fixed #532
This commit is contained in:
parent
ace0433ebd
commit
00242ed01a
|
@ -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.2.1'
|
||||
compile 'com.android.support:support-annotations:23.3.0'
|
||||
compile 'com.bluelinelabs:logansquare:1.3.7'
|
||||
compile 'com.github.mariotaku.RestFu:library:0.9.26'
|
||||
compile 'com.hannesdorfmann.parcelableplease:annotation:1.0.2'
|
||||
|
|
|
@ -101,23 +101,23 @@ dependencies {
|
|||
|
||||
debugCompile 'com.facebook.stetho:stetho:1.3.1'
|
||||
debugCompile 'com.facebook.stetho:stetho-okhttp3:1.3.1'
|
||||
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.4-beta1'
|
||||
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.4-beta2'
|
||||
|
||||
provided 'javax.annotation:jsr250-api:1.0'
|
||||
|
||||
testCompile 'junit:junit:4.12'
|
||||
|
||||
androidTestCompile 'com.android.support:support-annotations:23.2.1'
|
||||
androidTestCompile 'com.android.support:support-annotations:23.3.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.2.1'
|
||||
compile 'com.android.support:appcompat-v7:23.2.1'
|
||||
compile 'com.android.support:cardview-v7:23.2.1'
|
||||
compile 'com.android.support:recyclerview-v7:23.2.1'
|
||||
compile 'com.android.support:preference-v7:23.2.1'
|
||||
compile 'com.android.support:preference-v14:23.2.1'
|
||||
compile 'com.android.support:support-v13:23.3.0'
|
||||
compile 'com.android.support:appcompat-v7:23.3.0'
|
||||
compile 'com.android.support:cardview-v7:23.3.0'
|
||||
compile 'com.android.support:recyclerview-v7:23.3.0'
|
||||
compile 'com.android.support:preference-v7:23.3.0'
|
||||
compile 'com.android.support:preference-v14:23.3.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'
|
||||
|
@ -131,7 +131,7 @@ dependencies {
|
|||
compile 'com.github.mariotaku:MessageBubbleView:1.2'
|
||||
compile 'com.github.mariotaku:DragSortListView:0.6.1'
|
||||
compile 'com.github.uucky:ColorPicker-Android:0.9.7@aar'
|
||||
compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.14@aar'
|
||||
compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.15'
|
||||
compile 'com.sprylab.android.texturevideoview:texturevideoview:1.1.1'
|
||||
compile 'com.squareup:pollexor:2.0.4'
|
||||
compile 'com.squareup:tape:1.2.3'
|
||||
|
|
|
@ -30,6 +30,7 @@ import android.util.Log;
|
|||
import android.util.Pair;
|
||||
|
||||
import org.mariotaku.abstask.library.TaskStarter;
|
||||
import org.mariotaku.sqliteqb.library.Columns;
|
||||
import org.mariotaku.sqliteqb.library.Expression;
|
||||
import org.mariotaku.twidere.Constants;
|
||||
import org.mariotaku.twidere.api.twitter.Twitter;
|
||||
|
@ -45,6 +46,7 @@ import org.mariotaku.twidere.model.SingleResponse;
|
|||
import org.mariotaku.twidere.model.UserKey;
|
||||
import org.mariotaku.twidere.model.util.ParcelableCredentialsUtils;
|
||||
import org.mariotaku.twidere.model.util.ParcelableUserUtils;
|
||||
import org.mariotaku.twidere.model.util.UserKeyUtils;
|
||||
import org.mariotaku.twidere.provider.TwidereDataStore.CachedUsers;
|
||||
import org.mariotaku.twidere.task.UpdateAccountInfoTask;
|
||||
import org.mariotaku.twidere.util.TwitterAPIFactory;
|
||||
|
@ -115,8 +117,17 @@ public final class ParcelableUserLoader extends AsyncTaskLoader<SingleResponse<P
|
|||
where = Expression.equalsArgs(CachedUsers.USER_KEY);
|
||||
whereArgs = new String[]{mUserKey.toString()};
|
||||
} else if (mScreenName != null) {
|
||||
final String host = mAccountKey.getHost();
|
||||
if (host != null) {
|
||||
where = Expression.and(
|
||||
Expression.likeRaw(new Columns.Column(CachedUsers.USER_KEY), "'%@'||?"),
|
||||
Expression.equalsArgs(CachedUsers.SCREEN_NAME)
|
||||
);
|
||||
whereArgs = new String[]{host, mScreenName};
|
||||
} else {
|
||||
where = Expression.equalsArgs(CachedUsers.SCREEN_NAME);
|
||||
whereArgs = new String[]{mScreenName};
|
||||
}
|
||||
} else {
|
||||
return SingleResponse.getInstance();
|
||||
}
|
||||
|
@ -124,13 +135,17 @@ public final class ParcelableUserLoader extends AsyncTaskLoader<SingleResponse<P
|
|||
where.getSQL(), whereArgs, null);
|
||||
if (cur != null) {
|
||||
try {
|
||||
if (cur.moveToFirst()) {
|
||||
cur.moveToFirst();
|
||||
final ParcelableUserCursorIndices indices = new ParcelableUserCursorIndices(cur);
|
||||
while (!cur.isAfterLast()) {
|
||||
final ParcelableUser user = indices.newObject(cur);
|
||||
if (TextUtils.equals(UserKeyUtils.getUserHost(user), user.key.getHost())) {
|
||||
user.account_key = accountKey;
|
||||
user.account_color = credentials.color;
|
||||
return SingleResponse.getInstance(user);
|
||||
}
|
||||
cur.moveToNext();
|
||||
}
|
||||
} finally {
|
||||
cur.close();
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ public class ParcelableActivityUtils {
|
|||
*/
|
||||
public static boolean initAfterFilteredSourceIds(ParcelableActivity activity, String[] filteredUserIds,
|
||||
boolean followingOnly) {
|
||||
if (activity.sources == null) return false;
|
||||
if (activity.after_filtered_source_ids != null) return false;
|
||||
if (followingOnly || !ArrayUtils.isEmpty(filteredUserIds)) {
|
||||
List<UserKey> list = new ArrayList<>();
|
||||
|
|
|
@ -8,6 +8,7 @@ import android.text.TextUtils;
|
|||
|
||||
import org.mariotaku.twidere.TwidereConstants;
|
||||
import org.mariotaku.twidere.api.twitter.model.User;
|
||||
import org.mariotaku.twidere.model.ParcelableUser;
|
||||
import org.mariotaku.twidere.model.UserKey;
|
||||
import org.mariotaku.twidere.provider.TwidereDataStore.Accounts;
|
||||
import org.mariotaku.twidere.util.DataStoreUtils;
|
||||
|
@ -18,7 +19,7 @@ import java.util.ArrayList;
|
|||
/**
|
||||
* Created by mariotaku on 16/3/7.
|
||||
*/
|
||||
public class UserKeyUtils {
|
||||
public class UserKeyUtils implements TwidereConstants {
|
||||
|
||||
private UserKeyUtils() {
|
||||
}
|
||||
|
@ -59,24 +60,28 @@ public class UserKeyUtils {
|
|||
}
|
||||
|
||||
public static String getUserHost(User user) {
|
||||
if (isFanfouUser(user)) return TwidereConstants.USER_TYPE_FANFOU_COM;
|
||||
return getUserHost(user.getOstatusUri(), TwidereConstants.USER_TYPE_TWITTER_COM);
|
||||
if (isFanfouUser(user)) return USER_TYPE_FANFOU_COM;
|
||||
return getUserHost(user.getStatusnetProfileUrl(), USER_TYPE_TWITTER_COM);
|
||||
}
|
||||
|
||||
public static String getUserHost(ParcelableUser user) {
|
||||
if (isFanfouUser(user)) return USER_TYPE_FANFOU_COM;
|
||||
if (user.extras == null) return USER_TYPE_TWITTER_COM;
|
||||
|
||||
return getUserHost(user.extras.statusnet_profile_url, USER_TYPE_TWITTER_COM);
|
||||
}
|
||||
|
||||
public static boolean isFanfouUser(User user) {
|
||||
String url = user.getProfileImageUrlLarge();
|
||||
if (url != null && isFanfouHost(getUserHost(url, "twitter.com"))) {
|
||||
return true;
|
||||
return isFanfouUrl(user.getProfileImageUrlLarge()) || isFanfouUrl(user.getProfileImageUrl())
|
||||
|| isFanfouUrl(user.getProfileBackgroundImageUrl());
|
||||
}
|
||||
url = user.getProfileImageUrl();
|
||||
if (url != null && isFanfouHost(getUserHost(url, "twitter.com"))) {
|
||||
return true;
|
||||
|
||||
public static boolean isFanfouUser(ParcelableUser user) {
|
||||
return isFanfouUrl(user.profile_image_url) || isFanfouUrl(user.profile_background_url);
|
||||
}
|
||||
url = user.getProfileBackgroundImageUrl();
|
||||
if (url != null && isFanfouHost(getUserHost(url, "twitter.com"))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
static boolean isFanfouUrl(String url) {
|
||||
return url != null && isFanfouHost(getUserHost(url, "twitter.com"));
|
||||
}
|
||||
|
||||
private static boolean isFanfouHost(@NonNull String host) {
|
||||
|
@ -86,7 +91,7 @@ public class UserKeyUtils {
|
|||
@NonNull
|
||||
public static String getUserHost(@Nullable String uri, @Nullable String def) {
|
||||
if (def == null) {
|
||||
def = TwidereConstants.USER_TYPE_TWITTER_COM;
|
||||
def = USER_TYPE_TWITTER_COM;
|
||||
}
|
||||
if (uri == null) return def;
|
||||
final String authority = UriUtils.getAuthority(uri);
|
||||
|
|
|
@ -160,10 +160,10 @@ public class InternalTwitterContentUtils {
|
|||
}
|
||||
|
||||
public static boolean isFiltered(final SQLiteDatabase database, final ParcelableStatus status,
|
||||
final boolean filter_rts) {
|
||||
final boolean filterRTs) {
|
||||
if (database == null || status == null) return false;
|
||||
return isFiltered(database, status.user_key, status.text_plain, status.spans, status.source,
|
||||
status.retweeted_by_user_key, status.quoted_user_key, filter_rts);
|
||||
status.retweeted_by_user_key, status.quoted_user_key, filterRTs);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
|
Loading…
Reference in New Issue