mirror of
https://github.com/TwidereProject/Twidere-Android
synced 2025-02-17 04:00:48 +01:00
experimental support for tablet
menu button should work for sliding menu
This commit is contained in:
parent
660f68c26e
commit
0b32629de5
@ -70,7 +70,7 @@ public class ParcelableUser implements TwidereParcelable, Comparable<ParcelableU
|
||||
public final String description_plain, name, screen_name, location, profile_image_url, profile_banner_url, url,
|
||||
url_expanded, description_html, description_unescaped, description_expanded;
|
||||
|
||||
public final int followers_count, friends_count, statuses_count, favorites_count, listed_count;
|
||||
public final int followers_count, friends_count, statuses_count, favorites_count, listed_count, media_count;
|
||||
|
||||
public final int background_color, link_color, text_color;
|
||||
|
||||
@ -102,6 +102,7 @@ public class ParcelableUser implements TwidereParcelable, Comparable<ParcelableU
|
||||
statuses_count = 0;
|
||||
favorites_count = 0;
|
||||
listed_count = 0;
|
||||
media_count = 0;
|
||||
background_color = 0;
|
||||
link_color = 0;
|
||||
text_color = 0;
|
||||
@ -137,6 +138,7 @@ public class ParcelableUser implements TwidereParcelable, Comparable<ParcelableU
|
||||
background_color = indices.background_color != -1 ? cursor.getInt(indices.background_color) : 0;
|
||||
link_color = indices.link_color != -1 ? cursor.getInt(indices.link_color) : 0;
|
||||
text_color = indices.text_color != -1 ? cursor.getInt(indices.text_color) : 0;
|
||||
media_count = indices.media_count != -1 ? cursor.getInt(indices.media_count) : 0;
|
||||
is_cache = true;
|
||||
is_basic = indices.description_plain == -1 || indices.url == -1 || indices.location == -1;
|
||||
}
|
||||
@ -164,6 +166,7 @@ public class ParcelableUser implements TwidereParcelable, Comparable<ParcelableU
|
||||
statuses_count = in.readInt("statuses_count");
|
||||
favorites_count = in.readInt("favorites_count");
|
||||
listed_count = in.readInt("listed_count");
|
||||
media_count = in.readInt("media_count");
|
||||
url_expanded = in.readString("url_expanded");
|
||||
is_following = in.readBoolean("is_following");
|
||||
background_color = in.readInt("background_color");
|
||||
@ -196,6 +199,7 @@ public class ParcelableUser implements TwidereParcelable, Comparable<ParcelableU
|
||||
statuses_count = in.readInt();
|
||||
favorites_count = in.readInt();
|
||||
listed_count = in.readInt();
|
||||
media_count = in.readInt();
|
||||
url_expanded = in.readString();
|
||||
is_following = in.readInt() == 1;
|
||||
background_color = in.readInt();
|
||||
@ -234,6 +238,7 @@ public class ParcelableUser implements TwidereParcelable, Comparable<ParcelableU
|
||||
statuses_count = user.getStatusesCount();
|
||||
favorites_count = user.getFavouritesCount();
|
||||
listed_count = user.getListedCount();
|
||||
media_count = user.getMediaCount();
|
||||
is_following = user.isFollowing();
|
||||
background_color = ParseUtils.parseColor("#" + user.getProfileBackgroundColor(), 0);
|
||||
link_color = ParseUtils.parseColor("#" + user.getProfileLinkColor(), 0);
|
||||
@ -270,8 +275,8 @@ public class ParcelableUser implements TwidereParcelable, Comparable<ParcelableU
|
||||
out.writeLong(account_id);
|
||||
out.writeLong(id);
|
||||
out.writeLong(created_at);
|
||||
out.writeInt(is_protected ? 1 : 0);
|
||||
out.writeInt(is_verified ? 1 : 0);
|
||||
out.writeByte((byte) (is_protected ? 1 : 0));
|
||||
out.writeByte((byte) (is_verified ? 1 : 0));
|
||||
out.writeString(name);
|
||||
out.writeString(screen_name);
|
||||
out.writeString(description_plain);
|
||||
@ -282,19 +287,20 @@ public class ParcelableUser implements TwidereParcelable, Comparable<ParcelableU
|
||||
out.writeString(profile_image_url);
|
||||
out.writeString(profile_banner_url);
|
||||
out.writeString(url);
|
||||
out.writeInt(is_follow_request_sent ? 1 : 0);
|
||||
out.writeByte((byte) (is_follow_request_sent ? 1 : 0));
|
||||
out.writeInt(followers_count);
|
||||
out.writeInt(friends_count);
|
||||
out.writeInt(statuses_count);
|
||||
out.writeInt(favorites_count);
|
||||
out.writeInt(listed_count);
|
||||
out.writeInt(media_count);
|
||||
out.writeString(url_expanded);
|
||||
out.writeInt(is_following ? 1 : 0);
|
||||
out.writeByte((byte) (is_following ? 1 : 0));
|
||||
out.writeInt(background_color);
|
||||
out.writeInt(link_color);
|
||||
out.writeInt(text_color);
|
||||
out.writeInt(is_cache ? 1 : 0);
|
||||
out.writeInt(is_basic ? 1 : 0);
|
||||
out.writeByte((byte) (is_cache ? 1 : 0));
|
||||
out.writeByte((byte) (is_basic ? 1 : 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -393,6 +399,7 @@ public class ParcelableUser implements TwidereParcelable, Comparable<ParcelableU
|
||||
out.writeInt("statuses_count", statuses_count);
|
||||
out.writeInt("favorites_count", favorites_count);
|
||||
out.writeInt("listed_count", listed_count);
|
||||
out.writeInt("media_count", media_count);
|
||||
out.writeString("url_expanded", url_expanded);
|
||||
out.writeBoolean("is_following", is_following);
|
||||
out.writeInt("background_color", background_color);
|
||||
@ -405,7 +412,7 @@ public class ParcelableUser implements TwidereParcelable, Comparable<ParcelableU
|
||||
public static final class CachedIndices {
|
||||
|
||||
public final int id, name, screen_name, profile_image_url, created_at, is_protected,
|
||||
is_verified, favorites_count, listed_count, followers_count, friends_count,
|
||||
is_verified, favorites_count, listed_count, media_count, followers_count, friends_count,
|
||||
statuses_count, location, description_plain, description_html, description_expanded,
|
||||
url, url_expanded, profile_banner_url, is_following, background_color, link_color, text_color;
|
||||
|
||||
@ -419,6 +426,7 @@ public class ParcelableUser implements TwidereParcelable, Comparable<ParcelableU
|
||||
is_verified = cursor.getColumnIndex(CachedUsers.IS_VERIFIED);
|
||||
favorites_count = cursor.getColumnIndex(CachedUsers.FAVORITES_COUNT);
|
||||
listed_count = cursor.getColumnIndex(CachedUsers.LISTED_COUNT);
|
||||
media_count = cursor.getColumnIndex(CachedUsers.LISTED_COUNT);
|
||||
followers_count = cursor.getColumnIndex(CachedUsers.FOLLOWERS_COUNT);
|
||||
friends_count = cursor.getColumnIndex(CachedUsers.FRIENDS_COUNT);
|
||||
statuses_count = cursor.getColumnIndex(CachedUsers.STATUSES_COUNT);
|
||||
|
@ -252,6 +252,7 @@ public interface TwidereDataStore {
|
||||
String FAVORITES_COUNT = "favorites_count";
|
||||
|
||||
String LISTED_COUNT = "listed_count";
|
||||
String MEDIA_COUNT = "media_count";
|
||||
|
||||
String BACKGROUND_COLOR = "background_color";
|
||||
|
||||
@ -276,16 +277,16 @@ public interface TwidereDataStore {
|
||||
String[] COLUMNS = {_ID, USER_ID, CREATED_AT, NAME, SCREEN_NAME,
|
||||
DESCRIPTION_PLAIN, LOCATION, URL, PROFILE_IMAGE_URL, PROFILE_BANNER_URL, IS_PROTECTED,
|
||||
IS_VERIFIED, IS_FOLLOWING, FOLLOWERS_COUNT, FRIENDS_COUNT, STATUSES_COUNT, FAVORITES_COUNT,
|
||||
LISTED_COUNT, DESCRIPTION_HTML, DESCRIPTION_EXPANDED, URL_EXPANDED, BACKGROUND_COLOR,
|
||||
LINK_COLOR, TEXT_COLOR, LAST_SEEN};
|
||||
LISTED_COUNT, MEDIA_COUNT, DESCRIPTION_HTML, DESCRIPTION_EXPANDED, URL_EXPANDED,
|
||||
BACKGROUND_COLOR, LINK_COLOR, TEXT_COLOR, LAST_SEEN};
|
||||
|
||||
String[] BASIC_COLUMNS = {_ID, USER_ID,
|
||||
NAME, SCREEN_NAME, PROFILE_IMAGE_URL};
|
||||
|
||||
String[] TYPES = {TYPE_PRIMARY_KEY, TYPE_INT_UNIQUE, TYPE_INT,
|
||||
TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_BOOLEAN,
|
||||
TYPE_BOOLEAN, TYPE_BOOLEAN, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_TEXT,
|
||||
TYPE_TEXT, TYPE_TEXT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT};
|
||||
TYPE_BOOLEAN, TYPE_BOOLEAN, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT,
|
||||
TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT};
|
||||
|
||||
}
|
||||
|
||||
|
@ -162,6 +162,7 @@ public final class ContentValuesCreator implements TwidereConstants {
|
||||
values.put(CachedUsers.FRIENDS_COUNT, user.getFriendsCount());
|
||||
values.put(CachedUsers.STATUSES_COUNT, user.getStatusesCount());
|
||||
values.put(CachedUsers.LISTED_COUNT, user.getListedCount());
|
||||
values.put(CachedUsers.MEDIA_COUNT, user.getMediaCount());
|
||||
values.put(CachedUsers.LOCATION, user.getLocation());
|
||||
values.put(CachedUsers.DESCRIPTION_PLAIN, user.getDescription());
|
||||
values.put(CachedUsers.DESCRIPTION_HTML, TwitterContentUtils.formatUserDescription(user));
|
||||
|
@ -135,6 +135,8 @@ public interface User extends Comparable<User>, TwitterResponse, Serializable {
|
||||
|
||||
int getStatusesCount();
|
||||
|
||||
int getMediaCount();
|
||||
|
||||
String getTimeZone();
|
||||
|
||||
/**
|
||||
|
@ -72,6 +72,7 @@ import static twitter4j.internal.util.InternalParseUtil.getRawString;
|
||||
private int friendsCount;
|
||||
private Date createdAt;
|
||||
private int favouritesCount;
|
||||
private int mediaCount;
|
||||
private int utcOffset;
|
||||
private String timeZone;
|
||||
private String profileBackgroundImageUrl;
|
||||
@ -432,6 +433,11 @@ import static twitter4j.internal.util.InternalParseUtil.getRawString;
|
||||
+ isTranslator + ", listedCount=" + listedCount + ", isFollowRequestSent=" + isFollowRequestSent + '}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMediaCount() {
|
||||
return mediaCount;
|
||||
}
|
||||
|
||||
private void init(final JSONObject json) throws TwitterException {
|
||||
try {
|
||||
id = getLong("id", json);
|
||||
@ -460,6 +466,7 @@ import static twitter4j.internal.util.InternalParseUtil.getRawString;
|
||||
friendsCount = getInt("friends_count", json);
|
||||
createdAt = getDate("created_at", json, "EEE MMM dd HH:mm:ss z yyyy");
|
||||
favouritesCount = getInt("favourites_count", json);
|
||||
mediaCount = getInt("media_count", json);
|
||||
utcOffset = getInt("utc_offset", json);
|
||||
timeZone = getRawString("time_zone", json);
|
||||
profileBackgroundImageUrl = getRawString("profile_background_image_url", json);
|
||||
@ -526,8 +533,6 @@ import static twitter4j.internal.util.InternalParseUtil.getRawString;
|
||||
return users;
|
||||
} catch (final JSONException jsone) {
|
||||
throw new TwitterException(jsone);
|
||||
} catch (final TwitterException te) {
|
||||
throw te;
|
||||
}
|
||||
}
|
||||
|
||||
@ -550,8 +555,6 @@ import static twitter4j.internal.util.InternalParseUtil.getRawString;
|
||||
return users;
|
||||
} catch (final JSONException jsone) {
|
||||
throw new TwitterException(jsone);
|
||||
} catch (final TwitterException te) {
|
||||
throw te;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ import static org.mariotaku.twidere.annotation.Preference.Type.STRING;
|
||||
public interface Constants extends TwidereConstants {
|
||||
|
||||
String DATABASES_NAME = "twidere.sqlite";
|
||||
int DATABASES_VERSION = 95;
|
||||
int DATABASES_VERSION = 96;
|
||||
|
||||
int MENU_GROUP_STATUS_EXTENSION = 10;
|
||||
int MENU_GROUP_COMPOSE_EXTENSION = 11;
|
||||
|
@ -539,7 +539,7 @@ public class SettingsWizardActivity extends Activity implements Constants {
|
||||
final ContentValues values = new ContentValues();
|
||||
values.put(Tabs.TYPE, type);
|
||||
values.put(Tabs.ARGUMENTS, ParseUtils.bundleToJSON(spec.args));
|
||||
values.put(Tabs.NAME, spec.name);
|
||||
values.put(Tabs.NAME, ParseUtils.parseString(spec.name));
|
||||
if (spec.icon instanceof Integer) {
|
||||
values.put(Tabs.ICON, CustomTabUtils.findTabIconKey((Integer) spec.icon));
|
||||
} else if (spec.icon instanceof File) {
|
||||
|
@ -322,13 +322,16 @@ public class HomeActivity extends BaseActionBarActivity implements OnClickListen
|
||||
final boolean refreshOnStart = mPreferences.getBoolean(KEY_REFRESH_ON_START, false);
|
||||
mTabDisplayOption = getTabDisplayOptionInt(this);
|
||||
|
||||
final int tabColumns = getResources().getInteger(R.integer.default_tab_columns);
|
||||
|
||||
mColorStatusFrameLayout.setOnFitSystemWindowsListener(this);
|
||||
ThemeUtils.applyBackground(mTabIndicator);
|
||||
mPagerAdapter = new SupportTabsAdapter(this, getSupportFragmentManager(), mTabIndicator, 1);
|
||||
mPagerAdapter = new SupportTabsAdapter(this, getSupportFragmentManager(), mTabIndicator, tabColumns);
|
||||
mViewPager.setAdapter(mPagerAdapter);
|
||||
mViewPager.setOffscreenPageLimit(3);
|
||||
mTabIndicator.setViewPager(mViewPager);
|
||||
mTabIndicator.setOnPageChangeListener(this);
|
||||
mTabIndicator.setColumns(tabColumns);
|
||||
if (mTabDisplayOption != 0) {
|
||||
mTabIndicator.setTabDisplayOption(mTabDisplayOption);
|
||||
} else {
|
||||
@ -994,4 +997,14 @@ public class HomeActivity extends BaseActionBarActivity implements OnClickListen
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dispatchKeyEvent(KeyEvent event) {
|
||||
if (event.getKeyCode() == KeyEvent.KEYCODE_MENU && event.getAction() == KeyEvent.ACTION_UP) {
|
||||
if (mSlidingMenu != null) {
|
||||
mSlidingMenu.toggle(true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return super.dispatchKeyEvent(event);
|
||||
}
|
||||
}
|
||||
|
@ -107,6 +107,14 @@ public class TabsAdapter extends FragmentStatePagerAdapter implements TabProvide
|
||||
}
|
||||
}
|
||||
|
||||
public void setTabLabel(int position, CharSequence label) {
|
||||
for (TabSpec spec : mTabs) {
|
||||
if (position == spec.position)
|
||||
spec.name = label;
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageReselected(final int position) {
|
||||
}
|
||||
|
@ -174,6 +174,14 @@ public class SupportTabsAdapter extends SupportFixedFragmentStatePagerAdapter im
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setTabLabel(int position, CharSequence label) {
|
||||
for (SupportTabSpec spec : mTabs) {
|
||||
if (position == spec.position)
|
||||
spec.name = label;
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
private Bundle getPageArguments(Bundle args, int position) {
|
||||
if (args == null) {
|
||||
args = new Bundle();
|
||||
|
@ -636,10 +636,6 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
|
||||
final int idx = status.quote_text_unescaped.lastIndexOf(" twitter.com");
|
||||
final Spanned quote_text = Html.fromHtml(status.quote_text_html);
|
||||
quoteTextView.setText(idx > 0 ? quote_text.subSequence(0, idx) : quote_text);
|
||||
final SpannableString originalTweetLink = SpannableString.valueOf("Original tweet");
|
||||
originalTweetLink.setSpan(new URLSpan(LinkCreator.getTwitterStatusLink(status.user_screen_name, status.quote_id).toString()),
|
||||
0, originalTweetLink.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
|
||||
quoteTextView.append(originalTweetLink);
|
||||
linkify.applyAllLinks(quoteTextView, status.account_id, getLayoutPosition(),
|
||||
status.is_possibly_sensitive, adapter.getLinkHighlightingStyle());
|
||||
|
||||
@ -907,6 +903,7 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static final class LoadSensitiveImageConfirmDialogFragment extends BaseSupportDialogFragment implements
|
||||
|
@ -170,13 +170,19 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
|
||||
OnTouchListener, DrawerCallback, SupportFragmentCallback, SystemWindowsInsetsCallback,
|
||||
RefreshScrollTopInterface {
|
||||
|
||||
private static final ArgbEvaluator sArgbEvaluator = new ArgbEvaluator();
|
||||
|
||||
public static final String TRANSITION_NAME_PROFILE_IMAGE = "profile_image";
|
||||
public static final String TRANSITION_NAME_PROFILE_TYPE = "profile_type";
|
||||
public static final String TRANSITION_NAME_CARD = "card";
|
||||
|
||||
private static final int LOADER_ID_USER = 1;
|
||||
private static final int LOADER_ID_FRIENDSHIP = 2;
|
||||
private static final ArgbEvaluator sArgbEvaluator = new ArgbEvaluator();
|
||||
|
||||
private static final int TAB_POSITION_STATUSES = 0;
|
||||
private static final int TAB_POSITION_MEDIA = 1;
|
||||
private static final int TAB_POSITION_FAVORITES = 2;
|
||||
|
||||
private MediaLoaderWrapper mProfileImageLoader;
|
||||
private ShapedImageView mProfileImageView;
|
||||
private ImageView mProfileTypeView;
|
||||
@ -444,7 +450,8 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
|
||||
mUser = user;
|
||||
final FragmentActivity activity = getActivity();
|
||||
if (user == null || user.id <= 0 || activity == null) return;
|
||||
final Resources res = getResources();
|
||||
final Resources resources = getResources();
|
||||
final Resources res = resources;
|
||||
final LoaderManager lm = getLoaderManager();
|
||||
lm.destroyLoader(LOADER_ID_USER);
|
||||
lm.destroyLoader(LOADER_ID_FRIENDSHIP);
|
||||
@ -502,6 +509,7 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
|
||||
getFriendship();
|
||||
}
|
||||
activity.setTitle(UserColorNameUtils.getDisplayName(activity, user, true));
|
||||
|
||||
updateTitleColor();
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
@ -1278,11 +1286,11 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
|
||||
tabArgs.putLong(EXTRA_USER_ID, args.getLong(EXTRA_USER_ID, -1));
|
||||
tabArgs.putString(EXTRA_SCREEN_NAME, args.getString(EXTRA_SCREEN_NAME));
|
||||
}
|
||||
mPagerAdapter.addTab(UserTimelineFragment.class, tabArgs, getString(R.string.statuses), R.drawable.ic_action_quote, 0, null);
|
||||
mPagerAdapter.addTab(UserTimelineFragment.class, tabArgs, getString(R.string.statuses), R.drawable.ic_action_quote, TAB_POSITION_STATUSES, null);
|
||||
if (Utils.isOfficialKeyAccount(context, accountId)) {
|
||||
mPagerAdapter.addTab(UserMediaTimelineFragment.class, tabArgs, getString(R.string.media), R.drawable.ic_action_gallery, 1, null);
|
||||
mPagerAdapter.addTab(UserMediaTimelineFragment.class, tabArgs, getString(R.string.media), R.drawable.ic_action_gallery, TAB_POSITION_MEDIA, null);
|
||||
}
|
||||
mPagerAdapter.addTab(UserFavoritesFragment.class, tabArgs, getString(R.string.favorites), R.drawable.ic_action_star, 2, null);
|
||||
mPagerAdapter.addTab(UserFavoritesFragment.class, tabArgs, getString(R.string.favorites), R.drawable.ic_action_star, TAB_POSITION_FAVORITES, null);
|
||||
}
|
||||
|
||||
private boolean shouldUseNativeMenu() {
|
||||
|
@ -31,7 +31,7 @@ import static org.mariotaku.twidere.util.CompareUtils.objectEquals;
|
||||
|
||||
public class SupportTabSpec implements Comparable<SupportTabSpec>, TwidereConstants {
|
||||
|
||||
public final String name;
|
||||
public CharSequence name;
|
||||
public final Object icon;
|
||||
public final String type;
|
||||
public final Class<? extends Fragment> cls;
|
||||
|
@ -28,7 +28,7 @@ import static org.mariotaku.twidere.util.CompareUtils.objectEquals;
|
||||
|
||||
public class TabSpec {
|
||||
|
||||
public final CharSequence name;
|
||||
public CharSequence name;
|
||||
public final Object icon;
|
||||
public final Class<? extends Fragment> cls;
|
||||
public final Bundle args;
|
||||
|
@ -50,6 +50,7 @@ public class TabPagerIndicator extends RecyclerView implements PagerIndicator {
|
||||
private int mOption;
|
||||
private boolean mTabExpandEnabled;
|
||||
private int mHorizontalPadding, mVerticalPadding;
|
||||
private int mColumns;
|
||||
|
||||
public TabPagerIndicator(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
@ -102,6 +103,11 @@ public class TabPagerIndicator extends RecyclerView implements PagerIndicator {
|
||||
public void getTabSpecs() {
|
||||
}
|
||||
|
||||
public void setColumns(int columns) {
|
||||
mColumns = columns;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void setItemContext(Context context) {
|
||||
mIndicatorAdapter.setItemContext(context);
|
||||
}
|
||||
@ -450,7 +456,7 @@ public class TabPagerIndicator extends RecyclerView implements PagerIndicator {
|
||||
public void onBindViewHolder(TabItemHolder holder, int position) {
|
||||
final Drawable icon = mTabProvider.getPageIcon(position);
|
||||
final CharSequence title = mTabProvider.getPageTitle(position);
|
||||
holder.setTabData(icon, title, mIndicator.getCurrentItem() == position);
|
||||
holder.setTabData(icon, title, mIndicator.isTabSelected(position));
|
||||
holder.setBadge(mUnreadCounts.get(position, 0), mDisplayBadge);
|
||||
|
||||
holder.setStripColor(mStripColor);
|
||||
@ -499,4 +505,19 @@ public class TabPagerIndicator extends RecyclerView implements PagerIndicator {
|
||||
// notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isTabSelected(int position) {
|
||||
final int current = getCurrentItem();
|
||||
final int columns = getColumns();
|
||||
final int count = getCount();
|
||||
if (current + columns > count) {
|
||||
return position >= count - columns;
|
||||
}
|
||||
return position >= current && position < current + columns;
|
||||
}
|
||||
|
||||
private int getColumns() {
|
||||
if (mColumns > 0) return mColumns;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,8 @@
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center">
|
||||
android:layout_gravity="center"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="300dp"
|
||||
|
25
twidere/src/main/res/values-large-land/defaults.xml
Normal file
25
twidere/src/main/res/values-large-land/defaults.xml
Normal file
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Twidere - Twitter client for Android
|
||||
~
|
||||
~ Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
|
||||
~
|
||||
~ This program is free software: you can redistribute it and/or modify
|
||||
~ it under the terms of the GNU General Public License as published by
|
||||
~ the Free Software Foundation, either version 3 of the License, or
|
||||
~ (at your option) any later version.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
~ GNU General Public License for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU General Public License
|
||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
|
||||
<integer name="default_tab_columns">3</integer>
|
||||
|
||||
</resources>
|
@ -4,5 +4,6 @@
|
||||
<string name="default_tab_display_option">icon</string>
|
||||
<string name="profile_image_size">normal</string>
|
||||
<string name="default_profile_image_style">round</string>
|
||||
<integer name="default_tab_columns">1</integer>
|
||||
|
||||
</resources>
|
@ -50,5 +50,13 @@
|
||||
<item quantity="one">@string/from_name_and_name</item>
|
||||
<item quantity="other">@string/from_name_and_N_others</item>
|
||||
</plurals>
|
||||
<plurals name="N_statuses">
|
||||
<item quantity="one">@string/N_statuses_quantity_one</item>
|
||||
<item quantity="other">@string/N_statuses_quantity_other</item>
|
||||
</plurals>
|
||||
<plurals name="N_favorites">
|
||||
<item quantity="one">@string/N_favorites_quantity_one</item>
|
||||
<item quantity="other">@string/N_favorites_quantity_other</item>
|
||||
</plurals>
|
||||
|
||||
</resources>
|
@ -732,6 +732,9 @@
|
||||
<string name="server_address">Server address</string>
|
||||
<string name="security_key">Security key</string>
|
||||
<string name="hide_card_actions">Hide card actions</string>
|
||||
|
||||
<string name="N_statuses_quantity_one"><xliff:g id="count">%d</xliff:g> tweet</string>
|
||||
<string name="N_statuses_quantity_other"><xliff:g id="count">%d</xliff:g> tweets</string>
|
||||
<string name="N_favorites_quantity_one"><xliff:g id="count">%d</xliff:g> favorites</string>
|
||||
<string name="N_favorites_quantity_other"><xliff:g id="count">%d</xliff:g> favorites</string>
|
||||
|
||||
</resources>
|
Loading…
x
Reference in New Issue
Block a user