mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-11-26 06:11:19 +00:00
More Android TV DPAD fixes (fixes #226) (fixes #228) (fixes #230) (fixes #231) (fixes #232) (fixes #233) (#229)
* Fix focus when editing folder (fixes #226) * Don't show qr code scan button on TV (fixes #230) * FolderActivity: Prevent accidential scroll by DPAD * Make DPAD available in Custom Sync Conditions dialog (fixes #231) * EnhancedEditText: Reformat code * Remove blank * DeviceActivity: Move code, set initial focus * FolderActivity: Fix focus problems on phones with keyboard input (fixes #233) * DeviceActivity: Set custom sync dialog focus from code (fixes #233) * DeviceActivity: Use setOnClickListener instead of implementing View.OnClickListener * fragment_folder: focusableInTouchMode => focusable * Edit device dialog: Show copy device ID row or edit, scan device row * Fix unused, outdated refs * Constants: Static implies final * Remove double semicolon * Remove double semicolon * Remove unused imports * Remove unnecessary return in void func * Fix javadoc errors (fixes #234) * Fix typos * Fix focus problem on TV/device edit dialog * Fix create folder dialog focus on TV (fixes #228)
This commit is contained in:
parent
495c3e9eb6
commit
89212bc956
5 changed files with 151 additions and 112 deletions
|
@ -6,10 +6,8 @@ import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.drawable.Drawable;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.support.v4.content.ContextCompat;
|
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.support.v7.widget.SwitchCompat;
|
import android.support.v7.widget.SwitchCompat;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
|
@ -57,7 +55,6 @@ import static com.nutomic.syncthingandroid.util.Compression.METADATA;
|
||||||
*/
|
*/
|
||||||
public class DeviceActivity extends SyncthingActivity
|
public class DeviceActivity extends SyncthingActivity
|
||||||
implements
|
implements
|
||||||
View.OnClickListener,
|
|
||||||
SyncthingService.OnServiceStateChangeListener {
|
SyncthingService.OnServiceStateChangeListener {
|
||||||
|
|
||||||
public static final String EXTRA_NOTIFICATION_ID =
|
public static final String EXTRA_NOTIFICATION_ID =
|
||||||
|
@ -79,34 +76,21 @@ public class DeviceActivity extends SyncthingActivity
|
||||||
private ConfigRouter mConfig;
|
private ConfigRouter mConfig;
|
||||||
|
|
||||||
private Device mDevice;
|
private Device mDevice;
|
||||||
|
private EditText mEditDeviceId;
|
||||||
private View mIdContainer;
|
private View mShowDeviceIdContainer;
|
||||||
|
private EditText mShowDeviceId;
|
||||||
private EditText mIdView;
|
|
||||||
|
|
||||||
private View mQrButton;
|
private View mQrButton;
|
||||||
|
|
||||||
private EditText mNameView;
|
private EditText mNameView;
|
||||||
|
|
||||||
private EditText mAddressesView;
|
private EditText mAddressesView;
|
||||||
|
|
||||||
private TextView mCurrentAddressView;
|
private TextView mCurrentAddressView;
|
||||||
|
|
||||||
private TextView mCompressionValueView;
|
|
||||||
|
|
||||||
private SwitchCompat mIntroducerView;
|
|
||||||
|
|
||||||
private SwitchCompat mDevicePaused;
|
|
||||||
|
|
||||||
private SwitchCompat mCustomSyncConditionsSwitch;
|
|
||||||
|
|
||||||
private TextView mCustomSyncConditionsDescription;
|
|
||||||
|
|
||||||
private TextView mCustomSyncConditionsDialog;
|
|
||||||
|
|
||||||
private TextView mSyncthingVersionView;
|
|
||||||
|
|
||||||
private View mCompressionContainer;
|
private View mCompressionContainer;
|
||||||
|
private TextView mCompressionValueView;
|
||||||
|
private SwitchCompat mIntroducerView;
|
||||||
|
private SwitchCompat mDevicePaused;
|
||||||
|
private SwitchCompat mCustomSyncConditionsSwitch;
|
||||||
|
private TextView mCustomSyncConditionsDescription;
|
||||||
|
private TextView mCustomSyncConditionsDialog;
|
||||||
|
private TextView mSyncthingVersionView;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
SharedPreferences mPreferences;
|
SharedPreferences mPreferences;
|
||||||
|
@ -179,6 +163,7 @@ public class DeviceActivity extends SyncthingActivity
|
||||||
break;
|
break;
|
||||||
case R.id.customSyncConditionsSwitch:
|
case R.id.customSyncConditionsSwitch:
|
||||||
mCustomSyncConditionsDescription.setEnabled(isChecked);
|
mCustomSyncConditionsDescription.setEnabled(isChecked);
|
||||||
|
mCustomSyncConditionsDialog.setFocusable(isChecked);
|
||||||
mCustomSyncConditionsDialog.setEnabled(isChecked);
|
mCustomSyncConditionsDialog.setEnabled(isChecked);
|
||||||
// This is needed to display the "discard changes dialog".
|
// This is needed to display the "discard changes dialog".
|
||||||
mDeviceNeedsToUpdate = true;
|
mDeviceNeedsToUpdate = true;
|
||||||
|
@ -198,8 +183,9 @@ public class DeviceActivity extends SyncthingActivity
|
||||||
mIsCreateMode = getIntent().getBooleanExtra(EXTRA_IS_CREATE, false);
|
mIsCreateMode = getIntent().getBooleanExtra(EXTRA_IS_CREATE, false);
|
||||||
setTitle(mIsCreateMode ? R.string.add_device : R.string.edit_device);
|
setTitle(mIsCreateMode ? R.string.add_device : R.string.edit_device);
|
||||||
|
|
||||||
mIdContainer = findViewById(R.id.idContainer);
|
mEditDeviceId = findViewById(R.id.editDeviceId);
|
||||||
mIdView = findViewById(R.id.id);
|
mShowDeviceIdContainer = findViewById(R.id.showDeviceIdContainer);
|
||||||
|
mShowDeviceId = findViewById(R.id.showDeviceId);
|
||||||
mQrButton = findViewById(R.id.qrButton);
|
mQrButton = findViewById(R.id.qrButton);
|
||||||
mNameView = findViewById(R.id.name);
|
mNameView = findViewById(R.id.name);
|
||||||
mAddressesView = findViewById(R.id.addresses);
|
mAddressesView = findViewById(R.id.addresses);
|
||||||
|
@ -213,9 +199,13 @@ public class DeviceActivity extends SyncthingActivity
|
||||||
mCustomSyncConditionsDialog = findViewById(R.id.customSyncConditionsDialog);
|
mCustomSyncConditionsDialog = findViewById(R.id.customSyncConditionsDialog);
|
||||||
mSyncthingVersionView = findViewById(R.id.syncthingVersion);
|
mSyncthingVersionView = findViewById(R.id.syncthingVersion);
|
||||||
|
|
||||||
mQrButton.setOnClickListener(this);
|
if (Util.isRunningOnTV(this)) {
|
||||||
|
mQrButton.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
mQrButton.setOnClickListener(view -> onQrButtonClick());
|
||||||
|
mShowDeviceIdContainer.setOnClickListener(view -> onCopyDeviceIdClick());
|
||||||
|
mCompressionContainer.setOnClickListener(view -> onCompressionContainerClick());
|
||||||
mCustomSyncConditionsDialog.setOnClickListener(view -> onCustomSyncConditionsDialogClick());
|
mCustomSyncConditionsDialog.setOnClickListener(view -> onCustomSyncConditionsDialogClick());
|
||||||
mCompressionContainer.setOnClickListener(this);
|
|
||||||
|
|
||||||
if (savedInstanceState != null){
|
if (savedInstanceState != null){
|
||||||
if (mDevice == null) {
|
if (mDevice == null) {
|
||||||
|
@ -223,26 +213,18 @@ public class DeviceActivity extends SyncthingActivity
|
||||||
}
|
}
|
||||||
restoreDialogStates(savedInstanceState);
|
restoreDialogStates(savedInstanceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
findViewById(R.id.editDeviceIdContainer).setVisibility(mIsCreateMode ? View.VISIBLE : View.GONE);
|
||||||
|
mShowDeviceIdContainer.setVisibility(!mIsCreateMode ? View.VISIBLE : View.GONE);
|
||||||
if (mIsCreateMode) {
|
if (mIsCreateMode) {
|
||||||
if (mDevice == null) {
|
if (mDevice == null) {
|
||||||
initDevice();
|
initDevice();
|
||||||
}
|
}
|
||||||
|
mEditDeviceId.requestFocus();
|
||||||
|
} else {
|
||||||
|
getWindow().setSoftInputMode(SOFT_INPUT_STATE_ALWAYS_HIDDEN);
|
||||||
|
mNameView.requestFocus();
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
prepareEditMode();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoked after user clicked on the {@link #mCustomSyncConditionsDialog} label.
|
|
||||||
*/
|
|
||||||
private void onCustomSyncConditionsDialogClick() {
|
|
||||||
startActivityForResult(
|
|
||||||
SyncConditionsActivity.createIntent(
|
|
||||||
this, Constants.PREF_OBJECT_PREFIX_DEVICE + mDevice.deviceID, mDevice.name
|
|
||||||
),
|
|
||||||
0
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void restoreDialogStates(Bundle savedInstanceState) {
|
private void restoreDialogStates(Bundle savedInstanceState) {
|
||||||
|
@ -327,7 +309,7 @@ public class DeviceActivity extends SyncthingActivity
|
||||||
syncthingService.getNotificationHandler().cancelConsentNotification(getIntent().getIntExtra(EXTRA_NOTIFICATION_ID, 0));
|
syncthingService.getNotificationHandler().cancelConsentNotification(getIntent().getIntExtra(EXTRA_NOTIFICATION_ID, 0));
|
||||||
syncthingService.unregisterOnServiceStateChangeListener(DeviceActivity.this);
|
syncthingService.unregisterOnServiceStateChangeListener(DeviceActivity.this);
|
||||||
}
|
}
|
||||||
mIdView.removeTextChangedListener(mIdTextWatcher);
|
mEditDeviceId.removeTextChangedListener(mIdTextWatcher);
|
||||||
mNameView.removeTextChangedListener(mNameTextWatcher);
|
mNameView.removeTextChangedListener(mNameTextWatcher);
|
||||||
mAddressesView.removeTextChangedListener(mAddressesTextWatcher);
|
mAddressesView.removeTextChangedListener(mAddressesTextWatcher);
|
||||||
}
|
}
|
||||||
|
@ -376,7 +358,7 @@ public class DeviceActivity extends SyncthingActivity
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateViewsAndSetListeners() {
|
private void updateViewsAndSetListeners() {
|
||||||
mIdView.removeTextChangedListener(mIdTextWatcher);
|
mEditDeviceId.removeTextChangedListener(mIdTextWatcher);
|
||||||
mNameView.removeTextChangedListener(mNameTextWatcher);
|
mNameView.removeTextChangedListener(mNameTextWatcher);
|
||||||
mAddressesView.removeTextChangedListener(mAddressesTextWatcher);
|
mAddressesView.removeTextChangedListener(mAddressesTextWatcher);
|
||||||
mIntroducerView.setOnCheckedChangeListener(null);
|
mIntroducerView.setOnCheckedChangeListener(null);
|
||||||
|
@ -384,7 +366,8 @@ public class DeviceActivity extends SyncthingActivity
|
||||||
mCustomSyncConditionsSwitch.setOnCheckedChangeListener(null);
|
mCustomSyncConditionsSwitch.setOnCheckedChangeListener(null);
|
||||||
|
|
||||||
// Update views
|
// Update views
|
||||||
mIdView.setText(mDevice.deviceID);
|
mEditDeviceId.setText(mDevice.deviceID);
|
||||||
|
mShowDeviceId.setText(mDevice.deviceID);
|
||||||
mNameView.setText(mDevice.name);
|
mNameView.setText(mDevice.name);
|
||||||
mAddressesView.setText(displayableAddresses());
|
mAddressesView.setText(displayableAddresses());
|
||||||
mCompressionValueView.setText(Compression.fromValue(this, mDevice.compression).getTitle(this));
|
mCompressionValueView.setText(Compression.fromValue(this, mDevice.compression).getTitle(this));
|
||||||
|
@ -402,10 +385,11 @@ public class DeviceActivity extends SyncthingActivity
|
||||||
}
|
}
|
||||||
mCustomSyncConditionsSwitch.setEnabled(!mIsCreateMode);
|
mCustomSyncConditionsSwitch.setEnabled(!mIsCreateMode);
|
||||||
mCustomSyncConditionsDescription.setEnabled(mCustomSyncConditionsSwitch.isChecked());
|
mCustomSyncConditionsDescription.setEnabled(mCustomSyncConditionsSwitch.isChecked());
|
||||||
|
mCustomSyncConditionsDialog.setFocusable(mCustomSyncConditionsSwitch.isChecked());
|
||||||
mCustomSyncConditionsDialog.setEnabled(mCustomSyncConditionsSwitch.isChecked());
|
mCustomSyncConditionsDialog.setEnabled(mCustomSyncConditionsSwitch.isChecked());
|
||||||
|
|
||||||
// Keep state updated
|
// Keep state updated
|
||||||
mIdView.addTextChangedListener(mIdTextWatcher);
|
mEditDeviceId.addTextChangedListener(mIdTextWatcher);
|
||||||
mNameView.addTextChangedListener(mNameTextWatcher);
|
mNameView.addTextChangedListener(mNameTextWatcher);
|
||||||
mAddressesView.addTextChangedListener(mAddressesTextWatcher);
|
mAddressesView.addTextChangedListener(mAddressesTextWatcher);
|
||||||
mIntroducerView.setOnCheckedChangeListener(mCheckedListener);
|
mIntroducerView.setOnCheckedChangeListener(mCheckedListener);
|
||||||
|
@ -489,7 +473,7 @@ public class DeviceActivity extends SyncthingActivity
|
||||||
IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
|
IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
|
||||||
if (scanResult != null) {
|
if (scanResult != null) {
|
||||||
mDevice.deviceID = scanResult.getContents();
|
mDevice.deviceID = scanResult.getContents();
|
||||||
mIdView.setText(mDevice.deviceID);
|
mEditDeviceId.setText(mDevice.deviceID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -507,17 +491,6 @@ public class DeviceActivity extends SyncthingActivity
|
||||||
mDevice.introducedBy = "";
|
mDevice.introducedBy = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void prepareEditMode() {
|
|
||||||
getWindow().setSoftInputMode(SOFT_INPUT_STATE_ALWAYS_HIDDEN);
|
|
||||||
|
|
||||||
Drawable dr = ContextCompat.getDrawable(this, R.drawable.ic_content_copy_black_24dp);
|
|
||||||
mIdView.setCompoundDrawablesWithIntrinsicBounds(null, null, dr, null);
|
|
||||||
mIdView.setEnabled(false);
|
|
||||||
mQrButton.setVisibility(View.GONE);
|
|
||||||
|
|
||||||
mIdContainer.setOnClickListener(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends the updated device info if in edit mode.
|
* Sends the updated device info if in edit mode.
|
||||||
* Preconditions: mDeviceNeedsToUpdate == true
|
* Preconditions: mDeviceNeedsToUpdate == true
|
||||||
|
@ -580,16 +553,29 @@ public class DeviceActivity extends SyncthingActivity
|
||||||
return TextUtils.join(", ", list);
|
return TextUtils.join(", ", list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private void onCompressionContainerClick() {
|
||||||
public void onClick(View v) {
|
|
||||||
if (v.equals(mCompressionContainer)) {
|
|
||||||
showCompressionDialog();
|
showCompressionDialog();
|
||||||
} else if (v.equals(mQrButton)){
|
}
|
||||||
IntentIntegrator integrator = new IntentIntegrator(DeviceActivity.this);
|
|
||||||
integrator.initiateScan();
|
/**
|
||||||
} else if (v.equals(mIdContainer)) {
|
* Invoked after user clicked on the {@link #mCustomSyncConditionsDialog} label.
|
||||||
|
*/
|
||||||
|
private void onCustomSyncConditionsDialogClick() {
|
||||||
|
startActivityForResult(
|
||||||
|
SyncConditionsActivity.createIntent(
|
||||||
|
this, Constants.PREF_OBJECT_PREFIX_DEVICE + mDevice.deviceID, mDevice.name
|
||||||
|
),
|
||||||
|
0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onCopyDeviceIdClick() {
|
||||||
Util.copyDeviceId(this, mDevice.deviceID);
|
Util.copyDeviceId(this, mDevice.deviceID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void onQrButtonClick() {
|
||||||
|
IntentIntegrator integrator = new IntentIntegrator(DeviceActivity.this);
|
||||||
|
integrator.initiateScan();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showCompressionDialog(){
|
private void showCompressionDialog(){
|
||||||
|
@ -615,15 +601,11 @@ public class DeviceActivity extends SyncthingActivity
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showDiscardDialog(){
|
private void showDiscardDialog(){
|
||||||
mDiscardDialog = createDiscardDialog();
|
mDiscardDialog = new android.app.AlertDialog.Builder(this)
|
||||||
mDiscardDialog.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
private Dialog createDiscardDialog() {
|
|
||||||
return new android.app.AlertDialog.Builder(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)
|
||||||
.create();
|
.create();
|
||||||
|
mDiscardDialog.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,6 +161,7 @@ public class FolderActivity extends SyncthingActivity
|
||||||
break;
|
break;
|
||||||
case R.id.customSyncConditionsSwitch:
|
case R.id.customSyncConditionsSwitch:
|
||||||
mCustomSyncConditionsDescription.setEnabled(isChecked);
|
mCustomSyncConditionsDescription.setEnabled(isChecked);
|
||||||
|
mCustomSyncConditionsDialog.setFocusable(isChecked);
|
||||||
mCustomSyncConditionsDialog.setEnabled(isChecked);
|
mCustomSyncConditionsDialog.setEnabled(isChecked);
|
||||||
// This is needed to display the "discard changes dialog".
|
// This is needed to display the "discard changes dialog".
|
||||||
mFolderNeedsToUpdate = true;
|
mFolderNeedsToUpdate = true;
|
||||||
|
@ -228,19 +229,20 @@ public class FolderActivity extends SyncthingActivity
|
||||||
if (mFolder == null) {
|
if (mFolder == null) {
|
||||||
initFolder();
|
initFolder();
|
||||||
}
|
}
|
||||||
// Open keyboard on label view in edit mode.
|
|
||||||
mLabelView.requestFocus();
|
|
||||||
mEditIgnoreListTitle.setEnabled(false);
|
mEditIgnoreListTitle.setEnabled(false);
|
||||||
mEditIgnoreListContent.setEnabled(false);
|
mEditIgnoreListContent.setEnabled(false);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Prepare edit mode.
|
// Prepare edit mode.
|
||||||
mIdView.clearFocus();
|
|
||||||
mIdView.setFocusable(false);
|
mIdView.setFocusable(false);
|
||||||
mIdView.setEnabled(false);
|
mIdView.setEnabled(false);
|
||||||
|
mPathView.setFocusable(false);
|
||||||
mPathView.setEnabled(false);
|
mPathView.setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Open keyboard on label view in edit mode.
|
||||||
|
mLabelView.requestFocus();
|
||||||
|
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
if (savedInstanceState.getBoolean(IS_SHOWING_DELETE_DIALOG)) {
|
if (savedInstanceState.getBoolean(IS_SHOWING_DELETE_DIALOG)) {
|
||||||
showDeleteDialog();
|
showDeleteDialog();
|
||||||
|
@ -494,6 +496,7 @@ public class FolderActivity extends SyncthingActivity
|
||||||
}
|
}
|
||||||
mCustomSyncConditionsSwitch.setEnabled(!mIsCreateMode);
|
mCustomSyncConditionsSwitch.setEnabled(!mIsCreateMode);
|
||||||
mCustomSyncConditionsDescription.setEnabled(mCustomSyncConditionsSwitch.isChecked());
|
mCustomSyncConditionsDescription.setEnabled(mCustomSyncConditionsSwitch.isChecked());
|
||||||
|
mCustomSyncConditionsDialog.setFocusable(mCustomSyncConditionsSwitch.isChecked());
|
||||||
mCustomSyncConditionsDialog.setEnabled(mCustomSyncConditionsSwitch.isChecked());
|
mCustomSyncConditionsDialog.setEnabled(mCustomSyncConditionsSwitch.isChecked());
|
||||||
|
|
||||||
// Populate devicesList.
|
// Populate devicesList.
|
||||||
|
|
|
@ -17,8 +17,7 @@
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingBottom="8dp"
|
android:paddingBottom="8dp"
|
||||||
android:paddingTop="8dp"
|
android:paddingTop="8dp"
|
||||||
android:showDividers="middle"
|
android:showDividers="middle">
|
||||||
android:focusableInTouchMode="true">
|
|
||||||
|
|
||||||
<!-- Static Sync Condition Title -->
|
<!-- Static Sync Condition Title -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
|
@ -21,15 +21,16 @@
|
||||||
android:paddingTop="8dp"
|
android:paddingTop="8dp"
|
||||||
android:showDividers="middle">
|
android:showDividers="middle">
|
||||||
|
|
||||||
|
<!-- Option 1: Input or edit device ID -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/idContainer"
|
android:id="@+id/editDeviceIdContainer"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?selectableItemBackground"
|
android:background="?selectableItemBackground"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<com.nutomic.syncthingandroid.views.EnhancedEditText
|
<com.nutomic.syncthingandroid.views.EnhancedEditText
|
||||||
android:id="@+id/id"
|
android:id="@+id/editDeviceId"
|
||||||
style="@style/Widget.Syncthing.TextView.Label.Details.Field"
|
style="@style/Widget.Syncthing.TextView.Label.Details.Field"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -39,7 +40,8 @@
|
||||||
android:hint="@string/device_id"
|
android:hint="@string/device_id"
|
||||||
android:imeOptions="actionNext"
|
android:imeOptions="actionNext"
|
||||||
android:inputType="textNoSuggestions|textMultiLine"
|
android:inputType="textNoSuggestions|textMultiLine"
|
||||||
android:nextFocusForward="@+id/name" />
|
android:focusable="true"
|
||||||
|
android:nextFocusDown="@+id/name" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/qrButton"
|
android:id="@+id/qrButton"
|
||||||
|
@ -51,8 +53,46 @@
|
||||||
android:layout_marginRight="@dimen/abc_action_bar_content_inset_material"
|
android:layout_marginRight="@dimen/abc_action_bar_content_inset_material"
|
||||||
android:contentDescription="@string/scan_qr_code_description"
|
android:contentDescription="@string/scan_qr_code_description"
|
||||||
android:src="@drawable/ic_qrcode_black_24dp_active" />
|
android:src="@drawable/ic_qrcode_black_24dp_active" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- Option 2: Show or copy device ID -->
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/showDeviceIdContainer"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?selectableItemBackground"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:focusable="true"
|
||||||
|
android:nextFocusDown="@+id/name" >
|
||||||
|
|
||||||
|
<com.nutomic.syncthingandroid.views.EnhancedEditText
|
||||||
|
android:id="@+id/showDeviceId"
|
||||||
|
style="@style/Widget.Syncthing.TextView.Label.Details.Field"
|
||||||
|
android:enabled="false"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:drawableLeft="@drawable/ic_cellphone_black_24dp"
|
||||||
|
android:drawableStart="@drawable/ic_cellphone_black_24dp"
|
||||||
|
android:hint="@string/device_id"
|
||||||
|
android:imeOptions="actionNext"
|
||||||
|
android:inputType="textNoSuggestions|textMultiLine" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/copyDeviceIdIcon"
|
||||||
|
style="?actionButtonStyle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginEnd="@dimen/abc_action_bar_content_inset_material"
|
||||||
|
android:layout_marginRight="@dimen/abc_action_bar_content_inset_material"
|
||||||
|
android:contentDescription="@string/scan_qr_code_description"
|
||||||
|
android:src="@drawable/ic_content_copy_black_24dp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- Device Name -->
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/name"
|
android:id="@+id/name"
|
||||||
style="@style/Widget.Syncthing.TextView.Label.Details.Field"
|
style="@style/Widget.Syncthing.TextView.Label.Details.Field"
|
||||||
|
@ -65,6 +105,7 @@
|
||||||
android:inputType="textCapWords"
|
android:inputType="textCapWords"
|
||||||
android:importantForAutofill="no" />
|
android:importantForAutofill="no" />
|
||||||
|
|
||||||
|
<!-- Device Addresses-->
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/addresses"
|
android:id="@+id/addresses"
|
||||||
style="@style/Widget.Syncthing.TextView.Label.Details.Field"
|
style="@style/Widget.Syncthing.TextView.Label.Details.Field"
|
||||||
|
@ -82,7 +123,8 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?selectableItemBackground"
|
android:background="?selectableItemBackground"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal"
|
||||||
|
android:focusable="true">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
style="@style/Widget.Syncthing.TextView.Label.Details"
|
style="@style/Widget.Syncthing.TextView.Label.Details"
|
||||||
|
@ -161,7 +203,6 @@
|
||||||
android:layout_marginStart="56dp"
|
android:layout_marginStart="56dp"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:focusable="true"
|
|
||||||
android:text="@string/custom_sync_conditions_dialog"/>
|
android:text="@string/custom_sync_conditions_dialog"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
|
|
@ -19,8 +19,7 @@
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingBottom="8dp"
|
android:paddingBottom="8dp"
|
||||||
android:paddingTop="8dp"
|
android:paddingTop="8dp"
|
||||||
android:showDividers="middle"
|
android:showDividers="middle">
|
||||||
android:focusableInTouchMode="true">
|
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/label"
|
android:id="@+id/label"
|
||||||
|
@ -62,13 +61,15 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:drawableLeft="@drawable/ic_device_hub_black_24dp_active"
|
android:drawableLeft="@drawable/ic_device_hub_black_24dp_active"
|
||||||
android:drawableStart="@drawable/ic_device_hub_black_24dp_active"
|
android:drawableStart="@drawable/ic_device_hub_black_24dp_active"
|
||||||
|
android:focusable="false"
|
||||||
android:text="@string/devices" />
|
android:text="@string/devices" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/devicesContainer"
|
android:id="@+id/devicesContainer"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical"
|
||||||
|
android:focusable="false">
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
@ -77,7 +78,8 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?selectableItemBackground"
|
android:background="?selectableItemBackground"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical"
|
||||||
|
android:focusable="true">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
style="@style/Widget.Syncthing.TextView.Label.Details"
|
style="@style/Widget.Syncthing.TextView.Label.Details"
|
||||||
|
@ -185,7 +187,6 @@
|
||||||
android:layout_marginStart="56dp"
|
android:layout_marginStart="56dp"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:focusable="true"
|
|
||||||
android:text="@string/custom_sync_conditions_dialog"/>
|
android:text="@string/custom_sync_conditions_dialog"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
@ -207,7 +208,8 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?selectableItemBackground"
|
android:background="?selectableItemBackground"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical"
|
||||||
|
android:focusable="true">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
style="@style/Widget.Syncthing.TextView.Label.Details"
|
style="@style/Widget.Syncthing.TextView.Label.Details"
|
||||||
|
@ -245,7 +247,8 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?selectableItemBackground"
|
android:background="?selectableItemBackground"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical"
|
||||||
|
android:focusable="true">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
style="@style/Widget.Syncthing.TextView.Label.Details"
|
style="@style/Widget.Syncthing.TextView.Label.Details"
|
||||||
|
@ -278,6 +281,15 @@
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<!-- variableSizeBlocks -->
|
<!-- variableSizeBlocks -->
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/variableSizeBlocksContainer"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?selectableItemBackground"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:focusable="true">
|
||||||
|
|
||||||
<android.support.v7.widget.SwitchCompat
|
<android.support.v7.widget.SwitchCompat
|
||||||
android:id="@+id/variableSizeBlocks"
|
android:id="@+id/variableSizeBlocks"
|
||||||
style="@style/Widget.Syncthing.TextView.Label.Details"
|
style="@style/Widget.Syncthing.TextView.Label.Details"
|
||||||
|
@ -299,6 +311,8 @@
|
||||||
android:text="@string/folder_variable_size_blocks_description"
|
android:text="@string/folder_variable_size_blocks_description"
|
||||||
android:focusable="false"/>
|
android:focusable="false"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/editIgnoresContainer"
|
android:id="@+id/editIgnoresContainer"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
Loading…
Reference in a new issue