Files
FairEmail/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java

483 lines
20 KiB
Java
Raw Normal View History

2019-05-06 09:10:13 +02:00
package eu.faircode.email;
/*
This file is part of FairEmail.
FairEmail is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
FairEmail is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with FairEmail. If not, see <http://www.gnu.org/licenses/>.
2020-01-05 18:32:53 +01:00
Copyright 2018-2020 by Marcel Bokhorst (M66B)
2019-05-06 09:10:13 +02:00
*/
import android.app.ActivityManager;
import android.app.NotificationManager;
2019-12-31 12:07:45 +01:00
import android.content.ComponentName;
import android.content.Context;
2020-04-05 12:56:44 +02:00
import android.content.DialogInterface;
2020-02-25 15:20:23 +01:00
import android.content.Intent;
2019-05-06 09:10:13 +02:00
import android.content.SharedPreferences;
2019-12-31 12:07:45 +01:00
import android.content.pm.PackageManager;
2019-08-24 13:13:48 +02:00
import android.graphics.Paint;
2019-05-06 09:10:13 +02:00
import android.os.Bundle;
import android.view.LayoutInflater;
2019-05-06 14:41:03 +02:00
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
2019-05-06 09:10:13 +02:00
import android.view.View;
import android.view.ViewGroup;
2019-07-10 09:35:20 +02:00
import android.widget.Button;
2019-05-06 09:10:13 +02:00
import android.widget.CompoundButton;
import android.widget.TextView;
2019-07-10 09:35:20 +02:00
import android.widget.Toast;
2019-05-06 09:10:13 +02:00
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
2020-04-05 12:56:44 +02:00
import androidx.appcompat.app.AlertDialog;
2019-05-06 09:10:13 +02:00
import androidx.appcompat.widget.SwitchCompat;
2019-05-26 12:41:41 +02:00
import androidx.constraintlayout.widget.Group;
2019-09-10 08:53:07 +02:00
import androidx.lifecycle.Lifecycle;
2020-01-15 10:29:16 +01:00
import androidx.lifecycle.Observer;
2020-02-25 15:20:23 +01:00
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
2019-05-06 09:10:13 +02:00
import androidx.preference.PreferenceManager;
2020-04-05 12:56:44 +02:00
import java.nio.charset.Charset;
import java.util.SortedMap;
2020-01-16 09:44:54 +01:00
import io.requery.android.database.sqlite.SQLiteDatabase;
2019-05-06 09:10:13 +02:00
public class FragmentOptionsMisc extends FragmentBase implements SharedPreferences.OnSharedPreferenceChangeListener {
2019-12-31 12:07:45 +01:00
private SwitchCompat swExternalSearch;
2020-03-19 13:11:59 +01:00
private SwitchCompat swShortcuts;
2020-01-14 21:58:27 +01:00
private SwitchCompat swFts;
2020-01-15 10:29:16 +01:00
private TextView tvFtsIndexed;
2020-01-16 18:21:03 +01:00
private TextView tvFtsPro;
2019-05-06 09:10:13 +02:00
private SwitchCompat swEnglish;
2019-05-12 20:15:16 +02:00
private SwitchCompat swWatchdog;
2020-02-22 17:13:14 +01:00
private SwitchCompat swOptimize;
2019-05-06 09:10:13 +02:00
private SwitchCompat swUpdates;
2019-08-24 12:30:33 +02:00
private SwitchCompat swExperiments;
2019-08-24 13:13:48 +02:00
private TextView tvExperimentsHint;
2019-05-10 08:53:45 +02:00
private SwitchCompat swCrashReports;
2019-12-22 07:23:43 +01:00
private TextView tvUuid;
2019-05-06 09:10:13 +02:00
private SwitchCompat swDebug;
2019-10-05 09:37:57 +02:00
private Button btnReset;
private SwitchCompat swCleanupAttachments;
2019-07-10 09:35:20 +02:00
private Button btnCleanup;
2019-12-22 07:23:43 +01:00
private TextView tvLastCleanup;
2020-02-25 15:20:23 +01:00
private Button btnMore;
2019-05-06 09:10:13 +02:00
2019-06-15 21:25:49 +02:00
private TextView tvProcessors;
private TextView tvMemoryClass;
2019-10-19 21:53:19 +02:00
private TextView tvStorageSpace;
2019-12-22 07:23:43 +01:00
private TextView tvFingerprint;
2020-04-05 12:56:44 +02:00
private Button btnCharsets;
2019-05-26 12:41:41 +02:00
private Group grpDebug;
2019-05-06 09:10:13 +02:00
2019-05-06 14:41:03 +02:00
private final static String[] RESET_OPTIONS = new String[]{
"shortcuts", "fts", "english", "watchdog", "auto_optimize", "updates",
"experiments", "crash_reports", "debug", "cleanup_attachments"
2019-05-06 14:41:03 +02:00
};
2019-05-09 07:32:48 +02:00
private final static String[] RESET_QUESTIONS = new String[]{
2020-03-21 09:16:49 +01:00
"welcome", "first", "app_support", "notify_archive", "message_swipe", "message_select", "folder_actions", "folder_sync",
"crash_reports_asked", "review_asked", "review_later", "why",
2020-03-23 13:44:29 +01:00
"reply_hint", "html_always_images", "print_html_confirmed",
"selected_folders", "move_1_confirmed", "move_n_confirmed",
2020-04-10 17:14:28 +02:00
"last_search_senders", "last_search_recipients", "last_search_subject", "last_search_keywords", "last_search_message", "last_search",
2020-01-04 17:29:28 +01:00
"identities_asked", "cc_bcc", "inline_image_hint", "compose_reference", "send_dialog",
2020-04-07 08:28:44 +02:00
"setup_reminder", "setup_advanced"
2019-05-09 07:32:48 +02:00
};
2019-05-06 09:10:13 +02:00
@Override
@Nullable
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
2019-06-12 16:15:46 +02:00
setSubtitle(R.string.title_setup);
2019-05-06 14:41:03 +02:00
setHasOptionsMenu(true);
2019-05-06 09:10:13 +02:00
View view = inflater.inflate(R.layout.fragment_options_misc, container, false);
// Get controls
2019-12-31 12:07:45 +01:00
swExternalSearch = view.findViewById(R.id.swExternalSearch);
2020-03-19 13:11:59 +01:00
swShortcuts = view.findViewById(R.id.swShortcuts);
2020-01-14 21:58:27 +01:00
swFts = view.findViewById(R.id.swFts);
2020-01-15 10:29:16 +01:00
tvFtsIndexed = view.findViewById(R.id.tvFtsIndexed);
2020-01-16 18:21:03 +01:00
tvFtsPro = view.findViewById(R.id.tvFtsPro);
2019-05-06 09:10:13 +02:00
swEnglish = view.findViewById(R.id.swEnglish);
2019-05-12 20:15:16 +02:00
swWatchdog = view.findViewById(R.id.swWatchdog);
2020-02-22 17:13:14 +01:00
swOptimize = view.findViewById(R.id.swOptimize);
2019-05-06 09:10:13 +02:00
swUpdates = view.findViewById(R.id.swUpdates);
2019-08-24 12:30:33 +02:00
swExperiments = view.findViewById(R.id.swExperiments);
2019-08-24 13:13:48 +02:00
tvExperimentsHint = view.findViewById(R.id.tvExperimentsHint);
2019-05-10 08:53:45 +02:00
swCrashReports = view.findViewById(R.id.swCrashReports);
2019-12-22 07:23:43 +01:00
tvUuid = view.findViewById(R.id.tvUuid);
2019-05-06 09:10:13 +02:00
swDebug = view.findViewById(R.id.swDebug);
2019-10-05 09:37:57 +02:00
btnReset = view.findViewById(R.id.btnReset);
swCleanupAttachments = view.findViewById(R.id.swCleanupAttachments);
2019-07-10 09:35:20 +02:00
btnCleanup = view.findViewById(R.id.btnCleanup);
2019-12-22 07:23:43 +01:00
tvLastCleanup = view.findViewById(R.id.tvLastCleanup);
2020-02-25 15:20:23 +01:00
btnMore = view.findViewById(R.id.btnMore);
2019-05-06 09:10:13 +02:00
2019-06-15 21:25:49 +02:00
tvProcessors = view.findViewById(R.id.tvProcessors);
tvMemoryClass = view.findViewById(R.id.tvMemoryClass);
2019-10-19 21:53:19 +02:00
tvStorageSpace = view.findViewById(R.id.tvStorageSpace);
2019-12-22 07:23:43 +01:00
tvFingerprint = view.findViewById(R.id.tvFingerprint);
2020-04-05 12:56:44 +02:00
btnCharsets = view.findViewById(R.id.btnCharsets);
2019-05-26 12:41:41 +02:00
grpDebug = view.findViewById(R.id.grpDebug);
2019-05-06 09:10:13 +02:00
2019-05-06 15:30:30 +02:00
setOptions();
2019-05-06 09:10:13 +02:00
// Wire controls
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
2019-12-31 12:07:45 +01:00
swExternalSearch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
PackageManager pm = getContext().getPackageManager();
pm.setComponentEnabledSetting(
new ComponentName(getContext(), ActivitySearch.class),
checked
? PackageManager.COMPONENT_ENABLED_STATE_DEFAULT
: PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
PackageManager.DONT_KILL_APP);
}
});
2020-03-19 13:11:59 +01:00
swShortcuts.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("shortcuts", checked).commit(); // apply won't work here
restart();
}
});
2020-01-14 21:58:27 +01:00
swFts.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("fts", checked).apply();
2020-01-16 09:44:54 +01:00
2020-01-15 10:29:16 +01:00
WorkerFts.init(getContext(), true);
2020-01-16 09:44:54 +01:00
if (!checked) {
Bundle args = new Bundle();
new SimpleTask<Void>() {
@Override
protected Void onExecute(Context context, Bundle args) {
SQLiteDatabase sdb = FtsDbHelper.getInstance(context);
FtsDbHelper.delete(sdb);
FtsDbHelper.optimize(sdb);
DB db = DB.getInstance(context);
db.message().resetFts();
return null;
}
@Override
protected void onException(Bundle args, Throwable ex) {
Log.unexpectedError(getParentFragmentManager(), ex);
}
}.execute(FragmentOptionsMisc.this, args, "fts:reset");
}
2020-01-14 21:58:27 +01:00
}
});
2020-01-16 18:21:03 +01:00
Helper.linkPro(tvFtsPro);
2019-05-06 09:10:13 +02:00
swEnglish.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("english", checked).commit(); // apply won't work here
2019-05-10 08:54:06 +02:00
restart();
2019-05-06 09:10:13 +02:00
}
});
2019-05-12 20:15:16 +02:00
swWatchdog.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("watchdog", checked).apply();
WorkerWatchdog.init(getContext());
}
});
2020-02-22 17:13:14 +01:00
swOptimize.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("auto_optimize", checked).apply();
2020-03-30 13:07:37 +02:00
ServiceSynchronize.reload(getContext(), null, false, "optimize");
2020-02-22 17:13:14 +01:00
}
});
2019-05-06 09:10:13 +02:00
swUpdates.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("updates", checked).apply();
if (!checked) {
NotificationManager nm = (NotificationManager) getContext().getSystemService(Context.NOTIFICATION_SERVICE);
nm.cancel(Helper.NOTIFICATION_UPDATE);
}
2019-05-06 09:10:13 +02:00
}
});
2019-08-24 13:13:48 +02:00
tvExperimentsHint.setPaintFlags(tvExperimentsHint.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
tvExperimentsHint.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Helper.viewFAQ(getContext(), 125);
}
});
2019-08-24 12:30:33 +02:00
swExperiments.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("experiments", checked).apply();
}
});
2019-05-10 08:53:45 +02:00
swCrashReports.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
2019-07-31 08:43:50 +02:00
prefs.edit()
.remove("crash_reports_asked")
.putBoolean("crash_reports", checked)
.apply();
2019-08-12 13:17:55 +02:00
Log.setCrashReporting(checked);
2019-05-10 08:53:45 +02:00
}
});
2019-05-06 09:10:13 +02:00
swDebug.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("debug", checked).apply();
2020-04-05 14:10:42 +02:00
Log.setDebug(checked);
2019-05-29 08:51:08 +02:00
grpDebug.setVisibility(checked || BuildConfig.DEBUG ? View.VISIBLE : View.GONE);
2019-05-06 09:10:13 +02:00
}
});
2019-10-05 09:37:57 +02:00
btnReset.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onResetQuestions();
}
});
swCleanupAttachments.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("cleanup_attachments", checked).apply();
}
});
2019-07-10 09:35:20 +02:00
btnCleanup.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
onCleanup();
}
});
2020-02-25 15:20:23 +01:00
btnMore.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext());
lbm.sendBroadcast(new Intent(ActivitySetup.ACTION_SETUP_MORE));
}
});
2020-04-05 12:56:44 +02:00
btnCharsets.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new SimpleTask<SortedMap<String, Charset>>() {
@Override
protected SortedMap<String, Charset> onExecute(Context context, Bundle args) {
return Charset.availableCharsets();
}
@Override
protected void onExecuted(Bundle args, SortedMap<String, Charset> charsets) {
StringBuilder sb = new StringBuilder();
for (String key : charsets.keySet())
sb.append(charsets.get(key).displayName()).append("\r\n");
new AlertDialog.Builder(getContext())
.setTitle(R.string.title_advanced_charsets)
.setMessage(sb.toString())
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// Do nothing
}
})
.show();
}
@Override
protected void onException(Bundle args, Throwable ex) {
Log.unexpectedError(getParentFragmentManager(), ex);
}
}.execute(FragmentOptionsMisc.this, new Bundle(), "setup:charsets");
}
});
2020-01-15 10:29:16 +01:00
tvFtsIndexed.setText(null);
DB db = DB.getInstance(getContext());
db.message().liveFts().observe(getViewLifecycleOwner(), new Observer<TupleFtsStats>() {
2020-01-16 09:44:54 +01:00
private TupleFtsStats last = null;
2020-01-15 10:29:16 +01:00
@Override
public void onChanged(TupleFtsStats stats) {
if (stats == null)
tvFtsIndexed.setText(null);
2020-01-16 09:44:54 +01:00
else if (last == null || !last.equals(stats))
tvFtsIndexed.setText(getString(R.string.title_advanced_fts_indexed,
stats.fts,
stats.total,
Helper.humanReadableByteCount(FtsDbHelper.size(getContext()), true)));
last = stats;
2020-01-15 10:29:16 +01:00
}
});
2019-05-06 09:10:13 +02:00
setLastCleanup(prefs.getLong("last_cleanup", -1));
PreferenceManager.getDefaultSharedPreferences(getContext()).registerOnSharedPreferenceChangeListener(this);
return view;
}
@Override
public void onDestroyView() {
PreferenceManager.getDefaultSharedPreferences(getContext()).unregisterOnSharedPreferenceChangeListener(this);
super.onDestroyView();
}
2019-05-06 14:41:03 +02:00
@Override
public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
2019-09-10 08:53:07 +02:00
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED)) {
setOptions();
if ("last_cleanup".equals(key))
setLastCleanup(prefs.getLong(key, -1));
}
2019-05-06 14:41:03 +02:00
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
2019-10-05 09:37:57 +02:00
inflater.inflate(R.menu.menu_options, menu);
2019-05-06 14:41:03 +02:00
super.onCreateOptionsMenu(menu, inflater);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_default:
2019-09-01 22:33:32 +02:00
onMenuDefault();
2019-05-09 07:32:48 +02:00
return true;
2019-05-06 14:41:03 +02:00
default:
return super.onOptionsItemSelected(item);
}
}
2019-09-01 22:33:32 +02:00
private void onMenuDefault() {
2019-05-06 14:41:03 +02:00
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
SharedPreferences.Editor editor = prefs.edit();
2019-09-01 22:33:32 +02:00
for (String option : RESET_OPTIONS)
2019-05-06 14:41:03 +02:00
editor.remove(option);
editor.apply();
2019-07-14 12:32:32 +02:00
ToastEx.makeText(getContext(), R.string.title_setup_done, Toast.LENGTH_LONG).show();
2019-05-06 14:41:03 +02:00
}
2019-10-05 09:37:57 +02:00
private void onResetQuestions() {
2019-09-01 22:33:32 +02:00
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
SharedPreferences.Editor editor = prefs.edit();
for (String option : RESET_QUESTIONS)
editor.remove(option);
for (String key : prefs.getAll().keySet())
2019-10-04 15:25:04 +02:00
if (key.endsWith(".show_full") || key.endsWith(".show_images"))
2019-09-01 22:33:32 +02:00
editor.remove(key);
editor.apply();
ToastEx.makeText(getContext(), R.string.title_setup_done, Toast.LENGTH_LONG).show();
}
2019-07-10 09:35:20 +02:00
private void onCleanup() {
new SimpleTask<Void>() {
@Override
protected void onPreExecute(Bundle args) {
btnCleanup.setEnabled(false);
2019-08-01 10:04:56 +02:00
ToastEx.makeText(getContext(), R.string.title_executing, Toast.LENGTH_LONG).show();
2019-07-10 09:35:20 +02:00
}
@Override
protected void onPostExecute(Bundle args) {
btnCleanup.setEnabled(true);
2019-08-13 18:22:52 +02:00
ToastEx.makeText(getContext(), R.string.title_completed, Toast.LENGTH_LONG).show();
2019-07-10 09:35:20 +02:00
}
@Override
protected Void onExecute(Context context, Bundle args) {
WorkerCleanup.cleanup(context, true);
return null;
}
@Override
protected void onException(Bundle args, Throwable ex) {
2019-12-06 08:50:46 +01:00
Log.unexpectedError(getParentFragmentManager(), ex);
2019-07-10 09:35:20 +02:00
}
}.execute(this, new Bundle(), "cleanup:run");
}
2019-05-06 09:10:13 +02:00
private void setOptions() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
2019-12-31 12:07:45 +01:00
PackageManager pm = getContext().getPackageManager();
int state = pm.getComponentEnabledSetting(new ComponentName(getContext(), ActivitySearch.class));
swExternalSearch.setChecked(state != PackageManager.COMPONENT_ENABLED_STATE_DISABLED);
2020-03-19 13:11:59 +01:00
swShortcuts.setChecked(prefs.getBoolean("shortcuts", true));
2020-01-14 21:58:27 +01:00
swFts.setChecked(prefs.getBoolean("fts", false));
2019-05-06 09:10:13 +02:00
swEnglish.setChecked(prefs.getBoolean("english", false));
2019-05-12 20:15:16 +02:00
swWatchdog.setChecked(prefs.getBoolean("watchdog", true));
2020-02-22 21:40:57 +01:00
swOptimize.setChecked(prefs.getBoolean("auto_optimize", false));
2019-05-06 09:10:13 +02:00
swUpdates.setChecked(prefs.getBoolean("updates", true));
swUpdates.setVisibility(
Helper.isPlayStoreInstall() || !Helper.hasValidFingerprint(getContext())
? View.GONE : View.VISIBLE);
2019-08-24 12:30:33 +02:00
swExperiments.setChecked(prefs.getBoolean("experiments", false));
2019-05-10 08:53:45 +02:00
swCrashReports.setChecked(prefs.getBoolean("crash_reports", false));
2019-11-08 12:17:07 +01:00
tvUuid.setText(prefs.getString("uuid", null));
2019-05-06 09:10:13 +02:00
swDebug.setChecked(prefs.getBoolean("debug", false));
swCleanupAttachments.setChecked(prefs.getBoolean("cleanup_attachments", false));
2019-05-06 09:10:13 +02:00
2019-06-15 21:25:49 +02:00
tvProcessors.setText(getString(R.string.title_advanced_processors, Runtime.getRuntime().availableProcessors()));
ActivityManager am = (ActivityManager) getContext().getSystemService(Context.ACTIVITY_SERVICE);
int class_mb = am.getMemoryClass();
tvMemoryClass.setText(getString(R.string.title_advanced_memory_class, class_mb + " MB"));
2019-10-19 21:53:19 +02:00
tvStorageSpace.setText(getString(R.string.title_advanced_storage_space,
2019-12-24 10:53:42 +01:00
Helper.humanReadableByteCount(Helper.getAvailableStorageSpace(), true),
Helper.humanReadableByteCount(Helper.getTotalStorageSpace(), true)));
2019-12-22 07:23:43 +01:00
tvFingerprint.setText(Helper.getFingerprint(getContext()));
2019-10-19 21:53:19 +02:00
2019-05-29 08:51:08 +02:00
grpDebug.setVisibility(swDebug.isChecked() || BuildConfig.DEBUG ? View.VISIBLE : View.GONE);
2019-05-06 09:10:13 +02:00
}
private void setLastCleanup(long time) {
2019-07-15 21:28:25 +02:00
java.text.DateFormat DTF = Helper.getDateTimeInstance(getContext());
2019-05-06 09:10:13 +02:00
tvLastCleanup.setText(
getString(R.string.title_advanced_last_cleanup,
2019-07-15 21:28:25 +02:00
time < 0 ? "-" : DTF.format(time)));
2019-05-06 09:10:13 +02:00
}
}