parent
3d99ead56c
commit
cec66477ae
|
@ -10,7 +10,7 @@ buildscript {
|
|||
dependencies {
|
||||
classpath 'com.github.ben-manes:gradle-versions-plugin:0.12.0'
|
||||
classpath 'com.android.tools.build:gradle:2.1.2'
|
||||
classpath 'com.google.gms:google-services:2.1.0'
|
||||
classpath 'com.google.gms:google-services:3.0.0'
|
||||
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
|
||||
classpath('fr.avianey.androidsvgdrawable:gradle-plugin:3.0.0') {
|
||||
// should be excluded to avoid conflict
|
||||
|
|
|
@ -23,7 +23,7 @@ apply plugin: 'com.neenbedankt.android-apt'
|
|||
android {
|
||||
defaultConfig {
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 23
|
||||
targetSdkVersion 24
|
||||
versionCode 1
|
||||
versionName "3.0"
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ dependencies {
|
|||
apt 'com.bluelinelabs:logansquare-compiler:1.3.7'
|
||||
apt 'com.hannesdorfmann.parcelableplease:processor:1.0.2'
|
||||
apt 'com.github.mariotaku.ObjectCursor:processor:0.9.7'
|
||||
compile 'com.android.support:support-annotations:23.4.0'
|
||||
compile 'com.android.support:support-annotations:24.0.0'
|
||||
compile 'com.bluelinelabs:logansquare:1.3.7'
|
||||
compile 'com.github.mariotaku.RestFu:library:0.9.30'
|
||||
compile 'com.github.mariotaku.RestFu:oauth:0.9.30'
|
||||
|
|
|
@ -22,7 +22,7 @@ apply plugin: 'com.android.library'
|
|||
android {
|
||||
defaultConfig {
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 23
|
||||
targetSdkVersion 24
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ android {
|
|||
defaultConfig {
|
||||
applicationId "org.mariotaku.twidere.donate.nyanwp"
|
||||
minSdkVersion 20
|
||||
targetSdkVersion 23
|
||||
targetSdkVersion 24
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ android {
|
|||
defaultConfig {
|
||||
applicationId "org.mariotaku.twidere.donate.nyanwp"
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 23
|
||||
targetSdkVersion 24
|
||||
versionCode 3
|
||||
versionName "1.2"
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ apply plugin: 'com.android.library'
|
|||
android {
|
||||
defaultConfig {
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 23
|
||||
targetSdkVersion 24
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ android {
|
|||
defaultConfig {
|
||||
applicationId "org.mariotaku.twidere"
|
||||
minSdkVersion 20
|
||||
targetSdkVersion 23
|
||||
targetSdkVersion 24
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
multiDexEnabled true
|
||||
|
@ -39,5 +39,5 @@ android {
|
|||
dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
compile 'com.google.android.support:wearable:1.3.0'
|
||||
compile 'com.google.android.gms:play-services-wearable:8.4.0'
|
||||
compile 'com.google.android.gms:play-services-wearable:9.0.2'
|
||||
}
|
||||
|
|
|
@ -105,9 +105,8 @@ dependencies {
|
|||
compile project(':twidere.component.nyan')
|
||||
|
||||
// START Non-FOSS component
|
||||
googleCompile 'com.google.android.gms:play-services-maps:8.4.0'
|
||||
googleCompile 'com.google.android.gms:play-services-auth:8.4.0'
|
||||
googleCompile 'com.google.android.gms:play-services-measurement:8.4.0'
|
||||
googleCompile 'com.google.android.gms:play-services-maps:9.0.2'
|
||||
googleCompile 'com.google.android.gms:play-services-auth:9.0.2'
|
||||
googleCompile 'com.google.maps.android:android-maps-utils:0.4.3'
|
||||
googleCompile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') { transitive = true }
|
||||
googleCompile ':YouTubeAndroidPlayerApi:1.2.2@jar'
|
||||
|
@ -123,17 +122,17 @@ dependencies {
|
|||
|
||||
testCompile 'junit:junit:4.12'
|
||||
|
||||
androidTestCompile 'com.android.support:support-annotations:23.4.0'
|
||||
androidTestCompile 'com.android.support:support-annotations:24.0.0'
|
||||
androidTestCompile 'com.android.support.test:runner:0.5'
|
||||
androidTestCompile 'com.android.support.test:rules:0.5'
|
||||
|
||||
compile 'com.android.support:multidex:1.0.1'
|
||||
compile 'com.android.support:support-v13:23.4.0'
|
||||
compile 'com.android.support:appcompat-v7:23.4.0'
|
||||
compile 'com.android.support:cardview-v7:23.4.0'
|
||||
compile 'com.android.support:recyclerview-v7:23.4.0'
|
||||
compile 'com.android.support:preference-v7:23.4.0'
|
||||
compile 'com.android.support:preference-v14:23.4.0'
|
||||
compile 'com.android.support:support-v13:24.0.0'
|
||||
compile 'com.android.support:appcompat-v7:24.0.0'
|
||||
compile 'com.android.support:cardview-v7:24.0.0'
|
||||
compile 'com.android.support:recyclerview-v7:24.0.0'
|
||||
compile 'com.android.support:preference-v7:24.0.0'
|
||||
compile 'com.android.support:preference-v14:24.0.0'
|
||||
compile 'com.twitter:twitter-text:1.13.0'
|
||||
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
|
||||
compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.5.0'
|
||||
|
|
|
@ -38,14 +38,14 @@ public class DividerItemDecoration extends RecyclerView.ItemDecoration {
|
|||
|
||||
public static final int VERTICAL_LIST = LinearLayoutManager.VERTICAL;
|
||||
|
||||
private Drawable mDivider;
|
||||
private final Rect mPaddingRect = new Rect();
|
||||
private final Drawable mDivider;
|
||||
|
||||
private int mOrientation;
|
||||
private Rect mPadding;
|
||||
private Padding mPadding;
|
||||
private int mDecorationStart = -1, mDecorationEnd = -1, mDecorationEndOffset;
|
||||
|
||||
public DividerItemDecoration(Context context, int orientation) {
|
||||
mPadding = new Rect();
|
||||
final TypedArray a = context.obtainStyledAttributes(ATTRS);
|
||||
mDivider = a.getDrawable(0);
|
||||
a.recycle();
|
||||
|
@ -83,8 +83,18 @@ public class DividerItemDecoration extends RecyclerView.ItemDecoration {
|
|||
}
|
||||
}
|
||||
|
||||
public void setPadding(int left, int top, int right, int bottom) {
|
||||
mPadding.set(left, top, right, bottom);
|
||||
public void setPadding(final int left, final int top, final int right, final int bottom) {
|
||||
mPadding = new Padding() {
|
||||
@Override
|
||||
public boolean get(int position, Rect rect) {
|
||||
rect.set(left, top, right, bottom);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void setPadding(Padding padding) {
|
||||
mPadding = padding;
|
||||
}
|
||||
|
||||
public void drawVertical(Canvas c, RecyclerView parent) {
|
||||
|
@ -104,8 +114,12 @@ public class DividerItemDecoration extends RecyclerView.ItemDecoration {
|
|||
final int top = child.getBottom() + params.bottomMargin +
|
||||
Math.round(ViewCompat.getTranslationY(child));
|
||||
final int bottom = top + mDivider.getIntrinsicHeight();
|
||||
mDivider.setBounds(left + mPadding.left, top + mPadding.top, right - mPadding.right,
|
||||
bottom - mPadding.bottom);
|
||||
if (mPadding != null && mPadding.get(childPos, mPaddingRect)) {
|
||||
mDivider.setBounds(left + mPaddingRect.left, top + mPaddingRect.top, right - mPaddingRect.right,
|
||||
bottom - mPaddingRect.bottom);
|
||||
} else {
|
||||
mDivider.setBounds(left, top, right, bottom);
|
||||
}
|
||||
mDivider.draw(c);
|
||||
}
|
||||
}
|
||||
|
@ -131,8 +145,9 @@ public class DividerItemDecoration extends RecyclerView.ItemDecoration {
|
|||
final int left = child.getRight() + params.rightMargin +
|
||||
Math.round(ViewCompat.getTranslationX(child));
|
||||
final int right = left + mDivider.getIntrinsicHeight();
|
||||
mDivider.setBounds(left + mPadding.left, top + mPadding.top, right - mPadding.right,
|
||||
bottom - mPadding.bottom);
|
||||
|
||||
mDivider.setBounds(left + mPaddingRect.left, top + mPaddingRect.top, right - mPaddingRect.right,
|
||||
bottom - mPaddingRect.bottom);
|
||||
mDivider.draw(c);
|
||||
}
|
||||
}
|
||||
|
@ -166,4 +181,8 @@ public class DividerItemDecoration extends RecyclerView.ItemDecoration {
|
|||
private int getDecorationStart() {
|
||||
return mDecorationStart;
|
||||
}
|
||||
|
||||
public interface Padding {
|
||||
boolean get(int position, Rect rect);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ package org.mariotaku.twidere.fragment;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcelable;
|
||||
|
@ -598,25 +599,6 @@ public abstract class AbsActivitiesFragment extends AbsContentListRecyclerViewFr
|
|||
return new Rect(0, paddingVertical, 0, paddingVertical);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupRecyclerView(Context context, RecyclerView recyclerView) {
|
||||
final ParcelableActivitiesAdapter adapter = getAdapter();
|
||||
// Dividers are drawn on bottom of view
|
||||
recyclerView.addItemDecoration(new DividerItemDecoration(context, getLayoutManager().getOrientation()) {
|
||||
|
||||
@Override
|
||||
protected boolean isDividerEnabled(int childPos) {
|
||||
// Don't draw for last item
|
||||
if (childPos == RecyclerView.NO_POSITION || childPos == adapter.getItemCount() - 1) {
|
||||
return false;
|
||||
}
|
||||
final int itemViewType = adapter.getItemViewType(childPos);
|
||||
return itemViewType != ParcelableActivitiesAdapter.ITEM_VIEW_TYPE_EMPTY;
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
|
||||
if (!getUserVisibleHint() || menuInfo == null) return;
|
||||
|
@ -663,6 +645,39 @@ public abstract class AbsActivitiesFragment extends AbsContentListRecyclerViewFr
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
protected RecyclerView.ItemDecoration createItemDecoration(Context context, final RecyclerView recyclerView, final LinearLayoutManager layoutManager) {
|
||||
final ParcelableActivitiesAdapter adapter = getAdapter();
|
||||
final DividerItemDecoration itemDecoration = new DividerItemDecoration(context,
|
||||
((LinearLayoutManager) recyclerView.getLayoutManager()).getOrientation());
|
||||
final Resources res = context.getResources();
|
||||
if (adapter.isProfileImageEnabled()) {
|
||||
final int decorPaddingLeft = res.getDimensionPixelSize(R.dimen.element_spacing_normal) * 2
|
||||
+ res.getDimensionPixelSize(R.dimen.icon_size_status_profile_image);
|
||||
itemDecoration.setPadding(new DividerItemDecoration.Padding() {
|
||||
@Override
|
||||
public boolean get(int position, Rect rect) {
|
||||
final int itemViewType = adapter.getItemViewType(position);
|
||||
boolean nextItemIsStatus = false;
|
||||
if (position < adapter.getItemCount() - 1) {
|
||||
nextItemIsStatus = adapter.getItemViewType(position + 1) == ParcelableActivitiesAdapter.ITEM_VIEW_TYPE_STATUS;
|
||||
}
|
||||
if (nextItemIsStatus && itemViewType == ParcelableActivitiesAdapter.ITEM_VIEW_TYPE_STATUS) {
|
||||
rect.left = decorPaddingLeft;
|
||||
} else {
|
||||
rect.left = 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
itemDecoration.setDecorationEndOffset(1);
|
||||
return itemDecoration;
|
||||
}
|
||||
|
||||
|
||||
private String getCurrentReadPositionTag() {
|
||||
final String tag = getReadPositionTagWithAccounts();
|
||||
if (tag == null) return null;
|
||||
|
|
|
@ -372,14 +372,30 @@ public abstract class AbsStatusesFragment extends AbsContentListRecyclerViewFrag
|
|||
|
||||
@Nullable
|
||||
@Override
|
||||
protected RecyclerView.ItemDecoration createItemDecoration(Context context, RecyclerView recyclerView, LinearLayoutManager layoutManager) {
|
||||
protected RecyclerView.ItemDecoration createItemDecoration(Context context, final RecyclerView recyclerView, final LinearLayoutManager layoutManager) {
|
||||
final ParcelableStatusesAdapter adapter = getAdapter();
|
||||
final DividerItemDecoration itemDecoration = new DividerItemDecoration(context,
|
||||
((LinearLayoutManager) recyclerView.getLayoutManager()).getOrientation());
|
||||
final Resources res = context.getResources();
|
||||
if (getAdapter().isProfileImageEnabled()) {
|
||||
if (adapter.isProfileImageEnabled()) {
|
||||
final int decorPaddingLeft = res.getDimensionPixelSize(R.dimen.element_spacing_normal) * 2
|
||||
+ res.getDimensionPixelSize(R.dimen.icon_size_status_profile_image);
|
||||
itemDecoration.setPadding(decorPaddingLeft, 0, 0, 0);
|
||||
itemDecoration.setPadding(new DividerItemDecoration.Padding() {
|
||||
@Override
|
||||
public boolean get(int position, Rect rect) {
|
||||
final int itemViewType = adapter.getItemViewType(position);
|
||||
boolean nextItemIsStatus = false;
|
||||
if (position < adapter.getItemCount() - 1) {
|
||||
nextItemIsStatus = adapter.getItemViewType(position + 1) == ParcelableStatusesAdapter.ITEM_VIEW_TYPE_STATUS;
|
||||
}
|
||||
if (nextItemIsStatus && itemViewType == ParcelableStatusesAdapter.ITEM_VIEW_TYPE_STATUS) {
|
||||
rect.left = decorPaddingLeft;
|
||||
} else {
|
||||
rect.left = 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
itemDecoration.setDecorationEndOffset(1);
|
||||
return itemDecoration;
|
||||
|
|
Loading…
Reference in New Issue