diff options
author | Christian Schneppe <christian@pix-art.de> | 2019-01-26 15:51:05 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2019-01-26 15:51:05 +0100 |
commit | 8f6aa480b5c9cd9c6f1b8243da6ee234394af82c (patch) | |
tree | 54939c94d6b26d98614b06e1092a5dcf610abf4d /src | |
parent | 05c1aa03779b6bf2a45e2ab89cb7e7f486eac037 (diff) |
small layout fixes
Diffstat (limited to 'src')
6 files changed, 19 insertions, 72 deletions
diff --git a/src/main/java/de/pixart/messenger/services/ImportBackupService.java b/src/main/java/de/pixart/messenger/services/ImportBackupService.java index 63d6c7b41..72eab6140 100644 --- a/src/main/java/de/pixart/messenger/services/ImportBackupService.java +++ b/src/main/java/de/pixart/messenger/services/ImportBackupService.java @@ -110,7 +110,7 @@ public class ImportBackupService extends Service { executor.execute(() -> { List<Jid> accounts = mDatabaseBackend.getAccountJids(false); final ArrayList<BackupFile> backupFiles = new ArrayList<>(); - final Set<String> apps = new HashSet<>(Arrays.asList("Conversations", "Quicksy", getString(R.string.app_name))); + final Set<String> apps = new HashSet<>(Arrays.asList(getString(R.string.app_name))); for (String app : apps) { final File directory = new File(FileBackend.getBackupDirectory()); if (!directory.exists() || !directory.isDirectory()) { diff --git a/src/main/java/de/pixart/messenger/ui/ImportBackupActivity.java b/src/main/java/de/pixart/messenger/ui/ImportBackupActivity.java index 4aa4dbfed..4f9386963 100644 --- a/src/main/java/de/pixart/messenger/ui/ImportBackupActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ImportBackupActivity.java @@ -26,7 +26,7 @@ import de.pixart.messenger.databinding.DialogEnterPasswordBinding; import de.pixart.messenger.services.ImportBackupService; import de.pixart.messenger.ui.adapter.BackupFileAdapter; -public class ImportBackupActivity extends ActionBarActivity implements ServiceConnection, ImportBackupService.OnBackupFilesLoaded, BackupFileAdapter.OnItemClickedListener, ImportBackupService.OnBackupProcessed { +public class ImportBackupActivity extends XmppActivity implements ServiceConnection, ImportBackupService.OnBackupFilesLoaded, BackupFileAdapter.OnItemClickedListener, ImportBackupService.OnBackupProcessed { private ActivityImportBackupBinding binding; @@ -45,6 +45,10 @@ public class ImportBackupActivity extends ActionBarActivity implements ServiceCo } @Override + protected void refreshUiReal() { + } + + @Override public void onStart() { super.onStart(); bindService(new Intent(this, ImportBackupService.class), this, Context.BIND_AUTO_CREATE); @@ -60,6 +64,10 @@ public class ImportBackupActivity extends ActionBarActivity implements ServiceCo } @Override + void onBackendConnected() { + } + + @Override public void onServiceConnected(ComponentName name, IBinder service) { ImportBackupService.ImportBackupServiceBinder binder = (ImportBackupService.ImportBackupServiceBinder) service; this.service = binder.getService(); diff --git a/src/main/java/de/pixart/messenger/ui/SettingsActivity.java b/src/main/java/de/pixart/messenger/ui/SettingsActivity.java index 3eb01eb83..a8080f482 100644 --- a/src/main/java/de/pixart/messenger/ui/SettingsActivity.java +++ b/src/main/java/de/pixart/messenger/ui/SettingsActivity.java @@ -426,75 +426,9 @@ public class SettingsActivity extends XmppActivity implements private void enableMultiAccounts() { if (!isMultiAccountChecked) { multiAccountPreference.setEnabled(true); - AlertDialog.Builder builder = new AlertDialog.Builder(this); - builder.setCancelable(false); - builder.setTitle(R.string.pref_enable_multi_accounts_title); - builder.setMessage(R.string.pref_enable_multi_accounts_summary); - builder.setNegativeButton(R.string.cancel, (dialog, which) -> { - ((CheckBoxPreference) multiAccountPreference).setChecked(false); - }); - builder.setPositiveButton(R.string.enter_password, (dialog, which) -> { - ((CheckBoxPreference) multiAccountPreference).setChecked(false); - enterPasswordDialog(); - }); - AlertDialog dialog = builder.create(); - dialog.show(); } } - public void enterPasswordDialog() { - LayoutInflater li = LayoutInflater.from(this); - View promptsView = li.inflate(R.layout.password, null); - - final Preference preference = mSettingsFragment.findPreference("enable_multi_accounts"); - - final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this); - alertDialogBuilder.setView(promptsView); - final EditText password = promptsView.findViewById(R.id.password); - final EditText confirm_password = promptsView.findViewById(R.id.confirm_password); - confirm_password.setVisibility(View.VISIBLE); - alertDialogBuilder.setTitle(R.string.enter_password); - alertDialogBuilder.setMessage(R.string.enter_password); - alertDialogBuilder - .setCancelable(false) - .setPositiveButton(R.string.ok, - (dialog, id) -> { - final String pw1 = password.getText().toString(); - final String pw2 = confirm_password.getText().toString(); - if (!pw1.equals(pw2)) { - ((CheckBoxPreference) preference).setChecked(false); - AlertDialog.Builder builder = new AlertDialog.Builder(this); - builder.setTitle(R.string.error); - builder.setMessage(R.string.passwords_do_not_match); - builder.setNegativeButton(R.string.cancel, null); - builder.setPositiveButton(R.string.try_again, (dialog12, id12) -> enterPasswordDialog()); - builder.create().show(); - } else if (pw1.trim().isEmpty()) { - ((CheckBoxPreference) preference).setChecked(false); - AlertDialog.Builder builder = new AlertDialog.Builder(this); - builder.setTitle(R.string.error); - builder.setMessage(R.string.password_should_not_be_empty); - builder.setNegativeButton(R.string.cancel, null); - builder.setPositiveButton(R.string.try_again, (dialog1, id1) -> enterPasswordDialog()); - builder.create().show(); - } else { - ((CheckBoxPreference) preference).setChecked(true); - SharedPreferences multiaccount_prefs = getApplicationContext().getSharedPreferences(USE_MULTI_ACCOUNTS, Context.MODE_PRIVATE); - SharedPreferences.Editor editor = multiaccount_prefs.edit(); - editor.putString("BackupPW", pw1); - boolean passwordstored = editor.commit(); - Log.d(Config.LOGTAG, "saving multiaccount password " + passwordstored); - if (passwordstored) { - recreate(); - } else { - //handleMultiAccountChanges(); - } - } - }) - .setNegativeButton(R.string.cancel, null); - alertDialogBuilder.create().show(); - } - @Override public void onStop() { diff --git a/src/main/res/layout/account_row.xml b/src/main/res/layout/account_row.xml index d6831ac26..f99f6c0dd 100644 --- a/src/main/res/layout/account_row.xml +++ b/src/main/res/layout/account_row.xml @@ -6,6 +6,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?android:selectableItemBackground" + android:paddingStart="8dp" android:paddingLeft="8dp" android:paddingTop="8dp" android:paddingBottom="8dp"> @@ -14,6 +15,7 @@ android:id="@+id/account_image" android:layout_width="48dp" android:layout_height="48dp" + android:layout_alignParentStart="true" android:layout_alignParentLeft="true" android:contentDescription="@string/account_image_description" app:riv_corner_radius="2dp" /> @@ -24,8 +26,10 @@ android:layout_centerVertical="true" android:layout_toStartOf="@+id/tgl_account_status" android:layout_toLeftOf="@+id/tgl_account_status" + android:layout_toEndOf="@+id/account_image" android:layout_toRightOf="@+id/account_image" android:orientation="vertical" + android:paddingStart="@dimen/avatar_item_distance" android:paddingLeft="@dimen/avatar_item_distance"> <TextView @@ -48,6 +52,7 @@ android:id="@+id/tgl_account_status" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_alignParentEnd="true" android:layout_alignParentRight="true" android:layout_centerVertical="true" android:focusable="false" diff --git a/src/main/res/layout/activity_import_backup.xml b/src/main/res/layout/activity_import_backup.xml index e9ee433fe..7d12f78c9 100644 --- a/src/main/res/layout/activity_import_backup.xml +++ b/src/main/res/layout/activity_import_backup.xml @@ -6,7 +6,7 @@ <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" - android:background="?attr/color_background_primary" + android:background="?attr/color_background_tertiary" android:orientation="vertical"> <include @@ -30,13 +30,13 @@ android:id="@+id/coordinator" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="?attr/color_background_primary"> + android:background="?attr/color_background_tertiary"> <android.support.v7.widget.RecyclerView android:id="@+id/list" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="?attr/color_background_primary" + android:background="?attr/color_background_tertiary" android:orientation="vertical" app:layoutManager="android.support.v7.widget.LinearLayoutManager" /> </android.support.design.widget.CoordinatorLayout> diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 058ae89e0..5f3d159e7 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -732,7 +732,7 @@ <string name="huawei_protected_apps">Protected Apps</string> <string name="huawei_protected_apps_summary">To keep receiving notifications, even when the screen is turned off, you need to add Pix-Art Messenger to the list of protected apps.</string> <string name="pref_enable_multi_accounts_title">Enable multiple accounts</string> - <string name="pref_enable_multi_accounts_summary">You want to use multiple accounts, so you have to set a password for daily backups.</string> + <string name="pref_enable_multi_accounts_summary">Do you want to use multiple accounts?</string> <string name="mtm_accept_cert">Accept Unknown Certificate?</string> <string name="mtm_trust_anchor">The server certificate is not signed by a known Certificate Authority.</string> <string name="mtm_accept_servername">Accept Mismatching Server Name?</string> |