mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-01-26 01:34:45 +01:00
Check for theme setting on every activities except ViewImageActivity and ViewVideoActivity to correctly set the theme. Minor bugs fixed. Minor UI tweaks.
This commit is contained in:
parent
0840b7144f
commit
5f7bfd88b7
@ -1,5 +1,6 @@
|
|||||||
package ml.docilealligator.infinityforreddit;
|
package ml.docilealligator.infinityforreddit;
|
||||||
|
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
@ -13,6 +14,7 @@ import android.view.WindowManager;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
@ -27,6 +29,11 @@ import javax.inject.Inject;
|
|||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
|
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||||
|
|
||||||
public class AccountPostsActivity extends AppCompatActivity implements UserThingSortTypeBottomSheetFragment.UserThingSortTypeSelectionCallback {
|
public class AccountPostsActivity extends AppCompatActivity implements UserThingSortTypeBottomSheetFragment.UserThingSortTypeSelectionCallback {
|
||||||
|
|
||||||
static final String EXTRA_USER_WHERE = "EUW";
|
static final String EXTRA_USER_WHERE = "EUW";
|
||||||
@ -56,6 +63,9 @@ public class AccountPostsActivity extends AppCompatActivity implements UserThing
|
|||||||
@Inject
|
@Inject
|
||||||
RedditDataRoomDatabase mRedditDataRoomDatabase;
|
RedditDataRoomDatabase mRedditDataRoomDatabase;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
SharedPreferences mSharedPreferences;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -108,6 +118,24 @@ public class AccountPostsActivity extends AppCompatActivity implements UserThing
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||||
|
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||||
|
switch (themeType) {
|
||||||
|
case 0:
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if(systemDefault) {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||||
|
} else {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
mUserWhere = getIntent().getExtras().getString(EXTRA_USER_WHERE);
|
mUserWhere = getIntent().getExtras().getString(EXTRA_USER_WHERE);
|
||||||
if(mUserWhere.equals(PostDataSource.USER_WHERE_UPVOTED)) {
|
if(mUserWhere.equals(PostDataSource.USER_WHERE_UPVOTED)) {
|
||||||
toolbar.setTitle(R.string.upvoted);
|
toolbar.setTitle(R.string.upvoted);
|
||||||
|
@ -39,4 +39,6 @@ public interface AppComponent {
|
|||||||
void inject(ViewMessageActivity viewMessageActivity);
|
void inject(ViewMessageActivity viewMessageActivity);
|
||||||
void inject(NotificationPreferenceFragment notificationPreferenceFragment);
|
void inject(NotificationPreferenceFragment notificationPreferenceFragment);
|
||||||
void inject(LinkResolverActivity linkResolverActivity);
|
void inject(LinkResolverActivity linkResolverActivity);
|
||||||
|
void inject(SearchActivity searchActivity);
|
||||||
|
void inject(SettingsActivity settingsActivity);
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package ml.docilealligator.infinityforreddit;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -15,6 +16,7 @@ import android.widget.EditText;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
@ -32,6 +34,11 @@ import butterknife.ButterKnife;
|
|||||||
import retrofit2.Retrofit;
|
import retrofit2.Retrofit;
|
||||||
import ru.noties.markwon.view.MarkwonView;
|
import ru.noties.markwon.view.MarkwonView;
|
||||||
|
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||||
|
|
||||||
public class CommentActivity extends AppCompatActivity {
|
public class CommentActivity extends AppCompatActivity {
|
||||||
|
|
||||||
static final String EXTRA_COMMENT_PARENT_TEXT_KEY = "ECPTK";
|
static final String EXTRA_COMMENT_PARENT_TEXT_KEY = "ECPTK";
|
||||||
@ -64,6 +71,9 @@ public class CommentActivity extends AppCompatActivity {
|
|||||||
@Inject
|
@Inject
|
||||||
RedditDataRoomDatabase mRedditDataRoomDatabase;
|
RedditDataRoomDatabase mRedditDataRoomDatabase;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
SharedPreferences mSharedPreferences;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -83,6 +93,24 @@ public class CommentActivity extends AppCompatActivity {
|
|||||||
window.setNavigationBarColor(ContextCompat.getColor(this, R.color.navBarColor));
|
window.setNavigationBarColor(ContextCompat.getColor(this, R.color.navBarColor));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||||
|
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||||
|
switch (themeType) {
|
||||||
|
case 0:
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if(systemDefault) {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||||
|
} else {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if(savedInstanceState == null) {
|
if(savedInstanceState == null) {
|
||||||
getCurrentAccount();
|
getCurrentAccount();
|
||||||
} else {
|
} else {
|
||||||
|
@ -282,9 +282,9 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
|
|||||||
|
|
||||||
if(mPost.isArchived()) {
|
if(mPost.isArchived()) {
|
||||||
((PostDetailViewHolder) holder).mUpvoteButton
|
((PostDetailViewHolder) holder).mUpvoteButton
|
||||||
.setColorFilter(ContextCompat.getColor(mActivity, R.color.voteUnavailableVoteButtonColor), android.graphics.PorterDuff.Mode.SRC_IN);
|
.setColorFilter(ContextCompat.getColor(mActivity, R.color.voteAndReplyUnavailableVoteButtonColor), android.graphics.PorterDuff.Mode.SRC_IN);
|
||||||
((PostDetailViewHolder) holder).mDownvoteButton
|
((PostDetailViewHolder) holder).mDownvoteButton
|
||||||
.setColorFilter(ContextCompat.getColor(mActivity, R.color.voteUnavailableVoteButtonColor), android.graphics.PorterDuff.Mode.SRC_IN);
|
.setColorFilter(ContextCompat.getColor(mActivity, R.color.voteAndReplyUnavailableVoteButtonColor), android.graphics.PorterDuff.Mode.SRC_IN);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mPost.isCrosspost()) {
|
if(mPost.isCrosspost()) {
|
||||||
@ -476,8 +476,9 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
|
|||||||
params.width = comment.getDepth() * 16;
|
params.width = comment.getDepth() * 16;
|
||||||
((CommentViewHolder) holder).verticalBlock.setLayoutParams(params);
|
((CommentViewHolder) holder).verticalBlock.setLayoutParams(params);
|
||||||
|
|
||||||
if(comment.getAuthor().equals(mAccountName)) {
|
if(!mPost.isArchived() && !mPost.isLocked() && comment.getAuthor().equals(mAccountName)) {
|
||||||
((CommentViewHolder) holder).moreButton.setVisibility(View.VISIBLE);
|
((CommentViewHolder) holder).moreButton.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
((CommentViewHolder) holder).moreButton.setOnClickListener(view -> {
|
((CommentViewHolder) holder).moreButton.setOnClickListener(view -> {
|
||||||
ModifyCommentBottomSheetFragment modifyCommentBottomSheetFragment = new ModifyCommentBottomSheetFragment();
|
ModifyCommentBottomSheetFragment modifyCommentBottomSheetFragment = new ModifyCommentBottomSheetFragment();
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
@ -513,6 +514,149 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
|
|||||||
.setColorFilter(ContextCompat.getColor(mActivity, R.color.minusButtonColor), android.graphics.PorterDuff.Mode.SRC_IN);
|
.setColorFilter(ContextCompat.getColor(mActivity, R.color.minusButtonColor), android.graphics.PorterDuff.Mode.SRC_IN);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(mPost.isArchived()) {
|
||||||
|
((CommentViewHolder) holder).replyButton
|
||||||
|
.setColorFilter(ContextCompat.getColor(mActivity, R.color.voteAndReplyUnavailableVoteButtonColor),
|
||||||
|
android.graphics.PorterDuff.Mode.SRC_IN);
|
||||||
|
((CommentViewHolder) holder).upVoteButton
|
||||||
|
.setColorFilter(ContextCompat.getColor(mActivity, R.color.voteAndReplyUnavailableVoteButtonColor),
|
||||||
|
android.graphics.PorterDuff.Mode.SRC_IN);
|
||||||
|
((CommentViewHolder) holder).downVoteButton
|
||||||
|
.setColorFilter(ContextCompat.getColor(mActivity, R.color.voteAndReplyUnavailableVoteButtonColor),
|
||||||
|
android.graphics.PorterDuff.Mode.SRC_IN);
|
||||||
|
}
|
||||||
|
|
||||||
|
((CommentViewHolder) holder).replyButton.setOnClickListener(view -> {
|
||||||
|
if(mAccessToken == null) {
|
||||||
|
Toast.makeText(mActivity, R.string.login_first, Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(mPost.isArchived()) {
|
||||||
|
Toast.makeText(mActivity, R.string.archived_post_reply_unavailable, Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(mPost.isLocked()) {
|
||||||
|
Toast.makeText(mActivity, R.string.locked_post_reply_unavailable, Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Intent intent = new Intent(mActivity, CommentActivity.class);
|
||||||
|
intent.putExtra(CommentActivity.EXTRA_PARENT_DEPTH_KEY, comment.getDepth() + 1);
|
||||||
|
intent.putExtra(CommentActivity.EXTRA_COMMENT_PARENT_TEXT_KEY, comment.getCommentContent());
|
||||||
|
intent.putExtra(CommentActivity.EXTRA_PARENT_FULLNAME_KEY, comment.getFullName());
|
||||||
|
intent.putExtra(CommentActivity.EXTRA_IS_REPLYING_KEY, true);
|
||||||
|
|
||||||
|
int parentPosition = mIsSingleCommentThreadMode ? holder.getAdapterPosition() - 2 : holder.getAdapterPosition() - 1;
|
||||||
|
intent.putExtra(CommentActivity.EXTRA_PARENT_POSITION_KEY, parentPosition);
|
||||||
|
mActivity.startActivityForResult(intent, CommentActivity.WRITE_COMMENT_REQUEST_CODE);
|
||||||
|
});
|
||||||
|
|
||||||
|
((CommentViewHolder) holder).upVoteButton.setOnClickListener(view -> {
|
||||||
|
if(mPost.isArchived()) {
|
||||||
|
Toast.makeText(mActivity, R.string.archived_post_vote_unavailable, Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(mAccessToken == null) {
|
||||||
|
Toast.makeText(mActivity, R.string.login_first, Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int commentPosition = mIsSingleCommentThreadMode ? holder.getAdapterPosition() - 2 : holder.getAdapterPosition() - 1;
|
||||||
|
|
||||||
|
int previousVoteType = mVisibleComments.get(commentPosition).getVoteType();
|
||||||
|
String newVoteType;
|
||||||
|
|
||||||
|
((CommentViewHolder) holder).downVoteButton.clearColorFilter();
|
||||||
|
|
||||||
|
if(previousVoteType != CommentData.VOTE_TYPE_UPVOTE) {
|
||||||
|
//Not upvoted before
|
||||||
|
mVisibleComments.get(commentPosition).setVoteType(CommentData.VOTE_TYPE_UPVOTE);
|
||||||
|
newVoteType = RedditUtils.DIR_UPVOTE;
|
||||||
|
((CommentViewHolder) holder).upVoteButton.setColorFilter(ContextCompat.getColor(mActivity, R.color.backgroundColorPrimaryDark), android.graphics.PorterDuff.Mode.SRC_IN);
|
||||||
|
} else {
|
||||||
|
//Upvoted before
|
||||||
|
mVisibleComments.get(commentPosition).setVoteType(CommentData.VOTE_TYPE_NO_VOTE);
|
||||||
|
newVoteType = RedditUtils.DIR_UNVOTE;
|
||||||
|
((CommentViewHolder) holder).upVoteButton.clearColorFilter();
|
||||||
|
}
|
||||||
|
|
||||||
|
((CommentViewHolder) holder).scoreTextView.setText(Integer.toString(mVisibleComments.get(commentPosition).getScore() + mVisibleComments.get(commentPosition).getVoteType()));
|
||||||
|
|
||||||
|
VoteThing.voteThing(mOauthRetrofit, mAccessToken, new VoteThing.VoteThingListener() {
|
||||||
|
@Override
|
||||||
|
public void onVoteThingSuccess(int position) {
|
||||||
|
if(newVoteType.equals(RedditUtils.DIR_UPVOTE)) {
|
||||||
|
mVisibleComments.get(commentPosition).setVoteType(CommentData.VOTE_TYPE_UPVOTE);
|
||||||
|
((CommentViewHolder) holder).upVoteButton.setColorFilter(ContextCompat.getColor(mActivity, R.color.backgroundColorPrimaryDark), android.graphics.PorterDuff.Mode.SRC_IN);
|
||||||
|
} else {
|
||||||
|
mVisibleComments.get(commentPosition).setVoteType(CommentData.VOTE_TYPE_NO_VOTE);
|
||||||
|
((CommentViewHolder) holder).upVoteButton.clearColorFilter();
|
||||||
|
}
|
||||||
|
|
||||||
|
((CommentViewHolder) holder).downVoteButton.clearColorFilter();
|
||||||
|
((CommentViewHolder) holder).scoreTextView.setText(Integer.toString(mVisibleComments.get(commentPosition).getScore() + mVisibleComments.get(commentPosition).getVoteType()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onVoteThingFail(int position) { }
|
||||||
|
}, mVisibleComments.get(commentPosition).getFullName(), newVoteType, holder.getAdapterPosition());
|
||||||
|
});
|
||||||
|
|
||||||
|
((CommentViewHolder) holder).downVoteButton.setOnClickListener(view -> {
|
||||||
|
if(mPost.isArchived()) {
|
||||||
|
Toast.makeText(mActivity, R.string.archived_post_vote_unavailable, Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(mAccessToken == null) {
|
||||||
|
Toast.makeText(mActivity, R.string.login_first, Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int commentPosition = mIsSingleCommentThreadMode ? holder.getAdapterPosition() - 2 : holder.getAdapterPosition() - 1;
|
||||||
|
|
||||||
|
int previousVoteType = mVisibleComments.get(commentPosition).getVoteType();
|
||||||
|
String newVoteType;
|
||||||
|
|
||||||
|
((CommentViewHolder) holder).upVoteButton.clearColorFilter();
|
||||||
|
|
||||||
|
if(previousVoteType != CommentData.VOTE_TYPE_DOWNVOTE) {
|
||||||
|
//Not downvoted before
|
||||||
|
mVisibleComments.get(commentPosition).setVoteType(CommentData.VOTE_TYPE_DOWNVOTE);
|
||||||
|
newVoteType = RedditUtils.DIR_DOWNVOTE;
|
||||||
|
((CommentViewHolder) holder).downVoteButton.setColorFilter(ContextCompat.getColor(mActivity, R.color.colorAccent), android.graphics.PorterDuff.Mode.SRC_IN);
|
||||||
|
} else {
|
||||||
|
//Downvoted before
|
||||||
|
mVisibleComments.get(commentPosition).setVoteType(CommentData.VOTE_TYPE_NO_VOTE);
|
||||||
|
newVoteType = RedditUtils.DIR_UNVOTE;
|
||||||
|
((CommentViewHolder) holder).downVoteButton.clearColorFilter();
|
||||||
|
}
|
||||||
|
|
||||||
|
((CommentViewHolder) holder).scoreTextView.setText(Integer.toString(mVisibleComments.get(commentPosition).getScore() + mVisibleComments.get(commentPosition).getVoteType()));
|
||||||
|
|
||||||
|
VoteThing.voteThing(mOauthRetrofit, mAccessToken, new VoteThing.VoteThingListener() {
|
||||||
|
@Override
|
||||||
|
public void onVoteThingSuccess(int position1) {
|
||||||
|
if(newVoteType.equals(RedditUtils.DIR_DOWNVOTE)) {
|
||||||
|
mVisibleComments.get(commentPosition).setVoteType(CommentData.VOTE_TYPE_DOWNVOTE);
|
||||||
|
((CommentViewHolder) holder).downVoteButton.setColorFilter(ContextCompat.getColor(mActivity, R.color.colorAccent), android.graphics.PorterDuff.Mode.SRC_IN);
|
||||||
|
} else {
|
||||||
|
mVisibleComments.get(commentPosition).setVoteType(CommentData.VOTE_TYPE_NO_VOTE);
|
||||||
|
((CommentViewHolder) holder).downVoteButton.clearColorFilter();
|
||||||
|
}
|
||||||
|
|
||||||
|
((CommentViewHolder) holder).upVoteButton.clearColorFilter();
|
||||||
|
((CommentViewHolder) holder).scoreTextView.setText(Integer.toString(mVisibleComments.get(commentPosition).getScore() + mVisibleComments.get(commentPosition).getVoteType()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onVoteThingFail(int position1) { }
|
||||||
|
}, mVisibleComments.get(commentPosition).getFullName(), newVoteType, holder.getAdapterPosition());
|
||||||
|
});
|
||||||
} else if(holder instanceof LoadMoreChildCommentsViewHolder) {
|
} else if(holder instanceof LoadMoreChildCommentsViewHolder) {
|
||||||
CommentData placeholder;
|
CommentData placeholder;
|
||||||
placeholder = mIsSingleCommentThreadMode ? mVisibleComments.get(holder.getAdapterPosition() - 2)
|
placeholder = mIsSingleCommentThreadMode ? mVisibleComments.get(holder.getAdapterPosition() - 2)
|
||||||
@ -776,8 +920,12 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
|
|||||||
((CommentViewHolder) holder).expandButton.setVisibility(View.GONE);
|
((CommentViewHolder) holder).expandButton.setVisibility(View.GONE);
|
||||||
((CommentViewHolder) holder).upVoteButton.clearColorFilter();
|
((CommentViewHolder) holder).upVoteButton.clearColorFilter();
|
||||||
((CommentViewHolder) holder).downVoteButton.clearColorFilter();
|
((CommentViewHolder) holder).downVoteButton.clearColorFilter();
|
||||||
|
((CommentViewHolder) holder).replyButton.clearColorFilter();
|
||||||
((CommentViewHolder) holder).itemView.setBackgroundColor(
|
((CommentViewHolder) holder).itemView.setBackgroundColor(
|
||||||
mActivity.getResources().getColor(R.color.cardViewBackgroundColor));
|
mActivity.getResources().getColor(R.color.cardViewBackgroundColor));
|
||||||
|
} else if(holder instanceof PostDetailViewHolder) {
|
||||||
|
((PostDetailViewHolder) holder).mUpvoteButton.clearColorFilter();
|
||||||
|
((PostDetailViewHolder) holder).mDownvoteButton.clearColorFilter();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -863,13 +1011,13 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
|
|||||||
});
|
});
|
||||||
|
|
||||||
mUpvoteButton.setOnClickListener(view -> {
|
mUpvoteButton.setOnClickListener(view -> {
|
||||||
if(mAccessToken == null) {
|
if(mPost.isArchived()) {
|
||||||
Toast.makeText(mActivity, R.string.login_first, Toast.LENGTH_SHORT).show();
|
Toast.makeText(mActivity, R.string.archived_post_vote_unavailable, Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mPost.isArchived()) {
|
if(mAccessToken == null) {
|
||||||
Toast.makeText(mActivity, R.string.archived_post_vote_unavailable, Toast.LENGTH_SHORT).show();
|
Toast.makeText(mActivity, R.string.login_first, Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -927,13 +1075,13 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
|
|||||||
});
|
});
|
||||||
|
|
||||||
mDownvoteButton.setOnClickListener(view -> {
|
mDownvoteButton.setOnClickListener(view -> {
|
||||||
if(mAccessToken == null) {
|
if(mPost.isArchived()) {
|
||||||
Toast.makeText(mActivity, R.string.login_first, Toast.LENGTH_SHORT).show();
|
Toast.makeText(mActivity, R.string.archived_post_vote_unavailable, Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mPost.isArchived()) {
|
if(mAccessToken == null) {
|
||||||
Toast.makeText(mActivity, R.string.archived_post_vote_unavailable, Toast.LENGTH_SHORT).show();
|
Toast.makeText(mActivity, R.string.login_first, Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1039,118 +1187,6 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
|
|||||||
expandButton.setImageResource(R.drawable.ic_expand_less_black_20dp);
|
expandButton.setImageResource(R.drawable.ic_expand_less_black_20dp);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
replyButton.setOnClickListener(view -> {
|
|
||||||
if(mAccessToken == null) {
|
|
||||||
Toast.makeText(mActivity, R.string.login_first, Toast.LENGTH_SHORT).show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CommentData comment = mIsSingleCommentThreadMode ? mVisibleComments.get(getAdapterPosition() - 2) : mVisibleComments.get(getAdapterPosition() - 1);
|
|
||||||
Intent intent = new Intent(mActivity, CommentActivity.class);
|
|
||||||
intent.putExtra(CommentActivity.EXTRA_PARENT_DEPTH_KEY, comment.getDepth() + 1);
|
|
||||||
intent.putExtra(CommentActivity.EXTRA_COMMENT_PARENT_TEXT_KEY, comment.getCommentContent());
|
|
||||||
intent.putExtra(CommentActivity.EXTRA_PARENT_FULLNAME_KEY, comment.getFullName());
|
|
||||||
intent.putExtra(CommentActivity.EXTRA_IS_REPLYING_KEY, true);
|
|
||||||
|
|
||||||
int parentPosition = mIsSingleCommentThreadMode ? getAdapterPosition() - 2 : getAdapterPosition() - 1;
|
|
||||||
intent.putExtra(CommentActivity.EXTRA_PARENT_POSITION_KEY, parentPosition);
|
|
||||||
mActivity.startActivityForResult(intent, CommentActivity.WRITE_COMMENT_REQUEST_CODE);
|
|
||||||
});
|
|
||||||
|
|
||||||
upVoteButton.setOnClickListener(view -> {
|
|
||||||
if(mAccessToken == null) {
|
|
||||||
Toast.makeText(mActivity, R.string.login_first, Toast.LENGTH_SHORT).show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int commentPosition = mIsSingleCommentThreadMode ? getAdapterPosition() - 2 : getAdapterPosition() - 1;
|
|
||||||
|
|
||||||
int previousVoteType = mVisibleComments.get(commentPosition).getVoteType();
|
|
||||||
String newVoteType;
|
|
||||||
|
|
||||||
downVoteButton.clearColorFilter();
|
|
||||||
|
|
||||||
if(previousVoteType != CommentData.VOTE_TYPE_UPVOTE) {
|
|
||||||
//Not upvoted before
|
|
||||||
mVisibleComments.get(commentPosition).setVoteType(CommentData.VOTE_TYPE_UPVOTE);
|
|
||||||
newVoteType = RedditUtils.DIR_UPVOTE;
|
|
||||||
upVoteButton.setColorFilter(ContextCompat.getColor(mActivity, R.color.backgroundColorPrimaryDark), android.graphics.PorterDuff.Mode.SRC_IN);
|
|
||||||
} else {
|
|
||||||
//Upvoted before
|
|
||||||
mVisibleComments.get(commentPosition).setVoteType(CommentData.VOTE_TYPE_NO_VOTE);
|
|
||||||
newVoteType = RedditUtils.DIR_UNVOTE;
|
|
||||||
upVoteButton.clearColorFilter();
|
|
||||||
}
|
|
||||||
|
|
||||||
scoreTextView.setText(Integer.toString(mVisibleComments.get(commentPosition).getScore() + mVisibleComments.get(commentPosition).getVoteType()));
|
|
||||||
|
|
||||||
VoteThing.voteThing(mOauthRetrofit, mAccessToken, new VoteThing.VoteThingListener() {
|
|
||||||
@Override
|
|
||||||
public void onVoteThingSuccess(int position) {
|
|
||||||
if(newVoteType.equals(RedditUtils.DIR_UPVOTE)) {
|
|
||||||
mVisibleComments.get(commentPosition).setVoteType(CommentData.VOTE_TYPE_UPVOTE);
|
|
||||||
upVoteButton.setColorFilter(ContextCompat.getColor(mActivity, R.color.backgroundColorPrimaryDark), android.graphics.PorterDuff.Mode.SRC_IN);
|
|
||||||
} else {
|
|
||||||
mVisibleComments.get(commentPosition).setVoteType(CommentData.VOTE_TYPE_NO_VOTE);
|
|
||||||
upVoteButton.clearColorFilter();
|
|
||||||
}
|
|
||||||
|
|
||||||
downVoteButton.clearColorFilter();
|
|
||||||
scoreTextView.setText(Integer.toString(mVisibleComments.get(commentPosition).getScore() + mVisibleComments.get(commentPosition).getVoteType()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onVoteThingFail(int position) { }
|
|
||||||
}, mVisibleComments.get(commentPosition).getFullName(), newVoteType, getAdapterPosition());
|
|
||||||
});
|
|
||||||
|
|
||||||
downVoteButton.setOnClickListener(view -> {
|
|
||||||
if(mAccessToken == null) {
|
|
||||||
Toast.makeText(mActivity, R.string.login_first, Toast.LENGTH_SHORT).show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int commentPosition = mIsSingleCommentThreadMode ? getAdapterPosition() - 2 : getAdapterPosition() - 1;
|
|
||||||
|
|
||||||
int previousVoteType = mVisibleComments.get(commentPosition).getVoteType();
|
|
||||||
String newVoteType;
|
|
||||||
|
|
||||||
upVoteButton.clearColorFilter();
|
|
||||||
|
|
||||||
if(previousVoteType != CommentData.VOTE_TYPE_DOWNVOTE) {
|
|
||||||
//Not downvoted before
|
|
||||||
mVisibleComments.get(commentPosition).setVoteType(CommentData.VOTE_TYPE_DOWNVOTE);
|
|
||||||
newVoteType = RedditUtils.DIR_DOWNVOTE;
|
|
||||||
downVoteButton.setColorFilter(ContextCompat.getColor(mActivity, R.color.colorAccent), android.graphics.PorterDuff.Mode.SRC_IN);
|
|
||||||
} else {
|
|
||||||
//Downvoted before
|
|
||||||
mVisibleComments.get(commentPosition).setVoteType(CommentData.VOTE_TYPE_NO_VOTE);
|
|
||||||
newVoteType = RedditUtils.DIR_UNVOTE;
|
|
||||||
downVoteButton.clearColorFilter();
|
|
||||||
}
|
|
||||||
|
|
||||||
scoreTextView.setText(Integer.toString(mVisibleComments.get(commentPosition).getScore() + mVisibleComments.get(commentPosition).getVoteType()));
|
|
||||||
|
|
||||||
VoteThing.voteThing(mOauthRetrofit, mAccessToken, new VoteThing.VoteThingListener() {
|
|
||||||
@Override
|
|
||||||
public void onVoteThingSuccess(int position1) {
|
|
||||||
if(newVoteType.equals(RedditUtils.DIR_DOWNVOTE)) {
|
|
||||||
mVisibleComments.get(commentPosition).setVoteType(CommentData.VOTE_TYPE_DOWNVOTE);
|
|
||||||
downVoteButton.setColorFilter(ContextCompat.getColor(mActivity, R.color.colorAccent), android.graphics.PorterDuff.Mode.SRC_IN);
|
|
||||||
} else {
|
|
||||||
mVisibleComments.get(commentPosition).setVoteType(CommentData.VOTE_TYPE_NO_VOTE);
|
|
||||||
downVoteButton.clearColorFilter();
|
|
||||||
}
|
|
||||||
|
|
||||||
upVoteButton.clearColorFilter();
|
|
||||||
scoreTextView.setText(Integer.toString(mVisibleComments.get(commentPosition).getScore() + mVisibleComments.get(commentPosition).getVoteType()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onVoteThingFail(int position1) { }
|
|
||||||
}, mVisibleComments.get(commentPosition).getFullName(), newVoteType, getAdapterPosition());
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package ml.docilealligator.infinityforreddit;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -15,6 +16,7 @@ import android.widget.Toast;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
@ -37,6 +39,11 @@ import retrofit2.Callback;
|
|||||||
import retrofit2.Response;
|
import retrofit2.Response;
|
||||||
import retrofit2.Retrofit;
|
import retrofit2.Retrofit;
|
||||||
|
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||||
|
|
||||||
public class EditCommentActivity extends AppCompatActivity {
|
public class EditCommentActivity extends AppCompatActivity {
|
||||||
|
|
||||||
static final String EXTRA_CONTENT = "EC";
|
static final String EXTRA_CONTENT = "EC";
|
||||||
@ -59,6 +66,9 @@ public class EditCommentActivity extends AppCompatActivity {
|
|||||||
@Named("oauth")
|
@Named("oauth")
|
||||||
Retrofit mOauthRetrofit;
|
Retrofit mOauthRetrofit;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
SharedPreferences mSharedPreferences;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -78,6 +88,24 @@ public class EditCommentActivity extends AppCompatActivity {
|
|||||||
window.setNavigationBarColor(ContextCompat.getColor(this, R.color.navBarColor));
|
window.setNavigationBarColor(ContextCompat.getColor(this, R.color.navBarColor));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||||
|
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||||
|
switch (themeType) {
|
||||||
|
case 0:
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if(systemDefault) {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||||
|
} else {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package ml.docilealligator.infinityforreddit;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -16,6 +17,7 @@ import android.widget.Toast;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
@ -38,6 +40,11 @@ import retrofit2.Callback;
|
|||||||
import retrofit2.Response;
|
import retrofit2.Response;
|
||||||
import retrofit2.Retrofit;
|
import retrofit2.Retrofit;
|
||||||
|
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||||
|
|
||||||
public class EditPostActivity extends AppCompatActivity {
|
public class EditPostActivity extends AppCompatActivity {
|
||||||
|
|
||||||
static final String EXTRA_TITLE = "ET";
|
static final String EXTRA_TITLE = "ET";
|
||||||
@ -58,6 +65,9 @@ public class EditPostActivity extends AppCompatActivity {
|
|||||||
@Named("oauth")
|
@Named("oauth")
|
||||||
Retrofit mOauthRetrofit;
|
Retrofit mOauthRetrofit;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
SharedPreferences mSharedPreferences;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -77,6 +87,24 @@ public class EditPostActivity extends AppCompatActivity {
|
|||||||
window.setNavigationBarColor(ContextCompat.getColor(this, R.color.navBarColor));
|
window.setNavigationBarColor(ContextCompat.getColor(this, R.color.navBarColor));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||||
|
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||||
|
switch (themeType) {
|
||||||
|
case 0:
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if(systemDefault) {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||||
|
} else {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ml.docilealligator.infinityforreddit;
|
package ml.docilealligator.infinityforreddit;
|
||||||
|
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
@ -13,6 +14,7 @@ import android.view.WindowManager;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
@ -26,6 +28,11 @@ import javax.inject.Inject;
|
|||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
|
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||||
|
|
||||||
public class FilteredThingActivity extends AppCompatActivity implements SortTypeBottomSheetFragment.SortTypeSelectionCallback,
|
public class FilteredThingActivity extends AppCompatActivity implements SortTypeBottomSheetFragment.SortTypeSelectionCallback,
|
||||||
SearchPostSortTypeBottomSheetFragment.SearchSortTypeSelectionCallback, UserThingSortTypeBottomSheetFragment.UserThingSortTypeSelectionCallback {
|
SearchPostSortTypeBottomSheetFragment.SearchSortTypeSelectionCallback, UserThingSortTypeBottomSheetFragment.UserThingSortTypeSelectionCallback {
|
||||||
|
|
||||||
@ -59,6 +66,9 @@ public class FilteredThingActivity extends AppCompatActivity implements SortType
|
|||||||
@Inject
|
@Inject
|
||||||
RedditDataRoomDatabase mRedditDataRoomDatabase;
|
RedditDataRoomDatabase mRedditDataRoomDatabase;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
SharedPreferences mSharedPreferences;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -111,13 +121,31 @@ public class FilteredThingActivity extends AppCompatActivity implements SortType
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||||
|
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||||
|
switch (themeType) {
|
||||||
|
case 0:
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if(systemDefault) {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||||
|
} else {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
name = getIntent().getExtras().getString(EXTRA_NAME);
|
name = getIntent().getStringExtra(EXTRA_NAME);
|
||||||
postType = getIntent().getExtras().getInt(EXTRA_POST_TYPE);
|
postType = getIntent().getIntExtra(EXTRA_POST_TYPE, PostDataSource.TYPE_FRONT_PAGE);
|
||||||
int filter = getIntent().getExtras().getInt(EXTRA_FILTER);
|
int filter = getIntent().getIntExtra(EXTRA_FILTER, Post.TEXT_TYPE);
|
||||||
String sortType = getIntent().getExtras().getString(EXTRA_SORT_TYPE);
|
String sortType = getIntent().getStringExtra(EXTRA_SORT_TYPE);
|
||||||
|
|
||||||
if(savedInstanceState != null) {
|
if(savedInstanceState != null) {
|
||||||
mNullAccessToken = savedInstanceState.getBoolean(NULL_ACCESS_TOKEN_STATE);
|
mNullAccessToken = savedInstanceState.getBoolean(NULL_ACCESS_TOKEN_STATE);
|
||||||
|
@ -75,6 +75,7 @@ public class JSONUtils {
|
|||||||
static final String SHORT_NAME_KEY = "short_name";
|
static final String SHORT_NAME_KEY = "short_name";
|
||||||
static final String DESCRIPTION_HTML_KEY = "description_html";
|
static final String DESCRIPTION_HTML_KEY = "description_html";
|
||||||
static final String ARCHIVED_KEY = "archived";
|
static final String ARCHIVED_KEY = "archived";
|
||||||
|
static final String LOCKEC_KEY = "locked";
|
||||||
static final String TEXT_EDITABLE_KEY = "text_editable";
|
static final String TEXT_EDITABLE_KEY = "text_editable";
|
||||||
static final String SUBJECT_KEY = "subject";
|
static final String SUBJECT_KEY = "subject";
|
||||||
static final String CONTEXT_KEY = "context";
|
static final String CONTEXT_KEY = "context";
|
||||||
|
@ -2,8 +2,10 @@ package ml.docilealligator.infinityforreddit;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.webkit.CookieManager;
|
import android.webkit.CookieManager;
|
||||||
@ -13,6 +15,7 @@ import android.widget.Toast;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
@ -28,6 +31,11 @@ import retrofit2.Callback;
|
|||||||
import retrofit2.Response;
|
import retrofit2.Response;
|
||||||
import retrofit2.Retrofit;
|
import retrofit2.Retrofit;
|
||||||
|
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||||
|
|
||||||
public class LoginActivity extends AppCompatActivity {
|
public class LoginActivity extends AppCompatActivity {
|
||||||
|
|
||||||
private String authCode;
|
private String authCode;
|
||||||
@ -43,6 +51,9 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
@Inject
|
@Inject
|
||||||
RedditDataRoomDatabase mRedditDataRoomDatabase;
|
RedditDataRoomDatabase mRedditDataRoomDatabase;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
SharedPreferences mSharedPreferences;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -50,6 +61,24 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
((Infinity) getApplication()).getAppComponent().inject(this);
|
((Infinity) getApplication()).getAppComponent().inject(this);
|
||||||
|
|
||||||
|
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||||
|
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||||
|
switch (themeType) {
|
||||||
|
case 0:
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if(systemDefault) {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||||
|
} else {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
WebView webView = findViewById(R.id.webview_login_activity);
|
WebView webView = findViewById(R.id.webview_login_activity);
|
||||||
|
@ -166,6 +166,7 @@ class ParsePost {
|
|||||||
boolean nsfw = data.getBoolean(JSONUtils.NSFW_KEY);
|
boolean nsfw = data.getBoolean(JSONUtils.NSFW_KEY);
|
||||||
boolean stickied = data.getBoolean(JSONUtils.STICKIED_KEY);
|
boolean stickied = data.getBoolean(JSONUtils.STICKIED_KEY);
|
||||||
boolean archived = data.getBoolean(JSONUtils.ARCHIVED_KEY);
|
boolean archived = data.getBoolean(JSONUtils.ARCHIVED_KEY);
|
||||||
|
boolean locked = data.getBoolean(JSONUtils.LOCKEC_KEY);
|
||||||
String flair = null;
|
String flair = null;
|
||||||
if(!data.isNull(JSONUtils.LINK_FLAIR_TEXT_KEY)) {
|
if(!data.isNull(JSONUtils.LINK_FLAIR_TEXT_KEY)) {
|
||||||
flair = data.getString(JSONUtils.LINK_FLAIR_TEXT_KEY);
|
flair = data.getString(JSONUtils.LINK_FLAIR_TEXT_KEY);
|
||||||
@ -200,11 +201,11 @@ class ParsePost {
|
|||||||
data = data.getJSONArray(JSONUtils.CROSSPOST_PARENT_LIST).getJSONObject(0);
|
data = data.getJSONArray(JSONUtils.CROSSPOST_PARENT_LIST).getJSONObject(0);
|
||||||
return parseData(data, permalink, id, fullName, subredditName, subredditNamePrefixed,
|
return parseData(data, permalink, id, fullName, subredditName, subredditNamePrefixed,
|
||||||
author, formattedPostTime, title, previewUrl, previewWidth, previewHeight,
|
author, formattedPostTime, title, previewUrl, previewWidth, previewHeight,
|
||||||
score, voteType, gilded, flair, spoiler, nsfw, stickied, archived, true, i);
|
score, voteType, gilded, flair, spoiler, nsfw, stickied, archived, locked, true, i);
|
||||||
} else {
|
} else {
|
||||||
return parseData(data, permalink, id, fullName, subredditName, subredditNamePrefixed,
|
return parseData(data, permalink, id, fullName, subredditName, subredditNamePrefixed,
|
||||||
author, formattedPostTime, title, previewUrl, previewWidth, previewHeight,
|
author, formattedPostTime, title, previewUrl, previewWidth, previewHeight,
|
||||||
score, voteType, gilded, flair, spoiler, nsfw, stickied, archived, false, i);
|
score, voteType, gilded, flair, spoiler, nsfw, stickied, archived, locked, false, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,7 +214,7 @@ class ParsePost {
|
|||||||
String formattedPostTime, String title, String previewUrl, int previewWidth,
|
String formattedPostTime, String title, String previewUrl, int previewWidth,
|
||||||
int previewHeight, int score, int voteType, int gilded, String flair,
|
int previewHeight, int score, int voteType, int gilded, String flair,
|
||||||
boolean spoiler, boolean nsfw, boolean stickied, boolean archived,
|
boolean spoiler, boolean nsfw, boolean stickied, boolean archived,
|
||||||
boolean isCrosspost, int i) throws JSONException {
|
boolean locked, boolean isCrosspost, int i) throws JSONException {
|
||||||
Post post;
|
Post post;
|
||||||
|
|
||||||
boolean isVideo = data.getBoolean(JSONUtils.IS_VIDEO_KEY);
|
boolean isVideo = data.getBoolean(JSONUtils.IS_VIDEO_KEY);
|
||||||
@ -226,7 +227,7 @@ class ParsePost {
|
|||||||
int postType = Post.TEXT_TYPE;
|
int postType = Post.TEXT_TYPE;
|
||||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, formattedPostTime,
|
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, formattedPostTime,
|
||||||
title, permalink, score, postType, voteType, gilded, flair, spoiler, nsfw,
|
title, permalink, score, postType, voteType, gilded, flair, spoiler, nsfw,
|
||||||
stickied, archived, isCrosspost);
|
stickied, archived, locked, isCrosspost);
|
||||||
if(data.isNull(JSONUtils.SELFTEXT_KEY)) {
|
if(data.isNull(JSONUtils.SELFTEXT_KEY)) {
|
||||||
post.setSelfText("");
|
post.setSelfText("");
|
||||||
} else {
|
} else {
|
||||||
@ -238,7 +239,7 @@ class ParsePost {
|
|||||||
int postType = Post.NO_PREVIEW_LINK_TYPE;
|
int postType = Post.NO_PREVIEW_LINK_TYPE;
|
||||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, formattedPostTime,
|
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, formattedPostTime,
|
||||||
title, previewUrl, url, permalink, score, postType,
|
title, previewUrl, url, permalink, score, postType,
|
||||||
voteType, gilded, flair, spoiler, nsfw, stickied, archived, isCrosspost);
|
voteType, gilded, flair, spoiler, nsfw, stickied, archived, locked, isCrosspost);
|
||||||
if(data.isNull(JSONUtils.SELFTEXT_KEY)) {
|
if(data.isNull(JSONUtils.SELFTEXT_KEY)) {
|
||||||
post.setSelfText("");
|
post.setSelfText("");
|
||||||
} else {
|
} else {
|
||||||
@ -260,7 +261,7 @@ class ParsePost {
|
|||||||
|
|
||||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, formattedPostTime,
|
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, formattedPostTime,
|
||||||
title, previewUrl, permalink, score, postType, voteType,
|
title, previewUrl, permalink, score, postType, voteType,
|
||||||
gilded, flair, spoiler, nsfw, stickied, archived, isCrosspost, true);
|
gilded, flair, spoiler, nsfw, stickied, archived, locked, isCrosspost, true);
|
||||||
|
|
||||||
post.setPreviewWidth(previewWidth);
|
post.setPreviewWidth(previewWidth);
|
||||||
post.setPreviewHeight(previewHeight);
|
post.setPreviewHeight(previewHeight);
|
||||||
@ -277,7 +278,7 @@ class ParsePost {
|
|||||||
|
|
||||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, formattedPostTime, title,
|
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, formattedPostTime, title,
|
||||||
previewUrl, permalink, score, postType, voteType,
|
previewUrl, permalink, score, postType, voteType,
|
||||||
gilded, flair, spoiler, nsfw, stickied, archived, isCrosspost, false);
|
gilded, flair, spoiler, nsfw, stickied, archived, locked, isCrosspost, false);
|
||||||
post.setPreviewWidth(previewWidth);
|
post.setPreviewWidth(previewWidth);
|
||||||
post.setPreviewHeight(previewHeight);
|
post.setPreviewHeight(previewHeight);
|
||||||
post.setVideoUrl(videoUrl);
|
post.setVideoUrl(videoUrl);
|
||||||
@ -292,7 +293,7 @@ class ParsePost {
|
|||||||
|
|
||||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, formattedPostTime, title,
|
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, formattedPostTime, title,
|
||||||
previewUrl, permalink, score, postType, voteType,
|
previewUrl, permalink, score, postType, voteType,
|
||||||
gilded, flair, spoiler, nsfw, stickied, archived, isCrosspost, true);
|
gilded, flair, spoiler, nsfw, stickied, archived, locked, isCrosspost, true);
|
||||||
post.setPreviewWidth(previewWidth);
|
post.setPreviewWidth(previewWidth);
|
||||||
post.setPreviewHeight(previewHeight);
|
post.setPreviewHeight(previewHeight);
|
||||||
post.setVideoUrl(videoUrl);
|
post.setVideoUrl(videoUrl);
|
||||||
@ -305,7 +306,7 @@ class ParsePost {
|
|||||||
|
|
||||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, formattedPostTime,
|
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, formattedPostTime,
|
||||||
title, url, url, permalink, score, postType,
|
title, url, url, permalink, score, postType,
|
||||||
voteType, gilded, flair, spoiler, nsfw, stickied, archived, isCrosspost);
|
voteType, gilded, flair, spoiler, nsfw, stickied, archived, locked, isCrosspost);
|
||||||
|
|
||||||
post.setPreviewWidth(previewWidth);
|
post.setPreviewWidth(previewWidth);
|
||||||
post.setPreviewHeight(previewHeight);
|
post.setPreviewHeight(previewHeight);
|
||||||
@ -317,7 +318,7 @@ class ParsePost {
|
|||||||
|
|
||||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, formattedPostTime,
|
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, formattedPostTime,
|
||||||
title, permalink, score, postType, voteType, gilded, flair, spoiler,
|
title, permalink, score, postType, voteType, gilded, flair, spoiler,
|
||||||
nsfw, stickied, archived, isCrosspost);
|
nsfw, stickied, archived, locked, isCrosspost);
|
||||||
|
|
||||||
post.setPreviewWidth(previewWidth);
|
post.setPreviewWidth(previewWidth);
|
||||||
post.setPreviewHeight(previewHeight);
|
post.setPreviewHeight(previewHeight);
|
||||||
@ -334,7 +335,7 @@ class ParsePost {
|
|||||||
|
|
||||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, formattedPostTime,
|
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, formattedPostTime,
|
||||||
title, previewUrl, url, permalink, score, postType, voteType, gilded,
|
title, previewUrl, url, permalink, score, postType, voteType, gilded,
|
||||||
flair, spoiler, nsfw, stickied, archived, isCrosspost);
|
flair, spoiler, nsfw, stickied, archived, locked, isCrosspost);
|
||||||
if(data.isNull(JSONUtils.SELFTEXT_KEY)) {
|
if(data.isNull(JSONUtils.SELFTEXT_KEY)) {
|
||||||
post.setSelfText("");
|
post.setSelfText("");
|
||||||
} else {
|
} else {
|
||||||
@ -354,7 +355,7 @@ class ParsePost {
|
|||||||
|
|
||||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, formattedPostTime,
|
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, formattedPostTime,
|
||||||
title, previewUrl, url, permalink, score, postType,
|
title, previewUrl, url, permalink, score, postType,
|
||||||
voteType, gilded, flair, spoiler, nsfw, stickied, archived, isCrosspost);
|
voteType, gilded, flair, spoiler, nsfw, stickied, archived, locked, isCrosspost);
|
||||||
post.setPreviewWidth(previewWidth);
|
post.setPreviewWidth(previewWidth);
|
||||||
post.setPreviewHeight(previewHeight);
|
post.setPreviewHeight(previewHeight);
|
||||||
} else {
|
} else {
|
||||||
@ -364,7 +365,7 @@ class ParsePost {
|
|||||||
|
|
||||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, formattedPostTime, title,
|
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, formattedPostTime, title,
|
||||||
url, url, permalink, score, postType, voteType,
|
url, url, permalink, score, postType, voteType,
|
||||||
gilded, flair, spoiler, nsfw, stickied, archived, isCrosspost);
|
gilded, flair, spoiler, nsfw, stickied, archived, locked, isCrosspost);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,7 @@ class Post implements Parcelable {
|
|||||||
private boolean nsfw;
|
private boolean nsfw;
|
||||||
private boolean stickied;
|
private boolean stickied;
|
||||||
private boolean archived;
|
private boolean archived;
|
||||||
|
private boolean locked;
|
||||||
private boolean isCrosspost;
|
private boolean isCrosspost;
|
||||||
private boolean isDashVideo;
|
private boolean isDashVideo;
|
||||||
private boolean isDownloadableGifOrVideo;
|
private boolean isDownloadableGifOrVideo;
|
||||||
@ -49,7 +50,7 @@ class Post implements Parcelable {
|
|||||||
Post(String id, String fullName, String subredditName, String subredditNamePrefixed, String author,
|
Post(String id, String fullName, String subredditName, String subredditNamePrefixed, String author,
|
||||||
String postTime, String title, String previewUrl, String permalink, int score, int postType,
|
String postTime, String title, String previewUrl, String permalink, int score, int postType,
|
||||||
int voteType, int gilded, String flair, boolean spoiler, boolean nsfw, boolean stickied,
|
int voteType, int gilded, String flair, boolean spoiler, boolean nsfw, boolean stickied,
|
||||||
boolean archived, boolean isCrosspost, boolean isDashVideo) {
|
boolean archived, boolean locked, boolean isCrosspost, boolean isDashVideo) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.fullName = fullName;
|
this.fullName = fullName;
|
||||||
this.subredditName = subredditName;
|
this.subredditName = subredditName;
|
||||||
@ -69,6 +70,7 @@ class Post implements Parcelable {
|
|||||||
this.nsfw = nsfw;
|
this.nsfw = nsfw;
|
||||||
this.stickied = stickied;
|
this.stickied = stickied;
|
||||||
this.archived = archived;
|
this.archived = archived;
|
||||||
|
this.locked = locked;
|
||||||
this.isCrosspost = isCrosspost;
|
this.isCrosspost = isCrosspost;
|
||||||
this.isDashVideo = isDashVideo;
|
this.isDashVideo = isDashVideo;
|
||||||
}
|
}
|
||||||
@ -76,7 +78,7 @@ class Post implements Parcelable {
|
|||||||
Post(String id, String fullName, String subredditName, String subredditNamePrefixed, String author,
|
Post(String id, String fullName, String subredditName, String subredditNamePrefixed, String author,
|
||||||
String postTime, String title, String previewUrl, String url, String permalink, int score,
|
String postTime, String title, String previewUrl, String url, String permalink, int score,
|
||||||
int postType, int voteType, int gilded, String flair, boolean spoiler, boolean nsfw, boolean stickied,
|
int postType, int voteType, int gilded, String flair, boolean spoiler, boolean nsfw, boolean stickied,
|
||||||
boolean archived, boolean isCrosspost) {
|
boolean archived, boolean locked, boolean isCrosspost) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.fullName = fullName;
|
this.fullName = fullName;
|
||||||
this.subredditName = subredditName;
|
this.subredditName = subredditName;
|
||||||
@ -97,12 +99,14 @@ class Post implements Parcelable {
|
|||||||
this.nsfw = nsfw;
|
this.nsfw = nsfw;
|
||||||
this.stickied = stickied;
|
this.stickied = stickied;
|
||||||
this.archived = archived;
|
this.archived = archived;
|
||||||
|
this.locked = locked;
|
||||||
this.isCrosspost = isCrosspost;
|
this.isCrosspost = isCrosspost;
|
||||||
}
|
}
|
||||||
|
|
||||||
Post(String id, String fullName, String subredditName, String subredditNamePrefixed, String author,
|
Post(String id, String fullName, String subredditName, String subredditNamePrefixed, String author,
|
||||||
String postTime, String title, String permalink, int score, int postType, int voteType, int gilded,
|
String postTime, String title, String permalink, int score, int postType, int voteType, int gilded,
|
||||||
String flair, boolean spoiler, boolean nsfw, boolean stickied, boolean archived, boolean isCrosspost) {
|
String flair, boolean spoiler, boolean nsfw, boolean stickied, boolean archived, boolean locked,
|
||||||
|
boolean isCrosspost) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.fullName = fullName;
|
this.fullName = fullName;
|
||||||
this.subredditName = subredditName;
|
this.subredditName = subredditName;
|
||||||
@ -121,6 +125,7 @@ class Post implements Parcelable {
|
|||||||
this.nsfw = nsfw;
|
this.nsfw = nsfw;
|
||||||
this.stickied = stickied;
|
this.stickied = stickied;
|
||||||
this.archived = archived;
|
this.archived = archived;
|
||||||
|
this.locked = locked;
|
||||||
this.isCrosspost= isCrosspost;
|
this.isCrosspost= isCrosspost;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,6 +157,7 @@ class Post implements Parcelable {
|
|||||||
nsfw = in.readByte() != 0;
|
nsfw = in.readByte() != 0;
|
||||||
stickied = in.readByte() != 0;
|
stickied = in.readByte() != 0;
|
||||||
archived = in.readByte() != 0;
|
archived = in.readByte() != 0;
|
||||||
|
locked = in.readByte() != 0;
|
||||||
isCrosspost = in.readByte() != 0;
|
isCrosspost = in.readByte() != 0;
|
||||||
isDashVideo = in.readByte() != 0;
|
isDashVideo = in.readByte() != 0;
|
||||||
isDownloadableGifOrVideo = in.readByte() != 0;
|
isDownloadableGifOrVideo = in.readByte() != 0;
|
||||||
@ -346,6 +352,10 @@ class Post implements Parcelable {
|
|||||||
return archived;
|
return archived;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean isLocked() {
|
||||||
|
return locked;
|
||||||
|
}
|
||||||
|
|
||||||
boolean isCrosspost() {
|
boolean isCrosspost() {
|
||||||
return isCrosspost;
|
return isCrosspost;
|
||||||
}
|
}
|
||||||
@ -379,6 +389,7 @@ class Post implements Parcelable {
|
|||||||
parcel.writeByte((byte) (nsfw ? 1 : 0));
|
parcel.writeByte((byte) (nsfw ? 1 : 0));
|
||||||
parcel.writeByte((byte) (stickied ? 1 : 0));
|
parcel.writeByte((byte) (stickied ? 1 : 0));
|
||||||
parcel.writeByte((byte) (archived ? 1 : 0));
|
parcel.writeByte((byte) (archived ? 1 : 0));
|
||||||
|
parcel.writeByte((byte) (locked ? 1 : 0));
|
||||||
parcel.writeByte((byte) (isCrosspost ? 1 : 0));
|
parcel.writeByte((byte) (isCrosspost ? 1 : 0));
|
||||||
parcel.writeByte((byte) (isDashVideo ? 1 : 0));
|
parcel.writeByte((byte) (isDashVideo ? 1 : 0));
|
||||||
parcel.writeByte((byte) (isDownloadableGifOrVideo ? 1 : 0));
|
parcel.writeByte((byte) (isDownloadableGifOrVideo ? 1 : 0));
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ml.docilealligator.infinityforreddit;
|
package ml.docilealligator.infinityforreddit;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
@ -19,6 +20,7 @@ import android.widget.TextView;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||||
@ -47,6 +49,11 @@ import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
|
|||||||
import pl.droidsonroids.gif.GifImageView;
|
import pl.droidsonroids.gif.GifImageView;
|
||||||
import retrofit2.Retrofit;
|
import retrofit2.Retrofit;
|
||||||
|
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||||
|
|
||||||
public class PostImageActivity extends AppCompatActivity implements FlairBottomSheetFragment.FlairSelectionCallback {
|
public class PostImageActivity extends AppCompatActivity implements FlairBottomSheetFragment.FlairSelectionCallback {
|
||||||
|
|
||||||
static final String EXTRA_SUBREDDIT_NAME = "ESN";
|
static final String EXTRA_SUBREDDIT_NAME = "ESN";
|
||||||
@ -119,6 +126,9 @@ public class PostImageActivity extends AppCompatActivity implements FlairBottomS
|
|||||||
@Inject
|
@Inject
|
||||||
RedditDataRoomDatabase mRedditDataRoomDatabase;
|
RedditDataRoomDatabase mRedditDataRoomDatabase;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
SharedPreferences mSharedPreferences;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -138,6 +148,24 @@ public class PostImageActivity extends AppCompatActivity implements FlairBottomS
|
|||||||
window.setNavigationBarColor(ContextCompat.getColor(this, R.color.navBarColor));
|
window.setNavigationBarColor(ContextCompat.getColor(this, R.color.navBarColor));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||||
|
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||||
|
switch (themeType) {
|
||||||
|
case 0:
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if(systemDefault) {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||||
|
} else {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
@ -491,8 +519,7 @@ public class PostImageActivity extends AppCompatActivity implements FlairBottomS
|
|||||||
mPostingSnackbar.dismiss();
|
mPostingSnackbar.dismiss();
|
||||||
if(submitImagePostEvent.postSuccess) {
|
if(submitImagePostEvent.postSuccess) {
|
||||||
Intent intent = new Intent(PostImageActivity.this, ViewUserDetailActivity.class);
|
Intent intent = new Intent(PostImageActivity.this, ViewUserDetailActivity.class);
|
||||||
intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY,
|
intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, mAccountName);
|
||||||
mAccountName);
|
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
finish();
|
finish();
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ml.docilealligator.infinityforreddit;
|
package ml.docilealligator.infinityforreddit;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -15,6 +16,7 @@ import android.widget.TextView;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
@ -37,6 +39,11 @@ import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
|
|||||||
import pl.droidsonroids.gif.GifImageView;
|
import pl.droidsonroids.gif.GifImageView;
|
||||||
import retrofit2.Retrofit;
|
import retrofit2.Retrofit;
|
||||||
|
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||||
|
|
||||||
public class PostLinkActivity extends AppCompatActivity implements FlairBottomSheetFragment.FlairSelectionCallback {
|
public class PostLinkActivity extends AppCompatActivity implements FlairBottomSheetFragment.FlairSelectionCallback {
|
||||||
|
|
||||||
static final String EXTRA_SUBREDDIT_NAME = "ESN";
|
static final String EXTRA_SUBREDDIT_NAME = "ESN";
|
||||||
@ -95,6 +102,9 @@ public class PostLinkActivity extends AppCompatActivity implements FlairBottomSh
|
|||||||
@Inject
|
@Inject
|
||||||
RedditDataRoomDatabase mRedditDataRoomDatabase;
|
RedditDataRoomDatabase mRedditDataRoomDatabase;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
SharedPreferences mSharedPreferences;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -114,6 +124,24 @@ public class PostLinkActivity extends AppCompatActivity implements FlairBottomSh
|
|||||||
window.setNavigationBarColor(ContextCompat.getColor(this, R.color.navBarColor));
|
window.setNavigationBarColor(ContextCompat.getColor(this, R.color.navBarColor));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||||
|
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||||
|
switch (themeType) {
|
||||||
|
case 0:
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if(systemDefault) {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||||
|
} else {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
|
@ -351,9 +351,9 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo
|
|||||||
|
|
||||||
if(isArchived) {
|
if(isArchived) {
|
||||||
((DataViewHolder) holder).upvoteButton
|
((DataViewHolder) holder).upvoteButton
|
||||||
.setColorFilter(ContextCompat.getColor(mContext, R.color.voteUnavailableVoteButtonColor), android.graphics.PorterDuff.Mode.SRC_IN);
|
.setColorFilter(ContextCompat.getColor(mContext, R.color.voteAndReplyUnavailableVoteButtonColor), android.graphics.PorterDuff.Mode.SRC_IN);
|
||||||
((DataViewHolder) holder).downvoteButton
|
((DataViewHolder) holder).downvoteButton
|
||||||
.setColorFilter(ContextCompat.getColor(mContext, R.color.voteUnavailableVoteButtonColor), android.graphics.PorterDuff.Mode.SRC_IN);
|
.setColorFilter(ContextCompat.getColor(mContext, R.color.voteAndReplyUnavailableVoteButtonColor), android.graphics.PorterDuff.Mode.SRC_IN);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(post.isCrosspost()) {
|
if(post.isCrosspost()) {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ml.docilealligator.infinityforreddit;
|
package ml.docilealligator.infinityforreddit;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -15,6 +16,7 @@ import android.widget.TextView;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
@ -37,6 +39,11 @@ import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
|
|||||||
import pl.droidsonroids.gif.GifImageView;
|
import pl.droidsonroids.gif.GifImageView;
|
||||||
import retrofit2.Retrofit;
|
import retrofit2.Retrofit;
|
||||||
|
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||||
|
|
||||||
public class PostTextActivity extends AppCompatActivity implements FlairBottomSheetFragment.FlairSelectionCallback {
|
public class PostTextActivity extends AppCompatActivity implements FlairBottomSheetFragment.FlairSelectionCallback {
|
||||||
|
|
||||||
static final String EXTRA_SUBREDDIT_NAME = "ESN";
|
static final String EXTRA_SUBREDDIT_NAME = "ESN";
|
||||||
@ -95,6 +102,9 @@ public class PostTextActivity extends AppCompatActivity implements FlairBottomSh
|
|||||||
@Inject
|
@Inject
|
||||||
RedditDataRoomDatabase mRedditDataRoomDatabase;
|
RedditDataRoomDatabase mRedditDataRoomDatabase;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
SharedPreferences mSharedPreferences;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -114,6 +124,24 @@ public class PostTextActivity extends AppCompatActivity implements FlairBottomSh
|
|||||||
window.setNavigationBarColor(ContextCompat.getColor(this, R.color.navBarColor));
|
window.setNavigationBarColor(ContextCompat.getColor(this, R.color.navBarColor));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||||
|
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||||
|
switch (themeType) {
|
||||||
|
case 0:
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if(systemDefault) {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||||
|
} else {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
@ -122,6 +150,13 @@ public class PostTextActivity extends AppCompatActivity implements FlairBottomSh
|
|||||||
mPostingSnackbar = Snackbar.make(coordinatorLayout, R.string.posting, Snackbar.LENGTH_INDEFINITE);
|
mPostingSnackbar = Snackbar.make(coordinatorLayout, R.string.posting, Snackbar.LENGTH_INDEFINITE);
|
||||||
|
|
||||||
if(savedInstanceState != null) {
|
if(savedInstanceState != null) {
|
||||||
|
mNullAccessToken = savedInstanceState.getBoolean(NULL_ACCESS_TOKEN_STATE);
|
||||||
|
mAccessToken = savedInstanceState.getString(ACCESS_TOKEN_STATE);
|
||||||
|
|
||||||
|
if(!mNullAccessToken && mAccessToken == null) {
|
||||||
|
getCurrentAccount();
|
||||||
|
}
|
||||||
|
|
||||||
subredditName = savedInstanceState.getString(SUBREDDIT_NAME_STATE);
|
subredditName = savedInstanceState.getString(SUBREDDIT_NAME_STATE);
|
||||||
iconUrl = savedInstanceState.getString(SUBREDDIT_ICON_STATE);
|
iconUrl = savedInstanceState.getString(SUBREDDIT_ICON_STATE);
|
||||||
subredditSelected = savedInstanceState.getBoolean(SUBREDDIT_SELECTED_STATE);
|
subredditSelected = savedInstanceState.getBoolean(SUBREDDIT_SELECTED_STATE);
|
||||||
@ -157,6 +192,8 @@ public class PostTextActivity extends AppCompatActivity implements FlairBottomSh
|
|||||||
nsfwTextView.setBackgroundColor(getResources().getColor(R.color.colorAccent));
|
nsfwTextView.setBackgroundColor(getResources().getColor(R.color.colorAccent));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
getCurrentAccount();
|
||||||
|
|
||||||
isPosting = false;
|
isPosting = false;
|
||||||
|
|
||||||
if(getIntent().hasExtra(EXTRA_SUBREDDIT_NAME)) {
|
if(getIntent().hasExtra(EXTRA_SUBREDDIT_NAME)) {
|
||||||
@ -237,6 +274,16 @@ public class PostTextActivity extends AppCompatActivity implements FlairBottomSh
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void getCurrentAccount() {
|
||||||
|
new GetCurrentAccountAsyncTask(mRedditDataRoomDatabase.accountDao(), account -> {
|
||||||
|
if(account == null) {
|
||||||
|
mNullAccessToken = true;
|
||||||
|
} else {
|
||||||
|
mAccessToken = account.getAccessToken();
|
||||||
|
}
|
||||||
|
}).execute();
|
||||||
|
}
|
||||||
|
|
||||||
private void displaySubredditIcon() {
|
private void displaySubredditIcon() {
|
||||||
if(iconUrl != null && !iconUrl.equals("")) {
|
if(iconUrl != null && !iconUrl.equals("")) {
|
||||||
mGlide.load(iconUrl)
|
mGlide.load(iconUrl)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ml.docilealligator.infinityforreddit;
|
package ml.docilealligator.infinityforreddit;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
@ -18,6 +19,7 @@ import android.widget.VideoView;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||||
@ -42,6 +44,11 @@ import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
|
|||||||
import pl.droidsonroids.gif.GifImageView;
|
import pl.droidsonroids.gif.GifImageView;
|
||||||
import retrofit2.Retrofit;
|
import retrofit2.Retrofit;
|
||||||
|
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||||
|
|
||||||
public class PostVideoActivity extends AppCompatActivity implements FlairBottomSheetFragment.FlairSelectionCallback {
|
public class PostVideoActivity extends AppCompatActivity implements FlairBottomSheetFragment.FlairSelectionCallback {
|
||||||
|
|
||||||
static final String EXTRA_SUBREDDIT_NAME = "ESN";
|
static final String EXTRA_SUBREDDIT_NAME = "ESN";
|
||||||
@ -118,6 +125,9 @@ public class PostVideoActivity extends AppCompatActivity implements FlairBottomS
|
|||||||
@Inject
|
@Inject
|
||||||
RedditDataRoomDatabase mRedditDataRoomDatabase;
|
RedditDataRoomDatabase mRedditDataRoomDatabase;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
SharedPreferences mSharedPreferences;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -137,6 +147,24 @@ public class PostVideoActivity extends AppCompatActivity implements FlairBottomS
|
|||||||
window.setNavigationBarColor(ContextCompat.getColor(this, R.color.navBarColor));
|
window.setNavigationBarColor(ContextCompat.getColor(this, R.color.navBarColor));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||||
|
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||||
|
switch (themeType) {
|
||||||
|
case 0:
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if(systemDefault) {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||||
|
} else {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ml.docilealligator.infinityforreddit;
|
package ml.docilealligator.infinityforreddit;
|
||||||
|
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
@ -15,6 +16,7 @@ import android.widget.TextView;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
@ -39,11 +41,16 @@ import retrofit2.Callback;
|
|||||||
import retrofit2.Response;
|
import retrofit2.Response;
|
||||||
import retrofit2.Retrofit;
|
import retrofit2.Retrofit;
|
||||||
|
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||||
|
|
||||||
public class RulesActivity extends AppCompatActivity {
|
public class RulesActivity extends AppCompatActivity {
|
||||||
|
|
||||||
static final String EXTRA_SUBREDDIT_NAME = "ESN";
|
static final String EXTRA_SUBREDDIT_NAME = "ESN";
|
||||||
|
|
||||||
@BindView(R.id.appbar_rules_activity) AppBarLayout appBarLayout;
|
@BindView(R.id.appbar_layout_rules_activity) AppBarLayout appBarLayout;
|
||||||
@BindView(R.id.toolbar_rules_activity) Toolbar toolbar;
|
@BindView(R.id.toolbar_rules_activity) Toolbar toolbar;
|
||||||
@BindView(R.id.progress_bar_rules_activity) ProgressBar progressBar;
|
@BindView(R.id.progress_bar_rules_activity) ProgressBar progressBar;
|
||||||
@BindView(R.id.recycler_view_rules_activity) RecyclerView recyclerView;
|
@BindView(R.id.recycler_view_rules_activity) RecyclerView recyclerView;
|
||||||
@ -57,6 +64,9 @@ public class RulesActivity extends AppCompatActivity {
|
|||||||
@Named("no_oauth")
|
@Named("no_oauth")
|
||||||
Retrofit mRetrofit;
|
Retrofit mRetrofit;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
SharedPreferences mSharedPreferences;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -109,6 +119,24 @@ public class RulesActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||||
|
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||||
|
switch (themeType) {
|
||||||
|
case 0:
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if(systemDefault) {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||||
|
} else {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package ml.docilealligator.infinityforreddit;
|
|||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -17,6 +18,7 @@ import android.widget.TextView;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
@ -25,9 +27,16 @@ import com.ferfalk.simplesearchview.SimpleSearchView;
|
|||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
|
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||||
|
|
||||||
public class SearchActivity extends AppCompatActivity {
|
public class SearchActivity extends AppCompatActivity {
|
||||||
|
|
||||||
static final String EXTRA_QUERY = "EQ";
|
static final String EXTRA_QUERY = "EQ";
|
||||||
@ -52,6 +61,9 @@ public class SearchActivity extends AppCompatActivity {
|
|||||||
private String subredditName;
|
private String subredditName;
|
||||||
private boolean subredditIsUser;
|
private boolean subredditIsUser;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
SharedPreferences mSharedPreferences;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -59,6 +71,8 @@ public class SearchActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
ButterKnife.bind(this);
|
ButterKnife.bind(this);
|
||||||
|
|
||||||
|
((Infinity) getApplication()).getAppComponent().inject(this);
|
||||||
|
|
||||||
EventBus.getDefault().register(this);
|
EventBus.getDefault().register(this);
|
||||||
|
|
||||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
@ -69,6 +83,24 @@ public class SearchActivity extends AppCompatActivity {
|
|||||||
window.setNavigationBarColor(ContextCompat.getColor(this, R.color.navBarColor));
|
window.setNavigationBarColor(ContextCompat.getColor(this, R.color.navBarColor));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||||
|
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||||
|
switch (themeType) {
|
||||||
|
case 0:
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if(systemDefault) {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||||
|
} else {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
boolean searchOnlySubreddits = getIntent().getExtras().getBoolean(EXTRA_SEARCH_ONLY_SUBREDDITS);
|
boolean searchOnlySubreddits = getIntent().getExtras().getBoolean(EXTRA_SEARCH_ONLY_SUBREDDITS);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ml.docilealligator.infinityforreddit;
|
package ml.docilealligator.infinityforreddit;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
@ -14,6 +15,7 @@ import android.view.WindowManager;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
@ -31,6 +33,11 @@ import javax.inject.Inject;
|
|||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
|
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||||
|
|
||||||
public class SearchResultActivity extends AppCompatActivity implements SearchPostSortTypeBottomSheetFragment.SearchSortTypeSelectionCallback,
|
public class SearchResultActivity extends AppCompatActivity implements SearchPostSortTypeBottomSheetFragment.SearchSortTypeSelectionCallback,
|
||||||
SearchUserAndSubredditSortTypeBottomSheetFragment.SearchUserAndSubredditSortTypeSelectionCallback {
|
SearchUserAndSubredditSortTypeBottomSheetFragment.SearchUserAndSubredditSortTypeSelectionCallback {
|
||||||
static final String EXTRA_QUERY = "QK";
|
static final String EXTRA_QUERY = "QK";
|
||||||
@ -46,7 +53,7 @@ public class SearchResultActivity extends AppCompatActivity implements SearchPos
|
|||||||
private String mQuery;
|
private String mQuery;
|
||||||
private String mSubredditName;
|
private String mSubredditName;
|
||||||
|
|
||||||
@BindView(R.id.appbar_search_result_activity) AppBarLayout appBarLayout;
|
@BindView(R.id.appbar_layout_search_result_activity) AppBarLayout appBarLayout;
|
||||||
@BindView(R.id.toolbar_search_result_activity) Toolbar toolbar;
|
@BindView(R.id.toolbar_search_result_activity) Toolbar toolbar;
|
||||||
@BindView(R.id.tab_layout_search_result_activity) TabLayout tabLayout;
|
@BindView(R.id.tab_layout_search_result_activity) TabLayout tabLayout;
|
||||||
@BindView(R.id.view_pager_search_result_activity) ViewPager viewPager;
|
@BindView(R.id.view_pager_search_result_activity) ViewPager viewPager;
|
||||||
@ -59,6 +66,9 @@ public class SearchResultActivity extends AppCompatActivity implements SearchPos
|
|||||||
@Inject
|
@Inject
|
||||||
RedditDataRoomDatabase mRedditDataRoomDatabase;
|
RedditDataRoomDatabase mRedditDataRoomDatabase;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
SharedPreferences mSharedPreferences;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -108,6 +118,24 @@ public class SearchResultActivity extends AppCompatActivity implements SearchPos
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||||
|
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||||
|
switch (themeType) {
|
||||||
|
case 0:
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if(systemDefault) {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||||
|
} else {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
|
@ -2,14 +2,25 @@ package ml.docilealligator.infinityforreddit;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.content.res.Configuration;
|
||||||
|
import android.content.res.Resources;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
|
import com.google.android.material.appbar.AppBarLayout;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
|
|
||||||
@ -18,6 +29,11 @@ import javax.inject.Inject;
|
|||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
|
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||||
|
|
||||||
public class SearchSubredditsResultActivity extends AppCompatActivity {
|
public class SearchSubredditsResultActivity extends AppCompatActivity {
|
||||||
|
|
||||||
static final String EXTRA_QUERY = "EQ";
|
static final String EXTRA_QUERY = "EQ";
|
||||||
@ -29,6 +45,7 @@ public class SearchSubredditsResultActivity extends AppCompatActivity {
|
|||||||
private static final String ACCOUNT_NAME_STATE = "ANS";
|
private static final String ACCOUNT_NAME_STATE = "ANS";
|
||||||
private static final String FRAGMENT_OUT_STATE = "FOS";
|
private static final String FRAGMENT_OUT_STATE = "FOS";
|
||||||
|
|
||||||
|
@BindView(R.id.appbar_layout_search_subreddits_result_activity) AppBarLayout appBarLayout;
|
||||||
@BindView(R.id.toolbar_search_subreddits_result_activity) Toolbar toolbar;
|
@BindView(R.id.toolbar_search_subreddits_result_activity) Toolbar toolbar;
|
||||||
|
|
||||||
private boolean mNullAccessToken = false;
|
private boolean mNullAccessToken = false;
|
||||||
@ -40,6 +57,9 @@ public class SearchSubredditsResultActivity extends AppCompatActivity {
|
|||||||
@Inject
|
@Inject
|
||||||
RedditDataRoomDatabase mRedditDataRoomDatabase;
|
RedditDataRoomDatabase mRedditDataRoomDatabase;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
SharedPreferences mSharedPreferences;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -51,6 +71,62 @@ public class SearchSubredditsResultActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
EventBus.getDefault().register(this);
|
EventBus.getDefault().register(this);
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
|
||||||
|
Resources resources = getResources();
|
||||||
|
|
||||||
|
if(resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT || resources.getBoolean(R.bool.isTablet)) {
|
||||||
|
Window window = getWindow();
|
||||||
|
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||||
|
|
||||||
|
boolean lightNavBar = false;
|
||||||
|
if((resources.getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) {
|
||||||
|
lightNavBar = true;
|
||||||
|
}
|
||||||
|
boolean finalLightNavBar = lightNavBar;
|
||||||
|
|
||||||
|
View decorView = window.getDecorView();
|
||||||
|
appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() {
|
||||||
|
@Override
|
||||||
|
void onStateChanged(AppBarLayout appBarLayout, State state) {
|
||||||
|
if(state == State.COLLAPSED) {
|
||||||
|
if(finalLightNavBar) {
|
||||||
|
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||||
|
}
|
||||||
|
} else if(state == State.EXPANDED) {
|
||||||
|
if(finalLightNavBar) {
|
||||||
|
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
int statusBarResourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
|
||||||
|
if (statusBarResourceId > 0) {
|
||||||
|
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) toolbar.getLayoutParams();
|
||||||
|
params.topMargin = getResources().getDimensionPixelSize(statusBarResourceId);
|
||||||
|
toolbar.setLayoutParams(params);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||||
|
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||||
|
switch (themeType) {
|
||||||
|
case 0:
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if(systemDefault) {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||||
|
} else {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ml.docilealligator.infinityforreddit;
|
package ml.docilealligator.infinityforreddit;
|
||||||
|
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -9,16 +10,24 @@ import android.view.Window;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.PreferenceFragmentCompat;
|
import androidx.preference.PreferenceFragmentCompat;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import Settings.MainPreferenceFragment;
|
import Settings.MainPreferenceFragment;
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
|
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||||
|
|
||||||
public class SettingsActivity extends AppCompatActivity implements
|
public class SettingsActivity extends AppCompatActivity implements
|
||||||
PreferenceFragmentCompat.OnPreferenceStartFragmentCallback {
|
PreferenceFragmentCompat.OnPreferenceStartFragmentCallback {
|
||||||
|
|
||||||
@ -26,6 +35,9 @@ public class SettingsActivity extends AppCompatActivity implements
|
|||||||
|
|
||||||
@BindView(R.id.toolbar_settings_activity) Toolbar toolbar;
|
@BindView(R.id.toolbar_settings_activity) Toolbar toolbar;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
SharedPreferences mSharedPreferences;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -33,6 +45,8 @@ public class SettingsActivity extends AppCompatActivity implements
|
|||||||
|
|
||||||
ButterKnife.bind(this);
|
ButterKnife.bind(this);
|
||||||
|
|
||||||
|
((Infinity) getApplication()).getAppComponent().inject(this);
|
||||||
|
|
||||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
Window window = getWindow();
|
Window window = getWindow();
|
||||||
if((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) {
|
if((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) {
|
||||||
@ -41,6 +55,24 @@ public class SettingsActivity extends AppCompatActivity implements
|
|||||||
window.setNavigationBarColor(ContextCompat.getColor(this, R.color.navBarColor));
|
window.setNavigationBarColor(ContextCompat.getColor(this, R.color.navBarColor));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||||
|
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||||
|
switch (themeType) {
|
||||||
|
case 0:
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if(systemDefault) {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||||
|
} else {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
if (savedInstanceState == null) {
|
if (savedInstanceState == null) {
|
||||||
|
@ -2,6 +2,7 @@ package ml.docilealligator.infinityforreddit;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
@ -16,6 +17,7 @@ import android.view.WindowManager;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
@ -36,6 +38,11 @@ import butterknife.BindView;
|
|||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
import retrofit2.Retrofit;
|
import retrofit2.Retrofit;
|
||||||
|
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||||
|
|
||||||
public class SubredditSelectionActivity extends AppCompatActivity {
|
public class SubredditSelectionActivity extends AppCompatActivity {
|
||||||
|
|
||||||
static final String EXTRA_EXTRA_CLEAR_SELECTION = "EECS";
|
static final String EXTRA_EXTRA_CLEAR_SELECTION = "EECS";
|
||||||
@ -69,6 +76,9 @@ public class SubredditSelectionActivity extends AppCompatActivity {
|
|||||||
@Inject
|
@Inject
|
||||||
RedditDataRoomDatabase mRedditDataRoomDatabase;
|
RedditDataRoomDatabase mRedditDataRoomDatabase;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
SharedPreferences mSharedPreferences;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -121,6 +131,24 @@ public class SubredditSelectionActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||||
|
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||||
|
switch (themeType) {
|
||||||
|
case 0:
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if(systemDefault) {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||||
|
} else {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ml.docilealligator.infinityforreddit;
|
package ml.docilealligator.infinityforreddit;
|
||||||
|
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
@ -12,6 +13,7 @@ import android.view.WindowManager;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
@ -36,6 +38,11 @@ import butterknife.BindView;
|
|||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
import retrofit2.Retrofit;
|
import retrofit2.Retrofit;
|
||||||
|
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||||
|
|
||||||
public class SubscribedThingListingActivity extends AppCompatActivity {
|
public class SubscribedThingListingActivity extends AppCompatActivity {
|
||||||
|
|
||||||
private static final String INSERT_SUBSCRIBED_SUBREDDIT_STATE = "ISSS";
|
private static final String INSERT_SUBSCRIBED_SUBREDDIT_STATE = "ISSS";
|
||||||
@ -43,7 +50,7 @@ public class SubscribedThingListingActivity extends AppCompatActivity {
|
|||||||
private static final String ACCESS_TOKEN_STATE = "ATS";
|
private static final String ACCESS_TOKEN_STATE = "ATS";
|
||||||
private static final String ACCOUNT_NAME_STATE = "ANS";
|
private static final String ACCOUNT_NAME_STATE = "ANS";
|
||||||
|
|
||||||
@BindView(R.id.appbar_subscribed_thing_listing_activity) AppBarLayout appBarLayout;
|
@BindView(R.id.appbar_layout_subscribed_thing_listing_activity) AppBarLayout appBarLayout;
|
||||||
@BindView(R.id.toolbar_subscribed_thing_listing_activity) Toolbar toolbar;
|
@BindView(R.id.toolbar_subscribed_thing_listing_activity) Toolbar toolbar;
|
||||||
@BindView(R.id.tab_layout_subscribed_thing_listing_activity) TabLayout tabLayout;
|
@BindView(R.id.tab_layout_subscribed_thing_listing_activity) TabLayout tabLayout;
|
||||||
@BindView(R.id.view_pager_subscribed_thing_listing_activity) ViewPager viewPager;
|
@BindView(R.id.view_pager_subscribed_thing_listing_activity) ViewPager viewPager;
|
||||||
@ -62,6 +69,9 @@ public class SubscribedThingListingActivity extends AppCompatActivity {
|
|||||||
@Inject
|
@Inject
|
||||||
RedditDataRoomDatabase mRedditDataRoomDatabase;
|
RedditDataRoomDatabase mRedditDataRoomDatabase;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
SharedPreferences mSharedPreferences;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -114,6 +124,24 @@ public class SubscribedThingListingActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||||
|
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||||
|
switch (themeType) {
|
||||||
|
case 0:
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if(systemDefault) {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||||
|
} else {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ml.docilealligator.infinityforreddit;
|
package ml.docilealligator.infinityforreddit;
|
||||||
|
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
@ -17,6 +18,7 @@ import android.widget.Toast;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||||
@ -39,6 +41,11 @@ import butterknife.BindView;
|
|||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
import retrofit2.Retrofit;
|
import retrofit2.Retrofit;
|
||||||
|
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||||
|
|
||||||
public class ViewMessageActivity extends AppCompatActivity {
|
public class ViewMessageActivity extends AppCompatActivity {
|
||||||
|
|
||||||
static final String EXTRA_NEW_ACCOUNT_NAME = "ENAN";
|
static final String EXTRA_NEW_ACCOUNT_NAME = "ENAN";
|
||||||
@ -73,6 +80,9 @@ public class ViewMessageActivity extends AppCompatActivity {
|
|||||||
@Inject
|
@Inject
|
||||||
RedditDataRoomDatabase mRedditDataRoomDatabase;
|
RedditDataRoomDatabase mRedditDataRoomDatabase;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
SharedPreferences mSharedPreferences;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -132,6 +142,24 @@ public class ViewMessageActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||||
|
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||||
|
switch (themeType) {
|
||||||
|
case 0:
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if(systemDefault) {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||||
|
} else {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
toolbar.setTitle(R.string.inbox);
|
toolbar.setTitle(R.string.inbox);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ml.docilealligator.infinityforreddit;
|
package ml.docilealligator.infinityforreddit;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
@ -20,6 +21,7 @@ import android.widget.Toast;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
@ -51,6 +53,10 @@ import retrofit2.Callback;
|
|||||||
import retrofit2.Response;
|
import retrofit2.Response;
|
||||||
import retrofit2.Retrofit;
|
import retrofit2.Retrofit;
|
||||||
|
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||||
import static ml.docilealligator.infinityforreddit.CommentActivity.EXTRA_COMMENT_DATA_KEY;
|
import static ml.docilealligator.infinityforreddit.CommentActivity.EXTRA_COMMENT_DATA_KEY;
|
||||||
import static ml.docilealligator.infinityforreddit.CommentActivity.WRITE_COMMENT_REQUEST_CODE;
|
import static ml.docilealligator.infinityforreddit.CommentActivity.WRITE_COMMENT_REQUEST_CODE;
|
||||||
|
|
||||||
@ -126,6 +132,9 @@ public class ViewPostDetailActivity extends AppCompatActivity implements FlairBo
|
|||||||
@Inject
|
@Inject
|
||||||
RedditDataRoomDatabase mRedditDataRoomDatabase;
|
RedditDataRoomDatabase mRedditDataRoomDatabase;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
SharedPreferences mSharedPreferences;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -186,6 +195,24 @@ public class ViewPostDetailActivity extends AppCompatActivity implements FlairBo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||||
|
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||||
|
switch (themeType) {
|
||||||
|
case 0:
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if(systemDefault) {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||||
|
} else {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
toolbar.setTitle("");
|
toolbar.setTitle("");
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
@ -751,8 +778,18 @@ public class ViewPostDetailActivity extends AppCompatActivity implements FlairBo
|
|||||||
refresh(true, true);
|
refresh(true, true);
|
||||||
return true;
|
return true;
|
||||||
case R.id.action_comment_view_post_detail_activity:
|
case R.id.action_comment_view_post_detail_activity:
|
||||||
|
if(mPost.isArchived()) {
|
||||||
|
showMessage(R.string.archived_post_reply_unavailable);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(mPost.isLocked()) {
|
||||||
|
showMessage(R.string.locked_post_comment_unavailable);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if(mAccessToken == null) {
|
if(mAccessToken == null) {
|
||||||
Toast.makeText(this, R.string.login_first, Toast.LENGTH_SHORT).show();
|
showMessage(R.string.login_first);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ml.docilealligator.infinityforreddit;
|
package ml.docilealligator.infinityforreddit;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
@ -17,6 +18,7 @@ import android.widget.Toast;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
@ -46,6 +48,11 @@ import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
|
|||||||
import pl.droidsonroids.gif.GifImageView;
|
import pl.droidsonroids.gif.GifImageView;
|
||||||
import retrofit2.Retrofit;
|
import retrofit2.Retrofit;
|
||||||
|
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||||
|
|
||||||
public class ViewSubredditDetailActivity extends AppCompatActivity implements SortTypeBottomSheetFragment.SortTypeSelectionCallback,
|
public class ViewSubredditDetailActivity extends AppCompatActivity implements SortTypeBottomSheetFragment.SortTypeSelectionCallback,
|
||||||
PostTypeBottomSheetFragment.PostTypeSelectionCallback {
|
PostTypeBottomSheetFragment.PostTypeSelectionCallback {
|
||||||
|
|
||||||
@ -106,6 +113,9 @@ public class ViewSubredditDetailActivity extends AppCompatActivity implements So
|
|||||||
@Inject
|
@Inject
|
||||||
RedditDataRoomDatabase mRedditDataRoomDatabase;
|
RedditDataRoomDatabase mRedditDataRoomDatabase;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
SharedPreferences mSharedPreferences;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -157,6 +167,24 @@ public class ViewSubredditDetailActivity extends AppCompatActivity implements So
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||||
|
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||||
|
switch (themeType) {
|
||||||
|
case 0:
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if(systemDefault) {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||||
|
} else {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
subredditName = getIntent().getExtras().getString(EXTRA_SUBREDDIT_NAME_KEY);
|
subredditName = getIntent().getExtras().getString(EXTRA_SUBREDDIT_NAME_KEY);
|
||||||
|
|
||||||
if(savedInstanceState == null) {
|
if(savedInstanceState == null) {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ml.docilealligator.infinityforreddit;
|
package ml.docilealligator.infinityforreddit;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
@ -17,6 +18,7 @@ import android.widget.Toast;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
@ -51,6 +53,11 @@ import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
|
|||||||
import pl.droidsonroids.gif.GifImageView;
|
import pl.droidsonroids.gif.GifImageView;
|
||||||
import retrofit2.Retrofit;
|
import retrofit2.Retrofit;
|
||||||
|
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||||
|
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||||
|
|
||||||
public class ViewUserDetailActivity extends AppCompatActivity implements UserThingSortTypeBottomSheetFragment.UserThingSortTypeSelectionCallback {
|
public class ViewUserDetailActivity extends AppCompatActivity implements UserThingSortTypeBottomSheetFragment.UserThingSortTypeSelectionCallback {
|
||||||
|
|
||||||
static final String EXTRA_USER_NAME_KEY = "EUNK";
|
static final String EXTRA_USER_NAME_KEY = "EUNK";
|
||||||
@ -114,6 +121,9 @@ public class ViewUserDetailActivity extends AppCompatActivity implements UserThi
|
|||||||
@Inject
|
@Inject
|
||||||
RedditDataRoomDatabase mRedditDataRoomDatabase;
|
RedditDataRoomDatabase mRedditDataRoomDatabase;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
SharedPreferences mSharedPreferences;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -125,6 +135,24 @@ public class ViewUserDetailActivity extends AppCompatActivity implements UserThi
|
|||||||
|
|
||||||
EventBus.getDefault().register(this);
|
EventBus.getDefault().register(this);
|
||||||
|
|
||||||
|
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||||
|
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||||
|
switch (themeType) {
|
||||||
|
case 0:
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if(systemDefault) {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||||
|
} else {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
username = getIntent().getStringExtra(EXTRA_USER_NAME_KEY);
|
username = getIntent().getStringExtra(EXTRA_USER_NAME_KEY);
|
||||||
|
|
||||||
if (savedInstanceState == null) {
|
if (savedInstanceState == null) {
|
||||||
|
@ -4,18 +4,18 @@
|
|||||||
android:viewportWidth="24"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="24">
|
android:viewportHeight="24">
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FF000000"
|
android:fillColor="#FFFFFFFF"
|
||||||
android:pathData="M12,22C6.49,22 2,17.51 2,12S6.49,2 12,2s10,4.04 10,9c0,3.31 -2.69,6 -6,6h-1.77c-0.28,0 -0.5,0.22 -0.5,0.5 0,0.12 0.05,0.23 0.13,0.33 0.41,0.47 0.64,1.06 0.64,1.67 0,1.38 -1.12,2.5 -2.5,2.5zM12,4c-4.41,0 -8,3.59 -8,8s3.59,8 8,8c0.28,0 0.5,-0.22 0.5,-0.5 0,-0.16 -0.08,-0.28 -0.14,-0.35 -0.41,-0.46 -0.63,-1.05 -0.63,-1.65 0,-1.38 1.12,-2.5 2.5,-2.5L16,15c2.21,0 4,-1.79 4,-4 0,-3.86 -3.59,-7 -8,-7z"/>
|
android:pathData="M12,22C6.49,22 2,17.51 2,12S6.49,2 12,2s10,4.04 10,9c0,3.31 -2.69,6 -6,6h-1.77c-0.28,0 -0.5,0.22 -0.5,0.5 0,0.12 0.05,0.23 0.13,0.33 0.41,0.47 0.64,1.06 0.64,1.67 0,1.38 -1.12,2.5 -2.5,2.5zM12,4c-4.41,0 -8,3.59 -8,8s3.59,8 8,8c0.28,0 0.5,-0.22 0.5,-0.5 0,-0.16 -0.08,-0.28 -0.14,-0.35 -0.41,-0.46 -0.63,-1.05 -0.63,-1.65 0,-1.38 1.12,-2.5 2.5,-2.5L16,15c2.21,0 4,-1.79 4,-4 0,-3.86 -3.59,-7 -8,-7z"/>
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FF000000"
|
android:fillColor="#FFFFFFFF"
|
||||||
android:pathData="M6.5,11.5m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"/>
|
android:pathData="M6.5,11.5m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"/>
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FF000000"
|
android:fillColor="#FFFFFFFF"
|
||||||
android:pathData="M9.5,7.5m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"/>
|
android:pathData="M9.5,7.5m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"/>
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FF000000"
|
android:fillColor="#FFFFFFFF"
|
||||||
android:pathData="M14.5,7.5m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"/>
|
android:pathData="M14.5,7.5m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"/>
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FF000000"
|
android:fillColor="#FFFFFFFF"
|
||||||
android:pathData="M17.5,11.5m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"/>
|
android:pathData="M17.5,11.5m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"/>
|
||||||
</vector>
|
</vector>
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
tools:application=".RulesActivity">
|
tools:application=".RulesActivity">
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
android:id="@+id/appbar_rules_activity"
|
android:id="@+id/appbar_layout_rules_activity"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:theme="@style/AppTheme.AppBarOverlay">
|
android:theme="@style/AppTheme.AppBarOverlay">
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
android:id="@+id/appbar_search_result_activity"
|
android:id="@+id/appbar_layout_search_result_activity"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:theme="@style/AppTheme.AppBarOverlay">
|
android:theme="@style/AppTheme.AppBarOverlay">
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
tools:application=".SearchSubredditsResultActivity">
|
tools:application=".SearchSubredditsResultActivity">
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
|
android:id="@+id/appbar_layout_search_subreddits_result_activity"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:theme="@style/AppTheme.AppBarOverlay">
|
android:theme="@style/AppTheme.AppBarOverlay">
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
tools:application=".SubscribedThingListingActivity">
|
tools:application=".SubscribedThingListingActivity">
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
android:id="@+id/appbar_subscribed_thing_listing_activity"
|
android:id="@+id/appbar_layout_subscribed_thing_listing_activity"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:theme="@style/AppTheme.AppBarOverlay">
|
android:theme="@style/AppTheme.AppBarOverlay">
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
<color name="roundedBottomSheetPrimaryNavigationBarColor">@color/roundedBottomSheetPrimaryBackground</color>
|
<color name="roundedBottomSheetPrimaryNavigationBarColor">@color/roundedBottomSheetPrimaryBackground</color>
|
||||||
|
|
||||||
<color name="voteUnavailableVoteButtonColor">#3C3C3C</color>
|
<color name="voteAndReplyUnavailableVoteButtonColor">#3C3C3C</color>
|
||||||
|
|
||||||
<color name="tabLayoutWithExpandedCollapsingToolbarTextColor">#FFFFFF</color>
|
<color name="tabLayoutWithExpandedCollapsingToolbarTextColor">#FFFFFF</color>
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
<color name="roundedBottomSheetPrimaryNavigationBarColor">@color/roundedBottomSheetPrimaryBackground</color>
|
<color name="roundedBottomSheetPrimaryNavigationBarColor">@color/roundedBottomSheetPrimaryBackground</color>
|
||||||
|
|
||||||
<color name="voteUnavailableVoteButtonColor">#F0F0F0</color>
|
<color name="voteAndReplyUnavailableVoteButtonColor">#F0F0F0</color>
|
||||||
|
|
||||||
<color name="tabLayoutWithExpandedCollapsingToolbarTextColor">@color/colorPrimary</color>
|
<color name="tabLayoutWithExpandedCollapsingToolbarTextColor">@color/colorPrimary</color>
|
||||||
|
|
||||||
|
@ -182,6 +182,10 @@
|
|||||||
<string name="no_browser_found">No browser found</string>
|
<string name="no_browser_found">No browser found</string>
|
||||||
|
|
||||||
<string name="archived_post_vote_unavailable">Archived post. Vote unavailable.</string>
|
<string name="archived_post_vote_unavailable">Archived post. Vote unavailable.</string>
|
||||||
|
<string name="archived_post_comment_unavailable">Archived post. Comment unavailable.</string>
|
||||||
|
<string name="archived_post_reply_unavailable">Archived post. Reply unavailable.</string>
|
||||||
|
<string name="locked_post_comment_unavailable">Locked post. Comment unavailable.</string>
|
||||||
|
<string name="locked_post_reply_unavailable">Locked post. Reply unavailable.</string>
|
||||||
|
|
||||||
<string name="text">TEXT</string>
|
<string name="text">TEXT</string>
|
||||||
<string name="link">LINK</string>
|
<string name="link">LINK</string>
|
||||||
|
@ -62,6 +62,8 @@
|
|||||||
|
|
||||||
<style name="PreferenceActivityTheme" parent="AppTheme.NoActionBar">
|
<style name="PreferenceActivityTheme" parent="AppTheme.NoActionBar">
|
||||||
<item name="android:textColorPrimary">@color/primaryTextColor</item>
|
<item name="android:textColorPrimary">@color/primaryTextColor</item>
|
||||||
|
<item name="buttonBarPositiveButtonStyle">@style/MaterialAlertDialogPositiveButtonStyle</item>
|
||||||
|
<item name="buttonBarNegativeButtonStyle">@style/MaterialAlertDialogNegativeButtonStyle</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user