diff options
Diffstat (limited to 'OpenKeychain')
16 files changed, 140 insertions, 172 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/BaseActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/BaseActivity.java index e6c2542a2..41fa50705 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/BaseActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/BaseActivity.java @@ -88,12 +88,20 @@ public abstract class BaseActivity extends ActionBarActivity { /** * Close button only */ - protected void setFullScreenDialogClose(View.OnClickListener cancelOnClickListener) { - setActionBarIcon(R.drawable.ic_close_white_24dp); + protected void setFullScreenDialogClose(View.OnClickListener cancelOnClickListener, boolean white) { + if (white) { + setActionBarIcon(R.drawable.ic_close_white_24dp); + } else { + setActionBarIcon(R.drawable.ic_close_black_24dp); + } getSupportActionBar().setDisplayShowTitleEnabled(true); mToolbar.setNavigationOnClickListener(cancelOnClickListener); } + protected void setFullScreenDialogClose(View.OnClickListener cancelOnClickListener) { + setFullScreenDialogClose(cancelOnClickListener, true); + } + /** * Inflate custom design with two buttons using drawables. * This does not conform to the Material Design Guidelines, but we deviate here as this is used diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFilesActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFilesActivity.java index 89dd4970b..162b10eca 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFilesActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFilesActivity.java @@ -17,9 +17,12 @@ package org.sufficientlysecure.keychain.ui; +import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; +import android.os.PersistableBundle; +import android.view.View; import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.R; @@ -40,6 +43,14 @@ public class DecryptFilesActivity extends BaseActivity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + setFullScreenDialogClose(new View.OnClickListener() { + @Override + public void onClick(View v) { + setResult(Activity.RESULT_CANCELED); + finish(); + } + }, false); + // Handle intent actions handleActions(savedInstanceState, getIntent()); } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptTextActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptTextActivity.java index 81a8a2ac4..1e9e7bcb1 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptTextActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptTextActivity.java @@ -18,9 +18,11 @@ package org.sufficientlysecure.keychain.ui; +import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.text.TextUtils; +import android.view.View; import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.R; @@ -49,6 +51,14 @@ public class DecryptTextActivity extends BaseActivity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + setFullScreenDialogClose(new View.OnClickListener() { + @Override + public void onClick(View v) { + setResult(Activity.RESULT_CANCELED); + finish(); + } + }, false); + // Handle intent actions handleActions(savedInstanceState, getIntent()); } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java index 0d7e6056e..c595cc5b8 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java @@ -1,10 +1,30 @@ +/* + * Copyright (C) 2014 Dominik Schürmann <dominik@dominikschuermann.de> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + package org.sufficientlysecure.keychain.ui; +import android.app.Activity; import android.app.ProgressDialog; import android.content.Intent; import android.os.Bundle; import android.os.Message; import android.os.Messenger; +import android.os.PersistableBundle; +import android.view.View; import org.openintents.openpgp.util.OpenPgpApi; import org.sufficientlysecure.keychain.R; @@ -26,6 +46,19 @@ public abstract class EncryptActivity extends BaseActivity { protected Date mNfcTimestamp = null; protected byte[] mNfcHash = null; + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + setFullScreenDialogClose(new View.OnClickListener() { + @Override + public void onClick(View v) { + setResult(Activity.RESULT_CANCELED); + finish(); + } + }, false); + } + protected void startPassphraseDialog(long subkeyId) { Intent intent = new Intent(this, PassphraseDialogActivity.class); intent.putExtra(PassphraseDialogActivity.EXTRA_SUBKEY_ID, subkeyId); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesActivity.java index 11b596c24..eba19df6d 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesActivity.java @@ -314,15 +314,6 @@ public class EncryptFilesActivity extends EncryptActivity implements EncryptActi public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - // if called with an intent action, do not init drawer navigation - if (ACTION_ENCRYPT_DATA.equals(getIntent().getAction())) { - // lock drawer -// deactivateDrawerNavigation(); - // TODO: back button to key? - } else { -// activateDrawerNavigation(savedInstanceState); - } - // Handle intent actions handleActions(getIntent()); updateModeFragment(); @@ -339,17 +330,6 @@ public class EncryptFilesActivity extends EncryptActivity implements EncryptActi return super.onCreateOptionsMenu(menu); } - private void updateModeFragment() { - getSupportFragmentManager().beginTransaction() - .replace(R.id.encrypt_pager_mode, - mCurrentMode == MODE_SYMMETRIC - ? new EncryptSymmetricFragment() - : new EncryptAsymmetricFragment() - ) - .commitAllowingStateLoss(); - getSupportFragmentManager().executePendingTransactions(); - } - @Override public boolean onOptionsItemSelected(MenuItem item) { if (item.isCheckable()) { @@ -384,6 +364,17 @@ public class EncryptFilesActivity extends EncryptActivity implements EncryptActi return true; } + private void updateModeFragment() { + getSupportFragmentManager().beginTransaction() + .replace(R.id.encrypt_pager_mode, + mCurrentMode == MODE_SYMMETRIC + ? new EncryptSymmetricFragment() + : new EncryptAsymmetricFragment() + ) + .commitAllowingStateLoss(); + getSupportFragmentManager().executePendingTransactions(); + } + /** * Handles all actions with this intent * @@ -428,7 +419,6 @@ public class EncryptFilesActivity extends EncryptActivity implements EncryptActi // Save uris mInputUris = uris; - } } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesFragment.java index 860bd8502..ace58b165 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesFragment.java @@ -27,6 +27,7 @@ import android.os.Build; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; +import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; @@ -56,7 +57,6 @@ public class EncryptFilesFragment extends Fragment implements EncryptActivityInt // view private View mAddView; - private View mShareFile; private ListView mSelectedFiles; private SelectedFilesAdapter mAdapter = new SelectedFilesAdapter(); private final Map<Uri, Bitmap> thumbnailCache = new HashMap<>(); @@ -78,21 +78,6 @@ public class EncryptFilesFragment extends Fragment implements EncryptActivityInt public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.encrypt_files_fragment, container, false); - View vEncryptFile = view.findViewById(R.id.action_encrypt_file); - vEncryptFile.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - encryptClicked(false); - } - }); - mShareFile = view.findViewById(R.id.action_encrypt_share); - mShareFile.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - encryptClicked(true); - } - }); - mAddView = inflater.inflate(R.layout.file_list_entry_add, null); mAddView.setOnClickListener(new View.OnClickListener() { @Override @@ -108,8 +93,10 @@ public class EncryptFilesFragment extends Fragment implements EncryptActivityInt } @Override - public void onActivityCreated(Bundle savedInstanceState) { - super.onActivityCreated(savedInstanceState); + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + setHasOptionsMenu(true); } private void addInputUri() { @@ -192,6 +179,24 @@ public class EncryptFilesFragment extends Fragment implements EncryptActivityInt } @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case R.id.encrypt_save: { + encryptClicked(false); + break; + } + case R.id.encrypt_share: { + encryptClicked(true); + break; + } + default: { + return super.onOptionsItemSelected(item); + } + } + return true; + } + + @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { case REQUEST_CODE_INPUT: { diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextFragment.java index b13cb7837..5d9994c5c 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextFragment.java @@ -23,6 +23,7 @@ import android.support.v4.app.Fragment; import android.text.Editable; import android.text.TextWatcher; import android.view.LayoutInflater; +import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; @@ -33,8 +34,6 @@ public class EncryptTextFragment extends Fragment { public static final String ARG_TEXT = "text"; private TextView mText; - private View mEncryptShare; - private View mEncryptClipboard; private EncryptActivityInterface mEncryptInterface; @@ -72,24 +71,16 @@ public class EncryptTextFragment extends Fragment { mEncryptInterface.setMessage(s.toString()); } }); - mEncryptClipboard = view.findViewById(R.id.action_encrypt_clipboard); - mEncryptShare = view.findViewById(R.id.action_encrypt_share); - mEncryptClipboard.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - mEncryptInterface.startEncrypt(false); - } - }); - mEncryptShare.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - mEncryptInterface.startEncrypt(true); - } - }); return view; } + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + setHasOptionsMenu(true); + } @Override public void onActivityCreated(Bundle savedInstanceState) { @@ -100,4 +91,22 @@ public class EncryptTextFragment extends Fragment { mText.setText(text); } } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case R.id.encrypt_copy: { + mEncryptInterface.startEncrypt(false); + break; + } + case R.id.encrypt_share: { + mEncryptInterface.startEncrypt(true); + break; + } + default: { + return super.onOptionsItemSelected(item); + } + } + return true; + } } diff --git a/OpenKeychain/src/main/res/drawable-hdpi/ic_close_black_24dp.png b/OpenKeychain/src/main/res/drawable-hdpi/ic_close_black_24dp.png Binary files differnew file mode 100644 index 000000000..d5a928783 --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-hdpi/ic_close_black_24dp.png diff --git a/OpenKeychain/src/main/res/drawable-mdpi/ic_close_black_24dp.png b/OpenKeychain/src/main/res/drawable-mdpi/ic_close_black_24dp.png Binary files differnew file mode 100644 index 000000000..4ebf8a227 --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-mdpi/ic_close_black_24dp.png diff --git a/OpenKeychain/src/main/res/drawable-xhdpi/ic_close_black_24dp.png b/OpenKeychain/src/main/res/drawable-xhdpi/ic_close_black_24dp.png Binary files differnew file mode 100644 index 000000000..ed2b2525f --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-xhdpi/ic_close_black_24dp.png diff --git a/OpenKeychain/src/main/res/drawable-xxhdpi/ic_close_black_24dp.png b/OpenKeychain/src/main/res/drawable-xxhdpi/ic_close_black_24dp.png Binary files differnew file mode 100644 index 000000000..08f59ea1e --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-xxhdpi/ic_close_black_24dp.png diff --git a/OpenKeychain/src/main/res/drawable-xxxhdpi/ic_close_black_24dp.png b/OpenKeychain/src/main/res/drawable-xxxhdpi/ic_close_black_24dp.png Binary files differnew file mode 100644 index 000000000..c5d79caff --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-xxxhdpi/ic_close_black_24dp.png diff --git a/OpenKeychain/src/main/res/layout/decrypt_files_activity.xml b/OpenKeychain/src/main/res/layout/decrypt_files_activity.xml index 3cf4a9e7b..3d214dbf6 100644 --- a/OpenKeychain/src/main/res/layout/decrypt_files_activity.xml +++ b/OpenKeychain/src/main/res/layout/decrypt_files_activity.xml @@ -5,7 +5,7 @@ <include android:id="@+id/toolbar_include" - layout="@layout/toolbar_standalone" /> + layout="@layout/toolbar_standalone_white" /> <!-- fitsSystemWindows and layout_marginTop from diff --git a/OpenKeychain/src/main/res/layout/decrypt_text_activity.xml b/OpenKeychain/src/main/res/layout/decrypt_text_activity.xml index da4aa7099..a6099e25e 100644 --- a/OpenKeychain/src/main/res/layout/decrypt_text_activity.xml +++ b/OpenKeychain/src/main/res/layout/decrypt_text_activity.xml @@ -5,7 +5,7 @@ <include android:id="@+id/toolbar_include" - layout="@layout/toolbar_standalone" /> + layout="@layout/toolbar_standalone_white" /> <!-- fitsSystemWindows and layout_marginTop from diff --git a/OpenKeychain/src/main/res/layout/encrypt_files_fragment.xml b/OpenKeychain/src/main/res/layout/encrypt_files_fragment.xml index 26b1d809d..029e735b3 100644 --- a/OpenKeychain/src/main/res/layout/encrypt_files_fragment.xml +++ b/OpenKeychain/src/main/res/layout/encrypt_files_fragment.xml @@ -1,72 +1,19 @@ <?xml version="1.0" encoding="utf-8"?> -<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" - android:layout_height="match_parent" - android:fillViewport="true"> - - <LinearLayout + android:layout_height="wrap_content" + android:paddingLeft="16dp" + android:paddingRight="16dp" + android:orientation="vertical"> + + <ListView + android:id="@+id/selected_files_list" + android:dividerHeight="4dip" + android:divider="@android:color/transparent" + android:focusable="true" + android:focusableInTouchMode="true" + android:layout_marginTop="8dp" android:layout_width="match_parent" - android:layout_height="wrap_content" - android:paddingLeft="16dp" - android:paddingRight="16dp" - android:orientation="vertical"> - - <ListView - android:id="@+id/selected_files_list" - android:dividerHeight="4dip" - android:divider="@android:color/transparent" - android:focusable="true" - android:focusableInTouchMode="true" - android:layout_marginTop="8dp" - android:layout_width="match_parent" - android:layout_height="0dip" - android:layout_weight="1" /> - - <View - android:layout_width="match_parent" - android:layout_height="1dip" - android:background="?android:attr/listDivider" /> - - <!-- Note: The following construct should be a widget, we use it quiet often --> - - <LinearLayout - android:id="@+id/action_encrypt_share" - android:paddingLeft="8dp" - android:layout_width="match_parent" - android:layout_height="?android:attr/listPreferredItemHeight" - android:clickable="true" - style="@style/SelectableItem" - android:orientation="horizontal"> - - <TextView - android:paddingLeft="8dp" - android:paddingRight="8dp" - android:textAppearance="?android:attr/textAppearanceMedium" - android:layout_width="0dip" - android:layout_height="match_parent" - android:text="@string/btn_encrypt_share_file" - android:layout_weight="1" - android:drawableRight="@drawable/ic_share_grey_24dp" - android:drawablePadding="8dp" - android:gravity="center_vertical" /> - - <View - android:layout_width="1dip" - android:layout_height="match_parent" - android:gravity="right" - android:layout_marginBottom="8dp" - android:layout_marginTop="8dp" - android:background="?android:attr/listDivider" /> - - <ImageButton - android:id="@+id/action_encrypt_file" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:padding="8dp" - android:src="@drawable/ic_save_grey_24dp" - android:layout_gravity="center_vertical" - style="@style/SelectableItem" /> + android:layout_height="match_parent" /> - </LinearLayout> - </LinearLayout> -</ScrollView>
\ No newline at end of file +</LinearLayout>
\ No newline at end of file diff --git a/OpenKeychain/src/main/res/layout/encrypt_text_fragment.xml b/OpenKeychain/src/main/res/layout/encrypt_text_fragment.xml index 6f7b636e1..3c21291cd 100644 --- a/OpenKeychain/src/main/res/layout/encrypt_text_fragment.xml +++ b/OpenKeychain/src/main/res/layout/encrypt_text_fragment.xml @@ -21,50 +21,5 @@ android:hint="@string/encrypt_content_edit_text_hint" android:layout_weight="1" /> - <View - android:layout_width="match_parent" - android:layout_height="1dip" - android:background="?android:attr/listDivider" /> - - <LinearLayout - android:id="@+id/action_encrypt_share" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:clickable="true" - style="@style/SelectableItem" - android:orientation="horizontal"> - - <TextView - android:paddingLeft="8dp" - android:paddingRight="8dp" - android:textAppearance="?android:attr/textAppearanceMedium" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:minHeight="?android:attr/listPreferredItemHeight" - android:text="@string/btn_share_encrypted_signed" - android:drawableRight="@drawable/ic_share_grey_24dp" - android:drawablePadding="8dp" - android:gravity="center_vertical" - android:layout_weight="1" /> - - <View - android:layout_width="1dip" - android:layout_height="match_parent" - android:gravity="right" - android:layout_marginBottom="8dp" - android:layout_marginTop="8dp" - android:background="?android:attr/listDivider" /> - - <ImageButton - android:id="@+id/action_encrypt_clipboard" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:padding="8dp" - android:src="@drawable/ic_content_copy_grey_24dp" - android:layout_gravity="center_vertical" - style="@style/SelectableItem" /> - - </LinearLayout> - </LinearLayout> </ScrollView> |