Browse Source

Allow turning of browsing messages

Refs #138
main
M66B 6 years ago
parent
commit
b123f54fd2
5 changed files with 26 additions and 2 deletions
  1. +3
    -1
      app/src/main/java/eu/faircode/email/FragmentMessages.java
  2. +10
    -0
      app/src/main/java/eu/faircode/email/FragmentOptions.java
  3. +1
    -0
      app/src/main/java/eu/faircode/email/FragmentSetup.java
  4. +11
    -1
      app/src/main/res/layout/fragment_options.xml
  5. +1
    -0
      app/src/main/res/values/strings.xml

+ 3
- 1
app/src/main/java/eu/faircode/email/FragmentMessages.java View File

@ -654,6 +654,7 @@ public class FragmentMessages extends FragmentEx {
if (TextUtils.isEmpty(search)) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
String sort = prefs.getString("sort", "time");
boolean browse = prefs.getBoolean("browse", true);
boolean debug = prefs.getBoolean("debug", false);
if (messages != null)
@ -693,7 +694,8 @@ public class FragmentMessages extends FragmentEx {
.build();
LivePagedListBuilder<Integer, TupleMessageEx> builder = new LivePagedListBuilder<>(
db.message().pagedFolder(folder, sort, false, debug), config);
builder.setBoundaryCallback(searchCallback);
if (browse)
builder.setBoundaryCallback(searchCallback);
messages = builder.build();
break;


+ 10
- 0
app/src/main/java/eu/faircode/email/FragmentOptions.java View File

@ -34,6 +34,7 @@ import androidx.annotation.Nullable;
public class FragmentOptions extends FragmentEx {
private CheckBox cbAvatars;
private CheckBox cbLight;
private CheckBox cbBrowse;
private CheckBox cbDebug;
@Override
@ -46,6 +47,7 @@ public class FragmentOptions extends FragmentEx {
// Get controls
cbAvatars = view.findViewById(R.id.cbAvatars);
cbLight = view.findViewById(R.id.cbLight);
cbBrowse = view.findViewById(R.id.cbBrowse);
cbDebug = view.findViewById(R.id.cbDebug);
// Wire controls
@ -68,6 +70,14 @@ public class FragmentOptions extends FragmentEx {
}
});
cbBrowse.setChecked(prefs.getBoolean("browse", true));
cbBrowse.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("browse", checked).apply();
}
});
cbDebug.setChecked(prefs.getBoolean("debug", false));
cbDebug.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override


+ 1
- 0
app/src/main/java/eu/faircode/email/FragmentSetup.java View File

@ -103,6 +103,7 @@ public class FragmentSetup extends FragmentEx {
static final List<String> EXPORT_SETTINGS = Arrays.asList(
"avatars",
"light",
"browse",
"sort"
);


+ 11
- 1
app/src/main/res/layout/fragment_options.xml View File

@ -31,6 +31,16 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbAvatars" />
<CheckBox
android:id="@+id/cbBrowse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_browse"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbLight" />
<CheckBox
android:id="@+id/cbDebug"
android:layout_width="wrap_content"
@ -39,6 +49,6 @@
android:layout_marginTop="12dp"
android:text="@string/title_advanced_debug"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbLight" />
app:layout_constraintTop_toBottomOf="@id/cbBrowse" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>

+ 1
- 0
app/src/main/res/values/strings.xml View File

@ -78,6 +78,7 @@
<string name="title_advanced">Advanced options</string>
<string name="title_advanced_avatars">Show contact photos</string>
<string name="title_advanced_light">Use notification light</string>
<string name="title_advanced_browse">Browse message on the server</string>
<string name="title_advanced_debug">Debug mode</string>
<string name="title_select">Select &#8230;</string>


Loading…
Cancel
Save