Fixes + new update feed logic
This commit is contained in:
@@ -1,10 +1,19 @@
|
||||
package ru.vtosters.lite.utils;
|
||||
|
||||
import static ru.vtosters.lite.ui.fragments.dockbar.DockBarManager.*;
|
||||
import static ru.vtosters.lite.utils.Globals.*;
|
||||
import static ru.vtosters.lite.utils.Preferences.*;
|
||||
import static java.lang.Long.MAX_VALUE;
|
||||
import static ru.vtosters.lite.ui.fragments.dockbar.DockBarManager.getInstance;
|
||||
import static ru.vtosters.lite.utils.Globals.getContext;
|
||||
import static ru.vtosters.lite.utils.Globals.getPreferences;
|
||||
import static ru.vtosters.lite.utils.Preferences.BooleanTrue;
|
||||
import static ru.vtosters.lite.utils.Preferences.adsgroup;
|
||||
import static ru.vtosters.lite.utils.Preferences.adsstories;
|
||||
import static ru.vtosters.lite.utils.Preferences.authorsrecomm;
|
||||
import static ru.vtosters.lite.utils.Preferences.copyright_post;
|
||||
import static ru.vtosters.lite.utils.Preferences.friendsrecomm;
|
||||
import static ru.vtosters.lite.utils.Preferences.postsrecomm;
|
||||
|
||||
import com.vk.apps.AppsFragment;
|
||||
import com.vk.core.preference.Preference;
|
||||
import com.vk.fave.fragments.FaveTabFragment;
|
||||
import com.vk.menu.MenuFragment;
|
||||
import com.vk.music.fragment.MusicFragment;
|
||||
@@ -174,6 +183,20 @@ public class Newsfeed {
|
||||
return def;
|
||||
}
|
||||
|
||||
public static long getUpdateNewsfeed(boolean refresh_timeout) {
|
||||
String string = getPreferences().getString("newsupdate", "");
|
||||
if (string.isEmpty()) {
|
||||
return Preference.b().getLong(refresh_timeout ? "refresh_timeout_top" : "refresh_timeout_recent", 600000L);
|
||||
}
|
||||
if (string.equals("no_update")) {
|
||||
return MAX_VALUE;
|
||||
}
|
||||
if (string.equals("imd_update")) {
|
||||
return 10000L;
|
||||
}
|
||||
return Preference.b().getLong(refresh_timeout ? "refresh_timeout_top" : "refresh_timeout_recent", 600000L);
|
||||
}
|
||||
|
||||
public static Class getStartFragment() {
|
||||
String string = getPreferences().getString("start_values", "");
|
||||
if (string.equals("default")) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package ru.vtosters.lite.utils;
|
||||
|
||||
import static ru.vtosters.lite.ui.fragments.multiaccount.MultiAccountManager.*;
|
||||
import static ru.vtosters.lite.ui.fragments.multiaccount.MultiAccountManager.migrate;
|
||||
import static ru.vtosters.lite.utils.Globals.*;
|
||||
import static ru.vtosters.lite.utils.Newsfeed.*;
|
||||
import static ru.vtosters.lite.utils.Proxy.*;
|
||||
@@ -17,7 +17,15 @@ import com.vtosters.lite.data.Users;
|
||||
import java.util.Locale;
|
||||
|
||||
public class Preferences {
|
||||
public static String VERSIONNAME = "2.0 Beta";
|
||||
public static String VERSIONNAME = "Beta";
|
||||
|
||||
public static void init(Application application) {
|
||||
setupFilters();
|
||||
fixGapps();
|
||||
setProxy();
|
||||
migrate();
|
||||
registerActivities(application);
|
||||
}
|
||||
|
||||
public static boolean BooleanFalse(String key) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
@@ -29,13 +37,6 @@ public class Preferences {
|
||||
return prefs.getBoolean(key, true);
|
||||
}
|
||||
|
||||
public static String getBackgroundStickers() {
|
||||
if (isBGStickersEnabled()) {
|
||||
return "images_with_background";
|
||||
}
|
||||
return "images";
|
||||
}
|
||||
|
||||
public static boolean authorsrecomm() {
|
||||
return BooleanTrue("authorsrecomm");
|
||||
}
|
||||
@@ -144,10 +145,6 @@ public class Preferences {
|
||||
return BooleanTrue("dockcounter");
|
||||
}
|
||||
|
||||
public static boolean feedautoupdate() {
|
||||
return BooleanTrue("feedautoupdate");
|
||||
}
|
||||
|
||||
public static boolean feedcache() {
|
||||
return BooleanTrue("feedcache");
|
||||
}
|
||||
@@ -319,12 +316,4 @@ public class Preferences {
|
||||
}
|
||||
return string.isEmpty() ? Locale.getDefault().getLanguage() : string;
|
||||
}
|
||||
|
||||
public static void init(Application application) {
|
||||
setupFilters();
|
||||
fixGapps();
|
||||
setProxy();
|
||||
migrate();
|
||||
registerActivities(application);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,4 +194,10 @@ public class Themes {
|
||||
return VKThemeHelper.a(R.attr.tabbar_background);
|
||||
}
|
||||
|
||||
public static String getBackgroundStickers() {
|
||||
if (isBGStickersEnabled()) {
|
||||
return "images_with_background";
|
||||
}
|
||||
return "images";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -495,4 +495,9 @@
|
||||
<item>От Новых к Старым</item>
|
||||
<item>От Старых к Новым</item>
|
||||
</string-array>
|
||||
<string-array name="newsupdate_value">
|
||||
<item>По умолчанию</item>
|
||||
<item>Не обновлять</item>
|
||||
<item>Обновлять мгновенно</item>
|
||||
</string-array>
|
||||
</resources>
|
||||
|
||||
@@ -686,4 +686,14 @@
|
||||
<item>new</item>
|
||||
<item>old</item>
|
||||
</string-array>
|
||||
<string-array name="newsupdate_value">
|
||||
<item>Default</item>
|
||||
<item>Do not update</item>
|
||||
<item>Immediately update</item>
|
||||
</string-array>
|
||||
<string-array name="newsupdate">
|
||||
<item>default</item>
|
||||
<item>no_update</item>
|
||||
<item>imd_update</item>
|
||||
</string-array>
|
||||
</resources>
|
||||
|
||||
@@ -79,10 +79,13 @@
|
||||
android:entryValues="@array/commentssort"
|
||||
android:key="commentssort"
|
||||
android:title="Сортировка комментариев" />
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="feedautoupdate"
|
||||
android:title="@string/vtlfeedreload" />
|
||||
<com.vtosters.lite.ui.SummaryListPreference
|
||||
android:defaultValue="default"
|
||||
android:dialogTitle="Выберите значение"
|
||||
android:entries="@array/newsupdate_value"
|
||||
android:entryValues="@array/newsupdate"
|
||||
android:key="newsupdate"
|
||||
android:title="Обновление новостей" />
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="feedcache"
|
||||
|
||||
@@ -2213,7 +2213,7 @@
|
||||
.line 183
|
||||
sget-object v3, Lcom/vk/im/engine/internal/api_parsers/ImageSizesParser;->a:Lcom/vk/im/engine/internal/api_parsers/ImageSizesParser;
|
||||
|
||||
invoke-static {}, Lru/vtosters/lite/utils/Preferences;->getBackgroundStickers()Ljava/lang/String;
|
||||
invoke-static {}, Lru/vtosters/lite/utils/Themes;->getBackgroundStickers()Ljava/lang/String;
|
||||
|
||||
move-result-object v4
|
||||
|
||||
|
||||
@@ -531,17 +531,12 @@
|
||||
.method public static c(Z)J
|
||||
.locals 3
|
||||
|
||||
invoke-static {}, Lru/vtosters/lite/utils/Preferences;->feedautoupdate()Z
|
||||
invoke-static {p0}, Lru/vtosters/lite/utils/Newsfeed;->getUpdateNewsfeed(Z)J
|
||||
|
||||
move-result v0
|
||||
|
||||
if-nez v0, :cond_0
|
||||
|
||||
sget-wide v0, Ljava/lang/Long;->MAX_VALUE:J
|
||||
move-result-wide v0
|
||||
|
||||
return-wide v0
|
||||
|
||||
:cond_0
|
||||
if-eqz p0, :cond_1
|
||||
|
||||
const-string p0, "refresh_timeout_top"
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
move-result v2
|
||||
|
||||
invoke-static {}, Lru/vtosters/lite/utils/Preferences;->getBackgroundStickers()Ljava/lang/String;
|
||||
invoke-static {}, Lru/vtosters/lite/utils/Themes;->getBackgroundStickers()Ljava/lang/String;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user