mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-11-26 22:31:16 +00:00
Improved behaviour for add device/add folder (fixes #650)
- Added confirm dialog when exiting without saving - Replaced floppy disk icon with checkmark
This commit is contained in:
parent
2868f25fc9
commit
c60968d207
10 changed files with 37 additions and 32 deletions
|
@ -2,9 +2,9 @@ package com.nutomic.syncthingandroid.activities;
|
|||
|
||||
import android.app.Fragment;
|
||||
import android.app.FragmentManager;
|
||||
import android.content.Intent;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import com.nutomic.syncthingandroid.R;
|
||||
import com.nutomic.syncthingandroid.fragments.DeviceFragment;
|
||||
import com.nutomic.syncthingandroid.fragments.FolderFragment;
|
||||
|
@ -90,4 +90,23 @@ public class SettingsActivity extends SyncthingActivity {
|
|||
public boolean getIsCreate() {
|
||||
return getIntent().getBooleanExtra(EXTRA_IS_CREATE, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if (getIsCreate() && (mFragment instanceof DeviceFragment || mFragment instanceof FolderFragment)) {
|
||||
new AlertDialog.Builder(this)
|
||||
.setMessage(R.string.dialog_discard_changes)
|
||||
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
finish();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.show();
|
||||
}
|
||||
else {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,17 +13,11 @@ import android.text.Editable;
|
|||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.*;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.google.zxing.integration.android.IntentIntegrator;
|
||||
import com.google.zxing.integration.android.IntentResult;
|
||||
import com.nutomic.syncthingandroid.R;
|
||||
|
@ -343,7 +337,7 @@ public class DeviceFragment extends Fragment implements
|
|||
.show();
|
||||
return true;
|
||||
case android.R.id.home:
|
||||
getActivity().finish();
|
||||
getActivity().onBackPressed();
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
|
|
|
@ -12,18 +12,8 @@ import android.text.Editable;
|
|||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import android.view.*;
|
||||
import android.widget.*;
|
||||
import com.nutomic.syncthingandroid.R;
|
||||
import com.nutomic.syncthingandroid.activities.FolderPickerActivity;
|
||||
import com.nutomic.syncthingandroid.activities.SettingsActivity;
|
||||
|
@ -346,7 +336,7 @@ public class FolderFragment extends Fragment
|
|||
.show();
|
||||
return true;
|
||||
case android.R.id.home:
|
||||
getActivity().finish();
|
||||
getActivity().onBackPressed();
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 237 B |
Binary file not shown.
Before Width: | Height: | Size: 270 B |
Binary file not shown.
Before Width: | Height: | Size: 390 B |
Binary file not shown.
Before Width: | Height: | Size: 498 B |
|
@ -6,7 +6,7 @@
|
|||
<item
|
||||
android:id="@+id/create"
|
||||
android:title="@string/add"
|
||||
android:icon="@drawable/ic_save_white_24dp_active"
|
||||
android:icon="@drawable/ic_done_white_24dp"
|
||||
app:showAsAction="always" />
|
||||
|
||||
<item
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
<item
|
||||
android:id="@+id/create"
|
||||
android:icon="@drawable/ic_save_white_24dp_active"
|
||||
android:icon="@drawable/ic_done_white_24dp"
|
||||
android:title="@string/create"
|
||||
app:showAsAction="always" />
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ Please report any problems you encounter via Github.</string>
|
|||
|
||||
<string name="dialog_confirm_restart">Do you want to restart Syncthing?</string>
|
||||
|
||||
<!-- FolderSettingsFragment -->
|
||||
<!-- FolderFragment -->
|
||||
|
||||
|
||||
<!-- Setting title -->
|
||||
|
@ -155,13 +155,9 @@ Please report any problems you encounter via Github.</string>
|
|||
<!-- Toast shown when trying to create a folder with an empty path -->
|
||||
<string name="folder_path_required">The folder path must not be empty</string>
|
||||
|
||||
<!-- Dialog shown before config export -->
|
||||
<string name="dialog_confirm_export">Do you really want to export your configuration? Existing files will be overwritten.\n\nWARNING! Other applications may be able to read the private key from the backup location and use it to download/modify synchronized files.</string>
|
||||
<string name="dialog_discard_changes">Discard your changes?</string>
|
||||
|
||||
<!-- Dialog shown before config import -->
|
||||
<string name="dialog_confirm_import">Do you really want to import a new configuration? Existing files will be overwritten.</string>
|
||||
|
||||
<!-- DeviceSettingsFragment -->
|
||||
<!-- DeviceFragment -->
|
||||
|
||||
|
||||
<!-- Setting title -->
|
||||
|
@ -313,6 +309,12 @@ Please report any problems you encounter via Github.</string>
|
|||
|
||||
<string name="use_tor_summary">Force all traffic through Tor for increased privacy. Requires Orbot</string>
|
||||
|
||||
<!-- Dialog shown before config export -->
|
||||
<string name="dialog_confirm_export">Do you really want to export your configuration? Existing files will be overwritten.\n\nWARNING! Other applications may be able to read the private key from the backup location and use it to download/modify synchronized files.</string>
|
||||
|
||||
<!-- Dialog shown before config import -->
|
||||
<string name="dialog_confirm_import">Do you really want to import a new configuration? Existing files will be overwritten.</string>
|
||||
|
||||
<!-- Toast shown after config was successfully exported -->
|
||||
<string name="config_export_successful">Config was exported to %1$s</string>
|
||||
|
||||
|
|
Loading…
Reference in a new issue