some cleanup and fix for back button in ImportKeysActivity (fixes #1372)
This commit is contained in:
parent
510999c3a2
commit
3af97bf0e6
|
@ -49,13 +49,7 @@ public class DecryptActivity extends BaseActivity {
|
|||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setFullScreenDialogClose(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
setResult(Activity.RESULT_CANCELED);
|
||||
finish();
|
||||
}
|
||||
}, false);
|
||||
setFullScreenDialogClose(Activity.RESULT_CANCELED, false);
|
||||
|
||||
// Handle intent actions
|
||||
handleActions(savedInstanceState, getIntent());
|
||||
|
|
|
@ -41,13 +41,7 @@ public class DisplayTextActivity extends BaseActivity {
|
|||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setFullScreenDialogClose(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
setResult(Activity.RESULT_CANCELED);
|
||||
finish();
|
||||
}
|
||||
}, false);
|
||||
setFullScreenDialogClose(Activity.RESULT_CANCELED, false);
|
||||
|
||||
// Handle intent actions
|
||||
handleActions(savedInstanceState, getIntent());
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
package org.sufficientlysecure.keychain.ui;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
|
@ -41,12 +42,7 @@ public class EncryptFilesActivity extends EncryptActivity {
|
|||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setFullScreenDialogClose(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
finish();
|
||||
}
|
||||
}, false);
|
||||
setFullScreenDialogClose(Activity.RESULT_OK, false);
|
||||
|
||||
Intent intent = getIntent();
|
||||
String action = intent.getAction();
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
package org.sufficientlysecure.keychain.ui;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
|
@ -39,12 +40,7 @@ public class EncryptTextActivity extends EncryptActivity {
|
|||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setFullScreenDialogClose(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
finish();
|
||||
}
|
||||
}, false);
|
||||
setFullScreenDialogClose(Activity.RESULT_OK, false);
|
||||
|
||||
Intent intent = getIntent();
|
||||
String action = intent.getAction();
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package org.sufficientlysecure.keychain.ui;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
|
@ -95,6 +96,8 @@ public class ImportKeysActivity extends BaseNfcActivity
|
|||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setFullScreenDialogClose(Activity.RESULT_CANCELED, true);
|
||||
|
||||
mProxyPrefs = Preferences.getPreferences(this).getProxyPrefs();
|
||||
|
||||
mImportButton = findViewById(R.id.import_import);
|
||||
|
|
|
@ -257,7 +257,6 @@ public class ImportKeysProxyActivity extends FragmentActivity
|
|||
Intent data = new Intent();
|
||||
data.putExtras(returnData);
|
||||
returnResult(data);
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -87,9 +87,7 @@ public abstract class BaseActivity extends AppCompatActivity {
|
|||
mToolbar.setNavigationOnClickListener(cancelOnClickListener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Close button only
|
||||
*/
|
||||
/** Close button only */
|
||||
protected void setFullScreenDialogClose(View.OnClickListener cancelOnClickListener, boolean white) {
|
||||
if (white) {
|
||||
setActionBarIcon(R.drawable.ic_close_white_24dp);
|
||||
|
@ -104,6 +102,17 @@ public abstract class BaseActivity extends AppCompatActivity {
|
|||
setFullScreenDialogClose(cancelOnClickListener, true);
|
||||
}
|
||||
|
||||
/** Close button only, with finish-action and given return status, white. */
|
||||
protected void setFullScreenDialogClose(final int result, boolean white) {
|
||||
setFullScreenDialogClose(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
setResult(result);
|
||||
finish();
|
||||
}
|
||||
}, white);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inflate custom design with two buttons using drawables.
|
||||
* This does not conform to the Material Design Guidelines, but we deviate here as this is used
|
||||
|
|
Loading…
Reference in a new issue