mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-01-16 05:03:07 +01:00
Merge changes
This commit is contained in:
commit
db9edc47c0
@ -24,7 +24,11 @@ public class RetrofitHolder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getBaseURL() {
|
public String getBaseURL() {
|
||||||
return baseURL;
|
String result = baseURL;
|
||||||
|
if (baseURL.endsWith("/")) {
|
||||||
|
result = baseURL.substring(0, baseURL.length() - 1);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RetrofitHolder(OkHttpClient okHttpClient) {
|
public RetrofitHolder(OkHttpClient okHttpClient) {
|
||||||
|
@ -1219,7 +1219,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
|||||||
Intent shareIntent = new Intent(Intent.ACTION_SEND);
|
Intent shareIntent = new Intent(Intent.ACTION_SEND);
|
||||||
shareIntent.setType("text/plain");
|
shareIntent.setType("text/plain");
|
||||||
String baseURL = mRetrofit.getBaseURL().endsWith("/") ? mRetrofit.getBaseURL() : mRetrofit.getBaseURL() + "/";
|
String baseURL = mRetrofit.getBaseURL().endsWith("/") ? mRetrofit.getBaseURL() : mRetrofit.getBaseURL() + "/";
|
||||||
shareIntent.putExtra(Intent.EXTRA_TEXT, baseURL + "/" + qualifiedName);
|
shareIntent.putExtra(Intent.EXTRA_TEXT, baseURL + "c/" + qualifiedName);
|
||||||
if (shareIntent.resolveActivity(getPackageManager()) != null) {
|
if (shareIntent.resolveActivity(getPackageManager()) != null) {
|
||||||
startActivity(Intent.createChooser(shareIntent, getString(R.string.share)));
|
startActivity(Intent.createChooser(shareIntent, getString(R.string.share)));
|
||||||
} else {
|
} else {
|
||||||
|
@ -1255,7 +1255,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
|||||||
Intent shareIntent = new Intent(Intent.ACTION_SEND);
|
Intent shareIntent = new Intent(Intent.ACTION_SEND);
|
||||||
shareIntent.setType("text/plain");
|
shareIntent.setType("text/plain");
|
||||||
String baseURL = mRetrofit.getBaseURL().endsWith("/") ? mRetrofit.getBaseURL() : mRetrofit.getBaseURL() + "/";
|
String baseURL = mRetrofit.getBaseURL().endsWith("/") ? mRetrofit.getBaseURL() : mRetrofit.getBaseURL() + "/";
|
||||||
shareIntent.putExtra(Intent.EXTRA_TEXT, baseURL + qualifiedName);
|
shareIntent.putExtra(Intent.EXTRA_TEXT, baseURL + "u/" + qualifiedName);
|
||||||
if (shareIntent.resolveActivity(getPackageManager()) != null) {
|
if (shareIntent.resolveActivity(getPackageManager()) != null) {
|
||||||
startActivity(Intent.createChooser(shareIntent, getString(R.string.share)));
|
startActivity(Intent.createChooser(shareIntent, getString(R.string.share)));
|
||||||
} else {
|
} else {
|
||||||
|
@ -99,7 +99,8 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
|||||||
private Retrofit mOauthRetrofit;
|
private Retrofit mOauthRetrofit;
|
||||||
private Markwon mCommentMarkwon;
|
private Markwon mCommentMarkwon;
|
||||||
private String mAccessToken;
|
private String mAccessToken;
|
||||||
private String mAccountName;
|
private String mAccountQualifiedName;
|
||||||
|
|
||||||
private Post mPost;
|
private Post mPost;
|
||||||
private ArrayList<Comment> mVisibleComments;
|
private ArrayList<Comment> mVisibleComments;
|
||||||
|
|
||||||
@ -217,7 +218,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
|||||||
miscPlugin, mCommentTextColor, commentSpoilerBackgroundColor, onLinkLongClickListener);
|
miscPlugin, mCommentTextColor, commentSpoilerBackgroundColor, onLinkLongClickListener);
|
||||||
recycledViewPool = new RecyclerView.RecycledViewPool();
|
recycledViewPool = new RecyclerView.RecycledViewPool();
|
||||||
mAccessToken = accessToken;
|
mAccessToken = accessToken;
|
||||||
mAccountName = accountName;
|
mAccountQualifiedName = accountName;
|
||||||
mPost = post;
|
mPost = post;
|
||||||
mVisibleComments = new ArrayList<>();
|
mVisibleComments = new ArrayList<>();
|
||||||
loadedComments = new HashSet<>();
|
loadedComments = new HashSet<>();
|
||||||
@ -389,7 +390,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
|||||||
Drawable moderatorDrawable = Utils.getTintedDrawable(mActivity, R.drawable.ic_verified_user_14dp, mModeratorColor);
|
Drawable moderatorDrawable = Utils.getTintedDrawable(mActivity, R.drawable.ic_verified_user_14dp, mModeratorColor);
|
||||||
((CommentViewHolder) holder).authorTextView.setCompoundDrawablesWithIntrinsicBounds(
|
((CommentViewHolder) holder).authorTextView.setCompoundDrawablesWithIntrinsicBounds(
|
||||||
moderatorDrawable, null, null, null);
|
moderatorDrawable, null, null, null);
|
||||||
} else if (comment.getAuthor().equals(mAccountName)) {
|
} else if (comment.getAuthorQualifiedName().equals(mAccountQualifiedName)) {
|
||||||
((CommentViewHolder) holder).authorTextView.setTextColor(mCurrentUserColor);
|
((CommentViewHolder) holder).authorTextView.setTextColor(mCurrentUserColor);
|
||||||
Drawable currentUserDrawable = Utils.getTintedDrawable(mActivity, R.drawable.ic_current_user_14dp, mCurrentUserColor);
|
Drawable currentUserDrawable = Utils.getTintedDrawable(mActivity, R.drawable.ic_current_user_14dp, mCurrentUserColor);
|
||||||
((CommentViewHolder) holder).authorTextView.setCompoundDrawablesWithIntrinsicBounds(
|
((CommentViewHolder) holder).authorTextView.setCompoundDrawablesWithIntrinsicBounds(
|
||||||
@ -1373,7 +1374,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
|||||||
Comment comment = getCurrentComment(this);
|
Comment comment = getCurrentComment(this);
|
||||||
if (comment != null) {
|
if (comment != null) {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
if (!mPost.isArchived() && !mPost.isLocked() && comment.getAuthor().equals(mAccountName)) {
|
if (!mPost.isArchived() && !mPost.isLocked() && comment.getAuthorQualifiedName().equals(mAccountQualifiedName)) {
|
||||||
bundle.putBoolean(CommentMoreBottomSheetFragment.EXTRA_EDIT_AND_DELETE_AVAILABLE, true);
|
bundle.putBoolean(CommentMoreBottomSheetFragment.EXTRA_EDIT_AND_DELETE_AVAILABLE, true);
|
||||||
}
|
}
|
||||||
bundle.putString(CommentMoreBottomSheetFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
|
bundle.putString(CommentMoreBottomSheetFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
|
||||||
|
@ -621,7 +621,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
|
|||||||
mExoCreator, post -> EventBus.getDefault().post(new PostUpdateEventToPostList(mPost, postListPosition)));
|
mExoCreator, post -> EventBus.getDefault().post(new PostUpdateEventToPostList(mPost, postListPosition)));
|
||||||
mCommentsAdapter = new CommentsRecyclerViewAdapter(activity,
|
mCommentsAdapter = new CommentsRecyclerViewAdapter(activity,
|
||||||
this, mCustomThemeWrapper, mExecutor, mRetrofit.getRetrofit(),
|
this, mCustomThemeWrapper, mExecutor, mRetrofit.getRetrofit(),
|
||||||
mAccessToken, mAccountName, mPost, mLocale, mSingleCommentId
|
mAccessToken, mAccountQualifiedName, mPost, mLocale, mSingleCommentId
|
||||||
, isSingleCommentThreadMode, mSharedPreferences, mCurrentAccountSharedPreferences,
|
, isSingleCommentThreadMode, mSharedPreferences, mCurrentAccountSharedPreferences,
|
||||||
new CommentsRecyclerViewAdapter.CommentRecyclerViewAdapterCallback() {
|
new CommentsRecyclerViewAdapter.CommentRecyclerViewAdapterCallback() {
|
||||||
@Override
|
@Override
|
||||||
@ -1351,7 +1351,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
|
|||||||
pages_loaded++;
|
pages_loaded++;
|
||||||
mCommentsAdapter = new CommentsRecyclerViewAdapter(activity,
|
mCommentsAdapter = new CommentsRecyclerViewAdapter(activity,
|
||||||
ViewPostDetailFragment.this, mCustomThemeWrapper, mExecutor,
|
ViewPostDetailFragment.this, mCustomThemeWrapper, mExecutor,
|
||||||
mRetrofit.getRetrofit(), mAccessToken, mAccountName, mPost, mLocale,
|
mRetrofit.getRetrofit(), mAccessToken, mAccountQualifiedName, mPost, mLocale,
|
||||||
mSingleCommentId, isSingleCommentThreadMode, mSharedPreferences, mCurrentAccountSharedPreferences,
|
mSingleCommentId, isSingleCommentThreadMode, mSharedPreferences, mCurrentAccountSharedPreferences,
|
||||||
new CommentsRecyclerViewAdapter.CommentRecyclerViewAdapterCallback() {
|
new CommentsRecyclerViewAdapter.CommentRecyclerViewAdapterCallback() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -50,9 +50,7 @@ public class UploadImageUtils {
|
|||||||
JSONObject responseObject = new JSONObject(uploadMediaResponse.body());
|
JSONObject responseObject = new JSONObject(uploadMediaResponse.body());
|
||||||
String fileName = responseObject.getJSONArray("files").getJSONObject(0).getString("file");
|
String fileName = responseObject.getJSONArray("files").getJSONObject(0).getString("file");
|
||||||
String baseURL = mRetrofit.getBaseURL();
|
String baseURL = mRetrofit.getBaseURL();
|
||||||
if (baseURL.endsWith("/")) {
|
|
||||||
baseURL = baseURL.substring(0, baseURL.length() - 1);
|
|
||||||
}
|
|
||||||
return baseURL + "/pictrs/image/" + fileName;
|
return baseURL + "/pictrs/image/" + fileName;
|
||||||
} else {
|
} else {
|
||||||
return "Error: " + uploadMediaResponse.code();
|
return "Error: " + uploadMediaResponse.code();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user