瀏覽代碼

Fix layout issues

Mario Danic 8 年之前
父節點
當前提交
3c68e865e2

+ 16 - 0
src/main/java/com/owncloud/android/ui/fragment/ExtendedListFragment.java

@@ -48,6 +48,7 @@ import android.widget.GridView;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
 import android.widget.ProgressBar;
+import android.widget.RelativeLayout;
 import android.widget.TextView;
 
 import com.getbase.floatingactionbutton.FloatingActionButton;
@@ -391,6 +392,21 @@ public class ExtendedListFragment extends Fragment
         mFabMkdir = (FloatingActionButton) v.findViewById(R.id.fab_mkdir);
         mFabUploadFromApp = (FloatingActionButton) v.findViewById(R.id.fab_upload_from_app);
 
+        boolean searchSupported = AccountUtils.hasSearchSupport(AccountUtils.
+                getCurrentOwnCloudAccount(MainApp.getAppContext()));
+
+        if (getResources().getBoolean(R.bool.bottom_toolbar_enabled) && searchSupported) {
+            RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) mFabMain.getLayoutParams();
+            final float scale = v.getResources().getDisplayMetrics().density;
+
+            BottomNavigationView bottomNavigationView = (BottomNavigationView)
+                    v.findViewById(R.id.bottom_navigation_view);
+
+            // convert the DP into pixel
+            int pixel =  (int)(32 * scale + 0.5f);
+            layoutParams.setMargins(0, 0, pixel/2, bottomNavigationView.getMeasuredHeight() + pixel * 2);
+        }
+
         mCurrentListView = mListView;   // list by default
         if (savedInstanceState != null) {
 

+ 2 - 3
src/main/res/layout/list_fragment.xml

@@ -22,7 +22,7 @@
                 android:layout_width="match_parent"
                 android:layout_height="match_parent">
 
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:id="@+id/list_fragment_layout">
@@ -82,7 +82,7 @@
     </android.support.v4.widget.SwipeRefreshLayout>
 
 
-</FrameLayout>
+</android.support.design.widget.CoordinatorLayout>
 
     <com.getbase.floatingactionbutton.FloatingActionsMenu
         android:id="@+id/fab_main"
@@ -135,7 +135,6 @@
     <android.support.design.widget.BottomNavigationView
         android:id="@+id/bottom_navigation_view"
         android:visibility="gone"
-        android:layout_below="@+id/fab_main"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_gravity="bottom"