added name for account selector in compose screen
This commit is contained in:
parent
72506e853f
commit
86c77d4dd8
|
@ -48,6 +48,7 @@ public interface Constants extends TwidereConstants {
|
||||||
int MENU_COMPOSE = R.id.compose;
|
int MENU_COMPOSE = R.id.compose;
|
||||||
int MENU_SEND = R.id.send;
|
int MENU_SEND = R.id.send;
|
||||||
int MENU_EDIT = R.id.edit;
|
int MENU_EDIT = R.id.edit;
|
||||||
|
int MENU_INFO = R.id.info;
|
||||||
int MENU_SELECT_ACCOUNT = R.id.select_account;
|
int MENU_SELECT_ACCOUNT = R.id.select_account;
|
||||||
int MENU_SETTINGS = R.id.settings;
|
int MENU_SETTINGS = R.id.settings;
|
||||||
int MENU_ADD_LOCATION = R.id.add_location;
|
int MENU_ADD_LOCATION = R.id.add_location;
|
||||||
|
|
|
@ -1234,11 +1234,13 @@ public class ComposeActivity extends ThemedFragmentActivity implements LocationL
|
||||||
|
|
||||||
private final AccountIconsAdapter adapter;
|
private final AccountIconsAdapter adapter;
|
||||||
private final ShapedImageView iconView;
|
private final ShapedImageView iconView;
|
||||||
|
private final TextView nameView;
|
||||||
|
|
||||||
public AccountIconViewHolder(AccountIconsAdapter adapter, View itemView) {
|
public AccountIconViewHolder(AccountIconsAdapter adapter, View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
this.adapter = adapter;
|
this.adapter = adapter;
|
||||||
iconView = (ShapedImageView) itemView.findViewById(android.R.id.icon);
|
iconView = (ShapedImageView) itemView.findViewById(android.R.id.icon);
|
||||||
|
nameView = (TextView) itemView.findViewById(android.R.id.text1);
|
||||||
itemView.setOnClickListener(this);
|
itemView.setOnClickListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1247,6 +1249,7 @@ public class ComposeActivity extends ThemedFragmentActivity implements LocationL
|
||||||
final MediaLoaderWrapper loader = adapter.getImageLoader();
|
final MediaLoaderWrapper loader = adapter.getImageLoader();
|
||||||
loader.displayProfileImage(iconView, account.profile_image_url);
|
loader.displayProfileImage(iconView, account.profile_image_url);
|
||||||
iconView.setBorderColor(account.color);
|
iconView.setBorderColor(account.color);
|
||||||
|
nameView.setText(adapter.isNameFirst() ? account.name : ("@" + account.screen_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1263,6 +1266,7 @@ public class ComposeActivity extends ThemedFragmentActivity implements LocationL
|
||||||
private final LayoutInflater mInflater;
|
private final LayoutInflater mInflater;
|
||||||
private final MediaLoaderWrapper mImageLoader;
|
private final MediaLoaderWrapper mImageLoader;
|
||||||
private final LongSparseArray<Boolean> mSelection;
|
private final LongSparseArray<Boolean> mSelection;
|
||||||
|
private final boolean mNameFirst;
|
||||||
|
|
||||||
private ParcelableAccount[] mAccounts;
|
private ParcelableAccount[] mAccounts;
|
||||||
|
|
||||||
|
@ -1271,6 +1275,9 @@ public class ComposeActivity extends ThemedFragmentActivity implements LocationL
|
||||||
mInflater = activity.getLayoutInflater();
|
mInflater = activity.getLayoutInflater();
|
||||||
mImageLoader = TwidereApplication.getInstance(activity).getMediaLoaderWrapper();
|
mImageLoader = TwidereApplication.getInstance(activity).getMediaLoaderWrapper();
|
||||||
mSelection = new LongSparseArray<>();
|
mSelection = new LongSparseArray<>();
|
||||||
|
final SharedPreferencesWrapper preferences = SharedPreferencesWrapper.getInstance(activity,
|
||||||
|
SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE, SharedPreferenceConstants.class);
|
||||||
|
mNameFirst = preferences.getBoolean(KEY_NAME_FIRST);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MediaLoaderWrapper getImageLoader() {
|
public MediaLoaderWrapper getImageLoader() {
|
||||||
|
@ -1351,6 +1358,10 @@ public class ComposeActivity extends ThemedFragmentActivity implements LocationL
|
||||||
mActivity.notifyAccountSelectionChanged();
|
mActivity.notifyAccountSelectionChanged();
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isNameFirst() {
|
||||||
|
return mNameFirst;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class AddBitmapTask extends AddMediaTask {
|
private static class AddBitmapTask extends AddMediaTask {
|
||||||
|
|
|
@ -353,6 +353,7 @@ public class LinkHandlerActivity extends BaseAppCompatActivity implements System
|
||||||
switch (linkId) {
|
switch (linkId) {
|
||||||
case LINK_ID_SEARCH:
|
case LINK_ID_SEARCH:
|
||||||
case LINK_ID_USER_LISTS:
|
case LINK_ID_USER_LISTS:
|
||||||
|
case LINK_ID_USER_LIST:
|
||||||
case LINK_ID_FILTERS: {
|
case LINK_ID_FILTERS: {
|
||||||
ThemeUtils.applyActionBarBackground(actionBarContainer, this, themeId, themeColor, option, false);
|
ThemeUtils.applyActionBarBackground(actionBarContainer, this, themeId, themeColor, option, false);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -43,8 +43,6 @@ import android.support.v4.app.LoaderManager.LoaderCallbacks;
|
||||||
import android.support.v4.content.AsyncTaskLoader;
|
import android.support.v4.content.AsyncTaskLoader;
|
||||||
import android.support.v4.content.Loader;
|
import android.support.v4.content.Loader;
|
||||||
import android.support.v4.view.ViewPager;
|
import android.support.v4.view.ViewPager;
|
||||||
import android.support.v7.widget.CardView;
|
|
||||||
import android.text.method.LinkMovementMethod;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
|
@ -55,8 +53,6 @@ import android.view.View.OnClickListener;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import org.mariotaku.twidere.R;
|
import org.mariotaku.twidere.R;
|
||||||
import org.mariotaku.twidere.activity.iface.IThemedActivity;
|
import org.mariotaku.twidere.activity.iface.IThemedActivity;
|
||||||
|
@ -67,6 +63,7 @@ import org.mariotaku.twidere.app.TwidereApplication;
|
||||||
import org.mariotaku.twidere.constant.SharedPreferenceConstants;
|
import org.mariotaku.twidere.constant.SharedPreferenceConstants;
|
||||||
import org.mariotaku.twidere.fragment.iface.IBaseFragment.SystemWindowsInsetsCallback;
|
import org.mariotaku.twidere.fragment.iface.IBaseFragment.SystemWindowsInsetsCallback;
|
||||||
import org.mariotaku.twidere.fragment.iface.SupportFragmentCallback;
|
import org.mariotaku.twidere.fragment.iface.SupportFragmentCallback;
|
||||||
|
import org.mariotaku.twidere.graphic.EmptyDrawable;
|
||||||
import org.mariotaku.twidere.model.ParcelableUser;
|
import org.mariotaku.twidere.model.ParcelableUser;
|
||||||
import org.mariotaku.twidere.model.ParcelableUserList;
|
import org.mariotaku.twidere.model.ParcelableUserList;
|
||||||
import org.mariotaku.twidere.model.SingleResponse;
|
import org.mariotaku.twidere.model.SingleResponse;
|
||||||
|
@ -80,39 +77,28 @@ import org.mariotaku.twidere.util.ThemeUtils;
|
||||||
import org.mariotaku.twidere.util.TwidereLinkify;
|
import org.mariotaku.twidere.util.TwidereLinkify;
|
||||||
import org.mariotaku.twidere.util.UserColorNameManager;
|
import org.mariotaku.twidere.util.UserColorNameManager;
|
||||||
import org.mariotaku.twidere.util.Utils;
|
import org.mariotaku.twidere.util.Utils;
|
||||||
import org.mariotaku.twidere.view.ColorLabelLinearLayout;
|
|
||||||
import org.mariotaku.twidere.view.HeaderDrawerLayout;
|
|
||||||
import org.mariotaku.twidere.view.HeaderDrawerLayout.DrawerCallback;
|
|
||||||
import org.mariotaku.twidere.view.TabPagerIndicator;
|
import org.mariotaku.twidere.view.TabPagerIndicator;
|
||||||
|
|
||||||
import twitter4j.Twitter;
|
import twitter4j.Twitter;
|
||||||
import twitter4j.TwitterException;
|
import twitter4j.TwitterException;
|
||||||
import twitter4j.UserList;
|
import twitter4j.UserList;
|
||||||
|
|
||||||
import static android.text.TextUtils.isEmpty;
|
|
||||||
import static org.mariotaku.twidere.util.MenuUtils.setMenuItemAvailability;
|
import static org.mariotaku.twidere.util.MenuUtils.setMenuItemAvailability;
|
||||||
import static org.mariotaku.twidere.util.Utils.addIntentToMenu;
|
import static org.mariotaku.twidere.util.Utils.addIntentToMenu;
|
||||||
import static org.mariotaku.twidere.util.Utils.getAccountColor;
|
|
||||||
import static org.mariotaku.twidere.util.Utils.getTwitterInstance;
|
import static org.mariotaku.twidere.util.Utils.getTwitterInstance;
|
||||||
import static org.mariotaku.twidere.util.Utils.openUserListDetails;
|
import static org.mariotaku.twidere.util.Utils.openUserListDetails;
|
||||||
import static org.mariotaku.twidere.util.Utils.openUserProfile;
|
import static org.mariotaku.twidere.util.Utils.openUserProfile;
|
||||||
|
|
||||||
public class UserListFragment extends BaseSupportFragment implements OnClickListener,
|
public class UserListFragment extends BaseSupportFragment implements OnClickListener,
|
||||||
LoaderCallbacks<SingleResponse<ParcelableUserList>>, DrawerCallback,
|
LoaderCallbacks<SingleResponse<ParcelableUserList>>, SystemWindowsInsetsCallback,
|
||||||
SystemWindowsInsetsCallback, SupportFragmentCallback {
|
SupportFragmentCallback {
|
||||||
|
|
||||||
private MediaLoaderWrapper mProfileImageLoader;
|
private MediaLoaderWrapper mProfileImageLoader;
|
||||||
private AsyncTwitterWrapper mTwitterWrapper;
|
private AsyncTwitterWrapper mTwitterWrapper;
|
||||||
|
|
||||||
private ImageView mProfileImageView;
|
|
||||||
private TextView mListNameView, mCreatedByView, mDescriptionView, mErrorTextView;
|
|
||||||
private View mErrorContainer, mProgressContainer;
|
|
||||||
private ColorLabelLinearLayout mUserListDetails;
|
|
||||||
private ImageView mErrorIconView;
|
|
||||||
private HeaderDrawerLayout mHeaderDrawerLayout;
|
|
||||||
private ViewPager mViewPager;
|
private ViewPager mViewPager;
|
||||||
private TabPagerIndicator mPagerIndicator;
|
private TabPagerIndicator mPagerIndicator;
|
||||||
private CardView mCardView;
|
private View mPagerOverlay;
|
||||||
|
|
||||||
private SupportTabsAdapter mPagerAdapter;
|
private SupportTabsAdapter mPagerAdapter;
|
||||||
private boolean mUserListLoaderInitialized;
|
private boolean mUserListLoaderInitialized;
|
||||||
|
@ -141,78 +127,16 @@ public class UserListFragment extends BaseSupportFragment implements OnClickList
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canScroll(float dy) {
|
|
||||||
final Fragment fragment = getCurrentVisibleFragment();
|
|
||||||
return fragment instanceof DrawerCallback && ((DrawerCallback) fragment).canScroll(dy);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void cancelTouch() {
|
|
||||||
final Fragment fragment = getCurrentVisibleFragment();
|
|
||||||
if (fragment instanceof DrawerCallback) {
|
|
||||||
((DrawerCallback) fragment).cancelTouch();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void fling(float velocity) {
|
|
||||||
final Fragment fragment = getCurrentVisibleFragment();
|
|
||||||
if (fragment instanceof DrawerCallback) {
|
|
||||||
((DrawerCallback) fragment).fling(velocity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isScrollContent(float x, float y) {
|
|
||||||
final ViewPager v = mViewPager;
|
|
||||||
final int[] location = new int[2];
|
|
||||||
v.getLocationOnScreen(location);
|
|
||||||
return x >= location[0] && x <= location[0] + v.getWidth()
|
|
||||||
&& y >= location[1] && y <= location[1] + v.getHeight();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void scrollBy(float dy) {
|
|
||||||
final Fragment fragment = getCurrentVisibleFragment();
|
|
||||||
if (fragment instanceof DrawerCallback) {
|
|
||||||
((DrawerCallback) fragment).scrollBy(dy);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldLayoutHeaderBottom() {
|
|
||||||
final HeaderDrawerLayout drawer = mHeaderDrawerLayout;
|
|
||||||
final CardView card = mCardView;
|
|
||||||
if (drawer == null || card == null) return false;
|
|
||||||
return card.getTop() + drawer.getHeaderTop() - drawer.getPaddingTop() <= 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void topChanged(int offset) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void displayUserList(final ParcelableUserList userList) {
|
public void displayUserList(final ParcelableUserList userList) {
|
||||||
if (userList == null || getActivity() == null) return;
|
if (userList == null || getActivity() == null) return;
|
||||||
getLoaderManager().destroyLoader(0);
|
getLoaderManager().destroyLoader(0);
|
||||||
mErrorContainer.setVisibility(View.GONE);
|
|
||||||
mProgressContainer.setVisibility(View.GONE);
|
|
||||||
mUserList = userList;
|
mUserList = userList;
|
||||||
mUserListDetails.drawEnd(getAccountColor(getActivity(), userList.account_id));
|
|
||||||
mListNameView.setText(userList.name);
|
|
||||||
|
|
||||||
final boolean nameFirst = mPreferences.getBoolean(KEY_NAME_FIRST);
|
final boolean nameFirst = mPreferences.getBoolean(KEY_NAME_FIRST);
|
||||||
final String displayName = mUserColorNameManager.getDisplayName(userList, nameFirst, false);
|
final String displayName = mUserColorNameManager.getDisplayName(userList, nameFirst, false);
|
||||||
mCreatedByView.setText(getString(R.string.created_by, displayName));
|
|
||||||
final String description = userList.description;
|
final String description = userList.description;
|
||||||
mDescriptionView.setVisibility(isEmpty(description) ? View.GONE : View.VISIBLE);
|
|
||||||
mDescriptionView.setText(description);
|
|
||||||
final TwidereLinkify linkify = new TwidereLinkify(new OnLinkClickHandler(getActivity(),
|
final TwidereLinkify linkify = new TwidereLinkify(new OnLinkClickHandler(getActivity(),
|
||||||
getMultiSelectManager()));
|
getMultiSelectManager()));
|
||||||
linkify.applyAllLinks(mDescriptionView, userList.account_id, false);
|
|
||||||
mDescriptionView.setMovementMethod(LinkMovementMethod.getInstance());
|
|
||||||
mProfileImageLoader.displayProfileImage(mProfileImageView, userList.user_profile_image_url);
|
|
||||||
invalidateOptionsMenu();
|
invalidateOptionsMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,15 +197,7 @@ public class UserListFragment extends BaseSupportFragment implements OnClickList
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
|
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
|
||||||
final View view = inflater.inflate(R.layout.fragment_user_list, container, false);
|
return inflater.inflate(R.layout.fragment_content_pages, container, false);
|
||||||
final ViewGroup listDetailsContainer = (ViewGroup) view.findViewById(R.id.list_details_container);
|
|
||||||
final boolean isCompact = Utils.isCompactCards(getActivity());
|
|
||||||
if (isCompact) {
|
|
||||||
inflater.inflate(R.layout.layout_user_list_details_compact, listDetailsContainer);
|
|
||||||
} else {
|
|
||||||
inflater.inflate(R.layout.layout_user_list_details, listDetailsContainer);
|
|
||||||
}
|
|
||||||
return view;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -310,8 +226,6 @@ public class UserListFragment extends BaseSupportFragment implements OnClickList
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mHeaderDrawerLayout.setDrawerCallback(this);
|
|
||||||
|
|
||||||
mPagerAdapter = new SupportTabsAdapter(activity, getChildFragmentManager());
|
mPagerAdapter = new SupportTabsAdapter(activity, getChildFragmentManager());
|
||||||
|
|
||||||
mViewPager.setAdapter(mPagerAdapter);
|
mViewPager.setAdapter(mPagerAdapter);
|
||||||
|
@ -322,12 +236,7 @@ public class UserListFragment extends BaseSupportFragment implements OnClickList
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mProfileImageView.setOnClickListener(this);
|
|
||||||
mUserListDetails.setOnClickListener(this);
|
|
||||||
mErrorIconView.setOnClickListener(this);
|
|
||||||
getUserListInfo(false);
|
getUserListInfo(false);
|
||||||
|
|
||||||
setupUserPages();
|
setupUserPages();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -364,23 +273,17 @@ public class UserListFragment extends BaseSupportFragment implements OnClickList
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPrepareOptionsMenu(Menu menu) {
|
public void onPrepareOptionsMenu(Menu menu) {
|
||||||
final AsyncTwitterWrapper twitter = getTwitterWrapper();
|
|
||||||
final ParcelableUserList userList = mUserList;
|
final ParcelableUserList userList = mUserList;
|
||||||
final MenuItem followItem = menu.findItem(MENU_FOLLOW);
|
setMenuItemAvailability(menu, MENU_INFO, userList != null);
|
||||||
if (followItem != null) {
|
menu.removeGroup(MENU_GROUP_USER_LIST_EXTENSION);
|
||||||
followItem.setEnabled(userList != null);
|
if (userList != null) {
|
||||||
if (userList == null) {
|
final boolean isMyList = userList.user_id == userList.account_id;
|
||||||
followItem.setIcon(android.R.color.transparent);
|
final boolean isFollowing = userList.is_following;
|
||||||
}
|
setMenuItemAvailability(menu, MENU_EDIT, isMyList);
|
||||||
}
|
setMenuItemAvailability(menu, MENU_FOLLOW, !isMyList);
|
||||||
if (twitter == null || userList == null) return;
|
setMenuItemAvailability(menu, MENU_ADD, isMyList);
|
||||||
final boolean isMyList = userList.user_id == userList.account_id;
|
setMenuItemAvailability(menu, MENU_DELETE, isMyList);
|
||||||
setMenuItemAvailability(menu, MENU_EDIT, isMyList);
|
final MenuItem followItem = menu.findItem(MENU_FOLLOW);
|
||||||
setMenuItemAvailability(menu, MENU_ADD, isMyList);
|
|
||||||
setMenuItemAvailability(menu, MENU_DELETE, isMyList);
|
|
||||||
final boolean isFollowing = userList.is_following;
|
|
||||||
if (followItem != null) {
|
|
||||||
followItem.setVisible(!isMyList);
|
|
||||||
if (isFollowing) {
|
if (isFollowing) {
|
||||||
followItem.setIcon(R.drawable.ic_action_cancel);
|
followItem.setIcon(R.drawable.ic_action_cancel);
|
||||||
followItem.setTitle(R.string.unsubscribe);
|
followItem.setTitle(R.string.unsubscribe);
|
||||||
|
@ -388,12 +291,16 @@ public class UserListFragment extends BaseSupportFragment implements OnClickList
|
||||||
followItem.setIcon(R.drawable.ic_action_add);
|
followItem.setIcon(R.drawable.ic_action_add);
|
||||||
followItem.setTitle(R.string.subscribe);
|
followItem.setTitle(R.string.subscribe);
|
||||||
}
|
}
|
||||||
|
final Intent extensionsIntent = new Intent(INTENT_ACTION_EXTENSION_OPEN_USER_LIST);
|
||||||
|
extensionsIntent.setExtrasClassLoader(getActivity().getClassLoader());
|
||||||
|
extensionsIntent.putExtra(EXTRA_USER_LIST, userList);
|
||||||
|
addIntentToMenu(getActivity(), menu, extensionsIntent, MENU_GROUP_USER_LIST_EXTENSION);
|
||||||
|
} else {
|
||||||
|
setMenuItemAvailability(menu, MENU_EDIT, false);
|
||||||
|
setMenuItemAvailability(menu, MENU_FOLLOW, false);
|
||||||
|
setMenuItemAvailability(menu, MENU_ADD, false);
|
||||||
|
setMenuItemAvailability(menu, MENU_DELETE, false);
|
||||||
}
|
}
|
||||||
menu.removeGroup(MENU_GROUP_USER_LIST_EXTENSION);
|
|
||||||
final Intent extensionsIntent = new Intent(INTENT_ACTION_EXTENSION_OPEN_USER_LIST);
|
|
||||||
extensionsIntent.setExtrasClassLoader(getActivity().getClassLoader());
|
|
||||||
extensionsIntent.putExtra(EXTRA_USER_LIST, mUserList);
|
|
||||||
addIntentToMenu(getActivity(), menu, extensionsIntent, MENU_GROUP_USER_LIST_EXTENSION);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -476,11 +383,6 @@ public class UserListFragment extends BaseSupportFragment implements OnClickList
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Loader<SingleResponse<ParcelableUserList>> onCreateLoader(final int id, final Bundle args) {
|
public Loader<SingleResponse<ParcelableUserList>> onCreateLoader(final int id, final Bundle args) {
|
||||||
mErrorTextView.setText(null);
|
|
||||||
mErrorTextView.setVisibility(View.GONE);
|
|
||||||
mErrorContainer.setVisibility(View.GONE);
|
|
||||||
mHeaderDrawerLayout.setVisibility(View.GONE);
|
|
||||||
mProgressContainer.setVisibility(View.VISIBLE);
|
|
||||||
setProgressBarIndeterminateVisibility(true);
|
setProgressBarIndeterminateVisibility(true);
|
||||||
final long accountId = args != null ? args.getLong(EXTRA_ACCOUNT_ID, -1) : -1;
|
final long accountId = args != null ? args.getLong(EXTRA_ACCOUNT_ID, -1) : -1;
|
||||||
final long userId = args != null ? args.getLong(EXTRA_USER_ID, -1) : -1;
|
final long userId = args != null ? args.getLong(EXTRA_USER_ID, -1) : -1;
|
||||||
|
@ -497,20 +399,10 @@ public class UserListFragment extends BaseSupportFragment implements OnClickList
|
||||||
final SingleResponse<ParcelableUserList> data) {
|
final SingleResponse<ParcelableUserList> data) {
|
||||||
if (data == null) return;
|
if (data == null) return;
|
||||||
if (getActivity() == null) return;
|
if (getActivity() == null) return;
|
||||||
if (data.getData() != null) {
|
if (data.hasData()) {
|
||||||
final ParcelableUserList list = data.getData();
|
final ParcelableUserList list = data.getData();
|
||||||
displayUserList(list);
|
displayUserList(list);
|
||||||
mHeaderDrawerLayout.setVisibility(View.VISIBLE);
|
} else if (data.hasException()) {
|
||||||
mErrorContainer.setVisibility(View.GONE);
|
|
||||||
mProgressContainer.setVisibility(View.GONE);
|
|
||||||
} else {
|
|
||||||
if (data.hasException()) {
|
|
||||||
mErrorTextView.setText(data.getException().getMessage());
|
|
||||||
mErrorTextView.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
mHeaderDrawerLayout.setVisibility(View.GONE);
|
|
||||||
mErrorContainer.setVisibility(View.VISIBLE);
|
|
||||||
mProgressContainer.setVisibility(View.GONE);
|
|
||||||
}
|
}
|
||||||
setProgressBarIndeterminateVisibility(false);
|
setProgressBarIndeterminateVisibility(false);
|
||||||
}
|
}
|
||||||
|
@ -523,39 +415,12 @@ public class UserListFragment extends BaseSupportFragment implements OnClickList
|
||||||
@Override
|
@Override
|
||||||
public void onBaseViewCreated(final View view, final Bundle savedInstanceState) {
|
public void onBaseViewCreated(final View view, final Bundle savedInstanceState) {
|
||||||
super.onBaseViewCreated(view, savedInstanceState);
|
super.onBaseViewCreated(view, savedInstanceState);
|
||||||
mHeaderDrawerLayout = (HeaderDrawerLayout) view.findViewById(R.id.details_container);
|
mViewPager = (ViewPager) view.findViewById(R.id.view_pager);
|
||||||
mErrorContainer = view.findViewById(R.id.error_container);
|
mPagerIndicator = (TabPagerIndicator) view.findViewById(R.id.view_pager_tabs);
|
||||||
mProgressContainer = view.findViewById(R.id.progress_container);
|
mPagerOverlay = view.findViewById(R.id.pager_window_overlay);
|
||||||
|
|
||||||
final View headerView = mHeaderDrawerLayout.getHeader();
|
|
||||||
final View contentView = mHeaderDrawerLayout.getContent();
|
|
||||||
mCardView = (CardView) headerView.findViewById(R.id.card);
|
|
||||||
mUserListDetails = (ColorLabelLinearLayout) headerView.findViewById(R.id.user_list_details);
|
|
||||||
mListNameView = (TextView) headerView.findViewById(R.id.list_name);
|
|
||||||
mCreatedByView = (TextView) headerView.findViewById(R.id.created_by);
|
|
||||||
mDescriptionView = (TextView) headerView.findViewById(R.id.description);
|
|
||||||
mProfileImageView = (ImageView) headerView.findViewById(R.id.profile_image);
|
|
||||||
mErrorIconView = (ImageView) mErrorContainer.findViewById(R.id.error_icon);
|
|
||||||
mErrorTextView = (TextView) mErrorContainer.findViewById(R.id.error_text);
|
|
||||||
mViewPager = (ViewPager) contentView.findViewById(R.id.view_pager);
|
|
||||||
mPagerIndicator = (TabPagerIndicator) contentView.findViewById(R.id.view_pager_tabs);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void fitSystemWindows(Rect insets) {
|
|
||||||
final View progress = mProgressContainer, error = mErrorContainer;
|
|
||||||
final HeaderDrawerLayout content = mHeaderDrawerLayout;
|
|
||||||
if (progress == null || error == null || content == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
progress.setPadding(insets.left, insets.top, insets.right, insets.bottom);
|
|
||||||
error.setPadding(insets.left, insets.top, insets.right, insets.bottom);
|
|
||||||
content.setPadding(insets.left, insets.top, insets.right, insets.bottom);
|
|
||||||
content.setClipToPadding(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupUserPages() {
|
private void setupUserPages() {
|
||||||
final Context context = getActivity();
|
|
||||||
final Bundle args = getArguments(), tabArgs = new Bundle();
|
final Bundle args = getArguments(), tabArgs = new Bundle();
|
||||||
if (args.containsKey(EXTRA_USER)) {
|
if (args.containsKey(EXTRA_USER)) {
|
||||||
final ParcelableUserList userList = args.getParcelable(EXTRA_USER_LIST);
|
final ParcelableUserList userList = args.getParcelable(EXTRA_USER_LIST);
|
||||||
|
@ -574,7 +439,12 @@ public class UserListFragment extends BaseSupportFragment implements OnClickList
|
||||||
mPagerAdapter.addTab(UserListTimelineFragment.class, tabArgs, getString(R.string.statuses), null, 0, null);
|
mPagerAdapter.addTab(UserListTimelineFragment.class, tabArgs, getString(R.string.statuses), null, 0, null);
|
||||||
mPagerAdapter.addTab(UserListMembersFragment.class, tabArgs, getString(R.string.members), null, 1, null);
|
mPagerAdapter.addTab(UserListMembersFragment.class, tabArgs, getString(R.string.members), null, 1, null);
|
||||||
mPagerAdapter.addTab(UserListSubscribersFragment.class, tabArgs, getString(R.string.subscribers), null, 2, null);
|
mPagerAdapter.addTab(UserListSubscribersFragment.class, tabArgs, getString(R.string.subscribers), null, 2, null);
|
||||||
mPagerIndicator.notifyDataSetChanged();
|
|
||||||
|
final FragmentActivity activity = getActivity();
|
||||||
|
ThemeUtils.initPagerIndicatorAsActionBarTab(activity, mPagerIndicator, mPagerOverlay);
|
||||||
|
ThemeUtils.setCompatToolbarOverlay(activity, new EmptyDrawable());
|
||||||
|
ThemeUtils.setCompatContentViewOverlay(activity, new EmptyDrawable());
|
||||||
|
ThemeUtils.setWindowOverlayViewOverlay(activity, new EmptyDrawable());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class EditUserListDialogFragment extends BaseSupportDialogFragment implements
|
public static class EditUserListDialogFragment extends BaseSupportDialogFragment implements
|
||||||
|
|
|
@ -108,7 +108,7 @@
|
||||||
|
|
||||||
<android.support.v7.widget.RecyclerView
|
<android.support.v7.widget.RecyclerView
|
||||||
android:id="@+id/account_selector"
|
android:id="@+id/account_selector"
|
||||||
android:layout_width="?actionBarSize"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="left"
|
android:layout_gravity="left"
|
||||||
android:overScrollMode="never"/>
|
android:overScrollMode="never"/>
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
<!--
|
|
||||||
~ Twidere - Twitter client for Android
|
~ Twidere - Twitter client for Android
|
||||||
~
|
~
|
||||||
~ Copyright (C) 2012-2014 Mariotaku Lee <mariotaku.lee@gmail.com>
|
~ Copyright (C) 2012-2014 Mariotaku Lee <mariotaku.lee@gmail.com>
|
||||||
|
@ -17,15 +16,31 @@
|
||||||
~ You should have received a copy of the GNU General Public License
|
~ You should have received a copy of the GNU General Public License
|
||||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
-->
|
-->
|
||||||
<org.mariotaku.twidere.view.SquareShapedImageView
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@android:id/icon"
|
|
||||||
style="?profileImageStyle"
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tool="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="?actionBarSize"
|
||||||
android:layout_margin="@dimen/element_spacing_msmall"
|
android:gravity="center_vertical"
|
||||||
app:sivBorder="true"
|
android:orientation="horizontal"
|
||||||
app:sivBorderWidth="@dimen/line_width_compose_account_profile_image"
|
android:padding="@dimen/element_spacing_msmall">
|
||||||
tools:layout_width="48dp"/>
|
|
||||||
|
<org.mariotaku.twidere.view.SquareShapedImageView
|
||||||
|
android:id="@android:id/icon"
|
||||||
|
style="?profileImageStyle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
app:sivBorder="true"
|
||||||
|
app:sivBorderWidth="@dimen/line_width_compose_account_profile_image" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@android:id/text1"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="@dimen/element_spacing_normal"
|
||||||
|
android:textAppearance="?android:textAppearanceSmall"
|
||||||
|
android:textColor="?android:textColorPrimary"
|
||||||
|
android:textStyle="bold"
|
||||||
|
tool:text="Name" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -1,27 +1,35 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@id/info"
|
||||||
|
android:icon="@drawable/ic_action_info"
|
||||||
|
android:title="@string/user_list_details"
|
||||||
|
app:showAsAction="ifRoom"
|
||||||
|
android:visible="false" />
|
||||||
|
<item
|
||||||
|
android:id="@id/follow"
|
||||||
|
android:enabled="false"
|
||||||
|
app:showAsAction="ifRoom"
|
||||||
|
android:icon="@drawable/ic_action_add"
|
||||||
|
android:title="@string/subscribe" />
|
||||||
<item
|
<item
|
||||||
android:id="@id/edit"
|
android:id="@id/edit"
|
||||||
android:icon="@drawable/ic_action_edit"
|
android:icon="@drawable/ic_action_edit"
|
||||||
android:title="@string/edit_profile"
|
android:title="@string/edit_profile"
|
||||||
android:visible="false"/>
|
android:visible="false" />
|
||||||
<item
|
|
||||||
android:id="@id/follow"
|
|
||||||
android:enabled="false"
|
|
||||||
android:icon="@android:color/transparent"
|
|
||||||
android:title="@string/subscribe"/>
|
|
||||||
<item
|
<item
|
||||||
android:id="@id/add"
|
android:id="@id/add"
|
||||||
android:icon="@drawable/ic_action_add"
|
android:icon="@drawable/ic_action_add"
|
||||||
android:title="@string/add_member"/>
|
android:title="@string/add_member" />
|
||||||
<item
|
<item
|
||||||
android:id="@id/delete"
|
android:id="@id/delete"
|
||||||
android:icon="@drawable/ic_action_delete"
|
android:icon="@drawable/ic_action_delete"
|
||||||
android:title="@string/delete"/>
|
android:title="@string/delete" />
|
||||||
<item
|
<item
|
||||||
android:id="@id/open_with_account"
|
android:id="@id/open_with_account"
|
||||||
android:icon="@drawable/ic_action_accounts"
|
android:icon="@drawable/ic_action_accounts"
|
||||||
android:title="@string/open_with_account"/>
|
android:title="@string/open_with_account" />
|
||||||
|
|
||||||
</menu>
|
</menu>
|
|
@ -77,4 +77,5 @@
|
||||||
<item name="inverse_selection" type="id"/>
|
<item name="inverse_selection" type="id"/>
|
||||||
<item name="edit_media" type="id"/>
|
<item name="edit_media" type="id"/>
|
||||||
<item name="reset" type="id"/>
|
<item name="reset" type="id"/>
|
||||||
|
<item name="info" type="id"/>
|
||||||
</resources>
|
</resources>
|
|
@ -739,4 +739,5 @@
|
||||||
<string name="swipe_down_to_refresh">Swipe down to refresh</string>
|
<string name="swipe_down_to_refresh">Swipe down to refresh</string>
|
||||||
<string name="app_restart_confirm">Twidere will restart to apply settings.</string>
|
<string name="app_restart_confirm">Twidere will restart to apply settings.</string>
|
||||||
<string name="dont_restart">Don\'t restart</string>
|
<string name="dont_restart">Don\'t restart</string>
|
||||||
|
<string name="user_list_details">List details</string>
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in New Issue