mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-07 03:07:26 +01:00
Merge pull request 'Remove reddit related stuff' (#51) from reddit_removal into master
Reviewed-on: https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy/pulls/51
This commit is contained in:
commit
acb651cf92
@ -1400,10 +1400,6 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
||||
goToUser();
|
||||
break;
|
||||
}
|
||||
case FABMoreOptionsBottomSheetFragment.FAB_RANDOM: {
|
||||
randomThing();
|
||||
break;
|
||||
}
|
||||
case FABMoreOptionsBottomSheetFragment.FAB_HIDE_READ_POSTS: {
|
||||
if (sectionsPagerAdapter != null) {
|
||||
sectionsPagerAdapter.hideReadPosts();
|
||||
|
@ -558,10 +558,6 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect
|
||||
goToUser();
|
||||
break;
|
||||
}
|
||||
case FABMoreOptionsBottomSheetFragment.FAB_RANDOM: {
|
||||
random();
|
||||
break;
|
||||
}
|
||||
case FABMoreOptionsBottomSheetFragment.FAB_HIDE_READ_POSTS: {
|
||||
if (sectionsPagerAdapter != null) {
|
||||
sectionsPagerAdapter.hideReadPosts();
|
||||
|
@ -233,7 +233,7 @@ public class SubscribedThingListingActivity extends BaseActivity implements Acti
|
||||
});
|
||||
sectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
|
||||
viewPager.setAdapter(sectionsPagerAdapter);
|
||||
viewPager.setOffscreenPageLimit(3);
|
||||
viewPager.setOffscreenPageLimit(1);
|
||||
if (viewPager.getCurrentItem() != 2) {
|
||||
fab.hide();
|
||||
}
|
||||
@ -358,7 +358,7 @@ public class SubscribedThingListingActivity extends BaseActivity implements Acti
|
||||
}
|
||||
|
||||
if (!(!forceLoad && mInsertMultiredditSuccess)) {
|
||||
loadMultiReddits();
|
||||
//loadMultiReddits();
|
||||
}
|
||||
}
|
||||
|
||||
@ -412,7 +412,7 @@ public class SubscribedThingListingActivity extends BaseActivity implements Acti
|
||||
public void success() {
|
||||
Toast.makeText(SubscribedThingListingActivity.this,
|
||||
R.string.delete_multi_reddit_success, Toast.LENGTH_SHORT).show();
|
||||
loadMultiReddits();
|
||||
//loadMultiReddits();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -439,7 +439,7 @@ public class SubscribedThingListingActivity extends BaseActivity implements Acti
|
||||
|
||||
@Subscribe
|
||||
public void onRefreshMultiRedditsEvent(RefreshMultiRedditsEvent event) {
|
||||
loadMultiReddits();
|
||||
//loadMultiReddits();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -477,6 +477,7 @@ public class SubscribedThingListingActivity extends BaseActivity implements Acti
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
switch (position) {
|
||||
default:
|
||||
case 0: {
|
||||
SubscribedSubredditsListingFragment fragment = new SubscribedSubredditsListingFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
@ -487,28 +488,12 @@ public class SubscribedThingListingActivity extends BaseActivity implements Acti
|
||||
fragment.setArguments(bundle);
|
||||
return fragment;
|
||||
}
|
||||
case 1: {
|
||||
FollowedUsersListingFragment fragment = new FollowedUsersListingFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(FollowedUsersListingFragment.EXTRA_ACCOUNT_NAME, mAccountName == null ? "-" : mAccountName);
|
||||
bundle.putString(FollowedUsersListingFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
|
||||
fragment.setArguments(bundle);
|
||||
return fragment;
|
||||
}
|
||||
default: {
|
||||
MultiRedditListingFragment fragment = new MultiRedditListingFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(MultiRedditListingFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
|
||||
bundle.putString(MultiRedditListingFragment.EXTRA_ACCOUNT_NAME, mAccountName == null ? "-" : mAccountName);
|
||||
fragment.setArguments(bundle);
|
||||
return fragment;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return 3;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -946,10 +946,6 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT
|
||||
goToUser();
|
||||
break;
|
||||
}
|
||||
case FABMoreOptionsBottomSheetFragment.FAB_RANDOM: {
|
||||
random();
|
||||
break;
|
||||
}
|
||||
case FABMoreOptionsBottomSheetFragment.FAB_HIDE_READ_POSTS: {
|
||||
if (mFragment instanceof PostFragment) {
|
||||
((PostFragment) mFragment).hideReadPosts();
|
||||
|
@ -554,12 +554,9 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
creationTimeTextView.setText(subredditData.getCreatedUTC());
|
||||
description = subredditData.getDescription();
|
||||
|
||||
if (hideSubredditDescription || description.equals("")) {
|
||||
descriptionTextView.setVisibility(View.GONE);
|
||||
} else {
|
||||
descriptionTextView.setVisibility(View.VISIBLE);
|
||||
markwon.setMarkdown(descriptionTextView, description);
|
||||
}
|
||||
|
||||
descriptionTextView.setVisibility(View.GONE);
|
||||
|
||||
|
||||
if (subredditData.isNSFW()) {
|
||||
if (nsfwWarningBuilder == null
|
||||
@ -1402,10 +1399,6 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
goToUser();
|
||||
break;
|
||||
}
|
||||
case FABMoreOptionsBottomSheetFragment.FAB_RANDOM: {
|
||||
random();
|
||||
break;
|
||||
}
|
||||
case FABMoreOptionsBottomSheetFragment.FAB_HIDE_READ_POSTS: {
|
||||
if (sectionsPagerAdapter != null) {
|
||||
sectionsPagerAdapter.hideReadPosts();
|
||||
|
@ -1341,10 +1341,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
||||
goToUser();
|
||||
break;
|
||||
}
|
||||
case FABMoreOptionsBottomSheetFragment.FAB_RANDOM: {
|
||||
random();
|
||||
break;
|
||||
}
|
||||
|
||||
case FABMoreOptionsBottomSheetFragment.FAB_HIDE_READ_POSTS: {
|
||||
if (sectionsPagerAdapter != null) {
|
||||
sectionsPagerAdapter.hideReadPosts();
|
||||
|
@ -215,7 +215,7 @@ public class MessageRecyclerViewAdapter extends PagedListAdapter<CommentInteract
|
||||
|
||||
Intent intent = new Intent(mActivity, ViewUserDetailActivity.class);
|
||||
intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, message.getComment().getAuthor());
|
||||
intent.putExtra(ViewUserDetailActivity.EXTRA_QUALIFIED_USER_NAME_KEY, message.getComment().getCommunityQualifiedName());
|
||||
intent.putExtra(ViewUserDetailActivity.EXTRA_QUALIFIED_USER_NAME_KEY, message.getComment().getAuthorQualifiedName());
|
||||
mActivity.startActivity(intent);
|
||||
});
|
||||
}
|
||||
|
@ -24,8 +24,8 @@ public class AccountSectionRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
||||
|
||||
private static final int VIEW_TYPE_MENU_GROUP_TITLE = 1;
|
||||
private static final int VIEW_TYPE_MENU_ITEM = 2;
|
||||
private static final int ACCOUNT_SECTION_ITEMS = 5;
|
||||
private static final int ANONYMOUS_ACCOUNT_SECTION_ITEMS = 3;
|
||||
private static final int ACCOUNT_SECTION_ITEMS = 4;
|
||||
private static final int ANONYMOUS_ACCOUNT_SECTION_ITEMS = 2;
|
||||
|
||||
private BaseActivity baseActivity;
|
||||
private int inboxCount;
|
||||
@ -101,10 +101,6 @@ public class AccountSectionRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
||||
drawableId = R.drawable.ic_subscritptions_bottom_app_bar_24dp;
|
||||
break;
|
||||
case 3:
|
||||
stringId = R.string.multi_reddit;
|
||||
drawableId = R.drawable.ic_multi_reddit_24dp;
|
||||
break;
|
||||
case 4:
|
||||
setOnClickListener = false;
|
||||
if (inboxCount > 0) {
|
||||
((MenuItemViewHolder) holder).menuTextView.setText(baseActivity.getString(R.string.inbox_with_count, inboxCount));
|
||||
@ -118,23 +114,21 @@ public class AccountSectionRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
||||
});
|
||||
break;
|
||||
default:
|
||||
stringId = R.string.history;
|
||||
drawableId = R.drawable.ic_history_24dp;
|
||||
|
||||
stringId = R.string.account_saved_thing_activity_label;
|
||||
drawableId = R.drawable.ic_outline_bookmarks_24dp;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (position) {
|
||||
|
||||
case 1:
|
||||
stringId = R.string.subscriptions;
|
||||
drawableId = R.drawable.ic_subscritptions_bottom_app_bar_24dp;
|
||||
break;
|
||||
case 2:
|
||||
stringId = R.string.multi_reddit;
|
||||
drawableId = R.drawable.ic_multi_reddit_24dp;
|
||||
break;
|
||||
default:
|
||||
stringId = R.string.history;
|
||||
drawableId = R.drawable.ic_history_24dp;
|
||||
stringId = R.string.anonymous_account_instance;
|
||||
drawableId = R.drawable.ic_account_circle_24dp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,8 +17,6 @@ import eu.toldi.infinityforlemmy.subscribedsubreddit.SubscribedSubredditData;
|
||||
public class NavigationDrawerRecyclerViewMergedAdapter {
|
||||
private HeaderSectionRecyclerViewAdapter headerSectionRecyclerViewAdapter;
|
||||
private AccountSectionRecyclerViewAdapter accountSectionRecyclerViewAdapter;
|
||||
private RedditSectionRecyclerViewAdapter redditSectionRecyclerViewAdapter;
|
||||
private PostSectionRecyclerViewAdapter postSectionRecyclerViewAdapter;
|
||||
private PreferenceSectionRecyclerViewAdapter preferenceSectionRecyclerViewAdapter;
|
||||
private FavoriteSubscribedSubredditsSectionRecyclerViewAdapter favoriteSubscribedSubredditsSectionRecyclerViewAdapter;
|
||||
private SubscribedSubredditsRecyclerViewAdapter subscribedSubredditsRecyclerViewAdapter;
|
||||
@ -49,10 +47,6 @@ public class NavigationDrawerRecyclerViewMergedAdapter {
|
||||
});
|
||||
accountSectionRecyclerViewAdapter = new AccountSectionRecyclerViewAdapter(baseActivity, customThemeWrapper,
|
||||
navigationDrawerSharedPreferences, accountName != null, itemClickListener);
|
||||
redditSectionRecyclerViewAdapter = new RedditSectionRecyclerViewAdapter(baseActivity, customThemeWrapper,
|
||||
navigationDrawerSharedPreferences, itemClickListener, accountName != null);
|
||||
postSectionRecyclerViewAdapter = new PostSectionRecyclerViewAdapter(baseActivity, customThemeWrapper,
|
||||
navigationDrawerSharedPreferences, accountName != null, itemClickListener);
|
||||
preferenceSectionRecyclerViewAdapter = new PreferenceSectionRecyclerViewAdapter(baseActivity, customThemeWrapper,
|
||||
accountName, nsfwAndSpoilerSharedPreferences, navigationDrawerSharedPreferences, itemClickListener);
|
||||
favoriteSubscribedSubredditsSectionRecyclerViewAdapter = new FavoriteSubscribedSubredditsSectionRecyclerViewAdapter(
|
||||
@ -65,8 +59,6 @@ public class NavigationDrawerRecyclerViewMergedAdapter {
|
||||
mainPageConcatAdapter = new ConcatAdapter(
|
||||
headerSectionRecyclerViewAdapter,
|
||||
accountSectionRecyclerViewAdapter,
|
||||
redditSectionRecyclerViewAdapter,
|
||||
postSectionRecyclerViewAdapter,
|
||||
preferenceSectionRecyclerViewAdapter,
|
||||
favoriteSubscribedSubredditsSectionRecyclerViewAdapter,
|
||||
subscribedSubredditsRecyclerViewAdapter);
|
||||
@ -78,8 +70,6 @@ public class NavigationDrawerRecyclerViewMergedAdapter {
|
||||
|
||||
private void openAccountSection() {
|
||||
mainPageConcatAdapter.removeAdapter(accountSectionRecyclerViewAdapter);
|
||||
mainPageConcatAdapter.removeAdapter(redditSectionRecyclerViewAdapter);
|
||||
mainPageConcatAdapter.removeAdapter(postSectionRecyclerViewAdapter);
|
||||
mainPageConcatAdapter.removeAdapter(preferenceSectionRecyclerViewAdapter);
|
||||
mainPageConcatAdapter.removeAdapter(favoriteSubscribedSubredditsSectionRecyclerViewAdapter);
|
||||
mainPageConcatAdapter.removeAdapter(subscribedSubredditsRecyclerViewAdapter);
|
||||
@ -91,8 +81,6 @@ public class NavigationDrawerRecyclerViewMergedAdapter {
|
||||
mainPageConcatAdapter.removeAdapter(accountManagementSectionRecyclerViewAdapter);
|
||||
|
||||
mainPageConcatAdapter.addAdapter(accountSectionRecyclerViewAdapter);
|
||||
mainPageConcatAdapter.addAdapter(redditSectionRecyclerViewAdapter);
|
||||
mainPageConcatAdapter.addAdapter(postSectionRecyclerViewAdapter);
|
||||
mainPageConcatAdapter.addAdapter(preferenceSectionRecyclerViewAdapter);
|
||||
mainPageConcatAdapter.addAdapter(favoriteSubscribedSubredditsSectionRecyclerViewAdapter);
|
||||
mainPageConcatAdapter.addAdapter(subscribedSubredditsRecyclerViewAdapter);
|
||||
|
@ -24,7 +24,6 @@ public class FABMoreOptionsBottomSheetFragment extends LandscapeExpandedRoundedB
|
||||
public static final int FAB_OPTION_SEARCH = 4;
|
||||
public static final int FAB_OPTION_GO_TO_SUBREDDIT = 5;
|
||||
public static final int FAB_OPTION_GO_TO_USER = 6;
|
||||
public static final int FAB_RANDOM = 7;
|
||||
public static final int FAB_HIDE_READ_POSTS = 8;
|
||||
public static final int FAB_FILTER_POSTS = 9;
|
||||
public static final int FAB_GO_TO_TOP = 10;
|
||||
@ -86,10 +85,6 @@ public class FABMoreOptionsBottomSheetFragment extends LandscapeExpandedRoundedB
|
||||
dismiss();
|
||||
});
|
||||
|
||||
binding.randomTextViewFabMoreOptionsBottomSheetFragment.setOnClickListener(view -> {
|
||||
activity.fabOptionSelected(FAB_RANDOM);
|
||||
dismiss();
|
||||
});
|
||||
|
||||
binding.filterPostsTextViewFabMoreOptionsBottomSheetFragment.setOnClickListener(view -> {
|
||||
activity.fabOptionSelected(FAB_FILTER_POSTS);
|
||||
|
@ -31,16 +31,12 @@ public class SearchPostSortTypeBottomSheetFragment extends LandscapeExpandedRoun
|
||||
|
||||
public static final String EXTRA_CURRENT_SORT_TYPE = "ECST";
|
||||
|
||||
@BindView(R.id.relevance_type_text_view_search_sort_type_bottom_sheet_fragment)
|
||||
TextView relevanceTypeTextView;
|
||||
@BindView(R.id.hot_type_text_view_search_sort_type_bottom_sheet_fragment)
|
||||
TextView hotTypeTextView;
|
||||
@BindView(R.id.top_type_text_view_search_sort_type_bottom_sheet_fragment)
|
||||
TextView topTypeTextView;
|
||||
@BindView(R.id.new_type_text_view_search_sort_type_bottom_sheet_fragment)
|
||||
TextView newTypeTextView;
|
||||
@BindView(R.id.comments_type_text_view_search_sort_type_bottom_sheet_fragment)
|
||||
TextView commentsTypeTextView;
|
||||
@BindView(R.id.old_type_text_view_search_sort_type_bottom_sheet_fragment)
|
||||
TextView oldTypeTextView;
|
||||
private BaseActivity activity;
|
||||
public SearchPostSortTypeBottomSheetFragment() {
|
||||
// Required empty public constructor
|
||||
@ -61,14 +57,12 @@ public class SearchPostSortTypeBottomSheetFragment extends LandscapeExpandedRoun
|
||||
ButterKnife.bind(this, rootView);
|
||||
|
||||
String currentSortType = getArguments().getString(EXTRA_CURRENT_SORT_TYPE);
|
||||
if (currentSortType.equals(SortType.Type.HOT.fullName)) {
|
||||
hotTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(hotTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
|
||||
} else if (currentSortType.equals(SortType.Type.TOP.fullName)) {
|
||||
if (currentSortType.equals(SortType.Type.TOP.fullName)) {
|
||||
topTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(topTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
|
||||
} else if (currentSortType.equals(SortType.Type.NEW.fullName)) {
|
||||
newTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(newTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
|
||||
} else if (currentSortType.equals(SortType.Type.OLD.fullName)) {
|
||||
commentsTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(commentsTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
|
||||
oldTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(oldTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
|
||||
@ -76,15 +70,6 @@ public class SearchPostSortTypeBottomSheetFragment extends LandscapeExpandedRoun
|
||||
rootView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
}
|
||||
|
||||
/*relevanceTypeTextView.setOnClickListener(view -> {
|
||||
((SortTypeSelectionCallback) activity).sortTypeSelected(SortType.Type.RELEVANCE.name());
|
||||
dismiss();
|
||||
});*/
|
||||
|
||||
hotTypeTextView.setOnClickListener(view -> {
|
||||
((SortTypeSelectionCallback) activity).sortTypeSelected(SortType.Type.HOT.name());
|
||||
dismiss();
|
||||
});
|
||||
|
||||
topTypeTextView.setOnClickListener(view -> {
|
||||
((SortTypeSelectionCallback) activity).sortTypeSelected(SortType.Type.TOP.name());
|
||||
@ -92,12 +77,12 @@ public class SearchPostSortTypeBottomSheetFragment extends LandscapeExpandedRoun
|
||||
});
|
||||
|
||||
newTypeTextView.setOnClickListener(view -> {
|
||||
((SortTypeSelectionCallback) activity).sortTypeSelected(new SortType(SortType.Type.NEW));
|
||||
((SortTypeSelectionCallback) activity).sortTypeSelected(new SortType(SortType.Type.NEW,null));
|
||||
dismiss();
|
||||
});
|
||||
|
||||
commentsTypeTextView.setOnClickListener(view -> {
|
||||
((SortTypeSelectionCallback) activity).sortTypeSelected(SortType.Type.MOST_COMMENTS.name());
|
||||
oldTypeTextView.setOnClickListener(view -> {
|
||||
((SortTypeSelectionCallback) activity).sortTypeSelected(new SortType(SortType.Type.OLD,null));
|
||||
dismiss();
|
||||
});
|
||||
|
||||
|
@ -460,9 +460,9 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
||||
nameOfUsage = PostFilterUsage.NO_USAGE;
|
||||
|
||||
String sort = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_SEARCH_POST, SortType.Type.TOP_ALL.value);
|
||||
String sortTime = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TIME_SEARCH_POST, SortType.Time.ALL.name());
|
||||
String sortTime = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TIME_SEARCH_POST, sort.equalsIgnoreCase(SortType.Type.TOP.value) ? SortType.Time.ALL.name() : null);
|
||||
SortType.Type st = SortType.Type.fromValue(sort);
|
||||
sortType = new SortType(st == null ? SortType.Type.TOP_ALL : st, SortType.Time.valueOf(sortTime));
|
||||
sortType = new SortType(st == null ? SortType.Type.TOP_ALL : st,sortTime != null ? SortType.Time.valueOf(sortTime) : null);
|
||||
postLayout = mPostLayoutSharedPreferences.getInt(SharedPreferencesUtils.POST_LAYOUT_SEARCH_POST, defaultPostLayout);
|
||||
|
||||
mAdapter = new PostRecyclerViewAdapter(activity, this, mExecutor, mRetrofit.getRetrofit(), mGfycatRetrofit,
|
||||
@ -1385,6 +1385,8 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
||||
mSortTypeSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TYPE_SEARCH_POST, sortType.getType().name()).apply();
|
||||
if (sortType.getTime() != null) {
|
||||
mSortTypeSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TIME_SEARCH_POST, sortType.getTime().name()).apply();
|
||||
}else {
|
||||
mSortTypeSharedPreferences.edit().remove(SharedPreferencesUtils.SORT_TIME_SEARCH_POST).apply();
|
||||
}
|
||||
break;
|
||||
case PostPagingSource.TYPE_MULTI_REDDIT:
|
||||
|
@ -8,7 +8,12 @@ import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import eu.toldi.infinityforlemmy.utils.JSONUtils;
|
||||
|
||||
@ -47,7 +52,11 @@ public class ParseSubredditData {
|
||||
}
|
||||
|
||||
boolean removed = community.getBoolean("removed");
|
||||
String published = community.getString("published");
|
||||
String published_raw = community.getString("published");
|
||||
String published = formatISOTime(published_raw);
|
||||
if(published == null){
|
||||
published = published_raw;
|
||||
}
|
||||
String updated = "";
|
||||
if (!community.isNull("updated")) {
|
||||
updated = community.getString("updated");
|
||||
@ -170,4 +179,25 @@ public class ParseSubredditData {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static String formatISOTime(String isoTime) {
|
||||
// Truncate the time to millisecond precision
|
||||
String truncatedTime = isoTime.substring(0, 23);
|
||||
|
||||
SimpleDateFormat isoFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS", Locale.US);
|
||||
isoFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
|
||||
try {
|
||||
Date date = isoFormat.parse(truncatedTime);
|
||||
|
||||
// Set your desired output format here
|
||||
SimpleDateFormat outputFormat = new SimpleDateFormat("MMM dd, yyyy HH:mm:ss", Locale.US);
|
||||
outputFormat.setTimeZone(TimeZone.getDefault()); // Set to device's default timezone
|
||||
|
||||
return outputFormat.format(date);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -144,25 +144,6 @@
|
||||
android:focusable="true"
|
||||
android:background="?attr/selectableItemBackground" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/random_text_view_fab_more_options_bottom_sheet_fragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingBottom="16dp"
|
||||
android:paddingStart="32dp"
|
||||
android:paddingEnd="32dp"
|
||||
android:text="@string/random"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="?attr/font_default"
|
||||
android:fontFamily="?attr/font_family"
|
||||
app:drawableStartCompat="@drawable/ic_random_24dp"
|
||||
android:drawablePadding="48dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:background="?attr/selectableItemBackground" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/hide_read_posts_text_view_fab_more_options_bottom_sheet_fragment"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -11,43 +11,6 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/relevance_type_text_view_search_sort_type_bottom_sheet_fragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:drawableStart="@drawable/ic_best_24"
|
||||
android:drawablePadding="48dp"
|
||||
android:focusable="true"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:paddingStart="32dp"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingEnd="32dp"
|
||||
android:paddingBottom="16dp"
|
||||
android:text="@string/sort_relevance"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="?attr/font_default"
|
||||
app:drawableTint="?attr/primaryTextColor" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/hot_type_text_view_search_sort_type_bottom_sheet_fragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:drawableStart="@drawable/ic_hot_24"
|
||||
android:drawablePadding="48dp"
|
||||
android:focusable="true"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:paddingStart="32dp"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingEnd="32dp"
|
||||
android:paddingBottom="16dp"
|
||||
android:text="@string/sort_hot"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="?attr/font_default"
|
||||
app:drawableTint="?attr/primaryTextColor" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/top_type_text_view_search_sort_type_bottom_sheet_fragment"
|
||||
@ -88,7 +51,7 @@
|
||||
app:drawableTint="?attr/primaryTextColor" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/comments_type_text_view_search_sort_type_bottom_sheet_fragment"
|
||||
android:id="@+id/old_type_text_view_search_sort_type_bottom_sheet_fragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
@ -101,7 +64,7 @@
|
||||
android:paddingTop="16dp"
|
||||
android:paddingEnd="32dp"
|
||||
android:paddingBottom="16dp"
|
||||
android:text="@string/sort_comments"
|
||||
android:text="@string/sort_old"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="?attr/font_default"
|
||||
app:drawableTint="?attr/primaryTextColor" />
|
||||
|
@ -501,47 +501,57 @@
|
||||
<string-array name="settings_subreddit_default_sort_type">
|
||||
<item>Hot</item>
|
||||
<item>New</item>
|
||||
<item>Rising</item>
|
||||
<item>Active</item>
|
||||
<item>Top</item>
|
||||
<item>Controversial</item>
|
||||
<item>Most Comments</item>
|
||||
<item>New Comments</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="settings_subreddit_default_sort_type_values">
|
||||
<item>HOT</item>
|
||||
<item>NEW</item>
|
||||
<item>RISING</item>
|
||||
<item>ACTIVE</item>
|
||||
<item>TOP</item>
|
||||
<item>CONTROVERSIAL</item>
|
||||
<item>MOSTCOMMENTS</item>
|
||||
<item>NEWCOMMENTS</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="settings_user_default_sort_type">
|
||||
<item>New</item>
|
||||
<item>Hot</item>
|
||||
<item>Old</item>
|
||||
<item>Top</item>
|
||||
<item>Controversial</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="settings_user_default_sort_type_values">
|
||||
<item>NEW</item>
|
||||
<item>HOT</item>
|
||||
<item>OLD</item>
|
||||
<item>TOP</item>
|
||||
<item>CONTROVERSIAL</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="settings_default_sort_time">
|
||||
<item>Hour</item>
|
||||
<item>6 Hours</item>
|
||||
<item>12 Hours</item>
|
||||
<item>Day</item>
|
||||
<item>Week</item>
|
||||
<item>Month</item>
|
||||
<item>3 Months</item>
|
||||
<item>6 Months</item>
|
||||
<item>9 Months</item>
|
||||
<item>Year</item>
|
||||
<item>All Time</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="settings_default_sort_time_values">
|
||||
<item>HOUR</item>
|
||||
<item>6HOURS</item>
|
||||
<item>12HOURS</item>
|
||||
<item>DAY</item>
|
||||
<item>WEEK</item>
|
||||
<item>MONTH</item>
|
||||
<item>3MONTHS</item>
|
||||
<item>6MONTHS</item>
|
||||
<item>9MONTHS</item>
|
||||
<item>YEAR</item>
|
||||
<item>ALL</item>
|
||||
</string-array>
|
||||
|
Loading…
Reference in New Issue
Block a user