Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6a044ae7 authored by jinwu's avatar jinwu Committed by Zhao Wei Liew
Browse files

CMFileManager: Modify disk usage graph's layout

Change the view's layout to a ScrollView, so when roating the DUT
from landscape to portrait, every single piece of info is shown.

Change-Id: Iedbef14dad5325056cbb560e98855593b5494c16
CRs-Fixed: 889743
parent de844c23
Loading
Loading
Loading
Loading
+108 −97
Original line number Diff line number Diff line
@@ -257,17 +257,27 @@
  </ScrollView>

  <!-- Disk Usage -->
  <LinearLayout
  <ScrollView
    android:id="@+id/filesystem_tab_diskusage"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/filesystem_tabs"
    android:scrollbars="vertical"
    android:visibility="gone" >

    <LinearLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:orientation="vertical">

      <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <com.cyanogenmod.filemanager.ui.widgets.DiskUsageGraph
          android:id="@+id/filesystem_disk_usage_graph"
          android:layout_width="0dip"
      android:layout_height="wrap_content"
          android:layout_height="match_parent"
          android:layout_weight=".30"
          android:layout_margin="@dimen/extra_large_margin" />

@@ -356,7 +366,6 @@
        android:gravity="center"
        android:layout_centerHorizontal="true"
        android:visibility="invisible"
    android:layout_below="@id/filesystem_tab_diskusage"
        android:orientation="horizontal"
        android:columnCount="4"
        android:columnOrderPreserved="true"
@@ -366,4 +375,6 @@
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>

    </LinearLayout>
  </ScrollView>
</RelativeLayout>
+12 −13
Original line number Diff line number Diff line
@@ -147,17 +147,6 @@ public class DiskUsageGraph extends View {
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        int parentWidth = MeasureSpec.getSize(widthMeasureSpec);
        int parentHeight = MeasureSpec.getSize(heightMeasureSpec);
        int size = Math.min(parentWidth, parentHeight);
        this.setMeasuredDimension(size, size);
    }

    @Override
    protected void onSizeChanged(int w, int h, int oldw, int oldh) {
        // Redraw the disk usage graph when layout size changes
@@ -330,9 +319,19 @@ public class DiskUsageGraph extends View {
         */
        @Override
        public void run() {
            //Get information about the drawing zone, and adjust the size
            final int width = getWidth();
            final int height = getHeight();
            if (width == 0 || height == 0) {
                return;
            }

            // Calculate the widget size using the width and height params
            Rect rect = new Rect();
            getDrawingRect(rect);
            final int diameter = Math.min(width, height);
            rect.left = (width - diameter) / 2;
            rect.right = rect.left + diameter;
            rect.top = (height - diameter) / 2;
            rect.bottom = rect.top + diameter;
            int stroke = (rect.width() / 2) / 2;
            rect.left += stroke / 2;
            rect.right -= stroke / 2;