1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-23 18:36:50 +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
###Version next
* Applied some material design guidelines to Charts and (pebble) app management
###Version 0.18.4
* Mi Band 2: Display realtime steps in Live Activity
* 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.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
/**
* Abstract base class for fragments. Provides hooks that are called when
@ -37,7 +36,6 @@ public abstract class AbstractGBFragment extends Fragment {
* @see #onMadeInvisibleInActivity()
*/
protected void onMadeVisibleInActivity() {
updateActivityTitle();
}
/**
@ -58,15 +56,6 @@ public abstract class AbstractGBFragment extends Fragment {
return mVisibleInactivity;
}
protected void updateActivityTitle() {
FragmentActivity activity = getActivity();
if (activity != null && !activity.isFinishing() && !activity.isDestroyed()) {
if (getTitle() != null) {
activity.setTitle(getTitle());
}
}
}
@Nullable
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.FragmentStatePagerAdapter;
import android.support.v4.content.LocalBroadcastManager;
import android.support.v4.view.PagerTabStrip;
import android.support.v4.view.ViewPager;
import android.support.v4.widget.SwipeRefreshLayout;
import android.view.Menu;
@ -67,7 +66,6 @@ public class ChartsActivity extends AbstractGBFragmentActivity implements Charts
private Date mStartDate;
private Date mEndDate;
private SwipeRefreshLayout swipeLayout;
private PagerTabStrip mPagerTabStrip;
private ViewPager viewPager;
LimitedQueue mActivityAmountCache = new LimitedQueue(60);
@ -200,7 +198,6 @@ public class ChartsActivity extends AbstractGBFragmentActivity implements Charts
handleNextButtonClicked();
}
});
mPagerTabStrip = (PagerTabStrip) findViewById(R.id.charts_pagerTabStrip);
LinearLayout mainLayout = (LinearLayout) findViewById(R.id.charts_main_layout);
}

View File

@ -1,56 +1,59 @@
<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"
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_height="match_parent">
<LinearLayout android:layout_width="match_parent"
android:orientation="vertical"
android:id="@+id/charts_main_layout"
android:layout_height="match_parent">
android:layout_height="match_parent"
tools:context="nodomain.freeyourgadget.gadgetbridge.activities.charts.ChartsActivity">
<LinearLayout
android:id="@+id/charts_date_bar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/charts_previous"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="&lt;" />
<TextView
android:id="@+id/charts_text_date"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="5"
android:text="Today"
/>
android:id="@+id/charts_main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<Button
android:id="@+id/charts_next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=">" />
</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.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
android:id="@+id/charts_date_bar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom" />
</android.support.v4.view.ViewPager>
android:gravity="fill_horizontal"
android:orientation="horizontal">
<Button
android:id="@+id/charts_previous"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="&lt;" />
</LinearLayout>
<TextView
android:id="@+id/charts_text_date"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:layout_weight="1"
android:text="Today" />
<Button
android:id="@+id/charts_next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=">" />
</LinearLayout>
</LinearLayout>
</android.support.v4.widget.SwipeRefreshLayout>

View File

@ -1,5 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<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">
<change>Mi Band 2: Display realtime steps in Live Activity</change>
<change>Mi Band: Attempt to recognize Mi Band model with hwVersion = 8</change>