whatsnew block hide

This commit is contained in:
gdlbo
2022-07-21 12:24:09 +03:00
parent 22795bab81
commit 2aa7862fe1
3 changed files with 23 additions and 0 deletions
@@ -13,13 +13,20 @@ import static ru.vtosters.lite.utils.Newsfeed.isMusicBlock;
import static ru.vtosters.lite.utils.Newsfeed.isNewsBlock;
import static ru.vtosters.lite.utils.Newsfeed.isPostRecommendations;
import static ru.vtosters.lite.utils.Newsfeed.isRecomsGroup;
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
import static ru.vtosters.lite.utils.Preferences.vkme;
import android.view.View;
import android.view.ViewGroup;
import com.vk.core.preference.Preference;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
public class NewsfeedHook{
public static boolean injectFilters(JSONObject obj) throws JSONException{
var optString = obj.optString("type", "");
@@ -59,4 +66,11 @@ public class NewsfeedHook{
return Preference.b().getLong(refresh_timeout ? "refresh_timeout_top" : "refresh_timeout_recent", 600000L);
}
}
public static List hideElement(ArrayList list){
if (!getBoolValue("whatsnew", true)) {
list.clear();
}
return list;
}
}
+5
View File
@@ -10,6 +10,11 @@
android:defaultValue="true"
android:key="swipe"
android:title="@string/interfacenewsfeedswipe" />
<com.vtosters.lite.ui.MaterialSwitchPreference
android:defaultValue="true"
android:key="whatsnew"
android:summary="Блок написания поста в ленте"
android:title="Показывать блок поста" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/interfaceglobal">
<com.vtosters.lite.ui.SummaryListPreference
@@ -544,6 +544,10 @@
:cond_2
:goto_0
invoke-static {v0}, Lru/vtosters/lite/hooks/NewsfeedHook;->hideElement(Ljava/util/ArrayList;)Ljava/util/List;
move-result-object v0
return-object v0
.line 9