mirror of
https://github.com/TwidereProject/Twidere-Android
synced 2025-02-17 04:00:48 +01:00
fixed quick return
This commit is contained in:
parent
c86d73512c
commit
d9f7ac3a84
@ -21,28 +21,37 @@ package org.mariotaku.twidere.api.twitter.api;
|
||||
|
||||
import org.mariotaku.restfu.annotation.method.GET;
|
||||
import org.mariotaku.restfu.annotation.method.POST;
|
||||
import org.mariotaku.restfu.annotation.param.KeyValue;
|
||||
import org.mariotaku.restfu.annotation.param.Param;
|
||||
import org.mariotaku.restfu.annotation.param.Path;
|
||||
import org.mariotaku.restfu.annotation.param.Queries;
|
||||
import org.mariotaku.restfu.annotation.param.Query;
|
||||
import org.mariotaku.restfu.http.BodyType;
|
||||
import org.mariotaku.twidere.api.twitter.TwitterException;
|
||||
import org.mariotaku.twidere.api.twitter.model.ConversationTimeline;
|
||||
import org.mariotaku.twidere.api.twitter.model.NewDm;
|
||||
import org.mariotaku.twidere.api.twitter.model.Paging;
|
||||
import org.mariotaku.twidere.api.twitter.model.PrivateDirectMessages;
|
||||
import org.mariotaku.twidere.api.twitter.model.ResponseCode;
|
||||
import org.mariotaku.twidere.api.twitter.model.UserInbox;
|
||||
|
||||
@SuppressWarnings("RedundantThrows")
|
||||
|
||||
@Queries(@KeyValue(key = "include_groups", value = "true"))
|
||||
public interface PrivateDirectMessagesResources extends PrivateResources {
|
||||
|
||||
@POST("/dm/conversation/{conversation_id}/delete.json")
|
||||
@BodyType(BodyType.FORM)
|
||||
ResponseCode destroyDirectMessagesConversation(@Path("conversation_id") String conversationId) throws TwitterException;
|
||||
|
||||
@POST("/dm/new.json")
|
||||
ResponseCode sendDm(@Param NewDm newDm) throws TwitterException;
|
||||
|
||||
@POST("/dm/conversation/{account_id}-{user_id}/delete.json")
|
||||
@BodyType(BodyType.FORM)
|
||||
ResponseCode destroyDirectMessagesConversation(@Path("account_id") long accountId, @Path("user_id") long userId) throws TwitterException;
|
||||
|
||||
@GET("/dm/user_updates.json")
|
||||
PrivateDirectMessages getUserUpdates(@Query Paging paging);
|
||||
|
||||
@GET("/dm/user_inbox.json")
|
||||
PrivateDirectMessages getUserInbox(@Query Paging paging);
|
||||
UserInbox getUserInbox(@Query Paging paging) throws TwitterException;
|
||||
|
||||
@GET("/dm/conversation/{conversation_id}.json")
|
||||
ConversationTimeline getUserInbox(@Path("conversation_id") String conversationId, @Query Paging paging) throws TwitterException;
|
||||
}
|
||||
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Twidere - Twitter client for Android
|
||||
*
|
||||
* Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.mariotaku.twidere.api.twitter.model;
|
||||
|
||||
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 15/7/5.
|
||||
*/
|
||||
@JsonObject
|
||||
public class ConversationTimeline extends TwitterResponseObject {
|
||||
|
||||
@JsonField(name = "conversation_timeline")
|
||||
DMResponse conversationTimeline;
|
||||
|
||||
public DMResponse getConversationTimeline() {
|
||||
return conversationTimeline;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,270 @@
|
||||
package org.mariotaku.twidere.api.twitter.model;
|
||||
|
||||
import android.support.annotation.StringDef;
|
||||
|
||||
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 16/3/1.
|
||||
*/
|
||||
@JsonObject
|
||||
public class DMResponse {
|
||||
|
||||
@JsonField(name = "status")
|
||||
@Status
|
||||
String status;
|
||||
@JsonField(name = "cursor")
|
||||
String cursor;
|
||||
|
||||
@JsonField(name = "min_entry_id")
|
||||
long minEntryId;
|
||||
|
||||
@JsonField(name = "max_entry_id")
|
||||
long maxEntryId;
|
||||
|
||||
@JsonField(name = "last_seen_event_id")
|
||||
long lastSeenEvent;
|
||||
|
||||
@JsonField(name = "users")
|
||||
Map<String, User> users;
|
||||
|
||||
@JsonField(name = "conversations")
|
||||
Map<String, Conversation> conversations;
|
||||
|
||||
@JsonField(name = "entries")
|
||||
Entry[] entries;
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public String getCursor() {
|
||||
return cursor;
|
||||
}
|
||||
|
||||
public long getMinEntryId() {
|
||||
return minEntryId;
|
||||
}
|
||||
|
||||
public long getMaxEntryId() {
|
||||
return maxEntryId;
|
||||
}
|
||||
|
||||
public Map<String, User> getUsers() {
|
||||
return users;
|
||||
}
|
||||
|
||||
public Map<String, Conversation> getConversations() {
|
||||
return conversations;
|
||||
}
|
||||
|
||||
public User getUser(long userId) {
|
||||
return users.get(String.valueOf(userId));
|
||||
}
|
||||
|
||||
public Conversation getConversation(String conversationId) {
|
||||
return conversations.get(conversationId);
|
||||
}
|
||||
|
||||
public Entry[] getEntries() {
|
||||
return entries;
|
||||
}
|
||||
|
||||
@StringDef({DMResponse.Status.HAS_MORE, DMResponse.Status.AT_END})
|
||||
public @interface Status {
|
||||
String HAS_MORE = "HAS_MORE";
|
||||
String AT_END = "AT_END";
|
||||
}
|
||||
|
||||
@JsonObject
|
||||
public static class Entry {
|
||||
|
||||
@JsonField(name = "message")
|
||||
Message message;
|
||||
|
||||
|
||||
@JsonObject
|
||||
public static class Message {
|
||||
|
||||
@JsonField(name = "id")
|
||||
long id;
|
||||
|
||||
@JsonField(name = "time")
|
||||
long time;
|
||||
|
||||
@JsonField(name = "conversation_id")
|
||||
String conversationId;
|
||||
|
||||
public String getConversationId() {
|
||||
return conversationId;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public long getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
@JsonObject
|
||||
public static class Data implements EntitySupport {
|
||||
|
||||
@JsonField(name = "id")
|
||||
long id;
|
||||
|
||||
@JsonField(name = "time")
|
||||
long time;
|
||||
@JsonField(name = "sender_id")
|
||||
long senderId;
|
||||
@JsonField(name = "recipient_id")
|
||||
long recipientId;
|
||||
@JsonField(name = "text")
|
||||
String text;
|
||||
@JsonField(name = "entities")
|
||||
Entities entities;
|
||||
@JsonField(name = "attachment")
|
||||
Attachment attachment;
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public long getRecipientId() {
|
||||
return recipientId;
|
||||
}
|
||||
|
||||
public long getSenderId() {
|
||||
return senderId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashtagEntity[] getHashtagEntities() {
|
||||
if (entities == null) return null;
|
||||
return entities.getHashtags();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UrlEntity[] getUrlEntities() {
|
||||
if (entities == null) return null;
|
||||
return entities.getUrls();
|
||||
}
|
||||
|
||||
@Override
|
||||
public MediaEntity[] getMediaEntities() {
|
||||
if (entities == null) return null;
|
||||
return entities.getMedia();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserMentionEntity[] getUserMentionEntities() {
|
||||
if (entities == null) return null;
|
||||
return entities.getUserMentions();
|
||||
}
|
||||
|
||||
public Attachment getAttachment() {
|
||||
return attachment;
|
||||
}
|
||||
|
||||
public Entities getEntities() {
|
||||
return entities;
|
||||
}
|
||||
|
||||
public long getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@JsonObject
|
||||
public static class Attachment {
|
||||
@JsonField(name = "photo")
|
||||
MediaEntity photo;
|
||||
|
||||
public MediaEntity getPhoto() {
|
||||
return photo;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@JsonObject
|
||||
public static class Conversation {
|
||||
|
||||
@JsonField(name = "conversation_id")
|
||||
String conversationId;
|
||||
@JsonField(name = "last_read_event_id")
|
||||
long lastReadEventId;
|
||||
@JsonField(name = "max_entry_id")
|
||||
long maxEntryId;
|
||||
@JsonField(name = "min_entry_id")
|
||||
long minEntryId;
|
||||
@JsonField(name = "notifications_disabled")
|
||||
boolean notificationsDisabled;
|
||||
@JsonField(name = "participants")
|
||||
Participant[] participants;
|
||||
@JsonField(name = "read_only")
|
||||
boolean readOnly;
|
||||
@JsonField(name = "sort_event_id")
|
||||
long sortEventId;
|
||||
@JsonField(name = "sort_timestamp")
|
||||
long sortTimestamp;
|
||||
@JsonField(name = "status")
|
||||
Status status;
|
||||
@JsonField(name = "type")
|
||||
Type type;
|
||||
|
||||
public Participant[] getParticipants() {
|
||||
return participants;
|
||||
}
|
||||
|
||||
public String getConversationId() {
|
||||
return conversationId;
|
||||
}
|
||||
|
||||
public long getLastReadEventId() {
|
||||
return lastReadEventId;
|
||||
}
|
||||
|
||||
public long getMaxEntryId() {
|
||||
return maxEntryId;
|
||||
}
|
||||
|
||||
public long getMinEntryId() {
|
||||
return minEntryId;
|
||||
}
|
||||
|
||||
public boolean isNotificationsDisabled() {
|
||||
return notificationsDisabled;
|
||||
}
|
||||
|
||||
public enum Type {
|
||||
ONE_TO_ONE("one_to_one"), GROUP_DM("group_dm");
|
||||
|
||||
private final String literal;
|
||||
|
||||
Type(String literal) {
|
||||
this.literal = literal;
|
||||
}
|
||||
}
|
||||
|
||||
@JsonObject
|
||||
public static class Participant {
|
||||
|
||||
@JsonField(name = "user_id")
|
||||
long userId;
|
||||
|
||||
public long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package org.mariotaku.twidere.api.twitter.model;
|
||||
|
||||
import org.mariotaku.restfu.http.SimpleValueMap;
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 16/3/1.
|
||||
*/
|
||||
public class NewDm extends SimpleValueMap {
|
||||
|
||||
public void setText(String text) {
|
||||
put("text", text);
|
||||
}
|
||||
|
||||
public void setConversationId(String conversationId) {
|
||||
put("conversation_id", conversationId);
|
||||
}
|
||||
|
||||
public void setMediaId(long mediaId) {
|
||||
put("media_id", mediaId);
|
||||
}
|
||||
|
||||
}
|
@ -1,240 +0,0 @@
|
||||
/*
|
||||
* Twidere - Twitter client for Android
|
||||
*
|
||||
* Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.mariotaku.twidere.api.twitter.model;
|
||||
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 15/7/5.
|
||||
*/
|
||||
@JsonObject
|
||||
public class PrivateDirectMessages {
|
||||
|
||||
@JsonField(name = "user_inbox")
|
||||
UserInbox userInbox;
|
||||
@JsonField(name = "user_events")
|
||||
UserEvents userEvents;
|
||||
|
||||
public UserInbox getUserInbox() {
|
||||
return userInbox;
|
||||
}
|
||||
|
||||
public UserEvents getUserEvents() {
|
||||
return userEvents;
|
||||
}
|
||||
|
||||
public enum Status {
|
||||
HAS_MORE, AT_END
|
||||
}
|
||||
|
||||
@JsonObject
|
||||
public static class UserInbox {
|
||||
|
||||
@JsonField(name = "users")
|
||||
Map<String, User> users;
|
||||
|
||||
@JsonField(name = "conversations")
|
||||
Map<String, Conversation> conversations;
|
||||
|
||||
@JsonField(name = "entries")
|
||||
Message[] entries;
|
||||
|
||||
public User getUser(long userId) {
|
||||
return users.get(String.valueOf(userId));
|
||||
}
|
||||
|
||||
public Conversation getConversation(String conversationId) {
|
||||
return conversations.get(conversationId);
|
||||
}
|
||||
|
||||
public Message[] getEntries() {
|
||||
return entries;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@JsonObject
|
||||
public static class UserEvents {
|
||||
@JsonField(name = "cursor")
|
||||
String cursor;
|
||||
@JsonField(name = "last_seen_event_id")
|
||||
long lastSeenEventId;
|
||||
|
||||
public String getCursor() {
|
||||
return cursor;
|
||||
}
|
||||
|
||||
public long getLastSeenEventId() {
|
||||
return lastSeenEventId;
|
||||
}
|
||||
}
|
||||
|
||||
@JsonObject
|
||||
public static class Message {
|
||||
|
||||
@JsonObject
|
||||
public static class Data implements EntitySupport {
|
||||
|
||||
@Nullable
|
||||
@JsonField(name = "entities")
|
||||
Entities entities;
|
||||
|
||||
@JsonField(name = "sender_id")
|
||||
long senderId;
|
||||
@JsonField(name = "recipient_id")
|
||||
long recipientId;
|
||||
@JsonField(name = "id")
|
||||
long id;
|
||||
@JsonField(name = "conversation_id")
|
||||
String conversationId;
|
||||
@JsonField(name = "text")
|
||||
String text;
|
||||
@JsonField(name = "time")
|
||||
long time;
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public String getConversationId() {
|
||||
return conversationId;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public long getRecipientId() {
|
||||
return recipientId;
|
||||
}
|
||||
|
||||
public long getSenderId() {
|
||||
return senderId;
|
||||
}
|
||||
|
||||
public long getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashtagEntity[] getHashtagEntities() {
|
||||
if (entities == null) return null;
|
||||
return entities.getHashtags();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UrlEntity[] getUrlEntities() {
|
||||
if (entities == null) return null;
|
||||
return entities.getUrls();
|
||||
}
|
||||
|
||||
@Override
|
||||
public MediaEntity[] getMediaEntities() {
|
||||
if (entities == null) return null;
|
||||
return entities.getMedia();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserMentionEntity[] getUserMentionEntities() {
|
||||
if (entities == null) return null;
|
||||
return entities.getUserMentions();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@JsonObject
|
||||
public static class Conversation {
|
||||
|
||||
@JsonField(name = "conversation_id")
|
||||
String conversationId;
|
||||
@JsonField(name = "last_read_event_id")
|
||||
long lastReadEventId;
|
||||
@JsonField(name = "max_entry_id")
|
||||
long maxEntryId;
|
||||
@JsonField(name = "min_entry_id")
|
||||
long minEntryId;
|
||||
@JsonField(name = "notifications_disabled")
|
||||
boolean notificationsDisabled;
|
||||
@JsonField(name = "participants")
|
||||
Participant[] participants;
|
||||
@JsonField(name = "read_only")
|
||||
boolean readOnly;
|
||||
@JsonField(name = "sort_event_id")
|
||||
long sortEventId;
|
||||
@JsonField(name = "sort_timestamp")
|
||||
long sortTimestamp;
|
||||
@JsonField(name = "status")
|
||||
Status status;
|
||||
@JsonField(name = "type")
|
||||
Type type;
|
||||
|
||||
public Participant[] getParticipants() {
|
||||
return participants;
|
||||
}
|
||||
|
||||
public String getConversationId() {
|
||||
return conversationId;
|
||||
}
|
||||
|
||||
public long getLastReadEventId() {
|
||||
return lastReadEventId;
|
||||
}
|
||||
|
||||
public long getMaxEntryId() {
|
||||
return maxEntryId;
|
||||
}
|
||||
|
||||
public long getMinEntryId() {
|
||||
return minEntryId;
|
||||
}
|
||||
|
||||
public boolean isNotificationsDisabled() {
|
||||
return notificationsDisabled;
|
||||
}
|
||||
|
||||
public enum Type {
|
||||
ONE_TO_ONE("one_to_one"), GROUP_DM("group_dm");
|
||||
|
||||
private final String literal;
|
||||
|
||||
Type(String literal) {
|
||||
this.literal = literal;
|
||||
}
|
||||
}
|
||||
|
||||
@JsonObject
|
||||
public static class Participant {
|
||||
|
||||
@JsonField(name = "user_id")
|
||||
long userId;
|
||||
|
||||
public long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package org.mariotaku.twidere.api.twitter.model;
|
||||
|
||||
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 16/3/1.
|
||||
*/
|
||||
@JsonObject
|
||||
public class UserEventsResponse extends TwitterResponseObject {
|
||||
@JsonField(name = "user_events")
|
||||
UserEvents userEvents;
|
||||
|
||||
public UserEvents getUserEvents() {
|
||||
return userEvents;
|
||||
}
|
||||
|
||||
@JsonObject
|
||||
public static class UserEvents {
|
||||
@JsonField(name = "cursor")
|
||||
String cursor;
|
||||
@JsonField(name = "last_seen_event_id")
|
||||
long lastSeenEventId;
|
||||
|
||||
public String getCursor() {
|
||||
return cursor;
|
||||
}
|
||||
|
||||
public long getLastSeenEventId() {
|
||||
return lastSeenEventId;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Twidere - Twitter client for Android
|
||||
*
|
||||
* Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.mariotaku.twidere.api.twitter.model;
|
||||
|
||||
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 15/7/5.
|
||||
*/
|
||||
@JsonObject
|
||||
public class UserInbox extends TwitterResponseObject {
|
||||
|
||||
@JsonField(name = "user_inbox")
|
||||
DMResponse userInbox;
|
||||
|
||||
public DMResponse getUserInbox() {
|
||||
return userInbox;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -70,9 +70,12 @@ public interface IControlBarActivity {
|
||||
}
|
||||
|
||||
public void setControlBarVisibleAnimate(final boolean visible, final ControlBarAnimationListener listener) {
|
||||
if (mCurrentControlAnimation != null) {
|
||||
final int newDirection = visible ? 1 : -1;
|
||||
if (mControlAnimationDirection == newDirection) return;
|
||||
if (mCurrentControlAnimation != null && mControlAnimationDirection != 0) {
|
||||
mCurrentControlAnimation.cancel();
|
||||
mCurrentControlAnimation = null;
|
||||
mControlAnimationDirection = newDirection;
|
||||
}
|
||||
final ObjectAnimator animator;
|
||||
final float offset = mActivity.getControlBarOffset();
|
||||
@ -112,7 +115,7 @@ public interface IControlBarActivity {
|
||||
animator.setDuration(DURATION);
|
||||
animator.start();
|
||||
mCurrentControlAnimation = animator;
|
||||
mControlAnimationDirection = visible ? 1 : -1;
|
||||
mControlAnimationDirection = newDirection;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -207,6 +207,9 @@ public abstract class CursorActivitiesFragment extends AbsActivitiesFragment<Lis
|
||||
TaskStarter.execute(new AbstractTask<Object, long[][], CursorActivitiesFragment>() {
|
||||
@Override
|
||||
public long[][] doLongOperation(Object o) {
|
||||
if (getActivity() == null) {
|
||||
return null;
|
||||
}
|
||||
final long[][] result = new long[3][];
|
||||
result[0] = getAccountIds();
|
||||
result[2] = getNewestActivityIds(result[0]);
|
||||
@ -215,6 +218,7 @@ public abstract class CursorActivitiesFragment extends AbsActivitiesFragment<Lis
|
||||
|
||||
@Override
|
||||
public void afterExecute(CursorActivitiesFragment fragment, long[][] result) {
|
||||
if (result == null) return;
|
||||
fragment.getActivities(result[0], result[1], result[2]);
|
||||
}
|
||||
}.setResultHandler(this));
|
||||
|
@ -392,7 +392,8 @@ public class MessagesConversationFragment extends BaseSupportFragment implements
|
||||
@Override
|
||||
public void onPrepareOptionsMenu(Menu menu) {
|
||||
super.onPrepareOptionsMenu(menu);
|
||||
MenuUtils.setMenuItemAvailability(menu, R.id.delete_all, mRecipient != null && Utils.isOfficialCredentials(getActivity(), mAccount));
|
||||
MenuUtils.setMenuItemAvailability(menu, R.id.delete_all, mRecipient != null
|
||||
&& Utils.isOfficialCredentials(getActivity(), mAccount));
|
||||
updateRecipientInfo();
|
||||
}
|
||||
|
||||
@ -400,7 +401,8 @@ public class MessagesConversationFragment extends BaseSupportFragment implements
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.delete_all: {
|
||||
|
||||
if (mAccount == null || mRecipient == null) return true;
|
||||
mTwitterWrapper.destroyMessageConversationAsync(mAccount.account_id, mRecipient.id);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -35,8 +35,7 @@ public class RecyclerViewScrollHandler extends RecyclerView.OnScrollListener {
|
||||
@Override
|
||||
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
|
||||
final int scrollState = recyclerView.getScrollState();
|
||||
final int idleState = RecyclerView.SCROLL_STATE_IDLE;
|
||||
mScrollHandler.handleScroll(dy, scrollState, idleState);
|
||||
mScrollHandler.handleScroll(dy, scrollState, RecyclerView.SCROLL_STATE_IDLE);
|
||||
}
|
||||
|
||||
public static class RecyclerViewCallback implements ViewCallback {
|
||||
|
@ -175,6 +175,7 @@ import org.mariotaku.twidere.model.ParcelableUser;
|
||||
import org.mariotaku.twidere.model.ParcelableUserList;
|
||||
import org.mariotaku.twidere.model.ParcelableUserMention;
|
||||
import org.mariotaku.twidere.model.PebbleMessage;
|
||||
import org.mariotaku.twidere.model.TwitterAccountExtra;
|
||||
import org.mariotaku.twidere.model.util.ParcelableStatusUtils;
|
||||
import org.mariotaku.twidere.model.util.ParcelableUserUtils;
|
||||
import org.mariotaku.twidere.provider.TwidereDataStore;
|
||||
@ -968,8 +969,15 @@ public final class Utils implements Constants {
|
||||
return hasNavBar(context);
|
||||
}
|
||||
|
||||
public static boolean isOfficialCredentials(final Context context, final ParcelableCredentials account) {
|
||||
if (account == null) return false;
|
||||
public static boolean isOfficialCredentials(@NonNull final Context context,
|
||||
@NonNull final ParcelableCredentials account) {
|
||||
if (ParcelableCredentials.ACCOUNT_TYPE_TWITTER.equals(account.account_type)) {
|
||||
final TwitterAccountExtra extra = JsonSerializer.parse(account.account_extras,
|
||||
TwitterAccountExtra.class);
|
||||
if (extra != null) {
|
||||
return extra.isOfficialCredentials();
|
||||
}
|
||||
}
|
||||
final boolean isOAuth = account.auth_type == ParcelableCredentials.AUTH_TYPE_OAUTH
|
||||
|| account.auth_type == ParcelableCredentials.AUTH_TYPE_XAUTH;
|
||||
final String consumerKey = account.consumer_key, consumerSecret = account.consumer_secret;
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
<bool name="default_display_tab_label">true</bool>
|
||||
<bool name="home_display_icon">true</bool>
|
||||
<bool name="shadow_slidable">false</bool>
|
||||
<bool name="relative_behind_width">false</bool>
|
||||
|
||||
</resources>
|
@ -1,6 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<bool name="shadow_slidable">false</bool>
|
||||
|
||||
</resources>
|
@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<bool name="shadow_slidable">false</bool>
|
||||
<bool name="relative_behind_width">false</bool>
|
||||
|
||||
</resources>
|
||||
|
@ -3,9 +3,6 @@
|
||||
|
||||
<style name="Theme.Twidere" parent="Theme.Compat.Base">
|
||||
|
||||
<!-- Window attributes -->
|
||||
<item name="android:windowBackground">@color/background_color_window_dark</item>
|
||||
|
||||
<!-- Widget styles -->
|
||||
<item name="android:listSeparatorTextViewStyle">@style/Widget.Dark.TextView.ListSeparator
|
||||
</item>
|
||||
|
@ -1,31 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Twidere - Twitter client for Android
|
||||
~
|
||||
~ Copyright (C) 2012-2014 Mariotaku Lee <mariotaku.lee@gmail.com>
|
||||
~
|
||||
~ This program is free software: you can redistribute it and/or modify
|
||||
~ it under the terms of the GNU General Public License as published by
|
||||
~ the Free Software Foundation, either version 3 of the License, or
|
||||
~ (at your option) any later version.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
~ GNU General Public License for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU General Public License
|
||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
|
||||
<style name="Theme.Base" parent="android:Theme.Material"/>
|
||||
|
||||
<style name="Theme.Base.Dialog" parent="android:Theme.Material.Dialog"/>
|
||||
|
||||
<style name="Theme.Base.Light" parent="android:Theme.Material.Light"/>
|
||||
|
||||
<style name="Theme.Base.Light.Dialog" parent="android:Theme.Material.Light.Dialog"/>
|
||||
|
||||
</resources>
|
@ -3,8 +3,6 @@
|
||||
|
||||
<bool name="default_display_tab_label">false</bool>
|
||||
<bool name="home_display_icon">false</bool>
|
||||
<bool name="default_shadow_slidable">true</bool>
|
||||
<bool name="shadow_slidable">true</bool>
|
||||
<bool name="has_font_family">false</bool>
|
||||
<bool name="relative_behind_width">false</bool>
|
||||
|
||||
|
@ -3,9 +3,6 @@
|
||||
|
||||
<style name="Theme.Twidere" parent="Theme.Compat.Base.Light">
|
||||
|
||||
<!-- Window attributes -->
|
||||
<item name="android:windowBackground">@color/background_color_window_light</item>
|
||||
|
||||
<!-- Widget styles -->
|
||||
<item name="android:listSeparatorTextViewStyle">@style/Widget.Light.TextView.ListSeparator
|
||||
</item>
|
||||
@ -27,9 +24,6 @@
|
||||
|
||||
<style name="Theme.Twidere.NoActionBar" parent="Theme.Compat.Base.Light.NoActionBar">
|
||||
|
||||
<!-- Window attributes -->
|
||||
<item name="android:windowBackground">@color/background_color_window_light</item>
|
||||
|
||||
<!-- Widget styles -->
|
||||
<item name="android:listSeparatorTextViewStyle">@style/Widget.Light.TextView.ListSeparator
|
||||
</item>
|
||||
|
@ -1,31 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Twidere - Twitter client for Android
|
||||
~
|
||||
~ Copyright (C) 2012-2014 Mariotaku Lee <mariotaku.lee@gmail.com>
|
||||
~
|
||||
~ This program is free software: you can redistribute it and/or modify
|
||||
~ it under the terms of the GNU General Public License as published by
|
||||
~ the Free Software Foundation, either version 3 of the License, or
|
||||
~ (at your option) any later version.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
~ GNU General Public License for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU General Public License
|
||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
|
||||
<style name="Theme.Base" parent="android:Theme.Holo"/>
|
||||
|
||||
<style name="Theme.Base.Dialog" parent="android:Theme.Holo.Dialog"/>
|
||||
|
||||
<style name="Theme.Base.Light" parent="android:Theme.Holo.Light"/>
|
||||
|
||||
<style name="Theme.Base.Light.Dialog" parent="android:Theme.Holo.Light.Dialog"/>
|
||||
|
||||
</resources>
|
@ -21,6 +21,9 @@
|
||||
<resources>
|
||||
|
||||
<style name="Theme.Compat.Base" parent="Theme.AppCompat">
|
||||
<!-- Window attributes -->
|
||||
<item name="android:windowBackground">@color/background_color_window_dark</item>
|
||||
|
||||
<item name="android:textColorTertiary">@color/tertiary_text_mtrl_dark</item>
|
||||
<item name="android:textColorTertiaryInverse">@color/tertiary_text_mtrl_light</item>
|
||||
</style>
|
||||
@ -31,6 +34,9 @@
|
||||
</style>
|
||||
|
||||
<style name="Theme.Compat.Base.NoActionBar" parent="Theme.AppCompat.NoActionBar">
|
||||
<!-- Window attributes -->
|
||||
<item name="android:windowBackground">@color/background_color_window_dark</item>
|
||||
|
||||
<item name="android:textColorTertiary">@color/tertiary_text_mtrl_dark</item>
|
||||
<item name="android:textColorTertiaryInverse">@color/tertiary_text_mtrl_light</item>
|
||||
</style>
|
||||
@ -42,6 +48,10 @@
|
||||
</style>
|
||||
|
||||
<style name="Theme.Compat.Base.Light" parent="Theme.AppCompat.Light">
|
||||
|
||||
<!-- Window attributes -->
|
||||
<item name="android:windowBackground">@color/background_color_window_light</item>
|
||||
|
||||
<item name="android:textColorTertiary">@color/tertiary_text_mtrl_light</item>
|
||||
<item name="android:textColorTertiaryInverse">@color/tertiary_text_mtrl_dark</item>
|
||||
</style>
|
||||
@ -52,6 +62,9 @@
|
||||
</style>
|
||||
|
||||
<style name="Theme.Compat.Base.Light.NoActionBar" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<!-- Window attributes -->
|
||||
<item name="android:windowBackground">@color/background_color_window_light</item>
|
||||
|
||||
<item name="android:textColorTertiary">@color/tertiary_text_mtrl_light</item>
|
||||
<item name="android:textColorTertiaryInverse">@color/tertiary_text_mtrl_dark</item>
|
||||
</style>
|
||||
|
Loading…
x
Reference in New Issue
Block a user