mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-10 04:37:25 +01:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
351033600f
@ -16,11 +16,11 @@ def getCommitVersionCode = { ->
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdk 33
|
||||
compileSdk 34
|
||||
defaultConfig {
|
||||
applicationId "eu.toldi.infinityforlemmy"
|
||||
minSdk 21
|
||||
targetSdk 33
|
||||
targetSdk 34
|
||||
versionCode 128
|
||||
versionName "0.0.8"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
@ -108,6 +108,7 @@ dependencies {
|
||||
implementation 'androidx.cardview:cardview:1.0.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
implementation 'androidx.core:core-ktx:+'
|
||||
def lifecycleVersion = "2.5.1"
|
||||
implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycleVersion"
|
||||
implementation "androidx.lifecycle:lifecycle-livedata:$lifecycleVersion"
|
||||
|
@ -66,6 +66,7 @@ import eu.toldi.infinityforlemmy.activities.ViewVideoActivity;
|
||||
import eu.toldi.infinityforlemmy.activities.WebViewActivity;
|
||||
import eu.toldi.infinityforlemmy.activities.WikiActivity;
|
||||
import eu.toldi.infinityforlemmy.bottomsheetfragments.AccountChooserBottomSheetFragment;
|
||||
import eu.toldi.infinityforlemmy.bottomsheetfragments.CommentMoreBottomSheetFragment;
|
||||
import eu.toldi.infinityforlemmy.bottomsheetfragments.FlairBottomSheetFragment;
|
||||
import eu.toldi.infinityforlemmy.fragments.BlockedCommunitiesListingFragment;
|
||||
import eu.toldi.infinityforlemmy.fragments.BlockedUsersListingFragment;
|
||||
@ -76,6 +77,7 @@ import eu.toldi.infinityforlemmy.fragments.InboxFragment;
|
||||
import eu.toldi.infinityforlemmy.fragments.MorePostsInfoFragment;
|
||||
import eu.toldi.infinityforlemmy.fragments.MultiRedditListingFragment;
|
||||
import eu.toldi.infinityforlemmy.fragments.PostFragment;
|
||||
import eu.toldi.infinityforlemmy.fragments.PrivateMessageFragment;
|
||||
import eu.toldi.infinityforlemmy.fragments.SidebarFragment;
|
||||
import eu.toldi.infinityforlemmy.fragments.SubredditListingFragment;
|
||||
import eu.toldi.infinityforlemmy.fragments.SubscribedSubredditsListingFragment;
|
||||
@ -316,6 +318,9 @@ public interface AppComponent {
|
||||
|
||||
void inject(BlockedUsersListingFragment blockedUsersListingFragment);
|
||||
|
||||
void inject(CommentMoreBottomSheetFragment commentMoreBottomSheetFragment);
|
||||
|
||||
void inject(PrivateMessageFragment privateMessageFragment);
|
||||
|
||||
@Component.Factory
|
||||
interface Factory {
|
||||
|
@ -20,6 +20,7 @@ import retrofit2.Response;
|
||||
public class FetchStreamableVideo {
|
||||
public interface FetchStreamableVideoListener {
|
||||
void success(StreamableVideo streamableVideo);
|
||||
|
||||
void failed();
|
||||
}
|
||||
|
||||
@ -33,7 +34,12 @@ public class FetchStreamableVideo {
|
||||
String title = jsonObject.getString(JSONUtils.TITLE_KEY);
|
||||
JSONObject filesObject = jsonObject.getJSONObject(JSONUtils.FILES_KEY);
|
||||
StreamableVideo.Media mp4 = parseMedia(filesObject.getJSONObject(JSONUtils.MP4_KEY));
|
||||
StreamableVideo.Media mp4Mobile = parseMedia(filesObject.getJSONObject(JSONUtils.MP4_MOBILE_KEY));
|
||||
StreamableVideo.Media mp4MobileTemp = null;
|
||||
try {
|
||||
mp4MobileTemp = parseMedia(filesObject.getJSONObject(JSONUtils.MP4_MOBILE_KEY));
|
||||
} catch (JSONException e) {
|
||||
}
|
||||
StreamableVideo.Media mp4Mobile = mp4MobileTemp;
|
||||
handler.post(() -> fetchStreamableVideoListener.success(new StreamableVideo(title, mp4, mp4Mobile)));
|
||||
} else {
|
||||
handler.post(fetchStreamableVideoListener::failed);
|
||||
@ -55,7 +61,12 @@ public class FetchStreamableVideo {
|
||||
String title = jsonObject.getString(JSONUtils.TITLE_KEY);
|
||||
JSONObject filesObject = jsonObject.getJSONObject(JSONUtils.FILES_KEY);
|
||||
StreamableVideo.Media mp4 = parseMedia(filesObject.getJSONObject(JSONUtils.MP4_KEY));
|
||||
StreamableVideo.Media mp4Mobile = parseMedia(filesObject.getJSONObject(JSONUtils.MP4_MOBILE_KEY));
|
||||
StreamableVideo.Media mp4MobileTemp = null;
|
||||
try {
|
||||
mp4MobileTemp = parseMedia(filesObject.getJSONObject(JSONUtils.MP4_MOBILE_KEY));
|
||||
} catch (JSONException e) {
|
||||
}
|
||||
StreamableVideo.Media mp4Mobile = mp4MobileTemp;
|
||||
if (mp4 == null && mp4Mobile == null) {
|
||||
handler.post(fetchStreamableVideoListener::failed);
|
||||
return;
|
||||
|
@ -10,15 +10,14 @@ import javax.inject.Singleton;
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import eu.toldi.infinityforlemmy.apis.StreamableAPI;
|
||||
import eu.toldi.infinityforlemmy.network.SortTypeConverterFactory;
|
||||
import eu.toldi.infinityforlemmy.privatemessage.LemmyPrivateMessageAPI;
|
||||
import eu.toldi.infinityforlemmy.comment.LemmyCommentAPI;
|
||||
import eu.toldi.infinityforlemmy.post.LemmyPostAPI;
|
||||
import eu.toldi.infinityforlemmy.utils.APIUtils;
|
||||
import okhttp3.ConnectionPool;
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.OkHttpClient;
|
||||
import retrofit2.Retrofit;
|
||||
import retrofit2.adapter.guava.GuavaCallAdapterFactory;
|
||||
import retrofit2.converter.gson.GsonConverterFactory;
|
||||
import retrofit2.converter.scalars.ScalarsConverterFactory;
|
||||
|
||||
@Module(includes = AppModule.class)
|
||||
abstract class NetworkModule {
|
||||
@ -216,4 +215,22 @@ abstract class NetworkModule {
|
||||
static StreamableAPI provideStreamableApi(@Named("streamable") Retrofit streamableRetrofit) {
|
||||
return streamableRetrofit.create(StreamableAPI.class);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
static LemmyPostAPI providePostAPI(@Named("no_oauth") RetrofitHolder retrofitHolder) {
|
||||
return new LemmyPostAPI(retrofitHolder);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
static LemmyCommentAPI provideCommentAPI(@Named("no_oauth") RetrofitHolder retrofitHolder) {
|
||||
return new LemmyCommentAPI(retrofitHolder);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
static LemmyPrivateMessageAPI provideLemmyPrivateMessageAPI(@Named("base") RetrofitHolder retrofit) {
|
||||
return new LemmyPrivateMessageAPI(retrofit);
|
||||
}
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ class ParseSubscribedThing {
|
||||
int instanceId = community.getInt("instance_id");
|
||||
int subscribers = data.getJSONObject("counts").getInt("subscribers");
|
||||
boolean isBlocked = data.getBoolean("blocked");
|
||||
newSubscribedSubredditData.add(new SubscribedSubredditData(id, title, LemmyUtils.actorID2FullName(actorId), iconUrl, accountName));
|
||||
newSubscribedSubredditData.add(new SubscribedSubredditData(id, title, LemmyUtils.actorID2FullName(actorId), iconUrl, accountName, false));
|
||||
newSubredditData.add(new SubredditData(id, name, title, description, removed, published, updated, deleted, nsfw, actorId, local, iconUrl, bannerImageUrl, hidden, postingRestrictedToMods, instanceId, subscribers, isBlocked));
|
||||
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ import eu.toldi.infinityforlemmy.user.UserData;
|
||||
|
||||
@Database(entities = {Account.class, SubredditData.class, SubscribedSubredditData.class, UserData.class,
|
||||
SubscribedUserData.class, MultiReddit.class, CustomTheme.class, RecentSearchQuery.class,
|
||||
ReadPost.class, PostFilter.class, PostFilterUsage.class, AnonymousMultiredditSubreddit.class, BlockedUserData.class, BlockedCommunityData.class}, version = 26)
|
||||
ReadPost.class, PostFilter.class, PostFilterUsage.class, AnonymousMultiredditSubreddit.class, BlockedUserData.class, BlockedCommunityData.class}, version = 27)
|
||||
public abstract class RedditDataRoomDatabase extends RoomDatabase {
|
||||
|
||||
public static RedditDataRoomDatabase create(final Context context) {
|
||||
@ -53,7 +53,7 @@ public abstract class RedditDataRoomDatabase extends RoomDatabase {
|
||||
MIGRATION_9_10, MIGRATION_10_11, MIGRATION_11_12, MIGRATION_12_13,
|
||||
MIGRATION_13_14, MIGRATION_14_15, MIGRATION_15_16, MIGRATION_16_17,
|
||||
MIGRATION_17_18, MIGRATION_18_19, MIGRATION_19_20, MIGRATION_20_21,
|
||||
MIGRATION_21_22, MIGRATION_22_23, MIGRATION_23_24, MIGRATION_24_25, MIGRATION_25_26)
|
||||
MIGRATION_21_22, MIGRATION_22_23, MIGRATION_23_24, MIGRATION_24_25, MIGRATION_25_26, MIGRATION_26_27)
|
||||
.build();
|
||||
}
|
||||
|
||||
@ -416,4 +416,12 @@ public abstract class RedditDataRoomDatabase extends RoomDatabase {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
private static final Migration MIGRATION_26_27 = new Migration(26, 27) {
|
||||
@Override
|
||||
public void migrate(@NonNull SupportSQLiteDatabase database) {
|
||||
database.execSQL("ALTER TABLE subscribed_subreddits"
|
||||
+ " ADD COLUMN is_favorite INTEGER DEFAULT 0 NOT NULL");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -24,7 +24,11 @@ public class RetrofitHolder {
|
||||
}
|
||||
|
||||
public String getBaseURL() {
|
||||
return baseURL;
|
||||
String result = baseURL;
|
||||
if (baseURL.endsWith("/")) {
|
||||
result = baseURL.substring(0, baseURL.length() - 1);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public RetrofitHolder(OkHttpClient okHttpClient) {
|
||||
|
@ -226,7 +226,7 @@ public class CommentActivity extends BaseActivity implements UploadImageEnabledA
|
||||
|
||||
setSupportActionBar(binding.commentToolbar);
|
||||
|
||||
mGlide = Glide.with(this);
|
||||
mGlide = Glide.with(getApplication());
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
selectedAccount = savedInstanceState.getParcelable(SELECTED_ACCOUNT_STATE);
|
||||
|
@ -172,7 +172,7 @@ public class EditPostActivity extends BaseActivity implements UploadImageEnabled
|
||||
contentEditText.setText(mPost.getSelfText());
|
||||
linkEditText.setText(mPost.getUrl());
|
||||
|
||||
mGlide = Glide.with(this);
|
||||
mGlide = Glide.with(getApplication());
|
||||
|
||||
if (mPost.getUrl() != null && mPost.getUrl().matches(picturePattern)) {
|
||||
loadImage();
|
||||
@ -354,7 +354,7 @@ public class EditPostActivity extends BaseActivity implements UploadImageEnabled
|
||||
Uri imageUri = data.getData();
|
||||
mExecutor.execute(() -> {
|
||||
try {
|
||||
Bitmap bitmap = Glide.with(this).asBitmap().load(imageUri).submit().get();
|
||||
Bitmap bitmap = Glide.with(getApplication()).asBitmap().load(imageUri).submit().get();
|
||||
String imageUrlOrError = UploadImageUtils.uploadImage(mRetrofit, mAccessToken, bitmap);
|
||||
handler.post(() -> {
|
||||
if (imageUrlOrError != null && !imageUrlOrError.startsWith("Error: ")) {
|
||||
|
@ -38,7 +38,6 @@ import javax.inject.Named;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
|
||||
import eu.toldi.infinityforlemmy.Infinity;
|
||||
import eu.toldi.infinityforlemmy.R;
|
||||
import eu.toldi.infinityforlemmy.RedditDataRoomDatabase;
|
||||
@ -52,6 +51,7 @@ import eu.toldi.infinityforlemmy.user.UserViewModel;
|
||||
import eu.toldi.infinityforlemmy.utils.EditProfileUtils;
|
||||
import eu.toldi.infinityforlemmy.utils.SharedPreferencesUtils;
|
||||
import eu.toldi.infinityforlemmy.utils.Utils;
|
||||
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
|
||||
import pl.droidsonroids.gif.GifImageView;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
@ -135,7 +135,7 @@ public class EditProfileActivity extends BaseActivity {
|
||||
startPickImage(PICK_IMAGE_AVATAR_REQUEST_CODE);
|
||||
});
|
||||
|
||||
final RequestManager glide = Glide.with(this);
|
||||
final RequestManager glide = Glide.with(getApplication());
|
||||
final UserViewModel.Factory userViewModelFactory =
|
||||
new UserViewModel.Factory(getApplication(), mRedditDataRoomDatabase, mAccountName);
|
||||
final UserViewModel userViewModel =
|
||||
|
@ -29,12 +29,6 @@ import javax.inject.Named;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
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 eu.toldi.infinityforlemmy.Infinity;
|
||||
import eu.toldi.infinityforlemmy.R;
|
||||
import eu.toldi.infinityforlemmy.customtheme.CustomThemeWrapper;
|
||||
@ -45,6 +39,12 @@ import eu.toldi.infinityforlemmy.customviews.slidr.Slidr;
|
||||
import eu.toldi.infinityforlemmy.events.SwitchAccountEvent;
|
||||
import eu.toldi.infinityforlemmy.markdown.MarkdownUtils;
|
||||
import eu.toldi.infinityforlemmy.utils.SharedPreferencesUtils;
|
||||
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;
|
||||
|
||||
public class FullMarkdownActivity extends BaseActivity {
|
||||
|
||||
|
@ -55,6 +55,7 @@ import eu.toldi.infinityforlemmy.events.PassPrivateMessageEvent;
|
||||
import eu.toldi.infinityforlemmy.events.PassPrivateMessageIndexEvent;
|
||||
import eu.toldi.infinityforlemmy.events.SwitchAccountEvent;
|
||||
import eu.toldi.infinityforlemmy.fragments.InboxFragment;
|
||||
import eu.toldi.infinityforlemmy.fragments.PrivateMessageFragment;
|
||||
import eu.toldi.infinityforlemmy.message.CommentInteraction;
|
||||
import eu.toldi.infinityforlemmy.message.FetchMessage;
|
||||
import eu.toldi.infinityforlemmy.message.ReadMessage;
|
||||
@ -180,7 +181,7 @@ public class InboxActivity extends BaseActivity implements ActivityToolbarInterf
|
||||
if (i == EditorInfo.IME_ACTION_DONE) {
|
||||
Utils.hideKeyboard(this);
|
||||
Intent pmIntent = new Intent(this, SendPrivateMessageActivity.class);
|
||||
pmIntent.putExtra(SendPrivateMessageActivity.EXTRA_RECIPIENT_USERNAME, thingEditText.getText().toString());
|
||||
//pmIntent.putExtra(SendPrivateMessageActivity.EXTRA_RECIPIENT_USERNAME, thingEditText.getText().toString());
|
||||
startActivity(pmIntent);
|
||||
return true;
|
||||
}
|
||||
@ -193,7 +194,7 @@ public class InboxActivity extends BaseActivity implements ActivityToolbarInterf
|
||||
-> {
|
||||
Utils.hideKeyboard(this);
|
||||
Intent pmIntent = new Intent(this, SendPrivateMessageActivity.class);
|
||||
pmIntent.putExtra(SendPrivateMessageActivity.EXTRA_RECIPIENT_USERNAME, thingEditText.getText().toString());
|
||||
//pmIntent.putExtra(SendPrivateMessageActivity.EXTRA_RECIPIENT_USERNAME, thingEditText.getText().toString());
|
||||
startActivity(pmIntent);
|
||||
})
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
@ -330,7 +331,7 @@ public class InboxActivity extends BaseActivity implements ActivityToolbarInterf
|
||||
if (resultCode == RESULT_OK && requestCode == SEARCH_USER_REQUEST_CODE && data != null) {
|
||||
String username = data.getStringExtra(SearchActivity.EXTRA_RETURN_USER_NAME);
|
||||
Intent intent = new Intent(this, SendPrivateMessageActivity.class);
|
||||
intent.putExtra(SendPrivateMessageActivity.EXTRA_RECIPIENT_USERNAME, username);
|
||||
//intent.putExtra(SendPrivateMessageActivity.EXTRA_RECIPIENT_USERNAME, username);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
@ -441,7 +442,7 @@ public class InboxActivity extends BaseActivity implements ActivityToolbarInterf
|
||||
@NonNull
|
||||
@Override
|
||||
public Fragment createFragment(int position) {
|
||||
InboxFragment fragment = new InboxFragment();
|
||||
Fragment fragment = new InboxFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(InboxFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
|
||||
switch (position) {
|
||||
@ -450,11 +451,9 @@ public class InboxActivity extends BaseActivity implements ActivityToolbarInterf
|
||||
break;
|
||||
case 1:
|
||||
bundle.putString(InboxFragment.EXTRA_MESSAGE_WHERE, FetchMessage.WHERE_MENTIONS);
|
||||
fragment.setArguments(bundle);
|
||||
break;
|
||||
case 2:
|
||||
bundle.putString(InboxFragment.EXTRA_MESSAGE_WHERE, FetchMessage.WHERE_MESSAGES);
|
||||
fragment.setArguments(bundle);
|
||||
fragment = new PrivateMessageFragment();
|
||||
break;
|
||||
}
|
||||
fragment.setArguments(bundle);
|
||||
|
@ -1011,12 +1011,12 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
||||
sectionsPagerAdapter.setSubscribedSubreddits(subscribedSubredditData);
|
||||
}
|
||||
});
|
||||
/*subscribedSubredditViewModel.getAllFavoriteSubscribedSubreddits().observe(this, subscribedSubredditData -> {
|
||||
subscribedSubredditViewModel.getAllFavoriteSubscribedSubreddits().observe(this, subscribedSubredditData -> {
|
||||
adapter.setFavoriteSubscribedSubreddits(subscribedSubredditData);
|
||||
if (mShowFavoriteSubscribedSubreddits && sectionsPagerAdapter != null) {
|
||||
sectionsPagerAdapter.setFavoriteSubscribedSubreddits(subscribedSubredditData);
|
||||
}
|
||||
});*/
|
||||
});
|
||||
|
||||
accountViewModel = new ViewModelProvider(this,
|
||||
new AccountViewModel.Factory(mRedditDataRoomDatabase)).get(AccountViewModel.class);
|
||||
|
@ -214,7 +214,7 @@ public class PostGalleryActivity extends BaseActivity implements FlairBottomShee
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
mGlide = Glide.with(this);
|
||||
mGlide = Glide.with(getApplication());
|
||||
|
||||
mPostingSnackbar = Snackbar.make(coordinatorLayout, R.string.posting, Snackbar.LENGTH_INDEFINITE);
|
||||
|
||||
|
@ -228,7 +228,7 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
mGlide = Glide.with(this);
|
||||
mGlide = Glide.with(getApplication());
|
||||
|
||||
mPostingSnackbar = Snackbar.make(coordinatorLayout, R.string.posting, Snackbar.LENGTH_INDEFINITE);
|
||||
|
||||
|
@ -217,7 +217,7 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
mGlide = Glide.with(this);
|
||||
mGlide = Glide.with(getApplication());
|
||||
|
||||
mPostingSnackbar = Snackbar.make(coordinatorLayout, R.string.posting, Snackbar.LENGTH_INDEFINITE);
|
||||
|
||||
|
@ -219,7 +219,7 @@ public class PostPollActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
mGlide = Glide.with(this);
|
||||
mGlide = Glide.with(getApplication());
|
||||
|
||||
mPostingSnackbar = Snackbar.make(coordinatorLayout, R.string.posting, Snackbar.LENGTH_INDEFINITE);
|
||||
|
||||
|
@ -208,7 +208,7 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
mGlide = Glide.with(this);
|
||||
mGlide = Glide.with(getApplication());
|
||||
|
||||
mPostingSnackbar = Snackbar.make(coordinatorLayout, R.string.posting, Snackbar.LENGTH_INDEFINITE);
|
||||
|
||||
|
@ -216,7 +216,7 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
mGlide = Glide.with(this);
|
||||
mGlide = Glide.with(getApplication());
|
||||
|
||||
player = new ExoPlayer.Builder(this).build();
|
||||
videoPlayerView.setPlayer(player);
|
||||
|
@ -1,8 +1,13 @@
|
||||
package eu.toldi.infinityforlemmy.activities;
|
||||
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.provider.MediaStore;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
@ -10,12 +15,20 @@ import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
import androidx.core.content.FileProvider;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
@ -23,13 +36,24 @@ 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.bottomsheetfragments.UploadedImagesBottomSheetFragment;
|
||||
import eu.toldi.infinityforlemmy.customtheme.CustomThemeWrapper;
|
||||
import eu.toldi.infinityforlemmy.message.ComposeMessage;
|
||||
import eu.toldi.infinityforlemmy.customviews.LinearLayoutManagerBugFixed;
|
||||
import eu.toldi.infinityforlemmy.privatemessage.LemmyPrivateMessageAPI;
|
||||
import eu.toldi.infinityforlemmy.privatemessage.PrivateMessage;
|
||||
import eu.toldi.infinityforlemmy.user.BasicUserInfo;
|
||||
import eu.toldi.infinityforlemmy.utils.SharedPreferencesUtils;
|
||||
import retrofit2.Retrofit;
|
||||
import eu.toldi.infinityforlemmy.utils.Utils;
|
||||
|
||||
public class SendPrivateMessageActivity extends BaseActivity {
|
||||
public static final String EXTRA_RECIPIENT_USERNAME = "ERU";
|
||||
public class SendPrivateMessageActivity extends BaseActivity implements UploadImageEnabledActivity {
|
||||
public static final String EXTRA_RECIPIENT_USER_INFO = "ERUI";
|
||||
|
||||
private static final int PICK_IMAGE_REQUEST_CODE = 100;
|
||||
private static final int CAPTURE_IMAGE_REQUEST_CODE = 200;
|
||||
@BindView(R.id.coordinator_layout_send_private_message_activity)
|
||||
CoordinatorLayout coordinatorLayout;
|
||||
@BindView(R.id.appbar_layout_send_private_message_activity)
|
||||
@ -40,15 +64,20 @@ public class SendPrivateMessageActivity extends BaseActivity {
|
||||
EditText usernameEditText;
|
||||
@BindView(R.id.divider_1_send_private_message_activity)
|
||||
View divider1;
|
||||
@BindView(R.id.subjet_edit_text_send_private_message_activity)
|
||||
EditText subjectEditText;
|
||||
@BindView(R.id.divider_2_send_private_message_activity)
|
||||
View divider2;
|
||||
@BindView(R.id.content_edit_text_send_private_message_activity)
|
||||
EditText messageEditText;
|
||||
|
||||
@BindView(R.id.markdown_bottom_bar_recycler_view_send_private_message_activity)
|
||||
RecyclerView markdownBottomBarRecyclerView;
|
||||
@Inject
|
||||
@Named("oauth")
|
||||
Retrofit mOauthRetrofit;
|
||||
@Named("no_oauth")
|
||||
RetrofitHolder mRetrofit;
|
||||
|
||||
@Inject
|
||||
Executor mExecutor;
|
||||
|
||||
@Inject
|
||||
@Named("default")
|
||||
SharedPreferences mSharedPreferences;
|
||||
@ -57,15 +86,24 @@ public class SendPrivateMessageActivity extends BaseActivity {
|
||||
SharedPreferences mCurrentAccountSharedPreferences;
|
||||
@Inject
|
||||
CustomThemeWrapper mCustomThemeWrapper;
|
||||
|
||||
@Inject
|
||||
LemmyPrivateMessageAPI mLemmyPrivateMessageAPI;
|
||||
private String mAccessToken;
|
||||
|
||||
private BasicUserInfo mRecipientBasicUserInfo;
|
||||
private boolean isSubmitting = false;
|
||||
|
||||
private ArrayList<UploadedImage> uploadedImages = new ArrayList<>();
|
||||
|
||||
private Uri capturedImageUri;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
((Infinity) getApplication()).getAppComponent().inject(this);
|
||||
|
||||
setImmersiveModeNotApplicable();
|
||||
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_send_private_message);
|
||||
|
||||
@ -77,14 +115,66 @@ public class SendPrivateMessageActivity extends BaseActivity {
|
||||
addOnOffsetChangedListener(appBarLayout);
|
||||
}
|
||||
|
||||
MarkdownBottomBarRecyclerViewAdapter adapter = new MarkdownBottomBarRecyclerViewAdapter(
|
||||
mCustomThemeWrapper, new MarkdownBottomBarRecyclerViewAdapter.ItemClickListener() {
|
||||
@Override
|
||||
public void onClick(int item) {
|
||||
MarkdownBottomBarRecyclerViewAdapter.bindEditTextWithItemClickListener(
|
||||
SendPrivateMessageActivity.this, messageEditText, item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUploadImage() {
|
||||
Utils.hideKeyboard(SendPrivateMessageActivity.this);
|
||||
UploadedImagesBottomSheetFragment fragment = new UploadedImagesBottomSheetFragment();
|
||||
Bundle arguments = new Bundle();
|
||||
arguments.putParcelableArrayList(UploadedImagesBottomSheetFragment.EXTRA_UPLOADED_IMAGES,
|
||||
uploadedImages);
|
||||
fragment.setArguments(arguments);
|
||||
fragment.show(getSupportFragmentManager(), fragment.getTag());
|
||||
}
|
||||
});
|
||||
|
||||
markdownBottomBarRecyclerView.setLayoutManager(new LinearLayoutManagerBugFixed(this,
|
||||
LinearLayoutManagerBugFixed.HORIZONTAL, false));
|
||||
markdownBottomBarRecyclerView.setAdapter(adapter);
|
||||
|
||||
mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null);
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
String username = getIntent().getStringExtra(EXTRA_RECIPIENT_USERNAME);
|
||||
if (username != null) {
|
||||
usernameEditText.setText(username);
|
||||
if (savedInstanceState != null) {
|
||||
mRecipientBasicUserInfo = savedInstanceState.getParcelable(EXTRA_RECIPIENT_USER_INFO);
|
||||
} else {
|
||||
mRecipientBasicUserInfo = getIntent().getParcelableExtra(EXTRA_RECIPIENT_USER_INFO);
|
||||
}
|
||||
|
||||
if (mRecipientBasicUserInfo != null) {
|
||||
usernameEditText.setText(mRecipientBasicUserInfo.getQualifiedName());
|
||||
usernameEditText.setEnabled(false);
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (resultCode == RESULT_OK) {
|
||||
if (requestCode == PICK_IMAGE_REQUEST_CODE) {
|
||||
if (data == null) {
|
||||
Toast.makeText(SendPrivateMessageActivity.this, R.string.error_getting_image, Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
Utils.uploadImageToReddit(this, mExecutor, mRetrofit,
|
||||
mAccessToken, messageEditText, coordinatorLayout, data.getData(), uploadedImages);
|
||||
} else if (requestCode == CAPTURE_IMAGE_REQUEST_CODE) {
|
||||
Utils.uploadImageToReddit(this, mExecutor, mRetrofit,
|
||||
mAccessToken, messageEditText, coordinatorLayout, capturedImageUri, uploadedImages);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -108,12 +198,6 @@ public class SendPrivateMessageActivity extends BaseActivity {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (subjectEditText.getText() == null || subjectEditText.getText().toString().equals("")) {
|
||||
isSubmitting = false;
|
||||
Snackbar.make(coordinatorLayout, R.string.message_subject_required, Snackbar.LENGTH_LONG).show();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (messageEditText.getText() == null || messageEditText.getText().toString().equals("")) {
|
||||
isSubmitting = false;
|
||||
Snackbar.make(coordinatorLayout, R.string.message_content_required, Snackbar.LENGTH_LONG).show();
|
||||
@ -125,32 +209,26 @@ public class SendPrivateMessageActivity extends BaseActivity {
|
||||
Snackbar sendingSnackbar = Snackbar.make(coordinatorLayout, R.string.sending_message, Snackbar.LENGTH_INDEFINITE);
|
||||
sendingSnackbar.show();
|
||||
|
||||
ComposeMessage.composeMessage(mOauthRetrofit, mAccessToken, getResources().getConfiguration().locale,
|
||||
usernameEditText.getText().toString(), subjectEditText.getText().toString(),
|
||||
messageEditText.getText().toString(), new ComposeMessage.ComposeMessageListener() {
|
||||
@Override
|
||||
public void composeMessageSuccess() {
|
||||
isSubmitting = false;
|
||||
item.setEnabled(true);
|
||||
item.getIcon().setAlpha(255);
|
||||
Toast.makeText(SendPrivateMessageActivity.this, R.string.send_message_success, Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
}
|
||||
mLemmyPrivateMessageAPI.sendPrivateMessage(mAccessToken, mRecipientBasicUserInfo.getId(), messageEditText.getText().toString(), new LemmyPrivateMessageAPI.PrivateMessageSentListener() {
|
||||
@Override
|
||||
public void onPrivateMessageSentSuccess(@NonNull PrivateMessage privateMessage) {
|
||||
isSubmitting = false;
|
||||
item.setEnabled(true);
|
||||
item.getIcon().setAlpha(255);
|
||||
Toast.makeText(SendPrivateMessageActivity.this, R.string.send_message_success, Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void composeMessageFailed(String errorMessage) {
|
||||
isSubmitting = false;
|
||||
sendingSnackbar.dismiss();
|
||||
item.setEnabled(true);
|
||||
item.getIcon().setAlpha(255);
|
||||
@Override
|
||||
public void onPrivateMessageSentError() {
|
||||
isSubmitting = false;
|
||||
sendingSnackbar.dismiss();
|
||||
item.setEnabled(true);
|
||||
item.getIcon().setAlpha(255);
|
||||
|
||||
if (errorMessage == null || errorMessage.equals("")) {
|
||||
Snackbar.make(coordinatorLayout, R.string.send_message_failed, Snackbar.LENGTH_LONG).show();
|
||||
} else {
|
||||
Snackbar.make(coordinatorLayout, errorMessage, Snackbar.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
Snackbar.make(coordinatorLayout, R.string.send_message_failed, Snackbar.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@ -159,6 +237,7 @@ public class SendPrivateMessageActivity extends BaseActivity {
|
||||
@Override
|
||||
protected void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putParcelable(EXTRA_RECIPIENT_USER_INFO, mRecipientBasicUserInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -177,19 +256,49 @@ public class SendPrivateMessageActivity extends BaseActivity {
|
||||
applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, null, toolbar);
|
||||
int primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor();
|
||||
usernameEditText.setTextColor(primaryTextColor);
|
||||
subjectEditText.setTextColor(primaryTextColor);
|
||||
messageEditText.setTextColor(primaryTextColor);
|
||||
int secondaryTextColor = mCustomThemeWrapper.getSecondaryTextColor();
|
||||
usernameEditText.setHintTextColor(secondaryTextColor);
|
||||
subjectEditText.setHintTextColor(secondaryTextColor);
|
||||
messageEditText.setHintTextColor(secondaryTextColor);
|
||||
int dividerColor = mCustomThemeWrapper.getDividerColor();
|
||||
divider1.setBackgroundColor(dividerColor);
|
||||
divider2.setBackgroundColor(dividerColor);
|
||||
if (typeface != null) {
|
||||
usernameEditText.setTypeface(typeface);
|
||||
subjectEditText.setTypeface(typeface);
|
||||
messageEditText.setTypeface(typeface);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadImage() {
|
||||
Intent intent = new Intent();
|
||||
intent.setType("image/*");
|
||||
intent.setAction(Intent.ACTION_GET_CONTENT);
|
||||
startActivityForResult(Intent.createChooser(intent,
|
||||
getResources().getString(R.string.select_from_gallery)), PICK_IMAGE_REQUEST_CODE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void captureImage() {
|
||||
Intent pictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
||||
try {
|
||||
capturedImageUri = FileProvider.getUriForFile(this, "eu.toldi.infinityforlemmy.provider",
|
||||
File.createTempFile("captured_image", ".jpg", getExternalFilesDir(Environment.DIRECTORY_PICTURES)));
|
||||
pictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, capturedImageUri);
|
||||
startActivityForResult(pictureIntent, CAPTURE_IMAGE_REQUEST_CODE);
|
||||
} catch (IOException ex) {
|
||||
Toast.makeText(this, R.string.error_creating_temp_file, Toast.LENGTH_SHORT).show();
|
||||
} catch (ActivityNotFoundException e) {
|
||||
Toast.makeText(this, R.string.no_camera_available, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertImageUrl(UploadedImage uploadedImage) {
|
||||
int start = Math.max(messageEditText.getSelectionStart(), 0);
|
||||
int end = Math.max(messageEditText.getSelectionEnd(), 0);
|
||||
messageEditText.getText().replace(Math.min(start, end), Math.max(start, end),
|
||||
"![" + uploadedImage.imageName + "](" + uploadedImage.imageUrl + ")",
|
||||
0, "![]()".length() + uploadedImage.imageName.length() + uploadedImage.imageUrl.length());
|
||||
}
|
||||
}
|
@ -204,7 +204,7 @@ public class SubmitCrosspostActivity extends BaseActivity implements FlairBottom
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
mGlide = Glide.with(this);
|
||||
mGlide = Glide.with(getApplication());
|
||||
|
||||
mPostingSnackbar = Snackbar.make(coordinatorLayout, R.string.posting, Snackbar.LENGTH_INDEFINITE);
|
||||
|
||||
|
@ -127,7 +127,7 @@ public class SubredditMultiselectionActivity extends BaseActivity implements Act
|
||||
setSupportActionBar(mToolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
mGlide = Glide.with(this);
|
||||
mGlide = Glide.with(getApplication());
|
||||
|
||||
mSwipeRefreshLayout.setEnabled(false);
|
||||
|
||||
|
@ -152,7 +152,7 @@ public class TrendingActivity extends BaseActivity {
|
||||
|
||||
mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null);
|
||||
|
||||
mGlide = Glide.with(this);
|
||||
mGlide = Glide.with(getApplication());
|
||||
|
||||
DisplayMetrics displayMetrics = new DisplayMetrics();
|
||||
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
||||
@ -201,7 +201,7 @@ public class TrendingActivity extends BaseActivity {
|
||||
isRefreshing = true;
|
||||
|
||||
errorLinearLayout.setVisibility(View.GONE);
|
||||
Glide.with(this).clear(errorImageView);
|
||||
Glide.with(getApplication()).clear(errorImageView);
|
||||
swipeRefreshLayout.setRefreshing(true);
|
||||
trendingSearches = null;
|
||||
adapter.setTrendingSearches(null);
|
||||
|
@ -161,7 +161,7 @@ public class ViewImageOrGifActivity extends AppCompatActivity implements SetAsWa
|
||||
Slidr.attach(this, new SlidrConfig.Builder().position(SlidrPosition.VERTICAL).distanceThreshold(0.125f).build());
|
||||
}
|
||||
|
||||
glide = Glide.with(this);
|
||||
glide = Glide.with(getApplication());
|
||||
|
||||
handler = new Handler();
|
||||
|
||||
|
@ -181,6 +181,8 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele
|
||||
private SectionsPagerAdapter sectionsPagerAdapter;
|
||||
private String mAccessToken;
|
||||
private String mAccountName;
|
||||
|
||||
private String mAccountQalifiedName;
|
||||
private long postFragmentId;
|
||||
private int postListPosition;
|
||||
private int orientation;
|
||||
@ -269,6 +271,7 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele
|
||||
|
||||
mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null);
|
||||
mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, null);
|
||||
mAccountQalifiedName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_QUALIFIED_NAME, null);
|
||||
|
||||
mVolumeKeysNavigateComments = mSharedPreferences.getBoolean(SharedPreferencesUtils.VOLUME_KEYS_NAVIGATE_COMMENTS, false);
|
||||
|
||||
@ -353,8 +356,8 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele
|
||||
|
||||
private void checkNewAccountAndBindView(Bundle savedInstanceState) {
|
||||
if (mNewAccountName != null) {
|
||||
if (mAccountName == null || !mAccountName.equals(mNewAccountName)) {
|
||||
SwitchAccount.switchAccount(mRedditDataRoomDatabase,mRetrofit, mCurrentAccountSharedPreferences,
|
||||
if (mAccountName == null || !mAccountQalifiedName.equals(mNewAccountName)) {
|
||||
SwitchAccount.switchAccount(mRedditDataRoomDatabase, mRetrofit, mCurrentAccountSharedPreferences,
|
||||
mExecutor, new Handler(), mNewAccountName, newAccount -> {
|
||||
EventBus.getDefault().post(new SwitchAccountEvent(getClass().getName()));
|
||||
Toast.makeText(this, R.string.account_switched, Toast.LENGTH_SHORT).show();
|
||||
|
@ -5,6 +5,7 @@ import android.content.SharedPreferences;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
@ -27,6 +28,7 @@ import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@ -46,14 +48,15 @@ import eu.toldi.infinityforlemmy.customviews.LinearLayoutManagerBugFixed;
|
||||
import eu.toldi.infinityforlemmy.events.PassPrivateMessageEvent;
|
||||
import eu.toldi.infinityforlemmy.events.PassPrivateMessageIndexEvent;
|
||||
import eu.toldi.infinityforlemmy.events.RepliedToPrivateMessageEvent;
|
||||
import eu.toldi.infinityforlemmy.message.Message;
|
||||
import eu.toldi.infinityforlemmy.message.ReadMessage;
|
||||
import eu.toldi.infinityforlemmy.message.ReplyMessage;
|
||||
import eu.toldi.infinityforlemmy.privatemessage.LemmyPrivateMessageAPI;
|
||||
import eu.toldi.infinityforlemmy.privatemessage.PrivateMessage;
|
||||
import eu.toldi.infinityforlemmy.utils.SharedPreferencesUtils;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
public class ViewPrivateMessagesActivity extends BaseActivity implements ActivityToolbarInterface {
|
||||
|
||||
public static final String EXTRA_PRIVATE_MESSAGE = "EPM";
|
||||
public static final String EXTRA_PRIVATE_MESSAGE_INDEX = "EPM";
|
||||
public static final String EXTRA_MESSAGE_POSITION = "EMP";
|
||||
private static final String USER_AVATAR_STATE = "UAS";
|
||||
@ -91,14 +94,19 @@ public class ViewPrivateMessagesActivity extends BaseActivity implements Activit
|
||||
CustomThemeWrapper mCustomThemeWrapper;
|
||||
@Inject
|
||||
Executor mExecutor;
|
||||
|
||||
@Inject
|
||||
LemmyPrivateMessageAPI mLemmyPrivateMessageAPI;
|
||||
private LinearLayoutManagerBugFixed mLinearLayoutManager;
|
||||
private PrivateMessagesDetailRecyclerViewAdapter mAdapter;
|
||||
@State
|
||||
Message privateMessage;
|
||||
PrivateMessage privateMessage;
|
||||
@State
|
||||
Message replyTo;
|
||||
PrivateMessage replyTo;
|
||||
private String mAccessToken;
|
||||
private String mAccountName;
|
||||
|
||||
private String mAccountQualifiedName;
|
||||
private String mUserAvatar;
|
||||
private ArrayList<ProvideUserAvatarCallback> mProvideUserAvatarCallbacks;
|
||||
private boolean isLoadingUserAvatar = false;
|
||||
@ -128,6 +136,11 @@ public class ViewPrivateMessagesActivity extends BaseActivity implements Activit
|
||||
addOnOffsetChangedListener(mAppBarLayout);
|
||||
}
|
||||
|
||||
Intent intent = getIntent();
|
||||
privateMessage = intent.getParcelableExtra(EXTRA_PRIVATE_MESSAGE);
|
||||
|
||||
Log.i("ViewPrivate", "privateMessage: " + privateMessage);
|
||||
|
||||
setSupportActionBar(mToolbar);
|
||||
setToolbarGoToTop(mToolbar);
|
||||
|
||||
@ -135,6 +148,7 @@ public class ViewPrivateMessagesActivity extends BaseActivity implements Activit
|
||||
|
||||
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) {
|
||||
mUserAvatar = savedInstanceState.getString(USER_AVATAR_STATE);
|
||||
@ -144,36 +158,37 @@ public class ViewPrivateMessagesActivity extends BaseActivity implements Activit
|
||||
bindView();
|
||||
}
|
||||
} else {
|
||||
if (privateMessage != null) {
|
||||
bindView();
|
||||
}
|
||||
EventBus.getDefault().post(new PassPrivateMessageIndexEvent(getIntent().getIntExtra(EXTRA_PRIVATE_MESSAGE_INDEX, -1)));
|
||||
}
|
||||
}
|
||||
|
||||
private void bindView() {
|
||||
if (privateMessage != null) {
|
||||
if (privateMessage.getAuthor().equals(mAccountName)) {
|
||||
setTitle(privateMessage.getDestination());
|
||||
if (privateMessage.getCreatorQualifiedName().equals(mAccountQualifiedName)) {
|
||||
setTitle(privateMessage.getRecipientName());
|
||||
mToolbar.setOnClickListener(view -> {
|
||||
if (privateMessage.isDestinationDeleted()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Intent intent = new Intent(this, ViewUserDetailActivity.class);
|
||||
intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, privateMessage.getDestination());
|
||||
intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, privateMessage.getRecipientName());
|
||||
intent.putExtra(ViewUserDetailActivity.EXTRA_QUALIFIED_USER_NAME_KEY, privateMessage.getRecipientQualifiedName());
|
||||
startActivity(intent);
|
||||
});
|
||||
} else {
|
||||
setTitle(privateMessage.getAuthor());
|
||||
setTitle(privateMessage.getCreatorName());
|
||||
mToolbar.setOnClickListener(view -> {
|
||||
if (privateMessage.isAuthorDeleted()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Intent intent = new Intent(this, ViewUserDetailActivity.class);
|
||||
intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, privateMessage.getAuthor());
|
||||
intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, privateMessage.getCreatorName());
|
||||
intent.putExtra(ViewUserDetailActivity.EXTRA_QUALIFIED_USER_NAME_KEY, privateMessage.getCreatorQualifiedName());
|
||||
startActivity(intent);
|
||||
});
|
||||
}
|
||||
}
|
||||
mAdapter = new PrivateMessagesDetailRecyclerViewAdapter(this, mSharedPreferences,
|
||||
getResources().getConfiguration().locale, privateMessage, mAccountName, mCustomThemeWrapper);
|
||||
getResources().getConfiguration().locale, privateMessage, mAccountQualifiedName, mCustomThemeWrapper);
|
||||
mLinearLayoutManager = new LinearLayoutManagerBugFixed(this);
|
||||
mLinearLayoutManager.setStackFromEnd(true);
|
||||
mRecyclerView.setLayoutManager(mLinearLayoutManager);
|
||||
@ -184,45 +199,40 @@ public class ViewPrivateMessagesActivity extends BaseActivity implements Activit
|
||||
if (!mEditText.getText().toString().equals("")) {
|
||||
//Send Message
|
||||
if (privateMessage != null) {
|
||||
ArrayList<Message> replies = privateMessage.getReplies();
|
||||
List<PrivateMessage> replies = privateMessage.getReplies();
|
||||
if (replyTo == null) {
|
||||
replyTo = privateMessage;
|
||||
}
|
||||
isSendingMessage = true;
|
||||
mSendImageView.setColorFilter(mSecondaryTextColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
ReplyMessage.replyMessage(mEditText.getText().toString(), replyTo.getFullname(),
|
||||
getResources().getConfiguration().locale, mOauthRetrofit, mAccessToken,
|
||||
new ReplyMessage.ReplyMessageListener() {
|
||||
@Override
|
||||
public void replyMessageSuccess(Message message) {
|
||||
if (mAdapter != null) {
|
||||
mAdapter.addReply(message);
|
||||
}
|
||||
goToBottom();
|
||||
mEditText.setText("");
|
||||
mSendImageView.setColorFilter(mSendMessageIconColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
isSendingMessage = false;
|
||||
EventBus.getDefault().post(new RepliedToPrivateMessageEvent(message, getIntent().getIntExtra(EXTRA_MESSAGE_POSITION, -1)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void replyMessageFailed(String errorMessage) {
|
||||
if (errorMessage != null && !errorMessage.equals("")) {
|
||||
Snackbar.make(mCoordinatorLayout, errorMessage, Snackbar.LENGTH_LONG).show();
|
||||
} else {
|
||||
Snackbar.make(mCoordinatorLayout, R.string.reply_message_failed, Snackbar.LENGTH_LONG).show();
|
||||
}
|
||||
mSendImageView.setColorFilter(mSendMessageIconColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
isSendingMessage = false;
|
||||
}
|
||||
});
|
||||
mLemmyPrivateMessageAPI.sendPrivateMessage(mAccessToken, replyTo.getCreatorId(), mEditText.getText().toString(), new LemmyPrivateMessageAPI.PrivateMessageSentListener() {
|
||||
|
||||
@Override
|
||||
public void onPrivateMessageSentSuccess(@NonNull PrivateMessage privateMessage) {
|
||||
if (mAdapter != null) {
|
||||
mAdapter.addReply(privateMessage);
|
||||
}
|
||||
goToBottom();
|
||||
mEditText.setText("");
|
||||
isSendingMessage = false;
|
||||
EventBus.getDefault().post(new RepliedToPrivateMessageEvent(privateMessage, getIntent().getIntExtra(EXTRA_MESSAGE_POSITION, -1)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPrivateMessageSentError() {
|
||||
Snackbar.make(mCoordinatorLayout, R.string.reply_message_failed, Snackbar.LENGTH_LONG).show();
|
||||
mSendImageView.setColorFilter(mSendMessageIconColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
isSendingMessage = false;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
StringBuilder fullnames = new StringBuilder();
|
||||
if (privateMessage.isNew()) {
|
||||
fullnames.append(privateMessage.getFullname()).append(",");
|
||||
}
|
||||
|
||||
if (replies != null && !replies.isEmpty()) {
|
||||
for (Message m : replies) {
|
||||
if (m.isNew()) {
|
||||
for (PrivateMessage m : replies) {
|
||||
if (!m.getRead()) {
|
||||
fullnames.append(m).append(",");
|
||||
}
|
||||
}
|
||||
|
@ -3,12 +3,14 @@ package eu.toldi.infinityforlemmy.activities;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.Menu;
|
||||
@ -18,12 +20,14 @@ import android.view.ViewTreeObserver;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
@ -36,6 +40,7 @@ import androidx.viewpager2.widget.ViewPager2;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.RequestManager;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.evernote.android.state.State;
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
import com.google.android.material.appbar.CollapsingToolbarLayout;
|
||||
import com.google.android.material.appbar.MaterialToolbar;
|
||||
@ -83,6 +88,7 @@ import eu.toldi.infinityforlemmy.bottomsheetfragments.SortTimeBottomSheetFragmen
|
||||
import eu.toldi.infinityforlemmy.bottomsheetfragments.SortTypeBottomSheetFragment;
|
||||
import eu.toldi.infinityforlemmy.bottomsheetfragments.UrlMenuBottomSheetFragment;
|
||||
import eu.toldi.infinityforlemmy.community.BlockCommunity;
|
||||
import eu.toldi.infinityforlemmy.community.CommunityStats;
|
||||
import eu.toldi.infinityforlemmy.customtheme.CustomThemeWrapper;
|
||||
import eu.toldi.infinityforlemmy.customviews.NavigationWrapper;
|
||||
import eu.toldi.infinityforlemmy.customviews.slidr.Slidr;
|
||||
@ -163,12 +169,26 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
TextView communityFullNameTextView;
|
||||
@BindView(R.id.subscriber_count_text_view_view_subreddit_detail_activity)
|
||||
TextView nSubscribersTextView;
|
||||
@BindView(R.id.online_subscriber_count_text_view_view_subreddit_detail_activity)
|
||||
TextView nOnlineSubscribersTextView;
|
||||
@BindView(R.id.since_text_view_view_subreddit_detail_activity)
|
||||
TextView sinceTextView;
|
||||
@BindView(R.id.creation_time_text_view_view_subreddit_detail_activity)
|
||||
TextView creationTimeTextView;
|
||||
@BindView(R.id.active_user_count_text_view_view_subreddit_detail_activity)
|
||||
TextView nActiveUsersTextView;
|
||||
@BindView(R.id.post_count_text_view_view_subreddit_detail_activity)
|
||||
TextView nPostsTextView;
|
||||
@BindView(R.id.comment_count_text_view_view_subreddit_detail_activity)
|
||||
TextView nCommentsTextView;
|
||||
|
||||
@BindView(R.id.subscriber_count_image_view_view_subreddit_detail_activity)
|
||||
ImageView nSubscribersImageView;
|
||||
@BindView(R.id.active_user_count_image_view_view_subreddit_detail_activity)
|
||||
ImageView nActiveUsersImageView;
|
||||
@BindView(R.id.post_count_image_view_view_subreddit_detail_activity)
|
||||
ImageView nPostsImageView;
|
||||
@BindView(R.id.comment_count_image_view_view_subreddit_detail_activity)
|
||||
ImageView nCommentsImageView;
|
||||
|
||||
@BindView(R.id.community_statistics_block_view_subreddit_detail_activity)
|
||||
ConstraintLayout communityStatisticsBlock;
|
||||
|
||||
|
||||
@BindView(R.id.description_text_view_view_subreddit_detail_activity)
|
||||
TextView descriptionTextView;
|
||||
@Inject
|
||||
@ -212,7 +232,10 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
|
||||
private int communityId;
|
||||
|
||||
private SubredditData communityData;
|
||||
@State
|
||||
SubredditData communityData;
|
||||
@State
|
||||
CommunityStats mCommunityStats;
|
||||
private String description;
|
||||
|
||||
private String qualifiedName;
|
||||
@ -238,6 +261,8 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
private int fabOption;
|
||||
private MaterialAlertDialogBuilder nsfwWarningBuilder;
|
||||
|
||||
private boolean showStatistics;
|
||||
|
||||
private boolean hideSubredditDescription;
|
||||
|
||||
@Override
|
||||
@ -251,6 +276,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
ButterKnife.bind(this);
|
||||
|
||||
hideFab = mSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_FAB_IN_POST_FEED, false);
|
||||
showStatistics = mSharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_STATISTICS, true);
|
||||
showBottomAppBar = mSharedPreferences.getBoolean(SharedPreferencesUtils.BOTTOM_APP_BAR_KEY, false);
|
||||
navigationWrapper = new NavigationWrapper(findViewById(R.id.bottom_app_bar_bottom_app_bar), findViewById(R.id.linear_layout_bottom_app_bar),
|
||||
findViewById(R.id.option_1_bottom_app_bar), findViewById(R.id.option_2_bottom_app_bar),
|
||||
@ -363,19 +389,33 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
mMessageFullname = savedInstanceState.getInt(MESSAGE_FULLNAME_STATE);
|
||||
mNewAccountName = savedInstanceState.getString(NEW_ACCOUNT_NAME_STATE);
|
||||
|
||||
if (mFetchSubredditInfoSuccess) {
|
||||
nOnlineSubscribersTextView.setText(getString(R.string.online_subscribers_number_detail, mNCurrentOnlineSubscribers));
|
||||
}
|
||||
}
|
||||
|
||||
checkNewAccountAndBindView();
|
||||
|
||||
fetchSubredditData();
|
||||
if (communityName != null) {
|
||||
if (communityData != null) {
|
||||
setupVisibleElements();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
Log.e("ViewSubredditDetail", "onStart");
|
||||
if (communityData != null) {
|
||||
setupVisibleElements();
|
||||
} else {
|
||||
fetchSubredditData();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
mFetchSubredditInfoSuccess = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (sectionsPagerAdapter != null) {
|
||||
@ -417,9 +457,13 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
subscribeSubredditChip.setTextColor(mCustomThemeWrapper.getChipTextColor());
|
||||
int primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor();
|
||||
nSubscribersTextView.setTextColor(primaryTextColor);
|
||||
nOnlineSubscribersTextView.setTextColor(primaryTextColor);
|
||||
sinceTextView.setTextColor(primaryTextColor);
|
||||
creationTimeTextView.setTextColor(primaryTextColor);
|
||||
nActiveUsersTextView.setTextColor(primaryTextColor);
|
||||
nPostsTextView.setTextColor(primaryTextColor);
|
||||
nCommentsTextView.setTextColor(primaryTextColor);
|
||||
nSubscribersImageView.setColorFilter(mCustomThemeWrapper.getPrimaryTextColor(), PorterDuff.Mode.SRC_IN);
|
||||
nActiveUsersImageView.setColorFilter(mCustomThemeWrapper.getPrimaryTextColor(), PorterDuff.Mode.SRC_IN);
|
||||
nPostsImageView.setColorFilter(mCustomThemeWrapper.getPrimaryTextColor(), PorterDuff.Mode.SRC_IN);
|
||||
nCommentsImageView.setColorFilter(mCustomThemeWrapper.getPrimaryTextColor(), PorterDuff.Mode.SRC_IN);
|
||||
descriptionTextView.setTextColor(primaryTextColor);
|
||||
navigationWrapper.applyCustomTheme(mCustomThemeWrapper.getBottomAppBarIconColor(), mCustomThemeWrapper.getBottomAppBarBackgroundColor());
|
||||
applyTabLayoutTheme(tabLayout);
|
||||
@ -428,9 +472,9 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
subredditNameTextView.setTypeface(typeface);
|
||||
subscribeSubredditChip.setTypeface(typeface);
|
||||
nSubscribersTextView.setTypeface(typeface);
|
||||
nOnlineSubscribersTextView.setTypeface(typeface);
|
||||
sinceTextView.setTypeface(typeface);
|
||||
creationTimeTextView.setTypeface(typeface);
|
||||
nActiveUsersTextView.setTypeface(typeface);
|
||||
nPostsTextView.setTypeface(typeface);
|
||||
nCommentsTextView.setTypeface(typeface);
|
||||
descriptionTextView.setTypeface(typeface);
|
||||
}
|
||||
unsubscribedColor = mCustomThemeWrapper.getUnsubscribed();
|
||||
@ -469,7 +513,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
setSupportActionBar(toolbar);
|
||||
setToolbarGoToTop(toolbar);
|
||||
|
||||
glide = Glide.with(this);
|
||||
glide = Glide.with(getApplication());
|
||||
Locale locale = getResources().getConfiguration().locale;
|
||||
|
||||
MarkwonPlugin miscPlugin = new AbstractMarkwonPlugin() {
|
||||
@ -554,7 +598,13 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
communityFullNameTextView.setText(qualifiedName);
|
||||
String nSubscribers = getString(R.string.subscribers_number_detail, subredditData.getNSubscribers());
|
||||
nSubscribersTextView.setText(nSubscribers);
|
||||
creationTimeTextView.setText(subredditData.getCreatedUTC());
|
||||
|
||||
if (mCommunityStats != null && showStatistics) {
|
||||
communityStatisticsBlock.setVisibility(View.VISIBLE);
|
||||
nActiveUsersTextView.setText(getString(R.string.active_users_number_detail, mCommunityStats.getActiveUsers()));
|
||||
nPostsTextView.setText(getString(R.string.post_count_detail, mCommunityStats.getPosts()));
|
||||
nCommentsTextView.setText(getString(R.string.comment_count_detail, mCommunityStats.getComments()));
|
||||
}
|
||||
description = subredditData.getDescription();
|
||||
|
||||
|
||||
@ -694,13 +744,14 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
if (communityName == null) {
|
||||
communityName = communityData.getTitle();
|
||||
}
|
||||
mCommunityStats = communityData.getCommunityStats();
|
||||
setupVisibleElements();
|
||||
communityId = communityData.getId();
|
||||
ViewSubredditDetailActivity.this.communityData = communityData;
|
||||
setupSubscribeChip();
|
||||
|
||||
mNCurrentOnlineSubscribers = nCurrentOnlineSubscribers;
|
||||
nOnlineSubscribersTextView.setText(getString(R.string.online_subscribers_number_detail, nCurrentOnlineSubscribers));
|
||||
|
||||
InsertSubredditData.insertSubredditData(mExecutor, new Handler(), mRedditDataRoomDatabase,
|
||||
communityData, () -> mFetchSubredditInfoSuccess = true);
|
||||
}
|
||||
@ -1169,7 +1220,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
Intent shareIntent = new Intent(Intent.ACTION_SEND);
|
||||
shareIntent.setType("text/plain");
|
||||
String baseURL = mRetrofit.getBaseURL().endsWith("/") ? mRetrofit.getBaseURL() : mRetrofit.getBaseURL() + "/";
|
||||
shareIntent.putExtra(Intent.EXTRA_TEXT, baseURL + "/" + qualifiedName);
|
||||
shareIntent.putExtra(Intent.EXTRA_TEXT, baseURL + "c/" + qualifiedName);
|
||||
if (shareIntent.resolveActivity(getPackageManager()) != null) {
|
||||
startActivity(Intent.createChooser(shareIntent, getString(R.string.share)));
|
||||
} else {
|
||||
@ -1177,8 +1228,8 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
}
|
||||
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/" + communityName);
|
||||
/* Intent intent = new Intent(this, SendPrivateMessageActivity.class);
|
||||
intent.putExtra(SendPrivateMessageActivity.EXTRA_RECIPIENT_USERNAME, "r/" + communityName);*/
|
||||
//startActivity(intent);
|
||||
return true;
|
||||
} else if (itemId == R.id.block_community_view_subreddit_detail_activity) {
|
||||
@ -1640,6 +1691,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
bundle.putString(SidebarFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
|
||||
bundle.putString(SidebarFragment.EXTRA_SUBREDDIT_NAME, communityName);
|
||||
bundle.putString(SidebarFragment.EXTRA_COMMUNITY_QUALIFIED_NAME, qualifiedName);
|
||||
bundle.putBoolean(SidebarFragment.EXTRA_SHOW_STATISTICS, !showStatistics);
|
||||
fragment.setArguments(bundle);
|
||||
return fragment;
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
@ -20,12 +21,15 @@ import android.view.ViewTreeObserver;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
@ -105,11 +109,13 @@ import eu.toldi.infinityforlemmy.post.PostPagingSource;
|
||||
import eu.toldi.infinityforlemmy.readpost.InsertReadPost;
|
||||
import eu.toldi.infinityforlemmy.subreddit.ParseSubredditData;
|
||||
import eu.toldi.infinityforlemmy.subreddit.SubredditData;
|
||||
import eu.toldi.infinityforlemmy.user.BasicUserInfo;
|
||||
import eu.toldi.infinityforlemmy.user.BlockUser;
|
||||
import eu.toldi.infinityforlemmy.user.FetchUserData;
|
||||
import eu.toldi.infinityforlemmy.user.UserDao;
|
||||
import eu.toldi.infinityforlemmy.user.UserData;
|
||||
import eu.toldi.infinityforlemmy.user.UserFollowing;
|
||||
import eu.toldi.infinityforlemmy.user.UserStats;
|
||||
import eu.toldi.infinityforlemmy.user.UserViewModel;
|
||||
import eu.toldi.infinityforlemmy.utils.APIUtils;
|
||||
import eu.toldi.infinityforlemmy.utils.LemmyUtils;
|
||||
@ -170,11 +176,40 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
||||
|
||||
@BindView(R.id.user_qualified_name_text_view_view_user_detail_activity)
|
||||
TextView qualifiedNameTextView;
|
||||
|
||||
@BindView(R.id.loading_user_progress_indicator_view_user_detail_activity)
|
||||
ProgressBar progressBar;
|
||||
@BindView(R.id.subscribe_user_chip_view_user_detail_activity)
|
||||
Chip subscribeUserChip;
|
||||
@BindView(R.id.karma_text_view_view_user_detail_activity)
|
||||
TextView karmaTextView;
|
||||
@BindView(R.id.cakeday_text_view_view_user_detail_activity)
|
||||
|
||||
@BindView(R.id.post_count_text_view_view_user_detail_activity)
|
||||
TextView postCountTextView;
|
||||
|
||||
@BindView(R.id.comment_count_text_view_view_user_detail_activity)
|
||||
TextView commentCountTextView;
|
||||
|
||||
@BindView(R.id.upvote_count_post_text_view_view_user_detail_activity)
|
||||
TextView upvoteCountPostTextView;
|
||||
|
||||
@BindView(R.id.upvote_count_comment_text_view_view_user_detail_activity)
|
||||
TextView upvoteCountCommentTextView;
|
||||
|
||||
@BindView(R.id.posts_count_icon_image_view_view_user_detail_activity)
|
||||
ImageView postsCountIconImageView;
|
||||
@BindView(R.id.comments_count_icon_image_view_view_user_detail_activity)
|
||||
ImageView commentsCountIconImageView;
|
||||
|
||||
@BindView(R.id.upvote_count_posts_icon_image_view_view_user_detail_activity)
|
||||
ImageView postUpvoteCountIconImageView;
|
||||
@BindView(R.id.upvote_count_comments_icon_image_view_view_user_detail_activity)
|
||||
ImageView commentUpvoteCountIconImageView;
|
||||
@BindView(R.id.account_created_cake_icon_image_view_view_user_detail_activity)
|
||||
ImageView accountCreatedCakeIconImageView;
|
||||
|
||||
@BindView(R.id.user_statistics_block_view_user_detail_activity)
|
||||
ConstraintLayout userStatisticsBlock;
|
||||
|
||||
@BindView(R.id.cake_day_text_view_view_user_detail_activity)
|
||||
TextView cakedayTextView;
|
||||
@BindView(R.id.description_text_view_view_user_detail_activity)
|
||||
TextView descriptionTextView;
|
||||
@ -221,8 +256,12 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
||||
private String mAccountName;
|
||||
private String mAccountQualifiedName;
|
||||
private String username;
|
||||
|
||||
private String qualifiedName;
|
||||
private String description;
|
||||
|
||||
private boolean showStatistics;
|
||||
private boolean showScore;
|
||||
private boolean subscriptionReady = false;
|
||||
private boolean mFetchUserInfoSuccess = false;
|
||||
private int expandedTabTextColor;
|
||||
@ -287,6 +326,8 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
||||
mAccountQualifiedName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_QUALIFIED_NAME, null);
|
||||
lockBottomAppBar = mSharedPreferences.getBoolean(SharedPreferencesUtils.LOCK_BOTTOM_APP_BAR, false);
|
||||
|
||||
showStatistics = mSharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_STATISTICS, true);
|
||||
showScore = mSharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_POST_AND_COMMENT_SCORE, true);
|
||||
|
||||
if (savedInstanceState == null) {
|
||||
mMessageId = getIntent().getIntExtra(EXTRA_MESSAGE_FULLNAME, 0);
|
||||
@ -295,7 +336,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
||||
mFetchUserInfoSuccess = savedInstanceState.getBoolean(FETCH_USER_INFO_STATE);
|
||||
mMessageId = savedInstanceState.getInt(MESSAGE_FULLNAME_STATE);
|
||||
mNewAccountName = savedInstanceState.getString(NEW_ACCOUNT_NAME_STATE);
|
||||
qualifiedName = savedInstanceState.getString(NEW_ACCOUNT_QUALIFIED_NAME_STATE);
|
||||
qualifiedName = savedInstanceState.getString("qualified_name");
|
||||
}
|
||||
|
||||
checkNewAccountAndInitializeViewPager();
|
||||
@ -307,9 +348,26 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
if (mUserData != null) {
|
||||
setupVisibleElements();
|
||||
} else {
|
||||
fetchUserInfo();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
mFetchUserInfoSuccess = false;
|
||||
}
|
||||
|
||||
private void setupVisibleElements() {
|
||||
Resources resources = getResources();
|
||||
String title = username;
|
||||
progressBar.setVisibility(View.GONE);
|
||||
userNameTextView.setText(title);
|
||||
qualifiedNameTextView.setText(qualifiedName);
|
||||
toolbar.setTitle(title);
|
||||
@ -390,7 +448,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
||||
});
|
||||
}
|
||||
|
||||
glide = Glide.with(this);
|
||||
glide = Glide.with(getApplication());
|
||||
Locale locale = getResources().getConfiguration().locale;
|
||||
|
||||
MarkwonPlugin miscPlugin = new AbstractMarkwonPlugin() {
|
||||
@ -567,8 +625,23 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
||||
getSupportActionBar().setTitle(userFullName);
|
||||
}
|
||||
String karma = "";//getString(R.string.karma_info_user_detail, userData.getTotalKarma(), userData.getLinkKarma(), userData.getCommentKarma());
|
||||
karmaTextView.setText(karma);
|
||||
cakedayTextView.setText(getString(R.string.cakeday_info, userData.getCakeday()));
|
||||
|
||||
cakedayTextView.setText((String) userData.getCakeday());
|
||||
UserStats userStats = mUserData.getStats();
|
||||
if (userStats != null && showStatistics) {
|
||||
userStatisticsBlock.setVisibility(View.VISIBLE);
|
||||
postCountTextView.setText(String.valueOf(userStats.getPostCount()));
|
||||
commentCountTextView.setText(String.valueOf(userStats.getCommentCount()));
|
||||
if (showScore) {
|
||||
upvoteCountPostTextView.setText(String.valueOf(userStats.getPostScore()));
|
||||
upvoteCountCommentTextView.setText(String.valueOf(userStats.getCommentScore()));
|
||||
} else {
|
||||
upvoteCountPostTextView.setVisibility(View.GONE);
|
||||
upvoteCountCommentTextView.setVisibility(View.GONE);
|
||||
postUpvoteCountIconImageView.setVisibility(View.GONE);
|
||||
commentUpvoteCountIconImageView.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
if (userData.getDescription() == null || userData.getDescription().equals("")) {
|
||||
descriptionTextView.setVisibility(View.GONE);
|
||||
@ -636,7 +709,13 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
||||
unsubscribedColor = mCustomThemeWrapper.getUnsubscribed();
|
||||
subscribedColor = mCustomThemeWrapper.getSubscribed();
|
||||
userNameTextView.setTextColor(mCustomThemeWrapper.getUsername());
|
||||
karmaTextView.setTextColor(mCustomThemeWrapper.getPrimaryTextColor());
|
||||
postCountTextView.setTextColor(mCustomThemeWrapper.getPrimaryTextColor());
|
||||
upvoteCountPostTextView.setTextColor(mCustomThemeWrapper.getPrimaryTextColor());
|
||||
commentCountTextView.setTextColor(mCustomThemeWrapper.getPrimaryTextColor());
|
||||
upvoteCountCommentTextView.setTextColor(mCustomThemeWrapper.getPrimaryTextColor());
|
||||
postsCountIconImageView.setColorFilter(mCustomThemeWrapper.getPrimaryTextColor(), PorterDuff.Mode.SRC_IN);
|
||||
commentsCountIconImageView.setColorFilter(mCustomThemeWrapper.getPrimaryTextColor(), PorterDuff.Mode.SRC_IN);
|
||||
accountCreatedCakeIconImageView.setColorFilter(mCustomThemeWrapper.getPrimaryTextColor(), PorterDuff.Mode.SRC_IN);
|
||||
cakedayTextView.setTextColor(mCustomThemeWrapper.getPrimaryTextColor());
|
||||
navigationWrapper.applyCustomTheme(mCustomThemeWrapper.getBottomAppBarIconColor(), mCustomThemeWrapper.getBottomAppBarBackgroundColor());
|
||||
applyFABTheme(navigationWrapper.floatingActionButton, mSharedPreferences.getBoolean(SharedPreferencesUtils.USE_CIRCULAR_FAB, false));
|
||||
@ -645,7 +724,10 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
||||
applyTabLayoutTheme(tabLayout);
|
||||
if (typeface != null) {
|
||||
userNameTextView.setTypeface(typeface);
|
||||
karmaTextView.setTypeface(typeface);
|
||||
postCountTextView.setTypeface(typeface);
|
||||
upvoteCountPostTextView.setTypeface(typeface);
|
||||
commentCountTextView.setTypeface(typeface);
|
||||
upvoteCountCommentTextView.setTypeface(typeface);
|
||||
cakedayTextView.setTypeface(typeface);
|
||||
subscribeUserChip.setTypeface(typeface);
|
||||
descriptionTextView.setTypeface(typeface);
|
||||
@ -1092,7 +1174,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
||||
@Override
|
||||
public void onFetchUserDataSuccess(UserData userData, int inboxCount) {
|
||||
mUserData = userData;
|
||||
username = userData.getName();
|
||||
username = userData.getDisplayName();
|
||||
setupVisibleElements();
|
||||
FetchBlockedThings.fetchBlockedThings(mRetrofit.getRetrofit(), mAccessToken, mAccountQualifiedName, new FetchBlockedThings.FetchBlockedThingsListener() {
|
||||
|
||||
@ -1195,7 +1277,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
||||
Intent shareIntent = new Intent(Intent.ACTION_SEND);
|
||||
shareIntent.setType("text/plain");
|
||||
String baseURL = mRetrofit.getBaseURL().endsWith("/") ? mRetrofit.getBaseURL() : mRetrofit.getBaseURL() + "/";
|
||||
shareIntent.putExtra(Intent.EXTRA_TEXT, baseURL + qualifiedName);
|
||||
shareIntent.putExtra(Intent.EXTRA_TEXT, baseURL + "u/" + qualifiedName);
|
||||
if (shareIntent.resolveActivity(getPackageManager()) != null) {
|
||||
startActivity(Intent.createChooser(shareIntent, getString(R.string.share)));
|
||||
} else {
|
||||
@ -1209,7 +1291,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
||||
}
|
||||
|
||||
Intent pmIntent = new Intent(this, SendPrivateMessageActivity.class);
|
||||
pmIntent.putExtra(SendPrivateMessageActivity.EXTRA_RECIPIENT_USERNAME, username);
|
||||
pmIntent.putExtra(SendPrivateMessageActivity.EXTRA_RECIPIENT_USER_INFO, new BasicUserInfo(mUserData.getId(), username, qualifiedName, mUserData.getAvatar(), mUserData.getDisplayName()));
|
||||
startActivity(pmIntent);
|
||||
return true;
|
||||
} else if (itemId == R.id.action_add_to_post_filter_view_user_detail_activity) {
|
||||
@ -1319,7 +1401,8 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
||||
outState.putBoolean(FETCH_USER_INFO_STATE, mFetchUserInfoSuccess);
|
||||
outState.putInt(MESSAGE_FULLNAME_STATE, mMessageId);
|
||||
outState.putString(NEW_ACCOUNT_NAME_STATE, mNewAccountName);
|
||||
outState.getString(NEW_ACCOUNT_QUALIFIED_NAME_STATE, mAccountQualifiedName);
|
||||
outState.putString(NEW_ACCOUNT_QUALIFIED_NAME_STATE, mAccountQualifiedName);
|
||||
outState.putString("qualified_name", qualifiedName);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -35,16 +35,9 @@ import javax.inject.Named;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
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 me.saket.bettermovementmethod.BetterLinkMovementMethod;
|
||||
import eu.toldi.infinityforlemmy.Infinity;
|
||||
import eu.toldi.infinityforlemmy.R;
|
||||
import eu.toldi.infinityforlemmy.RetrofitHolder;
|
||||
import eu.toldi.infinityforlemmy.apis.RedditAPI;
|
||||
import eu.toldi.infinityforlemmy.bottomsheetfragments.UrlMenuBottomSheetFragment;
|
||||
import eu.toldi.infinityforlemmy.customtheme.CustomThemeWrapper;
|
||||
@ -57,10 +50,16 @@ import eu.toldi.infinityforlemmy.markdown.MarkdownUtils;
|
||||
import eu.toldi.infinityforlemmy.utils.JSONUtils;
|
||||
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 me.saket.bettermovementmethod.BetterLinkMovementMethod;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
public class WikiActivity extends BaseActivity {
|
||||
|
||||
@ -139,7 +138,7 @@ public class WikiActivity extends BaseActivity {
|
||||
}
|
||||
}
|
||||
|
||||
mGlide = Glide.with(this);
|
||||
mGlide = Glide.with(getApplication());
|
||||
|
||||
swipeRefreshLayout.setEnabled(mSharedPreferences.getBoolean(SharedPreferencesUtils.PULL_TO_REFRESH, true));
|
||||
swipeRefreshLayout.setOnRefreshListener(this::loadWiki);
|
||||
@ -219,7 +218,7 @@ public class WikiActivity extends BaseActivity {
|
||||
|
||||
swipeRefreshLayout.setRefreshing(true);
|
||||
|
||||
Glide.with(this).clear(mFetchWikiInfoImageView);
|
||||
Glide.with(getApplication()).clear(mFetchWikiInfoImageView);
|
||||
mFetchWikiInfoLinearLayout.setVisibility(View.GONE);
|
||||
|
||||
retrofit.getRetrofit().create(RedditAPI.class).getWikiPage(getIntent().getStringExtra(EXTRA_SUBREDDIT_NAME), getIntent().getStringExtra(EXTRA_WIKI_PATH)).enqueue(new Callback<String>() {
|
||||
|
@ -99,7 +99,8 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
||||
private Retrofit mOauthRetrofit;
|
||||
private Markwon mCommentMarkwon;
|
||||
private String mAccessToken;
|
||||
private String mAccountName;
|
||||
private String mAccountQualifiedName;
|
||||
|
||||
private Post mPost;
|
||||
private ArrayList<Comment> mVisibleComments;
|
||||
|
||||
@ -175,7 +176,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
||||
mFragment = fragment;
|
||||
mExecutor = executor;
|
||||
mRetrofit = retrofit;
|
||||
mGlide = Glide.with(activity);
|
||||
mGlide = Glide.with(activity.getApplicationContext());
|
||||
mSecondaryTextColor = customThemeWrapper.getSecondaryTextColor();
|
||||
mCommentTextColor = customThemeWrapper.getCommentColor();
|
||||
int commentSpoilerBackgroundColor = mCommentTextColor | 0xFF000000;
|
||||
@ -217,7 +218,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
||||
miscPlugin, mCommentTextColor, commentSpoilerBackgroundColor, onLinkLongClickListener);
|
||||
recycledViewPool = new RecyclerView.RecycledViewPool();
|
||||
mAccessToken = accessToken;
|
||||
mAccountName = accountName;
|
||||
mAccountQualifiedName = accountName;
|
||||
mPost = post;
|
||||
mVisibleComments = new ArrayList<>();
|
||||
loadedComments = new HashSet<>();
|
||||
@ -389,7 +390,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
||||
Drawable moderatorDrawable = Utils.getTintedDrawable(mActivity, R.drawable.ic_verified_user_14dp, mModeratorColor);
|
||||
((CommentViewHolder) holder).authorTextView.setCompoundDrawablesWithIntrinsicBounds(
|
||||
moderatorDrawable, null, null, null);
|
||||
} else if (comment.getAuthor().equals(mAccountName)) {
|
||||
} else if (comment.getAuthorQualifiedName().equals(mAccountQualifiedName)) {
|
||||
((CommentViewHolder) holder).authorTextView.setTextColor(mCurrentUserColor);
|
||||
Drawable currentUserDrawable = Utils.getTintedDrawable(mActivity, R.drawable.ic_current_user_14dp, mCurrentUserColor);
|
||||
((CommentViewHolder) holder).authorTextView.setCompoundDrawablesWithIntrinsicBounds(
|
||||
@ -904,7 +905,8 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
||||
loadedComments.add(comments.get(i).getId());
|
||||
}
|
||||
if (mIsSingleCommentThreadMode) {
|
||||
notifyItemRangeInserted(sizeBefore, comments.size() + 1);
|
||||
int offset = (comments.size() > 0) ? 1 : 0;
|
||||
notifyItemRangeInserted(sizeBefore, comments.size() + offset);
|
||||
} else {
|
||||
notifyItemRangeInserted(sizeBefore, comments.size());
|
||||
}
|
||||
@ -1373,7 +1375,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
||||
Comment comment = getCurrentComment(this);
|
||||
if (comment != null) {
|
||||
Bundle bundle = new Bundle();
|
||||
if (!mPost.isArchived() && !mPost.isLocked() && comment.getAuthor().equals(mAccountName)) {
|
||||
if (!mPost.isArchived() && !mPost.isLocked() && comment.getAuthorQualifiedName().equals(mAccountQualifiedName)) {
|
||||
bundle.putBoolean(CommentMoreBottomSheetFragment.EXTRA_EDIT_AND_DELETE_AVAILABLE, true);
|
||||
}
|
||||
bundle.putString(CommentMoreBottomSheetFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
|
||||
|
@ -554,9 +554,6 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy
|
||||
.into(((PostBaseViewHolder) holder).iconGifImageView);
|
||||
}
|
||||
|
||||
if (holder.getBindingAdapterPosition() >= 0) {
|
||||
post.setSubredditIconUrl(iconUrl);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else if (!post.getSubredditIconUrl().equals("")) {
|
||||
@ -1082,9 +1079,6 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy
|
||||
.into(((PostCompactBaseViewHolder) holder).iconGifImageView);
|
||||
}
|
||||
|
||||
if (holder.getBindingAdapterPosition() >= 0) {
|
||||
post.setSubredditIconUrl(iconUrl);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else if (!post.getSubredditIconUrl().equals("")) {
|
||||
|
@ -0,0 +1,20 @@
|
||||
package eu.toldi.infinityforlemmy.adapters;
|
||||
|
||||
import eu.toldi.infinityforlemmy.activities.BaseActivity;
|
||||
import eu.toldi.infinityforlemmy.customtheme.CustomThemeWrapper;
|
||||
import eu.toldi.infinityforlemmy.user.BasicUserRecyclerViewAdapter;
|
||||
|
||||
public class ModeratorRecyclerViewAdapter extends BasicUserRecyclerViewAdapter {
|
||||
|
||||
private final int mModeratorColor;
|
||||
|
||||
public ModeratorRecyclerViewAdapter(BaseActivity activity, CustomThemeWrapper customThemeWrapper) {
|
||||
super(activity, customThemeWrapper);
|
||||
mModeratorColor = customThemeWrapper.getModerator();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getUserNameTextColor() {
|
||||
return mModeratorColor;
|
||||
}
|
||||
}
|
@ -172,6 +172,8 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
||||
private boolean mHideUpvoteRatio;
|
||||
private boolean mHideTheNumberOfAwards;
|
||||
private boolean mHideSubredditAndUserPrefix;
|
||||
|
||||
private boolean mShowDisplayNames;
|
||||
private boolean mHideTheNumberOfVotes;
|
||||
|
||||
private boolean mSeperateUpvoteAndDownvote;
|
||||
@ -345,6 +347,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
||||
mHideUpvoteRatio = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_UPVOTE_RATIO, false);
|
||||
mHideTheNumberOfAwards = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_AWARDS, false);
|
||||
mHideSubredditAndUserPrefix = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_SUBREDDIT_AND_USER_PREFIX, false);
|
||||
mShowDisplayNames = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.POST_DETAIL_DISPLAY_NAME_INSTEAD_OF_USERNAME, true);
|
||||
mHideTheNumberOfVotes = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_VOTES, false);
|
||||
mHideDownvotes = !currentAccountSharedPreferences.getBoolean(SharedPreferencesUtils.CAN_DOWNVOTE, true);
|
||||
mSeperateUpvoteAndDownvote = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.POST_DETAIL_SEPARATE_UP_AND_DOWN_VOTES, true) && !mHideDownvotes;
|
||||
@ -528,8 +531,6 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
|
||||
.into(((PostDetailBaseViewHolder) holder).mIconGifImageView);
|
||||
}
|
||||
|
||||
mPost.setSubredditIconUrl(iconImageUrl);
|
||||
});
|
||||
} else if (!mPost.getSubredditIconUrl().equals("")) {
|
||||
mGlide.load(mPost.getSubredditIconUrl())
|
||||
@ -580,13 +581,14 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
||||
((PostDetailBaseViewHolder) holder).mCrosspostImageView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
((PostDetailBaseViewHolder) holder).mUserTextView.setText((mShowDisplayNames) ? mPost.getAuthor() : mPost.getAuthorInfo().getUsername());
|
||||
((PostDetailBaseViewHolder) holder).mSubredditTextView.setText((mShowDisplayNames) ? mPost.getSubredditName() : mPost.getCommunityInfo().getName());
|
||||
if (mHideSubredditAndUserPrefix) {
|
||||
((PostDetailBaseViewHolder) holder).mSubredditTextView.setText(mPost.getSubredditName());
|
||||
((PostDetailBaseViewHolder) holder).mUserTextView.setText(mPost.getAuthor());
|
||||
((PostDetailBaseViewHolder) holder).mUserTextView.setText((mShowDisplayNames) ? mPost.getAuthor() : mPost.getAuthorInfo().getUsername());
|
||||
} else {
|
||||
((PostDetailBaseViewHolder) holder).mSubredditTextView.setText(mPost.getSubredditName());
|
||||
((PostDetailBaseViewHolder) holder).mSubredditTextView.setText((mShowDisplayNames) ? mPost.getSubredditName() : mPost.getCommunityInfo().getName());
|
||||
((PostDetailBaseViewHolder) holder).mCommunityInstanceTextView.setText('@' + mPost.getSubredditNamePrefixed().split(Pattern.quote("@"))[1]);
|
||||
((PostDetailBaseViewHolder) holder).mUserTextView.setText(mPost.getAuthor());
|
||||
|
||||
((PostDetailBaseViewHolder) holder).mUserInstanceTextView.setText('@' + mPost.getAuthorNamePrefixed().split(Pattern.quote("@"))[1]);
|
||||
((PostDetailBaseViewHolder) holder).mCommunityInstanceTextView.setTextColor(CustomThemeWrapper.darkenColor(mSubredditColor, 0.7f));
|
||||
((PostDetailBaseViewHolder) holder).mUserInstanceTextView.setTextColor(CustomThemeWrapper.darkenColor(mPost.isModerator() || mPost.isAdmin() ? mModeratorColor : mUsernameColor, 0.7f));
|
||||
@ -1268,16 +1270,18 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
||||
|
||||
mIconGifImageView.setOnClickListener(view -> mSubredditTextView.performClick());
|
||||
|
||||
mSubredditTextView.setOnClickListener(view -> {
|
||||
View.OnClickListener communityClickListener = view -> {
|
||||
Intent intent;
|
||||
intent = new Intent(mActivity, ViewSubredditDetailActivity.class);
|
||||
intent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY,
|
||||
mPost.getSubredditName());
|
||||
intent.putExtra(ViewSubredditDetailActivity.EXTRA_COMMUNITY_FULL_NAME_KEY, mPost.getSubredditNamePrefixed());
|
||||
mActivity.startActivity(intent);
|
||||
});
|
||||
};
|
||||
mSubredditTextView.setOnClickListener(communityClickListener);
|
||||
mCommunityInstanceTextView.setOnClickListener(communityClickListener);
|
||||
|
||||
mUserTextView.setOnClickListener(view -> {
|
||||
View.OnClickListener onUserClick = view -> {
|
||||
if (mPost.isAuthorDeleted()) {
|
||||
return;
|
||||
}
|
||||
@ -1285,7 +1289,9 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
||||
intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, mPost.getAuthor());
|
||||
intent.putExtra(ViewUserDetailActivity.EXTRA_QUALIFIED_USER_NAME_KEY, mPost.getAuthorNamePrefixed());
|
||||
mActivity.startActivity(intent);
|
||||
});
|
||||
};
|
||||
mUserTextView.setOnClickListener(onUserClick);
|
||||
mUserInstanceTextView.setOnClickListener(onUserClick);
|
||||
|
||||
mAuthorFlairTextView.setOnClickListener(view -> mUserTextView.performClick());
|
||||
|
||||
|
@ -227,6 +227,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
|
||||
private boolean mHidePostFlair;
|
||||
private boolean mHideTheNumberOfAwards;
|
||||
private boolean mHideSubredditAndUserPrefix;
|
||||
private boolean mShowDisplayNames;
|
||||
private boolean mHideTheNumberOfVotes;
|
||||
|
||||
private boolean mSeparateUpandDownVotes;
|
||||
@ -313,6 +314,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
|
||||
mHidePostFlair = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_POST_FLAIR, false);
|
||||
mHideTheNumberOfAwards = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_AWARDS, false);
|
||||
mHideSubredditAndUserPrefix = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_SUBREDDIT_AND_USER_PREFIX, false);
|
||||
mShowDisplayNames = sharedPreferences.getBoolean(SharedPreferencesUtils.POST_DISPLAY_NAME_INSTEAD_OF_USERNAME, true);
|
||||
mHideTheNumberOfVotes = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_VOTES, false);
|
||||
mHideDownvotes = !currentAccountSharedPreferences.getBoolean(SharedPreferencesUtils.CAN_DOWNVOTE, true);
|
||||
mSeparateUpandDownVotes = sharedPreferences.getBoolean(SharedPreferencesUtils.POST_SEPARATE_UP_AND_DOWN_VOTES, true) && !mHideDownvotes;
|
||||
@ -536,13 +538,10 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
|
||||
}
|
||||
String authorPrefixed = post.getAuthorNamePrefixed();
|
||||
|
||||
if (mHideSubredditAndUserPrefix) {
|
||||
((PostBaseViewHolder) holder).subredditTextView.setText(post.getSubredditName());
|
||||
((PostBaseViewHolder) holder).userTextView.setText(post.getAuthor());
|
||||
} else {
|
||||
((PostBaseViewHolder) holder).subredditTextView.setText(post.getSubredditName());
|
||||
((PostBaseViewHolder) holder).userTextView.setText((mShowDisplayNames) ? post.getAuthor() : post.getAuthorInfo().getUsername());
|
||||
((PostBaseViewHolder) holder).subredditTextView.setText((mShowDisplayNames) ? post.getSubredditName() : post.getCommunityInfo().getName());
|
||||
if (!mHideSubredditAndUserPrefix) {
|
||||
((PostBaseViewHolder) holder).communityInstanceTextView.setText('@' + post.getSubredditNamePrefixed().split(Pattern.quote("@"))[1]);
|
||||
((PostBaseViewHolder) holder).userTextView.setText(post.getAuthor());
|
||||
((PostBaseViewHolder) holder).userInstanceTextView.setText('@' + post.getAuthorNamePrefixed().split(Pattern.quote("@"))[1]);
|
||||
((PostBaseViewHolder) holder).communityInstanceTextView.setTextColor(CustomThemeWrapper.darkenColor(mSubredditColor, 0.7f));
|
||||
((PostBaseViewHolder) holder).userInstanceTextView.setTextColor(CustomThemeWrapper.darkenColor(post.isModerator() || post.isAdmin() ? mModeratorColor : mUsernameColor, 0.7f));
|
||||
@ -599,10 +598,6 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
|
||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
|
||||
.into(((PostBaseViewHolder) holder).iconGifImageView);
|
||||
}
|
||||
|
||||
if (holder.getBindingAdapterPosition() >= 0) {
|
||||
post.setSubredditIconUrl(iconUrl);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else if (!post.getSubredditIconUrl().equals("")) {
|
||||
@ -1191,9 +1186,6 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
|
||||
.into(((PostCompactBaseViewHolder) holder).iconGifImageView);
|
||||
}
|
||||
|
||||
if (holder.getBindingAdapterPosition() >= 0) {
|
||||
post.setSubredditIconUrl(iconUrl);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else if (!post.getSubredditIconUrl().equals("")) {
|
||||
@ -1210,10 +1202,8 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
|
||||
}
|
||||
|
||||
((PostCompactBaseViewHolder) holder).nameTextView.setTextColor(mSubredditColor);
|
||||
if (mHideSubredditAndUserPrefix) {
|
||||
((PostCompactBaseViewHolder) holder).nameTextView.setText(post.getSubredditName());
|
||||
} else {
|
||||
((PostCompactBaseViewHolder) holder).nameTextView.setText(post.getSubredditName());
|
||||
((PostCompactBaseViewHolder) holder).nameTextView.setText((mShowDisplayNames) ? post.getSubredditName() : post.getCommunityInfo().getName());
|
||||
if (!mHideSubredditAndUserPrefix) {
|
||||
((PostCompactBaseViewHolder) holder).instanceTextView.setText('@' + post.getSubredditNamePrefixed().split(Pattern.quote("@"))[1]);
|
||||
((PostCompactBaseViewHolder) holder).instanceTextView.setTextColor(CustomThemeWrapper.darkenColor(mSubredditColor, 0.7f));
|
||||
}
|
||||
@ -2547,7 +2537,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
|
||||
return false;
|
||||
});
|
||||
|
||||
userTextView.setOnClickListener(view -> {
|
||||
View.OnClickListener onClickListener = view -> {
|
||||
if (!canStartActivity) {
|
||||
return;
|
||||
}
|
||||
@ -2564,49 +2554,35 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
|
||||
intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, post.getAuthor());
|
||||
intent.putExtra(ViewUserDetailActivity.EXTRA_QUALIFIED_USER_NAME_KEY, post.getAuthorNamePrefixed());
|
||||
mActivity.startActivity(intent);
|
||||
});
|
||||
};
|
||||
userTextView.setOnClickListener(onClickListener);
|
||||
userInstanceTextView.setOnClickListener(onClickListener);
|
||||
|
||||
|
||||
View.OnClickListener onClickListener1 = view -> {
|
||||
int position = getBindingAdapterPosition();
|
||||
if (position < 0) {
|
||||
return;
|
||||
}
|
||||
Post post = getItem(position);
|
||||
if (post != null) {
|
||||
if (canStartActivity) {
|
||||
canStartActivity = false;
|
||||
Intent intent = new Intent(mActivity, ViewSubredditDetailActivity.class);
|
||||
intent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY,
|
||||
post.getSubredditName());
|
||||
intent.putExtra(ViewSubredditDetailActivity.EXTRA_COMMUNITY_FULL_NAME_KEY,
|
||||
post.getSubredditNamePrefixed());
|
||||
mActivity.startActivity(intent);
|
||||
}
|
||||
}
|
||||
};
|
||||
communityInstanceTextView.setOnClickListener(onClickListener1);
|
||||
if (mDisplaySubredditName) {
|
||||
subredditTextView.setOnClickListener(view -> {
|
||||
int position = getBindingAdapterPosition();
|
||||
if (position < 0) {
|
||||
return;
|
||||
}
|
||||
Post post = getItem(position);
|
||||
if (post != null) {
|
||||
if (canStartActivity) {
|
||||
canStartActivity = false;
|
||||
Intent intent = new Intent(mActivity, ViewSubredditDetailActivity.class);
|
||||
intent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY,
|
||||
post.getSubredditName());
|
||||
intent.putExtra(ViewSubredditDetailActivity.EXTRA_COMMUNITY_FULL_NAME_KEY,
|
||||
post.getSubredditNamePrefixed());
|
||||
mActivity.startActivity(intent);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
subredditTextView.setOnClickListener(onClickListener1);
|
||||
iconGifImageView.setOnClickListener(view -> subredditTextView.performClick());
|
||||
} else {
|
||||
subredditTextView.setOnClickListener(view -> {
|
||||
int position = getBindingAdapterPosition();
|
||||
if (position < 0) {
|
||||
return;
|
||||
}
|
||||
Post post = getItem(position);
|
||||
if (post != null) {
|
||||
if (canStartActivity) {
|
||||
canStartActivity = false;
|
||||
Intent intent = new Intent(mActivity, ViewSubredditDetailActivity.class);
|
||||
intent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY,
|
||||
post.getSubredditName());
|
||||
intent.putExtra(ViewSubredditDetailActivity.EXTRA_COMMUNITY_FULL_NAME_KEY,
|
||||
post.getSubredditNamePrefixed());
|
||||
mActivity.startActivity(intent);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
subredditTextView.setOnClickListener(onClickListener1);
|
||||
iconGifImageView.setOnClickListener(view -> userTextView.performClick());
|
||||
}
|
||||
|
||||
@ -4025,7 +4001,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
|
||||
return false;
|
||||
});
|
||||
|
||||
nameTextView.setOnClickListener(view -> {
|
||||
View.OnClickListener onClickListener = view -> {
|
||||
int position = getBindingAdapterPosition();
|
||||
if (position < 0) {
|
||||
return;
|
||||
@ -4047,7 +4023,10 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
|
||||
mActivity.startActivity(intent);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
nameTextView.setOnClickListener(onClickListener);
|
||||
instanceTextView.setOnClickListener(onClickListener);
|
||||
|
||||
|
||||
iconGifImageView.setOnClickListener(view -> nameTextView.performClick());
|
||||
|
||||
|
@ -0,0 +1,343 @@
|
||||
package eu.toldi.infinityforlemmy.adapters;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.net.Uri;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.text.util.Linkify;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.paging.PagedListAdapter;
|
||||
import androidx.recyclerview.widget.DiffUtil;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import eu.toldi.infinityforlemmy.NetworkState;
|
||||
import eu.toldi.infinityforlemmy.R;
|
||||
import eu.toldi.infinityforlemmy.activities.BaseActivity;
|
||||
import eu.toldi.infinityforlemmy.activities.LinkResolverActivity;
|
||||
import eu.toldi.infinityforlemmy.activities.ViewPrivateMessagesActivity;
|
||||
import eu.toldi.infinityforlemmy.activities.ViewUserDetailActivity;
|
||||
import eu.toldi.infinityforlemmy.customtheme.CustomThemeWrapper;
|
||||
import eu.toldi.infinityforlemmy.markdown.RedditHeadingPlugin;
|
||||
import eu.toldi.infinityforlemmy.markdown.SpoilerAwareMovementMethod;
|
||||
import eu.toldi.infinityforlemmy.markdown.SpoilerParserPlugin;
|
||||
import eu.toldi.infinityforlemmy.markdown.SuperscriptPlugin;
|
||||
import eu.toldi.infinityforlemmy.privatemessage.LemmyPrivateMessageAPI;
|
||||
import eu.toldi.infinityforlemmy.privatemessage.PrivateMessage;
|
||||
import io.noties.markwon.AbstractMarkwonPlugin;
|
||||
import io.noties.markwon.Markwon;
|
||||
import io.noties.markwon.MarkwonConfiguration;
|
||||
import io.noties.markwon.core.MarkwonTheme;
|
||||
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
|
||||
import io.noties.markwon.image.glide.GlideImagesPlugin;
|
||||
import io.noties.markwon.inlineparser.HtmlInlineProcessor;
|
||||
import io.noties.markwon.inlineparser.MarkwonInlineParserPlugin;
|
||||
import io.noties.markwon.linkify.LinkifyPlugin;
|
||||
import io.noties.markwon.movement.MovementMethodPlugin;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
public class PrivateMessageRecycleViewAdapter extends PagedListAdapter<PrivateMessage, RecyclerView.ViewHolder> {
|
||||
private static final int VIEW_TYPE_DATA = 0;
|
||||
private static final int VIEW_TYPE_ERROR = 1;
|
||||
private static final int VIEW_TYPE_LOADING = 2;
|
||||
private static final DiffUtil.ItemCallback<PrivateMessage> DIFF_CALLBACK = new DiffUtil.ItemCallback<>() {
|
||||
@Override
|
||||
public boolean areItemsTheSame(@NonNull PrivateMessage message, @NonNull PrivateMessage t1) {
|
||||
return message.getId() == t1.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean areContentsTheSame(@NonNull PrivateMessage message, @NonNull PrivateMessage t1) {
|
||||
return message.getContent().equals(t1.getContent());
|
||||
}
|
||||
};
|
||||
private BaseActivity mActivity;
|
||||
private Retrofit retrofit;
|
||||
private Markwon mMarkwon;
|
||||
private String mAccessToken;
|
||||
|
||||
private final LemmyPrivateMessageAPI lemmyPrivateMessageAPI;
|
||||
private int mMessageType;
|
||||
private NetworkState networkState;
|
||||
private RetryLoadingMoreCallback mRetryLoadingMoreCallback;
|
||||
private int mColorAccent;
|
||||
private int mMessageBackgroundColor;
|
||||
private int mUsernameColor;
|
||||
private int mPrimaryTextColor;
|
||||
private int mSecondaryTextColor;
|
||||
private int mUnreadMessageBackgroundColor;
|
||||
private int mColorPrimaryLightTheme;
|
||||
private int mButtonTextColor;
|
||||
private boolean markAllMessagesAsRead = false;
|
||||
|
||||
public PrivateMessageRecycleViewAdapter(BaseActivity activity, Retrofit oauthRetrofit,
|
||||
CustomThemeWrapper customThemeWrapper,
|
||||
String accessToken,
|
||||
LemmyPrivateMessageAPI lemmyPrivateMessageAPI, RetryLoadingMoreCallback retryLoadingMoreCallback) {
|
||||
super(DIFF_CALLBACK);
|
||||
mActivity = activity;
|
||||
retrofit = oauthRetrofit;
|
||||
this.lemmyPrivateMessageAPI = lemmyPrivateMessageAPI;
|
||||
mRetryLoadingMoreCallback = retryLoadingMoreCallback;
|
||||
|
||||
mColorAccent = customThemeWrapper.getColorAccent();
|
||||
mMessageBackgroundColor = customThemeWrapper.getCardViewBackgroundColor();
|
||||
mUsernameColor = customThemeWrapper.getUsername();
|
||||
mPrimaryTextColor = customThemeWrapper.getPrimaryTextColor();
|
||||
mSecondaryTextColor = customThemeWrapper.getSecondaryTextColor();
|
||||
int spoilerBackgroundColor = mSecondaryTextColor | 0xFF000000;
|
||||
mUnreadMessageBackgroundColor = customThemeWrapper.getUnreadMessageBackgroundColor();
|
||||
mColorPrimaryLightTheme = customThemeWrapper.getColorPrimaryLightTheme();
|
||||
mButtonTextColor = customThemeWrapper.getButtonTextColor();
|
||||
|
||||
// todo:https://github.com/Docile-Alligator/Infinity-For-Reddit/issues/1027
|
||||
// add tables support and replace with MarkdownUtils#commonPostMarkwonBuilder
|
||||
mMarkwon = Markwon.builder(mActivity)
|
||||
.usePlugin(MarkwonInlineParserPlugin.create(plugin -> {
|
||||
plugin.excludeInlineProcessor(HtmlInlineProcessor.class);
|
||||
}))
|
||||
.usePlugin(new AbstractMarkwonPlugin() {
|
||||
@Override
|
||||
public void configureConfiguration(@NonNull MarkwonConfiguration.Builder builder) {
|
||||
builder.linkResolver((view, link) -> {
|
||||
Intent intent = new Intent(mActivity, LinkResolverActivity.class);
|
||||
Uri uri = Uri.parse(link);
|
||||
intent.setData(uri);
|
||||
mActivity.startActivity(intent);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configureTheme(@NonNull MarkwonTheme.Builder builder) {
|
||||
builder.linkColor(customThemeWrapper.getLinkColor());
|
||||
}
|
||||
})
|
||||
.usePlugin(SuperscriptPlugin.create())
|
||||
.usePlugin(SpoilerParserPlugin.create(mSecondaryTextColor, spoilerBackgroundColor))
|
||||
.usePlugin(RedditHeadingPlugin.create())
|
||||
.usePlugin(StrikethroughPlugin.create())
|
||||
.usePlugin(MovementMethodPlugin.create(new SpoilerAwareMovementMethod()))
|
||||
.usePlugin(LinkifyPlugin.create(Linkify.WEB_URLS))
|
||||
.usePlugin(GlideImagesPlugin.create(mActivity))
|
||||
.build();
|
||||
mAccessToken = accessToken;
|
||||
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
if (viewType == VIEW_TYPE_DATA) {
|
||||
return new DataViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_message, parent, false));
|
||||
} else if (viewType == VIEW_TYPE_ERROR) {
|
||||
return new ErrorViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_footer_error, parent, false));
|
||||
} else {
|
||||
return new LoadingViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_footer_loading, parent, false));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
if (holder instanceof DataViewHolder) {
|
||||
PrivateMessage message = getItem(holder.getBindingAdapterPosition());
|
||||
if (message != null) {
|
||||
|
||||
if (!message.getRead()) {
|
||||
if (markAllMessagesAsRead) {
|
||||
message.setRead(true);
|
||||
} else {
|
||||
holder.itemView.setBackgroundColor(
|
||||
mUnreadMessageBackgroundColor);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
((DataViewHolder) holder).titleTextView.setVisibility(View.GONE);
|
||||
|
||||
|
||||
((DataViewHolder) holder).authorTextView.setText(message.getCreatorQualifiedName());
|
||||
String subject = message.getRecipientQualifiedName();
|
||||
((DataViewHolder) holder).subjectTextView.setText(subject);
|
||||
mMarkwon.setMarkdown(((DataViewHolder) holder).contentCustomMarkwonView, message.getContent());
|
||||
|
||||
holder.itemView.setOnClickListener(view -> {
|
||||
|
||||
Intent intent = new Intent(mActivity, ViewPrivateMessagesActivity.class);
|
||||
intent.putExtra(ViewPrivateMessagesActivity.EXTRA_PRIVATE_MESSAGE, message);
|
||||
mActivity.startActivity(intent);
|
||||
|
||||
|
||||
if (message.getRead()) {
|
||||
holder.itemView.setBackgroundColor(mMessageBackgroundColor);
|
||||
|
||||
|
||||
lemmyPrivateMessageAPI.markPrivateMessageAsRead(mAccessToken, message.getId(), new LemmyPrivateMessageAPI.PrivateMessageMarkedAsReadListener() {
|
||||
|
||||
@Override
|
||||
public void onPrivateMessageMarkedAsReadError() {
|
||||
message.setRead(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPrivateMessageMarkedAsReadSuccess() {
|
||||
message.setRead(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
((DataViewHolder) holder).authorTextView.setOnClickListener(view -> {
|
||||
|
||||
Intent intent = new Intent(mActivity, ViewUserDetailActivity.class);
|
||||
intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, message.getCreatorName());
|
||||
intent.putExtra(ViewUserDetailActivity.EXTRA_QUALIFIED_USER_NAME_KEY, message.getCreatorQualifiedName());
|
||||
mActivity.startActivity(intent);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
// Reached at the end
|
||||
if (hasExtraRow() && position == getItemCount() - 1) {
|
||||
if (networkState.getStatus() == NetworkState.Status.LOADING) {
|
||||
return VIEW_TYPE_LOADING;
|
||||
} else {
|
||||
return VIEW_TYPE_ERROR;
|
||||
}
|
||||
} else {
|
||||
return VIEW_TYPE_DATA;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
if (hasExtraRow()) {
|
||||
return super.getItemCount() + 1;
|
||||
}
|
||||
return super.getItemCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewRecycled(@NonNull RecyclerView.ViewHolder holder) {
|
||||
super.onViewRecycled(holder);
|
||||
if (holder instanceof DataViewHolder) {
|
||||
((DataViewHolder) holder).itemView.setBackgroundColor(mMessageBackgroundColor);
|
||||
((DataViewHolder) holder).titleTextView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean hasExtraRow() {
|
||||
return networkState != null && networkState.getStatus() != NetworkState.Status.SUCCESS;
|
||||
}
|
||||
|
||||
public void setNetworkState(NetworkState newNetworkState) {
|
||||
NetworkState previousState = this.networkState;
|
||||
boolean previousExtraRow = hasExtraRow();
|
||||
this.networkState = newNetworkState;
|
||||
boolean newExtraRow = hasExtraRow();
|
||||
if (previousExtraRow != newExtraRow) {
|
||||
if (previousExtraRow) {
|
||||
notifyItemRemoved(super.getItemCount());
|
||||
} else {
|
||||
notifyItemInserted(super.getItemCount());
|
||||
}
|
||||
} else if (newExtraRow && !previousState.equals(newNetworkState)) {
|
||||
notifyItemChanged(getItemCount() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
public void updateMessageReply(PrivateMessage newReply, int position) {
|
||||
if (position >= 0 && position < super.getItemCount()) {
|
||||
PrivateMessage message = getItem(position);
|
||||
if (message != null) {
|
||||
notifyItemChanged(position);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setMarkAllMessagesAsRead(boolean markAllMessagesAsRead) {
|
||||
this.markAllMessagesAsRead = markAllMessagesAsRead;
|
||||
}
|
||||
|
||||
public interface RetryLoadingMoreCallback {
|
||||
void retryLoadingMore();
|
||||
}
|
||||
|
||||
class DataViewHolder extends RecyclerView.ViewHolder {
|
||||
@BindView(R.id.author_text_view_item_message)
|
||||
TextView authorTextView;
|
||||
@BindView(R.id.subject_text_view_item_message)
|
||||
TextView subjectTextView;
|
||||
@BindView(R.id.title_text_view_item_message)
|
||||
TextView titleTextView;
|
||||
@BindView(R.id.content_custom_markwon_view_item_message)
|
||||
TextView contentCustomMarkwonView;
|
||||
|
||||
DataViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
ButterKnife.bind(this, itemView);
|
||||
if (mActivity.typeface != null) {
|
||||
authorTextView.setTypeface(mActivity.typeface);
|
||||
subjectTextView.setTypeface(mActivity.typeface);
|
||||
titleTextView.setTypeface(mActivity.titleTypeface);
|
||||
contentCustomMarkwonView.setTypeface(mActivity.contentTypeface);
|
||||
}
|
||||
itemView.setBackgroundColor(mMessageBackgroundColor);
|
||||
authorTextView.setTextColor(mUsernameColor);
|
||||
subjectTextView.setTextColor(mPrimaryTextColor);
|
||||
titleTextView.setTextColor(mPrimaryTextColor);
|
||||
contentCustomMarkwonView.setTextColor(mSecondaryTextColor);
|
||||
|
||||
contentCustomMarkwonView.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
|
||||
contentCustomMarkwonView.setOnClickListener(view -> {
|
||||
if (contentCustomMarkwonView.getSelectionStart() == -1 && contentCustomMarkwonView.getSelectionEnd() == -1) {
|
||||
itemView.performClick();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class ErrorViewHolder extends RecyclerView.ViewHolder {
|
||||
@BindView(R.id.error_text_view_item_footer_error)
|
||||
TextView errorTextView;
|
||||
@BindView(R.id.retry_button_item_footer_error)
|
||||
Button retryButton;
|
||||
|
||||
ErrorViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
ButterKnife.bind(this, itemView);
|
||||
if (mActivity.typeface != null) {
|
||||
errorTextView.setTypeface(mActivity.typeface);
|
||||
retryButton.setTypeface(mActivity.typeface);
|
||||
}
|
||||
errorTextView.setText(R.string.load_comments_failed);
|
||||
errorTextView.setTextColor(mSecondaryTextColor);
|
||||
retryButton.setOnClickListener(view -> mRetryLoadingMoreCallback.retryLoadingMore());
|
||||
retryButton.setBackgroundTintList(ColorStateList.valueOf(mColorPrimaryLightTheme));
|
||||
retryButton.setTextColor(mButtonTextColor);
|
||||
}
|
||||
}
|
||||
|
||||
class LoadingViewHolder extends RecyclerView.ViewHolder {
|
||||
@BindView(R.id.progress_bar_item_footer_loading)
|
||||
ProgressBar progressBar;
|
||||
|
||||
LoadingViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
ButterKnife.bind(this, itemView);
|
||||
progressBar.setIndeterminateTintList(ColorStateList.valueOf(mColorAccent));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,34 +27,35 @@ import java.util.Locale;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import io.noties.markwon.AbstractMarkwonPlugin;
|
||||
import io.noties.markwon.Markwon;
|
||||
import io.noties.markwon.MarkwonConfiguration;
|
||||
import io.noties.markwon.core.MarkwonTheme;
|
||||
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
|
||||
import io.noties.markwon.inlineparser.BangInlineProcessor;
|
||||
import io.noties.markwon.inlineparser.HtmlInlineProcessor;
|
||||
import io.noties.markwon.inlineparser.MarkwonInlineParserPlugin;
|
||||
import io.noties.markwon.linkify.LinkifyPlugin;
|
||||
import io.noties.markwon.movement.MovementMethodPlugin;
|
||||
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
|
||||
import eu.toldi.infinityforlemmy.R;
|
||||
import eu.toldi.infinityforlemmy.activities.LinkResolverActivity;
|
||||
import eu.toldi.infinityforlemmy.activities.ViewPrivateMessagesActivity;
|
||||
import eu.toldi.infinityforlemmy.activities.ViewUserDetailActivity;
|
||||
import eu.toldi.infinityforlemmy.customtheme.CustomThemeWrapper;
|
||||
import eu.toldi.infinityforlemmy.markdown.ClickableGlideImagesPlugin;
|
||||
import eu.toldi.infinityforlemmy.markdown.RedditHeadingPlugin;
|
||||
import eu.toldi.infinityforlemmy.markdown.SpoilerAwareMovementMethod;
|
||||
import eu.toldi.infinityforlemmy.markdown.SpoilerParserPlugin;
|
||||
import eu.toldi.infinityforlemmy.markdown.SuperscriptPlugin;
|
||||
import eu.toldi.infinityforlemmy.message.Message;
|
||||
import eu.toldi.infinityforlemmy.privatemessage.PrivateMessage;
|
||||
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.core.MarkwonTheme;
|
||||
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
|
||||
import io.noties.markwon.image.glide.GlideImagesPlugin;
|
||||
import io.noties.markwon.inlineparser.HtmlInlineProcessor;
|
||||
import io.noties.markwon.inlineparser.MarkwonInlineParserPlugin;
|
||||
import io.noties.markwon.linkify.LinkifyPlugin;
|
||||
import io.noties.markwon.movement.MovementMethodPlugin;
|
||||
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
|
||||
|
||||
public class PrivateMessagesDetailRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
private static final int VIEW_TYPE_MESSAGE_SENT = 0;
|
||||
private static final int VIEW_TYPE_MESSAGE_RECEIVED = 1;
|
||||
private Message mMessage;
|
||||
private PrivateMessage mMessage;
|
||||
private ViewPrivateMessagesActivity mViewPrivateMessagesActivity;
|
||||
private RequestManager mGlide;
|
||||
private Locale mLocale;
|
||||
@ -70,7 +71,7 @@ public class PrivateMessagesDetailRecyclerViewAdapter extends RecyclerView.Adapt
|
||||
|
||||
public PrivateMessagesDetailRecyclerViewAdapter(ViewPrivateMessagesActivity viewPrivateMessagesActivity,
|
||||
SharedPreferences sharedPreferences, Locale locale,
|
||||
Message message, String accountName,
|
||||
PrivateMessage message, String accountName,
|
||||
CustomThemeWrapper customThemeWrapper) {
|
||||
mMessage = message;
|
||||
mViewPrivateMessagesActivity = viewPrivateMessagesActivity;
|
||||
@ -83,7 +84,6 @@ public class PrivateMessagesDetailRecyclerViewAdapter extends RecyclerView.Adapt
|
||||
mMarkwon = Markwon.builder(viewPrivateMessagesActivity)
|
||||
.usePlugin(MarkwonInlineParserPlugin.create(plugin -> {
|
||||
plugin.excludeInlineProcessor(HtmlInlineProcessor.class);
|
||||
plugin.excludeInlineProcessor(BangInlineProcessor.class);
|
||||
}))
|
||||
.usePlugin(new AbstractMarkwonPlugin() {
|
||||
@Override
|
||||
@ -108,6 +108,8 @@ public class PrivateMessagesDetailRecyclerViewAdapter extends RecyclerView.Adapt
|
||||
builder.linkColor(customThemeWrapper.getLinkColor());
|
||||
}
|
||||
})
|
||||
.usePlugin(GlideImagesPlugin.create(viewPrivateMessagesActivity))
|
||||
.usePlugin(ClickableGlideImagesPlugin.create(viewPrivateMessagesActivity))
|
||||
.usePlugin(SuperscriptPlugin.create())
|
||||
.usePlugin(StrikethroughPlugin.create())
|
||||
.usePlugin(SpoilerParserPlugin.create(commentColor, commentColor | 0xFF000000))
|
||||
@ -127,9 +129,9 @@ public class PrivateMessagesDetailRecyclerViewAdapter extends RecyclerView.Adapt
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
if (position == 0) {
|
||||
return mMessage.getAuthor().equals(mAccountName) ? VIEW_TYPE_MESSAGE_SENT : VIEW_TYPE_MESSAGE_RECEIVED;
|
||||
return mMessage.getCreatorQualifiedName().equals(mAccountName) ? VIEW_TYPE_MESSAGE_SENT : VIEW_TYPE_MESSAGE_RECEIVED;
|
||||
} else {
|
||||
return mMessage.getReplies().get(position - 1).getAuthor().equals(mAccountName) ? VIEW_TYPE_MESSAGE_SENT : VIEW_TYPE_MESSAGE_RECEIVED;
|
||||
return mMessage.getReplies().get(position - 1).getCreatorQualifiedName().equals(mAccountName) ? VIEW_TYPE_MESSAGE_SENT : VIEW_TYPE_MESSAGE_RECEIVED;
|
||||
}
|
||||
}
|
||||
|
||||
@ -145,7 +147,7 @@ public class PrivateMessagesDetailRecyclerViewAdapter extends RecyclerView.Adapt
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
Message message;
|
||||
PrivateMessage message;
|
||||
if (holder.getBindingAdapterPosition() == 0) {
|
||||
message = mMessage;
|
||||
} else {
|
||||
@ -153,12 +155,12 @@ public class PrivateMessagesDetailRecyclerViewAdapter extends RecyclerView.Adapt
|
||||
}
|
||||
if (message != null) {
|
||||
if (holder instanceof MessageViewHolder) {
|
||||
mMarkwon.setMarkdown(((MessageViewHolder) holder).messageTextView, message.getBody());
|
||||
mMarkwon.setMarkdown(((MessageViewHolder) holder).messageTextView, message.getContent());
|
||||
|
||||
if (mShowElapsedTime) {
|
||||
((MessageViewHolder) holder).timeTextView.setText(Utils.getElapsedTime(mViewPrivateMessagesActivity, message.getTimeUTC()));
|
||||
((MessageViewHolder) holder).timeTextView.setText(Utils.getElapsedTime(mViewPrivateMessagesActivity, message.getPublished()));
|
||||
} else {
|
||||
((MessageViewHolder) holder).timeTextView.setText(Utils.getFormattedTime(mLocale, message.getTimeUTC(), mTimeFormatPattern));
|
||||
((MessageViewHolder) holder).timeTextView.setText(Utils.getFormattedTime(mLocale, message.getPublished(), mTimeFormatPattern));
|
||||
}
|
||||
}
|
||||
|
||||
@ -166,26 +168,33 @@ public class PrivateMessagesDetailRecyclerViewAdapter extends RecyclerView.Adapt
|
||||
((SentMessageViewHolder) holder).messageTextView.setBackground(Utils.getTintedDrawable(mViewPrivateMessagesActivity,
|
||||
R.drawable.private_message_ballon, mSentMessageBackgroundColor));
|
||||
} else if (holder instanceof ReceivedMessageViewHolder) {
|
||||
mViewPrivateMessagesActivity.fetchUserAvatar(message.getAuthor(), userAvatarUrl -> {
|
||||
if (userAvatarUrl == null || userAvatarUrl.equals("")) {
|
||||
mGlide.load(R.drawable.subreddit_default_icon)
|
||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
||||
.into(((ReceivedMessageViewHolder) holder).userAvatarImageView);
|
||||
} else {
|
||||
mGlide.load(userAvatarUrl)
|
||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
||||
.error(mGlide.load(R.drawable.subreddit_default_icon)
|
||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
|
||||
.into(((ReceivedMessageViewHolder) holder).userAvatarImageView);
|
||||
}
|
||||
});
|
||||
if (!message.getCreatorAvatar().equals("")) {
|
||||
mGlide.load(message.getCreatorAvatar())
|
||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
||||
.error(mGlide.load(R.drawable.subreddit_default_icon)
|
||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
|
||||
.into(((ReceivedMessageViewHolder) holder).userAvatarImageView);
|
||||
} else {
|
||||
mViewPrivateMessagesActivity.fetchUserAvatar(message.getCreatorQualifiedName(), userAvatarUrl -> {
|
||||
if (userAvatarUrl == null || userAvatarUrl.equals("")) {
|
||||
mGlide.load(R.drawable.subreddit_default_icon)
|
||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
||||
.into(((ReceivedMessageViewHolder) holder).userAvatarImageView);
|
||||
} else {
|
||||
mGlide.load(userAvatarUrl)
|
||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
||||
.error(mGlide.load(R.drawable.subreddit_default_icon)
|
||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
|
||||
.into(((ReceivedMessageViewHolder) holder).userAvatarImageView);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
((ReceivedMessageViewHolder) holder).userAvatarImageView.setOnClickListener(view -> {
|
||||
if (message.isAuthorDeleted()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Intent intent = new Intent(mViewPrivateMessagesActivity, ViewUserDetailActivity.class);
|
||||
intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, message.getAuthor());
|
||||
intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, message.getCreatorName());
|
||||
intent.putExtra(ViewUserDetailActivity.EXTRA_QUALIFIED_USER_NAME_KEY, message.getCreatorQualifiedName());
|
||||
mViewPrivateMessagesActivity.startActivity(intent);
|
||||
});
|
||||
|
||||
@ -207,12 +216,12 @@ public class PrivateMessagesDetailRecyclerViewAdapter extends RecyclerView.Adapt
|
||||
}
|
||||
}
|
||||
|
||||
public void setMessage(Message message) {
|
||||
public void setMessage(PrivateMessage message) {
|
||||
mMessage = message;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void addReply(Message reply) {
|
||||
public void addReply(PrivateMessage reply) {
|
||||
int currentSize = getItemCount();
|
||||
|
||||
if (mMessage != null) {
|
||||
@ -273,7 +282,7 @@ public class PrivateMessagesDetailRecyclerViewAdapter extends RecyclerView.Adapt
|
||||
copyImageView.setColorFilter(mSecondaryTextColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
|
||||
copyImageView.setOnClickListener(view -> {
|
||||
Message message;
|
||||
PrivateMessage message;
|
||||
if (getBindingAdapterPosition() == 0) {
|
||||
message = mMessage;
|
||||
} else {
|
||||
@ -282,7 +291,7 @@ public class PrivateMessagesDetailRecyclerViewAdapter extends RecyclerView.Adapt
|
||||
if (message != null) {
|
||||
ClipboardManager clipboard = (ClipboardManager) mViewPrivateMessagesActivity.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
if (clipboard != null) {
|
||||
ClipData clip = ClipData.newPlainText("simple text", message.getBody());
|
||||
ClipData clip = ClipData.newPlainText("simple text", message.getContent());
|
||||
clipboard.setPrimaryClip(clip);
|
||||
if (android.os.Build.VERSION.SDK_INT < 33) {
|
||||
Toast.makeText(mViewPrivateMessagesActivity, R.string.copy_success, Toast.LENGTH_SHORT).show();
|
||||
|
@ -16,13 +16,6 @@ import java.util.ArrayList;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
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 me.saket.bettermovementmethod.BetterLinkMovementMethod;
|
||||
import eu.toldi.infinityforlemmy.R;
|
||||
import eu.toldi.infinityforlemmy.Rule;
|
||||
import eu.toldi.infinityforlemmy.activities.BaseActivity;
|
||||
@ -33,6 +26,13 @@ import eu.toldi.infinityforlemmy.customviews.SwipeLockInterface;
|
||||
import eu.toldi.infinityforlemmy.customviews.SwipeLockLinearLayoutManager;
|
||||
import eu.toldi.infinityforlemmy.customviews.slidr.widget.SliderPanel;
|
||||
import eu.toldi.infinityforlemmy.markdown.MarkdownUtils;
|
||||
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 me.saket.bettermovementmethod.BetterLinkMovementMethod;
|
||||
|
||||
public class RulesRecyclerViewAdapter extends RecyclerView.Adapter<RulesRecyclerViewAdapter.RuleViewHolder> {
|
||||
private BaseActivity activity;
|
||||
|
@ -1,9 +1,11 @@
|
||||
package eu.toldi.infinityforlemmy.adapters;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Handler;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@ -22,6 +24,7 @@ import eu.toldi.infinityforlemmy.R;
|
||||
import eu.toldi.infinityforlemmy.RedditDataRoomDatabase;
|
||||
import eu.toldi.infinityforlemmy.activities.BaseActivity;
|
||||
import eu.toldi.infinityforlemmy.activities.ViewSubredditDetailActivity;
|
||||
import eu.toldi.infinityforlemmy.asynctasks.InsertSubscribedThings;
|
||||
import eu.toldi.infinityforlemmy.customtheme.CustomThemeWrapper;
|
||||
import eu.toldi.infinityforlemmy.subscribedsubreddit.SubscribedSubredditData;
|
||||
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
|
||||
@ -158,11 +161,31 @@ public class SubscribedSubredditsRecyclerViewAdapter extends RecyclerView.Adapte
|
||||
fullname = mSubscribedSubredditData.get(viewHolder.getBindingAdapterPosition() - offset).getQualified_name();
|
||||
iconUrl = mSubscribedSubredditData.get(viewHolder.getBindingAdapterPosition() - offset).getIconUrl();
|
||||
|
||||
if (mSubscribedSubredditData.get(viewHolder.getBindingAdapterPosition() - offset).isFavorite()) {
|
||||
((SubredditViewHolder) viewHolder).favoriteImageView.setImageResource(R.drawable.ic_favorite_24dp);
|
||||
} else {
|
||||
((SubredditViewHolder) viewHolder).favoriteImageView.setImageResource(R.drawable.ic_favorite_border_24dp);
|
||||
}
|
||||
|
||||
((SubredditViewHolder) viewHolder).favoriteImageView.setOnClickListener(view -> {
|
||||
if (mSubscribedSubredditData.get(viewHolder.getBindingAdapterPosition() - offset).isFavorite()) {
|
||||
((SubredditViewHolder) viewHolder).favoriteImageView.setImageResource(R.drawable.ic_favorite_border_24dp);
|
||||
mSubscribedSubredditData.get(viewHolder.getBindingAdapterPosition() - offset).setFavorite(false);
|
||||
} else {
|
||||
((SubredditViewHolder) viewHolder).favoriteImageView.setImageResource(R.drawable.ic_favorite_24dp);
|
||||
mSubscribedSubredditData.get(viewHolder.getBindingAdapterPosition() - offset).setFavorite(true);
|
||||
}
|
||||
InsertSubscribedThings.insertSubscribedThings(mExecutor, new Handler(), mRedditDataRoomDatabase, mSubscribedSubredditData.get(viewHolder.getBindingAdapterPosition() - offset),
|
||||
() -> {
|
||||
});
|
||||
});
|
||||
|
||||
if (itemClickListener != null) {
|
||||
viewHolder.itemView.setOnClickListener(view -> itemClickListener.onClick(communityData));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (itemClickListener == null) {
|
||||
String finalFullname = fullname;
|
||||
viewHolder.itemView.setOnClickListener(view -> {
|
||||
@ -201,12 +224,33 @@ public class SubscribedSubredditsRecyclerViewAdapter extends RecyclerView.Adapte
|
||||
String name = mFavoriteSubscribedSubredditData.get(viewHolder.getBindingAdapterPosition() - offset).getName();
|
||||
String iconUrl = mFavoriteSubscribedSubredditData.get(viewHolder.getBindingAdapterPosition() - offset).getIconUrl();
|
||||
|
||||
if (mFavoriteSubscribedSubredditData.get(viewHolder.getBindingAdapterPosition() - offset).isFavorite()) {
|
||||
((FavoriteSubredditViewHolder) viewHolder).favoriteImageView.setImageResource(R.drawable.ic_favorite_24dp);
|
||||
} else {
|
||||
((FavoriteSubredditViewHolder) viewHolder).favoriteImageView.setImageResource(R.drawable.ic_favorite_border_24dp);
|
||||
}
|
||||
|
||||
((FavoriteSubredditViewHolder) viewHolder).favoriteImageView.setOnClickListener(view -> {
|
||||
if (mFavoriteSubscribedSubredditData.get(viewHolder.getBindingAdapterPosition() - offset).isFavorite()) {
|
||||
((FavoriteSubredditViewHolder) viewHolder).favoriteImageView.setImageResource(R.drawable.ic_favorite_border_24dp);
|
||||
mFavoriteSubscribedSubredditData.get(viewHolder.getBindingAdapterPosition() - offset).setFavorite(false);
|
||||
} else {
|
||||
((FavoriteSubredditViewHolder) viewHolder).favoriteImageView.setImageResource(R.drawable.ic_favorite_24dp);
|
||||
mFavoriteSubscribedSubredditData.get(viewHolder.getBindingAdapterPosition() - offset).setFavorite(true);
|
||||
}
|
||||
InsertSubscribedThings.insertSubscribedThings(mExecutor, new Handler(), mRedditDataRoomDatabase, mFavoriteSubscribedSubredditData.get(viewHolder.getBindingAdapterPosition() - offset),
|
||||
() -> {
|
||||
});
|
||||
});
|
||||
|
||||
if (itemClickListener != null) {
|
||||
viewHolder.itemView.setOnClickListener(view -> itemClickListener.onClick(communityData));
|
||||
} else {
|
||||
viewHolder.itemView.setOnClickListener(view -> {
|
||||
Intent intent = new Intent(mActivity, ViewSubredditDetailActivity.class);
|
||||
intent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, name);
|
||||
intent.putExtra(ViewSubredditDetailActivity.EXTRA_COMMUNITY_FULL_NAME_KEY,
|
||||
mFavoriteSubscribedSubredditData.get(viewHolder.getBindingAdapterPosition() - offset).getQualified_name());
|
||||
mActivity.startActivity(intent);
|
||||
});
|
||||
}
|
||||
@ -243,6 +287,7 @@ public class SubscribedSubredditsRecyclerViewAdapter extends RecyclerView.Adapte
|
||||
public void onViewRecycled(@NonNull RecyclerView.ViewHolder holder) {
|
||||
if(holder instanceof SubredditViewHolder) {
|
||||
glide.clear(((SubredditViewHolder) holder).iconGifImageView);
|
||||
((SubredditViewHolder) holder).favoriteImageView.setVisibility(View.VISIBLE);
|
||||
} else if (holder instanceof FavoriteSubredditViewHolder) {
|
||||
glide.clear(((FavoriteSubredditViewHolder) holder).iconGifImageView);
|
||||
}
|
||||
@ -317,6 +362,8 @@ public class SubscribedSubredditsRecyclerViewAdapter extends RecyclerView.Adapte
|
||||
GifImageView iconGifImageView;
|
||||
@BindView(R.id.thing_name_text_view_item_subscribed_thing)
|
||||
TextView subredditNameTextView;
|
||||
@BindView(R.id.favorite_image_view_item_subscribed_thing)
|
||||
ImageView favoriteImageView;
|
||||
|
||||
SubredditViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
@ -333,6 +380,9 @@ public class SubscribedSubredditsRecyclerViewAdapter extends RecyclerView.Adapte
|
||||
GifImageView iconGifImageView;
|
||||
@BindView(R.id.thing_name_text_view_item_subscribed_thing)
|
||||
TextView subredditNameTextView;
|
||||
@BindView(R.id.favorite_image_view_item_subscribed_thing)
|
||||
ImageView favoriteImageView;
|
||||
|
||||
|
||||
FavoriteSubredditViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
|
@ -24,7 +24,7 @@ public class LemmySectionRecyclerViewAdapter extends RecyclerView.Adapter<Recycl
|
||||
private static final int VIEW_TYPE_MENU_ITEM = 2;
|
||||
private static final int LEMMY_SECTION_ITEMS = 2;
|
||||
|
||||
private static final int LEMMY_SECTION_ANONYMOUS_ITEMS = 1;
|
||||
private static final int LEMMY_SECTION_ANONYMOUS_ITEMS = 2;
|
||||
private final boolean isLoggedIn;
|
||||
|
||||
private BaseActivity baseActivity;
|
||||
@ -93,9 +93,15 @@ public class LemmySectionRecyclerViewAdapter extends RecyclerView.Adapter<Recycl
|
||||
drawableId = R.drawable.ic_baseline_info_24;
|
||||
break;
|
||||
case 2:
|
||||
stringId = R.string.blocks;
|
||||
drawableId = R.drawable.ic_outline_lock_24dp;
|
||||
break;
|
||||
if (isLoggedIn) {
|
||||
stringId = R.string.blocks;
|
||||
drawableId = R.drawable.ic_outline_lock_24dp;
|
||||
break;
|
||||
} else {
|
||||
stringId = R.string.anonymous_account_instance;
|
||||
drawableId = R.drawable.ic_account_circle_24dp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
((MenuItemViewHolder) holder).menuTextView.setText(stringId);
|
||||
|
@ -15,9 +15,15 @@ import eu.toldi.infinityforlemmy.dto.EditCommentDTO;
|
||||
import eu.toldi.infinityforlemmy.dto.EditPostDTO;
|
||||
import eu.toldi.infinityforlemmy.dto.FollowCommunityDTO;
|
||||
import eu.toldi.infinityforlemmy.dto.PostVoteDTO;
|
||||
import eu.toldi.infinityforlemmy.dto.PrivateMessageDTO;
|
||||
import eu.toldi.infinityforlemmy.dto.PrivateMessageReadDTO;
|
||||
import eu.toldi.infinityforlemmy.dto.PrivateMessageReportDTO;
|
||||
import eu.toldi.infinityforlemmy.dto.PrivateMessageUpdateDTO;
|
||||
import eu.toldi.infinityforlemmy.dto.ReadCommentDTO;
|
||||
import eu.toldi.infinityforlemmy.dto.ReadMessageDTO;
|
||||
import eu.toldi.infinityforlemmy.dto.ReadPostDTO;
|
||||
import eu.toldi.infinityforlemmy.dto.ReportCommentDTO;
|
||||
import eu.toldi.infinityforlemmy.dto.ReportPostDTO;
|
||||
import eu.toldi.infinityforlemmy.dto.SaveCommentDTO;
|
||||
import eu.toldi.infinityforlemmy.dto.SavePostDTO;
|
||||
import eu.toldi.infinityforlemmy.dto.SubmitPostDTO;
|
||||
@ -82,6 +88,10 @@ public interface LemmyAPI {
|
||||
@POST("api/v3/post")
|
||||
Call<String> postCreate(@Body SubmitPostDTO params);
|
||||
|
||||
@Headers("Content-Type: application/json")
|
||||
@POST("api/v3/post/report")
|
||||
Call<String> postReport(@Body ReportPostDTO params);
|
||||
|
||||
@Headers("Content-Type: application/json")
|
||||
@PUT("api/v3/post")
|
||||
Call<String> postUpdate(@Body EditPostDTO params);
|
||||
@ -138,6 +148,10 @@ public interface LemmyAPI {
|
||||
@POST("api/v3/comment/like")
|
||||
Call<String> commentLike(@Body CommentVoteDTO params);
|
||||
|
||||
@Headers("Content-Type: application/json")
|
||||
@POST("api/v3/comment/report")
|
||||
Call<String> commentReport(@Body ReportCommentDTO params);
|
||||
|
||||
@Headers("Content-Type: application/json")
|
||||
@POST("api/v3/community/follow")
|
||||
Call<String> communityFollow(@Body FollowCommunityDTO params);
|
||||
@ -236,4 +250,37 @@ public interface LemmyAPI {
|
||||
Call<String> getSiteInfo(
|
||||
@Query("auth") String auth
|
||||
);
|
||||
|
||||
@GET("api/v3/private_message/list")
|
||||
Call<String> privateMessagesList(
|
||||
@Query("page") Integer page,
|
||||
@Query("limit") Integer limit,
|
||||
@Query("unread_only") Boolean unread_only,
|
||||
@NonNull @Query("auth") String auth
|
||||
);
|
||||
|
||||
@POST("api/v3/private_message")
|
||||
Call<String> privateMessageSend(
|
||||
@Body PrivateMessageDTO params
|
||||
);
|
||||
|
||||
@PUT("api/v3/private_message")
|
||||
Call<String> privateMessageEdit(
|
||||
@Body PrivateMessageUpdateDTO params
|
||||
);
|
||||
|
||||
@POST("api/v3/private_message/delete")
|
||||
Call<String> privateMessageDelete(
|
||||
@Body PrivateMessageUpdateDTO params
|
||||
);
|
||||
|
||||
@POST("api/v3/private_message/mark_as_read")
|
||||
Call<String> privateMessageMarkAsRead(
|
||||
@Body PrivateMessageReadDTO params
|
||||
);
|
||||
|
||||
@POST("api/v3/private_message/report")
|
||||
Call<String> privateMessageReport(
|
||||
@Body PrivateMessageReportDTO params
|
||||
);
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ public class InsertSubscribedThings {
|
||||
if (subscribedSubredditDataList != null) {
|
||||
List<SubscribedSubredditData> existingSubscribedSubredditDataList =
|
||||
subscribedSubredditDao.getAllSubscribedSubredditsList(accountName);
|
||||
Collections.sort(subscribedSubredditDataList, (subscribedSubredditData, t1) -> subscribedSubredditData.getName().compareToIgnoreCase(t1.getName()));
|
||||
Collections.sort(subscribedSubredditDataList, (subscribedSubredditData, t1) -> subscribedSubredditData.getQualified_name().compareToIgnoreCase(t1.getQualified_name()));
|
||||
List<String> unsubscribedSubreddits = new ArrayList<>();
|
||||
compareTwoSubscribedSubredditList(subscribedSubredditDataList, existingSubscribedSubredditDataList,
|
||||
unsubscribedSubreddits);
|
||||
@ -48,6 +48,9 @@ public class InsertSubscribedThings {
|
||||
}
|
||||
|
||||
for (SubscribedSubredditData s : subscribedSubredditDataList) {
|
||||
if (existingSubscribedSubredditDataList.contains(s)) {
|
||||
continue;
|
||||
}
|
||||
subscribedSubredditDao.insert(s);
|
||||
}
|
||||
}
|
||||
@ -79,7 +82,8 @@ public class InsertSubscribedThings {
|
||||
});
|
||||
}
|
||||
|
||||
public static void insertSubscribedThings(Executor executor, Handler handler, RedditDataRoomDatabase redditDataRoomDatabase,
|
||||
public static void insertSubscribedThings(Executor executor, Handler
|
||||
handler, RedditDataRoomDatabase redditDataRoomDatabase,
|
||||
SubscribedSubredditData singleSubscribedSubredditData,
|
||||
InsertSubscribedThingListener insertSubscribedThingListener) {
|
||||
executor.execute(() -> {
|
||||
@ -94,7 +98,8 @@ public class InsertSubscribedThings {
|
||||
});
|
||||
}
|
||||
|
||||
public static void insertSubscribedThings(Executor executor, Handler handler, RedditDataRoomDatabase redditDataRoomDatabase,
|
||||
public static void insertSubscribedThings(Executor executor, Handler
|
||||
handler, RedditDataRoomDatabase redditDataRoomDatabase,
|
||||
SubscribedUserData mSingleSubscribedUserData,
|
||||
InsertSubscribedThingListener insertSubscribedThingListener) {
|
||||
executor.execute(() -> {
|
||||
@ -109,35 +114,37 @@ public class InsertSubscribedThings {
|
||||
});
|
||||
}
|
||||
|
||||
private static void compareTwoSubscribedSubredditList(List<SubscribedSubredditData> newSubscribedSubreddits,
|
||||
List<SubscribedSubredditData> oldSubscribedSubreddits,
|
||||
List<String> unsubscribedSubredditNames) {
|
||||
private static void compareTwoSubscribedSubredditList
|
||||
(List<SubscribedSubredditData> newSubscribedSubreddits,
|
||||
List<SubscribedSubredditData> oldSubscribedSubreddits,
|
||||
List<String> unsubscribedSubredditNames) {
|
||||
int newIndex = 0;
|
||||
for (int oldIndex = 0; oldIndex < oldSubscribedSubreddits.size(); oldIndex++) {
|
||||
if (newIndex >= newSubscribedSubreddits.size()) {
|
||||
for (; oldIndex < oldSubscribedSubreddits.size(); oldIndex++) {
|
||||
unsubscribedSubredditNames.add(oldSubscribedSubreddits.get(oldIndex).getName());
|
||||
unsubscribedSubredditNames.add(oldSubscribedSubreddits.get(oldIndex).getQualified_name());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
SubscribedSubredditData old = oldSubscribedSubreddits.get(oldIndex);
|
||||
for (; newIndex < newSubscribedSubreddits.size(); newIndex++) {
|
||||
if (newSubscribedSubreddits.get(newIndex).getName().compareToIgnoreCase(old.getName()) == 0) {
|
||||
if (newSubscribedSubreddits.get(newIndex).getQualified_name().compareToIgnoreCase(old.getQualified_name()) == 0) {
|
||||
newIndex++;
|
||||
break;
|
||||
}
|
||||
if (newSubscribedSubreddits.get(newIndex).getName().compareToIgnoreCase(old.getName()) > 0) {
|
||||
unsubscribedSubredditNames.add(old.getName());
|
||||
if (newSubscribedSubreddits.get(newIndex).getQualified_name().compareToIgnoreCase(old.getQualified_name()) > 0) {
|
||||
unsubscribedSubredditNames.add(old.getQualified_name());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void compareTwoSubscribedUserList(List<SubscribedUserData> newSubscribedUsers,
|
||||
List<SubscribedUserData> oldSubscribedUsers,
|
||||
List<String> unsubscribedUserNames) {
|
||||
private static void compareTwoSubscribedUserList
|
||||
(List<SubscribedUserData> newSubscribedUsers,
|
||||
List<SubscribedUserData> oldSubscribedUsers,
|
||||
List<String> unsubscribedUserNames) {
|
||||
int newIndex = 0;
|
||||
for (int oldIndex = 0; oldIndex < oldSubscribedUsers.size(); oldIndex++) {
|
||||
if (newIndex >= newSubscribedUsers.size()) {
|
||||
|
@ -10,24 +10,32 @@ import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import eu.toldi.infinityforlemmy.Infinity;
|
||||
import eu.toldi.infinityforlemmy.R;
|
||||
import eu.toldi.infinityforlemmy.activities.BaseActivity;
|
||||
import eu.toldi.infinityforlemmy.activities.CommentActivity;
|
||||
import eu.toldi.infinityforlemmy.activities.EditCommentActivity;
|
||||
import eu.toldi.infinityforlemmy.activities.GiveAwardActivity;
|
||||
import eu.toldi.infinityforlemmy.activities.ReportActivity;
|
||||
import eu.toldi.infinityforlemmy.activities.ViewPostDetailActivity;
|
||||
import eu.toldi.infinityforlemmy.activities.ViewUserDetailActivity;
|
||||
import eu.toldi.infinityforlemmy.comment.Comment;
|
||||
import eu.toldi.infinityforlemmy.comment.LemmyCommentAPI;
|
||||
import eu.toldi.infinityforlemmy.customtheme.CustomThemeWrapper;
|
||||
import eu.toldi.infinityforlemmy.customviews.LandscapeExpandedRoundedBottomSheetDialogFragment;
|
||||
import eu.toldi.infinityforlemmy.utils.Utils;
|
||||
|
||||
@ -57,6 +65,13 @@ public class CommentMoreBottomSheetFragment extends LandscapeExpandedRoundedBott
|
||||
TextView copyTextView;
|
||||
@BindView(R.id.report_view_comment_more_bottom_sheet_fragment)
|
||||
TextView reportTextView;
|
||||
|
||||
@Inject
|
||||
LemmyCommentAPI lemmyCommentAPI;
|
||||
|
||||
@Inject
|
||||
CustomThemeWrapper mCustomThemeWrapper;
|
||||
|
||||
private BaseActivity activity;
|
||||
|
||||
public CommentMoreBottomSheetFragment() {
|
||||
@ -66,6 +81,7 @@ public class CommentMoreBottomSheetFragment extends LandscapeExpandedRoundedBott
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
((Infinity) activity.getApplication()).getAppComponent().inject(this);
|
||||
View rootView = inflater.inflate(R.layout.fragment_comment_more_bottom_sheet, container, false);
|
||||
ButterKnife.bind(this, rootView);
|
||||
|
||||
@ -177,11 +193,44 @@ public class CommentMoreBottomSheetFragment extends LandscapeExpandedRoundedBott
|
||||
});
|
||||
|
||||
reportTextView.setOnClickListener(view -> {
|
||||
/*Intent intent = new Intent(activity, ReportActivity.class);
|
||||
intent.putExtra(ReportActivity.EXTRA_SUBREDDIT_NAME, comment.getCommunityName());
|
||||
intent.putExtra(ReportActivity.EXTRA_THING_FULLNAME, comment.getFullName());
|
||||
activity.startActivity(intent);*/
|
||||
Toast.makeText(activity, R.string.not_implemented, Toast.LENGTH_SHORT).show();
|
||||
if (accessToken == null) {
|
||||
Toast.makeText(activity, R.string.login_first, Toast.LENGTH_SHORT).show();
|
||||
dismiss();
|
||||
return;
|
||||
}
|
||||
LayoutInflater dialog_inflater = LayoutInflater.from(activity);
|
||||
View dialog_view = dialog_inflater.inflate(R.layout.dialog_report, null);
|
||||
EditText reasonEditText = dialog_view.findViewById(R.id.reasonEditText);
|
||||
|
||||
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(activity)
|
||||
.setTitle(R.string.report_post)
|
||||
.setView(dialog_view)
|
||||
.setNegativeButton(R.string.cancel, (dialogInterface, i) -> dialogInterface.dismiss())
|
||||
.setPositiveButton(R.string.send_report, (dialogInterface, i) -> {
|
||||
String reason = reasonEditText.getText().toString();
|
||||
if (reason.isEmpty()) {
|
||||
Toast.makeText(activity, "A report reason must be provided", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
lemmyCommentAPI.reportComment(comment.getId(), reason, accessToken, new LemmyCommentAPI.ReportCommentCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Toast.makeText(activity, R.string.report_successful, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure() {
|
||||
Toast.makeText(activity, R.string.report_failed, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
});
|
||||
AlertDialog dialog = builder.create();
|
||||
dialog.show();
|
||||
|
||||
Button positiveButton = dialog.getButton(AlertDialog.BUTTON_POSITIVE);
|
||||
Button negativeButton = dialog.getButton(AlertDialog.BUTTON_NEGATIVE);
|
||||
positiveButton.setTextColor(mCustomThemeWrapper.getSecondaryTextColor());
|
||||
negativeButton.setTextColor(mCustomThemeWrapper.getSecondaryTextColor());
|
||||
dismiss();
|
||||
});
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
package eu.toldi.infinityforlemmy.events;
|
||||
|
||||
import eu.toldi.infinityforlemmy.message.Message;
|
||||
import eu.toldi.infinityforlemmy.privatemessage.PrivateMessage;
|
||||
|
||||
public class RepliedToPrivateMessageEvent {
|
||||
public Message newReply;
|
||||
public PrivateMessage newReply;
|
||||
public int messagePosition;
|
||||
|
||||
public RepliedToPrivateMessageEvent(Message newReply, int messagePosition) {
|
||||
public RepliedToPrivateMessageEvent(PrivateMessage newReply, int messagePosition) {
|
||||
this.newReply = newReply;
|
||||
this.messagePosition = messagePosition;
|
||||
}
|
||||
|
@ -0,0 +1,243 @@
|
||||
package eu.toldi.infinityforlemmy.fragments;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.paging.PagedList;
|
||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.RequestManager;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import eu.toldi.infinityforlemmy.FragmentCommunicator;
|
||||
import eu.toldi.infinityforlemmy.Infinity;
|
||||
import eu.toldi.infinityforlemmy.NetworkState;
|
||||
import eu.toldi.infinityforlemmy.R;
|
||||
import eu.toldi.infinityforlemmy.RecyclerViewContentScrollingInterface;
|
||||
import eu.toldi.infinityforlemmy.RedditDataRoomDatabase;
|
||||
import eu.toldi.infinityforlemmy.RetrofitHolder;
|
||||
import eu.toldi.infinityforlemmy.activities.BaseActivity;
|
||||
import eu.toldi.infinityforlemmy.adapters.PrivateMessageRecycleViewAdapter;
|
||||
import eu.toldi.infinityforlemmy.customtheme.CustomThemeWrapper;
|
||||
import eu.toldi.infinityforlemmy.customviews.LinearLayoutManagerBugFixed;
|
||||
import eu.toldi.infinityforlemmy.events.RepliedToPrivateMessageEvent;
|
||||
import eu.toldi.infinityforlemmy.privatemessage.LemmyPrivateMessageAPI;
|
||||
import eu.toldi.infinityforlemmy.privatemessage.PrivateMessage;
|
||||
import eu.toldi.infinityforlemmy.privatemessage.PrivateMessageViewModel;
|
||||
|
||||
public class PrivateMessageFragment extends Fragment implements FragmentCommunicator {
|
||||
|
||||
public static final String EXTRA_ACCESS_TOKEN = "EAT";
|
||||
public static final String EXTRA_MESSAGE_WHERE = "EMT";
|
||||
@BindView(R.id.swipe_refresh_layout_inbox_fragment)
|
||||
SwipeRefreshLayout mSwipeRefreshLayout;
|
||||
@BindView(R.id.recycler_view_inbox_fragment)
|
||||
RecyclerView mRecyclerView;
|
||||
@BindView(R.id.fetch_messages_info_linear_layout_inbox_fragment)
|
||||
LinearLayout mFetchMessageInfoLinearLayout;
|
||||
@BindView(R.id.fetch_messages_info_image_view_inbox_fragment)
|
||||
ImageView mFetchMessageInfoImageView;
|
||||
@BindView(R.id.fetch_messages_info_text_view_inbox_fragment)
|
||||
TextView mFetchMessageInfoTextView;
|
||||
PrivateMessageViewModel mMessageViewModel;
|
||||
@Inject
|
||||
@Named("no_oauth")
|
||||
RetrofitHolder mRetrofit;
|
||||
@Inject
|
||||
RedditDataRoomDatabase mRedditDataRoomDatabase;
|
||||
@Inject
|
||||
@Named("default")
|
||||
SharedPreferences mSharedPreferences;
|
||||
@Inject
|
||||
CustomThemeWrapper mCustomThemeWrapper;
|
||||
|
||||
@Inject
|
||||
LemmyPrivateMessageAPI mLemmyPrivateMessageAPI;
|
||||
private String mAccessToken;
|
||||
private PrivateMessageRecycleViewAdapter mAdapter;
|
||||
private RequestManager mGlide;
|
||||
private LinearLayoutManagerBugFixed mLinearLayoutManager;
|
||||
private BaseActivity mActivity;
|
||||
|
||||
public PrivateMessageFragment() {
|
||||
// Required empty public constructor
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
Log.i("PrivateMessageFragment", "onCreateView");
|
||||
View rootView = inflater.inflate(R.layout.fragment_inbox, container, false);
|
||||
|
||||
((Infinity) mActivity.getApplication()).getAppComponent().inject(this);
|
||||
|
||||
ButterKnife.bind(this, rootView);
|
||||
|
||||
EventBus.getDefault().register(this);
|
||||
|
||||
applyTheme();
|
||||
|
||||
Bundle arguments = getArguments();
|
||||
if (arguments == null) {
|
||||
return rootView;
|
||||
}
|
||||
mAccessToken = getArguments().getString(EXTRA_ACCESS_TOKEN);
|
||||
mGlide = Glide.with(this);
|
||||
|
||||
if (mActivity.isImmersiveInterface()) {
|
||||
mRecyclerView.setPadding(0, 0, 0, mActivity.getNavBarHeight());
|
||||
}
|
||||
|
||||
|
||||
mAdapter = new PrivateMessageRecycleViewAdapter(mActivity, mRetrofit.getRetrofit(), mCustomThemeWrapper, mAccessToken, mLemmyPrivateMessageAPI, () -> mMessageViewModel.refresh());
|
||||
mLinearLayoutManager = new LinearLayoutManagerBugFixed(mActivity);
|
||||
mRecyclerView.setLayoutManager(mLinearLayoutManager);
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mActivity, mLinearLayoutManager.getOrientation());
|
||||
mRecyclerView.addItemDecoration(dividerItemDecoration);
|
||||
|
||||
if (mActivity instanceof RecyclerViewContentScrollingInterface) {
|
||||
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||
if (dy > 0) {
|
||||
((RecyclerViewContentScrollingInterface) mActivity).contentScrollDown();
|
||||
} else if (dy < 0) {
|
||||
((RecyclerViewContentScrollingInterface) mActivity).contentScrollUp();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
PrivateMessageViewModel.Factory factory = new PrivateMessageViewModel.Factory(mRetrofit.getRetrofit(),
|
||||
getResources().getConfiguration().locale, mAccessToken, mLemmyPrivateMessageAPI);
|
||||
mMessageViewModel = new ViewModelProvider(this, factory).get(PrivateMessageViewModel.class);
|
||||
mMessageViewModel.getPrivateMessages().observe(getViewLifecycleOwner(), messages -> mAdapter.submitList(messages));
|
||||
|
||||
|
||||
mMessageViewModel.getInitialLoadState().observe(getViewLifecycleOwner(), networkState -> {
|
||||
if (networkState.getStatus().equals(NetworkState.Status.SUCCESS)) {
|
||||
mSwipeRefreshLayout.setRefreshing(false);
|
||||
} else if (networkState.getStatus().equals(NetworkState.Status.FAILED)) {
|
||||
mSwipeRefreshLayout.setRefreshing(false);
|
||||
mFetchMessageInfoLinearLayout.setOnClickListener(view -> {
|
||||
mFetchMessageInfoLinearLayout.setVisibility(View.GONE);
|
||||
mMessageViewModel.refresh();
|
||||
mAdapter.setNetworkState(null);
|
||||
});
|
||||
showErrorView(R.string.load_messages_failed);
|
||||
} else {
|
||||
mSwipeRefreshLayout.setRefreshing(true);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
mSwipeRefreshLayout.setOnRefreshListener(this::onRefresh);
|
||||
|
||||
return rootView;
|
||||
}
|
||||
|
||||
private void showErrorView(int stringResId) {
|
||||
mSwipeRefreshLayout.setRefreshing(false);
|
||||
mFetchMessageInfoLinearLayout.setVisibility(View.VISIBLE);
|
||||
mFetchMessageInfoTextView.setText(stringResId);
|
||||
mGlide.load(R.drawable.error_image).into(mFetchMessageInfoImageView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyTheme() {
|
||||
mSwipeRefreshLayout.setProgressBackgroundColorSchemeColor(mCustomThemeWrapper.getCircularProgressBarBackground());
|
||||
mSwipeRefreshLayout.setColorSchemeColors(mCustomThemeWrapper.getColorAccent());
|
||||
mFetchMessageInfoTextView.setTextColor(mCustomThemeWrapper.getSecondaryTextColor());
|
||||
if (mActivity.typeface != null) {
|
||||
mFetchMessageInfoTextView.setTypeface(mActivity.typeface);
|
||||
}
|
||||
}
|
||||
|
||||
public void goBackToTop() {
|
||||
if (mLinearLayoutManager != null) {
|
||||
mLinearLayoutManager.scrollToPositionWithOffset(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public void markAllMessagesRead() {
|
||||
if (mAdapter != null) {
|
||||
mAdapter.setMarkAllMessagesAsRead(true);
|
||||
|
||||
int previousPosition = -1;
|
||||
if (mLinearLayoutManager != null) {
|
||||
previousPosition = mLinearLayoutManager.findFirstVisibleItemPosition();
|
||||
}
|
||||
|
||||
RecyclerView.LayoutManager layoutManager = mRecyclerView.getLayoutManager();
|
||||
mRecyclerView.setAdapter(null);
|
||||
mRecyclerView.setLayoutManager(null);
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
mRecyclerView.setLayoutManager(layoutManager);
|
||||
|
||||
if (previousPosition > 0) {
|
||||
mRecyclerView.scrollToPosition(previousPosition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void onRefresh() {
|
||||
mMessageViewModel.refresh();
|
||||
mSwipeRefreshLayout.setRefreshing(false);
|
||||
}
|
||||
|
||||
public PrivateMessage getMessageByIndex(int index) {
|
||||
if (mMessageViewModel == null || index < 0) {
|
||||
return null;
|
||||
}
|
||||
PagedList<PrivateMessage> messages = mMessageViewModel.getPrivateMessages().getValue();
|
||||
if (messages == null) {
|
||||
return null;
|
||||
}
|
||||
if (index >= messages.size()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return messages.get(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
mActivity = (BaseActivity) context;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onRepliedToPrivateMessageEvent(RepliedToPrivateMessageEvent repliedToPrivateMessageEvent) {
|
||||
/* if (mAdapter != null && mWhere.equals(FetchMessage.WHERE_MESSAGES)) {
|
||||
mAdapter.updateMessageReply(repliedToPrivateMessageEvent.newReply, repliedToPrivateMessageEvent.messagePosition);
|
||||
}*/
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@ package eu.toldi.infinityforlemmy.fragments;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
@ -9,15 +10,20 @@ import android.text.Spanned;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
|
||||
import com.evernote.android.state.State;
|
||||
import com.google.android.material.card.MaterialCardView;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@ -31,15 +37,18 @@ import eu.toldi.infinityforlemmy.RedditDataRoomDatabase;
|
||||
import eu.toldi.infinityforlemmy.RetrofitHolder;
|
||||
import eu.toldi.infinityforlemmy.activities.LinkResolverActivity;
|
||||
import eu.toldi.infinityforlemmy.activities.ViewSubredditDetailActivity;
|
||||
import eu.toldi.infinityforlemmy.adapters.ModeratorRecyclerViewAdapter;
|
||||
import eu.toldi.infinityforlemmy.asynctasks.InsertSubredditData;
|
||||
import eu.toldi.infinityforlemmy.bottomsheetfragments.CopyTextBottomSheetFragment;
|
||||
import eu.toldi.infinityforlemmy.bottomsheetfragments.UrlMenuBottomSheetFragment;
|
||||
import eu.toldi.infinityforlemmy.community.CommunityStats;
|
||||
import eu.toldi.infinityforlemmy.customtheme.CustomThemeWrapper;
|
||||
import eu.toldi.infinityforlemmy.customviews.LinearLayoutManagerBugFixed;
|
||||
import eu.toldi.infinityforlemmy.markdown.MarkdownUtils;
|
||||
import eu.toldi.infinityforlemmy.subreddit.FetchSubredditData;
|
||||
import eu.toldi.infinityforlemmy.subreddit.SubredditData;
|
||||
import eu.toldi.infinityforlemmy.subreddit.SubredditViewModel;
|
||||
import eu.toldi.infinityforlemmy.user.BasicUserRecyclerViewAdapter;
|
||||
import eu.toldi.infinityforlemmy.utils.LemmyUtils;
|
||||
import io.noties.markwon.AbstractMarkwonPlugin;
|
||||
import io.noties.markwon.Markwon;
|
||||
@ -55,11 +64,50 @@ public class SidebarFragment extends Fragment {
|
||||
public static final String EXTRA_SUBREDDIT_NAME = "ESN";
|
||||
public static final String EXTRA_ACCESS_TOKEN = "EAT";
|
||||
public static final String EXTRA_COMMUNITY_QUALIFIED_NAME = "ECQN";
|
||||
|
||||
public static final String EXTRA_SHOW_STATISTICS = "ESS";
|
||||
public SubredditViewModel mSubredditViewModel;
|
||||
@BindView(R.id.swipe_refresh_layout_sidebar_fragment)
|
||||
SwipeRefreshLayout swipeRefreshLayout;
|
||||
@BindView(R.id.markdown_recycler_view_sidebar_fragment)
|
||||
RecyclerView recyclerView;
|
||||
|
||||
@BindView(R.id.recycler_view_moderators_side_fragment)
|
||||
RecyclerView moderatorsRecyclerView;
|
||||
|
||||
@BindView(R.id.subscriber_count_text_view_sidebar_fragment)
|
||||
TextView nSubscribersTextView;
|
||||
@BindView(R.id.active_user_count_text_view_sidebar_fragment)
|
||||
TextView nActiveUsersTextView;
|
||||
@BindView(R.id.post_count_text_view_sidebar_fragment)
|
||||
TextView nPostsTextView;
|
||||
@BindView(R.id.comment_count_text_view_sidebar_fragment)
|
||||
TextView nCommentsTextView;
|
||||
|
||||
@BindView(R.id.subscriber_count_image_view_sidebar_fragment)
|
||||
ImageView nSubscribersImageView;
|
||||
@BindView(R.id.active_user_count_image_view_sidebar_fragment)
|
||||
ImageView nActiveUsersImageView;
|
||||
@BindView(R.id.post_count_image_view_sidebar_fragment)
|
||||
ImageView nPostsImageView;
|
||||
@BindView(R.id.comment_count_image_view_sidebar_fragment)
|
||||
ImageView nCommentsImageView;
|
||||
|
||||
@BindView(R.id.community_statistics_block_sidebar_fragment)
|
||||
ConstraintLayout communityStatisticsBlock;
|
||||
|
||||
@BindView(R.id.moderators_text_view_sidebar_fragment)
|
||||
TextView moderatorsTextView;
|
||||
|
||||
@BindView(R.id.moderators_card_sidebar_fragment)
|
||||
MaterialCardView moderatorsCard;
|
||||
|
||||
@BindView(R.id.description_card_sidebar_fragment)
|
||||
MaterialCardView descriptionCard;
|
||||
|
||||
@BindView(R.id.statistics_card_sidebar_fragment)
|
||||
MaterialCardView statisticsCard;
|
||||
|
||||
@Inject
|
||||
@Named("no_oauth")
|
||||
RetrofitHolder mRetrofit;
|
||||
@ -76,11 +124,17 @@ public class SidebarFragment extends Fragment {
|
||||
private String mAccessToken;
|
||||
private String subredditName;
|
||||
|
||||
private boolean mShowStatistics;
|
||||
|
||||
private String communityQualifiedName;
|
||||
private LinearLayoutManagerBugFixed linearLayoutManager;
|
||||
private int markdownColor;
|
||||
private String sidebarDescription;
|
||||
|
||||
@State
|
||||
CommunityStats mCommunityStats;
|
||||
private BasicUserRecyclerViewAdapter moderatorAdapter;
|
||||
|
||||
public SidebarFragment() {
|
||||
// Required empty public constructor
|
||||
}
|
||||
@ -98,6 +152,7 @@ public class SidebarFragment extends Fragment {
|
||||
mAccessToken = getArguments().getString(EXTRA_ACCESS_TOKEN);
|
||||
subredditName = getArguments().getString(EXTRA_SUBREDDIT_NAME);
|
||||
communityQualifiedName = getArguments().getString(EXTRA_COMMUNITY_QUALIFIED_NAME);
|
||||
mShowStatistics = getArguments().getBoolean(EXTRA_SHOW_STATISTICS, true);
|
||||
if (communityQualifiedName == null) {
|
||||
Toast.makeText(activity, R.string.error_getting_community_name, Toast.LENGTH_SHORT).show();
|
||||
return rootView;
|
||||
@ -105,6 +160,27 @@ public class SidebarFragment extends Fragment {
|
||||
|
||||
swipeRefreshLayout.setProgressBackgroundColorSchemeColor(mCustomThemeWrapper.getCircularProgressBarBackground());
|
||||
swipeRefreshLayout.setColorSchemeColors(mCustomThemeWrapper.getColorAccent());
|
||||
int mCardViewBackgroundColor = mCustomThemeWrapper.getCardViewBackgroundColor();
|
||||
int primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor();
|
||||
nSubscribersTextView.setTextColor(primaryTextColor);
|
||||
nActiveUsersTextView.setTextColor(primaryTextColor);
|
||||
nPostsTextView.setTextColor(primaryTextColor);
|
||||
nCommentsTextView.setTextColor(primaryTextColor);
|
||||
moderatorsTextView.setTextColor(primaryTextColor);
|
||||
moderatorsTextView.setTypeface(activity.contentTypeface);
|
||||
nSubscribersImageView.setColorFilter(mCustomThemeWrapper.getPrimaryTextColor(), PorterDuff.Mode.SRC_IN);
|
||||
nActiveUsersImageView.setColorFilter(mCustomThemeWrapper.getPrimaryTextColor(), PorterDuff.Mode.SRC_IN);
|
||||
nPostsImageView.setColorFilter(mCustomThemeWrapper.getPrimaryTextColor(), PorterDuff.Mode.SRC_IN);
|
||||
nCommentsImageView.setColorFilter(mCustomThemeWrapper.getPrimaryTextColor(), PorterDuff.Mode.SRC_IN);
|
||||
moderatorsCard.setCardBackgroundColor(mCardViewBackgroundColor);
|
||||
descriptionCard.setCardBackgroundColor(mCardViewBackgroundColor);
|
||||
if (mShowStatistics) {
|
||||
statisticsCard.setCardBackgroundColor(mCardViewBackgroundColor);
|
||||
} else {
|
||||
statisticsCard.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
|
||||
markdownColor = mCustomThemeWrapper.getPrimaryTextColor();
|
||||
int spoilerBackgroundColor = markdownColor | 0xFF000000;
|
||||
|
||||
@ -166,6 +242,11 @@ public class SidebarFragment extends Fragment {
|
||||
}
|
||||
});
|
||||
|
||||
moderatorsRecyclerView.setLayoutManager(new LinearLayoutManagerBugFixed(activity));
|
||||
moderatorAdapter = new ModeratorRecyclerViewAdapter(activity,
|
||||
mCustomThemeWrapper);
|
||||
moderatorsRecyclerView.setAdapter(moderatorAdapter);
|
||||
|
||||
mSubredditViewModel = new ViewModelProvider(activity,
|
||||
new SubredditViewModel.Factory(activity.getApplication(), mRedditDataRoomDatabase, LemmyUtils.qualifiedCommunityName2ActorId(communityQualifiedName)))
|
||||
.get(SubredditViewModel.class);
|
||||
@ -180,6 +261,16 @@ public class SidebarFragment extends Fragment {
|
||||
} else {
|
||||
fetchSubredditData();
|
||||
}
|
||||
|
||||
if (mCommunityStats != null) {
|
||||
communityStatisticsBlock.setVisibility(View.VISIBLE);
|
||||
nSubscribersTextView.setText(getString(R.string.subscribers_number_detail, mCommunityStats.getSubscribers()));
|
||||
nActiveUsersTextView.setText(getString(R.string.active_users_number_detail, mCommunityStats.getActiveUsers()));
|
||||
nPostsTextView.setText(getString(R.string.post_count_detail, mCommunityStats.getPosts()));
|
||||
nCommentsTextView.setText(getString(R.string.comment_count_detail, mCommunityStats.getComments()));
|
||||
} else {
|
||||
fetchSubredditData();
|
||||
}
|
||||
});
|
||||
|
||||
swipeRefreshLayout.setOnRefreshListener(this::fetchSubredditData);
|
||||
@ -199,6 +290,8 @@ public class SidebarFragment extends Fragment {
|
||||
@Override
|
||||
public void onFetchSubredditDataSuccess(SubredditData subredditData, int nCurrentOnlineSubscribers) {
|
||||
swipeRefreshLayout.setRefreshing(false);
|
||||
mCommunityStats = subredditData.getCommunityStats();
|
||||
moderatorAdapter.setUsers(subredditData.getModerators());
|
||||
InsertSubredditData.insertSubredditData(mExecutor, new Handler(), mRedditDataRoomDatabase,
|
||||
subredditData, () -> swipeRefreshLayout.setRefreshing(false));
|
||||
}
|
||||
|
@ -157,16 +157,16 @@ public class SubscribedSubredditsListingFragment extends Fragment implements Fra
|
||||
adapter.setSubscribedSubreddits(subscribedSubredditData);
|
||||
});
|
||||
|
||||
/* mSubscribedSubredditViewModel.getAllFavoriteSubscribedSubreddits().observe(getViewLifecycleOwner(), favoriteSubscribedSubredditData -> {
|
||||
mSwipeRefreshLayout.setRefreshing(false);
|
||||
if (favoriteSubscribedSubredditData != null && favoriteSubscribedSubredditData.size() > 0) {
|
||||
mLinearLayout.setVisibility(View.GONE);
|
||||
mRecyclerView.setVisibility(View.VISIBLE);
|
||||
mGlide.clear(mImageView);
|
||||
}
|
||||
mSubscribedSubredditViewModel.getAllFavoriteSubscribedSubreddits().observe(getViewLifecycleOwner(), favoriteSubscribedSubredditData -> {
|
||||
mSwipeRefreshLayout.setRefreshing(false);
|
||||
if (favoriteSubscribedSubredditData != null && favoriteSubscribedSubredditData.size() > 0) {
|
||||
mLinearLayout.setVisibility(View.GONE);
|
||||
mRecyclerView.setVisibility(View.VISIBLE);
|
||||
mGlide.clear(mImageView);
|
||||
}
|
||||
|
||||
adapter.setFavoriteSubscribedSubreddits(favoriteSubscribedSubredditData);
|
||||
});*/
|
||||
adapter.setFavoriteSubscribedSubreddits(favoriteSubscribedSubredditData);
|
||||
});
|
||||
|
||||
return rootView;
|
||||
}
|
||||
|
@ -24,6 +24,8 @@ import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
@ -31,6 +33,7 @@ import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.appcompat.view.menu.MenuItemImpl;
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
@ -106,6 +109,7 @@ import eu.toldi.infinityforlemmy.message.ReadMessage;
|
||||
import eu.toldi.infinityforlemmy.post.FetchPost;
|
||||
import eu.toldi.infinityforlemmy.post.FetchRemovedPost;
|
||||
import eu.toldi.infinityforlemmy.post.HidePost;
|
||||
import eu.toldi.infinityforlemmy.post.LemmyPostAPI;
|
||||
import eu.toldi.infinityforlemmy.post.MarkPostAsRead;
|
||||
import eu.toldi.infinityforlemmy.post.Post;
|
||||
import eu.toldi.infinityforlemmy.readpost.InsertReadPost;
|
||||
@ -194,6 +198,8 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
|
||||
Executor mExecutor;
|
||||
@Inject
|
||||
MarkPostAsRead markPostAsRead;
|
||||
@Inject
|
||||
LemmyPostAPI mLemmyPostAPI;
|
||||
@State
|
||||
Post mPost;
|
||||
@State
|
||||
@ -615,7 +621,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
|
||||
mExoCreator, post -> EventBus.getDefault().post(new PostUpdateEventToPostList(mPost, postListPosition)));
|
||||
mCommentsAdapter = new CommentsRecyclerViewAdapter(activity,
|
||||
this, mCustomThemeWrapper, mExecutor, mRetrofit.getRetrofit(),
|
||||
mAccessToken, mAccountName, mPost, mLocale, mSingleCommentId
|
||||
mAccessToken, mAccountQualifiedName, mPost, mLocale, mSingleCommentId
|
||||
, isSingleCommentThreadMode, mSharedPreferences, mCurrentAccountSharedPreferences,
|
||||
new CommentsRecyclerViewAdapter.CommentRecyclerViewAdapterCallback() {
|
||||
@Override
|
||||
@ -1153,7 +1159,43 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
|
||||
Toast.makeText(activity, R.string.login_first, Toast.LENGTH_SHORT).show();
|
||||
return true;
|
||||
}
|
||||
Toast.makeText(activity, R.string.not_implemented, Toast.LENGTH_SHORT).show();
|
||||
if (mAccessToken == null) {
|
||||
Toast.makeText(activity, R.string.login_first, Toast.LENGTH_SHORT).show();
|
||||
return true;
|
||||
}
|
||||
LayoutInflater inflater = LayoutInflater.from(activity);
|
||||
View view = inflater.inflate(R.layout.dialog_report, null);
|
||||
EditText reasonEditText = view.findViewById(R.id.reasonEditText);
|
||||
|
||||
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(activity)
|
||||
.setTitle(R.string.report_post)
|
||||
.setView(view)
|
||||
.setNegativeButton(R.string.cancel, (dialogInterface, i) -> dialogInterface.dismiss())
|
||||
.setPositiveButton(R.string.send_report, (dialogInterface, i) -> {
|
||||
String reason = reasonEditText.getText().toString();
|
||||
if (reason.isEmpty()) {
|
||||
Toast.makeText(activity, "A report reason must be provided", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
mLemmyPostAPI.reportPost(mPost.getId(), reason, mAccessToken, new LemmyPostAPI.ReportPostCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Toast.makeText(activity, R.string.report_successful, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure() {
|
||||
Toast.makeText(activity, R.string.report_failed, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
});
|
||||
AlertDialog dialog = builder.create();
|
||||
dialog.show();
|
||||
|
||||
Button positiveButton = dialog.getButton(AlertDialog.BUTTON_POSITIVE);
|
||||
Button negativeButton = dialog.getButton(AlertDialog.BUTTON_NEGATIVE);
|
||||
positiveButton.setTextColor(mCustomThemeWrapper.getSecondaryTextColor());
|
||||
negativeButton.setTextColor(mCustomThemeWrapper.getSecondaryTextColor());
|
||||
return true;
|
||||
} else if (itemId == R.id.action_see_removed_view_post_detail_fragment) {
|
||||
showRemovedPost();
|
||||
@ -1309,7 +1351,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
|
||||
pages_loaded++;
|
||||
mCommentsAdapter = new CommentsRecyclerViewAdapter(activity,
|
||||
ViewPostDetailFragment.this, mCustomThemeWrapper, mExecutor,
|
||||
mRetrofit.getRetrofit(), mAccessToken, mAccountName, mPost, mLocale,
|
||||
mRetrofit.getRetrofit(), mAccessToken, mAccountQualifiedName, mPost, mLocale,
|
||||
mSingleCommentId, isSingleCommentThreadMode, mSharedPreferences, mCurrentAccountSharedPreferences,
|
||||
new CommentsRecyclerViewAdapter.CommentRecyclerViewAdapterCallback() {
|
||||
@Override
|
||||
|
@ -1,5 +1,6 @@
|
||||
package eu.toldi.infinityforlemmy.markdown;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.text.util.Linkify;
|
||||
|
||||
@ -29,16 +30,17 @@ import me.saket.bettermovementmethod.BetterLinkMovementMethod;
|
||||
public class MarkdownUtils {
|
||||
/**
|
||||
* Creates a Markwon instance with all the plugins required for processing Reddit's markdown.
|
||||
*
|
||||
* @return configured Markwon instance
|
||||
*/
|
||||
@NonNull
|
||||
public static Markwon createFullRedditMarkwon(@NonNull Context context,
|
||||
public static Markwon createFullRedditMarkwon(@NonNull Activity context,
|
||||
@NonNull MarkwonPlugin miscPlugin,
|
||||
int markdownColor,
|
||||
int spoilerBackgroundColor,
|
||||
@Nullable BetterLinkMovementMethod.OnLinkLongClickListener onLinkLongClickListener) {
|
||||
return Markwon.builder(context)
|
||||
.usePlugin(GlideImagesPlugin.create(context))
|
||||
.usePlugin(GlideImagesPlugin.create(context.getApplicationContext()))
|
||||
.usePlugin(MarkwonInlineParserPlugin.create(plugin -> {
|
||||
plugin.excludeInlineProcessor(HtmlInlineProcessor.class);
|
||||
}))
|
||||
@ -57,7 +59,7 @@ public class MarkdownUtils {
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public static Markwon createDescriptionMarkwon(Context context, MarkwonPlugin miscPlugin,
|
||||
public static Markwon createDescriptionMarkwon(Activity context, MarkwonPlugin miscPlugin,
|
||||
BetterLinkMovementMethod.OnLinkLongClickListener onLinkLongClickListener) {
|
||||
return Markwon.builder(context)
|
||||
.usePlugin(MarkwonInlineParserPlugin.create(plugin -> {
|
||||
@ -71,7 +73,7 @@ public class MarkdownUtils {
|
||||
.setOnLinkLongClickListener(onLinkLongClickListener)))
|
||||
.usePlugin(LinkifyPlugin.create(Linkify.WEB_URLS))
|
||||
.usePlugin(TableEntryPlugin.create(context))
|
||||
.usePlugin(GlideImagesPlugin.create(context))
|
||||
.usePlugin(GlideImagesPlugin.create(context.getApplicationContext()))
|
||||
.usePlugin(new MarkwonLemmyLinkPlugin())
|
||||
.build();
|
||||
}
|
||||
|
@ -33,7 +33,9 @@ import java.util.concurrent.Executor;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import eu.toldi.infinityforlemmy.community.BasicCommunityInfo;
|
||||
import eu.toldi.infinityforlemmy.postfilter.PostFilter;
|
||||
import eu.toldi.infinityforlemmy.user.BasicUserInfo;
|
||||
import eu.toldi.infinityforlemmy.utils.JSONUtils;
|
||||
import eu.toldi.infinityforlemmy.utils.LemmyUtils;
|
||||
import eu.toldi.infinityforlemmy.utils.Utils;
|
||||
@ -188,25 +190,25 @@ public class ParsePost {
|
||||
boolean saved = data.getBoolean("saved");
|
||||
String distinguished = (creator.getBoolean("admin") ? "admin" : "");
|
||||
String suggestedSort = "";
|
||||
ArrayList <Post.Preview> previews = new ArrayList<>();
|
||||
if(!post.isNull("thumbnail_url")) {
|
||||
ArrayList<Post.Preview> previews = new ArrayList<>();
|
||||
if (!post.isNull("thumbnail_url")) {
|
||||
String thumbnail = post.getString("thumbnail_url");
|
||||
//int[] wh_array = getImageDimension(thumbnail);
|
||||
previews.add(new Post.Preview(thumbnail, 0, 0, "", ""));
|
||||
}
|
||||
BasicUserInfo authorInfo = new BasicUserInfo(creator.getInt("id"), author, authorFull, creator.optString("avatar", ""), creator.optString("display_name", author));
|
||||
BasicCommunityInfo communityInfo = new BasicCommunityInfo(community.getInt("id"), subredditName, subredditNamePrefixed, community.optString("icon", ""), community.optString("title", subredditName));
|
||||
|
||||
|
||||
return parseData(data, permalink, id, fullName, subredditName, subredditNamePrefixed,
|
||||
author,authorFull, postTimeMillis, title, previews,
|
||||
downvotes,upvotes, voteType, nComments, upvoteRatio, nsfw, locked, saved,
|
||||
distinguished, suggestedSort);
|
||||
return parseData(data, permalink, id, communityInfo,
|
||||
authorInfo, postTimeMillis, title, previews,
|
||||
downvotes, upvotes, voteType, nComments, upvoteRatio, nsfw, locked, saved,
|
||||
distinguished, suggestedSort);
|
||||
|
||||
}
|
||||
|
||||
private static Post parseData(JSONObject data, String permalink, int id, String fullName,
|
||||
String subredditName, String subredditNamePrefixed, String author, String authorFull,
|
||||
private static Post parseData(JSONObject data, String permalink, int id, BasicCommunityInfo communityInfo, BasicUserInfo author,
|
||||
long postTimeMillis, String title, ArrayList<Post.Preview> previews,
|
||||
int downvotes,int upvotes, int voteType, int nComments, int upvoteRatio,
|
||||
int downvotes, int upvotes, int voteType, int nComments, int upvoteRatio,
|
||||
boolean nsfw, boolean locked,
|
||||
boolean saved,
|
||||
String distinguished, String suggestedSort) throws JSONException {
|
||||
@ -218,9 +220,6 @@ public class ParsePost {
|
||||
String authorAvatar = (!data.getJSONObject("creator").isNull("avatar")) ? data.getJSONObject("creator").getString("avatar") : null;
|
||||
|
||||
Uri uri = Uri.parse(url);
|
||||
if (uri.getAuthority() == null) {
|
||||
Log.e("ParsePost", "parseData:" + uri.toString());
|
||||
}
|
||||
String path = uri.getPath();
|
||||
boolean isVideo = path.endsWith(".mp4") || path.endsWith(".webm") || path.endsWith(".gifv");
|
||||
|
||||
@ -228,7 +227,7 @@ public class ParsePost {
|
||||
if (!data.getJSONObject("post").isNull("body") && url.equals("")) {
|
||||
//Text post
|
||||
int postType = Post.TEXT_TYPE;
|
||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFull,
|
||||
post = new Post(id, communityInfo, author,
|
||||
postTimeMillis, title, permalink, downvotes, upvotes,
|
||||
postType, voteType, nComments, upvoteRatio, nsfw,
|
||||
locked, saved, distinguished, suggestedSort);
|
||||
@ -241,9 +240,9 @@ public class ParsePost {
|
||||
//Image post
|
||||
int postType = Post.IMAGE_TYPE;
|
||||
|
||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFull,
|
||||
post = new Post(id, communityInfo, author,
|
||||
postTimeMillis, title, url, permalink, downvotes, upvotes,
|
||||
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort);
|
||||
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort);
|
||||
|
||||
if (previews.isEmpty()) {
|
||||
previews.add(new Post.Preview(url, 0, 0, "", ""));
|
||||
@ -254,7 +253,7 @@ public class ParsePost {
|
||||
//No preview video post
|
||||
int postType = Post.VIDEO_TYPE;
|
||||
|
||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFull, postTimeMillis, title, permalink, downvotes,upvotes, postType, voteType,
|
||||
post = new Post(id, communityInfo, author, postTimeMillis, title, permalink, downvotes, upvotes, postType, voteType,
|
||||
nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort);
|
||||
|
||||
post.setVideoUrl(url);
|
||||
@ -262,7 +261,7 @@ public class ParsePost {
|
||||
} else if (!url.equals("")) {
|
||||
//No preview link post
|
||||
int postType = Post.NO_PREVIEW_LINK_TYPE;
|
||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFull,
|
||||
post = new Post(id, communityInfo, author,
|
||||
postTimeMillis, title, url, permalink, downvotes, upvotes,
|
||||
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort);
|
||||
if (data.isNull(JSONUtils.SELFTEXT_KEY)) {
|
||||
@ -296,7 +295,7 @@ public class ParsePost {
|
||||
}
|
||||
} else {
|
||||
int postType = Post.TEXT_TYPE;
|
||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFull,
|
||||
post = new Post(id, communityInfo, author,
|
||||
postTimeMillis, title, permalink, downvotes, upvotes,
|
||||
postType, voteType, nComments, upvoteRatio, nsfw,
|
||||
locked, saved, distinguished, suggestedSort);
|
||||
@ -335,7 +334,7 @@ public class ParsePost {
|
||||
String videoUrl = Html.fromHtml(redditVideoObject.getString(JSONUtils.HLS_URL_KEY)).toString();
|
||||
String videoDownloadUrl = redditVideoObject.getString(JSONUtils.FALLBACK_URL_KEY);
|
||||
|
||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFull, postTimeMillis, title, permalink, downvotes, upvotes, postType, voteType,
|
||||
post = new Post(id, communityInfo, author, postTimeMillis, title, permalink, downvotes, upvotes, postType, voteType,
|
||||
nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort);
|
||||
|
||||
post.setPreviews(previews);
|
||||
@ -346,8 +345,8 @@ public class ParsePost {
|
||||
//Image post
|
||||
int postType = Post.IMAGE_TYPE;
|
||||
|
||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
|
||||
authorFull, postTimeMillis, title, url, permalink, downvotes, upvotes,
|
||||
post = new Post(id, communityInfo, author,
|
||||
postTimeMillis, title, url, permalink, downvotes, upvotes,
|
||||
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved,
|
||||
distinguished, suggestedSort);
|
||||
|
||||
@ -358,7 +357,7 @@ public class ParsePost {
|
||||
} else if (path.endsWith(".gif")) {
|
||||
//Gif post
|
||||
int postType = Post.GIF_TYPE;
|
||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFull,
|
||||
post = new Post(id, communityInfo, author,
|
||||
postTimeMillis, title, url, permalink, downvotes, upvotes,
|
||||
postType, voteType, nComments, upvoteRatio,
|
||||
nsfw, locked, saved,
|
||||
@ -374,7 +373,7 @@ public class ParsePost {
|
||||
url = url.substring(0, url.length() - 5) + ".mp4";
|
||||
}
|
||||
|
||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFull,
|
||||
post = new Post(id, communityInfo, author,
|
||||
postTimeMillis, title, url, permalink, downvotes, upvotes,
|
||||
postType, voteType, nComments, upvoteRatio,
|
||||
nsfw, locked, saved,
|
||||
@ -387,7 +386,7 @@ public class ParsePost {
|
||||
//Video post
|
||||
int postType = Post.VIDEO_TYPE;
|
||||
|
||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFull,
|
||||
post = new Post(id, communityInfo, author,
|
||||
postTimeMillis, title, url, permalink, downvotes, upvotes,
|
||||
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved,
|
||||
distinguished, suggestedSort);
|
||||
@ -398,7 +397,7 @@ public class ParsePost {
|
||||
//Link post
|
||||
int postType = Post.LINK_TYPE;
|
||||
|
||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFull,
|
||||
post = new Post(id, communityInfo, author,
|
||||
postTimeMillis, title, url, permalink, downvotes, upvotes,
|
||||
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved,
|
||||
distinguished, suggestedSort);
|
||||
@ -439,7 +438,7 @@ public class ParsePost {
|
||||
//Image post
|
||||
int postType = Post.IMAGE_TYPE;
|
||||
|
||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,authorFull,
|
||||
post = new Post(id, communityInfo, author,
|
||||
postTimeMillis, title, url, permalink, downvotes, upvotes,
|
||||
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort);
|
||||
|
||||
@ -451,7 +450,7 @@ public class ParsePost {
|
||||
//Video post
|
||||
int postType = Post.VIDEO_TYPE;
|
||||
|
||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,authorFull,
|
||||
post = new Post(id, communityInfo, author,
|
||||
postTimeMillis, title, url, permalink, downvotes, upvotes,
|
||||
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort);
|
||||
post.setPreviews(previews);
|
||||
@ -461,9 +460,9 @@ public class ParsePost {
|
||||
//CP No Preview Link post
|
||||
int postType = Post.NO_PREVIEW_LINK_TYPE;
|
||||
|
||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,authorFull,
|
||||
post = new Post(id, communityInfo, author,
|
||||
postTimeMillis, title, url, permalink, downvotes, upvotes,
|
||||
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort);
|
||||
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort);
|
||||
//Need attention
|
||||
if (data.isNull(JSONUtils.SELFTEXT_KEY)) {
|
||||
post.setSelfText("");
|
||||
@ -579,7 +578,7 @@ public class ParsePost {
|
||||
singleGalleryObject.getJSONObject(JSONUtils.S_KEY).getInt(JSONUtils.Y_KEY), galleryItemCaption, galleryItemCaptionUrl));
|
||||
}
|
||||
|
||||
Post.Gallery postGalleryItem = new Post.Gallery(mimeType, galleryItemUrl, "", subredditName + "-" + galleryId + "." + mimeType.substring(mimeType.lastIndexOf("/") + 1), galleryItemCaption, galleryItemCaptionUrl);
|
||||
Post.Gallery postGalleryItem = new Post.Gallery(mimeType, galleryItemUrl, "", communityInfo.getDisplayName() + "-" + galleryId + "." + mimeType.substring(mimeType.lastIndexOf("/") + 1), galleryItemCaption, galleryItemCaptionUrl);
|
||||
|
||||
// For issue #558
|
||||
// Construct a fallback image url
|
||||
@ -675,8 +674,8 @@ public class ParsePost {
|
||||
if (data.getJSONObject("post").getBoolean("featured_local")) {
|
||||
post.setFeaturedOnInstance(true);
|
||||
}
|
||||
post.setAuthorIconUrl(authorAvatar);
|
||||
post.setSubredditIconUrl(communityURL);
|
||||
|
||||
|
||||
return post;
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,9 @@ import androidx.annotation.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import eu.toldi.infinityforlemmy.community.BasicCommunityInfo;
|
||||
import eu.toldi.infinityforlemmy.user.BasicUserInfo;
|
||||
|
||||
/**
|
||||
* Created by alex on 3/1/18.
|
||||
*/
|
||||
@ -33,13 +36,8 @@ public class Post implements Parcelable {
|
||||
}
|
||||
};
|
||||
private int id;
|
||||
private String fullName;
|
||||
private String subredditName;
|
||||
private String subredditNamePrefixed;
|
||||
private String subredditIconUrl;
|
||||
private String author;
|
||||
private String authorNamePrefixed;
|
||||
private String authorIconUrl;
|
||||
private BasicCommunityInfo communityInfo;
|
||||
private BasicUserInfo author;
|
||||
private String title;
|
||||
private String selfText;
|
||||
private String selfTextPlain;
|
||||
@ -80,18 +78,15 @@ public class Post implements Parcelable {
|
||||
private ArrayList<Preview> previews = new ArrayList<>();
|
||||
private ArrayList<Gallery> gallery = new ArrayList<>();
|
||||
|
||||
public Post(int id, String fullName, String subredditName, String subredditNamePrefixed,
|
||||
String author,String authorNamePrefixed, long postTimeMillis,
|
||||
String title, String permalink, int downvotes,int upvotes, int postType, int voteType, int nComments,
|
||||
public Post(int id, BasicCommunityInfo communityInfo,
|
||||
BasicUserInfo userInfo, long postTimeMillis,
|
||||
String title, String permalink, int downvotes, int upvotes, int postType, int voteType, int nComments,
|
||||
int upvoteRatio,
|
||||
boolean nsfw, boolean locked, boolean saved,
|
||||
String distinguished, String suggestedSort) {
|
||||
this.id = id;
|
||||
this.fullName = fullName;
|
||||
this.subredditName = subredditName;
|
||||
this.subredditNamePrefixed = subredditNamePrefixed;
|
||||
this.author = author;
|
||||
this.authorNamePrefixed = authorNamePrefixed;
|
||||
this.communityInfo = communityInfo;
|
||||
this.author = userInfo;
|
||||
this.postTimeMillis = postTimeMillis;
|
||||
this.title = title;
|
||||
this.permalink = permalink;
|
||||
@ -112,17 +107,14 @@ public class Post implements Parcelable {
|
||||
isRead = false;
|
||||
}
|
||||
|
||||
public Post(int id, String fullName, String subredditName, String subredditNamePrefixed,
|
||||
String author, String authorNamePrefixed, long postTimeMillis, String title,
|
||||
String url, String permalink, int downvotes,int upvotes, int postType, int voteType, int nComments,
|
||||
public Post(int id, BasicCommunityInfo communityInfo,
|
||||
BasicUserInfo author, long postTimeMillis, String title,
|
||||
String url, String permalink, int downvotes, int upvotes, int postType, int voteType, int nComments,
|
||||
int upvoteRatio,
|
||||
boolean nsfw, boolean locked, boolean saved, String distinguished, String suggestedSort) {
|
||||
boolean nsfw, boolean locked, boolean saved, String distinguished, String suggestedSort) {
|
||||
this.id = id;
|
||||
this.fullName = fullName;
|
||||
this.subredditName = subredditName;
|
||||
this.subredditNamePrefixed = subredditNamePrefixed;
|
||||
this.communityInfo = communityInfo;
|
||||
this.author = author;
|
||||
this.authorNamePrefixed = authorNamePrefixed;
|
||||
this.postTimeMillis = postTimeMillis;
|
||||
this.title = title;
|
||||
this.url = url;
|
||||
@ -146,13 +138,8 @@ public class Post implements Parcelable {
|
||||
|
||||
protected Post(Parcel in) {
|
||||
id = in.readInt();
|
||||
fullName = in.readString();
|
||||
subredditName = in.readString();
|
||||
subredditNamePrefixed = in.readString();
|
||||
subredditIconUrl = in.readString();
|
||||
author = in.readString();
|
||||
authorNamePrefixed = in.readString();
|
||||
authorIconUrl = in.readString();
|
||||
communityInfo = in.readParcelable(BasicCommunityInfo.class.getClassLoader());
|
||||
author = in.readParcelable(BasicUserInfo.class.getClassLoader());
|
||||
postTimeMillis = in.readLong();
|
||||
title = in.readString();
|
||||
selfText = in.readString();
|
||||
@ -195,27 +182,24 @@ public class Post implements Parcelable {
|
||||
}
|
||||
|
||||
public String getFullName() {
|
||||
return fullName;
|
||||
return communityInfo.getQualifiedName();
|
||||
}
|
||||
|
||||
public String getSubredditName() {
|
||||
return subredditName;
|
||||
return communityInfo.getDisplayName();
|
||||
}
|
||||
|
||||
public String getSubredditNamePrefixed() {
|
||||
return subredditNamePrefixed;
|
||||
return communityInfo.getQualifiedName();
|
||||
}
|
||||
|
||||
public String getSubredditIconUrl() {
|
||||
return subredditIconUrl;
|
||||
return communityInfo.getIcon();
|
||||
}
|
||||
|
||||
public void setSubredditIconUrl(String subredditIconUrl) {
|
||||
this.subredditIconUrl = subredditIconUrl;
|
||||
}
|
||||
|
||||
public String getAuthor() {
|
||||
return author;
|
||||
return author.getDisplayName();
|
||||
}
|
||||
|
||||
public boolean isAuthorDeleted() {
|
||||
@ -223,20 +207,19 @@ public class Post implements Parcelable {
|
||||
}
|
||||
|
||||
public void setAuthor(String author) {
|
||||
this.author = author;
|
||||
this.authorNamePrefixed = "u/" + author;
|
||||
|
||||
}
|
||||
|
||||
public String getAuthorNamePrefixed() {
|
||||
return authorNamePrefixed;
|
||||
return author.getQualifiedName();
|
||||
}
|
||||
|
||||
public String getAuthorIconUrl() {
|
||||
return authorIconUrl;
|
||||
return (author.getAvatar() == null) ? "" : author.getAvatar();
|
||||
}
|
||||
|
||||
public void setAuthorIconUrl(String authorIconUrl) {
|
||||
this.authorIconUrl = authorIconUrl;
|
||||
|
||||
}
|
||||
|
||||
public long getPostTimeMillis() {
|
||||
@ -512,16 +495,19 @@ public class Post implements Parcelable {
|
||||
this.gallery = gallery;
|
||||
}
|
||||
|
||||
public BasicCommunityInfo getCommunityInfo() {
|
||||
return communityInfo;
|
||||
}
|
||||
|
||||
public BasicUserInfo getAuthorInfo() {
|
||||
return author;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel parcel, int i) {
|
||||
parcel.writeInt(id);
|
||||
parcel.writeString(fullName);
|
||||
parcel.writeString(subredditName);
|
||||
parcel.writeString(subredditNamePrefixed);
|
||||
parcel.writeString(subredditIconUrl);
|
||||
parcel.writeString(author);
|
||||
parcel.writeString(authorNamePrefixed);
|
||||
parcel.writeString(authorIconUrl);
|
||||
parcel.writeParcelable(communityInfo, i);
|
||||
parcel.writeParcelable(author, i);
|
||||
parcel.writeLong(postTimeMillis);
|
||||
parcel.writeString(title);
|
||||
parcel.writeString(selfText);
|
||||
|
@ -112,7 +112,7 @@ public class CommunitySubscription {
|
||||
SubredditSubscriptionListener subredditSubscriptionListener) {
|
||||
executor.execute(() -> {
|
||||
SubscribedSubredditData subscribedSubredditData = new SubscribedSubredditData(subredditData.getId(), subredditData.getName(), LemmyUtils.actorID2FullName(subredditData.getActorId()),
|
||||
subredditData.getIconUrl(), accountName);
|
||||
subredditData.getIconUrl(), accountName, false);
|
||||
if (accountName.equals("-")) {
|
||||
if (!redditDataRoomDatabase.accountDao().isAnonymousAccountInserted()) {
|
||||
redditDataRoomDatabase.accountDao().insert(Account.getAnonymousAccount());
|
||||
|
@ -15,7 +15,10 @@ import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import eu.toldi.infinityforlemmy.community.CommunityStats;
|
||||
import eu.toldi.infinityforlemmy.user.BasicUserInfo;
|
||||
import eu.toldi.infinityforlemmy.utils.JSONUtils;
|
||||
import eu.toldi.infinityforlemmy.utils.LemmyUtils;
|
||||
|
||||
public class ParseSubredditData {
|
||||
public static void parseSubredditData(String response, ParseSubredditDataListener parseSubredditDataListener) {
|
||||
@ -71,8 +74,15 @@ public class ParseSubredditData {
|
||||
int instanceId = community.getInt("instance_id");
|
||||
int subscribers = (subredditDataJsonObject.has("counts")) ? subredditDataJsonObject.getJSONObject("counts").getInt("subscribers") : 0;
|
||||
boolean blocked = (subredditDataJsonObject.has("blocked")) ? subredditDataJsonObject.getBoolean("blocked") : true;
|
||||
|
||||
return new SubredditData(id, name, title, description, removed, published, updated, deleted, isNSFW, actorId, local, iconUrl, bannerImageUrl, hidden, postingRestrictedToMods, instanceId, subscribers, blocked);
|
||||
CommunityStats stats = null;
|
||||
if (subredditDataJsonObject.has("counts")) {
|
||||
JSONObject counts = subredditDataJsonObject.getJSONObject("counts");
|
||||
int activeUserCount = counts.getInt("users_active_month");
|
||||
int postCount = counts.getInt("posts");
|
||||
int commentCount = counts.getInt("comments");
|
||||
stats = new CommunityStats(subscribers, activeUserCount, postCount, commentCount);
|
||||
}
|
||||
return new SubredditData(id, name, title, description, removed, published, updated, deleted, isNSFW, actorId, local, iconUrl, bannerImageUrl, hidden, postingRestrictedToMods, instanceId, subscribers, blocked, stats);
|
||||
}
|
||||
|
||||
interface ParseSubredditDataListener {
|
||||
@ -111,6 +121,16 @@ public class ParseSubredditData {
|
||||
JSONObject data = jsonResponse.getJSONObject("community_view");
|
||||
mNCurrentOnlineSubscribers = 0;// data.getInt(JSONUtils.ACTIVE_USER_COUNT_KEY);
|
||||
subredditData = parseSubredditData(data, true);
|
||||
JSONArray moderators = jsonResponse.getJSONArray("moderators");
|
||||
for (int i = 0; i < moderators.length(); i++) {
|
||||
JSONObject moderator = moderators.getJSONObject(i).getJSONObject("moderator");
|
||||
int mod_id = moderator.getInt("id");
|
||||
String mod_name = moderator.getString("name");
|
||||
String mod_displayName = moderator.optString("display_name", mod_name);
|
||||
String mod_qualified_name = LemmyUtils.actorID2FullName(moderator.getString("actor_id"));
|
||||
String avatarUrl = moderator.optString("avatar", "");
|
||||
subredditData.addModerator(new BasicUserInfo(mod_id, mod_name, mod_qualified_name, avatarUrl, mod_displayName));
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
parseFailed = true;
|
||||
e.printStackTrace();
|
||||
|
@ -1,13 +1,22 @@
|
||||
package eu.toldi.infinityforlemmy.subreddit;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.room.ColumnInfo;
|
||||
import androidx.room.Entity;
|
||||
import androidx.room.Ignore;
|
||||
import androidx.room.PrimaryKey;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import eu.toldi.infinityforlemmy.community.CommunityStats;
|
||||
import eu.toldi.infinityforlemmy.user.BasicUserInfo;
|
||||
|
||||
@Entity(tableName = "subreddits")
|
||||
public class SubredditData {
|
||||
public class SubredditData implements Parcelable {
|
||||
@PrimaryKey
|
||||
@NonNull
|
||||
@ColumnInfo(name = "id")
|
||||
@ -68,6 +77,76 @@ public class SubredditData {
|
||||
@Ignore
|
||||
private boolean isSelected;
|
||||
|
||||
@Ignore
|
||||
private CommunityStats communityStats;
|
||||
|
||||
@Ignore
|
||||
private List<BasicUserInfo> moderators = new ArrayList<>();
|
||||
|
||||
protected SubredditData(Parcel in) {
|
||||
id = in.readInt();
|
||||
name = in.readString();
|
||||
title = in.readString();
|
||||
description = in.readString();
|
||||
removed = in.readByte() != 0;
|
||||
published = in.readString();
|
||||
updated = in.readString();
|
||||
deleted = in.readByte() != 0;
|
||||
nsfw = in.readByte() != 0;
|
||||
actorId = in.readString();
|
||||
local = in.readByte() != 0;
|
||||
icon = in.readString();
|
||||
banner = in.readString();
|
||||
hidden = in.readByte() != 0;
|
||||
postingRestrictedToMods = in.readByte() != 0;
|
||||
instanceId = in.readInt();
|
||||
subscribers = in.readInt();
|
||||
blocked = in.readByte() != 0;
|
||||
isSelected = in.readByte() != 0;
|
||||
communityStats = in.readParcelable(CommunityStats.class.getClassLoader());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeInt(id);
|
||||
dest.writeString(name);
|
||||
dest.writeString(title);
|
||||
dest.writeString(description);
|
||||
dest.writeByte((byte) (removed ? 1 : 0));
|
||||
dest.writeString(published);
|
||||
dest.writeString(updated);
|
||||
dest.writeByte((byte) (deleted ? 1 : 0));
|
||||
dest.writeByte((byte) (nsfw ? 1 : 0));
|
||||
dest.writeString(actorId);
|
||||
dest.writeByte((byte) (local ? 1 : 0));
|
||||
dest.writeString(icon);
|
||||
dest.writeString(banner);
|
||||
dest.writeByte((byte) (hidden ? 1 : 0));
|
||||
dest.writeByte((byte) (postingRestrictedToMods ? 1 : 0));
|
||||
dest.writeInt(instanceId);
|
||||
dest.writeInt(subscribers);
|
||||
dest.writeByte((byte) (blocked ? 1 : 0));
|
||||
dest.writeByte((byte) (isSelected ? 1 : 0));
|
||||
dest.writeParcelable(communityStats, flags);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static final Creator<SubredditData> CREATOR = new Creator<SubredditData>() {
|
||||
@Override
|
||||
public SubredditData createFromParcel(Parcel in) {
|
||||
return new SubredditData(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SubredditData[] newArray(int size) {
|
||||
return new SubredditData[size];
|
||||
}
|
||||
};
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
@ -225,6 +304,28 @@ public class SubredditData {
|
||||
this.blocked = blocked;
|
||||
}
|
||||
|
||||
public SubredditData(int id, String name, String title, String description, boolean removed, String published, String updated, boolean deleted, boolean nsfw, String actorId, boolean local, String icon, String banner, boolean hidden, boolean postingRestrictedToMods, int instanceId, int subscribers, boolean blocked, CommunityStats communityStats) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.title = title;
|
||||
this.description = description;
|
||||
this.removed = removed;
|
||||
this.published = published;
|
||||
this.updated = updated;
|
||||
this.deleted = deleted;
|
||||
this.nsfw = nsfw;
|
||||
this.actorId = actorId;
|
||||
this.local = local;
|
||||
this.icon = icon;
|
||||
this.banner = banner;
|
||||
this.hidden = hidden;
|
||||
this.postingRestrictedToMods = postingRestrictedToMods;
|
||||
this.instanceId = instanceId;
|
||||
this.subscribers = subscribers;
|
||||
this.blocked = blocked;
|
||||
this.communityStats = communityStats;
|
||||
}
|
||||
|
||||
public boolean isNSFW() {
|
||||
return nsfw;
|
||||
}
|
||||
@ -264,4 +365,20 @@ public class SubredditData {
|
||||
public void setBlocked(boolean blocked) {
|
||||
this.blocked = blocked;
|
||||
}
|
||||
|
||||
public CommunityStats getCommunityStats() {
|
||||
return communityStats;
|
||||
}
|
||||
|
||||
public void setCommunityStats(CommunityStats communityStats) {
|
||||
this.communityStats = communityStats;
|
||||
}
|
||||
|
||||
public List<BasicUserInfo> getModerators() {
|
||||
return moderators;
|
||||
}
|
||||
|
||||
public void addModerator(BasicUserInfo moderator) {
|
||||
moderators.add(moderator);
|
||||
}
|
||||
}
|
||||
|
@ -33,4 +33,7 @@ public interface SubscribedSubredditDao {
|
||||
|
||||
@Query("DELETE FROM subscribed_subreddits WHERE name = :subredditName COLLATE NOCASE AND username = :accountName COLLATE NOCASE")
|
||||
void deleteSubscribedSubreddit(String subredditName, String accountName);
|
||||
|
||||
@Query("SELECT * from subscribed_subreddits WHERE username = :qualified_name AND name LIKE '%' || :searchQuery || '%' COLLATE NOCASE AND is_favorite = 1 ORDER BY name COLLATE NOCASE ASC")
|
||||
LiveData<List<SubscribedSubredditData>> getAllFavoriteSubscribedSubredditsWithSearchQuery(String qualified_name, String searchQuery);
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.room.ColumnInfo;
|
||||
import androidx.room.Entity;
|
||||
import androidx.room.ForeignKey;
|
||||
@ -30,12 +31,16 @@ public class SubscribedSubredditData implements Parcelable {
|
||||
@ColumnInfo(name = "username")
|
||||
private String username;
|
||||
|
||||
public SubscribedSubredditData(@NonNull int id, String name, @NonNull String qualified_name, String iconUrl, @NonNull String username) {
|
||||
@ColumnInfo(name = "is_favorite")
|
||||
private boolean favorite;
|
||||
|
||||
public SubscribedSubredditData(@NonNull int id, String name, @NonNull String qualified_name, String iconUrl, @NonNull String username, boolean favorite) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.iconUrl = iconUrl;
|
||||
this.username = username;
|
||||
this.qualified_name = qualified_name;
|
||||
this.favorite = favorite;
|
||||
}
|
||||
|
||||
public SubscribedSubredditData(@NonNull SubredditData communityData) {
|
||||
@ -44,6 +49,7 @@ public class SubscribedSubredditData implements Parcelable {
|
||||
this.iconUrl = communityData.getIconUrl();
|
||||
this.username = "-";
|
||||
this.qualified_name = LemmyUtils.actorID2FullName(communityData.getActorId());
|
||||
this.favorite = false;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@ -89,6 +95,7 @@ public class SubscribedSubredditData implements Parcelable {
|
||||
parcel.writeString(iconUrl);
|
||||
parcel.writeString(username);
|
||||
parcel.writeString(qualified_name);
|
||||
parcel.writeByte((byte) (favorite ? 1 : 0));
|
||||
}
|
||||
|
||||
public SubscribedSubredditData(Parcel in) {
|
||||
@ -97,6 +104,7 @@ public class SubscribedSubredditData implements Parcelable {
|
||||
iconUrl = in.readString();
|
||||
username = in.readString();
|
||||
qualified_name = in.readString();
|
||||
favorite = in.readByte() != 0;
|
||||
}
|
||||
|
||||
public static final Creator<SubscribedSubredditData> CREATOR = new Creator<>() {
|
||||
@ -110,4 +118,25 @@ public class SubscribedSubredditData implements Parcelable {
|
||||
return new SubscribedSubredditData[size];
|
||||
}
|
||||
};
|
||||
|
||||
public boolean isFavorite() {
|
||||
return favorite;
|
||||
}
|
||||
|
||||
public void setFavorite(boolean favorite) {
|
||||
this.favorite = favorite;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (obj instanceof SubscribedSubredditData) {
|
||||
return id == ((SubscribedSubredditData) obj).getId();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,10 @@ public class SubscribedSubredditRepository {
|
||||
return mSubscribedSubredditDao.getAllSubscribedSubredditsWithSearchQuery(mAccountName, searchQuery);
|
||||
}
|
||||
|
||||
public LiveData<List<SubscribedSubredditData>> getAllFavoriteSubscribedSubredditsWithSearchQuery(String searchQuery) {
|
||||
return mSubscribedSubredditDao.getAllFavoriteSubscribedSubredditsWithSearchQuery(mAccountName, searchQuery);
|
||||
}
|
||||
|
||||
public void insert(SubscribedSubredditData subscribedSubredditData) {
|
||||
new insertAsyncTask(mSubscribedSubredditDao).execute(subscribedSubredditData);
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ import eu.toldi.infinityforlemmy.RedditDataRoomDatabase;
|
||||
public class SubscribedSubredditViewModel extends AndroidViewModel {
|
||||
private SubscribedSubredditRepository mSubscribedSubredditRepository;
|
||||
private LiveData<List<SubscribedSubredditData>> mAllSubscribedSubreddits;
|
||||
private LiveData<List<SubscribedSubredditData>> mAllFavoriteSubscribedSubreddits;
|
||||
private MutableLiveData<String> searchQueryLiveData;
|
||||
|
||||
public SubscribedSubredditViewModel(Application application, RedditDataRoomDatabase redditDataRoomDatabase, String accountName) {
|
||||
@ -26,12 +27,17 @@ public class SubscribedSubredditViewModel extends AndroidViewModel {
|
||||
searchQueryLiveData.postValue("");
|
||||
|
||||
mAllSubscribedSubreddits = Transformations.switchMap(searchQueryLiveData, searchQuery -> mSubscribedSubredditRepository.getAllSubscribedSubredditsWithSearchQuery(searchQuery));
|
||||
mAllFavoriteSubscribedSubreddits = Transformations.switchMap(searchQueryLiveData, searchQuery -> mSubscribedSubredditRepository.getAllFavoriteSubscribedSubredditsWithSearchQuery(searchQuery));
|
||||
}
|
||||
|
||||
public LiveData<List<SubscribedSubredditData>> getAllSubscribedSubreddits() {
|
||||
return mAllSubscribedSubreddits;
|
||||
}
|
||||
|
||||
public LiveData<List<SubscribedSubredditData>> getAllFavoriteSubscribedSubreddits() {
|
||||
return mAllFavoriteSubscribedSubreddits;
|
||||
}
|
||||
|
||||
public void insert(SubscribedSubredditData subscribedSubredditData) {
|
||||
mSubscribedSubredditRepository.insert(subscribedSubredditData);
|
||||
}
|
||||
|
@ -0,0 +1,139 @@
|
||||
package eu.toldi.infinityforlemmy.user;
|
||||
|
||||
|
||||
import android.content.Intent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.RequestManager;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import eu.toldi.infinityforlemmy.R;
|
||||
import eu.toldi.infinityforlemmy.activities.BaseActivity;
|
||||
import eu.toldi.infinityforlemmy.activities.ViewUserDetailActivity;
|
||||
import eu.toldi.infinityforlemmy.customtheme.CustomThemeWrapper;
|
||||
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
|
||||
import me.zhanghai.android.fastscroll.PopupTextProvider;
|
||||
import pl.droidsonroids.gif.GifImageView;
|
||||
|
||||
public class BasicUserRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements PopupTextProvider {
|
||||
private static final int VIEW_TYPE_FAVORITE_USER_DIVIDER = 0;
|
||||
private static final int VIEW_TYPE_FAVORITE_USER = 1;
|
||||
private static final int VIEW_TYPE_USER_DIVIDER = 2;
|
||||
private static final int VIEW_TYPE_USER = 3;
|
||||
|
||||
private List<BasicUserInfo> basicUserInfo;
|
||||
private BaseActivity mActivity;
|
||||
private RequestManager glide;
|
||||
private int mPrimaryTextColor;
|
||||
private int mSecondaryTextColor;
|
||||
|
||||
public BasicUserRecyclerViewAdapter(BaseActivity activity,
|
||||
CustomThemeWrapper customThemeWrapper) {
|
||||
mActivity = activity;
|
||||
glide = Glide.with(activity);
|
||||
mPrimaryTextColor = customThemeWrapper.getPrimaryTextColor();
|
||||
mSecondaryTextColor = customThemeWrapper.getSecondaryTextColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
return VIEW_TYPE_USER;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
|
||||
return new UserViewHolder(LayoutInflater.from(viewGroup.getContext())
|
||||
.inflate(R.layout.item_subscribed_thing, viewGroup, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull final RecyclerView.ViewHolder viewHolder, int i) {
|
||||
if (viewHolder instanceof UserViewHolder) {
|
||||
|
||||
if (!basicUserInfo.get(viewHolder.getBindingAdapterPosition()).getAvatar().equals("")) {
|
||||
glide.load(basicUserInfo.get(viewHolder.getBindingAdapterPosition()).getAvatar())
|
||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
||||
.error(glide.load(R.drawable.subreddit_default_icon)
|
||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
|
||||
.into(((UserViewHolder) viewHolder).iconGifImageView);
|
||||
} else {
|
||||
glide.load(R.drawable.subreddit_default_icon)
|
||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
||||
.into(((UserViewHolder) viewHolder).iconGifImageView);
|
||||
}
|
||||
((UserViewHolder) viewHolder).userNameTextView.setText(basicUserInfo.get(viewHolder.getBindingAdapterPosition()).getDisplayName());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
if (basicUserInfo != null && basicUserInfo.size() > 0) {
|
||||
return basicUserInfo.size();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewRecycled(@NonNull RecyclerView.ViewHolder holder) {
|
||||
if (holder instanceof UserViewHolder) {
|
||||
glide.clear(((UserViewHolder) holder).iconGifImageView);
|
||||
}
|
||||
}
|
||||
|
||||
public void setUsers(List<BasicUserInfo> subscribedUsers) {
|
||||
basicUserInfo = subscribedUsers;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String getPopupText(int position) {
|
||||
return basicUserInfo.get(position).getQualifiedName().substring(0, 1).toUpperCase();
|
||||
}
|
||||
|
||||
protected int getUserNameTextColor() {
|
||||
return mPrimaryTextColor;
|
||||
}
|
||||
|
||||
|
||||
protected class UserViewHolder extends RecyclerView.ViewHolder {
|
||||
@BindView(R.id.thing_icon_gif_image_view_item_subscribed_thing)
|
||||
GifImageView iconGifImageView;
|
||||
@BindView(R.id.thing_name_text_view_item_subscribed_thing)
|
||||
TextView userNameTextView;
|
||||
|
||||
protected UserViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
ButterKnife.bind(this, itemView);
|
||||
if (mActivity.typeface != null) {
|
||||
userNameTextView.setTypeface(mActivity.typeface);
|
||||
}
|
||||
userNameTextView.setTextColor(getUserNameTextColor());
|
||||
|
||||
itemView.setOnClickListener(view -> {
|
||||
int position = getBindingAdapterPosition();
|
||||
if (position >= 0 && basicUserInfo.size() > position) {
|
||||
Intent intent = new Intent(mActivity, ViewUserDetailActivity.class);
|
||||
intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, basicUserInfo.get(position).getDisplayName());
|
||||
intent.putExtra(ViewUserDetailActivity.EXTRA_QUALIFIED_USER_NAME_KEY, basicUserInfo.get(position).getQualifiedName());
|
||||
mActivity.startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -28,6 +28,7 @@ public class ParseUserData {
|
||||
|
||||
|
||||
JSONObject personJson = (userDataJson.has("person_view")) ? userDataJson.getJSONObject("person_view").getJSONObject("person") : userDataJson.getJSONObject("person");
|
||||
JSONObject countsJson = (userDataJson.has("person_view")) ? userDataJson.getJSONObject("person_view").getJSONObject("counts") : userDataJson.getJSONObject("counts");
|
||||
String userName = personJson.getString(JSONUtils.NAME_KEY);
|
||||
String actor_id = personJson.getString("actor_id");
|
||||
String iconImageUrl = "";
|
||||
@ -59,9 +60,13 @@ public class ParseUserData {
|
||||
if (!personJson.isNull("display_name")) {
|
||||
title = personJson.getString("display_name");
|
||||
}
|
||||
int postCount = countsJson.optInt("post_count", 0);
|
||||
int commentCount = countsJson.optInt("comment_count", 0);
|
||||
int postScore = countsJson.optInt("post_score", 0);
|
||||
int commentScore = countsJson.optInt("comment_score", 0);
|
||||
UserStats userStats = new UserStats(postCount, postScore, commentCount, commentScore);
|
||||
|
||||
|
||||
return new UserData(account_id,userName,title, iconImageUrl,isBanned,cakeday,actor_id,isLocal,isDeleted,isAdmin,isBot,instance_id);
|
||||
return new UserData(account_id, userName, title, iconImageUrl, isBanned, cakeday, actor_id, isLocal, isDeleted, isAdmin, isBot, instance_id, userStats);
|
||||
}
|
||||
|
||||
interface ParseUserDataListener {
|
||||
|
@ -49,6 +49,9 @@ public class UserData {
|
||||
@Ignore
|
||||
private boolean isSelected;
|
||||
|
||||
@Ignore
|
||||
private UserStats stats;
|
||||
|
||||
public boolean isSelected() {
|
||||
return isSelected;
|
||||
}
|
||||
@ -157,6 +160,10 @@ public class UserData {
|
||||
this.instanceId = instanceId;
|
||||
}
|
||||
|
||||
public UserStats getStats() {
|
||||
return stats;
|
||||
}
|
||||
|
||||
public UserData(int id, String name, String displayName, String avatar, boolean banned, String published, String actorId, boolean local, boolean deleted, boolean admin, boolean botAccount, int instanceId) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
@ -172,6 +179,23 @@ public class UserData {
|
||||
this.instanceId = instanceId;
|
||||
}
|
||||
|
||||
public UserData(int id, String name, String displayName, String avatar, boolean banned, String published, String actorId, boolean local, boolean deleted, boolean admin, boolean botAccount, int instanceId, UserStats stats) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.displayName = displayName;
|
||||
this.avatar = avatar;
|
||||
this.banned = banned;
|
||||
this.published = published;
|
||||
this.actorId = actorId;
|
||||
this.local = local;
|
||||
this.deleted = deleted;
|
||||
this.admin = admin;
|
||||
this.botAccount = botAccount;
|
||||
this.instanceId = instanceId;
|
||||
this.stats = stats;
|
||||
}
|
||||
|
||||
|
||||
public boolean isCanBeFollowed() {
|
||||
return false;
|
||||
}
|
||||
|
@ -1,5 +1,14 @@
|
||||
package eu.toldi.infinityforlemmy.utils;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.TimeZone;
|
||||
|
||||
public class LemmyUtils {
|
||||
public static String actorID2FullName(String url) {
|
||||
String[] splitURL = url.split("/");
|
||||
@ -21,4 +30,25 @@ public class LemmyUtils {
|
||||
String domain = splitQualifiedName[1];
|
||||
return "https://" + domain + "/u/" + userName;
|
||||
}
|
||||
|
||||
public static Long dateStringToMills(String dateStr) {
|
||||
long postTimeMillis = 0;
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
|
||||
postTimeMillis = ZonedDateTime.parse(dateStr,
|
||||
DateTimeFormatter.ISO_DATE_TIME.withZone(ZoneId.of("Z"))).toInstant().toEpochMilli();
|
||||
} else {
|
||||
dateStr = dateStr.substring(0, dateStr.lastIndexOf(".") + 4) + 'Z';
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.getDefault());
|
||||
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
try {
|
||||
Date date = sdf.parse(dateStr);
|
||||
if (date != null) {
|
||||
postTimeMillis = date.getTime();
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return postTimeMillis;
|
||||
}
|
||||
}
|
||||
|
@ -54,6 +54,10 @@ public class SharedPreferencesUtils {
|
||||
|
||||
public static final String COMMENT_SEPARATE_UP_AND_DOWN_VOTES = "comment_separate_down_and_up_votes";
|
||||
|
||||
public static final String POST_DISPLAY_NAME_INSTEAD_OF_USERNAME = "post_display_name_instead_of_user_name";
|
||||
|
||||
public static final String POST_DETAIL_DISPLAY_NAME_INSTEAD_OF_USERNAME = "post_detail_display_name_instead_of_user_name";
|
||||
|
||||
public static final String SORT_TYPE_SHARED_PREFERENCES_FILE = "eu.toldi.infinityforlemmy.sort_type";
|
||||
public static final String SORT_TYPE_BEST_POST = "sort_type_best_post";
|
||||
public static final String SORT_TIME_BEST_POST = "sort_time_best_post";
|
||||
@ -407,4 +411,6 @@ public class SharedPreferencesUtils {
|
||||
public static final String ACCOUNT_INSTANCE = "account_instance";
|
||||
public static final String ACCOUNT_QUALIFIED_NAME = "account_qualified_name";
|
||||
public static final String CAN_DOWNVOTE = "can_downvote";
|
||||
public static final String SHOW_STATISTICS = "show_statistics";
|
||||
public static final String SHOW_POST_AND_COMMENT_SCORE = "show_score";
|
||||
}
|
||||
|
@ -49,7 +49,9 @@ public class UploadImageUtils {
|
||||
if (uploadMediaResponse.isSuccessful()) {
|
||||
JSONObject responseObject = new JSONObject(uploadMediaResponse.body());
|
||||
String fileName = responseObject.getJSONArray("files").getJSONObject(0).getString("file");
|
||||
return mRetrofit.getBaseURL() + "/pictrs/image/" + fileName;
|
||||
String baseURL = mRetrofit.getBaseURL();
|
||||
|
||||
return baseURL + "/pictrs/image/" + fileName;
|
||||
} else {
|
||||
return "Error: " + uploadMediaResponse.code();
|
||||
}
|
||||
|
@ -0,0 +1,35 @@
|
||||
package eu.toldi.infinityforlemmy.comment
|
||||
|
||||
import eu.toldi.infinityforlemmy.RetrofitHolder
|
||||
import eu.toldi.infinityforlemmy.apis.LemmyAPI
|
||||
import eu.toldi.infinityforlemmy.dto.ReportCommentDTO
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
|
||||
class LemmyCommentAPI(val retrofitHolder: RetrofitHolder) {
|
||||
|
||||
fun reportComment(id: Int, reason: String, auth: String, callback: ReportCommentCallback) {
|
||||
val api = retrofitHolder.retrofit.create(LemmyAPI::class.java)
|
||||
api.commentReport(ReportCommentDTO(id, reason, auth)).enqueue(object : Callback<String> {
|
||||
override fun onResponse(
|
||||
call: retrofit2.Call<String>,
|
||||
response: retrofit2.Response<String>
|
||||
) {
|
||||
if (response.isSuccessful) {
|
||||
callback.onSuccess()
|
||||
} else {
|
||||
callback.onFailure()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(call: Call<String>, t: Throwable) {
|
||||
callback.onFailure()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
public interface ReportCommentCallback {
|
||||
fun onSuccess()
|
||||
fun onFailure()
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package eu.toldi.infinityforlemmy.community
|
||||
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
data class BasicCommunityInfo(
|
||||
val id: Int,
|
||||
val name: String,
|
||||
val qualifiedName: String,
|
||||
val icon: String?,
|
||||
val displayName: String
|
||||
) : Parcelable {
|
||||
constructor(parcel: Parcel) : this(
|
||||
parcel.readInt(),
|
||||
parcel.readString()!!,
|
||||
parcel.readString()!!,
|
||||
parcel.readString(),
|
||||
parcel.readString()!!
|
||||
) {
|
||||
}
|
||||
|
||||
override fun writeToParcel(parcel: Parcel, flags: Int) {
|
||||
parcel.writeInt(id)
|
||||
parcel.writeString(name)
|
||||
parcel.writeString(qualifiedName)
|
||||
parcel.writeString(icon)
|
||||
parcel.writeString(displayName)
|
||||
}
|
||||
|
||||
override fun describeContents(): Int {
|
||||
return 0
|
||||
}
|
||||
|
||||
companion object CREATOR : Parcelable.Creator<BasicCommunityInfo> {
|
||||
override fun createFromParcel(parcel: Parcel): BasicCommunityInfo {
|
||||
return BasicCommunityInfo(parcel)
|
||||
}
|
||||
|
||||
override fun newArray(size: Int): Array<BasicCommunityInfo?> {
|
||||
return arrayOfNulls(size)
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package eu.toldi.infinityforlemmy.community
|
||||
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
data class CommunityStats(
|
||||
val subscribers: Int,
|
||||
val activeUsers: Int,
|
||||
val posts: Int,
|
||||
val comments: Int
|
||||
) : Parcelable {
|
||||
constructor(parcel: Parcel) : this(
|
||||
parcel.readInt(),
|
||||
parcel.readInt(),
|
||||
parcel.readInt(),
|
||||
parcel.readInt()
|
||||
) {
|
||||
}
|
||||
|
||||
override fun writeToParcel(parcel: Parcel, flags: Int) {
|
||||
parcel.writeInt(subscribers)
|
||||
parcel.writeInt(activeUsers)
|
||||
parcel.writeInt(posts)
|
||||
parcel.writeInt(comments)
|
||||
}
|
||||
|
||||
override fun describeContents(): Int {
|
||||
return 0
|
||||
}
|
||||
|
||||
companion object CREATOR : Parcelable.Creator<CommunityStats> {
|
||||
override fun createFromParcel(parcel: Parcel): CommunityStats {
|
||||
return CommunityStats(parcel)
|
||||
}
|
||||
|
||||
override fun newArray(size: Int): Array<CommunityStats?> {
|
||||
return arrayOfNulls(size)
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package eu.toldi.infinityforlemmy.dto
|
||||
|
||||
data class PrivateMessageDTO(val recipient_id: Int, val content: String, val auth: String)
|
||||
|
||||
data class PrivateMessageUpdateDTO(
|
||||
val private_message_id: Int,
|
||||
val auth: String,
|
||||
val content: String
|
||||
)
|
||||
|
||||
data class PrivateMessageDeleteDTO(
|
||||
val private_message_id: Int,
|
||||
val auth: String,
|
||||
val deleted: Boolean
|
||||
)
|
||||
|
||||
data class PrivateMessageReadDTO(val private_message_id: Int, val auth: String, val read: Boolean)
|
||||
|
||||
data class PrivateMessageReportDTO(
|
||||
val private_message_id: Int,
|
||||
val auth: String,
|
||||
val reason: String
|
||||
)
|
@ -0,0 +1,5 @@
|
||||
package eu.toldi.infinityforlemmy.dto
|
||||
|
||||
data class ReportPostDTO(val post_id: Int, val reason: String, val auth: String)
|
||||
|
||||
data class ReportCommentDTO(val comment_id: Int, val reason: String, val auth: String)
|
@ -0,0 +1,36 @@
|
||||
package eu.toldi.infinityforlemmy.post
|
||||
|
||||
import eu.toldi.infinityforlemmy.RetrofitHolder
|
||||
import eu.toldi.infinityforlemmy.apis.LemmyAPI
|
||||
import eu.toldi.infinityforlemmy.dto.ReportPostDTO
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
|
||||
class LemmyPostAPI(val retrofitHolder: RetrofitHolder) {
|
||||
|
||||
fun reportPost(postId: Int, reason: String, auth: String, callback: ReportPostCallback) {
|
||||
val api = retrofitHolder.retrofit.create(LemmyAPI::class.java)
|
||||
api.postReport(ReportPostDTO(postId, reason, auth)).enqueue(object : Callback<String> {
|
||||
override fun onResponse(
|
||||
call: retrofit2.Call<String>,
|
||||
response: retrofit2.Response<String>
|
||||
) {
|
||||
if (response.isSuccessful) {
|
||||
callback.onSuccess()
|
||||
} else {
|
||||
callback.onFailure()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(call: Call<String>, t: Throwable) {
|
||||
callback.onFailure()
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
public interface ReportPostCallback {
|
||||
fun onSuccess()
|
||||
fun onFailure()
|
||||
}
|
||||
}
|
@ -0,0 +1,153 @@
|
||||
package eu.toldi.infinityforlemmy.privatemessage
|
||||
|
||||
import eu.toldi.infinityforlemmy.RetrofitHolder
|
||||
import eu.toldi.infinityforlemmy.apis.LemmyAPI
|
||||
import eu.toldi.infinityforlemmy.dto.PrivateMessageDTO
|
||||
import eu.toldi.infinityforlemmy.dto.PrivateMessageReadDTO
|
||||
import eu.toldi.infinityforlemmy.utils.LemmyUtils
|
||||
import org.json.JSONObject
|
||||
|
||||
class LemmyPrivateMessageAPI(val retrofitHolder: RetrofitHolder) {
|
||||
|
||||
|
||||
fun fetchPrivateMessages(
|
||||
auth: String,
|
||||
page: Int,
|
||||
listener: PrivateMessageFetchedListener,
|
||||
limit: Int = 25,
|
||||
unreadOnly: Boolean = false
|
||||
) {
|
||||
val api = retrofitHolder.retrofit.create(LemmyAPI::class.java)
|
||||
api.privateMessagesList(page, limit, unreadOnly, auth).enqueue(
|
||||
object : retrofit2.Callback<String> {
|
||||
override fun onResponse(
|
||||
call: retrofit2.Call<String>,
|
||||
response: retrofit2.Response<String>
|
||||
) {
|
||||
if (response.isSuccessful) {
|
||||
val jresponse = JSONObject(response.body()!!);
|
||||
val privateMessages = jresponse.getJSONArray("private_messages")
|
||||
val privateMessageList = mutableListOf<PrivateMessage>()
|
||||
for (i in 0 until privateMessages.length()) {
|
||||
val privateMessage =
|
||||
parsePrivateMessage(privateMessages.getJSONObject(i))
|
||||
privateMessageList.add(privateMessage)
|
||||
}
|
||||
listener.onPrivateMessageFetchedSuccess(privateMessageList)
|
||||
} else {
|
||||
listener.onPrivateMessageFetchedError()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(call: retrofit2.Call<String>, t: Throwable) {
|
||||
listener.onPrivateMessageFetchedError()
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
fun markPrivateMessageAsRead(
|
||||
auth: String,
|
||||
privateMessageId: Int,
|
||||
listener: PrivateMessageMarkedAsReadListener
|
||||
) {
|
||||
val api = retrofitHolder.retrofit.create(LemmyAPI::class.java)
|
||||
api.privateMessageMarkAsRead(PrivateMessageReadDTO(privateMessageId, auth, true)).enqueue(
|
||||
object : retrofit2.Callback<String> {
|
||||
override fun onResponse(
|
||||
call: retrofit2.Call<String>,
|
||||
response: retrofit2.Response<String>
|
||||
) {
|
||||
if (response.isSuccessful) {
|
||||
listener.onPrivateMessageMarkedAsReadSuccess()
|
||||
} else {
|
||||
listener.onPrivateMessageMarkedAsReadError()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(call: retrofit2.Call<String>, t: Throwable) {
|
||||
listener.onPrivateMessageMarkedAsReadError()
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
fun sendPrivateMessage(
|
||||
auth: String,
|
||||
recipientId: Int,
|
||||
content: String,
|
||||
listener: PrivateMessageSentListener
|
||||
) {
|
||||
val api = retrofitHolder.retrofit.create(LemmyAPI::class.java)
|
||||
|
||||
api.privateMessageSend(PrivateMessageDTO(recipientId, content, auth)).enqueue(
|
||||
object : retrofit2.Callback<String> {
|
||||
override fun onResponse(
|
||||
call: retrofit2.Call<String>,
|
||||
response: retrofit2.Response<String>
|
||||
) {
|
||||
if (response.isSuccessful) {
|
||||
listener.onPrivateMessageSentSuccess(
|
||||
parsePrivateMessage(
|
||||
JSONObject(response.body()!!).getJSONObject(
|
||||
"private_message_view"
|
||||
)
|
||||
)
|
||||
)
|
||||
} else {
|
||||
listener.onPrivateMessageSentError()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(call: retrofit2.Call<String>, t: Throwable) {
|
||||
listener.onPrivateMessageSentError()
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
interface PrivateMessageSentListener {
|
||||
fun onPrivateMessageSentSuccess(privateMessage: PrivateMessage)
|
||||
fun onPrivateMessageSentError()
|
||||
}
|
||||
|
||||
interface PrivateMessageMarkedAsReadListener {
|
||||
fun onPrivateMessageMarkedAsReadSuccess()
|
||||
fun onPrivateMessageMarkedAsReadError()
|
||||
}
|
||||
|
||||
|
||||
interface PrivateMessageFetchedListener {
|
||||
fun onPrivateMessageFetchedSuccess(privateMessage: List<PrivateMessage>)
|
||||
fun onPrivateMessageFetchedError()
|
||||
}
|
||||
|
||||
private fun parsePrivateMessage(jsonObject: JSONObject): PrivateMessage {
|
||||
|
||||
val privateMessage = jsonObject.getJSONObject("private_message")
|
||||
val creator = jsonObject.getJSONObject("creator")
|
||||
val recipient = jsonObject.getJSONObject("recipient")
|
||||
val updated = privateMessage.optString("updated", "")
|
||||
|
||||
return PrivateMessage(
|
||||
id = privateMessage.getInt("id"),
|
||||
creatorId = privateMessage.getInt("creator_id"),
|
||||
recipientId = privateMessage.getInt("recipient_id"),
|
||||
content = privateMessage.getString("content"),
|
||||
deleted = privateMessage.getBoolean("deleted"),
|
||||
read = privateMessage.getBoolean("read"),
|
||||
published = LemmyUtils.dateStringToMills(privateMessage.getString("published")),
|
||||
updated = if (updated == "") {
|
||||
null
|
||||
} else {
|
||||
LemmyUtils.dateStringToMills(updated)
|
||||
},
|
||||
creatorName = creator.getString("name"),
|
||||
creatorAvatar = creator.optString("avatar", ""),
|
||||
creatorQualifiedName = LemmyUtils.actorID2FullName(creator.getString("actor_id")),
|
||||
recipientName = recipient.getString("name"),
|
||||
recipientAvatar = recipient.optString("avatar", ""),
|
||||
recipientQualifiedName = LemmyUtils.actorID2FullName(recipient.getString("actor_id"))
|
||||
)
|
||||
}
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
package eu.toldi.infinityforlemmy.privatemessage
|
||||
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
data class PrivateMessage(
|
||||
val id: Int,
|
||||
val creatorId: Int,
|
||||
val recipientId: Int,
|
||||
val content: String,
|
||||
val deleted: Boolean,
|
||||
var read: Boolean,
|
||||
val published: Long,
|
||||
val updated: Long?,
|
||||
val creatorName: String,
|
||||
val creatorAvatar: String,
|
||||
val creatorQualifiedName: String,
|
||||
val recipientName: String,
|
||||
val recipientAvatar: String,
|
||||
val recipientQualifiedName: String
|
||||
) : Parcelable {
|
||||
fun addReply(reply: PrivateMessage) {
|
||||
replies.add(reply)
|
||||
}
|
||||
|
||||
val replies = mutableListOf<PrivateMessage>()
|
||||
|
||||
constructor(parcel: Parcel) : this(
|
||||
parcel.readInt(),
|
||||
parcel.readInt(),
|
||||
parcel.readInt(),
|
||||
parcel.readString()!!,
|
||||
parcel.readByte() != 0.toByte(),
|
||||
parcel.readByte() != 0.toByte(),
|
||||
parcel.readLong(),
|
||||
parcel.readValue(Long::class.java.classLoader) as? Long,
|
||||
parcel.readString()!!,
|
||||
parcel.readString()!!,
|
||||
parcel.readString()!!,
|
||||
parcel.readString()!!,
|
||||
parcel.readString()!!,
|
||||
parcel.readString()!!
|
||||
) {
|
||||
}
|
||||
|
||||
override fun writeToParcel(parcel: Parcel, flags: Int) {
|
||||
parcel.writeInt(id)
|
||||
parcel.writeInt(creatorId)
|
||||
parcel.writeInt(recipientId)
|
||||
parcel.writeString(content)
|
||||
parcel.writeByte(if (deleted) 1 else 0)
|
||||
parcel.writeByte(if (read) 1 else 0)
|
||||
parcel.writeLong(published)
|
||||
parcel.writeValue(updated)
|
||||
parcel.writeString(creatorName)
|
||||
parcel.writeString(creatorAvatar)
|
||||
parcel.writeString(creatorQualifiedName)
|
||||
parcel.writeString(recipientName)
|
||||
parcel.writeString(recipientAvatar)
|
||||
parcel.writeString(recipientQualifiedName)
|
||||
}
|
||||
|
||||
override fun describeContents(): Int {
|
||||
return 0
|
||||
}
|
||||
|
||||
companion object CREATOR : Parcelable.Creator<PrivateMessage> {
|
||||
override fun createFromParcel(parcel: Parcel): PrivateMessage {
|
||||
return PrivateMessage(parcel)
|
||||
}
|
||||
|
||||
override fun newArray(size: Int): Array<PrivateMessage?> {
|
||||
return arrayOfNulls(size)
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
package eu.toldi.infinityforlemmy.privatemessage
|
||||
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.paging.PageKeyedDataSource
|
||||
import eu.toldi.infinityforlemmy.NetworkState
|
||||
|
||||
|
||||
class PrivateMessageDataSource(
|
||||
private val mLemmyPrivateMessageAPI: LemmyPrivateMessageAPI,
|
||||
private val accessToken: String
|
||||
) : PageKeyedDataSource<Int, PrivateMessage>() {
|
||||
|
||||
val initialLoadStateLiveData = MutableLiveData<NetworkState>()
|
||||
|
||||
override fun loadInitial(
|
||||
params: LoadInitialParams<Int>,
|
||||
callback: LoadInitialCallback<Int, PrivateMessage>
|
||||
) {
|
||||
mLemmyPrivateMessageAPI.fetchPrivateMessages(accessToken, 1, object :
|
||||
LemmyPrivateMessageAPI.PrivateMessageFetchedListener {
|
||||
override fun onPrivateMessageFetchedSuccess(privateMessages: List<PrivateMessage>) {
|
||||
initialLoadStateLiveData.postValue(NetworkState.LOADED)
|
||||
if (privateMessages.isEmpty()) {
|
||||
callback.onResult(ArrayList(), null, null)
|
||||
} else {
|
||||
callback.onResult(privateMessages, null, 2)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onPrivateMessageFetchedError() {
|
||||
initialLoadStateLiveData.postValue(
|
||||
NetworkState(
|
||||
NetworkState.Status.FAILED,
|
||||
"Error fetching messages"
|
||||
)
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
override fun loadAfter(
|
||||
params: LoadParams<Int>,
|
||||
callback: LoadCallback<Int, PrivateMessage>
|
||||
) {
|
||||
mLemmyPrivateMessageAPI.fetchPrivateMessages(accessToken, params.key, object :
|
||||
LemmyPrivateMessageAPI.PrivateMessageFetchedListener {
|
||||
override fun onPrivateMessageFetchedSuccess(privateMessages: List<PrivateMessage>) {
|
||||
initialLoadStateLiveData.postValue(NetworkState.LOADED)
|
||||
if (privateMessages.isEmpty()) {
|
||||
callback.onResult(ArrayList(), null)
|
||||
} else {
|
||||
callback.onResult(privateMessages, params.key + 1)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onPrivateMessageFetchedError() {
|
||||
initialLoadStateLiveData.postValue(
|
||||
NetworkState(
|
||||
NetworkState.Status.FAILED,
|
||||
"Error fetching messages"
|
||||
)
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
override fun loadBefore(
|
||||
params: LoadParams<Int>,
|
||||
callback: LoadCallback<Int, PrivateMessage>
|
||||
) {
|
||||
|
||||
}
|
||||
|
||||
fun refresh() {
|
||||
invalidate()
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package eu.toldi.infinityforlemmy.privatemessage
|
||||
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.paging.DataSource
|
||||
|
||||
|
||||
class PrivateMessageDataSourceFactory(
|
||||
private val mLemmyPrivateMessageAPI: LemmyPrivateMessageAPI,
|
||||
private val accessToken: String
|
||||
) : DataSource.Factory<Int, PrivateMessage>() {
|
||||
|
||||
val dataSourceLiveData = MutableLiveData<PrivateMessageDataSource>()
|
||||
|
||||
override fun create(): DataSource<Int, PrivateMessage> {
|
||||
val dataSource = PrivateMessageDataSource(mLemmyPrivateMessageAPI, accessToken)
|
||||
dataSourceLiveData.postValue(dataSource)
|
||||
return dataSource
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,52 @@
|
||||
package eu.toldi.infinityforlemmy.privatemessage
|
||||
|
||||
import androidx.lifecycle.Transformations
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.paging.LivePagedListBuilder
|
||||
import androidx.paging.PagedList
|
||||
import retrofit2.Retrofit
|
||||
import java.util.Locale
|
||||
|
||||
|
||||
class PrivateMessageViewModel(
|
||||
private val mLemmyPrivateMessageAPI: LemmyPrivateMessageAPI,
|
||||
private val accessToken: String
|
||||
) : ViewModel() {
|
||||
|
||||
private val dataSourceFactory =
|
||||
PrivateMessageDataSourceFactory(mLemmyPrivateMessageAPI, accessToken)
|
||||
|
||||
val privateMessages = LivePagedListBuilder(
|
||||
dataSourceFactory, PagedList.Config.Builder()
|
||||
.setPageSize(20)
|
||||
.setEnablePlaceholders(false)
|
||||
.build()
|
||||
)
|
||||
.build()
|
||||
|
||||
val initialLoadState = Transformations.switchMap(dataSourceFactory.dataSourceLiveData) {
|
||||
it.initialLoadStateLiveData
|
||||
}
|
||||
|
||||
fun refresh() {
|
||||
dataSourceFactory.dataSourceLiveData.value?.refresh()
|
||||
}
|
||||
|
||||
|
||||
class Factory(
|
||||
private val retrofit: Retrofit,
|
||||
private val locale: Locale,
|
||||
private val accessToken: String,
|
||||
private val lemmyPrivateMessageAPI: LemmyPrivateMessageAPI
|
||||
) :
|
||||
ViewModelProvider.NewInstanceFactory() {
|
||||
|
||||
override fun <T : ViewModel> create(modelClass: Class<T>): T {
|
||||
return PrivateMessageViewModel(
|
||||
lemmyPrivateMessageAPI,
|
||||
accessToken,
|
||||
) as T
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package eu.toldi.infinityforlemmy.user
|
||||
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
data class BasicUserInfo(
|
||||
val id: Int,
|
||||
val username: String,
|
||||
val qualifiedName: String,
|
||||
val avatar: String?,
|
||||
val displayName: String
|
||||
) : Parcelable {
|
||||
constructor(parcel: Parcel) : this(
|
||||
parcel.readInt(),
|
||||
parcel.readString()!!,
|
||||
parcel.readString()!!,
|
||||
parcel.readString(),
|
||||
parcel.readString()!!
|
||||
) {
|
||||
}
|
||||
|
||||
override fun writeToParcel(parcel: Parcel, flags: Int) {
|
||||
parcel.writeInt(id)
|
||||
parcel.writeString(username)
|
||||
parcel.writeString(qualifiedName)
|
||||
parcel.writeString(avatar)
|
||||
parcel.writeString(displayName)
|
||||
}
|
||||
|
||||
override fun describeContents(): Int {
|
||||
return 0
|
||||
}
|
||||
|
||||
companion object CREATOR : Parcelable.Creator<BasicUserInfo> {
|
||||
override fun createFromParcel(parcel: Parcel): BasicUserInfo {
|
||||
return BasicUserInfo(parcel)
|
||||
}
|
||||
|
||||
override fun newArray(size: Int): Array<BasicUserInfo?> {
|
||||
return arrayOfNulls(size)
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package eu.toldi.infinityforlemmy.user
|
||||
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
data class UserStats(
|
||||
val postCount: Int,
|
||||
val postScore: Int,
|
||||
val commentCount: Int,
|
||||
val commentScore: Int
|
||||
) : Parcelable {
|
||||
constructor(parcel: Parcel) : this(
|
||||
parcel.readInt(),
|
||||
parcel.readInt(),
|
||||
parcel.readInt(),
|
||||
parcel.readInt()
|
||||
) {
|
||||
}
|
||||
|
||||
override fun writeToParcel(parcel: Parcel, flags: Int) {
|
||||
parcel.writeInt(postCount)
|
||||
parcel.writeInt(postScore)
|
||||
parcel.writeInt(commentCount)
|
||||
parcel.writeInt(commentScore)
|
||||
}
|
||||
|
||||
override fun describeContents(): Int {
|
||||
return 0
|
||||
}
|
||||
|
||||
companion object CREATOR : Parcelable.Creator<UserStats> {
|
||||
override fun createFromParcel(parcel: Parcel): UserStats {
|
||||
return UserStats(parcel)
|
||||
}
|
||||
|
||||
override fun newArray(size: Int): Array<UserStats?> {
|
||||
return arrayOfNulls(size)
|
||||
}
|
||||
}
|
||||
}
|
10
app/src/main/res/drawable/ic_bolt_24.xml
Normal file
10
app/src/main/res/drawable/ic_bolt_24.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<vector android:height="24dp"
|
||||
android:tint="#000000"
|
||||
android:viewportHeight="24"
|
||||
android:viewportWidth="24"
|
||||
android:width="24dp"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M11,21h-1l1,-7H7.5c-0.58,0 -0.57,-0.32 -0.38,-0.66 0.19,-0.34 0.05,-0.08 0.07,-0.12C8.48,10.94 10.42,7.54 13,3h1l-1,7h3.5c0.49,0 0.56,0.33 0.47,0.51l-0.07,0.15C12.96,17.55 11,21 11,21z" />
|
||||
</vector>
|
10
app/src/main/res/drawable/ic_cake_24.xml
Normal file
10
app/src/main/res/drawable/ic_cake_24.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<vector android:height="24dp"
|
||||
android:tint="#000000"
|
||||
android:viewportHeight="24"
|
||||
android:viewportWidth="24"
|
||||
android:width="24dp"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M12,6c1.11,0 2,-0.9 2,-2 0,-0.38 -0.1,-0.73 -0.29,-1.03L12,0l-1.71,2.97c-0.19,0.3 -0.29,0.65 -0.29,1.03 0,1.1 0.9,2 2,2zM16.6,15.99l-1.07,-1.07 -1.08,1.07c-1.3,1.3 -3.58,1.31 -4.89,0l-1.07,-1.07 -1.09,1.07C6.75,16.64 5.88,17 4.96,17c-0.73,0 -1.4,-0.23 -1.96,-0.61L3,21c0,0.55 0.45,1 1,1h16c0.55,0 1,-0.45 1,-1v-4.61c-0.56,0.38 -1.23,0.61 -1.96,0.61 -0.92,0 -1.79,-0.36 -2.44,-1.01zM18,9h-5L13,7h-2v2L6,9c-1.66,0 -3,1.34 -3,3v1.54c0,1.08 0.88,1.96 1.96,1.96 0.52,0 1.02,-0.2 1.38,-0.57l2.14,-2.13 2.13,2.13c0.74,0.74 2.03,0.74 2.77,0l2.14,-2.13 2.13,2.13c0.37,0.37 0.86,0.57 1.38,0.57 1.08,0 1.96,-0.88 1.96,-1.96L20.99,12C21,10.34 19.66,9 18,9z" />
|
||||
</vector>
|
11
app/src/main/res/drawable/ic_comment_black_24.xml
Normal file
11
app/src/main/res/drawable/ic_comment_black_24.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<vector android:autoMirrored="true"
|
||||
android:height="24dp"
|
||||
android:tint="#000000"
|
||||
android:viewportHeight="24"
|
||||
android:viewportWidth="24"
|
||||
android:width="24dp"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M21.99,4c0,-1.1 -0.89,-2 -1.99,-2L4,2c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h14l4,4 -0.01,-18zM18,14L6,14v-2h12v2zM18,11L6,11L6,9h12v2zM18,8L6,8L6,6h12v2z" />
|
||||
</vector>
|
10
app/src/main/res/drawable/ic_person_24.xml
Normal file
10
app/src/main/res/drawable/ic_person_24.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<vector android:height="24dp"
|
||||
android:tint="#000000"
|
||||
android:viewportHeight="24"
|
||||
android:viewportWidth="24"
|
||||
android:width="24dp"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M12,12c2.21,0 4,-1.79 4,-4s-1.79,-4 -4,-4 -4,1.79 -4,4 1.79,4 4,4zM12,14c-2.67,0 -8,1.34 -8,4v2h16v-2c0,-2.66 -5.33,-4 -8,-4z" />
|
||||
</vector>
|
22
app/src/main/res/drawable/ic_post_add_24.xml
Normal file
22
app/src/main/res/drawable/ic_post_add_24.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<vector android:height="24dp"
|
||||
android:tint="#000000"
|
||||
android:viewportHeight="24"
|
||||
android:viewportWidth="24"
|
||||
android:width="24dp"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M17,19.22H5V7h7V5H5C3.9,5 3,5.9 3,7v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2v-7h-2V19.22z" />
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M19,2h-2v3h-3c0.01,0.01 0,2 0,2h3v2.99c0.01,0.01 2,0 2,0V7h3V5h-3V2z" />
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M7,9h8v2h-8z" />
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M7,12l0,2l8,0l0,-2l-3,0z" />
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M7,15h8v2h-8z" />
|
||||
</vector>
|
@ -79,59 +79,96 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="16dp">
|
||||
android:layout_marginBottom="16dp"
|
||||
android:visibility="gone"
|
||||
android:id="@+id/community_statistics_block_view_subreddit_detail_activity">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/subscriber_count_image_view_view_subreddit_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/ic_person_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/subscriber_count_text_view_view_subreddit_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="?attr/font_default"
|
||||
android:fontFamily="?attr/font_family"
|
||||
app:layout_constraintBottom_toTopOf="@id/online_subscriber_count_text_view_view_subreddit_detail_activity"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/barrier"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/online_subscriber_count_text_view_view_subreddit_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="?attr/font_default"
|
||||
android:fontFamily="?attr/font_family"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/barrier"
|
||||
app:layout_constraintTop_toBottomOf="@id/subscriber_count_text_view_view_subreddit_detail_activity"
|
||||
app:layout_constraintHorizontal_bias="0" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/since_text_view_view_subreddit_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/since"
|
||||
android:fontFamily="?attr/font_family"
|
||||
app:layout_constraintBottom_toTopOf="@id/creation_time_text_view_view_subreddit_detail_activity"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/subscribers_number_detail"
|
||||
app:layout_constraintStart_toEndOf="@+id/subscriber_count_image_view_view_subreddit_detail_activity"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/creation_time_text_view_view_subreddit_detail_activity"
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline7"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="end"
|
||||
android:textSize="?attr/font_default"
|
||||
android:fontFamily="?attr/font_family"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/since_text_view_view_subreddit_detail_activity" />
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.5" />
|
||||
|
||||
<androidx.constraintlayout.widget.Barrier
|
||||
android:id="@+id/barrier"
|
||||
<ImageView
|
||||
android:id="@+id/active_user_count_image_view_view_subreddit_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:barrierDirection="start"
|
||||
app:constraint_referenced_ids="creation_time_text_view_view_subreddit_detail_activity, since_text_view_view_subreddit_detail_activity" />
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layout_constraintStart_toStartOf="@+id/guideline7"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/ic_bolt_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/active_user_count_text_view_view_subreddit_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/active_users_number_detail"
|
||||
app:layout_constraintStart_toEndOf="@+id/active_user_count_image_view_view_subreddit_detail_activity"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/post_count_image_view_view_subreddit_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="16dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/subscriber_count_image_view_view_subreddit_detail_activity"
|
||||
app:srcCompat="@drawable/ic_post_add_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/post_count_text_view_view_subreddit_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="18dp"
|
||||
android:text="@string/post_count_detail"
|
||||
app:layout_constraintStart_toEndOf="@+id/post_count_image_view_view_subreddit_detail_activity"
|
||||
app:layout_constraintTop_toBottomOf="@+id/subscriber_count_image_view_view_subreddit_detail_activity" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/comment_count_image_view_view_subreddit_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="16dp"
|
||||
app:layout_constraintStart_toStartOf="@+id/guideline7"
|
||||
app:layout_constraintTop_toBottomOf="@+id/active_user_count_image_view_view_subreddit_detail_activity"
|
||||
app:srcCompat="@drawable/ic_comment_black_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/comment_count_text_view_view_subreddit_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="18dp"
|
||||
android:text="@string/comment_count_detail"
|
||||
app:layout_constraintStart_toEndOf="@+id/comment_count_image_view_view_subreddit_detail_activity"
|
||||
app:layout_constraintTop_toBottomOf="@+id/active_user_count_image_view_view_subreddit_detail_activity" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
@ -51,6 +51,12 @@
|
||||
android:paddingEnd="16dp"
|
||||
android:layout_below="@id/banner_image_view_view_user_detail_activity">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/loading_user_progress_indicator_view_user_detail_activity"
|
||||
style="?android:attr/progressBarStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/user_name_text_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
@ -59,15 +65,14 @@
|
||||
android:layout_marginBottom="4dp"
|
||||
android:textSize="?attr/font_18"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:layout_gravity="center_horizontal"/>
|
||||
android:layout_gravity="center_horizontal" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/user_qualified_name_text_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:text="TextView" />
|
||||
android:layout_marginBottom="16dp" />
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
android:id="@+id/subscribe_user_chip_view_user_detail_activity"
|
||||
@ -78,30 +83,146 @@
|
||||
android:visibility="gone"
|
||||
app:chipStrokeColor="#00000000" />
|
||||
|
||||
<RelativeLayout
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp">
|
||||
android:visibility="gone"
|
||||
android:id="@+id/user_statistics_block_view_user_detail_activity">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/karma_text_view_view_user_detail_activity"
|
||||
android:id="@+id/post_stats_text_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_toStartOf="@id/cakeday_text_view_view_user_detail_activity"
|
||||
android:textSize="?attr/font_default"
|
||||
android:fontFamily="?attr/font_family" />
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/posts"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/posts_count_icon_image_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/post_stats_text_view_view_user_detail_activity"
|
||||
app:srcCompat="@drawable/ic_post_add_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/cakeday_text_view_view_user_detail_activity"
|
||||
android:id="@+id/post_count_text_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="end"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:textSize="?attr/font_default"
|
||||
android:fontFamily="?attr/font_family" />
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="9dp"
|
||||
android:text="0"
|
||||
app:layout_constraintStart_toEndOf="@+id/posts_count_icon_image_view_view_user_detail_activity"
|
||||
app:layout_constraintTop_toBottomOf="@+id/post_stats_text_view_view_user_detail_activity" />
|
||||
|
||||
</RelativeLayout>
|
||||
<ImageView
|
||||
android:id="@+id/upvote_count_posts_icon_image_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layout_constraintStart_toEndOf="@+id/post_count_text_view_view_user_detail_activity"
|
||||
app:layout_constraintTop_toBottomOf="@+id/post_stats_text_view_view_user_detail_activity"
|
||||
app:srcCompat="@drawable/ic_arrow_upward_black_24dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/upvote_count_post_text_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="9dp"
|
||||
android:text="0"
|
||||
app:layout_constraintStart_toEndOf="@+id/upvote_count_posts_icon_image_view_view_user_detail_activity"
|
||||
app:layout_constraintTop_toBottomOf="@+id/post_stats_text_view_view_user_detail_activity" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.5" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/comment_stats_text_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/comments"
|
||||
app:layout_constraintStart_toStartOf="@+id/guideline3"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/comments_count_icon_image_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layout_constraintStart_toStartOf="@+id/guideline3"
|
||||
app:layout_constraintTop_toBottomOf="@+id/comment_stats_text_view_view_user_detail_activity"
|
||||
app:srcCompat="@drawable/ic_comment_black_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/comment_count_text_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="9dp"
|
||||
android:text="0"
|
||||
app:layout_constraintStart_toEndOf="@+id/comments_count_icon_image_view_view_user_detail_activity"
|
||||
app:layout_constraintTop_toBottomOf="@+id/comment_stats_text_view_view_user_detail_activity" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/upvote_count_comments_icon_image_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layout_constraintStart_toEndOf="@+id/comment_count_text_view_view_user_detail_activity"
|
||||
app:layout_constraintTop_toBottomOf="@+id/comment_stats_text_view_view_user_detail_activity"
|
||||
app:srcCompat="@drawable/ic_arrow_upward_black_24dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/upvote_count_comment_text_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="9dp"
|
||||
android:text="0"
|
||||
app:layout_constraintStart_toEndOf="@+id/upvote_count_comments_icon_image_view_view_user_detail_activity"
|
||||
app:layout_constraintTop_toBottomOf="@+id/comment_stats_text_view_view_user_detail_activity" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/account_created_text_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="Account Created"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/posts_count_icon_image_view_view_user_detail_activity" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/account_created_cake_icon_image_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/account_created_text_view_view_user_detail_activity"
|
||||
app:srcCompat="@drawable/ic_cake_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/cake_day_text_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="11dp"
|
||||
app:layout_constraintStart_toEndOf="@+id/account_created_cake_icon_image_view_view_user_detail_activity"
|
||||
app:layout_constraintTop_toBottomOf="@+id/account_created_text_view_view_user_detail_activity" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/description_text_view_view_user_detail_activity"
|
||||
|
@ -76,62 +76,99 @@
|
||||
app:chipStrokeColor="#00000000" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/community_statistics_block_view_subreddit_detail_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="16dp">
|
||||
android:layout_marginBottom="16dp"
|
||||
android:visibility="gone">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/subscriber_count_image_view_view_subreddit_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/ic_person_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/subscriber_count_text_view_view_subreddit_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="?attr/font_default"
|
||||
android:fontFamily="?attr/font_family"
|
||||
app:layout_constraintBottom_toTopOf="@id/online_subscriber_count_text_view_view_subreddit_detail_activity"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/barrier"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/online_subscriber_count_text_view_view_subreddit_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="?attr/font_default"
|
||||
android:fontFamily="?attr/font_family"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/barrier"
|
||||
app:layout_constraintTop_toBottomOf="@id/subscriber_count_text_view_view_subreddit_detail_activity"
|
||||
app:layout_constraintHorizontal_bias="0" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/since_text_view_view_subreddit_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/since"
|
||||
android:fontFamily="?attr/font_family"
|
||||
app:layout_constraintBottom_toTopOf="@id/creation_time_text_view_view_subreddit_detail_activity"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/subscribers_number_detail"
|
||||
app:layout_constraintStart_toEndOf="@+id/subscriber_count_image_view_view_subreddit_detail_activity"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/creation_time_text_view_view_subreddit_detail_activity"
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline7"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="end"
|
||||
android:textSize="?attr/font_default"
|
||||
android:fontFamily="?attr/font_family"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/since_text_view_view_subreddit_detail_activity" />
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.5" />
|
||||
|
||||
<androidx.constraintlayout.widget.Barrier
|
||||
android:id="@+id/barrier"
|
||||
<ImageView
|
||||
android:id="@+id/active_user_count_image_view_view_subreddit_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:barrierDirection="start"
|
||||
app:constraint_referenced_ids="creation_time_text_view_view_subreddit_detail_activity, since_text_view_view_subreddit_detail_activity" />
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layout_constraintStart_toStartOf="@+id/guideline7"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/ic_bolt_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/active_user_count_text_view_view_subreddit_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/active_users_number_detail"
|
||||
app:layout_constraintStart_toEndOf="@+id/active_user_count_image_view_view_subreddit_detail_activity"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/post_count_image_view_view_subreddit_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="16dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/subscriber_count_image_view_view_subreddit_detail_activity"
|
||||
app:srcCompat="@drawable/ic_post_add_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/post_count_text_view_view_subreddit_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="18dp"
|
||||
android:text="@string/post_count_detail"
|
||||
app:layout_constraintStart_toEndOf="@+id/post_count_image_view_view_subreddit_detail_activity"
|
||||
app:layout_constraintTop_toBottomOf="@+id/subscriber_count_image_view_view_subreddit_detail_activity" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/comment_count_image_view_view_subreddit_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="16dp"
|
||||
app:layout_constraintStart_toStartOf="@+id/guideline7"
|
||||
app:layout_constraintTop_toBottomOf="@+id/active_user_count_image_view_view_subreddit_detail_activity"
|
||||
app:srcCompat="@drawable/ic_comment_black_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/comment_count_text_view_view_subreddit_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="18dp"
|
||||
android:text="@string/comment_count_detail"
|
||||
app:layout_constraintStart_toEndOf="@+id/comment_count_image_view_view_subreddit_detail_activity"
|
||||
app:layout_constraintTop_toBottomOf="@+id/active_user_count_image_view_view_subreddit_detail_activity" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
@ -51,6 +51,12 @@
|
||||
android:paddingEnd="16dp"
|
||||
android:layout_below="@id/banner_image_view_view_user_detail_activity">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/loading_user_progress_indicator_view_user_detail_activity"
|
||||
style="?android:attr/progressBarStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/user_name_text_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
@ -59,14 +65,14 @@
|
||||
android:layout_marginBottom="4dp"
|
||||
android:textSize="?attr/font_18"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:layout_gravity="center_horizontal"/>
|
||||
android:layout_gravity="center_horizontal" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/user_qualified_name_text_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:text="TextView" />
|
||||
android:layout_marginBottom="16dp" />
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
android:id="@+id/subscribe_user_chip_view_user_detail_activity"
|
||||
@ -77,30 +83,146 @@
|
||||
android:visibility="gone"
|
||||
app:chipStrokeColor="#00000000" />
|
||||
|
||||
<RelativeLayout
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp">
|
||||
android:visibility="gone"
|
||||
android:id="@+id/user_statistics_block_view_user_detail_activity">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/karma_text_view_view_user_detail_activity"
|
||||
android:id="@+id/post_stats_text_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_toStartOf="@id/cakeday_text_view_view_user_detail_activity"
|
||||
android:textSize="?attr/font_default"
|
||||
android:fontFamily="?attr/font_family" />
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/posts"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/posts_count_icon_image_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/post_stats_text_view_view_user_detail_activity"
|
||||
app:srcCompat="@drawable/ic_post_add_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/cakeday_text_view_view_user_detail_activity"
|
||||
android:id="@+id/post_count_text_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="end"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:textSize="?attr/font_default"
|
||||
android:fontFamily="?attr/font_family" />
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="9dp"
|
||||
android:text="0"
|
||||
app:layout_constraintStart_toEndOf="@+id/posts_count_icon_image_view_view_user_detail_activity"
|
||||
app:layout_constraintTop_toBottomOf="@+id/post_stats_text_view_view_user_detail_activity" />
|
||||
|
||||
</RelativeLayout>
|
||||
<ImageView
|
||||
android:id="@+id/upvote_count_posts_icon_image_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layout_constraintStart_toEndOf="@+id/post_count_text_view_view_user_detail_activity"
|
||||
app:layout_constraintTop_toBottomOf="@+id/post_stats_text_view_view_user_detail_activity"
|
||||
app:srcCompat="@drawable/ic_arrow_upward_black_24dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/upvote_count_post_text_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="9dp"
|
||||
android:text="0"
|
||||
app:layout_constraintStart_toEndOf="@+id/upvote_count_posts_icon_image_view_view_user_detail_activity"
|
||||
app:layout_constraintTop_toBottomOf="@+id/post_stats_text_view_view_user_detail_activity" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.5" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/comment_stats_text_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/comments"
|
||||
app:layout_constraintStart_toStartOf="@+id/guideline3"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/comments_count_icon_image_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layout_constraintStart_toStartOf="@+id/guideline3"
|
||||
app:layout_constraintTop_toBottomOf="@+id/comment_stats_text_view_view_user_detail_activity"
|
||||
app:srcCompat="@drawable/ic_comment_black_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/comment_count_text_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="9dp"
|
||||
android:text="0"
|
||||
app:layout_constraintStart_toEndOf="@+id/comments_count_icon_image_view_view_user_detail_activity"
|
||||
app:layout_constraintTop_toBottomOf="@+id/comment_stats_text_view_view_user_detail_activity" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/upvote_count_comments_icon_image_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layout_constraintStart_toEndOf="@+id/comment_count_text_view_view_user_detail_activity"
|
||||
app:layout_constraintTop_toBottomOf="@+id/comment_stats_text_view_view_user_detail_activity"
|
||||
app:srcCompat="@drawable/ic_arrow_upward_black_24dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/upvote_count_comment_text_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="9dp"
|
||||
android:text="0"
|
||||
app:layout_constraintStart_toEndOf="@+id/upvote_count_comments_icon_image_view_view_user_detail_activity"
|
||||
app:layout_constraintTop_toBottomOf="@+id/comment_stats_text_view_view_user_detail_activity" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/account_created_text_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="Account Created"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/posts_count_icon_image_view_view_user_detail_activity" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/account_created_cake_icon_image_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/account_created_text_view_view_user_detail_activity"
|
||||
app:srcCompat="@drawable/ic_cake_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/cake_day_text_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="11dp"
|
||||
app:layout_constraintStart_toEndOf="@+id/account_created_cake_icon_image_view_view_user_detail_activity"
|
||||
app:layout_constraintTop_toBottomOf="@+id/account_created_text_view_view_user_detail_activity" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/description_text_view_view_user_detail_activity"
|
||||
|
@ -23,77 +23,75 @@
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<LinearLayout
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/username_edit_text_send_private_message_activity"
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#00000000"
|
||||
android:gravity="top"
|
||||
android:hint="@string/send_message_username_hint"
|
||||
android:inputType="textCapSentences|textMultiLine"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingBottom="16dp"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="?attr/content_font_18"
|
||||
android:fontFamily="?attr/content_font_family" />
|
||||
android:orientation="vertical">
|
||||
|
||||
<View
|
||||
android:id="@+id/divider_1_send_private_message_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginBottom="16dp" />
|
||||
<EditText
|
||||
android:id="@+id/username_edit_text_send_private_message_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#00000000"
|
||||
android:fontFamily="?attr/content_font_family"
|
||||
android:gravity="top"
|
||||
android:hint="@string/send_message_username_hint"
|
||||
android:inputType="textCapSentences|textMultiLine"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingBottom="16dp"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="?attr/content_font_18" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/subjet_edit_text_send_private_message_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#00000000"
|
||||
android:gravity="top"
|
||||
android:hint="@string/send_message_subject_hint"
|
||||
android:inputType="textCapSentences|textMultiLine"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingBottom="16dp"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="?attr/content_font_18"
|
||||
android:maxLength="100"
|
||||
android:fontFamily="?attr/content_font_family" />
|
||||
<View
|
||||
android:id="@+id/divider_1_send_private_message_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginBottom="16dp" />
|
||||
|
||||
<View
|
||||
android:id="@+id/divider_2_send_private_message_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginBottom="16dp" />
|
||||
<View
|
||||
android:id="@+id/divider_2_send_private_message_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginBottom="16dp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/content_edit_text_send_private_message_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#00000000"
|
||||
android:gravity="top"
|
||||
android:hint="@string/send_message_content_hint"
|
||||
android:inputType="textCapSentences|textMultiLine"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingBottom="16dp"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="?attr/content_font_18"
|
||||
android:fontFamily="?attr/content_font_family" />
|
||||
<EditText
|
||||
android:id="@+id/content_edit_text_send_private_message_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#00000000"
|
||||
android:fontFamily="?attr/content_font_family"
|
||||
android:gravity="top"
|
||||
android:hint="@string/send_message_content_hint"
|
||||
android:inputType="textCapSentences|textMultiLine"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingBottom="16dp"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="?attr/content_font_18" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/markdown_bottom_bar_recycler_view_send_private_message_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:scrollbars="horizontal"
|
||||
android:layout_gravity="bottom" />
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
@ -78,59 +78,96 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="16dp">
|
||||
android:layout_marginBottom="16dp"
|
||||
android:visibility="gone"
|
||||
android:id="@+id/community_statistics_block_view_subreddit_detail_activity">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/subscriber_count_image_view_view_subreddit_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/ic_person_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/subscriber_count_text_view_view_subreddit_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="?attr/font_default"
|
||||
android:fontFamily="?attr/font_family"
|
||||
app:layout_constraintBottom_toTopOf="@id/online_subscriber_count_text_view_view_subreddit_detail_activity"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/barrier"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/online_subscriber_count_text_view_view_subreddit_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="?attr/font_default"
|
||||
android:fontFamily="?attr/font_family"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/barrier"
|
||||
app:layout_constraintTop_toBottomOf="@id/subscriber_count_text_view_view_subreddit_detail_activity"
|
||||
app:layout_constraintHorizontal_bias="0" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/since_text_view_view_subreddit_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/since"
|
||||
android:fontFamily="?attr/font_family"
|
||||
app:layout_constraintBottom_toTopOf="@id/creation_time_text_view_view_subreddit_detail_activity"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/subscribers_number_detail"
|
||||
app:layout_constraintStart_toEndOf="@+id/subscriber_count_image_view_view_subreddit_detail_activity"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/creation_time_text_view_view_subreddit_detail_activity"
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline7"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="end"
|
||||
android:textSize="?attr/font_default"
|
||||
android:fontFamily="?attr/font_family"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/since_text_view_view_subreddit_detail_activity" />
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.5" />
|
||||
|
||||
<androidx.constraintlayout.widget.Barrier
|
||||
android:id="@+id/barrier"
|
||||
<ImageView
|
||||
android:id="@+id/active_user_count_image_view_view_subreddit_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:barrierDirection="start"
|
||||
app:constraint_referenced_ids="creation_time_text_view_view_subreddit_detail_activity, since_text_view_view_subreddit_detail_activity" />
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layout_constraintStart_toStartOf="@+id/guideline7"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/ic_bolt_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/active_user_count_text_view_view_subreddit_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/active_users_number_detail"
|
||||
app:layout_constraintStart_toEndOf="@+id/active_user_count_image_view_view_subreddit_detail_activity"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/post_count_image_view_view_subreddit_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="16dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/subscriber_count_image_view_view_subreddit_detail_activity"
|
||||
app:srcCompat="@drawable/ic_post_add_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/post_count_text_view_view_subreddit_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="18dp"
|
||||
android:text="@string/post_count_detail"
|
||||
app:layout_constraintStart_toEndOf="@+id/post_count_image_view_view_subreddit_detail_activity"
|
||||
app:layout_constraintTop_toBottomOf="@+id/subscriber_count_image_view_view_subreddit_detail_activity" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/comment_count_image_view_view_subreddit_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="16dp"
|
||||
app:layout_constraintStart_toStartOf="@+id/guideline7"
|
||||
app:layout_constraintTop_toBottomOf="@+id/active_user_count_image_view_view_subreddit_detail_activity"
|
||||
app:srcCompat="@drawable/ic_comment_black_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/comment_count_text_view_view_subreddit_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="18dp"
|
||||
android:text="@string/comment_count_detail"
|
||||
app:layout_constraintStart_toEndOf="@+id/comment_count_image_view_view_subreddit_detail_activity"
|
||||
app:layout_constraintTop_toBottomOf="@+id/active_user_count_image_view_view_subreddit_detail_activity" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
@ -51,6 +51,12 @@
|
||||
android:paddingEnd="16dp"
|
||||
android:layout_below="@id/banner_image_view_view_user_detail_activity">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/loading_user_progress_indicator_view_user_detail_activity"
|
||||
style="?android:attr/progressBarStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/user_name_text_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
@ -66,8 +72,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:text="TextView" />
|
||||
android:layout_marginBottom="16dp" />
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
android:id="@+id/subscribe_user_chip_view_user_detail_activity"
|
||||
@ -78,30 +83,146 @@
|
||||
android:visibility="gone"
|
||||
app:chipStrokeColor="#00000000" />
|
||||
|
||||
<RelativeLayout
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp">
|
||||
android:visibility="gone"
|
||||
android:id="@+id/user_statistics_block_view_user_detail_activity">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/karma_text_view_view_user_detail_activity"
|
||||
android:id="@+id/post_stats_text_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_toStartOf="@id/cakeday_text_view_view_user_detail_activity"
|
||||
android:textSize="?attr/font_default"
|
||||
android:fontFamily="?attr/font_family" />
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/posts"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/posts_count_icon_image_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/post_stats_text_view_view_user_detail_activity"
|
||||
app:srcCompat="@drawable/ic_post_add_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/cakeday_text_view_view_user_detail_activity"
|
||||
android:id="@+id/post_count_text_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="end"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:textSize="?attr/font_default"
|
||||
android:fontFamily="?attr/font_family" />
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="9dp"
|
||||
android:text="0"
|
||||
app:layout_constraintStart_toEndOf="@+id/posts_count_icon_image_view_view_user_detail_activity"
|
||||
app:layout_constraintTop_toBottomOf="@+id/post_stats_text_view_view_user_detail_activity" />
|
||||
|
||||
</RelativeLayout>
|
||||
<ImageView
|
||||
android:id="@+id/upvote_count_posts_icon_image_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layout_constraintStart_toEndOf="@+id/post_count_text_view_view_user_detail_activity"
|
||||
app:layout_constraintTop_toBottomOf="@+id/post_stats_text_view_view_user_detail_activity"
|
||||
app:srcCompat="@drawable/ic_arrow_upward_black_24dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/upvote_count_post_text_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="9dp"
|
||||
android:text="0"
|
||||
app:layout_constraintStart_toEndOf="@+id/upvote_count_posts_icon_image_view_view_user_detail_activity"
|
||||
app:layout_constraintTop_toBottomOf="@+id/post_stats_text_view_view_user_detail_activity" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.5" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/comment_stats_text_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/comments"
|
||||
app:layout_constraintStart_toStartOf="@+id/guideline3"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/comments_count_icon_image_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layout_constraintStart_toStartOf="@+id/guideline3"
|
||||
app:layout_constraintTop_toBottomOf="@+id/comment_stats_text_view_view_user_detail_activity"
|
||||
app:srcCompat="@drawable/ic_comment_black_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/comment_count_text_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="9dp"
|
||||
android:text="0"
|
||||
app:layout_constraintStart_toEndOf="@+id/comments_count_icon_image_view_view_user_detail_activity"
|
||||
app:layout_constraintTop_toBottomOf="@+id/comment_stats_text_view_view_user_detail_activity" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/upvote_count_comments_icon_image_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layout_constraintStart_toEndOf="@+id/comment_count_text_view_view_user_detail_activity"
|
||||
app:layout_constraintTop_toBottomOf="@+id/comment_stats_text_view_view_user_detail_activity"
|
||||
app:srcCompat="@drawable/ic_arrow_upward_black_24dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/upvote_count_comment_text_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="9dp"
|
||||
android:text="0"
|
||||
app:layout_constraintStart_toEndOf="@+id/upvote_count_comments_icon_image_view_view_user_detail_activity"
|
||||
app:layout_constraintTop_toBottomOf="@+id/comment_stats_text_view_view_user_detail_activity" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/account_created_text_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="Account Created"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/posts_count_icon_image_view_view_user_detail_activity" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/account_created_cake_icon_image_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/account_created_text_view_view_user_detail_activity"
|
||||
app:srcCompat="@drawable/ic_cake_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/cake_day_text_view_view_user_detail_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="11dp"
|
||||
app:layout_constraintStart_toEndOf="@+id/account_created_cake_icon_image_view_view_user_detail_activity"
|
||||
app:layout_constraintTop_toBottomOf="@+id/account_created_text_view_view_user_detail_activity" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/description_text_view_view_user_detail_activity"
|
||||
|
15
app/src/main/res/layout/dialog_report.xml
Normal file
15
app/src/main/res/layout/dialog_report.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/reasonEditText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="Reason"
|
||||
android:inputType="textMultiLine" />
|
||||
|
||||
</LinearLayout>
|
@ -8,19 +8,188 @@
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/swipe_refresh_layout_sidebar_fragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/markdown_recycler_view_sidebar_fragment"
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="144dp"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:clipToPadding="false" />
|
||||
android:fillViewport="true">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/moderators_card_sidebar_fragment"
|
||||
style="?attr/materialCardViewElevatedStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
app:cardCornerRadius="16dp"
|
||||
app:cardElevation="2dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/moderators_text_view_sidebar_fragment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/moderators"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view_moderators_side_fragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clipToPadding="false" />
|
||||
</LinearLayout>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
style="?attr/materialCardViewElevatedStyle"
|
||||
android:id="@+id/description_card_sidebar_fragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
app:cardCornerRadius="16dp"
|
||||
app:cardElevation="2dp">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/markdown_recycler_view_sidebar_fragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:clipToPadding="false"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:paddingBottom="144dp" />
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
style="?attr/materialCardViewElevatedStyle"
|
||||
android:id="@+id/statistics_card_sidebar_fragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
app:cardCornerRadius="16dp"
|
||||
app:cardElevation="2dp">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/community_statistics_block_sidebar_fragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:visibility="gone">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/subscriber_count_image_view_sidebar_fragment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/ic_person_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/subscriber_count_text_view_sidebar_fragment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/subscribers_number_detail"
|
||||
app:layout_constraintStart_toEndOf="@+id/subscriber_count_image_view_sidebar_fragment"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline7"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.5" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/active_user_count_image_view_sidebar_fragment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layout_constraintStart_toStartOf="@+id/guideline7"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/ic_bolt_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/active_user_count_text_view_sidebar_fragment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/active_users_number_detail"
|
||||
app:layout_constraintStart_toEndOf="@+id/active_user_count_image_view_sidebar_fragment"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/post_count_image_view_sidebar_fragment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="16dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/subscriber_count_image_view_sidebar_fragment"
|
||||
app:srcCompat="@drawable/ic_post_add_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/post_count_text_view_sidebar_fragment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="18dp"
|
||||
android:text="@string/post_count_detail"
|
||||
app:layout_constraintStart_toEndOf="@+id/post_count_image_view_sidebar_fragment"
|
||||
app:layout_constraintTop_toBottomOf="@+id/subscriber_count_image_view_sidebar_fragment" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/comment_count_image_view_sidebar_fragment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="16dp"
|
||||
app:layout_constraintStart_toStartOf="@+id/guideline7"
|
||||
app:layout_constraintTop_toBottomOf="@+id/active_user_count_image_view_sidebar_fragment"
|
||||
app:srcCompat="@drawable/ic_comment_black_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/comment_count_text_view_sidebar_fragment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="18dp"
|
||||
android:text="@string/comment_count_detail"
|
||||
app:layout_constraintStart_toEndOf="@+id/comment_count_image_view_sidebar_fragment"
|
||||
app:layout_constraintTop_toBottomOf="@+id/active_user_count_image_view_sidebar_fragment" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<View
|
||||
android:id="@+id/placeholder_view_sidebar_fragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="150dp" />
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
|
@ -201,6 +201,9 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:maxWidth="170dp"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_card_2_gallery_type"
|
||||
@ -211,6 +214,8 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constraintStart_toEndOf="@+id/subreddit_name_text_view_item_post_card_2_gallery_type"
|
||||
@ -221,6 +226,9 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:maxWidth="170dp"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
@ -232,6 +240,8 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
@ -161,6 +161,9 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:maxWidth="170dp"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_card_2_text"
|
||||
@ -171,6 +174,8 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constraintStart_toEndOf="@+id/subreddit_name_text_view_item_post_card_2_text"
|
||||
@ -181,6 +186,9 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:maxWidth="170dp"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
@ -191,6 +199,8 @@
|
||||
android:id="@+id/user_instance_text_view_item_post_card_2_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:textSize="?attr/font_default"
|
||||
|
@ -201,6 +201,9 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:maxWidth="170dp"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_card_2_video_autoplay"
|
||||
@ -211,6 +214,8 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constraintStart_toEndOf="@+id/subreddit_name_text_view_item_post_card_2_video_autoplay"
|
||||
@ -221,6 +226,9 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:maxWidth="170dp"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
@ -232,6 +240,8 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
@ -202,6 +202,9 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:maxWidth="170dp"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_card_2_video_autoplay"
|
||||
@ -212,6 +215,8 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constraintStart_toEndOf="@+id/subreddit_name_text_view_item_post_card_2_video_autoplay"
|
||||
@ -221,6 +226,9 @@
|
||||
android:id="@+id/user_text_view_item_post_card_2_video_autoplay"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxWidth="170dp"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:textSize="?attr/font_default"
|
||||
@ -233,6 +241,8 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
@ -212,6 +212,9 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:maxWidth="170dp"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_card_2_with_preview"
|
||||
@ -222,6 +225,8 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constraintStart_toEndOf="@+id/subreddit_name_text_view_item_post_card_2_with_preview"
|
||||
@ -232,6 +237,9 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:maxWidth="170dp"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
@ -243,6 +251,8 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
@ -29,6 +29,9 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="16dp"
|
||||
android:maxWidth="170dp"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constrainedWidth="true"
|
||||
@ -42,6 +45,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constrainedWidth="true"
|
||||
|
@ -29,6 +29,9 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="16dp"
|
||||
android:maxWidth="170dp"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constrainedWidth="true"
|
||||
@ -41,6 +44,8 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:textSize="?attr/font_default"
|
||||
|
@ -26,6 +26,9 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:maxWidth="170dp"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constrainedWidth="true"
|
||||
@ -36,6 +39,8 @@
|
||||
android:id="@+id/community_instance_text_view_item_post_detail_gallery"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constrainedWidth="true"
|
||||
@ -47,6 +52,9 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:maxWidth="170dp"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constrainedWidth="true"
|
||||
@ -58,6 +66,8 @@
|
||||
android:id="@+id/user_instance_text_view_item_post_detail_gallery"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constrainedWidth="true"
|
||||
|
@ -26,6 +26,9 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:maxWidth="170dp"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constrainedWidth="true"
|
||||
@ -36,6 +39,8 @@
|
||||
android:id="@+id/community_instance_text_view_item_post_detail_image_and_gif_autoplay"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constrainedWidth="true"
|
||||
@ -46,6 +51,9 @@
|
||||
android:id="@+id/user_text_view_item_post_detail_image_and_gif_autoplay"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxWidth="170dp"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:layout_marginStart="16dp"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:textSize="?attr/font_default"
|
||||
@ -58,6 +66,8 @@
|
||||
android:id="@+id/user_instance_text_view_item_post_detail_image_and_gif_autoplay"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constrainedWidth="true"
|
||||
|
@ -26,6 +26,9 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:maxWidth="170dp"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constrainedWidth="true"
|
||||
@ -36,6 +39,8 @@
|
||||
android:id="@+id/community_instance_text_view_item_post_detail_link"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constrainedWidth="true"
|
||||
@ -47,6 +52,9 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:maxWidth="170dp"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:textSize="?attr/font_default"
|
||||
app:layout_constrainedWidth="true"
|
||||
@ -60,6 +68,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:textSize="?attr/font_default"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
app:layout_constrainedWidth="true"
|
||||
app:layout_constraintBottom_toTopOf="@+id/author_flair_text_view_item_post_detail_link"
|
||||
app:layout_constraintStart_toEndOf="@+id/user_text_view_item_post_detail_link"
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user