mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-28 11:58:23 +01:00
Merge branch 'master' into master
This commit is contained in:
commit
fc284a3dc0
@ -76,6 +76,10 @@ dependencies {
|
||||
implementation 'com.google.code.gson:gson:2.8.6'
|
||||
implementation 'me.zhanghai.android.fastscroll:library:1.1.2'
|
||||
|
||||
def toroVersion = '3.7.0.2010003'
|
||||
implementation "im.ene.toro3:toro:$toroVersion"
|
||||
implementation "im.ene.toro3:toro-ext-exoplayer:$toroVersion"
|
||||
|
||||
testImplementation 'junit:junit:4.13'
|
||||
androidTestImplementation 'androidx.test:runner:1.2.0'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
|
@ -21,14 +21,20 @@
|
||||
android:theme="@style/AppTheme"
|
||||
android:usesCleartextTraffic="true"
|
||||
tools:replace="android:label">
|
||||
<activity android:name=".Activity.SelectedSubredditsActivity"
|
||||
<activity android:name=".Activity.ReportActivity"
|
||||
android:label="@string/report_activity_label"
|
||||
android:parentActivityName=".Activity.MainActivity"
|
||||
android:theme="@style/AppTheme.NoActionBar"/>
|
||||
<activity
|
||||
android:name=".Activity.SelectedSubredditsActivity"
|
||||
android:label="@string/selected_subeddits_activity_label"
|
||||
android:parentActivityName=".Activity.MainActivity"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
<activity android:name=".Activity.EditMultiRedditActivity"
|
||||
<activity
|
||||
android:name=".Activity.EditMultiRedditActivity"
|
||||
android:label="@string/edit_multi_reddit_activity_label"
|
||||
android:parentActivityName=".Activity.MainActivity"
|
||||
android:theme="@style/AppTheme.NoActionBar"/>
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
<activity
|
||||
android:name=".Activity.ThemePreviewActivity"
|
||||
android:label="@string/theme_preview_activity_label"
|
||||
|
@ -302,11 +302,11 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
||||
int backgroundColor = mCustomThemeWrapper.getBackgroundColor();
|
||||
drawer.setBackgroundColor(backgroundColor);
|
||||
drawer.setStatusBarBackgroundColor(mCustomThemeWrapper.getColorPrimaryDark());
|
||||
int primaryIconColor = mCustomThemeWrapper.getPrimaryIconColor();
|
||||
subscriptionsBottomAppBar.setColorFilter(primaryIconColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
multiRedditBottomAppBar.setColorFilter(primaryIconColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
messageBottomAppBar.setColorFilter(primaryIconColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
profileBottomAppBar.setColorFilter(primaryIconColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
int bottomAppBarIconColor = mCustomThemeWrapper.getBottomAppBarIconColor();
|
||||
subscriptionsBottomAppBar.setColorFilter(bottomAppBarIconColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
multiRedditBottomAppBar.setColorFilter(bottomAppBarIconColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
messageBottomAppBar.setColorFilter(bottomAppBarIconColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
profileBottomAppBar.setColorFilter(bottomAppBarIconColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
navigationView.setBackgroundColor(backgroundColor);
|
||||
applyAppBarLayoutAndToolbarTheme(appBarLayout, toolbar);
|
||||
applyTabLayoutTheme(tabLayout);
|
||||
|
@ -0,0 +1,213 @@
|
||||
package ml.docilealligator.infinityforreddit.Activity;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import ml.docilealligator.infinityforreddit.Adapter.ReportReasonRecyclerViewAdapter;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
|
||||
import ml.docilealligator.infinityforreddit.FetchRules;
|
||||
import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.ReportReason;
|
||||
import ml.docilealligator.infinityforreddit.ReportThing;
|
||||
import ml.docilealligator.infinityforreddit.Rule;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
public class ReportActivity extends BaseActivity {
|
||||
|
||||
public static final String EXTRA_SUBREDDIT_NAME = "ESN";
|
||||
public static final String EXTRA_THING_FULLNAME = "ETF";
|
||||
private static final String NULL_ACCESS_TOKEN_STATE = "NATS";
|
||||
private static final String ACCESS_TOKEN_STATE = "ATS";
|
||||
private static final String GENERAL_REASONS_STATE = "GRS";
|
||||
private static final String RULES_REASON_STATE = "RRS";
|
||||
|
||||
@BindView(R.id.coordinator_layout_report_activity)
|
||||
CoordinatorLayout coordinatorLayout;
|
||||
@BindView(R.id.appbar_layout_report_activity)
|
||||
AppBarLayout appBarLayout;
|
||||
@BindView(R.id.toolbar_report_activity)
|
||||
Toolbar toolbar;
|
||||
@BindView(R.id.recycler_view_report_activity)
|
||||
RecyclerView recyclerView;
|
||||
@Inject
|
||||
@Named("oauth")
|
||||
Retrofit mOauthRetrofit;
|
||||
@Inject
|
||||
@Named("no_oauth")
|
||||
Retrofit mRetrofit;
|
||||
@Inject
|
||||
@Named("default")
|
||||
SharedPreferences mSharedPreferences;
|
||||
@Inject
|
||||
RedditDataRoomDatabase mRedditDataRoomDatabase;
|
||||
@Inject
|
||||
CustomThemeWrapper mCustomThemeWrapper;
|
||||
private boolean mNullAccessToken = false;
|
||||
private String mAccessToken;
|
||||
private String mFullname;
|
||||
private String mSubredditName;
|
||||
private ArrayList<ReportReason> generalReasons;
|
||||
private ArrayList<ReportReason> rulesReasons;
|
||||
private ReportReasonRecyclerViewAdapter mAdapter;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
((Infinity) getApplication()).getAppComponent().inject(this);
|
||||
|
||||
setImmersiveModeNotApplicable();
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_report);
|
||||
|
||||
ButterKnife.bind(this);
|
||||
|
||||
applyCustomTheme();
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && isChangeStatusBarIconColor()) {
|
||||
addOnOffsetChangedListener(appBarLayout);
|
||||
}
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
mFullname = getIntent().getStringExtra(EXTRA_THING_FULLNAME);
|
||||
mSubredditName = getIntent().getStringExtra(EXTRA_SUBREDDIT_NAME);
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
mNullAccessToken = savedInstanceState.getBoolean(NULL_ACCESS_TOKEN_STATE);
|
||||
mAccessToken = savedInstanceState.getString(ACCESS_TOKEN_STATE);
|
||||
|
||||
if (!mNullAccessToken && mAccessToken == null) {
|
||||
getCurrentAccount();
|
||||
}
|
||||
|
||||
generalReasons = savedInstanceState.getParcelableArrayList(GENERAL_REASONS_STATE);
|
||||
rulesReasons = savedInstanceState.getParcelableArrayList(RULES_REASON_STATE);
|
||||
} else {
|
||||
getCurrentAccount();
|
||||
}
|
||||
|
||||
if (generalReasons != null) {
|
||||
mAdapter = new ReportReasonRecyclerViewAdapter(mCustomThemeWrapper, generalReasons);
|
||||
} else {
|
||||
mAdapter = new ReportReasonRecyclerViewAdapter(mCustomThemeWrapper, ReportReason.getGeneralReasons(this));
|
||||
}
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||
recyclerView.setAdapter(mAdapter);
|
||||
|
||||
if (rulesReasons == null) {
|
||||
FetchRules.fetchRules(mRetrofit, mSubredditName, new FetchRules.FetchRulesListener() {
|
||||
@Override
|
||||
public void success(ArrayList<Rule> rules) {
|
||||
mAdapter.setRules(ReportReason.convertRulesToReasons(rules));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failed() {
|
||||
Snackbar.make(coordinatorLayout, R.string.error_loading_rules_without_retry, Snackbar.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
mAdapter.setRules(rulesReasons);
|
||||
}
|
||||
}
|
||||
|
||||
private void getCurrentAccount() {
|
||||
new GetCurrentAccountAsyncTask(mRedditDataRoomDatabase.accountDao(), account -> {
|
||||
if (account == null) {
|
||||
mNullAccessToken = true;
|
||||
} else {
|
||||
mAccessToken = account.getAccessToken();
|
||||
}
|
||||
}).execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.report_activity, menu);
|
||||
applyMenuItemTheme(menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
finish();
|
||||
return true;
|
||||
case R.id.action_send_report_activity:
|
||||
ReportReason reportReason = mAdapter.getSelectedReason();
|
||||
if (reportReason != null) {
|
||||
Toast.makeText(ReportActivity.this, R.string.reporting, Toast.LENGTH_SHORT).show();
|
||||
ReportThing.reportThing(mOauthRetrofit, mAccessToken, mFullname, mSubredditName,
|
||||
reportReason.getReasonType(), reportReason.getReportReason(), new ReportThing.ReportThingListener() {
|
||||
@Override
|
||||
public void success() {
|
||||
Toast.makeText(ReportActivity.this, R.string.report_successful, Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failed() {
|
||||
Toast.makeText(ReportActivity.this, R.string.report_failed, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Toast.makeText(ReportActivity.this, R.string.report_reason_not_selected, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putBoolean(NULL_ACCESS_TOKEN_STATE, mNullAccessToken);
|
||||
outState.putString(ACCESS_TOKEN_STATE, mAccessToken);
|
||||
if (mAdapter != null) {
|
||||
outState.putParcelableArrayList(GENERAL_REASONS_STATE, mAdapter.getGeneralReasons());
|
||||
outState.putParcelableArrayList(RULES_REASON_STATE, mAdapter.getRules());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SharedPreferences getSharedPreferences() {
|
||||
return mSharedPreferences;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CustomThemeWrapper getCustomThemeWrapper() {
|
||||
return mCustomThemeWrapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyCustomTheme() {
|
||||
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
|
||||
applyAppBarLayoutAndToolbarTheme(appBarLayout, toolbar);
|
||||
}
|
||||
}
|
@ -2,7 +2,6 @@ package ml.docilealligator.infinityforreddit.Activity;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.MenuItem;
|
||||
@ -22,9 +21,6 @@ import com.google.android.material.appbar.AppBarLayout;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@ -36,15 +32,10 @@ import butterknife.ButterKnife;
|
||||
import ml.docilealligator.infinityforreddit.Adapter.RulesRecyclerViewAdapter;
|
||||
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
|
||||
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
|
||||
import ml.docilealligator.infinityforreddit.FetchRules;
|
||||
import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditAPI;
|
||||
import ml.docilealligator.infinityforreddit.Rule;
|
||||
import ml.docilealligator.infinityforreddit.Utils.JSONUtils;
|
||||
import ml.docilealligator.infinityforreddit.Utils.Utils;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
public class RulesActivity extends BaseActivity {
|
||||
@ -116,7 +107,26 @@ public class RulesActivity extends BaseActivity {
|
||||
mAdapter = new RulesRecyclerViewAdapter(this, mCustomThemeWrapper);
|
||||
recyclerView.setAdapter(mAdapter);
|
||||
|
||||
fetchRules();
|
||||
//fetchRules();
|
||||
|
||||
FetchRules.fetchRules(mRetrofit, mSubredditName, new FetchRules.FetchRulesListener() {
|
||||
@Override
|
||||
public void success(ArrayList<Rule> rules) {
|
||||
progressBar.setVisibility(View.GONE);
|
||||
if (rules == null || rules.size() == 0) {
|
||||
errorTextView.setVisibility(View.VISIBLE);
|
||||
errorTextView.setText(R.string.no_rule);
|
||||
errorTextView.setOnClickListener(view -> {
|
||||
});
|
||||
}
|
||||
mAdapter.changeDataset(rules);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failed() {
|
||||
displayError();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -137,7 +147,7 @@ public class RulesActivity extends BaseActivity {
|
||||
errorTextView.setTextColor(mCustomThemeWrapper.getSecondaryTextColor());
|
||||
}
|
||||
|
||||
private void fetchRules() {
|
||||
/*private void fetchRules() {
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
errorTextView.setVisibility(View.GONE);
|
||||
|
||||
@ -175,13 +185,34 @@ public class RulesActivity extends BaseActivity {
|
||||
displayError();
|
||||
}
|
||||
});
|
||||
}
|
||||
}*/
|
||||
|
||||
private void displayError() {
|
||||
progressBar.setVisibility(View.GONE);
|
||||
errorTextView.setVisibility(View.VISIBLE);
|
||||
errorTextView.setText(R.string.error_loading_rules);
|
||||
errorTextView.setOnClickListener(view -> fetchRules());
|
||||
errorTextView.setOnClickListener(view -> {
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
errorTextView.setVisibility(View.GONE);
|
||||
FetchRules.fetchRules(mRetrofit, mSubredditName, new FetchRules.FetchRulesListener() {
|
||||
@Override
|
||||
public void success(ArrayList<Rule> rules) {
|
||||
progressBar.setVisibility(View.GONE);
|
||||
if (rules == null || rules.size() == 0) {
|
||||
errorTextView.setVisibility(View.VISIBLE);
|
||||
errorTextView.setText(R.string.no_rule);
|
||||
errorTextView.setOnClickListener(view -> {
|
||||
});
|
||||
}
|
||||
mAdapter.changeDataset(rules);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failed() {
|
||||
displayError();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -205,7 +236,7 @@ public class RulesActivity extends BaseActivity {
|
||||
finish();
|
||||
}
|
||||
|
||||
private static class ParseRulesAsyncTask extends AsyncTask<Void, ArrayList<Rule>, ArrayList<Rule>> {
|
||||
/*private static class ParseRulesAsyncTask extends AsyncTask<Void, ArrayList<Rule>, ArrayList<Rule>> {
|
||||
private String response;
|
||||
private ParseRulesAsyncTaskListener parseRulesAsyncTaskListener;
|
||||
|
||||
@ -248,5 +279,5 @@ public class RulesActivity extends BaseActivity {
|
||||
|
||||
void parseFailed();
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
@ -323,11 +323,11 @@ public class ThemePreviewActivity extends AppCompatActivity {
|
||||
primaryTextView.setTextColor(customTheme.primaryTextColor);
|
||||
secondaryTextView.setTextColor(customTheme.secondaryTextColor);
|
||||
bottomNavigationView.setBackgroundTint(ColorStateList.valueOf(customTheme.bottomAppBarBackgroundColor));
|
||||
int primaryIconColor = customTheme.primaryIconColor;
|
||||
subscriptionsBottomAppBar.setColorFilter(primaryIconColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
multiRedditBottomAppBar.setColorFilter(primaryIconColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
messageBottomAppBar.setColorFilter(primaryIconColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
profileBottomAppBar.setColorFilter(primaryIconColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
int bottomAppBarIconColor = customTheme.bottomAppBarIconColor;
|
||||
subscriptionsBottomAppBar.setColorFilter(bottomAppBarIconColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
multiRedditBottomAppBar.setColorFilter(bottomAppBarIconColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
messageBottomAppBar.setColorFilter(bottomAppBarIconColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
profileBottomAppBar.setColorFilter(bottomAppBarIconColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
applyTabLayoutTheme(tabLayout);
|
||||
applyFABTheme(fab);
|
||||
unsubscribedColor = customTheme.unsubscribed;
|
||||
|
@ -64,14 +64,14 @@ import ml.docilealligator.infinityforreddit.Event.PostUpdateEventToDetailActivit
|
||||
import ml.docilealligator.infinityforreddit.Event.PostUpdateEventToPostList;
|
||||
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
|
||||
import ml.docilealligator.infinityforreddit.FetchComment;
|
||||
import ml.docilealligator.infinityforreddit.FetchPost;
|
||||
import ml.docilealligator.infinityforreddit.Post.FetchPost;
|
||||
import ml.docilealligator.infinityforreddit.Flair;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.FlairBottomSheetFragment;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.PostCommentSortTypeBottomSheetFragment;
|
||||
import ml.docilealligator.infinityforreddit.HidePost;
|
||||
import ml.docilealligator.infinityforreddit.Post.HidePost;
|
||||
import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.ParseComment;
|
||||
import ml.docilealligator.infinityforreddit.ParsePost;
|
||||
import ml.docilealligator.infinityforreddit.Post.ParsePost;
|
||||
import ml.docilealligator.infinityforreddit.Post.Post;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.ReadMessage;
|
||||
@ -473,6 +473,8 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
|
||||
hideItem.setVisible(true);
|
||||
hideItem.setTitle(R.string.action_hide_post);
|
||||
}
|
||||
|
||||
mMenu.findItem(R.id.action_report_view_post_detail_activity).setVisible(true);
|
||||
} else {
|
||||
saveItem.setVisible(false);
|
||||
hideItem.setVisible(false);
|
||||
@ -622,6 +624,8 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
|
||||
hideItem.setVisible(true);
|
||||
hideItem.setTitle(R.string.action_hide_post);
|
||||
}
|
||||
|
||||
mMenu.findItem(R.id.action_report_view_post_detail_activity).setVisible(true);
|
||||
} else {
|
||||
saveItem.setVisible(false);
|
||||
hideItem.setVisible(false);
|
||||
@ -931,6 +935,8 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
|
||||
hideItem.setVisible(true);
|
||||
hideItem.setTitle(R.string.action_hide_post);
|
||||
}
|
||||
|
||||
mMenu.findItem(R.id.action_report_view_post_detail_activity).setVisible(true);
|
||||
} else {
|
||||
saveItem.setVisible(false);
|
||||
hideItem.setVisible(false);
|
||||
@ -1264,6 +1270,8 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
|
||||
hideItem.setVisible(true);
|
||||
hideItem.setTitle(R.string.action_hide_post);
|
||||
}
|
||||
|
||||
mMenu.findItem(R.id.action_report_view_post_detail_activity).setVisible(true);
|
||||
} else {
|
||||
saveItem.setVisible(false);
|
||||
hideItem.setVisible(false);
|
||||
@ -1481,6 +1489,11 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
|
||||
flairBottomSheetFragment.setArguments(bundle);
|
||||
flairBottomSheetFragment.show(getSupportFragmentManager(), flairBottomSheetFragment.getTag());
|
||||
return true;
|
||||
case R.id.action_report_view_post_detail_activity:
|
||||
Intent intent = new Intent(this, ReportActivity.class);
|
||||
intent.putExtra(ReportActivity.EXTRA_SUBREDDIT_NAME, mPost.getSubredditName());
|
||||
intent.putExtra(ReportActivity.EXTRA_THING_FULLNAME, mPost.getFullName());
|
||||
startActivity(intent);
|
||||
case android.R.id.home:
|
||||
onBackPressed();
|
||||
return true;
|
||||
|
@ -41,6 +41,9 @@ import com.google.android.material.tabs.TabLayout;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
@ -119,6 +122,10 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
TextView nSubscribersTextView;
|
||||
@BindView(R.id.online_subscriber_count_text_view_view_subreddit_detail_activity)
|
||||
TextView nOnlineSubscribersTextView;
|
||||
@BindView(R.id.since_text_view_view_subreddit_detail_activity)
|
||||
TextView sinceTextView;
|
||||
@BindView(R.id.creation_time_text_view_view_subreddit_detail_activity)
|
||||
TextView creationTimeTextView;
|
||||
@BindView(R.id.description_text_view_view_subreddit_detail_activity)
|
||||
TextView descriptionTextView;
|
||||
@BindView(R.id.bottom_navigation_view_subreddit_detail_activity)
|
||||
@ -322,6 +329,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
glide = Glide.with(this);
|
||||
Locale locale = getResources().getConfiguration().locale;
|
||||
|
||||
mSubredditViewModel = new ViewModelProvider(this,
|
||||
new SubredditViewModel.Factory(getApplication(), mRedditDataRoomDatabase, subredditName))
|
||||
@ -370,6 +378,8 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
subredditNameTextView.setText(subredditFullName);
|
||||
String nSubscribers = getString(R.string.subscribers_number_detail, subredditData.getNSubscribers());
|
||||
nSubscribersTextView.setText(nSubscribers);
|
||||
creationTimeTextView.setText(new SimpleDateFormat("MMM d, yyyy",
|
||||
locale).format(subredditData.getCreatedUTC()));
|
||||
if (subredditData.getDescription().equals("")) {
|
||||
descriptionTextView.setVisibility(View.GONE);
|
||||
} else {
|
||||
@ -416,13 +426,15 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
int primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor();
|
||||
nSubscribersTextView.setTextColor(primaryTextColor);
|
||||
nOnlineSubscribersTextView.setTextColor(primaryTextColor);
|
||||
sinceTextView.setTextColor(primaryTextColor);
|
||||
creationTimeTextView.setTextColor(primaryTextColor);
|
||||
descriptionTextView.setTextColor(primaryTextColor);
|
||||
bottomNavigationView.setBackgroundTint(ColorStateList.valueOf(mCustomThemeWrapper.getBottomAppBarBackgroundColor()));
|
||||
int primaryIconColor = mCustomThemeWrapper.getPrimaryIconColor();
|
||||
subscriptionsBottomAppBar.setColorFilter(primaryIconColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
multiRedditBottomAppBar.setColorFilter(primaryIconColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
messageBottomAppBar.setColorFilter(primaryIconColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
profileBottomAppBar.setColorFilter(primaryIconColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
int bottomAppBarIconColor = mCustomThemeWrapper.getBottomAppBarIconColor();
|
||||
subscriptionsBottomAppBar.setColorFilter(bottomAppBarIconColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
multiRedditBottomAppBar.setColorFilter(bottomAppBarIconColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
messageBottomAppBar.setColorFilter(bottomAppBarIconColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
profileBottomAppBar.setColorFilter(bottomAppBarIconColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
applyTabLayoutTheme(tabLayout);
|
||||
applyFABTheme(fab);
|
||||
unsubscribedColor = mCustomThemeWrapper.getUnsubscribed();
|
||||
@ -706,6 +718,16 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
sidebarIntent.putExtra(ViewSidebarActivity.EXTRA_SUBREDDIT_NAME, subredditName);
|
||||
startActivity(sidebarIntent);
|
||||
return true;
|
||||
case R.id.action_share_view_subreddit_detail_activity:
|
||||
Intent shareIntent = new Intent(Intent.ACTION_SEND);
|
||||
shareIntent.setType("text/plain");
|
||||
shareIntent.putExtra(Intent.EXTRA_TEXT, "https://www.reddit.com/r/" + subredditName);
|
||||
if (shareIntent.resolveActivity(getPackageManager()) != null) {
|
||||
startActivity(Intent.createChooser(shareIntent, getString(R.string.share)));
|
||||
} else {
|
||||
Toast.makeText(this, R.string.no_app, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -40,6 +40,9 @@ import com.google.android.material.tabs.TabLayout;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
@ -116,6 +119,10 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
||||
Chip subscribeUserChip;
|
||||
@BindView(R.id.karma_text_view_view_user_detail_activity)
|
||||
TextView karmaTextView;
|
||||
@BindView(R.id.cakeday_text_view_view_user_detail_activity)
|
||||
TextView cakedayTextView;
|
||||
@BindView(R.id.description_text_view_view_user_detail_activity)
|
||||
TextView descriptionTextView;
|
||||
@Inject
|
||||
@Named("no_oauth")
|
||||
Retrofit mRetrofit;
|
||||
@ -274,15 +281,14 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
||||
|
||||
subscribedUserDao = mRedditDataRoomDatabase.subscribedUserDao();
|
||||
glide = Glide.with(this);
|
||||
Locale locale = getResources().getConfiguration().locale;
|
||||
|
||||
userViewModel = new ViewModelProvider(this, new UserViewModel.Factory(getApplication(), mRedditDataRoomDatabase, username))
|
||||
.get(UserViewModel.class);
|
||||
userViewModel.getUserLiveData().observe(this, userData -> {
|
||||
if (userData != null) {
|
||||
if (userData.getBanner().equals("")) {
|
||||
bannerImageView.setOnClickListener(view -> {
|
||||
//Do nothing since the user has no banner image
|
||||
});
|
||||
bannerImageView.setOnClickListener(null);
|
||||
} else {
|
||||
glide.load(userData.getBanner()).into(bannerImageView);
|
||||
bannerImageView.setOnClickListener(view -> {
|
||||
@ -297,9 +303,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
||||
glide.load(getDrawable(R.drawable.subreddit_default_icon))
|
||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(216, 0)))
|
||||
.into(iconGifImageView);
|
||||
iconGifImageView.setOnClickListener(view -> {
|
||||
//Do nothing since the user has no icon image
|
||||
});
|
||||
iconGifImageView.setOnClickListener(null);
|
||||
} else {
|
||||
glide.load(userData.getIconUrl())
|
||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(216, 0)))
|
||||
@ -387,8 +391,17 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
||||
if (!title.equals(userFullName)) {
|
||||
getSupportActionBar().setTitle(userFullName);
|
||||
}
|
||||
String karma = getString(R.string.karma_info, userData.getKarma());
|
||||
String karma = getString(R.string.karma_info_user_detail, userData.getKarma(), userData.getLinkKarma(), userData.getCommentKarma());
|
||||
karmaTextView.setText(karma);
|
||||
cakedayTextView.setText(getString(R.string.cakeday_info, new SimpleDateFormat("MMM d, yyyy",
|
||||
locale).format(userData.getCakeday())));
|
||||
|
||||
if (userData.getDescription() == null || userData.getDescription().equals("")) {
|
||||
descriptionTextView.setVisibility(View.GONE);
|
||||
} else {
|
||||
descriptionTextView.setVisibility(View.VISIBLE);
|
||||
descriptionTextView.setText(userData.getDescription());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -432,6 +445,8 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
||||
subscribedColor = mCustomThemeWrapper.getSubscribed();
|
||||
userNameTextView.setTextColor(mCustomThemeWrapper.getUsername());
|
||||
karmaTextView.setTextColor(mCustomThemeWrapper.getPrimaryTextColor());
|
||||
cakedayTextView.setTextColor(mCustomThemeWrapper.getPrimaryTextColor());
|
||||
descriptionTextView.setTextColor(mCustomThemeWrapper.getPrimaryTextColor());
|
||||
subscribeUserChip.setTextColor(mCustomThemeWrapper.getChipTextColor());
|
||||
applyTabLayoutTheme(tabLayout);
|
||||
}
|
||||
@ -621,6 +636,16 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
||||
case R.id.action_change_post_layout_view_user_detail_activity:
|
||||
postLayoutBottomSheetFragment.show(getSupportFragmentManager(), postLayoutBottomSheetFragment.getTag());
|
||||
return true;
|
||||
case R.id.action_share_view_user_detail_activity:
|
||||
Intent shareIntent = new Intent(Intent.ACTION_SEND);
|
||||
shareIntent.setType("text/plain");
|
||||
shareIntent.putExtra(Intent.EXTRA_TEXT, "https://www.reddit.com/user/" + username);
|
||||
if (shareIntent.resolveActivity(getPackageManager()) != null) {
|
||||
startActivity(Intent.createChooser(shareIntent, getString(R.string.share)));
|
||||
} else {
|
||||
Toast.makeText(this, R.string.no_app, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -834,7 +834,6 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
||||
if (comment.getAuthorFlairHTML() != null && !comment.getAuthorFlairHTML().equals("")) {
|
||||
((CommentViewHolder) holder).authorFlairTextView.setVisibility(View.VISIBLE);
|
||||
Utils.setHTMLWithImageToTextView(((CommentViewHolder) holder).authorFlairTextView, comment.getAuthorFlairHTML());
|
||||
((CommentViewHolder) holder).authorFlairTextView.setOnClickListener(view -> ((CommentViewHolder) holder).authorTextView.performClick());
|
||||
} else if (comment.getAuthorFlair() != null && !comment.getAuthorFlair().equals("")) {
|
||||
((CommentViewHolder) holder).authorFlairTextView.setVisibility(View.VISIBLE);
|
||||
((CommentViewHolder) holder).authorFlairTextView.setText(comment.getAuthorFlair());
|
||||
@ -924,39 +923,6 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
||||
((CommentViewHolder) holder).verticalBlock.setLayoutParams(params);
|
||||
}
|
||||
|
||||
if (mCommentToolbarHideOnClick) {
|
||||
View.OnClickListener hideToolbarOnClickListener = view -> {
|
||||
if (((CommentViewHolder) holder).bottomConstraintLayout.getLayoutParams().height == 0) {
|
||||
((CommentViewHolder) holder).bottomConstraintLayout.getLayoutParams().height = LinearLayout.LayoutParams.WRAP_CONTENT;
|
||||
((CommentViewHolder) holder).topScoreTextView.setVisibility(View.GONE);
|
||||
((ViewPostDetailActivity) mActivity).delayTransition();
|
||||
} else {
|
||||
((ViewPostDetailActivity) mActivity).delayTransition();
|
||||
((CommentViewHolder) holder).bottomConstraintLayout.getLayoutParams().height = 0;
|
||||
((CommentViewHolder) holder).topScoreTextView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
};
|
||||
((CommentViewHolder) holder).linearLayout.setOnClickListener(hideToolbarOnClickListener);
|
||||
((CommentViewHolder) holder).commentMarkdownView.setOnClickListener(hideToolbarOnClickListener);
|
||||
((CommentViewHolder) holder).commentTimeTextView.setOnClickListener(hideToolbarOnClickListener);
|
||||
}
|
||||
|
||||
((CommentViewHolder) holder).moreButton.setOnClickListener(view -> {
|
||||
Bundle bundle = new Bundle();
|
||||
if (!mPost.isArchived() && !mPost.isLocked() && comment.getAuthor().equals(mAccountName)) {
|
||||
bundle.putString(CommentMoreBottomSheetFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
|
||||
}
|
||||
bundle.putParcelable(CommentMoreBottomSheetFragment.EXTRA_COMMENT, comment);
|
||||
if (mIsSingleCommentThreadMode) {
|
||||
bundle.putInt(CommentMoreBottomSheetFragment.EXTRA_POSITION, holder.getAdapterPosition() - 2);
|
||||
} else {
|
||||
bundle.putInt(CommentMoreBottomSheetFragment.EXTRA_POSITION, holder.getAdapterPosition() - 1);
|
||||
}
|
||||
CommentMoreBottomSheetFragment commentMoreBottomSheetFragment = new CommentMoreBottomSheetFragment();
|
||||
commentMoreBottomSheetFragment.setArguments(bundle);
|
||||
commentMoreBottomSheetFragment.show(mActivity.getSupportFragmentManager(), commentMoreBottomSheetFragment.getTag());
|
||||
});
|
||||
|
||||
if (comment.hasReply()) {
|
||||
if (comment.isExpanded()) {
|
||||
((CommentViewHolder) holder).expandButton.setImageResource(R.drawable.ic_expand_less_grey_24dp);
|
||||
@ -997,239 +963,11 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
||||
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.getCommentMarkdown());
|
||||
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 previousVoteType = comment.getVoteType();
|
||||
String newVoteType;
|
||||
|
||||
((CommentViewHolder) holder).downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
|
||||
if (previousVoteType != CommentData.VOTE_TYPE_UPVOTE) {
|
||||
//Not upvoted before
|
||||
comment.setVoteType(CommentData.VOTE_TYPE_UPVOTE);
|
||||
newVoteType = RedditUtils.DIR_UPVOTE;
|
||||
((CommentViewHolder) holder).upvoteButton.setColorFilter(mUpvotedColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
((CommentViewHolder) holder).scoreTextView.setTextColor(mUpvotedColor);
|
||||
} else {
|
||||
//Upvoted before
|
||||
comment.setVoteType(CommentData.VOTE_TYPE_NO_VOTE);
|
||||
newVoteType = RedditUtils.DIR_UNVOTE;
|
||||
((CommentViewHolder) holder).upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
((CommentViewHolder) holder).scoreTextView.setTextColor(mCommentIconAndInfoColor);
|
||||
}
|
||||
|
||||
((CommentViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
|
||||
comment.getScore() + comment.getVoteType()));
|
||||
((CommentViewHolder) holder).topScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
|
||||
comment.getScore() + comment.getVoteType()) + " pts");
|
||||
|
||||
VoteThing.voteThing(mActivity, mOauthRetrofit, mAccessToken, new VoteThing.VoteThingListener() {
|
||||
@Override
|
||||
public void onVoteThingSuccess(int position) {
|
||||
if (newVoteType.equals(RedditUtils.DIR_UPVOTE)) {
|
||||
comment.setVoteType(CommentData.VOTE_TYPE_UPVOTE);
|
||||
((CommentViewHolder) holder).upvoteButton.setColorFilter(mUpvotedColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
((CommentViewHolder) holder).scoreTextView.setTextColor(mUpvotedColor);
|
||||
} else {
|
||||
comment.setVoteType(CommentData.VOTE_TYPE_NO_VOTE);
|
||||
((CommentViewHolder) holder).upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
((CommentViewHolder) holder).scoreTextView.setTextColor(mCommentIconAndInfoColor);
|
||||
}
|
||||
|
||||
((CommentViewHolder) holder).downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
((CommentViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
|
||||
comment.getScore() + comment.getVoteType()));
|
||||
((CommentViewHolder) holder).topScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
|
||||
comment.getScore() + comment.getVoteType()) + " pts");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVoteThingFail(int position) {
|
||||
}
|
||||
}, comment.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 previousVoteType = comment.getVoteType();
|
||||
String newVoteType;
|
||||
|
||||
((CommentViewHolder) holder).upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
|
||||
if (previousVoteType != CommentData.VOTE_TYPE_DOWNVOTE) {
|
||||
//Not downvoted before
|
||||
comment.setVoteType(CommentData.VOTE_TYPE_DOWNVOTE);
|
||||
newVoteType = RedditUtils.DIR_DOWNVOTE;
|
||||
((CommentViewHolder) holder).downvoteButton.setColorFilter(mDownvotedColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
((CommentViewHolder) holder).scoreTextView.setTextColor(mDownvotedColor);
|
||||
} else {
|
||||
//Downvoted before
|
||||
comment.setVoteType(CommentData.VOTE_TYPE_NO_VOTE);
|
||||
newVoteType = RedditUtils.DIR_UNVOTE;
|
||||
((CommentViewHolder) holder).downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
((CommentViewHolder) holder).scoreTextView.setTextColor(mCommentIconAndInfoColor);
|
||||
}
|
||||
|
||||
((CommentViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
|
||||
comment.getScore() + comment.getVoteType()));
|
||||
((CommentViewHolder) holder).topScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
|
||||
comment.getScore() + comment.getVoteType()) + " pts");
|
||||
|
||||
VoteThing.voteThing(mActivity, mOauthRetrofit, mAccessToken, new VoteThing.VoteThingListener() {
|
||||
@Override
|
||||
public void onVoteThingSuccess(int position1) {
|
||||
if (newVoteType.equals(RedditUtils.DIR_DOWNVOTE)) {
|
||||
comment.setVoteType(CommentData.VOTE_TYPE_DOWNVOTE);
|
||||
((CommentViewHolder) holder).downvoteButton.setColorFilter(mDownvotedColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
((CommentViewHolder) holder).scoreTextView.setTextColor(mDownvotedColor);
|
||||
} else {
|
||||
comment.setVoteType(CommentData.VOTE_TYPE_NO_VOTE);
|
||||
((CommentViewHolder) holder).downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
((CommentViewHolder) holder).scoreTextView.setTextColor(mCommentIconAndInfoColor);
|
||||
}
|
||||
|
||||
((CommentViewHolder) holder).upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
((CommentViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
|
||||
comment.getScore() + comment.getVoteType()));
|
||||
((CommentViewHolder) holder).topScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
|
||||
comment.getScore() + comment.getVoteType()) + " pts");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVoteThingFail(int position1) {
|
||||
}
|
||||
}, comment.getFullName(), newVoteType, holder.getAdapterPosition());
|
||||
});
|
||||
|
||||
if (comment.isSaved()) {
|
||||
((CommentViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
|
||||
} else {
|
||||
((CommentViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
|
||||
}
|
||||
|
||||
((CommentViewHolder) holder).saveButton.setOnClickListener(view -> {
|
||||
if (comment.isSaved()) {
|
||||
comment.setSaved(false);
|
||||
SaveThing.unsaveThing(mOauthRetrofit, mAccessToken, comment.getFullName(), new SaveThing.SaveThingListener() {
|
||||
@Override
|
||||
public void success() {
|
||||
comment.setSaved(false);
|
||||
((CommentViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
|
||||
Toast.makeText(mActivity, R.string.comment_unsaved_success, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failed() {
|
||||
comment.setSaved(true);
|
||||
((CommentViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
|
||||
Toast.makeText(mActivity, R.string.comment_unsaved_failed, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
comment.setSaved(true);
|
||||
SaveThing.saveThing(mOauthRetrofit, mAccessToken, comment.getFullName(), new SaveThing.SaveThingListener() {
|
||||
@Override
|
||||
public void success() {
|
||||
comment.setSaved(true);
|
||||
((CommentViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
|
||||
Toast.makeText(mActivity, R.string.comment_saved_success, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failed() {
|
||||
comment.setSaved(false);
|
||||
((CommentViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
|
||||
Toast.makeText(mActivity, R.string.comment_saved_failed, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
((CommentViewHolder) holder).authorTextView.setOnClickListener(view -> {
|
||||
Intent intent = new Intent(mActivity, ViewUserDetailActivity.class);
|
||||
intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, comment.getAuthor());
|
||||
mActivity.startActivity(intent);
|
||||
});
|
||||
|
||||
((CommentViewHolder) holder).expandButton.setOnClickListener(view -> {
|
||||
if (((CommentViewHolder) holder).expandButton.getVisibility() == View.VISIBLE) {
|
||||
int commentPosition = mIsSingleCommentThreadMode ? holder.getAdapterPosition() - 2 : holder.getAdapterPosition() - 1;
|
||||
if(commentPosition >= 0 && commentPosition < mVisibleComments.size()) {
|
||||
if (mVisibleComments.get(commentPosition).isExpanded()) {
|
||||
collapseChildren(commentPosition);
|
||||
((CommentViewHolder) holder).expandButton.setImageResource(R.drawable.ic_expand_more_grey_24dp);
|
||||
} else {
|
||||
comment.setExpanded(true);
|
||||
ArrayList<CommentData> newList = new ArrayList<>();
|
||||
expandChildren(mVisibleComments.get(commentPosition).getChildren(), newList, 0);
|
||||
mVisibleComments.get(commentPosition).setExpanded(true);
|
||||
mVisibleComments.addAll(commentPosition + 1, newList);
|
||||
|
||||
if (mIsSingleCommentThreadMode) {
|
||||
notifyItemRangeInserted(commentPosition + 3, newList.size());
|
||||
} else {
|
||||
notifyItemRangeInserted(commentPosition + 2, newList.size());
|
||||
}
|
||||
((CommentViewHolder) holder).expandButton.setImageResource(R.drawable.ic_expand_less_grey_24dp);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
((CommentViewHolder) holder).commentMarkdownView.setOnLongClickListener(view -> {
|
||||
((CommentViewHolder) holder).expandButton.performClick();
|
||||
return true;
|
||||
});
|
||||
|
||||
((CommentViewHolder) holder).itemView.setOnLongClickListener(view -> {
|
||||
((CommentViewHolder) holder).expandButton.performClick();
|
||||
return true;
|
||||
});
|
||||
} else if (holder instanceof LoadMoreChildCommentsViewHolder) {
|
||||
CommentData placeholder;
|
||||
placeholder = mIsSingleCommentThreadMode ? mVisibleComments.get(holder.getAdapterPosition() - 2)
|
||||
@ -2208,6 +1946,287 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
||||
expandButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
saveButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
replyButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
|
||||
authorFlairTextView.setOnClickListener(view -> authorTextView.performClick());
|
||||
|
||||
View.OnClickListener hideToolbarOnClickListener = view -> {
|
||||
if (mCommentToolbarHideOnClick) {
|
||||
if (bottomConstraintLayout.getLayoutParams().height == 0) {
|
||||
bottomConstraintLayout.getLayoutParams().height = LinearLayout.LayoutParams.WRAP_CONTENT;
|
||||
topScoreTextView.setVisibility(View.GONE);
|
||||
((ViewPostDetailActivity) mActivity).delayTransition();
|
||||
} else {
|
||||
((ViewPostDetailActivity) mActivity).delayTransition();
|
||||
bottomConstraintLayout.getLayoutParams().height = 0;
|
||||
topScoreTextView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
};
|
||||
linearLayout.setOnClickListener(hideToolbarOnClickListener);
|
||||
commentMarkdownView.setOnClickListener(hideToolbarOnClickListener);
|
||||
commentTimeTextView.setOnClickListener(hideToolbarOnClickListener);
|
||||
|
||||
moreButton.setOnClickListener(view -> {
|
||||
CommentData comment = getCurrentComment();
|
||||
Bundle bundle = new Bundle();
|
||||
if (!mPost.isArchived() && !mPost.isLocked() && comment.getAuthor().equals(mAccountName)) {
|
||||
bundle.putString(CommentMoreBottomSheetFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
|
||||
}
|
||||
bundle.putParcelable(CommentMoreBottomSheetFragment.EXTRA_COMMENT, comment);
|
||||
if (mIsSingleCommentThreadMode) {
|
||||
bundle.putInt(CommentMoreBottomSheetFragment.EXTRA_POSITION, getAdapterPosition() - 2);
|
||||
} else {
|
||||
bundle.putInt(CommentMoreBottomSheetFragment.EXTRA_POSITION, getAdapterPosition() - 1);
|
||||
}
|
||||
CommentMoreBottomSheetFragment commentMoreBottomSheetFragment = new CommentMoreBottomSheetFragment();
|
||||
commentMoreBottomSheetFragment.setArguments(bundle);
|
||||
commentMoreBottomSheetFragment.show(mActivity.getSupportFragmentManager(), commentMoreBottomSheetFragment.getTag());
|
||||
});
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
CommentData comment = getCurrentComment();
|
||||
|
||||
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.getCommentMarkdown());
|
||||
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 (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;
|
||||
}
|
||||
|
||||
CommentData comment = getCurrentComment();
|
||||
int previousVoteType = comment.getVoteType();
|
||||
String newVoteType;
|
||||
|
||||
downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
|
||||
if (previousVoteType != CommentData.VOTE_TYPE_UPVOTE) {
|
||||
//Not upvoted before
|
||||
comment.setVoteType(CommentData.VOTE_TYPE_UPVOTE);
|
||||
newVoteType = RedditUtils.DIR_UPVOTE;
|
||||
upvoteButton.setColorFilter(mUpvotedColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
scoreTextView.setTextColor(mUpvotedColor);
|
||||
} else {
|
||||
//Upvoted before
|
||||
comment.setVoteType(CommentData.VOTE_TYPE_NO_VOTE);
|
||||
newVoteType = RedditUtils.DIR_UNVOTE;
|
||||
upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
scoreTextView.setTextColor(mCommentIconAndInfoColor);
|
||||
}
|
||||
|
||||
scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
|
||||
comment.getScore() + comment.getVoteType()));
|
||||
topScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
|
||||
comment.getScore() + comment.getVoteType()) + " pts");
|
||||
|
||||
VoteThing.voteThing(mActivity, mOauthRetrofit, mAccessToken, new VoteThing.VoteThingListener() {
|
||||
@Override
|
||||
public void onVoteThingSuccess(int position) {
|
||||
if (newVoteType.equals(RedditUtils.DIR_UPVOTE)) {
|
||||
comment.setVoteType(CommentData.VOTE_TYPE_UPVOTE);
|
||||
upvoteButton.setColorFilter(mUpvotedColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
scoreTextView.setTextColor(mUpvotedColor);
|
||||
} else {
|
||||
comment.setVoteType(CommentData.VOTE_TYPE_NO_VOTE);
|
||||
upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
scoreTextView.setTextColor(mCommentIconAndInfoColor);
|
||||
}
|
||||
|
||||
downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
|
||||
comment.getScore() + comment.getVoteType()));
|
||||
topScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
|
||||
comment.getScore() + comment.getVoteType()) + " pts");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVoteThingFail(int position) {
|
||||
}
|
||||
}, comment.getFullName(), newVoteType, getAdapterPosition());
|
||||
});
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
CommentData comment = getCurrentComment();
|
||||
int previousVoteType = comment.getVoteType();
|
||||
String newVoteType;
|
||||
|
||||
upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
|
||||
if (previousVoteType != CommentData.VOTE_TYPE_DOWNVOTE) {
|
||||
//Not downvoted before
|
||||
comment.setVoteType(CommentData.VOTE_TYPE_DOWNVOTE);
|
||||
newVoteType = RedditUtils.DIR_DOWNVOTE;
|
||||
downvoteButton.setColorFilter(mDownvotedColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
scoreTextView.setTextColor(mDownvotedColor);
|
||||
} else {
|
||||
//Downvoted before
|
||||
comment.setVoteType(CommentData.VOTE_TYPE_NO_VOTE);
|
||||
newVoteType = RedditUtils.DIR_UNVOTE;
|
||||
downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
scoreTextView.setTextColor(mCommentIconAndInfoColor);
|
||||
}
|
||||
|
||||
scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
|
||||
comment.getScore() + comment.getVoteType()));
|
||||
topScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
|
||||
comment.getScore() + comment.getVoteType()) + " pts");
|
||||
|
||||
VoteThing.voteThing(mActivity, mOauthRetrofit, mAccessToken, new VoteThing.VoteThingListener() {
|
||||
@Override
|
||||
public void onVoteThingSuccess(int position1) {
|
||||
if (newVoteType.equals(RedditUtils.DIR_DOWNVOTE)) {
|
||||
comment.setVoteType(CommentData.VOTE_TYPE_DOWNVOTE);
|
||||
downvoteButton.setColorFilter(mDownvotedColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
scoreTextView.setTextColor(mDownvotedColor);
|
||||
} else {
|
||||
comment.setVoteType(CommentData.VOTE_TYPE_NO_VOTE);
|
||||
downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
scoreTextView.setTextColor(mCommentIconAndInfoColor);
|
||||
}
|
||||
|
||||
upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
|
||||
comment.getScore() + comment.getVoteType()));
|
||||
topScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
|
||||
comment.getScore() + comment.getVoteType()) + " pts");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVoteThingFail(int position1) {
|
||||
}
|
||||
}, comment.getFullName(), newVoteType, getAdapterPosition());
|
||||
});
|
||||
|
||||
saveButton.setOnClickListener(view -> {
|
||||
CommentData comment = getCurrentComment();
|
||||
if (comment.isSaved()) {
|
||||
comment.setSaved(false);
|
||||
SaveThing.unsaveThing(mOauthRetrofit, mAccessToken, comment.getFullName(), new SaveThing.SaveThingListener() {
|
||||
@Override
|
||||
public void success() {
|
||||
comment.setSaved(false);
|
||||
saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
|
||||
Toast.makeText(mActivity, R.string.comment_unsaved_success, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failed() {
|
||||
comment.setSaved(true);
|
||||
saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
|
||||
Toast.makeText(mActivity, R.string.comment_unsaved_failed, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
comment.setSaved(true);
|
||||
SaveThing.saveThing(mOauthRetrofit, mAccessToken, comment.getFullName(), new SaveThing.SaveThingListener() {
|
||||
@Override
|
||||
public void success() {
|
||||
comment.setSaved(true);
|
||||
saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
|
||||
Toast.makeText(mActivity, R.string.comment_saved_success, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failed() {
|
||||
comment.setSaved(false);
|
||||
saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
|
||||
Toast.makeText(mActivity, R.string.comment_saved_failed, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
authorTextView.setOnClickListener(view -> {
|
||||
Intent intent = new Intent(mActivity, ViewUserDetailActivity.class);
|
||||
intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, getCurrentComment().getAuthor());
|
||||
mActivity.startActivity(intent);
|
||||
});
|
||||
|
||||
expandButton.setOnClickListener(view -> {
|
||||
if (expandButton.getVisibility() == View.VISIBLE) {
|
||||
int commentPosition = mIsSingleCommentThreadMode ? getAdapterPosition() - 2 : getAdapterPosition() - 1;
|
||||
if(commentPosition >= 0 && commentPosition < mVisibleComments.size()) {
|
||||
CommentData comment = getCurrentComment();
|
||||
if (mVisibleComments.get(commentPosition).isExpanded()) {
|
||||
collapseChildren(commentPosition);
|
||||
expandButton.setImageResource(R.drawable.ic_expand_more_grey_24dp);
|
||||
} else {
|
||||
comment.setExpanded(true);
|
||||
ArrayList<CommentData> newList = new ArrayList<>();
|
||||
expandChildren(mVisibleComments.get(commentPosition).getChildren(), newList, 0);
|
||||
mVisibleComments.get(commentPosition).setExpanded(true);
|
||||
mVisibleComments.addAll(commentPosition + 1, newList);
|
||||
|
||||
if (mIsSingleCommentThreadMode) {
|
||||
notifyItemRangeInserted(commentPosition + 3, newList.size());
|
||||
} else {
|
||||
notifyItemRangeInserted(commentPosition + 2, newList.size());
|
||||
}
|
||||
expandButton.setImageResource(R.drawable.ic_expand_less_grey_24dp);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
commentMarkdownView.setOnLongClickListener(view -> {
|
||||
expandButton.performClick();
|
||||
return true;
|
||||
});
|
||||
|
||||
itemView.setOnLongClickListener(view -> {
|
||||
expandButton.performClick();
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
private CommentData getCurrentComment() {
|
||||
CommentData comment;
|
||||
if (mIsSingleCommentThreadMode) {
|
||||
comment = mVisibleComments.get(getAdapterPosition() - 2);
|
||||
} else {
|
||||
comment = mVisibleComments.get(getAdapterPosition() - 1);
|
||||
}
|
||||
|
||||
return comment;
|
||||
}
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,130 @@
|
||||
package ml.docilealligator.infinityforreddit.Adapter;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.ReportReason;
|
||||
|
||||
public class ReportReasonRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
|
||||
private ArrayList<ReportReason> generalReasons;
|
||||
private ArrayList<ReportReason> rules;
|
||||
private int primaryTextColor;
|
||||
private int colorAccent;
|
||||
|
||||
public ReportReasonRecyclerViewAdapter(CustomThemeWrapper customThemeWrapper, ArrayList<ReportReason> generalReasons) {
|
||||
this.generalReasons = generalReasons;
|
||||
primaryTextColor = customThemeWrapper.getPrimaryTextColor();
|
||||
colorAccent = customThemeWrapper.getColorAccent();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new ReasonViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_report_reason, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
if (holder instanceof ReasonViewHolder) {
|
||||
ReportReason reportReason;
|
||||
if (position >= generalReasons.size()) {
|
||||
reportReason = rules.get(holder.getAdapterPosition() - generalReasons.size());
|
||||
} else {
|
||||
reportReason = generalReasons.get(holder.getAdapterPosition());
|
||||
}
|
||||
((ReasonViewHolder) holder).reasonTextView.setText(reportReason.getReportReason());
|
||||
((ReasonViewHolder) holder).checkBox.setChecked(reportReason.isSelected());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return rules == null ? generalReasons.size() : rules.size() + generalReasons.size();
|
||||
}
|
||||
|
||||
public void setRules(ArrayList<ReportReason> reportReasons) {
|
||||
this.rules = reportReasons;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public ReportReason getSelectedReason() {
|
||||
for (ReportReason reportReason : rules) {
|
||||
if (reportReason.isSelected()) {
|
||||
return reportReason;
|
||||
}
|
||||
}
|
||||
|
||||
for (ReportReason reportReason : generalReasons) {
|
||||
if (reportReason.isSelected()) {
|
||||
return reportReason;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public ArrayList<ReportReason> getGeneralReasons() {
|
||||
return generalReasons;
|
||||
}
|
||||
|
||||
public ArrayList<ReportReason> getRules() {
|
||||
return rules;
|
||||
}
|
||||
|
||||
class ReasonViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
@BindView(R.id.reason_text_view_item_report_reason)
|
||||
TextView reasonTextView;
|
||||
@BindView(R.id.check_box_item_report_reason)
|
||||
CheckBox checkBox;
|
||||
|
||||
ReasonViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
ButterKnife.bind(this, itemView);
|
||||
|
||||
reasonTextView.setTextColor(primaryTextColor);
|
||||
checkBox.setButtonTintList(ColorStateList.valueOf(colorAccent));
|
||||
|
||||
checkBox.setOnClickListener(view -> {
|
||||
for (int i = 0; i < generalReasons.size(); i++) {
|
||||
if (generalReasons.get(i).isSelected()) {
|
||||
generalReasons.get(i).setSelected(false);
|
||||
notifyItemChanged(i);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (rules != null) {
|
||||
for (int i = 0; i < rules.size(); i++) {
|
||||
if (rules.get(i).isSelected()) {
|
||||
rules.get(i).setSelected(false);
|
||||
notifyItemChanged(i + generalReasons.size());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (getAdapterPosition() >= generalReasons.size()) {
|
||||
rules.get(getAdapterPosition() - generalReasons.size()).setSelected(checkBox.isChecked());
|
||||
} else {
|
||||
generalReasons.get(getAdapterPosition()).setSelected(checkBox.isChecked());
|
||||
}
|
||||
});
|
||||
|
||||
itemView.setOnClickListener(view -> checkBox.performClick());
|
||||
}
|
||||
}
|
||||
}
|
@ -21,6 +21,7 @@ import ml.docilealligator.infinityforreddit.Activity.PostImageActivity;
|
||||
import ml.docilealligator.infinityforreddit.Activity.PostLinkActivity;
|
||||
import ml.docilealligator.infinityforreddit.Activity.PostTextActivity;
|
||||
import ml.docilealligator.infinityforreddit.Activity.PostVideoActivity;
|
||||
import ml.docilealligator.infinityforreddit.Activity.ReportActivity;
|
||||
import ml.docilealligator.infinityforreddit.Activity.RulesActivity;
|
||||
import ml.docilealligator.infinityforreddit.Activity.SearchActivity;
|
||||
import ml.docilealligator.infinityforreddit.Activity.SearchResultActivity;
|
||||
@ -161,4 +162,6 @@ public interface AppComponent {
|
||||
void inject(EditMultiRedditActivity editMultiRedditActivity);
|
||||
|
||||
void inject(SelectedSubredditsActivity selectedSubredditsActivity);
|
||||
|
||||
void inject(ReportActivity reportActivity);
|
||||
}
|
||||
|
@ -6,6 +6,11 @@ import android.content.SharedPreferences;
|
||||
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import com.google.android.exoplayer2.database.ExoDatabaseProvider;
|
||||
import com.google.android.exoplayer2.upstream.cache.LeastRecentlyUsedCacheEvictor;
|
||||
import com.google.android.exoplayer2.upstream.cache.SimpleCache;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.inject.Named;
|
||||
@ -13,6 +18,10 @@ import javax.inject.Singleton;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import im.ene.toro.exoplayer.Config;
|
||||
import im.ene.toro.exoplayer.ExoCreator;
|
||||
import im.ene.toro.exoplayer.MediaSourceBuilder;
|
||||
import im.ene.toro.exoplayer.ToroExo;
|
||||
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
|
||||
import ml.docilealligator.infinityforreddit.Utils.CustomThemeSharedPreferencesUtils;
|
||||
import ml.docilealligator.infinityforreddit.Utils.RedditUtils;
|
||||
@ -147,4 +156,14 @@ class AppModule {
|
||||
@Named("amoled_theme") SharedPreferences amoledThemeSharedPreferences) {
|
||||
return new CustomThemeWrapper(lightThemeSharedPreferences, darkThemeSharedPreferences, amoledThemeSharedPreferences);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
ExoCreator provideExoCreator() {
|
||||
SimpleCache cache = new SimpleCache(new File(mApplication.getCacheDir(), "/toro_cache"),
|
||||
new LeastRecentlyUsedCacheEvictor(200 * 1024 * 1024), new ExoDatabaseProvider(mApplication));
|
||||
Config config = new Config.Builder(mApplication).setMediaSourceBuilder(MediaSourceBuilder.LOOPING).setCache(cache)
|
||||
.build();
|
||||
return ToroExo.with(mApplication).getCreator(config);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,22 @@
|
||||
package ml.docilealligator.infinityforreddit.BroadcastReceiver;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
public class NetworkWifiStatusReceiver extends BroadcastReceiver {
|
||||
private NetworkWifiStatusReceiverListener networkWifiStatusReceiverListener;
|
||||
|
||||
public interface NetworkWifiStatusReceiverListener {
|
||||
void networkStatusChange();
|
||||
}
|
||||
|
||||
public NetworkWifiStatusReceiver(NetworkWifiStatusReceiverListener listener) {
|
||||
networkWifiStatusReceiverListener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
networkWifiStatusReceiverListener.networkStatusChange();
|
||||
}
|
||||
}
|
@ -51,6 +51,8 @@ public class CustomTheme {
|
||||
public int bottomAppBarBackgroundColor;
|
||||
@ColumnInfo(name = "primary_icon_color")
|
||||
public int primaryIconColor;
|
||||
@ColumnInfo(name = "bottom_app_bar_icon_color")
|
||||
public int bottomAppBarIconColor;
|
||||
@ColumnInfo(name = "post_icon_and_info_color")
|
||||
public int postIconAndInfoColor;
|
||||
@ColumnInfo(name = "comment_icon_and_info_color")
|
||||
@ -193,57 +195,58 @@ public class CustomTheme {
|
||||
customTheme.commentBackgroundColor = customThemeSettingsItems.get(16).colorValue;
|
||||
customTheme.bottomAppBarBackgroundColor = customThemeSettingsItems.get(17).colorValue;
|
||||
customTheme.primaryIconColor = customThemeSettingsItems.get(18).colorValue;
|
||||
customTheme.postIconAndInfoColor = customThemeSettingsItems.get(19).colorValue;
|
||||
customTheme.commentIconAndInfoColor = customThemeSettingsItems.get(20).colorValue;
|
||||
customTheme.fabIconColor = customThemeSettingsItems.get(21).colorValue;
|
||||
customTheme.toolbarPrimaryTextAndIconColor = customThemeSettingsItems.get(22).colorValue;
|
||||
customTheme.toolbarSecondaryTextColor = customThemeSettingsItems.get(23).colorValue;
|
||||
customTheme.circularProgressBarBackground = customThemeSettingsItems.get(24).colorValue;
|
||||
customTheme.tabLayoutWithExpandedCollapsingToolbarTabBackground = customThemeSettingsItems.get(25).colorValue;
|
||||
customTheme.tabLayoutWithExpandedCollapsingToolbarTextColor = customThemeSettingsItems.get(26).colorValue;
|
||||
customTheme.tabLayoutWithExpandedCollapsingToolbarTabIndicator = customThemeSettingsItems.get(27).colorValue;
|
||||
customTheme.tabLayoutWithCollapsedCollapsingToolbarTabBackground = customThemeSettingsItems.get(28).colorValue;
|
||||
customTheme.tabLayoutWithCollapsedCollapsingToolbarTextColor = customThemeSettingsItems.get(29).colorValue;
|
||||
customTheme.tabLayoutWithCollapsedCollapsingToolbarTabIndicator = customThemeSettingsItems.get(30).colorValue;
|
||||
customTheme.upvoted = customThemeSettingsItems.get(31).colorValue;
|
||||
customTheme.downvoted = customThemeSettingsItems.get(32).colorValue;
|
||||
customTheme.postTypeBackgroundColor = customThemeSettingsItems.get(33).colorValue;
|
||||
customTheme.postTypeTextColor = customThemeSettingsItems.get(34).colorValue;
|
||||
customTheme.spoilerBackgroundColor = customThemeSettingsItems.get(35).colorValue;
|
||||
customTheme.spoilerTextColor = customThemeSettingsItems.get(36).colorValue;
|
||||
customTheme.nsfwBackgroundColor = customThemeSettingsItems.get(37).colorValue;
|
||||
customTheme.nsfwTextColor = customThemeSettingsItems.get(38).colorValue;
|
||||
customTheme.flairBackgroundColor = customThemeSettingsItems.get(39).colorValue;
|
||||
customTheme.flairTextColor = customThemeSettingsItems.get(40).colorValue;
|
||||
customTheme.awardsBackgroundColor = customThemeSettingsItems.get(41).colorValue;
|
||||
customTheme.awardsTextColor = customThemeSettingsItems.get(42).colorValue;
|
||||
customTheme.archivedTint = customThemeSettingsItems.get(43).colorValue;
|
||||
customTheme.lockedIconTint = customThemeSettingsItems.get(44).colorValue;
|
||||
customTheme.crosspostIconTint = customThemeSettingsItems.get(45).colorValue;
|
||||
customTheme.stickiedPostIconTint = customThemeSettingsItems.get(46).colorValue;
|
||||
customTheme.subscribed = customThemeSettingsItems.get(47).colorValue;
|
||||
customTheme.unsubscribed = customThemeSettingsItems.get(48).colorValue;
|
||||
customTheme.username = customThemeSettingsItems.get(49).colorValue;
|
||||
customTheme.subreddit = customThemeSettingsItems.get(50).colorValue;
|
||||
customTheme.authorFlairTextColor = customThemeSettingsItems.get(51).colorValue;
|
||||
customTheme.submitter = customThemeSettingsItems.get(52).colorValue;
|
||||
customTheme.moderator = customThemeSettingsItems.get(53).colorValue;
|
||||
customTheme.singleCommentThreadBackgroundColor = customThemeSettingsItems.get(54).colorValue;
|
||||
customTheme.unreadMessageBackgroundColor = customThemeSettingsItems.get(55).colorValue;
|
||||
customTheme.dividerColor = customThemeSettingsItems.get(56).colorValue;
|
||||
customTheme.noPreviewLinkBackgroundColor = customThemeSettingsItems.get(57).colorValue;
|
||||
customTheme.voteAndReplyUnavailableButtonColor = customThemeSettingsItems.get(58).colorValue;
|
||||
customTheme.commentVerticalBarColor1 = customThemeSettingsItems.get(59).colorValue;
|
||||
customTheme.commentVerticalBarColor2 = customThemeSettingsItems.get(60).colorValue;
|
||||
customTheme.commentVerticalBarColor3 = customThemeSettingsItems.get(61).colorValue;
|
||||
customTheme.commentVerticalBarColor4 = customThemeSettingsItems.get(62).colorValue;
|
||||
customTheme.commentVerticalBarColor5 = customThemeSettingsItems.get(63).colorValue;
|
||||
customTheme.commentVerticalBarColor6 = customThemeSettingsItems.get(64).colorValue;
|
||||
customTheme.commentVerticalBarColor7 = customThemeSettingsItems.get(65).colorValue;
|
||||
customTheme.navBarColor = customThemeSettingsItems.get(66).colorValue;
|
||||
customTheme.isLightStatusBar = customThemeSettingsItems.get(67).isEnabled;
|
||||
customTheme.isLightNavBar = customThemeSettingsItems.get(68).isEnabled;
|
||||
customTheme.isChangeStatusBarIconColorAfterToolbarCollapsedInImmersiveInterface = customThemeSettingsItems.get(69).isEnabled;
|
||||
customTheme.bottomAppBarIconColor = customThemeSettingsItems.get(19).colorValue;
|
||||
customTheme.postIconAndInfoColor = customThemeSettingsItems.get(20).colorValue;
|
||||
customTheme.commentIconAndInfoColor = customThemeSettingsItems.get(21).colorValue;
|
||||
customTheme.fabIconColor = customThemeSettingsItems.get(22).colorValue;
|
||||
customTheme.toolbarPrimaryTextAndIconColor = customThemeSettingsItems.get(23).colorValue;
|
||||
customTheme.toolbarSecondaryTextColor = customThemeSettingsItems.get(24).colorValue;
|
||||
customTheme.circularProgressBarBackground = customThemeSettingsItems.get(25).colorValue;
|
||||
customTheme.tabLayoutWithExpandedCollapsingToolbarTabBackground = customThemeSettingsItems.get(26).colorValue;
|
||||
customTheme.tabLayoutWithExpandedCollapsingToolbarTextColor = customThemeSettingsItems.get(27).colorValue;
|
||||
customTheme.tabLayoutWithExpandedCollapsingToolbarTabIndicator = customThemeSettingsItems.get(28).colorValue;
|
||||
customTheme.tabLayoutWithCollapsedCollapsingToolbarTabBackground = customThemeSettingsItems.get(29).colorValue;
|
||||
customTheme.tabLayoutWithCollapsedCollapsingToolbarTextColor = customThemeSettingsItems.get(30).colorValue;
|
||||
customTheme.tabLayoutWithCollapsedCollapsingToolbarTabIndicator = customThemeSettingsItems.get(31).colorValue;
|
||||
customTheme.upvoted = customThemeSettingsItems.get(32).colorValue;
|
||||
customTheme.downvoted = customThemeSettingsItems.get(33).colorValue;
|
||||
customTheme.postTypeBackgroundColor = customThemeSettingsItems.get(34).colorValue;
|
||||
customTheme.postTypeTextColor = customThemeSettingsItems.get(35).colorValue;
|
||||
customTheme.spoilerBackgroundColor = customThemeSettingsItems.get(36).colorValue;
|
||||
customTheme.spoilerTextColor = customThemeSettingsItems.get(37).colorValue;
|
||||
customTheme.nsfwBackgroundColor = customThemeSettingsItems.get(38).colorValue;
|
||||
customTheme.nsfwTextColor = customThemeSettingsItems.get(39).colorValue;
|
||||
customTheme.flairBackgroundColor = customThemeSettingsItems.get(40).colorValue;
|
||||
customTheme.flairTextColor = customThemeSettingsItems.get(41).colorValue;
|
||||
customTheme.awardsBackgroundColor = customThemeSettingsItems.get(42).colorValue;
|
||||
customTheme.awardsTextColor = customThemeSettingsItems.get(43).colorValue;
|
||||
customTheme.archivedTint = customThemeSettingsItems.get(44).colorValue;
|
||||
customTheme.lockedIconTint = customThemeSettingsItems.get(45).colorValue;
|
||||
customTheme.crosspostIconTint = customThemeSettingsItems.get(46).colorValue;
|
||||
customTheme.stickiedPostIconTint = customThemeSettingsItems.get(47).colorValue;
|
||||
customTheme.subscribed = customThemeSettingsItems.get(48).colorValue;
|
||||
customTheme.unsubscribed = customThemeSettingsItems.get(49).colorValue;
|
||||
customTheme.username = customThemeSettingsItems.get(50).colorValue;
|
||||
customTheme.subreddit = customThemeSettingsItems.get(51).colorValue;
|
||||
customTheme.authorFlairTextColor = customThemeSettingsItems.get(52).colorValue;
|
||||
customTheme.submitter = customThemeSettingsItems.get(53).colorValue;
|
||||
customTheme.moderator = customThemeSettingsItems.get(54).colorValue;
|
||||
customTheme.singleCommentThreadBackgroundColor = customThemeSettingsItems.get(55).colorValue;
|
||||
customTheme.unreadMessageBackgroundColor = customThemeSettingsItems.get(56).colorValue;
|
||||
customTheme.dividerColor = customThemeSettingsItems.get(57).colorValue;
|
||||
customTheme.noPreviewLinkBackgroundColor = customThemeSettingsItems.get(58).colorValue;
|
||||
customTheme.voteAndReplyUnavailableButtonColor = customThemeSettingsItems.get(59).colorValue;
|
||||
customTheme.commentVerticalBarColor1 = customThemeSettingsItems.get(60).colorValue;
|
||||
customTheme.commentVerticalBarColor2 = customThemeSettingsItems.get(61).colorValue;
|
||||
customTheme.commentVerticalBarColor3 = customThemeSettingsItems.get(62).colorValue;
|
||||
customTheme.commentVerticalBarColor4 = customThemeSettingsItems.get(63).colorValue;
|
||||
customTheme.commentVerticalBarColor5 = customThemeSettingsItems.get(64).colorValue;
|
||||
customTheme.commentVerticalBarColor6 = customThemeSettingsItems.get(65).colorValue;
|
||||
customTheme.commentVerticalBarColor7 = customThemeSettingsItems.get(66).colorValue;
|
||||
customTheme.navBarColor = customThemeSettingsItems.get(67).colorValue;
|
||||
customTheme.isLightStatusBar = customThemeSettingsItems.get(68).isEnabled;
|
||||
customTheme.isLightNavBar = customThemeSettingsItems.get(69).isEnabled;
|
||||
customTheme.isChangeStatusBarIconColorAfterToolbarCollapsedInImmersiveInterface = customThemeSettingsItems.get(70).isEnabled;
|
||||
|
||||
return customTheme;
|
||||
}
|
||||
|
@ -130,6 +130,10 @@ public class CustomThemeSettingsItem implements Parcelable {
|
||||
context.getString(R.string.theme_item_primary_icon_color),
|
||||
context.getString(R.string.theme_item_primary_icon_color_detail),
|
||||
customTheme.primaryIconColor));
|
||||
customThemeSettingsItems.add(new CustomThemeSettingsItem(
|
||||
context.getString(R.string.theme_item_bottom_app_bar_icon_color),
|
||||
context.getString(R.string.theme_item_bottom_app_bar_icon_color_detail),
|
||||
customTheme.bottomAppBarIconColor));
|
||||
customThemeSettingsItems.add(new CustomThemeSettingsItem(
|
||||
context.getString(R.string.theme_item_post_icon_and_info_color),
|
||||
context.getString(R.string.theme_item_post_icon_and_info_color_detail),
|
||||
|
@ -127,6 +127,11 @@ public class CustomThemeWrapper {
|
||||
getDefaultColor("#000000", "#FFFFFF", "#FFFFFF"));
|
||||
}
|
||||
|
||||
public int getBottomAppBarIconColor() {
|
||||
return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.BOTTOM_APP_BAR_ICON_COLOR,
|
||||
getDefaultColor("#000000", "#FFFFFF", "#FFFFFF"));
|
||||
}
|
||||
|
||||
public int getPostIconAndInfoColor() {
|
||||
return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.POST_ICON_AND_INFO_COLOR,
|
||||
getDefaultColor("#8A000000", "#B3FFFFFF", "#B3FFFFFF"));
|
||||
@ -449,6 +454,7 @@ public class CustomThemeWrapper {
|
||||
customTheme.commentBackgroundColor = Color.parseColor("#FFFFFF");
|
||||
customTheme.bottomAppBarBackgroundColor = Color.parseColor("#FFFFFF");
|
||||
customTheme.primaryIconColor = Color.parseColor("#000000");
|
||||
customTheme.bottomAppBarIconColor = Color.parseColor("#000000");
|
||||
customTheme.postIconAndInfoColor = Color.parseColor("#8A000000");
|
||||
customTheme.commentIconAndInfoColor = Color.parseColor("#8A000000");
|
||||
customTheme.toolbarPrimaryTextAndIconColor = Color.parseColor("#FFFFFF");
|
||||
@ -525,6 +531,7 @@ public class CustomThemeWrapper {
|
||||
customTheme.commentBackgroundColor = Color.parseColor("#242424");
|
||||
customTheme.bottomAppBarBackgroundColor = Color.parseColor("#121212");
|
||||
customTheme.primaryIconColor = Color.parseColor("#FFFFFF");
|
||||
customTheme.bottomAppBarIconColor = Color.parseColor("#FFFFFF");
|
||||
customTheme.postIconAndInfoColor = Color.parseColor("#B3FFFFFF");
|
||||
customTheme.commentIconAndInfoColor = Color.parseColor("#B3FFFFFF");
|
||||
customTheme.toolbarPrimaryTextAndIconColor = Color.parseColor("#FFFFFF");
|
||||
@ -601,6 +608,7 @@ public class CustomThemeWrapper {
|
||||
customTheme.commentBackgroundColor = Color.parseColor("#000000");
|
||||
customTheme.bottomAppBarBackgroundColor = Color.parseColor("#000000");
|
||||
customTheme.primaryIconColor = Color.parseColor("#FFFFFF");
|
||||
customTheme.bottomAppBarIconColor = Color.parseColor("#FFFFFF");
|
||||
customTheme.postIconAndInfoColor = Color.parseColor("#B3FFFFFF");
|
||||
customTheme.commentIconAndInfoColor = Color.parseColor("#B3FFFFFF");
|
||||
customTheme.toolbarPrimaryTextAndIconColor = Color.parseColor("#FFFFFF");
|
||||
@ -677,6 +685,7 @@ public class CustomThemeWrapper {
|
||||
customTheme.commentBackgroundColor = Color.parseColor("#FFFFFF");
|
||||
customTheme.bottomAppBarBackgroundColor = Color.parseColor("#FFFFFF");
|
||||
customTheme.primaryIconColor = Color.parseColor("#000000");
|
||||
customTheme.bottomAppBarIconColor = Color.parseColor("#000000");
|
||||
customTheme.postIconAndInfoColor = Color.parseColor("#3C4043");
|
||||
customTheme.commentIconAndInfoColor = Color.parseColor("#3C4043");
|
||||
customTheme.toolbarPrimaryTextAndIconColor = Color.parseColor("#3C4043");
|
||||
@ -753,6 +762,7 @@ public class CustomThemeWrapper {
|
||||
customTheme.commentBackgroundColor = Color.parseColor("#242424");
|
||||
customTheme.bottomAppBarBackgroundColor = Color.parseColor("#121212");
|
||||
customTheme.primaryIconColor = Color.parseColor("#FFFFFF");
|
||||
customTheme.bottomAppBarIconColor = Color.parseColor("#FFFFFF");
|
||||
customTheme.postIconAndInfoColor = Color.parseColor("#B3FFFFFF");
|
||||
customTheme.commentIconAndInfoColor = Color.parseColor("#B3FFFFFF");
|
||||
customTheme.toolbarPrimaryTextAndIconColor = Color.parseColor("#FFFFFF");
|
||||
@ -829,6 +839,7 @@ public class CustomThemeWrapper {
|
||||
customTheme.commentBackgroundColor = Color.parseColor("#000000");
|
||||
customTheme.bottomAppBarBackgroundColor = Color.parseColor("#000000");
|
||||
customTheme.primaryIconColor = Color.parseColor("#FFFFFF");
|
||||
customTheme.bottomAppBarIconColor = Color.parseColor("#FFFFFF");
|
||||
customTheme.postIconAndInfoColor = Color.parseColor("#B3FFFFFF");
|
||||
customTheme.commentIconAndInfoColor = Color.parseColor("#B3FFFFFF");
|
||||
customTheme.toolbarPrimaryTextAndIconColor = Color.parseColor("#FFFFFF");
|
||||
@ -905,6 +916,7 @@ public class CustomThemeWrapper {
|
||||
customTheme.commentBackgroundColor = Color.parseColor("#FFFFFF");
|
||||
customTheme.bottomAppBarBackgroundColor = Color.parseColor("#FFFFFF");
|
||||
customTheme.primaryIconColor = Color.parseColor("#000000");
|
||||
customTheme.bottomAppBarIconColor = Color.parseColor("#000000");
|
||||
customTheme.postIconAndInfoColor = Color.parseColor("#8A000000");
|
||||
customTheme.commentIconAndInfoColor = Color.parseColor("#8A000000");
|
||||
customTheme.toolbarPrimaryTextAndIconColor = Color.parseColor("#FFFFFF");
|
||||
@ -981,6 +993,7 @@ public class CustomThemeWrapper {
|
||||
customTheme.commentBackgroundColor = Color.parseColor("#242424");
|
||||
customTheme.bottomAppBarBackgroundColor = Color.parseColor("#121212");
|
||||
customTheme.primaryIconColor = Color.parseColor("#FFFFFF");
|
||||
customTheme.bottomAppBarIconColor = Color.parseColor("#FFFFFF");
|
||||
customTheme.postIconAndInfoColor = Color.parseColor("#B3FFFFFF");
|
||||
customTheme.commentIconAndInfoColor = Color.parseColor("#B3FFFFFF");
|
||||
customTheme.toolbarPrimaryTextAndIconColor = Color.parseColor("#FFFFFF");
|
||||
@ -1057,6 +1070,7 @@ public class CustomThemeWrapper {
|
||||
customTheme.commentBackgroundColor = Color.parseColor("#000000");
|
||||
customTheme.bottomAppBarBackgroundColor = Color.parseColor("#000000");
|
||||
customTheme.primaryIconColor = Color.parseColor("#FFFFFF");
|
||||
customTheme.bottomAppBarIconColor = Color.parseColor("#FFFFFF");
|
||||
customTheme.postIconAndInfoColor = Color.parseColor("#B3FFFFFF");
|
||||
customTheme.commentIconAndInfoColor = Color.parseColor("#B3FFFFFF");
|
||||
customTheme.toolbarPrimaryTextAndIconColor = Color.parseColor("#FFFFFF");
|
||||
@ -1133,6 +1147,7 @@ public class CustomThemeWrapper {
|
||||
customTheme.commentBackgroundColor = Color.parseColor("#393A59");
|
||||
customTheme.bottomAppBarBackgroundColor = Color.parseColor("#393A59");
|
||||
customTheme.primaryIconColor = Color.parseColor("#FFFFFF");
|
||||
customTheme.bottomAppBarIconColor = Color.parseColor("#FFFFFF");
|
||||
customTheme.postIconAndInfoColor = Color.parseColor("#FFFFFF");
|
||||
customTheme.commentIconAndInfoColor = Color.parseColor("#FFFFFF");
|
||||
customTheme.toolbarPrimaryTextAndIconColor = Color.parseColor("#FFFFFF");
|
||||
@ -1209,6 +1224,7 @@ public class CustomThemeWrapper {
|
||||
customTheme.commentBackgroundColor = Color.parseColor("#C0F0F4");
|
||||
customTheme.bottomAppBarBackgroundColor = Color.parseColor("#D48AE0");
|
||||
customTheme.primaryIconColor = Color.parseColor("#000000");
|
||||
customTheme.bottomAppBarIconColor = Color.parseColor("#000000");
|
||||
customTheme.postIconAndInfoColor = Color.parseColor("#000000");
|
||||
customTheme.commentIconAndInfoColor = Color.parseColor("#000000");
|
||||
customTheme.toolbarPrimaryTextAndIconColor = Color.parseColor("#3C4043");
|
||||
|
@ -0,0 +1,27 @@
|
||||
package ml.docilealligator.infinityforreddit.CustomView;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import im.ene.toro.widget.Container;
|
||||
|
||||
public class CustomToroContainer extends Container {
|
||||
public CustomToroContainer(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public CustomToroContainer(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public CustomToroContainer(Context context, @Nullable AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWindowVisibilityChanged(int visibility) {
|
||||
super.onWindowVisibilityChanged(visibility);
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package ml.docilealligator.infinityforreddit.Event;
|
||||
|
||||
public class ChangeVideoAutoplayEvent {
|
||||
public String autoplay;
|
||||
|
||||
public ChangeVideoAutoplayEvent(String autoplay) {
|
||||
this.autoplay = autoplay;
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package ml.docilealligator.infinityforreddit.Event;
|
||||
|
||||
public class ChangeWifiStatusEvent {
|
||||
public boolean isConnectedToWifi;
|
||||
public ChangeWifiStatusEvent(boolean isConnectedToWifi) {
|
||||
this.isConnectedToWifi = isConnectedToWifi;
|
||||
}
|
||||
}
|
@ -0,0 +1,101 @@
|
||||
package ml.docilealligator.infinityforreddit;
|
||||
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import ml.docilealligator.infinityforreddit.Utils.JSONUtils;
|
||||
import ml.docilealligator.infinityforreddit.Utils.Utils;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
public class FetchRules {
|
||||
public interface FetchRulesListener {
|
||||
void success(ArrayList<Rule> rules);
|
||||
void failed();
|
||||
}
|
||||
|
||||
public static void fetchRules(Retrofit retrofit, String subredditName, FetchRulesListener fetchRulesListener) {
|
||||
|
||||
RedditAPI api = retrofit.create(RedditAPI.class);
|
||||
Call<String> rulesCall = api.getRules(subredditName);
|
||||
rulesCall.enqueue(new Callback<String>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) {
|
||||
if (response.isSuccessful()) {
|
||||
new ParseRulesAsyncTask(response.body(), new ParseRulesAsyncTask.ParseRulesAsyncTaskListener() {
|
||||
@Override
|
||||
public void parseSuccessful(ArrayList<Rule> rules) {
|
||||
fetchRulesListener.success(rules);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void parseFailed() {
|
||||
fetchRulesListener.failed();
|
||||
}
|
||||
}).execute();
|
||||
} else {
|
||||
fetchRulesListener.failed();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
|
||||
fetchRulesListener.failed();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static class ParseRulesAsyncTask extends AsyncTask<Void, ArrayList<Rule>, ArrayList<Rule>> {
|
||||
private String response;
|
||||
private ParseRulesAsyncTask.ParseRulesAsyncTaskListener parseRulesAsyncTaskListener;
|
||||
|
||||
ParseRulesAsyncTask(String response, ParseRulesAsyncTask.ParseRulesAsyncTaskListener parseRulesAsyncTaskListener) {
|
||||
this.response = response;
|
||||
this.parseRulesAsyncTaskListener = parseRulesAsyncTaskListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ArrayList<Rule> doInBackground(Void... voids) {
|
||||
try {
|
||||
JSONArray rulesArray = new JSONObject(response).getJSONArray(JSONUtils.RULES_KEY);
|
||||
ArrayList<Rule> rules = new ArrayList<>();
|
||||
for (int i = 0; i < rulesArray.length(); i++) {
|
||||
String shortName = rulesArray.getJSONObject(i).getString(JSONUtils.SHORT_NAME_KEY);
|
||||
String description = null;
|
||||
if (rulesArray.getJSONObject(i).has(JSONUtils.DESCRIPTION_KEY)) {
|
||||
description = Utils.modifyMarkdown(rulesArray.getJSONObject(i).getString(JSONUtils.DESCRIPTION_KEY));
|
||||
}
|
||||
rules.add(new Rule(shortName, description));
|
||||
}
|
||||
return rules;
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(ArrayList<Rule> rules) {
|
||||
if (rules != null) {
|
||||
parseRulesAsyncTaskListener.parseSuccessful(rules);
|
||||
} else {
|
||||
parseRulesAsyncTaskListener.parseFailed();
|
||||
}
|
||||
}
|
||||
|
||||
interface ParseRulesAsyncTaskListener {
|
||||
void parseSuccessful(ArrayList<Rule> rules);
|
||||
|
||||
void parseFailed();
|
||||
}
|
||||
}
|
||||
}
|
@ -22,6 +22,7 @@ import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment;
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import ml.docilealligator.infinityforreddit.Activity.EditCommentActivity;
|
||||
import ml.docilealligator.infinityforreddit.Activity.ReportActivity;
|
||||
import ml.docilealligator.infinityforreddit.Activity.ViewPostDetailActivity;
|
||||
import ml.docilealligator.infinityforreddit.Activity.ViewUserDetailActivity;
|
||||
import ml.docilealligator.infinityforreddit.CommentData;
|
||||
@ -44,6 +45,8 @@ public class CommentMoreBottomSheetFragment extends RoundedBottomSheetDialogFrag
|
||||
TextView shareTextView;
|
||||
@BindView(R.id.copy_text_view_comment_more_bottom_sheet_fragment)
|
||||
TextView copyTextView;
|
||||
@BindView(R.id.report_view_comment_more_bottom_sheet_fragment)
|
||||
TextView reportTextView;
|
||||
private AppCompatActivity activity;
|
||||
public CommentMoreBottomSheetFragment() {
|
||||
// Required empty public constructor
|
||||
@ -119,6 +122,15 @@ public class CommentMoreBottomSheetFragment extends RoundedBottomSheetDialogFrag
|
||||
copyTextBottomSheetFragment.show(activity.getSupportFragmentManager(), copyTextBottomSheetFragment.getTag());
|
||||
});
|
||||
|
||||
reportTextView.setOnClickListener(view -> {
|
||||
Intent intent = new Intent(activity, ReportActivity.class);
|
||||
intent.putExtra(ReportActivity.EXTRA_SUBREDDIT_NAME, commentData.getSubredditName());
|
||||
intent.putExtra(ReportActivity.EXTRA_THING_FULLNAME, commentData.getFullName());
|
||||
activity.startActivity(intent);
|
||||
|
||||
dismiss();
|
||||
});
|
||||
|
||||
return rootView;
|
||||
}
|
||||
|
||||
|
@ -46,19 +46,26 @@ import javax.inject.Named;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import im.ene.toro.exoplayer.ExoCreator;
|
||||
import im.ene.toro.media.PlaybackInfo;
|
||||
import im.ene.toro.media.VolumeInfo;
|
||||
import im.ene.toro.widget.Container;
|
||||
import ml.docilealligator.infinityforreddit.Activity.BaseActivity;
|
||||
import ml.docilealligator.infinityforreddit.Activity.FilteredThingActivity;
|
||||
import ml.docilealligator.infinityforreddit.Activity.MainActivity;
|
||||
import ml.docilealligator.infinityforreddit.Activity.ViewSubredditDetailActivity;
|
||||
import ml.docilealligator.infinityforreddit.Adapter.PostRecyclerViewAdapter;
|
||||
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
|
||||
import ml.docilealligator.infinityforreddit.CustomView.CustomToroContainer;
|
||||
import ml.docilealligator.infinityforreddit.Event.ChangeDefaultPostLayoutEvent;
|
||||
import ml.docilealligator.infinityforreddit.Event.ChangeNSFWBlurEvent;
|
||||
import ml.docilealligator.infinityforreddit.Event.ChangePostLayoutEvent;
|
||||
import ml.docilealligator.infinityforreddit.Event.ChangeShowAbsoluteNumberOfVotesEvent;
|
||||
import ml.docilealligator.infinityforreddit.Event.ChangeShowElapsedTimeEvent;
|
||||
import ml.docilealligator.infinityforreddit.Event.ChangeSpoilerBlurEvent;
|
||||
import ml.docilealligator.infinityforreddit.Event.ChangeVideoAutoplayEvent;
|
||||
import ml.docilealligator.infinityforreddit.Event.ChangeVoteButtonsPositionEvent;
|
||||
import ml.docilealligator.infinityforreddit.Event.ChangeWifiStatusEvent;
|
||||
import ml.docilealligator.infinityforreddit.Event.PostUpdateEventToPostList;
|
||||
import ml.docilealligator.infinityforreddit.Event.ShowDividerInCompactLayoutPreferenceEvent;
|
||||
import ml.docilealligator.infinityforreddit.FragmentCommunicator;
|
||||
@ -71,8 +78,12 @@ import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.SortType;
|
||||
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
|
||||
import ml.docilealligator.infinityforreddit.Utils.Utils;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
import static im.ene.toro.media.PlaybackInfo.INDEX_UNSET;
|
||||
import static im.ene.toro.media.PlaybackInfo.TIME_UNSET;
|
||||
|
||||
|
||||
/**
|
||||
* A simple {@link Fragment} subclass.
|
||||
@ -94,7 +105,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
||||
@BindView(R.id.swipe_refresh_layout_post_fragment)
|
||||
SwipeRefreshLayout mSwipeRefreshLayout;
|
||||
@BindView(R.id.recycler_view_post_fragment)
|
||||
RecyclerView mPostRecyclerView;
|
||||
CustomToroContainer mPostRecyclerView;
|
||||
@BindView(R.id.fetch_post_info_linear_layout_post_fragment)
|
||||
LinearLayout mFetchPostInfoLinearLayout;
|
||||
@BindView(R.id.fetch_post_info_image_view_post_fragment)
|
||||
@ -121,6 +132,8 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
||||
SharedPreferences mPostLayoutSharedPreferences;
|
||||
@Inject
|
||||
CustomThemeWrapper customThemeWrapper;
|
||||
@Inject
|
||||
ExoCreator exoCreator;
|
||||
private RequestManager mGlide;
|
||||
private AppCompatActivity activity;
|
||||
private LinearLayoutManager mLinearLayoutManager;
|
||||
@ -151,6 +164,9 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
||||
if (isInLazyMode && isLazyModePaused) {
|
||||
resumeLazyMode(false);
|
||||
}
|
||||
if (mAdapter != null && mPostRecyclerView != null) {
|
||||
mPostRecyclerView.onWindowVisibilityChanged(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean scrollPostsByCount(int count) {
|
||||
@ -323,12 +339,6 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
||||
int filter = getArguments().getInt(EXTRA_FILTER);
|
||||
String accessToken = getArguments().getString(EXTRA_ACCESS_TOKEN);
|
||||
boolean nsfw = mSharedPreferences.getBoolean(SharedPreferencesUtils.NSFW_KEY, false);
|
||||
boolean needBlurNsfw = mSharedPreferences.getBoolean(SharedPreferencesUtils.BLUR_NSFW_KEY, true);
|
||||
boolean needBlurSpoiler = mSharedPreferences.getBoolean(SharedPreferencesUtils.BLUR_SPOILER_KEY, false);
|
||||
boolean voteButtonsOnTheRight = mSharedPreferences.getBoolean(SharedPreferencesUtils.VOTE_BUTTONS_ON_THE_RIGHT_KEY, false);
|
||||
boolean showElapsedTime = mSharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_ELAPSED_TIME_KEY, false);
|
||||
boolean showDividerInCompactLayout = mSharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_DIVIDER_IN_COMPACT_LAYOUT, true);
|
||||
boolean showAbsoluteNumberOfVotes = mSharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_ABSOLUTE_NUMBER_OF_VOTES, true);
|
||||
int defaultPostLayout = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.DEFAULT_POST_LAYOUT_KEY, "0"));
|
||||
|
||||
if (postType == PostDataSource.TYPE_SEARCH) {
|
||||
@ -342,9 +352,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
||||
|
||||
mAdapter = new PostRecyclerViewAdapter(activity, mOauthRetrofit, mRetrofit, mRedditDataRoomDatabase,
|
||||
customThemeWrapper, accessToken, postType, postLayout, true,
|
||||
needBlurNsfw, needBlurSpoiler, voteButtonsOnTheRight, showElapsedTime,
|
||||
showDividerInCompactLayout, showAbsoluteNumberOfVotes,
|
||||
new PostRecyclerViewAdapter.Callback() {
|
||||
mSharedPreferences, exoCreator, new PostRecyclerViewAdapter.Callback() {
|
||||
@Override
|
||||
public void retryLoadingMore() {
|
||||
mPostViewModel.retryLoadingMore();
|
||||
@ -407,9 +415,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
||||
|
||||
mAdapter = new PostRecyclerViewAdapter(activity, mOauthRetrofit, mRetrofit, mRedditDataRoomDatabase,
|
||||
customThemeWrapper, accessToken, postType, postLayout, displaySubredditName,
|
||||
needBlurNsfw, needBlurSpoiler, voteButtonsOnTheRight, showElapsedTime,
|
||||
showDividerInCompactLayout, showAbsoluteNumberOfVotes,
|
||||
new PostRecyclerViewAdapter.Callback() {
|
||||
mSharedPreferences, exoCreator, new PostRecyclerViewAdapter.Callback() {
|
||||
@Override
|
||||
public void retryLoadingMore() {
|
||||
mPostViewModel.retryLoadingMore();
|
||||
@ -457,9 +463,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
||||
|
||||
mAdapter = new PostRecyclerViewAdapter(activity, mOauthRetrofit, mRetrofit, mRedditDataRoomDatabase,
|
||||
customThemeWrapper, accessToken, postType, postLayout, true,
|
||||
needBlurNsfw, needBlurSpoiler, voteButtonsOnTheRight, showElapsedTime,
|
||||
showDividerInCompactLayout, showAbsoluteNumberOfVotes,
|
||||
new PostRecyclerViewAdapter.Callback() {
|
||||
mSharedPreferences, exoCreator, new PostRecyclerViewAdapter.Callback() {
|
||||
@Override
|
||||
public void retryLoadingMore() {
|
||||
mPostViewModel.retryLoadingMore();
|
||||
@ -505,9 +509,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
||||
|
||||
mAdapter = new PostRecyclerViewAdapter(activity, mOauthRetrofit, mRetrofit, mRedditDataRoomDatabase,
|
||||
customThemeWrapper, accessToken, postType, postLayout, true,
|
||||
needBlurNsfw, needBlurSpoiler, voteButtonsOnTheRight, showElapsedTime,
|
||||
showDividerInCompactLayout, showAbsoluteNumberOfVotes,
|
||||
new PostRecyclerViewAdapter.Callback() {
|
||||
mSharedPreferences, exoCreator, new PostRecyclerViewAdapter.Callback() {
|
||||
@Override
|
||||
public void retryLoadingMore() {
|
||||
mPostViewModel.retryLoadingMore();
|
||||
@ -546,9 +548,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
||||
|
||||
mAdapter = new PostRecyclerViewAdapter(activity, mOauthRetrofit, mRetrofit, mRedditDataRoomDatabase,
|
||||
customThemeWrapper, accessToken, postType, postLayout, true,
|
||||
needBlurNsfw, needBlurSpoiler, voteButtonsOnTheRight, showElapsedTime,
|
||||
showDividerInCompactLayout, showAbsoluteNumberOfVotes,
|
||||
new PostRecyclerViewAdapter.Callback() {
|
||||
mSharedPreferences, exoCreator, new PostRecyclerViewAdapter.Callback() {
|
||||
@Override
|
||||
public void retryLoadingMore() {
|
||||
mPostViewModel.retryLoadingMore();
|
||||
@ -569,6 +569,12 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
||||
}
|
||||
|
||||
mPostRecyclerView.setAdapter(mAdapter);
|
||||
mPostRecyclerView.setCacheManager(mAdapter);
|
||||
mPostRecyclerView.setPlayerInitializer(order -> {
|
||||
VolumeInfo volumeInfo = new VolumeInfo(true, 0f);
|
||||
return new PlaybackInfo(INDEX_UNSET, TIME_UNSET, volumeInfo);
|
||||
});
|
||||
|
||||
mPostViewModel.getPosts().observe(this, posts -> mAdapter.submitList(posts));
|
||||
|
||||
mPostViewModel.hasPost().observe(this, hasPost -> {
|
||||
@ -846,6 +852,31 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onChangeVideoAutoplayEvent(ChangeVideoAutoplayEvent changeVideoAutoplayEvent) {
|
||||
if (mAdapter != null) {
|
||||
boolean autoplay = false;
|
||||
if (changeVideoAutoplayEvent.autoplay.equals(SharedPreferencesUtils.VIDEO_AUTOPLAY_VALUE_ALWAYS_ON)) {
|
||||
autoplay = true;
|
||||
} else if (changeVideoAutoplayEvent.autoplay.equals(SharedPreferencesUtils.VIDEO_AUTOPLAY_VALUE_ON_WIFI)) {
|
||||
autoplay = Utils.isConnectedToWifi(activity);
|
||||
}
|
||||
mAdapter.setAutoplay(autoplay);
|
||||
refreshAdapter();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onChangeWifiStatusEvent(ChangeWifiStatusEvent changeWifiStatusEvent) {
|
||||
if (mAdapter != null) {
|
||||
String autoplay = mSharedPreferences.getString(SharedPreferencesUtils.VIDEO_AUTOPLAY, SharedPreferencesUtils.VIDEO_AUTOPLAY_VALUE_NEVER);
|
||||
if (autoplay.equals(SharedPreferencesUtils.VIDEO_AUTOPLAY_VALUE_ON_WIFI)) {
|
||||
mAdapter.setAutoplay(changeWifiStatusEvent.isConnectedToWifi);
|
||||
refreshAdapter();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshAdapter() {
|
||||
int previousPosition = -1;
|
||||
if (mLinearLayoutManager != null) {
|
||||
@ -872,6 +903,9 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
||||
if (isInLazyMode) {
|
||||
pauseLazyMode(false);
|
||||
}
|
||||
if (mAdapter != null && mPostRecyclerView != null) {
|
||||
mPostRecyclerView.onWindowVisibilityChanged(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,6 +1,8 @@
|
||||
package ml.docilealligator.infinityforreddit;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.IntentFilter;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@ -10,8 +12,15 @@ import com.evernote.android.state.StateSaver;
|
||||
import com.livefront.bridge.Bridge;
|
||||
import com.livefront.bridge.SavedStateHandler;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import ml.docilealligator.infinityforreddit.BroadcastReceiver.NetworkWifiStatusReceiver;
|
||||
import ml.docilealligator.infinityforreddit.Event.ChangeWifiStatusEvent;
|
||||
import ml.docilealligator.infinityforreddit.Utils.Utils;
|
||||
|
||||
public class Infinity extends Application {
|
||||
private AppComponent mAppComponent;
|
||||
private NetworkWifiStatusReceiver mNetworkWifiStatusReceiver;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
@ -32,6 +41,10 @@ public class Infinity extends Application {
|
||||
StateSaver.restoreInstanceState(target, state);
|
||||
}
|
||||
});
|
||||
|
||||
mNetworkWifiStatusReceiver =
|
||||
new NetworkWifiStatusReceiver(() -> EventBus.getDefault().post(new ChangeWifiStatusEvent(Utils.isConnectedToWifi(getApplicationContext()))));
|
||||
registerReceiver(mNetworkWifiStatusReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
|
||||
}
|
||||
|
||||
public AppComponent getAppComponent() {
|
||||
|
@ -25,6 +25,7 @@ class ParseSubredditData {
|
||||
String subredditFullName = subredditDataJsonObject.getString(JSONUtils.DISPLAY_NAME_KEY);
|
||||
String description = subredditDataJsonObject.getString(JSONUtils.PUBLIC_DESCRIPTION_KEY).trim();
|
||||
String sidebarDescription = subredditDataJsonObject.getString(JSONUtils.DESCRIPTION_KEY).trim();
|
||||
long createdUTC = subredditDataJsonObject.getLong(JSONUtils.CREATED_UTC_KEY) * 1000;
|
||||
|
||||
String bannerImageUrl;
|
||||
if (subredditDataJsonObject.isNull(JSONUtils.BANNER_BACKGROUND_IMAGE_KEY)) {
|
||||
@ -52,7 +53,7 @@ class ParseSubredditData {
|
||||
}
|
||||
|
||||
return new SubredditData(id, subredditFullName, iconUrl, bannerImageUrl, description,
|
||||
sidebarDescription, nSubscribers);
|
||||
sidebarDescription, nSubscribers, createdUTC);
|
||||
}
|
||||
|
||||
interface ParseSubredditDataListener {
|
||||
|
@ -99,9 +99,10 @@ class ParseSubscribedThing {
|
||||
String description = data.getString(JSONUtils.PUBLIC_DESCRIPTION_KEY).trim();
|
||||
String sidebarDescription = data.getString(JSONUtils.DESCRIPTION_KEY);
|
||||
int nSubscribers = data.getInt(JSONUtils.SUBSCRIBERS_KEY);
|
||||
long createdUTC = data.getLong(JSONUtils.CREATED_UTC_KEY);
|
||||
newSubscribedSubredditData.add(new SubscribedSubredditData(id, name, iconUrl, accountName, isFavorite));
|
||||
newSubredditData.add(new SubredditData(id, subredditFullName, iconUrl,
|
||||
bannerImageUrl, description, sidebarDescription, nSubscribers));
|
||||
bannerImageUrl, description, sidebarDescription, nSubscribers, createdUTC));
|
||||
}
|
||||
}
|
||||
lastItem = jsonResponse.getJSONObject(JSONUtils.DATA_KEY).getString(JSONUtils.AFTER_KEY);
|
||||
|
@ -38,11 +38,13 @@ public class ParseUserData {
|
||||
}
|
||||
int linkKarma = userDataJson.getInt(JSONUtils.LINK_KARMA_KEY);
|
||||
int commentKarma = userDataJson.getInt(JSONUtils.COMMENT_KARMA_KEY);
|
||||
int karma = linkKarma + commentKarma;
|
||||
long cakeday = userDataJson.getLong(JSONUtils.CREATED_UTC_KEY) * 1000;
|
||||
boolean isGold = userDataJson.getBoolean(JSONUtils.IS_GOLD_KEY);
|
||||
boolean isFriend = userDataJson.getBoolean(JSONUtils.IS_FRIEND_KEY);
|
||||
String description = userDataJson.getJSONObject(JSONUtils.SUBREDDIT_KEY).getString(JSONUtils.PUBLIC_DESCRIPTION_KEY);
|
||||
|
||||
return new UserData(userName, iconImageUrl, bannerImageUrl, karma, isGold, isFriend, canBeFollowed);
|
||||
return new UserData(userName, iconImageUrl, bannerImageUrl, linkKarma, commentKarma, cakeday,
|
||||
isGold, isFriend, canBeFollowed, description);
|
||||
}
|
||||
|
||||
interface ParseUserDataListener {
|
||||
|
@ -1,10 +1,10 @@
|
||||
package ml.docilealligator.infinityforreddit;
|
||||
package ml.docilealligator.infinityforreddit.Post;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import ml.docilealligator.infinityforreddit.Post.Post;
|
||||
import ml.docilealligator.infinityforreddit.RedditAPI;
|
||||
import ml.docilealligator.infinityforreddit.Utils.RedditUtils;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
@ -1,10 +1,11 @@
|
||||
package ml.docilealligator.infinityforreddit;
|
||||
package ml.docilealligator.infinityforreddit.Post;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import ml.docilealligator.infinityforreddit.RedditAPI;
|
||||
import ml.docilealligator.infinityforreddit.Utils.RedditUtils;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
@ -1,4 +1,4 @@
|
||||
package ml.docilealligator.infinityforreddit;
|
||||
package ml.docilealligator.infinityforreddit.Post;
|
||||
|
||||
import android.os.AsyncTask;
|
||||
import android.text.Html;
|
||||
@ -8,12 +8,11 @@ import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Locale;
|
||||
|
||||
import ml.docilealligator.infinityforreddit.Fragment.PostFragment;
|
||||
import ml.docilealligator.infinityforreddit.Post.Post;
|
||||
import ml.docilealligator.infinityforreddit.Utils.JSONUtils;
|
||||
import ml.docilealligator.infinityforreddit.Utils.Utils;
|
||||
|
||||
@ -357,7 +356,7 @@ public class ParsePost {
|
||||
}
|
||||
|
||||
public interface ParsePostsListingListener {
|
||||
void onParsePostsListingSuccess(ArrayList<Post> newPostData, String lastItem);
|
||||
void onParsePostsListingSuccess(LinkedHashSet<Post> newPostData, String lastItem);
|
||||
|
||||
void onParsePostsListingFail();
|
||||
}
|
||||
@ -376,7 +375,7 @@ public class ParsePost {
|
||||
private boolean nsfw;
|
||||
private ParsePostsListingListener parsePostsListingListener;
|
||||
private ParsePostListener parsePostListener;
|
||||
private ArrayList<Post> newPosts;
|
||||
private LinkedHashSet<Post> newPosts;
|
||||
private Post post;
|
||||
private String lastItem;
|
||||
private boolean parseFailed;
|
||||
@ -392,7 +391,7 @@ public class ParsePost {
|
||||
this.nPosts = nPosts;
|
||||
this.filter = filter;
|
||||
this.nsfw = nsfw;
|
||||
newPosts = new ArrayList<>();
|
||||
newPosts = new LinkedHashSet<>();
|
||||
parseFailed = false;
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
@ -3,6 +3,8 @@ package ml.docilealligator.infinityforreddit.Post;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import ml.docilealligator.infinityforreddit.Utils.RedditUtils;
|
||||
|
||||
/**
|
||||
@ -506,4 +508,12 @@ public class Post implements Parcelable {
|
||||
parcel.writeByte((byte) (isCrosspost ? 1 : 0));
|
||||
parcel.writeString(crosspostParentId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (!(obj instanceof Post)) {
|
||||
return false;
|
||||
}
|
||||
return ((Post) obj).id.equals(id);
|
||||
}
|
||||
}
|
@ -5,10 +5,11 @@ import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.paging.PageKeyedDataSource;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import ml.docilealligator.infinityforreddit.NetworkState;
|
||||
import ml.docilealligator.infinityforreddit.ParsePost;
|
||||
import ml.docilealligator.infinityforreddit.RedditAPI;
|
||||
import ml.docilealligator.infinityforreddit.SortType;
|
||||
import ml.docilealligator.infinityforreddit.Utils.RedditUtils;
|
||||
@ -42,6 +43,7 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> {
|
||||
private int filter;
|
||||
private String userWhere;
|
||||
private String multiRedditPath;
|
||||
private LinkedHashSet<Post> postLinkedHashSet;
|
||||
|
||||
private MutableLiveData<NetworkState> paginationNetworkStateLiveData;
|
||||
private MutableLiveData<NetworkState> initialLoadStateLiveData;
|
||||
@ -62,6 +64,7 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> {
|
||||
this.sortType = sortType == null ? new SortType(SortType.Type.BEST) : sortType;
|
||||
this.filter = filter;
|
||||
this.nsfw = nsfw;
|
||||
postLinkedHashSet = new LinkedHashSet<>();
|
||||
}
|
||||
|
||||
PostDataSource(Retrofit retrofit, String accessToken, Locale locale, String path, int postType,
|
||||
@ -97,6 +100,7 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> {
|
||||
}
|
||||
this.filter = filter;
|
||||
this.nsfw = nsfw;
|
||||
postLinkedHashSet = new LinkedHashSet<>();
|
||||
}
|
||||
|
||||
PostDataSource(Retrofit retrofit, String accessToken, Locale locale, String subredditOrUserName, int postType,
|
||||
@ -113,6 +117,7 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> {
|
||||
userWhere = where;
|
||||
this.filter = filter;
|
||||
this.nsfw = nsfw;
|
||||
postLinkedHashSet = new LinkedHashSet<>();
|
||||
}
|
||||
|
||||
PostDataSource(Retrofit retrofit, String accessToken, Locale locale, String subredditOrUserName, String query,
|
||||
@ -129,6 +134,7 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> {
|
||||
this.sortType = sortType == null ? new SortType(SortType.Type.RELEVANCE) : sortType;
|
||||
this.filter = filter;
|
||||
this.nsfw = nsfw;
|
||||
postLinkedHashSet = new LinkedHashSet<>();
|
||||
}
|
||||
|
||||
MutableLiveData<NetworkState> getPaginationNetworkStateLiveData() {
|
||||
@ -234,7 +240,7 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> {
|
||||
ParsePost.parsePosts(response.body(), locale, -1, filter, nsfw,
|
||||
new ParsePost.ParsePostsListingListener() {
|
||||
@Override
|
||||
public void onParsePostsListingSuccess(ArrayList<Post> newPosts, String lastItem) {
|
||||
public void onParsePostsListingSuccess(LinkedHashSet<Post> newPosts, String lastItem) {
|
||||
String nextPageKey;
|
||||
if (lastItem == null || lastItem.equals("") || lastItem.equals("null")) {
|
||||
nextPageKey = null;
|
||||
@ -243,13 +249,15 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> {
|
||||
}
|
||||
|
||||
if (newPosts.size() != 0) {
|
||||
callback.onResult(newPosts, null, nextPageKey);
|
||||
postLinkedHashSet.addAll(newPosts);
|
||||
callback.onResult(new ArrayList<>(newPosts), null, nextPageKey);
|
||||
hasPostLiveData.postValue(true);
|
||||
} else if (nextPageKey != null) {
|
||||
loadBestPostsInitial(callback, nextPageKey);
|
||||
return;
|
||||
} else {
|
||||
callback.onResult(newPosts, null, nextPageKey);
|
||||
postLinkedHashSet.addAll(newPosts);
|
||||
callback.onResult(new ArrayList<>(newPosts), null, nextPageKey);
|
||||
hasPostLiveData.postValue(false);
|
||||
}
|
||||
|
||||
@ -296,11 +304,18 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> {
|
||||
ParsePost.parsePosts(response.body(), locale, -1, filter, nsfw,
|
||||
new ParsePost.ParsePostsListingListener() {
|
||||
@Override
|
||||
public void onParsePostsListingSuccess(ArrayList<Post> newPosts, String lastItem) {
|
||||
public void onParsePostsListingSuccess(LinkedHashSet<Post> newPosts, String lastItem) {
|
||||
if (newPosts.size() == 0 && lastItem != null && !lastItem.equals("") && !lastItem.equals("null")) {
|
||||
loadBestPostsAfter(params, callback, lastItem);
|
||||
} else {
|
||||
callback.onResult(newPosts, lastItem);
|
||||
int currentPostsSize = postLinkedHashSet.size();
|
||||
postLinkedHashSet.addAll(newPosts);
|
||||
if (currentPostsSize == postLinkedHashSet.size()) {
|
||||
callback.onResult(new ArrayList<>(), lastItem);
|
||||
} else {
|
||||
List<Post> newPostsList = new ArrayList<>(postLinkedHashSet).subList(currentPostsSize, postLinkedHashSet.size());
|
||||
callback.onResult(newPostsList, lastItem);
|
||||
}
|
||||
paginationNetworkStateLiveData.postValue(NetworkState.LOADED);
|
||||
}
|
||||
}
|
||||
@ -366,7 +381,7 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> {
|
||||
ParsePost.parsePosts(response.body(), locale, -1, filter, nsfw,
|
||||
new ParsePost.ParsePostsListingListener() {
|
||||
@Override
|
||||
public void onParsePostsListingSuccess(ArrayList<Post> newPosts, String lastItem) {
|
||||
public void onParsePostsListingSuccess(LinkedHashSet<Post> newPosts, String lastItem) {
|
||||
String nextPageKey;
|
||||
if (lastItem == null || lastItem.equals("") || lastItem.equals("null")) {
|
||||
nextPageKey = null;
|
||||
@ -375,13 +390,15 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> {
|
||||
}
|
||||
|
||||
if (newPosts.size() != 0) {
|
||||
callback.onResult(newPosts, null, nextPageKey);
|
||||
postLinkedHashSet.addAll(newPosts);
|
||||
callback.onResult(new ArrayList<>(newPosts), null, nextPageKey);
|
||||
hasPostLiveData.postValue(true);
|
||||
} else if (nextPageKey != null) {
|
||||
loadSubredditPostsInitial(callback, nextPageKey);
|
||||
return;
|
||||
} else {
|
||||
callback.onResult(newPosts, null, nextPageKey);
|
||||
postLinkedHashSet.addAll(newPosts);
|
||||
callback.onResult(new ArrayList<>(newPosts), null, nextPageKey);
|
||||
hasPostLiveData.postValue(false);
|
||||
}
|
||||
|
||||
@ -439,11 +456,18 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> {
|
||||
ParsePost.parsePosts(response.body(), locale, -1, filter, nsfw,
|
||||
new ParsePost.ParsePostsListingListener() {
|
||||
@Override
|
||||
public void onParsePostsListingSuccess(ArrayList<Post> newPosts, String lastItem) {
|
||||
public void onParsePostsListingSuccess(LinkedHashSet<Post> newPosts, String lastItem) {
|
||||
if (newPosts.size() == 0 && lastItem != null && !lastItem.equals("") && !lastItem.equals("null")) {
|
||||
loadSubredditPostsAfter(params, callback, lastItem);
|
||||
} else {
|
||||
callback.onResult(newPosts, lastItem);
|
||||
int currentPostsSize = postLinkedHashSet.size();
|
||||
postLinkedHashSet.addAll(newPosts);
|
||||
if (currentPostsSize == postLinkedHashSet.size()) {
|
||||
callback.onResult(new ArrayList<>(), lastItem);
|
||||
} else {
|
||||
List<Post> newPostsList = new ArrayList<>(postLinkedHashSet).subList(currentPostsSize, postLinkedHashSet.size());
|
||||
callback.onResult(newPostsList, lastItem);
|
||||
}
|
||||
paginationNetworkStateLiveData.postValue(NetworkState.LOADED);
|
||||
}
|
||||
}
|
||||
@ -493,7 +517,7 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> {
|
||||
ParsePost.parsePosts(response.body(), locale, -1, filter, nsfw,
|
||||
new ParsePost.ParsePostsListingListener() {
|
||||
@Override
|
||||
public void onParsePostsListingSuccess(ArrayList<Post> newPosts, String lastItem) {
|
||||
public void onParsePostsListingSuccess(LinkedHashSet<Post> newPosts, String lastItem) {
|
||||
String nextPageKey;
|
||||
if (lastItem == null || lastItem.equals("") || lastItem.equals("null")) {
|
||||
nextPageKey = null;
|
||||
@ -502,13 +526,15 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> {
|
||||
}
|
||||
|
||||
if (newPosts.size() != 0) {
|
||||
callback.onResult(newPosts, null, nextPageKey);
|
||||
postLinkedHashSet.addAll(newPosts);
|
||||
callback.onResult(new ArrayList<>(newPosts), null, nextPageKey);
|
||||
hasPostLiveData.postValue(true);
|
||||
} else if (nextPageKey != null) {
|
||||
loadUserPostsInitial(callback, nextPageKey);
|
||||
return;
|
||||
} else {
|
||||
callback.onResult(newPosts, null, nextPageKey);
|
||||
postLinkedHashSet.addAll(newPosts);
|
||||
callback.onResult(new ArrayList<>(newPosts), null, nextPageKey);
|
||||
hasPostLiveData.postValue(false);
|
||||
}
|
||||
|
||||
@ -562,11 +588,18 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> {
|
||||
ParsePost.parsePosts(response.body(), locale, -1, filter, nsfw,
|
||||
new ParsePost.ParsePostsListingListener() {
|
||||
@Override
|
||||
public void onParsePostsListingSuccess(ArrayList<Post> newPosts, String lastItem) {
|
||||
public void onParsePostsListingSuccess(LinkedHashSet<Post> newPosts, String lastItem) {
|
||||
if (newPosts.size() == 0 && lastItem != null && !lastItem.equals("") && !lastItem.equals("null")) {
|
||||
loadUserPostsAfter(params, callback, lastItem);
|
||||
} else {
|
||||
callback.onResult(newPosts, lastItem);
|
||||
int currentPostsSize = postLinkedHashSet.size();
|
||||
postLinkedHashSet.addAll(newPosts);
|
||||
if (currentPostsSize == postLinkedHashSet.size()) {
|
||||
callback.onResult(new ArrayList<>(), lastItem);
|
||||
} else {
|
||||
List<Post> newPostsList = new ArrayList<>(postLinkedHashSet).subList(currentPostsSize, postLinkedHashSet.size());
|
||||
callback.onResult(newPostsList, lastItem);
|
||||
}
|
||||
paginationNetworkStateLiveData.postValue(NetworkState.LOADED);
|
||||
}
|
||||
}
|
||||
@ -638,7 +671,7 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> {
|
||||
ParsePost.parsePosts(response.body(), locale, -1, filter, nsfw,
|
||||
new ParsePost.ParsePostsListingListener() {
|
||||
@Override
|
||||
public void onParsePostsListingSuccess(ArrayList<Post> newPosts, String lastItem) {
|
||||
public void onParsePostsListingSuccess(LinkedHashSet<Post> newPosts, String lastItem) {
|
||||
String nextPageKey;
|
||||
if (lastItem == null || lastItem.equals("") || lastItem.equals("null")) {
|
||||
nextPageKey = null;
|
||||
@ -647,13 +680,15 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> {
|
||||
}
|
||||
|
||||
if (newPosts.size() != 0) {
|
||||
callback.onResult(newPosts, null, nextPageKey);
|
||||
postLinkedHashSet.addAll(newPosts);
|
||||
callback.onResult(new ArrayList<>(newPosts), null, nextPageKey);
|
||||
hasPostLiveData.postValue(true);
|
||||
} else if (nextPageKey != null) {
|
||||
loadSearchPostsInitial(callback, nextPageKey);
|
||||
return;
|
||||
} else {
|
||||
callback.onResult(newPosts, null, nextPageKey);
|
||||
postLinkedHashSet.addAll(newPosts);
|
||||
callback.onResult(new ArrayList<>(newPosts), null, nextPageKey);
|
||||
hasPostLiveData.postValue(false);
|
||||
}
|
||||
|
||||
@ -727,11 +762,18 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> {
|
||||
ParsePost.parsePosts(response.body(), locale, -1, filter, nsfw,
|
||||
new ParsePost.ParsePostsListingListener() {
|
||||
@Override
|
||||
public void onParsePostsListingSuccess(ArrayList<Post> newPosts, String lastItem) {
|
||||
public void onParsePostsListingSuccess(LinkedHashSet<Post> newPosts, String lastItem) {
|
||||
if (newPosts.size() == 0 && lastItem != null && !lastItem.equals("") && !lastItem.equals("null")) {
|
||||
loadSearchPostsAfter(params, callback, lastItem);
|
||||
} else {
|
||||
callback.onResult(newPosts, lastItem);
|
||||
int currentPostsSize = postLinkedHashSet.size();
|
||||
postLinkedHashSet.addAll(newPosts);
|
||||
if (currentPostsSize == postLinkedHashSet.size()) {
|
||||
callback.onResult(new ArrayList<>(), lastItem);
|
||||
} else {
|
||||
List<Post> newPostsList = new ArrayList<>(postLinkedHashSet).subList(currentPostsSize, postLinkedHashSet.size());
|
||||
callback.onResult(newPostsList, lastItem);
|
||||
}
|
||||
paginationNetworkStateLiveData.postValue(NetworkState.LOADED);
|
||||
}
|
||||
}
|
||||
@ -780,7 +822,7 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> {
|
||||
ParsePost.parsePosts(response.body(), locale, -1, filter, nsfw,
|
||||
new ParsePost.ParsePostsListingListener() {
|
||||
@Override
|
||||
public void onParsePostsListingSuccess(ArrayList<Post> newPosts, String lastItem) {
|
||||
public void onParsePostsListingSuccess(LinkedHashSet<Post> newPosts, String lastItem) {
|
||||
String nextPageKey;
|
||||
if (lastItem == null || lastItem.equals("") || lastItem.equals("null")) {
|
||||
nextPageKey = null;
|
||||
@ -789,13 +831,15 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> {
|
||||
}
|
||||
|
||||
if (newPosts.size() != 0) {
|
||||
callback.onResult(newPosts, null, nextPageKey);
|
||||
postLinkedHashSet.addAll(newPosts);
|
||||
callback.onResult(new ArrayList<>(newPosts), null, nextPageKey);
|
||||
hasPostLiveData.postValue(true);
|
||||
} else if (nextPageKey != null) {
|
||||
loadMultiRedditPostsInitial(callback, nextPageKey);
|
||||
return;
|
||||
} else {
|
||||
callback.onResult(newPosts, null, nextPageKey);
|
||||
postLinkedHashSet.addAll(newPosts);
|
||||
callback.onResult(new ArrayList<>(newPosts), null, nextPageKey);
|
||||
hasPostLiveData.postValue(false);
|
||||
}
|
||||
|
||||
@ -849,11 +893,18 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> {
|
||||
ParsePost.parsePosts(response.body(), locale, -1, filter, nsfw,
|
||||
new ParsePost.ParsePostsListingListener() {
|
||||
@Override
|
||||
public void onParsePostsListingSuccess(ArrayList<Post> newPosts, String lastItem) {
|
||||
public void onParsePostsListingSuccess(LinkedHashSet<Post> newPosts, String lastItem) {
|
||||
if (newPosts.size() == 0 && lastItem != null && !lastItem.equals("") && !lastItem.equals("null")) {
|
||||
loadMultiRedditPostsAfter(params, callback, lastItem);
|
||||
} else {
|
||||
callback.onResult(newPosts, lastItem);
|
||||
int currentPostsSize = postLinkedHashSet.size();
|
||||
postLinkedHashSet.addAll(newPosts);
|
||||
if (currentPostsSize == postLinkedHashSet.size()) {
|
||||
callback.onResult(new ArrayList<>(), lastItem);
|
||||
} else {
|
||||
List<Post> newPostsList = new ArrayList<>(postLinkedHashSet).subList(currentPostsSize, postLinkedHashSet.size());
|
||||
callback.onResult(newPostsList, lastItem);
|
||||
}
|
||||
paginationNetworkStateLiveData.postValue(NetworkState.LOADED);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package ml.docilealligator.infinityforreddit;
|
||||
package ml.docilealligator.infinityforreddit.Post;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.AsyncTask;
|
||||
@ -20,7 +20,7 @@ import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import ml.docilealligator.infinityforreddit.Post.Post;
|
||||
import ml.docilealligator.infinityforreddit.RedditAPI;
|
||||
import ml.docilealligator.infinityforreddit.Utils.JSONUtils;
|
||||
import ml.docilealligator.infinityforreddit.Utils.RedditUtils;
|
||||
import okhttp3.MediaType;
|
@ -304,4 +304,8 @@ public interface RedditAPI {
|
||||
|
||||
@GET("/api/multi/multipath/")
|
||||
Call<String> getMultiRedditInfo(@HeaderMap Map<String, String> headers, @Query("multipath") String multipath);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST("/api/report")
|
||||
Call<String> report(@HeaderMap Map<String, String> headers, @FieldMap Map<String, String> params);
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ import ml.docilealligator.infinityforreddit.User.UserDao;
|
||||
import ml.docilealligator.infinityforreddit.User.UserData;
|
||||
|
||||
@Database(entities = {Account.class, SubredditData.class, SubscribedSubredditData.class, UserData.class,
|
||||
SubscribedUserData.class, MultiReddit.class, CustomTheme.class}, version = 7)
|
||||
SubscribedUserData.class, MultiReddit.class, CustomTheme.class}, version = 8)
|
||||
public abstract class RedditDataRoomDatabase extends RoomDatabase {
|
||||
private static RedditDataRoomDatabase INSTANCE;
|
||||
|
||||
@ -37,7 +37,7 @@ public abstract class RedditDataRoomDatabase extends RoomDatabase {
|
||||
INSTANCE = Room.databaseBuilder(context.getApplicationContext(),
|
||||
RedditDataRoomDatabase.class, "reddit_data")
|
||||
.addMigrations(MIGRATION_1_2, MIGRATION_2_3, MIGRATION_3_4, MIGRATION_4_5,
|
||||
MIGRATION_5_6, MIGRATION_6_7)
|
||||
MIGRATION_5_6, MIGRATION_6_7, MIGRATION_7_8)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
@ -165,4 +165,25 @@ public abstract class RedditDataRoomDatabase extends RoomDatabase {
|
||||
database.execSQL("ALTER TABLE custom_themes ADD COLUMN awards_text_color INTEGER DEFAULT " + Color.parseColor("#FFFFFF") + " NOT NULL");
|
||||
}
|
||||
};
|
||||
|
||||
private static final Migration MIGRATION_7_8 = new Migration(7, 8) {
|
||||
@Override
|
||||
public void migrate(@NonNull SupportSQLiteDatabase database) {
|
||||
database.execSQL("CREATE TABLE users_temp " +
|
||||
"(name TEXT NOT NULL PRIMARY KEY, icon TEXT, banner TEXT, " +
|
||||
"link_karma INTEGER NOT NULL, comment_karma INTEGER DEFAULT 0 NOT NULL, created_utc INTEGER DEFAULT 0 NOT NULL," +
|
||||
"is_gold INTEGER NOT NULL, is_friend INTEGER NOT NULL, can_be_followed INTEGER NOT NULL," +
|
||||
"description TEXT)");
|
||||
database.execSQL(
|
||||
"INSERT INTO users_temp(name, icon, banner, link_karma, is_gold, is_friend, can_be_followed) SELECT * FROM users");
|
||||
database.execSQL("DROP TABLE users");
|
||||
database.execSQL("ALTER TABLE users_temp RENAME TO users");
|
||||
|
||||
database.execSQL("ALTER TABLE subreddits"
|
||||
+ " ADD COLUMN created_utc INTEGER DEFAULT 0 NOT NULL");
|
||||
|
||||
database.execSQL("ALTER TABLE custom_themes"
|
||||
+ " ADD COLUMN bottom_app_bar_icon_color INTEGER DEFAULT " + Color.parseColor("#000000") + " NOT NULL");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -0,0 +1,90 @@
|
||||
package ml.docilealligator.infinityforreddit;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ReportReason implements Parcelable {
|
||||
public static final String REASON_TYPE_SITE_REASON = "site_reason";
|
||||
public static final String REASON_TYPE_RULE_REASON = "rule_reason";
|
||||
public static final String REASON_TYPE_OTHER_REASON = "other_reason";
|
||||
public static final String REASON_SITE_REASON_SELECTED = "site_reason_selected";
|
||||
public static final String REASON_RULE_REASON_SELECTED = "rule_reason_selected";
|
||||
public static final String REASON_OTHER = "other";
|
||||
|
||||
private String reportReason;
|
||||
private String reasonType;
|
||||
private boolean isSelected;
|
||||
|
||||
public ReportReason(String reportReason, String reasonType) {
|
||||
this.reportReason = reportReason;
|
||||
this.reasonType = reasonType;
|
||||
this.isSelected = false;
|
||||
}
|
||||
|
||||
protected ReportReason(Parcel in) {
|
||||
reportReason = in.readString();
|
||||
reasonType = in.readString();
|
||||
isSelected = in.readByte() != 0;
|
||||
}
|
||||
|
||||
public static final Creator<ReportReason> CREATOR = new Creator<ReportReason>() {
|
||||
@Override
|
||||
public ReportReason createFromParcel(Parcel in) {
|
||||
return new ReportReason(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReportReason[] newArray(int size) {
|
||||
return new ReportReason[size];
|
||||
}
|
||||
};
|
||||
|
||||
public String getReportReason() {
|
||||
return reportReason;
|
||||
}
|
||||
|
||||
public String getReasonType() {
|
||||
return reasonType;
|
||||
}
|
||||
|
||||
public boolean isSelected() {
|
||||
return isSelected;
|
||||
}
|
||||
|
||||
public void setSelected(boolean selected) {
|
||||
isSelected = selected;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel parcel, int i) {
|
||||
parcel.writeString(reportReason);
|
||||
parcel.writeString(reasonType);
|
||||
parcel.writeByte((byte) (isSelected ? 1 : 0));
|
||||
}
|
||||
|
||||
public static ArrayList<ReportReason> getGeneralReasons(Context context) {
|
||||
ArrayList<ReportReason> reportReasons = new ArrayList<>();
|
||||
reportReasons.add(new ReportReason(context.getString(R.string.report_reason_general_spam), REASON_TYPE_SITE_REASON));
|
||||
reportReasons.add(new ReportReason(context.getString(R.string.report_reason_general_copyright_issue), REASON_TYPE_SITE_REASON));
|
||||
reportReasons.add(new ReportReason(context.getString(R.string.report_reason_general_child_pornography), REASON_TYPE_SITE_REASON));
|
||||
reportReasons.add(new ReportReason(context.getString(R.string.report_reason_general_abusive_content), REASON_TYPE_SITE_REASON));
|
||||
return reportReasons;
|
||||
}
|
||||
|
||||
public static ArrayList<ReportReason> convertRulesToReasons(ArrayList<Rule> rules) {
|
||||
ArrayList<ReportReason> reportReasons = new ArrayList<>();
|
||||
for (Rule r : rules) {
|
||||
reportReasons.add(new ReportReason(r.getShortName(), REASON_TYPE_RULE_REASON));
|
||||
}
|
||||
|
||||
return reportReasons;
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package ml.docilealligator.infinityforreddit;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import ml.docilealligator.infinityforreddit.Utils.RedditUtils;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
public class ReportThing {
|
||||
|
||||
public interface ReportThingListener {
|
||||
void success();
|
||||
void failed();
|
||||
}
|
||||
|
||||
public static void reportThing(Retrofit oauthRetrofit, String accessToken, String thingFullname,
|
||||
String subredditName, String reasonType, String reason,
|
||||
ReportThingListener reportThingListener) {
|
||||
Map<String, String> header = RedditUtils.getOAuthHeader(accessToken);
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put(RedditUtils.THING_ID_KEY, thingFullname);
|
||||
params.put(RedditUtils.SR_NAME_KEY, subredditName);
|
||||
params.put(reasonType, reason);
|
||||
if (reasonType.equals(ReportReason.REASON_TYPE_SITE_REASON)) {
|
||||
params.put(RedditUtils.REASON_KEY, ReportReason.REASON_SITE_REASON_SELECTED);
|
||||
} else if (reasonType.equals(ReportReason.REASON_TYPE_RULE_REASON)) {
|
||||
params.put(RedditUtils.REASON_KEY, ReportReason.REASON_RULE_REASON_SELECTED);
|
||||
} else {
|
||||
params.put(RedditUtils.REASON_KEY, ReportReason.REASON_OTHER);
|
||||
}
|
||||
params.put(RedditUtils.API_TYPE_KEY, RedditUtils.API_TYPE_JSON);
|
||||
|
||||
oauthRetrofit.create(RedditAPI.class).report(header, params).enqueue(new Callback<String>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) {
|
||||
if (response.isSuccessful()) {
|
||||
reportThingListener.success();
|
||||
} else {
|
||||
reportThingListener.failed();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
|
||||
reportThingListener.failed();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -39,7 +39,7 @@ import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.NotificationUtils;
|
||||
import ml.docilealligator.infinityforreddit.Post.Post;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.SubmitPost;
|
||||
import ml.docilealligator.infinityforreddit.Post.SubmitPost;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
public class SubmitPostService extends Service {
|
||||
|
@ -7,7 +7,7 @@ import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.ListPreference;
|
||||
import androidx.preference.PreferenceFragmentCompat;
|
||||
import androidx.preference.SwitchPreference;
|
||||
|
||||
@ -19,6 +19,7 @@ import javax.inject.Named;
|
||||
import ml.docilealligator.infinityforreddit.Event.ChangeNSFWBlurEvent;
|
||||
import ml.docilealligator.infinityforreddit.Event.ChangeNSFWEvent;
|
||||
import ml.docilealligator.infinityforreddit.Event.ChangeSpoilerBlurEvent;
|
||||
import ml.docilealligator.infinityforreddit.Event.ChangeVideoAutoplayEvent;
|
||||
import ml.docilealligator.infinityforreddit.Event.RecreateActivityEvent;
|
||||
import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
@ -39,18 +40,22 @@ public class MainPreferenceFragment extends PreferenceFragmentCompat {
|
||||
setPreferencesFromResource(R.xml.main_preferences, rootKey);
|
||||
((Infinity) activity.getApplication()).getAppComponent().inject(this);
|
||||
|
||||
ListPreference videoAutoplaySwitch = findPreference(SharedPreferencesUtils.VIDEO_AUTOPLAY);
|
||||
SwitchPreference confirmToExitSwitch = findPreference(SharedPreferencesUtils.CONFIRM_TO_EXIT);
|
||||
SwitchPreference nsfwSwitch = findPreference(SharedPreferencesUtils.NSFW_KEY);
|
||||
SwitchPreference blurNSFWSwitch = findPreference(SharedPreferencesUtils.BLUR_NSFW_KEY);
|
||||
SwitchPreference blurSpoilerSwitch = findPreference(SharedPreferencesUtils.BLUR_SPOILER_KEY);
|
||||
|
||||
if (videoAutoplaySwitch != null) {
|
||||
videoAutoplaySwitch.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
EventBus.getDefault().post(new ChangeVideoAutoplayEvent((String) newValue));
|
||||
return true;
|
||||
});
|
||||
}
|
||||
if (confirmToExitSwitch != null) {
|
||||
confirmToExitSwitch.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
EventBus.getDefault().post(new RecreateActivityEvent());
|
||||
return true;
|
||||
}
|
||||
confirmToExitSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
EventBus.getDefault().post(new RecreateActivityEvent());
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -23,9 +23,11 @@ public class SubredditData {
|
||||
private String sidebarDescription;
|
||||
@ColumnInfo(name = "subscribers_count")
|
||||
private int nSubscribers;
|
||||
@ColumnInfo(name = "created_utc")
|
||||
private long createdUTC;
|
||||
|
||||
public SubredditData(@NonNull String id, String name, String iconUrl, String bannerUrl,
|
||||
String description, String sidebarDescription, int nSubscribers) {
|
||||
String description, String sidebarDescription, int nSubscribers, long createdUTC) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.iconUrl = iconUrl;
|
||||
@ -33,6 +35,7 @@ public class SubredditData {
|
||||
this.description = description;
|
||||
this.sidebarDescription = sidebarDescription;
|
||||
this.nSubscribers = nSubscribers;
|
||||
this.createdUTC = createdUTC;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@ -63,4 +66,8 @@ public class SubredditData {
|
||||
public int getNSubscribers() {
|
||||
return nSubscribers;
|
||||
}
|
||||
|
||||
public long getCreatedUTC() {
|
||||
return createdUTC;
|
||||
}
|
||||
}
|
||||
|
@ -15,23 +15,33 @@ public class UserData {
|
||||
private String iconUrl;
|
||||
@ColumnInfo(name = "banner")
|
||||
private String banner;
|
||||
@ColumnInfo(name = "karma")
|
||||
private int karma;
|
||||
@ColumnInfo(name = "link_karma")
|
||||
private int linkKarma;
|
||||
@ColumnInfo(name = "comment_karma")
|
||||
private int commentKarma;
|
||||
@ColumnInfo(name = "created_utc")
|
||||
private long cakeday;
|
||||
@ColumnInfo(name = "is_gold")
|
||||
private boolean isGold;
|
||||
@ColumnInfo(name = "is_friend")
|
||||
private boolean isFriend;
|
||||
@ColumnInfo(name = "can_be_followed")
|
||||
private boolean canBeFollowed;
|
||||
@ColumnInfo(name = "description")
|
||||
private String description;
|
||||
|
||||
public UserData(@NonNull String name, String iconUrl, String banner, int karma, boolean isGold, boolean isFriend, boolean canBeFollowed) {
|
||||
public UserData(@NonNull String name, String iconUrl, String banner, int linkKarma, int commentKarma,
|
||||
long cakeday, boolean isGold, boolean isFriend, boolean canBeFollowed, String description) {
|
||||
this.name = name;
|
||||
this.iconUrl = iconUrl;
|
||||
this.banner = banner;
|
||||
this.karma = karma;
|
||||
this.commentKarma = commentKarma;
|
||||
this.linkKarma = linkKarma;
|
||||
this.cakeday = cakeday;
|
||||
this.isGold = isGold;
|
||||
this.isFriend = isFriend;
|
||||
this.canBeFollowed = canBeFollowed;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@ -47,8 +57,20 @@ public class UserData {
|
||||
return banner;
|
||||
}
|
||||
|
||||
public int getLinkKarma() {
|
||||
return linkKarma;
|
||||
}
|
||||
|
||||
public int getCommentKarma() {
|
||||
return commentKarma;
|
||||
}
|
||||
|
||||
public int getKarma() {
|
||||
return karma;
|
||||
return linkKarma + commentKarma;
|
||||
}
|
||||
|
||||
public long getCakeday() {
|
||||
return cakeday;
|
||||
}
|
||||
|
||||
public boolean isGold() {
|
||||
@ -62,4 +84,8 @@ public class UserData {
|
||||
public boolean isCanBeFollowed() {
|
||||
return canBeFollowed;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ public class CustomThemeSharedPreferencesUtils {
|
||||
public static final String COMMENT_BACKGROUND_COLOR = "commentBackgroundColor";
|
||||
public static final String BOTTOM_APP_BAR_BACKGROUND_COLOR = "bottomAppBarBackgroundColor";
|
||||
public static final String PRIMARY_ICON_COLOR = "primaryIconColor";
|
||||
public static final String BOTTOM_APP_BAR_ICON_COLOR = "bottomAppBarIconColor";
|
||||
public static final String POST_ICON_AND_INFO_COLOR = "postIconAndInfoColor";
|
||||
public static final String COMMENT_ICON_AND_INFO_COLOR = "commentIconAndInfoColor";
|
||||
public static final String TOOLBAR_PRIMARY_TEXT_AND_ICON_COLOR = "toolbarPrimaryTextAndIconColor";
|
||||
@ -96,6 +97,7 @@ public class CustomThemeSharedPreferencesUtils {
|
||||
editor.putInt(COMMENT_BACKGROUND_COLOR, customTheme.commentBackgroundColor);
|
||||
editor.putInt(BOTTOM_APP_BAR_BACKGROUND_COLOR, customTheme.bottomAppBarBackgroundColor);
|
||||
editor.putInt(PRIMARY_ICON_COLOR, customTheme.primaryIconColor);
|
||||
editor.putInt(BOTTOM_APP_BAR_ICON_COLOR, customTheme.bottomAppBarIconColor);
|
||||
editor.putInt(POST_ICON_AND_INFO_COLOR, customTheme.postIconAndInfoColor);
|
||||
editor.putInt(COMMENT_ICON_AND_INFO_COLOR, customTheme.commentIconAndInfoColor);
|
||||
editor.putInt(TOOLBAR_PRIMARY_TEXT_AND_ICON_COLOR, customTheme.toolbarPrimaryTextAndIconColor);
|
||||
@ -118,6 +120,8 @@ public class CustomThemeSharedPreferencesUtils {
|
||||
editor.putInt(NSFW_TEXT_COLOR, customTheme.nsfwTextColor);
|
||||
editor.putInt(FLAIR_BACKGROUND_COLOR, customTheme.flairBackgroundColor);
|
||||
editor.putInt(FLAIR_TEXT_COLOR, customTheme.flairTextColor);
|
||||
editor.putInt(AWARDS_BACKGROUND_COLOR, customTheme.awardsBackgroundColor);
|
||||
editor.putInt(AWARDS_TEXT_COLOR, customTheme.awardsTextColor);
|
||||
editor.putInt(ARCHIVED_ICON_TINT, customTheme.archivedTint);
|
||||
editor.putInt(LOCKED_ICON_TINT, customTheme.lockedIconTint);
|
||||
editor.putInt(CROSSPOST_ICON_TINT, customTheme.crosspostIconTint);
|
||||
|
@ -84,6 +84,8 @@ public class RedditUtils {
|
||||
public static final String MULTIPATH_KEY = "multipath";
|
||||
public static final String MODEL_KEY = "model";
|
||||
|
||||
public static final String REASON_KEY = "reason";
|
||||
|
||||
public static Map<String, String> getHttpBasicAuthHeader() {
|
||||
Map<String, String> params = new HashMap<>();
|
||||
String credentials = String.format("%s:%s", RedditUtils.CLIENT_ID, "");
|
||||
|
@ -76,6 +76,10 @@ public class SharedPreferencesUtils {
|
||||
public static final String VOLUME_KEYS_NAVIGATE_POSTS = "volume_keys_navigate_posts";
|
||||
public static final String MUTE_VIDEO = "mute_video";
|
||||
public static final String OPEN_LINK_IN_APP = "open_link_in_app";
|
||||
public static final String VIDEO_AUTOPLAY = "video_autoplay";
|
||||
public static final String VIDEO_AUTOPLAY_VALUE_ALWAYS_ON = "2";
|
||||
public static final String VIDEO_AUTOPLAY_VALUE_ON_WIFI = "1";
|
||||
public static final String VIDEO_AUTOPLAY_VALUE_NEVER = "0";
|
||||
public static final String LOCK_JUMP_TO_NEXT_TOP_LEVEL_COMMENT_BUTTON = "lock_jump_to_next_top_level_comment_button";
|
||||
public static final String SWIPE_UP_TO_HIDE_JUMP_TO_NEXT_TOP_LEVEL_COMMENT_BUTTON = "swipe_up_to_hide_jump_to_next_top_level_comments_button";
|
||||
public static final String SHOW_TOP_LEVEL_COMMENTS_FIRST = "show_top_level_comments_first";
|
||||
@ -89,10 +93,10 @@ public class SharedPreferencesUtils {
|
||||
public static final String CUSTOMIZE_DARK_THEME = "customize_dark_theme";
|
||||
public static final String CUSTOMIZE_AMOLED_THEME = "customize_amoled_theme";
|
||||
public static final String MANAGE_THEMES = "manage_themes";
|
||||
public static final String DELETE_ALL_SUBREDDITS_DATA_IN_DATABASE= "delete_all_subreddits_data_in_database";
|
||||
public static final String DELETE_ALL_USERS_DATA_IN_DATABASE= "delete_all_users_data_in_database";
|
||||
public static final String DELETE_ALL_SORT_TYPE_DATA_IN_DATABASE= "delete_all_sort_type_data_in_database";
|
||||
public static final String DELETE_ALL_POST_LAYOUT_DATA_IN_DATABASE= "delete_all_post_layout_data_in_database";
|
||||
public static final String DELETE_ALL_SUBREDDITS_DATA_IN_DATABASE = "delete_all_subreddits_data_in_database";
|
||||
public static final String DELETE_ALL_USERS_DATA_IN_DATABASE = "delete_all_users_data_in_database";
|
||||
public static final String DELETE_ALL_SORT_TYPE_DATA_IN_DATABASE = "delete_all_sort_type_data_in_database";
|
||||
public static final String DELETE_ALL_POST_LAYOUT_DATA_IN_DATABASE = "delete_all_post_layout_data_in_database";
|
||||
public static final String DELETE_ALL_THEMES_IN_DATABASE = "delete_all_themes_in_database";
|
||||
public static final String RESET_ALL_SETTINGS = "reset_all_settings";
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
package ml.docilealligator.infinityforreddit.Utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.Network;
|
||||
import android.net.NetworkInfo;
|
||||
import android.text.Html;
|
||||
import android.text.Spannable;
|
||||
import android.widget.TextView;
|
||||
@ -87,4 +90,18 @@ public class Utils {
|
||||
}
|
||||
textView.setText(html);
|
||||
}
|
||||
|
||||
public static boolean isConnectedToWifi(Context context) {
|
||||
ConnectivityManager connMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
if (connMgr != null) {
|
||||
for (Network network : connMgr.getAllNetworks()) {
|
||||
NetworkInfo networkInfo = connMgr.getNetworkInfo(network);
|
||||
if (networkInfo != null && networkInfo.getType() == ConnectivityManager.TYPE_WIFI) {
|
||||
return networkInfo.isConnected();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<item>
|
||||
<shape android:shape="oval">
|
||||
<solid android:color="#02EEE6" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
</layer-list>
|
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="18dp"
|
||||
android:height="18dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M6,14c-0.55,0 -1,0.45 -1,1v3c0,0.55 0.45,1 1,1h3c0.55,0 1,-0.45 1,-1s-0.45,-1 -1,-1L7,17v-2c0,-0.55 -0.45,-1 -1,-1zM6,10c0.55,0 1,-0.45 1,-1L7,7h2c0.55,0 1,-0.45 1,-1s-0.45,-1 -1,-1L6,5c-0.55,0 -1,0.45 -1,1v3c0,0.55 0.45,1 1,1zM17,17h-2c-0.55,0 -1,0.45 -1,1s0.45,1 1,1h3c0.55,0 1,-0.45 1,-1v-3c0,-0.55 -0.45,-1 -1,-1s-1,0.45 -1,1v2zM14,6c0,0.55 0.45,1 1,1h2v2c0,0.55 0.45,1 1,1s1,-0.45 1,-1L19,6c0,-0.55 -0.45,-1 -1,-1h-3c-0.55,0 -1,0.45 -1,1z"
|
||||
android:fillColor="#FFFFFF"/>
|
||||
</vector>
|
9
app/src/main/res/drawable/ic_mute_white_rounded_18dp.xml
Normal file
9
app/src/main/res/drawable/ic_mute_white_rounded_18dp.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="18dp"
|
||||
android:height="18dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M3.63,3.63c-0.39,0.39 -0.39,1.02 0,1.41L7.29,8.7 7,9L4,9c-0.55,0 -1,0.45 -1,1v4c0,0.55 0.45,1 1,1h3l3.29,3.29c0.63,0.63 1.71,0.18 1.71,-0.71v-4.17l4.18,4.18c-0.49,0.37 -1.02,0.68 -1.6,0.91 -0.36,0.15 -0.58,0.53 -0.58,0.92 0,0.72 0.73,1.18 1.39,0.91 0.8,-0.33 1.55,-0.77 2.22,-1.31l1.34,1.34c0.39,0.39 1.02,0.39 1.41,0 0.39,-0.39 0.39,-1.02 0,-1.41L5.05,3.63c-0.39,-0.39 -1.02,-0.39 -1.42,0zM19,12c0,0.82 -0.15,1.61 -0.41,2.34l1.53,1.53c0.56,-1.17 0.88,-2.48 0.88,-3.87 0,-3.83 -2.4,-7.11 -5.78,-8.4 -0.59,-0.23 -1.22,0.23 -1.22,0.86v0.19c0,0.38 0.25,0.71 0.61,0.85C17.18,6.54 19,9.06 19,12zM10.29,5.71l-0.17,0.17L12,7.76L12,6.41c0,-0.89 -1.08,-1.33 -1.71,-0.7zM16.5,12c0,-1.77 -1.02,-3.29 -2.5,-4.03v1.79l2.48,2.48c0.01,-0.08 0.02,-0.16 0.02,-0.24z"
|
||||
android:fillColor="#ffffff"/>
|
||||
</vector>
|
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="18dp"
|
||||
android:height="18dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M8,19c1.1,0 2,-0.9 2,-2L10,7c0,-1.1 -0.9,-2 -2,-2s-2,0.9 -2,2v10c0,1.1 0.9,2 2,2zM14,7v10c0,1.1 0.9,2 2,2s2,-0.9 2,-2L18,7c0,-1.1 -0.9,-2 -2,-2s-2,0.9 -2,2z"
|
||||
android:fillColor="#ffffff"/>
|
||||
</vector>
|
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="18dp"
|
||||
android:height="18dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M8,6.82v10.36c0,0.79 0.87,1.27 1.54,0.84l8.14,-5.18c0.62,-0.39 0.62,-1.29 0,-1.69L9.54,5.98C8.87,5.55 8,6.03 8,6.82z"
|
||||
android:fillColor="#ffffff"/>
|
||||
</vector>
|
15
app/src/main/res/drawable/ic_report_black_24dp.xml
Normal file
15
app/src/main/res/drawable/ic_report_black_24dp.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M15.73,3H8.27L3,8.27v7.46L8.27,21h7.46L21,15.73V8.27L15.73,3zM19,14.9L14.9,19H9.1L5,14.9V9.1L9.1,5h5.8L19,9.1v5.8z"
|
||||
android:fillColor="#000000"/>
|
||||
<path
|
||||
android:pathData="M12,16m-1,0a1,1 0,1 1,2 0a1,1 0,1 1,-2 0"
|
||||
android:fillColor="#000000"/>
|
||||
<path
|
||||
android:pathData="M11,7h2v7h-2z"
|
||||
android:fillColor="#000000"/>
|
||||
</vector>
|
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="18dp"
|
||||
android:height="18dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M3,10v4c0,0.55 0.45,1 1,1h3l3.29,3.29c0.63,0.63 1.71,0.18 1.71,-0.71L12,6.41c0,-0.89 -1.08,-1.34 -1.71,-0.71L7,9L4,9c-0.55,0 -1,0.45 -1,1zM16.5,12c0,-1.77 -1.02,-3.29 -2.5,-4.03v8.05c1.48,-0.73 2.5,-2.25 2.5,-4.02zM14,4.45v0.2c0,0.38 0.25,0.71 0.6,0.85C17.18,6.53 19,9.06 19,12s-1.82,5.47 -4.4,6.5c-0.36,0.14 -0.6,0.47 -0.6,0.85v0.2c0,0.63 0.63,1.07 1.21,0.85C18.6,19.11 21,15.84 21,12s-2.4,-7.11 -5.79,-8.4c-0.58,-0.23 -1.21,0.22 -1.21,0.85z"
|
||||
android:fillColor="#ffffff"/>
|
||||
</vector>
|
31
app/src/main/res/layout/activity_report.xml
Normal file
31
app/src/main/res/layout/activity_report.xml
Normal file
@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/coordinator_layout_report_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:application=".PostImageActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appbar_layout_report_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar_report_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
app:navigationIcon="?attr/homeAsUpIndicator"
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view_report_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
@ -5,7 +5,8 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/parent_relative_layout_view_gif_activity"
|
||||
android:background="@android:color/black"
|
||||
android:background="#000000"
|
||||
android:keepScreenOn="true"
|
||||
tools:application="ml.docilealligator.infinityforreddit.Activity.ViewGIFActivity">
|
||||
|
||||
<ProgressBar
|
||||
|
@ -74,7 +74,7 @@
|
||||
android:textColor="@android:color/white"
|
||||
android:layout_gravity="center_horizontal"/>
|
||||
|
||||
<RelativeLayout
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
@ -84,20 +84,51 @@
|
||||
android:id="@+id/subscriber_count_text_view_view_subreddit_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="?attr/font_default"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_toStartOf="@id/online_subscriber_count_text_view_view_subreddit_detail_activity" />
|
||||
app:layout_constraintBottom_toTopOf="@id/online_subscriber_count_text_view_view_subreddit_detail_activity"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/barrier"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/online_subscriber_count_text_view_view_subreddit_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="?attr/font_default" />
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/barrier"
|
||||
app:layout_constraintTop_toBottomOf="@id/subscriber_count_text_view_view_subreddit_detail_activity"
|
||||
app:layout_constraintHorizontal_bias="0" />
|
||||
|
||||
</RelativeLayout>
|
||||
<TextView
|
||||
android:id="@+id/since_text_view_view_subreddit_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/since"
|
||||
app:layout_constraintBottom_toTopOf="@id/creation_time_text_view_view_subreddit_detail_activity"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/creation_time_text_view_view_subreddit_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="end"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/since_text_view_view_subreddit_detail_activity" />
|
||||
|
||||
<androidx.constraintlayout.widget.Barrier
|
||||
android:id="@+id/barrier"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:barrierDirection="start"
|
||||
app:constraint_referenced_ids="creation_time_text_view_view_subreddit_detail_activity, since_text_view_view_subreddit_detail_activity" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/description_text_view_view_subreddit_detail_activity"
|
||||
|
@ -62,16 +62,8 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:textSize="?attr/font_18"
|
||||
android:layout_gravity="center_horizontal"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/karma_text_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:textSize="?attr/font_default"
|
||||
android:textSize="?attr/font_18"
|
||||
android:layout_gravity="center_horizontal"/>
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
@ -79,10 +71,40 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:textColor="@android:color/white"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/karma_text_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_toStartOf="@id/cakeday_text_view_view_user_detail_activity"
|
||||
android:textSize="?attr/font_default" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/cakeday_text_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="end"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:textSize="?attr/font_default" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/description_text_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:textSize="?attr/font_default"
|
||||
android:visibility="gone" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
@ -4,7 +4,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/black"
|
||||
android:background="#000000"
|
||||
android:id="@+id/relative_layout_view_video_activity"
|
||||
android:keepScreenOn="true"
|
||||
tools:application="ml.docilealligator.infinityforreddit.Activity.ViewVideoActivity">
|
||||
|
@ -0,0 +1,72 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/linear_layout_exo_playback_control_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:layout_gravity="bottom">
|
||||
|
||||
<TextView android:id="@id/exo_position"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:includeFontPadding="false"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/slash"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toEndOf="@id/exo_position"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="/"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView android:id="@id/exo_duration"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toEndOf="@id/slash"
|
||||
android:layout_centerVertical="true"
|
||||
android:includeFontPadding="false"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ImageView android:id="@id/exo_play"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="8dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@drawable/ic_play_arrow_white_rounded_18dp" />
|
||||
|
||||
<ImageView android:id="@id/exo_pause"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="8dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@drawable/ic_pause_white_rounded_18dp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/mute_exo_playback_control_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="8dp"
|
||||
android:layout_toStartOf="@id/fullscreen_exo_playback_control_view"
|
||||
android:src="@drawable/ic_mute_white_rounded_18dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/fullscreen_exo_playback_control_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="8dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:src="@drawable/ic_fullscreen_white_rounded_18dp" />
|
||||
|
||||
</RelativeLayout>
|
@ -81,6 +81,24 @@
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="?attr/font_default" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/report_view_comment_more_bottom_sheet_fragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:drawableStart="@drawable/ic_report_black_24dp"
|
||||
android:drawablePadding="48dp"
|
||||
android:focusable="true"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="32dp"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingEnd="32dp"
|
||||
android:paddingBottom="16dp"
|
||||
android:text="@string/report"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="?attr/font_default" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
@ -10,7 +10,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
<ml.docilealligator.infinityforreddit.CustomView.CustomToroContainer
|
||||
android:id="@+id/recycler_view_post_fragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
@ -0,0 +1,313 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:id="@+id/card_view_item_post_image_type"
|
||||
app:cardBackgroundColor="?attr/cardViewBackgroundColor"
|
||||
app:cardElevation="2dp"
|
||||
app:cardCornerRadius="16dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp">
|
||||
|
||||
<ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView
|
||||
android:id="@+id/icon_gif_image_view_item_post_image_type"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_gravity="center"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/subreddit_name_text_view_item_post_image_type"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constraintBottom_toTopOf="@id/user_text_view_item_post_image_type"
|
||||
app:layout_constraintStart_toEndOf="@id/icon_gif_image_view_item_post_image_type"
|
||||
app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_item_post_image_type"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/user_text_view_item_post_image_type"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:textSize="?attr/font_default"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_image_type"
|
||||
app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_item_post_image_type"
|
||||
app:layout_constraintTop_toBottomOf="@+id/subreddit_name_text_view_item_post_image_type"
|
||||
app:layout_constraintHorizontal_bias="0" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/stickied_post_image_view_item_post_image_type"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/subreddit_name_text_view_item_post_image_type"
|
||||
app:layout_constraintEnd_toStartOf="@+id/guideline2"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/post_time_text_view_best_item_post_image_type"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="end"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/guideline2"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.6" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title_text_view_best_item_post_image_type"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:textSize="?attr/title_font_18" />
|
||||
|
||||
<com.nex3z.flowlayout.FlowLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp"
|
||||
app:flChildSpacing="16dp"
|
||||
app:flChildSpacingForLastRow="align"
|
||||
app:flRowSpacing="8dp">
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/type_text_view_item_post_image_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="4dp"
|
||||
android:textSize="?attr/font_12"
|
||||
app:lib_setRadius="3dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/spoiler_custom_text_view_item_post_image_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/spoiler"
|
||||
android:textSize="?attr/font_12"
|
||||
android:padding="4dp"
|
||||
android:visibility="gone"
|
||||
app:lib_setRadius="3dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/nsfw_text_view_item_post_image_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="4dp"
|
||||
android:text="@string/nsfw"
|
||||
android:textSize="?attr/font_12"
|
||||
android:visibility="gone"
|
||||
app:lib_setRadius="3dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/flair_custom_text_view_item_post_image_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:textSize="?attr/font_12"
|
||||
android:padding="4dp"
|
||||
android:visibility="gone"
|
||||
app:lib_setRadius="3dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/awards_text_view_item_post_image_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="4dp"
|
||||
android:textSize="?attr/font_12"
|
||||
android:visibility="gone"
|
||||
app:lib_setRadius="3dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/archived_image_view_item_post_image_type"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@drawable/ic_archive_outline"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/locked_image_view_item_post_image_type"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@drawable/ic_outline_lock_24dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/crosspost_image_view_item_post_image_type"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@drawable/crosspost"
|
||||
android:visibility="gone" />
|
||||
|
||||
</com.nex3z.flowlayout.FlowLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/image_view_wrapper_item_post_image_type"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView
|
||||
android:id="@+id/image_view_best_post_item"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="fitStart" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress_bar_item_post_image_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/load_image_error_relative_layout_item_post_image_type"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerInParent="true"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableTop="@drawable/ic_error_outline_black_24dp"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:text="@string/error_loading_image_tap_to_retry"
|
||||
android:textSize="?attr/font_default" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/bottom_constraint_layout_item_post_image_type"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/plus_button_item_post_image_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp"
|
||||
android:src="@drawable/ic_arrow_upward_grey_24dp"
|
||||
android:background="?actionBarItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/score_text_view_item_post_image_type"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textSize="?attr/font_12"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/plus_button_item_post_image_type" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/minus_button_item_post_image_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp"
|
||||
android:src="@drawable/ic_arrow_downward_grey_24dp"
|
||||
android:background="?actionBarItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_image_type" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/comments_count_item_post_image_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="?attr/font_12"
|
||||
android:textStyle="bold"
|
||||
android:drawableStart="@drawable/ic_comment_grey_24dp"
|
||||
android:drawablePadding="12dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/minus_button_item_post_image_type" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/save_button_item_post_image_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp"
|
||||
android:background="?actionBarItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
app:layout_constraintHorizontal_bias="1"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/comments_count_item_post_image_type"
|
||||
app:layout_constraintEnd_toStartOf="@id/share_button_item_post_image_type" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/share_button_item_post_image_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp"
|
||||
android:src="@drawable/ic_share_grey_24dp"
|
||||
android:background="?actionBarItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
324
app/src/main/res/layout/item_post_link_type.xml
Normal file
324
app/src/main/res/layout/item_post_link_type.xml
Normal file
@ -0,0 +1,324 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:id="@+id/card_view_item_post_link_type"
|
||||
app:cardBackgroundColor="?attr/cardViewBackgroundColor"
|
||||
app:cardElevation="2dp"
|
||||
app:cardCornerRadius="16dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp">
|
||||
|
||||
<ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView
|
||||
android:id="@+id/icon_gif_image_view_item_post_link_type"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_gravity="center"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/subreddit_name_text_view_item_post_link_type"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constraintBottom_toTopOf="@id/user_text_view_item_post_link_type"
|
||||
app:layout_constraintStart_toEndOf="@id/icon_gif_image_view_item_post_link_type"
|
||||
app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_item_post_link_type"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/user_text_view_item_post_link_type"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:textSize="?attr/font_default"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_link_type"
|
||||
app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_item_post_link_type"
|
||||
app:layout_constraintTop_toBottomOf="@+id/subreddit_name_text_view_item_post_link_type"
|
||||
app:layout_constraintHorizontal_bias="0" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/stickied_post_image_view_item_post_link_type"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/subreddit_name_text_view_item_post_link_type"
|
||||
app:layout_constraintEnd_toStartOf="@+id/guideline2"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/post_time_text_view_best_item_post_link_type"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="end"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/guideline2"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.6" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title_text_view_best_item_post_link_type"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:textSize="?attr/title_font_18" />
|
||||
|
||||
<com.nex3z.flowlayout.FlowLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp"
|
||||
app:flChildSpacing="16dp"
|
||||
app:flChildSpacingForLastRow="align"
|
||||
app:flRowSpacing="8dp">
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/type_text_view_item_post_link_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="4dp"
|
||||
android:text="@string/link"
|
||||
android:textSize="?attr/font_12"
|
||||
app:lib_setRadius="3dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/spoiler_custom_text_view_item_post_link_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/spoiler"
|
||||
android:textSize="?attr/font_12"
|
||||
android:padding="4dp"
|
||||
android:visibility="gone"
|
||||
app:lib_setRadius="3dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/nsfw_text_view_item_post_link_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="4dp"
|
||||
android:text="@string/nsfw"
|
||||
android:textSize="?attr/font_12"
|
||||
android:visibility="gone"
|
||||
app:lib_setRadius="3dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/flair_custom_text_view_item_post_link_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:textSize="?attr/font_12"
|
||||
android:padding="4dp"
|
||||
android:visibility="gone"
|
||||
app:lib_setRadius="3dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/awards_text_view_item_post_link_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="4dp"
|
||||
android:textSize="?attr/font_12"
|
||||
android:visibility="gone"
|
||||
app:lib_setRadius="3dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/archived_image_view_item_post_link_type"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@drawable/ic_archive_outline"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/locked_image_view_item_post_link_type"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@drawable/ic_outline_lock_24dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/crosspost_image_view_item_post_link_type"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@drawable/crosspost"
|
||||
android:visibility="gone" />
|
||||
|
||||
</com.nex3z.flowlayout.FlowLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/link_text_view_item_post_link_type"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:textSize="?attr/font_12"
|
||||
android:visibility="gone" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/image_view_wrapper_item_post_link_type"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView
|
||||
android:id="@+id/image_view_best_post_item"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="fitStart" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress_bar_item_post_link_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/load_image_error_relative_layout_item_post_link_type"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerInParent="true"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableTop="@drawable/ic_error_outline_black_24dp"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:text="@string/error_loading_image_tap_to_retry"
|
||||
android:textSize="?attr/font_default" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/bottom_constraint_layout_item_post_link_type"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/plus_button_item_post_link_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp"
|
||||
android:src="@drawable/ic_arrow_upward_grey_24dp"
|
||||
android:background="?actionBarItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/score_text_view_item_post_link_type"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textSize="?attr/font_12"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/plus_button_item_post_link_type" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/minus_button_item_post_link_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp"
|
||||
android:src="@drawable/ic_arrow_downward_grey_24dp"
|
||||
android:background="?actionBarItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_link_type" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/comments_count_item_post_link_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="?attr/font_12"
|
||||
android:textStyle="bold"
|
||||
android:drawableStart="@drawable/ic_comment_grey_24dp"
|
||||
android:drawablePadding="12dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/minus_button_item_post_link_type" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/save_button_item_post_link_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp"
|
||||
android:background="?actionBarItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
app:layout_constraintHorizontal_bias="1"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/comments_count_item_post_link_type"
|
||||
app:layout_constraintEnd_toStartOf="@id/share_button_item_post_link_type" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/share_button_item_post_link_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp"
|
||||
android:src="@drawable/ic_share_grey_24dp"
|
||||
android:background="?actionBarItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
293
app/src/main/res/layout/item_post_no_preview_link_type.xml
Normal file
293
app/src/main/res/layout/item_post_no_preview_link_type.xml
Normal file
@ -0,0 +1,293 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:id="@+id/card_view_item_post_no_preview_link_type"
|
||||
app:cardBackgroundColor="?attr/cardViewBackgroundColor"
|
||||
app:cardElevation="2dp"
|
||||
app:cardCornerRadius="16dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp">
|
||||
|
||||
<ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView
|
||||
android:id="@+id/icon_gif_image_view_item_post_no_preview_link_type"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_gravity="center"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/subreddit_name_text_view_item_post_no_preview_link_type"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constraintBottom_toTopOf="@id/user_text_view_item_post_no_preview_link_type"
|
||||
app:layout_constraintStart_toEndOf="@id/icon_gif_image_view_item_post_no_preview_link_type"
|
||||
app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_item_post_no_preview_link_type"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/user_text_view_item_post_no_preview_link_type"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:textSize="?attr/font_default"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_no_preview_link_type"
|
||||
app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_item_post_no_preview_link_type"
|
||||
app:layout_constraintTop_toBottomOf="@+id/subreddit_name_text_view_item_post_no_preview_link_type"
|
||||
app:layout_constraintHorizontal_bias="0" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/stickied_post_image_view_item_post_no_preview_link_type"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/subreddit_name_text_view_item_post_no_preview_link_type"
|
||||
app:layout_constraintEnd_toStartOf="@+id/guideline2"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/post_time_text_view_best_item_post_no_preview_link_type"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="end"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/guideline2"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.6" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title_text_view_best_item_post_no_preview_link_type"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:textSize="?attr/title_font_18" />
|
||||
|
||||
<com.nex3z.flowlayout.FlowLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp"
|
||||
app:flChildSpacing="16dp"
|
||||
app:flChildSpacingForLastRow="align"
|
||||
app:flRowSpacing="8dp">
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/type_text_view_item_post_no_preview_link_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="4dp"
|
||||
android:text="@string/link"
|
||||
android:textSize="?attr/font_12"
|
||||
app:lib_setRadius="3dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/spoiler_custom_text_view_item_post_no_preview_link_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/spoiler"
|
||||
android:textSize="?attr/font_12"
|
||||
android:padding="4dp"
|
||||
android:visibility="gone"
|
||||
app:lib_setRadius="3dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/nsfw_text_view_item_post_no_preview_link_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="4dp"
|
||||
android:text="@string/nsfw"
|
||||
android:textSize="?attr/font_12"
|
||||
android:visibility="gone"
|
||||
app:lib_setRadius="3dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/flair_custom_text_view_item_post_no_preview_link_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:textSize="?attr/font_12"
|
||||
android:padding="4dp"
|
||||
android:visibility="gone"
|
||||
app:lib_setRadius="3dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/awards_text_view_item_post_no_preview_link_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="4dp"
|
||||
android:textSize="?attr/font_12"
|
||||
android:visibility="gone"
|
||||
app:lib_setRadius="3dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/archived_image_view_item_post_no_preview_link_type"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@drawable/ic_archive_outline"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/locked_image_view_item_post_no_preview_link_type"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@drawable/ic_outline_lock_24dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/crosspost_image_view_item_post_no_preview_link_type"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@drawable/crosspost"
|
||||
android:visibility="gone" />
|
||||
|
||||
</com.nex3z.flowlayout.FlowLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/link_text_view_item_post_no_preview_link_type"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:textSize="?attr/font_12" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image_view_no_preview_link_item_post_no_preview_link_type"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="150dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_link"
|
||||
android:tint="@android:color/tab_indicator_text" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/bottom_constraint_layout_item_post_no_preview_link_type"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/plus_button_item_post_no_preview_link_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp"
|
||||
android:src="@drawable/ic_arrow_upward_grey_24dp"
|
||||
android:background="?actionBarItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/score_text_view_item_post_no_preview_link_type"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textSize="?attr/font_12"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/plus_button_item_post_no_preview_link_type" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/minus_button_item_post_no_preview_link_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp"
|
||||
android:src="@drawable/ic_arrow_downward_grey_24dp"
|
||||
android:background="?actionBarItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_no_preview_link_type" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/comments_count_item_post_no_preview_link_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="?attr/font_12"
|
||||
android:textStyle="bold"
|
||||
android:drawableStart="@drawable/ic_comment_grey_24dp"
|
||||
android:drawablePadding="12dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/minus_button_item_post_no_preview_link_type" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/save_button_item_post_no_preview_link_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp"
|
||||
android:background="?actionBarItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
app:layout_constraintHorizontal_bias="1"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/comments_count_item_post_no_preview_link_type"
|
||||
app:layout_constraintEnd_toStartOf="@id/share_button_item_post_no_preview_link_type" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/share_button_item_post_no_preview_link_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp"
|
||||
android:src="@drawable/ic_share_grey_24dp"
|
||||
android:background="?actionBarItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
288
app/src/main/res/layout/item_post_text_type.xml
Normal file
288
app/src/main/res/layout/item_post_text_type.xml
Normal file
@ -0,0 +1,288 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:id="@+id/card_view_item_post_text_type"
|
||||
app:cardBackgroundColor="?attr/cardViewBackgroundColor"
|
||||
app:cardElevation="2dp"
|
||||
app:cardCornerRadius="16dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp">
|
||||
|
||||
<ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView
|
||||
android:id="@+id/icon_gif_image_view_item_post_text_type"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_gravity="center"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/subreddit_name_text_view_item_post_text_type"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constraintBottom_toTopOf="@id/user_text_view_item_post_text_type"
|
||||
app:layout_constraintStart_toEndOf="@id/icon_gif_image_view_item_post_text_type"
|
||||
app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_item_post_text_type"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/user_text_view_item_post_text_type"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:textSize="?attr/font_default"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_text_type"
|
||||
app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_item_post_text_type"
|
||||
app:layout_constraintTop_toBottomOf="@+id/subreddit_name_text_view_item_post_text_type"
|
||||
app:layout_constraintHorizontal_bias="0" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/stickied_post_image_view_item_post_text_type"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/subreddit_name_text_view_item_post_text_type"
|
||||
app:layout_constraintEnd_toStartOf="@+id/guideline2"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/post_time_text_view_best_item_post_text_type"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="end"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/guideline2"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.6" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title_text_view_best_item_post_text_type"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:textSize="?attr/title_font_18" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/content_text_view_item_post_text_type"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:maxLines="4"
|
||||
android:visibility="gone"
|
||||
android:textSize="?attr/content_font_default"
|
||||
android:ellipsize="end" />
|
||||
|
||||
<com.nex3z.flowlayout.FlowLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp"
|
||||
app:flChildSpacing="16dp"
|
||||
app:flChildSpacingForLastRow="align"
|
||||
app:flRowSpacing="8dp">
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/type_text_view_item_post_text_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="4dp"
|
||||
android:text="@string/text"
|
||||
android:textSize="?attr/font_12"
|
||||
app:lib_setRadius="3dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/spoiler_custom_text_view_item_post_text_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/spoiler"
|
||||
android:textSize="?attr/font_12"
|
||||
android:padding="4dp"
|
||||
android:visibility="gone"
|
||||
app:lib_setRadius="3dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/nsfw_text_view_item_post_text_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="4dp"
|
||||
android:text="@string/nsfw"
|
||||
android:textSize="?attr/font_12"
|
||||
android:visibility="gone"
|
||||
app:lib_setRadius="3dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/flair_custom_text_view_item_post_text_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:textSize="?attr/font_12"
|
||||
android:padding="4dp"
|
||||
android:visibility="gone"
|
||||
app:lib_setRadius="3dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/awards_text_view_item_post_text_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="4dp"
|
||||
android:textSize="?attr/font_12"
|
||||
android:visibility="gone"
|
||||
app:lib_setRadius="3dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/archived_image_view_item_post_text_type"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@drawable/ic_archive_outline"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/locked_image_view_item_post_text_type"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@drawable/ic_outline_lock_24dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/crosspost_image_view_item_post_text_type"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@drawable/crosspost"
|
||||
android:visibility="gone" />
|
||||
|
||||
</com.nex3z.flowlayout.FlowLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/bottom_constraint_layout_item_post_text_type"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/plus_button_item_post_text_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp"
|
||||
android:src="@drawable/ic_arrow_upward_grey_24dp"
|
||||
android:background="?actionBarItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/score_text_view_item_post_text_type"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textSize="?attr/font_12"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/plus_button_item_post_text_type" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/minus_button_item_post_text_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp"
|
||||
android:src="@drawable/ic_arrow_downward_grey_24dp"
|
||||
android:background="?actionBarItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_text_type" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/comments_count_item_post_text_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="?attr/font_12"
|
||||
android:textStyle="bold"
|
||||
android:drawableStart="@drawable/ic_comment_grey_24dp"
|
||||
android:drawablePadding="12dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/minus_button_item_post_text_type" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/save_button_item_post_text_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp"
|
||||
android:background="?actionBarItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
app:layout_constraintHorizontal_bias="1"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/comments_count_item_post_text_type"
|
||||
app:layout_constraintEnd_toStartOf="@id/share_button_item_post_text_type" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/share_button_item_post_text_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp"
|
||||
android:src="@drawable/ic_share_grey_24dp"
|
||||
android:background="?actionBarItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
328
app/src/main/res/layout/item_post_video_and_gif_preview_type.xml
Normal file
328
app/src/main/res/layout/item_post_video_and_gif_preview_type.xml
Normal file
@ -0,0 +1,328 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:id="@+id/card_view_item_post_gif_type_autoplay"
|
||||
app:cardBackgroundColor="?attr/cardViewBackgroundColor"
|
||||
app:cardElevation="2dp"
|
||||
app:cardCornerRadius="16dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp">
|
||||
|
||||
<ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView
|
||||
android:id="@+id/icon_gif_image_view_item_post_gif_type_autoplay"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_gravity="center"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/subreddit_name_text_view_item_post_gif_type_autoplay"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constraintBottom_toTopOf="@id/user_text_view_item_post_gif_type_autoplay"
|
||||
app:layout_constraintStart_toEndOf="@id/icon_gif_image_view_item_post_gif_type_autoplay"
|
||||
app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_item_post_gif_type_autoplay"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/user_text_view_item_post_gif_type_autoplay"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:textSize="?attr/font_default"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_gif_type_autoplay"
|
||||
app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_item_post_gif_type_autoplay"
|
||||
app:layout_constraintTop_toBottomOf="@+id/subreddit_name_text_view_item_post_gif_type_autoplay"
|
||||
app:layout_constraintHorizontal_bias="0" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/stickied_post_image_view_item_post_gif_type_autoplay"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/subreddit_name_text_view_item_post_gif_type_autoplay"
|
||||
app:layout_constraintEnd_toStartOf="@+id/guideline2"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/post_time_text_view_best_item_post_gif_type_autoplay"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="end"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/guideline2"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.6" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title_text_view_best_item_post_gif_type_autoplay"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:textSize="?attr/title_font_18" />
|
||||
|
||||
<com.nex3z.flowlayout.FlowLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp"
|
||||
app:flChildSpacing="16dp"
|
||||
app:flChildSpacingForLastRow="align"
|
||||
app:flRowSpacing="8dp">
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/type_text_view_item_post_gif_type_autoplay"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="4dp"
|
||||
android:text="@string/gif"
|
||||
android:textSize="?attr/font_12"
|
||||
app:lib_setRadius="3dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/spoiler_custom_text_view_item_post_gif_type_autoplay"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/spoiler"
|
||||
android:textSize="?attr/font_12"
|
||||
android:padding="4dp"
|
||||
android:visibility="gone"
|
||||
app:lib_setRadius="3dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/nsfw_text_view_item_post_gif_type_autoplay"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="4dp"
|
||||
android:text="@string/nsfw"
|
||||
android:textSize="?attr/font_12"
|
||||
android:visibility="gone"
|
||||
app:lib_setRadius="3dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/flair_custom_text_view_item_post_gif_type_autoplay"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:textSize="?attr/font_12"
|
||||
android:padding="4dp"
|
||||
android:visibility="gone"
|
||||
app:lib_setRadius="3dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/awards_text_view_item_post_gif_type_autoplay"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="4dp"
|
||||
android:textSize="?attr/font_12"
|
||||
android:visibility="gone"
|
||||
app:lib_setRadius="3dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/archived_image_view_item_post_gif_type_autoplay"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@drawable/ic_archive_outline"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/locked_image_view_item_post_gif_type_autoplay"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@drawable/ic_outline_lock_24dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/crosspost_image_view_item_post_gif_type_autoplay"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@drawable/crosspost"
|
||||
android:visibility="gone" />
|
||||
|
||||
</com.nex3z.flowlayout.FlowLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/image_view_wrapper_item_post_gif_type_autoplay"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView
|
||||
android:id="@+id/image_view_item_post_gif_type_autoplay"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="fitStart" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
android:layout_gravity="start"
|
||||
android:background="@drawable/play_button_round_background"
|
||||
android:src="@drawable/ic_play_circle_36dp" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress_bar_item_post_gif_type_autoplay"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/load_image_error_relative_layout_item_post_gif_type_autoplay"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerInParent="true"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableTop="@drawable/ic_error_outline_black_24dp"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:text="@string/error_loading_image_tap_to_retry"
|
||||
android:textSize="?attr/font_default" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/bottom_constraint_layout_item_post_gif_type_autoplay"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/plus_button_item_post_gif_type_autoplay"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp"
|
||||
android:src="@drawable/ic_arrow_upward_grey_24dp"
|
||||
android:background="?actionBarItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/score_text_view_item_post_gif_type_autoplay"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textSize="?attr/font_12"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/plus_button_item_post_gif_type_autoplay" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/minus_button_item_post_gif_type_autoplay"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp"
|
||||
android:src="@drawable/ic_arrow_downward_grey_24dp"
|
||||
android:background="?actionBarItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_gif_type_autoplay" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/comments_count_item_post_gif_type_autoplay"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="?attr/font_12"
|
||||
android:textStyle="bold"
|
||||
android:drawableStart="@drawable/ic_comment_grey_24dp"
|
||||
android:drawablePadding="12dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/minus_button_item_post_gif_type_autoplay" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/save_button_item_post_gif_type_autoplay"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp"
|
||||
android:background="?actionBarItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
app:layout_constraintHorizontal_bias="1"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/comments_count_item_post_gif_type_autoplay"
|
||||
app:layout_constraintEnd_toStartOf="@id/share_button_item_post_gif_type_autoplay" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/share_button_item_post_gif_type_autoplay"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp"
|
||||
android:src="@drawable/ic_share_grey_24dp"
|
||||
android:background="?actionBarItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
291
app/src/main/res/layout/item_post_video_type_autoplay.xml
Normal file
291
app/src/main/res/layout/item_post_video_type_autoplay.xml
Normal file
@ -0,0 +1,291 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:id="@+id/card_view_item_post_video_type_autoplay"
|
||||
app:cardBackgroundColor="?attr/cardViewBackgroundColor"
|
||||
app:cardElevation="2dp"
|
||||
app:cardCornerRadius="16dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp">
|
||||
|
||||
<ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView
|
||||
android:id="@+id/icon_gif_image_view_item_post_video_type_autoplay"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_gravity="center"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/subreddit_name_text_view_item_post_video_type_autoplay"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constraintBottom_toTopOf="@id/user_text_view_item_post_video_type_autoplay"
|
||||
app:layout_constraintStart_toEndOf="@id/icon_gif_image_view_item_post_video_type_autoplay"
|
||||
app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_item_post_video_type_autoplay"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/user_text_view_item_post_video_type_autoplay"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:textSize="?attr/font_default"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_video_type_autoplay"
|
||||
app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_item_post_video_type_autoplay"
|
||||
app:layout_constraintTop_toBottomOf="@+id/subreddit_name_text_view_item_post_video_type_autoplay"
|
||||
app:layout_constraintHorizontal_bias="0" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/stickied_post_image_view_item_post_video_type_autoplay"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/subreddit_name_text_view_item_post_video_type_autoplay"
|
||||
app:layout_constraintEnd_toStartOf="@+id/guideline2"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/post_time_text_view_best_item_post_video_type_autoplay"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="end"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/guideline2"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.6" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title_text_view_best_item_post_video_type_autoplay"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:textSize="?attr/title_font_18" />
|
||||
|
||||
<com.nex3z.flowlayout.FlowLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp"
|
||||
app:flChildSpacing="16dp"
|
||||
app:flChildSpacingForLastRow="align"
|
||||
app:flRowSpacing="8dp">
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/type_text_view_item_post_video_type_autoplay"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="4dp"
|
||||
android:text="@string/video"
|
||||
android:textSize="?attr/font_12"
|
||||
app:lib_setRadius="3dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/spoiler_custom_text_view_item_post_video_type_autoplay"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/spoiler"
|
||||
android:textSize="?attr/font_12"
|
||||
android:padding="4dp"
|
||||
android:visibility="gone"
|
||||
app:lib_setRadius="3dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/nsfw_text_view_item_post_video_type_autoplay"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="4dp"
|
||||
android:text="@string/nsfw"
|
||||
android:textSize="?attr/font_12"
|
||||
android:visibility="gone"
|
||||
app:lib_setRadius="3dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/flair_custom_text_view_item_post_video_type_autoplay"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:textSize="?attr/font_12"
|
||||
android:padding="4dp"
|
||||
android:visibility="gone"
|
||||
app:lib_setRadius="3dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/awards_text_view_item_post_video_type_autoplay"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="4dp"
|
||||
android:textSize="?attr/font_12"
|
||||
android:visibility="gone"
|
||||
app:lib_setRadius="3dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/archived_image_view_item_post_video_type_autoplay"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@drawable/ic_archive_outline"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/locked_image_view_item_post_video_type_autoplay"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@drawable/ic_outline_lock_24dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/crosspost_image_view_item_post_video_type_autoplay"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@drawable/crosspost"
|
||||
android:visibility="gone" />
|
||||
|
||||
</com.nex3z.flowlayout.FlowLayout>
|
||||
|
||||
<com.google.android.exoplayer2.ui.AspectRatioFrameLayout
|
||||
android:id="@+id/aspect"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:background="#000000"
|
||||
app:resize_mode="fixed_width">
|
||||
|
||||
<com.google.android.exoplayer2.ui.PlayerView
|
||||
android:id="@+id/player_view_item_post_video_type_autoplay"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:controller_layout_id="@layout/exo_autoplay_playback_control_view"/>
|
||||
|
||||
</com.google.android.exoplayer2.ui.AspectRatioFrameLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/bottom_constraint_layout_item_post_video_type_autoplay"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/plus_button_item_post_video_type_autoplay"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp"
|
||||
android:src="@drawable/ic_arrow_upward_grey_24dp"
|
||||
android:background="?actionBarItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/score_text_view_item_post_video_type_autoplay"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textSize="?attr/font_12"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/plus_button_item_post_video_type_autoplay" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/minus_button_item_post_video_type_autoplay"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp"
|
||||
android:src="@drawable/ic_arrow_downward_grey_24dp"
|
||||
android:background="?actionBarItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_video_type_autoplay" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/comments_count_item_post_video_type_autoplay"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="?attr/font_12"
|
||||
android:textStyle="bold"
|
||||
android:drawableStart="@drawable/ic_comment_grey_24dp"
|
||||
android:drawablePadding="12dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/minus_button_item_post_video_type_autoplay" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/save_button_item_post_video_type_autoplay"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp"
|
||||
android:background="?actionBarItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
app:layout_constraintHorizontal_bias="1"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/comments_count_item_post_video_type_autoplay"
|
||||
app:layout_constraintEnd_toStartOf="@id/share_button_item_post_video_type_autoplay" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/share_button_item_post_video_type_autoplay"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp"
|
||||
android:src="@drawable/ic_share_grey_24dp"
|
||||
android:background="?actionBarItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
29
app/src/main/res/layout/item_report_reason.xml
Normal file
29
app/src/main/res/layout/item_report_reason.xml
Normal file
@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:background="?attr/selectableItemBackground">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/reason_text_view_item_report_reason"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="32dp"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="?attr/font_default" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/check_box_item_report_reason"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical" />
|
||||
|
||||
</LinearLayout>
|
10
app/src/main/res/menu/report_activity.xml
Normal file
10
app/src/main/res/menu/report_activity.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<item
|
||||
android:id="@+id/action_send_report_activity"
|
||||
android:orderInCategory="1"
|
||||
android:title="@string/action_send"
|
||||
android:icon="@drawable/ic_send_toolbar_24dp"
|
||||
app:showAsAction="ifRoom" />
|
||||
</menu>
|
@ -74,4 +74,11 @@
|
||||
android:title="@string/action_edit_flair"
|
||||
app:showAsAction="never"
|
||||
android:visible="false" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_report_view_post_detail_activity"
|
||||
android:orderInCategory="12"
|
||||
android:title="@string/action_report"
|
||||
app:showAsAction="never"
|
||||
android:visible="false" />
|
||||
</menu>
|
@ -39,4 +39,10 @@
|
||||
android:orderInCategory="6"
|
||||
android:title="@string/action_view_side_bar"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_share_view_subreddit_detail_activity"
|
||||
android:orderInCategory="7"
|
||||
android:title="@string/action_share"
|
||||
app:showAsAction="never" />
|
||||
</menu>
|
@ -31,4 +31,10 @@
|
||||
android:orderInCategory="5"
|
||||
android:title="@string/action_change_post_layout"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_share_view_user_detail_activity"
|
||||
android:orderInCategory="6"
|
||||
android:title="@string/action_share"
|
||||
app:showAsAction="never" />
|
||||
</menu>
|
||||
|
@ -47,6 +47,18 @@
|
||||
<item>1</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="settings_video_autoplay">
|
||||
<item>Always On</item>
|
||||
<item>Only on Wifi</item>
|
||||
<item>Never</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="settings_video_autoplay_values">
|
||||
<item>2</item>
|
||||
<item>1</item>
|
||||
<item>0</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="settings_lazy_mode_interval">
|
||||
<item>1s</item>
|
||||
<item>2s</item>
|
||||
|
@ -25,6 +25,7 @@
|
||||
<string name="theme_preview_activity_label">Theme Preview</string>
|
||||
<string name="edit_multi_reddit_activity_label">Edit Multireddit</string>
|
||||
<string name="selected_subeddits_activity_label">Selected Subreddits</string>
|
||||
<string name="report_activity_label">Report</string>
|
||||
|
||||
<string name="navigation_drawer_open">Open navigation drawer</string>
|
||||
<string name="navigation_drawer_close">Close navigation drawer</string>
|
||||
@ -57,6 +58,7 @@
|
||||
<string name="action_delete_multi_reddit">Delete Multireddit</string>
|
||||
<string name="action_share">Share</string>
|
||||
<string name="action_preview">Preview</string>
|
||||
<string name="action_report">Report</string>
|
||||
|
||||
<string name="parse_json_response_error">Error occurred when parsing the JSON response</string>
|
||||
<string name="retrieve_token_error">Error Retrieving the token</string>
|
||||
@ -90,6 +92,9 @@
|
||||
|
||||
<string name="nsfw">NSFW</string>
|
||||
<string name="karma_info">Karma: %1$d</string>
|
||||
<string name="karma_info_user_detail">Karma:\n%1$d (%2$d + %3$d)</string>
|
||||
<string name="cakeday_info">Cakeday:\n%1$s</string>
|
||||
<string name="since">Since:</string>
|
||||
|
||||
<string name="profile">Profile</string>
|
||||
<string name="following">Following</string>
|
||||
@ -193,6 +198,7 @@
|
||||
|
||||
<string name="no_rule">No rule</string>
|
||||
<string name="error_loading_rules">Error loading rules.\nTap to retry.</string>
|
||||
<string name="error_loading_rules_without_retry">Error Loading Rules</string>
|
||||
|
||||
<string name="search_in">Search in</string>
|
||||
<string name="all_subreddits">All subreddits</string>
|
||||
@ -311,6 +317,7 @@
|
||||
<string name="settings_interface_title">Interface</string>
|
||||
<string name="settings_gestures_and_buttons_title">Gestures & Buttons</string>
|
||||
<string name="settings_open_link_in_app_title">Open Link In App</string>
|
||||
<string name="settings_video_autoplay_title">Video Autoplay</string>
|
||||
<string name="settings_immersive_interface_title">Immersive Interface</string>
|
||||
<string name="settings_immersive_interface_ignore_nav_bar_title">Ignore Navigation Bar in Immersive Interface</string>
|
||||
<string name="settings_immersive_interface_ignore_nav_bar_summary">Prevent the Bottom Navigation Bar Having Extra Padding</string>
|
||||
@ -524,7 +531,9 @@
|
||||
<string name="theme_item_bottom_app_bar_background_color">Bottom Navigation Bar Color</string>
|
||||
<string name="theme_item_bottom_app_bar_background_color_detail">Applied to: Bottom navigation bar</string>
|
||||
<string name="theme_item_primary_icon_color">Primary Icon Color</string>
|
||||
<string name="theme_item_primary_icon_color_detail">Applied to: Icons in the bottom navigation bar and the navigation drawer.</string>
|
||||
<string name="theme_item_primary_icon_color_detail">Applied to: Icons in the navigation drawer.</string>
|
||||
<string name="theme_item_bottom_app_bar_icon_color">Bottom Navigation Bar Icon Color</string>
|
||||
<string name="theme_item_bottom_app_bar_icon_color_detail">Applied to: Icons in the bottom navigation bar</string>
|
||||
<string name="theme_item_post_icon_and_info_color">Post Icon and Info Color</string>
|
||||
<string name="theme_item_post_icon_and_info_color_detail">Applied to: Icons, score and the number of comments in posts</string>
|
||||
<string name="theme_item_comment_icon_and_info_color">Comment Icon and Info Color</string>
|
||||
@ -696,4 +705,15 @@
|
||||
<string name="n_awards">%1$d Awards</string>
|
||||
<string name="one_award">1 Award</string>
|
||||
|
||||
<string name="report">Report</string>
|
||||
<string name="reporting">Reporting</string>
|
||||
<string name="report_successful">Reported</string>
|
||||
<string name="report_failed">Report failed</string>
|
||||
<string name="report_reason_not_selected">You haven\'t selected a reason</string>
|
||||
|
||||
<string name="report_reason_general_spam">It Is Spam</string>
|
||||
<string name="report_reason_general_copyright_issue">It Contains Copyright Issue</string>
|
||||
<string name="report_reason_general_child_pornography">It Contains Child Pornography</string>
|
||||
<string name="report_reason_general_abusive_content">It Contains Abusive Content</string>
|
||||
|
||||
</resources>
|
||||
|
@ -28,6 +28,14 @@
|
||||
app:key="open_link_in_app"
|
||||
app:title="@string/settings_open_link_in_app_title" />
|
||||
|
||||
<ListPreference
|
||||
app:defaultValue="0"
|
||||
android:entries="@array/settings_video_autoplay"
|
||||
app:entryValues="@array/settings_video_autoplay_values"
|
||||
app:key="video_autoplay"
|
||||
app:title="@string/settings_video_autoplay_title"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
|
||||
<SwitchPreference
|
||||
app:defaultValue="false"
|
||||
app:key="mute_video"
|
||||
|
Loading…
Reference in New Issue
Block a user