updated api
This commit is contained in:
parent
2b6cdeae65
commit
4a0df8b563
|
@ -43,7 +43,7 @@ dependencies {
|
|||
compile 'com.android.support:support-v4:22.2.0'
|
||||
compile 'com.bluelinelabs:logansquare:1.1.0'
|
||||
compile 'org.apache.commons:commons-lang3:3.4'
|
||||
compile 'com.github.mariotaku:RestFu:c8bd230561'
|
||||
compile 'com.github.mariotaku:RestFu:b40c366f1c'
|
||||
compile 'com.hannesdorfmann.parcelableplease:annotation:1.0.1'
|
||||
compile project(':twidere.component.querybuilder')
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.mariotaku.restfu.annotation.method.GET;
|
|||
import org.mariotaku.restfu.annotation.method.POST;
|
||||
import org.mariotaku.restfu.annotation.param.Body;
|
||||
import org.mariotaku.restfu.annotation.param.Form;
|
||||
import org.mariotaku.restfu.annotation.param.MethodExtra;
|
||||
import org.mariotaku.restfu.annotation.param.Query;
|
||||
import org.mariotaku.restfu.http.BodyType;
|
||||
import org.mariotaku.twidere.api.twitter.TwitterException;
|
||||
|
@ -31,6 +32,7 @@ import org.mariotaku.twidere.api.twitter.model.Paging;
|
|||
import org.mariotaku.twidere.api.twitter.model.ResponseList;
|
||||
|
||||
@SuppressWarnings("RedundantThrows")
|
||||
@MethodExtra(name = "extra_params", values = {"full_text", "include_entities", "include_cards", "cards_platform"})
|
||||
public interface DirectMessagesResources {
|
||||
|
||||
@POST("/direct_messages/destroy.json")
|
||||
|
@ -38,27 +40,30 @@ public interface DirectMessagesResources {
|
|||
DirectMessage destroyDirectMessage(@Form("id") long id) throws TwitterException;
|
||||
|
||||
@GET("/direct_messages.json")
|
||||
ResponseList<DirectMessage> getDirectMessages(@Query Paging paging, @Query("full_text") boolean fullText) throws TwitterException;
|
||||
|
||||
ResponseList<DirectMessage> getDirectMessages(@Query Paging paging) throws TwitterException;
|
||||
|
||||
@GET("/direct_messages/sent.json")
|
||||
ResponseList<DirectMessage> getSentDirectMessages(@Query Paging paging, @Query("full_text") boolean fullText) throws TwitterException;
|
||||
ResponseList<DirectMessage> getSentDirectMessages(@Query Paging paging) throws TwitterException;
|
||||
|
||||
@POST("/direct_messages/new.json")
|
||||
@Body(BodyType.FORM)
|
||||
DirectMessage sendDirectMessage(@Form("user_id") long userId, @Form("text") String text) throws TwitterException;
|
||||
DirectMessage sendDirectMessage(@Form("user_id") long userId, @Form("text") String text)
|
||||
throws TwitterException;
|
||||
|
||||
@POST("/direct_messages/new.json")
|
||||
@Body(BodyType.FORM)
|
||||
DirectMessage sendDirectMessage(@Form("user_id") long userId, @Form("text") String text, @Form("media_id") long mediaId) throws TwitterException;
|
||||
DirectMessage sendDirectMessage(@Form("user_id") long userId, @Form("text") String text,
|
||||
@Form("media_id") long mediaId) throws TwitterException;
|
||||
|
||||
@POST("/direct_messages/new.json")
|
||||
@Body(BodyType.FORM)
|
||||
DirectMessage sendDirectMessage(@Form("screen_name") String screenName, @Form("text") String text) throws TwitterException;
|
||||
DirectMessage sendDirectMessage(@Form("screen_name") String screenName, @Form("text") String text)
|
||||
throws TwitterException;
|
||||
|
||||
@POST("/direct_messages/new.json")
|
||||
@Body(BodyType.FORM)
|
||||
DirectMessage sendDirectMessage(@Form("screen_name") String screenName, @Form("text") String text, @Form("media_id") long mediaId) throws TwitterException;
|
||||
DirectMessage sendDirectMessage(@Form("screen_name") String screenName, @Form("text") String text,
|
||||
@Form("media_id") long mediaId) throws TwitterException;
|
||||
|
||||
@GET("/direct_messages/show.json")
|
||||
DirectMessage showDirectMessage(@Query("id") long id) throws TwitterException;
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.mariotaku.restfu.annotation.method.GET;
|
|||
import org.mariotaku.restfu.annotation.method.POST;
|
||||
import org.mariotaku.restfu.annotation.param.Body;
|
||||
import org.mariotaku.restfu.annotation.param.Form;
|
||||
import org.mariotaku.restfu.annotation.param.MethodExtra;
|
||||
import org.mariotaku.restfu.annotation.param.Query;
|
||||
import org.mariotaku.restfu.http.BodyType;
|
||||
import org.mariotaku.twidere.api.twitter.TwitterException;
|
||||
|
@ -34,6 +35,8 @@ import org.mariotaku.twidere.api.twitter.model.Status;
|
|||
* @author Joern Huxhorn - jhuxhorn at googlemail.com
|
||||
*/
|
||||
@SuppressWarnings("RedundantThrows")
|
||||
@MethodExtra(name = "extra_params", values = {"include_my_retweet", "include_rts", "include_entities",
|
||||
"include_cards", "cards_platform", "include_reply_count", "include_descendent_reply_count"})
|
||||
public interface FavoritesResources {
|
||||
|
||||
@POST("/favorites/create.json")
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.mariotaku.restfu.annotation.method.GET;
|
|||
import org.mariotaku.restfu.annotation.method.POST;
|
||||
import org.mariotaku.restfu.annotation.param.Body;
|
||||
import org.mariotaku.restfu.annotation.param.Form;
|
||||
import org.mariotaku.restfu.annotation.param.MethodExtra;
|
||||
import org.mariotaku.restfu.annotation.param.Query;
|
||||
import org.mariotaku.restfu.http.BodyType;
|
||||
import org.mariotaku.twidere.api.twitter.TwitterException;
|
||||
|
@ -36,6 +37,7 @@ import org.mariotaku.twidere.api.twitter.model.ResponseList;
|
|||
import org.mariotaku.twidere.api.twitter.model.User;
|
||||
|
||||
@SuppressWarnings("RedundantThrows")
|
||||
@MethodExtra(name = "extra_params", values = {"include_entities"})
|
||||
public interface FriendsFollowersResources {
|
||||
|
||||
@POST("/friendships/create.json")
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.mariotaku.restfu.annotation.method.GET;
|
|||
import org.mariotaku.restfu.annotation.method.POST;
|
||||
import org.mariotaku.restfu.annotation.param.Body;
|
||||
import org.mariotaku.restfu.annotation.param.Form;
|
||||
import org.mariotaku.restfu.annotation.param.MethodExtra;
|
||||
import org.mariotaku.restfu.annotation.param.Query;
|
||||
import org.mariotaku.restfu.http.BodyType;
|
||||
import org.mariotaku.twidere.api.twitter.TwitterException;
|
||||
|
@ -130,12 +131,18 @@ public interface ListsResources {
|
|||
ResponseList<UserList> getUserLists(@Query("screen_name") String screenName, @Query("reverse") boolean reverse) throws TwitterException;
|
||||
|
||||
@GET("/lists/statuses.json")
|
||||
@MethodExtra(name = "extra_params", values = {"include_my_retweet", "include_rts", "include_entities",
|
||||
"include_cards", "cards_platform", "include_reply_count", "include_descendent_reply_count"})
|
||||
ResponseList<Status> getUserListStatuses(@Query("list_id") long listId, @Query Paging paging) throws TwitterException;
|
||||
|
||||
@GET("/lists/statuses.json")
|
||||
@MethodExtra(name = "extra_params", values = {"include_my_retweet", "include_rts", "include_entities",
|
||||
"include_cards", "cards_platform", "include_reply_count", "include_descendent_reply_count"})
|
||||
ResponseList<Status> getUserListStatuses(@Query("slug") String slug, @Query("owner_id") long ownerId, @Query Paging paging) throws TwitterException;
|
||||
|
||||
@GET("/lists/statuses.json")
|
||||
@MethodExtra(name = "extra_params", values = {"include_my_retweet", "include_rts", "include_entities",
|
||||
"include_cards", "cards_platform", "include_reply_count", "include_descendent_reply_count"})
|
||||
ResponseList<Status> getUserListStatuses(@Query("slug") String slug, @Query("owner_screen_name") String ownerScreenName, @Query Paging paging)
|
||||
throws TwitterException;
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
package org.mariotaku.twidere.api.twitter.api;
|
||||
|
||||
import org.mariotaku.restfu.annotation.method.GET;
|
||||
import org.mariotaku.restfu.annotation.param.MethodExtra;
|
||||
import org.mariotaku.restfu.annotation.param.Query;
|
||||
import org.mariotaku.twidere.api.twitter.TwitterException;
|
||||
import org.mariotaku.twidere.api.twitter.model.Activity;
|
||||
|
@ -27,6 +28,8 @@ import org.mariotaku.twidere.api.twitter.model.Paging;
|
|||
import org.mariotaku.twidere.api.twitter.model.ResponseList;
|
||||
|
||||
@SuppressWarnings("RedundantThrows")
|
||||
@MethodExtra(name = "extra_params", values = {"include_my_retweet", "include_rts", "include_entities",
|
||||
"include_cards", "cards_platform", "include_reply_count", "include_descendent_reply_count"})
|
||||
public interface PrivateActivityResources extends PrivateResources {
|
||||
|
||||
@GET("/activity/about_me.json")
|
||||
|
|
|
@ -24,16 +24,17 @@ import org.mariotaku.restfu.annotation.param.Body;
|
|||
import org.mariotaku.restfu.annotation.param.Path;
|
||||
import org.mariotaku.restfu.http.BodyType;
|
||||
import org.mariotaku.twidere.api.twitter.TwitterException;
|
||||
import org.mariotaku.twidere.api.twitter.model.ResponseCode;
|
||||
|
||||
@SuppressWarnings("RedundantThrows")
|
||||
public interface PrivateDirectMessagesResources extends PrivateResources {
|
||||
|
||||
@POST("/dm/conversation/{conversation_id}/delete.json")
|
||||
@Body(BodyType.FORM)
|
||||
void destroyDirectMessagesConversation(@Path("conversation_id") String conversationId) throws TwitterException;
|
||||
ResponseCode destroyDirectMessagesConversation(@Path("conversation_id") String conversationId) throws TwitterException;
|
||||
|
||||
@POST("/dm/conversation/{account_id}-{user_id}/delete.json")
|
||||
@Body(BodyType.FORM)
|
||||
void destroyDirectMessagesConversation(@Path("account_id") long accountId, @Path("user_id") long userId) throws TwitterException;
|
||||
ResponseCode destroyDirectMessagesConversation(@Path("account_id") long accountId, @Path("user_id") long userId) throws TwitterException;
|
||||
|
||||
}
|
||||
|
|
|
@ -19,10 +19,12 @@
|
|||
|
||||
package org.mariotaku.twidere.api.twitter.api;
|
||||
|
||||
import org.mariotaku.restfu.annotation.param.MethodExtra;
|
||||
import org.mariotaku.twidere.api.twitter.TwitterException;
|
||||
import org.mariotaku.twidere.api.twitter.model.User;
|
||||
|
||||
@SuppressWarnings("RedundantThrows")
|
||||
@MethodExtra(name = "extra_params", values = {"include_entities"})
|
||||
public interface PrivateFriendsFollowersResources extends PrivateResources {
|
||||
|
||||
User acceptFriendship(long userId) throws TwitterException;
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
package org.mariotaku.twidere.api.twitter.api;
|
||||
|
||||
import org.mariotaku.restfu.annotation.method.GET;
|
||||
import org.mariotaku.restfu.annotation.param.MethodExtra;
|
||||
import org.mariotaku.restfu.annotation.param.Query;
|
||||
import org.mariotaku.twidere.api.twitter.TwitterException;
|
||||
import org.mariotaku.twidere.api.twitter.model.Paging;
|
||||
|
@ -27,6 +28,8 @@ import org.mariotaku.twidere.api.twitter.model.ResponseList;
|
|||
import org.mariotaku.twidere.api.twitter.model.Status;
|
||||
|
||||
@SuppressWarnings("RedundantThrows")
|
||||
@MethodExtra(name = "extra_params", values = {"include_my_retweet", "include_rts", "include_entities",
|
||||
"include_cards", "cards_platform", "include_reply_count", "include_descendent_reply_count"})
|
||||
public interface PrivateTimelinesResources extends PrivateResources {
|
||||
|
||||
@GET("/statuses/media_timeline.json")
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
package org.mariotaku.twidere.api.twitter.api;
|
||||
|
||||
import org.mariotaku.restfu.annotation.method.GET;
|
||||
import org.mariotaku.restfu.annotation.param.MethodExtra;
|
||||
import org.mariotaku.restfu.annotation.param.Path;
|
||||
import org.mariotaku.restfu.annotation.param.Query;
|
||||
import org.mariotaku.twidere.api.twitter.TwitterException;
|
||||
|
@ -30,6 +31,8 @@ import org.mariotaku.twidere.api.twitter.model.StatusActivitySummary;
|
|||
import org.mariotaku.twidere.api.twitter.model.TranslationResult;
|
||||
|
||||
@SuppressWarnings("RedundantThrows")
|
||||
@MethodExtra(name = "extra_params", values = {"include_my_retweet", "include_rts", "include_entities",
|
||||
"include_cards", "cards_platform", "include_reply_count", "include_descendent_reply_count"})
|
||||
public interface PrivateTweetResources extends PrivateResources {
|
||||
|
||||
@GET("/statuses/{id}/activity/summary.json")
|
||||
|
|
|
@ -20,12 +20,15 @@
|
|||
package org.mariotaku.twidere.api.twitter.api;
|
||||
|
||||
import org.mariotaku.restfu.annotation.method.GET;
|
||||
import org.mariotaku.restfu.annotation.param.MethodExtra;
|
||||
import org.mariotaku.restfu.annotation.param.Query;
|
||||
import org.mariotaku.twidere.api.twitter.TwitterException;
|
||||
import org.mariotaku.twidere.api.twitter.model.QueryResult;
|
||||
import org.mariotaku.twidere.api.twitter.model.SearchQuery;
|
||||
|
||||
@SuppressWarnings("RedundantThrows")
|
||||
@MethodExtra(name = "extra_params", values = {"include_my_retweet", "include_rts", "include_entities",
|
||||
"include_cards", "cards_platform", "include_reply_count", "include_descendent_reply_count"})
|
||||
public interface SearchResource {
|
||||
@GET("/search/tweets.json")
|
||||
QueryResult search(@Query SearchQuery query) throws TwitterException;
|
||||
|
|
|
@ -21,13 +21,16 @@ package org.mariotaku.twidere.api.twitter.api;
|
|||
|
||||
|
||||
import org.mariotaku.restfu.annotation.method.GET;
|
||||
import org.mariotaku.restfu.annotation.param.MethodExtra;
|
||||
import org.mariotaku.restfu.annotation.param.Query;
|
||||
import org.mariotaku.twidere.api.twitter.TwitterException;
|
||||
import org.mariotaku.twidere.api.twitter.model.Paging;
|
||||
import org.mariotaku.twidere.api.twitter.model.ResponseList;
|
||||
import org.mariotaku.twidere.api.twitter.model.Status;
|
||||
import org.mariotaku.twidere.api.twitter.TwitterException;
|
||||
|
||||
@SuppressWarnings("RedundantThrows")
|
||||
@MethodExtra(name = "extra_params", values = {"include_my_retweet", "include_rts", "include_entities",
|
||||
"include_cards", "cards_platform", "include_reply_count", "include_descendent_reply_count"})
|
||||
public interface TimelinesResources {
|
||||
|
||||
@GET("/statuses/home_timeline.json")
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.mariotaku.restfu.annotation.method.GET;
|
|||
import org.mariotaku.restfu.annotation.method.POST;
|
||||
import org.mariotaku.restfu.annotation.param.Body;
|
||||
import org.mariotaku.restfu.annotation.param.Form;
|
||||
import org.mariotaku.restfu.annotation.param.MethodExtra;
|
||||
import org.mariotaku.restfu.annotation.param.Path;
|
||||
import org.mariotaku.restfu.annotation.param.Query;
|
||||
import org.mariotaku.restfu.http.BodyType;
|
||||
|
@ -34,6 +35,8 @@ import org.mariotaku.twidere.api.twitter.model.Status;
|
|||
import org.mariotaku.twidere.api.twitter.model.StatusUpdate;
|
||||
|
||||
@SuppressWarnings("RedundantThrows")
|
||||
@MethodExtra(name = "extra_params", values = {"include_my_retweet", "include_rts", "include_entities",
|
||||
"include_cards", "cards_platform", "include_reply_count", "include_descendent_reply_count"})
|
||||
public interface TweetResources {
|
||||
@POST("/statuses/destroy/{id}.json")
|
||||
@Body(BodyType.FORM)
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.mariotaku.restfu.annotation.method.GET;
|
|||
import org.mariotaku.restfu.annotation.method.POST;
|
||||
import org.mariotaku.restfu.annotation.param.Body;
|
||||
import org.mariotaku.restfu.annotation.param.Form;
|
||||
import org.mariotaku.restfu.annotation.param.MethodExtra;
|
||||
import org.mariotaku.restfu.annotation.param.Part;
|
||||
import org.mariotaku.restfu.annotation.param.Query;
|
||||
import org.mariotaku.restfu.http.BodyType;
|
||||
|
@ -40,6 +41,7 @@ import org.mariotaku.twidere.api.twitter.model.SettingsUpdate;
|
|||
import org.mariotaku.twidere.api.twitter.model.User;
|
||||
|
||||
@SuppressWarnings("RedundantThrows")
|
||||
@MethodExtra(name = "extra_params", values = {"include_entities"})
|
||||
public interface UsersResources {
|
||||
|
||||
@POST("/blocks/create.json")
|
||||
|
@ -134,8 +136,8 @@ public interface UsersResources {
|
|||
@POST("/account/update_profile_banner.json")
|
||||
@Body(BodyType.MULTIPART)
|
||||
ResponseCode updateProfileBannerImage(@Part("banner") FileTypedData data, @Part("width") int width,
|
||||
@Part("height") int height, @Part("offset_left") int offsetLeft,
|
||||
@Part("offset_top") int offsetTop)
|
||||
@Part("height") int height, @Part("offset_left") int offsetLeft,
|
||||
@Part("offset_top") int offsetTop)
|
||||
throws TwitterException;
|
||||
|
||||
@POST("/account/update_profile_banner.json")
|
||||
|
|
|
@ -68,7 +68,6 @@ import android.widget.TextView;
|
|||
import com.github.johnpersano.supertoasts.SuperToast;
|
||||
import com.github.johnpersano.supertoasts.SuperToast.Duration;
|
||||
import com.github.johnpersano.supertoasts.SuperToast.OnDismissListener;
|
||||
import com.rengwuxian.materialedittext.validation.METLengthChecker;
|
||||
import com.squareup.otto.Bus;
|
||||
import com.squareup.otto.Subscribe;
|
||||
|
||||
|
@ -113,7 +112,8 @@ import org.mariotaku.twidere.util.TwidereValidator;
|
|||
import org.mariotaku.twidere.util.UserColorNameManager;
|
||||
import org.mariotaku.twidere.util.Utils;
|
||||
import org.mariotaku.twidere.util.message.TaskStateChangedEvent;
|
||||
import org.mariotaku.twidere.view.UserHashtagAutoCompleteEditText;
|
||||
import org.mariotaku.twidere.view.ComposeEditText;
|
||||
import org.mariotaku.twidere.view.ComposeMaterialEditText;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
@ -177,7 +177,7 @@ public class MessagesConversationFragment extends BaseSupportFragment implements
|
|||
// Views
|
||||
private RecyclerView mMessagesListView;
|
||||
private ListView mUsersSearchList;
|
||||
private UserHashtagAutoCompleteEditText mEditText;
|
||||
private ComposeEditText mEditText;
|
||||
private View mSendButton;
|
||||
private ImageView mAddImageButton;
|
||||
private View mConversationContainer, mRecipientSelectorContainer;
|
||||
|
@ -337,13 +337,14 @@ public class MessagesConversationFragment extends BaseSupportFragment implements
|
|||
}
|
||||
}
|
||||
mEditText.setSelection(mEditText.length());
|
||||
mEditText.setMaxCharacters(mValidator.getMaxTweetLength());
|
||||
mEditText.setLengthChecker(new METLengthChecker() {
|
||||
@Override
|
||||
public int getLength(CharSequence text) {
|
||||
return mValidator.getTweetLength(String.valueOf(text));
|
||||
}
|
||||
});
|
||||
// mEditText.setMaxCharacters(mValidator.getMaxTweetLength());
|
||||
// mEditText.setLengthChecker(new METLengthChecker() {
|
||||
// @Override
|
||||
// public int getLength(CharSequence text) {
|
||||
// return mValidator.getTweetLength(String.valueOf(text));
|
||||
// }
|
||||
// });
|
||||
// TODO show text length
|
||||
final boolean isValid = mAccount != null && mRecipient != null;
|
||||
mConversationContainer.setVisibility(isValid ? View.VISIBLE : View.GONE);
|
||||
mRecipientSelectorContainer.setVisibility(isValid ? View.GONE : View.VISIBLE);
|
||||
|
@ -439,7 +440,7 @@ public class MessagesConversationFragment extends BaseSupportFragment implements
|
|||
mRecipientSelectorContainer = view.findViewById(R.id.recipient_selector_container);
|
||||
mInputPanelShadowCompat = view.findViewById(R.id.input_panel_shadow_compat);
|
||||
mInputPanel = view.findViewById(R.id.input_panel);
|
||||
mEditText = (UserHashtagAutoCompleteEditText) mInputPanel.findViewById(R.id.edit_text);
|
||||
mEditText = (ComposeEditText) mInputPanel.findViewById(R.id.edit_text);
|
||||
mSendButton = mInputPanel.findViewById(R.id.send);
|
||||
mAddImageButton = (ImageView) mInputPanel.findViewById(R.id.add_image);
|
||||
}
|
||||
|
|
|
@ -39,8 +39,6 @@ import android.view.MenuItem;
|
|||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
|
||||
import com.rengwuxian.materialedittext.validation.METLengthChecker;
|
||||
|
||||
import org.mariotaku.twidere.Constants;
|
||||
import org.mariotaku.twidere.R;
|
||||
import org.mariotaku.twidere.constant.SharedPreferenceConstants;
|
||||
|
@ -52,7 +50,7 @@ import org.mariotaku.twidere.util.MenuUtils;
|
|||
import org.mariotaku.twidere.util.SharedPreferencesWrapper;
|
||||
import org.mariotaku.twidere.util.ThemeUtils;
|
||||
import org.mariotaku.twidere.util.TwidereValidator;
|
||||
import org.mariotaku.twidere.view.UserHashtagAutoCompleteEditText;
|
||||
import org.mariotaku.twidere.view.ComposeMaterialEditText;
|
||||
import org.mariotaku.twidere.view.holder.StatusViewHolder;
|
||||
import org.mariotaku.twidere.view.holder.StatusViewHolder.DummyStatusHolderAdapter;
|
||||
|
||||
|
@ -62,7 +60,7 @@ public class RetweetQuoteDialogFragment extends BaseSupportDialogFragment implem
|
|||
Constants, DialogInterface.OnClickListener {
|
||||
|
||||
public static final String FRAGMENT_TAG = "retweet_quote";
|
||||
private UserHashtagAutoCompleteEditText mEditComment;
|
||||
private ComposeMaterialEditText mEditComment;
|
||||
private PopupMenu mPopupMenu;
|
||||
private View mCommentMenu;
|
||||
private TwidereValidator mValidator;
|
||||
|
@ -121,18 +119,18 @@ public class RetweetQuoteDialogFragment extends BaseSupportDialogFragment implem
|
|||
view.findViewById(R.id.action_buttons).setVisibility(View.GONE);
|
||||
view.findViewById(R.id.item_content).setFocusable(false);
|
||||
view.findViewById(R.id.comment_container).setVisibility(status.user_is_protected ? View.GONE : View.VISIBLE);
|
||||
mEditComment = (UserHashtagAutoCompleteEditText) view.findViewById(R.id.edit_comment);
|
||||
mEditComment = (ComposeMaterialEditText) view.findViewById(R.id.edit_comment);
|
||||
mEditComment.setAccountId(status.account_id);
|
||||
mEditComment.setLengthChecker(new METLengthChecker() {
|
||||
|
||||
final String statusLink = LinkCreator.getTwitterStatusLink(status.user_screen_name, status.quote_id).toString();
|
||||
|
||||
@Override
|
||||
public int getLength(CharSequence text) {
|
||||
return mValidator.getTweetLength(text + " " + statusLink);
|
||||
}
|
||||
});
|
||||
mEditComment.setMaxCharacters(mValidator.getMaxTweetLength());
|
||||
// mEditComment.setLengthChecker(new METLengthChecker() {
|
||||
//
|
||||
// final String statusLink = LinkCreator.getTwitterStatusLink(status.user_screen_name, status.quote_id).toString();
|
||||
//
|
||||
// @Override
|
||||
// public int getLength(CharSequence text) {
|
||||
// return mValidator.getTweetLength(text + " " + statusLink);
|
||||
// }
|
||||
// });
|
||||
// mEditComment.setMaxCharacters(mValidator.getMaxTweetLength());
|
||||
|
||||
final boolean sendByEnter = mPreferences.getBoolean(KEY_QUICK_SEND);
|
||||
final EditTextEnterHandler enterHandler = EditTextEnterHandler.attach(mEditComment, new EditTextEnterHandler.EnterListener() {
|
||||
|
|
|
@ -2087,7 +2087,7 @@ public class AsyncTwitterWrapper extends TwitterWrapper {
|
|||
@Override
|
||||
public ResponseList<DirectMessage> getDirectMessages(final Twitter twitter, final Paging paging)
|
||||
throws TwitterException {
|
||||
return twitter.getDirectMessages(paging, true);
|
||||
return twitter.getDirectMessages(paging);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -2126,7 +2126,7 @@ public class AsyncTwitterWrapper extends TwitterWrapper {
|
|||
@Override
|
||||
public ResponseList<DirectMessage> getDirectMessages(final Twitter twitter, final Paging paging)
|
||||
throws TwitterException {
|
||||
return twitter.getSentDirectMessages(paging, true);
|
||||
return twitter.getSentDirectMessages(paging);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.mariotaku.restfu.RestAPIFactory;
|
|||
import org.mariotaku.restfu.RestMethodInfo;
|
||||
import org.mariotaku.restfu.RestRequestInfo;
|
||||
import org.mariotaku.restfu.annotation.RestMethod;
|
||||
import org.mariotaku.restfu.annotation.param.MethodExtra;
|
||||
import org.mariotaku.restfu.http.Authorization;
|
||||
import org.mariotaku.restfu.http.Endpoint;
|
||||
import org.mariotaku.restfu.http.FileValue;
|
||||
|
@ -50,6 +51,7 @@ import java.net.Proxy;
|
|||
import java.net.SocketAddress;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
@ -308,6 +310,21 @@ public class TwitterAPIFactory implements TwidereConstants {
|
|||
}
|
||||
|
||||
public static class TwidereRequestInfoFactory implements RequestInfoFactory {
|
||||
|
||||
private static HashMap<String, String> sExtraParams = new HashMap<>();
|
||||
|
||||
static {
|
||||
sExtraParams.put("include_cards", "true");
|
||||
sExtraParams.put("cards_platform", "Android-12");
|
||||
sExtraParams.put("include_entities", "true");
|
||||
sExtraParams.put("include_my_retweet", "1");
|
||||
sExtraParams.put("include_rts", "1");
|
||||
sExtraParams.put("include_reply_count", "true");
|
||||
sExtraParams.put("include_descendent_reply_count", "true");
|
||||
sExtraParams.put("full_text", "true");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public RestRequestInfo create(RestMethodInfo methodInfo) {
|
||||
final RestMethod method = methodInfo.getMethod();
|
||||
|
@ -318,23 +335,19 @@ public class TwitterAPIFactory implements TwidereConstants {
|
|||
final List<Pair<String, TypedData>> parts = methodInfo.getParts();
|
||||
final FileValue file = methodInfo.getFile();
|
||||
final Map<String, Object> extras = methodInfo.getExtras();
|
||||
if (parts.isEmpty()) {
|
||||
final List<Pair<String, String>> params = method.hasBody() ? forms : queries;
|
||||
addParameter(params, "include_cards", true);
|
||||
addParameter(params, "cards_platform", "Android-12");
|
||||
addParameter(params, "include_entities", true);
|
||||
addParameter(params, "include_my_retweet", 1);
|
||||
addParameter(params, "include_rts", 1);
|
||||
addParameter(params, "include_reply_count", true);
|
||||
addParameter(params, "include_descendent_reply_count", true);
|
||||
} else {
|
||||
addPart(parts, "include_cards", true);
|
||||
addPart(parts, "cards_platform", "Android-12");
|
||||
addPart(parts, "include_entities", true);
|
||||
addPart(parts, "include_my_retweet", 1);
|
||||
addPart(parts, "include_rts", 1);
|
||||
addPart(parts, "include_reply_count", true);
|
||||
addPart(parts, "include_descendent_reply_count", true);
|
||||
final MethodExtra methodExtra = methodInfo.getMethodExtra();
|
||||
if (methodExtra != null && "extra_params".equals(methodExtra.name())) {
|
||||
final String[] extraParamKeys = methodExtra.values();
|
||||
if (parts.isEmpty()) {
|
||||
final List<Pair<String, String>> params = method.hasBody() ? forms : queries;
|
||||
for (String key : extraParamKeys) {
|
||||
addParameter(params, key, sExtraParams.get(key));
|
||||
}
|
||||
} else {
|
||||
for (String key : extraParamKeys) {
|
||||
addPart(parts, key, sExtraParams.get(key));
|
||||
}
|
||||
}
|
||||
}
|
||||
return new RestRequestInfo(method.value(), path, queries, forms, headers, parts, file,
|
||||
methodInfo.getBody(), extras);
|
||||
|
|
|
@ -22,31 +22,30 @@ package org.mariotaku.twidere.view;
|
|||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.widget.AppCompatMultiAutoCompleteTextView;
|
||||
import android.text.InputType;
|
||||
import android.text.method.ArrowKeyMovementMethod;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import com.rengwuxian.materialedittext.MaterialMultiAutoCompleteTextView;
|
||||
|
||||
import org.mariotaku.twidere.R;
|
||||
import org.mariotaku.twidere.adapter.UserHashtagAutoCompleteAdapter;
|
||||
import org.mariotaku.twidere.util.widget.ScreenNameTokenizer;
|
||||
import org.mariotaku.twidere.view.iface.IThemeBackgroundTintView;
|
||||
|
||||
public class UserHashtagAutoCompleteEditText extends MaterialMultiAutoCompleteTextView implements IThemeBackgroundTintView {
|
||||
public class ComposeMaterialEditText extends AppCompatMultiAutoCompleteTextView implements IThemeBackgroundTintView {
|
||||
|
||||
private UserHashtagAutoCompleteAdapter mAdapter;
|
||||
private long mAccountId;
|
||||
|
||||
public UserHashtagAutoCompleteEditText(final Context context) {
|
||||
public ComposeMaterialEditText(final Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public UserHashtagAutoCompleteEditText(final Context context, final AttributeSet attrs) {
|
||||
public ComposeMaterialEditText(final Context context, final AttributeSet attrs) {
|
||||
this(context, attrs, R.attr.autoCompleteTextViewStyle);
|
||||
}
|
||||
|
||||
public UserHashtagAutoCompleteEditText(final Context context, final AttributeSet attrs, final int defStyle) {
|
||||
public ComposeMaterialEditText(final Context context, final AttributeSet attrs, final int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
setTokenizer(new ScreenNameTokenizer());
|
||||
setMovementMethod(ArrowKeyMovementMethod.getInstance());
|
||||
|
@ -80,7 +79,7 @@ public class UserHashtagAutoCompleteEditText extends MaterialMultiAutoCompleteTe
|
|||
|
||||
@Override
|
||||
public void setBackgroundTintColor(@NonNull ColorStateList color) {
|
||||
setPrimaryColor(color.getDefaultColor());
|
||||
setSupportBackgroundTintList(color);
|
||||
}
|
||||
|
||||
public void setAccountId(long accountId) {
|
|
@ -38,7 +38,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<org.mariotaku.twidere.view.UserHashtagAutoCompleteEditText
|
||||
<org.mariotaku.twidere.view.ComposeMaterialEditText
|
||||
android:id="@+id/edit_comment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -56,7 +56,7 @@
|
|||
app:met_textColorHint="?android:textColorTertiary">
|
||||
|
||||
<requestFocus />
|
||||
</org.mariotaku.twidere.view.UserHashtagAutoCompleteEditText>
|
||||
</org.mariotaku.twidere.view.ComposeMaterialEditText>
|
||||
|
||||
<org.mariotaku.twidere.view.ActionIconButton
|
||||
android:id="@+id/comment_menu"
|
||||
|
|
|
@ -17,10 +17,11 @@
|
|||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<FrameLayout
|
||||
android:id="@+id/fragment_content"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/fragment_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".fragment.DirectMessagesConversationFragment">
|
||||
|
@ -42,7 +43,7 @@
|
|||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scrollbars="vertical" />
|
||||
android:scrollbars="vertical"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
@ -51,7 +52,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/element_spacing_small"
|
||||
android:layout_above="@+id/input_panel"
|
||||
android:background="@drawable/shadow_top" />
|
||||
android:background="@drawable/shadow_top"/>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/input_panel"
|
||||
|
@ -76,7 +77,7 @@
|
|||
android:color="?android:textColorSecondary"
|
||||
android:contentDescription="@string/add_image"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/ic_action_gallery" />
|
||||
android:src="@drawable/ic_action_gallery"/>
|
||||
|
||||
<org.mariotaku.twidere.view.ActionIconView
|
||||
android:id="@+id/send"
|
||||
|
@ -89,7 +90,7 @@
|
|||
android:color="?android:textColorSecondary"
|
||||
android:contentDescription="@string/send"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/ic_action_send" />
|
||||
android:src="@drawable/ic_action_send"/>
|
||||
|
||||
<org.mariotaku.messagebubbleview.library.MessageBubbleView
|
||||
android:id="@+id/edit_text_container"
|
||||
|
@ -112,7 +113,7 @@
|
|||
android:minHeight="@dimen/element_size_normal"
|
||||
android:padding="@dimen/element_spacing_normal">
|
||||
|
||||
<org.mariotaku.twidere.view.UserHashtagAutoCompleteEditText
|
||||
<org.mariotaku.twidere.view.ComposeEditText
|
||||
android:id="@+id/edit_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -126,14 +127,11 @@
|
|||
android:maxHeight="140dp"
|
||||
android:singleLine="false"
|
||||
android:textAppearance="?android:textAppearanceMedium"
|
||||
app:met_baseColor="?android:textColorSecondary"
|
||||
app:met_helperTextColor="?android:textColorSecondary"
|
||||
app:met_hideUnderline="true"
|
||||
app:met_textColor="?android:textColorPrimary"
|
||||
app:met_textColorHint="?android:textColorTertiary">
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textColorHint="?android:textColorTertiary">
|
||||
|
||||
<requestFocus />
|
||||
</org.mariotaku.twidere.view.UserHashtagAutoCompleteEditText>
|
||||
<requestFocus/>
|
||||
</org.mariotaku.twidere.view.ComposeEditText>
|
||||
|
||||
</FrameLayout>
|
||||
</org.mariotaku.messagebubbleview.library.MessageBubbleView>
|
||||
|
@ -154,7 +152,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:paddingLeft="@dimen/element_spacing_normal"
|
||||
android:paddingRight="@dimen/element_spacing_normal"
|
||||
android:scrollbarStyle="outsideInset" />
|
||||
android:scrollbarStyle="outsideInset"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/users_search_empty"
|
||||
|
@ -169,7 +167,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:color="?android:textColorSecondary"
|
||||
android:src="@drawable/ic_info_search" />
|
||||
android:src="@drawable/ic_info_search"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/users_search_empty_text"
|
||||
|
@ -178,7 +176,7 @@
|
|||
android:layout_gravity="center"
|
||||
android:layout_marginTop="@dimen/element_spacing_normal"
|
||||
android:gravity="center"
|
||||
android:textAppearance="?android:textAppearanceMedium" />
|
||||
android:textAppearance="?android:textAppearanceMedium"/>
|
||||
</LinearLayout>
|
||||
|
||||
<ProgressBar
|
||||
|
@ -187,7 +185,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:visibility="gone" />
|
||||
android:visibility="gone"/>
|
||||
</FrameLayout>
|
||||
|
||||
</FrameLayout>
|
Loading…
Reference in New Issue