Allow to change toots per page
This commit is contained in:
parent
12bf13f746
commit
eb7c1f21af
|
@ -2391,6 +2391,8 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
|
||||
public void updateHomeCounter(){
|
||||
int i = 0;
|
||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||
int tootperpage = sharedpreferences.getInt(Helper.SET_TOOT_PER_PAGE, Helper.TOOTS_PER_PAGE);
|
||||
if( timelines != null && timelines.size() > 0){
|
||||
for(ManageTimelines tl: timelines){
|
||||
if( tl.getType() == ManageTimelines.Type.HOME){
|
||||
|
@ -2398,7 +2400,7 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
View tabHome = tabLayout.getTabAt(i).getCustomView();
|
||||
if( tabHome != null){
|
||||
TextView tabCounterHome = tabHome.findViewById(R.id.tab_counter);
|
||||
if(countNewStatus == Helper.TOOTS_PER_PAGE){
|
||||
if(countNewStatus == tootperpage){
|
||||
tabCounterHome.setText(String.format(Locale.getDefault(), "%d+", countNewStatus));
|
||||
}else{
|
||||
tabCounterHome.setText(String.valueOf(countNewStatus));
|
||||
|
|
|
@ -112,7 +112,7 @@ public class GroupActivity extends BaseActivity implements OnRetrieveFeedsInterf
|
|||
|
||||
final RecyclerView lv_status = findViewById(R.id.lv_status);
|
||||
//lv_status.addItemDecoration(new DividerItemDecoration(GroupActivity.this, DividerItemDecoration.VERTICAL));
|
||||
tootsPerPage = Helper.TOOTS_PER_PAGE;
|
||||
tootsPerPage = sharedpreferences.getInt(Helper.SET_TOOT_PER_PAGE, Helper.TOOTS_PER_PAGE);
|
||||
mainLoader = findViewById(R.id.loader);
|
||||
nextElementLoader = findViewById(R.id.loading_next_status);
|
||||
textviewNoAction = findViewById(R.id.no_action);
|
||||
|
|
|
@ -110,7 +110,7 @@ public class HashTagActivity extends BaseActivity implements OnRetrieveFeedsInte
|
|||
|
||||
|
||||
final RecyclerView lv_status = findViewById(R.id.lv_status);
|
||||
tootsPerPage = Helper.TOOTS_PER_PAGE;
|
||||
tootsPerPage = sharedpreferences.getInt(Helper.SET_TOOT_PER_PAGE, Helper.TOOTS_PER_PAGE);
|
||||
mainLoader = findViewById(R.id.loader);
|
||||
nextElementLoader = findViewById(R.id.loading_next_status);
|
||||
textviewNoAction = findViewById(R.id.no_action);
|
||||
|
|
|
@ -190,7 +190,7 @@ public class API {
|
|||
return;
|
||||
}
|
||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
tootPerPage = Helper.TOOTS_PER_PAGE;
|
||||
tootPerPage = sharedpreferences.getInt(Helper.SET_TOOT_PER_PAGE, Helper.TOOTS_PER_PAGE);
|
||||
accountPerPage = Helper.ACCOUNTS_PER_PAGE;
|
||||
notificationPerPage = Helper.NOTIFICATIONS_PER_PAGE;
|
||||
this.prefKeyOauthTokenT = sharedpreferences.getString(Helper.PREF_KEY_OAUTH_TOKEN, null);
|
||||
|
@ -768,7 +768,7 @@ public class API {
|
|||
return;
|
||||
}
|
||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
tootPerPage = Helper.TOOTS_PER_PAGE;
|
||||
tootPerPage = sharedpreferences.getInt(Helper.SET_TOOT_PER_PAGE, Helper.TOOTS_PER_PAGE);
|
||||
accountPerPage = Helper.ACCOUNTS_PER_PAGE;
|
||||
notificationPerPage = Helper.NOTIFICATIONS_PER_PAGE;
|
||||
if( instance != null)
|
||||
|
|
|
@ -87,7 +87,7 @@ public class GNUAPI {
|
|||
public GNUAPI(Context context) {
|
||||
this.context = context;
|
||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
tootPerPage = Helper.TOOTS_PER_PAGE;
|
||||
tootPerPage =sharedpreferences.getInt(Helper.SET_TOOT_PER_PAGE, Helper.TOOTS_PER_PAGE);
|
||||
accountPerPage = Helper.ACCOUNTS_PER_PAGE;
|
||||
notificationPerPage = Helper.NOTIFICATIONS_PER_PAGE;
|
||||
this.prefKeyOauthTokenT = sharedpreferences.getString(PREF_KEY_OAUTH_TOKEN, null);
|
||||
|
@ -117,7 +117,7 @@ public class GNUAPI {
|
|||
return;
|
||||
}
|
||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
tootPerPage = Helper.TOOTS_PER_PAGE;
|
||||
tootPerPage = sharedpreferences.getInt(Helper.SET_TOOT_PER_PAGE, Helper.TOOTS_PER_PAGE);
|
||||
accountPerPage = Helper.ACCOUNTS_PER_PAGE;
|
||||
notificationPerPage = Helper.NOTIFICATIONS_PER_PAGE;
|
||||
if( instance != null)
|
||||
|
|
|
@ -1289,6 +1289,30 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
});
|
||||
|
||||
|
||||
SeekBar toot_per_page = rootView.findViewById(R.id.set_toot_per_page);
|
||||
final TextView set_toot_per_page_count = rootView.findViewById(R.id.set_toot_per_page_count);;
|
||||
toot_per_page.setMax(20);
|
||||
int tootperpage = sharedpreferences.getInt(Helper.SET_TOOT_PER_PAGE, Helper.TOOTS_PER_PAGE);
|
||||
toot_per_page.setProgress(tootperpage-Helper.TOOTS_PER_PAGE);
|
||||
set_toot_per_page_count.setText(String.valueOf(tootperpage));
|
||||
|
||||
toot_per_page.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {}
|
||||
@Override
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {}
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
|
||||
int value = progress + 20;
|
||||
set_toot_per_page_count.setText(String.valueOf(value));
|
||||
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putInt(Helper.SET_TOOT_PER_PAGE, value);
|
||||
editor.apply();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// NSFW Timeout
|
||||
SeekBar nsfwTimeoutSeekBar = rootView.findViewById(R.id.set_nsfw_timeout);
|
||||
|
|
|
@ -501,7 +501,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
if( max_id == null)
|
||||
max_id = "0";
|
||||
//max_id needs to work like an offset
|
||||
int tootPerPage = Helper.TOOTS_PER_PAGE;
|
||||
int tootPerPage = sharedpreferences.getInt(Helper.SET_TOOT_PER_PAGE, Helper.TOOTS_PER_PAGE);
|
||||
max_id = String.valueOf(Integer.valueOf(max_id) + tootPerPage);
|
||||
if( apiResponse.getPeertubes() == null){
|
||||
return;
|
||||
|
@ -1007,7 +1007,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
try {
|
||||
((MainActivity) context).updateHomeCounter();
|
||||
}catch (Exception ignored){}
|
||||
int tootPerPage = Helper.TOOTS_PER_PAGE;
|
||||
int tootPerPage = sharedpreferences.getInt(Helper.SET_TOOT_PER_PAGE, Helper.TOOTS_PER_PAGE);
|
||||
//Display the fetch more toot button
|
||||
if( tmpStatuses.size() >= tootPerPage) {
|
||||
if (initialBookMarkDate != null && tmpStatuses.size() > 0 && tmpStatuses.get(tmpStatuses.size() - 1).getCreated_at().after(initialBookMarkDate)) {
|
||||
|
|
|
@ -323,6 +323,7 @@ public class Helper {
|
|||
public static final int ACCOUNTS_PER_PAGE = 20;
|
||||
public static final int NOTIFICATIONS_PER_PAGE = 15;
|
||||
public static final String SET_ATTACHMENT_ACTION = "set_attachment_action";
|
||||
public static final String SET_TOOT_PER_PAGE = "set_toot_per_page";
|
||||
public static final String SET_THEME = "set_theme";
|
||||
public static final String SET_TIME_FROM = "set_time_from";
|
||||
public static final String SET_TIME_TO = "set_time_to";
|
||||
|
|
|
@ -122,6 +122,37 @@
|
|||
android:layout_height="wrap_content" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:text="@string/set_toots_page"
|
||||
android:layout_marginTop="10dp"
|
||||
android:textSize="16sp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical" />
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:id="@+id/set_toot_per_page_count"
|
||||
android:gravity="end"
|
||||
android:textSize="16sp"
|
||||
android:layout_width="30dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_height="wrap_content"
|
||||
tools:ignore="RtlHardcoded" />
|
||||
<SeekBar
|
||||
android:layout_gravity="center_vertical"
|
||||
android:id="@+id/set_toot_per_page"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
</SeekBar>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
Loading…
Reference in New Issue