aboutsummaryrefslogtreecommitdiffstats
path: root/OpenPGP-Keychain/src/main/java/org
diff options
context:
space:
mode:
authorrafaelav <rafaela.voiculescu@gmail.com>2014-03-08 12:28:28 +0100
committerrafaelav <rafaela.voiculescu@gmail.com>2014-03-09 22:30:01 +0100
commitb107766f5b311d9a0d80fd23306a11f41c438c66 (patch)
treeb6d1860ead47dc842e3170bd5584f04328a483bc /OpenPGP-Keychain/src/main/java/org
parent50d9908bafd1b55640deb3a0b2cff4e06155cc5e (diff)
downloadopen-keychain-b107766f5b311d9a0d80fd23306a11f41c438c66.tar.gz
open-keychain-b107766f5b311d9a0d80fd23306a11f41c438c66.tar.bz2
open-keychain-b107766f5b311d9a0d80fd23306a11f41c438c66.zip
Issue #178 - Hide advanced options in EncryptActivity
Diffstat (limited to 'OpenPGP-Keychain/src/main/java/org')
-rw-r--r--OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java56
1 files changed, 56 insertions, 0 deletions
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) + " ("