aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2020-07-29 06:24:27 +0000
committerAlex Ning <chineseperson5@gmail.com>2020-07-29 06:24:27 +0000
commit2c03eb8d15e40a8fc949a07a3a46e5f829674d61 (patch)
tree7e75660c3655a6cc73a4991430713b6afaeaf635
parentcdf7eaba266dcbd80df8264e3400adebb402d7c8 (diff)
downloadinfinity-for-reddit-2c03eb8d15e40a8fc949a07a3a46e5f829674d61.tar
infinity-for-reddit-2c03eb8d15e40a8fc949a07a3a46e5f829674d61.tar.gz
infinity-for-reddit-2c03eb8d15e40a8fc949a07a3a46e5f829674d61.tar.bz2
infinity-for-reddit-2c03eb8d15e40a8fc949a07a3a46e5f829674d61.tar.lz
infinity-for-reddit-2c03eb8d15e40a8fc949a07a3a46e5f829674d61.tar.xz
infinity-for-reddit-2c03eb8d15e40a8fc949a07a3a46e5f829674d61.tar.zst
infinity-for-reddit-2c03eb8d15e40a8fc949a07a3a46e5f829674d61.zip
Version 4.0.1. Block users. Show report menu item even in anonymous mode. Remove Crashy.
-rw-r--r--app/build.gradle8
-rw-r--r--app/src/main/AndroidManifest.xml9
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/API/RedditAPI.java5
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImageOrGifActivity.java1
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java6
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java48
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeWrapper.java24
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/ViewRedditGalleryImageOrGifFragment.java1
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CrashReportsFragment.java54
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CrashReportsRecyclerViewAdapter.java46
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/User/BlockUser.java40
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Utils/APIUtils.java6
-rw-r--r--app/src/main/res/layout/fragment_view_imgur_images.xml3
-rw-r--r--app/src/main/res/menu/view_post_detail_activity.xml3
-rw-r--r--app/src/main/res/menu/view_user_detail_activity.xml20
-rw-r--r--app/src/main/res/values/strings.xml7
-rw-r--r--app/src/main/res/xml/about_preferences.xml5
17 files changed, 133 insertions, 153 deletions
diff --git a/app/build.gradle b/app/build.gradle
index f33760bd..9bed2fff 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -6,8 +6,8 @@ android {
applicationId "ml.docilealligator.infinityforreddit"
minSdkVersion 21
targetSdkVersion 29
- versionCode 36
- versionName "4.0.0"
+ versionCode 37
+ versionName "4.0.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
@@ -94,10 +94,6 @@ dependencies {
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'me.zhanghai.android.fastscroll:library:1.1.2'
implementation "com.thefuntasty.hauler:core:3.1.0"
- // androidX startup for auto-init
- implementation "androidx.startup:startup-runtime:1.0.0-alpha01"
- //crashy
- implementation 'com.github.CraZyLegenD:Crashy:1.0.5'
implementation 'com.github.Piasy:BigImageViewer:1.6.5'
def toroVersion = '3.7.0.2010003'
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 64082b4a..809a15c4 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -327,15 +327,6 @@
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
- <provider
- android:name="androidx.startup.InitializationProvider"
- android:authorities="${applicationId}.androidx-startup"
- android:exported="false"
- tools:node="merge">
- <meta-data
- android:name="com.crazylegend.crashyreporter.initializer.CrashyInitializer"
- android:value="androidx.startup" />
- </provider>
<service
android:name=".Service.SubmitPostService"
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/API/RedditAPI.java b/app/src/main/java/ml/docilealligator/infinityforreddit/API/RedditAPI.java
index fbfdd32a..1da58727 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/API/RedditAPI.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/API/RedditAPI.java
@@ -312,4 +312,9 @@ public interface RedditAPI {
@FormUrlEncoded
@POST("/api/compose")
Call<String> composePrivateMessage(@HeaderMap Map<String, String> headers, @FieldMap Map<String, String> params);
+
+
+ @FormUrlEncoded
+ @POST("api/block_user")
+ Call<String> blockUser(@HeaderMap Map<String, String> headers, @FieldMap Map<String, String> params);
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImageOrGifActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImageOrGifActivity.java
index 5cea5c59..9152c1be 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImageOrGifActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImageOrGifActivity.java
@@ -213,6 +213,7 @@ public class ViewImageOrGifActivity extends AppCompatActivity implements SetAsWa
if (view != null) {
view.setMinimumDpi(80);
+ view.setQuickScaleEnabled(true);
view.setOnImageEventListener(new SubsamplingScaleImageView.OnImageEventListener() {
@Override
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java
index 0fbc96b2..362eae60 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java
@@ -542,8 +542,6 @@ 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);
@@ -1440,6 +1438,10 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
flairBottomSheetFragment.show(getSupportFragmentManager(), flairBottomSheetFragment.getTag());
return true;
case R.id.action_report_view_post_detail_activity:
+ if (mAccessToken == null) {
+ Toast.makeText(this, R.string.login_first, Toast.LENGTH_SHORT).show();
+ return true;
+ }
Intent intent = new Intent(this, ReportActivity.class);
intent.putExtra(ReportActivity.EXTRA_SUBREDDIT_NAME, mPost.getSubredditName());
intent.putExtra(ReportActivity.EXTRA_THING_FULLNAME, mPost.getFullName());
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java
index 426f6504..1ceed6e1 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java
@@ -4,6 +4,7 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.ColorStateList;
import android.content.res.Resources;
+import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
@@ -56,29 +57,30 @@ import ml.docilealligator.infinityforreddit.AppBarStateChangeListener;
import ml.docilealligator.infinityforreddit.AsyncTask.CheckIsFollowingUserAsyncTask;
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
import ml.docilealligator.infinityforreddit.AsyncTask.SwitchAccountAsyncTask;
+import ml.docilealligator.infinityforreddit.BottomSheetFragment.PostLayoutBottomSheetFragment;
+import ml.docilealligator.infinityforreddit.BottomSheetFragment.SortTimeBottomSheetFragment;
+import ml.docilealligator.infinityforreddit.BottomSheetFragment.UserThingSortTypeBottomSheetFragment;
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
import ml.docilealligator.infinityforreddit.DeleteThing;
import ml.docilealligator.infinityforreddit.Event.ChangeNSFWEvent;
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
-import ml.docilealligator.infinityforreddit.User.FetchUserData;
import ml.docilealligator.infinityforreddit.Fragment.CommentsListingFragment;
import ml.docilealligator.infinityforreddit.Fragment.PostFragment;
-import ml.docilealligator.infinityforreddit.BottomSheetFragment.PostLayoutBottomSheetFragment;
-import ml.docilealligator.infinityforreddit.BottomSheetFragment.SortTimeBottomSheetFragment;
-import ml.docilealligator.infinityforreddit.BottomSheetFragment.UserThingSortTypeBottomSheetFragment;
import ml.docilealligator.infinityforreddit.FragmentCommunicator;
import ml.docilealligator.infinityforreddit.Infinity;
+import ml.docilealligator.infinityforreddit.Message.ReadMessage;
import ml.docilealligator.infinityforreddit.Post.PostDataSource;
import ml.docilealligator.infinityforreddit.R;
-import ml.docilealligator.infinityforreddit.Message.ReadMessage;
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
import ml.docilealligator.infinityforreddit.SortType;
import ml.docilealligator.infinityforreddit.SortTypeSelectionCallback;
import ml.docilealligator.infinityforreddit.SubscribedUserDatabase.SubscribedUserDao;
+import ml.docilealligator.infinityforreddit.User.BlockUser;
+import ml.docilealligator.infinityforreddit.User.FetchUserData;
import ml.docilealligator.infinityforreddit.User.UserDao;
import ml.docilealligator.infinityforreddit.User.UserData;
-import ml.docilealligator.infinityforreddit.User.UserViewModel;
import ml.docilealligator.infinityforreddit.User.UserFollowing;
+import ml.docilealligator.infinityforreddit.User.UserViewModel;
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
import ml.docilealligator.infinityforreddit.Utils.Utils;
import pl.droidsonroids.gif.GifImageView;
@@ -653,10 +655,44 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
}
return true;
case R.id.action_send_private_message_view_user_detail_activity:
+ if (mAccessToken == null) {
+ Toast.makeText(this, R.string.login_first, Toast.LENGTH_SHORT).show();
+ return true;
+ }
+
Intent pmIntent = new Intent(this, SendPrivateMessageActivity.class);
pmIntent.putExtra(SendPrivateMessageActivity.EXTRA_RECIPIENT_USERNAME, username);
startActivity(pmIntent);
return true;
+ case R.id.action_report_view_user_detail_activity:
+ Intent reportIntent = new Intent(this, LinkResolverActivity.class);
+ reportIntent.setData(Uri.parse("https://www.reddithelp.com/en/categories/rules-reporting/account-and-community-restrictions/what-should-i-do-if-i-see-something-i"));
+ startActivity(reportIntent);
+ return true;
+ case R.id.action_block_user_view_user_detail_activity:
+ if (mAccessToken == null) {
+ Toast.makeText(this, R.string.login_first, Toast.LENGTH_SHORT).show();
+ return true;
+ }
+
+ new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
+ .setTitle(R.string.block_user)
+ .setMessage(R.string.are_you_sure)
+ .setPositiveButton(R.string.yes, (dialogInterface, i)
+ -> BlockUser.blockUser(mOauthRetrofit, mAccessToken, username, new BlockUser.BlockUserListener() {
+ @Override
+ public void success() {
+ Toast.makeText(ViewUserDetailActivity.this, R.string.block_user_success, Toast.LENGTH_SHORT).show();
+ }
+
+ @Override
+ public void failed() {
+ Toast.makeText(ViewUserDetailActivity.this, R.string.block_user_failed, Toast.LENGTH_SHORT).show();
+ }
+ }))
+ .setNegativeButton(R.string.no, null)
+ .show();
+ return true;
}
return false;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeWrapper.java b/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeWrapper.java
index 3a30ba62..7dd17c41 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeWrapper.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeWrapper.java
@@ -409,7 +409,7 @@ public class CustomThemeWrapper {
public int getAwardedCommentBackgroundColor() {
return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.AWARDED_COMMENT_BACKGROUND_COLOR,
- getDefaultColor("#FFF162", "#FF6400", "#FF6400"));
+ getDefaultColor("#FFFFFF", "#242424", "#000000"));
}
public int getNavBarColor() {
@@ -550,7 +550,7 @@ public class CustomThemeWrapper {
customTheme.sentMessageBackgroundColor = Color.parseColor("#31BF7D");
customTheme.sendMessageIconColor = Color.parseColor("#4185F4");
customTheme.fullyCollapsedCommentBackgroundColor = Color.parseColor("#8EDFBA");
- customTheme.awardedCommentBackgroundColor = Color.parseColor("#FFF162");
+ customTheme.awardedCommentBackgroundColor = Color.parseColor("#FFFFFF");
customTheme.navBarColor = Color.parseColor("#FFFFFF");
customTheme.isLightStatusBar = false;
customTheme.isLightNavBar = true;
@@ -635,7 +635,7 @@ public class CustomThemeWrapper {
customTheme.sentMessageBackgroundColor = Color.parseColor("#31BF7D");
customTheme.sendMessageIconColor = Color.parseColor("#4185F4");
customTheme.fullyCollapsedCommentBackgroundColor = Color.parseColor("#21C561");
- customTheme.awardedCommentBackgroundColor = Color.parseColor("#FF6400");
+ customTheme.awardedCommentBackgroundColor = Color.parseColor("#242424");
customTheme.navBarColor = Color.parseColor("#121212");
customTheme.isLightStatusBar = false;
customTheme.isLightNavBar = false;
@@ -720,7 +720,7 @@ public class CustomThemeWrapper {
customTheme.sentMessageBackgroundColor = Color.parseColor("#31BF7D");
customTheme.sendMessageIconColor = Color.parseColor("#4185F4");
customTheme.fullyCollapsedCommentBackgroundColor = Color.parseColor("#21C561");
- customTheme.awardedCommentBackgroundColor = Color.parseColor("#FF6400");
+ customTheme.awardedCommentBackgroundColor = Color.parseColor("#000000");
customTheme.navBarColor = Color.parseColor("#000000");
customTheme.isLightStatusBar = false;
customTheme.isLightNavBar = false;
@@ -805,7 +805,7 @@ public class CustomThemeWrapper {
customTheme.sentMessageBackgroundColor = Color.parseColor("#31BF7D");
customTheme.sendMessageIconColor = Color.parseColor("#4185F4");
customTheme.fullyCollapsedCommentBackgroundColor = Color.parseColor("#8EDFBA");
- customTheme.awardedCommentBackgroundColor = Color.parseColor("#FFF162");
+ customTheme.awardedCommentBackgroundColor = Color.parseColor("#FFFFFF");
customTheme.navBarColor = Color.parseColor("#FFFFFF");
customTheme.isLightStatusBar = true;
customTheme.isLightNavBar = true;
@@ -890,7 +890,7 @@ public class CustomThemeWrapper {
customTheme.sentMessageBackgroundColor = Color.parseColor("#31BF7D");
customTheme.sendMessageIconColor = Color.parseColor("#4185F4");
customTheme.fullyCollapsedCommentBackgroundColor = Color.parseColor("#21C561");
- customTheme.awardedCommentBackgroundColor = Color.parseColor("#FF6400");
+ customTheme.awardedCommentBackgroundColor = Color.parseColor("#242424");
customTheme.navBarColor = Color.parseColor("#121212");
customTheme.isLightStatusBar = false;
customTheme.isLightNavBar = false;
@@ -975,7 +975,7 @@ public class CustomThemeWrapper {
customTheme.sentMessageBackgroundColor = Color.parseColor("#31BF7D");
customTheme.sendMessageIconColor = Color.parseColor("#4185F4");
customTheme.fullyCollapsedCommentBackgroundColor = Color.parseColor("#21C561");
- customTheme.awardedCommentBackgroundColor = Color.parseColor("#FF6400");
+ customTheme.awardedCommentBackgroundColor = Color.parseColor("#000000");
customTheme.navBarColor = Color.parseColor("#000000");
customTheme.isLightStatusBar = false;
customTheme.isLightNavBar = false;
@@ -1060,7 +1060,7 @@ public class CustomThemeWrapper {
customTheme.sentMessageBackgroundColor = Color.parseColor("#31BF7D");
customTheme.sendMessageIconColor = Color.parseColor("#4185F4");
customTheme.fullyCollapsedCommentBackgroundColor = Color.parseColor("#8EDFBA");
- customTheme.awardedCommentBackgroundColor = Color.parseColor("#FFF162");
+ customTheme.awardedCommentBackgroundColor = Color.parseColor("#FFFFFF");
customTheme.navBarColor = Color.parseColor("#FFFFFF");
customTheme.isLightStatusBar = false;
customTheme.isLightNavBar = true;
@@ -1145,7 +1145,7 @@ public class CustomThemeWrapper {
customTheme.sentMessageBackgroundColor = Color.parseColor("#31BF7D");
customTheme.sendMessageIconColor = Color.parseColor("#4185F4");
customTheme.fullyCollapsedCommentBackgroundColor = Color.parseColor("#21C561");
- customTheme.awardedCommentBackgroundColor = Color.parseColor("#FF6400");
+ customTheme.awardedCommentBackgroundColor = Color.parseColor("#242424");
customTheme.navBarColor = Color.parseColor("#121212");
customTheme.isLightStatusBar = false;
customTheme.isLightNavBar = false;
@@ -1230,7 +1230,7 @@ public class CustomThemeWrapper {
customTheme.sentMessageBackgroundColor = Color.parseColor("#31BF7D");
customTheme.sendMessageIconColor = Color.parseColor("#4185F4");
customTheme.fullyCollapsedCommentBackgroundColor = Color.parseColor("#21C561");
- customTheme.awardedCommentBackgroundColor = Color.parseColor("#FF6400");
+ customTheme.awardedCommentBackgroundColor = Color.parseColor("#000000");
customTheme.navBarColor = Color.parseColor("#000000");
customTheme.isLightStatusBar = false;
customTheme.isLightNavBar = false;
@@ -1315,7 +1315,7 @@ public class CustomThemeWrapper {
customTheme.sentMessageBackgroundColor = Color.parseColor("#31BF7D");
customTheme.sendMessageIconColor = Color.parseColor("#4185F4");
customTheme.fullyCollapsedCommentBackgroundColor = Color.parseColor("#21C561");
- customTheme.awardedCommentBackgroundColor = Color.parseColor("#FF6400");
+ customTheme.awardedCommentBackgroundColor = Color.parseColor("#393A59");
customTheme.navBarColor = Color.parseColor("#393A59");
customTheme.isLightStatusBar = false;
customTheme.isLightNavBar = false;
@@ -1400,7 +1400,7 @@ public class CustomThemeWrapper {
customTheme.sentMessageBackgroundColor = Color.parseColor("#31BF7D");
customTheme.sendMessageIconColor = Color.parseColor("#4185F4");
customTheme.fullyCollapsedCommentBackgroundColor = Color.parseColor("#8EDFBA");
- customTheme.awardedCommentBackgroundColor = Color.parseColor("#FFF162");
+ customTheme.awardedCommentBackgroundColor = Color.parseColor("#C0F0F4");
customTheme.navBarColor = Color.parseColor("#D48AE0");
customTheme.isLightStatusBar = true;
customTheme.isLightNavBar = true;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/ViewRedditGalleryImageOrGifFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/ViewRedditGalleryImageOrGifFragment.java
index 0b466749..015e57c7 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/ViewRedditGalleryImageOrGifFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/ViewRedditGalleryImageOrGifFragment.java
@@ -131,6 +131,7 @@ public class ViewRedditGalleryImageOrGifFragment extends Fragment {
if (view != null) {
view.setMinimumDpi(80);
+ view.setQuickScaleEnabled(true);
view.setOnImageEventListener(new SubsamplingScaleImageView.OnImageEventListener() {
@Override
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CrashReportsFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CrashReportsFragment.java
deleted file mode 100644
index 04bdc0e9..00000000
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CrashReportsFragment.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package ml.docilealligator.infinityforreddit.Settings;
-
-import android.app.Activity;
-import android.content.Context;
-import android.os.Bundle;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
-import androidx.annotation.NonNull;
-import androidx.fragment.app.Fragment;
-import androidx.recyclerview.widget.LinearLayoutManager;
-import androidx.recyclerview.widget.RecyclerView;
-
-import com.crazylegend.crashyreporter.CrashyReporter;
-
-import butterknife.BindView;
-import butterknife.ButterKnife;
-import ml.docilealligator.infinityforreddit.R;
-
-public class CrashReportsFragment extends Fragment {
-
- @BindView(R.id.recycler_view_crash_reports_fragment)
- RecyclerView recyclerView;
- private Activity activity;
- private CrashReportsRecyclerViewAdapter adapter;
- private LinearLayoutManager linearLayoutManager;
-
- public CrashReportsFragment() {
- // Required empty public constructor
- }
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- // Inflate the layout for this fragment
- View rootView = inflater.inflate(R.layout.fragment_crash_reports, container, false);
-
- ButterKnife.bind(this, rootView);
-
- adapter = new CrashReportsRecyclerViewAdapter(CrashyReporter.INSTANCE.getLogsAsStrings());
- linearLayoutManager = new LinearLayoutManager(activity);
- recyclerView.setLayoutManager(linearLayoutManager);
- recyclerView.setAdapter(adapter);
-
- return rootView;
- }
-
- @Override
- public void onAttach(@NonNull Context context) {
- super.onAttach(context);
- this.activity = (Activity) context;
- }
-} \ No newline at end of file
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CrashReportsRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CrashReportsRecyclerViewAdapter.java
deleted file mode 100644
index 82c43795..00000000
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CrashReportsRecyclerViewAdapter.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package ml.docilealligator.infinityforreddit.Settings;
-
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.TextView;
-
-import androidx.annotation.NonNull;
-import androidx.recyclerview.widget.RecyclerView;
-
-import java.util.List;
-
-import ml.docilealligator.infinityforreddit.R;
-
-class CrashReportsRecyclerViewAdapter extends RecyclerView.Adapter<CrashReportsRecyclerViewAdapter.CrashReportViewHolder> {
- private List<String> crashReports;
-
- public CrashReportsRecyclerViewAdapter(List<String> crashReports) {
- this.crashReports = crashReports;
- }
-
- @NonNull
- @Override
- public CrashReportViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
- return new CrashReportViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_crash_report, parent, false));
- }
-
- @Override
- public void onBindViewHolder(@NonNull CrashReportViewHolder holder, int position) {
- holder.crashReportTextView.setText(crashReports.get(holder.getAdapterPosition()));
- }
-
- @Override
- public int getItemCount() {
- return crashReports == null ? 0 : crashReports.size();
- }
-
- class CrashReportViewHolder extends RecyclerView.ViewHolder {
- TextView crashReportTextView;
-
- public CrashReportViewHolder(@NonNull View itemView) {
- super(itemView);
- crashReportTextView = (TextView) itemView;
- }
- }
-} \ No newline at end of file
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/User/BlockUser.java b/app/src/main/java/ml/docilealligator/infinityforreddit/User/BlockUser.java
new file mode 100644
index 00000000..ca6dd1d1
--- /dev/null
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/User/BlockUser.java
@@ -0,0 +1,40 @@
+package ml.docilealligator.infinityforreddit.User;
+
+import androidx.annotation.NonNull;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import ml.docilealligator.infinityforreddit.API.RedditAPI;
+import ml.docilealligator.infinityforreddit.Utils.APIUtils;
+import retrofit2.Call;
+import retrofit2.Callback;
+import retrofit2.Response;
+import retrofit2.Retrofit;
+
+public class BlockUser {
+ public interface BlockUserListener {
+ void success();
+ void failed();
+ }
+
+ public static void blockUser(Retrofit oauthRetrofit, String accessToken, String username, BlockUserListener blockUserListener) {
+ Map<String, String> params = new HashMap<>();
+ params.put(APIUtils.NAME_KEY, username);
+ oauthRetrofit.create(RedditAPI.class).blockUser(APIUtils.getOAuthHeader(accessToken), params).enqueue(new Callback<String>() {
+ @Override
+ public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) {
+ if (response.isSuccessful()) {
+ blockUserListener.success();
+ } else {
+ blockUserListener.failed();
+ }
+ }
+
+ @Override
+ public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
+ blockUserListener.failed();
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/APIUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/APIUtils.java
index 1b00e57a..f824eafa 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/APIUtils.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/APIUtils.java
@@ -35,13 +35,13 @@ public class APIUtils {
public static final String DURATION_KEY = "duration";
public static final String DURATION = "permanent";
public static final String SCOPE_KEY = "scope";
- public static final String SCOPE = "identity edit flair history modconfig modflair modlog modposts modwiki mysubreddits privatemessages read report save submit subscribe vote wikiedit wikiread";
+ public static final String SCOPE = "identity edit flair history modconfig modflair modlog modposts modwiki mysubreddits privatemessages read report save submit subscribe vote wikiedit wikiread creddits modcontributors modmail modothers livemanage account modself";
public static final String ACCESS_TOKEN_KEY = "access_token";
public static final String AUTHORIZATION_KEY = "Authorization";
public static final String AUTHORIZATION_BASE = "bearer ";
public static final String USER_AGENT_KEY = "User-Agent";
- public static final String USER_AGENT = "android:ml.docilealligator.infinityforreddit:v3.2.0 (by /u/Hostilenemy)";
+ public static final String USER_AGENT = "android:ml.docilealligator.infinityforreddit:v4.0.1 (by /u/Hostilenemy)";
public static final String GRANT_TYPE_KEY = "grant_type";
public static final String GRANT_TYPE_REFRESH_TOKEN = "refresh_token";
@@ -95,6 +95,8 @@ public class APIUtils {
public static final String SUBJECT_KEY = "subject";
public static final String TO_KEY = "to";
+ public static final String NAME_KEY = "name";
+
public static Map<String, String> getHttpBasicAuthHeader() {
Map<String, String> params = new HashMap<>();
String credentials = String.format("%s:%s", APIUtils.CLIENT_ID, "");
diff --git a/app/src/main/res/layout/fragment_view_imgur_images.xml b/app/src/main/res/layout/fragment_view_imgur_images.xml
index 20110897..36286c05 100644
--- a/app/src/main/res/layout/fragment_view_imgur_images.xml
+++ b/app/src/main/res/layout/fragment_view_imgur_images.xml
@@ -16,8 +16,7 @@
<com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
android:id="@+id/image_view_view_imgur_image_fragment"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- app:quickScaleEnabled="false" />
+ android:layout_height="match_parent" />
<LinearLayout
android:id="@+id/load_image_error_linear_layout_view_imgur_image_fragment"
diff --git a/app/src/main/res/menu/view_post_detail_activity.xml b/app/src/main/res/menu/view_post_detail_activity.xml
index 29c49e1f..52afcc23 100644
--- a/app/src/main/res/menu/view_post_detail_activity.xml
+++ b/app/src/main/res/menu/view_post_detail_activity.xml
@@ -79,8 +79,7 @@
android:id="@+id/action_report_view_post_detail_activity"
android:orderInCategory="12"
android:title="@string/action_report"
- app:showAsAction="never"
- android:visible="false"/>
+ app:showAsAction="never" />
<item
android:id="@+id/action_see_removed_view_post_detail_activity"
diff --git a/app/src/main/res/menu/view_user_detail_activity.xml b/app/src/main/res/menu/view_user_detail_activity.xml
index 50170f31..a06c2677 100644
--- a/app/src/main/res/menu/view_user_detail_activity.xml
+++ b/app/src/main/res/menu/view_user_detail_activity.xml
@@ -33,14 +33,24 @@
app:showAsAction="never" />
<item
- android:id="@+id/action_share_view_user_detail_activity"
+ android:id="@+id/action_send_private_message_view_user_detail_activity"
android:orderInCategory="6"
- android:title="@string/action_share"
+ android:title="@string/action_send_private_message"
app:showAsAction="never" />
<item
- android:id="@+id/action_send_private_message_view_user_detail_activity"
- android:orderInCategory="6"
- android:title="@string/action_send_private_message"
+ android:id="@+id/action_share_view_user_detail_activity"
+ android:orderInCategory="7"
+ android:title="@string/action_share"
app:showAsAction="never" />
+
+ <item
+ android:id="@+id/action_report_view_user_detail_activity"
+ android:orderInCategory="8"
+ android:title="@string/action_report" />
+
+ <item
+ android:id="@+id/action_block_user_view_user_detail_activity"
+ android:orderInCategory="9"
+ android:title="@string/action_block_user" />
</menu>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 447922e7..05c1c9de 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -68,6 +68,7 @@
<string name="action_see_removed">See Removed</string>
<string name="action_set_wallpaper">Set as Wallpaper</string>
<string name="action_send_private_message">Send Private Message</string>
+ <string name="action_block_user">Block User</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>
@@ -441,8 +442,6 @@
<string name="settings_subreddit_summary">r/Infinity_For_Reddit</string>
<string name="settings_share_title">Share</string>
<string name="settings_share_summary">Share this app to other people if you enjoy it</string>
- <string name="settings_crash_reports_title">Crash Reports</string>
- <string name="settings_crash_reports_summary">See the error logs and send them to me when you report bugs</string>
<string name="settings_version_title">Infinity For Reddit</string>
<string name="settings_version_summary">Version %s</string>
<string name="settings_category_customization_title">Customization</string>
@@ -850,4 +849,8 @@
<string name="login_activity_2fa_prompt">If you have 2-factor authentication enabled, kindly type your password like the following: &lt;password&gt;:&lt;2FA code&gt;.\nExample: yourpass:123456</string>
+ <string name="block_user">Block User</string>
+ <string name="block_user_success">Blocked</string>
+ <string name="block_user_failed">Failed to block user</string>
+
</resources>
diff --git a/app/src/main/res/xml/about_preferences.xml b/app/src/main/res/xml/about_preferences.xml
index 6561eec3..a73f9aaa 100644
--- a/app/src/main/res/xml/about_preferences.xml
+++ b/app/src/main/res/xml/about_preferences.xml
@@ -46,11 +46,6 @@
app:summary="@string/settings_share_summary" />
<Preference
- app:title="@string/settings_crash_reports_title"
- app:summary="@string/settings_crash_reports_summary"
- app:fragment="ml.docilealligator.infinityforreddit.Settings.CrashReportsFragment" />
-
- <Preference
android:key="version"
app:title="@string/settings_version_title"
app:summary="@string/settings_version_summary" />