fixed activity tab account selection

This commit is contained in:
Mariotaku Lee 2015-04-27 00:51:14 +08:00
parent 1a0d3eeb83
commit c40835b7c9
3 changed files with 16 additions and 11 deletions

View File

@ -106,6 +106,7 @@ public class ParcelableAccount implements Parcelable {
}
public ParcelableAccount() {
is_dummy = true;
}
@Override

View File

@ -80,20 +80,17 @@ public class AccountsSpinnerAdapter extends ArrayAdapter<ParcelableAccount> {
final TextView text1 = (TextView) view.findViewById(android.R.id.text1);
final TextView text2 = (TextView) view.findViewById(android.R.id.text2);
final ImageView icon = (ImageView) view.findViewById(android.R.id.icon);
if (text2 != null) {
text2.setVisibility(item.is_dummy ? View.GONE : View.VISIBLE);
}
if (icon != null) {
icon.setVisibility(item.is_dummy ? View.GONE : View.VISIBLE);
}
if (!item.is_dummy) {
if (text1 != null) {
text1.setVisibility(View.VISIBLE);
text1.setText(item.name);
}
if (text2 != null) {
text2.setVisibility(View.VISIBLE);
text2.setText(String.format("@%s", item.screen_name));
}
if (icon != null) {
icon.setVisibility(View.VISIBLE);
if (mDisplayProfileImage) {
mImageLoader.displayProfileImage(icon, item.profile_image_url);
} else {
@ -101,9 +98,18 @@ public class AccountsSpinnerAdapter extends ArrayAdapter<ParcelableAccount> {
// icon.setImageResource(R.drawable.ic_profile_image_default);
}
}
} else if (text1 != null) {
} else {
if (text1 != null) {
text1.setVisibility(View.VISIBLE);
text1.setText(mDummyItemText);
}
if (text2 != null) {
text2.setVisibility(View.GONE);
}
if (icon != null) {
icon.setVisibility(View.GONE);
}
}
}

View File

@ -94,7 +94,7 @@ public class CustomTabUtils implements Constants {
CustomTabConfiguration.ACCOUNT_REQUIRED, CustomTabConfiguration.FIELD_TYPE_USER_LIST, 7));
CUSTOM_TABS_CONFIGURATION_MAP.put(TAB_TYPE_ACTIVITIES_ABOUT_ME, new CustomTabConfiguration(
ActivitiesAboutMeFragment.class, R.string.activities_about_me, R.drawable.ic_action_user,
CustomTabConfiguration.ACCOUNT_OPTIONAL, CustomTabConfiguration.FIELD_TYPE_NONE, 8));
CustomTabConfiguration.ACCOUNT_REQUIRED, CustomTabConfiguration.FIELD_TYPE_NONE, 8));
CUSTOM_TABS_CONFIGURATION_MAP.put(TAB_TYPE_ACTIVITIES_BY_FRIENDS, new CustomTabConfiguration(
ActivitiesByFriendsFragment.class, R.string.activities_by_friends,
R.drawable.ic_action_accounts, CustomTabConfiguration.ACCOUNT_REQUIRED,
@ -102,8 +102,6 @@ public class CustomTabUtils implements Constants {
CUSTOM_TABS_CONFIGURATION_MAP.put(TAB_TYPE_RETWEETS_OF_ME, new CustomTabConfiguration(
RetweetsOfMeFragment.class, R.string.retweets_of_me, R.drawable.ic_action_retweet,
CustomTabConfiguration.ACCOUNT_REQUIRED, CustomTabConfiguration.FIELD_TYPE_NONE, 10));
if (Utils.hasStaggeredTimeline()) {
}
CUSTOM_TABS_ICON_NAME_MAP.put("accounts", R.drawable.ic_action_accounts);
CUSTOM_TABS_ICON_NAME_MAP.put("hashtag", R.drawable.ic_action_hashtag);