Browse Source

Remove optional navbarcheck

Signed-off-by: alperozturk <alper_ozturk@proton.me>
alperozturk 1 year ago
parent
commit
2eadbad887

+ 1 - 5
app/src/main/java/com/nextcloud/client/editimage/EditImageActivity.kt

@@ -33,7 +33,6 @@ import androidx.core.graphics.drawable.DrawableCompat
 import com.canhub.cropper.CropImageView
 import com.canhub.cropper.CropImageView
 import com.nextcloud.client.di.Injectable
 import com.nextcloud.client.di.Injectable
 import com.nextcloud.utils.extensions.getParcelableArgument
 import com.nextcloud.utils.extensions.getParcelableArgument
-import com.nextcloud.utils.extensions.hasNavBar
 import com.nextcloud.utils.extensions.navBarHeight
 import com.nextcloud.utils.extensions.navBarHeight
 import com.nextcloud.utils.extensions.shiftUp
 import com.nextcloud.utils.extensions.shiftUp
 import com.owncloud.android.R
 import com.owncloud.android.R
@@ -103,10 +102,7 @@ class EditImageActivity :
         }
         }
 
 
         setupCropper()
         setupCropper()
-
-        if (resources.hasNavBar()) {
-            shiftLayout()
-        }
+        shiftLayout()
     }
     }
 
 
     private fun shiftLayout() {
     private fun shiftLayout() {

+ 0 - 9
app/src/main/java/com/nextcloud/utils/extensions/ResourcesExtensions.kt

@@ -34,12 +34,3 @@ fun Resources.navBarHeight(): Int {
         0
         0
     }
     }
 }
 }
-
-/**
- * This method only works in real device
- */
-@SuppressLint("DiscouragedApi")
-fun Resources.hasNavBar(): Boolean {
-    val id = getIdentifier("config_showNavigationBar", "bool", "android")
-    return id > 0 && getBoolean(id)
-}

+ 12 - 16
app/src/main/res/layout/activity_edit_image.xml

@@ -18,9 +18,11 @@
  You should have received a copy of the GNU Affero General Public License
  You should have received a copy of the GNU Affero General Public License
  along with this program. If not, see <https://www.gnu.org/licenses/>.
  along with this program. If not, see <https://www.gnu.org/licenses/>.
 -->
 -->
-<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:layout_width="match_parent"
     android:layout_width="match_parent"
+    android:orientation="vertical"
     android:layout_height="match_parent"
     android:layout_height="match_parent"
     android:background="@color/black">
     android:background="@color/black">
 
 
@@ -31,33 +33,27 @@
         android:background="@color/black"
         android:background="@color/black"
         android:elevation="4dp"
         android:elevation="4dp"
         android:minHeight="?attr/actionBarSize"
         android:minHeight="?attr/actionBarSize"
-        android:theme="@style/Theme.ownCloud.Toolbar.AppWidgetContainer"
-        app:layout_constraintTop_toTopOf="parent" />
+        android:theme="@style/Theme.ownCloud.Toolbar.AppWidgetContainer" />
 
 
     <com.canhub.cropper.CropImageView
     <com.canhub.cropper.CropImageView
         android:id="@+id/cropImageView"
         android:id="@+id/cropImageView"
-        android:layout_width="0dp"
-        android:layout_height="0dp"
-        android:layout_margin="0dp"
-        app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/toolbar" />
+        android:layout_gravity="center"
+        android:layout_weight="1"
+        android:layout_width="match_parent"
+        android:layout_height="0dp"/>
 
 
     <LinearLayout
     <LinearLayout
         android:id="@+id/edit_buttons_layout"
         android:id="@+id/edit_buttons_layout"
+        android:layout_gravity="center"
         android:layout_width="wrap_content"
         android:layout_width="wrap_content"
+        android:gravity="center_vertical"
         android:layout_height="wrap_content"
         android:layout_height="wrap_content"
-        android:layout_marginBottom="16dp"
         android:background="@drawable/rounded_rect"
         android:background="@drawable/rounded_rect"
         android:backgroundTint="@color/grey_900"
         android:backgroundTint="@color/grey_900"
         android:elevation="4dp"
         android:elevation="4dp"
         android:orientation="horizontal"
         android:orientation="horizontal"
         android:paddingLeft="8dp"
         android:paddingLeft="8dp"
-        android:paddingRight="8dp"
-        app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintStart_toStartOf="parent">
+        android:paddingRight="8dp">
 
 
         <ImageButton
         <ImageButton
             android:id="@+id/rotate_left"
             android:id="@+id/rotate_left"
@@ -109,4 +105,4 @@
             app:srcCompat="@drawable/outline_flip_24"
             app:srcCompat="@drawable/outline_flip_24"
             app:tint="@color/white" />
             app:tint="@color/white" />
     </LinearLayout>
     </LinearLayout>
-</androidx.constraintlayout.widget.ConstraintLayout>
+</LinearLayout>