mirror of https://github.com/M66B/FairEmail.git
True auto scroll
This commit is contained in:
parent
19a179edb8
commit
4128af9f31
|
@ -105,6 +105,17 @@ public class FragmentLogs extends FragmentBase {
|
||||||
adapter = new AdapterLog(this);
|
adapter = new AdapterLog(this);
|
||||||
rvLog.setAdapter(adapter);
|
rvLog.setAdapter(adapter);
|
||||||
|
|
||||||
|
rvLog.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||||
|
@Override
|
||||||
|
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||||
|
try {
|
||||||
|
autoScroll = (llm.findFirstVisibleItemPosition() == 0);
|
||||||
|
} catch (Throwable ex) {
|
||||||
|
Log.e(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Initialize
|
// Initialize
|
||||||
grpReady.setVisibility(View.GONE);
|
grpReady.setVisibility(View.GONE);
|
||||||
pbWait.setVisibility(View.VISIBLE);
|
pbWait.setVisibility(View.VISIBLE);
|
||||||
|
@ -159,7 +170,6 @@ public class FragmentLogs extends FragmentBase {
|
||||||
boolean all = (account == null && folder == null && message == null);
|
boolean all = (account == null && folder == null && message == null);
|
||||||
|
|
||||||
menu.findItem(R.id.menu_enabled).setChecked(main_log);
|
menu.findItem(R.id.menu_enabled).setChecked(main_log);
|
||||||
menu.findItem(R.id.menu_auto_scroll).setChecked(autoScroll);
|
|
||||||
menu.findItem(R.id.menu_show).setVisible(all);
|
menu.findItem(R.id.menu_show).setVisible(all);
|
||||||
menu.findItem(R.id.menu_clear).setVisible(all);
|
menu.findItem(R.id.menu_clear).setVisible(all);
|
||||||
|
|
||||||
|
@ -174,11 +184,6 @@ public class FragmentLogs extends FragmentBase {
|
||||||
item.setChecked(enabled);
|
item.setChecked(enabled);
|
||||||
onMenuEnable(enabled);
|
onMenuEnable(enabled);
|
||||||
return true;
|
return true;
|
||||||
} else if (itemId == R.id.menu_auto_scroll) {
|
|
||||||
boolean enabled = !item.isChecked();
|
|
||||||
item.setChecked(enabled);
|
|
||||||
onMenuAutoScroll(enabled);
|
|
||||||
return true;
|
|
||||||
} else if (itemId == R.id.menu_show) {
|
} else if (itemId == R.id.menu_show) {
|
||||||
onMenuShow();
|
onMenuShow();
|
||||||
} else if (itemId == R.id.menu_clear) {
|
} else if (itemId == R.id.menu_clear) {
|
||||||
|
@ -193,10 +198,6 @@ public class FragmentLogs extends FragmentBase {
|
||||||
prefs.edit().putBoolean("main_log", enabled).apply();
|
prefs.edit().putBoolean("main_log", enabled).apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onMenuAutoScroll(boolean enabled) {
|
|
||||||
autoScroll = enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onMenuShow() {
|
private void onMenuShow() {
|
||||||
final Context context = getContext();
|
final Context context = getContext();
|
||||||
|
|
||||||
|
|
|
@ -7,12 +7,6 @@
|
||||||
android:checked="true"
|
android:checked="true"
|
||||||
android:title="@string/title_enabled"
|
android:title="@string/title_enabled"
|
||||||
app:showAsAction="never" />
|
app:showAsAction="never" />
|
||||||
<item
|
|
||||||
android:id="@+id/menu_auto_scroll"
|
|
||||||
android:checkable="true"
|
|
||||||
android:checked="true"
|
|
||||||
android:title="@string/title_auto_scroll"
|
|
||||||
app:showAsAction="never" />
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_show"
|
android:id="@+id/menu_show"
|
||||||
android:title="@string/title_unhide"
|
android:title="@string/title_unhide"
|
||||||
|
|
|
@ -1973,7 +1973,6 @@
|
||||||
|
|
||||||
<string name="title_unexpected_error">Unexpected error</string>
|
<string name="title_unexpected_error">Unexpected error</string>
|
||||||
<string name="title_log">Log</string>
|
<string name="title_log">Log</string>
|
||||||
<string name="title_auto_scroll">Auto scroll</string>
|
|
||||||
<string name="title_log_clear">Clear</string>
|
<string name="title_log_clear">Clear</string>
|
||||||
<string name="title_rules_search_hint">Search name or condition</string>
|
<string name="title_rules_search_hint">Search name or condition</string>
|
||||||
<string name="title_rules_export">Export rules</string>
|
<string name="title_rules_export">Export rules</string>
|
||||||
|
|
Loading…
Reference in New Issue