mirror of
https://github.com/TwidereProject/Twidere-Android
synced 2025-02-17 04:00:48 +01:00
fixed home refresh preferences
This commit is contained in:
parent
ec126ecfff
commit
262dfe961c
@ -208,6 +208,8 @@ public interface SharedPreferenceConstants {
|
||||
String KEY_HOME_REFRESH_DIRECT_MESSAGES = "home_refresh_direct_messages";
|
||||
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = true)
|
||||
String KEY_HOME_REFRESH_TRENDS = "home_refresh_trends";
|
||||
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = true)
|
||||
String KEY_HOME_REFRESH_SAVED_SEARCHES = "home_refresh_saved_searches";
|
||||
String KEY_IMAGE_UPLOAD_FORMAT = "image_upload_format";
|
||||
String KEY_STATUS_SHORTENER = "status_shortener";
|
||||
String KEY_MEDIA_UPLOADER = "media_uploader";
|
||||
|
@ -41,12 +41,12 @@ public class HomeRefreshContentPreference extends MultiSelectListPreference impl
|
||||
|
||||
@Override
|
||||
protected boolean[] getDefaults() {
|
||||
return new boolean[]{true, true, true};
|
||||
return new boolean[]{true, true, true, true};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String[] getKeys() {
|
||||
return new String[]{KEY_HOME_REFRESH_MENTIONS, KEY_HOME_REFRESH_DIRECT_MESSAGES, KEY_HOME_REFRESH_TRENDS};
|
||||
return new String[]{KEY_HOME_REFRESH_MENTIONS, KEY_HOME_REFRESH_DIRECT_MESSAGES, KEY_HOME_REFRESH_TRENDS, KEY_HOME_REFRESH_SAVED_SEARCHES};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -39,9 +39,6 @@ import org.apache.commons.collections.primitives.IntList;
|
||||
import org.apache.commons.collections.primitives.LongList;
|
||||
import org.mariotaku.abstask.library.AbstractTask;
|
||||
import org.mariotaku.abstask.library.TaskStarter;
|
||||
import org.mariotaku.sqliteqb.library.Expression;
|
||||
import org.mariotaku.twidere.BuildConfig;
|
||||
import org.mariotaku.twidere.R;
|
||||
import org.mariotaku.microblog.library.MicroBlog;
|
||||
import org.mariotaku.microblog.library.MicroBlogException;
|
||||
import org.mariotaku.microblog.library.twitter.http.HttpResponseCode;
|
||||
@ -55,6 +52,9 @@ import org.mariotaku.microblog.library.twitter.model.SavedSearch;
|
||||
import org.mariotaku.microblog.library.twitter.model.User;
|
||||
import org.mariotaku.microblog.library.twitter.model.UserList;
|
||||
import org.mariotaku.microblog.library.twitter.model.UserListUpdate;
|
||||
import org.mariotaku.sqliteqb.library.Expression;
|
||||
import org.mariotaku.twidere.BuildConfig;
|
||||
import org.mariotaku.twidere.R;
|
||||
import org.mariotaku.twidere.model.ListResponse;
|
||||
import org.mariotaku.twidere.model.ParcelableAccount;
|
||||
import org.mariotaku.twidere.model.ParcelableActivity;
|
||||
@ -404,35 +404,41 @@ public class AsyncTwitterWrapper extends TwitterWrapper {
|
||||
getAccountKeys());
|
||||
}
|
||||
});
|
||||
getActivitiesAboutMeAsync(new SimpleRefreshTaskParam() {
|
||||
@NonNull
|
||||
@Override
|
||||
public UserKey[] getAccountKeysWorker() {
|
||||
return closure.getAccountKeys();
|
||||
}
|
||||
if (mPreferences.getBoolean(KEY_HOME_REFRESH_MENTIONS)) {
|
||||
getActivitiesAboutMeAsync(new SimpleRefreshTaskParam() {
|
||||
@NonNull
|
||||
@Override
|
||||
public UserKey[] getAccountKeysWorker() {
|
||||
return closure.getAccountKeys();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String[] getSinceIds() {
|
||||
return DataStoreUtils.getNewestActivityMaxPositions(mContext,
|
||||
Activities.AboutMe.CONTENT_URI, getAccountKeys());
|
||||
}
|
||||
});
|
||||
getReceivedDirectMessagesAsync(new SimpleRefreshTaskParam() {
|
||||
@NonNull
|
||||
@Override
|
||||
public UserKey[] getAccountKeysWorker() {
|
||||
return closure.getAccountKeys();
|
||||
}
|
||||
});
|
||||
getSentDirectMessagesAsync(new SimpleRefreshTaskParam() {
|
||||
@NonNull
|
||||
@Override
|
||||
public UserKey[] getAccountKeysWorker() {
|
||||
return closure.getAccountKeys();
|
||||
}
|
||||
});
|
||||
getSavedSearchesAsync(closure.getAccountKeys());
|
||||
@Nullable
|
||||
@Override
|
||||
public String[] getSinceIds() {
|
||||
return DataStoreUtils.getNewestActivityMaxPositions(mContext,
|
||||
Activities.AboutMe.CONTENT_URI, getAccountKeys());
|
||||
}
|
||||
});
|
||||
}
|
||||
if (mPreferences.getBoolean(KEY_HOME_REFRESH_DIRECT_MESSAGES)) {
|
||||
getReceivedDirectMessagesAsync(new SimpleRefreshTaskParam() {
|
||||
@NonNull
|
||||
@Override
|
||||
public UserKey[] getAccountKeysWorker() {
|
||||
return closure.getAccountKeys();
|
||||
}
|
||||
});
|
||||
getSentDirectMessagesAsync(new SimpleRefreshTaskParam() {
|
||||
@NonNull
|
||||
@Override
|
||||
public UserKey[] getAccountKeysWorker() {
|
||||
return closure.getAccountKeys();
|
||||
}
|
||||
});
|
||||
}
|
||||
if (mPreferences.getBoolean(KEY_HOME_REFRESH_SAVED_SEARCHES)) {
|
||||
getSavedSearchesAsync(closure.getAccountKeys());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
<item>@string/mentions</item>
|
||||
<item>@string/inbox</item>
|
||||
<item>@string/trends</item>
|
||||
<item>@string/saved_searches</item>
|
||||
</string-array>
|
||||
<string-array name="entries_image_preload_option">
|
||||
<item>@string/profile_images</item>
|
||||
|
Loading…
x
Reference in New Issue
Block a user