forked from mirrors/Fedilab
Group reblogs
This commit is contained in:
parent
611c22a5c8
commit
b428cf4de9
4 changed files with 36 additions and 5 deletions
|
@ -17,6 +17,7 @@ package app.fedilab.android.helper;
|
||||||
import static app.fedilab.android.BaseMainActivity.filteredAccounts;
|
import static app.fedilab.android.BaseMainActivity.filteredAccounts;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.net.NetworkInfo;
|
import android.net.NetworkInfo;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
@ -25,6 +26,7 @@ import android.text.Html;
|
||||||
import androidx.lifecycle.LifecycleOwner;
|
import androidx.lifecycle.LifecycleOwner;
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
import androidx.lifecycle.ViewModelStoreOwner;
|
import androidx.lifecycle.ViewModelStoreOwner;
|
||||||
|
import androidx.preference.PreferenceManager;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -35,6 +37,7 @@ import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import app.fedilab.android.BaseMainActivity;
|
import app.fedilab.android.BaseMainActivity;
|
||||||
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.activities.MainActivity;
|
import app.fedilab.android.activities.MainActivity;
|
||||||
import app.fedilab.android.client.endpoints.MastodonFiltersService;
|
import app.fedilab.android.client.endpoints.MastodonFiltersService;
|
||||||
import app.fedilab.android.client.entities.api.Account;
|
import app.fedilab.android.client.entities.api.Account;
|
||||||
|
@ -153,21 +156,40 @@ public class TimelineHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
|
boolean groupReblogs = sharedpreferences.getBoolean(context.getString(R.string.SET_GROUP_REBLOGS), true);
|
||||||
if (filterTimeLineType == Timeline.TimeLineEnum.HOME) {
|
if (filterTimeLineType == Timeline.TimeLineEnum.HOME) {
|
||||||
if (filteredAccounts != null && filteredAccounts.size() > 0) {
|
|
||||||
for (Status status : statuses) {
|
for (int i = 0; i < statuses.size(); i++) {
|
||||||
|
if (filteredAccounts != null && filteredAccounts.size() > 0) {
|
||||||
for (Account account : filteredAccounts) {
|
for (Account account : filteredAccounts) {
|
||||||
if (account.acct.equals(status.account.acct) || (status.reblog != null && account.acct.equals(status.reblog.account.acct))) {
|
if (account.acct.equals(statuses.get(i).account.acct) || (statuses.get(i).reblog != null && account.acct.equals(statuses.get(i).reblog.account.acct))) {
|
||||||
Filter filterCustom = new Filter();
|
Filter filterCustom = new Filter();
|
||||||
filterCustom.filter_action = "hide";
|
filterCustom.filter_action = "hide";
|
||||||
ArrayList<String> contextCustom = new ArrayList<>();
|
ArrayList<String> contextCustom = new ArrayList<>();
|
||||||
contextCustom.add("home");
|
contextCustom.add("home");
|
||||||
filterCustom.title = "Fedilab";
|
filterCustom.title = "Fedilab";
|
||||||
filterCustom.context = contextCustom;
|
filterCustom.context = contextCustom;
|
||||||
status.filteredByApp = filterCustom;
|
statuses.get(i).filteredByApp = filterCustom;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//Group boosts
|
||||||
|
if (groupReblogs && statuses.get(i).filteredByApp == null && statuses.get(i).reblog != null) {
|
||||||
|
for (int j = 0; j < i; j++) {
|
||||||
|
if (statuses.get(j).reblog != null && statuses.get(j).reblog.id.equals(statuses.get(i).reblog.id)) {
|
||||||
|
Filter filterCustom = new Filter();
|
||||||
|
filterCustom.filter_action = "hide";
|
||||||
|
ArrayList<String> contextCustom = new ArrayList<>();
|
||||||
|
contextCustom.add("home");
|
||||||
|
filterCustom.title = "Fedilab reblog";
|
||||||
|
filterCustom.context = contextCustom;
|
||||||
|
statuses.get(i).filteredByApp = filterCustom;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1409,6 +1409,8 @@
|
||||||
<string name="SET_DISPLAY_ALL_NOTIFICATIONS_TYPE" translatable="false">SET_DISPLAY_ALL_NOTIFICATIONS_TYPE</string>
|
<string name="SET_DISPLAY_ALL_NOTIFICATIONS_TYPE" translatable="false">SET_DISPLAY_ALL_NOTIFICATIONS_TYPE</string>
|
||||||
<string name="SET_EXCLUDED_NOTIFICATIONS_TYPE" translatable="false">SET_EXCLUDED_NOTIFICATIONS_TYPE</string>
|
<string name="SET_EXCLUDED_NOTIFICATIONS_TYPE" translatable="false">SET_EXCLUDED_NOTIFICATIONS_TYPE</string>
|
||||||
<string name="SET_EXPAND_MEDIA" translatable="false">SET_EXPAND_MEDIA</string>
|
<string name="SET_EXPAND_MEDIA" translatable="false">SET_EXPAND_MEDIA</string>
|
||||||
|
<string name="SET_GROUP_REBLOGS" translatable="false">SET_GROUP_REBLOGS</string>
|
||||||
|
|
||||||
<string name="SET_LIVE_TRANSLATE" translatable="false">SET_LIVE_TRANSLATE</string>
|
<string name="SET_LIVE_TRANSLATE" translatable="false">SET_LIVE_TRANSLATE</string>
|
||||||
<string name="SET_TRUNCATE_TOOTS_SIZE" translatable="false">SET_TRUNCATE_TOOTS_SIZE</string>
|
<string name="SET_TRUNCATE_TOOTS_SIZE" translatable="false">SET_TRUNCATE_TOOTS_SIZE</string>
|
||||||
<string name="SET_ART_WITH_NSFW" translatable="false">SET_ART_WITH_NSFW</string>
|
<string name="SET_ART_WITH_NSFW" translatable="false">SET_ART_WITH_NSFW</string>
|
||||||
|
@ -2108,4 +2110,5 @@
|
||||||
<string name="put_all_accounts_in_home_muted">All accounts will be muted for the Home timeline.</string>
|
<string name="put_all_accounts_in_home_muted">All accounts will be muted for the Home timeline.</string>
|
||||||
<string name="mute_them_all">Mute them all</string>
|
<string name="mute_them_all">Mute them all</string>
|
||||||
<string name="import_data">Import data</string>
|
<string name="import_data">Import data</string>
|
||||||
|
<string name="group_reblogs">Group reblogs in home timeline</string>
|
||||||
</resources>
|
</resources>
|
|
@ -19,7 +19,12 @@
|
||||||
app:key="@string/SET_EXPAND_MEDIA"
|
app:key="@string/SET_EXPAND_MEDIA"
|
||||||
app:singleLineTitle="false"
|
app:singleLineTitle="false"
|
||||||
app:title="@string/expand_image" />
|
app:title="@string/expand_image" />
|
||||||
|
<SwitchPreferenceCompat
|
||||||
|
android:defaultValue="true"
|
||||||
|
app:iconSpaceReserved="false"
|
||||||
|
app:key="@string/SET_GROUP_REBLOGS"
|
||||||
|
app:singleLineTitle="false"
|
||||||
|
app:title="@string/group_reblogs" />
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:defaultValue="default"
|
android:defaultValue="default"
|
||||||
app:entries="@array/SET_LIVE_TRANSLATE_VALUES"
|
app:entries="@array/SET_LIVE_TRANSLATE_VALUES"
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
Added:
|
Added:
|
||||||
- Post random quotes
|
- Post random quotes
|
||||||
|
- Group reblogs in home timeline
|
||||||
|
|
||||||
Changed:
|
Changed:
|
||||||
- Display translate button only when language is different
|
- Display translate button only when language is different
|
||||||
|
|
Loading…
Reference in a new issue