mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-23 17:22:16 -05:00
Merge branch 'development' of https://github.com/manojkhannakm/open-keychain into manojkhannakm-development
This commit is contained in:
commit
bf427ce9c1
@ -120,7 +120,7 @@ public class CertifyResult extends OperationResult {
|
|||||||
mCertifyError, mCertifyError);
|
mCertifyError, mCertifyError);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Notify.createNotify(activity, str, duration, style, new ActionListener() {
|
return Notify.create(activity, str, duration, style, new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onAction() {
|
public void onAction() {
|
||||||
Intent intent = new Intent(
|
Intent intent = new Intent(
|
||||||
|
@ -116,7 +116,7 @@ public class DeleteResult extends OperationResult {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Notify.createNotify(activity, str, duration, style, new ActionListener() {
|
return Notify.create(activity, str, duration, style, new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onAction() {
|
public void onAction() {
|
||||||
Intent intent = new Intent(
|
Intent intent = new Intent(
|
||||||
|
@ -179,7 +179,7 @@ public class ImportKeyResult extends OperationResult {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Notify.createNotify(activity, str, duration, style, new ActionListener() {
|
return Notify.create(activity, str, duration, style, new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onAction() {
|
public void onAction() {
|
||||||
Intent intent = new Intent(
|
Intent intent = new Intent(
|
||||||
|
@ -273,19 +273,19 @@ public abstract class OperationResult implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (getLog() == null || getLog().isEmpty()) {
|
if (getLog() == null || getLog().isEmpty()) {
|
||||||
return Notify.createNotify(activity, msgId, Notify.LENGTH_LONG, style);
|
return Notify.create(activity, msgId, Notify.LENGTH_LONG, style);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Notify.createNotify(activity, msgId, Notify.LENGTH_LONG, style,
|
return Notify.create(activity, msgId, Notify.LENGTH_LONG, style,
|
||||||
new ActionListener() {
|
new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onAction() {
|
public void onAction() {
|
||||||
Intent intent = new Intent(
|
Intent intent = new Intent(
|
||||||
activity, LogDisplayActivity.class);
|
activity, LogDisplayActivity.class);
|
||||||
intent.putExtra(LogDisplayFragment.EXTRA_RESULT, OperationResult.this);
|
intent.putExtra(LogDisplayFragment.EXTRA_RESULT, OperationResult.this);
|
||||||
activity.startActivity(intent);
|
activity.startActivity(intent);
|
||||||
}
|
}
|
||||||
}, R.string.view_log);
|
}, R.string.view_log);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ public class RemoteServiceActivity extends BaseActivity {
|
|||||||
|
|
||||||
// user needs to select a key if it has explicitly requested (None is only allowed for new accounts)
|
// user needs to select a key if it has explicitly requested (None is only allowed for new accounts)
|
||||||
if (mUpdateExistingAccount && mAccSettingsFragment.getAccSettings().getKeyId() == Constants.key.none) {
|
if (mUpdateExistingAccount && mAccSettingsFragment.getAccSettings().getKeyId() == Constants.key.none) {
|
||||||
Notify.showNotify(RemoteServiceActivity.this, getString(R.string.api_register_error_select_key), Notify.Style.ERROR);
|
Notify.create(RemoteServiceActivity.this, getString(R.string.api_register_error_select_key), Notify.Style.ERROR).show();
|
||||||
} else {
|
} else {
|
||||||
if (mUpdateExistingAccount) {
|
if (mUpdateExistingAccount) {
|
||||||
Uri baseUri = KeychainContract.ApiAccounts.buildBaseUri(packageName);
|
Uri baseUri = KeychainContract.ApiAccounts.buildBaseUri(packageName);
|
||||||
|
@ -129,9 +129,9 @@ public class KeychainIntentServiceHandler extends Handler {
|
|||||||
|
|
||||||
// show error from service
|
// show error from service
|
||||||
if (data.containsKey(DATA_ERROR)) {
|
if (data.containsKey(DATA_ERROR)) {
|
||||||
Notify.showNotify(mActivity,
|
Notify.create(mActivity,
|
||||||
mActivity.getString(R.string.error_message, data.getString(DATA_ERROR)),
|
mActivity.getString(R.string.error_message, data.getString(DATA_ERROR)),
|
||||||
Notify.Style.ERROR);
|
Notify.Style.ERROR).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -169,8 +169,8 @@ public class CertifyKeyFragment extends LoaderFragment
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (mSignMasterKeyId == Constants.key.none) {
|
if (mSignMasterKeyId == Constants.key.none) {
|
||||||
Notify.showNotify(getActivity(), getString(R.string.select_key_to_certify),
|
Notify.create(getActivity(), getString(R.string.select_key_to_certify),
|
||||||
Notify.Style.ERROR);
|
Notify.Style.ERROR).show();
|
||||||
} else {
|
} else {
|
||||||
initiateCertifying();
|
initiateCertifying();
|
||||||
}
|
}
|
||||||
@ -360,8 +360,8 @@ public class CertifyKeyFragment extends LoaderFragment
|
|||||||
// Bail out if there is not at least one user id selected
|
// Bail out if there is not at least one user id selected
|
||||||
ArrayList<CertifyAction> certifyActions = mUserIdsAdapter.getSelectedCertifyActions();
|
ArrayList<CertifyAction> certifyActions = mUserIdsAdapter.getSelectedCertifyActions();
|
||||||
if (certifyActions.isEmpty()) {
|
if (certifyActions.isEmpty()) {
|
||||||
Notify.showNotify(getActivity(), "No identities selected!",
|
Notify.create(getActivity(), "No identities selected!",
|
||||||
Notify.Style.ERROR);
|
Notify.Style.ERROR).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,8 +277,8 @@ public class CreateKeyFinalFragment extends Fragment {
|
|||||||
// TODO: upload operation needs a result!
|
// TODO: upload operation needs a result!
|
||||||
// TODO: then combine these results
|
// TODO: then combine these results
|
||||||
//if (result.getResult() == OperationResultParcel.RESULT_OK) {
|
//if (result.getResult() == OperationResultParcel.RESULT_OK) {
|
||||||
//Notify.showNotify(getActivity(), R.string.key_send_success,
|
//Notify.create(getActivity(), R.string.key_send_success,
|
||||||
//Notify.Style.INFO);
|
//Notify.Style.OK).show();
|
||||||
|
|
||||||
Intent data = new Intent();
|
Intent data = new Intent();
|
||||||
data.putExtra(OperationResult.EXTRA_RESULT, saveKeyResult);
|
data.putExtra(OperationResult.EXTRA_RESULT, saveKeyResult);
|
||||||
|
@ -139,7 +139,7 @@ public class DecryptFilesFragment extends DecryptFragment {
|
|||||||
|
|
||||||
private void decryptAction() {
|
private void decryptAction() {
|
||||||
if (mInputUri == null) {
|
if (mInputUri == null) {
|
||||||
Notify.showNotify(getActivity(), R.string.no_file_selected, Notify.Style.ERROR);
|
Notify.create(getActivity(), R.string.no_file_selected, Notify.Style.ERROR).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ public class DecryptTextActivity extends BaseActivity {
|
|||||||
if (sharedText != null) {
|
if (sharedText != null) {
|
||||||
loadFragment(savedInstanceState, sharedText);
|
loadFragment(savedInstanceState, sharedText);
|
||||||
} else {
|
} else {
|
||||||
Notify.showNotify(this, R.string.error_invalid_data, Notify.Style.ERROR);
|
Notify.create(this, R.string.error_invalid_data, Notify.Style.ERROR).show();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.e(Constants.TAG, "ACTION_SEND received non-plaintext, this should not happen in this activity!");
|
Log.e(Constants.TAG, "ACTION_SEND received non-plaintext, this should not happen in this activity!");
|
||||||
@ -175,7 +175,7 @@ public class DecryptTextActivity extends BaseActivity {
|
|||||||
if (extraText != null) {
|
if (extraText != null) {
|
||||||
loadFragment(savedInstanceState, extraText);
|
loadFragment(savedInstanceState, extraText);
|
||||||
} else {
|
} else {
|
||||||
Notify.showNotify(this, R.string.error_invalid_data, Notify.Style.ERROR);
|
Notify.create(this, R.string.error_invalid_data, Notify.Style.ERROR).show();
|
||||||
}
|
}
|
||||||
} else if (ACTION_DECRYPT_FROM_CLIPBOARD.equals(action)) {
|
} else if (ACTION_DECRYPT_FROM_CLIPBOARD.equals(action)) {
|
||||||
Log.d(Constants.TAG, "ACTION_DECRYPT_FROM_CLIPBOARD");
|
Log.d(Constants.TAG, "ACTION_DECRYPT_FROM_CLIPBOARD");
|
||||||
|
@ -132,7 +132,7 @@ public class DecryptTextFragment extends DecryptFragment {
|
|||||||
|
|
||||||
private void copyToClipboard(String text) {
|
private void copyToClipboard(String text) {
|
||||||
ClipboardReflection.copyToClipboard(getActivity(), text);
|
ClipboardReflection.copyToClipboard(getActivity(), text);
|
||||||
Notify.showNotify(getActivity(), R.string.text_copied_to_clipboard, Notify.Style.INFO);
|
Notify.create(getActivity(), R.string.text_copied_to_clipboard, Notify.Style.OK).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -577,11 +577,11 @@ public class EditKeyFragment extends LoaderFragment implements
|
|||||||
|
|
||||||
private void returnKeyringParcel() {
|
private void returnKeyringParcel() {
|
||||||
if (mSaveKeyringParcel.mAddUserIds.size() == 0) {
|
if (mSaveKeyringParcel.mAddUserIds.size() == 0) {
|
||||||
Notify.showNotify(getActivity(), R.string.edit_key_error_add_identity, Notify.Style.ERROR);
|
Notify.create(getActivity(), R.string.edit_key_error_add_identity, Notify.Style.ERROR).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mSaveKeyringParcel.mAddSubKeys.size() == 0) {
|
if (mSaveKeyringParcel.mAddSubKeys.size() == 0) {
|
||||||
Notify.showNotify(getActivity(), R.string.edit_key_error_add_subkey, Notify.Style.ERROR);
|
Notify.create(getActivity(), R.string.edit_key_error_add_subkey, Notify.Style.ERROR).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,7 +303,8 @@ public class EncryptFilesActivity extends EncryptActivity implements EncryptActi
|
|||||||
// file checks
|
// file checks
|
||||||
|
|
||||||
if (mInputUris.isEmpty()) {
|
if (mInputUris.isEmpty()) {
|
||||||
Notify.showNotify(this, R.string.no_file_selected, Notify.Style.ERROR);
|
Notify.create(this, R.string.no_file_selected, Notify.Style.ERROR)
|
||||||
|
.show(getSupportFragmentManager().findFragmentById(R.id.encrypt_file_fragment));
|
||||||
return false;
|
return false;
|
||||||
} else if (mInputUris.size() > 1 && !mShareAfterEncrypt) {
|
} else if (mInputUris.size() > 1 && !mShareAfterEncrypt) {
|
||||||
// This should be impossible...
|
// This should be impossible...
|
||||||
@ -317,11 +318,13 @@ public class EncryptFilesActivity extends EncryptActivity implements EncryptActi
|
|||||||
// symmetric encryption checks
|
// symmetric encryption checks
|
||||||
|
|
||||||
if (mPassphrase == null) {
|
if (mPassphrase == null) {
|
||||||
Notify.showNotify(this, R.string.passphrases_do_not_match, Notify.Style.ERROR);
|
Notify.create(this, R.string.passphrases_do_not_match, Notify.Style.ERROR)
|
||||||
|
.show(getSupportFragmentManager().findFragmentById(R.id.encrypt_file_fragment));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (mPassphrase.isEmpty()) {
|
if (mPassphrase.isEmpty()) {
|
||||||
Notify.showNotify(this, R.string.passphrase_must_not_be_empty, Notify.Style.ERROR);
|
Notify.create(this, R.string.passphrase_must_not_be_empty, Notify.Style.ERROR)
|
||||||
|
.show(getSupportFragmentManager().findFragmentById(R.id.encrypt_file_fragment));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -333,7 +336,8 @@ public class EncryptFilesActivity extends EncryptActivity implements EncryptActi
|
|||||||
|
|
||||||
// Files must be encrypted, only text can be signed-only right now
|
// Files must be encrypted, only text can be signed-only right now
|
||||||
if (!gotEncryptionKeys) {
|
if (!gotEncryptionKeys) {
|
||||||
Notify.showNotify(this, R.string.select_encryption_key, Notify.Style.ERROR);
|
Notify.create(this, R.string.select_encryption_key, Notify.Style.ERROR)
|
||||||
|
.show(getSupportFragmentManager().findFragmentById(R.id.encrypt_file_fragment));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -115,9 +115,9 @@ public class EncryptFilesFragment extends Fragment implements EncryptActivityInt
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mEncryptInterface.getInputUris().contains(inputUri)) {
|
if (mEncryptInterface.getInputUris().contains(inputUri)) {
|
||||||
Notify.showNotify(getActivity(),
|
Notify.create(getActivity(),
|
||||||
getActivity().getString(R.string.error_file_added_already, FileHelper.getFilename(getActivity(), inputUri)),
|
getActivity().getString(R.string.error_file_added_already, FileHelper.getFilename(getActivity(), inputUri)),
|
||||||
Notify.Style.ERROR);
|
Notify.Style.ERROR).show(this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ public class EncryptFilesFragment extends Fragment implements EncryptActivityInt
|
|||||||
|
|
||||||
private void encryptClicked(boolean share) {
|
private void encryptClicked(boolean share) {
|
||||||
if (mEncryptInterface.getInputUris().isEmpty()) {
|
if (mEncryptInterface.getInputUris().isEmpty()) {
|
||||||
Notify.showNotify(getActivity(), R.string.error_no_file_selected, Notify.Style.ERROR);
|
Notify.create(getActivity(), R.string.error_no_file_selected, Notify.Style.ERROR).show(this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (share) {
|
if (share) {
|
||||||
@ -169,7 +169,7 @@ public class EncryptFilesFragment extends Fragment implements EncryptActivityInt
|
|||||||
mEncryptInterface.startEncrypt(true);
|
mEncryptInterface.startEncrypt(true);
|
||||||
} else {
|
} else {
|
||||||
if (mEncryptInterface.getInputUris().size() > 1) {
|
if (mEncryptInterface.getInputUris().size() > 1) {
|
||||||
Notify.showNotify(getActivity(), R.string.error_multi_not_supported, Notify.Style.ERROR);
|
Notify.create(getActivity(), R.string.error_multi_not_supported, Notify.Style.ERROR).show(this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
showOutputFileDialog();
|
showOutputFileDialog();
|
||||||
|
@ -198,8 +198,9 @@ public class EncryptTextActivity extends EncryptActivity implements EncryptActiv
|
|||||||
// Copy to clipboard
|
// Copy to clipboard
|
||||||
copyToClipboard(result.getResultBytes());
|
copyToClipboard(result.getResultBytes());
|
||||||
result.createNotify(EncryptTextActivity.this).show();
|
result.createNotify(EncryptTextActivity.this).show();
|
||||||
// Notify.showNotify(EncryptTextActivity.this,
|
// Notify.create(EncryptTextActivity.this,
|
||||||
// R.string.encrypt_sign_clipboard_successful, Notify.Style.INFO);
|
// R.string.encrypt_sign_clipboard_successful, Notify.Style.OK)
|
||||||
|
// .show(getSupportFragmentManager().findFragmentById(R.id.encrypt_text_fragment));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,7 +282,8 @@ public class EncryptTextActivity extends EncryptActivity implements EncryptActiv
|
|||||||
|
|
||||||
protected boolean inputIsValid() {
|
protected boolean inputIsValid() {
|
||||||
if (mMessage == null) {
|
if (mMessage == null) {
|
||||||
Notify.showNotify(this, R.string.error_message, Notify.Style.ERROR);
|
Notify.create(this, R.string.error_message, Notify.Style.ERROR)
|
||||||
|
.show(getSupportFragmentManager().findFragmentById(R.id.encrypt_text_fragment));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -289,11 +291,13 @@ public class EncryptTextActivity extends EncryptActivity implements EncryptActiv
|
|||||||
// symmetric encryption checks
|
// symmetric encryption checks
|
||||||
|
|
||||||
if (mPassphrase == null) {
|
if (mPassphrase == null) {
|
||||||
Notify.showNotify(this, R.string.passphrases_do_not_match, Notify.Style.ERROR);
|
Notify.create(this, R.string.passphrases_do_not_match, Notify.Style.ERROR)
|
||||||
|
.show(getSupportFragmentManager().findFragmentById(R.id.encrypt_text_fragment));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (mPassphrase.isEmpty()) {
|
if (mPassphrase.isEmpty()) {
|
||||||
Notify.showNotify(this, R.string.passphrase_must_not_be_empty, Notify.Style.ERROR);
|
Notify.create(this, R.string.passphrase_must_not_be_empty, Notify.Style.ERROR)
|
||||||
|
.show(getSupportFragmentManager().findFragmentById(R.id.encrypt_text_fragment));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -304,7 +308,8 @@ public class EncryptTextActivity extends EncryptActivity implements EncryptActiv
|
|||||||
&& mEncryptionKeyIds.length > 0);
|
&& mEncryptionKeyIds.length > 0);
|
||||||
|
|
||||||
if (!gotEncryptionKeys && mSigningKeyId == 0) {
|
if (!gotEncryptionKeys && mSigningKeyId == 0) {
|
||||||
Notify.showNotify(this, R.string.select_encryption_or_signature_key, Notify.Style.ERROR);
|
Notify.create(this, R.string.select_encryption_or_signature_key, Notify.Style.ERROR)
|
||||||
|
.show(getSupportFragmentManager().findFragmentById(R.id.encrypt_text_fragment));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ import android.os.Messenger;
|
|||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
import org.sufficientlysecure.keychain.Constants;
|
import org.sufficientlysecure.keychain.Constants;
|
||||||
import org.sufficientlysecure.keychain.R;
|
import org.sufficientlysecure.keychain.R;
|
||||||
@ -277,7 +278,8 @@ public class ImportKeysActivity extends BaseActivity {
|
|||||||
|
|
||||||
private boolean isFingerprintValid(String fingerprint) {
|
private boolean isFingerprintValid(String fingerprint) {
|
||||||
if (fingerprint == null || fingerprint.length() < 40) {
|
if (fingerprint == null || fingerprint.length() < 40) {
|
||||||
Notify.showNotify(this, R.string.import_qr_code_too_short_fingerprint, Notify.Style.ERROR);
|
Notify.create(this, R.string.import_qr_code_too_short_fingerprint, Notify.Style.ERROR)
|
||||||
|
.show((ViewGroup) findViewById(R.id.import_snackbar));
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
@ -329,7 +331,8 @@ public class ImportKeysActivity extends BaseActivity {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
result.createNotify(ImportKeysActivity.this).show();
|
result.createNotify(ImportKeysActivity.this)
|
||||||
|
.show((ViewGroup) findViewById(R.id.import_snackbar));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -372,7 +375,8 @@ public class ImportKeysActivity extends BaseActivity {
|
|||||||
startService(intent);
|
startService(intent);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(Constants.TAG, "Problem writing cache file", e);
|
Log.e(Constants.TAG, "Problem writing cache file", e);
|
||||||
Notify.showNotify(this, "Problem writing cache file!", Notify.Style.ERROR);
|
Notify.create(this, "Problem writing cache file!", Notify.Style.ERROR)
|
||||||
|
.show((ViewGroup) findViewById(R.id.import_snackbar));
|
||||||
}
|
}
|
||||||
} else if (ls instanceof ImportKeysListFragment.CloudLoaderState) {
|
} else if (ls instanceof ImportKeysListFragment.CloudLoaderState) {
|
||||||
ImportKeysListFragment.CloudLoaderState sls = (ImportKeysListFragment.CloudLoaderState) ls;
|
ImportKeysListFragment.CloudLoaderState sls = (ImportKeysListFragment.CloudLoaderState) ls;
|
||||||
@ -412,7 +416,8 @@ public class ImportKeysActivity extends BaseActivity {
|
|||||||
// start service with intent
|
// start service with intent
|
||||||
startService(intent);
|
startService(intent);
|
||||||
} else {
|
} else {
|
||||||
Notify.showNotify(this, R.string.error_nothing_import, Notify.Style.ERROR);
|
Notify.create(this, R.string.error_nothing_import, Notify.Style.ERROR)
|
||||||
|
.show((ViewGroup) findViewById(R.id.import_snackbar));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -390,8 +390,8 @@ public class KeyListFragment extends LoaderFragment
|
|||||||
public void showDeleteKeyDialog(final ActionMode mode, long[] masterKeyIds, boolean hasSecret) {
|
public void showDeleteKeyDialog(final ActionMode mode, long[] masterKeyIds, boolean hasSecret) {
|
||||||
// Can only work on singular secret keys
|
// Can only work on singular secret keys
|
||||||
if (hasSecret && masterKeyIds.length > 1) {
|
if (hasSecret && masterKeyIds.length > 1) {
|
||||||
Notify.showNotify(getActivity(), R.string.secret_cannot_multiple,
|
Notify.create(getActivity(), R.string.secret_cannot_multiple,
|
||||||
Notify.Style.ERROR);
|
Notify.Style.ERROR).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -484,21 +484,21 @@ public class KeyListFragment extends LoaderFragment
|
|||||||
case R.id.menu_key_list_debug_read:
|
case R.id.menu_key_list_debug_read:
|
||||||
try {
|
try {
|
||||||
KeychainDatabase.debugBackup(getActivity(), true);
|
KeychainDatabase.debugBackup(getActivity(), true);
|
||||||
Notify.showNotify(getActivity(), "Restored debug_backup.db", Notify.Style.INFO);
|
Notify.create(getActivity(), "Restored debug_backup.db", Notify.Style.OK).show();
|
||||||
getActivity().getContentResolver().notifyChange(KeychainContract.KeyRings.CONTENT_URI, null);
|
getActivity().getContentResolver().notifyChange(KeychainContract.KeyRings.CONTENT_URI, null);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(Constants.TAG, "IO Error", e);
|
Log.e(Constants.TAG, "IO Error", e);
|
||||||
Notify.showNotify(getActivity(), "IO Error " + e.getMessage(), Notify.Style.ERROR);
|
Notify.create(getActivity(), "IO Error " + e.getMessage(), Notify.Style.ERROR).show();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case R.id.menu_key_list_debug_write:
|
case R.id.menu_key_list_debug_write:
|
||||||
try {
|
try {
|
||||||
KeychainDatabase.debugBackup(getActivity(), false);
|
KeychainDatabase.debugBackup(getActivity(), false);
|
||||||
Notify.showNotify(getActivity(), "Backup to debug_backup.db completed", Notify.Style.INFO);
|
Notify.create(getActivity(), "Backup to debug_backup.db completed", Notify.Style.OK).show();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(Constants.TAG, "IO Error", e);
|
Log.e(Constants.TAG, "IO Error", e);
|
||||||
Notify.showNotify(getActivity(), "IO Error: " + e.getMessage(), Notify.Style.ERROR);
|
Notify.create(getActivity(), "IO Error: " + e.getMessage(), Notify.Style.ERROR).show();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ public class QrCodeViewActivity extends BaseActivity {
|
|||||||
KeychainContract.KeyRings.FINGERPRINT, ProviderHelper.FIELD_TYPE_BLOB);
|
KeychainContract.KeyRings.FINGERPRINT, ProviderHelper.FIELD_TYPE_BLOB);
|
||||||
if (blob == null) {
|
if (blob == null) {
|
||||||
Log.e(Constants.TAG, "key not found!");
|
Log.e(Constants.TAG, "key not found!");
|
||||||
Notify.showNotify(this, R.string.error_key_not_found, Style.ERROR);
|
Notify.create(this, R.string.error_key_not_found, Style.ERROR).show();
|
||||||
ActivityCompat.finishAfterTransition(QrCodeViewActivity.this);
|
ActivityCompat.finishAfterTransition(QrCodeViewActivity.this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,7 +102,7 @@ public class QrCodeViewActivity extends BaseActivity {
|
|||||||
});
|
});
|
||||||
} catch (ProviderHelper.NotFoundException e) {
|
} catch (ProviderHelper.NotFoundException e) {
|
||||||
Log.e(Constants.TAG, "key not found!", e);
|
Log.e(Constants.TAG, "key not found!", e);
|
||||||
Notify.showNotify(this, R.string.error_key_not_found, Style.ERROR);
|
Notify.create(this, R.string.error_key_not_found, Style.ERROR).show();
|
||||||
ActivityCompat.finishAfterTransition(QrCodeViewActivity.this);
|
ActivityCompat.finishAfterTransition(QrCodeViewActivity.this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -205,7 +205,7 @@ public class SafeSlingerActivity extends BaseActivity {
|
|||||||
activity.startService(intent);
|
activity.startService(intent);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(Constants.TAG, "Problem writing cache file", e);
|
Log.e(Constants.TAG, "Problem writing cache file", e);
|
||||||
Notify.showNotify(activity, "Problem writing cache file!", Notify.Style.ERROR);
|
Notify.create(activity, "Problem writing cache file!", Notify.Style.ERROR).show();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// give everything else down to KeyListActivity!
|
// give everything else down to KeyListActivity!
|
||||||
|
@ -338,7 +338,7 @@ public class ViewKeyActivity extends BaseActivity implements
|
|||||||
try {
|
try {
|
||||||
updateFromKeyserver(mDataUri, mProviderHelper);
|
updateFromKeyserver(mDataUri, mProviderHelper);
|
||||||
} catch (ProviderHelper.NotFoundException e) {
|
} catch (ProviderHelper.NotFoundException e) {
|
||||||
Notify.showNotify(this, R.string.error_key_not_found, Notify.Style.ERROR);
|
Notify.create(this, R.string.error_key_not_found, Notify.Style.ERROR).show();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -449,7 +449,7 @@ public class ViewKeyActivity extends BaseActivity implements
|
|||||||
Constants.Path.APP_DIR_FILE, ((Long) data.get(KeychainContract.KeyRings.HAS_SECRET) != 0)
|
Constants.Path.APP_DIR_FILE, ((Long) data.get(KeychainContract.KeyRings.HAS_SECRET) != 0)
|
||||||
);
|
);
|
||||||
} catch (ProviderHelper.NotFoundException e) {
|
} catch (ProviderHelper.NotFoundException e) {
|
||||||
Notify.showNotify(this, R.string.error_key_not_found, Notify.Style.ERROR);
|
Notify.create(this, R.string.error_key_not_found, Notify.Style.ERROR).show();
|
||||||
Log.e(Constants.TAG, "Key not found", e);
|
Log.e(Constants.TAG, "Key not found", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -486,14 +486,14 @@ public class ViewKeyActivity extends BaseActivity implements
|
|||||||
|
|
||||||
String fp = data.getStringExtra(ImportKeysProxyActivity.EXTRA_FINGERPRINT);
|
String fp = data.getStringExtra(ImportKeysProxyActivity.EXTRA_FINGERPRINT);
|
||||||
if (fp == null) {
|
if (fp == null) {
|
||||||
Notify.createNotify(this, "Error scanning fingerprint!",
|
Notify.create(this, "Error scanning fingerprint!",
|
||||||
Notify.LENGTH_LONG, Notify.Style.ERROR).show();
|
Notify.LENGTH_LONG, Notify.Style.ERROR).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mFingerprint.equalsIgnoreCase(fp)) {
|
if (mFingerprint.equalsIgnoreCase(fp)) {
|
||||||
certifyImmediate();
|
certifyImmediate();
|
||||||
} else {
|
} else {
|
||||||
Notify.createNotify(this, "Fingerprints did not match!",
|
Notify.create(this, "Fingerprints did not match!",
|
||||||
Notify.LENGTH_LONG, Notify.Style.ERROR).show();
|
Notify.LENGTH_LONG, Notify.Style.ERROR).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -519,7 +519,7 @@ public class ViewKeyActivity extends BaseActivity implements
|
|||||||
private void encrypt(Uri dataUri, boolean text) {
|
private void encrypt(Uri dataUri, boolean text) {
|
||||||
// If there is no encryption key, don't bother.
|
// If there is no encryption key, don't bother.
|
||||||
if (!mHasEncrypt) {
|
if (!mHasEncrypt) {
|
||||||
Notify.showNotify(this, R.string.error_no_encrypt_subkey, Notify.Style.ERROR);
|
Notify.create(this, R.string.error_no_encrypt_subkey, Notify.Style.ERROR).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
@ -199,13 +199,13 @@ public class ViewKeyAdvShareFragment extends LoaderFragment implements
|
|||||||
} else {
|
} else {
|
||||||
message = getResources().getString(R.string.key_copied_to_clipboard);
|
message = getResources().getString(R.string.key_copied_to_clipboard);
|
||||||
}
|
}
|
||||||
Notify.showNotify(getActivity(), message, Notify.Style.OK);
|
Notify.create(getActivity(), message, Notify.Style.OK).show();
|
||||||
} else {
|
} else {
|
||||||
// Android will fail with android.os.TransactionTooLargeException if key is too big
|
// Android will fail with android.os.TransactionTooLargeException if key is too big
|
||||||
// see http://www.lonestarprod.com/?p=34
|
// see http://www.lonestarprod.com/?p=34
|
||||||
if (content.length() >= 86389) {
|
if (content.length() >= 86389) {
|
||||||
Notify.showNotify(getActivity(), R.string.key_too_big_for_sharing,
|
Notify.create(getActivity(), R.string.key_too_big_for_sharing,
|
||||||
Notify.Style.ERROR);
|
Notify.Style.ERROR).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,10 +223,10 @@ public class ViewKeyAdvShareFragment extends LoaderFragment implements
|
|||||||
}
|
}
|
||||||
} catch (PgpGeneralException | IOException e) {
|
} catch (PgpGeneralException | IOException e) {
|
||||||
Log.e(Constants.TAG, "error processing key!", e);
|
Log.e(Constants.TAG, "error processing key!", e);
|
||||||
Notify.showNotify(getActivity(), R.string.error_key_processing, Notify.Style.ERROR);
|
Notify.create(getActivity(), R.string.error_key_processing, Notify.Style.ERROR).show();
|
||||||
} catch (ProviderHelper.NotFoundException e) {
|
} catch (ProviderHelper.NotFoundException e) {
|
||||||
Log.e(Constants.TAG, "key not found!", e);
|
Log.e(Constants.TAG, "key not found!", e);
|
||||||
Notify.showNotify(getActivity(), R.string.error_key_not_found, Notify.Style.ERROR);
|
Notify.create(getActivity(), R.string.error_key_not_found, Notify.Style.ERROR).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ public class FileDialogFragment extends DialogFragment {
|
|||||||
mFile = file;
|
mFile = file;
|
||||||
mFilename.setText(mFile.getName());
|
mFilename.setText(mFile.getName());
|
||||||
} else {
|
} else {
|
||||||
Notify.showNotify(getActivity(), R.string.no_file_selected, Notify.Style.ERROR);
|
Notify.create(getActivity(), R.string.no_file_selected, Notify.Style.ERROR).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,10 +18,7 @@
|
|||||||
package org.sufficientlysecure.keychain.ui.util;
|
package org.sufficientlysecure.keychain.ui.util;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.res.Resources;
|
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.app.FragmentActivity;
|
|
||||||
import android.support.v4.app.FragmentManager;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
@ -40,135 +37,49 @@ import org.sufficientlysecure.keychain.util.FabContainer;
|
|||||||
*/
|
*/
|
||||||
public class Notify {
|
public class Notify {
|
||||||
|
|
||||||
public static enum Style {OK, WARN, INFO, ERROR}
|
public static enum Style {OK, WARN, ERROR}
|
||||||
|
|
||||||
public static final int LENGTH_INDEFINITE = 0;
|
public static final int LENGTH_INDEFINITE = 0;
|
||||||
public static final int LENGTH_LONG = 3500;
|
public static final int LENGTH_LONG = 3500;
|
||||||
|
|
||||||
/**
|
public static Showable create(final Activity activity, String text, int duration, Style style,
|
||||||
* Shows a simple in-layout notification with the CharSequence given as parameter
|
final ActionListener actionListener, int actionResId) {
|
||||||
* @param text Text to show
|
final Snackbar snackbar = Snackbar.with(activity)
|
||||||
* @param style Notification styling
|
.type(SnackbarType.MULTI_LINE)
|
||||||
*/
|
|
||||||
public static void showNotify(final Activity activity, CharSequence text, Style style) {
|
|
||||||
|
|
||||||
Snackbar bar = getSnackbar(activity)
|
|
||||||
.text(text);
|
.text(text);
|
||||||
|
|
||||||
switch (style) {
|
|
||||||
case OK:
|
|
||||||
break;
|
|
||||||
case WARN:
|
|
||||||
bar.textColor(activity.getResources().getColor(R.color.android_orange_light));
|
|
||||||
break;
|
|
||||||
case ERROR:
|
|
||||||
bar.textColor(activity.getResources().getColor(R.color.android_red_light));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
showSnackbar(activity, bar);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Showable createNotify (final Activity activity, int resId, int duration, Style style) {
|
|
||||||
final Snackbar bar = getSnackbar(activity)
|
|
||||||
.text(resId);
|
|
||||||
|
|
||||||
if (duration == LENGTH_INDEFINITE) {
|
if (duration == LENGTH_INDEFINITE) {
|
||||||
bar.duration(SnackbarDuration.LENGTH_INDEFINITE);
|
snackbar.duration(SnackbarDuration.LENGTH_INDEFINITE);
|
||||||
} else {
|
} else {
|
||||||
bar.duration(duration);
|
snackbar.duration(duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (style) {
|
switch (style) {
|
||||||
case OK:
|
case OK:
|
||||||
bar.actionColor(activity.getResources().getColor(R.color.android_green_light));
|
snackbar.actionColorResource(R.color.android_green_light);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WARN:
|
case WARN:
|
||||||
bar.textColor(activity.getResources().getColor(R.color.android_orange_light));
|
snackbar.textColorResource(R.color.android_orange_light);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ERROR:
|
case ERROR:
|
||||||
bar.textColor(activity.getResources().getColor(R.color.android_red_light));
|
snackbar.textColorResource(R.color.android_red_light);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Showable () {
|
if (actionListener != null) {
|
||||||
@Override
|
snackbar.actionLabel(actionResId)
|
||||||
public void show() {
|
.actionListener(new ActionClickListener() {
|
||||||
showSnackbar(activity, bar);
|
@Override
|
||||||
}
|
public void onActionClicked(Snackbar snackbar) {
|
||||||
};
|
actionListener.onAction();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
public static Showable createNotify(Activity activity, int resId, int duration, Style style,
|
|
||||||
final ActionListener listener, int resIdAction) {
|
|
||||||
return createNotify(activity, activity.getString(resId), duration, style, listener, resIdAction);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Showable createNotify(Activity activity, String msg, int duration, Style style) {
|
|
||||||
return createNotify(activity, msg, duration, style, null, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Showable createNotify(final Activity activity, String msg, int duration, Style style,
|
|
||||||
final ActionListener listener, int resIdAction) {
|
|
||||||
|
|
||||||
final Snackbar bar = getSnackbar(activity)
|
|
||||||
.text(msg);
|
|
||||||
|
|
||||||
if (listener != null) {
|
|
||||||
bar.actionLabel(resIdAction);
|
|
||||||
bar.actionListener(new ActionClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onActionClicked(Snackbar snackbar) {
|
|
||||||
listener.onAction();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (duration == LENGTH_INDEFINITE) {
|
|
||||||
bar.duration(SnackbarDuration.LENGTH_INDEFINITE);
|
|
||||||
} else {
|
|
||||||
bar.duration(duration);
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (style) {
|
|
||||||
case OK:
|
|
||||||
bar.actionColor(activity.getResources().getColor(R.color.android_green_light));
|
|
||||||
break;
|
|
||||||
case WARN:
|
|
||||||
bar.textColor(activity.getResources().getColor(R.color.android_orange_light));
|
|
||||||
break;
|
|
||||||
case ERROR:
|
|
||||||
bar.textColor(activity.getResources().getColor(R.color.android_red_light));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Showable () {
|
|
||||||
@Override
|
|
||||||
public void show() {
|
|
||||||
showSnackbar(activity, bar);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Shows a simple in-layout notification with the resource text from given id
|
|
||||||
* @param resId ResourceId of notification text
|
|
||||||
* @param style Notification styling
|
|
||||||
* @throws Resources.NotFoundException
|
|
||||||
*/
|
|
||||||
public static void showNotify(Activity activity, int resId, Style style) throws Resources.NotFoundException {
|
|
||||||
showNotify(activity, activity.getResources().getText(resId), style);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Snackbar getSnackbar(final Activity activity) {
|
|
||||||
Snackbar bar = Snackbar.with(activity)
|
|
||||||
.type(SnackbarType.MULTI_LINE)
|
|
||||||
.duration(SnackbarDuration.LENGTH_LONG);
|
|
||||||
|
|
||||||
if (activity instanceof FabContainer) {
|
if (activity instanceof FabContainer) {
|
||||||
bar.eventListener(new EventListenerAdapter() {
|
snackbar.eventListener(new EventListenerAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void onShow(Snackbar snackbar) {
|
public void onShow(Snackbar snackbar) {
|
||||||
((FabContainer) activity).fabMoveUp(snackbar.getHeight());
|
((FabContainer) activity).fabMoveUp(snackbar.getHeight());
|
||||||
@ -180,37 +91,84 @@ public class Notify {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return bar;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void showSnackbar(Activity activity, Snackbar snackbar) {
|
return new Showable() {
|
||||||
if (activity instanceof FragmentActivity) {
|
@Override
|
||||||
FragmentManager fragmentManager = ((FragmentActivity) activity).getSupportFragmentManager();
|
public void show() {
|
||||||
|
SnackbarManager.show(snackbar, activity);
|
||||||
|
}
|
||||||
|
|
||||||
int count = fragmentManager.getBackStackEntryCount();
|
@Override
|
||||||
Fragment fragment = fragmentManager.getFragments().get(count > 0 ? count - 1 : 0);
|
public void show(Fragment fragment) {
|
||||||
|
if (fragment != null) {
|
||||||
|
View view = fragment.getView();
|
||||||
|
|
||||||
if (fragment != null) {
|
if (view != null && view instanceof ViewGroup) {
|
||||||
View view = fragment.getView();
|
SnackbarManager.show(snackbar, (ViewGroup) view);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (view != null) {
|
show();
|
||||||
SnackbarManager.show(snackbar, (ViewGroup) view);
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void show(ViewGroup viewGroup) {
|
||||||
|
if (viewGroup != null) {
|
||||||
|
SnackbarManager.show(snackbar, viewGroup);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SnackbarManager.show(snackbar);
|
show();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Showable create(Activity activity, String text, int duration, Style style) {
|
||||||
|
return create(activity, text, duration, style, null, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Showable create(Activity activity, String text, Style style) {
|
||||||
|
return create(activity, text, LENGTH_LONG, style);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Showable create(Activity activity, int textResId, int duration, Style style,
|
||||||
|
ActionListener actionListener, int actionResId) {
|
||||||
|
return create(activity, activity.getString(textResId), duration, style, actionListener, actionResId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Showable create(Activity activity, int textResId, int duration, Style style) {
|
||||||
|
return create(activity, activity.getString(textResId), duration, style);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Showable create(Activity activity, int textResId, Style style) {
|
||||||
|
return create(activity, activity.getString(textResId), style);
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface Showable {
|
public interface Showable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shows the notification on the bottom of the Activity.
|
||||||
|
*/
|
||||||
public void show();
|
public void show();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shows the notification on the bottom of the Fragment.
|
||||||
|
*/
|
||||||
|
public void show(Fragment fragment);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shows the notification on the given ViewGroup.
|
||||||
|
* The viewGroup should be either a RelativeLayout or FrameLayout.
|
||||||
|
*/
|
||||||
|
public void show(ViewGroup viewGroup);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface ActionListener {
|
public interface ActionListener {
|
||||||
|
|
||||||
public void onAction();
|
public void onAction();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -159,13 +159,13 @@ public class NfcHelper {
|
|||||||
public void invokeNfcBeam() {
|
public void invokeNfcBeam() {
|
||||||
// Check if device supports NFC
|
// Check if device supports NFC
|
||||||
if (!mActivity.getPackageManager().hasSystemFeature(PackageManager.FEATURE_NFC)) {
|
if (!mActivity.getPackageManager().hasSystemFeature(PackageManager.FEATURE_NFC)) {
|
||||||
Notify.createNotify(mActivity, R.string.no_nfc_support, Notify.LENGTH_LONG, Notify.Style.ERROR).show();
|
Notify.create(mActivity, R.string.no_nfc_support, Notify.LENGTH_LONG, Notify.Style.ERROR).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Check for available NFC Adapter
|
// Check for available NFC Adapter
|
||||||
mNfcAdapter = NfcAdapter.getDefaultAdapter(mActivity);
|
mNfcAdapter = NfcAdapter.getDefaultAdapter(mActivity);
|
||||||
if (mNfcAdapter == null || !mNfcAdapter.isEnabled()) {
|
if (mNfcAdapter == null || !mNfcAdapter.isEnabled()) {
|
||||||
Notify.createNotify(mActivity, R.string.error_nfc_needed, Notify.LENGTH_LONG, Notify.Style.ERROR, new Notify.ActionListener() {
|
Notify.create(mActivity, R.string.error_nfc_needed, Notify.LENGTH_LONG, Notify.Style.ERROR, new Notify.ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onAction() {
|
public void onAction() {
|
||||||
Intent intentSettings = new Intent(Settings.ACTION_NFC_SETTINGS);
|
Intent intentSettings = new Intent(Settings.ACTION_NFC_SETTINGS);
|
||||||
@ -177,7 +177,7 @@ public class NfcHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!mNfcAdapter.isNdefPushEnabled()) {
|
if (!mNfcAdapter.isNdefPushEnabled()) {
|
||||||
Notify.createNotify(mActivity, R.string.error_beam_needed, Notify.LENGTH_LONG, Notify.Style.ERROR, new Notify.ActionListener() {
|
Notify.create(mActivity, R.string.error_beam_needed, Notify.LENGTH_LONG, Notify.Style.ERROR, new Notify.ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onAction() {
|
public void onAction() {
|
||||||
Intent intentSettings = new Intent(Settings.ACTION_NFCSHARING_SETTINGS);
|
Intent intentSettings = new Intent(Settings.ACTION_NFCSHARING_SETTINGS);
|
||||||
@ -208,8 +208,7 @@ public class NfcHelper {
|
|||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
switch (msg.what) {
|
switch (msg.what) {
|
||||||
case NFC_SENT:
|
case NFC_SENT:
|
||||||
Notify.showNotify(
|
Notify.create(activity, R.string.nfc_successful, Notify.Style.OK).show();
|
||||||
activity, R.string.nfc_successful, Notify.Style.INFO);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,18 +50,19 @@
|
|||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@android:color/white" />
|
android:background="@android:color/white" />
|
||||||
|
|
||||||
<LinearLayout
|
<RelativeLayout
|
||||||
android:id="@+id/import_footer"
|
android:id="@+id/import_footer"
|
||||||
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:paddingLeft="16dp"
|
|
||||||
android:paddingRight="16dp"
|
|
||||||
android:background="@android:color/white">
|
android:background="@android:color/white">
|
||||||
|
|
||||||
<View
|
<View
|
||||||
|
android:id="@+id/import_divider"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="1dip"
|
android:layout_height="1dip"
|
||||||
|
android:layout_marginLeft="16dp"
|
||||||
|
android:layout_marginRight="16dp"
|
||||||
android:background="?android:attr/listDivider" />
|
android:background="?android:attr/listDivider" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@ -70,7 +71,10 @@
|
|||||||
android:paddingRight="8dp"
|
android:paddingRight="8dp"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="16dp"
|
||||||
|
android:layout_marginRight="16dp"
|
||||||
|
android:layout_below="@id/import_divider"
|
||||||
android:text="@string/import_import"
|
android:text="@string/import_import"
|
||||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||||
android:drawableRight="@drawable/ic_file_download_grey_24dp"
|
android:drawableRight="@drawable/ic_file_download_grey_24dp"
|
||||||
@ -79,6 +83,12 @@
|
|||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:background="?android:selectableItemBackground" />
|
android:background="?android:selectableItemBackground" />
|
||||||
|
|
||||||
</LinearLayout>
|
<RelativeLayout
|
||||||
|
android:id="@+id/import_snackbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignBottom="@id/import_import" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
2
extern/openpgp-api-lib
vendored
2
extern/openpgp-api-lib
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 9abb91d3a69964a547f26aa1d56de233e75c4410
|
Subproject commit 70a17dcbeb5d8de095f09a7ce756543deff0165a
|
Loading…
Reference in New Issue
Block a user