diff options
Diffstat (limited to 'app')
16 files changed, 566 insertions, 5 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index b665b78b..08f83a69 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -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" diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ReportActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ReportActivity.java new file mode 100644 index 00000000..526be6ef --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ReportActivity.java @@ -0,0 +1,172 @@ +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 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.Infinity; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.ReportReason; +import ml.docilealligator.infinityforreddit.ReportThing; +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"; + + @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("default") + SharedPreferences mSharedPreferences; + @Inject + RedditDataRoomDatabase mRedditDataRoomDatabase; + @Inject + CustomThemeWrapper mCustomThemeWrapper; + private boolean mNullAccessToken = false; + private String mAccessToken; + private String mFullname; + private String mSubredditName; + 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); + mAdapter = new ReportReasonRecyclerViewAdapter(mCustomThemeWrapper, ReportReason.getGeneralReasons(this)); + recyclerView.setLayoutManager(new LinearLayoutManager(this)); + recyclerView.setAdapter(mAdapter); + + if (savedInstanceState != null) { + mNullAccessToken = savedInstanceState.getBoolean(NULL_ACCESS_TOKEN_STATE); + mAccessToken = savedInstanceState.getString(ACCESS_TOKEN_STATE); + + if (!mNullAccessToken && mAccessToken == null) { + getCurrentAccount(); + } + } else { + getCurrentAccount(); + } + } + + 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) { + 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); + } + + @Override + protected SharedPreferences getSharedPreferences() { + return mSharedPreferences; + } + + @Override + protected CustomThemeWrapper getCustomThemeWrapper() { + return mCustomThemeWrapper; + } + + @Override + protected void applyCustomTheme() { + coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); + applyAppBarLayoutAndToolbarTheme(appBarLayout, toolbar); + } +} 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 9d8ea8a9..f3e4d0aa 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java @@ -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; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java index c474a710..3623fb54 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java @@ -13,7 +13,6 @@ import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.FrameLayout; -import android.widget.ImageButton; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.RelativeLayout; @@ -1849,6 +1848,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView PlayerView videoPlayer; @BindView(R.id.mute_exo_playback_control_view) ImageView muteButton; + @BindView(R.id.fullscreen_exo_playback_control_view) + ImageView fullscreenButton; @BindView(R.id.bottom_constraint_layout_item_post_video_type_autoplay) ConstraintLayout bottomConstraintLayout; @BindView(R.id.plus_button_item_post_video_type_autoplay) @@ -1910,6 +1911,19 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView } } }); + + fullscreenButton.setOnClickListener(view -> { + Post post = getItem(getAdapterPosition()); + if (post != null) { + Intent intent = new Intent(mActivity, ViewVideoActivity.class); + intent.setData(Uri.parse(post.getVideoUrl())); + intent.putExtra(ViewVideoActivity.EXTRA_VIDEO_DOWNLOAD_URL, post.getVideoDownloadUrl()); + intent.putExtra(ViewVideoActivity.EXTRA_SUBREDDIT, post.getSubredditName()); + intent.putExtra(ViewVideoActivity.EXTRA_ID, post.getId()); + intent.putExtra(ViewVideoActivity.EXTRA_POST_TITLE, post.getTitle()); + mActivity.startActivity(intent); + } + }); } void bindVideoUri(Uri videoUri) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/ReportReasonRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/ReportReasonRecyclerViewAdapter.java new file mode 100644 index 00000000..98db7e3c --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/ReportReasonRecyclerViewAdapter.java @@ -0,0 +1,121 @@ +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; + rules = new ArrayList<>(); + 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.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; + } + + 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); + + } + } + + 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()); + } + } +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java b/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java index d8dcc56e..351ab8f8 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java @@ -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); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/RedditAPI.java b/app/src/main/java/ml/docilealligator/infinityforreddit/RedditAPI.java index 371e31e9..113e1604 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/RedditAPI.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/RedditAPI.java @@ -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); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ReportReason.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ReportReason.java new file mode 100644 index 00000000..a132a17f --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ReportReason.java @@ -0,0 +1,77 @@ +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_RULE_REASON = "rule_reason"; + public static final String REASON_TYPE_REASON = "reason"; + + 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_REASON)); + reportReasons.add(new ReportReason(context.getString(R.string.report_reason_general_copyright_issue), REASON_TYPE_REASON)); + reportReasons.add(new ReportReason(context.getString(R.string.report_reason_general_child_pornography), REASON_TYPE_REASON)); + reportReasons.add(new ReportReason(context.getString(R.string.report_reason_general_abusive_content), REASON_TYPE_REASON)); + return reportReasons; + } +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ReportThing.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ReportThing.java new file mode 100644 index 00000000..3d7febfb --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ReportThing.java @@ -0,0 +1,46 @@ +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); + + 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(); + } + }); + } +}
\ No newline at end of file diff --git a/app/src/main/res/drawable/ic_fullscreen_white_rounded_18dp.xml b/app/src/main/res/drawable/ic_fullscreen_white_rounded_18dp.xml new file mode 100644 index 00000000..9977b60f --- /dev/null +++ b/app/src/main/res/drawable/ic_fullscreen_white_rounded_18dp.xml @@ -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> diff --git a/app/src/main/res/layout/activity_report.xml b/app/src/main/res/layout/activity_report.xml new file mode 100644 index 00000000..845c9ecc --- /dev/null +++ b/app/src/main/res/layout/activity_report.xml @@ -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>
\ No newline at end of file diff --git a/app/src/main/res/layout/exo_autoplay_playback_control_view.xml b/app/src/main/res/layout/exo_autoplay_playback_control_view.xml index 826f6870..a5e128ae 100644 --- a/app/src/main/res/layout/exo_autoplay_playback_control_view.xml +++ b/app/src/main/res/layout/exo_autoplay_playback_control_view.xml @@ -57,8 +57,16 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="8dp" - android:layout_alignParentEnd="true" + 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>
\ No newline at end of file diff --git a/app/src/main/res/layout/item_report_reason.xml b/app/src/main/res/layout/item_report_reason.xml new file mode 100644 index 00000000..08d6900b --- /dev/null +++ b/app/src/main/res/layout/item_report_reason.xml @@ -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>
\ No newline at end of file diff --git a/app/src/main/res/menu/report_activity.xml b/app/src/main/res/menu/report_activity.xml new file mode 100644 index 00000000..8445d412 --- /dev/null +++ b/app/src/main/res/menu/report_activity.xml @@ -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>
\ No newline at end of file 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 a9871051..32f83c41 100644 --- a/app/src/main/res/menu/view_post_detail_activity.xml +++ b/app/src/main/res/menu/view_post_detail_activity.xml @@ -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>
\ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 2bd237f9..3a8dbdd1 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -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> @@ -702,4 +704,13 @@ <string name="n_awards">%1$d Awards</string> <string name="one_award">1 Award</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">Spam</string> + <string name="report_reason_general_copyright_issue">Copyright Issue</string> + <string name="report_reason_general_child_pornography">Child Pornography</string> + <string name="report_reason_general_abusive_content">Abusive Content</string> + </resources> |