diff options
author | Stefanos Togoulidis <stefanostogoulidis@gmail.com> | 2016-09-28 13:04:39 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-28 13:04:39 +0300 |
commit | b7539af3802f6e868bb5a9052efc64a50dd8cf24 (patch) | |
tree | 738d49aad16e578e8d17eee8ebf615e00f61b303 | |
parent | 0da597bb1d6416fcfb67e3047080bfda3687013b (diff) | |
parent | 50b90bfc3c748cdf74ef6fb63b7e57237ab8d224 (diff) | |
download | gradle-perf-android-medium-b7539af3802f6e868bb5a9052efc64a50dd8cf24.tar.gz |
Merge pull request #4548 from nawabhussain/feature/Role_Selection_Dropdown
Feature/role selection dropdown
3 files changed, 80 insertions, 43 deletions
diff --git a/WordPress/src/main/java/org/wordpress/android/ui/people/PeopleInviteFragment.java b/WordPress/src/main/java/org/wordpress/android/ui/people/PeopleInviteFragment.java index 1af3111fb..1108627bb 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/people/PeopleInviteFragment.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/people/PeopleInviteFragment.java @@ -2,6 +2,8 @@ package org.wordpress.android.ui.people; import android.app.Fragment; +import android.content.Intent; +import android.net.Uri; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.content.ContextCompat; @@ -17,6 +19,7 @@ import android.view.ViewGroup; import android.view.inputmethod.EditorInfo; import android.widget.EditText; import android.widget.ImageButton; +import android.widget.ImageView; import android.widget.TextView; import org.wordpress.android.R; @@ -30,6 +33,7 @@ import org.wordpress.android.util.NetworkUtils; import org.wordpress.android.util.StringUtils; import org.wordpress.android.util.ToastUtils; import org.wordpress.android.widgets.MultiUsernameEditText; +import org.wordpress.passcodelock.AppLockManager; import java.util.ArrayList; import java.util.Collection; @@ -50,15 +54,14 @@ public class PeopleInviteFragment extends Fragment implements private static final int MAX_NUMBER_OF_INVITEES = 10; private static final String[] USERNAME_DELIMITERS = {" ", ","}; - + private final Map<String, ViewGroup> mUsernameButtons = new LinkedHashMap<>(); + private final HashMap<String, String> mUsernameResults = new HashMap<>(); + private final Map<String, View> mUsernameErrorViews = new Hashtable<>(); private ViewGroup mUsernamesContainer; private MultiUsernameEditText mUsernameEditText; private TextView mRoleTextView; private EditText mCustomMessageEditText; - private final Map<String, ViewGroup> mUsernameButtons = new LinkedHashMap<>(); - private final HashMap<String, String> mUsernameResults = new HashMap<>(); - private final Map<String, TextView> mUsernameErrorViews = new Hashtable<>(); private Role mRole; private String mCustomMessage = ""; private boolean mInviteOperationInProgress = false; @@ -194,16 +197,25 @@ public class PeopleInviteFragment extends Fragment implements populateUsernameButtons(usernames); } - View roleContainer = view.findViewById(R.id.role_container); - roleContainer.setOnClickListener(new View.OnClickListener() { + + view.findViewById(R.id.role_container).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { RoleSelectDialogFragment.show(PeopleInviteFragment.this, 0, isPrivateSite()); } }); - mRoleTextView = (TextView) view.findViewById(R.id.role); + mRoleTextView = (TextView) view.findViewById(R.id.role); setRole(role); + ImageView imgRoleInfo = (ImageView) view.findViewById(R.id.imgRoleInfo); + imgRoleInfo.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Uri uri = Uri.parse(getString(R.string.role_info_url)); + AppLockManager.getInstance().setExtendedTimeout(); + startActivity(new Intent(Intent.ACTION_VIEW, uri)); + } + }); final int MAX_CHARS = getResources().getInteger(R.integer.invite_message_char_limit); final TextView remainingCharsTextView = (TextView) view.findViewById(R.id.message_remaining); @@ -343,6 +355,7 @@ public class PeopleInviteFragment extends Fragment implements /** * Deletes the last entered username. + * * @return true if the username was deleted */ private boolean removeLastEnteredUsername() { @@ -403,7 +416,7 @@ public class PeopleInviteFragment extends Fragment implements return; } - if(!isUserInInvitees(username)){ + if (!isUserInInvitees(username)) { //user is removed from invitees before validation return; } @@ -434,6 +447,7 @@ public class PeopleInviteFragment extends Fragment implements } } + public interface ValidationEndListener { void onValidationEnd(); } @@ -477,7 +491,7 @@ public class PeopleInviteFragment extends Fragment implements TextView usernameErrorTextView; if (mUsernameErrorViews.containsKey(username)) { - usernameErrorTextView = mUsernameErrorViews.get(username); + usernameErrorTextView = (TextView) mUsernameErrorViews.get(username); if (usernameResult == null || usernameResult.equals(FLAG_SUCCESS)) { // no error so we need to remove the existing error view @@ -651,4 +665,5 @@ public class PeopleInviteFragment extends Fragment implements Blog blog = WordPress.wpDB.getBlogForDotComBlogId(dotComBlogId); return blog != null && blog.isPrivate(); } + } diff --git a/WordPress/src/main/res/layout/people_invite_fragment.xml b/WordPress/src/main/res/layout/people_invite_fragment.xml index 20cdf0d76..81ead88b0 100644 --- a/WordPress/src/main/res/layout/people_invite_fragment.xml +++ b/WordPress/src/main/res/layout/people_invite_fragment.xml @@ -1,15 +1,14 @@ <?xml version="1.0" encoding="utf-8"?> -<ScrollView - xmlns:android="http://schemas.android.com/apk/res/android" +<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/white" + android:clickable="true" android:clipToPadding="false" android:paddingLeft="16dp" android:paddingRight="16dp" - android:clickable="true" - android:scrollbarStyle="outsideInset" > + android:scrollbarStyle="outsideInset"> <LinearLayout android:layout_width="match_parent" @@ -21,16 +20,16 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="@dimen/margin_large" + android:text="@string/invite_names_title" android:textColor="@color/grey_dark" - android:textSize="@dimen/text_sz_large" - android:text="@string/invite_names_title"/> + android:textSize="@dimen/text_sz_large" /> <LinearLayout android:id="@+id/usernames_container" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginTop="5dp" android:layout_marginBottom="@dimen/margin_extra_large" + android:layout_marginTop="5dp" android:animateLayoutChanges="true" android:orientation="vertical"> @@ -38,29 +37,29 @@ android:id="@+id/usernames" android:layout_width="match_parent" android:layout_height="wrap_content" + android:animateLayoutChanges="true" android:background="@drawable/invites_border" - android:paddingLeft="2dp" - android:paddingRight="2dp" android:paddingBottom="@dimen/margin_large" - android:animateLayoutChanges="true" > + android:paddingLeft="2dp" + android:paddingRight="2dp"> <org.wordpress.android.widgets.MultiUsernameEditText android:id="@+id/invite_usernames" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@color/transparent" - android:paddingTop="@dimen/margin_large" + android:imeOptions="actionDone" + android:inputType="text" + android:minWidth="40dp" android:paddingBottom="0dp" android:paddingLeft="@dimen/margin_medium" android:paddingRight="@dimen/margin_medium" + android:paddingTop="@dimen/margin_large" android:singleLine="true" android:textColor="@color/grey_dark" android:textColorHint="#AAAAAA" android:textSize="@dimen/text_sz_medium" - tools:text="sdfwefef" - android:inputType="text" - android:imeOptions="actionDone" - android:minWidth="40dp" /> + tools:text="sdfwefef" /> </org.wordpress.android.widgets.FlowLayout> <org.wordpress.android.widgets.WPTextView @@ -92,26 +91,48 @@ android:background="?android:selectableItemBackground" android:orientation="vertical"> - <org.wordpress.android.widgets.WPTextView - android:layout_width="wrap_content" + <LinearLayout + android:layout_width="match_parent" android:layout_height="wrap_content" - android:ellipsize="end" - android:text="@string/role" - android:textColor="@color/grey_dark" - android:textSize="@dimen/text_sz_large" - tools:text="@string/role"/> + android:orientation="horizontal"> + + <org.wordpress.android.widgets.WPTextView + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:ellipsize="end" + android:gravity="center_vertical" + android:text="@string/role" + android:textColor="@color/grey_dark" + android:textSize="@dimen/text_sz_large" + tools:text="@string/role" /> + + <ImageView + android:id="@+id/imgRoleInfo" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:paddingLeft="@dimen/margin_small" + android:paddingRight="@dimen/margin_small" + android:src="@drawable/dashicon_info" /> + </LinearLayout> <org.wordpress.android.widgets.WPTextView android:id="@+id/role" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="5dp" android:layout_marginLeft="1dp" + android:layout_marginTop="5dp" + android:drawableRight="@drawable/arrow" android:ellipsize="end" + android:gravity="center_vertical" android:maxLines="1" + android:paddingBottom="@dimen/margin_medium" + android:paddingLeft="@dimen/margin_medium" + android:paddingRight="@dimen/margin_medium" + android:paddingTop="@dimen/margin_medium" android:textColor="@color/grey" android:textSize="@dimen/text_sz_medium" - tools:text="@string/role"/> + tools:text="@string/role" /> </LinearLayout> @@ -120,15 +141,15 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="@dimen/margin_medium" + android:text="@string/invite_message_title" android:textColor="@color/grey_dark" - android:textSize="@dimen/text_sz_large" - android:text="@string/invite_message_title"/> + android:textSize="@dimen/text_sz_large" /> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="@drawable/invites_border" android:layout_marginTop="5dp" + android:background="@drawable/invites_border" android:padding="2dp"> <org.wordpress.android.widgets.WPEditText @@ -136,21 +157,21 @@ style="@style/WordPress.NUXEditText" android:layout_width="match_parent" android:layout_height="wrap_content" - android:gravity="top" android:layout_marginLeft="0dp" + android:gravity="top" android:inputType="textCapSentences|textAutoCorrect|textMultiLine" - android:minLines="4" - android:maxLength="@integer/invite_message_char_limit"/> + android:maxLength="@integer/invite_message_char_limit" + android:minLines="4" /> <org.wordpress.android.widgets.WPTextView android:id="@+id/message_remaining" android:layout_width="match_parent" android:layout_height="wrap_content" - android:gravity="right" android:layout_below="@+id/message" + android:gravity="right" android:padding="5dp" android:textColor="@color/grey_lighten_10" - android:textSize="@dimen/text_sz_small"/> + android:textSize="@dimen/text_sz_small" /> </RelativeLayout> <org.wordpress.android.widgets.WPTextView @@ -158,9 +179,9 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="5dp" + android:text="@string/invite_message_info" android:textColor="@color/grey_lighten_10" android:textSize="@dimen/text_sz_small" - android:textStyle="italic" - android:text="@string/invite_message_info"/> + android:textStyle="italic" /> </LinearLayout> </ScrollView> diff --git a/WordPress/src/main/res/values/strings.xml b/WordPress/src/main/res/values/strings.xml index 73e7e139e..32637527b 100644 --- a/WordPress/src/main/res/values/strings.xml +++ b/WordPress/src/main/res/values/strings.xml @@ -1574,5 +1574,6 @@ <string name="editor_toast_failed_uploads">Some media uploads have failed. You can\'t save or publish your post in this state. Would you like to remove all failed media?</string> <string name="editor_remove_failed_uploads">Remove failed uploads</string> + <string name="role_info_url">https://en.support.wordpress.com/user-roles/</string> </resources> |