|
@ -378,7 +378,7 @@ public class DeviceActivity extends SyncthingActivity implements View.OnClickLis
|
||||||
}
|
}
|
||||||
|
|
||||||
private Dialog createDeleteDialog(){
|
private Dialog createDeleteDialog(){
|
||||||
return new android.app.AlertDialog.Builder(this)
|
return Util.getAlertDialogBuilder(this)
|
||||||
.setMessage(R.string.remove_device_confirm)
|
.setMessage(R.string.remove_device_confirm)
|
||||||
.setPositiveButton(android.R.string.yes, (dialogInterface, i) -> {
|
.setPositiveButton(android.R.string.yes, (dialogInterface, i) -> {
|
||||||
getApi().removeDevice(mDevice.deviceID);
|
getApi().removeDevice(mDevice.deviceID);
|
||||||
|
@ -413,7 +413,7 @@ public class DeviceActivity extends SyncthingActivity implements View.OnClickLis
|
||||||
private void prepareEditMode() {
|
private void prepareEditMode() {
|
||||||
getWindow().setSoftInputMode(SOFT_INPUT_STATE_ALWAYS_HIDDEN);
|
getWindow().setSoftInputMode(SOFT_INPUT_STATE_ALWAYS_HIDDEN);
|
||||||
|
|
||||||
Drawable dr = ContextCompat.getDrawable(this, R.drawable.ic_content_copy_black_24dp);
|
Drawable dr = ContextCompat.getDrawable(this, R.drawable.ic_content_copy_24dp);
|
||||||
mIdView.setCompoundDrawablesWithIntrinsicBounds(null, null, dr, null);
|
mIdView.setCompoundDrawablesWithIntrinsicBounds(null, null, dr, null);
|
||||||
mIdView.setEnabled(false);
|
mIdView.setEnabled(false);
|
||||||
mQrButton.setVisibility(GONE);
|
mQrButton.setVisibility(GONE);
|
||||||
|
@ -461,7 +461,7 @@ public class DeviceActivity extends SyncthingActivity implements View.OnClickLis
|
||||||
}
|
}
|
||||||
|
|
||||||
private Dialog createCompressionDialog(){
|
private Dialog createCompressionDialog(){
|
||||||
return new AlertDialog.Builder(this)
|
return Util.getAlertDialogBuilder(this)
|
||||||
.setTitle(R.string.compression)
|
.setTitle(R.string.compression)
|
||||||
.setSingleChoiceItems(R.array.compress_entries,
|
.setSingleChoiceItems(R.array.compress_entries,
|
||||||
Compression.fromValue(this, mDevice.compression).getIndex(),
|
Compression.fromValue(this, mDevice.compression).getIndex(),
|
||||||
|
@ -497,7 +497,7 @@ public class DeviceActivity extends SyncthingActivity implements View.OnClickLis
|
||||||
}
|
}
|
||||||
|
|
||||||
private Dialog createDiscardDialog() {
|
private Dialog createDiscardDialog() {
|
||||||
return new android.app.AlertDialog.Builder(this)
|
return Util.getAlertDialogBuilder(this)
|
||||||
.setMessage(R.string.dialog_discard_changes)
|
.setMessage(R.string.dialog_discard_changes)
|
||||||
.setPositiveButton(android.R.string.ok, (dialog, which) -> finish())
|
.setPositiveButton(android.R.string.ok, (dialog, which) -> finish())
|
||||||
.setNegativeButton(android.R.string.cancel, null)
|
.setNegativeButton(android.R.string.cancel, null)
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
package com.nutomic.syncthingandroid.activities;
|
package com.nutomic.syncthingandroid.activities;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.annotation.TargetApi;
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.ActivityNotFoundException;
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
@ -12,6 +10,7 @@ import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.provider.DocumentFile;
|
import android.support.v4.provider.DocumentFile;
|
||||||
import android.support.v7.widget.SwitchCompat;
|
import android.support.v7.widget.SwitchCompat;
|
||||||
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
|
@ -27,7 +26,6 @@ import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.nutomic.syncthingandroid.R;
|
import com.nutomic.syncthingandroid.R;
|
||||||
import com.nutomic.syncthingandroid.model.Device;
|
import com.nutomic.syncthingandroid.model.Device;
|
||||||
|
@ -116,7 +114,7 @@ public class FolderActivity extends SyncthingActivity
|
||||||
@Override
|
@Override
|
||||||
public void afterTextChanged(Editable s) {
|
public void afterTextChanged(Editable s) {
|
||||||
mFolder.label = mLabelView.getText().toString();
|
mFolder.label = mLabelView.getText().toString();
|
||||||
mFolder.id = mIdView.getText().toString();;
|
mFolder.id = mIdView.getText().toString();
|
||||||
// mPathView must not be handled here as it's handled by {@link onActivityResult}
|
// mPathView must not be handled here as it's handled by {@link onActivityResult}
|
||||||
mFolderNeedsToUpdate = true;
|
mFolderNeedsToUpdate = true;
|
||||||
}
|
}
|
||||||
|
@ -498,7 +496,7 @@ public class FolderActivity extends SyncthingActivity
|
||||||
}
|
}
|
||||||
|
|
||||||
private Dialog createDeleteDialog(){
|
private Dialog createDeleteDialog(){
|
||||||
return new AlertDialog.Builder(this)
|
return Util.getAlertDialogBuilder(this)
|
||||||
.setMessage(R.string.remove_folder_confirm)
|
.setMessage(R.string.remove_folder_confirm)
|
||||||
.setPositiveButton(android.R.string.yes, (dialogInterface, i) -> {
|
.setPositiveButton(android.R.string.yes, (dialogInterface, i) -> {
|
||||||
RestApi restApi = getApi();
|
RestApi restApi = getApi();
|
||||||
|
@ -676,7 +674,7 @@ public class FolderActivity extends SyncthingActivity
|
||||||
}
|
}
|
||||||
|
|
||||||
private Dialog createDiscardDialog() {
|
private Dialog createDiscardDialog() {
|
||||||
return new AlertDialog.Builder(this)
|
return Util.getAlertDialogBuilder(this)
|
||||||
.setMessage(R.string.dialog_discard_changes)
|
.setMessage(R.string.dialog_discard_changes)
|
||||||
.setPositiveButton(android.R.string.ok, (dialog, which) -> finish())
|
.setPositiveButton(android.R.string.ok, (dialog, which) -> finish())
|
||||||
.setNegativeButton(android.R.string.cancel, null)
|
.setNegativeButton(android.R.string.cancel, null)
|
||||||
|
|
|
@ -2,7 +2,6 @@ package com.nutomic.syncthingandroid.activities;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
@ -15,6 +14,7 @@ import android.preference.PreferenceManager;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
@ -186,7 +186,7 @@ public class FolderPickerActivity extends SyncthingActivity
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case R.id.create_folder:
|
case R.id.create_folder:
|
||||||
final EditText et = new EditText(this);
|
final EditText et = new EditText(this);
|
||||||
AlertDialog dialog = new AlertDialog.Builder(this)
|
AlertDialog dialog = Util.getAlertDialogBuilder(this)
|
||||||
.setTitle(R.string.create_folder)
|
.setTitle(R.string.create_folder)
|
||||||
.setView(et)
|
.setView(et)
|
||||||
.setPositiveButton(android.R.string.ok,
|
.setPositiveButton(android.R.string.ok,
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.nutomic.syncthingandroid.activities;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
@ -14,7 +13,7 @@ import com.nutomic.syncthingandroid.service.Constants;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class FolderTypeDialogActivity extends AppCompatActivity {
|
public class FolderTypeDialogActivity extends ThemedAppCompatActivity {
|
||||||
|
|
||||||
public static final String EXTRA_FOLDER_TYPE = "com.nutomic.syncthinandroid.activities.FolderTypeDialogActivity.FOLDER_TYPE";
|
public static final String EXTRA_FOLDER_TYPE = "com.nutomic.syncthinandroid.activities.FolderTypeDialogActivity.FOLDER_TYPE";
|
||||||
public static final String EXTRA_RESULT_FOLDER_TYPE = "com.nutomic.syncthinandroid.activities.FolderTypeDialogActivity.EXTRA_RESULT_FOLDER_TYPE";
|
public static final String EXTRA_RESULT_FOLDER_TYPE = "com.nutomic.syncthinandroid.activities.FolderTypeDialogActivity.EXTRA_RESULT_FOLDER_TYPE";
|
||||||
|
|
|
@ -2,7 +2,7 @@ package com.nutomic.syncthingandroid.activities;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.ActivityNotFoundException;
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
|
@ -140,7 +140,7 @@ public class MainActivity extends StateDialogActivity
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mBatteryOptimizationsDialog = new AlertDialog.Builder(this)
|
mBatteryOptimizationsDialog = Util.getAlertDialogBuilder(this)
|
||||||
.setTitle(R.string.dialog_disable_battery_optimization_title)
|
.setTitle(R.string.dialog_disable_battery_optimization_title)
|
||||||
.setMessage(R.string.dialog_disable_battery_optimization_message)
|
.setMessage(R.string.dialog_disable_battery_optimization_message)
|
||||||
.setPositiveButton(R.string.dialog_disable_battery_optimization_turn_off, (d, i) -> {
|
.setPositiveButton(R.string.dialog_disable_battery_optimization_turn_off, (d, i) -> {
|
||||||
|
@ -359,7 +359,7 @@ public class MainActivity extends StateDialogActivity
|
||||||
}
|
}
|
||||||
|
|
||||||
private Dialog createRestartDialog(){
|
private Dialog createRestartDialog(){
|
||||||
return new AlertDialog.Builder(this)
|
return Util.getAlertDialogBuilder(this)
|
||||||
.setMessage(R.string.dialog_confirm_restart)
|
.setMessage(R.string.dialog_confirm_restart)
|
||||||
.setPositiveButton(android.R.string.yes, (dialogInterface, i1) -> this.startService(new Intent(this, SyncthingService.class)
|
.setPositiveButton(android.R.string.yes, (dialogInterface, i1) -> this.startService(new Intent(this, SyncthingService.class)
|
||||||
.setAction(SyncthingService.ACTION_RESTART)))
|
.setAction(SyncthingService.ACTION_RESTART)))
|
||||||
|
@ -379,7 +379,7 @@ public class MainActivity extends StateDialogActivity
|
||||||
shareDeviceIdTextView.setOnClickListener(v -> shareDeviceId(deviceId));
|
shareDeviceIdTextView.setOnClickListener(v -> shareDeviceId(deviceId));
|
||||||
qrCodeImageView.setImageBitmap(qrCode);
|
qrCodeImageView.setImageBitmap(qrCode);
|
||||||
|
|
||||||
mQrCodeDialog = new AlertDialog.Builder(this)
|
mQrCodeDialog = Util.getAlertDialogBuilder(this)
|
||||||
.setTitle(R.string.device_id)
|
.setTitle(R.string.device_id)
|
||||||
.setView(qrCodeDialogView)
|
.setView(qrCodeDialogView)
|
||||||
.setPositiveButton(R.string.finish, null)
|
.setPositiveButton(R.string.finish, null)
|
||||||
|
@ -514,7 +514,7 @@ public class MainActivity extends StateDialogActivity
|
||||||
.inflate(R.layout.dialog_usage_reporting, null);
|
.inflate(R.layout.dialog_usage_reporting, null);
|
||||||
TextView tv = v.findViewById(R.id.example);
|
TextView tv = v.findViewById(R.id.example);
|
||||||
tv.setText(report);
|
tv.setText(report);
|
||||||
new AlertDialog.Builder(MainActivity.this)
|
Util.getAlertDialogBuilder(MainActivity.this)
|
||||||
.setTitle(R.string.usage_reporting_dialog_title)
|
.setTitle(R.string.usage_reporting_dialog_title)
|
||||||
.setView(v)
|
.setView(v)
|
||||||
.setPositiveButton(R.string.yes, listener)
|
.setPositiveButton(R.string.yes, listener)
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.nutomic.syncthingandroid.activities;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
@ -13,7 +12,7 @@ import com.nutomic.syncthingandroid.R;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class PullOrderDialogActivity extends AppCompatActivity {
|
public class PullOrderDialogActivity extends ThemedAppCompatActivity {
|
||||||
|
|
||||||
public static final String EXTRA_PULL_ORDER = "com.nutomic.syncthinandroid.activities.PullOrderDialogActivity.PULL_ORDER";
|
public static final String EXTRA_PULL_ORDER = "com.nutomic.syncthinandroid.activities.PullOrderDialogActivity.PULL_ORDER";
|
||||||
public static final String EXTRA_RESULT_PULL_ORDER = "com.nutomic.syncthinandroid.activities.PullOrderDialogActivity.EXTRA_RESULT_PULL_ORDER";
|
public static final String EXTRA_RESULT_PULL_ORDER = "com.nutomic.syncthinandroid.activities.PullOrderDialogActivity.EXTRA_RESULT_PULL_ORDER";
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.nutomic.syncthingandroid.activities;
|
package com.nutomic.syncthingandroid.activities;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
|
@ -17,6 +16,7 @@ import android.preference.PreferenceManager;
|
||||||
import android.preference.PreferenceScreen;
|
import android.preference.PreferenceScreen;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
|
import android.support.v4.app.TaskStackBuilder;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.ListAdapter;
|
import android.widget.ListAdapter;
|
||||||
|
@ -74,7 +74,7 @@ public class SettingsActivity extends SyncthingActivity {
|
||||||
this.startService(new Intent(this, SyncthingService.class)
|
this.startService(new Intent(this, SyncthingService.class)
|
||||||
.setAction(SyncthingService.ACTION_REFRESH_NETWORK_INFO));
|
.setAction(SyncthingService.ACTION_REFRESH_NETWORK_INFO));
|
||||||
} else {
|
} else {
|
||||||
new AlertDialog.Builder(this)
|
Util.getAlertDialogBuilder(this)
|
||||||
.setTitle(R.string.sync_only_wifi_ssids_location_permission_rejected_dialog_title)
|
.setTitle(R.string.sync_only_wifi_ssids_location_permission_rejected_dialog_title)
|
||||||
.setMessage(R.string.sync_only_wifi_ssids_location_permission_rejected_dialog_content)
|
.setMessage(R.string.sync_only_wifi_ssids_location_permission_rejected_dialog_content)
|
||||||
.setPositiveButton(android.R.string.ok, null).show();
|
.setPositiveButton(android.R.string.ok, null).show();
|
||||||
|
@ -265,6 +265,9 @@ public class SettingsActivity extends SyncthingActivity {
|
||||||
handleSocksProxyPreferenceChange(screen.findPreference(Constants.PREF_SOCKS_PROXY_ADDRESS), mPreferences.getString(Constants.PREF_SOCKS_PROXY_ADDRESS, ""));
|
handleSocksProxyPreferenceChange(screen.findPreference(Constants.PREF_SOCKS_PROXY_ADDRESS), mPreferences.getString(Constants.PREF_SOCKS_PROXY_ADDRESS, ""));
|
||||||
handleHttpProxyPreferenceChange(screen.findPreference(Constants.PREF_HTTP_PROXY_ADDRESS), mPreferences.getString(Constants.PREF_HTTP_PROXY_ADDRESS, ""));
|
handleHttpProxyPreferenceChange(screen.findPreference(Constants.PREF_HTTP_PROXY_ADDRESS), mPreferences.getString(Constants.PREF_HTTP_PROXY_ADDRESS, ""));
|
||||||
|
|
||||||
|
ListPreference themePreference = (ListPreference) findPreference(Constants.PREF_APP_THEME);
|
||||||
|
themePreference.setOnPreferenceChangeListener(this);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
appVersion.setSummary(getActivity().getPackageManager()
|
appVersion.setSummary(getActivity().getPackageManager()
|
||||||
.getPackageInfo(getActivity().getPackageName(), 0).versionName);
|
.getPackageInfo(getActivity().getPackageName(), 0).versionName);
|
||||||
|
@ -311,8 +314,8 @@ public class SettingsActivity extends SyncthingActivity {
|
||||||
public void onServiceStateChange(SyncthingService.State currentState) {
|
public void onServiceStateChange(SyncthingService.State currentState) {
|
||||||
mApi = mSyncthingService.getApi();
|
mApi = mSyncthingService.getApi();
|
||||||
boolean isSyncthingRunning = (mApi != null) &&
|
boolean isSyncthingRunning = (mApi != null) &&
|
||||||
mApi.isConfigLoaded() &&
|
mApi.isConfigLoaded() &&
|
||||||
(currentState == SyncthingService.State.ACTIVE);
|
(currentState == SyncthingService.State.ACTIVE);
|
||||||
mCategorySyncthingOptions.setEnabled(isSyncthingRunning);
|
mCategorySyncthingOptions.setEnabled(isSyncthingRunning);
|
||||||
mCategoryBackup.setEnabled(isSyncthingRunning);
|
mCategoryBackup.setEnabled(isSyncthingRunning);
|
||||||
|
|
||||||
|
@ -511,6 +514,13 @@ public class SettingsActivity extends SyncthingActivity {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case Constants.PREF_APP_THEME:
|
||||||
|
// Recreate activities with the correct colors
|
||||||
|
TaskStackBuilder.create(getActivity())
|
||||||
|
.addNextIntent(new Intent(getActivity(), MainActivity.class))
|
||||||
|
.addNextIntent(getActivity().getIntent())
|
||||||
|
.startActivities();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -531,7 +541,7 @@ public class SettingsActivity extends SyncthingActivity {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
case KEY_EXPORT_CONFIG:
|
case KEY_EXPORT_CONFIG:
|
||||||
new AlertDialog.Builder(getActivity())
|
Util.getAlertDialogBuilder(getActivity())
|
||||||
.setMessage(R.string.dialog_confirm_export)
|
.setMessage(R.string.dialog_confirm_export)
|
||||||
.setPositiveButton(android.R.string.yes, (dialog, which) -> {
|
.setPositiveButton(android.R.string.yes, (dialog, which) -> {
|
||||||
mSyncthingService.exportConfig();
|
mSyncthingService.exportConfig();
|
||||||
|
@ -543,7 +553,7 @@ public class SettingsActivity extends SyncthingActivity {
|
||||||
.show();
|
.show();
|
||||||
return true;
|
return true;
|
||||||
case KEY_IMPORT_CONFIG:
|
case KEY_IMPORT_CONFIG:
|
||||||
new AlertDialog.Builder(getActivity())
|
Util.getAlertDialogBuilder(getActivity())
|
||||||
.setMessage(R.string.dialog_confirm_import)
|
.setMessage(R.string.dialog_confirm_import)
|
||||||
.setPositiveButton(android.R.string.yes, (dialog, which) -> {
|
.setPositiveButton(android.R.string.yes, (dialog, which) -> {
|
||||||
if (mSyncthingService.importConfig()) {
|
if (mSyncthingService.importConfig()) {
|
||||||
|
@ -562,7 +572,7 @@ public class SettingsActivity extends SyncthingActivity {
|
||||||
.show();
|
.show();
|
||||||
return true;
|
return true;
|
||||||
case KEY_UNDO_IGNORED_DEVICES_FOLDERS:
|
case KEY_UNDO_IGNORED_DEVICES_FOLDERS:
|
||||||
new AlertDialog.Builder(getActivity())
|
Util.getAlertDialogBuilder(getActivity())
|
||||||
.setMessage(R.string.undo_ignored_devices_folders_question)
|
.setMessage(R.string.undo_ignored_devices_folders_question)
|
||||||
.setPositiveButton(android.R.string.yes, (dialog, which) -> {
|
.setPositiveButton(android.R.string.yes, (dialog, which) -> {
|
||||||
if (mApi == null) {
|
if (mApi == null) {
|
||||||
|
@ -584,7 +594,7 @@ public class SettingsActivity extends SyncthingActivity {
|
||||||
intent = new Intent(getActivity(), SyncthingService.class)
|
intent = new Intent(getActivity(), SyncthingService.class)
|
||||||
.setAction(SyncthingService.ACTION_RESET_DATABASE);
|
.setAction(SyncthingService.ACTION_RESET_DATABASE);
|
||||||
|
|
||||||
new AlertDialog.Builder(getActivity())
|
Util.getAlertDialogBuilder(getActivity())
|
||||||
.setTitle(R.string.st_reset_database_title)
|
.setTitle(R.string.st_reset_database_title)
|
||||||
.setMessage(R.string.st_reset_database_question)
|
.setMessage(R.string.st_reset_database_question)
|
||||||
.setPositiveButton(android.R.string.ok, (dialogInterface, i) -> {
|
.setPositiveButton(android.R.string.ok, (dialogInterface, i) -> {
|
||||||
|
@ -599,7 +609,7 @@ public class SettingsActivity extends SyncthingActivity {
|
||||||
intent = new Intent(getActivity(), SyncthingService.class)
|
intent = new Intent(getActivity(), SyncthingService.class)
|
||||||
.setAction(SyncthingService.ACTION_RESET_DELTAS);
|
.setAction(SyncthingService.ACTION_RESET_DELTAS);
|
||||||
|
|
||||||
new AlertDialog.Builder(getActivity())
|
Util.getAlertDialogBuilder(getActivity())
|
||||||
.setTitle(R.string.st_reset_deltas_title)
|
.setTitle(R.string.st_reset_deltas_title)
|
||||||
.setMessage(R.string.st_reset_deltas_question)
|
.setMessage(R.string.st_reset_deltas_question)
|
||||||
.setPositiveButton(android.R.string.ok, (dialogInterface, i) -> {
|
.setPositiveButton(android.R.string.ok, (dialogInterface, i) -> {
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.nutomic.syncthingandroid.activities;
|
package com.nutomic.syncthingandroid.activities;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.databinding.DataBindingUtil;
|
import android.databinding.DataBindingUtil;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
@ -8,6 +7,7 @@ import android.os.Handler;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v4.app.ActivityCompat;
|
import android.support.v4.app.ActivityCompat;
|
||||||
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import com.nutomic.syncthingandroid.R;
|
import com.nutomic.syncthingandroid.R;
|
||||||
|
@ -108,7 +108,7 @@ public abstract class StateDialogActivity extends SyncthingActivity {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mDisabledDialog = new AlertDialog.Builder(this)
|
mDisabledDialog = Util.getAlertDialogBuilder(this)
|
||||||
.setTitle(R.string.syncthing_disabled_title)
|
.setTitle(R.string.syncthing_disabled_title)
|
||||||
.setMessage(getDisabledDialogMessage())
|
.setMessage(getDisabledDialogMessage())
|
||||||
.setPositiveButton(R.string.syncthing_disabled_change_settings,
|
.setPositiveButton(R.string.syncthing_disabled_change_settings,
|
||||||
|
@ -164,7 +164,7 @@ public abstract class StateDialogActivity extends SyncthingActivity {
|
||||||
? R.string.web_gui_creating_key
|
? R.string.web_gui_creating_key
|
||||||
: R.string.api_loading);
|
: R.string.api_loading);
|
||||||
|
|
||||||
mLoadingDialog = new AlertDialog.Builder(this)
|
mLoadingDialog = Util.getAlertDialogBuilder(this)
|
||||||
.setCancelable(false)
|
.setCancelable(false)
|
||||||
.setView(binding.getRoot())
|
.setView(binding.getRoot())
|
||||||
.show();
|
.show();
|
||||||
|
|
|
@ -6,7 +6,6 @@ import android.content.Intent;
|
||||||
import android.content.ServiceConnection;
|
import android.content.ServiceConnection;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
|
|
||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
|
@ -20,7 +19,7 @@ import java.util.LinkedList;
|
||||||
/**
|
/**
|
||||||
* Connects to {@link SyncthingService} and provides access to it.
|
* Connects to {@link SyncthingService} and provides access to it.
|
||||||
*/
|
*/
|
||||||
public abstract class SyncthingActivity extends AppCompatActivity implements ServiceConnection {
|
public abstract class SyncthingActivity extends ThemedAppCompatActivity implements ServiceConnection {
|
||||||
|
|
||||||
public static final String EXTRA_KEY_GENERATION_IN_PROGRESS = "com.nutomic.syncthing-android.SyncthingActivity.KEY_GENERATION_IN_PROGRESS";
|
public static final String EXTRA_KEY_GENERATION_IN_PROGRESS = "com.nutomic.syncthing-android.SyncthingActivity.KEY_GENERATION_IN_PROGRESS";
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.nutomic.syncthingandroid.activities;
|
||||||
|
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.support.v7.app.AppCompatDelegate;
|
||||||
|
|
||||||
|
import com.nutomic.syncthingandroid.service.Constants;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides a themed instance of AppCompatActivity.
|
||||||
|
*/
|
||||||
|
public class ThemedAppCompatActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
private static final String LIGHT_THEME = "1";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
// Load theme.
|
||||||
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
Integer prefAppTheme = Integer.parseInt(prefs.getString(Constants.PREF_APP_THEME, LIGHT_THEME));
|
||||||
|
AppCompatDelegate.setDefaultNightMode(prefAppTheme);
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -5,7 +5,6 @@ import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.app.FragmentTransaction;
|
import android.support.v4.app.FragmentTransaction;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
@ -20,7 +19,7 @@ import com.nutomic.syncthingandroid.fragments.dialog.TrashCanVersioningFragment;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class VersioningDialogActivity extends AppCompatActivity {
|
public class VersioningDialogActivity extends ThemedAppCompatActivity {
|
||||||
|
|
||||||
private Fragment mCurrentFragment;
|
private Fragment mCurrentFragment;
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package com.nutomic.syncthingandroid.fragments;
|
package com.nutomic.syncthingandroid.fragments;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -256,7 +256,7 @@ public class DrawerFragment extends Fragment implements View.OnClickListener {
|
||||||
* App is running as a service. Show an explanation why exiting syncthing is an
|
* App is running as a service. Show an explanation why exiting syncthing is an
|
||||||
* extraordinary request, then ask the user to confirm.
|
* extraordinary request, then ask the user to confirm.
|
||||||
*/
|
*/
|
||||||
AlertDialog mExitConfirmationDialog = new AlertDialog.Builder(mActivity)
|
AlertDialog mExitConfirmationDialog = Util.getAlertDialogBuilder(mActivity)
|
||||||
.setTitle(R.string.dialog_exit_while_running_as_service_title)
|
.setTitle(R.string.dialog_exit_while_running_as_service_title)
|
||||||
.setMessage(R.string.dialog_exit_while_running_as_service_message)
|
.setMessage(R.string.dialog_exit_while_running_as_service_message)
|
||||||
.setPositiveButton(R.string.yes, (d, i) -> {
|
.setPositiveButton(R.string.yes, (d, i) -> {
|
||||||
|
|
|
@ -25,6 +25,7 @@ public class Constants {
|
||||||
// Preferences - Behaviour
|
// Preferences - Behaviour
|
||||||
public static final String PREF_FIRST_START = "first_start";
|
public static final String PREF_FIRST_START = "first_start";
|
||||||
public static final String PREF_START_INTO_WEB_GUI = "start_into_web_gui";
|
public static final String PREF_START_INTO_WEB_GUI = "start_into_web_gui";
|
||||||
|
public static final String PREF_APP_THEME = "theme";
|
||||||
public static final String PREF_USE_ROOT = "use_root";
|
public static final String PREF_USE_ROOT = "use_root";
|
||||||
public static final String PREF_ENVIRONMENT_VARIABLES = "environment_variables";
|
public static final String PREF_ENVIRONMENT_VARIABLES = "environment_variables";
|
||||||
public static final String PREF_DEBUG_FACILITIES_ENABLED = "debug_facilities_enabled";
|
public static final String PREF_DEBUG_FACILITIES_ENABLED = "debug_facilities_enabled";
|
||||||
|
|
|
@ -9,6 +9,7 @@ import android.content.pm.ApplicationInfo;
|
||||||
import android.content.pm.PackageManager.NameNotFoundException;
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
@ -230,4 +231,12 @@ public class Util {
|
||||||
public static String formatPath(String path) {
|
public static String formatPath(String path) {
|
||||||
return new File(path).toURI().normalize().getPath();
|
return new File(path).toURI().normalize().getPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return a themed AlertDialog builder.
|
||||||
|
*/
|
||||||
|
public static AlertDialog.Builder getAlertDialogBuilder(Context context)
|
||||||
|
{
|
||||||
|
return new AlertDialog.Builder(context, R.style.Theme_Syncthing_Dialog);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Before Width: | Height: | Size: 197 B |
Before Width: | Height: | Size: 124 B |
Before Width: | Height: | Size: 514 B |
Before Width: | Height: | Size: 137 B |
Before Width: | Height: | Size: 136 B |
Before Width: | Height: | Size: 224 B |
Before Width: | Height: | Size: 299 B |
Before Width: | Height: | Size: 161 B |
Before Width: | Height: | Size: 263 B |
Before Width: | Height: | Size: 188 B |
Before Width: | Height: | Size: 143 B |
Before Width: | Height: | Size: 143 B |
Before Width: | Height: | Size: 491 B |
Before Width: | Height: | Size: 286 B |
Before Width: | Height: | Size: 403 B |
Before Width: | Height: | Size: 466 B |
Before Width: | Height: | Size: 327 B |
Before Width: | Height: | Size: 150 B |
Before Width: | Height: | Size: 367 B |
Before Width: | Height: | Size: 437 B |
Before Width: | Height: | Size: 543 B |
Before Width: | Height: | Size: 390 B |
Before Width: | Height: | Size: 308 B |
Before Width: | Height: | Size: 287 B |
Before Width: | Height: | Size: 255 B |
Before Width: | Height: | Size: 171 B |
Before Width: | Height: | Size: 182 B |
Before Width: | Height: | Size: 375 B |
Before Width: | Height: | Size: 228 B |
Before Width: | Height: | Size: 139 B |
Before Width: | Height: | Size: 292 B |
Before Width: | Height: | Size: 377 B |
Before Width: | Height: | Size: 227 B |
Before Width: | Height: | Size: 97 B |
Before Width: | Height: | Size: 675 B |
Before Width: | Height: | Size: 161 B |
Before Width: | Height: | Size: 161 B |
Before Width: | Height: | Size: 250 B |
Before Width: | Height: | Size: 308 B |
Before Width: | Height: | Size: 151 B |
Before Width: | Height: | Size: 314 B |
Before Width: | Height: | Size: 199 B |
Before Width: | Height: | Size: 196 B |
Before Width: | Height: | Size: 186 B |
Before Width: | Height: | Size: 627 B |
Before Width: | Height: | Size: 358 B |
Before Width: | Height: | Size: 483 B |
Before Width: | Height: | Size: 545 B |
Before Width: | Height: | Size: 381 B |
Before Width: | Height: | Size: 164 B |
Before Width: | Height: | Size: 137 B |
Before Width: | Height: | Size: 566 B |
Before Width: | Height: | Size: 684 B |
Before Width: | Height: | Size: 484 B |
Before Width: | Height: | Size: 320 B |
Before Width: | Height: | Size: 346 B |
Before Width: | Height: | Size: 316 B |
Before Width: | Height: | Size: 196 B |
Before Width: | Height: | Size: 169 B |
Before Width: | Height: | Size: 281 B |
Before Width: | Height: | Size: 97 B |
Before Width: | Height: | Size: 929 B |
Before Width: | Height: | Size: 204 B |
Before Width: | Height: | Size: 195 B |
Before Width: | Height: | Size: 328 B |
Before Width: | Height: | Size: 404 B |
Before Width: | Height: | Size: 193 B |
Before Width: | Height: | Size: 430 B |
Before Width: | Height: | Size: 255 B |
Before Width: | Height: | Size: 277 B |
Before Width: | Height: | Size: 266 B |
Before Width: | Height: | Size: 897 B |
Before Width: | Height: | Size: 508 B |
Before Width: | Height: | Size: 649 B |
Before Width: | Height: | Size: 784 B |
Before Width: | Height: | Size: 562 B |
Before Width: | Height: | Size: 213 B |
Before Width: | Height: | Size: 156 B |
Before Width: | Height: | Size: 808 B |
Before Width: | Height: | Size: 989 B |
Before Width: | Height: | Size: 666 B |
Before Width: | Height: | Size: 459 B |
Before Width: | Height: | Size: 503 B |
Before Width: | Height: | Size: 447 B |
Before Width: | Height: | Size: 281 B |
Before Width: | Height: | Size: 206 B |