diff options
author | Dominik Schürmann <dominik@dominikschuermann.de> | 2014-07-31 21:51:35 +0200 |
---|---|---|
committer | Dominik Schürmann <dominik@dominikschuermann.de> | 2014-07-31 21:51:35 +0200 |
commit | 50aea621ba4de844cf6eee077d1f5b14d0247f14 (patch) | |
tree | ba5df1afa20a4c8e7d7d4310f9b14460f0795b21 | |
parent | b9694ae9c58eaf5cbd723edc35d38ba2bc00eccf (diff) | |
download | open-keychain-50aea621ba4de844cf6eee077d1f5b14d0247f14.tar.gz open-keychain-50aea621ba4de844cf6eee077d1f5b14d0247f14.tar.bz2 open-keychain-50aea621ba4de844cf6eee077d1f5b14d0247f14.zip |
Fix animations in create key
5 files changed, 31 insertions, 47 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyActivity.java index 569ae82f0..534ac5811 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyActivity.java @@ -29,9 +29,9 @@ public class CreateKeyActivity extends ActionBarActivity { public static final String EXTRA_NAME = "name"; public static final String EXTRA_EMAIL = "email"; - public static final int ANIM_NO = 0; - public static final int ANIM_TO_RIGHT = 1; - public static final int ANIM_TO_LEFT = 2; + public static final int FRAG_ACTION_START = 0; + public static final int FRAG_ACTION_TO_RIGHT = 1; + public static final int FRAG_ACTION_TO_LEFT = 2; @Override public void onCreate(Bundle savedInstanceState) { @@ -45,10 +45,10 @@ public class CreateKeyActivity extends ActionBarActivity { getIntent().getStringExtra(EXTRA_NAME), getIntent().getStringExtra(EXTRA_EMAIL) ); - loadFragment(null, frag, ANIM_NO); + loadFragment(null, frag, FRAG_ACTION_START); } - public void loadFragment(Bundle savedInstanceState, Fragment fragment, int animation) { + public void loadFragment(Bundle savedInstanceState, Fragment fragment, int action) { // However, if we're being restored from a previous state, // then we don't need to do anything and should return or else // we could end up with overlapping fragments. @@ -60,22 +60,24 @@ public class CreateKeyActivity extends ActionBarActivity { // NOTE: We use commitAllowingStateLoss() to prevent weird crashes! FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); - switch (animation) { - case ANIM_NO: + switch (action) { + case FRAG_ACTION_START: transaction.setCustomAnimations(0, 0); + transaction.replace(R.id.create_key_fragment_container, fragment) + .commitAllowingStateLoss(); break; - case ANIM_TO_LEFT: - transaction.setCustomAnimations(R.anim.frag_slide_in_from_left, R.anim.frag_slide_out_to_right); + case FRAG_ACTION_TO_LEFT: + getSupportFragmentManager().popBackStackImmediate(); break; - case ANIM_TO_RIGHT: - transaction.setCustomAnimations(R.anim.frag_slide_out_to_left, R.anim.frag_slide_in_from_right, + case FRAG_ACTION_TO_RIGHT: + transaction.setCustomAnimations(R.anim.frag_slide_in_from_right, R.anim.frag_slide_out_to_left, R.anim.frag_slide_in_from_left, R.anim.frag_slide_out_to_right); - transaction.addToBackStack("back"); + transaction.addToBackStack(null); + transaction.replace(R.id.create_key_fragment_container, fragment) + .commitAllowingStateLoss(); break; } - transaction.replace(R.id.create_key_fragment_container, fragment) - .commitAllowingStateLoss(); // do it immediately! getSupportFragmentManager().executePendingTransactions(); } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyFinalFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyFinalFragment.java index c2c983b95..b64480087 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyFinalFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyFinalFragment.java @@ -20,11 +20,8 @@ package org.sufficientlysecure.keychain.ui; import android.app.Activity; import android.app.ProgressDialog; import android.content.Intent; -import android.database.ContentObserver; import android.net.Uri; import android.os.Bundle; -import android.os.Handler; -import android.os.Looper; import android.os.Message; import android.os.Messenger; import android.support.v4.app.Fragment; @@ -32,7 +29,6 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.CheckBox; -import android.widget.Spinner; import android.widget.TextView; import org.spongycastle.bcpg.sig.KeyFlags; @@ -110,9 +106,7 @@ public class CreateKeyFinalFragment extends Fragment { mBackButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - CreateKeyInputFragment frag = - CreateKeyInputFragment.newInstance(mName, mEmail); - mCreateKeyActivity.loadFragment(null, frag, CreateKeyActivity.ANIM_TO_LEFT); + mCreateKeyActivity.loadFragment(null, null, CreateKeyActivity.FRAG_ACTION_TO_LEFT); } }); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyInputFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyInputFragment.java index a1fdc09cc..ef5a3b145 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyInputFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyInputFragment.java @@ -161,7 +161,7 @@ public class CreateKeyInputFragment extends Fragment { ); hideKeyboard(); - mCreateKeyActivity.loadFragment(null, frag, CreateKeyActivity.ANIM_TO_RIGHT); + mCreateKeyActivity.loadFragment(null, frag, CreateKeyActivity.FRAG_ACTION_TO_RIGHT); } } diff --git a/OpenKeychain/src/main/res/layout/create_key_final_fragment.xml b/OpenKeychain/src/main/res/layout/create_key_final_fragment.xml index 74231142a..64b3621a4 100644 --- a/OpenKeychain/src/main/res/layout/create_key_final_fragment.xml +++ b/OpenKeychain/src/main/res/layout/create_key_final_fragment.xml @@ -20,14 +20,14 @@ android:layout_height="wrap_content" android:paddingTop="16dp" android:paddingBottom="8dp" - android:text="You entered the following credentials:" + android:text="@string/create_key_final_text" android:textAppearance="?android:attr/textAppearanceMedium" /> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="2dp" - android:text="Name" + android:text="@string/label_name" android:textColor="@color/tertiary_text_light" android:textAppearance="?android:attr/textAppearanceSmall" /> @@ -44,7 +44,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="2dp" - android:text="Email" + android:text="@string/label_email" android:textColor="@color/tertiary_text_light" android:textAppearance="?android:attr/textAppearanceSmall" /> @@ -76,30 +76,16 @@ android:layout_height="1dip" android:background="?android:attr/listDivider" /> - <LinearLayout - android:layout_width="match_parent" + <TextView + android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="16dp" android:layout_marginBottom="8dp" - android:orientation="horizontal"> - - <ImageView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:id="@+id/imageView" - android:src="@drawable/create_key_robot" - android:layout_gravity="center_vertical" /> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginLeft="8dp" - android:text="Creating a key may take a while, have a cup of coffee in the meantime…\n(3 subkeys, RSA, 4096 bit)" - android:textColor="@color/android_green_dark" - android:textAppearance="?android:attr/textAppearanceMedium" - android:id="@+id/textView" /> - - </LinearLayout> + android:text="@string/create_key_final_robot_text" + android:textColor="@color/android_green_dark" + android:textAppearance="?android:attr/textAppearanceMedium" + android:drawableLeft="@drawable/create_key_robot" + android:drawablePadding="8dp" /> </LinearLayout> </ScrollView> @@ -123,7 +109,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" - android:text="back" + android:text="@string/btn_back" android:minHeight="?android:attr/listPreferredItemHeight" android:gravity="center_vertical" android:clickable="true" diff --git a/OpenKeychain/src/main/res/values/strings.xml b/OpenKeychain/src/main/res/values/strings.xml index 0cffdd28a..bcd4d3bbc 100644 --- a/OpenKeychain/src/main/res/values/strings.xml +++ b/OpenKeychain/src/main/res/values/strings.xml @@ -508,6 +508,8 @@ <string name="create_key_upload">Upload key to keyserver</string> <string name="create_key_empty">This field is required</string> <string name="create_key_passphrases_not_equal">Passphrases do not match</string> + <string name="create_key_final_text">You entered the following credentials:</string> + <string name="create_key_final_robot_text">Creating a key may take a while, have a cup of coffee in the meantime…\n(3 subkeys, RSA, 4096 bit)</string> <!-- View key --> <string name="view_key_revoked">This key has been revoked!</string> |