Yuvipanda has uploaded a new change for review. https://gerrit.wikimedia.org/r/119891
Change subject: [WIP] Add a 'User Actions' submenu ...................................................................... [WIP] Add a 'User Actions' submenu - Needs design finalization - Needs indicator on the right side of username Change-Id: I8ba55ce2e755ece9a2b158d120b59987b0ce6fed --- A wikipedia/res/anim/slide_in_top.xml A wikipedia/res/anim/slide_out_top.xml M wikipedia/res/layout/fragment_navdrawer.xml M wikipedia/res/values/strings.xml M wikipedia/src/main/java/org/wikipedia/NavDrawerFragment.java 5 files changed, 107 insertions(+), 25 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia refs/changes/91/119891/1 diff --git a/wikipedia/res/anim/slide_in_top.xml b/wikipedia/res/anim/slide_in_top.xml new file mode 100644 index 0000000..fe9b4e5 --- /dev/null +++ b/wikipedia/res/anim/slide_in_top.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8"?> +<set xmlns:android="http://schemas.android.com/apk/res/android" + android:fillAfter="true" + android:repeatCount="0" > + + <scale + android:duration="@android:integer/config_mediumAnimTime" + android:fromXScale="1.0" + android:toXScale="1.0" + android:fromYScale="0.0" + android:toYScale="1.0" + android:fillBefore="false" + /> + +</set> diff --git a/wikipedia/res/anim/slide_out_top.xml b/wikipedia/res/anim/slide_out_top.xml new file mode 100644 index 0000000..eaf5e17 --- /dev/null +++ b/wikipedia/res/anim/slide_out_top.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8"?> +<set xmlns:android="http://schemas.android.com/apk/res/android" + android:fillBefore="true" + android:repeatCount="0" > + + <scale + android:duration="@android:integer/config_mediumAnimTime" + android:fromXScale="1.0" + android:toXScale="1.0" + android:fromYScale="1.0" + android:toYScale="0.0" + android:fillAfter="false" + /> + +</set> diff --git a/wikipedia/res/layout/fragment_navdrawer.xml b/wikipedia/res/layout/fragment_navdrawer.xml index ec892e3..ca1a0c0 100644 --- a/wikipedia/res/layout/fragment_navdrawer.xml +++ b/wikipedia/res/layout/fragment_navdrawer.xml @@ -51,7 +51,6 @@ android:id="@+id/nav_item_username" android:background="?android:attr/selectableItemBackground" android:paddingTop="8dp" - android:paddingBottom="8dp" android:paddingRight="8dp" android:visibility="gone" > @@ -60,27 +59,42 @@ android:layout_gravity="top" android:src="@drawable/face_smile_white" /> - <LinearLayout android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - > - <org.wikipedia.styledviews.StyledTextView - android:layout_width="match_parent" - android:layout_height="48dp" - android:gravity="center_vertical" - android:layout_gravity="center_vertical" - android:id="@+id/nav_item_username_primary_text" - style="?android:textAppearanceMediumInverse" - /> - <org.wikipedia.styledviews.StyledTextView - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:text="@string/nav_item_tap_to_logout" - style="?android:textAppearanceSmallInverse" - android:visibility="gone" - /> - </LinearLayout> + <org.wikipedia.styledviews.StyledTextView + android:layout_width="match_parent" + android:layout_height="48dp" + android:gravity="center_vertical" + android:layout_gravity="center_vertical" + android:id="@+id/nav_item_username_primary_text" + style="?android:textAppearanceMediumInverse" + /> + </LinearLayout> + <LinearLayout + android:id="@+id/nav_item_container_user_actions" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:visibility="gone" + > + <org.wikipedia.styledviews.StyledTextView + android:layout_width="match_parent" + android:layout_height="48dp" + android:gravity="center_vertical" + android:text="@string/nav_item_user_my_contributions" + android:id="@+id/nav_item_user_my_contributions" + style="?android:textAppearanceMediumInverse" + android:background="?android:attr/selectableItemBackground" + android:paddingLeft="48dp" + /> + <org.wikipedia.styledviews.StyledTextView + android:layout_width="match_parent" + android:layout_height="48dp" + android:gravity="center_vertical" + android:text="@string/nav_item_user_log_out" + android:id="@+id/nav_item_user_log_out" + style="?android:textAppearanceMediumInverse" + android:background="?android:attr/selectableItemBackground" + android:paddingLeft="48dp" + /> </LinearLayout> <View android:layout_width="match_parent" android:layout_height="0.5dp" android:background="#038368" /> diff --git a/wikipedia/res/values/strings.xml b/wikipedia/res/values/strings.xml index 725a27a..cb7eac4 100644 --- a/wikipedia/res/values/strings.xml +++ b/wikipedia/res/values/strings.xml @@ -121,4 +121,6 @@ <string name="nav_item_tap_to_logout">Tap to log out</string> <string name="create_account_account_created_toast">Account created!</string> <string name="user_contribs_more_action">Load more</string> + <string name="nav_item_user_my_contributions">My contributions</string> + <string name="nav_item_user_log_out">Log out</string> </resources> diff --git a/wikipedia/src/main/java/org/wikipedia/NavDrawerFragment.java b/wikipedia/src/main/java/org/wikipedia/NavDrawerFragment.java index 1abd875..693aec5 100644 --- a/wikipedia/src/main/java/org/wikipedia/NavDrawerFragment.java +++ b/wikipedia/src/main/java/org/wikipedia/NavDrawerFragment.java @@ -6,6 +6,7 @@ import android.os.*; import android.support.v4.app.Fragment; import android.view.*; +import android.view.animation.*; import android.widget.*; import org.wikipedia.history.*; import org.wikipedia.login.*; @@ -22,7 +23,9 @@ R.id.nav_item_login, R.id.nav_item_username, R.id.nav_item_random, - R.id.nav_item_send_feedback + R.id.nav_item_send_feedback, + R.id.nav_item_user_log_out, + R.id.nav_item_user_my_contributions // We don't actually need R.id.nav_item_zero here because we add it programmatically // below, and we don't need an on-tap as of now }; @@ -30,6 +33,8 @@ private View[] actionViews = new View[ACTION_ITEMS_TEXT.length]; private WikipediaApp app; private RandomHandler randomHandler; + private View userActionsContainer; + @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { @@ -58,6 +63,7 @@ } wikipediaZeroText = (TextView) getView().findViewById(R.id.nav_item_zero); + userActionsContainer = getView().findViewById(R.id.nav_item_container_user_actions); randomHandler = new RandomHandler(getActivity()); } @@ -133,8 +139,31 @@ randomHandler.doVistRandomArticle(); break; case R.id.nav_item_username: - intent.setClass(this.getActivity(), UserContribsActivity.class); - startActivity(intent); + if (userActionsContainer.getVisibility() == View.GONE) { + Animation anim = AnimationUtils.loadAnimation(getActivity(), R.anim.slide_in_top); + userActionsContainer.startAnimation(anim); + userActionsContainer.setVisibility(View.VISIBLE); + } else { + Animation anim = AnimationUtils.loadAnimation(getActivity(), R.anim.slide_out_top); + anim.setAnimationListener(new Animation.AnimationListener() { + @Override + public void onAnimationStart(Animation animation) { + + } + + @Override + public void onAnimationEnd(Animation animation) { + userActionsContainer.setVisibility(View.GONE); + + } + + @Override + public void onAnimationRepeat(Animation animation) { + + } + }); + userActionsContainer.startAnimation(anim); + } break; case R.id.nav_item_send_feedback: // Will be stripped out in prod builds @@ -143,6 +172,13 @@ intent.setData(Uri.parse("mailto:[email protected]?subject=Android App " + WikipediaApp.APP_VERSION_STRING + " Feedback")); startActivity(intent); break; + case R.id.nav_item_user_log_out: + doLogout(); + break; + case R.id.nav_item_user_my_contributions: + intent.setClass(getActivity(), UserContribsActivity.class); + startActivity(intent); + break; default: throw new RuntimeException("Unknown ID clicked!"); } -- To view, visit https://gerrit.wikimedia.org/r/119891 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8ba55ce2e755ece9a2b158d120b59987b0ce6fed Gerrit-PatchSet: 1 Gerrit-Project: apps/android/wikipedia Gerrit-Branch: master Gerrit-Owner: Yuvipanda <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
