diff options
5 files changed, 146 insertions, 41 deletions
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java index 313655766..67ce7a395 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java @@ -596,13 +596,21 @@ public class KeychainIntentService extends IntentService implements ProgressDial String passphrase = data.getString(GENERATE_KEY_SYMMETRIC_PASSPHRASE); /* Operation */ + int keysTotal = 2; + int keysCreated =0; + setProgress(getApplicationContext().getResources().getQuantityString(R.plurals.progress_generating,keysTotal), + keysCreated, keysTotal); PgpKeyOperation keyOperations = new PgpKeyOperation(this, this); PGPSecretKey masterKey = keyOperations.createKey(Id.choice.algorithm.rsa, 4096, passphrase, true); + keysCreated++; + setProgress(keysCreated, keysTotal); PGPSecretKey subKey = keyOperations.createKey(Id.choice.algorithm.rsa, 4096, passphrase, false); + keysCreated++; + setProgress(keysCreated, keysTotal ); // TODO: default to one master for cert, one sub for encrypt and one sub // for sign diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java index 898b0e67a..2507a77b1 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java @@ -187,7 +187,7 @@ public class EditKeyActivity extends ActionBarActivity { // Message is received after generating is done in ApgService KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler( - this, R.string.progress_generating, ProgressDialog.STYLE_SPINNER, true, + this, R.string.progress_generating, ProgressDialog.STYLE_HORIZONTAL, true, new DialogInterface.OnCancelListener() { @Override diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java index b486fc151..665035d0c 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java @@ -52,17 +52,21 @@ import android.os.Message; import android.os.Messenger; import android.view.View; import android.view.View.OnClickListener; +import android.view.animation.AlphaAnimation; +import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.ArrayAdapter; import android.widget.CheckBox; import android.widget.EditText; import android.widget.ImageView; +import android.widget.LinearLayout; import android.widget.Spinner; import android.widget.TextView; import android.widget.Toast; import android.widget.ViewFlipper; import com.beardedhen.androidbootstrap.BootstrapButton; +import com.beardedhen.androidbootstrap.FontAwesomeText; import com.devspark.appmsg.AppMsg; public class EncryptActivity extends DrawerActivity { @@ -114,6 +118,11 @@ public class EncryptActivity extends DrawerActivity { private String mInputFilename = null; private String mOutputFilename = null; + private Integer mShortAnimationDuration = null; + private boolean mFileAdvancedSettingsVisible = false; + private TextView mFileAdvancedSettings = null; + private LinearLayout mFileAdvancedSettingsContainer = null; + private FontAwesomeText mAdvancedSettingsIcon; private boolean mAsciiArmorDemand = false; private boolean mOverrideAsciiArmor = false; @@ -148,6 +157,9 @@ public class EncryptActivity extends DrawerActivity { updateMode(); updateActionBarButtons(); + + // retrieve and cache the system's short animation time + mShortAnimationDuration = getResources().getInteger(android.R.integer.config_shortAnimTime); } /** @@ -793,6 +805,50 @@ public class EncryptActivity extends DrawerActivity { } }); + mAdvancedSettingsIcon = (FontAwesomeText) findViewById(R.id.advancedSettingsIcon); + mFileAdvancedSettingsContainer = (LinearLayout) findViewById(R.id.fileAdvancedSettingsContainer); + mFileAdvancedSettings = (TextView) findViewById(R.id.advancedSettings); + + LinearLayout advancedSettingsControl = (LinearLayout) findViewById(R.id.advancedSettingsControl); + advancedSettingsControl.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + mFileAdvancedSettingsVisible = !mFileAdvancedSettingsVisible; + if (mFileAdvancedSettingsVisible) { + mAdvancedSettingsIcon.setIcon("fa-chevron-down"); + mFileAdvancedSettingsContainer.setVisibility(View.VISIBLE); + AlphaAnimation animation = new AlphaAnimation(0f, 1f); + animation.setDuration(mShortAnimationDuration); + mFileAdvancedSettingsContainer.startAnimation(animation); + mFileAdvancedSettings.setText(R.string.btn_encryption_advanced_settings_hide); + + } else { + mAdvancedSettingsIcon.setIcon("fa-chevron-right"); + AlphaAnimation animation = new AlphaAnimation(1f, 0f); + animation.setDuration(mShortAnimationDuration); + animation.setAnimationListener(new Animation.AnimationListener() { + @Override + public void onAnimationStart(Animation animation) { + // do nothing + } + + @Override + public void onAnimationEnd(Animation animation) { + // making sure that at the end the container is completely removed from view + mFileAdvancedSettingsContainer.setVisibility(View.GONE); + } + + @Override + public void onAnimationRepeat(Animation animation) { + // do nothing + } + }); + mFileAdvancedSettingsContainer.startAnimation(animation); + mFileAdvancedSettings.setText(R.string.btn_encryption_advanced_settings_show); + } + } + }); + mFileCompression = (Spinner) findViewById(R.id.fileCompression); Choice[] choices = new Choice[]{ new Choice(Id.choice.compression.none, getString(R.string.choice_none) + " (" diff --git a/OpenPGP-Keychain/src/main/res/layout/encrypt_activity.xml b/OpenPGP-Keychain/src/main/res/layout/encrypt_activity.xml index e716b033a..dc4cf0063 100644 --- a/OpenPGP-Keychain/src/main/res/layout/encrypt_activity.xml +++ b/OpenPGP-Keychain/src/main/res/layout/encrypt_activity.xml @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:bootstrapbutton="http://schemas.android.com/apk/res-auto" + xmlns:fontawesometext="http://schemas.android.com/apk/res-auto" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent"> @@ -251,64 +252,97 @@ </LinearLayout> <LinearLayout + android:id="@+id/advancedSettingsControl" android:layout_width="match_parent" android:layout_height="wrap_content" - android:orientation="horizontal"> - - <TextView - android:id="@+id/label_fileCompression" - android:layout_width="0dip" + android:orientation="horizontal" + android:clickable="true"> + <com.beardedhen.androidbootstrap.FontAwesomeText + android:id="@+id/advancedSettingsIcon" + android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:layout_weight="1" - android:paddingRight="10dip" - android:text="@string/label_file_compression" - android:textAppearance="?android:attr/textAppearanceSmall" /> - - <Spinner - android:id="@+id/fileCompression" + android:layout_marginRight="10dp" + android:textSize="12sp" + android:paddingTop="@dimen/padding_medium" + android:paddingBottom="@dimen/padding_medium" + fontawesometext:fa_icon="fa-chevron-right"/> + <TextView + android:id="@+id/advancedSettings" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_gravity="center_vertical" /> + android:text="@string/btn_encryption_advanced_settings_show" + android:paddingTop="@dimen/padding_medium" + android:paddingBottom="@dimen/padding_medium" + android:textColor="@color/emphasis"/> </LinearLayout> <LinearLayout + android:id="@+id/fileAdvancedSettingsContainer" android:layout_width="match_parent" android:layout_height="wrap_content" - android:orientation="horizontal"> + android:orientation="vertical" + android:visibility="gone"> - <CheckBox - android:id="@+id/deleteAfterEncryption" - android:layout_width="wrap_content" + <LinearLayout + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:text="@string/label_delete_after_encryption" /> - </LinearLayout> + android:orientation="horizontal"> - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> + <TextView + android:id="@+id/label_fileCompression" + android:layout_width="0dip" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" + android:layout_weight="1" + android:paddingRight="10dip" + android:text="@string/label_file_compression" + android:textAppearance="?android:attr/textAppearanceSmall" /> - <CheckBox - android:id="@+id/shareAfterEncryption" - android:layout_width="wrap_content" + <Spinner + android:id="@+id/fileCompression" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" /> + </LinearLayout> + + <LinearLayout + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:text="@string/label_share_after_encryption" /> - </LinearLayout> + android:orientation="horizontal"> - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> + <CheckBox + android:id="@+id/deleteAfterEncryption" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" + android:text="@string/label_delete_after_encryption" /> + </LinearLayout> - <CheckBox - android:id="@+id/asciiArmour" - android:layout_width="wrap_content" + <LinearLayout + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:text="@string/label_ascii_armor" /> + android:orientation="horizontal"> + + <CheckBox + android:id="@+id/shareAfterEncryption" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" + android:text="@string/label_share_after_encryption" /> + </LinearLayout> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal"> + + <CheckBox + android:id="@+id/asciiArmour" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" + android:text="@string/label_ascii_armor" /> + </LinearLayout> </LinearLayout> </LinearLayout> </ViewFlipper> diff --git a/OpenPGP-Keychain/src/main/res/values/strings.xml b/OpenPGP-Keychain/src/main/res/values/strings.xml index cd016c41e..505e41b78 100644 --- a/OpenPGP-Keychain/src/main/res/values/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values/strings.xml @@ -67,6 +67,8 @@ <string name="btn_clipboard">Clipboard</string> <string name="btn_share">Share with…</string> <string name="btn_lookup_key">Lookup key</string> + <string name="btn_encryption_advanced_settings_show">Show advanced settings</string> + <string name="btn_encryption_advanced_settings_hide">Hide advanced settings</string> <!-- menu --> <string name="menu_preferences">Settings</string> @@ -326,6 +328,11 @@ <item quantity="other">exporting keys…</item> </plurals> + <plurals name="progress_generating"> + <item quantity="one">generating key, this can take up to 3 minutes…</item> + <item quantity="other">generating keys, this can take up to 3 minutes…</item> + </plurals> + <string name="progress_extracting_signature_key">extracting signature key…</string> <string name="progress_extracting_key">extracting key…</string> <string name="progress_preparing_streams">preparing streams…</string> |