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