Use gridlayout from support library
Add gridlayout dependency and use it instead of heavily nested linearlayouts (fragment_live_activity) or to simplify existing grid layouts.
This commit is contained in:
parent
41feb008a7
commit
44d2384aec
|
@ -68,6 +68,7 @@ dependencies {
|
|||
compile 'com.android.support:cardview-v7:25.3.1'
|
||||
compile 'com.android.support:recyclerview-v7:25.3.1'
|
||||
compile 'com.android.support:support-v4:25.3.1'
|
||||
compile 'com.android.support:gridlayout-v7:25.3.1'
|
||||
compile 'com.android.support:design:25.3.1'
|
||||
compile 'com.github.tony19:logback-android-classic:1.1.1-6'
|
||||
compile 'org.slf4j:slf4j-api:1.7.7'
|
||||
|
|
|
@ -6,53 +6,51 @@
|
|||
|
||||
<ScrollView
|
||||
android:id="@+id/scrollView2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
<android.support.v7.widget.GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:grid="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin">
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
grid:alignmentMode="alignBounds"
|
||||
grid:columnCount="2">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="fill_horizontal"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="2">
|
||||
<Button
|
||||
android:id="@+id/exportDBButton"
|
||||
style="@style/Widget.AppCompat.Button.Colored"
|
||||
android:text="Export DB"
|
||||
grid:layout_column="0"
|
||||
grid:layout_gravity="center" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/exportDBButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
<Button
|
||||
android:id="@+id/importDBButton"
|
||||
style="@style/Widget.AppCompat.Button.Colored"
|
||||
android:text="Import DB"
|
||||
grid:layout_gravity="center"
|
||||
grid:layout_column="1" />
|
||||
|
||||
android:text="Export DB" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/importDBButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Import DB" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/db_management_intro"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/activity_db_management_import_export_explanation"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
grid:layout_columnSpan="2"
|
||||
grid:layout_columnWeight="1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/activity_db_management_path"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
grid:layout_columnSpan="2"
|
||||
grid:layout_columnWeight="1" />
|
||||
|
||||
|
||||
<TextView
|
||||
|
@ -62,23 +60,18 @@
|
|||
android:layout_marginTop="40dp"
|
||||
android:text="@string/activity_db_management_merge_old_title"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="@color/accent" />
|
||||
android:textColor="@color/accent"
|
||||
grid:layout_columnSpan="2"
|
||||
grid:layout_columnWeight="1" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
||||
<Button
|
||||
android:id="@+id/deleteOldActivityDB"
|
||||
style="@style/Widget.AppCompat.Button.Colored"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="fill_horizontal"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="2">
|
||||
|
||||
<Button
|
||||
android:id="@+id/deleteOldActivityDB"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="fill_horizontal"
|
||||
android:layout_weight="1"
|
||||
android:text="Delete old DB" />
|
||||
</LinearLayout>
|
||||
android:layout_weight="1"
|
||||
android:text="Delete old DB" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/emptyDBText"
|
||||
|
@ -86,16 +79,19 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="40dp"
|
||||
android:text="Warning! By pushing this button you will wipe your database and start from scratch."
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
grid:layout_columnSpan="2"
|
||||
grid:layout_columnWeight="1" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/emptyDBButton"
|
||||
style="@style/Widget.AppCompat.Button.Colored"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Empty DB" />
|
||||
|
||||
</android.support.v7.widget.GridLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
</RelativeLayout>
|
||||
|
|
|
@ -2,10 +2,6 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context="nodomain.freeyourgadget.gadgetbridge.activities.ControlCenterv2">
|
||||
|
||||
<ScrollView
|
||||
|
@ -17,21 +13,23 @@
|
|||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true">
|
||||
|
||||
<GridLayout
|
||||
<android.support.v7.widget.GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:grid="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:alignmentMode="alignMargins"
|
||||
android:columnCount="2"
|
||||
android:rowCount="15">
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
grid:alignmentMode="alignMargins"
|
||||
grid:columnCount="2">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_column="0"
|
||||
android:layout_columnSpan="2"
|
||||
android:layout_gravity="fill_horizontal"
|
||||
android:layout_row="0"
|
||||
grid:layout_columnSpan="2"
|
||||
grid:layout_gravity="fill_horizontal"
|
||||
android:text="Message / Caller"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||
|
||||
|
@ -39,10 +37,8 @@
|
|||
android:id="@+id/editContent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_column="0"
|
||||
android:layout_columnSpan="2"
|
||||
android:layout_gravity="fill_horizontal"
|
||||
android:layout_row="1"
|
||||
grid:layout_columnSpan="2"
|
||||
grid:layout_gravity="fill_horizontal"
|
||||
android:ems="10"
|
||||
android:inputType="textMultiLine"
|
||||
android:text="Test" />
|
||||
|
@ -51,116 +47,92 @@
|
|||
android:id="@+id/sendTypeSpinner"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_column="0"
|
||||
android:layout_gravity="fill_horizontal"
|
||||
android:layout_row="2"
|
||||
android:layout_columnSpan="2"
|
||||
grid:layout_gravity="fill_horizontal"
|
||||
grid:layout_columnSpan="2"
|
||||
android:text="send as SMS" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/sendButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_column="0"
|
||||
android:layout_columnSpan="2"
|
||||
android:layout_gravity="fill_horizontal"
|
||||
android:layout_row="3"
|
||||
grid:layout_columnSpan="2"
|
||||
grid:layout_gravity="fill_horizontal"
|
||||
android:text="Send" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/incomingCallButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_column="0"
|
||||
android:layout_gravity="fill_horizontal"
|
||||
android:layout_row="4"
|
||||
grid:layout_gravity="fill_horizontal"
|
||||
android:text="incoming call" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/outgoingCallButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_column="1"
|
||||
android:layout_gravity="fill_horizontal"
|
||||
android:layout_row="4"
|
||||
grid:layout_gravity="fill_horizontal"
|
||||
android:text="outgoing call" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/startCallButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_column="0"
|
||||
android:layout_gravity="fill_horizontal"
|
||||
android:layout_row="5"
|
||||
grid:layout_gravity="fill_horizontal"
|
||||
android:text="start call" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/endCallButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_column="1"
|
||||
android:layout_gravity="fill_horizontal"
|
||||
android:layout_row="5"
|
||||
grid:layout_gravity="fill_horizontal"
|
||||
android:text="end call" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/setTimeButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_column="0"
|
||||
android:layout_gravity="fill_horizontal"
|
||||
android:layout_row="6"
|
||||
grid:layout_gravity="fill_horizontal"
|
||||
android:text="set time" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/setMusicInfoButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_column="1"
|
||||
android:layout_gravity="fill_horizontal"
|
||||
android:layout_row="6"
|
||||
grid:layout_gravity="fill_horizontal"
|
||||
android:text="set music info" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/HearRateButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_column="0"
|
||||
android:layout_columnSpan="2"
|
||||
android:layout_gravity="fill_horizontal"
|
||||
android:layout_row="7"
|
||||
grid:layout_columnSpan="2"
|
||||
grid:layout_gravity="fill_horizontal"
|
||||
android:text="Heart Rate Test" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/rebootButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_column="0"
|
||||
android:layout_columnSpan="2"
|
||||
android:layout_gravity="fill_horizontal"
|
||||
android:layout_row="8"
|
||||
grid:layout_columnSpan="2"
|
||||
grid:layout_gravity="fill_horizontal"
|
||||
android:text="reboot" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/testNotificationButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_column="0"
|
||||
android:layout_columnSpan="2"
|
||||
android:layout_gravity="fill_horizontal"
|
||||
android:layout_row="9"
|
||||
grid:layout_columnSpan="2"
|
||||
grid:layout_gravity="fill_horizontal"
|
||||
android:text="create test notification" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/testNewFunctionality"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_column="0"
|
||||
android:layout_columnSpan="2"
|
||||
android:layout_gravity="fill_horizontal"
|
||||
android:layout_row="10"
|
||||
grid:layout_columnSpan="2"
|
||||
grid:layout_gravity="fill_horizontal"
|
||||
android:text="Test New Functionality" />
|
||||
</GridLayout>
|
||||
</android.support.v7.widget.GridLayout>
|
||||
</ScrollView>
|
||||
|
||||
</RelativeLayout>
|
||||
|
|
|
@ -1,28 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
<android.support.v7.widget.GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:grid="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
grid:columnCount="2">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="20">
|
||||
<nodomain.freeyourgadget.gadgetbridge.activities.charts.CustomBarChart
|
||||
android:id="@+id/livechart_steps_per_minute_current"
|
||||
grid:layout_columnWeight="1"
|
||||
grid:layout_rowWeight="1"></nodomain.freeyourgadget.gadgetbridge.activities.charts.CustomBarChart>
|
||||
|
||||
<nodomain.freeyourgadget.gadgetbridge.activities.charts.CustomBarChart
|
||||
android:id="@+id/livechart_steps_per_minute_current"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="20"></nodomain.freeyourgadget.gadgetbridge.activities.charts.CustomBarChart>
|
||||
<nodomain.freeyourgadget.gadgetbridge.activities.charts.CustomBarChart
|
||||
android:id="@+id/livechart_steps_total"
|
||||
grid:layout_columnWeight="1"
|
||||
grid:layout_rowWeight="1"></nodomain.freeyourgadget.gadgetbridge.activities.charts.CustomBarChart>
|
||||
|
||||
<nodomain.freeyourgadget.gadgetbridge.activities.charts.CustomBarChart
|
||||
android:id="@+id/livechart_steps_total"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="20"></nodomain.freeyourgadget.gadgetbridge.activities.charts.CustomBarChart>
|
||||
|
||||
<!--
|
||||
<!--
|
||||
<com.github.mikephil.charting.charts.PieChart
|
||||
android:id="@+id/livechart_steps_total"
|
||||
android:layout_width="fill_parent"
|
||||
|
@ -37,13 +30,12 @@
|
|||
android:layout_weight="20">
|
||||
</com.github.mikephil.charting.charts.PieChart>
|
||||
-->
|
||||
</LinearLayout>
|
||||
|
||||
<com.github.mikephil.charting.charts.LineChart
|
||||
android:id="@+id/livechart_steps_per_minute_history"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="20"></com.github.mikephil.charting.charts.LineChart>
|
||||
grid:layout_columnSpan="2"
|
||||
grid:layout_columnWeight="1"
|
||||
grid:layout_rowWeight="1"></com.github.mikephil.charting.charts.LineChart>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.GridLayout>
|
||||
|
|
Loading…
Reference in New Issue