aboutsummaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2021-07-07 14:13:56 +0000
committerAlex Ning <chineseperson5@gmail.com>2021-07-07 14:13:56 +0000
commit6eecaaccfa358d0dfd9ef3b514db5faad9c96edd (patch)
treee9101dd4d22744453453737465ae57e434ed424a /app/src
parent571e1003aa451605acae5a914ff4e0aecc9c1da6 (diff)
downloadinfinity-for-reddit-6eecaaccfa358d0dfd9ef3b514db5faad9c96edd.tar
infinity-for-reddit-6eecaaccfa358d0dfd9ef3b514db5faad9c96edd.tar.gz
infinity-for-reddit-6eecaaccfa358d0dfd9ef3b514db5faad9c96edd.tar.bz2
infinity-for-reddit-6eecaaccfa358d0dfd9ef3b514db5faad9c96edd.tar.lz
infinity-for-reddit-6eecaaccfa358d0dfd9ef3b514db5faad9c96edd.tar.xz
infinity-for-reddit-6eecaaccfa358d0dfd9ef3b514db5faad9c96edd.tar.zst
infinity-for-reddit-6eecaaccfa358d0dfd9ef3b514db5faad9c96edd.zip
Cannot use Strapi to send comments, upvote or downvote in RPAN.
Diffstat (limited to '')
-rw-r--r--app/src/main/AndroidManifest.xml3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/RPANBroadcast.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/RPANActivity.java1
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RPANCommentStreamRecyclerViewAdapter.java12
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/apis/Strapi.java43
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRPANBroadcastFragment.java12
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/utils/Utils.java7
-rw-r--r--app/src/main/res/layout/exo_rpan_broadcast_playback_control_view.xml1
-rw-r--r--app/src/main/res/layout/fragment_view_rpan_broadcast.xml3
9 files changed, 22 insertions, 64 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 66c76e03..f320cb64 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -36,7 +36,8 @@
android:configChanges="orientation|screenSize|layoutDirection"
android:label="@string/rpan_activity_label"
android:parentActivityName=".activities.MainActivity"
- android:theme="@style/AppTheme.TranslucentStatusBar" />
+ android:theme="@style/AppTheme.TranslucentStatusBar"
+ android:windowSoftInputMode="adjustPan" />
<activity
android:name=".activities.MotionTestActivity"
android:theme="@style/AppTheme.NoActionBar" />
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/RPANBroadcast.java b/app/src/main/java/ml/docilealligator/infinityforreddit/RPANBroadcast.java
index 43b8ef55..1d317e2d 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/RPANBroadcast.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/RPANBroadcast.java
@@ -77,6 +77,7 @@ public class RPANBroadcast implements Parcelable {
}
public static class RPANPost implements Parcelable{
+ public String fullname;
public String title;
public String subredditName;
public String subredditIconUrl;
@@ -92,10 +93,11 @@ public class RPANBroadcast implements Parcelable {
public String suggestedCommentSort;
public String liveCommentsWebsocketUrl;
- public RPANPost(String title, String subredditName, String subredditIconUrl, String username,
+ public RPANPost(String fullname, String title, String subredditName, String subredditIconUrl, String username,
int postScore, String voteState, double upvoteRatio, String postPermalink, String rpanUrl,
boolean isNsfw, boolean isLocked, boolean isArchived, boolean isSpoiler,
String suggestedCommentSort, String liveCommentsWebsocketUrl) {
+ this.fullname = fullname;
this.title = title;
this.subredditName = subredditName;
this.subredditIconUrl = subredditIconUrl;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/RPANActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/RPANActivity.java
index c22d481f..cc4c83ef 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/RPANActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/RPANActivity.java
@@ -159,6 +159,7 @@ public class RPANActivity extends AppCompatActivity {
JSONObject singleData = dataArray.getJSONObject(i);
JSONObject rpanPostObject = singleData.getJSONObject(JSONUtils.POST_KEY);
RPANBroadcast.RPANPost rpanPost = new RPANBroadcast.RPANPost(
+ rpanPostObject.getString(JSONUtils.ID_KEY),
rpanPostObject.getString(JSONUtils.TITLE_KEY),
rpanPostObject.getJSONObject(JSONUtils.SUBREDDIT_KEY).getString(JSONUtils.NAME_KEY),
rpanPostObject.getJSONObject(JSONUtils.SUBREDDIT_KEY).getJSONObject(JSONUtils.STYLES_KEY).getString(JSONUtils.ICON_KEY),
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RPANCommentStreamRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RPANCommentStreamRecyclerViewAdapter.java
index 60f596ab..ba7dcd34 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RPANCommentStreamRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RPANCommentStreamRecyclerViewAdapter.java
@@ -23,12 +23,10 @@ import ml.docilealligator.infinityforreddit.RPANComment;
public class RPANCommentStreamRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private RequestManager glide;
private ArrayList<RPANComment> rpanComments;
- private ItemClickListener itemClickListener;
- public RPANCommentStreamRecyclerViewAdapter(Context context, ItemClickListener itemClickListener) {
+ public RPANCommentStreamRecyclerViewAdapter(Context context) {
glide = Glide.with(context);
rpanComments = new ArrayList<>();
- this.itemClickListener = itemClickListener;
}
@NonNull
@@ -80,14 +78,6 @@ public class RPANCommentStreamRecyclerViewAdapter extends RecyclerView.Adapter<R
iconImageView = itemView.findViewById(R.id.icon_image_view_item_rpan_comment);
authorTextView = itemView.findViewById(R.id.author_text_view_item_rpan_comment);
contentTextView = itemView.findViewById(R.id.content_text_view_item_rpan_comment);
-
- itemView.setOnClickListener(view -> {
- itemClickListener.onClick();
- });
}
}
-
- public interface ItemClickListener {
- void onClick();
- }
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/apis/Strapi.java b/app/src/main/java/ml/docilealligator/infinityforreddit/apis/Strapi.java
index 02af768f..e4bfe573 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/apis/Strapi.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/apis/Strapi.java
@@ -3,57 +3,14 @@ package ml.docilealligator.infinityforreddit.apis;
import java.util.Map;
import retrofit2.Call;
-import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.HeaderMap;
-import retrofit2.http.POST;
import retrofit2.http.Path;
public interface Strapi {
@GET("/broadcasts")
Call<String> getAllBroadcasts(@HeaderMap Map<String ,String> headers);
- /*
- Response:
- {"status": "success", "status_message": ""}
- */
- @FormUrlEncoded
- @POST("/videos/{rpan_id}/vote/up")
- Call<String> upvote(@HeaderMap Map<String, String> headers, @Path("rpan_id") String rpanId);
-
- @FormUrlEncoded
- @POST("/videos/{rpan_id}/vote/down")
- Call<String> downvote(@HeaderMap Map<String, String> headers, @Path("rpan_id") String rpanId);
-
- @FormUrlEncoded
- @POST("/videos/{rpan_id}/vote/unset")
- Call<String> unsetVote(@HeaderMap Map<String, String> headers, @Path("rpan_id") String rpanId);
-
- /*
- Request payload: {text: "Noice"}
-
- Response:
- {"status": "success", "status_message": "", "data": {"auto_mute_status": {"level": 0, "level_changed": false},
- "r2_comment": {"total_awards_received": 0, "approved_at_utc": null, "comment_type": null, "edited": false,
- "mod_reason_by": null, "banned_by": null, "author_flair_type": "text", "removal_reason": null, "link_id": "t3_of7btc",
- "author_flair_template_id": null, "likes": true, "rtjson": {"document": [{"c": [{"e": "text", "t": "Noice"}], "e": "par"}]},
- "replies": "", "user_reports": [], "saved": false, "id": "h4avk42", "banned_at_utc": null, "mod_reason_title": null,
- "gilded": 0, "archived": false, "no_follow": false, "author": "Hostilenemy", "can_mod_post": false, "send_replies": true,
- "parent_id": "t3_of7btc", "score": 1, "author_fullname": "t2_z40p4", "approved_by": null, "mod_note": null,
- "all_awardings": [], "subreddit_id": "t5_3psukr", "body": "Noice", "awarders": [], "downs": 0, "author_flair_css_class": null,
- "name": "t1_h4avk42", "author_patreon_flair": false, "collapsed": false, "author_flair_richtext": [], "is_submitter": false,
- "body_html": "<div class=\"md\"><p>Noice</p>\n</div>", "gildings": {}, "collapsed_reason": null, "distinguished": null,
- "associated_award": null, "stickied": false, "author_premium": false, "can_gild": false, "top_awarded_type": null,
- "author_flair_text_color": null, "score_hidden": false, "permalink": "/r/RedditSets/comments/of7btc/whistleface_762021_house_music/h4avk42/",
- "num_reports": null, "locked": false, "report_reasons": null, "created": 1625647709.0, "subreddit": "RedditSets", "author_flair_text": null,
- "treatment_tags": [], "rte_mode": "markdown", "created_utc": 1625618909.0, "subreddit_name_prefixed": "r/RedditSets",
- "controversiality": 0, "author_flair_background_color": null, "collapsed_because_crowd_control": null, "mod_reports": [],
- "subreddit_type": "public", "ups": 1}}}
- */
- @FormUrlEncoded
- @POST("/broadcasts/{rpan_id}/comment_v2")
- Call<String> sendComment(@HeaderMap Map<String, String> headers, @Path("rpan_id") String rpanId);
-
@GET("/videos/{rpan_id_or_fullname}")
Call<String> getRPANBroadcast(@Path("rpan_id_or_fullname") String rpanIdOrFullname);
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRPANBroadcastFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRPANBroadcastFragment.java
index 219a55de..09aa6ee7 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRPANBroadcastFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRPANBroadcastFragment.java
@@ -59,6 +59,7 @@ import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.WebSocket;
import okhttp3.WebSocketListener;
+import retrofit2.Retrofit;
public class ViewRPANBroadcastFragment extends Fragment {
@@ -76,6 +77,9 @@ public class ViewRPANBroadcastFragment extends Fragment {
@BindView(R.id.hd_exo_rpan_broadcast_playback_control_view)
ImageButton hdButton;
@Inject
+ @Named("strapi")
+ Retrofit mStrapiRetrofit;
+ @Inject
@Named("default")
SharedPreferences mSharedPreferences;
@Inject
@@ -142,6 +146,7 @@ public class ViewRPANBroadcastFragment extends Fragment {
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE);
+ playerView.setControllerShowTimeoutMs(0);
break;
case View.VISIBLE:
mActivity.getWindow().getDecorView().setSystemUiVisibility(
@@ -248,12 +253,7 @@ public class ViewRPANBroadcastFragment extends Fragment {
return false;
}
});
- adapter = new RPANCommentStreamRecyclerViewAdapter(mActivity, new RPANCommentStreamRecyclerViewAdapter.ItemClickListener() {
- @Override
- public void onClick() {
-
- }
- });
+ adapter = new RPANCommentStreamRecyclerViewAdapter(mActivity);
recyclerView.setAdapter(adapter);
handler = new Handler();
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/Utils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/Utils.java
index e01f41cd..567f3afe 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/Utils.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/Utils.java
@@ -311,6 +311,13 @@ public class Utils {
}
public static void hideKeyboard(Activity activity) {
+ /*if (activity.getCurrentFocus() == null || !(activity.getCurrentFocus() instanceof EditText)) {
+ editText.requestFocus();
+ }
+ InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
+ imm.hideSoftInputFromWindow(editText.getWindowToken(), 0);
+ activity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);*/
+
InputMethodManager inputMethodManager = (InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE);
if (inputMethodManager != null && activity.getCurrentFocus() != null) {
inputMethodManager.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), 0);
diff --git a/app/src/main/res/layout/exo_rpan_broadcast_playback_control_view.xml b/app/src/main/res/layout/exo_rpan_broadcast_playback_control_view.xml
index da7faea2..9ee2582f 100644
--- a/app/src/main/res/layout/exo_rpan_broadcast_playback_control_view.xml
+++ b/app/src/main/res/layout/exo_rpan_broadcast_playback_control_view.xml
@@ -4,6 +4,7 @@
android:layout_height="match_parent"
android:background="#44000000"
android:id="@+id/constraint_layout_exo_rpan_broadcast_playback_control_view"
+ android:focusableInTouchMode="true"
xmlns:app="http://schemas.android.com/apk/res-auto">
<LinearLayout
diff --git a/app/src/main/res/layout/fragment_view_rpan_broadcast.xml b/app/src/main/res/layout/fragment_view_rpan_broadcast.xml
index 6a5aedf4..abab4f52 100644
--- a/app/src/main/res/layout/fragment_view_rpan_broadcast.xml
+++ b/app/src/main/res/layout/fragment_view_rpan_broadcast.xml
@@ -10,7 +10,6 @@
android:id="@+id/player_view_view_rpan_broadcast_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
- app:controller_layout_id="@layout/exo_rpan_broadcast_playback_control_view"
- app:show_timeout="0" />
+ app:controller_layout_id="@layout/exo_rpan_broadcast_playback_control_view" />
</FrameLayout> \ No newline at end of file