1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-27 12:26:48 +01:00

Apply some Material design guidelines to the charts

- replace the PagerTabStrip with a TabLayout (moved to top and scrollable)
- move the date selection to the bottom
- do not update the activity title as the tab name is much more visible now
This commit is contained in:
Daniele Gobbetti 2017-04-01 17:47:54 +02:00
parent 9a0439c6e0
commit e89ba529c3
5 changed files with 54 additions and 57 deletions

View File

@ -1,5 +1,8 @@
###Changelog ###Changelog
###Version next
* Applied some material design guidelines to Charts and (pebble) app management
###Version 0.18.4 ###Version 0.18.4
* Mi Band 2: Display realtime steps in Live Activity * Mi Band 2: Display realtime steps in Live Activity
* Mi Band: Attempt to recognize Mi Band model with hwVersion = 8 * Mi Band: Attempt to recognize Mi Band model with hwVersion = 8

View File

@ -18,7 +18,6 @@ package nodomain.freeyourgadget.gadgetbridge.activities;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
/** /**
* Abstract base class for fragments. Provides hooks that are called when * Abstract base class for fragments. Provides hooks that are called when
@ -37,7 +36,6 @@ public abstract class AbstractGBFragment extends Fragment {
* @see #onMadeInvisibleInActivity() * @see #onMadeInvisibleInActivity()
*/ */
protected void onMadeVisibleInActivity() { protected void onMadeVisibleInActivity() {
updateActivityTitle();
} }
/** /**
@ -58,15 +56,6 @@ public abstract class AbstractGBFragment extends Fragment {
return mVisibleInactivity; return mVisibleInactivity;
} }
protected void updateActivityTitle() {
FragmentActivity activity = getActivity();
if (activity != null && !activity.isFinishing() && !activity.isDestroyed()) {
if (getTitle() != null) {
activity.setTitle(getTitle());
}
}
}
@Nullable @Nullable
protected abstract CharSequence getTitle(); protected abstract CharSequence getTitle();

View File

@ -27,7 +27,6 @@ import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter; import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.content.LocalBroadcastManager; import android.support.v4.content.LocalBroadcastManager;
import android.support.v4.view.PagerTabStrip;
import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager;
import android.support.v4.widget.SwipeRefreshLayout; import android.support.v4.widget.SwipeRefreshLayout;
import android.view.Menu; import android.view.Menu;
@ -67,7 +66,6 @@ public class ChartsActivity extends AbstractGBFragmentActivity implements Charts
private Date mStartDate; private Date mStartDate;
private Date mEndDate; private Date mEndDate;
private SwipeRefreshLayout swipeLayout; private SwipeRefreshLayout swipeLayout;
private PagerTabStrip mPagerTabStrip;
private ViewPager viewPager; private ViewPager viewPager;
LimitedQueue mActivityAmountCache = new LimitedQueue(60); LimitedQueue mActivityAmountCache = new LimitedQueue(60);
@ -200,7 +198,6 @@ public class ChartsActivity extends AbstractGBFragmentActivity implements Charts
handleNextButtonClicked(); handleNextButtonClicked();
} }
}); });
mPagerTabStrip = (PagerTabStrip) findViewById(R.id.charts_pagerTabStrip);
LinearLayout mainLayout = (LinearLayout) findViewById(R.id.charts_main_layout); LinearLayout mainLayout = (LinearLayout) findViewById(R.id.charts_main_layout);
} }

View File

@ -1,36 +1,52 @@
<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_swipe_layout" android:id="@+id/activity_swipe_layout"
tools:context="nodomain.freeyourgadget.gadgetbridge.activities.charts.ChartsActivity"
android:paddingLeft="0px"
android:paddingRight="0px"
android:paddingTop="0px"
android:paddingBottom="0px"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
tools:context="nodomain.freeyourgadget.gadgetbridge.activities.charts.ChartsActivity">
<LinearLayout android:layout_width="match_parent" <LinearLayout
android:orientation="vertical"
android:id="@+id/charts_main_layout" android:id="@+id/charts_main_layout"
android:layout_height="match_parent"> android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v4.view.ViewPager
android:id="@+id/charts_pager"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
tools:context="nodomain.freeyourgadget.gadgetbridge.activities.charts.ChartsActivity">
<android.support.design.widget.TabLayout
android:id="@+id/charts_pagerTabStrip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
app:tabMode="scrollable" />
</android.support.v4.view.ViewPager>
<LinearLayout <LinearLayout
android:id="@+id/charts_date_bar" android:id="@+id/charts_date_bar"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="fill_horizontal"
android:orientation="horizontal"> android:orientation="horizontal">
<Button <Button
android:id="@+id/charts_previous" android:id="@+id/charts_previous"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="&lt;" /> android:text="&lt;" />
<TextView <TextView
android:id="@+id/charts_text_date" android:id="@+id/charts_text_date"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="5" android:gravity="center_horizontal"
android:text="Today" android:layout_weight="1"
/> android:text="Today" />
<Button <Button
android:id="@+id/charts_next" android:id="@+id/charts_next"
@ -39,18 +55,5 @@
android:text=">" /> android:text=">" />
</LinearLayout> </LinearLayout>
</LinearLayout>
<android.support.v4.view.ViewPager android:id="@+id/charts_pager"
android:layout_width="match_parent" android:layout_height="match_parent"
tools:context="nodomain.freeyourgadget.gadgetbridge.activities.charts.ChartsActivity">
<android.support.v4.view.PagerTabStrip
android:id="@+id/charts_pagerTabStrip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom" />
</android.support.v4.view.ViewPager>
</LinearLayout>
</android.support.v4.widget.SwipeRefreshLayout> </android.support.v4.widget.SwipeRefreshLayout>

View File

@ -1,5 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<changelog> <changelog>
<release version="next">
<change>Applied some material design guidelines to Charts and (pebble) app management
</change>
</release>
<release version="0.18.4" versioncode="91"> <release version="0.18.4" versioncode="91">
<change>Mi Band 2: Display realtime steps in Live Activity</change> <change>Mi Band 2: Display realtime steps in Live Activity</change>
<change>Mi Band: Attempt to recognize Mi Band model with hwVersion = 8</change> <change>Mi Band: Attempt to recognize Mi Band model with hwVersion = 8</change>