add compose fab to drafts list
This commit is contained in:
parent
4b113e4a82
commit
3a607a81f6
|
@ -706,6 +706,7 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
|
||||||
private void navigateToUnsentPosts() {
|
private void navigateToUnsentPosts() {
|
||||||
Bundle args=new Bundle();
|
Bundle args=new Bundle();
|
||||||
args.putString("account", accountID);
|
args.putString("account", accountID);
|
||||||
|
args.putBoolean("hide_fab", true);
|
||||||
InputMethodManager imm=getActivity().getSystemService(InputMethodManager.class);
|
InputMethodManager imm=getActivity().getSystemService(InputMethodManager.class);
|
||||||
imm.hideSoftInputFromWindow(draftsBtn.getWindowToken(), 0);
|
imm.hideSoftInputFromWindow(draftsBtn.getWindowToken(), 0);
|
||||||
if (hasDraft()) {
|
if (hasDraft()) {
|
||||||
|
|
|
@ -105,7 +105,7 @@ public class HomeTimelineFragment extends StatusListFragment{
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
fab=view.findViewById(R.id.fab);
|
fab=view.findViewById(R.id.fab);
|
||||||
fab.setOnClickListener(this::onFabClick);
|
fab.setOnClickListener(this::onFabClick);
|
||||||
fab.setOnLongClickListener(v->UiUtils.pickAccountForCompose(getActivity(), accountID, null));
|
fab.setOnLongClickListener(v->UiUtils.pickAccountForCompose(getActivity(), accountID));
|
||||||
|
|
||||||
updateToolbarLogo();
|
updateToolbarLogo();
|
||||||
list.addOnScrollListener(new RecyclerView.OnScrollListener(){
|
list.addOnScrollListener(new RecyclerView.OnScrollListener(){
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package org.joinmastodon.android.fragments;
|
package org.joinmastodon.android.fragments;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.media.MediaRouter;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
|
@ -70,7 +69,7 @@ public class ListTimelineFragment extends StatusListFragment {
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
fab=view.findViewById(R.id.fab);
|
fab=view.findViewById(R.id.fab);
|
||||||
fab.setOnClickListener(this::onFabClick);
|
fab.setOnClickListener(this::onFabClick);
|
||||||
fab.setOnLongClickListener(v -> UiUtils.pickAccountForCompose(getActivity(), accountID, null));
|
fab.setOnLongClickListener(v -> UiUtils.pickAccountForCompose(getActivity(), accountID));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onFabClick(View v){
|
private void onFabClick(View v){
|
||||||
|
|
|
@ -9,13 +9,10 @@ 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.requests.statuses.GetBookmarkedStatuses;
|
import org.joinmastodon.android.api.requests.statuses.CreateStatus;
|
||||||
import org.joinmastodon.android.api.requests.statuses.GetScheduledStatuses;
|
import org.joinmastodon.android.api.requests.statuses.GetScheduledStatuses;
|
||||||
import org.joinmastodon.android.api.session.AccountSessionManager;
|
|
||||||
import org.joinmastodon.android.events.ScheduledStatusCreatedEvent;
|
import org.joinmastodon.android.events.ScheduledStatusCreatedEvent;
|
||||||
import org.joinmastodon.android.events.ScheduledStatusDeletedEvent;
|
import org.joinmastodon.android.events.ScheduledStatusDeletedEvent;
|
||||||
import org.joinmastodon.android.events.StatusCreatedEvent;
|
|
||||||
import org.joinmastodon.android.events.StatusDeletedEvent;
|
|
||||||
import org.joinmastodon.android.model.HeaderPaginationList;
|
import org.joinmastodon.android.model.HeaderPaginationList;
|
||||||
import org.joinmastodon.android.model.ScheduledStatus;
|
import org.joinmastodon.android.model.ScheduledStatus;
|
||||||
import org.joinmastodon.android.model.Status;
|
import org.joinmastodon.android.model.Status;
|
||||||
|
@ -31,8 +28,13 @@ import me.grishka.appkit.api.SimpleCallback;
|
||||||
|
|
||||||
public class ScheduledStatusListFragment extends BaseStatusListFragment<ScheduledStatus> {
|
public class ScheduledStatusListFragment extends BaseStatusListFragment<ScheduledStatus> {
|
||||||
private String nextMaxID;
|
private String nextMaxID;
|
||||||
|
private ImageButton fab;
|
||||||
private static final int SCHEDULED_STATUS_LIST_OPENED = 161;
|
private static final int SCHEDULED_STATUS_LIST_OPENED = 161;
|
||||||
|
|
||||||
|
public ScheduledStatusListFragment() {
|
||||||
|
setListLayoutId(R.layout.recycler_fragment_with_fab);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState){
|
public void onCreate(Bundle savedInstanceState){
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@ -53,6 +55,18 @@ public class ScheduledStatusListFragment extends BaseStatusListFragment<Schedule
|
||||||
loadData();
|
loadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
fab=view.findViewById(R.id.fab);
|
||||||
|
Bundle args=new Bundle();
|
||||||
|
args.putString("account", accountID);
|
||||||
|
args.putSerializable("scheduledAt", CreateStatus.getDraftInstant());
|
||||||
|
fab.setOnClickListener(v -> Nav.go(getActivity(), ComposeFragment.class, args));
|
||||||
|
fab.setOnLongClickListener(v -> UiUtils.pickAccountForCompose(getActivity(), accountID, args));
|
||||||
|
if (getArguments().getBoolean("hide_fab", false)) fab.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<StatusDisplayItem> buildDisplayItems(ScheduledStatus s) {
|
protected List<StatusDisplayItem> buildDisplayItems(ScheduledStatus s) {
|
||||||
return StatusDisplayItem.buildItems(this, s.toStatus(), accountID, s, knownAccounts, false, false, null);
|
return StatusDisplayItem.buildItems(this, s.toStatus(), accountID, s, knownAccounts, false, false, null);
|
||||||
|
|
|
@ -984,11 +984,19 @@ public class UiUtils{
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean pickAccountForCompose(Activity activity, String accountID, String prefilledText){
|
public static boolean pickAccountForCompose(Activity activity, String accountID, String prefilledText){
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
if (prefilledText != null) args.putString("prefilledText", prefilledText);
|
||||||
|
return pickAccountForCompose(activity, accountID, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean pickAccountForCompose(Activity activity, String accountID){
|
||||||
|
return pickAccountForCompose(activity, accountID, (String) null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean pickAccountForCompose(Activity activity, String accountID, Bundle args){
|
||||||
if (AccountSessionManager.getInstance().getLoggedInAccounts().size() > 1) {
|
if (AccountSessionManager.getInstance().getLoggedInAccounts().size() > 1) {
|
||||||
UiUtils.pickAccount(activity, accountID, 0, 0, session -> {
|
UiUtils.pickAccount(activity, accountID, 0, 0, session -> {
|
||||||
Bundle args=new Bundle();
|
|
||||||
args.putString("account", session.getID());
|
args.putString("account", session.getID());
|
||||||
if (prefilledText != null) args.putString("prefilledText", prefilledText);
|
|
||||||
Nav.go(activity, ComposeFragment.class, args);
|
Nav.go(activity, ComposeFragment.class, args);
|
||||||
}, null);
|
}, null);
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue