use SuperToast instead of AppMsg in code, part 1

This commit is contained in:
Vincent Breitmoser
2014-07-07 17:34:41 +02:00
parent d044daeedd
commit 2c62aa90c0
17 changed files with 82 additions and 112 deletions

View File

@@ -25,12 +25,11 @@ import android.os.Message;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import com.devspark.appmsg.AppMsg;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.ui.dialog.ProgressDialogFragment;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Notify;
public class KeychainIntentServiceHandler extends Handler {
@@ -102,9 +101,9 @@ public class KeychainIntentServiceHandler extends Handler {
// show error from service
if (data.containsKey(DATA_ERROR)) {
AppMsg.makeText(mActivity,
Notify.showNotify(mActivity,
mActivity.getString(R.string.error_message, data.getString(DATA_ERROR)),
AppMsg.STYLE_ALERT).show();
Notify.Style.ERROR);
}
break;

View File

@@ -41,8 +41,6 @@ import android.widget.ListView;
import android.widget.Spinner;
import android.widget.TextView;
import com.devspark.appmsg.AppMsg;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.helper.Preferences;
@@ -52,10 +50,12 @@ import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
import org.sufficientlysecure.keychain.provider.KeychainContract.UserIds;
import org.sufficientlysecure.keychain.service.KeychainIntentService;
import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler;
import org.sufficientlysecure.keychain.service.OperationResultParcel;
import org.sufficientlysecure.keychain.service.PassphraseCacheService;
import org.sufficientlysecure.keychain.ui.adapter.UserIdsAdapter;
import org.sufficientlysecure.keychain.ui.dialog.PassphraseDialogFragment;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Notify;
import java.util.ArrayList;
@@ -246,8 +246,8 @@ public class CertifyKeyActivity extends ActionBarActivity implements
// Bail out if there is not at least one user id selected
ArrayList<String> userIds = mUserIdsAdapter.getSelectedUserIds();
if (userIds.isEmpty()) {
AppMsg.makeText(CertifyKeyActivity.this, "No User IDs to sign selected!",
AppMsg.STYLE_ALERT).show();
Notify.showNotify(CertifyKeyActivity.this, "No Notify.Style IDs to sign selected!",
Notify.Style.ERROR);
return;
}
@@ -274,8 +274,8 @@ public class CertifyKeyActivity extends ActionBarActivity implements
if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) {
AppMsg.makeText(CertifyKeyActivity.this, R.string.key_certify_success,
AppMsg.STYLE_INFO).show();
Notify.showNotify(CertifyKeyActivity.this, R.string.key_certify_success,
Notify.Style.INFO);
// check if we need to send the key to the server or not
if (mUploadKeyCheckbox.isChecked()) {
@@ -327,8 +327,10 @@ public class CertifyKeyActivity extends ActionBarActivity implements
super.handleMessage(message);
if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) {
AppMsg.makeText(CertifyKeyActivity.this, R.string.key_send_success,
AppMsg.STYLE_INFO).show();
Intent intent = new Intent();
intent.putExtra(OperationResultParcel.EXTRA_RESULT, message.getData());
Notify.showNotify(CertifyKeyActivity.this, R.string.key_send_success,
Notify.Style.INFO);
setResult(RESULT_OK);
finish();

View File

@@ -34,8 +34,6 @@ import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageButton;
import com.devspark.appmsg.AppMsg;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.helper.FileHelper;
@@ -129,7 +127,6 @@ public class DecryptFileFragment extends DecryptFragment {
}
if (mInputFilename.equals("")) {
//AppMsg.makeText(getActivity(), R.string.no_file_selected, AppMsg.STYLE_ALERT).show();
Notify.showNotify(getActivity(), R.string.no_file_selected, Notify.Style.ERROR);
return;
}
@@ -137,11 +134,8 @@ public class DecryptFileFragment extends DecryptFragment {
if (mInputUri == null && mInputFilename.startsWith("file")) {
File file = new File(mInputFilename);
if (!file.exists() || !file.isFile()) {
AppMsg.makeText(
getActivity(),
getString(R.string.error_message,
getString(R.string.error_file_not_found)), AppMsg.STYLE_ALERT)
.show();
Notify.showNotify(getActivity(), getString(R.string.error_message,
getString(R.string.error_file_not_found)), Notify.Style.ERROR);
return;
}
}

View File

@@ -28,8 +28,6 @@ import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.EditText;
import com.devspark.appmsg.AppMsg;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.compatibility.ClipboardReflection;
@@ -38,6 +36,7 @@ import org.sufficientlysecure.keychain.pgp.PgpHelper;
import org.sufficientlysecure.keychain.service.KeychainIntentService;
import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Notify;
import java.util.regex.Matcher;
@@ -107,12 +106,10 @@ public class DecryptMessageFragment extends DecryptFragment {
mCiphertext = matcher.group(1);
decryptStart(null);
} else {
AppMsg.makeText(getActivity(), R.string.error_invalid_data, AppMsg.STYLE_ALERT)
.show();
Notify.showNotify(getActivity(), R.string.error_invalid_data, Notify.Style.ERROR);
}
} else {
AppMsg.makeText(getActivity(), R.string.error_invalid_data, AppMsg.STYLE_ALERT)
.show();
Notify.showNotify(getActivity(), R.string.error_invalid_data, Notify.Style.ERROR);
}
}

View File

@@ -37,8 +37,6 @@ import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.Spinner;
import com.devspark.appmsg.AppMsg;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.helper.FileHelper;
@@ -51,6 +49,7 @@ import org.sufficientlysecure.keychain.ui.dialog.FileDialogFragment;
import org.sufficientlysecure.keychain.ui.dialog.PassphraseDialogFragment;
import org.sufficientlysecure.keychain.util.Choice;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Notify;
import java.io.File;
@@ -218,18 +217,18 @@ public class EncryptFileFragment extends Fragment {
}
if (mInputFilename.equals("")) {
AppMsg.makeText(getActivity(), R.string.no_file_selected, AppMsg.STYLE_ALERT).show();
Notify.showNotify(getActivity(), R.string.no_file_selected, Notify.Style.ERROR);
return;
}
if (mInputUri == null && !mInputFilename.startsWith("content")) {
File file = new File(mInputFilename);
if (!file.exists() || !file.isFile()) {
AppMsg.makeText(
Notify.showNotify(
getActivity(),
getString(R.string.error_message,
getString(R.string.error_file_not_found)), AppMsg.STYLE_ALERT)
.show();
getString(R.string.error_file_not_found)), Notify.Style.ERROR
);
return;
}
}
@@ -240,13 +239,13 @@ public class EncryptFileFragment extends Fragment {
boolean gotPassphrase = (mEncryptInterface.getPassphrase() != null
&& mEncryptInterface.getPassphrase().length() != 0);
if (!gotPassphrase) {
AppMsg.makeText(getActivity(), R.string.passphrase_must_not_be_empty, AppMsg.STYLE_ALERT)
.show();
Notify.showNotify(getActivity(), R.string.passphrase_must_not_be_empty, Notify.Style.ERROR)
;
return;
}
if (!mEncryptInterface.getPassphrase().equals(mEncryptInterface.getPassphraseAgain())) {
AppMsg.makeText(getActivity(), R.string.passphrases_do_not_match, AppMsg.STYLE_ALERT).show();
Notify.showNotify(getActivity(), R.string.passphrases_do_not_match, Notify.Style.ERROR);
return;
}
} else {
@@ -256,13 +255,13 @@ public class EncryptFileFragment extends Fragment {
&& mEncryptInterface.getEncryptionKeys().length > 0);
if (!gotEncryptionKeys) {
AppMsg.makeText(getActivity(), R.string.select_encryption_key, AppMsg.STYLE_ALERT).show();
Notify.showNotify(getActivity(), R.string.select_encryption_key, Notify.Style.ERROR);
return;
}
if (!gotEncryptionKeys && mEncryptInterface.getSignatureKey() == 0) {
AppMsg.makeText(getActivity(), R.string.select_encryption_or_signature_key,
AppMsg.STYLE_ALERT).show();
Notify.showNotify(getActivity(), R.string.select_encryption_or_signature_key,
Notify.Style.ERROR);
return;
}
@@ -345,8 +344,8 @@ public class EncryptFileFragment extends Fragment {
super.handleMessage(message);
if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) {
AppMsg.makeText(getActivity(), R.string.encrypt_sign_successful,
AppMsg.STYLE_INFO).show();
Notify.showNotify(getActivity(), R.string.encrypt_sign_successful,
Notify.Style.INFO);
if (mDeleteAfter.isChecked()) {
// Create and show dialog to delete original file

View File

@@ -30,8 +30,6 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.devspark.appmsg.AppMsg;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.compatibility.ClipboardReflection;
@@ -41,6 +39,7 @@ import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler;
import org.sufficientlysecure.keychain.service.PassphraseCacheService;
import org.sufficientlysecure.keychain.ui.dialog.PassphraseDialogFragment;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Notify;
public class EncryptMessageFragment extends Fragment {
public static final String ARG_TEXT = "text";
@@ -126,13 +125,12 @@ public class EncryptMessageFragment extends Fragment {
boolean gotPassphrase = (mEncryptInterface.getPassphrase() != null
&& mEncryptInterface.getPassphrase().length() != 0);
if (!gotPassphrase) {
AppMsg.makeText(getActivity(), R.string.passphrase_must_not_be_empty, AppMsg.STYLE_ALERT)
.show();
Notify.showNotify(getActivity(), R.string.passphrase_must_not_be_empty, Notify.Style.ERROR);
return;
}
if (!mEncryptInterface.getPassphrase().equals(mEncryptInterface.getPassphraseAgain())) {
AppMsg.makeText(getActivity(), R.string.passphrases_do_not_match, AppMsg.STYLE_ALERT).show();
Notify.showNotify(getActivity(), R.string.passphrases_do_not_match, Notify.Style.ERROR);
return;
}
@@ -143,8 +141,8 @@ public class EncryptMessageFragment extends Fragment {
&& mEncryptInterface.getEncryptionKeys().length > 0);
if (!gotEncryptionKeys && mEncryptInterface.getSignatureKey() == 0) {
AppMsg.makeText(getActivity(), R.string.select_encryption_or_signature_key,
AppMsg.STYLE_ALERT).show();
Notify.showNotify(getActivity(), R.string.select_encryption_or_signature_key,
Notify.Style.ERROR);
return;
}
@@ -226,9 +224,8 @@ public class EncryptMessageFragment extends Fragment {
if (toClipboard) {
ClipboardReflection.copyToClipboard(getActivity(), output);
AppMsg.makeText(getActivity(),
R.string.encrypt_sign_clipboard_successful, AppMsg.STYLE_INFO)
.show();
Notify.showNotify(getActivity(),
R.string.encrypt_sign_clipboard_successful, Notify.Style.INFO);
} else {
Intent sendIntent = new Intent(Intent.ACTION_SEND);

View File

@@ -25,15 +25,11 @@ import android.os.Messenger;
import android.view.Menu;
import android.view.MenuItem;
import com.devspark.appmsg.AppMsg;
import org.spongycastle.bcpg.sig.KeyFlags;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.Constants.choice.algorithm;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.helper.ExportHelper;
import org.sufficientlysecure.keychain.helper.OtherHelper;
import org.sufficientlysecure.keychain.keyimport.ImportKeysListEntry;
import org.sufficientlysecure.keychain.provider.KeychainContract;
import org.sufficientlysecure.keychain.provider.KeychainDatabase;
import org.sufficientlysecure.keychain.service.KeychainIntentService;
@@ -41,9 +37,9 @@ import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler;
import org.sufficientlysecure.keychain.service.SaveKeyringParcel;
import org.sufficientlysecure.keychain.service.SaveKeyringParcel.SubkeyAdd;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Notify;
import java.io.IOException;
import java.util.ArrayList;
public class KeyListActivity extends DrawerActivity {
@@ -96,21 +92,21 @@ public class KeyListActivity extends DrawerActivity {
case R.id.menu_key_list_debug_read:
try {
KeychainDatabase.debugRead(this);
AppMsg.makeText(this, "Restored from backup", AppMsg.STYLE_CONFIRM).show();
Notify.showNotify(this, "Restored Notify.Style backup", Notify.Style.INFO);
getContentResolver().notifyChange(KeychainContract.KeyRings.CONTENT_URI, null);
} catch(IOException e) {
Log.e(Constants.TAG, "IO Error", e);
AppMsg.makeText(this, "IO Error: " + e.getMessage(), AppMsg.STYLE_ALERT).show();
Notify.showNotify(this, "IO Notify.Style: " + e.getMessage(), Notify.Style.ERROR);
}
return true;
case R.id.menu_key_list_debug_write:
try {
KeychainDatabase.debugWrite(this);
AppMsg.makeText(this, "Backup successful", AppMsg.STYLE_CONFIRM).show();
Notify.showNotify(this, "Backup Notify.Style", Notify.Style.INFO);
} catch(IOException e) {
Log.e(Constants.TAG, "IO Error", e);
AppMsg.makeText(this, "IO Error: " + e.getMessage(), AppMsg.STYLE_ALERT).show();
Notify.showNotify(this, "IO Notify.Style: " + e.getMessage(), Notify.Style.ERROR);
}
return true;
@@ -171,4 +167,4 @@ public class KeyListActivity extends DrawerActivity {
startService(intent);
}
}
}

View File

@@ -52,8 +52,6 @@ import android.widget.ListView;
import android.widget.TextView;
import android.widget.Button;
import com.devspark.appmsg.AppMsg;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.helper.ExportHelper;
@@ -62,6 +60,7 @@ import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
import org.sufficientlysecure.keychain.ui.dialog.DeleteKeyDialogFragment;
import org.sufficientlysecure.keychain.util.Highlighter;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Notify;
import java.util.Date;
import java.util.HashMap;
@@ -104,10 +103,10 @@ public class KeyListFragment extends LoaderFragment
@Override
public void onClick(View v) {
Intent intent = new Intent(getActivity(), EditKeyActivityOld.class);
intent.setAction(EditKeyActivityOld.ACTION_CREATE_KEY);
intent.putExtra(EditKeyActivityOld.EXTRA_GENERATE_DEFAULT_KEYS, true);
intent.putExtra(EditKeyActivityOld.EXTRA_USER_IDS, ""); // show user id view
Intent intent = new Intent(getActivity(), EditKeyActivity.class);
intent.setAction(EditKeyActivity.ACTION_CREATE_KEY);
intent.putExtra(EditKeyActivity.EXTRA_GENERATE_DEFAULT_KEYS, true);
intent.putExtra(EditKeyActivity.EXTRA_USER_IDS, ""); // show user id view
startActivityForResult(intent, 0);
}
});
@@ -339,8 +338,8 @@ public class KeyListFragment extends LoaderFragment
public void showDeleteKeyDialog(final ActionMode mode, long[] masterKeyIds, boolean hasSecret) {
// Can only work on singular secret keys
if(hasSecret && masterKeyIds.length > 1) {
AppMsg.makeText(getActivity(), R.string.secret_cannot_multiple,
AppMsg.STYLE_ALERT).show();
Notify.showNotify(getActivity(), R.string.secret_cannot_multiple,
Notify.Style.ERROR);
return;
}

View File

@@ -44,8 +44,6 @@ import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import com.devspark.appmsg.AppMsg;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.helper.ContactHelper;
@@ -54,11 +52,13 @@ import org.sufficientlysecure.keychain.pgp.KeyRing;
import org.sufficientlysecure.keychain.pgp.PgpKeyHelper;
import org.sufficientlysecure.keychain.provider.KeychainContract;
import org.sufficientlysecure.keychain.provider.ProviderHelper;
import org.sufficientlysecure.keychain.service.OperationResultParcel;
import org.sufficientlysecure.keychain.service.OperationResults.ImportResult;
import org.sufficientlysecure.keychain.ui.adapter.PagerTabStripAdapter;
import org.sufficientlysecure.keychain.ui.widget.SlidingTabLayout.TabColorizer;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.ui.widget.SlidingTabLayout;
import org.sufficientlysecure.keychain.util.Notify;
import java.util.Date;
import java.util.HashMap;
@@ -295,7 +295,7 @@ public class ViewKeyActivity extends ActionBarActivity implements
}
}
} catch (ProviderHelper.NotFoundException e) {
AppMsg.makeText(this, R.string.error_key_not_found, AppMsg.STYLE_ALERT).show();
Notify.showNotify(this, R.string.error_key_not_found, Notify.Style.ERROR);
Log.e(Constants.TAG, "Key not found", e);
}
return super.onOptionsItemSelected(item);
@@ -352,22 +352,11 @@ public class ViewKeyActivity extends ActionBarActivity implements
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case REQUEST_CODE_LOOKUP_KEY: {
if (resultCode == Activity.RESULT_OK) {
ImportResult result = data.getParcelableExtra(ImportKeysActivity.EXTRA_RESULT);
if (result != null) {
result.displayNotify(this);
}
}
break;
}
default: {
super.onActivityResult(requestCode, resultCode, data);
break;
}
if (data.hasExtra(OperationResultParcel.EXTRA_RESULT)) {
OperationResultParcel result = data.getParcelableExtra(OperationResultParcel.EXTRA_RESULT);
result.createNotify(this).show();
} else {
super.onActivityResult(requestCode, resultCode, data);
}
}
@@ -455,8 +444,8 @@ public class ViewKeyActivity extends ActionBarActivity implements
public void handleMessage(Message msg) {
switch (msg.what) {
case NFC_SENT:
AppMsg.makeText(ViewKeyActivity.this, R.string.nfc_successful,
AppMsg.STYLE_INFO).show();
Notify.showNotify(
ViewKeyActivity.this, R.string.nfc_successful, Notify.Style.INFO);
break;
}
}

View File

@@ -29,8 +29,6 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import com.devspark.appmsg.AppMsg;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
@@ -40,6 +38,7 @@ import org.sufficientlysecure.keychain.provider.KeychainContract.UserIds;
import org.sufficientlysecure.keychain.provider.ProviderHelper;
import org.sufficientlysecure.keychain.ui.adapter.UserIdsAdapter;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Notify;
import java.util.Date;
@@ -225,7 +224,7 @@ public class ViewKeyMainFragment extends LoaderFragment implements
private void encrypt(Uri dataUri) {
// If there is no encryption key, don't bother.
if (!mHasEncrypt) {
AppMsg.makeText(getActivity(), R.string.error_no_encrypt_subkey, AppMsg.STYLE_ALERT).show();
Notify.showNotify(getActivity(), R.string.error_no_encrypt_subkey, Notify.Style.ERROR);
return;
}
try {
@@ -246,7 +245,7 @@ public class ViewKeyMainFragment extends LoaderFragment implements
private void certify(Uri dataUri) {
Intent signIntent = new Intent(getActivity(), CertifyKeyActivity.class);
signIntent.setData(dataUri);
startActivity(signIntent);
startActivityForResult(signIntent, 0);
}
private void editKey(Uri dataUri) {

View File

@@ -33,8 +33,6 @@ import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.devspark.appmsg.AppMsg;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.compatibility.ClipboardReflection;
@@ -47,6 +45,7 @@ import org.sufficientlysecure.keychain.provider.ProviderHelper;
import org.sufficientlysecure.keychain.ui.dialog.ShareNfcDialogFragment;
import org.sufficientlysecure.keychain.ui.dialog.ShareQrCodeDialogFragment;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Notify;
import org.sufficientlysecure.keychain.util.QrCodeUtils;
import java.io.IOException;
@@ -171,13 +170,13 @@ public class ViewKeyShareFragment extends LoaderFragment implements
} else {
message = getResources().getString(R.string.key_copied_to_clipboard);
}
AppMsg.makeText(getActivity(), message, AppMsg.STYLE_INFO).show();
Notify.showNotify(getActivity(), message, Notify.Style.OK);
} else {
// Android will fail with android.os.TransactionTooLargeException if key is too big
// see http://www.lonestarprod.com/?p=34
if (content.length() >= 86389) {
AppMsg.makeText(getActivity(), R.string.key_too_big_for_sharing,
AppMsg.STYLE_ALERT).show();
Notify.showNotify(getActivity(), R.string.key_too_big_for_sharing,
Notify.Style.ERROR);
return;
}
@@ -195,13 +194,13 @@ public class ViewKeyShareFragment extends LoaderFragment implements
}
} catch (PgpGeneralException e) {
Log.e(Constants.TAG, "error processing key!", e);
AppMsg.makeText(getActivity(), R.string.error_key_processing, AppMsg.STYLE_ALERT).show();
Notify.showNotify(getActivity(), R.string.error_key_processing, Notify.Style.ERROR);
} catch (IOException e) {
Log.e(Constants.TAG, "error processing key!", e);
AppMsg.makeText(getActivity(), R.string.error_key_processing, AppMsg.STYLE_ALERT).show();
Notify.showNotify(getActivity(), R.string.error_key_processing, Notify.Style.ERROR);
} catch (ProviderHelper.NotFoundException e) {
Log.e(Constants.TAG, "key not found!", e);
AppMsg.makeText(getActivity(), R.string.error_key_not_found, AppMsg.STYLE_ALERT).show();
Notify.showNotify(getActivity(), R.string.error_key_not_found, Notify.Style.ERROR);
}
}

View File

@@ -27,14 +27,13 @@ import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.devspark.appmsg.AppMsg;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.pgp.PgpKeyHelper;
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
import org.sufficientlysecure.keychain.provider.ProviderHelper;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Notify;
import org.sufficientlysecure.keychain.util.QrCodeUtils;
public class ShareQrCodeDialogFragment extends DialogFragment {
@@ -87,7 +86,7 @@ public class ShareQrCodeDialogFragment extends DialogFragment {
KeyRings.FINGERPRINT, ProviderHelper.FIELD_TYPE_BLOB);
if (blob == null) {
Log.e(Constants.TAG, "key not found!");
AppMsg.makeText(getActivity(), R.string.error_key_not_found, AppMsg.STYLE_ALERT).show();
Notify.showNotify(getActivity(), R.string.error_key_not_found, Notify.Style.ERROR);
return null;
}
@@ -97,7 +96,7 @@ public class ShareQrCodeDialogFragment extends DialogFragment {
setQrCode(content);
} catch (ProviderHelper.NotFoundException e) {
Log.e(Constants.TAG, "key not found!", e);
AppMsg.makeText(getActivity(), R.string.error_key_not_found, AppMsg.STYLE_ALERT).show();
Notify.showNotify(getActivity(), R.string.error_key_not_found, Notify.Style.ERROR);
return null;
}

View File

@@ -29,7 +29,7 @@ import com.github.johnpersano.supertoasts.SuperToast;
*/
public class Notify {
public static enum Style {OK, WARN, ERROR}
public static enum Style {OK, WARN, INFO, ERROR}
/**
* Shows a simple in-layout notification with the CharSequence given as parameter