aboutsummaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2020-02-19 08:27:05 +0000
committerAlex Ning <chineseperson5@gmail.com>2020-02-19 08:27:05 +0000
commit9f8713979411a27caee062b77f893617029b3d67 (patch)
treee34d4ee42019cc8797ce1b20475f5330c05f6701 /app/src
parent61cc6089faea9d66ee8e8149f0d10c8a17b1676a (diff)
downloadinfinity-for-reddit-9f8713979411a27caee062b77f893617029b3d67.tar
infinity-for-reddit-9f8713979411a27caee062b77f893617029b3d67.tar.gz
infinity-for-reddit-9f8713979411a27caee062b77f893617029b3d67.tar.bz2
infinity-for-reddit-9f8713979411a27caee062b77f893617029b3d67.tar.lz
infinity-for-reddit-9f8713979411a27caee062b77f893617029b3d67.tar.xz
infinity-for-reddit-9f8713979411a27caee062b77f893617029b3d67.tar.zst
infinity-for-reddit-9f8713979411a27caee062b77f893617029b3d67.zip
The new nav bar is now fully functional. Fix wrong icon color in dark theme.
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java40
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/AccountRecyclerViewAdapter.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/NavigationDrawerRecyclerViewAdapter.java260
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/SubscribedSubredditsListingFragment.java9
-rw-r--r--app/src/main/res/drawable-night/ic_anonymous_24dp.xml9
-rw-r--r--app/src/main/res/drawable-night/ic_log_out_24dp.xml9
-rw-r--r--app/src/main/res/drawable-night/ic_outline_add_circle_outline_24dp.xml9
-rw-r--r--app/src/main/res/drawable/ic_anonymous_24dp.xml (renamed from app/src/main/res/drawable/ic_outline_public_24px.xml)0
-rw-r--r--app/src/main/res/drawable/ic_log_out_24dp.xml (renamed from app/src/main/res/drawable/ic_outline_block_24px.xml)0
-rw-r--r--app/src/main/res/drawable/ic_outline_add_circle_outline_24dp.xml (renamed from app/src/main/res/drawable/ic_outline_add_circle_outline_24px.xml)0
-rw-r--r--app/src/main/res/layout/item_nav_drawer_account.xml (renamed from app/src/main/res/layout/item_account.xml)0
11 files changed, 263 insertions, 81 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java
index eba098b1..4148993f 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java
@@ -66,6 +66,7 @@ import ml.docilealligator.infinityforreddit.AppBarStateChangeListener;
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
import ml.docilealligator.infinityforreddit.AsyncTask.InsertSubscribedThingsAsyncTask;
import ml.docilealligator.infinityforreddit.AsyncTask.SwitchAccountAsyncTask;
+import ml.docilealligator.infinityforreddit.AsyncTask.SwitchToAnonymousAccountAsyncTask;
import ml.docilealligator.infinityforreddit.Event.ChangeConfirmToExitEvent;
import ml.docilealligator.infinityforreddit.Event.ChangeLockBottomAppBarEvent;
import ml.docilealligator.infinityforreddit.Event.ChangeNSFWEvent;
@@ -540,6 +541,11 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
intent.putExtra(AccountPostsActivity.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_GILDED);
break;
case R.string.light_theme:
+ mSharedPreferences.edit().putString(SharedPreferencesUtils.THEME_KEY, "0").apply();
+ AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
+ getTheme().applyStyle(R.style.Theme_Default, true);
+ break;
+ case R.string.dark_theme:
mSharedPreferences.edit().putString(SharedPreferencesUtils.THEME_KEY, "1").apply();
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
if(mSharedPreferences.getBoolean(SharedPreferencesUtils.AMOLED_DARK_KEY, false)) {
@@ -548,13 +554,28 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
getTheme().applyStyle(R.style.Theme_Default_NormalDark, true);
}
break;
- case R.string.dark_theme:
- mSharedPreferences.edit().putString(SharedPreferencesUtils.THEME_KEY, "0").apply();
- AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
- getTheme().applyStyle(R.style.Theme_Default, true);
- break;
case R.string.settings:
intent = new Intent(MainActivity.this, SettingsActivity.class);
+ break;
+ case R.string.add_account:
+ Intent addAccountIntent = new Intent(MainActivity.this, LoginActivity.class);
+ startActivityForResult(addAccountIntent, LOGIN_ACTIVITY_REQUEST_CODE);
+ break;
+ case R.string.anonymous_account:
+ new SwitchToAnonymousAccountAsyncTask(mRedditDataRoomDatabase, false,
+ () -> {
+ Intent anonymousIntent = new Intent(MainActivity.this, MainActivity.class);
+ startActivity(anonymousIntent);
+ finish();
+ }).execute();
+ break;
+ case R.string.log_out:
+ new SwitchToAnonymousAccountAsyncTask(mRedditDataRoomDatabase, true,
+ () -> {
+ Intent logOutIntent = new Intent(MainActivity.this, MainActivity.class);
+ startActivity(logOutIntent);
+ finish();
+ }).execute();
}
if (intent != null) {
@@ -569,6 +590,15 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
intent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, subredditName);
startActivity(intent);
}
+
+ @Override
+ public void onAccountClick(String accountName) {
+ new SwitchAccountAsyncTask(mRedditDataRoomDatabase, accountName, newAccount -> {
+ Intent intent = new Intent(MainActivity.this, MainActivity.class);
+ startActivity(intent);
+ finish();
+ }).execute();
+ }
});
navDrawerRecyclerView.setLayoutManager(new LinearLayoutManager(this));
navDrawerRecyclerView.setAdapter(adapter);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/AccountRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/AccountRecyclerViewAdapter.java
index 3900bb0e..2476a1b6 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/AccountRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/AccountRecyclerViewAdapter.java
@@ -39,7 +39,7 @@ public class AccountRecyclerViewAdapter extends RecyclerView.Adapter<AccountRecy
@NonNull
@Override
public AccountViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
- return new AccountViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_account, parent, false));
+ return new AccountViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_nav_drawer_account, parent, false));
}
@Override
@@ -63,21 +63,21 @@ public class AccountRecyclerViewAdapter extends RecyclerView.Adapter<AccountRecy
});
} else if (position == mAccounts.size()) {
holder.profileImageGifImageView.setColorFilter(ContextCompat.getColor(mContext, R.color.primaryTextColor), android.graphics.PorterDuff.Mode.SRC_IN);
- mGlide.load(R.drawable.ic_outline_add_circle_outline_24px)
+ mGlide.load(R.drawable.ic_outline_add_circle_outline_24dp)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(128, 0)))
.into(holder.profileImageGifImageView);
holder.usernameTextView.setText(R.string.add_account);
holder.itemView.setOnClickListener(view -> mItemSelectedListener.addAccountSelected());
} else if (position == mAccounts.size() + 1) {
holder.profileImageGifImageView.setColorFilter(ContextCompat.getColor(mContext, R.color.primaryTextColor), android.graphics.PorterDuff.Mode.SRC_IN);
- mGlide.load(R.drawable.ic_outline_public_24px)
+ mGlide.load(R.drawable.ic_anonymous_24dp)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(128, 0)))
.into(holder.profileImageGifImageView);
holder.usernameTextView.setText(R.string.anonymous_account);
holder.itemView.setOnClickListener(view -> mItemSelectedListener.anonymousSelected());
} else {
holder.profileImageGifImageView.setColorFilter(ContextCompat.getColor(mContext, R.color.primaryTextColor), android.graphics.PorterDuff.Mode.SRC_IN);
- mGlide.load(R.drawable.ic_outline_block_24px)
+ mGlide.load(R.drawable.ic_log_out_24dp)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(128, 0)))
.into(holder.profileImageGifImageView);
holder.usernameTextView.setText(R.string.log_out);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/NavigationDrawerRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/NavigationDrawerRecyclerViewAdapter.java
index 2d6cd5bd..d852efbf 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/NavigationDrawerRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/NavigationDrawerRecyclerViewAdapter.java
@@ -28,9 +28,11 @@ import ml.docilealligator.infinityforreddit.SubscribedSubredditDatabase.Subscrib
import pl.droidsonroids.gif.GifImageView;
public class NavigationDrawerRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
+
public interface ItemClickListener {
void onMenuClick(int stringId);
void onSubscribedSubredditClick(String subredditName);
+ void onAccountClick(String accountName);
}
private static final int VIEW_TYPE_NAV_HEADER = 0;
@@ -38,6 +40,7 @@ public class NavigationDrawerRecyclerViewAdapter extends RecyclerView.Adapter<Re
private static final int VIEW_TYPE_MENU_ITEM = 2;
private static final int VIEW_TYPE_DIVIDER = 3;
private static final int VIEW_TYPE_SUBSCRIBED_SUBREDDIT = 4;
+ private static final int VIEW_TYPE_ACCOUNT = 5;
private static final int CURRENT_MENU_ITEMS = 15;
private Context context;
@@ -68,21 +71,36 @@ public class NavigationDrawerRecyclerViewAdapter extends RecyclerView.Adapter<Re
@Override
public int getItemViewType(int position) {
- if (isLoggedIn) {
- if (position >= 15) {
- return VIEW_TYPE_SUBSCRIBED_SUBREDDIT;
- } else if (position == 0) {
- return VIEW_TYPE_NAV_HEADER;
- } else if (position == 1 || position == 6) {
- return VIEW_TYPE_MENU_GROUP_TITLE;
- } else if (position == 12) {
- return VIEW_TYPE_DIVIDER;
+ if (isInMainPage) {
+ if (isLoggedIn) {
+ if (position >= 15) {
+ return VIEW_TYPE_SUBSCRIBED_SUBREDDIT;
+ } else if (position == 0) {
+ return VIEW_TYPE_NAV_HEADER;
+ } else if (position == 1 || position == 6) {
+ return VIEW_TYPE_MENU_GROUP_TITLE;
+ } else if (position == 12) {
+ return VIEW_TYPE_DIVIDER;
+ } else {
+ return VIEW_TYPE_MENU_ITEM;
+ }
} else {
- return VIEW_TYPE_MENU_ITEM;
+ if (position == 0) {
+ return VIEW_TYPE_NAV_HEADER;
+ } else {
+ return VIEW_TYPE_MENU_ITEM;
+ }
}
} else {
if (position == 0) {
return VIEW_TYPE_NAV_HEADER;
+ }
+ if (accounts != null) {
+ if (position > accounts.size()) {
+ return VIEW_TYPE_MENU_ITEM;
+ } else {
+ return VIEW_TYPE_ACCOUNT;
+ }
} else {
return VIEW_TYPE_MENU_ITEM;
}
@@ -105,6 +123,9 @@ public class NavigationDrawerRecyclerViewAdapter extends RecyclerView.Adapter<Re
case VIEW_TYPE_DIVIDER:
return new DividerViewHolder(LayoutInflater.from(parent.getContext())
.inflate(R.layout.item_nav_drawer_divider, parent, false));
+ case VIEW_TYPE_ACCOUNT:
+ return new AccountViewHolder(LayoutInflater.from(parent.getContext())
+ .inflate(R.layout.item_nav_drawer_account, parent, false));
default:
return new SubscribedThingViewHolder(LayoutInflater.from(parent.getContext())
.inflate(R.layout.item_nav_drawer_subscribed_thing, parent, false));
@@ -135,6 +156,9 @@ public class NavigationDrawerRecyclerViewAdapter extends RecyclerView.Adapter<Re
} else {
((NavHeaderViewHolder) holder).karmaTextView.setText(R.string.press_here_to_login);
((NavHeaderViewHolder) holder).accountNameTextView.setText(R.string.anonymous_account);
+ glide.load(R.drawable.subreddit_default_icon)
+ .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(144, 0)))
+ .into(((NavHeaderViewHolder) holder).profileImageView);
}
if (isInMainPage) {
@@ -145,11 +169,31 @@ public class NavigationDrawerRecyclerViewAdapter extends RecyclerView.Adapter<Re
((NavHeaderViewHolder) holder).itemView.setOnClickListener(view -> {
if (isInMainPage) {
- isInMainPage = false;
((NavHeaderViewHolder) holder).dropIconImageView.setImageDrawable(resources.getDrawable(R.drawable.ic_baseline_arrow_drop_up_24px));
+ notifyItemRangeRemoved(1, getItemCount() - 1);
+ if (accounts != null) {
+ notifyItemRangeInserted(1, accounts.size() + 3);
+ } else {
+ if (isLoggedIn) {
+ notifyItemRangeInserted(1, 3);
+ } else {
+ notifyItemInserted(1);
+ }
+ }
+ isInMainPage = false;
} else {
- isInMainPage = true;
((NavHeaderViewHolder) holder).dropIconImageView.setImageDrawable(resources.getDrawable(R.drawable.ic_baseline_arrow_drop_down_24px));
+ notifyItemRangeRemoved(1, getItemCount() - 1);
+ if (isLoggedIn) {
+ if (subscribedSubreddits != null) {
+ notifyItemRangeInserted(1, subscribedSubreddits.size() + CURRENT_MENU_ITEMS - 1);
+ } else {
+ notifyItemRangeInserted(1, CURRENT_MENU_ITEMS - 1);
+ }
+ } else {
+ notifyItemRangeInserted(1, 2);
+ }
+ isInMainPage = true;
}
});
} else if (holder instanceof MenuGroupTitleViewHolder) {
@@ -162,63 +206,100 @@ public class NavigationDrawerRecyclerViewAdapter extends RecyclerView.Adapter<Re
int stringId = 0;
int drawableId = 0;
- switch (position) {
- case 2:
- stringId = R.string.profile;
- drawableId = R.drawable.ic_account_circle_24dp;
- break;
- case 3:
- stringId = R.string.subscriptions;
- drawableId = R.drawable.ic_subscritptions_bottom_app_bar_24dp;
- break;
- case 4:
- stringId = R.string.multi_reddit;
- drawableId = R.drawable.ic_multi_reddit_24dp;
- break;
- case 5:
- stringId = R.string.inbox;
- drawableId = R.drawable.ic_inbox_24dp;
- break;
- case 7:
- stringId = R.string.upvoted;
- drawableId = R.drawable.ic_arrow_upward_black_24dp;
- break;
- case 8:
- stringId = R.string.downvoted;
- drawableId = R.drawable.ic_arrow_downward_black_24dp;
- break;
- case 9:
- stringId = R.string.hidden;
- drawableId = R.drawable.ic_outline_lock_24dp;
- break;
- case 10:
- stringId = R.string.saved;
- drawableId = R.drawable.ic_outline_bookmarks_24dp;
- break;
- case 11:
- stringId = R.string.gilded;
- drawableId = R.drawable.ic_star_border_24dp;
- break;
- case 13:
- if ((resources.getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) {
- stringId = R.string.dark_theme;
- drawableId = R.drawable.ic_dark_theme_24dp;
- } else {
- stringId = R.string.light_theme;
- drawableId = R.drawable.ic_light_theme_24dp;
+ if (isInMainPage) {
+ if (isLoggedIn) {
+ switch (position) {
+ case 2:
+ stringId = R.string.profile;
+ drawableId = R.drawable.ic_account_circle_24dp;
+ break;
+ case 3:
+ stringId = R.string.subscriptions;
+ drawableId = R.drawable.ic_subscritptions_bottom_app_bar_24dp;
+ break;
+ case 4:
+ stringId = R.string.multi_reddit;
+ drawableId = R.drawable.ic_multi_reddit_24dp;
+ break;
+ case 5:
+ stringId = R.string.inbox;
+ drawableId = R.drawable.ic_inbox_24dp;
+ break;
+ case 7:
+ stringId = R.string.upvoted;
+ drawableId = R.drawable.ic_arrow_upward_black_24dp;
+ break;
+ case 8:
+ stringId = R.string.downvoted;
+ drawableId = R.drawable.ic_arrow_downward_black_24dp;
+ break;
+ case 9:
+ stringId = R.string.hidden;
+ drawableId = R.drawable.ic_outline_lock_24dp;
+ break;
+ case 10:
+ stringId = R.string.saved;
+ drawableId = R.drawable.ic_outline_bookmarks_24dp;
+ break;
+ case 11:
+ stringId = R.string.gilded;
+ drawableId = R.drawable.ic_star_border_24dp;
+ break;
+ case 13:
+ if ((resources.getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) {
+ stringId = R.string.dark_theme;
+ drawableId = R.drawable.ic_dark_theme_24dp;
+ } else {
+ stringId = R.string.light_theme;
+ drawableId = R.drawable.ic_light_theme_24dp;
+ }
+ break;
+ case 14:
+ stringId = R.string.settings;
+ drawableId = R.drawable.ic_settings_24dp;
}
- break;
- case 14:
- stringId = R.string.settings;
- drawableId = R.drawable.ic_settings_24dp;
- break;
+ } else {
+ switch (position) {
+ case 1:
+ if ((resources.getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) {
+ stringId = R.string.dark_theme;
+ drawableId = R.drawable.ic_dark_theme_24dp;
+ } else {
+ stringId = R.string.light_theme;
+ drawableId = R.drawable.ic_light_theme_24dp;
+ }
+ break;
+ case 2:
+ stringId = R.string.settings;
+ drawableId = R.drawable.ic_settings_24dp;
+ }
+ }
+ } else {
+ if (isLoggedIn) {
+ int offset = accounts == null ? 0 : accounts.size();
+ if (position == offset + 1) {
+ stringId = R.string.add_account;
+ drawableId = R.drawable.ic_outline_add_circle_outline_24dp;
+ } else if (position == offset + 2) {
+ stringId = R.string.anonymous_account;
+ drawableId = R.drawable.ic_anonymous_24dp;
+ } else if (position == offset + 3) {
+ stringId = R.string.log_out;
+ drawableId = R.drawable.ic_log_out_24dp;
+ }
+ } else {
+ stringId = R.string.add_account;
+ drawableId = R.drawable.ic_outline_add_circle_outline_24dp;
+ }
}
- ((MenuItemViewHolder) holder).menuTextView.setText(stringId);
- ((MenuItemViewHolder) holder).menuTextView.setCompoundDrawablesWithIntrinsicBounds(
- drawableId, 0, 0, 0);
- int finalStringId = stringId;
- ((MenuItemViewHolder) holder).itemView.setOnClickListener(view -> itemClickListener.onMenuClick(finalStringId));
+ if (stringId != 0) {
+ ((MenuItemViewHolder) holder).menuTextView.setText(stringId);
+ ((MenuItemViewHolder) holder).menuTextView.setCompoundDrawablesWithIntrinsicBounds(
+ drawableId, 0, 0, 0);
+ int finalStringId = stringId;
+ ((MenuItemViewHolder) holder).itemView.setOnClickListener(view -> itemClickListener.onMenuClick(finalStringId));
+ }
} else if (holder instanceof SubscribedThingViewHolder) {
SubscribedSubredditData subreddit = subscribedSubreddits.get(position - CURRENT_MENU_ITEMS);
String subredditName = subreddit.getName();
@@ -239,16 +320,43 @@ public class NavigationDrawerRecyclerViewAdapter extends RecyclerView.Adapter<Re
((SubscribedThingViewHolder) holder).itemView.setOnClickListener(view -> {
itemClickListener.onSubscribedSubredditClick(subredditName);
});
+ } else if (holder instanceof AccountViewHolder) {
+ glide.load(accounts.get(position - 1).getProfileImageUrl())
+ .error(glide.load(R.drawable.subreddit_default_icon))
+ .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(128, 0)))
+ .into(((AccountViewHolder) holder).profileImageGifImageView);
+ ((AccountViewHolder) holder).usernameTextView.setText(accounts.get(position - 1).getUsername());
+ ((AccountViewHolder) holder).itemView.setOnClickListener(view ->
+ itemClickListener.onAccountClick(accounts.get(position - 1).getUsername()));
}
}
@Override
public int getItemCount() {
- if (subscribedSubreddits != null) {
- return CURRENT_MENU_ITEMS + subscribedSubreddits.size();
+ if (isInMainPage) {
+ if (isLoggedIn) {
+ if (subscribedSubreddits != null) {
+ return CURRENT_MENU_ITEMS + subscribedSubreddits.size();
+ }
+ return CURRENT_MENU_ITEMS;
+ } else {
+ return 3;
+ }
+ } else {
+ if (isLoggedIn) {
+ if (accounts != null && !accounts.isEmpty()) {
+ return 4 + accounts.size();
+ } else {
+ return 4;
+ }
+ } else {
+ if (accounts != null && !accounts.isEmpty()) {
+ return 2 + accounts.size();
+ } else {
+ return 2;
+ }
+ }
}
-
- return CURRENT_MENU_ITEMS;
}
public void setSubscribedSubreddits(List<SubscribedSubredditData> subscribedSubreddits) {
@@ -315,4 +423,16 @@ public class NavigationDrawerRecyclerViewAdapter extends RecyclerView.Adapter<Re
ButterKnife.bind(this, itemView);
}
}
+
+ class AccountViewHolder extends RecyclerView.ViewHolder {
+ @BindView(R.id.profile_image_item_account)
+ GifImageView profileImageGifImageView;
+ @BindView(R.id.username_text_view_item_account)
+ TextView usernameTextView;
+
+ AccountViewHolder(@NonNull View itemView) {
+ super(itemView);
+ ButterKnife.bind(this, itemView);
+ }
+ }
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/SubscribedSubredditsListingFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/SubscribedSubredditsListingFragment.java
index 7d16277b..704dab43 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/SubscribedSubredditsListingFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/SubscribedSubredditsListingFragment.java
@@ -2,6 +2,7 @@ package ml.docilealligator.infinityforreddit.Fragment;
import android.app.Activity;
+import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Build;
@@ -78,8 +79,6 @@ public class SubscribedSubredditsListingFragment extends Fragment implements Fra
ButterKnife.bind(this, rootView);
- mActivity = getActivity();
-
((Infinity) mActivity.getApplication()).getAppComponent().inject(this);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
@@ -154,6 +153,12 @@ public class SubscribedSubredditsListingFragment extends Fragment implements Fra
}
@Override
+ public void onAttach(@NonNull Context context) {
+ super.onAttach(context);
+ mActivity = (Activity) context;
+ }
+
+ @Override
public void stopRefreshProgressbar() {
mSwipeRefreshLayout.setRefreshing(false);
}
diff --git a/app/src/main/res/drawable-night/ic_anonymous_24dp.xml b/app/src/main/res/drawable-night/ic_anonymous_24dp.xml
new file mode 100644
index 00000000..7a00ccf5
--- /dev/null
+++ b/app/src/main/res/drawable-night/ic_anonymous_24dp.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,2zM4,12c0,-0.61 0.08,-1.21 0.21,-1.78L8.99,15v1c0,1.1 0.9,2 2,2v1.93C7.06,19.43 4,16.07 4,12zM17.89,17.4c-0.26,-0.81 -1,-1.4 -1.9,-1.4h-1v-3c0,-0.55 -0.45,-1 -1,-1h-6v-2h2c0.55,0 1,-0.45 1,-1L10.99,7h2c1.1,0 2,-0.9 2,-2v-0.41C17.92,5.77 20,8.65 20,12c0,2.08 -0.81,3.98 -2.11,5.4z"/>
+</vector>
diff --git a/app/src/main/res/drawable-night/ic_log_out_24dp.xml b/app/src/main/res/drawable-night/ic_log_out_24dp.xml
new file mode 100644
index 00000000..4885d221
--- /dev/null
+++ b/app/src/main/res/drawable-night/ic_log_out_24dp.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,2zM4,12c0,-4.42 3.58,-8 8,-8 1.85,0 3.55,0.63 4.9,1.69L5.69,16.9C4.63,15.55 4,13.85 4,12zM12,20c-1.85,0 -3.55,-0.63 -4.9,-1.69L18.31,7.1C19.37,8.45 20,10.15 20,12c0,4.42 -3.58,8 -8,8z"/>
+</vector>
diff --git a/app/src/main/res/drawable-night/ic_outline_add_circle_outline_24dp.xml b/app/src/main/res/drawable-night/ic_outline_add_circle_outline_24dp.xml
new file mode 100644
index 00000000..8c721cf1
--- /dev/null
+++ b/app/src/main/res/drawable-night/ic_outline_add_circle_outline_24dp.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="M13,7h-2v4L7,11v2h4v4h2v-4h4v-2h-4L13,7zM12,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,8z"/>
+</vector>
diff --git a/app/src/main/res/drawable/ic_outline_public_24px.xml b/app/src/main/res/drawable/ic_anonymous_24dp.xml
index aafeefba..aafeefba 100644
--- a/app/src/main/res/drawable/ic_outline_public_24px.xml
+++ b/app/src/main/res/drawable/ic_anonymous_24dp.xml
diff --git a/app/src/main/res/drawable/ic_outline_block_24px.xml b/app/src/main/res/drawable/ic_log_out_24dp.xml
index 0c5dbe45..0c5dbe45 100644
--- a/app/src/main/res/drawable/ic_outline_block_24px.xml
+++ b/app/src/main/res/drawable/ic_log_out_24dp.xml
diff --git a/app/src/main/res/drawable/ic_outline_add_circle_outline_24px.xml b/app/src/main/res/drawable/ic_outline_add_circle_outline_24dp.xml
index 8611136a..8611136a 100644
--- a/app/src/main/res/drawable/ic_outline_add_circle_outline_24px.xml
+++ b/app/src/main/res/drawable/ic_outline_add_circle_outline_24dp.xml
diff --git a/app/src/main/res/layout/item_account.xml b/app/src/main/res/layout/item_nav_drawer_account.xml
index 35405b82..35405b82 100644
--- a/app/src/main/res/layout/item_account.xml
+++ b/app/src/main/res/layout/item_nav_drawer_account.xml