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