Fetch a new access token in onCreate method of MainActivity when the old access token is about to expire, specifically, to expire within the next 5 minutes or is already expired to avoid refreshing the access token many times by other queries later.

This commit is contained in:
Alex Ning
2018-08-05 14:26:01 +08:00
parent c6026e5659
commit f2eb18749c
7 changed files with 91 additions and 22 deletions

View File

@@ -82,6 +82,7 @@
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_alignParentEnd="true"
android:layout_toStartOf="@id/subscriber_count_text_view_view_subreddit_detail_activity"
android:textColor="@android:color/black" />
</RelativeLayout>
@@ -102,9 +103,11 @@
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="@style/AppTheme.PopupOverlay" />
app:popupTheme="@style/AppTheme.PopupOverlay"
app:navigationIcon="?attr/homeAsUpIndicator" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_view_subreddit_detail" />

View File

@@ -19,7 +19,6 @@
<string name="profile">Profile</string>
<string name="following">Following</string>
<string name="subscriptions">Subscriptions</string>
<string name="title_activity_view_subreddit_detail">ViewSubredditDetailActivity</string>
<string name="subscribers_number_detail">Subscribers: %1$d</string>
<string name="online_subscribers_number_detail">Online: %1$d</string>
<string name="large_text">