mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-12-23 15:38:50 -05:00
Redesign of encrypt activites finished
This commit is contained in:
parent
c50dceab32
commit
72c18734ad
@ -11,6 +11,7 @@ python copy OpenKeychain av white repeat 24
|
||||
python copy OpenKeychain av grey repeat 24
|
||||
python copy OpenKeychain editor white mode_edit 24
|
||||
python copy OpenKeychain content white save 24
|
||||
python copy OpenKeychain navigation black close 24
|
||||
|
||||
python copy OpenKeychain action grey delete 24
|
||||
python copy OpenKeychain action grey done 24
|
||||
|
@ -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
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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() {
|
||||
@ -191,6 +178,24 @@ public class EncryptFilesFragment extends Fragment implements EncryptActivityInt
|
||||
return false;
|
||||
}
|
||||
|
||||
@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) {
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
BIN
OpenKeychain/src/main/res/drawable-hdpi/ic_close_black_24dp.png
Normal file
BIN
OpenKeychain/src/main/res/drawable-hdpi/ic_close_black_24dp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 301 B |
BIN
OpenKeychain/src/main/res/drawable-mdpi/ic_close_black_24dp.png
Normal file
BIN
OpenKeychain/src/main/res/drawable-mdpi/ic_close_black_24dp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 257 B |
BIN
OpenKeychain/src/main/res/drawable-xhdpi/ic_close_black_24dp.png
Normal file
BIN
OpenKeychain/src/main/res/drawable-xhdpi/ic_close_black_24dp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 360 B |
Binary file not shown.
After Width: | Height: | Size: 425 B |
Binary file not shown.
After Width: | Height: | Size: 565 B |
@ -5,7 +5,7 @@
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbar_include"
|
||||
layout="@layout/toolbar_standalone" />
|
||||
layout="@layout/toolbar_standalone_white" />
|
||||
|
||||
<!--
|
||||
fitsSystemWindows and layout_marginTop from
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbar_include"
|
||||
layout="@layout/toolbar_standalone" />
|
||||
layout="@layout/toolbar_standalone_white" />
|
||||
|
||||
<!--
|
||||
fitsSystemWindows and layout_marginTop from
|
||||
|
@ -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">
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
<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">
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<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" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</LinearLayout>
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user