Added conversation actions

This commit is contained in:
M66B
2020-03-18 21:07:14 +01:00
parent 21c97c1cc7
commit b89f6bd48d
7 changed files with 129 additions and 3 deletions

View File

@@ -27,6 +27,7 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.graphics.Paint;
import android.os.Build;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
@@ -52,6 +53,7 @@ import io.requery.android.database.sqlite.SQLiteDatabase;
public class FragmentOptionsMisc extends FragmentBase implements SharedPreferences.OnSharedPreferenceChangeListener {
private SwitchCompat swExternalSearch;
private SwitchCompat swConversationActions;
private SwitchCompat swFts;
private TextView tvFtsIndexed;
private TextView tvFtsPro;
@@ -77,7 +79,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private Group grpDebug;
private final static String[] RESET_OPTIONS = new String[]{
"fts", "english", "watchdog", "auto_optimize", "updates", "experiments", "crash_reports", "debug"
"conversation_actions", "fts", "english", "watchdog", "auto_optimize", "updates", "experiments", "crash_reports", "debug"
};
private final static String[] RESET_QUESTIONS = new String[]{
@@ -98,6 +100,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
// Get controls
swExternalSearch = view.findViewById(R.id.swExternalSearch);
swConversationActions = view.findViewById(R.id.swConversationActions);
swFts = view.findViewById(R.id.swFts);
tvFtsIndexed = view.findViewById(R.id.tvFtsIndexed);
tvFtsPro = view.findViewById(R.id.tvFtsPro);
@@ -141,6 +144,13 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
}
});
swConversationActions.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("conversation_actions", checked).apply();
}
});
swFts.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@@ -379,6 +389,8 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
int state = pm.getComponentEnabledSetting(new ComponentName(getContext(), ActivitySearch.class));
swExternalSearch.setChecked(state != PackageManager.COMPONENT_ENABLED_STATE_DISABLED);
swConversationActions.setChecked(prefs.getBoolean("conversation_actions", true));
swConversationActions.setVisibility(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q ? View.VISIBLE : View.GONE);
swFts.setChecked(prefs.getBoolean("fts", false));
swEnglish.setChecked(prefs.getBoolean("english", false));
swWatchdog.setChecked(prefs.getBoolean("watchdog", true));