chore(merge-upstream): more conflict solving tomfoolery
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
package org.joinmastodon.android.api.requests.lists;
|
package org.joinmastodon.android.api.requests.lists;
|
||||||
|
|
||||||
import org.joinmastodon.android.api.MastodonAPIRequest;
|
import org.joinmastodon.android.api.MastodonAPIRequest;
|
||||||
import org.joinmastodon.android.model.ListTimeline;
|
import org.joinmastodon.android.model.FollowList;
|
||||||
|
|
||||||
public class GetList extends MastodonAPIRequest<ListTimeline> {
|
public class GetList extends MastodonAPIRequest<FollowList> {
|
||||||
public GetList(String id) {
|
public GetList(String id) {
|
||||||
super(HttpMethod.GET, "/lists/" + id, ListTimeline.class);
|
super(HttpMethod.GET, "/lists/" + id, FollowList.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import com.google.gson.reflect.TypeToken;
|
|||||||
|
|
||||||
import org.joinmastodon.android.api.MastodonAPIRequest;
|
import org.joinmastodon.android.api.MastodonAPIRequest;
|
||||||
import org.joinmastodon.android.model.FollowList;
|
import org.joinmastodon.android.model.FollowList;
|
||||||
import org.joinmastodon.android.model.ListTimeline;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
package org.joinmastodon.android.events;
|
package org.joinmastodon.android.events;
|
||||||
|
|
||||||
import org.joinmastodon.android.model.ListTimeline;
|
import org.joinmastodon.android.model.FollowList;
|
||||||
|
|
||||||
public class ListUpdatedCreatedEvent {
|
public class ListUpdatedCreatedEvent {
|
||||||
public final String id;
|
public final String id;
|
||||||
public final String title;
|
public final String title;
|
||||||
public final ListTimeline.RepliesPolicy repliesPolicy;
|
public final FollowList.RepliesPolicy repliesPolicy;
|
||||||
public final boolean exclusive;
|
public final boolean exclusive;
|
||||||
|
|
||||||
public ListUpdatedCreatedEvent(String id, String title, boolean exclusive, ListTimeline.RepliesPolicy repliesPolicy) {
|
public ListUpdatedCreatedEvent(String id, String title, boolean exclusive, FollowList.RepliesPolicy repliesPolicy) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.exclusive = exclusive;
|
this.exclusive = exclusive;
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public class CreateListFragment extends BaseEditListFragment{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getNavigationIconDrawableResource(){
|
protected int getNavigationIconDrawableResource(){
|
||||||
return R.drawable.ic_baseline_close_24;
|
return R.drawable.ic_baseline_arrow_drop_down_18;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -41,17 +41,14 @@ import org.joinmastodon.android.api.requests.lists.GetLists;
|
|||||||
import org.joinmastodon.android.api.requests.tags.GetFollowedHashtags;
|
import org.joinmastodon.android.api.requests.tags.GetFollowedHashtags;
|
||||||
import org.joinmastodon.android.api.session.AccountLocalPreferences;
|
import org.joinmastodon.android.api.session.AccountLocalPreferences;
|
||||||
import org.joinmastodon.android.api.session.AccountSessionManager;
|
import org.joinmastodon.android.api.session.AccountSessionManager;
|
||||||
import org.joinmastodon.android.api.session.AccountSession;
|
|
||||||
import org.joinmastodon.android.api.session.AccountSessionManager;
|
|
||||||
import org.joinmastodon.android.model.CustomLocalTimeline;
|
import org.joinmastodon.android.model.CustomLocalTimeline;
|
||||||
|
import org.joinmastodon.android.model.FollowList;
|
||||||
import org.joinmastodon.android.model.Hashtag;
|
import org.joinmastodon.android.model.Hashtag;
|
||||||
import org.joinmastodon.android.model.HeaderPaginationList;
|
import org.joinmastodon.android.model.HeaderPaginationList;
|
||||||
import org.joinmastodon.android.model.ListTimeline;
|
|
||||||
import org.joinmastodon.android.model.TimelineDefinition;
|
import org.joinmastodon.android.model.TimelineDefinition;
|
||||||
import org.joinmastodon.android.ui.DividerItemDecoration;
|
import org.joinmastodon.android.ui.DividerItemDecoration;
|
||||||
import org.joinmastodon.android.ui.M3AlertDialogBuilder;
|
import org.joinmastodon.android.ui.M3AlertDialogBuilder;
|
||||||
import org.joinmastodon.android.ui.utils.UiUtils;
|
import org.joinmastodon.android.ui.utils.UiUtils;
|
||||||
import org.joinmastodon.android.ui.views.TextInputFrameLayout;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@@ -74,7 +71,7 @@ public class EditTimelinesFragment extends MastodonRecyclerFragment<TimelineDefi
|
|||||||
private Menu optionsMenu;
|
private Menu optionsMenu;
|
||||||
private boolean updated;
|
private boolean updated;
|
||||||
private final Map<MenuItem, TimelineDefinition> timelineByMenuItem=new HashMap<>();
|
private final Map<MenuItem, TimelineDefinition> timelineByMenuItem=new HashMap<>();
|
||||||
private final List<ListTimeline> listTimelines=new ArrayList<>();
|
private final List<FollowList> followLists =new ArrayList<>();
|
||||||
private final List<Hashtag> hashtags=new ArrayList<>();
|
private final List<Hashtag> hashtags=new ArrayList<>();
|
||||||
private MenuItem addHashtagItem;
|
private MenuItem addHashtagItem;
|
||||||
private final List<CustomLocalTimeline> localTimelines = new ArrayList<>();
|
private final List<CustomLocalTimeline> localTimelines = new ArrayList<>();
|
||||||
@@ -94,8 +91,8 @@ public class EditTimelinesFragment extends MastodonRecyclerFragment<TimelineDefi
|
|||||||
|
|
||||||
new GetLists().setCallback(new Callback<>(){
|
new GetLists().setCallback(new Callback<>(){
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<ListTimeline> result){
|
public void onSuccess(List<FollowList> result){
|
||||||
listTimelines.addAll(result);
|
followLists.addAll(result);
|
||||||
updateOptionsMenu();
|
updateOptionsMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -224,7 +221,7 @@ public class EditTimelinesFragment extends MastodonRecyclerFragment<TimelineDefi
|
|||||||
makeBackItem(hashtagsMenu);
|
makeBackItem(hashtagsMenu);
|
||||||
|
|
||||||
TimelineDefinition.getAllTimelines(accountID).stream().forEach(tl->addTimelineToOptions(tl, timelinesMenu));
|
TimelineDefinition.getAllTimelines(accountID).stream().forEach(tl->addTimelineToOptions(tl, timelinesMenu));
|
||||||
listTimelines.stream().map(TimelineDefinition::ofList).forEach(tl->addTimelineToOptions(tl, listsMenu));
|
followLists.stream().map(TimelineDefinition::ofList).forEach(tl->addTimelineToOptions(tl, listsMenu));
|
||||||
addHashtagItem=addOptionsItem(hashtagsMenu, getContext().getString(R.string.sk_timelines_add), R.drawable.ic_fluent_add_24_regular);
|
addHashtagItem=addOptionsItem(hashtagsMenu, getContext().getString(R.string.sk_timelines_add), R.drawable.ic_fluent_add_24_regular);
|
||||||
hashtags.stream().map(TimelineDefinition::ofHashtag).forEach(tl->addTimelineToOptions(tl, hashtagsMenu));
|
hashtags.stream().map(TimelineDefinition::ofHashtag).forEach(tl->addTimelineToOptions(tl, hashtagsMenu));
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ import org.joinmastodon.android.fragments.settings.SettingsMainFragment;
|
|||||||
import org.joinmastodon.android.model.Announcement;
|
import org.joinmastodon.android.model.Announcement;
|
||||||
import org.joinmastodon.android.model.Hashtag;
|
import org.joinmastodon.android.model.Hashtag;
|
||||||
import org.joinmastodon.android.model.HeaderPaginationList;
|
import org.joinmastodon.android.model.HeaderPaginationList;
|
||||||
import org.joinmastodon.android.model.ListTimeline;
|
import org.joinmastodon.android.model.FollowList;
|
||||||
import org.joinmastodon.android.model.TimelineDefinition;
|
import org.joinmastodon.android.model.TimelineDefinition;
|
||||||
import org.joinmastodon.android.ui.SimpleViewHolder;
|
import org.joinmastodon.android.ui.SimpleViewHolder;
|
||||||
import org.joinmastodon.android.ui.utils.UiUtils;
|
import org.joinmastodon.android.ui.utils.UiUtils;
|
||||||
@@ -95,7 +95,7 @@ public class HomeTabFragment extends MastodonToolbarFragment implements Scrollab
|
|||||||
private ImageView collapsedChevron;
|
private ImageView collapsedChevron;
|
||||||
private TextView timelineTitle;
|
private TextView timelineTitle;
|
||||||
private PopupMenu switcherPopup;
|
private PopupMenu switcherPopup;
|
||||||
private final Map<Integer, ListTimeline> listItems = new HashMap<>();
|
private final Map<Integer, FollowList> listItems = new HashMap<>();
|
||||||
private final Map<Integer, Hashtag> hashtagsItems = new HashMap<>();
|
private final Map<Integer, Hashtag> hashtagsItems = new HashMap<>();
|
||||||
private List<TimelineDefinition> timelinesList;
|
private List<TimelineDefinition> timelinesList;
|
||||||
private int count;
|
private int count;
|
||||||
@@ -270,7 +270,7 @@ public class HomeTabFragment extends MastodonToolbarFragment implements Scrollab
|
|||||||
|
|
||||||
new GetLists().setCallback(new Callback<>() {
|
new GetLists().setCallback(new Callback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<ListTimeline> lists) {
|
public void onSuccess(List<FollowList> lists) {
|
||||||
updateList(lists, listItems);
|
updateList(lists, listItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -512,7 +512,7 @@ public class HomeTabFragment extends MastodonToolbarFragment implements Scrollab
|
|||||||
Bundle args=new Bundle();
|
Bundle args=new Bundle();
|
||||||
args.putString("account", accountID);
|
args.putString("account", accountID);
|
||||||
int id = item.getItemId();
|
int id = item.getItemId();
|
||||||
ListTimeline list;
|
FollowList list;
|
||||||
Hashtag hashtag;
|
Hashtag hashtag;
|
||||||
|
|
||||||
if (item.getItemId() == R.id.menu_back) {
|
if (item.getItemId() == R.id.menu_back) {
|
||||||
@@ -701,13 +701,13 @@ public class HomeTabFragment extends MastodonToolbarFragment implements Scrollab
|
|||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onListDeletedEvent(ListDeletedEvent event) {
|
public void onListDeletedEvent(ListDeletedEvent event) {
|
||||||
handleListEvent(listItems, l -> l.id.equals(event.id), false, null);
|
handleListEvent(listItems, l -> l.id.equals(event.listID), false, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onListUpdatedCreatedEvent(ListUpdatedCreatedEvent event) {
|
public void onListUpdatedCreatedEvent(ListUpdatedCreatedEvent event) {
|
||||||
handleListEvent(listItems, l -> l.id.equals(event.id), true, () -> {
|
handleListEvent(listItems, l -> l.id.equals(event.id), true, () -> {
|
||||||
ListTimeline list = new ListTimeline();
|
FollowList list = new FollowList();
|
||||||
list.id = event.id;
|
list.id = event.id;
|
||||||
list.title = event.title;
|
list.title = event.title;
|
||||||
list.repliesPolicy = event.repliesPolicy;
|
list.repliesPolicy = event.repliesPolicy;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package org.joinmastodon.android.fragments;
|
package org.joinmastodon.android.fragments;
|
||||||
|
|
||||||
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.ActionMode;
|
import android.view.ActionMode;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
@@ -13,6 +14,7 @@ import com.squareup.otto.Subscribe;
|
|||||||
|
|
||||||
import org.joinmastodon.android.E;
|
import org.joinmastodon.android.E;
|
||||||
import org.joinmastodon.android.R;
|
import org.joinmastodon.android.R;
|
||||||
|
import org.joinmastodon.android.api.MastodonAPIRequest;
|
||||||
import org.joinmastodon.android.api.requests.HeaderPaginationRequest;
|
import org.joinmastodon.android.api.requests.HeaderPaginationRequest;
|
||||||
import org.joinmastodon.android.api.requests.lists.AddAccountsToList;
|
import org.joinmastodon.android.api.requests.lists.AddAccountsToList;
|
||||||
import org.joinmastodon.android.api.requests.lists.GetListAccounts;
|
import org.joinmastodon.android.api.requests.lists.GetListAccounts;
|
||||||
@@ -76,6 +78,21 @@ public class ListMembersFragment extends PaginatedAccountListFragment{
|
|||||||
return new GetListAccounts(followList.id, maxID, count);
|
return new GetListAccounts(followList.id, maxID, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected MastodonAPIRequest loadRemoteInfo(){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getCurrentInfo(){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRemoteDomain(){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onConfigureViewHolder(AccountViewHolder holder){
|
protected void onConfigureViewHolder(AccountViewHolder holder){
|
||||||
super.onConfigureViewHolder(holder);
|
super.onConfigureViewHolder(holder);
|
||||||
@@ -125,7 +142,7 @@ public class ListMembersFragment extends PaginatedAccountListFragment{
|
|||||||
public void onViewCreated(View view, Bundle savedInstanceState){
|
public void onViewCreated(View view, Bundle savedInstanceState){
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
fab=view.findViewById(R.id.fab);
|
fab=view.findViewById(R.id.fab);
|
||||||
fab.setImageResource(R.drawable.ic_add_24px);
|
fab.setImageResource(R.drawable.ic_fluent_add_24_regular);
|
||||||
fab.setContentDescription(getString(R.string.add_list_member));
|
fab.setContentDescription(getString(R.string.add_list_member));
|
||||||
fab.setOnClickListener(v->onFabClick());
|
fab.setOnClickListener(v->onFabClick());
|
||||||
}
|
}
|
||||||
@@ -298,4 +315,9 @@ public class ListMembersFragment extends PaginatedAccountListFragment{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Uri getWebUri(Uri.Builder base){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import org.joinmastodon.android.api.session.AccountSessionManager;
|
|||||||
import org.joinmastodon.android.events.ListDeletedEvent;
|
import org.joinmastodon.android.events.ListDeletedEvent;
|
||||||
import org.joinmastodon.android.events.ListUpdatedCreatedEvent;
|
import org.joinmastodon.android.events.ListUpdatedCreatedEvent;
|
||||||
import org.joinmastodon.android.model.FilterContext;
|
import org.joinmastodon.android.model.FilterContext;
|
||||||
import org.joinmastodon.android.model.ListTimeline;
|
import org.joinmastodon.android.model.FollowList;
|
||||||
import org.joinmastodon.android.model.Status;
|
import org.joinmastodon.android.model.Status;
|
||||||
import org.joinmastodon.android.model.TimelineDefinition;
|
import org.joinmastodon.android.model.TimelineDefinition;
|
||||||
import org.joinmastodon.android.ui.M3AlertDialogBuilder;
|
import org.joinmastodon.android.ui.M3AlertDialogBuilder;
|
||||||
@@ -39,7 +39,7 @@ public class ListTimelineFragment extends PinnableStatusListFragment {
|
|||||||
private String listID;
|
private String listID;
|
||||||
private String listTitle;
|
private String listTitle;
|
||||||
@Nullable
|
@Nullable
|
||||||
private ListTimeline.RepliesPolicy repliesPolicy;
|
private FollowList.RepliesPolicy repliesPolicy;
|
||||||
private boolean exclusive;
|
private boolean exclusive;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -54,19 +54,19 @@ public class ListTimelineFragment extends PinnableStatusListFragment {
|
|||||||
listID = args.getString("listID");
|
listID = args.getString("listID");
|
||||||
listTitle = args.getString("listTitle");
|
listTitle = args.getString("listTitle");
|
||||||
exclusive = args.getBoolean("listIsExclusive");
|
exclusive = args.getBoolean("listIsExclusive");
|
||||||
repliesPolicy = ListTimeline.RepliesPolicy.values()[args.getInt("repliesPolicy", 0)];
|
repliesPolicy = FollowList.RepliesPolicy.values()[args.getInt("repliesPolicy", 0)];
|
||||||
|
|
||||||
setTitle(listTitle);
|
setTitle(listTitle);
|
||||||
setHasOptionsMenu(true);
|
setHasOptionsMenu(true);
|
||||||
|
|
||||||
new GetList(listID).setCallback(new Callback<>() {
|
new GetList(listID).setCallback(new Callback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(ListTimeline listTimeline) {
|
public void onSuccess(FollowList followList) {
|
||||||
if(getActivity()==null) return;
|
if(getActivity()==null) return;
|
||||||
// TODO: save updated info
|
// TODO: save updated info
|
||||||
if (!listTimeline.title.equals(listTitle)) setTitle(listTimeline.title);
|
if (!followList.title.equals(listTitle)) setTitle(followList.title);
|
||||||
if (listTimeline.repliesPolicy != null && !listTimeline.repliesPolicy.equals(repliesPolicy)) {
|
if (followList.repliesPolicy != null && !followList.repliesPolicy.equals(repliesPolicy)) {
|
||||||
repliesPolicy = listTimeline.repliesPolicy;
|
repliesPolicy = followList.repliesPolicy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ public class ListTimelineFragment extends PinnableStatusListFragment {
|
|||||||
setTitle(newTitle);
|
setTitle(newTitle);
|
||||||
new UpdateList(listID, newTitle, editor.isExclusive(), editor.getRepliesPolicy()).setCallback(new Callback<>() {
|
new UpdateList(listID, newTitle, editor.isExclusive(), editor.getRepliesPolicy()).setCallback(new Callback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(ListTimeline list) {
|
public void onSuccess(FollowList list) {
|
||||||
if(getActivity()==null) return;
|
if(getActivity()==null) return;
|
||||||
setTitle(list.title);
|
setTitle(list.title);
|
||||||
listTitle = list.title;
|
listTitle = list.title;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import org.joinmastodon.android.api.requests.lists.GetLists;
|
|||||||
import org.joinmastodon.android.api.requests.lists.RemoveAccountsFromList;
|
import org.joinmastodon.android.api.requests.lists.RemoveAccountsFromList;
|
||||||
import org.joinmastodon.android.events.ListDeletedEvent;
|
import org.joinmastodon.android.events.ListDeletedEvent;
|
||||||
import org.joinmastodon.android.events.ListUpdatedCreatedEvent;
|
import org.joinmastodon.android.events.ListUpdatedCreatedEvent;
|
||||||
import org.joinmastodon.android.model.ListTimeline;
|
import org.joinmastodon.android.model.FollowList;
|
||||||
import org.joinmastodon.android.ui.DividerItemDecoration;
|
import org.joinmastodon.android.ui.DividerItemDecoration;
|
||||||
import org.joinmastodon.android.ui.M3AlertDialogBuilder;
|
import org.joinmastodon.android.ui.M3AlertDialogBuilder;
|
||||||
import org.joinmastodon.android.ui.views.ListEditor;
|
import org.joinmastodon.android.ui.views.ListEditor;
|
||||||
@@ -42,7 +42,7 @@ import me.grishka.appkit.api.SimpleCallback;
|
|||||||
import me.grishka.appkit.utils.BindableViewHolder;
|
import me.grishka.appkit.utils.BindableViewHolder;
|
||||||
import me.grishka.appkit.views.UsableRecyclerView;
|
import me.grishka.appkit.views.UsableRecyclerView;
|
||||||
|
|
||||||
public class ListsFragment extends MastodonRecyclerFragment<ListTimeline> implements ScrollableToTop, ProvidesAssistContent.ProvidesWebUri {
|
public class ListsFragment extends MastodonRecyclerFragment<FollowList> implements ScrollableToTop, ProvidesAssistContent.ProvidesWebUri {
|
||||||
private String accountID;
|
private String accountID;
|
||||||
private String profileAccountId;
|
private String profileAccountId;
|
||||||
private final HashMap<String, Boolean> userInListBefore = new HashMap<>();
|
private final HashMap<String, Boolean> userInListBefore = new HashMap<>();
|
||||||
@@ -99,7 +99,7 @@ public class ListsFragment extends MastodonRecyclerFragment<ListTimeline> implem
|
|||||||
.setPositiveButton(R.string.sk_create, (d, which) ->
|
.setPositiveButton(R.string.sk_create, (d, which) ->
|
||||||
new CreateList(editor.getTitle(), editor.isExclusive(), editor.getRepliesPolicy()).setCallback(new Callback<>() {
|
new CreateList(editor.getTitle(), editor.isExclusive(), editor.getRepliesPolicy()).setCallback(new Callback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(ListTimeline list) {
|
public void onSuccess(FollowList list) {
|
||||||
data.add(0, list);
|
data.add(0, list);
|
||||||
adapter.notifyItemRangeInserted(0, 1);
|
adapter.notifyItemRangeInserted(0, 1);
|
||||||
E.post(new ListUpdatedCreatedEvent(list.id, list.title, list.exclusive, list.repliesPolicy));
|
E.post(new ListUpdatedCreatedEvent(list.id, list.title, list.exclusive, list.repliesPolicy));
|
||||||
@@ -139,19 +139,19 @@ public class ListsFragment extends MastodonRecyclerFragment<ListTimeline> implem
|
|||||||
currentRequest=(profileAccountId != null ? new GetLists(profileAccountId) : new GetLists())
|
currentRequest=(profileAccountId != null ? new GetLists(profileAccountId) : new GetLists())
|
||||||
.setCallback(new SimpleCallback<>(this) {
|
.setCallback(new SimpleCallback<>(this) {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<ListTimeline> lists) {
|
public void onSuccess(List<FollowList> lists) {
|
||||||
if(getActivity()==null) return;
|
if(getActivity()==null) return;
|
||||||
for (ListTimeline l : lists) userInListBefore.put(l.id, true);
|
for (FollowList l : lists) userInListBefore.put(l.id, true);
|
||||||
userInList.putAll(userInListBefore);
|
userInList.putAll(userInListBefore);
|
||||||
if (profileAccountId == null || !lists.isEmpty()) onDataLoaded(lists, false);
|
if (profileAccountId == null || !lists.isEmpty()) onDataLoaded(lists, false);
|
||||||
if (profileAccountId == null) return;
|
if (profileAccountId == null) return;
|
||||||
|
|
||||||
currentRequest=new GetLists().setCallback(new SimpleCallback<>(ListsFragment.this) {
|
currentRequest=new GetLists().setCallback(new SimpleCallback<>(ListsFragment.this) {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<ListTimeline> allLists) {
|
public void onSuccess(List<FollowList> allLists) {
|
||||||
if(getActivity()==null) return;
|
if(getActivity()==null) return;
|
||||||
List<ListTimeline> newLists = new ArrayList<>();
|
List<FollowList> newLists = new ArrayList<>();
|
||||||
for (ListTimeline l : allLists) {
|
for (FollowList l : allLists) {
|
||||||
if (lists.stream().noneMatch(e -> e.id.equals(l.id))) newLists.add(l);
|
if (lists.stream().noneMatch(e -> e.id.equals(l.id))) newLists.add(l);
|
||||||
if (!userInListBefore.containsKey(l.id)) {
|
if (!userInListBefore.containsKey(l.id)) {
|
||||||
userInListBefore.put(l.id, false);
|
userInListBefore.put(l.id, false);
|
||||||
@@ -169,7 +169,7 @@ public class ListsFragment extends MastodonRecyclerFragment<ListTimeline> implem
|
|||||||
@Subscribe
|
@Subscribe
|
||||||
public void onListDeletedEvent(ListDeletedEvent event) {
|
public void onListDeletedEvent(ListDeletedEvent event) {
|
||||||
for (int i = 0; i < data.size(); i++) {
|
for (int i = 0; i < data.size(); i++) {
|
||||||
ListTimeline item = data.get(i);
|
FollowList item = data.get(i);
|
||||||
if (item.id.equals(event.id)) {
|
if (item.id.equals(event.id)) {
|
||||||
data.remove(i);
|
data.remove(i);
|
||||||
adapter.notifyItemRemoved(i);
|
adapter.notifyItemRemoved(i);
|
||||||
@@ -181,7 +181,7 @@ public class ListsFragment extends MastodonRecyclerFragment<ListTimeline> implem
|
|||||||
@Subscribe
|
@Subscribe
|
||||||
public void onListUpdatedCreatedEvent(ListUpdatedCreatedEvent event) {
|
public void onListUpdatedCreatedEvent(ListUpdatedCreatedEvent event) {
|
||||||
for (int i = 0; i < data.size(); i++) {
|
for (int i = 0; i < data.size(); i++) {
|
||||||
ListTimeline item = data.get(i);
|
FollowList item = data.get(i);
|
||||||
if (item.id.equals(event.id)) {
|
if (item.id.equals(event.id)) {
|
||||||
item.title = event.title;
|
item.title = event.title;
|
||||||
item.repliesPolicy = event.repliesPolicy;
|
item.repliesPolicy = event.repliesPolicy;
|
||||||
@@ -230,7 +230,7 @@ public class ListsFragment extends MastodonRecyclerFragment<ListTimeline> implem
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ListViewHolder extends BindableViewHolder<ListTimeline> implements UsableRecyclerView.Clickable{
|
private class ListViewHolder extends BindableViewHolder<FollowList> implements UsableRecyclerView.Clickable{
|
||||||
private final TextView title;
|
private final TextView title;
|
||||||
private final CheckBox listToggle;
|
private final CheckBox listToggle;
|
||||||
|
|
||||||
@@ -241,7 +241,7 @@ public class ListsFragment extends MastodonRecyclerFragment<ListTimeline> implem
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBind(ListTimeline item) {
|
public void onBind(FollowList item) {
|
||||||
title.setText(item.title);
|
title.setText(item.title);
|
||||||
title.setCompoundDrawablesRelativeWithIntrinsicBounds(itemView.getContext().getDrawable(
|
title.setCompoundDrawablesRelativeWithIntrinsicBounds(itemView.getContext().getDrawable(
|
||||||
item.exclusive ? R.drawable.ic_fluent_rss_24_regular : R.drawable.ic_fluent_people_24_regular
|
item.exclusive ? R.drawable.ic_fluent_rss_24_regular : R.drawable.ic_fluent_people_24_regular
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public class ManageFollowedHashtagsFragment extends BaseSettingsFragment<Hashtag
|
|||||||
onDataLoaded(result.stream().map(t->{
|
onDataLoaded(result.stream().map(t->{
|
||||||
int posts=t.getWeekPosts();
|
int posts=t.getWeekPosts();
|
||||||
return new ListItemWithOptionsMenu<>(t.name, getResources().getQuantityString(R.plurals.x_posts_recently, posts, posts), ManageFollowedHashtagsFragment.this,
|
return new ListItemWithOptionsMenu<>(t.name, getResources().getQuantityString(R.plurals.x_posts_recently, posts, posts), ManageFollowedHashtagsFragment.this,
|
||||||
R.drawable.ic_tag_24px, ManageFollowedHashtagsFragment.this::onItemClick, t, false);
|
R.drawable.ic_fluent_tag_24_regular, ManageFollowedHashtagsFragment.this::onItemClick, t, false);
|
||||||
}).collect(Collectors.toList()), maxID!=null);
|
}).collect(Collectors.toList()), maxID!=null);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -57,6 +57,8 @@ public class NotificationsListFragment extends BaseStatusListFragment<Notificati
|
|||||||
private String maxID;
|
private String maxID;
|
||||||
private boolean reloadingFromCache;
|
private boolean reloadingFromCache;
|
||||||
private DiscoverInfoBannerHelper bannerHelper;
|
private DiscoverInfoBannerHelper bannerHelper;
|
||||||
|
private String unreadMarker, realUnreadMarker;
|
||||||
|
private MenuItem markAllReadItem;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean wantsComposeButton() {
|
protected boolean wantsComposeButton() {
|
||||||
@@ -161,7 +163,7 @@ public class NotificationsListFragment extends BaseStatusListFragment<Notificati
|
|||||||
protected void doLoadData(int offset, int count){
|
protected void doLoadData(int offset, int count){
|
||||||
AccountSessionManager.getInstance()
|
AccountSessionManager.getInstance()
|
||||||
.getAccount(accountID).getCacheController()
|
.getAccount(accountID).getCacheController()
|
||||||
.getNotifications(offset>0 ? maxID : null, count, onlyMentions, onlyPosts, refreshing && !reloadingFromCache, new SimpleCallback<>(this){
|
.getNotifications(offset>0 ? maxID : null, count, onlyMentions, false, refreshing && !reloadingFromCache, new SimpleCallback<>(this){
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(PaginatedResponse<List<Notification>> result){
|
public void onSuccess(PaginatedResponse<List<Notification>> result){
|
||||||
if(getActivity()==null)
|
if(getActivity()==null)
|
||||||
@@ -367,28 +369,6 @@ public class NotificationsListFragment extends BaseStatusListFragment<Notificati
|
|||||||
adapter.notifyItemRangeRemoved(index, lastIndex-index);
|
adapter.notifyItemRangeRemoved(index, lastIndex-index);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onTabClick(View v){
|
|
||||||
boolean newOnlyMentions=v.getId()==R.id.mentions_tab;
|
|
||||||
if(newOnlyMentions==onlyMentions)
|
|
||||||
return;
|
|
||||||
onlyMentions=newOnlyMentions;
|
|
||||||
mentionsTab.setSelected(onlyMentions);
|
|
||||||
allTab.setSelected(!onlyMentions);
|
|
||||||
maxID=null;
|
|
||||||
showProgress();
|
|
||||||
refreshing=true;
|
|
||||||
reloadingFromCache=true;
|
|
||||||
loadData(0, 20);
|
|
||||||
AccountSessionManager.get(accountID).setNotificationsMentionsOnly(onlyMentions);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected View onCreateFooterView(LayoutInflater inflater){
|
|
||||||
View v=inflater.inflate(R.layout.load_more_with_end_mark, null);
|
|
||||||
endMark=v.findViewById(R.id.end_mark);
|
|
||||||
endMark.setVisibility(View.GONE);
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean needDividerForExtraItem(View child, View bottomSibling, RecyclerView.ViewHolder holder, RecyclerView.ViewHolder siblingHolder){
|
protected boolean needDividerForExtraItem(View child, View bottomSibling, RecyclerView.ViewHolder holder, RecyclerView.ViewHolder siblingHolder){
|
||||||
@@ -432,7 +412,7 @@ public class NotificationsListFragment extends BaseStatusListFragment<Notificati
|
|||||||
public void onRefresh(){
|
public void onRefresh(){
|
||||||
super.onRefresh();
|
super.onRefresh();
|
||||||
if (getParentFragment() instanceof NotificationsFragment nf) {
|
if (getParentFragment() instanceof NotificationsFragment nf) {
|
||||||
if (!onlyMentions && !onlyPosts) nf.markAsRead();
|
if (!onlyMentions) nf.markAsRead();
|
||||||
else AccountSessionManager.get(accountID).reloadNotificationsMarker(m->{
|
else AccountSessionManager.get(accountID).reloadNotificationsMarker(m->{
|
||||||
nf.unreadMarker=nf.realUnreadMarker=m;
|
nf.unreadMarker=nf.realUnreadMarker=m;
|
||||||
nf.updateMarkAllReadButton();
|
nf.updateMarkAllReadButton();
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ import android.widget.ImageView;
|
|||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
import android.widget.Toolbar;
|
import android.widget.Toolbar;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|||||||
@@ -45,7 +45,8 @@ public abstract class PaginatedAccountListFragment<T> extends BaseAccountListFra
|
|||||||
}
|
}
|
||||||
|
|
||||||
remoteDisabled = !GlobalUserPreferences.allowRemoteLoading
|
remoteDisabled = !GlobalUserPreferences.allowRemoteLoading
|
||||||
|| getSession().domain.equals(getRemoteDomain());
|
|| getSession().domain.equals(getRemoteDomain())
|
||||||
|
|| remoteInfoRequest == null;
|
||||||
if (!remoteDisabled) {
|
if (!remoteDisabled) {
|
||||||
remoteInfoRequest = loadRemoteInfo().setCallback(new Callback<>() {
|
remoteInfoRequest = loadRemoteInfo().setCallback(new Callback<>() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,37 +1,32 @@
|
|||||||
package org.joinmastodon.android.model;
|
package org.joinmastodon.android.model;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
import org.joinmastodon.android.api.AllFieldsAreRequired;
|
import org.joinmastodon.android.api.RequiredField;
|
||||||
import org.joinmastodon.android.api.ObjectValidationException;
|
|
||||||
import org.parceler.Parcel;
|
import org.parceler.Parcel;
|
||||||
|
|
||||||
// Called like this to avoid conflict with java.util.List
|
|
||||||
@AllFieldsAreRequired
|
|
||||||
@Parcel
|
@Parcel
|
||||||
public class FollowList extends BaseModel{
|
public class FollowList extends BaseModel {
|
||||||
|
@RequiredField
|
||||||
public String id;
|
public String id;
|
||||||
|
@RequiredField
|
||||||
public String title;
|
public String title;
|
||||||
public RepliesPolicy repliesPolicy=RepliesPolicy.LIST;
|
public RepliesPolicy repliesPolicy;
|
||||||
public boolean exclusive;
|
public boolean exclusive;
|
||||||
|
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String toString(){
|
public String toString() {
|
||||||
return "FollowList{"+
|
return "List{" +
|
||||||
"id='"+id+'\''+
|
"id='" + id + '\'' +
|
||||||
", title='"+title+'\''+
|
", title='" + title + '\'' +
|
||||||
", repliesPolicy="+repliesPolicy+
|
", repliesPolicy=" + repliesPolicy +
|
||||||
", exclusive="+exclusive+
|
", exclusive=" + exclusive +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void postprocess() throws ObjectValidationException{
|
|
||||||
if(repliesPolicy==null)
|
|
||||||
repliesPolicy=RepliesPolicy.LIST;
|
|
||||||
super.postprocess();
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum RepliesPolicy{
|
public enum RepliesPolicy{
|
||||||
@SerializedName("followed")
|
@SerializedName("followed")
|
||||||
FOLLOWED,
|
FOLLOWED,
|
||||||
|
|||||||
@@ -1,38 +0,0 @@
|
|||||||
package org.joinmastodon.android.model;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
|
||||||
|
|
||||||
import org.joinmastodon.android.api.RequiredField;
|
|
||||||
import org.parceler.Parcel;
|
|
||||||
|
|
||||||
@Parcel
|
|
||||||
public class ListTimeline extends BaseModel {
|
|
||||||
@RequiredField
|
|
||||||
public String id;
|
|
||||||
@RequiredField
|
|
||||||
public String title;
|
|
||||||
public RepliesPolicy repliesPolicy;
|
|
||||||
public boolean exclusive;
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "List{" +
|
|
||||||
"id='" + id + '\'' +
|
|
||||||
", title='" + title + '\'' +
|
|
||||||
", repliesPolicy=" + repliesPolicy +
|
|
||||||
", exclusive=" + exclusive +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum RepliesPolicy{
|
|
||||||
@SerializedName("followed")
|
|
||||||
FOLLOWED,
|
|
||||||
@SerializedName("list")
|
|
||||||
LIST,
|
|
||||||
@SerializedName("none")
|
|
||||||
NONE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -9,7 +9,6 @@ import androidx.annotation.DrawableRes;
|
|||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.annotation.StringRes;
|
import androidx.annotation.StringRes;
|
||||||
|
|
||||||
import org.joinmastodon.android.BuildConfig;
|
|
||||||
import org.joinmastodon.android.R;
|
import org.joinmastodon.android.R;
|
||||||
import org.joinmastodon.android.fragments.CustomLocalTimelineFragment;
|
import org.joinmastodon.android.fragments.CustomLocalTimelineFragment;
|
||||||
import org.joinmastodon.android.api.session.AccountSession;
|
import org.joinmastodon.android.api.session.AccountSession;
|
||||||
@@ -53,7 +52,7 @@ public class TimelineDefinition {
|
|||||||
return def;
|
return def;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TimelineDefinition ofList(ListTimeline list) {
|
public static TimelineDefinition ofList(FollowList list) {
|
||||||
return ofList(list.id, list.title, list.exclusive);
|
return ofList(list.id, list.title, list.exclusive);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,6 @@ public class OldPostPreReplySheet extends PreReplySheet{
|
|||||||
String monthsStr=months>24 ? context.getString(R.string.more_than_two_years) : context.getResources().getQuantityString(R.plurals.x_months, months, months);
|
String monthsStr=months>24 ? context.getString(R.string.more_than_two_years) : context.getResources().getQuantityString(R.plurals.x_months, months, months);
|
||||||
title.setText(context.getString(R.string.old_post_sheet_title, monthsStr));
|
title.setText(context.getString(R.string.old_post_sheet_title, monthsStr));
|
||||||
text.setText(R.string.old_post_sheet_text);
|
text.setText(R.string.old_post_sheet_text);
|
||||||
icon.setImageResource(R.drawable.ic_history_24px);
|
icon.setImageResource(R.drawable.ic_fluent_clock_24_regular);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -780,8 +780,9 @@ public class UiUtils {
|
|||||||
activity.getString(R.string.delete),
|
activity.getString(R.string.delete),
|
||||||
R.drawable.ic_fluent_delete_28_regular,
|
R.drawable.ic_fluent_delete_28_regular,
|
||||||
() -> new DeleteList(listID).setCallback(new Callback<>() {
|
() -> new DeleteList(listID).setCallback(new Callback<>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Object o) {
|
public void onSuccess(Void result){
|
||||||
callback.run();
|
callback.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,10 +15,10 @@ import androidx.annotation.NonNull;
|
|||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import org.joinmastodon.android.R;
|
import org.joinmastodon.android.R;
|
||||||
import org.joinmastodon.android.model.ListTimeline;
|
import org.joinmastodon.android.model.FollowList;
|
||||||
|
|
||||||
public class ListEditor extends LinearLayout {
|
public class ListEditor extends LinearLayout {
|
||||||
private ListTimeline.RepliesPolicy policy = null;
|
private FollowList.RepliesPolicy policy = null;
|
||||||
private final TextInputFrameLayout input;
|
private final TextInputFrameLayout input;
|
||||||
private final Button button;
|
private final Button button;
|
||||||
private final Switch exclusiveSwitch;
|
private final Switch exclusiveSwitch;
|
||||||
@@ -42,10 +42,10 @@ public class ListEditor extends LinearLayout {
|
|||||||
findViewById(R.id.exclusive)
|
findViewById(R.id.exclusive)
|
||||||
.setOnClickListener(v -> exclusiveSwitch.setChecked(!exclusiveSwitch.isChecked()));
|
.setOnClickListener(v -> exclusiveSwitch.setChecked(!exclusiveSwitch.isChecked()));
|
||||||
|
|
||||||
setRepliesPolicy(ListTimeline.RepliesPolicy.LIST);
|
setRepliesPolicy(FollowList.RepliesPolicy.LIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void applyList(String title, boolean exclusive, @Nullable ListTimeline.RepliesPolicy policy) {
|
public void applyList(String title, boolean exclusive, @Nullable FollowList.RepliesPolicy policy) {
|
||||||
input.getEditText().setText(title);
|
input.getEditText().setText(title);
|
||||||
exclusiveSwitch.setChecked(exclusive);
|
exclusiveSwitch.setChecked(exclusive);
|
||||||
if (policy != null) setRepliesPolicy(policy);
|
if (policy != null) setRepliesPolicy(policy);
|
||||||
@@ -55,7 +55,7 @@ public class ListEditor extends LinearLayout {
|
|||||||
return input.getEditText().getText().toString();
|
return input.getEditText().getText().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ListTimeline.RepliesPolicy getRepliesPolicy() {
|
public FollowList.RepliesPolicy getRepliesPolicy() {
|
||||||
return policy;
|
return policy;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ public class ListEditor extends LinearLayout {
|
|||||||
return exclusiveSwitch.isChecked();
|
return exclusiveSwitch.isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRepliesPolicy(@NonNull ListTimeline.RepliesPolicy policy) {
|
public void setRepliesPolicy(@NonNull FollowList.RepliesPolicy policy) {
|
||||||
this.policy = policy;
|
this.policy = policy;
|
||||||
switch (policy) {
|
switch (policy) {
|
||||||
case FOLLOWED -> button.setText(R.string.sk_list_replies_policy_followed);
|
case FOLLOWED -> button.setText(R.string.sk_list_replies_policy_followed);
|
||||||
@@ -74,11 +74,11 @@ public class ListEditor extends LinearLayout {
|
|||||||
|
|
||||||
private boolean onMenuItemClick(MenuItem i) {
|
private boolean onMenuItemClick(MenuItem i) {
|
||||||
if (i.getItemId() == R.id.reply_policy_none) {
|
if (i.getItemId() == R.id.reply_policy_none) {
|
||||||
setRepliesPolicy(ListTimeline.RepliesPolicy.NONE);
|
setRepliesPolicy(FollowList.RepliesPolicy.NONE);
|
||||||
} else if (i.getItemId() == R.id.reply_policy_followed) {
|
} else if (i.getItemId() == R.id.reply_policy_followed) {
|
||||||
setRepliesPolicy(ListTimeline.RepliesPolicy.FOLLOWED);
|
setRepliesPolicy(FollowList.RepliesPolicy.FOLLOWED);
|
||||||
} else if (i.getItemId() == R.id.reply_policy_list) {
|
} else if (i.getItemId() == R.id.reply_policy_list) {
|
||||||
setRepliesPolicy(ListTimeline.RepliesPolicy.LIST);
|
setRepliesPolicy(FollowList.RepliesPolicy.LIST);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user