15 Commits

Author SHA1 Message Date
Balazs Toldi
919d259f61 Add backend to upload images.
Also added an Image upload button for comments.
2023-07-27 18:32:44 +02:00
Balazs Toldi
2fc4020b72 Fix post refreshing bug
Fix bug where the whole post disappears after refreshing it.
2023-07-27 17:45:14 +02:00
Balazs Toldi
9d6e15edb7 Change error image to the new logo
Signed-off-by: Balazs Toldi <balazs@toldi.eu>
2023-07-27 14:15:27 +02:00
Balazs Toldi
44956bd951 Minor fix to load comment author's icon
Signed-off-by: Balazs Toldi <balazs@toldi.eu>
2023-07-27 14:15:10 +02:00
Balazs Toldi
388b895499 Edit comments
This comments adds functionality to edit comments.
Signed-off-by: Balazs Toldi <balazs@toldi.eu>
2023-07-27 13:25:16 +02:00
Balazs Toldi
5b26d57fdb Save posts/comment with save post button
The save post/comment buttons are now functional.
Signed-off-by: Balazs Toldi <balazs@toldi.eu>
2023-07-27 13:24:41 +02:00
Balazs Toldi
e2de8b8160 Make subscribe/unsubscribe buttons functional
This commit makes the subscribe/unsubscribe buttons functional, so you can manage subscriptions in the app!
Signed-off-by: Balazs Toldi <balazs@toldi.eu>
2023-07-27 09:26:12 +02:00
Balazs Toldi
f3bff30ef0 Fix avatar loading on ViewUserDatailActivity
The icons for a user were not loaded because of a small bug. Now it loads as it should.
Signed-off-by: Balazs Toldi <balazs@toldi.eu>
2023-07-27 08:49:42 +02:00
Balazs Toldi
6704772fb2 Goto user/community button now works
Signed-off-by: Balazs Toldi <balazs@toldi.eu>
2023-07-27 08:41:19 +02:00
Balazs Toldi
efc74a074c No more infinity post loading!
Loading should posts now stops if we could not load any new posts. This is particularly important, because previously the app made WAY TOO MANY requests.
Signed-off-by: Balazs Toldi <balazs@toldi.eu>
2023-07-27 08:22:34 +02:00
Balazs Toldi
3b5852d1e4 Fix bug when progress indicator is present on the comments page, even after loading all the comments
Signed-off-by: Balazs Toldi <balazs@toldi.eu>
2023-07-27 07:49:46 +02:00
Balazs Toldi
0fa2da6ffa Fix icon in README
Signed-off-by: Balazs Toldi <balazs@toldi.eu>
2023-07-27 07:25:14 +02:00
Balazs Toldi
e3a4db17d2 Hide karma
Signed-off-by: Balazs Toldi <balazs@toldi.eu>
2023-07-27 07:22:52 +02:00
Balazs Toldi
2828429120 Fix score on already voted comments
Fixes #12
Signed-off-by: Balazs Toldi <balazs@toldi.eu>
2023-07-27 07:17:03 +02:00
Balazs Toldi
f2f057827a Update README and fastlane metadata
Signed-off-by: Balazs Toldi <balazs@toldi.eu>
2023-07-26 22:13:11 +02:00
56 changed files with 758 additions and 562 deletions

View File

@@ -1,12 +1,12 @@
<h1 align="center">
Infinity for Lemmy
</h1>
<div align="center">
A Lemmy client on Android written in Java. It's a fork of the [Infinity for Reddit](https://github.com/Docile-Alligator/Infinity-For-Reddit) project, currenty in early development.
A Lemmy client for Android written in Java. It's a fork of the [Infinity for Reddit](https://github.com/Docile-Alligator/Infinity-For-Reddit) project, currenty in early development.
<img align="right" src="https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy/raw/branch/master/fastlane/metadata/android/en-US/images/LemmInfinity.png" width=200>
<img align="right" src="https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy/raw/branch/master/fastlane/metadata/android/en-US/images/icon.png" width=200>
</div>
@@ -33,9 +33,9 @@ A Lemmy client on Android written in Java. It's a fork of the [Infinity for Redd
---
## Action Items for LemmInfinity
## Action Items for Infinity for Lemmy
LemmInfinity is currently in the early stages of development. Expect many unfinished features and bugs!
Infinity for Lemmy is currently in the early stages of development. Expect many unfinished features and bugs!
- [x] Implementation of basic post browsing feature
- [x] Support for multiple account handling

View File

@@ -12,13 +12,19 @@ public class RetrofitHolder {
private Retrofit retrofit;
private OkHttpClient okHttpClient;
private String baseURL = APIUtils.API_BASE_URI;
public Retrofit getRetrofit() {
return retrofit;
}
public void setBaseURL(String baseURL){
retrofit = createRetrofit(okHttpClient,baseURL);
public void setBaseURL(String baseURL) {
retrofit = createRetrofit(okHttpClient, baseURL);
this.baseURL = baseURL;
}
public String getBaseURL() {
return baseURL;
}
public RetrofitHolder(OkHttpClient okHttpClient) {

View File

@@ -0,0 +1,53 @@
package eu.toldi.infinityforlemmy;
import androidx.annotation.NonNull;
import eu.toldi.infinityforlemmy.apis.LemmyAPI;
import eu.toldi.infinityforlemmy.dto.SaveCommentDTO;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
public class SaveComment implements SaveThing {
@Override
public void saveThing(Retrofit retrofit, String accessToken, int id, SaveThingListener saveThingListener) {
retrofit.create(LemmyAPI.class).commentSave(new SaveCommentDTO(id, true, accessToken)).enqueue(new Callback<String>() {
@Override
public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) {
if (response.isSuccessful()) {
saveThingListener.success();
} else {
saveThingListener.failed();
}
}
@Override
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
saveThingListener.failed();
}
});
}
@Override
public void unsaveThing(Retrofit retrofit, String accessToken, int id, SaveThingListener saveThingListener) {
retrofit.create(LemmyAPI.class).commentSave(new SaveCommentDTO(id, false, accessToken)).enqueue(new Callback<String>() {
@Override
public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) {
if (response.isSuccessful()) {
saveThingListener.success();
} else {
saveThingListener.failed();
}
}
@Override
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
saveThingListener.failed();
}
});
}
}

View File

@@ -0,0 +1,55 @@
package eu.toldi.infinityforlemmy;
import androidx.annotation.NonNull;
import eu.toldi.infinityforlemmy.apis.LemmyAPI;
import eu.toldi.infinityforlemmy.dto.SavePostDTO;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
public class SavePost implements SaveThing {
@Override
public void saveThing(Retrofit retrofit, String accessToken, int id, SaveThingListener saveThingListener) {
retrofit.create(LemmyAPI.class).postSave(new SavePostDTO(id, true, accessToken)).enqueue(new Callback<String>() {
@Override
public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) {
if (response.isSuccessful()) {
saveThingListener.success();
} else {
saveThingListener.failed();
}
}
@Override
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
saveThingListener.failed();
}
});
}
@Override
public void unsaveThing(Retrofit retrofit, String accessToken, int id, SaveThingListener saveThingListener) {
retrofit.create(LemmyAPI.class).postSave(new SavePostDTO(id, false, accessToken)).enqueue(new Callback<String>() {
@Override
public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) {
if (response.isSuccessful()) {
saveThingListener.success();
} else {
saveThingListener.failed();
}
}
@Override
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
saveThingListener.failed();
}
});
}
}

View File

@@ -1,59 +1,13 @@
package eu.toldi.infinityforlemmy;
import androidx.annotation.NonNull;
import java.util.HashMap;
import java.util.Map;
import eu.toldi.infinityforlemmy.apis.RedditAPI;
import eu.toldi.infinityforlemmy.utils.APIUtils;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
public class SaveThing {
public static void saveThing(Retrofit oauthRetrofit, String accessToken, String fullname,
SaveThingListener saveThingListener) {
Map<String, String> params = new HashMap<>();
params.put(APIUtils.ID_KEY, fullname);
oauthRetrofit.create(RedditAPI.class).save(APIUtils.getOAuthHeader(accessToken), params).enqueue(new Callback<String>() {
@Override
public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) {
if (response.isSuccessful()) {
saveThingListener.success();
} else {
saveThingListener.failed();
}
}
public interface SaveThing {
void saveThing(Retrofit oauthRetrofit, String accessToken, int id,
SaveThingListener saveThingListener);
@Override
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
saveThingListener.failed();
}
});
}
public static void unsaveThing(Retrofit oauthRetrofit, String accessToken, String fullname,
SaveThingListener saveThingListener) {
Map<String, String> params = new HashMap<>();
params.put(APIUtils.ID_KEY, fullname);
oauthRetrofit.create(RedditAPI.class).unsave(APIUtils.getOAuthHeader(accessToken), params).enqueue(new Callback<String>() {
@Override
public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) {
if (response.isSuccessful()) {
saveThingListener.success();
} else {
saveThingListener.failed();
}
}
@Override
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
saveThingListener.failed();
}
});
}
void unsaveThing(Retrofit oauthRetrofit, String accessToken, int id,
SaveThingListener saveThingListener);
public interface SaveThingListener {
void success();

View File

@@ -39,17 +39,10 @@ import java.util.concurrent.Executor;
import javax.inject.Inject;
import javax.inject.Named;
import eu.toldi.infinityforlemmy.RetrofitHolder;
import io.noties.markwon.AbstractMarkwonPlugin;
import io.noties.markwon.Markwon;
import io.noties.markwon.MarkwonConfiguration;
import io.noties.markwon.MarkwonPlugin;
import io.noties.markwon.core.MarkwonTheme;
import io.noties.markwon.recycler.MarkwonAdapter;
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
import eu.toldi.infinityforlemmy.Infinity;
import eu.toldi.infinityforlemmy.R;
import eu.toldi.infinityforlemmy.RedditDataRoomDatabase;
import eu.toldi.infinityforlemmy.RetrofitHolder;
import eu.toldi.infinityforlemmy.UploadImageEnabledActivity;
import eu.toldi.infinityforlemmy.UploadedImage;
import eu.toldi.infinityforlemmy.account.Account;
@@ -66,6 +59,13 @@ import eu.toldi.infinityforlemmy.events.SwitchAccountEvent;
import eu.toldi.infinityforlemmy.markdown.MarkdownUtils;
import eu.toldi.infinityforlemmy.utils.SharedPreferencesUtils;
import eu.toldi.infinityforlemmy.utils.Utils;
import io.noties.markwon.AbstractMarkwonPlugin;
import io.noties.markwon.Markwon;
import io.noties.markwon.MarkwonConfiguration;
import io.noties.markwon.MarkwonPlugin;
import io.noties.markwon.core.MarkwonTheme;
import io.noties.markwon.recycler.MarkwonAdapter;
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
import retrofit2.Retrofit;
public class CommentActivity extends BaseActivity implements UploadImageEnabledActivity, AccountChooserBottomSheetFragment.AccountChooserListener {
@@ -449,10 +449,10 @@ public class CommentActivity extends BaseActivity implements UploadImageEnabledA
Toast.makeText(CommentActivity.this, R.string.error_getting_image, Toast.LENGTH_LONG).show();
return;
}
Utils.uploadImageToReddit(this, mExecutor, mRetrofit.getRetrofit(), mUploadMediaRetrofit,
Utils.uploadImageToReddit(this, mExecutor, mRetrofit,
mAccessToken, binding.commentCommentEditText, binding.commentCoordinatorLayout, data.getData(), uploadedImages);
} else if (requestCode == CAPTURE_IMAGE_REQUEST_CODE) {
Utils.uploadImageToReddit(this, mExecutor, mRetrofit.getRetrofit(), mUploadMediaRetrofit,
Utils.uploadImageToReddit(this, mExecutor, mRetrofit,
mAccessToken, binding.commentCommentEditText, binding.commentCoordinatorLayout, capturedImageUri, uploadedImages);
} else if (requestCode == MARKDOWN_PREVIEW_REQUEST_CODE) {
sendComment(mMenu == null ? null : mMenu.findItem(R.id.action_send_comment_activity));

View File

@@ -32,8 +32,6 @@ import org.greenrobot.eventbus.Subscribe;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Executor;
import javax.inject.Inject;
@@ -43,15 +41,16 @@ import butterknife.BindView;
import butterknife.ButterKnife;
import eu.toldi.infinityforlemmy.Infinity;
import eu.toldi.infinityforlemmy.R;
import eu.toldi.infinityforlemmy.RetrofitHolder;
import eu.toldi.infinityforlemmy.UploadImageEnabledActivity;
import eu.toldi.infinityforlemmy.UploadedImage;
import eu.toldi.infinityforlemmy.adapters.MarkdownBottomBarRecyclerViewAdapter;
import eu.toldi.infinityforlemmy.apis.RedditAPI;
import eu.toldi.infinityforlemmy.apis.LemmyAPI;
import eu.toldi.infinityforlemmy.bottomsheetfragments.UploadedImagesBottomSheetFragment;
import eu.toldi.infinityforlemmy.customtheme.CustomThemeWrapper;
import eu.toldi.infinityforlemmy.customviews.LinearLayoutManagerBugFixed;
import eu.toldi.infinityforlemmy.dto.EditCommentDTO;
import eu.toldi.infinityforlemmy.events.SwitchAccountEvent;
import eu.toldi.infinityforlemmy.utils.APIUtils;
import eu.toldi.infinityforlemmy.utils.SharedPreferencesUtils;
import eu.toldi.infinityforlemmy.utils.Utils;
import retrofit2.Call;
@@ -84,8 +83,8 @@ public class EditCommentActivity extends BaseActivity implements UploadImageEnab
@BindView(R.id.markdown_bottom_bar_recycler_view_edit_comment_activity)
RecyclerView markdownBottomBarRecyclerView;
@Inject
@Named("oauth")
Retrofit mOauthRetrofit;
@Named("no_oauth")
RetrofitHolder retrofit;
@Inject
@Named("upload_media")
Retrofit mUploadMediaRetrofit;
@@ -99,7 +98,7 @@ public class EditCommentActivity extends BaseActivity implements UploadImageEnab
CustomThemeWrapper mCustomThemeWrapper;
@Inject
Executor mExecutor;
private String mFullName;
private int mCommentId;
private String mAccessToken;
private String mCommentContent;
private boolean isSubmitting = false;
@@ -129,7 +128,10 @@ public class EditCommentActivity extends BaseActivity implements UploadImageEnab
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mFullName = getIntent().getStringExtra(EXTRA_FULLNAME);
mCommentId = getIntent().getIntExtra(EXTRA_FULLNAME, 0);
if (mCommentId == 0) {
finish();
}
mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null);
mCommentContent = getIntent().getStringExtra(EXTRA_CONTENT);
contentEditText.setText(mCommentContent);
@@ -225,12 +227,7 @@ public class EditCommentActivity extends BaseActivity implements UploadImageEnab
String content = contentEditText.getText().toString();
Map<String, String> params = new HashMap<>();
params.put(APIUtils.THING_ID_KEY, mFullName);
params.put(APIUtils.TEXT_KEY, content);
mOauthRetrofit.create(RedditAPI.class)
.editPostOrComment(APIUtils.getOAuthHeader(mAccessToken), params)
retrofit.getRetrofit().create(LemmyAPI.class).commentEdit(new EditCommentDTO(mCommentId, content, null, null, mAccessToken))
.enqueue(new Callback<String>() {
@Override
public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) {
@@ -278,10 +275,10 @@ public class EditCommentActivity extends BaseActivity implements UploadImageEnab
Toast.makeText(EditCommentActivity.this, R.string.error_getting_image, Toast.LENGTH_LONG).show();
return;
}
Utils.uploadImageToReddit(this, mExecutor, mOauthRetrofit, mUploadMediaRetrofit,
Utils.uploadImageToReddit(this, mExecutor, retrofit,
mAccessToken, contentEditText, coordinatorLayout, data.getData(), uploadedImages);
} else if (requestCode == CAPTURE_IMAGE_REQUEST_CODE) {
Utils.uploadImageToReddit(this, mExecutor, mOauthRetrofit, mUploadMediaRetrofit,
Utils.uploadImageToReddit(this, mExecutor, retrofit,
mAccessToken, contentEditText, coordinatorLayout, capturedImageUri, uploadedImages);
} else if (requestCode == MARKDOWN_PREVIEW_REQUEST_CODE) {
editComment();

View File

@@ -44,6 +44,7 @@ import butterknife.BindView;
import butterknife.ButterKnife;
import eu.toldi.infinityforlemmy.Infinity;
import eu.toldi.infinityforlemmy.R;
import eu.toldi.infinityforlemmy.RetrofitHolder;
import eu.toldi.infinityforlemmy.UploadImageEnabledActivity;
import eu.toldi.infinityforlemmy.UploadedImage;
import eu.toldi.infinityforlemmy.adapters.MarkdownBottomBarRecyclerViewAdapter;
@@ -88,8 +89,8 @@ public class EditPostActivity extends BaseActivity implements UploadImageEnabled
@BindView(R.id.markdown_bottom_bar_recycler_view_edit_post_activity)
RecyclerView markdownBottomBarRecyclerView;
@Inject
@Named("oauth")
Retrofit mOauthRetrofit;
@Named("no_oauth")
RetrofitHolder mRetrofit;
@Inject
@Named("upload_media")
Retrofit mUploadMediaRetrofit;
@@ -241,7 +242,7 @@ public class EditPostActivity extends BaseActivity implements UploadImageEnabled
params.put(APIUtils.THING_ID_KEY, mFullName);
params.put(APIUtils.TEXT_KEY, contentEditText.getText().toString());
mOauthRetrofit.create(RedditAPI.class)
mRetrofit.getRetrofit().create(RedditAPI.class)
.editPostOrComment(APIUtils.getOAuthHeader(mAccessToken), params)
.enqueue(new Callback<String>() {
@Override
@@ -272,10 +273,10 @@ public class EditPostActivity extends BaseActivity implements UploadImageEnabled
Toast.makeText(EditPostActivity.this, R.string.error_getting_image, Toast.LENGTH_LONG).show();
return;
}
Utils.uploadImageToReddit(this, mExecutor, mOauthRetrofit, mUploadMediaRetrofit,
Utils.uploadImageToReddit(this, mExecutor, mRetrofit,
mAccessToken, contentEditText, coordinatorLayout, data.getData(), uploadedImages);
} else if (requestCode == CAPTURE_IMAGE_REQUEST_CODE) {
Utils.uploadImageToReddit(this, mExecutor, mOauthRetrofit, mUploadMediaRetrofit,
Utils.uploadImageToReddit(this, mExecutor, mRetrofit,
mAccessToken, contentEditText, coordinatorLayout, capturedImageUri, uploadedImages);
} else if (requestCode == MARKDOWN_PREVIEW_REQUEST_CODE) {
editPost();

View File

@@ -71,7 +71,6 @@ import javax.inject.Named;
import butterknife.BindView;
import butterknife.ButterKnife;
import eu.toldi.infinityforlemmy.ActivityToolbarInterface;
import eu.toldi.infinityforlemmy.FetchMyInfo;
import eu.toldi.infinityforlemmy.FetchSubscribedThing;
import eu.toldi.infinityforlemmy.Infinity;
import eu.toldi.infinityforlemmy.MarkPostAsReadInterface;
@@ -1406,7 +1405,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
if (i == EditorInfo.IME_ACTION_DONE) {
Utils.hideKeyboard(this);
Intent subredditIntent = new Intent(this, ViewSubredditDetailActivity.class);
subredditIntent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, thingEditText.getText().toString());
subredditIntent.putExtra(ViewSubredditDetailActivity.EXTRA_COMMUNITY_FULL_NAME_KEY, thingEditText.getText().toString());
startActivity(subredditIntent);
return true;
}
@@ -1464,7 +1463,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
-> {
Utils.hideKeyboard(this);
Intent subredditIntent = new Intent(this, ViewSubredditDetailActivity.class);
subredditIntent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, thingEditText.getText().toString());
subredditIntent.putExtra(ViewSubredditDetailActivity.EXTRA_COMMUNITY_FULL_NAME_KEY, thingEditText.getText().toString());
startActivity(subredditIntent);
})
.setNegativeButton(R.string.cancel, (dialogInterface, i) -> {
@@ -1485,7 +1484,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
if (i == EditorInfo.IME_ACTION_DONE) {
Utils.hideKeyboard(this);
Intent userIntent = new Intent(this, ViewUserDetailActivity.class);
userIntent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, thingEditText.getText().toString());
userIntent.putExtra(ViewUserDetailActivity.EXTRA_QUALIFIED_USER_NAME_KEY, thingEditText.getText().toString());
startActivity(userIntent);
return true;
}
@@ -1498,7 +1497,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
-> {
Utils.hideKeyboard(this);
Intent userIntent = new Intent(this, ViewUserDetailActivity.class);
userIntent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, thingEditText.getText().toString());
userIntent.putExtra(ViewUserDetailActivity.EXTRA_QUALIFIED_USER_NAME_KEY, thingEditText.getText().toString());
startActivity(userIntent);
})
.setNegativeButton(R.string.cancel, (dialogInterface, i) -> {

View File

@@ -492,7 +492,7 @@ public class PostGalleryActivity extends BaseActivity implements FlairBottomShee
mExecutor.execute(() -> {
try {
Bitmap resource = Glide.with(PostGalleryActivity.this).asBitmap().load(imageUri).submit().get();
String response = UploadImageUtils.uploadImage(mOauthRetrofit, mUploadMediaRetrofit, mAccessToken, resource, true);
String response = UploadImageUtils.uploadImage(mRetrofit, mAccessToken, resource, true);
String mediaId = new JSONObject(response).getJSONObject(JSONUtils.ASSET_KEY).getString(JSONUtils.ASSET_ID_KEY);
handler.post(() -> {
adapter.setImageAsUploaded(mediaId);

View File

@@ -637,10 +637,10 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr
Toast.makeText(PostTextActivity.this, R.string.error_getting_image, Toast.LENGTH_LONG).show();
return;
}
Utils.uploadImageToReddit(this, mExecutor, mOauthRetrofit, mUploadMediaRetrofit,
Utils.uploadImageToReddit(this, mExecutor, mRetrofit,
mAccessToken, contentEditText, coordinatorLayout, data.getData(), uploadedImages);
} else if (requestCode == CAPTURE_IMAGE_REQUEST_CODE) {
Utils.uploadImageToReddit(this, mExecutor, mOauthRetrofit, mUploadMediaRetrofit,
Utils.uploadImageToReddit(this, mExecutor, mRetrofit,
mAccessToken, contentEditText, coordinatorLayout, capturedImageUri, uploadedImages);
} else if (requestCode == MARKDOWN_PREVIEW_REQUEST_CODE) {
submitPost(mMenu.findItem(R.id.action_send_post_text_activity));

View File

@@ -788,7 +788,7 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect
bundle.putString(SubredditListingFragment.EXTRA_QUERY, mQuery);
bundle.putBoolean(SubredditListingFragment.EXTRA_IS_GETTING_SUBREDDIT_INFO, false);
bundle.putString(SubredditListingFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
bundle.putString(SubredditListingFragment.EXTRA_ACCOUNT_NAME, mAccountName);
bundle.putString(SubredditListingFragment.EXTRA_ACCOUNT_NAME, mAccountQualifiedName);
mFragment.setArguments(bundle);
return mFragment;
}

View File

@@ -64,6 +64,8 @@ public class SearchSubredditsResultActivity extends BaseActivity implements Acti
private String mAccessToken;
private String mAccountName;
private String mAccountQualifiedName;
@Override
protected void onCreate(Bundle savedInstanceState) {
((Infinity) getApplication()).getAppComponent().inject(this);
@@ -107,6 +109,7 @@ public class SearchSubredditsResultActivity extends BaseActivity implements Acti
mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null);
mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, null);
mAccountQualifiedName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_QUALIFIED_NAME, null);
if (savedInstanceState == null) {
mFragment = new SubredditListingFragment();
@@ -114,7 +117,7 @@ public class SearchSubredditsResultActivity extends BaseActivity implements Acti
bundle.putString(SubredditListingFragment.EXTRA_QUERY, query);
bundle.putBoolean(SubredditListingFragment.EXTRA_IS_GETTING_SUBREDDIT_INFO, true);
bundle.putString(SubredditListingFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
bundle.putString(SubredditListingFragment.EXTRA_ACCOUNT_NAME, mAccountName);
bundle.putString(SubredditListingFragment.EXTRA_ACCOUNT_NAME, mAccountQualifiedName);
bundle.putBoolean(SubredditListingFragment.EXTRA_IS_MULTI_SELECTION, getIntent().getBooleanExtra(EXTRA_IS_MULTI_SELECTION, false));
mFragment.setArguments(bundle);
} else {

View File

@@ -63,6 +63,7 @@ import eu.toldi.infinityforlemmy.LoadingMorePostsStatus;
import eu.toldi.infinityforlemmy.R;
import eu.toldi.infinityforlemmy.RedditDataRoomDatabase;
import eu.toldi.infinityforlemmy.RetrofitHolder;
import eu.toldi.infinityforlemmy.SaveComment;
import eu.toldi.infinityforlemmy.SaveThing;
import eu.toldi.infinityforlemmy.SortType;
import eu.toldi.infinityforlemmy.SortTypeSelectionCallback;
@@ -443,9 +444,10 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele
}
public void saveComment(@NonNull Comment comment, int position) {
SaveComment saveComment = new SaveComment();
if (comment.isSaved()) {
comment.setSaved(false);
SaveThing.unsaveThing(mOauthRetrofit, mAccessToken, comment.getFullName(), new SaveThing.SaveThingListener() {
saveComment.unsaveThing(mOauthRetrofit, mAccessToken, comment.getId(), new SaveThing.SaveThingListener() {
@Override
public void success() {
ViewPostDetailFragment fragment = sectionsPagerAdapter.getCurrentFragment();
@@ -466,7 +468,7 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele
});
} else {
comment.setSaved(true);
SaveThing.saveThing(mOauthRetrofit, mAccessToken, comment.getFullName(), new SaveThing.SaveThingListener() {
saveComment.saveThing(mOauthRetrofit, mAccessToken, comment.getId(), new SaveThing.SaveThingListener() {
@Override
public void success() {
ViewPostDetailFragment fragment = sectionsPagerAdapter.getCurrentFragment();

View File

@@ -96,10 +96,10 @@ import eu.toldi.infinityforlemmy.multireddit.MultiReddit;
import eu.toldi.infinityforlemmy.post.Post;
import eu.toldi.infinityforlemmy.post.PostPagingSource;
import eu.toldi.infinityforlemmy.readpost.InsertReadPost;
import eu.toldi.infinityforlemmy.subreddit.CommunitySubscription;
import eu.toldi.infinityforlemmy.subreddit.FetchSubredditData;
import eu.toldi.infinityforlemmy.subreddit.ParseSubredditData;
import eu.toldi.infinityforlemmy.subreddit.SubredditData;
import eu.toldi.infinityforlemmy.subreddit.SubredditSubscription;
import eu.toldi.infinityforlemmy.subreddit.SubredditViewModel;
import eu.toldi.infinityforlemmy.utils.APIUtils;
import eu.toldi.infinityforlemmy.utils.LemmyUtils;
@@ -116,7 +116,6 @@ import pl.droidsonroids.gif.GifImageView;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
public class ViewSubredditDetailActivity extends BaseActivity implements SortTypeSelectionCallback,
PostTypeBottomSheetFragment.PostTypeSelectionCallback, PostLayoutBottomSheetFragment.PostLayoutSelectionCallback,
@@ -174,9 +173,6 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
@Named("no_oauth")
RetrofitHolder mRetrofit;
@Inject
@Named("oauth")
Retrofit mOauthRetrofit;
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
@Inject
@Named("default")
@@ -207,7 +203,9 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
private String mAccessToken;
private String mAccountName;
private String mAccountQualifiedName;
private String subredditName;
private String communityName;
private int communityId;
private String description;
private String qualifiedName;
@@ -340,8 +338,8 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
lockBottomAppBar = mSharedPreferences.getBoolean(SharedPreferencesUtils.LOCK_BOTTOM_APP_BAR, false);
hideSubredditDescription = mSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_SUBREDDIT_DESCRIPTION, false);
subredditName = getIntent().getStringExtra(EXTRA_SUBREDDIT_NAME_KEY);
qualifiedName = getIntent().getStringExtra(EXTRA_COMMUNITY_FULL_NAME_KEY);
communityName = getIntent().getStringExtra(EXTRA_SUBREDDIT_NAME_KEY);
qualifiedName = getIntent().getStringExtra(EXTRA_COMMUNITY_FULL_NAME_KEY);
fragmentManager = getSupportFragmentManager();
@@ -366,7 +364,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
checkNewAccountAndBindView();
fetchSubredditData();
if (subredditName != null) {
if (communityName != null) {
setupVisibleElements();
}
}
@@ -457,10 +455,10 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
}
private void setupVisibleElements() {
subredditNameTextView.setText(subredditName);
subredditNameTextView.setText(communityName);
communityFullNameTextView.setText(qualifiedName);
toolbar.setTitle(subredditName);
toolbar.setTitle(communityName);
setSupportActionBar(toolbar);
setToolbarGoToTop(toolbar);
@@ -514,8 +512,8 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
bannerImageView.setOnClickListener(view -> {
Intent intent = new Intent(ViewSubredditDetailActivity.this, ViewImageOrGifActivity.class);
intent.putExtra(ViewImageOrGifActivity.EXTRA_IMAGE_URL_KEY, subredditData.getBannerUrl());
intent.putExtra(ViewImageOrGifActivity.EXTRA_FILE_NAME_KEY, subredditName + "-banner.jpg");
intent.putExtra(ViewImageOrGifActivity.EXTRA_SUBREDDIT_OR_USERNAME_KEY, subredditName);
intent.putExtra(ViewImageOrGifActivity.EXTRA_FILE_NAME_KEY, communityName + "-banner.jpg");
intent.putExtra(ViewImageOrGifActivity.EXTRA_SUBREDDIT_OR_USERNAME_KEY, communityName);
startActivity(intent);
});
}
@@ -534,14 +532,14 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
iconGifImageView.setOnClickListener(view -> {
Intent intent = new Intent(ViewSubredditDetailActivity.this, ViewImageOrGifActivity.class);
intent.putExtra(ViewImageOrGifActivity.EXTRA_IMAGE_URL_KEY, subredditData.getIconUrl());
intent.putExtra(ViewImageOrGifActivity.EXTRA_FILE_NAME_KEY, subredditName + "-icon.jpg");
intent.putExtra(ViewImageOrGifActivity.EXTRA_SUBREDDIT_OR_USERNAME_KEY, subredditName);
intent.putExtra(ViewImageOrGifActivity.EXTRA_FILE_NAME_KEY, communityName + "-icon.jpg");
intent.putExtra(ViewImageOrGifActivity.EXTRA_SUBREDDIT_OR_USERNAME_KEY, communityName);
startActivity(intent);
});
}
String subredditFullName = subredditData.getTitle();
if (!subredditName.equals(subredditFullName)) {
if (!communityName.equals(subredditFullName)) {
getSupportActionBar().setTitle(subredditFullName);
}
subredditNameTextView.setText(subredditFullName);
@@ -577,21 +575,130 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
});
}
private void setupSubscribeChip() {
subscribeSubredditChip.setOnClickListener(view -> {
if (mAccessToken == null) {
if (subscriptionReady) {
subscriptionReady = false;
if (getResources().getString(R.string.subscribe).contentEquals(subscribeSubredditChip.getText())) {
CommunitySubscription.anonymousSubscribeToSubreddit(mExecutor, new Handler(),
mRetrofit.getRetrofit(), mRedditDataRoomDatabase, communityName,
new CommunitySubscription.SubredditSubscriptionListener() {
@Override
public void onSubredditSubscriptionSuccess() {
subscribeSubredditChip.setText(R.string.unsubscribe);
subscribeSubredditChip.setChipBackgroundColor(ColorStateList.valueOf(subscribedColor));
makeSnackbar(R.string.subscribed, false);
subscriptionReady = true;
}
@Override
public void onSubredditSubscriptionFail() {
makeSnackbar(R.string.subscribe_failed, false);
subscriptionReady = true;
}
});
} else {
CommunitySubscription.anonymousUnsubscribeToSubreddit(mExecutor, new Handler(),
mRedditDataRoomDatabase, communityName,
new CommunitySubscription.SubredditSubscriptionListener() {
@Override
public void onSubredditSubscriptionSuccess() {
subscribeSubredditChip.setText(R.string.subscribe);
subscribeSubredditChip.setChipBackgroundColor(ColorStateList.valueOf(unsubscribedColor));
makeSnackbar(R.string.unsubscribed, false);
subscriptionReady = true;
}
@Override
public void onSubredditSubscriptionFail() {
makeSnackbar(R.string.unsubscribe_failed, false);
subscriptionReady = true;
}
});
}
}
} else {
if (subscriptionReady) {
subscriptionReady = false;
if (getResources().getString(R.string.subscribe).contentEquals(subscribeSubredditChip.getText())) {
CommunitySubscription.subscribeToCommunity(mExecutor, new Handler(),
mRetrofit.getRetrofit(), mAccessToken, communityId, qualifiedName, mAccountQualifiedName, mRedditDataRoomDatabase,
new CommunitySubscription.SubredditSubscriptionListener() {
@Override
public void onSubredditSubscriptionSuccess() {
subscribeSubredditChip.setText(R.string.unsubscribe);
subscribeSubredditChip.setChipBackgroundColor(ColorStateList.valueOf(subscribedColor));
makeSnackbar(R.string.subscribed, false);
subscriptionReady = true;
}
@Override
public void onSubredditSubscriptionFail() {
makeSnackbar(R.string.subscribe_failed, false);
subscriptionReady = true;
}
});
} else {
CommunitySubscription.unsubscribeToCommunity(mExecutor, new Handler(),
mRetrofit.getRetrofit(), mAccessToken, communityId, qualifiedName, mAccountName, mRedditDataRoomDatabase,
new CommunitySubscription.SubredditSubscriptionListener() {
@Override
public void onSubredditSubscriptionSuccess() {
subscribeSubredditChip.setText(R.string.subscribe);
subscribeSubredditChip.setChipBackgroundColor(ColorStateList.valueOf(unsubscribedColor));
makeSnackbar(R.string.unsubscribed, false);
subscriptionReady = true;
}
@Override
public void onSubredditSubscriptionFail() {
makeSnackbar(R.string.unsubscribe_failed, false);
subscriptionReady = true;
}
});
}
}
}
});
CheckIsSubscribedToSubreddit.checkIsSubscribedToSubreddit(mExecutor, new Handler(),
mRedditDataRoomDatabase, qualifiedName, mAccountQualifiedName,
new CheckIsSubscribedToSubreddit.CheckIsSubscribedToSubredditListener() {
@Override
public void isSubscribed() {
subscribeSubredditChip.setText(R.string.unsubscribe);
subscribeSubredditChip.setChipBackgroundColor(ColorStateList.valueOf(subscribedColor));
subscriptionReady = true;
}
@Override
public void isNotSubscribed() {
subscribeSubredditChip.setText(R.string.subscribe);
subscribeSubredditChip.setChipBackgroundColor(ColorStateList.valueOf(unsubscribedColor));
subscriptionReady = true;
}
});
}
private void fetchSubredditData() {
if (!mFetchSubredditInfoSuccess) {
FetchSubredditData.fetchSubredditData(mOauthRetrofit, mRetrofit.getRetrofit(), qualifiedName, mAccessToken, new FetchSubredditData.FetchSubredditDataListener() {
FetchSubredditData.fetchSubredditData(mRetrofit.getRetrofit(), qualifiedName, mAccessToken, new FetchSubredditData.FetchSubredditDataListener() {
@Override
public void onFetchSubredditDataSuccess(SubredditData subredditData, int nCurrentOnlineSubscribers) {
qualifiedName = LemmyUtils.actorID2FullName(subredditData.getActorId());
if (subredditName == null) {
subredditName = subredditData.getTitle();
public void onFetchSubredditDataSuccess(SubredditData communityData, int nCurrentOnlineSubscribers) {
qualifiedName = LemmyUtils.actorID2FullName(communityData.getActorId());
if (communityName == null) {
communityName = communityData.getTitle();
setupVisibleElements();
}
communityId = communityData.getId();
setupSubscribeChip();
mNCurrentOnlineSubscribers = nCurrentOnlineSubscribers;
nOnlineSubscribersTextView.setText(getString(R.string.online_subscribers_number_detail, nCurrentOnlineSubscribers));
InsertSubredditData.insertSubredditData(mExecutor, new Handler(), mRedditDataRoomDatabase,
subredditData, () -> mFetchSubredditInfoSuccess = true);
communityData, () -> mFetchSubredditInfoSuccess = true);
}
@Override
@@ -648,7 +755,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
}
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_SEARCH: {
Intent intent = new Intent(this, SearchActivity.class);
intent.putExtra(SearchActivity.EXTRA_SUBREDDIT_NAME, subredditName);
intent.putExtra(SearchActivity.EXTRA_SUBREDDIT_NAME, communityName);
startActivity(intent);
break;
}
@@ -762,7 +869,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
private void bindView() {
if (mMessageFullname != null) {
ReadMessage.readMessage(mOauthRetrofit, mAccessToken, mMessageFullname, new ReadMessage.ReadMessageListener() {
ReadMessage.readMessage(mRetrofit.getRetrofit(), mAccessToken, mMessageFullname, new ReadMessage.ReadMessageListener() {
@Override
public void readSuccess() {
mMessageFullname = null;
@@ -920,7 +1027,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
}
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SEARCH: {
Intent intent = new Intent(this, SearchActivity.class);
intent.putExtra(SearchActivity.EXTRA_SUBREDDIT_NAME, subredditName);
intent.putExtra(SearchActivity.EXTRA_SUBREDDIT_NAME, communityName);
startActivity(intent);
break;
}
@@ -964,109 +1071,6 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
});
navigationWrapper.floatingActionButton.setVisibility(hideFab ? View.GONE : View.VISIBLE);
subscribeSubredditChip.setOnClickListener(view -> {
if (mAccessToken == null) {
if (subscriptionReady) {
subscriptionReady = false;
if (getResources().getString(R.string.subscribe).contentEquals(subscribeSubredditChip.getText())) {
SubredditSubscription.anonymousSubscribeToSubreddit(mExecutor, new Handler(),
mRetrofit.getRetrofit(), mRedditDataRoomDatabase, subredditName,
new SubredditSubscription.SubredditSubscriptionListener() {
@Override
public void onSubredditSubscriptionSuccess() {
subscribeSubredditChip.setText(R.string.unsubscribe);
subscribeSubredditChip.setChipBackgroundColor(ColorStateList.valueOf(subscribedColor));
makeSnackbar(R.string.subscribed, false);
subscriptionReady = true;
}
@Override
public void onSubredditSubscriptionFail() {
makeSnackbar(R.string.subscribe_failed, false);
subscriptionReady = true;
}
});
} else {
SubredditSubscription.anonymousUnsubscribeToSubreddit(mExecutor, new Handler(),
mRedditDataRoomDatabase, subredditName,
new SubredditSubscription.SubredditSubscriptionListener() {
@Override
public void onSubredditSubscriptionSuccess() {
subscribeSubredditChip.setText(R.string.subscribe);
subscribeSubredditChip.setChipBackgroundColor(ColorStateList.valueOf(unsubscribedColor));
makeSnackbar(R.string.unsubscribed, false);
subscriptionReady = true;
}
@Override
public void onSubredditSubscriptionFail() {
makeSnackbar(R.string.unsubscribe_failed, false);
subscriptionReady = true;
}
});
}
}
} else {
if (subscriptionReady) {
subscriptionReady = false;
if (getResources().getString(R.string.subscribe).contentEquals(subscribeSubredditChip.getText())) {
SubredditSubscription.subscribeToSubreddit(mExecutor, new Handler(), mOauthRetrofit,
mRetrofit.getRetrofit(), mAccessToken, subredditName, mAccountName, mRedditDataRoomDatabase,
new SubredditSubscription.SubredditSubscriptionListener() {
@Override
public void onSubredditSubscriptionSuccess() {
subscribeSubredditChip.setText(R.string.unsubscribe);
subscribeSubredditChip.setChipBackgroundColor(ColorStateList.valueOf(subscribedColor));
makeSnackbar(R.string.subscribed, false);
subscriptionReady = true;
}
@Override
public void onSubredditSubscriptionFail() {
makeSnackbar(R.string.subscribe_failed, false);
subscriptionReady = true;
}
});
} else {
SubredditSubscription.unsubscribeToSubreddit(mExecutor, new Handler(), mOauthRetrofit,
mAccessToken, subredditName, mAccountName, mRedditDataRoomDatabase,
new SubredditSubscription.SubredditSubscriptionListener() {
@Override
public void onSubredditSubscriptionSuccess() {
subscribeSubredditChip.setText(R.string.subscribe);
subscribeSubredditChip.setChipBackgroundColor(ColorStateList.valueOf(unsubscribedColor));
makeSnackbar(R.string.unsubscribed, false);
subscriptionReady = true;
}
@Override
public void onSubredditSubscriptionFail() {
makeSnackbar(R.string.unsubscribe_failed, false);
subscriptionReady = true;
}
});
}
}
}
});
CheckIsSubscribedToSubreddit.checkIsSubscribedToSubreddit(mExecutor, new Handler(),
mRedditDataRoomDatabase, qualifiedName, mAccountQualifiedName,
new CheckIsSubscribedToSubreddit.CheckIsSubscribedToSubredditListener() {
@Override
public void isSubscribed() {
subscribeSubredditChip.setText(R.string.unsubscribe);
subscribeSubredditChip.setChipBackgroundColor(ColorStateList.valueOf(subscribedColor));
subscriptionReady = true;
}
@Override
public void isNotSubscribed() {
subscribeSubredditChip.setText(R.string.subscribe);
subscribeSubredditChip.setChipBackgroundColor(ColorStateList.valueOf(unsubscribedColor));
subscriptionReady = true;
}
});
sectionsPagerAdapter = new SectionsPagerAdapter(this);
viewPager2.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
@@ -1133,7 +1137,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
return true;
} else if (itemId == R.id.action_search_view_subreddit_detail_activity) {
Intent intent = new Intent(this, SearchActivity.class);
intent.putExtra(SearchActivity.EXTRA_SUBREDDIT_NAME, subredditName);
intent.putExtra(SearchActivity.EXTRA_SUBREDDIT_NAME, communityName);
intent.putExtra(SearchActivity.EXTRA_COMMUNITY_FULL_NAME, qualifiedName);
startActivity(intent);
return true;
@@ -1152,7 +1156,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
return true;
}
Intent selectUserFlairIntent = new Intent(this, SelectUserFlairActivity.class);
selectUserFlairIntent.putExtra(SelectUserFlairActivity.EXTRA_SUBREDDIT_NAME, subredditName);
selectUserFlairIntent.putExtra(SelectUserFlairActivity.EXTRA_SUBREDDIT_NAME, communityName);
startActivity(selectUserFlairIntent);
return true;
} else if (itemId == R.id.action_add_to_multireddit_view_subreddit_detail_activity) {
@@ -1164,7 +1168,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
startActivityForResult(intent, ADD_TO_MULTIREDDIT_REQUEST_CODE);
} else if (itemId == R.id.action_add_to_post_filter_view_subreddit_detail_activity) {
Intent intent = new Intent(this, PostFilterPreferenceActivity.class);
intent.putExtra(PostFilterPreferenceActivity.EXTRA_SUBREDDIT_NAME, subredditName);
intent.putExtra(PostFilterPreferenceActivity.EXTRA_SUBREDDIT_NAME, communityName);
startActivity(intent);
return true;
} else if (itemId == R.id.action_share_view_subreddit_detail_activity) {
@@ -1179,13 +1183,13 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
return true;
} else if (itemId == R.id.action_go_to_wiki_view_subreddit_detail_activity) {
Intent wikiIntent = new Intent(this, WikiActivity.class);
wikiIntent.putExtra(WikiActivity.EXTRA_SUBREDDIT_NAME, subredditName);
wikiIntent.putExtra(WikiActivity.EXTRA_SUBREDDIT_NAME, communityName);
wikiIntent.putExtra(WikiActivity.EXTRA_WIKI_PATH, "index");
startActivity(wikiIntent);
return true;
} else if (itemId == R.id.action_contact_mods_view_subreddit_detail_activity) {
Intent intent = new Intent(this, SendPrivateMessageActivity.class);
intent.putExtra(SendPrivateMessageActivity.EXTRA_RECIPIENT_USERNAME, "r/" + subredditName);
intent.putExtra(SendPrivateMessageActivity.EXTRA_RECIPIENT_USERNAME, "r/" + communityName);
startActivity(intent);
return true;
}
@@ -1199,19 +1203,19 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
if (data != null) {
MultiReddit multiReddit = data.getParcelableExtra(MultiredditSelectionActivity.EXTRA_RETURN_MULTIREDDIT);
if (multiReddit != null) {
AddSubredditOrUserToMultiReddit.addSubredditOrUserToMultiReddit(mOauthRetrofit,
mAccessToken, multiReddit.getPath(), subredditName,
AddSubredditOrUserToMultiReddit.addSubredditOrUserToMultiReddit(mRetrofit.getRetrofit(),
mAccessToken, multiReddit.getPath(), communityName,
new AddSubredditOrUserToMultiReddit.AddSubredditOrUserToMultiRedditListener() {
@Override
public void success() {
Toast.makeText(ViewSubredditDetailActivity.this,
getString(R.string.add_community_or_user_to_multireddit_success, subredditName, multiReddit.getDisplayName()), Toast.LENGTH_LONG).show();
getString(R.string.add_community_or_user_to_multireddit_success, communityName, multiReddit.getDisplayName()), Toast.LENGTH_LONG).show();
}
@Override
public void failed(int code) {
Toast.makeText(ViewSubredditDetailActivity.this,
getString(R.string.add_community_or_user_to_multireddit_failed, subredditName, multiReddit.getDisplayName()), Toast.LENGTH_LONG).show();
getString(R.string.add_community_or_user_to_multireddit_failed, communityName, multiReddit.getDisplayName()), Toast.LENGTH_LONG).show();
}
});
}
@@ -1274,39 +1278,39 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
switch (postType) {
case PostTypeBottomSheetFragment.TYPE_TEXT:
intent = new Intent(this, PostTextActivity.class);
intent.putExtra(PostTextActivity.EXTRA_SUBREDDIT_NAME, subredditName);
intent.putExtra(PostTextActivity.EXTRA_SUBREDDIT_NAME, communityName);
startActivity(intent);
break;
case PostTypeBottomSheetFragment.TYPE_LINK:
intent = new Intent(this, PostLinkActivity.class);
intent.putExtra(PostLinkActivity.EXTRA_SUBREDDIT_NAME, subredditName);
intent.putExtra(PostLinkActivity.EXTRA_SUBREDDIT_NAME, communityName);
startActivity(intent);
break;
case PostTypeBottomSheetFragment.TYPE_IMAGE:
intent = new Intent(this, PostImageActivity.class);
intent.putExtra(PostImageActivity.EXTRA_SUBREDDIT_NAME, subredditName);
intent.putExtra(PostImageActivity.EXTRA_SUBREDDIT_NAME, communityName);
startActivity(intent);
break;
case PostTypeBottomSheetFragment.TYPE_VIDEO:
intent = new Intent(this, PostVideoActivity.class);
intent.putExtra(PostVideoActivity.EXTRA_SUBREDDIT_NAME, subredditName);
intent.putExtra(PostVideoActivity.EXTRA_SUBREDDIT_NAME, communityName);
startActivity(intent);
break;
case PostTypeBottomSheetFragment.TYPE_GALLERY:
intent = new Intent(this, PostGalleryActivity.class);
intent.putExtra(PostGalleryActivity.EXTRA_SUBREDDIT_NAME, subredditName);
intent.putExtra(PostGalleryActivity.EXTRA_SUBREDDIT_NAME, communityName);
startActivity(intent);
break;
case PostTypeBottomSheetFragment.TYPE_POLL:
intent = new Intent(this, PostPollActivity.class);
intent.putExtra(PostPollActivity.EXTRA_SUBREDDIT_NAME, subredditName);
intent.putExtra(PostPollActivity.EXTRA_SUBREDDIT_NAME, communityName);
startActivity(intent);
}
}
@Override
public void postLayoutSelected(int postLayout) {
mPostLayoutSharedPreferences.edit().putInt(SharedPreferencesUtils.POST_LAYOUT_SUBREDDIT_POST_BASE + subredditName, postLayout).apply();
mPostLayoutSharedPreferences.edit().putInt(SharedPreferencesUtils.POST_LAYOUT_SUBREDDIT_POST_BASE + communityName, postLayout).apply();
sectionsPagerAdapter.changePostLayout(postLayout);
}
@@ -1382,7 +1386,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
break;
case FABMoreOptionsBottomSheetFragment.FAB_OPTION_SEARCH:
Intent intent = new Intent(this, SearchActivity.class);
intent.putExtra(SearchActivity.EXTRA_SUBREDDIT_NAME, subredditName);
intent.putExtra(SearchActivity.EXTRA_SUBREDDIT_NAME, communityName);
startActivity(intent);
break;
case FABMoreOptionsBottomSheetFragment.FAB_OPTION_GO_TO_SUBREDDIT: {
@@ -1460,7 +1464,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
if (subredditAutocompleteCall != null) {
subredditAutocompleteCall.cancel();
}
subredditAutocompleteCall = mOauthRetrofit.create(RedditAPI.class).subredditAutocomplete(APIUtils.getOAuthHeader(mAccessToken),
subredditAutocompleteCall = mRetrofit.getRetrofit().create(RedditAPI.class).subredditAutocomplete(APIUtils.getOAuthHeader(mAccessToken),
editable.toString(), nsfw);
subredditAutocompleteCall.enqueue(new Callback<String>() {
@Override
@@ -1596,7 +1600,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
SidebarFragment fragment = new SidebarFragment();
Bundle bundle = new Bundle();
bundle.putString(SidebarFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
bundle.putString(SidebarFragment.EXTRA_SUBREDDIT_NAME, subredditName);
bundle.putString(SidebarFragment.EXTRA_SUBREDDIT_NAME, communityName);
bundle.putString(SidebarFragment.EXTRA_COMMUNITY_QUALIFIED_NAME, qualifiedName);
fragment.setArguments(bundle);
return fragment;

View File

@@ -32,6 +32,7 @@ import butterknife.BindView;
import butterknife.ButterKnife;
import eu.toldi.infinityforlemmy.NetworkState;
import eu.toldi.infinityforlemmy.R;
import eu.toldi.infinityforlemmy.SaveComment;
import eu.toldi.infinityforlemmy.SaveThing;
import eu.toldi.infinityforlemmy.VoteThing;
import eu.toldi.infinityforlemmy.activities.BaseActivity;
@@ -646,9 +647,10 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
}
Comment comment = getItem(position);
if (comment != null) {
SaveComment saveComment = new SaveComment();
if (comment.isSaved()) {
comment.setSaved(false);
SaveThing.unsaveThing(mOauthRetrofit, mAccessToken, comment.getFullName(), new SaveThing.SaveThingListener() {
saveComment.unsaveThing(mOauthRetrofit, mAccessToken, comment.getId(), new SaveThing.SaveThingListener() {
@Override
public void success() {
comment.setSaved(false);
@@ -669,7 +671,7 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
});
} else {
comment.setSaved(true);
SaveThing.saveThing(mOauthRetrofit, mAccessToken, comment.getFullName(), new SaveThing.SaveThingListener() {
saveComment.saveThing(mOauthRetrofit, mAccessToken, comment.getId(), new SaveThing.SaveThingListener() {
@Override
public void success() {
comment.setSaved(true);

View File

@@ -42,6 +42,7 @@ import java.util.concurrent.Executor;
import butterknife.BindView;
import butterknife.ButterKnife;
import eu.toldi.infinityforlemmy.R;
import eu.toldi.infinityforlemmy.SaveComment;
import eu.toldi.infinityforlemmy.SaveThing;
import eu.toldi.infinityforlemmy.SortType;
import eu.toldi.infinityforlemmy.VoteThing;
@@ -391,7 +392,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
}
if (comment.getAuthorIconUrl() == null) {
mFragment.loadIcon(comment.getAuthor(), (authorName, iconUrl) -> {
mFragment.loadIcon(comment.getAuthorQualifiedName(), (authorName, iconUrl) -> {
if (authorName.equals(comment.getAuthor())) {
comment.setAuthorIconUrl(iconUrl);
}
@@ -536,7 +537,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
((CommentFullyCollapsedViewHolder) holder).usernameTextView.setText(authorWithPrefix);
if (comment.getAuthorIconUrl() == null) {
mFragment.loadIcon(comment.getAuthor(), (authorName, iconUrl) -> {
mFragment.loadIcon(comment.getAuthorQualifiedName(), (authorName, iconUrl) -> {
if (authorName.equals(comment.getAuthor())) {
comment.setAuthorIconUrl(iconUrl);
}
@@ -856,6 +857,16 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
}
}
List<Comment> newComments = new ArrayList<>();
for (int i = 0; i < comments.size(); i++) {
if (loadedComments.contains(comments.get(i).getId())) {
continue;
}
newComments.add(comments.get(i));
loadedComments.add(comments.get(i).getId());
}
comments = (ArrayList<Comment>) newComments;
int sizeBefore = mVisibleComments.size();
mVisibleComments.addAll(comments);
for (int i = 0; i < comments.size(); i++) {
@@ -1535,9 +1546,10 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
Comment comment = getCurrentComment(this);
if (comment != null) {
int position = getBindingAdapterPosition();
SaveComment saveComment = new SaveComment();
if (comment.isSaved()) {
comment.setSaved(false);
SaveThing.unsaveThing(mOauthRetrofit, mAccessToken, comment.getFullName(), new SaveThing.SaveThingListener() {
saveComment.unsaveThing(mOauthRetrofit, mAccessToken, comment.getId(), new SaveThing.SaveThingListener() {
@Override
public void success() {
comment.setSaved(false);
@@ -1558,7 +1570,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
});
} else {
comment.setSaved(true);
SaveThing.saveThing(mOauthRetrofit, mAccessToken, comment.getFullName(), new SaveThing.SaveThingListener() {
saveComment.saveThing(mOauthRetrofit, mAccessToken, comment.getId(), new SaveThing.SaveThingListener() {
@Override
public void success() {
comment.setSaved(true);
@@ -1925,4 +1937,8 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
((TextView) itemView).setTextColor(mColorAccent);
}
}
public void clearLoadedComments() {
loadedComments.clear();
}
}

View File

@@ -67,6 +67,7 @@ import eu.toldi.infinityforlemmy.FetchGfycatOrRedgifsVideoLinks;
import eu.toldi.infinityforlemmy.FetchStreamableVideo;
import eu.toldi.infinityforlemmy.R;
import eu.toldi.infinityforlemmy.SaveMemoryCenterInisdeDownsampleStrategy;
import eu.toldi.infinityforlemmy.SavePost;
import eu.toldi.infinityforlemmy.SaveThing;
import eu.toldi.infinityforlemmy.StreamableVideo;
import eu.toldi.infinityforlemmy.VoteThing;
@@ -2476,10 +2477,10 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy
Toast.makeText(mActivity, R.string.login_first, Toast.LENGTH_SHORT).show();
return;
}
SavePost savePost = new SavePost();
if (post.isSaved()) {
saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
SaveThing.unsaveThing(mOauthRetrofit, mAccessToken, post.getFullName(),
savePost.unsaveThing(mOauthRetrofit, mAccessToken, post.getId(),
new SaveThing.SaveThingListener() {
@Override
public void success() {
@@ -2503,7 +2504,7 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy
});
} else {
saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
SaveThing.saveThing(mOauthRetrofit, mAccessToken, post.getFullName(),
savePost.saveThing(mOauthRetrofit, mAccessToken, post.getId(),
new SaveThing.SaveThingListener() {
@Override
public void success() {
@@ -3804,9 +3805,10 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy
}
Post post = getItem(position);
if (post != null) {
SavePost savePost = new SavePost();
if (post.isSaved()) {
saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
SaveThing.unsaveThing(mOauthRetrofit, mAccessToken, post.getFullName(),
savePost.unsaveThing(mOauthRetrofit, mAccessToken, post.getId(),
new SaveThing.SaveThingListener() {
@Override
public void success() {
@@ -3830,7 +3832,7 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy
});
} else {
saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
SaveThing.saveThing(mOauthRetrofit, mAccessToken, post.getFullName(),
savePost.saveThing(mOauthRetrofit, mAccessToken, post.getId(),
new SaveThing.SaveThingListener() {
@Override
public void success() {

View File

@@ -31,7 +31,7 @@ public class MarkdownBottomBarRecyclerViewAdapter extends RecyclerView.Adapter<R
public static final int CODE_BLOCK = 9;
public static final int UPLOAD_IMAGE = 10;
private static final int ITEM_COUNT = 10;
private static final int ITEM_COUNT = 11;
private CustomThemeWrapper customThemeWrapper;
private ItemClickListener itemClickListener;

View File

@@ -64,6 +64,7 @@ import eu.toldi.infinityforlemmy.FetchStreamableVideo;
import eu.toldi.infinityforlemmy.R;
import eu.toldi.infinityforlemmy.RedditDataRoomDatabase;
import eu.toldi.infinityforlemmy.SaveMemoryCenterInisdeDownsampleStrategy;
import eu.toldi.infinityforlemmy.SavePost;
import eu.toldi.infinityforlemmy.SaveThing;
import eu.toldi.infinityforlemmy.StreamableVideo;
import eu.toldi.infinityforlemmy.VoteThing;
@@ -1350,10 +1351,10 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
Toast.makeText(mActivity, R.string.login_first, Toast.LENGTH_SHORT).show();
return;
}
SavePost savePost = new SavePost();
if (mPost.isSaved()) {
mSaveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
SaveThing.unsaveThing(mOauthRetrofit, mAccessToken, mPost.getFullName(),
savePost.unsaveThing(mOauthRetrofit, mAccessToken, mPost.getId(),
new SaveThing.SaveThingListener() {
@Override
public void success() {
@@ -1373,7 +1374,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
});
} else {
mSaveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
SaveThing.saveThing(mOauthRetrofit, mAccessToken, mPost.getFullName(),
savePost.saveThing(mOauthRetrofit, mAccessToken, mPost.getId(),
new SaveThing.SaveThingListener() {
@Override
public void success() {

View File

@@ -68,6 +68,7 @@ import eu.toldi.infinityforlemmy.FetchStreamableVideo;
import eu.toldi.infinityforlemmy.MarkPostAsReadInterface;
import eu.toldi.infinityforlemmy.R;
import eu.toldi.infinityforlemmy.SaveMemoryCenterInisdeDownsampleStrategy;
import eu.toldi.infinityforlemmy.SavePost;
import eu.toldi.infinityforlemmy.SaveThing;
import eu.toldi.infinityforlemmy.StreamableVideo;
import eu.toldi.infinityforlemmy.VoteThing;
@@ -2587,10 +2588,10 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
Toast.makeText(mActivity, R.string.login_first, Toast.LENGTH_SHORT).show();
return;
}
SavePost savePost = new SavePost();
if (post.isSaved()) {
saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
SaveThing.unsaveThing(mOauthRetrofit, mAccessToken, post.getFullName(),
savePost.unsaveThing(mOauthRetrofit, mAccessToken, post.getId(),
new SaveThing.SaveThingListener() {
@Override
public void success() {
@@ -2614,7 +2615,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
});
} else {
saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
SaveThing.saveThing(mOauthRetrofit, mAccessToken, post.getFullName(),
savePost.saveThing(mOauthRetrofit, mAccessToken, post.getId(),
new SaveThing.SaveThingListener() {
@Override
public void success() {
@@ -3948,9 +3949,10 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
}
Post post = getItem(position);
if (post != null) {
SavePost postSave = new SavePost();
if (post.isSaved()) {
saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
SaveThing.unsaveThing(mOauthRetrofit, mAccessToken, post.getFullName(),
postSave.unsaveThing(mOauthRetrofit, mAccessToken, post.getId(),
new SaveThing.SaveThingListener() {
@Override
public void success() {
@@ -3974,7 +3976,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
});
} else {
saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
SaveThing.saveThing(mOauthRetrofit, mAccessToken, post.getFullName(),
postSave.saveThing(mOauthRetrofit, mAccessToken, post.getId(),
new SaveThing.SaveThingListener() {
@Override
public void success() {

View File

@@ -33,8 +33,8 @@ import eu.toldi.infinityforlemmy.RedditDataRoomDatabase;
import eu.toldi.infinityforlemmy.activities.BaseActivity;
import eu.toldi.infinityforlemmy.asynctasks.CheckIsSubscribedToSubreddit;
import eu.toldi.infinityforlemmy.customtheme.CustomThemeWrapper;
import eu.toldi.infinityforlemmy.subreddit.CommunitySubscription;
import eu.toldi.infinityforlemmy.subreddit.SubredditData;
import eu.toldi.infinityforlemmy.subreddit.SubredditSubscription;
import eu.toldi.infinityforlemmy.utils.LemmyUtils;
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
import pl.droidsonroids.gif.GifImageView;
@@ -158,10 +158,10 @@ public class SubredditListingRecyclerViewAdapter extends PagedListAdapter<Subred
((DataViewHolder) holder).subscribeButton.setVisibility(View.VISIBLE);
((DataViewHolder) holder).subscribeButton.setOnClickListener(view -> {
if (accessToken != null) {
SubredditSubscription.subscribeToSubreddit(executor, new Handler(),
oauthRetrofit, retrofit, accessToken, subredditData.getName(),
CommunitySubscription.subscribeToCommunity(executor, new Handler(),
retrofit, accessToken, subredditData.getId(), LemmyUtils.actorID2FullName(subredditData.getActorId()),
accountName, redditDataRoomDatabase,
new SubredditSubscription.SubredditSubscriptionListener() {
new CommunitySubscription.SubredditSubscriptionListener() {
@Override
public void onSubredditSubscriptionSuccess() {
((DataViewHolder) holder).subscribeButton.setVisibility(View.GONE);
@@ -174,9 +174,9 @@ public class SubredditListingRecyclerViewAdapter extends PagedListAdapter<Subred
}
});
} else {
SubredditSubscription.anonymousSubscribeToSubreddit(executor, new Handler(),
CommunitySubscription.anonymousSubscribeToSubreddit(executor, new Handler(),
retrofit, redditDataRoomDatabase, subredditData.getName(),
new SubredditSubscription.SubredditSubscriptionListener() {
new CommunitySubscription.SubredditSubscriptionListener() {
@Override
public void onSubredditSubscriptionSuccess() {
((DataViewHolder) holder).subscribeButton.setVisibility(View.GONE);

View File

@@ -26,11 +26,11 @@ import java.util.concurrent.Executor;
import butterknife.BindView;
import butterknife.ButterKnife;
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
import eu.toldi.infinityforlemmy.R;
import eu.toldi.infinityforlemmy.activities.BaseActivity;
import eu.toldi.infinityforlemmy.customtheme.CustomThemeWrapper;
import eu.toldi.infinityforlemmy.utils.SharedPreferencesUtils;
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
import pl.droidsonroids.gif.GifImageView;
public class HeaderSectionRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
@@ -65,7 +65,7 @@ public class HeaderSectionRecyclerViewAdapter extends RecyclerView.Adapter<Recyc
requireAuthToAccountSection = securitySharedPreferences.getBoolean(SharedPreferencesUtils.REQUIRE_AUTHENTICATION_TO_GO_TO_ACCOUNT_SECTION_IN_NAVIGATION_DRAWER, false);
showAvatarOnTheRightInTheNavigationDrawer = sharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_AVATAR_ON_THE_RIGHT, false);
showAvatarOnTheRightInTheNavigationDrawer = navigationDrawerSharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_AVATAR_ON_THE_RIGHT, false);
this.hideKarma = navigationDrawerSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_ACCOUNT_KARMA_NAV_BAR, false);
this.hideKarma = true;
}
@NonNull

View File

@@ -5,13 +5,22 @@ import com.google.common.util.concurrent.ListenableFuture;
import eu.toldi.infinityforlemmy.dto.AccountLoginDTO;
import eu.toldi.infinityforlemmy.dto.CommentDTO;
import eu.toldi.infinityforlemmy.dto.CommentVoteDTO;
import eu.toldi.infinityforlemmy.dto.EditCommentDTO;
import eu.toldi.infinityforlemmy.dto.FollowCommunityDTO;
import eu.toldi.infinityforlemmy.dto.PostVoteDTO;
import eu.toldi.infinityforlemmy.dto.SaveCommentDTO;
import eu.toldi.infinityforlemmy.dto.SavePostDTO;
import okhttp3.MultipartBody;
import retrofit2.Call;
import retrofit2.Response;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Headers;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Part;
import retrofit2.http.Query;
public interface LemmyAPI {
@@ -66,6 +75,18 @@ public interface LemmyAPI {
@POST("api/v3/comment/like")
Call<String> commentLike(@Body CommentVoteDTO params);
@Headers("Content-Type: application/json")
@POST("api/v3/community/follow")
Call<String> communityFollow(@Body FollowCommunityDTO params);
@Headers("Content-Type: application/json")
@PUT("api/v3/post/save")
Call<String> postSave(@Body SavePostDTO params);
@Headers("Content-Type: application/json")
@PUT("api/v3/comment/save")
Call<String> commentSave(@Body SaveCommentDTO params);
@GET("api/v3/comment/list")
Call<String> getComments(
@Query("type_") String type,
@@ -112,4 +133,15 @@ public interface LemmyAPI {
@Headers("Content-Type: application/json")
@POST("api/v3/comment")
Call<String> postComment(@Body CommentDTO params);
@Headers("Content-Type: application/json")
@PUT("api/v3/comment")
Call<String> commentEdit(@Body EditCommentDTO params);
@Multipart
@POST("/pictrs/image")
Call<String> uploadImage(
@Header("Cookie") String token,
@Part MultipartBody.Part filePart
);
}

View File

@@ -23,7 +23,7 @@ public class LoadSubredditIcon {
String iconImageUrl = subredditDao.getSubredditData(subredditName).getIconUrl();
handler.post(() -> loadSubredditIconAsyncTaskListener.loadIconSuccess(iconImageUrl));
} else {
handler.post(() -> FetchSubredditData.fetchSubredditData(oauthRetrofit, retrofit, subredditName, accessToken, new FetchSubredditData.FetchSubredditDataListener() {
handler.post(() -> FetchSubredditData.fetchSubredditData(retrofit, subredditName, accessToken, new FetchSubredditData.FetchSubredditDataListener() {
@Override
public void onFetchSubredditDataSuccess(SubredditData subredditData1, int nCurrentOnlineSubscribers) {
ArrayList<SubredditData> singleSubredditDataList = new ArrayList<>();

View File

@@ -112,7 +112,7 @@ public class CommentMoreBottomSheetFragment extends LandscapeExpandedRoundedBott
editTextView.setOnClickListener(view -> {
Intent intent = new Intent(activity, EditCommentActivity.class);
intent.putExtra(EditCommentActivity.EXTRA_FULLNAME, comment.getFullName());
intent.putExtra(EditCommentActivity.EXTRA_FULLNAME, comment.getId());
intent.putExtra(EditCommentActivity.EXTRA_CONTENT, comment.getCommentMarkdown());
intent.putExtra(EditCommentActivity.EXTRA_POSITION, bundle.getInt(EXTRA_POSITION));
if (activity instanceof ViewPostDetailActivity) {

View File

@@ -290,6 +290,8 @@ public class ParseComment {
int score = countsObj.getInt("score");
int voteType = (jsonObject.isNull("my_vote")) ? 0 : jsonObject.getInt("my_vote");
if (voteType != 0)
score -= 1;
boolean isSubmitter = creatorObj.getInt("id") == postObj.getInt("creator_id");
String distinguished = commentObj.getString("distinguished");
String permalink = commentObj.getString("ap_id");

View File

@@ -0,0 +1,38 @@
package eu.toldi.infinityforlemmy.dto;
public class EditCommentDTO {
private int comment_id;
private String content;
private Integer language_id;
private String form_id;
private String auth;
public EditCommentDTO(int comment_id, String content, Integer language_id, String form_id, String auth) {
this.comment_id = comment_id;
this.content = content;
this.language_id = language_id;
this.form_id = form_id;
this.auth = auth;
}
public int getComment_id() {
return comment_id;
}
public String getContent() {
return content;
}
public Integer getLanguage_id() {
return language_id;
}
public String getForm_id() {
return form_id;
}
public String getAuth() {
return auth;
}
}

View File

@@ -0,0 +1,26 @@
package eu.toldi.infinityforlemmy.dto;
public class FollowCommunityDTO {
private int community_id;
private boolean follow;
private String auth;
public FollowCommunityDTO(int community_id, boolean follow, String auth) {
this.community_id = community_id;
this.follow = follow;
this.auth = auth;
}
public int getCommunity_id() {
return community_id;
}
public boolean isFollow() {
return follow;
}
public String getAuth() {
return auth;
}
}

View File

@@ -0,0 +1,26 @@
package eu.toldi.infinityforlemmy.dto;
public class SaveCommentDTO {
private int comment_id;
private boolean save;
private String auth;
public SaveCommentDTO(int comment_id, boolean save, String auth) {
this.comment_id = comment_id;
this.save = save;
this.auth = auth;
}
public int getComment_id() {
return comment_id;
}
public boolean isSave() {
return save;
}
public String getAuth() {
return auth;
}
}

View File

@@ -0,0 +1,27 @@
package eu.toldi.infinityforlemmy.dto;
public class SavePostDTO {
private int post_id;
private boolean save;
private String auth;
public SavePostDTO(int post_id, boolean save, String auth) {
this.post_id = post_id;
this.save = save;
this.auth = auth;
}
public int getPost_id() {
return post_id;
}
public boolean isSave() {
return save;
}
public String getAuth() {
return auth;
}
}

View File

@@ -194,7 +194,7 @@ public class SidebarFragment extends Fragment {
public void fetchSubredditData() {
swipeRefreshLayout.setRefreshing(true);
FetchSubredditData.fetchSubredditData(mOauthRetrofit, mRetrofit.getRetrofit(), communityQualifiedName, mAccessToken, new FetchSubredditData.FetchSubredditDataListener() {
FetchSubredditData.fetchSubredditData(mRetrofit.getRetrofit(), communityQualifiedName, mAccessToken, new FetchSubredditData.FetchSubredditDataListener() {
@Override
public void onFetchSubredditDataSuccess(SubredditData subredditData, int nCurrentOnlineSubscribers) {
swipeRefreshLayout.setRefreshing(false);

View File

@@ -73,6 +73,7 @@ import eu.toldi.infinityforlemmy.Infinity;
import eu.toldi.infinityforlemmy.R;
import eu.toldi.infinityforlemmy.RedditDataRoomDatabase;
import eu.toldi.infinityforlemmy.RetrofitHolder;
import eu.toldi.infinityforlemmy.SavePost;
import eu.toldi.infinityforlemmy.SaveThing;
import eu.toldi.infinityforlemmy.SortType;
import eu.toldi.infinityforlemmy.activities.CommentActivity;
@@ -948,9 +949,10 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
return true;
} else if (itemId == R.id.action_save_view_post_detail_fragment) {
if (mPost != null && mAccessToken != null) {
SavePost savePost = new SavePost();
if (mPost.isSaved()) {
item.setIcon(mUnsavedIcon);
SaveThing.unsaveThing(mOauthRetrofit, mAccessToken, mPost.getFullName(),
savePost.unsaveThing(mOauthRetrofit, mAccessToken, mPost.getId(),
new SaveThing.SaveThingListener() {
@Override
public void success() {
@@ -974,7 +976,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
});
} else {
item.setIcon(mSavedIcon);
SaveThing.saveThing(mOauthRetrofit, mAccessToken, mPost.getFullName(),
savePost.saveThing(mOauthRetrofit, mAccessToken, mPost.getId(),
new SaveThing.SaveThingListener() {
@Override
public void success() {
@@ -1400,22 +1402,17 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
e.printStackTrace();
}
}
FetchSubredditData.fetchSubredditData(mOauthRetrofit, mRetrofit.getRetrofit(), mPost.getSubredditNamePrefixed(), mAccessToken,
FetchSubredditData.fetchSubredditData(mRetrofit.getRetrofit(), mPost.getSubredditNamePrefixed(), mAccessToken,
new FetchSubredditData.FetchSubredditDataListener() {
@Override
public void onFetchSubredditDataSuccess(SubredditData subredditData, int nCurrentOnlineSubscribers) {
String suggestedCommentSort = "top";
SortType.Type sortTypeType;
if (suggestedCommentSort == null || suggestedCommentSort.equals("null") || suggestedCommentSort.equals("")) {
mRespectSubredditRecommendedSortType = false;
try {
sortTypeType = SortType.Type.fromValue(suggestedCommentSort);
} catch (IllegalArgumentException e) {
e.printStackTrace();
sortTypeType = loadSortType();
} else {
try {
sortTypeType = SortType.Type.valueOf(suggestedCommentSort.toUpperCase(Locale.US));
} catch (IllegalArgumentException e) {
e.printStackTrace();
sortTypeType = loadSortType();
}
}
activity.setTitle(sortTypeType.fullName);
ViewPostDetailFragment.this.sortType = sortTypeType;
@@ -1450,6 +1447,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
@Override
public void onFetchCommentSuccess(ArrayList<Comment> expandedComments,
Integer parentId, ArrayList<Integer> children) {
isFetchingComments = false;
ViewPostDetailFragment.this.children = children;
pages_loaded++;
comments = expandedComments;
@@ -1508,8 +1506,6 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
if (changeRefreshState) {
isRefreshing = false;
}
isFetchingComments = false;
}
@Override
@@ -1535,8 +1531,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
isLoadingMoreChildren = true;
Retrofit retrofit = mAccessToken == null ? mRetrofit.getRetrofit() : mOauthRetrofit;
FetchComment.fetchComments(mExecutor, new Handler(), retrofit, mAccessToken,
FetchComment.fetchComments(mExecutor, new Handler(), mRetrofit.getRetrofit(), mAccessToken,
mPost.getId(), null, sortType, mExpandChildren, pages_loaded + 1, new FetchComment.FetchCommentListener() {
@Override
public void onFetchCommentSuccess(ArrayList<Comment> expandedComments, Integer parentId, ArrayList<Integer> children) {
@@ -1582,6 +1577,8 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
mSwipeRefreshLayout.setRefreshing(false);
if (fetchComments) {
pages_loaded = 0;
mCommentsAdapter.clearLoadedComments();
fetchCommentsRespectRecommendedSort(true);
} else {
isRefreshing = false;

View File

@@ -191,9 +191,19 @@ public class PostPagingSource extends ListenableFuturePagingSource<Integer, Post
if (newPosts == null) {
return new LoadResult.Error<>(new Exception("Error parsing posts"));
} else {
List<Post> trulyNewPosts = new ArrayList<>();
for (Post post : newPosts) {
if (!postLinkedHashSet.contains(post)) {
trulyNewPosts.add(post);
}
}
int currentPostsSize = postLinkedHashSet.size();
postLinkedHashSet.addAll(newPosts);
int nextKey = (postLinkedHashSet.size()+1) / 25+1;
postLinkedHashSet.addAll(trulyNewPosts);
int nextKey = ++page;
if (trulyNewPosts.size() == 0) {
return new LoadResult.Page<>(new ArrayList<>(), null, null);
}
if (currentPostsSize == postLinkedHashSet.size()) {
return new LoadResult.Page<>(new ArrayList<>(), null, nextKey);
} else {

View File

@@ -10,20 +10,17 @@ import org.json.JSONException;
import org.json.JSONObject;
import org.xmlpull.v1.XmlPullParserException;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Executor;
import eu.toldi.infinityforlemmy.Flair;
import eu.toldi.infinityforlemmy.RetrofitHolder;
import eu.toldi.infinityforlemmy.apis.RedditAPI;
import eu.toldi.infinityforlemmy.utils.APIUtils;
import eu.toldi.infinityforlemmy.utils.JSONUtils;
import eu.toldi.infinityforlemmy.utils.UploadImageUtils;
import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import retrofit2.Call;
import retrofit2.Response;
import retrofit2.Retrofit;
@@ -38,14 +35,14 @@ public class SubmitPost {
flair, isSpoiler, isNSFW, receivePostReplyNotifications, kind, null, submitPostListener);
}
public static void submitImagePost(Executor executor, Handler handler, Retrofit oauthRetrofit, Retrofit uploadMediaRetrofit,
public static void submitImagePost(Executor executor, Handler handler, RetrofitHolder mRetrofit,
String accessToken, String subredditName, String title, Bitmap image,
Flair flair, boolean isSpoiler, boolean isNSFW,
boolean receivePostReplyNotifications, SubmitPostListener submitPostListener) {
try {
String imageUrlOrError = UploadImageUtils.uploadImage(oauthRetrofit, uploadMediaRetrofit, accessToken, image);
String imageUrlOrError = UploadImageUtils.uploadImage(mRetrofit, accessToken, image);
if (imageUrlOrError != null && !imageUrlOrError.startsWith("Error: ")) {
submitPost(executor, handler, oauthRetrofit, accessToken,
submitPost(executor, handler, mRetrofit.getRetrofit(), accessToken,
subredditName, title, imageUrlOrError, flair, isSpoiler, isNSFW,
receivePostReplyNotifications, APIUtils.KIND_IMAGE, null, submitPostListener);
} else {
@@ -57,70 +54,6 @@ public class SubmitPost {
}
}
public static void submitVideoPost(Executor executor, Handler handler, Retrofit oauthRetrofit, Retrofit uploadMediaRetrofit,
Retrofit uploadVideoRetrofit, String accessToken,
String subredditName, String title, File buffer, String mimeType,
Bitmap posterBitmap, Flair flair, boolean isSpoiler, boolean isNSFW,
boolean receivePostReplyNotifications, SubmitPostListener submitPostListener) {
RedditAPI api = oauthRetrofit.create(RedditAPI.class);
String fileType = mimeType.substring(mimeType.indexOf("/") + 1);
Map<String, String> uploadImageParams = new HashMap<>();
uploadImageParams.put(APIUtils.FILEPATH_KEY, "post_video." + fileType);
uploadImageParams.put(APIUtils.MIMETYPE_KEY, mimeType);
Call<String> uploadImageCall = api.uploadImage(APIUtils.getOAuthHeader(accessToken), uploadImageParams);
try {
Response<String> uploadImageResponse = uploadImageCall.execute();
if (uploadImageResponse.isSuccessful()) {
Map<String, RequestBody> nameValuePairsMap = UploadImageUtils.parseJSONResponseFromAWS(uploadImageResponse.body());
RequestBody fileBody = RequestBody.create(buffer, MediaType.parse("application/octet-stream"));
MultipartBody.Part fileToUpload = MultipartBody.Part.createFormData("file", "post_video." + fileType, fileBody);
RedditAPI uploadVideoToAWSApi;
if (fileType.equals("gif")) {
uploadVideoToAWSApi = uploadMediaRetrofit.create(RedditAPI.class);
} else {
uploadVideoToAWSApi = uploadVideoRetrofit.create(RedditAPI.class);
}
Call<String> uploadMediaToAWS = uploadVideoToAWSApi.uploadMediaToAWS(nameValuePairsMap, fileToUpload);
Response<String> uploadMediaToAWSResponse = uploadMediaToAWS.execute();
if (uploadMediaToAWSResponse.isSuccessful()) {
String url = UploadImageUtils.parseXMLResponseFromAWS(uploadMediaToAWSResponse.body());
if (url == null) {
submitPostListener.submitFailed(null);
return;
}
String imageUrlOrError = UploadImageUtils.uploadImage(oauthRetrofit, uploadMediaRetrofit, accessToken, posterBitmap);
if (imageUrlOrError != null && !imageUrlOrError.startsWith("Error: ")) {
if (fileType.equals("gif")) {
submitPost(executor, handler, oauthRetrofit, accessToken,
subredditName, title, url, flair, isSpoiler, isNSFW,
receivePostReplyNotifications, APIUtils.KIND_VIDEOGIF, imageUrlOrError,
submitPostListener);
} else {
submitPost(executor, handler, oauthRetrofit, accessToken,
subredditName, title, url, flair, isSpoiler, isNSFW,
receivePostReplyNotifications, APIUtils.KIND_VIDEO, imageUrlOrError,
submitPostListener);
}
} else {
submitPostListener.submitFailed(imageUrlOrError);
}
} else {
submitPostListener.submitFailed(uploadMediaToAWSResponse.code() + " " + uploadMediaToAWSResponse.message());
}
} else {
submitPostListener.submitFailed(uploadImageResponse.code() + " " + uploadImageResponse.message());
}
} catch (IOException | XmlPullParserException | JSONException e) {
e.printStackTrace();
submitPostListener.submitFailed(e.getMessage());
}
}
public static void submitCrosspost(Executor executor, Handler handler, Retrofit oauthRetrofit, String accessToken,
String subredditName, String title, String crosspostFullname,
Flair flair, boolean isSpoiler, boolean isNSFW,

View File

@@ -28,7 +28,6 @@ import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -55,7 +54,6 @@ import eu.toldi.infinityforlemmy.events.SubmitGalleryPostEvent;
import eu.toldi.infinityforlemmy.events.SubmitImagePostEvent;
import eu.toldi.infinityforlemmy.events.SubmitPollPostEvent;
import eu.toldi.infinityforlemmy.events.SubmitTextOrLinkPostEvent;
import eu.toldi.infinityforlemmy.events.SubmitVideoOrGifPostEvent;
import eu.toldi.infinityforlemmy.post.Post;
import eu.toldi.infinityforlemmy.post.SubmitPost;
import eu.toldi.infinityforlemmy.utils.APIUtils;
@@ -157,11 +155,7 @@ public class SubmitPostService extends Service {
flair, isSpoiler, isNSFW, receivePostReplyNotifications);
} else if (postType == EXTRA_POST_TYPE_IMAGE) {
Uri mediaUri = Uri.parse(bundle.getString(EXTRA_MEDIA_URI));
submitImagePost(newAuthenticatorOauthRetrofit, account, mediaUri, subredditName, title, flair, isSpoiler, isNSFW,
receivePostReplyNotifications);
} else if (postType == EXTRA_POST_TYPE_VIDEO) {
Uri mediaUri = Uri.parse(bundle.getString(EXTRA_MEDIA_URI));
submitVideoPost(newAuthenticatorOauthRetrofit, account, mediaUri, subredditName, title, flair, isSpoiler, isNSFW,
submitImagePost(mRetrofit, account, mediaUri, subredditName, title, flair, isSpoiler, isNSFW,
receivePostReplyNotifications);
} else if (postType == EXTRA_POST_TYPE_GALLERY) {
submitGalleryPost(newAuthenticatorOauthRetrofit, account, bundle.getString(EXTRA_REDDIT_GALLERY_PAYLOAD));
@@ -278,11 +272,11 @@ public class SubmitPostService extends Service {
});
}
private void submitImagePost(Retrofit newAuthenticatorOauthRetrofit, Account selectedAccount, Uri mediaUri, String subredditName, String title,
private void submitImagePost(RetrofitHolder newAuthenticatorOauthRetrofit, Account selectedAccount, Uri mediaUri, String subredditName, String title,
Flair flair, boolean isSpoiler, boolean isNSFW, boolean receivePostReplyNotifications) {
try {
Bitmap resource = Glide.with(this).asBitmap().load(mediaUri).submit().get();
SubmitPost.submitImagePost(mExecutor, handler, newAuthenticatorOauthRetrofit, mUploadMediaRetrofit,
SubmitPost.submitImagePost(mExecutor, handler, newAuthenticatorOauthRetrofit,
selectedAccount.getAccessToken(), subredditName, title, resource, flair, isSpoiler, isNSFW, receivePostReplyNotifications,
new SubmitPost.SubmitPostListener() {
@Override
@@ -309,61 +303,6 @@ public class SubmitPostService extends Service {
}
}
private void submitVideoPost(Retrofit newAuthenticatorOauthRetrofit, Account selectedAccount, Uri mediaUri, String subredditName, String title,
Flair flair, boolean isSpoiler, boolean isNSFW, boolean receivePostReplyNotifications) {
try {
InputStream in = getContentResolver().openInputStream(mediaUri);
String type = getContentResolver().getType(mediaUri);
String cacheFilePath;
if (type != null && type.contains("gif")) {
cacheFilePath = getExternalCacheDir() + "/" + mediaUri.getLastPathSegment() + ".gif";
} else {
cacheFilePath = getExternalCacheDir() + "/" + mediaUri.getLastPathSegment() + ".mp4";
}
copyFileToCache(in, cacheFilePath);
Bitmap resource = Glide.with(this).asBitmap().load(mediaUri).submit().get();
if (type != null) {
SubmitPost.submitVideoPost(mExecutor, handler, newAuthenticatorOauthRetrofit, mUploadMediaRetrofit,
mUploadVideoRetrofit, selectedAccount.getAccessToken(), subredditName, title, new File(cacheFilePath),
type, resource, flair, isSpoiler, isNSFW, receivePostReplyNotifications,
new SubmitPost.SubmitPostListener() {
@Override
public void submitSuccessful(Post post) {
handler.post(() -> {
EventBus.getDefault().post(new SubmitVideoOrGifPostEvent(true, false, null));
if (type.contains("gif")) {
Toast.makeText(SubmitPostService.this, R.string.gif_is_processing, Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(SubmitPostService.this, R.string.video_is_processing, Toast.LENGTH_SHORT).show();
}
});
stopService();
}
@Override
public void submitFailed(@Nullable String errorMessage) {
handler.post(() -> EventBus.getDefault().post(new SubmitVideoOrGifPostEvent(false, false, errorMessage)));
stopService();
}
});
} else {
handler.post(() -> EventBus.getDefault().post(new SubmitVideoOrGifPostEvent(false, true, null)));
stopService();
}
} catch (IOException | InterruptedException | ExecutionException e) {
e.printStackTrace();
handler.post(() -> EventBus.getDefault().post(new SubmitVideoOrGifPostEvent(false, true, null)));
stopService();
}
}
private void submitGalleryPost(Retrofit newAuthenticatorOauthRetrofit, Account selectedAccount, String payload) {
try {

View File

@@ -4,26 +4,24 @@ import android.os.Handler;
import androidx.annotation.NonNull;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Executor;
import eu.toldi.infinityforlemmy.RedditDataRoomDatabase;
import eu.toldi.infinityforlemmy.account.Account;
import eu.toldi.infinityforlemmy.apis.RedditAPI;
import eu.toldi.infinityforlemmy.apis.LemmyAPI;
import eu.toldi.infinityforlemmy.dto.FollowCommunityDTO;
import eu.toldi.infinityforlemmy.subscribedsubreddit.SubscribedSubredditData;
import eu.toldi.infinityforlemmy.utils.APIUtils;
import eu.toldi.infinityforlemmy.utils.LemmyUtils;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Retrofit;
public class SubredditSubscription {
public static void subscribeToSubreddit(Executor executor, Handler handler, Retrofit oauthRetrofit,
Retrofit retrofit, String accessToken, String subredditName,
public class CommunitySubscription {
public static void subscribeToCommunity(Executor executor, Handler handler,
Retrofit retrofit, String accessToken, int communityId, String communityQualifiedName,
String accountName, RedditDataRoomDatabase redditDataRoomDatabase,
SubredditSubscriptionListener subredditSubscriptionListener) {
subredditSubscription(executor, handler, oauthRetrofit, retrofit, accessToken, subredditName,
communitySubscription(executor, handler, retrofit, accessToken, communityId, communityQualifiedName,
accountName, "sub", redditDataRoomDatabase, subredditSubscriptionListener);
}
@@ -31,7 +29,7 @@ public class SubredditSubscription {
RedditDataRoomDatabase redditDataRoomDatabase,
String subredditName,
SubredditSubscriptionListener subredditSubscriptionListener) {
FetchSubredditData.fetchSubredditData(null, retrofit, subredditName, "", new FetchSubredditData.FetchSubredditDataListener() {
FetchSubredditData.fetchSubredditData(retrofit, subredditName, "", new FetchSubredditData.FetchSubredditDataListener() {
@Override
public void onFetchSubredditDataSuccess(SubredditData subredditData, int nCurrentOnlineSubscribers) {
insertSubscription(executor, handler, redditDataRoomDatabase,
@@ -45,11 +43,11 @@ public class SubredditSubscription {
});
}
public static void unsubscribeToSubreddit(Executor executor, Handler handler, Retrofit oauthRetrofit,
String accessToken, String subredditName, String accountName,
public static void unsubscribeToCommunity(Executor executor, Handler handler,
Retrofit retrofit, String accessToken, int communityId, String communityQualifiedName, String accountName,
RedditDataRoomDatabase redditDataRoomDatabase,
SubredditSubscriptionListener subredditSubscriptionListener) {
subredditSubscription(executor, handler, oauthRetrofit, null, accessToken, subredditName,
communitySubscription(executor, handler, retrofit, accessToken, communityId, communityQualifiedName,
accountName, "unsub", redditDataRoomDatabase, subredditSubscriptionListener);
}
@@ -60,24 +58,21 @@ public class SubredditSubscription {
removeSubscription(executor, handler, redditDataRoomDatabase, subredditName, "-", subredditSubscriptionListener);
}
private static void subredditSubscription(Executor executor, Handler handler, Retrofit oauthRetrofit,
Retrofit retrofit, String accessToken, String subredditName,
private static void communitySubscription(Executor executor, Handler handler,
Retrofit retrofit, String accessToken, int communityId, String communityQualifiedName,
String accountName, String action,
RedditDataRoomDatabase redditDataRoomDatabase,
SubredditSubscriptionListener subredditSubscriptionListener) {
RedditAPI api = oauthRetrofit.create(RedditAPI.class);
LemmyAPI api = retrofit.create(LemmyAPI.class);
Map<String, String> params = new HashMap<>();
params.put(APIUtils.ACTION_KEY, action);
params.put(APIUtils.SR_NAME_KEY, subredditName);
Call<String> subredditSubscriptionCall = api.subredditSubscription(APIUtils.getOAuthHeader(accessToken), params);
Call<String> subredditSubscriptionCall = api.communityFollow(new FollowCommunityDTO(communityId, action.equals("sub"), accessToken));
subredditSubscriptionCall.enqueue(new Callback<String>() {
@Override
public void onResponse(@NonNull Call<String> call, @NonNull retrofit2.Response<String> response) {
if (response.isSuccessful()) {
if (action.equals("sub")) {
FetchSubredditData.fetchSubredditData(oauthRetrofit, retrofit, subredditName, accessToken, new FetchSubredditData.FetchSubredditDataListener() {
FetchSubredditData.fetchSubredditData(retrofit, communityQualifiedName, accessToken, new FetchSubredditData.FetchSubredditDataListener() {
@Override
public void onFetchSubredditDataSuccess(SubredditData subredditData, int nCurrentOnlineSubscribers) {
insertSubscription(executor, handler, redditDataRoomDatabase,
@@ -90,7 +85,7 @@ public class SubredditSubscription {
}
});
} else {
removeSubscription(executor, handler, redditDataRoomDatabase, subredditName,
removeSubscription(executor, handler, redditDataRoomDatabase, communityQualifiedName,
accountName, subredditSubscriptionListener);
}
} else {

View File

@@ -12,11 +12,11 @@ import retrofit2.Response;
import retrofit2.Retrofit;
public class FetchSubredditData {
public static void fetchSubredditData(Retrofit oauthRetrofit, Retrofit retrofit, String subredditName, String accessToken, final FetchSubredditDataListener fetchSubredditDataListener) {
public static void fetchSubredditData(Retrofit retrofit, String subredditName, String accessToken, final FetchSubredditDataListener fetchSubredditDataListener) {
LemmyAPI api = retrofit.create(LemmyAPI.class);
Call<String> subredditData;
subredditData = api.communityInfo(subredditName,accessToken);
subredditData = api.communityInfo(subredditName, accessToken);
subredditData.enqueue(new Callback<>() {
@Override

View File

@@ -21,7 +21,7 @@ public interface UserDao {
LiveData<UserData> getUserLiveData(String userName);
@Query("SELECT * FROM users WHERE actor_id = :actor_id COLLATE NOCASE LIMIT 1")
LiveData<UserData> getUserLiveDataByQualifiedName(String actor_id);
LiveData<UserData> getUserLiveDataByActorId(String actor_id);
@Query("SELECT * FROM users WHERE name = :userName COLLATE NOCASE LIMIT 1")
UserData getUserData(String userName);

View File

@@ -12,7 +12,7 @@ public class UserRepository {
UserRepository(RedditDataRoomDatabase redditDataRoomDatabase, String actor_id) {
mUserDao = redditDataRoomDatabase.userDao();
mUserLiveData = mUserDao.getUserLiveData(actor_id);
mUserLiveData = mUserDao.getUserLiveDataByActorId(actor_id);
}
LiveData<UserData> getUserLiveData() {

View File

@@ -17,55 +17,41 @@ import java.io.StringReader;
import java.util.HashMap;
import java.util.Map;
import eu.toldi.infinityforlemmy.apis.RedditAPI;
import eu.toldi.infinityforlemmy.RetrofitHolder;
import eu.toldi.infinityforlemmy.apis.LemmyAPI;
import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import retrofit2.Call;
import retrofit2.Response;
import retrofit2.Retrofit;
public class UploadImageUtils {
@Nullable
public static String uploadImage(Retrofit oauthRetrofit, Retrofit uploadMediaRetrofit,
public static String uploadImage(RetrofitHolder mRetrofit,
String accessToken, Bitmap image) throws IOException, JSONException, XmlPullParserException {
return uploadImage(oauthRetrofit, uploadMediaRetrofit, accessToken, image, false);
return uploadImage(mRetrofit, accessToken, image, false);
}
@Nullable
public static String uploadImage(Retrofit oauthRetrofit, Retrofit uploadMediaRetrofit,
String accessToken, Bitmap image, boolean returnResponseForGallerySubmission) throws IOException, JSONException, XmlPullParserException {
RedditAPI api = oauthRetrofit.create(RedditAPI.class);
public static String uploadImage(RetrofitHolder mRetrofit,
String accessToken, Bitmap image, boolean returnResponseForGallerySubmission) throws IOException, JSONException, XmlPullParserException {
Map<String, String> uploadImageParams = new HashMap<>();
uploadImageParams.put(APIUtils.FILEPATH_KEY, "post_image.jpg");
uploadImageParams.put(APIUtils.MIMETYPE_KEY, "image/jpeg");
ByteArrayOutputStream stream = new ByteArrayOutputStream();
image.compress(Bitmap.CompressFormat.JPEG, 100, stream);
byte[] byteArray = stream.toByteArray();
Call<String> uploadImageCall = api.uploadImage(APIUtils.getOAuthHeader(accessToken), uploadImageParams);
Response<String> uploadImageResponse = uploadImageCall.execute();
if (uploadImageResponse.isSuccessful()) {
Map<String, RequestBody> nameValuePairsMap = parseJSONResponseFromAWS(uploadImageResponse.body());
RequestBody fileBody = RequestBody.create(byteArray, MediaType.parse("application/octet-stream"));
MultipartBody.Part fileToUpload = MultipartBody.Part.createFormData("images[]", "post_image.jpg", fileBody);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
image.compress(Bitmap.CompressFormat.JPEG, 100, stream);
byte[] byteArray = stream.toByteArray();
RequestBody fileBody = RequestBody.create(byteArray, MediaType.parse("application/octet-stream"));
MultipartBody.Part fileToUpload = MultipartBody.Part.createFormData("file", "post_image.jpg", fileBody);
RedditAPI uploadMediaToAWSApi = uploadMediaRetrofit.create(RedditAPI.class);
Call<String> uploadMediaToAWS = uploadMediaToAWSApi.uploadMediaToAWS(nameValuePairsMap, fileToUpload);
Response<String> uploadMediaToAWSResponse = uploadMediaToAWS.execute();
if (uploadMediaToAWSResponse.isSuccessful()) {
if (returnResponseForGallerySubmission) {
return uploadImageResponse.body();
}
return parseXMLResponseFromAWS(uploadMediaToAWSResponse.body());
} else {
return "Error: " + uploadMediaToAWSResponse.code();
}
LemmyAPI api = mRetrofit.getRetrofit().create(LemmyAPI.class);
Call<String> uploadMedia = api.uploadImage("jwt=" + accessToken, fileToUpload);
Response<String> uploadMediaResponse = uploadMedia.execute();
if (uploadMediaResponse.isSuccessful()) {
JSONObject responseObject = new JSONObject(uploadMediaResponse.body());
String fileName = responseObject.getJSONArray("files").getJSONObject(0).getString("file");
return mRetrofit.getBaseURL() + "/pictrs/image/" + fileName;
} else {
return "Error: " + uploadImageResponse.message();
return "Error: " + uploadMediaResponse.code();
}
}

View File

@@ -53,11 +53,11 @@ import java.util.concurrent.Executor;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import io.noties.markwon.core.spans.CustomTypefaceSpan;
import eu.toldi.infinityforlemmy.R;
import eu.toldi.infinityforlemmy.RetrofitHolder;
import eu.toldi.infinityforlemmy.SortType;
import eu.toldi.infinityforlemmy.UploadedImage;
import retrofit2.Retrofit;
import io.noties.markwon.core.spans.CustomTypefaceSpan;
public final class Utils {
public static final int NETWORK_TYPE_OTHER = -1;
@@ -361,8 +361,8 @@ public final class Utils {
return drawable;
}
public static void uploadImageToReddit(Context context, Executor executor, Retrofit oauthRetrofit,
Retrofit uploadMediaRetrofit, String accessToken, EditText editText,
public static void uploadImageToReddit(Context context, Executor executor, RetrofitHolder retrofit,
String accessToken, EditText editText,
CoordinatorLayout coordinatorLayout, Uri imageUri,
ArrayList<UploadedImage> uploadedImages) {
Toast.makeText(context, R.string.uploading_image, Toast.LENGTH_SHORT).show();
@@ -370,7 +370,7 @@ public final class Utils {
executor.execute(() -> {
try {
Bitmap bitmap = Glide.with(context).asBitmap().load(imageUri).submit().get();
String imageUrlOrError = UploadImageUtils.uploadImage(oauthRetrofit, uploadMediaRetrofit, accessToken, bitmap);
String imageUrlOrError = UploadImageUtils.uploadImage(retrofit, accessToken, bitmap);
handler.post(() -> {
if (imageUrlOrError != null && !imageUrlOrError.startsWith("Error: ")) {
String fileName = Utils.getFileName(context, imageUri);

View File

@@ -1,54 +1,160 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="169.4dp"
android:height="141.4dp"
android:viewportWidth="169.4"
android:viewportHeight="141.4">
<path
android:pathData="M38.199,118.602L38.138,119.349C37.838,123.044 34.951,135.916 34.951,135.916L38.507,137.579C38.507,137.579 40.936,134.715 48.987,122.37L50.023,121.586L38.199,118.602Z"
android:fillColor="#009559"/>
android:pathData="M38.2,118.6L38.14,119.35C37.84,123.04 34.95,135.92 34.95,135.92L38.51,137.58C38.51,137.58 40.94,134.71 48.99,122.37L50.02,121.59L38.2,118.6Z"
android:fillColor="#dbd548" />
<path
android:pathData="M75.846,122.66L77.807,141.366L82.5,141.313L84.925,122.66L75.846,122.66Z"
android:fillColor="#009559"/>
android:pathData="M75.85,122.66L77.81,141.37L82.5,141.31L84.93,122.66L75.85,122.66Z"
android:fillColor="#dbd548" />
<path
android:pathData="M126.591,118.196L117.925,122.267L130.964,135.15L134.409,132.275L126.591,118.196Z"
android:fillColor="#009559"/>
android:pathData="M126.59,118.2L117.93,122.27L130.96,135.15L134.41,132.27L126.59,118.2Z"
android:fillColor="#dbd548" />
<path
android:pathData="M169.36,89.86C169.36,110.142 131.447,126.584 84.68,126.584C37.913,126.584 0,110.142 0,89.86C0,69.578 37.913,53.137 84.68,53.137C131.447,53.137 169.36,69.578 169.36,89.86Z"
android:fillColor="#00B57C"/>
android:pathData="M169.36,89.86C169.36,110.14 131.45,126.58 84.68,126.58C37.91,126.58 0,110.14 0,89.86C0,69.58 37.91,53.14 84.68,53.14C131.45,53.14 169.36,69.58 169.36,89.86Z"
android:fillColor="#f1ea4f" />
<path
android:pathData="M90.422,111.47C90.328,113.622 87.585,115.251 84.296,115.107C81.007,114.964 78.417,113.102 78.511,110.949C78.605,108.796 81.348,107.167 84.637,107.311C87.926,107.455 90.516,109.317 90.422,111.47Z"
android:fillColor="#645EB2"/>
android:pathData="M90.42,111.47C90.33,113.62 87.58,115.25 84.3,115.11C81.01,114.96 78.42,113.1 78.51,110.95C78.61,108.8 81.35,107.17 84.64,107.31C87.93,107.46 90.52,109.32 90.42,111.47Z"
android:fillColor="#04b5b3" />
<path
android:pathData="M128.993,107.476C128.912,109.33 126.083,110.712 122.675,110.563C119.265,110.414 116.568,108.79 116.649,106.936C116.73,105.082 119.559,103.7 122.968,103.85C126.377,103.998 129.074,105.622 128.993,107.476Z"
android:fillColor="#645EB2"/>
android:pathData="M128.99,107.48C128.91,109.33 126.08,110.71 122.68,110.56C119.26,110.41 116.57,108.79 116.65,106.94C116.73,105.08 119.56,103.7 122.97,103.85C126.38,104 129.07,105.62 128.99,107.48Z"
android:fillColor="#04b5b3" />
<path
android:pathData="M154.836,93.616C154.75,95.59 151.819,97.064 148.291,96.91C144.763,96.756 141.973,95.031 142.059,93.057C142.145,91.084 145.075,89.609 148.604,89.763C152.132,89.918 154.922,91.642 154.836,93.616Z"
android:fillColor="#645EB2"/>
android:pathData="M154.84,93.62C154.75,95.59 151.82,97.06 148.29,96.91C144.76,96.76 141.97,95.03 142.06,93.06C142.15,91.08 145.07,89.61 148.6,89.76C152.13,89.92 154.92,91.64 154.84,93.62Z"
android:fillColor="#04b5b3" />
<path
android:pathData="M43.44,105.996C43.526,104.022 46.456,102.548 49.984,102.702C53.513,102.856 56.303,104.581 56.217,106.555C56.13,108.528 53.2,110.003 49.672,109.849C46.144,109.694 43.354,107.97 43.44,105.996Z"
android:fillColor="#645EB2"/>
android:pathData="M43.44,106C43.53,104.02 46.46,102.55 49.98,102.7C53.51,102.86 56.3,104.58 56.22,106.56C56.13,108.53 53.2,110 49.67,109.85C46.14,109.69 43.35,107.97 43.44,106Z"
android:fillColor="#04b5b3" />
<path
android:pathData="M14.525,93.977C14.608,92.063 17.682,90.644 21.39,90.806C25.098,90.968 28.035,92.65 27.952,94.564C27.868,96.477 24.795,97.897 21.087,97.735C17.379,97.573 14.442,95.891 14.525,93.977Z"
android:fillColor="#645EB2"/>
android:pathData="M14.52,93.98C14.61,92.06 17.68,90.64 21.39,90.81C25.1,90.97 28.03,92.65 27.95,94.56C27.87,96.48 24.8,97.9 21.09,97.74C17.38,97.57 14.44,95.89 14.52,93.98Z"
android:fillColor="#04b5b3" />
<path
android:pathData="M84.062,97.111C66.262,97.111 45.617,93.636 23.471,83.362L23.138,83.208L23.108,82.844C23.094,82.672 21.762,65.428 28.579,46.557C33.593,32.679 43.946,15.63 65.301,5.251C82.613,-3.164 103.387,-1.522 118.349,10.589C118.876,11.016 119.403,11.458 119.927,11.916C135.893,25.86 144.782,49.219 146.349,81.347L146.367,81.715L146.054,81.911C145.69,82.137 121.009,97.111 84.062,97.111Z"
android:fillColor="#98F4ED"/>
android:pathData="M84.06,97.11C66.26,97.11 45.62,93.64 23.47,83.36L23.14,83.21L23.11,82.84C23.09,82.67 21.76,65.43 28.58,46.56C33.59,32.68 43.95,15.63 65.3,5.25C82.61,-3.16 103.39,-1.52 118.35,10.59C118.88,11.02 119.4,11.46 119.93,11.92C135.89,25.86 144.78,49.22 146.35,81.35L146.37,81.71L146.05,81.91C145.69,82.14 121.01,97.11 84.06,97.11Z"
android:fillColor="#000f44" />
<path
android:pathData="M128.431,64.821C124.241,54.604 116.516,40.949 102.949,34.717C104.034,31.924 106.031,27.559 107.143,25.166C107.239,25.177 107.334,25.191 107.433,25.189C108.544,25.169 109.428,24.251 109.407,23.14C109.386,22.029 108.469,21.146 107.358,21.166C106.247,21.187 105.363,22.105 105.384,23.216C105.394,23.774 105.632,24.274 106.006,24.632C104.895,27.017 102.916,31.342 101.8,34.206C96.796,32.114 91.026,31.027 84.38,31.449L83.964,17.33C84.737,17.049 85.292,16.315 85.292,15.445C85.292,14.334 84.391,13.433 83.281,13.433C82.169,13.433 81.268,14.334 81.268,15.445C81.268,16.356 81.878,17.117 82.709,17.364L83.127,31.558C82.643,31.602 82.165,31.636 81.673,31.696C75.498,32.445 70.169,33.859 65.526,35.742C64.048,31.651 61.872,27.584 60.631,25.398C60.948,25.035 61.141,24.562 61.131,24.043C61.11,22.932 60.193,22.048 59.082,22.069C57.971,22.09 57.087,23.007 57.108,24.118C57.129,25.229 58.046,26.113 59.157,26.092C59.292,26.09 59.423,26.072 59.549,26.045C60.775,28.212 62.924,32.241 64.359,36.217C36.951,48.109 35.332,77.364 35.765,88.447C53.262,94.817 69.601,97.111 84.062,97.111C106.644,97.111 124.631,91.519 135.297,87.117C134.255,82.183 132.172,73.941 128.431,64.821Z"
android:fillColor="#FFF0BB"/>
android:pathData="M51.69,70.02a32.61,28.34 0,1 0,65.21 0a32.61,28.34 0,1 0,-65.21 0z"
android:strokeLineJoin="round"
android:strokeWidth="1.29152"
android:strokeColor="#00000000">
<aapt:attr name="android:fillColor">
<gradient
android:startX="51.69"
android:startY="70.02"
android:endX="116.9"
android:endY="70.02"
android:type="linear">
<item
android:offset="0"
android:color="#FF496A6A" />
<item
android:offset="1"
android:color="#FF395A63" />
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M77.172,61.355C78.097,62.842 79.504,64.214 81.139,64.875C84.381,66.185 87.04,63.967 88.914,61.501C89.624,60.566 88.041,59.656 87.339,60.58C85.689,62.751 83.405,64.419 80.849,62.651C80.025,62.081 79.279,61.288 78.748,60.434C78.128,59.439 76.549,60.354 77.172,61.355Z"
android:fillColor="#032560"/>
android:pathData="M99.66,46.48a16.46,16.23 0,1 0,32.92 0a16.46,16.23 0,1 0,-32.92 0z"
android:strokeLineJoin="round"
android:strokeWidth="0.873869"
android:strokeColor="#00000000">
<aapt:attr name="android:fillColor">
<gradient
android:startX="99.66"
android:startY="46.48"
android:endX="132.59"
android:endY="46.48"
android:type="linear">
<item
android:offset="0"
android:color="#FF496A6A" />
<item
android:offset="1"
android:color="#FF395A63" />
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M71.48,50.672C71.48,51.821 70.548,52.753 69.399,52.753C68.251,52.753 67.319,51.821 67.319,50.672C67.319,49.523 68.251,48.591 69.399,48.591C70.548,48.591 71.48,49.523 71.48,50.672Z"
android:fillColor="#032560"/>
android:pathData="M106.91,54.08a10.73,11.44 106.75,1 0,18.52 -11.92a10.73,11.44 106.75,1 0,-18.52 11.92z"
android:strokeLineJoin="round"
android:strokeWidth="1.0805"
android:strokeColor="#00000000">
<aapt:attr name="android:fillColor">
<gradient
android:startX="106.52"
android:startY="54.33"
android:endX="125.81"
android:endY="41.9"
android:type="linear">
<item
android:offset="0.06"
android:color="#FFFF8684" />
<item
android:offset="0.9"
android:color="#FFFFC9C1" />
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M98.167,50.672C98.167,51.821 97.235,52.753 96.086,52.753C94.937,52.753 94.006,51.821 94.006,50.672C94.006,49.523 94.937,48.591 96.086,48.591C97.235,48.591 98.167,49.523 98.167,50.672Z"
android:fillColor="#032560"/>
android:pathData="M36.81,46.66a16.46,16.23 0,1 0,32.92 0a16.46,16.23 0,1 0,-32.92 0z"
android:strokeLineJoin="round"
android:strokeWidth="0.873869"
android:strokeColor="#00000000">
<aapt:attr name="android:fillColor">
<gradient
android:startX="36.81"
android:startY="46.66"
android:endX="69.74"
android:endY="46.66"
android:type="linear">
<item
android:offset="0"
android:color="#FF395A63" />
<item
android:offset="1"
android:color="#FF496A6A" />
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M70.092,59.487C70.092,61.525 68.216,63.177 65.902,63.177C63.588,63.177 61.712,61.525 61.712,59.487C61.712,57.449 63.588,55.798 65.902,55.798C68.216,55.798 70.092,57.449 70.092,59.487Z"
android:fillColor="#FFAB3D"/>
android:pathData="M53.45,37.54a10.57,11.61 90.26,1 0,-0.1 21.14a10.57,11.61 90.26,1 0,0.1 -21.14z"
android:strokeLineJoin="round"
android:strokeWidth="1.07946"
android:strokeColor="#00000000">
<aapt:attr name="android:fillColor">
<gradient
android:startX="53.45"
android:startY="37.1"
android:endX="53.35"
android:endY="59.13"
android:type="linear">
<item
android:offset="0.1"
android:color="#FFFFC9C1" />
<item
android:offset="0.94"
android:color="#FFFF8684" />
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M102.81,59.487C102.81,61.525 100.934,63.177 98.62,63.177C96.306,63.177 94.43,61.525 94.43,59.487C94.43,57.449 96.306,55.798 98.62,55.798C100.934,55.798 102.81,57.449 102.81,59.487Z"
android:fillColor="#FFAB3D"/>
android:pathData="M82.15,75.67a2.45,3.99 0,1 0,4.9 0a2.45,3.99 0,1 0,-4.9 0z"
android:strokeLineJoin="round"
android:strokeWidth="0.778139"
android:fillColor="#000000"
android:strokeColor="#00000000" />
<path
android:pathData="M65.4,70.69a3.54,4.31 0,1 0,7.07 0a3.54,4.31 0,1 0,-7.07 0z"
android:strokeLineJoin="round"
android:strokeWidth="0.778139"
android:fillColor="#000000"
android:strokeColor="#00000000" />
<path
android:pathData="M96.31,70.56a3.54,4.31 0,1 0,7.07 0a3.54,4.31 0,1 0,-7.07 0z"
android:strokeLineJoin="round"
android:strokeWidth="0.778139"
android:fillColor="#000000"
android:strokeColor="#00000000" />
</vector>

View File

@@ -1,35 +1,17 @@
<p>Infinity is a beautiful, feature-rich app that offers a smooth Reddit browsing experience. It is completely free and ad-less; you can browse Reddit without interruptions or distractions. Built by a passionate university student, Infinity is open source. Please check out, support or contribute to the project at https://github.com/Docile-Alligator/Infinity-For-Reddit!</p>
<h1>Infinity for Lemmy</h1>
<p>A client for Lemmy, specifically designed for Android and written in Java. This project is a fork of the Infinity for Reddit project, and it is currently in the early stages of development. As such, expect many unfinished features and potential bugs!</p>
<p>A subreddit for this app is available: https://www.reddit.com/r/Infinity_For_Reddit/</p>
<p><b>Highlighted features:</b></p>
<p><b>Lazy mode</b></p>
<p>Automatic scrolling of posts enables you to enjoy amazing content without moving your thumb.</p>
<p><b>Multi-account support</b></p>
<p>Switch to different accounts instantaneously.</p>
<p><b>Night theme</b></p>
<p>Beautifully designed night theme</p>
<p><b>Highlighted feature</b></p>
<p>Lazy mode: Automatic scrolling of posts enables you to enjoy amazing posts without moving your thumb.</p>
<p><b>Features:</b></p>
<h2>Development Progress</h2>
<ul>
<li>Browsing posts</li>
<li>View comments</li>
<li>Expand and collapse comments section</li>
<li>Vote posts and comments</li>
<li>Save posts</li>
<li>Write comments</li>
<li>Edit comments and delete comments</li>
<li>Submit posts (text, link, image and video)</li>
<li>Edit posts (mark and unmark NSFW and spoiler and edit flair) and delete posts</li>
<li>See all the subscribed subreddits and followed users</li>
<li>View the messages</li>
<li>Get notifications of unread messages</li>
<li>And much more!</li>
</ul>
<li>[x] Implementation of basic post browsing feature</li>
<li>[x] Support for multiple account handling</li>
<li>[x] Functionality for post upvotes/downvotes</li>
<li>[x] Functionality to browse comments</li>
<li>[ ] Capability for creating a new post</li>
<li>[x] Ability to create comments</li>
<li>[ ] Elimination of code/string references specific to Reddit</li>
<li>[ ] Incorporation of private messaging feature</li>
<li>[ ] Feature for saving posts</li>
<li>[ ] Account editing function</li>
<li>[ ] Multi community view?</li>
</ul>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 236 KiB

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 295 KiB

After

Width:  |  Height:  |  Size: 292 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 208 KiB

After

Width:  |  Height:  |  Size: 402 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 431 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 300 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 261 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 87 KiB

View File

@@ -1 +1 @@
A beautiful, feature-rich Lemmy client.
A Lemmy client for Android written in Java. It's a fork of the Infinity for Reddit project, currenty in early development.

View File

@@ -1 +1 @@
LemmInfinity (Infinity for Lemmy)
Infinity for Lemmy