aboutsummaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2019-09-14 03:11:39 +0000
committerAlex Ning <chineseperson5@gmail.com>2019-09-14 03:11:39 +0000
commit2f15383718c72246581b1f70cb61ffb9bd12e6db (patch)
tree69b272463d62cb6c1a767574e13da3e0940a9154 /app/src
parent6f24ac8cf5731e6e13ad767e6639ca2d67611985 (diff)
downloadinfinity-for-reddit-2f15383718c72246581b1f70cb61ffb9bd12e6db.tar
infinity-for-reddit-2f15383718c72246581b1f70cb61ffb9bd12e6db.tar.gz
infinity-for-reddit-2f15383718c72246581b1f70cb61ffb9bd12e6db.tar.bz2
infinity-for-reddit-2f15383718c72246581b1f70cb61ffb9bd12e6db.tar.lz
infinity-for-reddit-2f15383718c72246581b1f70cb61ffb9bd12e6db.tar.xz
infinity-for-reddit-2f15383718c72246581b1f70cb61ffb9bd12e6db.tar.zst
infinity-for-reddit-2f15383718c72246581b1f70cb61ffb9bd12e6db.zip
Fix status bar and navbar icon color in MainActivity.
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java34
-rw-r--r--app/src/main/res/drawable/ic_outline_check_circle_outline_white_24px.xml9
-rw-r--r--app/src/main/res/menu/main_activity.xml20
-rw-r--r--app/src/main/res/values/strings.xml1
4 files changed, 58 insertions, 6 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java
index dc1bbb99..e62b164d 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java
@@ -168,6 +168,8 @@ public class MainActivity extends AppCompatActivity implements SortTypeBottomShe
EventBus.getDefault().register(this);
+ getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
Resources resources = getResources();
@@ -299,12 +301,20 @@ public class MainActivity extends AppCompatActivity implements SortTypeBottomShe
mNewAccountName = null;
if(newAccount == null) {
mNullAccessToken = true;
+
+ if(mMenu != null) {
+ mMenu.findItem(R.id.action_subscriptions_main_activity).setVisible(false);
+ }
} else {
mAccessToken = newAccount.getAccessToken();
mAccountName = newAccount.getUsername();
mProfileImageUrl = newAccount.getProfileImageUrl();
mBannerImageUrl = newAccount.getBannerImageUrl();
mKarma = newAccount.getKarma();
+
+ if(mMenu != null) {
+ mMenu.findItem(R.id.action_subscriptions_main_activity).setVisible(true);
+ }
}
if(enableNotification) {
@@ -333,6 +343,10 @@ public class MainActivity extends AppCompatActivity implements SortTypeBottomShe
mBannerImageUrl = account.getBannerImageUrl();
mKarma = account.getKarma();
+ if(mMenu != null) {
+ mMenu.findItem(R.id.action_subscriptions_main_activity).setVisible(true);
+ }
+
if(enableNotification) {
Constraints constraints = new Constraints.Builder()
.setRequiredNetworkType(NetworkType.CONNECTED)
@@ -355,12 +369,20 @@ public class MainActivity extends AppCompatActivity implements SortTypeBottomShe
} else {
if(account == null) {
mNullAccessToken = true;
+
+ if(mMenu != null) {
+ mMenu.findItem(R.id.action_subscriptions_main_activity).setVisible(false);
+ }
} else {
mAccessToken = account.getAccessToken();
mAccountName = account.getUsername();
mProfileImageUrl = account.getProfileImageUrl();
mBannerImageUrl = account.getBannerImageUrl();
mKarma = account.getKarma();
+
+ if(mMenu != null) {
+ mMenu.findItem(R.id.action_subscriptions_main_activity).setVisible(true);
+ }
}
if(enableNotification) {
@@ -679,6 +701,14 @@ public class MainActivity extends AppCompatActivity implements SortTypeBottomShe
getMenuInflater().inflate(R.menu.main_activity, menu);
mMenu = menu;
MenuItem lazyModeItem = mMenu.findItem(R.id.action_lazy_mode_main_activity);
+ MenuItem subscriptionsItem = mMenu.findItem(R.id.action_subscriptions_main_activity);
+
+ if(mAccessToken != null) {
+ subscriptionsItem.setVisible(true);
+ } else {
+ subscriptionsItem.setVisible(false);
+ }
+
if(isInLazyMode) {
lazyModeItem.setTitle(R.string.action_stop_lazy_mode);
params.setScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_NO_SCROLL);
@@ -695,6 +725,10 @@ public class MainActivity extends AppCompatActivity implements SortTypeBottomShe
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()) {
+ case R.id.action_subscriptions_main_activity:
+ Intent subscriptionsIntent = new Intent(this, SubscribedThingListingActivity.class);
+ startActivity(subscriptionsIntent);
+ return true;
case R.id.action_sort_main_activity:
if(viewPager.getCurrentItem() == 1 ||viewPager.getCurrentItem() == 2) {
popularAndAllSortTypeBottomSheetFragment.show(getSupportFragmentManager(), popularAndAllSortTypeBottomSheetFragment.getTag());
diff --git a/app/src/main/res/drawable/ic_outline_check_circle_outline_white_24px.xml b/app/src/main/res/drawable/ic_outline_check_circle_outline_white_24px.xml
new file mode 100644
index 00000000..191a8e4c
--- /dev/null
+++ b/app/src/main/res/drawable/ic_outline_check_circle_outline_white_24px.xml
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8zM16.59,7.58L10,14.17l-2.59,-2.58L6,13l4,4 8,-8z"/>
+</vector>
diff --git a/app/src/main/res/menu/main_activity.xml b/app/src/main/res/menu/main_activity.xml
index 3ab9d924..e69f976b 100644
--- a/app/src/main/res/menu/main_activity.xml
+++ b/app/src/main/res/menu/main_activity.xml
@@ -4,11 +4,12 @@
xmlns:tools="http://schemas.android.com/tools"
tools:application="ml.docilealligator.infinityforreddit.MainActivity">
<item
- android:id="@+id/action_sort_main_activity"
+ android:id="@+id/action_subscriptions_main_activity"
android:orderInCategory="1"
- android:title="@string/action_sort"
- android:icon="@drawable/ic_outline_sort_24px"
- app:showAsAction="ifRoom" />
+ android:title="@string/action_subscriptions"
+ android:icon="@drawable/ic_outline_check_circle_outline_white_24px"
+ app:showAsAction="ifRoom"
+ android:visible="false"/>
<item
android:id="@+id/action_search_main_activity"
@@ -18,14 +19,21 @@
app:showAsAction="ifRoom" />
<item
- android:id="@+id/action_refresh_main_activity"
+ android:id="@+id/action_sort_main_activity"
android:orderInCategory="3"
+ android:title="@string/action_sort"
+ android:icon="@drawable/ic_outline_sort_24px"
+ app:showAsAction="ifRoom" />
+
+ <item
+ android:id="@+id/action_refresh_main_activity"
+ android:orderInCategory="4"
android:title="@string/action_refresh"
app:showAsAction="never" />
<item
android:id="@+id/action_lazy_mode_main_activity"
- android:orderInCategory="4"
+ android:orderInCategory="5"
android:title="@string/action_start_lazy_mode"
app:showAsAction="never" />
</menu> \ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index afd0cc44..a029821d 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -30,6 +30,7 @@
<string name="action_stop_lazy_mode">Stop Lazy Mode</string>
<string name="action_send">Send</string>
<string name="action_sort">Sort</string>
+ <string name="action_subscriptions">Subscriptions</string>
<string name="action_hide_post">Hide Post</string>
<string name="action_unhide_post">Unhide Post</string>
<string name="action_edit_post">Edit Post</string>