Fix an issue with media timelines
This commit is contained in:
parent
3dbfe33983
commit
a81879fb36
|
@ -429,6 +429,27 @@ public class StatusCache {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* delete all cache for an slug
|
||||||
|
*
|
||||||
|
* @return long - db id
|
||||||
|
* @throws DBException exception with database
|
||||||
|
*/
|
||||||
|
public long deleteForSlug(String slug) throws DBException {
|
||||||
|
if (db == null) {
|
||||||
|
throw new DBException("db is null. Wrong initialization.");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return db.delete(Sqlite.TABLE_STATUS_CACHE,
|
||||||
|
Sqlite.COL_SLUG + " = ? AND " + Sqlite.COL_USER_ID + " = ? AND " + Sqlite.COL_INSTANCE + " =?",
|
||||||
|
new String[]{slug, MainActivity.currentUserID, MainActivity.currentInstance});
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* delete all cache for an account
|
* delete all cache for an account
|
||||||
*
|
*
|
||||||
|
@ -581,7 +602,6 @@ public class StatusCache {
|
||||||
selection += "AND " + Sqlite.COL_STATUS_ID + " > '" + since_id + "' ";
|
selection += "AND " + Sqlite.COL_STATUS_ID + " > '" + since_id + "' ";
|
||||||
limit = null;
|
limit = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Cursor c = db.query(Sqlite.TABLE_STATUS_CACHE, null, selection, null, Sqlite.COL_STATUS_ID, null, Sqlite.COL_STATUS_ID + order, limit);
|
Cursor c = db.query(Sqlite.TABLE_STATUS_CACHE, null, selection, null, Sqlite.COL_STATUS_ID, null, Sqlite.COL_STATUS_ID + order, limit);
|
||||||
return createStatusReply(cursorToListOfStatuses(c));
|
return createStatusReply(cursorToListOfStatuses(c));
|
||||||
|
|
|
@ -27,7 +27,6 @@ import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
import android.util.Log;
|
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.ContextThemeWrapper;
|
import android.view.ContextThemeWrapper;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
@ -63,6 +62,7 @@ import app.fedilab.android.client.entities.app.BottomMenu;
|
||||||
import app.fedilab.android.client.entities.app.Pinned;
|
import app.fedilab.android.client.entities.app.Pinned;
|
||||||
import app.fedilab.android.client.entities.app.PinnedTimeline;
|
import app.fedilab.android.client.entities.app.PinnedTimeline;
|
||||||
import app.fedilab.android.client.entities.app.RemoteInstance;
|
import app.fedilab.android.client.entities.app.RemoteInstance;
|
||||||
|
import app.fedilab.android.client.entities.app.StatusCache;
|
||||||
import app.fedilab.android.client.entities.app.TagTimeline;
|
import app.fedilab.android.client.entities.app.TagTimeline;
|
||||||
import app.fedilab.android.client.entities.app.Timeline;
|
import app.fedilab.android.client.entities.app.Timeline;
|
||||||
import app.fedilab.android.databinding.ActivityMainBinding;
|
import app.fedilab.android.databinding.ActivityMainBinding;
|
||||||
|
@ -491,19 +491,18 @@ public class PinnedTimelineHelper {
|
||||||
tabStrip.getChildAt(i).setOnLongClickListener(v -> {
|
tabStrip.getChildAt(i).setOnLongClickListener(v -> {
|
||||||
|
|
||||||
int position = finalI - (BOTTOM_TIMELINE_COUNT - finalToRemove);
|
int position = finalI - (BOTTOM_TIMELINE_COUNT - finalToRemove);
|
||||||
Log.v(Helper.TAG, "position: " + position + " -> " + pinnedTimelineVisibleList.get(position).type);
|
|
||||||
switch (pinnedTimelineVisibleList.get(position).type) {
|
switch (pinnedTimelineVisibleList.get(position).type) {
|
||||||
case LIST:
|
case LIST:
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case TAG:
|
case TAG:
|
||||||
tagClick(activity, finalPinned, v, activityMainBinding, finalI);
|
tagClick(activity, finalPinned, v, activityMainBinding, finalI, activityMainBinding.tabLayout.getTabAt(finalI).getTag().toString());
|
||||||
break;
|
break;
|
||||||
case REMOTE:
|
case REMOTE:
|
||||||
if (pinnedTimelineVisibleList.get(position).remoteInstance.type != RemoteInstance.InstanceType.NITTER) {
|
if (pinnedTimelineVisibleList.get(position).remoteInstance.type != RemoteInstance.InstanceType.NITTER) {
|
||||||
instanceClick(activity, finalPinned, v, activityMainBinding, finalI);
|
instanceClick(activity, finalPinned, v, activityMainBinding, finalI, activityMainBinding.tabLayout.getTabAt(finalI).getTag().toString());
|
||||||
} else {
|
} else {
|
||||||
nitterClick(activity, finalPinned, activityMainBinding, finalI);
|
nitterClick(activity, finalPinned, activityMainBinding, finalI, activityMainBinding.tabLayout.getTabAt(finalI).getTag().toString());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case HOME:
|
case HOME:
|
||||||
|
@ -758,7 +757,7 @@ public class PinnedTimelineHelper {
|
||||||
* @param view - View
|
* @param view - View
|
||||||
* @param position - int position of the tab
|
* @param position - int position of the tab
|
||||||
*/
|
*/
|
||||||
public static void tagClick(BaseMainActivity activity, Pinned pinned, View view, ActivityMainBinding activityMainBinding, int position) {
|
public static void tagClick(BaseMainActivity activity, Pinned pinned, View view, ActivityMainBinding activityMainBinding, int position, String slug) {
|
||||||
int toRemove = itemToRemoveInBottomMenu(activity);
|
int toRemove = itemToRemoveInBottomMenu(activity);
|
||||||
PopupMenu popup = new PopupMenu(new ContextThemeWrapper(activity, Helper.popupStyle()), view);
|
PopupMenu popup = new PopupMenu(new ContextThemeWrapper(activity, Helper.popupStyle()), view);
|
||||||
int offSetPosition = position - (BOTTOM_TIMELINE_COUNT - toRemove);
|
int offSetPosition = position - (BOTTOM_TIMELINE_COUNT - toRemove);
|
||||||
|
@ -769,7 +768,6 @@ public class PinnedTimelineHelper {
|
||||||
}
|
}
|
||||||
String tag;
|
String tag;
|
||||||
TagTimeline tagTimeline = pinned.pinnedTimelines.get(offSetPosition).tagTimeline;
|
TagTimeline tagTimeline = pinned.pinnedTimelines.get(offSetPosition).tagTimeline;
|
||||||
Log.v(Helper.TAG, "tagTimeline: " + tagTimeline);
|
|
||||||
if (tagTimeline == null)
|
if (tagTimeline == null)
|
||||||
return;
|
return;
|
||||||
if (tagTimeline.displayName != null)
|
if (tagTimeline.displayName != null)
|
||||||
|
@ -795,6 +793,14 @@ public class PinnedTimelineHelper {
|
||||||
popup.setOnDismissListener(menu1 -> {
|
popup.setOnDismissListener(menu1 -> {
|
||||||
if (changes[0]) {
|
if (changes[0]) {
|
||||||
if (activityMainBinding.viewPager.getAdapter() != null) {
|
if (activityMainBinding.viewPager.getAdapter() != null) {
|
||||||
|
try {
|
||||||
|
new StatusCache(activity).deleteForSlug(slug);
|
||||||
|
} catch (DBException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||||
|
editor.putString(activity.getString(R.string.SET_INNER_MARKER) + BaseMainActivity.currentUserID + BaseMainActivity.currentInstance + slug, null);
|
||||||
|
editor.commit();
|
||||||
Fragment fragmentMastodonTimeline = (Fragment) activityMainBinding.viewPager.getAdapter().instantiateItem(activityMainBinding.viewPager, activityMainBinding.tabLayout.getSelectedTabPosition());
|
Fragment fragmentMastodonTimeline = (Fragment) activityMainBinding.viewPager.getAdapter().instantiateItem(activityMainBinding.viewPager, activityMainBinding.tabLayout.getSelectedTabPosition());
|
||||||
if (fragmentMastodonTimeline instanceof FragmentMastodonTimeline && fragmentMastodonTimeline.isVisible()) {
|
if (fragmentMastodonTimeline instanceof FragmentMastodonTimeline && fragmentMastodonTimeline.isVisible()) {
|
||||||
FragmentTransaction fragTransaction = activity.getSupportFragmentManager().beginTransaction();
|
FragmentTransaction fragTransaction = activity.getSupportFragmentManager().beginTransaction();
|
||||||
|
@ -802,6 +808,7 @@ public class PinnedTimelineHelper {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.TAG);
|
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.TAG);
|
||||||
bundle.putSerializable(Helper.ARG_TAG_TIMELINE, tagTimeline);
|
bundle.putSerializable(Helper.ARG_TAG_TIMELINE, tagTimeline);
|
||||||
|
bundle.putSerializable(Helper.ARG_INITIALIZE_VIEW, false);
|
||||||
fragmentMastodonTimeline.setArguments(bundle);
|
fragmentMastodonTimeline.setArguments(bundle);
|
||||||
FragmentTransaction fragTransaction2 = activity.getSupportFragmentManager().beginTransaction();
|
FragmentTransaction fragTransaction2 = activity.getSupportFragmentManager().beginTransaction();
|
||||||
fragTransaction2.attach(fragmentMastodonTimeline);
|
fragTransaction2.attach(fragmentMastodonTimeline);
|
||||||
|
@ -975,7 +982,7 @@ public class PinnedTimelineHelper {
|
||||||
* @param view - View
|
* @param view - View
|
||||||
* @param position - int position of the tab
|
* @param position - int position of the tab
|
||||||
*/
|
*/
|
||||||
public static void instanceClick(BaseMainActivity activity, Pinned pinned, View view, ActivityMainBinding activityMainBinding, int position) {
|
public static void instanceClick(BaseMainActivity activity, Pinned pinned, View view, ActivityMainBinding activityMainBinding, int position, String slug) {
|
||||||
|
|
||||||
PopupMenu popup = new PopupMenu(new ContextThemeWrapper(activity, Helper.popupStyle()), view);
|
PopupMenu popup = new PopupMenu(new ContextThemeWrapper(activity, Helper.popupStyle()), view);
|
||||||
int toRemove = itemToRemoveInBottomMenu(activity);
|
int toRemove = itemToRemoveInBottomMenu(activity);
|
||||||
|
@ -986,6 +993,7 @@ public class PinnedTimelineHelper {
|
||||||
offSetPosition = position;
|
offSetPosition = position;
|
||||||
}
|
}
|
||||||
RemoteInstance remoteInstance = pinned.pinnedTimelines.get(offSetPosition).remoteInstance;
|
RemoteInstance remoteInstance = pinned.pinnedTimelines.get(offSetPosition).remoteInstance;
|
||||||
|
|
||||||
if (remoteInstance == null)
|
if (remoteInstance == null)
|
||||||
return;
|
return;
|
||||||
final String[] currentFilter = {remoteInstance.filteredWith};
|
final String[] currentFilter = {remoteInstance.filteredWith};
|
||||||
|
@ -1016,6 +1024,11 @@ public class PinnedTimelineHelper {
|
||||||
});
|
});
|
||||||
changes[0] = true;
|
changes[0] = true;
|
||||||
FragmentMastodonTimeline fragmentMastodonTimeline = null;
|
FragmentMastodonTimeline fragmentMastodonTimeline = null;
|
||||||
|
try {
|
||||||
|
new StatusCache(activity).deleteForSlug(slug);
|
||||||
|
} catch (DBException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
if (activityMainBinding.viewPager.getAdapter() != null) {
|
if (activityMainBinding.viewPager.getAdapter() != null) {
|
||||||
Fragment fragment = (Fragment) activityMainBinding.viewPager.getAdapter().instantiateItem(activityMainBinding.viewPager, activityMainBinding.tabLayout.getSelectedTabPosition());
|
Fragment fragment = (Fragment) activityMainBinding.viewPager.getAdapter().instantiateItem(activityMainBinding.viewPager, activityMainBinding.tabLayout.getSelectedTabPosition());
|
||||||
if (fragment instanceof FragmentMastodonTimeline && fragment.isVisible()) {
|
if (fragment instanceof FragmentMastodonTimeline && fragment.isVisible()) {
|
||||||
|
@ -1039,6 +1052,7 @@ public class PinnedTimelineHelper {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putSerializable(Helper.ARG_REMOTE_INSTANCE, pinned.pinnedTimelines.get(finalOffSetPosition));
|
bundle.putSerializable(Helper.ARG_REMOTE_INSTANCE, pinned.pinnedTimelines.get(finalOffSetPosition));
|
||||||
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.REMOTE);
|
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.REMOTE);
|
||||||
|
bundle.putSerializable(Helper.ARG_INITIALIZE_VIEW, false);
|
||||||
fragmentMastodonTimeline.setArguments(bundle);
|
fragmentMastodonTimeline.setArguments(bundle);
|
||||||
FragmentTransaction fragTransaction2 = activity.getSupportFragmentManager().beginTransaction();
|
FragmentTransaction fragTransaction2 = activity.getSupportFragmentManager().beginTransaction();
|
||||||
fragTransaction2.attach(fragmentMastodonTimeline);
|
fragTransaction2.attach(fragmentMastodonTimeline);
|
||||||
|
@ -1069,6 +1083,11 @@ public class PinnedTimelineHelper {
|
||||||
fragmentMastodonTimeline.refreshAllAdapters();
|
fragmentMastodonTimeline.refreshAllAdapters();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
new StatusCache(activity).deleteForSlug(slug);
|
||||||
|
} catch (DBException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
FragmentTransaction fragTransaction1 = activity.getSupportFragmentManager().beginTransaction();
|
FragmentTransaction fragTransaction1 = activity.getSupportFragmentManager().beginTransaction();
|
||||||
if (fragmentMastodonTimeline == null)
|
if (fragmentMastodonTimeline == null)
|
||||||
return false;
|
return false;
|
||||||
|
@ -1084,6 +1103,7 @@ public class PinnedTimelineHelper {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putSerializable(Helper.ARG_REMOTE_INSTANCE, pinned.pinnedTimelines.get(finalOffSetPosition1));
|
bundle.putSerializable(Helper.ARG_REMOTE_INSTANCE, pinned.pinnedTimelines.get(finalOffSetPosition1));
|
||||||
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.REMOTE);
|
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.REMOTE);
|
||||||
|
bundle.putSerializable(Helper.ARG_INITIALIZE_VIEW, false);
|
||||||
fragmentMastodonTimeline.setArguments(bundle);
|
fragmentMastodonTimeline.setArguments(bundle);
|
||||||
FragmentTransaction fragTransaction2 = activity.getSupportFragmentManager().beginTransaction();
|
FragmentTransaction fragTransaction2 = activity.getSupportFragmentManager().beginTransaction();
|
||||||
fragTransaction2.attach(fragmentMastodonTimeline);
|
fragTransaction2.attach(fragmentMastodonTimeline);
|
||||||
|
@ -1132,7 +1152,7 @@ public class PinnedTimelineHelper {
|
||||||
}
|
}
|
||||||
popup.getMenu().clear();
|
popup.getMenu().clear();
|
||||||
popup.getMenu().close();
|
popup.getMenu().close();
|
||||||
instanceClick(activity, pinned, view, activityMainBinding, position);
|
instanceClick(activity, pinned, view, activityMainBinding, position, slug);
|
||||||
});
|
});
|
||||||
AlertDialog alertDialog = dialogBuilder.create();
|
AlertDialog alertDialog = dialogBuilder.create();
|
||||||
alertDialog.show();
|
alertDialog.show();
|
||||||
|
@ -1143,6 +1163,11 @@ public class PinnedTimelineHelper {
|
||||||
popup.setOnDismissListener(menu -> {
|
popup.setOnDismissListener(menu -> {
|
||||||
if (changes[0]) {
|
if (changes[0]) {
|
||||||
FragmentMastodonTimeline fragmentMastodonTimeline = null;
|
FragmentMastodonTimeline fragmentMastodonTimeline = null;
|
||||||
|
try {
|
||||||
|
new StatusCache(activity).deleteForSlug(slug);
|
||||||
|
} catch (DBException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
if (activityMainBinding.viewPager.getAdapter() != null) {
|
if (activityMainBinding.viewPager.getAdapter() != null) {
|
||||||
Fragment fragment = (Fragment) activityMainBinding.viewPager.getAdapter().instantiateItem(activityMainBinding.viewPager, activityMainBinding.tabLayout.getSelectedTabPosition());
|
Fragment fragment = (Fragment) activityMainBinding.viewPager.getAdapter().instantiateItem(activityMainBinding.viewPager, activityMainBinding.tabLayout.getSelectedTabPosition());
|
||||||
if (fragment instanceof FragmentMastodonTimeline && fragment.isVisible()) {
|
if (fragment instanceof FragmentMastodonTimeline && fragment.isVisible()) {
|
||||||
|
@ -1157,6 +1182,7 @@ public class PinnedTimelineHelper {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putSerializable(Helper.ARG_REMOTE_INSTANCE, pinned.pinnedTimelines.get(finalOffSetPosition2));
|
bundle.putSerializable(Helper.ARG_REMOTE_INSTANCE, pinned.pinnedTimelines.get(finalOffSetPosition2));
|
||||||
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.REMOTE);
|
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.REMOTE);
|
||||||
|
bundle.putSerializable(Helper.ARG_INITIALIZE_VIEW, false);
|
||||||
fragmentMastodonTimeline.setArguments(bundle);
|
fragmentMastodonTimeline.setArguments(bundle);
|
||||||
FragmentTransaction fragTransaction2 = activity.getSupportFragmentManager().beginTransaction();
|
FragmentTransaction fragTransaction2 = activity.getSupportFragmentManager().beginTransaction();
|
||||||
fragTransaction2.attach(fragmentMastodonTimeline);
|
fragTransaction2.attach(fragmentMastodonTimeline);
|
||||||
|
@ -1174,7 +1200,7 @@ public class PinnedTimelineHelper {
|
||||||
* @param pinned - {@link Pinned}
|
* @param pinned - {@link Pinned}
|
||||||
* @param position - int position of the tab
|
* @param position - int position of the tab
|
||||||
*/
|
*/
|
||||||
public static void nitterClick(BaseMainActivity activity, Pinned pinned, ActivityMainBinding activityMainBinding, int position) {
|
public static void nitterClick(BaseMainActivity activity, Pinned pinned, ActivityMainBinding activityMainBinding, int position, String slug) {
|
||||||
|
|
||||||
int toRemove = itemToRemoveInBottomMenu(activity);
|
int toRemove = itemToRemoveInBottomMenu(activity);
|
||||||
int offSetPosition = position - (BOTTOM_TIMELINE_COUNT - toRemove);
|
int offSetPosition = position - (BOTTOM_TIMELINE_COUNT - toRemove);
|
||||||
|
@ -1206,6 +1232,11 @@ public class PinnedTimelineHelper {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
FragmentMastodonTimeline fragmentMastodonTimeline = null;
|
FragmentMastodonTimeline fragmentMastodonTimeline = null;
|
||||||
|
try {
|
||||||
|
new StatusCache(activity).deleteForSlug(slug);
|
||||||
|
} catch (DBException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
if (activityMainBinding.viewPager.getAdapter() != null) {
|
if (activityMainBinding.viewPager.getAdapter() != null) {
|
||||||
Fragment fragment = (Fragment) activityMainBinding.viewPager.getAdapter().instantiateItem(activityMainBinding.viewPager, activityMainBinding.tabLayout.getSelectedTabPosition());
|
Fragment fragment = (Fragment) activityMainBinding.viewPager.getAdapter().instantiateItem(activityMainBinding.viewPager, activityMainBinding.tabLayout.getSelectedTabPosition());
|
||||||
if (fragment instanceof FragmentMastodonTimeline && fragment.isVisible()) {
|
if (fragment instanceof FragmentMastodonTimeline && fragment.isVisible()) {
|
||||||
|
@ -1220,6 +1251,7 @@ public class PinnedTimelineHelper {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putSerializable(Helper.ARG_REMOTE_INSTANCE, pinned.pinnedTimelines.get(finalOffSetPosition));
|
bundle.putSerializable(Helper.ARG_REMOTE_INSTANCE, pinned.pinnedTimelines.get(finalOffSetPosition));
|
||||||
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.REMOTE);
|
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.REMOTE);
|
||||||
|
bundle.putSerializable(Helper.ARG_INITIALIZE_VIEW, false);
|
||||||
fragmentMastodonTimeline.setArguments(bundle);
|
fragmentMastodonTimeline.setArguments(bundle);
|
||||||
FragmentTransaction fragTransaction2 = activity.getSupportFragmentManager().beginTransaction();
|
FragmentTransaction fragTransaction2 = activity.getSupportFragmentManager().beginTransaction();
|
||||||
fragTransaction2.attach(fragmentMastodonTimeline);
|
fragTransaction2.attach(fragmentMastodonTimeline);
|
||||||
|
|
|
@ -252,7 +252,7 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
|
||||||
ident = null;
|
ident = null;
|
||||||
}
|
}
|
||||||
if (timelineType != null) {
|
if (timelineType != null) {
|
||||||
slug = timelineType.getValue() + (ident != null ? "|" + ident : "");
|
slug = timelineType != Timeline.TimeLineEnum.ART ? timelineType.getValue() + (ident != null ? "|" + ident : "") : Timeline.TimeLineEnum.TAG.getValue() + (ident != null ? "|" + ident : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity());
|
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity());
|
||||||
|
@ -328,6 +328,7 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
|
||||||
}
|
}
|
||||||
flagLoading = fetched_statuses.pagination.max_id == null;
|
flagLoading = fetched_statuses.pagination.max_id == null;
|
||||||
binding.noAction.setVisibility(View.GONE);
|
binding.noAction.setVisibility(View.GONE);
|
||||||
|
|
||||||
if (timelineType == Timeline.TimeLineEnum.ART) {
|
if (timelineType == Timeline.TimeLineEnum.ART) {
|
||||||
//We have to split media in different statuses
|
//We have to split media in different statuses
|
||||||
List<Status> mediaStatuses = new ArrayList<>();
|
List<Status> mediaStatuses = new ArrayList<>();
|
||||||
|
@ -574,7 +575,6 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
|
||||||
timelineParams.maxId = max_id;
|
timelineParams.maxId = max_id;
|
||||||
}
|
}
|
||||||
timelineParams.fetchingMissing = fetchingMissing;
|
timelineParams.fetchingMissing = fetchingMissing;
|
||||||
|
|
||||||
switch (timelineType) {
|
switch (timelineType) {
|
||||||
case LOCAL:
|
case LOCAL:
|
||||||
timelineParams.local = true;
|
timelineParams.local = true;
|
||||||
|
@ -587,6 +587,7 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
|
||||||
case LIST:
|
case LIST:
|
||||||
timelineParams.listId = list_id;
|
timelineParams.listId = list_id;
|
||||||
break;
|
break;
|
||||||
|
case ART:
|
||||||
case TAG:
|
case TAG:
|
||||||
if (tagTimeline == null) {
|
if (tagTimeline == null) {
|
||||||
tagTimeline = new TagTimeline();
|
tagTimeline = new TagTimeline();
|
||||||
|
@ -608,7 +609,6 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
|
||||||
}
|
}
|
||||||
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity());
|
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity());
|
||||||
boolean useCache = sharedpreferences.getBoolean(getString(R.string.SET_USE_CACHE), true);
|
boolean useCache = sharedpreferences.getBoolean(getString(R.string.SET_USE_CACHE), true);
|
||||||
|
|
||||||
Handler handler = new Handler();
|
Handler handler = new Handler();
|
||||||
handler.postDelayed(() -> {
|
handler.postDelayed(() -> {
|
||||||
if (useCache && direction != DIRECTION.SCROLL_TOP && direction != DIRECTION.FETCH_NEW) {
|
if (useCache && direction != DIRECTION.SCROLL_TOP && direction != DIRECTION.FETCH_NEW) {
|
||||||
|
@ -681,10 +681,10 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
|
||||||
if (direction == null) {
|
if (direction == null) {
|
||||||
timelinesVM.getTimelineCache(timelineStatuses, timelineParams)
|
timelinesVM.getTimelineCache(timelineStatuses, timelineParams)
|
||||||
.observe(getViewLifecycleOwner(), statusesCached -> {
|
.observe(getViewLifecycleOwner(), statusesCached -> {
|
||||||
initialStatuses = statusesCached;
|
|
||||||
if (statusesCached == null || statusesCached.statuses == null || statusesCached.statuses.size() == 0) {
|
if (statusesCached == null || statusesCached.statuses == null || statusesCached.statuses.size() == 0) {
|
||||||
getLiveStatus(null, fetchingMissing, timelineParams, null);
|
getLiveStatus(null, fetchingMissing, timelineParams, null);
|
||||||
} else {
|
} else {
|
||||||
|
initialStatuses = statusesCached;
|
||||||
initializeStatusesCommonView(statusesCached);
|
initializeStatusesCommonView(statusesCached);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -727,6 +727,7 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
|
||||||
if (getView() == null) {
|
if (getView() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (direction == null) {
|
if (direction == null) {
|
||||||
timelinesVM.getTimeline(timelineStatuses, timelineParams)
|
timelinesVM.getTimeline(timelineStatuses, timelineParams)
|
||||||
.observe(getViewLifecycleOwner(), statuses -> {
|
.observe(getViewLifecycleOwner(), statuses -> {
|
||||||
|
|
|
@ -402,6 +402,7 @@ public class TimelinesVM extends AndroidViewModel {
|
||||||
case PUBLIC:
|
case PUBLIC:
|
||||||
timelineCall = mastodonTimelinesService.getPublic(timelineParams.token, false, true, timelineParams.onlyMedia, timelineParams.maxId, timelineParams.sinceId, timelineParams.minId, timelineParams.limit);
|
timelineCall = mastodonTimelinesService.getPublic(timelineParams.token, false, true, timelineParams.onlyMedia, timelineParams.maxId, timelineParams.sinceId, timelineParams.minId, timelineParams.limit);
|
||||||
break;
|
break;
|
||||||
|
case ART:
|
||||||
case TAG:
|
case TAG:
|
||||||
timelineCall = mastodonTimelinesService.getHashTag(timelineParams.token, timelineParams.hashtagTrim, timelineParams.local, timelineParams.onlyMedia, timelineParams.all, timelineParams.any, timelineParams.none, timelineParams.maxId, timelineParams.sinceId, timelineParams.minId, timelineParams.limit);
|
timelineCall = mastodonTimelinesService.getHashTag(timelineParams.token, timelineParams.hashtagTrim, timelineParams.local, timelineParams.onlyMedia, timelineParams.all, timelineParams.any, timelineParams.none, timelineParams.maxId, timelineParams.sinceId, timelineParams.minId, timelineParams.limit);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -328,6 +328,7 @@
|
||||||
android:padding="1dp"
|
android:padding="1dp"
|
||||||
android:adjustViewBounds="true"
|
android:adjustViewBounds="true"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
tools:visibility="visible"
|
tools:visibility="visible"
|
||||||
tools:src="@tools:sample/backgrounds/scenic" />
|
tools:src="@tools:sample/backgrounds/scenic" />
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue