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

@ -85,11 +85,6 @@
android:configChanges="orientation|screenSize|keyboardHidden|keyboard" android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
android:label="@string/title_wizard" android:label="@string/title_wizard"
android:windowSoftInputMode="stateHidden" /> android:windowSoftInputMode="stateHidden" />
<activity
android:name=".ui.EditKeyActivityOld"
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
android:label="@string/title_edit_key"
android:windowSoftInputMode="stateHidden" />
<activity <activity
android:name=".ui.EditKeyActivity" android:name=".ui.EditKeyActivity"
android:configChanges="orientation|screenSize|keyboardHidden|keyboard" android:configChanges="orientation|screenSize|keyboardHidden|keyboard"

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -52,8 +52,6 @@ import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Button; import android.widget.Button;
import com.devspark.appmsg.AppMsg;
import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.helper.ExportHelper; 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.ui.dialog.DeleteKeyDialogFragment;
import org.sufficientlysecure.keychain.util.Highlighter; import org.sufficientlysecure.keychain.util.Highlighter;
import org.sufficientlysecure.keychain.util.Log; import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Notify;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
@ -104,10 +103,10 @@ public class KeyListFragment extends LoaderFragment
@Override @Override
public void onClick(View v) { public void onClick(View v) {
Intent intent = new Intent(getActivity(), EditKeyActivityOld.class); Intent intent = new Intent(getActivity(), EditKeyActivity.class);
intent.setAction(EditKeyActivityOld.ACTION_CREATE_KEY); intent.setAction(EditKeyActivity.ACTION_CREATE_KEY);
intent.putExtra(EditKeyActivityOld.EXTRA_GENERATE_DEFAULT_KEYS, true); intent.putExtra(EditKeyActivity.EXTRA_GENERATE_DEFAULT_KEYS, true);
intent.putExtra(EditKeyActivityOld.EXTRA_USER_IDS, ""); // show user id view intent.putExtra(EditKeyActivity.EXTRA_USER_IDS, ""); // show user id view
startActivityForResult(intent, 0); startActivityForResult(intent, 0);
} }
}); });
@ -339,8 +338,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) {
AppMsg.makeText(getActivity(), R.string.secret_cannot_multiple, Notify.showNotify(getActivity(), R.string.secret_cannot_multiple,
AppMsg.STYLE_ALERT).show(); Notify.Style.ERROR);
return; return;
} }

View file

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

View file

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

View file

@ -33,8 +33,6 @@ import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import com.devspark.appmsg.AppMsg;
import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.compatibility.ClipboardReflection; 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.ShareNfcDialogFragment;
import org.sufficientlysecure.keychain.ui.dialog.ShareQrCodeDialogFragment; import org.sufficientlysecure.keychain.ui.dialog.ShareQrCodeDialogFragment;
import org.sufficientlysecure.keychain.util.Log; import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Notify;
import org.sufficientlysecure.keychain.util.QrCodeUtils; import org.sufficientlysecure.keychain.util.QrCodeUtils;
import java.io.IOException; import java.io.IOException;
@ -171,13 +170,13 @@ public class ViewKeyShareFragment extends LoaderFragment implements
} else { } else {
message = getResources().getString(R.string.key_copied_to_clipboard); 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 { } 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) {
AppMsg.makeText(getActivity(), R.string.key_too_big_for_sharing, Notify.showNotify(getActivity(), R.string.key_too_big_for_sharing,
AppMsg.STYLE_ALERT).show(); Notify.Style.ERROR);
return; return;
} }
@ -195,13 +194,13 @@ public class ViewKeyShareFragment extends LoaderFragment implements
} }
} catch (PgpGeneralException e) { } catch (PgpGeneralException e) {
Log.e(Constants.TAG, "error processing key!", 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) { } catch (IOException e) {
Log.e(Constants.TAG, "error processing key!", 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) { } catch (ProviderHelper.NotFoundException e) {
Log.e(Constants.TAG, "key not found!", 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.ImageView;
import android.widget.TextView; import android.widget.TextView;
import com.devspark.appmsg.AppMsg;
import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.pgp.PgpKeyHelper; import org.sufficientlysecure.keychain.pgp.PgpKeyHelper;
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings; import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
import org.sufficientlysecure.keychain.provider.ProviderHelper; import org.sufficientlysecure.keychain.provider.ProviderHelper;
import org.sufficientlysecure.keychain.util.Log; import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Notify;
import org.sufficientlysecure.keychain.util.QrCodeUtils; import org.sufficientlysecure.keychain.util.QrCodeUtils;
public class ShareQrCodeDialogFragment extends DialogFragment { public class ShareQrCodeDialogFragment extends DialogFragment {
@ -87,7 +86,7 @@ public class ShareQrCodeDialogFragment extends DialogFragment {
KeyRings.FINGERPRINT, ProviderHelper.FIELD_TYPE_BLOB); 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!");
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; return null;
} }
@ -97,7 +96,7 @@ public class ShareQrCodeDialogFragment extends DialogFragment {
setQrCode(content); setQrCode(content);
} catch (ProviderHelper.NotFoundException e) { } catch (ProviderHelper.NotFoundException e) {
Log.e(Constants.TAG, "key not found!", 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; return null;
} }

View file

@ -29,7 +29,7 @@ import com.github.johnpersano.supertoasts.SuperToast;
*/ */
public class Notify { 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 * Shows a simple in-layout notification with the CharSequence given as parameter

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:bootstrapbutton="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent"> android:layout_height="match_parent">

View file

@ -4,6 +4,12 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" > android:layout_height="match_parent" >
<LinearLayout
android:id="@+id/card_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />
<include layout="@layout/key_list_content"/> <include layout="@layout/key_list_content"/>
<include layout="@layout/drawer_list" /> <include layout="@layout/drawer_list" />

View file

@ -656,6 +656,7 @@
<string name="msg_mf_unlock">Unlocking keyring</string> <string name="msg_mf_unlock">Unlocking keyring</string>
<!-- unsorted --> <!-- unsorted -->
<string name="internal_error">Internal error!</string>
<string name="section_certifier_id">Certifier</string> <string name="section_certifier_id">Certifier</string>
<string name="section_cert">Certificate Details</string> <string name="section_cert">Certificate Details</string>
<string name="label_user_id">Identity</string> <string name="label_user_id">Identity</string>