mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-30 21:07:11 +01:00
Cannot use Strapi to send comments, upvote or downvote in RPAN.
This commit is contained in:
parent
571e1003aa
commit
6eecaaccfa
@ -36,7 +36,8 @@
|
|||||||
android:configChanges="orientation|screenSize|layoutDirection"
|
android:configChanges="orientation|screenSize|layoutDirection"
|
||||||
android:label="@string/rpan_activity_label"
|
android:label="@string/rpan_activity_label"
|
||||||
android:parentActivityName=".activities.MainActivity"
|
android:parentActivityName=".activities.MainActivity"
|
||||||
android:theme="@style/AppTheme.TranslucentStatusBar" />
|
android:theme="@style/AppTheme.TranslucentStatusBar"
|
||||||
|
android:windowSoftInputMode="adjustPan" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.MotionTestActivity"
|
android:name=".activities.MotionTestActivity"
|
||||||
android:theme="@style/AppTheme.NoActionBar" />
|
android:theme="@style/AppTheme.NoActionBar" />
|
||||||
|
@ -77,6 +77,7 @@ public class RPANBroadcast implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class RPANPost implements Parcelable{
|
public static class RPANPost implements Parcelable{
|
||||||
|
public String fullname;
|
||||||
public String title;
|
public String title;
|
||||||
public String subredditName;
|
public String subredditName;
|
||||||
public String subredditIconUrl;
|
public String subredditIconUrl;
|
||||||
@ -92,10 +93,11 @@ public class RPANBroadcast implements Parcelable {
|
|||||||
public String suggestedCommentSort;
|
public String suggestedCommentSort;
|
||||||
public String liveCommentsWebsocketUrl;
|
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,
|
int postScore, String voteState, double upvoteRatio, String postPermalink, String rpanUrl,
|
||||||
boolean isNsfw, boolean isLocked, boolean isArchived, boolean isSpoiler,
|
boolean isNsfw, boolean isLocked, boolean isArchived, boolean isSpoiler,
|
||||||
String suggestedCommentSort, String liveCommentsWebsocketUrl) {
|
String suggestedCommentSort, String liveCommentsWebsocketUrl) {
|
||||||
|
this.fullname = fullname;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.subredditName = subredditName;
|
this.subredditName = subredditName;
|
||||||
this.subredditIconUrl = subredditIconUrl;
|
this.subredditIconUrl = subredditIconUrl;
|
||||||
|
@ -159,6 +159,7 @@ public class RPANActivity extends AppCompatActivity {
|
|||||||
JSONObject singleData = dataArray.getJSONObject(i);
|
JSONObject singleData = dataArray.getJSONObject(i);
|
||||||
JSONObject rpanPostObject = singleData.getJSONObject(JSONUtils.POST_KEY);
|
JSONObject rpanPostObject = singleData.getJSONObject(JSONUtils.POST_KEY);
|
||||||
RPANBroadcast.RPANPost rpanPost = new RPANBroadcast.RPANPost(
|
RPANBroadcast.RPANPost rpanPost = new RPANBroadcast.RPANPost(
|
||||||
|
rpanPostObject.getString(JSONUtils.ID_KEY),
|
||||||
rpanPostObject.getString(JSONUtils.TITLE_KEY),
|
rpanPostObject.getString(JSONUtils.TITLE_KEY),
|
||||||
rpanPostObject.getJSONObject(JSONUtils.SUBREDDIT_KEY).getString(JSONUtils.NAME_KEY),
|
rpanPostObject.getJSONObject(JSONUtils.SUBREDDIT_KEY).getString(JSONUtils.NAME_KEY),
|
||||||
rpanPostObject.getJSONObject(JSONUtils.SUBREDDIT_KEY).getJSONObject(JSONUtils.STYLES_KEY).getString(JSONUtils.ICON_KEY),
|
rpanPostObject.getJSONObject(JSONUtils.SUBREDDIT_KEY).getJSONObject(JSONUtils.STYLES_KEY).getString(JSONUtils.ICON_KEY),
|
||||||
|
@ -23,12 +23,10 @@ import ml.docilealligator.infinityforreddit.RPANComment;
|
|||||||
public class RPANCommentStreamRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
public class RPANCommentStreamRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||||
private RequestManager glide;
|
private RequestManager glide;
|
||||||
private ArrayList<RPANComment> rpanComments;
|
private ArrayList<RPANComment> rpanComments;
|
||||||
private ItemClickListener itemClickListener;
|
|
||||||
|
|
||||||
public RPANCommentStreamRecyclerViewAdapter(Context context, ItemClickListener itemClickListener) {
|
public RPANCommentStreamRecyclerViewAdapter(Context context) {
|
||||||
glide = Glide.with(context);
|
glide = Glide.with(context);
|
||||||
rpanComments = new ArrayList<>();
|
rpanComments = new ArrayList<>();
|
||||||
this.itemClickListener = itemClickListener;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@ -80,14 +78,6 @@ public class RPANCommentStreamRecyclerViewAdapter extends RecyclerView.Adapter<R
|
|||||||
iconImageView = itemView.findViewById(R.id.icon_image_view_item_rpan_comment);
|
iconImageView = itemView.findViewById(R.id.icon_image_view_item_rpan_comment);
|
||||||
authorTextView = itemView.findViewById(R.id.author_text_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);
|
contentTextView = itemView.findViewById(R.id.content_text_view_item_rpan_comment);
|
||||||
|
|
||||||
itemView.setOnClickListener(view -> {
|
|
||||||
itemClickListener.onClick();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface ItemClickListener {
|
|
||||||
void onClick();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -3,57 +3,14 @@ package ml.docilealligator.infinityforreddit.apis;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.http.FormUrlEncoded;
|
|
||||||
import retrofit2.http.GET;
|
import retrofit2.http.GET;
|
||||||
import retrofit2.http.HeaderMap;
|
import retrofit2.http.HeaderMap;
|
||||||
import retrofit2.http.POST;
|
|
||||||
import retrofit2.http.Path;
|
import retrofit2.http.Path;
|
||||||
|
|
||||||
public interface Strapi {
|
public interface Strapi {
|
||||||
@GET("/broadcasts")
|
@GET("/broadcasts")
|
||||||
Call<String> getAllBroadcasts(@HeaderMap Map<String ,String> headers);
|
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}")
|
@GET("/videos/{rpan_id_or_fullname}")
|
||||||
Call<String> getRPANBroadcast(@Path("rpan_id_or_fullname") String rpanIdOrFullname);
|
Call<String> getRPANBroadcast(@Path("rpan_id_or_fullname") String rpanIdOrFullname);
|
||||||
}
|
}
|
||||||
|
@ -59,6 +59,7 @@ import okhttp3.OkHttpClient;
|
|||||||
import okhttp3.Request;
|
import okhttp3.Request;
|
||||||
import okhttp3.WebSocket;
|
import okhttp3.WebSocket;
|
||||||
import okhttp3.WebSocketListener;
|
import okhttp3.WebSocketListener;
|
||||||
|
import retrofit2.Retrofit;
|
||||||
|
|
||||||
public class ViewRPANBroadcastFragment extends Fragment {
|
public class ViewRPANBroadcastFragment extends Fragment {
|
||||||
|
|
||||||
@ -76,6 +77,9 @@ public class ViewRPANBroadcastFragment extends Fragment {
|
|||||||
@BindView(R.id.hd_exo_rpan_broadcast_playback_control_view)
|
@BindView(R.id.hd_exo_rpan_broadcast_playback_control_view)
|
||||||
ImageButton hdButton;
|
ImageButton hdButton;
|
||||||
@Inject
|
@Inject
|
||||||
|
@Named("strapi")
|
||||||
|
Retrofit mStrapiRetrofit;
|
||||||
|
@Inject
|
||||||
@Named("default")
|
@Named("default")
|
||||||
SharedPreferences mSharedPreferences;
|
SharedPreferences mSharedPreferences;
|
||||||
@Inject
|
@Inject
|
||||||
@ -142,6 +146,7 @@ public class ViewRPANBroadcastFragment extends Fragment {
|
|||||||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||||
| View.SYSTEM_UI_FLAG_FULLSCREEN
|
| View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||||
| View.SYSTEM_UI_FLAG_IMMERSIVE);
|
| View.SYSTEM_UI_FLAG_IMMERSIVE);
|
||||||
|
playerView.setControllerShowTimeoutMs(0);
|
||||||
break;
|
break;
|
||||||
case View.VISIBLE:
|
case View.VISIBLE:
|
||||||
mActivity.getWindow().getDecorView().setSystemUiVisibility(
|
mActivity.getWindow().getDecorView().setSystemUiVisibility(
|
||||||
@ -248,12 +253,7 @@ public class ViewRPANBroadcastFragment extends Fragment {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
adapter = new RPANCommentStreamRecyclerViewAdapter(mActivity, new RPANCommentStreamRecyclerViewAdapter.ItemClickListener() {
|
adapter = new RPANCommentStreamRecyclerViewAdapter(mActivity);
|
||||||
@Override
|
|
||||||
public void onClick() {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
recyclerView.setAdapter(adapter);
|
recyclerView.setAdapter(adapter);
|
||||||
|
|
||||||
handler = new Handler();
|
handler = new Handler();
|
||||||
|
@ -311,6 +311,13 @@ public class Utils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void hideKeyboard(Activity activity) {
|
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);
|
InputMethodManager inputMethodManager = (InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||||
if (inputMethodManager != null && activity.getCurrentFocus() != null) {
|
if (inputMethodManager != null && activity.getCurrentFocus() != null) {
|
||||||
inputMethodManager.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), 0);
|
inputMethodManager.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), 0);
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="#44000000"
|
android:background="#44000000"
|
||||||
android:id="@+id/constraint_layout_exo_rpan_broadcast_playback_control_view"
|
android:id="@+id/constraint_layout_exo_rpan_broadcast_playback_control_view"
|
||||||
|
android:focusableInTouchMode="true"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
android:id="@+id/player_view_view_rpan_broadcast_fragment"
|
android:id="@+id/player_view_view_rpan_broadcast_fragment"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
app:controller_layout_id="@layout/exo_rpan_broadcast_playback_control_view"
|
app:controller_layout_id="@layout/exo_rpan_broadcast_playback_control_view" />
|
||||||
app:show_timeout="0" />
|
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
Loading…
Reference in New Issue
Block a user