Fix merge

This commit is contained in:
mar-v-in 2014-07-31 23:20:43 +02:00
parent eae7c711a3
commit 36d8c9f608
4 changed files with 21 additions and 37 deletions

View File

@ -30,7 +30,6 @@ import android.support.v4.view.PagerTabStrip;
import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
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;
@ -43,6 +42,7 @@ import org.sufficientlysecure.keychain.ui.adapter.PagerTabStripAdapter;
import org.sufficientlysecure.keychain.ui.dialog.DeleteFileDialogFragment; import org.sufficientlysecure.keychain.ui.dialog.DeleteFileDialogFragment;
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;
import java.util.HashSet; import java.util.HashSet;
@ -94,7 +94,7 @@ public class EncryptActivity extends DrawerActivity implements EncryptActivityIn
private boolean mShareAfterEncrypt = false; private boolean mShareAfterEncrypt = false;
private ArrayList<Uri> mInputUris; private ArrayList<Uri> mInputUris;
private ArrayList<Uri> mOutputUris; private ArrayList<Uri> mOutputUris;
private String mMessage; private String mMessage = "";
public boolean isModeSymmetric() { public boolean isModeSymmetric() {
return PAGER_MODE_SYMMETRIC == mViewPagerMode.getCurrentItem(); return PAGER_MODE_SYMMETRIC == mViewPagerMode.getCurrentItem();
@ -198,7 +198,7 @@ public class EncryptActivity extends DrawerActivity implements EncryptActivityIn
public void startEncrypt() { public void startEncrypt() {
if (!inputIsValid()) { if (!inputIsValid()) {
// AppMsg was created by inputIsValid. // Notify was created by inputIsValid.
return; return;
} }
@ -215,7 +215,7 @@ public class EncryptActivity extends DrawerActivity implements EncryptActivityIn
super.handleMessage(message); super.handleMessage(message);
if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) { if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) {
AppMsg.makeText(EncryptActivity.this, R.string.encrypt_sign_successful, AppMsg.STYLE_INFO).show(); Notify.showNotify(EncryptActivity.this, R.string.encrypt_sign_successful, Notify.Style.INFO);
if (!isContentMessage() && mDeleteAfterEncrypt) { if (!isContentMessage() && mDeleteAfterEncrypt) {
// TODO: Create and show dialog to delete original file // TODO: Create and show dialog to delete original file
@ -233,8 +233,8 @@ public class EncryptActivity extends DrawerActivity implements EncryptActivityIn
} else if (isContentMessage()) { } else if (isContentMessage()) {
// Copy to clipboard // Copy to clipboard
copyToClipboard(message); copyToClipboard(message);
AppMsg.makeText(EncryptActivity.this, Notify.showNotify(EncryptActivity.this,
R.string.encrypt_sign_clipboard_successful, AppMsg.STYLE_INFO).show(); R.string.encrypt_sign_clipboard_successful, Notify.Style.INFO);
} }
} }
} }
@ -322,11 +322,16 @@ public class EncryptActivity extends DrawerActivity implements EncryptActivityIn
} }
private boolean inputIsValid() { private boolean inputIsValid() {
if (!isContentMessage()) { if (isContentMessage()) {
if (mMessage == null) {
Notify.showNotify(this, R.string.error_message, Notify.Style.ERROR);
return false;
}
} else {
// file checks // file checks
if (mInputUris.isEmpty()) { if (mInputUris.isEmpty()) {
AppMsg.makeText(this, R.string.no_file_selected, AppMsg.STYLE_ALERT).show(); Notify.showNotify(this, R.string.no_file_selected, Notify.Style.ERROR);
return false; return false;
} else if (mInputUris.size() > 1 && !mShareAfterEncrypt) { } else if (mInputUris.size() > 1 && !mShareAfterEncrypt) {
// This should be impossible... // This should be impossible...
@ -342,11 +347,11 @@ public class EncryptActivity extends DrawerActivity implements EncryptActivityIn
if (mPassphrase == null) { if (mPassphrase == null) {
AppMsg.makeText(this, R.string.passphrases_do_not_match, AppMsg.STYLE_ALERT).show(); Notify.showNotify(this, R.string.passphrases_do_not_match, Notify.Style.ERROR);
return false; return false;
} }
if (mPassphrase.isEmpty()) { if (mPassphrase.isEmpty()) {
AppMsg.makeText(this, R.string.passphrase_must_not_be_empty, AppMsg.STYLE_ALERT).show(); Notify.showNotify(this, R.string.passphrase_must_not_be_empty, Notify.Style.ERROR);
return false; return false;
} }
@ -358,13 +363,12 @@ public class EncryptActivity extends DrawerActivity implements EncryptActivityIn
// 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 && !isContentMessage()) { if (!gotEncryptionKeys && !isContentMessage()) {
AppMsg.makeText(this, R.string.select_encryption_key, AppMsg.STYLE_ALERT).show(); Notify.showNotify(this, R.string.select_encryption_key, Notify.Style.ERROR);
return false; return false;
} }
if (!gotEncryptionKeys && mSigningKeyId == 0) { if (!gotEncryptionKeys && mSigningKeyId == 0) {
AppMsg.makeText(this, R.string.select_encryption_or_signature_key, Notify.showNotify(this, R.string.select_encryption_or_signature_key, Notify.Style.ERROR);
AppMsg.STYLE_ALERT).show();
return false; return false;
} }

View File

@ -18,12 +18,7 @@
package org.sufficientlysecure.keychain.ui; package org.sufficientlysecure.keychain.ui;
import android.app.Activity; import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.Messenger;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.text.Editable; import android.text.Editable;
import android.text.TextWatcher; import android.text.TextWatcher;
@ -31,23 +26,7 @@ import android.view.LayoutInflater;
import android.view.View; 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.R; import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.compatibility.ClipboardReflection;
import org.sufficientlysecure.keychain.helper.Preferences;
import org.sufficientlysecure.keychain.pgp.KeyRing;
import org.sufficientlysecure.keychain.service.KeychainIntentService;
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 java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
public class EncryptMessageFragment extends Fragment { public class EncryptMessageFragment extends Fragment {
public static final String ARG_TEXT = "text"; public static final String ARG_TEXT = "text";

View File

@ -18,7 +18,6 @@
package org.sufficientlysecure.keychain.ui.dialog; package org.sufficientlysecure.keychain.ui.dialog;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
@ -35,11 +34,11 @@ import android.widget.CheckBox;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageButton; import android.widget.ImageButton;
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.FileHelper; import org.sufficientlysecure.keychain.helper.FileHelper;
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;
@ -190,7 +189,7 @@ public class FileDialogFragment extends DialogFragment {
mFile = file; mFile = file;
mFilename.setText(mFile.getName()); mFilename.setText(mFile.getName());
} else { } else {
AppMsg.makeText(getActivity(), R.string.no_file_selected, AppMsg.STYLE_ALERT).show(); Notify.showNotify(getActivity(), R.string.no_file_selected, Notify.Style.ERROR);
} }
} }

View File

@ -7,6 +7,8 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<include layout="@layout/notify_area"/>
<org.sufficientlysecure.keychain.ui.widget.NoSwipeWrapContentViewPager <org.sufficientlysecure.keychain.ui.widget.NoSwipeWrapContentViewPager
android:id="@+id/encrypt_pager_mode" android:id="@+id/encrypt_pager_mode"
android:layout_width="match_parent" android:layout_width="match_parent"