diff --git a/settings.gradle b/settings.gradle index 0d0b807b0..8850e4395 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,6 +1,4 @@ include ':twidere' -include ':twidere.component.twitter4j' -//include ':twidere.component.twitter4j.streaming' include ':twidere.component.common' include ':twidere.library.extension' include ':twidere.component.querybuilder' @@ -8,7 +6,6 @@ include ':twidere.wear' include ':twidere.donate.nyanwp' include ':twidere.donate.nyanwp.wear' include ':twidere.component.nyan' -//include ':twidere.extension.streaming' include ':twidere.extension.twitlonger' include ':twidere.extension.push.xiaomi' include ':twidere.extension.launcher.compose' \ No newline at end of file diff --git a/twidere.component.common/build.gradle b/twidere.component.common/build.gradle index ef908c120..902b761e2 100644 --- a/twidere.component.common/build.gradle +++ b/twidere.component.common/build.gradle @@ -42,6 +42,5 @@ dependencies { compile 'com.bluelinelabs:logansquare:1.0.6' compile 'org.apache.commons:commons-lang3:3.4' compile project(':twidere.component.querybuilder') - compile project(':twidere.component.twitter4j') compile fileTree(dir: 'libs', include: ['*.jar']) } diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/Converter.java b/twidere.component.common/src/main/java/org/mariotaku/simplerestapi/Converter.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/Converter.java rename to twidere.component.common/src/main/java/org/mariotaku/simplerestapi/Converter.java diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/ErrorCallback.java b/twidere.component.common/src/main/java/org/mariotaku/simplerestapi/ErrorCallback.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/ErrorCallback.java rename to twidere.component.common/src/main/java/org/mariotaku/simplerestapi/ErrorCallback.java diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/FileValue.java b/twidere.component.common/src/main/java/org/mariotaku/simplerestapi/FileValue.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/FileValue.java rename to twidere.component.common/src/main/java/org/mariotaku/simplerestapi/FileValue.java diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/RawCallback.java b/twidere.component.common/src/main/java/org/mariotaku/simplerestapi/RawCallback.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/RawCallback.java rename to twidere.component.common/src/main/java/org/mariotaku/simplerestapi/RawCallback.java diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/RestAPIFactory.java b/twidere.component.common/src/main/java/org/mariotaku/simplerestapi/RestAPIFactory.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/RestAPIFactory.java rename to twidere.component.common/src/main/java/org/mariotaku/simplerestapi/RestAPIFactory.java diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/RestCallback.java b/twidere.component.common/src/main/java/org/mariotaku/simplerestapi/RestCallback.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/RestCallback.java rename to twidere.component.common/src/main/java/org/mariotaku/simplerestapi/RestCallback.java diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/RestClient.java b/twidere.component.common/src/main/java/org/mariotaku/simplerestapi/RestClient.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/RestClient.java rename to twidere.component.common/src/main/java/org/mariotaku/simplerestapi/RestClient.java diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/RestException.java b/twidere.component.common/src/main/java/org/mariotaku/simplerestapi/RestException.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/RestException.java rename to twidere.component.common/src/main/java/org/mariotaku/simplerestapi/RestException.java diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/RestMethod.java b/twidere.component.common/src/main/java/org/mariotaku/simplerestapi/RestMethod.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/RestMethod.java rename to twidere.component.common/src/main/java/org/mariotaku/simplerestapi/RestMethod.java diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/RestMethodInfo.java b/twidere.component.common/src/main/java/org/mariotaku/simplerestapi/RestMethodInfo.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/RestMethodInfo.java rename to twidere.component.common/src/main/java/org/mariotaku/simplerestapi/RestMethodInfo.java diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/Utils.java b/twidere.component.common/src/main/java/org/mariotaku/simplerestapi/Utils.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/Utils.java rename to twidere.component.common/src/main/java/org/mariotaku/simplerestapi/Utils.java diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/http/Authorization.java b/twidere.component.common/src/main/java/org/mariotaku/simplerestapi/http/Authorization.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/http/Authorization.java rename to twidere.component.common/src/main/java/org/mariotaku/simplerestapi/http/Authorization.java diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/http/BodyType.java b/twidere.component.common/src/main/java/org/mariotaku/simplerestapi/http/BodyType.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/http/BodyType.java rename to twidere.component.common/src/main/java/org/mariotaku/simplerestapi/http/BodyType.java diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/http/ContentType.java b/twidere.component.common/src/main/java/org/mariotaku/simplerestapi/http/ContentType.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/http/ContentType.java rename to twidere.component.common/src/main/java/org/mariotaku/simplerestapi/http/ContentType.java diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/http/Endpoint.java b/twidere.component.common/src/main/java/org/mariotaku/simplerestapi/http/Endpoint.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/http/Endpoint.java rename to twidere.component.common/src/main/java/org/mariotaku/simplerestapi/http/Endpoint.java diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/http/RestHttpClient.java b/twidere.component.common/src/main/java/org/mariotaku/simplerestapi/http/RestHttpClient.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/http/RestHttpClient.java rename to twidere.component.common/src/main/java/org/mariotaku/simplerestapi/http/RestHttpClient.java diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/http/RestRequest.java b/twidere.component.common/src/main/java/org/mariotaku/simplerestapi/http/RestRequest.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/http/RestRequest.java rename to twidere.component.common/src/main/java/org/mariotaku/simplerestapi/http/RestRequest.java diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/http/RestResponse.java b/twidere.component.common/src/main/java/org/mariotaku/simplerestapi/http/RestResponse.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/http/RestResponse.java rename to twidere.component.common/src/main/java/org/mariotaku/simplerestapi/http/RestResponse.java diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/http/SimpleValueMap.java b/twidere.component.common/src/main/java/org/mariotaku/simplerestapi/http/SimpleValueMap.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/http/SimpleValueMap.java rename to twidere.component.common/src/main/java/org/mariotaku/simplerestapi/http/SimpleValueMap.java diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/http/ValueMap.java b/twidere.component.common/src/main/java/org/mariotaku/simplerestapi/http/ValueMap.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/http/ValueMap.java rename to twidere.component.common/src/main/java/org/mariotaku/simplerestapi/http/ValueMap.java diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/http/mime/BaseTypedData.java b/twidere.component.common/src/main/java/org/mariotaku/simplerestapi/http/mime/BaseTypedData.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/http/mime/BaseTypedData.java rename to twidere.component.common/src/main/java/org/mariotaku/simplerestapi/http/mime/BaseTypedData.java diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/http/mime/FileTypedData.java b/twidere.component.common/src/main/java/org/mariotaku/simplerestapi/http/mime/FileTypedData.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/http/mime/FileTypedData.java rename to twidere.component.common/src/main/java/org/mariotaku/simplerestapi/http/mime/FileTypedData.java diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/http/mime/FormTypedBody.java b/twidere.component.common/src/main/java/org/mariotaku/simplerestapi/http/mime/FormTypedBody.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/http/mime/FormTypedBody.java rename to twidere.component.common/src/main/java/org/mariotaku/simplerestapi/http/mime/FormTypedBody.java diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/http/mime/MultipartTypedBody.java b/twidere.component.common/src/main/java/org/mariotaku/simplerestapi/http/mime/MultipartTypedBody.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/http/mime/MultipartTypedBody.java rename to twidere.component.common/src/main/java/org/mariotaku/simplerestapi/http/mime/MultipartTypedBody.java diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/http/mime/TypedData.java b/twidere.component.common/src/main/java/org/mariotaku/simplerestapi/http/mime/TypedData.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/http/mime/TypedData.java rename to twidere.component.common/src/main/java/org/mariotaku/simplerestapi/http/mime/TypedData.java diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/io/StreamingGZIPInputStream.java b/twidere.component.common/src/main/java/org/mariotaku/simplerestapi/io/StreamingGZIPInputStream.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/io/StreamingGZIPInputStream.java rename to twidere.component.common/src/main/java/org/mariotaku/simplerestapi/io/StreamingGZIPInputStream.java diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/method/GET.java b/twidere.component.common/src/main/java/org/mariotaku/simplerestapi/method/GET.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/method/GET.java rename to twidere.component.common/src/main/java/org/mariotaku/simplerestapi/method/GET.java diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/method/POST.java b/twidere.component.common/src/main/java/org/mariotaku/simplerestapi/method/POST.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/method/POST.java rename to twidere.component.common/src/main/java/org/mariotaku/simplerestapi/method/POST.java diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/param/Body.java b/twidere.component.common/src/main/java/org/mariotaku/simplerestapi/param/Body.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/param/Body.java rename to twidere.component.common/src/main/java/org/mariotaku/simplerestapi/param/Body.java diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/param/Extra.java b/twidere.component.common/src/main/java/org/mariotaku/simplerestapi/param/Extra.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/param/Extra.java rename to twidere.component.common/src/main/java/org/mariotaku/simplerestapi/param/Extra.java diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/param/File.java b/twidere.component.common/src/main/java/org/mariotaku/simplerestapi/param/File.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/param/File.java rename to twidere.component.common/src/main/java/org/mariotaku/simplerestapi/param/File.java diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/param/Form.java b/twidere.component.common/src/main/java/org/mariotaku/simplerestapi/param/Form.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/param/Form.java rename to twidere.component.common/src/main/java/org/mariotaku/simplerestapi/param/Form.java diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/param/Header.java b/twidere.component.common/src/main/java/org/mariotaku/simplerestapi/param/Header.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/param/Header.java rename to twidere.component.common/src/main/java/org/mariotaku/simplerestapi/param/Header.java diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/param/Part.java b/twidere.component.common/src/main/java/org/mariotaku/simplerestapi/param/Part.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/param/Part.java rename to twidere.component.common/src/main/java/org/mariotaku/simplerestapi/param/Part.java diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/param/Path.java b/twidere.component.common/src/main/java/org/mariotaku/simplerestapi/param/Path.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/param/Path.java rename to twidere.component.common/src/main/java/org/mariotaku/simplerestapi/param/Path.java diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/param/Query.java b/twidere.component.common/src/main/java/org/mariotaku/simplerestapi/param/Query.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/simplerestapi/param/Query.java rename to twidere.component.common/src/main/java/org/mariotaku/simplerestapi/param/Query.java diff --git a/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/Twitter.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/Twitter.java new file mode 100644 index 000000000..85f07b037 --- /dev/null +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/Twitter.java @@ -0,0 +1,47 @@ +/* + * Copyright 2007 Yusuke Yamamoto + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.mariotaku.twidere.api.twitter; + +import org.mariotaku.twidere.api.twitter.api.DirectMessagesResources; +import org.mariotaku.twidere.api.twitter.api.FavoritesResources; +import org.mariotaku.twidere.api.twitter.api.FriendsFollowersResources; +import org.mariotaku.twidere.api.twitter.api.HelpResources; +import org.mariotaku.twidere.api.twitter.api.ListsResources; +import org.mariotaku.twidere.api.twitter.api.PlacesGeoResources; +import org.mariotaku.twidere.api.twitter.api.PrivateActivityResources; +import org.mariotaku.twidere.api.twitter.api.PrivateDirectMessagesResources; +import org.mariotaku.twidere.api.twitter.api.PrivateFriendsFollowersResources; +import org.mariotaku.twidere.api.twitter.api.PrivateTimelinesResources; +import org.mariotaku.twidere.api.twitter.api.PrivateTweetResources; +import org.mariotaku.twidere.api.twitter.api.SavedSearchesResources; +import org.mariotaku.twidere.api.twitter.api.SearchResource; +import org.mariotaku.twidere.api.twitter.api.SpamReportingResources; +import org.mariotaku.twidere.api.twitter.api.TimelinesResources; +import org.mariotaku.twidere.api.twitter.api.TrendsResources; +import org.mariotaku.twidere.api.twitter.api.TweetResources; +import org.mariotaku.twidere.api.twitter.api.UsersResources; + +/** + * @author Yusuke Yamamoto - yusuke at mac.com + * @since Twitter4J 2.2.0 + */ +public interface Twitter extends SearchResource, TimelinesResources, + TweetResources, UsersResources, ListsResources, DirectMessagesResources, FriendsFollowersResources, + FavoritesResources, SpamReportingResources, SavedSearchesResources, TrendsResources, PlacesGeoResources, + HelpResources, PrivateActivityResources, PrivateTweetResources, PrivateTimelinesResources, + PrivateFriendsFollowersResources, PrivateDirectMessagesResources { +} diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/TwitterConstants.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/TwitterConstants.java similarity index 99% rename from twidere.component.twitter4j/src/main/java/twitter4j/TwitterConstants.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/TwitterConstants.java index 204b7a3a1..8e4139f1a 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/TwitterConstants.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/TwitterConstants.java @@ -1,4 +1,4 @@ -package twitter4j; +package org.mariotaku.twidere.api.twitter; public interface TwitterConstants { diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/TwitterException.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/TwitterException.java similarity index 95% rename from twidere.component.twitter4j/src/main/java/twitter4j/TwitterException.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/TwitterException.java index 84fa0c5f1..19e7f086b 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/TwitterException.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/TwitterException.java @@ -17,19 +17,22 @@ * along with this program. If not, see . */ -package twitter4j; +package org.mariotaku.twidere.api.twitter; import com.bluelinelabs.logansquare.annotation.JsonField; import com.bluelinelabs.logansquare.annotation.JsonObject; import org.mariotaku.simplerestapi.http.RestRequest; import org.mariotaku.simplerestapi.http.RestResponse; +import org.mariotaku.twidere.api.twitter.model.ErrorInfo; +import org.mariotaku.twidere.api.twitter.model.RateLimitStatus; +import org.mariotaku.twidere.api.twitter.model.TwitterResponse; import org.mariotaku.twidere.api.twitter.model.impl.RateLimitStatusJSONImpl; import java.util.Locale; -import twitter4j.http.HttpResponseCode; -import twitter4j.internal.util.InternalParseUtil; +import org.mariotaku.twidere.api.twitter.http.HttpResponseCode; +import org.mariotaku.twidere.api.twitter.util.InternalParseUtil; /** * An exception class that will be thrown when TwitterAPI calls are failed.
diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/TwitterOAuth.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/TwitterOAuth.java similarity index 97% rename from twidere.component.twitter4j/src/main/java/twitter4j/TwitterOAuth.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/TwitterOAuth.java index f034cc5c5..63496bbae 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/TwitterOAuth.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/TwitterOAuth.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package twitter4j; +package org.mariotaku.twidere.api.twitter; import org.mariotaku.simplerestapi.http.BodyType; diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/api/DirectMessagesResources.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/DirectMessagesResources.java similarity index 90% rename from twidere.component.twitter4j/src/main/java/twitter4j/api/DirectMessagesResources.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/DirectMessagesResources.java index 916b75ecf..ea867b9cd 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/api/DirectMessagesResources.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/DirectMessagesResources.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package twitter4j.api; +package org.mariotaku.twidere.api.twitter.api; import org.mariotaku.simplerestapi.http.BodyType; import org.mariotaku.simplerestapi.method.GET; @@ -23,10 +23,10 @@ import org.mariotaku.simplerestapi.param.Body; import org.mariotaku.simplerestapi.param.Form; import org.mariotaku.simplerestapi.param.Query; -import twitter4j.DirectMessage; -import twitter4j.Paging; -import twitter4j.ResponseList; -import twitter4j.TwitterException; +import org.mariotaku.twidere.api.twitter.model.DirectMessage; +import org.mariotaku.twidere.api.twitter.model.Paging; +import org.mariotaku.twidere.api.twitter.model.ResponseList; +import org.mariotaku.twidere.api.twitter.TwitterException; /** * @author Joern Huxhorn - jhuxhorn at googlemail.com diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/api/FavoritesResources.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/FavoritesResources.java similarity index 89% rename from twidere.component.twitter4j/src/main/java/twitter4j/api/FavoritesResources.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/FavoritesResources.java index a476c2632..1bdf7aa69 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/api/FavoritesResources.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/FavoritesResources.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package twitter4j.api; +package org.mariotaku.twidere.api.twitter.api; import org.mariotaku.simplerestapi.http.BodyType; import org.mariotaku.simplerestapi.method.GET; @@ -26,10 +26,10 @@ import org.mariotaku.simplerestapi.param.Body; import org.mariotaku.simplerestapi.param.Form; import org.mariotaku.simplerestapi.param.Query; -import twitter4j.Paging; -import twitter4j.ResponseList; -import twitter4j.Status; -import twitter4j.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; /** * @author Joern Huxhorn - jhuxhorn at googlemail.com diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/api/FriendsFollowersResources.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/FriendsFollowersResources.java similarity index 87% rename from twidere.component.twitter4j/src/main/java/twitter4j/api/FriendsFollowersResources.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/FriendsFollowersResources.java index ef5556270..5fda61e8a 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/api/FriendsFollowersResources.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/FriendsFollowersResources.java @@ -17,19 +17,19 @@ * along with this program. If not, see . */ -package twitter4j.api; +package org.mariotaku.twidere.api.twitter.api; import org.mariotaku.simplerestapi.method.GET; import org.mariotaku.simplerestapi.param.Query; -import twitter4j.Friendship; -import twitter4j.IDs; -import twitter4j.PageableResponseList; -import twitter4j.Paging; -import twitter4j.Relationship; -import twitter4j.ResponseList; -import twitter4j.TwitterException; -import twitter4j.User; +import org.mariotaku.twidere.api.twitter.model.Friendship; +import org.mariotaku.twidere.api.twitter.model.IDs; +import org.mariotaku.twidere.api.twitter.model.PageableResponseList; +import org.mariotaku.twidere.api.twitter.model.Paging; +import org.mariotaku.twidere.api.twitter.model.Relationship; +import org.mariotaku.twidere.api.twitter.model.ResponseList; +import org.mariotaku.twidere.api.twitter.TwitterException; +import org.mariotaku.twidere.api.twitter.model.User; /** * @author Joern Huxhorn - jhuxhorn at googlemail.com diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/api/HelpResources.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/HelpResources.java similarity index 91% rename from twidere.component.twitter4j/src/main/java/twitter4j/api/HelpResources.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/HelpResources.java index dfcfbb4fb..5d0e0bb26 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/api/HelpResources.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/HelpResources.java @@ -17,14 +17,15 @@ * along with this program. If not, see . */ -package twitter4j.api; +package org.mariotaku.twidere.api.twitter.api; + +import org.mariotaku.twidere.api.twitter.TwitterException; import java.util.Map; -import twitter4j.RateLimitStatus; -import twitter4j.ResponseList; -import twitter4j.TwitterAPIConfiguration; -import twitter4j.TwitterException; +import org.mariotaku.twidere.api.twitter.model.RateLimitStatus; +import org.mariotaku.twidere.api.twitter.model.ResponseList; +import org.mariotaku.twidere.api.twitter.model.TwitterAPIConfiguration; /** * @author Joern Huxhorn - jhuxhorn at googlemail.com @@ -37,7 +38,7 @@ public interface HelpResources { * they are loaded, but no more than once a day. * * @return configuration - * @throws twitter4j.TwitterException when Twitter service or network is + * @throws TwitterException when Twitter service or network is * unavailable * @see GET @@ -52,7 +53,7 @@ public interface HelpResources { * include lang with any of your requests. * * @return list of languages supported by Twitter - * @throws twitter4j.TwitterException when Twitter service or network is + * @throws TwitterException when Twitter service or network is * unavailable * @see GET @@ -66,7 +67,7 @@ public interface HelpResources { * This method calls http://api.twitter.com/1.1/legal/privacy.json * * @return privacy policy - * @throws twitter4j.TwitterException when Twitter service or network is + * @throws TwitterException when Twitter service or network is * unavailable * @see GET * legal/privacy | Twitter Developers @@ -148,7 +149,7 @@ public interface HelpResources { * This method calls http://api.twitter.com/1.1/legal/tos.json * * @return Terms of Service - * @throws twitter4j.TwitterException when Twitter service or network is + * @throws TwitterException when Twitter service or network is * unavailable * @see GET * legal/tos | Twitter Developers diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/api/ListsResources.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/ListsResources.java similarity index 93% rename from twidere.component.twitter4j/src/main/java/twitter4j/api/ListsResources.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/ListsResources.java index 048cea220..5ed610b09 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/api/ListsResources.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/ListsResources.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package twitter4j.api; +package org.mariotaku.twidere.api.twitter.api; import org.mariotaku.simplerestapi.http.BodyType; import org.mariotaku.simplerestapi.method.GET; @@ -26,14 +26,14 @@ import org.mariotaku.simplerestapi.param.Body; import org.mariotaku.simplerestapi.param.Form; import org.mariotaku.simplerestapi.param.Query; -import twitter4j.PageableResponseList; -import twitter4j.Paging; -import twitter4j.ResponseList; -import twitter4j.Status; -import twitter4j.TwitterException; -import twitter4j.User; -import twitter4j.UserList; -import twitter4j.UserListUpdate; +import org.mariotaku.twidere.api.twitter.model.PageableResponseList; +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; +import org.mariotaku.twidere.api.twitter.model.User; +import org.mariotaku.twidere.api.twitter.model.UserList; +import org.mariotaku.twidere.api.twitter.model.UserListUpdate; /** * @author Joern Huxhorn - jhuxhorn at googlemail.com diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/api/PlacesGeoResources.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/PlacesGeoResources.java similarity index 93% rename from twidere.component.twitter4j/src/main/java/twitter4j/api/PlacesGeoResources.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/PlacesGeoResources.java index 9b2d40966..685ab0317 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/api/PlacesGeoResources.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/PlacesGeoResources.java @@ -17,14 +17,14 @@ * along with this program. If not, see . */ -package twitter4j.api; +package org.mariotaku.twidere.api.twitter.api; -import twitter4j.GeoLocation; -import twitter4j.GeoQuery; -import twitter4j.Place; -import twitter4j.ResponseList; -import twitter4j.SimilarPlaces; -import twitter4j.TwitterException; +import org.mariotaku.twidere.api.twitter.model.GeoLocation; +import org.mariotaku.twidere.api.twitter.model.GeoQuery; +import org.mariotaku.twidere.api.twitter.model.Place; +import org.mariotaku.twidere.api.twitter.model.ResponseList; +import org.mariotaku.twidere.api.twitter.model.SimilarPlaces; +import org.mariotaku.twidere.api.twitter.TwitterException; /** * @author Yusuke Yamamoto - yusuke at mac.com @@ -58,7 +58,7 @@ public interface PlacesGeoResources { /** * Find out more details of a place that was returned from the - * {@link PlacesGeoResources#reverseGeoCode(twitter4j.GeoQuery)} + * {@link PlacesGeoResources#reverseGeoCode(GeoQuery)} * method.
* This method calls http://api.twitter.com/1.1/geo/id/:id.json * diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/api/PrivateActivityResources.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/PrivateActivityResources.java similarity index 60% rename from twidere.component.twitter4j/src/main/java/twitter4j/api/PrivateActivityResources.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/PrivateActivityResources.java index 09e96c6f5..c7d9d8c5f 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/api/PrivateActivityResources.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/PrivateActivityResources.java @@ -1,9 +1,9 @@ -package twitter4j.api; +package org.mariotaku.twidere.api.twitter.api; -import twitter4j.Activity; -import twitter4j.Paging; -import twitter4j.ResponseList; -import twitter4j.TwitterException; +import org.mariotaku.twidere.api.twitter.model.Activity; +import org.mariotaku.twidere.api.twitter.model.Paging; +import org.mariotaku.twidere.api.twitter.model.ResponseList; +import org.mariotaku.twidere.api.twitter.TwitterException; public interface PrivateActivityResources extends PrivateResources { public ResponseList getActivitiesAboutMe() throws TwitterException; diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/api/PrivateDirectMessagesResources.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/PrivateDirectMessagesResources.java similarity index 90% rename from twidere.component.twitter4j/src/main/java/twitter4j/api/PrivateDirectMessagesResources.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/PrivateDirectMessagesResources.java index f092e4598..24e854cd0 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/api/PrivateDirectMessagesResources.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/PrivateDirectMessagesResources.java @@ -17,9 +17,9 @@ * along with this program. If not, see . */ -package twitter4j.api; +package org.mariotaku.twidere.api.twitter.api; -import twitter4j.TwitterException; +import org.mariotaku.twidere.api.twitter.TwitterException; /** * Created by mariotaku on 15/1/6. diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/api/PrivateFriendsFollowersResources.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/PrivateFriendsFollowersResources.java similarity index 69% rename from twidere.component.twitter4j/src/main/java/twitter4j/api/PrivateFriendsFollowersResources.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/PrivateFriendsFollowersResources.java index 7d2bed674..604b32e67 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/api/PrivateFriendsFollowersResources.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/PrivateFriendsFollowersResources.java @@ -1,7 +1,7 @@ -package twitter4j.api; +package org.mariotaku.twidere.api.twitter.api; -import twitter4j.TwitterException; -import twitter4j.User; +import org.mariotaku.twidere.api.twitter.TwitterException; +import org.mariotaku.twidere.api.twitter.model.User; public interface PrivateFriendsFollowersResources extends PrivateResources { diff --git a/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/PrivateResources.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/PrivateResources.java new file mode 100644 index 000000000..04a80aaa0 --- /dev/null +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/PrivateResources.java @@ -0,0 +1,5 @@ +package org.mariotaku.twidere.api.twitter.api; + +public interface PrivateResources { + +} diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/api/PrivateTimelinesResources.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/PrivateTimelinesResources.java similarity index 80% rename from twidere.component.twitter4j/src/main/java/twitter4j/api/PrivateTimelinesResources.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/PrivateTimelinesResources.java index 85972241c..37860c9e3 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/api/PrivateTimelinesResources.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/PrivateTimelinesResources.java @@ -1,12 +1,12 @@ -package twitter4j.api; +package org.mariotaku.twidere.api.twitter.api; import org.mariotaku.simplerestapi.method.GET; import org.mariotaku.simplerestapi.param.Query; -import twitter4j.Paging; -import twitter4j.ResponseList; -import twitter4j.Status; -import twitter4j.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; public interface PrivateTimelinesResources extends PrivateResources { diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/api/PrivateTweetResources.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/PrivateTweetResources.java similarity index 66% rename from twidere.component.twitter4j/src/main/java/twitter4j/api/PrivateTweetResources.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/PrivateTweetResources.java index b63a8557b..ae81f39a7 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/api/PrivateTweetResources.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/PrivateTweetResources.java @@ -1,14 +1,14 @@ -package twitter4j.api; +package org.mariotaku.twidere.api.twitter.api; import org.mariotaku.simplerestapi.method.GET; import org.mariotaku.simplerestapi.param.Query; -import twitter4j.Paging; -import twitter4j.ResponseList; -import twitter4j.Status; -import twitter4j.StatusActivitySummary; -import twitter4j.TranslationResult; -import twitter4j.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.model.StatusActivitySummary; +import org.mariotaku.twidere.api.twitter.model.TranslationResult; +import org.mariotaku.twidere.api.twitter.TwitterException; public interface PrivateTweetResources extends PrivateResources { diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/api/SavedSearchesResources.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/SavedSearchesResources.java similarity index 84% rename from twidere.component.twitter4j/src/main/java/twitter4j/api/SavedSearchesResources.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/SavedSearchesResources.java index 5c5f88803..de236482d 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/api/SavedSearchesResources.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/SavedSearchesResources.java @@ -17,13 +17,13 @@ * along with this program. If not, see . */ -package twitter4j.api; +package org.mariotaku.twidere.api.twitter.api; import org.mariotaku.simplerestapi.method.GET; -import twitter4j.ResponseList; -import twitter4j.SavedSearch; -import twitter4j.TwitterException; +import org.mariotaku.twidere.api.twitter.model.ResponseList; +import org.mariotaku.twidere.api.twitter.model.SavedSearch; +import org.mariotaku.twidere.api.twitter.TwitterException; public interface SavedSearchesResources { SavedSearch createSavedSearch(String query) throws TwitterException; diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/api/SearchResource.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/SearchResource.java similarity index 82% rename from twidere.component.twitter4j/src/main/java/twitter4j/api/SearchResource.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/SearchResource.java index 5d54d0377..e995a7549 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/api/SearchResource.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/SearchResource.java @@ -17,14 +17,14 @@ * along with this program. If not, see . */ -package twitter4j.api; +package org.mariotaku.twidere.api.twitter.api; import org.mariotaku.simplerestapi.method.GET; import org.mariotaku.simplerestapi.param.Query; -import twitter4j.QueryResult; -import twitter4j.SearchQuery; -import twitter4j.TwitterException; +import org.mariotaku.twidere.api.twitter.model.QueryResult; +import org.mariotaku.twidere.api.twitter.model.SearchQuery; +import org.mariotaku.twidere.api.twitter.TwitterException; public interface SearchResource { @GET("/search/tweets.json") diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/api/SpamReportingResources.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/SpamReportingResources.java similarity index 92% rename from twidere.component.twitter4j/src/main/java/twitter4j/api/SpamReportingResources.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/SpamReportingResources.java index 000a6e7b4..bf9bb646f 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/api/SpamReportingResources.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/SpamReportingResources.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package twitter4j.api; +package org.mariotaku.twidere.api.twitter.api; -import twitter4j.TwitterException; -import twitter4j.User; +import org.mariotaku.twidere.api.twitter.TwitterException; +import org.mariotaku.twidere.api.twitter.model.User; /** * @author Joern Huxhorn - jhuxhorn at googlemail.com diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/api/TimelinesResources.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/TimelinesResources.java similarity index 86% rename from twidere.component.twitter4j/src/main/java/twitter4j/api/TimelinesResources.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/TimelinesResources.java index c8e948fdb..fd25a80c1 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/api/TimelinesResources.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/TimelinesResources.java @@ -17,15 +17,15 @@ * along with this program. If not, see . */ -package twitter4j.api; +package org.mariotaku.twidere.api.twitter.api; import org.mariotaku.simplerestapi.method.GET; import org.mariotaku.simplerestapi.param.Query; -import twitter4j.Paging; -import twitter4j.ResponseList; -import twitter4j.Status; -import twitter4j.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; /** * @author Joern Huxhorn - jhuxhorn at googlemail.com diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/api/TrendsResources.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/TrendsResources.java similarity index 89% rename from twidere.component.twitter4j/src/main/java/twitter4j/api/TrendsResources.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/TrendsResources.java index 07081c951..a11b0bdc0 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/api/TrendsResources.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/TrendsResources.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package twitter4j.api; +package org.mariotaku.twidere.api.twitter.api; -import twitter4j.GeoLocation; -import twitter4j.Location; -import twitter4j.ResponseList; -import twitter4j.Trends; -import twitter4j.TwitterException; +import org.mariotaku.twidere.api.twitter.TwitterException; +import org.mariotaku.twidere.api.twitter.model.GeoLocation; +import org.mariotaku.twidere.api.twitter.model.Location; +import org.mariotaku.twidere.api.twitter.model.ResponseList; +import org.mariotaku.twidere.api.twitter.model.Trends; /** * @author Joern Huxhorn - jhuxhorn at googlemail.com @@ -36,7 +36,7 @@ public interface TrendsResources { * This method calls http://api.twitter.com/1.1/trends/available.json * * @return the locations - * @throws twitter4j.TwitterException when Twitter service or network is + * @throws TwitterException when Twitter service or network is * unavailable * @see GET @@ -58,7 +58,7 @@ public interface TrendsResources { * to the lat and long passed in. The sort is nearest to * furthest. * @return the locations - * @throws twitter4j.TwitterException when Twitter service or network is + * @throws TwitterException when Twitter service or network is * unavailable * @see GET @@ -81,7 +81,7 @@ public interface TrendsResources { * to the lat and long passed in. The sort is nearest to * furthest. * @return the locations - * @throws twitter4j.TwitterException when Twitter service or network is + * @throws TwitterException when Twitter service or network is * unavailable * @see GET @@ -103,7 +103,7 @@ public interface TrendsResources { * * @param woeid The WOEID of the location to be querying for * @return trends - * @throws twitter4j.TwitterException when Twitter service or network is + * @throws TwitterException when Twitter service or network is * unavailable * @see GET * trends/:woeid | Twitter Developers @@ -129,7 +129,7 @@ public interface TrendsResources { * trending information for. Global information is available by * using 1 as the WOEID. * @return trends - * @throws twitter4j.TwitterException when Twitter service or network is + * @throws TwitterException when Twitter service or network is * unavailable * @see GET * trends/place | Twitter Developers diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/api/TweetResources.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/TweetResources.java similarity index 83% rename from twidere.component.twitter4j/src/main/java/twitter4j/api/TweetResources.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/TweetResources.java index a3e34f15a..a767666a2 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/api/TweetResources.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/TweetResources.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package twitter4j.api; +package org.mariotaku.twidere.api.twitter.api; import org.mariotaku.simplerestapi.http.BodyType; import org.mariotaku.simplerestapi.method.GET; @@ -27,12 +27,12 @@ import org.mariotaku.simplerestapi.param.Form; import org.mariotaku.simplerestapi.param.Path; import org.mariotaku.simplerestapi.param.Query; -import twitter4j.IDs; -import twitter4j.Paging; -import twitter4j.ResponseList; -import twitter4j.Status; -import twitter4j.StatusUpdate; -import twitter4j.TwitterException; +import org.mariotaku.twidere.api.twitter.model.IDs; +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.model.StatusUpdate; +import org.mariotaku.twidere.api.twitter.TwitterException; /** * @author Joern Huxhorn - jhuxhorn at googlemail.com diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/api/TwitterUpload.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/TwitterUpload.java similarity index 88% rename from twidere.component.twitter4j/src/main/java/twitter4j/api/TwitterUpload.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/TwitterUpload.java index d1205054f..66ad9e138 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/api/TwitterUpload.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/TwitterUpload.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package twitter4j.api; +package org.mariotaku.twidere.api.twitter.api; import org.mariotaku.simplerestapi.http.BodyType; import org.mariotaku.simplerestapi.http.mime.FileTypedData; @@ -27,8 +27,8 @@ import org.mariotaku.simplerestapi.param.Part; import java.io.File; -import twitter4j.MediaUploadResponse; -import twitter4j.TwitterException; +import org.mariotaku.twidere.api.twitter.model.MediaUploadResponse; +import org.mariotaku.twidere.api.twitter.TwitterException; public interface TwitterUpload { diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/api/UsersResources.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/UsersResources.java similarity index 88% rename from twidere.component.twitter4j/src/main/java/twitter4j/api/UsersResources.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/UsersResources.java index da1e8c886..a3d628563 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/api/UsersResources.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/api/UsersResources.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package twitter4j.api; +package org.mariotaku.twidere.api.twitter.api; import org.mariotaku.simplerestapi.http.BodyType; import org.mariotaku.simplerestapi.method.GET; @@ -29,16 +29,16 @@ import org.mariotaku.simplerestapi.param.Query; import java.io.File; import java.io.InputStream; -import twitter4j.AccountSettings; -import twitter4j.Category; -import twitter4j.IDs; -import twitter4j.PageableResponseList; -import twitter4j.Paging; -import twitter4j.ProfileUpdate; -import twitter4j.ResponseList; -import twitter4j.SettingsUpdate; -import twitter4j.TwitterException; -import twitter4j.User; +import org.mariotaku.twidere.api.twitter.model.AccountSettings; +import org.mariotaku.twidere.api.twitter.model.Category; +import org.mariotaku.twidere.api.twitter.model.IDs; +import org.mariotaku.twidere.api.twitter.model.PageableResponseList; +import org.mariotaku.twidere.api.twitter.model.Paging; +import org.mariotaku.twidere.api.twitter.model.ProfileUpdate; +import org.mariotaku.twidere.api.twitter.model.ResponseList; +import org.mariotaku.twidere.api.twitter.model.SettingsUpdate; +import org.mariotaku.twidere.api.twitter.TwitterException; +import org.mariotaku.twidere.api.twitter.model.User; public interface UsersResources { diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/auth/AuthorizationConfiguration.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/auth/AuthorizationConfiguration.java similarity index 95% rename from twidere.component.twitter4j/src/main/java/twitter4j/auth/AuthorizationConfiguration.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/auth/AuthorizationConfiguration.java index 9aefa66d3..bc9295396 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/auth/AuthorizationConfiguration.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/auth/AuthorizationConfiguration.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package twitter4j.auth; +package org.mariotaku.twidere.api.twitter.auth; /** * A static factory class for Authorization. diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/auth/BasicAuthorization.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/auth/BasicAuthorization.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/auth/BasicAuthorization.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/auth/BasicAuthorization.java diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/auth/EmptyAuthorization.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/auth/EmptyAuthorization.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/auth/EmptyAuthorization.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/auth/EmptyAuthorization.java diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/auth/OAuthAuthorization.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/auth/OAuthAuthorization.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/auth/OAuthAuthorization.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/auth/OAuthAuthorization.java diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/auth/OAuthEndpoint.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/auth/OAuthEndpoint.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/auth/OAuthEndpoint.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/auth/OAuthEndpoint.java diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/auth/OAuthSupport.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/auth/OAuthSupport.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/auth/OAuthSupport.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/auth/OAuthSupport.java diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/auth/OAuthToken.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/auth/OAuthToken.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/auth/OAuthToken.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/auth/OAuthToken.java diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/auth/XAuthAuthorization.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/auth/XAuthAuthorization.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/auth/XAuthAuthorization.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/auth/XAuthAuthorization.java diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/http/HttpResponseCode.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/http/HttpResponseCode.java similarity index 98% rename from twidere.component.twitter4j/src/main/java/twitter4j/http/HttpResponseCode.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/http/HttpResponseCode.java index 4ad9dc3c9..c6221d6d7 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/http/HttpResponseCode.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/http/HttpResponseCode.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package twitter4j.http; +package org.mariotaku.twidere.api.twitter.http; /** * @author Yusuke Yamamoto - yusuke at mac.com diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/AccountSettings.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/AccountSettings.java similarity index 97% rename from twidere.component.twitter4j/src/main/java/twitter4j/AccountSettings.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/AccountSettings.java index a2499bcf6..567fef885 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/AccountSettings.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/AccountSettings.java @@ -14,9 +14,7 @@ * limitations under the License. */ -package twitter4j; - -import java.io.Serializable; +package org.mariotaku.twidere.api.twitter.model; /** * @author Yusuke Yamamoto - yusuke at mac.com diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/AccountTotals.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/AccountTotals.java similarity index 96% rename from twidere.component.twitter4j/src/main/java/twitter4j/AccountTotals.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/AccountTotals.java index d190dd79d..e7390feb4 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/AccountTotals.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/AccountTotals.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package twitter4j; +package org.mariotaku.twidere.api.twitter.model; import java.io.Serializable; diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/Activity.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/Activity.java similarity index 97% rename from twidere.component.twitter4j/src/main/java/twitter4j/Activity.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/Activity.java index f2ad7d909..6dc5adef0 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/Activity.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/Activity.java @@ -1,4 +1,4 @@ -package twitter4j; +package org.mariotaku.twidere.api.twitter.model; import java.util.Date; diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/CardEntity.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/CardEntity.java similarity index 97% rename from twidere.component.twitter4j/src/main/java/twitter4j/CardEntity.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/CardEntity.java index 958df0f5f..dacef9db5 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/CardEntity.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/CardEntity.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package twitter4j; +package org.mariotaku.twidere.api.twitter.model; import java.util.Map; diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/Category.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/Category.java similarity index 94% rename from twidere.component.twitter4j/src/main/java/twitter4j/Category.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/Category.java index 304839d71..89c0dd89e 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/Category.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/Category.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package twitter4j; +package org.mariotaku.twidere.api.twitter.model; import java.io.Serializable; diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/CursorSupport.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/CursorSupport.java similarity index 95% rename from twidere.component.twitter4j/src/main/java/twitter4j/CursorSupport.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/CursorSupport.java index e30947104..7a43399f5 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/CursorSupport.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/CursorSupport.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package twitter4j; +package org.mariotaku.twidere.api.twitter.model; /** * @author Yusuke Yamamoto - yusuke at mac.com diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/DirectMessage.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/DirectMessage.java similarity index 95% rename from twidere.component.twitter4j/src/main/java/twitter4j/DirectMessage.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/DirectMessage.java index ecba85b66..05bbd1ea1 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/DirectMessage.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/DirectMessage.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package twitter4j; +package org.mariotaku.twidere.api.twitter.model; import java.util.Date; diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/EntitySupport.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/EntitySupport.java similarity index 97% rename from twidere.component.twitter4j/src/main/java/twitter4j/EntitySupport.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/EntitySupport.java index 1792c0f55..c09723490 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/EntitySupport.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/EntitySupport.java @@ -14,9 +14,7 @@ * limitations under the License. */ -package twitter4j; - -import java.io.Serializable; +package org.mariotaku.twidere.api.twitter.model; /** * @author Yusuke Yamamoto - yusuke at mac.com diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/ErrorInfo.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/ErrorInfo.java similarity index 95% rename from twidere.component.twitter4j/src/main/java/twitter4j/ErrorInfo.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/ErrorInfo.java index 5258928d3..a999f808f 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/ErrorInfo.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/ErrorInfo.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package twitter4j; +package org.mariotaku.twidere.api.twitter.model; import com.bluelinelabs.logansquare.annotation.JsonField; import com.bluelinelabs.logansquare.annotation.JsonObject; diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/lib/MyClass.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/ExtendedEntitySupport.java similarity index 82% rename from twidere.component.twitter4j/src/main/java/twitter4j/lib/MyClass.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/ExtendedEntitySupport.java index 1d2f03a8b..af8cda4cb 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/lib/MyClass.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/ExtendedEntitySupport.java @@ -17,7 +17,10 @@ * along with this program. If not, see . */ -package twitter4j.lib; +package org.mariotaku.twidere.api.twitter.model; + +public interface ExtendedEntitySupport extends EntitySupport { + + MediaEntity[] getExtendedMediaEntities(); -public class MyClass { } diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/Friendship.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/Friendship.java similarity index 94% rename from twidere.component.twitter4j/src/main/java/twitter4j/Friendship.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/Friendship.java index 2eca37153..c9a873b45 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/Friendship.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/Friendship.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package twitter4j; +package org.mariotaku.twidere.api.twitter.model; /** * @author Yusuke Yamamoto - yusuke at mac.com diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/GeoLocation.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/GeoLocation.java similarity index 98% rename from twidere.component.twitter4j/src/main/java/twitter4j/GeoLocation.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/GeoLocation.java index 0cd54f575..ccdf336bd 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/GeoLocation.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/GeoLocation.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package twitter4j; +package org.mariotaku.twidere.api.twitter.model; import com.bluelinelabs.logansquare.LoganSquare; import com.bluelinelabs.logansquare.typeconverters.TypeConverter; diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/GeoQuery.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/GeoQuery.java similarity index 99% rename from twidere.component.twitter4j/src/main/java/twitter4j/GeoQuery.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/GeoQuery.java index 48bb17f60..12a807e83 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/GeoQuery.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/GeoQuery.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package twitter4j; +package org.mariotaku.twidere.api.twitter.model; import org.mariotaku.simplerestapi.http.ValueMap; diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/HashtagEntity.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/HashtagEntity.java similarity index 96% rename from twidere.component.twitter4j/src/main/java/twitter4j/HashtagEntity.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/HashtagEntity.java index 86a8a41b1..797ac0d3e 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/HashtagEntity.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/HashtagEntity.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package twitter4j; +package org.mariotaku.twidere.api.twitter.model; import java.io.Serializable; diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/IDs.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/IDs.java similarity index 94% rename from twidere.component.twitter4j/src/main/java/twitter4j/IDs.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/IDs.java index 304ef70eb..611861f21 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/IDs.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/IDs.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package twitter4j; +package org.mariotaku.twidere.api.twitter.model; /** * A data interface representing array of numeric IDs. diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/Location.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/Location.java similarity index 94% rename from twidere.component.twitter4j/src/main/java/twitter4j/Location.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/Location.java index 27a913c18..7bc9a5bdf 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/Location.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/Location.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package twitter4j; +package org.mariotaku.twidere.api.twitter.model; /** * @author Yusuke Yamamoto - yusuke at mac.com diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/MediaEntity.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/MediaEntity.java similarity index 96% rename from twidere.component.twitter4j/src/main/java/twitter4j/MediaEntity.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/MediaEntity.java index 7326d2982..656d76b21 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/MediaEntity.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/MediaEntity.java @@ -1,8 +1,7 @@ -package twitter4j; +package org.mariotaku.twidere.api.twitter.model; -import java.io.Serializable; import java.util.Map; diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/MediaUploadResponse.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/MediaUploadResponse.java similarity index 83% rename from twidere.component.twitter4j/src/main/java/twitter4j/MediaUploadResponse.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/MediaUploadResponse.java index fa0959e26..807db93d7 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/MediaUploadResponse.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/MediaUploadResponse.java @@ -1,4 +1,4 @@ -package twitter4j; +package org.mariotaku.twidere.api.twitter.model; public interface MediaUploadResponse extends TwitterResponse { diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/PageableResponseList.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/PageableResponseList.java similarity index 95% rename from twidere.component.twitter4j/src/main/java/twitter4j/PageableResponseList.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/PageableResponseList.java index 5f935f468..260123317 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/PageableResponseList.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/PageableResponseList.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package twitter4j; +package org.mariotaku.twidere.api.twitter.model; /** * ResponseList with cursor support. diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/Paging.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/Paging.java similarity index 98% rename from twidere.component.twitter4j/src/main/java/twitter4j/Paging.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/Paging.java index be4dc3c09..8019cf38d 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/Paging.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/Paging.java @@ -1,4 +1,4 @@ -package twitter4j; +package org.mariotaku.twidere.api.twitter.model; import org.mariotaku.simplerestapi.http.ValueMap; diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/Place.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/Place.java similarity index 91% rename from twidere.component.twitter4j/src/main/java/twitter4j/Place.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/Place.java index 978e44ab4..8cfdacec6 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/Place.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/Place.java @@ -1,4 +1,4 @@ -package twitter4j; +package org.mariotaku.twidere.api.twitter.model; /** * @author Yusuke Yamamoto - yusuke at mac.com diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/ProfileUpdate.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/ProfileUpdate.java similarity index 97% rename from twidere.component.twitter4j/src/main/java/twitter4j/ProfileUpdate.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/ProfileUpdate.java index 4e51b1907..9d53cb6e7 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/ProfileUpdate.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/ProfileUpdate.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package twitter4j; +package org.mariotaku.twidere.api.twitter.model; import org.mariotaku.simplerestapi.http.SimpleValueMap; diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/QueryResult.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/QueryResult.java similarity index 94% rename from twidere.component.twitter4j/src/main/java/twitter4j/QueryResult.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/QueryResult.java index 9906385ff..5eb55d0be 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/QueryResult.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/QueryResult.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package twitter4j; +package org.mariotaku.twidere.api.twitter.model; /** * A data interface representing search API response diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/RateLimitStatus.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/RateLimitStatus.java similarity index 97% rename from twidere.component.twitter4j/src/main/java/twitter4j/RateLimitStatus.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/RateLimitStatus.java index 2d84c55bd..dd9c895ef 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/RateLimitStatus.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/RateLimitStatus.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package twitter4j; +package org.mariotaku.twidere.api.twitter.model; /** * A data interface representing Twitter REST API's rate limit status diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/Relationship.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/Relationship.java similarity index 98% rename from twidere.component.twitter4j/src/main/java/twitter4j/Relationship.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/Relationship.java index dabd34a20..7fb7119dc 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/Relationship.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/Relationship.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package twitter4j; +package org.mariotaku.twidere.api.twitter.model; public interface Relationship extends TwitterResponse { boolean canSourceDMTarget(); diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/ReportAs.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/ReportAs.java similarity index 88% rename from twidere.component.twitter4j/src/main/java/twitter4j/ReportAs.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/ReportAs.java index 43ddce5ae..a892d2b87 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/ReportAs.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/ReportAs.java @@ -1,4 +1,4 @@ -package twitter4j; +package org.mariotaku.twidere.api.twitter.model; public enum ReportAs { ABUSE("abuse"), COMPROMISED("compromised"), SPAM("spam"); diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/ResponseList.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/ResponseList.java similarity index 94% rename from twidere.component.twitter4j/src/main/java/twitter4j/ResponseList.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/ResponseList.java index b32ed8ea1..cff43234d 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/ResponseList.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/ResponseList.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package twitter4j; +package org.mariotaku.twidere.api.twitter.model; import java.util.List; diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/SavedSearch.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/SavedSearch.java similarity index 89% rename from twidere.component.twitter4j/src/main/java/twitter4j/SavedSearch.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/SavedSearch.java index b85d6f816..d88defc5a 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/SavedSearch.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/SavedSearch.java @@ -14,11 +14,8 @@ * limitations under the License. */ -package twitter4j; +package org.mariotaku.twidere.api.twitter.model; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -import java.io.Serializable; import java.util.Date; /** diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/SearchQuery.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/SearchQuery.java similarity index 99% rename from twidere.component.twitter4j/src/main/java/twitter4j/SearchQuery.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/SearchQuery.java index 58fc21806..e2d141758 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/SearchQuery.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/SearchQuery.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package twitter4j; +package org.mariotaku.twidere.api.twitter.model; import org.mariotaku.simplerestapi.http.ValueMap; diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/SettingsUpdate.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/SettingsUpdate.java similarity index 97% rename from twidere.component.twitter4j/src/main/java/twitter4j/SettingsUpdate.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/SettingsUpdate.java index 38b8192fb..096712fcf 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/SettingsUpdate.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/SettingsUpdate.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package twitter4j; +package org.mariotaku.twidere.api.twitter.model; import org.mariotaku.simplerestapi.http.SimpleValueMap; diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/SimilarPlaces.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/SimilarPlaces.java similarity index 53% rename from twidere.component.twitter4j/src/main/java/twitter4j/SimilarPlaces.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/SimilarPlaces.java index 2557cc9ec..f0109876b 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/SimilarPlaces.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/SimilarPlaces.java @@ -14,7 +14,11 @@ * limitations under the License. */ -package twitter4j; +package org.mariotaku.twidere.api.twitter.model; + +import org.mariotaku.twidere.api.twitter.model.GeoLocation; +import org.mariotaku.twidere.api.twitter.model.Place; +import org.mariotaku.twidere.api.twitter.model.ResponseList; import java.io.Serializable; @@ -23,13 +27,13 @@ import java.io.Serializable; * @since Twitter4J 2.1.7 */ public interface SimilarPlaces extends ResponseList, Serializable { - /** - * Returns the token needed to be able to create a new place with - * {@link twitter4j.api.PlacesGeoResources#createPlace(String, String, String, GeoLocation, String)} - * . - * - * @return token the token needed to be able to create a new place with - * {@link twitter4j.api.PlacesGeoResources#createPlace(String, String, String, GeoLocation, String)} - */ - String getToken(); + /** + * Returns the token needed to be able to create a new place with + * {@link org.mariotaku.twidere.api.twitter.api.PlacesGeoResources#createPlace(String, String, String, GeoLocation, String)} + * . + * + * @return token the token needed to be able to create a new place with + * {@link org.mariotaku.twidere.api.twitter.api.PlacesGeoResources#createPlace(String, String, String, GeoLocation, String)} + */ + String getToken(); } diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/Status.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/Status.java similarity index 98% rename from twidere.component.twitter4j/src/main/java/twitter4j/Status.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/Status.java index 7459a55f8..0bb69fcc1 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/Status.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/Status.java @@ -14,9 +14,8 @@ * limitations under the License. */ -package twitter4j; +package org.mariotaku.twidere.api.twitter.model; -import java.io.Serializable; import java.util.Date; /** diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/StatusActivitySummary.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/StatusActivitySummary.java similarity index 86% rename from twidere.component.twitter4j/src/main/java/twitter4j/StatusActivitySummary.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/StatusActivitySummary.java index 41a4510f8..ee24c326d 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/StatusActivitySummary.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/StatusActivitySummary.java @@ -1,4 +1,4 @@ -package twitter4j; +package org.mariotaku.twidere.api.twitter.model; public interface StatusActivitySummary extends TwitterResponse { diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/StatusUpdate.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/StatusUpdate.java similarity index 98% rename from twidere.component.twitter4j/src/main/java/twitter4j/StatusUpdate.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/StatusUpdate.java index 935265b16..a23dea8a6 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/StatusUpdate.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/StatusUpdate.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package twitter4j; +package org.mariotaku.twidere.api.twitter.model; import org.mariotaku.simplerestapi.Utils; import org.mariotaku.simplerestapi.http.SimpleValueMap; diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/TimeZone.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/TimeZone.java similarity index 94% rename from twidere.component.twitter4j/src/main/java/twitter4j/TimeZone.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/TimeZone.java index 763c16789..62d367c38 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/TimeZone.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/TimeZone.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package twitter4j; +package org.mariotaku.twidere.api.twitter.model; import java.io.Serializable; diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/TranslationResult.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/TranslationResult.java similarity index 65% rename from twidere.component.twitter4j/src/main/java/twitter4j/TranslationResult.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/TranslationResult.java index 1a858acdd..a19a0fac1 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/TranslationResult.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/TranslationResult.java @@ -1,4 +1,6 @@ -package twitter4j; +package org.mariotaku.twidere.api.twitter.model; + +import org.mariotaku.twidere.api.twitter.model.TwitterResponse; public interface TranslationResult extends TwitterResponse { diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/Trend.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/Trend.java similarity index 94% rename from twidere.component.twitter4j/src/main/java/twitter4j/Trend.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/Trend.java index 1cf2f5d8b..f0a6e8b0a 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/Trend.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/Trend.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package twitter4j; +package org.mariotaku.twidere.api.twitter.model; import java.io.Serializable; diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/Trends.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/Trends.java similarity index 96% rename from twidere.component.twitter4j/src/main/java/twitter4j/Trends.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/Trends.java index 2f8e3e19f..e92f9cb35 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/Trends.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/Trends.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package twitter4j; +package org.mariotaku.twidere.api.twitter.model; import java.io.Serializable; import java.util.Date; diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/TwitterAPIConfiguration.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/TwitterAPIConfiguration.java similarity index 85% rename from twidere.component.twitter4j/src/main/java/twitter4j/TwitterAPIConfiguration.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/TwitterAPIConfiguration.java index 2d5649bed..2f6afab5e 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/TwitterAPIConfiguration.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/TwitterAPIConfiguration.java @@ -14,9 +14,11 @@ * limitations under the License. */ -package twitter4j; +package org.mariotaku.twidere.api.twitter.model; + +import org.mariotaku.twidere.api.twitter.model.MediaEntity; +import org.mariotaku.twidere.api.twitter.model.TwitterResponse; -import java.io.Serializable; import java.util.Map; /** diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/TwitterResponse.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/TwitterResponse.java similarity index 94% rename from twidere.component.twitter4j/src/main/java/twitter4j/TwitterResponse.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/TwitterResponse.java index b44cf884b..a8b3350d7 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/TwitterResponse.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/TwitterResponse.java @@ -17,19 +17,17 @@ * along with this program. If not, see . */ -package twitter4j; +package org.mariotaku.twidere.api.twitter.model; import org.mariotaku.simplerestapi.http.RestResponse; -import java.io.Serializable; - /** * Super interface of Twitter Response data interfaces which indicates that rate * limit status is avaialble. * * @author Yusuke Yamamoto - yusuke at mac.com * @see DirectMessage - * @see twitter4j.Status + * @see Status * @see User */ public interface TwitterResponse { diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/UrlEntity.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/UrlEntity.java similarity index 97% rename from twidere.component.twitter4j/src/main/java/twitter4j/UrlEntity.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/UrlEntity.java index ce8f929c1..bdbd1efa9 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/UrlEntity.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/UrlEntity.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package twitter4j; +package org.mariotaku.twidere.api.twitter.model; import java.io.Serializable; import java.net.URL; diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/User.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/User.java similarity index 98% rename from twidere.component.twitter4j/src/main/java/twitter4j/User.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/User.java index 079c1c1f0..653cae97b 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/User.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/User.java @@ -14,9 +14,8 @@ * limitations under the License. */ -package twitter4j; +package org.mariotaku.twidere.api.twitter.model; -import java.io.Serializable; import java.util.Date; /** diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/UserList.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/UserList.java similarity index 96% rename from twidere.component.twitter4j/src/main/java/twitter4j/UserList.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/UserList.java index 47023a1c8..45b190687 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/UserList.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/UserList.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package twitter4j; +package org.mariotaku.twidere.api.twitter.model; import java.util.Date; diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/UserListUpdate.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/UserListUpdate.java similarity index 96% rename from twidere.component.twitter4j/src/main/java/twitter4j/UserListUpdate.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/UserListUpdate.java index 359d5f9e7..25d9e477a 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/UserListUpdate.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/UserListUpdate.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package twitter4j; +package org.mariotaku.twidere.api.twitter.model; import org.mariotaku.simplerestapi.http.SimpleValueMap; diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/UserMentionEntity.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/UserMentionEntity.java similarity index 97% rename from twidere.component.twitter4j/src/main/java/twitter4j/UserMentionEntity.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/UserMentionEntity.java index eceeeff43..2873add57 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/UserMentionEntity.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/UserMentionEntity.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package twitter4j; +package org.mariotaku.twidere.api.twitter.model; /** * A data interface representing one single user mention entity. diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/CardEntityImpl.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/CardEntityImpl.java similarity index 96% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/CardEntityImpl.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/CardEntityImpl.java index 70a98341c..71d7ddcf2 100644 --- a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/CardEntityImpl.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/CardEntityImpl.java @@ -26,9 +26,9 @@ import org.mariotaku.simplerestapi.http.RestResponse; import java.util.Map; -import twitter4j.CardEntity; -import twitter4j.RateLimitStatus; -import twitter4j.User; +import org.mariotaku.twidere.api.twitter.model.CardEntity; +import org.mariotaku.twidere.api.twitter.model.RateLimitStatus; +import org.mariotaku.twidere.api.twitter.model.User; /** * Created by mariotaku on 15/5/7. diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/DirectMessageImpl.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/DirectMessageImpl.java similarity index 88% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/DirectMessageImpl.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/DirectMessageImpl.java index e4e079f00..29c8c0c60 100644 --- a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/DirectMessageImpl.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/DirectMessageImpl.java @@ -22,15 +22,15 @@ package org.mariotaku.twidere.api.twitter.model.impl; import com.bluelinelabs.logansquare.annotation.JsonField; import com.bluelinelabs.logansquare.annotation.JsonObject; -import org.mariotaku.twidere.api.twitter.TwitterDateConverter; +import org.mariotaku.twidere.api.twitter.util.TwitterDateConverter; import java.util.Date; -import twitter4j.DirectMessage; -import twitter4j.HashtagEntity; -import twitter4j.MediaEntity; -import twitter4j.UrlEntity; -import twitter4j.UserMentionEntity; +import org.mariotaku.twidere.api.twitter.model.DirectMessage; +import org.mariotaku.twidere.api.twitter.model.HashtagEntity; +import org.mariotaku.twidere.api.twitter.model.MediaEntity; +import org.mariotaku.twidere.api.twitter.model.UrlEntity; +import org.mariotaku.twidere.api.twitter.model.UserMentionEntity; /** * Created by mariotaku on 15/5/7. diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/EntitiesImpl.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/EntitiesImpl.java similarity index 88% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/EntitiesImpl.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/EntitiesImpl.java index 100ae4afe..c0a64498a 100644 --- a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/EntitiesImpl.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/EntitiesImpl.java @@ -24,10 +24,10 @@ import com.bluelinelabs.logansquare.annotation.JsonObject; import java.util.Arrays; -import twitter4j.HashtagEntity; -import twitter4j.MediaEntity; -import twitter4j.UrlEntity; -import twitter4j.UserMentionEntity; +import org.mariotaku.twidere.api.twitter.model.HashtagEntity; +import org.mariotaku.twidere.api.twitter.model.MediaEntity; +import org.mariotaku.twidere.api.twitter.model.UrlEntity; +import org.mariotaku.twidere.api.twitter.model.UserMentionEntity; /** * Created by mariotaku on 15/3/31. diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/ErrorInfoImpl.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/ErrorInfoImpl.java similarity index 95% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/ErrorInfoImpl.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/ErrorInfoImpl.java index a50031173..d13184320 100644 --- a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/ErrorInfoImpl.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/ErrorInfoImpl.java @@ -22,7 +22,7 @@ package org.mariotaku.twidere.api.twitter.model.impl; import com.bluelinelabs.logansquare.annotation.JsonField; import com.bluelinelabs.logansquare.annotation.JsonObject; -import twitter4j.*; +import org.mariotaku.twidere.api.twitter.model.ErrorInfo; /** * Created by mariotaku on 15/5/7. diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/GeoPoint.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/GeoPoint.java similarity index 95% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/GeoPoint.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/GeoPoint.java index b910ccdfa..b536369cd 100644 --- a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/GeoPoint.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/GeoPoint.java @@ -22,7 +22,7 @@ package org.mariotaku.twidere.api.twitter.model.impl; import com.bluelinelabs.logansquare.annotation.JsonField; import com.bluelinelabs.logansquare.annotation.JsonObject; -import twitter4j.GeoLocation; +import org.mariotaku.twidere.api.twitter.model.GeoLocation; /** * Created by mariotaku on 15/5/7. diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/HashtagEntityImpl.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/HashtagEntityImpl.java similarity index 95% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/HashtagEntityImpl.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/HashtagEntityImpl.java index 89513efaa..b1682f6e6 100644 --- a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/HashtagEntityImpl.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/HashtagEntityImpl.java @@ -22,7 +22,7 @@ package org.mariotaku.twidere.api.twitter.model.impl; import com.bluelinelabs.logansquare.annotation.JsonField; import com.bluelinelabs.logansquare.annotation.JsonObject; -import twitter4j.HashtagEntity; +import org.mariotaku.twidere.api.twitter.model.HashtagEntity; /** * Created by mariotaku on 15/3/31. diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/Indices.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/Indices.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/Indices.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/Indices.java diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/MediaEntityImpl.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/MediaEntityImpl.java similarity index 99% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/MediaEntityImpl.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/MediaEntityImpl.java index 5b3db6852..e2229f331 100644 --- a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/MediaEntityImpl.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/MediaEntityImpl.java @@ -26,7 +26,7 @@ import java.util.Arrays; import java.util.HashMap; import java.util.Map; -import twitter4j.MediaEntity; +import org.mariotaku.twidere.api.twitter.model.MediaEntity; /** * Created by mariotaku on 15/3/31. diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/MediaUploadResponseImpl.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/MediaUploadResponseImpl.java similarity index 96% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/MediaUploadResponseImpl.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/MediaUploadResponseImpl.java index f83faff32..d0928c911 100644 --- a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/MediaUploadResponseImpl.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/MediaUploadResponseImpl.java @@ -22,7 +22,7 @@ package org.mariotaku.twidere.api.twitter.model.impl; import com.bluelinelabs.logansquare.annotation.JsonField; import com.bluelinelabs.logansquare.annotation.JsonObject; -import twitter4j.MediaUploadResponse; +import org.mariotaku.twidere.api.twitter.model.MediaUploadResponse; /** * Created by mariotaku on 15/5/7. diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/PageableResponseListImpl.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/PageableResponseListImpl.java similarity index 91% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/PageableResponseListImpl.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/PageableResponseListImpl.java index ea1af5cdf..114ea8d9f 100644 --- a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/PageableResponseListImpl.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/PageableResponseListImpl.java @@ -19,12 +19,9 @@ package org.mariotaku.twidere.api.twitter.model.impl; -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - import java.util.Collection; -import twitter4j.PageableResponseList; +import org.mariotaku.twidere.api.twitter.model.PageableResponseList; /** * Created by mariotaku on 15/5/7. diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/PageableResponseListMapper.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/PageableResponseListMapper.java similarity index 95% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/PageableResponseListMapper.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/PageableResponseListMapper.java index f1f72142a..a1a4ec119 100644 --- a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/PageableResponseListMapper.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/PageableResponseListMapper.java @@ -25,14 +25,14 @@ import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonToken; -import org.mariotaku.twidere.api.twitter.TwitterConverter; +import org.mariotaku.twidere.api.twitter.util.TwitterConverter; import java.io.IOException; import java.util.HashMap; import java.util.Map; -import twitter4j.Status; -import twitter4j.User; +import org.mariotaku.twidere.api.twitter.model.Status; +import org.mariotaku.twidere.api.twitter.model.User; public final class PageableResponseListMapper extends JsonMapper> { diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/PageableResponseListWrapper.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/PageableResponseListWrapper.java similarity index 87% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/PageableResponseListWrapper.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/PageableResponseListWrapper.java index 3471c9ee5..aed3762a1 100644 --- a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/PageableResponseListWrapper.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/PageableResponseListWrapper.java @@ -22,15 +22,15 @@ package org.mariotaku.twidere.api.twitter.model.impl; import com.bluelinelabs.logansquare.annotation.JsonField; import com.bluelinelabs.logansquare.annotation.JsonObject; -import org.mariotaku.twidere.api.twitter.TwitterConverter; +import org.mariotaku.twidere.api.twitter.util.TwitterConverter; import java.lang.reflect.Type; import java.util.ArrayList; -import twitter4j.PageableResponseList; -import twitter4j.Status; -import twitter4j.User; -import twitter4j.UserList; +import org.mariotaku.twidere.api.twitter.model.PageableResponseList; +import org.mariotaku.twidere.api.twitter.model.Status; +import org.mariotaku.twidere.api.twitter.model.User; +import org.mariotaku.twidere.api.twitter.model.UserList; /** * Created by mariotaku on 15/5/7. diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/PlaceImpl.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/PlaceImpl.java similarity index 95% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/PlaceImpl.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/PlaceImpl.java index 04afe62ea..828c3c3e1 100644 --- a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/PlaceImpl.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/PlaceImpl.java @@ -22,9 +22,8 @@ package org.mariotaku.twidere.api.twitter.model.impl; import com.bluelinelabs.logansquare.annotation.JsonField; import com.bluelinelabs.logansquare.annotation.JsonObject; -import twitter4j.GeoLocation; -import twitter4j.Place; -import twitter4j.RateLimitStatus; +import org.mariotaku.twidere.api.twitter.model.GeoLocation; +import org.mariotaku.twidere.api.twitter.model.Place; /** * Created by mariotaku on 15/5/7. diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/QueryResultImpl.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/QueryResultImpl.java similarity index 93% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/QueryResultImpl.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/QueryResultImpl.java index 05cd39a01..c0d24ba9a 100644 --- a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/QueryResultImpl.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/QueryResultImpl.java @@ -21,8 +21,8 @@ package org.mariotaku.twidere.api.twitter.model.impl; import java.util.ArrayList; -import twitter4j.QueryResult; -import twitter4j.Status; +import org.mariotaku.twidere.api.twitter.model.QueryResult; +import org.mariotaku.twidere.api.twitter.model.Status; /** * Created by mariotaku on 15/5/7. diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/QueryResultWrapper.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/QueryResultWrapper.java similarity index 94% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/QueryResultWrapper.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/QueryResultWrapper.java index 3f29657df..6f25b1bf1 100644 --- a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/QueryResultWrapper.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/QueryResultWrapper.java @@ -24,8 +24,8 @@ import com.bluelinelabs.logansquare.annotation.JsonObject; import java.util.ArrayList; -import twitter4j.QueryResult; -import twitter4j.Status; +import org.mariotaku.twidere.api.twitter.model.QueryResult; +import org.mariotaku.twidere.api.twitter.model.Status; /** * Created by mariotaku on 15/5/7. diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/RateLimitStatusJSONImpl.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/RateLimitStatusJSONImpl.java similarity index 98% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/RateLimitStatusJSONImpl.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/RateLimitStatusJSONImpl.java index 490a6723a..0d2087c7d 100644 --- a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/RateLimitStatusJSONImpl.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/RateLimitStatusJSONImpl.java @@ -24,7 +24,7 @@ import com.bluelinelabs.logansquare.annotation.JsonObject; import org.mariotaku.simplerestapi.http.RestResponse; -import twitter4j.RateLimitStatus; +import org.mariotaku.twidere.api.twitter.model.RateLimitStatus; /** * A data class representing Twitter REST API's rate limit status diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/RelationshipImpl.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/RelationshipImpl.java similarity index 98% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/RelationshipImpl.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/RelationshipImpl.java index 88aaee072..3df0e2e1d 100644 --- a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/RelationshipImpl.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/RelationshipImpl.java @@ -22,7 +22,7 @@ package org.mariotaku.twidere.api.twitter.model.impl; import com.bluelinelabs.logansquare.annotation.JsonField; import com.bluelinelabs.logansquare.annotation.JsonObject; -import twitter4j.Relationship; +import org.mariotaku.twidere.api.twitter.model.Relationship; /** * Created by mariotaku on 15/5/7. diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/RelationshipWrapper.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/RelationshipWrapper.java similarity index 95% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/RelationshipWrapper.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/RelationshipWrapper.java index 5525ed691..47dd4d46f 100644 --- a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/RelationshipWrapper.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/RelationshipWrapper.java @@ -22,7 +22,7 @@ package org.mariotaku.twidere.api.twitter.model.impl; import com.bluelinelabs.logansquare.annotation.JsonField; import com.bluelinelabs.logansquare.annotation.JsonObject; -import twitter4j.Relationship; +import org.mariotaku.twidere.api.twitter.model.Relationship; /** * Created by mariotaku on 15/5/7. diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/ResponseListImpl.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/ResponseListImpl.java similarity index 90% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/ResponseListImpl.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/ResponseListImpl.java index 854213cb5..080376638 100644 --- a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/ResponseListImpl.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/ResponseListImpl.java @@ -24,9 +24,9 @@ import org.mariotaku.simplerestapi.http.RestResponse; import java.util.ArrayList; import java.util.Collection; -import twitter4j.RateLimitStatus; -import twitter4j.ResponseList; -import twitter4j.internal.util.InternalParseUtil; +import org.mariotaku.twidere.api.twitter.model.RateLimitStatus; +import org.mariotaku.twidere.api.twitter.model.ResponseList; +import org.mariotaku.twidere.api.twitter.util.InternalParseUtil; /** * Created by mariotaku on 15/5/7. diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/SavedSearchImpl.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/SavedSearchImpl.java similarity index 93% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/SavedSearchImpl.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/SavedSearchImpl.java index 60b6ad3f7..1219b8e19 100644 --- a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/SavedSearchImpl.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/SavedSearchImpl.java @@ -24,12 +24,11 @@ import android.support.annotation.NonNull; import com.bluelinelabs.logansquare.annotation.JsonField; import com.bluelinelabs.logansquare.annotation.JsonObject; -import org.mariotaku.twidere.api.twitter.TwitterDateConverter; +import org.mariotaku.twidere.api.twitter.util.TwitterDateConverter; import java.util.Date; -import twitter4j.RateLimitStatus; -import twitter4j.SavedSearch; +import org.mariotaku.twidere.api.twitter.model.SavedSearch; /** * Created by mariotaku on 15/5/7. diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/StatusImpl.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/StatusImpl.java similarity index 92% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/StatusImpl.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/StatusImpl.java index a9b110e7b..5c91aed48 100644 --- a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/StatusImpl.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/StatusImpl.java @@ -24,21 +24,20 @@ import android.support.annotation.NonNull; import com.bluelinelabs.logansquare.annotation.JsonField; import com.bluelinelabs.logansquare.annotation.JsonObject; -import org.mariotaku.twidere.api.twitter.TwitterDateConverter; +import org.mariotaku.twidere.api.twitter.util.TwitterDateConverter; import java.util.Arrays; import java.util.Date; -import twitter4j.CardEntity; -import twitter4j.GeoLocation; -import twitter4j.HashtagEntity; -import twitter4j.MediaEntity; -import twitter4j.Place; -import twitter4j.RateLimitStatus; -import twitter4j.Status; -import twitter4j.UrlEntity; -import twitter4j.User; -import twitter4j.UserMentionEntity; +import org.mariotaku.twidere.api.twitter.model.CardEntity; +import org.mariotaku.twidere.api.twitter.model.GeoLocation; +import org.mariotaku.twidere.api.twitter.model.HashtagEntity; +import org.mariotaku.twidere.api.twitter.model.MediaEntity; +import org.mariotaku.twidere.api.twitter.model.Place; +import org.mariotaku.twidere.api.twitter.model.Status; +import org.mariotaku.twidere.api.twitter.model.UrlEntity; +import org.mariotaku.twidere.api.twitter.model.User; +import org.mariotaku.twidere.api.twitter.model.UserMentionEntity; /** * Created by mariotaku on 15/5/5. diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/TranslationResultImpl.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/TranslationResultImpl.java similarity index 96% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/TranslationResultImpl.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/TranslationResultImpl.java index e531f1d15..7c85f4876 100644 --- a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/TranslationResultImpl.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/TranslationResultImpl.java @@ -22,7 +22,7 @@ package org.mariotaku.twidere.api.twitter.model.impl; import com.bluelinelabs.logansquare.annotation.JsonField; import com.bluelinelabs.logansquare.annotation.JsonObject; -import twitter4j.TranslationResult; +import org.mariotaku.twidere.api.twitter.model.TranslationResult; /** * Created by mariotaku on 15/5/7. diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/TwitterResponseImpl.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/TwitterResponseImpl.java similarity index 88% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/TwitterResponseImpl.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/TwitterResponseImpl.java index 3331c21ed..019dce813 100644 --- a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/TwitterResponseImpl.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/TwitterResponseImpl.java @@ -21,9 +21,9 @@ package org.mariotaku.twidere.api.twitter.model.impl; import org.mariotaku.simplerestapi.http.RestResponse; -import twitter4j.RateLimitStatus; -import twitter4j.TwitterResponse; -import twitter4j.internal.util.InternalParseUtil; +import org.mariotaku.twidere.api.twitter.model.RateLimitStatus; +import org.mariotaku.twidere.api.twitter.model.TwitterResponse; +import org.mariotaku.twidere.api.twitter.util.InternalParseUtil; /** * Created by mariotaku on 15/5/7. diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/TypeConverterMapper.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/TypeConverterMapper.java similarity index 100% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/TypeConverterMapper.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/TypeConverterMapper.java diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/UrlEntityImpl.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/UrlEntityImpl.java similarity index 97% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/UrlEntityImpl.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/UrlEntityImpl.java index 3debfe5b0..cf0c16c89 100644 --- a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/UrlEntityImpl.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/UrlEntityImpl.java @@ -22,7 +22,7 @@ package org.mariotaku.twidere.api.twitter.model.impl; import com.bluelinelabs.logansquare.annotation.JsonField; import com.bluelinelabs.logansquare.annotation.JsonObject; -import twitter4j.UrlEntity; +import org.mariotaku.twidere.api.twitter.model.UrlEntity; /** * Created by mariotaku on 15/3/31. diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/UserEntitiesImpl.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/UserEntitiesImpl.java similarity index 96% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/UserEntitiesImpl.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/UserEntitiesImpl.java index a1e7ee323..730c99a0d 100644 --- a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/UserEntitiesImpl.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/UserEntitiesImpl.java @@ -22,7 +22,7 @@ package org.mariotaku.twidere.api.twitter.model.impl; import com.bluelinelabs.logansquare.annotation.JsonField; import com.bluelinelabs.logansquare.annotation.JsonObject; -import twitter4j.UrlEntity; +import org.mariotaku.twidere.api.twitter.model.UrlEntity; /** * Created by mariotaku on 15/3/31. diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/UserImpl.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/UserImpl.java similarity index 98% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/UserImpl.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/UserImpl.java index 09ea8b693..a27d934aa 100644 --- a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/UserImpl.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/UserImpl.java @@ -25,13 +25,13 @@ import android.support.annotation.NonNull; import com.bluelinelabs.logansquare.annotation.JsonField; import com.bluelinelabs.logansquare.annotation.JsonObject; -import org.mariotaku.twidere.api.twitter.TwitterDateConverter; +import org.mariotaku.twidere.api.twitter.util.TwitterDateConverter; import java.util.Date; -import twitter4j.Status; -import twitter4j.UrlEntity; -import twitter4j.User; +import org.mariotaku.twidere.api.twitter.model.Status; +import org.mariotaku.twidere.api.twitter.model.UrlEntity; +import org.mariotaku.twidere.api.twitter.model.User; /** * Created by mariotaku on 15/3/31. diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/UserListImpl.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/UserListImpl.java similarity index 95% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/UserListImpl.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/UserListImpl.java index 280c92dd3..77cd9066f 100644 --- a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/UserListImpl.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/UserListImpl.java @@ -24,12 +24,12 @@ import android.support.annotation.NonNull; import com.bluelinelabs.logansquare.annotation.JsonField; import com.bluelinelabs.logansquare.annotation.JsonObject; -import org.mariotaku.twidere.api.twitter.TwitterDateConverter; +import org.mariotaku.twidere.api.twitter.util.TwitterDateConverter; import java.util.Date; -import twitter4j.User; -import twitter4j.UserList; +import org.mariotaku.twidere.api.twitter.model.User; +import org.mariotaku.twidere.api.twitter.model.UserList; /** * Created by mariotaku on 15/4/7. diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/UserMentionEntityImpl.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/UserMentionEntityImpl.java similarity index 96% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/UserMentionEntityImpl.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/UserMentionEntityImpl.java index 9ce060ea7..4e5bfcd56 100644 --- a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/UserMentionEntityImpl.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/UserMentionEntityImpl.java @@ -22,7 +22,7 @@ package org.mariotaku.twidere.api.twitter.model.impl; import com.bluelinelabs.logansquare.annotation.JsonField; import com.bluelinelabs.logansquare.annotation.JsonObject; -import twitter4j.UserMentionEntity; +import org.mariotaku.twidere.api.twitter.model.UserMentionEntity; /** * Created by mariotaku on 15/3/31. diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/Wrapper.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/Wrapper.java similarity index 93% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/Wrapper.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/Wrapper.java index 2cbb56e20..b6634be5f 100644 --- a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/Wrapper.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/impl/Wrapper.java @@ -19,7 +19,7 @@ package org.mariotaku.twidere.api.twitter.model.impl; -import twitter4j.TwitterResponse; +import org.mariotaku.twidere.api.twitter.model.TwitterResponse; /** * Created by mariotaku on 15/5/7. diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/util/CharacterUtil.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/util/CharacterUtil.java similarity index 96% rename from twidere.component.twitter4j/src/main/java/twitter4j/util/CharacterUtil.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/util/CharacterUtil.java index b4e6e0e1a..8da16bccb 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/util/CharacterUtil.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/util/CharacterUtil.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package twitter4j.util; +package org.mariotaku.twidere.api.twitter.util; /** * @author Yusuke Yamamoto - yusuke at mac.com diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/internal/util/InternalParseUtil.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/util/InternalParseUtil.java similarity index 97% rename from twidere.component.twitter4j/src/main/java/twitter4j/internal/util/InternalParseUtil.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/util/InternalParseUtil.java index 9685cd611..957714979 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/internal/util/InternalParseUtil.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/util/InternalParseUtil.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package twitter4j.internal.util; +package org.mariotaku.twidere.api.twitter.util; import org.json.JSONException; import org.json.JSONObject; @@ -34,8 +34,8 @@ import java.util.Locale; import java.util.Map; import java.util.TimeZone; -import twitter4j.TwitterException; -import twitter4j.TwitterResponse; +import org.mariotaku.twidere.api.twitter.TwitterException; +import org.mariotaku.twidere.api.twitter.model.TwitterResponse; /** * A tiny parse utility class. diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/util/TimeSpanConverter.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/util/TimeSpanConverter.java similarity index 99% rename from twidere.component.twitter4j/src/main/java/twitter4j/util/TimeSpanConverter.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/util/TimeSpanConverter.java index 3b91aec1c..991ae77a5 100644 --- a/twidere.component.twitter4j/src/main/java/twitter4j/util/TimeSpanConverter.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/util/TimeSpanConverter.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package twitter4j.util; +package org.mariotaku.twidere.api.twitter.util; import java.text.MessageFormat; import java.text.SimpleDateFormat; diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/TwitterConverter.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/util/TwitterConverter.java similarity index 90% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/TwitterConverter.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/util/TwitterConverter.java index dd2c7d83d..fc037f31e 100644 --- a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/TwitterConverter.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/util/TwitterConverter.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package org.mariotaku.twidere.api.twitter; +package org.mariotaku.twidere.api.twitter.util; import com.bluelinelabs.logansquare.LoganSquare; import com.bluelinelabs.logansquare.typeconverters.TypeConverter; @@ -29,7 +29,27 @@ import org.mariotaku.simplerestapi.Converter; import org.mariotaku.simplerestapi.http.ContentType; import org.mariotaku.simplerestapi.http.RestResponse; import org.mariotaku.simplerestapi.http.mime.TypedData; +import org.mariotaku.twidere.api.twitter.TwitterException; +import org.mariotaku.twidere.api.twitter.model.UserMentionEntity; import org.mariotaku.twidere.api.twitter.auth.OAuthToken; +import org.mariotaku.twidere.api.twitter.model.CardEntity; +import org.mariotaku.twidere.api.twitter.model.DirectMessage; +import org.mariotaku.twidere.api.twitter.model.ErrorInfo; +import org.mariotaku.twidere.api.twitter.model.GeoLocation; +import org.mariotaku.twidere.api.twitter.model.HashtagEntity; +import org.mariotaku.twidere.api.twitter.model.MediaEntity; +import org.mariotaku.twidere.api.twitter.model.MediaUploadResponse; +import org.mariotaku.twidere.api.twitter.model.PageableResponseList; +import org.mariotaku.twidere.api.twitter.model.Place; +import org.mariotaku.twidere.api.twitter.model.QueryResult; +import org.mariotaku.twidere.api.twitter.model.Relationship; +import org.mariotaku.twidere.api.twitter.model.ResponseList; +import org.mariotaku.twidere.api.twitter.model.SavedSearch; +import org.mariotaku.twidere.api.twitter.model.Status; +import org.mariotaku.twidere.api.twitter.model.TranslationResult; +import org.mariotaku.twidere.api.twitter.model.UrlEntity; +import org.mariotaku.twidere.api.twitter.model.User; +import org.mariotaku.twidere.api.twitter.model.UserList; import org.mariotaku.twidere.api.twitter.model.impl.CardEntityImpl; import org.mariotaku.twidere.api.twitter.model.impl.DirectMessageImpl; import org.mariotaku.twidere.api.twitter.model.impl.ErrorInfoImpl; @@ -67,27 +87,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import twitter4j.CardEntity; -import twitter4j.DirectMessage; -import twitter4j.ErrorInfo; -import twitter4j.GeoLocation; -import twitter4j.HashtagEntity; -import twitter4j.MediaEntity; -import twitter4j.MediaUploadResponse; -import twitter4j.PageableResponseList; -import twitter4j.Place; -import twitter4j.QueryResult; -import twitter4j.Relationship; -import twitter4j.ResponseList; -import twitter4j.SavedSearch; -import twitter4j.Status; -import twitter4j.TranslationResult; -import twitter4j.TwitterException; -import twitter4j.UrlEntity; -import twitter4j.User; -import twitter4j.UserList; -import twitter4j.UserMentionEntity; - /** * Created by mariotaku on 15/5/5. */ diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/TwitterDateConverter.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/util/TwitterDateConverter.java similarity index 96% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/TwitterDateConverter.java rename to twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/util/TwitterDateConverter.java index 822477833..12dc948cf 100644 --- a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/TwitterDateConverter.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/util/TwitterDateConverter.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package org.mariotaku.twidere.api.twitter; +package org.mariotaku.twidere.api.twitter.util; import com.bluelinelabs.logansquare.typeconverters.DateTypeConverter; diff --git a/twidere.component.common/src/main/java/org/mariotaku/twidere/constant/SharedPreferenceConstants.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/constant/SharedPreferenceConstants.java index 4b6aef789..546b565e3 100644 --- a/twidere.component.common/src/main/java/org/mariotaku/twidere/constant/SharedPreferenceConstants.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/constant/SharedPreferenceConstants.java @@ -151,8 +151,6 @@ public interface SharedPreferenceConstants { String KEY_LEFTSIDE_COMPOSE_BUTTON = "leftside_compose_button"; @Preference(type = BOOLEAN, exportable = false, hasDefault = true, defaultBoolean = false) String KEY_ATTACH_LOCATION = "attach_location"; - @Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = true) - String KEY_GZIP_COMPRESSING = "gzip_compressing"; @Preference(type = BOOLEAN) String KEY_IGNORE_SSL_ERROR = "ignore_ssl_error"; @Preference(type = STRING) diff --git a/twidere.component.common/src/main/java/org/mariotaku/twidere/model/ParcelableDirectMessage.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/model/ParcelableDirectMessage.java index 71255179e..7e5d3a050 100644 --- a/twidere.component.common/src/main/java/org/mariotaku/twidere/model/ParcelableDirectMessage.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/model/ParcelableDirectMessage.java @@ -34,8 +34,8 @@ import org.mariotaku.twidere.util.TwitterContentUtils; import java.util.Comparator; import java.util.Date; -import twitter4j.DirectMessage; -import twitter4j.User; +import org.mariotaku.twidere.api.twitter.model.DirectMessage; +import org.mariotaku.twidere.api.twitter.model.User; import static org.mariotaku.twidere.util.HtmlEscapeHelper.toPlainText; import static org.mariotaku.twidere.util.content.ContentValuesUtils.getAsBoolean; diff --git a/twidere.component.common/src/main/java/org/mariotaku/twidere/model/ParcelableLocation.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/model/ParcelableLocation.java index 5b3478958..69d70a99d 100644 --- a/twidere.component.common/src/main/java/org/mariotaku/twidere/model/ParcelableLocation.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/model/ParcelableLocation.java @@ -29,7 +29,7 @@ import com.bluelinelabs.logansquare.annotation.JsonObject; import org.mariotaku.twidere.util.ParseUtils; -import twitter4j.GeoLocation; +import org.mariotaku.twidere.api.twitter.model.GeoLocation; @JsonObject public class ParcelableLocation implements Parcelable { diff --git a/twidere.component.common/src/main/java/org/mariotaku/twidere/model/ParcelableMedia.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/model/ParcelableMedia.java index a4ccb29bb..1d1eb5502 100644 --- a/twidere.component.common/src/main/java/org/mariotaku/twidere/model/ParcelableMedia.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/model/ParcelableMedia.java @@ -22,17 +22,17 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import twitter4j.CardEntity; -import twitter4j.CardEntity.BindingValue; -import twitter4j.CardEntity.ImageValue; -import twitter4j.CardEntity.StringValue; -import twitter4j.EntitySupport; -import twitter4j.ExtendedEntitySupport; -import twitter4j.MediaEntity; -import twitter4j.MediaEntity.Size; -import twitter4j.MediaEntity.Type; -import twitter4j.Status; -import twitter4j.UrlEntity; +import org.mariotaku.twidere.api.twitter.model.CardEntity; +import org.mariotaku.twidere.api.twitter.model.CardEntity.BindingValue; +import org.mariotaku.twidere.api.twitter.model.CardEntity.ImageValue; +import org.mariotaku.twidere.api.twitter.model.CardEntity.StringValue; +import org.mariotaku.twidere.api.twitter.model.EntitySupport; +import org.mariotaku.twidere.api.twitter.model.ExtendedEntitySupport; +import org.mariotaku.twidere.api.twitter.model.MediaEntity; +import org.mariotaku.twidere.api.twitter.model.MediaEntity.Size; +import org.mariotaku.twidere.api.twitter.model.MediaEntity.Type; +import org.mariotaku.twidere.api.twitter.model.Status; +import org.mariotaku.twidere.api.twitter.model.UrlEntity; @SuppressWarnings("unused") @JsonObject diff --git a/twidere.component.common/src/main/java/org/mariotaku/twidere/model/ParcelableStatus.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/model/ParcelableStatus.java index c00836cc8..4be2e6c2a 100644 --- a/twidere.component.common/src/main/java/org/mariotaku/twidere/model/ParcelableStatus.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/model/ParcelableStatus.java @@ -43,15 +43,15 @@ import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; -import twitter4j.CardEntity; -import twitter4j.CardEntity.BindingValue; -import twitter4j.CardEntity.BooleanValue; -import twitter4j.CardEntity.ImageValue; -import twitter4j.CardEntity.StringValue; -import twitter4j.CardEntity.UserValue; -import twitter4j.Place; -import twitter4j.Status; -import twitter4j.User; +import org.mariotaku.twidere.api.twitter.model.CardEntity; +import org.mariotaku.twidere.api.twitter.model.CardEntity.BindingValue; +import org.mariotaku.twidere.api.twitter.model.CardEntity.BooleanValue; +import org.mariotaku.twidere.api.twitter.model.CardEntity.ImageValue; +import org.mariotaku.twidere.api.twitter.model.CardEntity.StringValue; +import org.mariotaku.twidere.api.twitter.model.CardEntity.UserValue; +import org.mariotaku.twidere.api.twitter.model.Place; +import org.mariotaku.twidere.api.twitter.model.Status; +import org.mariotaku.twidere.api.twitter.model.User; @SuppressWarnings("unused") @JsonObject diff --git a/twidere.component.common/src/main/java/org/mariotaku/twidere/model/ParcelableUser.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/model/ParcelableUser.java index 05b43f8ba..bd5578c8f 100644 --- a/twidere.component.common/src/main/java/org/mariotaku/twidere/model/ParcelableUser.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/model/ParcelableUser.java @@ -35,8 +35,8 @@ import org.mariotaku.twidere.util.HtmlEscapeHelper; import org.mariotaku.twidere.util.ParseUtils; import org.mariotaku.twidere.util.TwitterContentUtils; -import twitter4j.UrlEntity; -import twitter4j.User; +import org.mariotaku.twidere.api.twitter.model.UrlEntity; +import org.mariotaku.twidere.api.twitter.model.User; @JsonObject public class ParcelableUser implements Parcelable, Comparable { diff --git a/twidere.component.common/src/main/java/org/mariotaku/twidere/model/ParcelableUserList.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/model/ParcelableUserList.java index abb821187..9c66dc384 100644 --- a/twidere.component.common/src/main/java/org/mariotaku/twidere/model/ParcelableUserList.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/model/ParcelableUserList.java @@ -26,8 +26,8 @@ import android.support.annotation.NonNull; import com.bluelinelabs.logansquare.annotation.JsonField; import com.bluelinelabs.logansquare.annotation.JsonObject; -import twitter4j.User; -import twitter4j.UserList; +import org.mariotaku.twidere.api.twitter.model.User; +import org.mariotaku.twidere.api.twitter.model.UserList; @JsonObject public class ParcelableUserList implements Parcelable, Comparable { diff --git a/twidere.component.common/src/main/java/org/mariotaku/twidere/model/ParcelableUserMention.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/model/ParcelableUserMention.java index eef472f98..d782dd852 100644 --- a/twidere.component.common/src/main/java/org/mariotaku/twidere/model/ParcelableUserMention.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/model/ParcelableUserMention.java @@ -30,8 +30,8 @@ import com.bluelinelabs.logansquare.annotation.JsonObject; import java.io.IOException; import java.util.List; -import twitter4j.Status; -import twitter4j.UserMentionEntity; +import org.mariotaku.twidere.api.twitter.model.Status; +import org.mariotaku.twidere.api.twitter.model.UserMentionEntity; @JsonObject public class ParcelableUserMention implements Parcelable { diff --git a/twidere.component.common/src/main/java/org/mariotaku/twidere/util/ContentValuesCreator.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/util/ContentValuesCreator.java index 9cdcc5b8a..6d3119739 100644 --- a/twidere.component.common/src/main/java/org/mariotaku/twidere/util/ContentValuesCreator.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/util/ContentValuesCreator.java @@ -54,16 +54,16 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import twitter4j.DirectMessage; -import twitter4j.GeoLocation; -import twitter4j.Place; -import twitter4j.Relationship; -import twitter4j.SavedSearch; -import twitter4j.Status; -import twitter4j.Trend; -import twitter4j.Trends; -import twitter4j.UrlEntity; -import twitter4j.User; +import org.mariotaku.twidere.api.twitter.model.DirectMessage; +import org.mariotaku.twidere.api.twitter.model.GeoLocation; +import org.mariotaku.twidere.api.twitter.model.Place; +import org.mariotaku.twidere.api.twitter.model.Relationship; +import org.mariotaku.twidere.api.twitter.model.SavedSearch; +import org.mariotaku.twidere.api.twitter.model.Status; +import org.mariotaku.twidere.api.twitter.model.Trend; +import org.mariotaku.twidere.api.twitter.model.Trends; +import org.mariotaku.twidere.api.twitter.model.UrlEntity; +import org.mariotaku.twidere.api.twitter.model.User; import static org.mariotaku.twidere.util.HtmlEscapeHelper.toPlainText; diff --git a/twidere.component.common/src/main/java/org/mariotaku/twidere/util/MediaPreviewUtils.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/util/MediaPreviewUtils.java index 4e47aa2a9..53a4a0807 100644 --- a/twidere.component.common/src/main/java/org/mariotaku/twidere/util/MediaPreviewUtils.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/util/MediaPreviewUtils.java @@ -41,9 +41,9 @@ import java.util.Locale; import java.util.regex.Matcher; import java.util.regex.Pattern; -import twitter4j.MediaEntity; -import twitter4j.Status; -import twitter4j.UrlEntity; +import org.mariotaku.twidere.api.twitter.model.MediaEntity; +import org.mariotaku.twidere.api.twitter.model.Status; +import org.mariotaku.twidere.api.twitter.model.UrlEntity; import static android.text.TextUtils.isEmpty; diff --git a/twidere.component.common/src/main/java/org/mariotaku/twidere/util/TwitterContentUtils.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/util/TwitterContentUtils.java index 6965d3d91..53c63f286 100644 --- a/twidere.component.common/src/main/java/org/mariotaku/twidere/util/TwitterContentUtils.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/util/TwitterContentUtils.java @@ -28,13 +28,13 @@ import org.mariotaku.twidere.model.ConsumerKeyType; import java.nio.charset.Charset; import java.util.zip.CRC32; -import twitter4j.DirectMessage; -import twitter4j.EntitySupport; -import twitter4j.MediaEntity; -import twitter4j.Status; -import twitter4j.UrlEntity; -import twitter4j.User; -import twitter4j.UserMentionEntity; +import org.mariotaku.twidere.api.twitter.model.DirectMessage; +import org.mariotaku.twidere.api.twitter.model.EntitySupport; +import org.mariotaku.twidere.api.twitter.model.MediaEntity; +import org.mariotaku.twidere.api.twitter.model.Status; +import org.mariotaku.twidere.api.twitter.model.UrlEntity; +import org.mariotaku.twidere.api.twitter.model.User; +import org.mariotaku.twidere.api.twitter.model.UserMentionEntity; import static org.mariotaku.twidere.util.HtmlEscapeHelper.toPlainText; diff --git a/twidere.component.twitter4j.streaming/.gitignore b/twidere.component.twitter4j.streaming/.gitignore deleted file mode 100644 index 796b96d1c..000000000 --- a/twidere.component.twitter4j.streaming/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build diff --git a/twidere.component.twitter4j.streaming/build.gradle b/twidere.component.twitter4j.streaming/build.gradle deleted file mode 100644 index 47059764a..000000000 --- a/twidere.component.twitter4j.streaming/build.gradle +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Twidere - Twitter client for Android - * - * Copyright (C) 2012-2015 Mariotaku Lee - * - * 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 . - */ - -apply plugin: 'com.android.library' -apply from: rootProject.file('global.gradle') - -android { - defaultConfig { - minSdkVersion 14 - targetSdkVersion 22 - versionCode 1 - versionName "1.0" - } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } - } -} - -dependencies { - compile project(':twidere.component.twitter4j') - compile fileTree(dir: 'libs', include: ['*.jar']) -} diff --git a/twidere.component.twitter4j.streaming/proguard-rules.pro b/twidere.component.twitter4j.streaming/proguard-rules.pro deleted file mode 100644 index ee5b46f04..000000000 --- a/twidere.component.twitter4j.streaming/proguard-rules.pro +++ /dev/null @@ -1,17 +0,0 @@ -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in /Users/mariotaku/Tools/android-sdk/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the proguardFiles -# directive in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} diff --git a/twidere.component.twitter4j.streaming/src/androidTest/java/org/mariotaku/twidere/library/twitter4j/streaming/ApplicationTest.java b/twidere.component.twitter4j.streaming/src/androidTest/java/org/mariotaku/twidere/library/twitter4j/streaming/ApplicationTest.java deleted file mode 100644 index 37041d3c9..000000000 --- a/twidere.component.twitter4j.streaming/src/androidTest/java/org/mariotaku/twidere/library/twitter4j/streaming/ApplicationTest.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Twidere - Twitter client for Android - * - * Copyright (C) 2012-2015 Mariotaku Lee - * - * 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 . - */ - -package org.mariotaku.twidere.library.twitter4j.streaming; - -import android.app.Application; -import android.test.ApplicationTestCase; - -/** - * Testing Fundamentals - */ -public class ApplicationTest extends ApplicationTestCase { - public ApplicationTest() { - super(Application.class); - } -} \ No newline at end of file diff --git a/twidere.component.twitter4j.streaming/src/main/AndroidManifest.xml b/twidere.component.twitter4j.streaming/src/main/AndroidManifest.xml deleted file mode 100644 index 3e5a30de4..000000000 --- a/twidere.component.twitter4j.streaming/src/main/AndroidManifest.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - diff --git a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/ConnectionLifeCycleListener.java b/twidere.component.twitter4j.streaming/src/main/java/twitter4j/ConnectionLifeCycleListener.java deleted file mode 100644 index e29ee9668..000000000 --- a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/ConnectionLifeCycleListener.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2007 Yusuke Yamamoto - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package twitter4j; - -/** - * @author Yusuke Yamamoto - yusuke at mac.com - * @since Twitter4J 2.1.7 - */ -public interface ConnectionLifeCycleListener { - /** - * called before thread gets cleaned up - */ - void onCleanUp(); - - /** - * called after connection was established - */ - void onConnect(); - - /** - * called after connection was disconnected - */ - void onDisconnect(); -} diff --git a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/ControlStreamInfo.java b/twidere.component.twitter4j.streaming/src/main/java/twitter4j/ControlStreamInfo.java deleted file mode 100644 index a90245018..000000000 --- a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/ControlStreamInfo.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright 2007 Yusuke Yamamoto - * Copyright (C) 2012 Twitter, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package twitter4j; - -import static twitter4j.internal.util.InternalParseUtil.getBoolean; -import static twitter4j.internal.util.InternalParseUtil.getRawString; - -import java.io.Serializable; -import java.util.Arrays; - -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; - -/** - * @author Yusuke Yamamoto - yusuke at twitter.com - * @since Twitter4J 2.2.6 - */ -public final class ControlStreamInfo implements Serializable { - private static final long serialVersionUID = -6761659771734942177L; - private final StreamController.User[] users; - private final boolean includeFollowingsActivity; - private final boolean includeUserChanges; - private final String replies; - private final String with; - private transient final StreamController controller; - - /* package */ControlStreamInfo(final StreamController controller, final JSONObject json) throws TwitterException { - this.controller = controller; - try { - final JSONObject info = json.getJSONObject("info"); - includeFollowingsActivity = getBoolean("include_followings_activity", info); - includeUserChanges = getBoolean("include_user_changes", info); - replies = getRawString("replies", info); - with = getRawString("with", info); - final JSONArray usersJSON = info.getJSONArray("users"); - users = new StreamController.User[usersJSON.length()]; - for (int i = 0; i < usersJSON.length(); i++) { - users[i] = this.controller.createUser(usersJSON.getJSONObject(i)); - } - - } catch (final JSONException e) { - throw new TwitterException(e); - } - - } - - @Override - public boolean equals(final Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - final ControlStreamInfo that = (ControlStreamInfo) o; - - if (includeFollowingsActivity != that.includeFollowingsActivity) return false; - if (includeUserChanges != that.includeUserChanges) return false; - if (replies != null ? !replies.equals(that.replies) : that.replies != null) return false; - if (!Arrays.equals(users, that.users)) return false; - if (with != null ? !with.equals(that.with) : that.with != null) return false; - - return true; - } - - public StreamController.User[] getUsers() { - return users; - } - - @Override - public int hashCode() { - int result = users != null ? Arrays.hashCode(users) : 0; - result = 31 * result + (includeFollowingsActivity ? 1 : 0); - result = 31 * result + (includeUserChanges ? 1 : 0); - result = 31 * result + (replies != null ? replies.hashCode() : 0); - result = 31 * result + (with != null ? with.hashCode() : 0); - return result; - } - - public boolean isIncludeFollowingsActivity() { - return includeFollowingsActivity; - } - - public boolean isIncludeUserChanges() { - return includeUserChanges; - } - - public String isReplies() { - return replies; - } - - public String isWith() { - return with; - } - - @Override - public String toString() { - return "ControlStreamInfo{" + "users=" + (users == null ? null : Arrays.asList(users)) - + ", includeFollowingsActivity=" + includeFollowingsActivity + ", includeUserChanges=" - + includeUserChanges + ", replies='" + replies + '\'' + ", with='" + with + '\'' + '}'; - } -} \ No newline at end of file diff --git a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/FilterQuery.java b/twidere.component.twitter4j.streaming/src/main/java/twitter4j/FilterQuery.java deleted file mode 100644 index e6a363b74..000000000 --- a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/FilterQuery.java +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Copyright 2007 Yusuke Yamamoto - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package twitter4j; - -import java.util.ArrayList; -import java.util.Arrays; - -import twitter4j.http.HttpParameter; -import twitter4j.internal.util.InternalStringUtil; - -/** - * @author Yusuke Yamamoto - yusuke at mac.com - * @since Twitter4J 2.1.2 - */ -public final class FilterQuery implements java.io.Serializable { - private static final long serialVersionUID = 430966623248982833L; - private int count; - private long[] follow; - private String[] track; - private double[][] locations; - - /** - * Creates a new FilterQuery - */ - public FilterQuery() { - count = 0; - follow = null; - track = null; - locations = null; - } - - /** - * Creates a new FilterQuery - * - * @param count Indicates the number of previous statuses to stream before - * transitioning to the live stream. - * @param follow Specifies the users, by ID, to receive public tweets from. - */ - public FilterQuery(final int count, final long[] follow) { - this(); - this.count = count; - this.follow = follow; - } - - /** - * Creates a new FilterQuery - * - * @param count Indicates the number of previous statuses to stream before - * transitioning to the live stream. - * @param follow Specifies the users, by ID, to receive public tweets from. - * @param track Specifies keywords to track. - */ - public FilterQuery(final int count, final long[] follow, final String[] track) { - this(); - this.count = count; - this.follow = follow; - this.track = track; - } - - /** - * Creates a new FilterQuery - * - * @param count Indicates the number of previous statuses to stream before - * transitioning to the live stream. - * @param follow Specifies the users, by ID, to receive public tweets from. - * @param track Specifies keywords to track. - * @param locations Specifies the locations to track. 2D array - */ - public FilterQuery(final int count, final long[] follow, final String[] track, final double[][] locations) { - this.count = count; - this.follow = follow; - this.track = track; - this.locations = locations; - } - - /** - * Creates a new FilterQuery - * - * @param follow Specifies the users, by ID, to receive public tweets from. - */ - public FilterQuery(final long[] follow) { - this(); - count = 0; - this.follow = follow; - } - - /** - * Sets count - * - * @param count Indicates the number of previous statuses to stream before - * transitioning to the live stream. - * @return this instance - */ - public FilterQuery count(final int count) { - this.count = count; - return this; - } - - @Override - public boolean equals(final Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - final FilterQuery that = (FilterQuery) o; - - if (count != that.count) return false; - if (!Arrays.equals(follow, that.follow)) return false; - if (!Arrays.equals(track, that.track)) return false; - - return true; - } - - /** - * Sets follow - * - * @param follow Specifies the users, by ID, to receive public tweets from. - * @return this instance - */ - public FilterQuery follow(final long[] follow) { - this.follow = follow; - return this; - } - - @Override - public int hashCode() { - int result = count; - result = 31 * result + (follow != null ? Arrays.hashCode(follow) : 0); - result = 31 * result + (track != null ? Arrays.hashCode(track) : 0); - return result; - } - - /** - * Sets locations - * - * @param locations Specifies the locations to track. 2D array - * @return this instance - */ - public FilterQuery locations(final double[][] locations) { - this.locations = locations; - return this; - } - - @Override - public String toString() { - return "FilterQuery{" + "count=" + count + ", follow=" + Arrays.toString(follow) + ", track=" - + (track == null ? null : Arrays.asList(track)) + ", locations=" - + (locations == null ? null : Arrays.asList(locations)) + '}'; - } - - /** - * Sets track - * - * @param track Specifies keywords to track. - * @return this instance - */ - public FilterQuery track(final String[] track) { - this.track = track; - return this; - } - - private String toLocationsString(final double[][] keywords) { - final StringBuilder buf = new StringBuilder(20 * keywords.length * 2); - for (final double[] keyword : keywords) { - if (0 != buf.length()) { - buf.append(","); - } - buf.append(keyword[0]); - buf.append(","); - buf.append(keyword[1]); - } - return buf.toString(); - } - - /* package */HttpParameter[] asHttpParameterArray(final HttpParameter stallWarningsParam) { - final ArrayList params = new ArrayList(); - - params.add(new HttpParameter("count", count)); - if (follow != null && follow.length > 0) { - params.add(new HttpParameter("follow", InternalStringUtil.join(follow))); - } - if (track != null && track.length > 0) { - params.add(new HttpParameter("track", InternalStringUtil.join(track))); - } - if (locations != null && locations.length > 0) { - params.add(new HttpParameter("locations", toLocationsString(locations))); - } - params.add(stallWarningsParam); - final HttpParameter[] paramArray = new HttpParameter[params.size()]; - return params.toArray(paramArray); - } -} diff --git a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/RawStreamListener.java b/twidere.component.twitter4j.streaming/src/main/java/twitter4j/RawStreamListener.java deleted file mode 100644 index beb1f16cb..000000000 --- a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/RawStreamListener.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2007 Yusuke Yamamoto - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package twitter4j; - -/** - * @author Yusuke Yamamoto - yusuke at mac.com - * @since Twitter4J 3.0.2 - */ -public interface RawStreamListener extends StreamListener { - void onMessage(String rawString); -} diff --git a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/SiteStreamsAdapter.java b/twidere.component.twitter4j.streaming/src/main/java/twitter4j/SiteStreamsAdapter.java deleted file mode 100644 index 6287c2ec4..000000000 --- a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/SiteStreamsAdapter.java +++ /dev/null @@ -1,95 +0,0 @@ -package twitter4j; - -/** - * @author Yusuke Yamamoto - yusuke at mac.com - * @since Twitter4J 2.1.8 - */ -public class SiteStreamsAdapter implements SiteStreamsListener { - @Override - public void onBlock(final long forUser, final User source, final User blockedUser) { - } - - @Override - public void onDeletionNotice(final long forUser, final long directMessageId, final long userId) { - } - - @Override - public void onDeletionNotice(final long forUser, final StatusDeletionNotice statusDeletionNotice) { - } - - @Override - public void onDirectMessage(final long forUser, final DirectMessage directMessage) { - } - - @Override - public void onDisconnectionNotice(final String screenName) { - } - - @Override - public void onException(final Exception ex) { - } - - @Override - public void onFavorite(final long forUser, final User source, final User target, final Status favoritedStatus) { - } - - @Override - public void onFollow(final long forUser, final User source, final User followedUser) { - } - - @Override - public void onFriendList(final long forUser, final long[] friendIds) { - } - - @Override - public void onStatus(final long forUser, final Status status) { - } - - @Override - public void onUnblock(final long forUser, final User source, final User unblockedUser) { - } - - @Override - public void onUnfavorite(final long forUser, final User source, final User target, final Status unfavoritedStatus) { - } - - @Override - public void onUnfollow(final long forUser, final User source, final User followedUser) { - } - - @Override - public void onUserListCreation(final long forUser, final User listOwner, final UserList list) { - } - - @Override - public void onUserListDeletion(final long forUser, final User listOwner, final UserList list) { - } - - @Override - public void onUserListMemberAddition(final long forUser, final User addedUser, final User listOwner, - final UserList list) { - } - - @Override - public void onUserListMemberDeletion(final long forUser, final User deletedUser, final User listOwner, - final UserList list) { - } - - @Override - public void onUserListSubscription(final long forUser, final User subscriber, final User listOwner, - final UserList list) { - } - - @Override - public void onUserListUnsubscription(final long forUser, final User subscriber, final User listOwner, - final UserList list) { - } - - @Override - public void onUserListUpdate(final long forUser, final User listOwner, final UserList list) { - } - - @Override - public void onUserProfileUpdate(final long forUser, final User updatedUser) { - } -} diff --git a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/SiteStreamsImpl.java b/twidere.component.twitter4j.streaming/src/main/java/twitter4j/SiteStreamsImpl.java deleted file mode 100755 index fad0cd4ff..000000000 --- a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/SiteStreamsImpl.java +++ /dev/null @@ -1,281 +0,0 @@ -/* - * Copyright 2007 Yusuke Yamamoto - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package twitter4j; - -import java.io.IOException; -import java.io.InputStream; - -import org.json.JSONException; -import org.json.JSONObject; - -import twitter4j.conf.StreamConfiguration; -import twitter4j.http.HttpResponse; -import twitter4j.internal.async.Dispatcher; -import twitter4j.internal.util.InternalParseUtil; - -/** - * @author Yusuke Yamamoto - yusuke at mac.com - * @since Twitter4J 2.1.8 - */ -class SiteStreamsImpl extends StatusStreamBase { - - private final StreamController cs; - - private static ThreadLocal forUser = new ThreadLocal() { - @Override - protected Integer initialValue() { - return 0; - } - }; - - protected static final RawStreamListener[] EMPTY = new RawStreamListener[0]; - - /* package */SiteStreamsImpl(final Dispatcher dispatcher, final HttpResponse response, - final StreamConfiguration conf, final StreamController cs) throws IOException { - super(dispatcher, response, conf); - this.cs = cs; - } - - /* package */SiteStreamsImpl(final Dispatcher dispatcher, final InputStream stream, final StreamConfiguration conf, - final StreamController cs) throws IOException { - super(dispatcher, stream, conf); - this.cs = cs; - } - - @Override - public void next(final StatusListener listener) throws TwitterException { - handleNextElement(new StatusListener[] { listener }, EMPTY); - } - - @Override - public void next(final StreamListener[] listeners, final RawStreamListener[] rawStreamListeners) - throws TwitterException { - handleNextElement(listeners, rawStreamListeners); - } - - @Override - public void onDisconnectionNotice(final String line, final StreamListener[] listeners) { - for (final StreamListener listener : listeners) { - ((SiteStreamsListener) listener).onDisconnectionNotice(line); - } - } - - @Override - public void onException(final Exception ex, final StreamListener[] listeners) { - for (final StreamListener listener : listeners) { - listener.onException(ex); - } - } - - @Override - protected void onBlock(final JSONObject source, final JSONObject target, final StreamListener[] listeners) - throws TwitterException { - for (final StreamListener listener : listeners) { - ((SiteStreamsListener) listener).onBlock(forUser.get(), asUser(source), asUser(target)); - } - } - - @Override - protected void onDelete(final JSONObject json, final StreamListener[] listeners) throws JSONException { - final JSONObject deletionNotice = json.getJSONObject("delete"); - if (deletionNotice.has("status")) { - for (final StreamListener listener : listeners) { - ((SiteStreamsListener) listener).onDeletionNotice(forUser.get(), new StatusDeletionNoticeImpl( - deletionNotice.getJSONObject("status"))); - } - } else { - final JSONObject directMessage = deletionNotice.getJSONObject("direct_message"); - for (final StreamListener listener : listeners) { - ((SiteStreamsListener) listener).onDeletionNotice(forUser.get(), - InternalParseUtil.getInt("id", directMessage), - InternalParseUtil.getLong("user_id", directMessage)); - } - } - } - - @Override - protected void onDirectMessage(final JSONObject json, final StreamListener[] listeners) throws TwitterException { - for (final StreamListener listener : listeners) { - ((SiteStreamsListener) listener).onDirectMessage(forUser.get(), asDirectMessage(json)); - } - } - - @Override - protected void onFavorite(final JSONObject source, final JSONObject target, final JSONObject targetObject, - final StreamListener[] listeners) throws TwitterException { - for (final StreamListener listener : listeners) { - ((SiteStreamsListener) listener).onFavorite(forUser.get(), asUser(source), asUser(target), - asStatus(targetObject)); - } - } - - @Override - protected void onFollow(final JSONObject source, final JSONObject target, final StreamListener[] listeners) - throws TwitterException { - for (final StreamListener listener : listeners) { - ((SiteStreamsListener) listener).onFollow(forUser.get(), asUser(source), asUser(target)); - } - } - - @Override - protected void onFriends(final JSONObject json, final StreamListener[] listeners) throws TwitterException, - JSONException { - for (final StreamListener listener : listeners) { - ((SiteStreamsListener) listener).onFriendList(forUser.get(), asFriendList(json)); - } - } - - @Override - protected void onMessage(final String rawString, final RawStreamListener[] listeners) throws TwitterException { - for (final RawStreamListener listener : listeners) { - listener.onMessage(rawString); - } - } - - @Override - protected void onStatus(final JSONObject json, final StreamListener[] listeners) throws TwitterException { - for (final StreamListener listener : listeners) { - ((SiteStreamsListener) listener).onStatus(forUser.get(), asStatus(json)); - } - } - - @Override - protected void onUnblock(final JSONObject source, final JSONObject target, final StreamListener[] listeners) - throws TwitterException { - for (final StreamListener listener : listeners) { - ((SiteStreamsListener) listener).onUnblock(forUser.get(), asUser(source), asUser(target)); - } - } - - @Override - protected void onUnfavorite(final JSONObject source, final JSONObject target, final JSONObject targetObject, - final StreamListener[] listeners) throws TwitterException { - for (final StreamListener listener : listeners) { - ((SiteStreamsListener) listener).onUnfavorite(forUser.get(), asUser(source), asUser(target), - asStatus(targetObject)); - } - } - - @Override - protected void onUnfollow(final JSONObject source, final JSONObject target, final StreamListener[] listeners) - throws TwitterException { - for (final StreamListener listener : listeners) { - ((SiteStreamsListener) listener).onUnfollow(forUser.get(), asUser(source), asUser(target)); - } - } - - @Override - protected void onUserListCreation(final JSONObject source, final JSONObject userList, - final StreamListener[] listeners) throws TwitterException, JSONException { - for (final StreamListener listener : listeners) { - ((SiteStreamsListener) listener).onUserListCreation(forUser.get(), asUser(source), asUserList(userList)); - } - } - - @Override - protected void onUserListDestroyed(final JSONObject source, final JSONObject userList, - final StreamListener[] listeners) throws TwitterException { - for (final StreamListener listener : listeners) { - ((SiteStreamsListener) listener).onUserListDeletion(forUser.get(), asUser(source), asUserList(userList)); - } - } - - @Override - protected void onUserListMemberAddition(final JSONObject addedMember, final JSONObject owner, - final JSONObject userList, final StreamListener[] listeners) throws TwitterException, JSONException { - for (final StreamListener listener : listeners) { - ((SiteStreamsListener) listener).onUserListMemberAddition(forUser.get(), asUser(addedMember), - asUser(owner), asUserList(userList)); - } - } - - @Override - protected void onUserListMemberDeletion(final JSONObject deletedMember, final JSONObject owner, - final JSONObject userList, final StreamListener[] listeners) throws TwitterException, JSONException { - for (final StreamListener listener : listeners) { - ((SiteStreamsListener) listener).onUserListMemberDeletion(forUser.get(), asUser(deletedMember), - asUser(owner), asUserList(userList)); - } - } - - @Override - protected void onUserListSubscription(final JSONObject source, final JSONObject owner, final JSONObject userList, - final StreamListener[] listeners) throws TwitterException, JSONException { - for (final StreamListener listener : listeners) { - ((SiteStreamsListener) listener).onUserListSubscription(forUser.get(), asUser(source), asUser(owner), - asUserList(userList)); - } - } - - @Override - protected void onUserListUnsubscription(final JSONObject source, final JSONObject owner, final JSONObject userList, - final StreamListener[] listeners) throws TwitterException, JSONException { - for (final StreamListener listener : listeners) { - ((SiteStreamsListener) listener).onUserListUnsubscription(forUser.get(), asUser(source), asUser(owner), - asUserList(userList)); - } - } - - @Override - protected void onUserListUpdated(final JSONObject source, final JSONObject userList, - final StreamListener[] listeners) throws TwitterException, JSONException { - for (final StreamListener listener : listeners) { - ((SiteStreamsListener) listener).onUserListUpdate(forUser.get(), asUser(source), asUserList(userList)); - } - } - - @Override - protected void onUserUpdate(final JSONObject source, final JSONObject target, final StreamListener[] listeners) - throws TwitterException { - for (final StreamListener listener : listeners) { - ((SiteStreamsListener) listener).onUserProfileUpdate(forUser.get(), asUser(source)); - } - } - - @Override - protected String parseLine(final String line) { - if ("".equals(line) || null == line) return line; - final int userIdEnd = line.indexOf(',', 12); - // in the documentation for_user is not quoted, but actually it is - // quoted - if (cs.getControlURI() == null && line.charAt(2) == 'c' && line.charAt(3) == 'o' && line.charAt(4) == 'n') { - // control endpoint uri - // https://dev.twitter.com/docs/streaming-api/control-streams - JSONObject control = null; - try { - control = new JSONObject(line); - cs.setControlURI(CONF.getSiteStreamBaseURL() - + control.getJSONObject("control").getString("control_uri")); - logger.info("control_uri: " + cs.getControlURI()); - } catch (final JSONException e) { - logger.warn("received unexpected event:" + line); - } - return null; - } - - if (line.charAt(2) == 'd') // disconnection notice - // {"disconnect":{"code":3,"stream_name":"yusuke-sitestream6139-yusuke","reason":"control request for yusuke-sitestream6139 106.171.17.29 /1.1/site.json sitestream"}} - return line; - if (line.charAt(12) == '"') { - forUser.set(Integer.parseInt(line.substring(13, userIdEnd - 1))); - } else { - forUser.set(Integer.parseInt(line.substring(12, userIdEnd))); - } - return line.substring(userIdEnd + 11, line.length() - 1); - } - -} \ No newline at end of file diff --git a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/SiteStreamsListener.java b/twidere.component.twitter4j.streaming/src/main/java/twitter4j/SiteStreamsListener.java deleted file mode 100644 index 33a91109f..000000000 --- a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/SiteStreamsListener.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Twidere - Twitter client for Android - * - * Copyright (C) 2012-2015 Mariotaku Lee - * - * 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 . - */ - -package twitter4j; - -/** - * @author Yusuke Yamamoto - yusuke at mac.com - * @since Twitter4J 2.1.8 - */ -public interface SiteStreamsListener extends StreamListener { - /** - * @param forUser the user id to whom sent the event - * @param source - * @param blockedUser - */ - void onBlock(long forUser, User source, User blockedUser); - - void onDeletionNotice(long forUser, long directMessageId, long userId); - - void onDeletionNotice(long forUser, StatusDeletionNotice statusDeletionNotice); - - /** - * @param forUser the user id to whom sent the event - * @param directMessage - */ - void onDirectMessage(long forUser, DirectMessage directMessage); - - /** - * callback method for {@link twitter4j.StreamController#removeUsers(long[])} - */ - void onDisconnectionNotice(String line); - - @Override - void onException(Exception ex); - - /** - * @param forUser the user id to whom sent the event - * @param source - * @param target - * @param favoritedStatus - */ - void onFavorite(long forUser, User source, User target, Status favoritedStatus); - - /** - * @param forUser the user id to whom sent the event - * @param source - * @param followedUser - */ - void onFollow(long forUser, User source, User followedUser); - - /** - * @param forUser the user id to whom sent the event - * @param friendIds - */ - void onFriendList(long forUser, long[] friendIds); - - void onStatus(long forUser, Status status); - - /** - * @param forUser the user id to whom sent the event - * @param source - * @param unblockedUser - */ - void onUnblock(long forUser, User source, User unblockedUser); - - /** - * @param forUser the user id to whom sent the event - * @param target - * @param unfavoritedStatus - */ - void onUnfavorite(long forUser, User source, User target, Status unfavoritedStatus); - - /** - * @param forUser the user id to whom sent the event - * @param source - * @param unfollowedUser - * @since Twitter4J 2.1.11 - */ - void onUnfollow(long forUser, User source, User unfollowedUser); - - /** - * @param forUser the user id to whom sent the event - * @param listOwner - * @param list - */ - void onUserListCreation(long forUser, User listOwner, UserList list); - - /** - * @param forUser the user id to whom sent the event - * @param listOwner - * @param list - */ - void onUserListDeletion(long forUser, User listOwner, UserList list); - - /** - * @param forUser the user id to whom sent the event - * @param addedMember - * @param listOwner - * @param list - */ - void onUserListMemberAddition(long forUser, User addedMember, User listOwner, UserList list); - - /** - * @param forUser the user id to whom sent the event - * @param deletedMember - * @param listOwner - * @param list - */ - void onUserListMemberDeletion(long forUser, User deletedMember, User listOwner, UserList list); - - /** - * @param forUser the user id to whom sent the event - * @param subscriber - * @param listOwner - * @param list - */ - void onUserListSubscription(long forUser, User subscriber, User listOwner, UserList list); - - /** - * @param forUser the user id to whom sent the event - * @param subscriber - * @param listOwner - * @param list - */ - void onUserListUnsubscription(long forUser, User subscriber, User listOwner, UserList list); - - /** - * @param forUser the user id to whom sent the event - * @param listOwner - * @param list - */ - void onUserListUpdate(long forUser, User listOwner, UserList list); - - /** - * @param forUser the user id to whom sent the event - * @param updatedUser updated user - * @since Twitter4J 2.1.9 - */ - void onUserProfileUpdate(long forUser, User updatedUser); -} diff --git a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/StallWarning.java b/twidere.component.twitter4j.streaming/src/main/java/twitter4j/StallWarning.java deleted file mode 100644 index 15926a6e8..000000000 --- a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/StallWarning.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2007 Yusuke Yamamoto - * Copyright (C) 2012 Twitter, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package twitter4j; - -import static twitter4j.internal.util.InternalParseUtil.getInt; -import static twitter4j.internal.util.InternalParseUtil.getRawString; - -import java.io.Serializable; - -import org.json.JSONException; -import org.json.JSONObject; - -/** - * @author Yusuke Yamamoto - yusuke at twitter.com - * @since Twitter4J 3.0.0 - */ -public final class StallWarning implements Serializable { - private static final long serialVersionUID = 7387184309206228363L; - private final String code; - private final String message; - private final int percentFull; - - StallWarning(final JSONObject json) throws JSONException { - final JSONObject warning = json.getJSONObject("warning"); - code = getRawString("code", warning); - message = getRawString("message", warning); - percentFull = getInt("percent_full", warning); - - } - - @Override - public boolean equals(final Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - final StallWarning that = (StallWarning) o; - - if (percentFull != that.percentFull) return false; - if (code != null ? !code.equals(that.code) : that.code != null) return false; - if (message != null ? !message.equals(that.message) : that.message != null) return false; - - return true; - } - - public String getCode() { - return code; - } - - public String getMessage() { - return message; - } - - public int getPercentFull() { - return percentFull; - } - - @Override - public int hashCode() { - int result = code != null ? code.hashCode() : 0; - result = 31 * result + (message != null ? message.hashCode() : 0); - result = 31 * result + percentFull; - return result; - } - - @Override - public String toString() { - return "StallWarning{" + "code='" + code + '\'' + ", message='" + message + '\'' + ", percentFull=" - + percentFull + '}'; - } -} diff --git a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/StatusAdapter.java b/twidere.component.twitter4j.streaming/src/main/java/twitter4j/StatusAdapter.java deleted file mode 100644 index c154e9f5c..000000000 --- a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/StatusAdapter.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2007 Yusuke Yamamoto - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package twitter4j; - -/** - * @author yusuke at mac.com - * @since Twitter4J 2.1.3 - */ -public class StatusAdapter implements StatusListener { - @Override - public void onDeletionNotice(final StatusDeletionNotice statusDeletionNotice) { - } - - @Override - public void onException(final Exception ex) { - } - - @Override - public void onScrubGeo(final long userId, final long upToStatusId) { - } - - @Override - public void onStallWarning(final StallWarning warning) { - } - - @Override - public void onStatus(final Status status) { - } - - @Override - public void onTrackLimitationNotice(final int numberOfLimitedStatuses) { - } -} diff --git a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/StatusDeletionNotice.java b/twidere.component.twitter4j.streaming/src/main/java/twitter4j/StatusDeletionNotice.java deleted file mode 100644 index e93d1ca20..000000000 --- a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/StatusDeletionNotice.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2007 Yusuke Yamamoto - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package twitter4j; - -/** - * A data class representing Status deletionNotice
- * Clients are urged to honor deletionNotice requests and discard deleted - * statuses immediately. At times, status deletionNotice messages may arrive - * before the status. Even in this case, the late arriving status should be - * deleted from your backing store. - * - * @author Yusuke Yamamoto - yusuke at mac.com - * @since Twitter4J 2.1.0 - */ -public interface StatusDeletionNotice extends Comparable, java.io.Serializable { - long getStatusId(); - - long getUserId(); -} diff --git a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/StatusDeletionNoticeImpl.java b/twidere.component.twitter4j.streaming/src/main/java/twitter4j/StatusDeletionNoticeImpl.java deleted file mode 100644 index 4853ffa17..000000000 --- a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/StatusDeletionNoticeImpl.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2007 Yusuke Yamamoto - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package twitter4j; - -import org.json.JSONObject; - -import twitter4j.internal.util.InternalParseUtil; - -/** - * StatusDeletionNotice implementation. This class is NOT intended to be - * extended but left non-final for the ease of mock testing. - * - * @author Yusuke Yamamoto - yusuke at mac.com - * @since Twitter4J 2.1.2 - */ -class StatusDeletionNoticeImpl implements StatusDeletionNotice, java.io.Serializable { - - private final long statusId; - private final long userId; - private static final long serialVersionUID = 1723338404242596062L; - - /* package */StatusDeletionNoticeImpl(final JSONObject status) { - statusId = InternalParseUtil.getLong("id", status); - userId = InternalParseUtil.getLong("user_id", status); - } - - @Override - public int compareTo(final StatusDeletionNotice that) { - final long delta = statusId - that.getStatusId(); - if (delta < Integer.MIN_VALUE) - return Integer.MIN_VALUE; - else if (delta > Integer.MAX_VALUE) return Integer.MAX_VALUE; - return (int) delta; - } - - @Override - public boolean equals(final Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - final StatusDeletionNoticeImpl that = (StatusDeletionNoticeImpl) o; - - if (statusId != that.statusId) return false; - if (userId != that.userId) return false; - - return true; - } - - @Override - public long getStatusId() { - return statusId; - } - - @Override - public long getUserId() { - return userId; - } - - @Override - public int hashCode() { - int result = (int) (statusId ^ statusId >>> 32); - result = 31 * result + (int) (userId ^ userId >>> 32); - return result; - } - - @Override - public String toString() { - return "StatusDeletionNoticeImpl{" + "statusId=" + statusId + ", userId=" + userId + '}'; - } -} diff --git a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/StatusListener.java b/twidere.component.twitter4j.streaming/src/main/java/twitter4j/StatusListener.java deleted file mode 100644 index 4e146a707..000000000 --- a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/StatusListener.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright 2007 Yusuke Yamamoto - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package twitter4j; - -/** - * @author Yusuke Yamamoto - yusuke at mac.com - * @since Twitter4J 2.0.4 - */ -public interface StatusListener extends StreamListener { - /** - * Called upon deletionNotice notices. Clients are urged to honor - * deletionNotice requests and discard deleted statuses immediately. At - * times, status deletionNotice messages may arrive before the status. Even - * in this case, the late arriving status should be deleted from your - * backing store. - * - * @param statusDeletionNotice the deletionNotice notice - * @see Streaming - * API Concepts | Twitter Developers - * @since Twitter4J 2.1.0 - */ - void onDeletionNotice(StatusDeletionNotice statusDeletionNotice); - - /** - * Called upon location deletion messages. Clients are urged to honor - * deletion requests and remove appropriate geolocation information from - * both the display and your backing store immediately. Note that in some - * cases the location deletion message may arrive before a tweet that lies - * within the deletion range arrives. You should still strip the location - * data. - * - * @param userId user id - * @param upToStatusId up to status id - * @since Twitter4J 2.1.9 - */ - void onScrubGeo(long userId, long upToStatusId); - - /** - * Called when receiving stall warnings. - * - * @param warning StallWaning - * @see Streaming - * API request parameters - stall_warnings - * @since Twitter4J 3.0.0 - */ - void onStallWarning(StallWarning warning); - - void onStatus(Status status); - - /** - * This notice will be sent each time a limited stream becomes unlimited.
- * If this number is high and or rapidly increasing, it is an indication - * that your predicate is too broad, and you should consider a predicate - * with higher selectivity. - * - * @param numberOfLimitedStatuses an enumeration of statuses that matched - * the track predicate but were administratively limited. - * @see Streaming - * API Concepts - Filter Limiting | Twitter Developers - * @see Streaming - * API Concepts - Parsing Responses | Twitter Developers - * @see Twitter - * Development Talk - Track API Limit message meaning - * @since Twitter4J 2.1.0 - */ - void onTrackLimitationNotice(int numberOfLimitedStatuses); -} diff --git a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/StatusStream.java b/twidere.component.twitter4j.streaming/src/main/java/twitter4j/StatusStream.java deleted file mode 100644 index 18065bb06..000000000 --- a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/StatusStream.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2007 Yusuke Yamamoto - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package twitter4j; - -import java.io.IOException; - -/** - * @author Yusuke Yamamoto - yusuke at mac.com - * @since Twitter4J 2.0.4 - */ -public interface StatusStream { - - void close() throws IOException; - - /** - * Reads next status from this stream. - * - * @param listener a StatusListener implementation - * @throws TwitterException when the end of the stream has been reached. - * @throws IllegalStateException when the end of the stream had been - * reached. - */ - void next(StatusListener listener) throws TwitterException; -} diff --git a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/StatusStreamBase.java b/twidere.component.twitter4j.streaming/src/main/java/twitter4j/StatusStreamBase.java deleted file mode 100755 index 27bb14f87..000000000 --- a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/StatusStreamBase.java +++ /dev/null @@ -1,418 +0,0 @@ -/* - * Copyright 2007 Yusuke Yamamoto - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package twitter4j; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; - -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; - -import twitter4j.conf.StreamConfiguration; -import twitter4j.http.HttpResponse; -import twitter4j.internal.async.Dispatcher; -import twitter4j.internal.json.DataObjectFactoryUtil; -import twitter4j.internal.json.InternalJSONFactory; -import twitter4j.internal.json.InternalJSONFactoryImpl; -import twitter4j.internal.logging.Logger; -import twitter4j.json.JSONObjectType; - -/** - * @author Yusuke Yamamoto - yusuke at mac.com - * @since Twitter4J 2.1.8 - */ -abstract class StatusStreamBase implements StatusStream { - protected static final Logger logger = Logger.getLogger(StatusStreamImpl.class); - - private boolean streamAlive = true; - private final BufferedReader br; - private final InputStream is; - private HttpResponse response; - protected final Dispatcher dispatcher; - protected final StreamConfiguration CONF; - protected InternalJSONFactory factory; - - /* package */ - - StatusStreamBase(final Dispatcher dispatcher, final HttpResponse response, final StreamConfiguration conf) - throws IOException { - this(dispatcher, response.asStream(), conf); - this.response = response; - } - - StatusStreamBase(final Dispatcher dispatcher, final InputStream stream, final StreamConfiguration conf) - throws IOException { - is = stream; - br = new BufferedReader(new InputStreamReader(stream, "UTF-8")); - this.dispatcher = dispatcher; - CONF = conf; - factory = new InternalJSONFactoryImpl(conf); - } - - /* package */ - - @Override - public void close() throws IOException { - streamAlive = false; - is.close(); - br.close(); - if (response != null) { - response.disconnect(); - } - } - - @Override - public abstract void next(StatusListener listener) throws TwitterException; - - public abstract void next(StreamListener[] listeners, RawStreamListener[] rawStreamListeners) - throws TwitterException; - - public void onException(final Exception e, final StreamListener[] listeners, - final RawStreamListener[] rawStreamListeners) { - for (final StreamListener listener : listeners) { - listener.onException(e); - } - for (final RawStreamListener listener : rawStreamListeners) { - listener.onException(e); - } - } - - protected DirectMessage asDirectMessage(final JSONObject json) throws TwitterException { - DirectMessage directMessage; - try { - directMessage = factory.createDirectMessage(json.getJSONObject("direct_message")); - } catch (final JSONException e) { - throw new TwitterException(e); - } - if (CONF.isJSONStoreEnabled()) { - DataObjectFactoryUtil.registerJSONObject(directMessage, json); - } - return directMessage; - } - - protected long[] asFriendList(final JSONObject json) throws TwitterException { - JSONArray friends; - try { - friends = json.getJSONArray("friends"); - final long[] friendIds = new long[friends.length()]; - for (int i = 0; i < friendIds.length; ++i) { - friendIds[i] = Long.parseLong(friends.getString(i)); - } - return friendIds; - } catch (final JSONException e) { - throw new TwitterException(e); - } - } - - protected Status asStatus(final JSONObject json) throws TwitterException { - final Status status = factory.createStatus(json); - if (CONF.isJSONStoreEnabled()) { - DataObjectFactoryUtil.registerJSONObject(status, json); - } - return status; - } - - protected User asUser(final JSONObject json) throws TwitterException { - final User user = factory.createUser(json); - if (CONF.isJSONStoreEnabled()) { - DataObjectFactoryUtil.registerJSONObject(user, json); - } - return user; - } - - protected UserList asUserList(final JSONObject json) throws TwitterException { - final UserList userList = factory.createAUserList(json); - if (CONF.isJSONStoreEnabled()) { - DataObjectFactoryUtil.registerJSONObject(userList, json); - } - return userList; - } - - protected void handleNextElement(final StreamListener[] listeners, final RawStreamListener[] rawStreamListeners) - throws TwitterException { - if (!streamAlive) throw new IllegalStateException("Stream already closed."); - try { - final String line = br.readLine(); - if (null == line) // invalidate this status stream - throw new IOException("the end of the stream has been reached"); - dispatcher.invokeLater(new StreamEvent(line) { - @Override - public void run() { - try { - if (rawStreamListeners.length > 0) { - onMessage(line, rawStreamListeners); - } - // SiteStreamsImpl will parse "forUser" attribute - line = parseLine(line); - if (line != null && line.length() > 0) { - // parsing JSON is an expensive process and can be - // avoided when all listeners are instanceof - // RawStreamListener - if (listeners.length > 0) { - if (CONF.isJSONStoreEnabled()) { - DataObjectFactoryUtil.clearThreadLocalMap(); - } - final JSONObject json = new JSONObject(line); - final JSONObjectType.Type event = JSONObjectType.determine(json); - if (logger.isDebugEnabled()) { - logger.debug("Received:", - CONF.isPrettyDebugEnabled() ? json.toString(1) : json.toString()); - } - switch (event) { - case SENDER: - onSender(json, listeners); - break; - case STATUS: - onStatus(json, listeners); - break; - case DIRECT_MESSAGE: - onDirectMessage(json, listeners); - break; - case DELETE: - onDelete(json, listeners); - break; - case LIMIT: - onLimit(json, listeners); - break; - case STALL_WARNING: - onStallWarning(json, listeners); - break; - case SCRUB_GEO: - onScrubGeo(json, listeners); - break; - case FRIENDS: - onFriends(json, listeners); - break; - case FAVORITE: - onFavorite(json.getJSONObject("source"), json.getJSONObject("target"), - json.getJSONObject("target_object"), listeners); - break; - case UNFAVORITE: - onUnfavorite(json.getJSONObject("source"), json.getJSONObject("target"), - json.getJSONObject("target_object"), listeners); - break; - case FOLLOW: - onFollow(json.getJSONObject("source"), json.getJSONObject("target"), listeners); - break; - case UNFOLLOW: - onUnfollow(json.getJSONObject("source"), json.getJSONObject("target"), - listeners); - break; - case USER_LIST_MEMBER_ADDED: - onUserListMemberAddition(json.getJSONObject("target"), - json.getJSONObject("source"), json.getJSONObject("target_object"), - listeners); - break; - case USER_LIST_MEMBER_DELETED: - onUserListMemberDeletion(json.getJSONObject("target"), - json.getJSONObject("source"), json.getJSONObject("target_object"), - listeners); - break; - case USER_LIST_SUBSCRIBED: - onUserListSubscription(json.getJSONObject("source"), - json.getJSONObject("target"), json.getJSONObject("target_object"), - listeners); - break; - case USER_LIST_UNSUBSCRIBED: - onUserListUnsubscription(json.getJSONObject("source"), - json.getJSONObject("target"), json.getJSONObject("target_object"), - listeners); - break; - case USER_LIST_CREATED: - onUserListCreation(json.getJSONObject("source"), json.getJSONObject("target"), - listeners); - break; - case USER_LIST_UPDATED: - onUserListUpdated(json.getJSONObject("source"), json.getJSONObject("target"), - listeners); - break; - case USER_LIST_DESTROYED: - onUserListDestroyed(json.getJSONObject("source"), json.getJSONObject("target"), - listeners); - break; - case USER_UPDATE: - onUserUpdate(json.getJSONObject("source"), json.getJSONObject("target"), - listeners); - break; - case BLOCK: - onBlock(json.getJSONObject("source"), json.getJSONObject("target"), listeners); - break; - case UNBLOCK: - onUnblock(json.getJSONObject("source"), json.getJSONObject("target"), listeners); - break; - case DISCONNECTION: - onDisconnectionNotice(line, listeners); - break; - case UNKNOWN: - default: - logger.warn("Received unknown event:", - CONF.isPrettyDebugEnabled() ? json.toString(1) : json.toString()); - } - } - } - } catch (final Exception ex) { - onException(ex, listeners); - } - } - }); - - } catch (final IOException ioe) { - try { - is.close(); - } catch (final IOException ignore) { - } - final boolean isUnexpectedException = streamAlive; - streamAlive = false; - if (isUnexpectedException) throw new TwitterException("Stream closed.", ioe); - } - } - - protected void onBlock(final JSONObject source, final JSONObject target, final StreamListener[] listeners) - throws TwitterException { - logger.warn("Unhandled event: onBlock"); - } - - protected void onDelete(final JSONObject json, final StreamListener[] listeners) throws TwitterException, - JSONException { - logger.warn("Unhandled event: onDelete"); - } - - protected void onDirectMessage(final JSONObject json, final StreamListener[] listeners) throws TwitterException, - JSONException { - logger.warn("Unhandled event: onDirectMessage"); - } - - protected void onDisconnectionNotice(final String line, final StreamListener[] listeners) { - logger.warn("Unhandled event: ", line); - } - - protected void onException(final Exception e, final StreamListener[] listeners) { - logger.warn("Unhandled event: ", e.getMessage()); - } - - protected void onFavorite(final JSONObject source, final JSONObject target, final JSONObject targetObject, - final StreamListener[] listeners) throws TwitterException { - logger.warn("Unhandled event: onFavorite"); - } - - protected void onFollow(final JSONObject source, final JSONObject target, final StreamListener[] listeners) - throws TwitterException { - logger.warn("Unhandled event: onFollow"); - } - - protected void onFriends(final JSONObject json, final StreamListener[] listeners) throws TwitterException, - JSONException { - logger.warn("Unhandled event: onFriends"); - } - - protected void onLimit(final JSONObject json, final StreamListener[] listeners) throws TwitterException, - JSONException { - logger.warn("Unhandled event: onLimit"); - } - - protected void onMessage(final String rawString, final RawStreamListener[] listeners) throws TwitterException { - logger.warn("Unhandled event: onMessage"); - } - - protected void onScrubGeo(final JSONObject json, final StreamListener[] listeners) throws TwitterException, - JSONException { - logger.warn("Unhandled event: onScrubGeo"); - } - - protected void onSender(final JSONObject json, final StreamListener[] listeners) throws TwitterException { - logger.warn("Unhandled event: onSender"); - } - - protected void onStallWarning(final JSONObject json, final StreamListener[] listeners) throws TwitterException, - JSONException { - logger.warn("Unhandled event: onStallWarning"); - } - - protected void onStatus(final JSONObject json, final StreamListener[] listeners) throws TwitterException { - logger.warn("Unhandled event: onStatus"); - } - - protected void onUnblock(final JSONObject source, final JSONObject target, final StreamListener[] listeners) - throws TwitterException { - logger.warn("Unhandled event: onUnblock"); - } - - protected void onUnfavorite(final JSONObject source, final JSONObject target, final JSONObject targetObject, - final StreamListener[] listeners) throws TwitterException { - logger.warn("Unhandled event: onUnfavorite"); - } - - protected void onUnfollow(final JSONObject source, final JSONObject target, final StreamListener[] listeners) - throws TwitterException { - logger.warn("Unhandled event: onUnfollow"); - } - - protected void onUserListCreation(final JSONObject source, final JSONObject userList, - final StreamListener[] listeners) throws TwitterException, JSONException { - logger.warn("Unhandled event: onUserListCreation"); - } - - protected void onUserListDestroyed(final JSONObject source, final JSONObject userList, - final StreamListener[] listeners) throws TwitterException { - logger.warn("Unhandled event: onUserListDestroyed"); - } - - protected void onUserListMemberAddition(final JSONObject addedMember, final JSONObject owner, - final JSONObject userList, final StreamListener[] listeners) throws TwitterException, JSONException { - logger.warn("Unhandled event: onUserListMemberAddition"); - } - - protected void onUserListMemberDeletion(final JSONObject deletedMember, final JSONObject owner, - final JSONObject userList, final StreamListener[] listeners) throws TwitterException, JSONException { - logger.warn("Unhandled event: onUserListMemberDeletion"); - } - - protected void onUserListSubscription(final JSONObject source, final JSONObject owner, final JSONObject userList, - final StreamListener[] listeners) throws TwitterException, JSONException { - logger.warn("Unhandled event: onUserListSubscription"); - } - - protected void onUserListUnsubscription(final JSONObject source, final JSONObject owner, final JSONObject userList, - final StreamListener[] listeners) throws TwitterException, JSONException { - logger.warn("Unhandled event: onUserListUnsubscription"); - } - - protected void onUserListUpdated(final JSONObject source, final JSONObject userList, - final StreamListener[] listeners) throws TwitterException, JSONException { - logger.warn("Unhandled event: onUserListUpdated"); - } - - protected void onUserUpdate(final JSONObject source, final JSONObject target, final StreamListener[] listeners) - throws TwitterException { - logger.warn("Unhandled event: onUserUpdate"); - } - - protected String parseLine(final String line) { - return line; - } - - abstract class StreamEvent implements Runnable { - String line; - - StreamEvent(final String line) { - this.line = line; - } - } -} diff --git a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/StatusStreamImpl.java b/twidere.component.twitter4j.streaming/src/main/java/twitter4j/StatusStreamImpl.java deleted file mode 100644 index ec3da949d..000000000 --- a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/StatusStreamImpl.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright 2007 Yusuke Yamamoto - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package twitter4j; - -import java.io.IOException; -import java.io.InputStream; - -import org.json.JSONException; -import org.json.JSONObject; - -import twitter4j.conf.StreamConfiguration; -import twitter4j.http.HttpResponse; -import twitter4j.internal.async.Dispatcher; -import twitter4j.internal.util.InternalParseUtil; - -/** - * StatusStream implementation. This class is NOT intended to be extended but - * left non-final for the ease of mock testing. - * - * @author Yusuke Yamamoto - yusuke at mac.com - * @since Twitter4J 2.1.2 - */ -class StatusStreamImpl extends StatusStreamBase { - /* package */ - - protected String line; - - protected static final RawStreamListener[] EMPTY = new RawStreamListener[0]; - - StatusStreamImpl(final Dispatcher dispatcher, final HttpResponse response, final StreamConfiguration conf) - throws IOException { - super(dispatcher, response, conf); - } - - StatusStreamImpl(final Dispatcher dispatcher, final InputStream stream, final StreamConfiguration conf) - throws IOException { - super(dispatcher, stream, conf); - } - - /* package */ - @Override - public void next(final StatusListener listener) throws TwitterException { - handleNextElement(new StatusListener[] { listener }, EMPTY); - } - - @Override - public void next(final StreamListener[] listeners, final RawStreamListener[] rawStreamListeners) - throws TwitterException { - handleNextElement(listeners, rawStreamListeners); - } - - @Override - public void onException(final Exception e, final StreamListener[] listeners) { - for (final StreamListener listener : listeners) { - listener.onException(e); - } - } - - @Override - protected void onDelete(final JSONObject json, final StreamListener[] listeners) throws TwitterException, - JSONException { - for (final StreamListener listener : listeners) { - final JSONObject deletionNotice = json.getJSONObject("delete"); - if (deletionNotice.has("status")) { - ((StatusListener) listener).onDeletionNotice(new StatusDeletionNoticeImpl(deletionNotice - .getJSONObject("status"))); - } else { - final JSONObject directMessage = deletionNotice.getJSONObject("direct_message"); - ((UserStreamListener) listener).onDeletionNotice(InternalParseUtil.getLong("id", directMessage), - InternalParseUtil.getLong("user_id", directMessage)); - } - } - } - - @Override - protected void onLimit(final JSONObject json, final StreamListener[] listeners) throws TwitterException, - JSONException { - for (final StreamListener listener : listeners) { - ((StatusListener) listener).onTrackLimitationNotice(InternalParseUtil.getInt("track", - json.getJSONObject("limit"))); - } - } - - @Override - protected void onMessage(final String rawString, final RawStreamListener[] listeners) throws TwitterException { - for (final RawStreamListener listener : listeners) { - listener.onMessage(rawString); - } - } - - @Override - protected void onScrubGeo(final JSONObject json, final StreamListener[] listeners) throws TwitterException, - JSONException { - final JSONObject scrubGeo = json.getJSONObject("scrub_geo"); - for (final StreamListener listener : listeners) { - ((StatusListener) listener).onScrubGeo(InternalParseUtil.getLong("user_id", scrubGeo), - InternalParseUtil.getLong("up_to_status_id", scrubGeo)); - } - - } - - @Override - protected void onStallWarning(final JSONObject json, final StreamListener[] listeners) throws TwitterException, - JSONException { - for (final StreamListener listener : listeners) { - ((StatusListener) listener).onStallWarning(new StallWarning(json)); - } - } - - @Override - protected void onStatus(final JSONObject json, final StreamListener[] listeners) throws TwitterException { - for (final StreamListener listener : listeners) { - ((StatusListener) listener).onStatus(asStatus(json)); - } - } - - @Override - protected String parseLine(final String line) { - this.line = line; - return line; - } -} diff --git a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/StreamController.java b/twidere.component.twitter4j.streaming/src/main/java/twitter4j/StreamController.java deleted file mode 100644 index 110436ab9..000000000 --- a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/StreamController.java +++ /dev/null @@ -1,270 +0,0 @@ -/* - * Copyright 2007 Yusuke Yamamoto - * Copyright (C) 2012 Twitter, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package twitter4j; - -import static twitter4j.internal.util.InternalParseUtil.getBoolean; -import static twitter4j.internal.util.InternalParseUtil.getLong; -import static twitter4j.internal.util.InternalParseUtil.getRawString; - -import java.io.Serializable; -import java.util.Arrays; - -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; - -import twitter4j.auth.Authorization; -import twitter4j.auth.AuthorizationFactory; -import twitter4j.conf.Configuration; -import twitter4j.http.HttpClientWrapper; -import twitter4j.http.HttpParameter; -import twitter4j.http.HttpResponse; -import twitter4j.internal.util.InternalParseUtil; -import twitter4j.internal.util.InternalStringUtil; - -/** - * @author Yusuke Yamamoto - yusuke at twitter.com - * @since Twitter4J 2.2.6 - */ -public class StreamController { - private String controlURI = null; - private final HttpClientWrapper HTTP; - private final Authorization AUTH; - - Object lock = new Object(); - - /* package */StreamController(final Configuration conf) { - HTTP = new HttpClientWrapper(conf); - AUTH = AuthorizationFactory.getInstance(conf); - } - - /* package */StreamController(final HttpClientWrapper http, final Authorization auth) { - HTTP = http; - AUTH = auth; - } - - public String addUsers(final long[] userIds) throws TwitterException { - ensureControlURISet(); - final HttpParameter param = new HttpParameter("user_id", InternalStringUtil.join(userIds)); - final HttpResponse res = HTTP.post(controlURI + "/add_user.json", controlURI + "/add_user.json", - new HttpParameter[] { param }, AUTH); - return res.asString(); - } - - public FriendsIDs getFriendsIDs(final long userId, final long cursor) throws TwitterException { - ensureControlURISet(); - final HttpResponse res = HTTP - .post(controlURI + "/friends/ids.json", controlURI + "/friends/ids.json", new HttpParameter[] { - new HttpParameter("user_id", userId), new HttpParameter("cursor", cursor) }, AUTH); - return new FriendsIDs(res); - } - - public ControlStreamInfo getInfo() throws TwitterException { - ensureControlURISet(); - final HttpResponse res = HTTP.get(controlURI + "/info.json", controlURI + "/info.json", AUTH); - return new ControlStreamInfo(this, res.asJSONObject()); - } - - public String removeUsers(final long[] userIds) throws TwitterException { - ensureControlURISet(); - final HttpParameter param = new HttpParameter("user_id", InternalStringUtil.join(userIds)); - final HttpResponse res = HTTP.post(controlURI + "/remove_user.json", controlURI + "/remove_user.json", - new HttpParameter[] { param }, AUTH); - return res.asString(); - } - - /* package */User createUser(final JSONObject json) { - return new User(json); - } - - void ensureControlURISet() throws TwitterException { - synchronized (lock) { - try { - while (controlURI == null) { - lock.wait(30000); - throw new TwitterException("timed out for control uri to be ready"); - } - } catch (final InterruptedException e) { - } - } - } - - String getControlURI() { - return controlURI; - } - - void setControlURI(final String controlURI) { - this.controlURI = controlURI.replace("/1.1//1.1/", "/1.1/"); - synchronized (lock) { - lock.notifyAll(); - } - } - - public final class FriendsIDs implements CursorSupport, Serializable { - private static final long serialVersionUID = -6282978710522199102L; - private long[] ids; - private long previousCursor = -1; - private long nextCursor = -1; - private User user; - - /* package */FriendsIDs(final HttpResponse res) throws TwitterException { - init(res.asJSONObject()); - } - - @Override - public boolean equals(final Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - final FriendsIDs that = (FriendsIDs) o; - - if (nextCursor != that.nextCursor) return false; - if (previousCursor != that.previousCursor) return false; - if (!Arrays.equals(ids, that.ids)) return false; - if (user != null ? !user.equals(that.user) : that.user != null) return false; - - return true; - } - - public long[] getIds() { - return ids; - } - - /** - * {@inheritDoc} - */ - @Override - public long getNextCursor() { - return nextCursor; - } - - /** - * {@inheritDoc} - */ - @Override - public long getPreviousCursor() { - return previousCursor; - } - - public User getUser() { - return user; - } - - @Override - public int hashCode() { - int result = ids != null ? Arrays.hashCode(ids) : 0; - result = 31 * result + (int) (previousCursor ^ previousCursor >>> 32); - result = 31 * result + (int) (nextCursor ^ nextCursor >>> 32); - result = 31 * result + (user != null ? user.hashCode() : 0); - return result; - } - - /** - * {@inheritDoc} - */ - @Override - public boolean hasNext() { - return 0 != nextCursor; - } - - /** - * {@inheritDoc} - */ - @Override - public boolean hasPrevious() { - return 0 != previousCursor; - } - - @Override - public String toString() { - return "FriendsIDs{" + "ids=" + ids + ", previousCursor=" + previousCursor + ", nextCursor=" + nextCursor - + ", user=" + user + '}'; - } - - private void init(final JSONObject json) throws TwitterException { - try { - final JSONObject follow = json.getJSONObject("follow"); - final JSONArray idList = follow.getJSONArray("friends"); - ids = new long[idList.length()]; - for (int i = 0; i < idList.length(); i++) { - try { - ids[i] = Long.parseLong(idList.getString(i)); - } catch (final NumberFormatException nfe) { - throw new TwitterException("Twitter API returned malformed response: " + json, nfe); - } - } - user = new User(follow.getJSONObject("user")); - previousCursor = InternalParseUtil.getLong("previous_cursor", json); - nextCursor = InternalParseUtil.getLong("next_cursor", json); - } catch (final JSONException jsone) { - throw new TwitterException(jsone); - } - } - } - - public final class User implements Serializable { - private static final long serialVersionUID = -2925833063500478073L; - private final long id; - private final String name; - private final boolean dm; - - /* package */User(final JSONObject json) { - id = getLong("id", json); - name = getRawString("name", json); - dm = getBoolean("dm", json); - } - - @Override - public boolean equals(final Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - final User user = (User) o; - - if (dm != user.dm) return false; - if (id != user.id) return false; - if (name != null ? !name.equals(user.name) : user.name != null) return false; - - return true; - } - - public long getId() { - return id; - } - - public String getName() { - return name; - } - - @Override - public int hashCode() { - int result = (int) (id ^ id >>> 32); - result = 31 * result + (name != null ? name.hashCode() : 0); - result = 31 * result + (dm ? 1 : 0); - return result; - } - - public boolean isDMAccessible() { - return dm; - } - - @Override - public String toString() { - return "User{" + "id=" + id + ", name='" + name + '\'' + ", dm=" + dm + '}'; - } - } -} diff --git a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/StreamImplementation.java b/twidere.component.twitter4j.streaming/src/main/java/twitter4j/StreamImplementation.java deleted file mode 100644 index 85f2d1ad6..000000000 --- a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/StreamImplementation.java +++ /dev/null @@ -1,15 +0,0 @@ -package twitter4j; - -import java.io.IOException; - -/** - * @author Yusuke Yamamoto - yusuke at mac.com - * @since Twitter4J 2.1.8 - */ -interface StreamImplementation { - void close() throws IOException; - - void next(StreamListener[] listeners, RawStreamListener[] rawStreamListeners) throws TwitterException; - - void onException(Exception ex, StreamListener[] listeners, RawStreamListener[] rawStreamListeners); -} diff --git a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/StreamListener.java b/twidere.component.twitter4j.streaming/src/main/java/twitter4j/StreamListener.java deleted file mode 100644 index 463cf9298..000000000 --- a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/StreamListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2007 Yusuke Yamamoto - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package twitter4j; - -/** - * @author Yusuke Yamamoto - yusuke at mac.com - * @since Twitter4J 2.1.8 - */ -interface StreamListener { - void onException(Exception ex); -} diff --git a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/TwitterStream.java b/twidere.component.twitter4j.streaming/src/main/java/twitter4j/TwitterStream.java deleted file mode 100755 index d07b61d58..000000000 --- a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/TwitterStream.java +++ /dev/null @@ -1,373 +0,0 @@ -/* - * Twidere - Twitter client for Android - * - * Copyright (C) 2012-2015 Mariotaku Lee - * - * 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 . - */ -package twitter4j; - -import twitter4j.auth.OAuthSupport; - -/** - * @author Yusuke Yamamoto - yusuke at mac.com - * @since Twitter4J 2.2.0 - */ -public interface TwitterStream extends OAuthSupport, TwitterBase { - /** - * Adds a ConnectionLifeCycleListener - * - * @param listener listener to be added - * @since Twitter4J 2.1.7 - */ - void addConnectionLifeCycleListener(ConnectionLifeCycleListener listener); - - /** - * @param listener listener to add - * @since Twitter4J 3.0.2 - */ - void addListener(RawStreamListener listener); - - /** - * @param listener listener to add - * @since Twitter4J 2.1.8 - */ - void addListener(SiteStreamsListener listener); - - /** - * @param listener listener to add - * @since Twitter4J 2.1.8 - */ - void addListener(StatusListener listener); - - /** - * @param listener listener to add - * @since Twitter4J 2.1.8 - */ - void addListener(UserStreamListener listener); - - /** - * shutdown internal stream consuming thread - * - * @since Twitter4J 2.1.7 - */ - void cleanUp(); - - /** - * Start consuming public statuses that match one or more filter predicates. - * At least one predicate parameter, follow, locations, or track must be - * specified. Multiple parameters may be specified which allows most clients - * to use a single connection to the Streaming API. Placing long parameters - * in the URL may cause the request to be rejected for excessive URL length.
- * The default access level allows up to 200 track keywords, 400 follow - * userids and 10 1-degree location boxes. Increased access levels allow - * 80,000 follow userids ("shadow" role), 400,000 follow userids ("birddog" - * role), 10,000 track keywords ("restricted track" role), 200,000 track - * keywords ("partner track" role), and 200 10-degree location boxes - * ("locRestricted" role). Increased track access levels also pass a higher - * proportion of statuses before limiting the stream. - * - * @param query Filter query - * @see StatusStream - * @see Streaming - * API Methods statuses/filter - * @since Twitter4J 2.1.2 - */ - void filter(final FilterQuery query); - - /** - * Starts listening on all public statuses. Available only to approved - * parties and requires a signed agreement to access. Please do not contact - * us about access to the firehose. If your service warrants access to it, - * we'll contact you. - * - * @param count Indicates the number of previous statuses to stream before - * transitioning to the live stream. - * @see StatusStream - * @see Streaming - * API Methods statuses/firehose - * @since Twitter4J 2.0.4 - */ - void firehose(final int count); - - /** - * Returns public statuses that match one or more filter predicates. At - * least one predicate parameter, follow, locations, or track must be - * specified. Multiple parameters may be specified which allows most clients - * to use a single connection to the Streaming API. Placing long parameters - * in the URL may cause the request to be rejected for excessive URL length.
- * The default access level allows up to 200 track keywords, 400 follow - * userids and 10 1-degree location boxes. Increased access levels allow - * 80,000 follow userids ("shadow" role), 400,000 follow userids ("birddog" - * role), 10,000 track keywords ("restricted track" role), 200,000 track - * keywords ("partner track" role), and 200 10-degree location boxes - * ("locRestricted" role). Increased track access levels also pass a higher - * proportion of statuses before limiting the stream. - * - * @param query Filter query - * @return StatusStream - * @throws TwitterException when Twitter service or network is unavailable - * @see StatusStream - * @see Streaming - * API Methods | Twitter Developers - * @since Twitter4J 2.1.2 - * @deprecated use {@link #filter(twitter4j.FilterQuery)} instead - */ - @Deprecated - StatusStream getFilterStream(FilterQuery query) throws TwitterException; - - /** - * Returns a status stream of all public statuses. Available only to - * approved parties and requires a signed agreement to access. Please do not - * contact us about access to the firehose. If your service warrants access - * to it, we'll contact you. - * - * @param count Indicates the number of previous statuses to stream before - * transitioning to the live stream. - * @return StatusStream - * @throws TwitterException when Twitter service or network is unavailable - * @see StatusStream - * @see Streaming - * API Methods statuses/firehose - * @since Twitter4J 2.0.4 - * @deprecated use {@link #firehose(int)} instead - */ - @Deprecated - StatusStream getFirehoseStream(int count) throws TwitterException; - - /** - * Returns a status stream of all public statuses containing links. - * Available only to approved parties and requires a signed agreement to - * access. Please do not contact us about access to the links stream. If - * your service warrants access to it, we'll contact you. - * - * @param count Indicates the number of previous statuses to stream before - * transitioning to the live stream. - * @return StatusStream - * @throws TwitterException when Twitter service or network is unavailable - * @see StatusStream - * @see Streaming - * API Methods statuses/links - * @since Twitter4J 2.1.1 - * @deprecated use {@link #links(int)} instead - */ - @Deprecated - StatusStream getLinksStream(int count) throws TwitterException; - - /** - * Returns a stream of all retweets. The retweet stream is not a generally - * available resource. Few applications require this level of access. - * Creative use of a combination of other resources and various access - * levels can satisfy nearly every application use case. As of 9/11/2009, - * the site-wide retweet feature has not yet launched, so there are - * currently few, if any, retweets on this stream. - * - * @return StatusStream - * @throws TwitterException when Twitter service or network is unavailable - * @see StatusStream - * @see Streaming - * API: Methods statuses/retweet - * @since Twitter4J 2.0.10 - * @deprecated use {@link #getRetweetStream()} instead - */ - @Deprecated - StatusStream getRetweetStream() throws TwitterException; - - /** - * Returns a stream of random sample of all public statuses. The default - * access level provides a small proportion of the Firehose. The - * "Gardenhose" access level provides a proportion more suitable for data - * mining and research applications that desire a larger proportion to be - * statistically significant sample. - * - * @return StatusStream - * @throws TwitterException when Twitter service or network is unavailable - * @see StatusStream - * @see Streaming - * API: Methods statuses/sample - * @since Twitter4J 2.0.10 - * @deprecated use {@link #sample()} instead - */ - @Deprecated - StatusStream getSampleStream() throws TwitterException; - - /** - * User Streams provides real-time updates of all data needed to update a - * desktop application display. Applications can request startup back-fill - * from the REST API and then transition to Streaming for nearly all - * subsequent reads. Rate limits and latency are practically eliminated. - * Desktop developers can stop managing rate limits and use this new data to - * create an entirely new user experience. On our end, we hope to reduce - * costs and increase site reliability. - * - * @return UserStream - * @throws TwitterException when Twitter service or network is unavailable - * @see User - * Streams - * @deprecated use {@link #user()} instead - */ - @Deprecated - UserStream getUserStream() throws TwitterException; - - /** - * User Streams provides real-time updates of all data needed to update a - * desktop application display. Applications can request startup back-fill - * from the REST API and then transition to Streaming for nearly all - * subsequent reads. Rate limits and latency are practically eliminated. - * Desktop developers can stop managing rate limits and use this new data to - * create an entirely new user experience. On our end, we hope to reduce - * costs and increase site reliability. - * - * @param track keywords to track - * @return UserStream - * @throws TwitterException when Twitter service or network is unavailable - * @see User - * Streams - * @since Twitter4J 2.1.9 - * @deprecated use {@link #user()} instead - */ - @Deprecated - UserStream getUserStream(String[] track) throws TwitterException; - - /** - * Starts listening on all public statuses containing links. Available only - * to approved parties and requires a signed agreement to access. Please do - * not contact us about access to the links stream. If your service warrants - * access to it, we'll contact you. - * - * @param count Indicates the number of previous statuses to stream before - * transitioning to the live stream. - * @see StatusStream - * @see Streaming - * API Methods statuses/links - * @since Twitter4J 2.1.1 - */ - void links(final int count); - - /** - * Starts listening on all retweets. The retweet stream is not a generally - * available resource. Few applications require this level of access. - * Creative use of a combination of other resources and various access - * levels can satisfy nearly every application use case. As of 9/11/2009, - * the site-wide retweet feature has not yet launched, so there are - * currently few, if any, retweets on this stream. - * - * @see StatusStream - * @see Streaming - * API Methods statuses/retweet - * @since Twitter4J 2.0.10 - */ - void retweet(); - - /** - * Starts listening on random sample of all public statuses. The default - * access level provides a small proportion of the Firehose. The - * "Gardenhose" access level provides a proportion more suitable for data - * mining and research applications that desire a larger proportion to be - * statistically significant sample. - * - * @see StatusStream - * @see Streaming - * API: Methods statuses/sample - * @since Twitter4J 2.0.10 - */ - void sample(); - - /** - * Shuts down internal dispatcher thread shared by all TwitterStream - * instances.
- * - * @since Twitter4J 2.1.9 - */ - @Override - void shutdown(); - - /** - * Site Streams, a new feature on the Streaming API, is now available for - * beta testing. Site Streams allows services, such as web sites or mobile - * push services, to receive real-time updates for a large number of users - * without any of the hassles of managing REST API rate limits. The initial - * version delivers events created by, or directed to, users that have - * shared their OAuth token with your application. The following events are - * streamed immediately, and without rate limits: Home Timelines, Mentions - * Timelines, User Timelines, Direct Messages, Mentions, Follows, Favorites, - * Tweets, Retweets, Profile changes, and List changes. The following - * limitations must be respected during the beta period. These limitations - * may be changed with little advance notice. We intend to increase or - * remove these various limitations as we move from beta test into full - * production:
- * Limit the follow count to 100 users per stream. Clients must occasionally - * compact users onto a smaller number of connections to minimize the total - * number of connections outstanding.
- * Open no more than 25 new connections per second and exponentially - * back-off on errors. - * - * @param withFollowings whether to receive status updates from people - * following - * @param follow an array of users to include in the stream - * @see Site - * Streams | Twitter Developers - * @since Twitter4J 2.1.8 - */ - StreamController site(final boolean withFollowings, final long[] follow); - - /** - * User Streams provides real-time updates of all data needed to update a - * desktop application display. Applications can request startup back-fill - * from the REST API and then transition to Streaming for nearly all - * subsequent reads. Rate limits and latency are practically eliminated. - * Desktop developers can stop managing rate limits and use this new data to - * create an entirely new user experience. On our end, we hope to reduce - * costs and increase site reliability. - * - * @throws IllegalStateException when non-UserStreamListener is set, or no - * listener is set - * @see User - * Streams - */ - void user(); - - /** - * User Streams provides real-time updates of all data needed to update a - * desktop application display. Applications can request startup back-fill - * from the REST API and then transition to Streaming for nearly all - * subsequent reads. Rate limits and latency are practically eliminated. - * Desktop developers can stop managing rate limits and use this new data to - * create an entirely new user experience. On our end, we hope to reduce - * costs and increase site reliability. - * - * @param track keywords to track - * @throws IllegalStateException when non-UserStreamListener is set, or no - * listener is set - * @see User - * Streams - * @since Twitter4J 2.1.9 - */ - void user(final String[] track); -} diff --git a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/TwitterStreamConstants.java b/twidere.component.twitter4j.streaming/src/main/java/twitter4j/TwitterStreamConstants.java deleted file mode 100644 index bfb59bfac..000000000 --- a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/TwitterStreamConstants.java +++ /dev/null @@ -1,7 +0,0 @@ -package twitter4j; - -public interface TwitterStreamConstants extends TwitterConstants { - public static final String DEFAULT_STREAM_BASE_URL = "https://stream.twitter.com/1.1/"; - public static final String DEFAULT_USER_STREAM_BASE_URL = "https://userstream.twitter.com/1.1/"; - public static final String DEFAULT_SITE_STREAM_BASE_URL = "https://sitestream.twitter.com/1.1/"; -} \ No newline at end of file diff --git a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/TwitterStreamFactory.java b/twidere.component.twitter4j.streaming/src/main/java/twitter4j/TwitterStreamFactory.java deleted file mode 100644 index 783ee827e..000000000 --- a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/TwitterStreamFactory.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Twidere - Twitter client for Android - * - * Copyright (C) 2012-2015 Mariotaku Lee - * - * 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 . - */ - -package twitter4j; - -import twitter4j.auth.AccessToken; -import twitter4j.auth.Authorization; -import twitter4j.auth.AuthorizationFactory; -import twitter4j.auth.OAuthAuthorization; -import twitter4j.conf.StreamConfiguration; -import twitter4j.conf.StreamConfigurationContext; - -/** - * A factory class for TwitterFactory.
- * An instance of this class is completely thread safe and can be re-used and - * used concurrently.
- * Note that TwitterStream is NOT compatible with Google App Engine as GAE is - * not capable of handling requests longer than 30 seconds. - * - * @author Yusuke Yamamoto - yusuke at mac.com - * @since Twitter4J 2.1.0 - */ -public final class TwitterStreamFactory implements java.io.Serializable { - private static final long serialVersionUID = 8146074704915782233L; - private final StreamConfiguration conf; - private static final TwitterStream SINGLETON; - - static { - SINGLETON = new TwitterStreamImpl(StreamConfigurationContext.getInstance(), - TwitterFactory.DEFAULT_AUTHORIZATION); - } - - /** - * Creates a TwitterStreamFactory with the root configuration. - */ - public TwitterStreamFactory() { - this(StreamConfigurationContext.getInstance()); - } - - /** - * Creates a TwitterStreamFactory with the given configuration. - * - * @param conf the configuration to use - * @since Twitter4J 2.1.1 - */ - public TwitterStreamFactory(final StreamConfiguration conf) { - this.conf = conf; - } - - // implementations for BasicSupportFactory - - /** - * Returns a instance associated with the configuration bound to this - * factory. - * - * @return default instance - */ - public TwitterStream getInstance() { - return getInstance(AuthorizationFactory.getInstance(conf)); - } - - /** - * Returns a OAuth Authenticated instance.
- * consumer key and consumer Secret must be provided by - * twitter4j.properties, or system properties. Unlike - * {@link twitter4j.TwitterStream#setOAuthAccessToken(twitter4j.auth.AccessToken)}, - * this factory method potentially returns a cached instance. - * - * @param accessToken access token - * @return an instance - */ - public TwitterStream getInstance(final AccessToken accessToken) { - final String consumerKey = conf.getOAuthConsumerKey(); - final String consumerSecret = conf.getOAuthConsumerSecret(); - if (null == consumerKey && null == consumerSecret) - throw new IllegalStateException("Consumer key and Consumer secret not supplied."); - final OAuthAuthorization oauth = new OAuthAuthorization(conf); - oauth.setOAuthAccessToken(accessToken); - return getInstance(conf, oauth); - } - - /** - * Returns a instance. - * - * @return an instance - */ - public TwitterStream getInstance(final Authorization auth) { - return getInstance(conf, auth); - } - - private TwitterStream getInstance(final StreamConfiguration conf, final Authorization auth) { - return new TwitterStreamImpl(conf, auth); - } - - /** - * Returns default singleton TwitterStream instance. - * - * @return default singleton TwitterStream instance - * @since Twitter4J 2.2.4 - */ - public static TwitterStream getSingleton() { - return SINGLETON; - } -} diff --git a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/TwitterStreamImpl.java b/twidere.component.twitter4j.streaming/src/main/java/twitter4j/TwitterStreamImpl.java deleted file mode 100755 index d38d37380..000000000 --- a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/TwitterStreamImpl.java +++ /dev/null @@ -1,671 +0,0 @@ -/* - * Copyright 2007 Yusuke Yamamoto - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package twitter4j; - -import static twitter4j.http.HttpResponseCode.FORBIDDEN; -import static twitter4j.http.HttpResponseCode.NOT_ACCEPTABLE; - -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.List; - -import twitter4j.auth.Authorization; -import twitter4j.conf.StreamConfiguration; -import twitter4j.http.HttpParameter; -import twitter4j.internal.async.Dispatcher; -import twitter4j.internal.async.DispatcherFactory; -import twitter4j.internal.logging.Logger; -import twitter4j.internal.util.InternalStringUtil; - -/** - * A java representation of the Streaming API: - * Methods
- * Note that this class is NOT compatible with Google App Engine as GAE is not - * capable of handling requests longer than 30 seconds. - * - * @author Yusuke Yamamoto - yusuke at mac.com - * @since Twitter4J 2.0.4 - */ -class TwitterStreamImpl extends TwitterBaseImpl implements TwitterStream { - private final StreamConfiguration conf; - private static final Logger logger = Logger.getLogger(TwitterStreamImpl.class); - - private final List lifeCycleListeners = new ArrayList(0); - private TwitterStreamConsumer handler = null; - - private final HttpParameter STALL_WARNINGS; - - private static transient Dispatcher dispatcher; - - /* Streaming API */ - - private static int numberOfHandlers = 0; - - private final List userStreamListeners = new ArrayList(0); - - private final List statusListeners = new ArrayList(0); - - private final List siteStreamsListeners = new ArrayList(0); - - private final List rawStreamListeners = new ArrayList(0); - - /* - * https://dev.twitter.com/docs/streaming-api/concepts#connecting When a - * network error (TCP/IP level) is encountered, back off linearly. Perhaps - * start at 250 milliseconds, double, and cap at 16 seconds When a HTTP - * error (> 200) is returned, back off exponentially. Perhaps start with a - * 10 second wait, double on each subsequent failure, and finally cap the - * wait at 240 seconds. Consider sending an alert to a human operator after - * multiple HTTP errors, as there is probably a client configuration issue - * that is unlikely to be resolved without human intervention. There's not - * much point in polling any faster in the face of HTTP error codes and your - * client is may run afoul of a rate limit. - */ - private static final int TCP_ERROR_INITIAL_WAIT = 250; - - private static final int TCP_ERROR_WAIT_CAP = 16 * 1000; - - private static final int HTTP_ERROR_INITIAL_WAIT = 10 * 1000; - - private static final int HTTP_ERROR_WAIT_CAP = 240 * 1000; - - private static final int NO_WAIT = 0; - - static int count = 0; - - /* package */ - TwitterStreamImpl(final StreamConfiguration conf, final Authorization auth) { - super(conf, auth); - this.conf = conf; - STALL_WARNINGS = new HttpParameter("stall_warnings", conf.isStallWarningsEnabled()); - } - - /** - * {@inheritDoc} - */ - @Override - public void addConnectionLifeCycleListener(final ConnectionLifeCycleListener listener) { - lifeCycleListeners.add(listener); - } - - /** - * {@inheritDoc} - */ - @Override - public void addListener(final RawStreamListener listener) { - rawStreamListeners.add(listener); - } - - /** - * {@inheritDoc} - */ - @Override - public void addListener(final SiteStreamsListener listener) { - siteStreamsListeners.add(listener); - } - - /** - * {@inheritDoc} - */ - @Override - public void addListener(final StatusListener listener) { - statusListeners.add(listener); - } - - /** - * {@inheritDoc} - */ - @Override - public void addListener(final UserStreamListener listener) { - statusListeners.add(listener); - userStreamListeners.add(listener); - } - - /** - * {@inheritDoc} - */ - @Override - public synchronized void cleanUp() { - if (handler != null) { - handler.close(); - numberOfHandlers--; - } - } - - @Override - public boolean equals(final Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - if (!super.equals(o)) return false; - - final TwitterStreamImpl that = (TwitterStreamImpl) o; - - if (handler != null ? !handler.equals(that.handler) : that.handler != null) return false; - if (http != null ? !http.equals(that.http) : that.http != null) return false; - if (lifeCycleListeners != null ? !lifeCycleListeners.equals(that.lifeCycleListeners) - : that.lifeCycleListeners != null) return false; - if (rawStreamListeners != null ? !rawStreamListeners.equals(that.rawStreamListeners) - : that.rawStreamListeners != null) return false; - if (siteStreamsListeners != null ? !siteStreamsListeners.equals(that.siteStreamsListeners) - : that.siteStreamsListeners != null) return false; - if (STALL_WARNINGS != null ? !STALL_WARNINGS.equals(that.STALL_WARNINGS) : that.STALL_WARNINGS != null) - return false; - if (statusListeners != null ? !statusListeners.equals(that.statusListeners) : that.statusListeners != null) - return false; - if (userStreamListeners != null ? !userStreamListeners.equals(that.userStreamListeners) - : that.userStreamListeners != null) return false; - - return true; - } - - /** - * {@inheritDoc} - */ - @Override - public void filter(final FilterQuery query) { - ensureAuthorizationEnabled(); - ensureStatusStreamListenerIsSet(); - startHandler(new TwitterStreamConsumer(statusListeners, rawStreamListeners) { - @Override - public StatusStream getStream() throws TwitterException { - return getFilterStream(query); - } - }); - } - - /** - * {@inheritDoc} - */ - @Override - public void firehose(final int count) { - ensureAuthorizationEnabled(); - ensureStatusStreamListenerIsSet(); - startHandler(new TwitterStreamConsumer(statusListeners, rawStreamListeners) { - @Override - public StatusStream getStream() throws TwitterException { - return getFirehoseStream(count); - } - }); - } - - /** - * {@inheritDoc} - */ - @Override - public StatusStream getFilterStream(final FilterQuery query) throws TwitterException { - ensureAuthorizationEnabled(); - try { - return new StatusStreamImpl(getDispatcher(), - http.post(conf.getStreamBaseURL() + "statuses/filter.json", conf.getStreamBaseURL() - + "statuses/filter.json", query.asHttpParameterArray(STALL_WARNINGS), auth), conf); - } catch (final IOException e) { - throw new TwitterException(e); - } - } - - /** - * {@inheritDoc} - */ - @Override - public StatusStream getFirehoseStream(final int count) throws TwitterException { - ensureAuthorizationEnabled(); - return getCountStream("statuses/firehose.json", count); - } - - /** - * {@inheritDoc} - */ - @Override - public StatusStream getLinksStream(final int count) throws TwitterException { - ensureAuthorizationEnabled(); - return getCountStream("statuses/links.json", count); - } - - /** - * {@inheritDoc} - */ - @Override - public StatusStream getRetweetStream() throws TwitterException { - ensureAuthorizationEnabled(); - try { - return new StatusStreamImpl(getDispatcher(), http.post(conf.getStreamBaseURL() + "statuses/retweet.json", - conf.getStreamBaseURL() + "statuses/retweet.json", new HttpParameter[] { STALL_WARNINGS }, auth), - conf); - } catch (final IOException e) { - throw new TwitterException(e); - } - } - - /** - * {@inheritDoc} - */ - @Override - public StatusStream getSampleStream() throws TwitterException { - ensureAuthorizationEnabled(); - try { - return new StatusStreamImpl(getDispatcher(), get(conf.getStreamBaseURL() + "statuses/sample.json", - conf.getStreamBaseURL() + "statuses/sample.json", STALL_WARNINGS), conf); - } catch (final IOException e) { - throw new TwitterException(e); - } - } - - /** - * {@inheritDoc} - */ - @Override - public UserStream getUserStream() throws TwitterException { - return getUserStream(null); - } - - /** - * {@inheritDoc} - */ - @Override - public UserStream getUserStream(final String[] track) throws TwitterException { - ensureAuthorizationEnabled(); - try { - final List params = new ArrayList(); - params.add(STALL_WARNINGS); - if (conf.isUserStreamRepliesAllEnabled()) { - params.add(new HttpParameter("replies", "all")); - } - if (track != null) { - params.add(new HttpParameter("track", InternalStringUtil.join(track))); - } - return new UserStreamImpl(getDispatcher(), http.post(conf.getUserStreamBaseURL() + "user.json", - conf.getUserStreamBaseURL() + "user.json", params.toArray(new HttpParameter[params.size()]), auth), - conf); - } catch (final IOException e) { - throw new TwitterException(e); - } - } - - @Override - public int hashCode() { - int result = super.hashCode(); - result = 31 * result + (http != null ? http.hashCode() : 0); - result = 31 * result + (lifeCycleListeners != null ? lifeCycleListeners.hashCode() : 0); - result = 31 * result + (handler != null ? handler.hashCode() : 0); - result = 31 * result + (STALL_WARNINGS != null ? STALL_WARNINGS.hashCode() : 0); - result = 31 * result + (userStreamListeners != null ? userStreamListeners.hashCode() : 0); - result = 31 * result + (statusListeners != null ? statusListeners.hashCode() : 0); - result = 31 * result + (siteStreamsListeners != null ? siteStreamsListeners.hashCode() : 0); - result = 31 * result + (rawStreamListeners != null ? rawStreamListeners.hashCode() : 0); - return result; - } - - /** - * {@inheritDoc} - */ - @Override - public void links(final int count) { - ensureAuthorizationEnabled(); - ensureStatusStreamListenerIsSet(); - startHandler(new TwitterStreamConsumer(statusListeners, rawStreamListeners) { - @Override - public StatusStream getStream() throws TwitterException { - return getLinksStream(count); - } - }); - } - - /** - * {@inheritDoc} - */ - @Override - public void retweet() { - ensureAuthorizationEnabled(); - ensureStatusStreamListenerIsSet(); - startHandler(new TwitterStreamConsumer(statusListeners, rawStreamListeners) { - @Override - public StatusStream getStream() throws TwitterException { - return getRetweetStream(); - } - }); - } - - /** - * {@inheritDoc} - */ - @Override - public void sample() { - ensureAuthorizationEnabled(); - ensureStatusStreamListenerIsSet(); - startHandler(new TwitterStreamConsumer(statusListeners, rawStreamListeners) { - @Override - public StatusStream getStream() throws TwitterException { - return getSampleStream(); - } - }); - } - - /** - * {@inheritDoc} - */ - @Override - public synchronized void shutdown() { - super.shutdown(); - cleanUp(); - synchronized (TwitterStreamImpl.class) { - if (0 == numberOfHandlers) { - if (dispatcher != null) { - dispatcher.shutdown(); - dispatcher = null; - } - } - } - } - - /** - * {@inheritDoc} - */ - @Override - public StreamController site(final boolean withFollowings, final long[] follow) { - ensureOAuthEnabled(); - ensureSiteStreamsListenerIsSet(); - final StreamController cs = new StreamController(http, auth); - startHandler(new TwitterStreamConsumer(siteStreamsListeners, rawStreamListeners) { - @Override - public StatusStream getStream() throws TwitterException { - try { - return new SiteStreamsImpl(getDispatcher(), getSiteStream(withFollowings, follow), conf, cs); - } catch (final IOException e) { - throw new TwitterException(e); - } - } - }); - return cs; - } - - @Override - public String toString() { - return "TwitterStreamImpl{http=" + http + ", conf=" + conf + ", lifeCycleListeners=" + lifeCycleListeners - + ", handler=" + handler + ", STALL_WARNINGS=" + STALL_WARNINGS + ", userStreamListeners=" - + userStreamListeners + ", statusListeners=" + statusListeners + ", siteStreamsListeners=" - + siteStreamsListeners + ", rawStreamListeners=" + rawStreamListeners + "}"; - } - - /** - * {@inheritDoc} - */ - @Override - public void user() { - user(null); - } - - /** - * {@inheritDoc} - */ - @Override - public void user(final String[] track) { - ensureAuthorizationEnabled(); - ensureUserStreamListenerIsSet(); - startHandler(new TwitterStreamConsumer(statusListeners, rawStreamListeners) { - @Override - public StatusStream getStream() throws TwitterException { - return getUserStream(track); - } - }); - } - - private void ensureSiteStreamsListenerIsSet() { - if (siteStreamsListeners.size() == 0 && rawStreamListeners.size() == 0) - throw new IllegalStateException("SiteStreamsListener is not set."); - } - - /** - * check if any listener is set. Throws IllegalStateException if no listener - * is set. - * - * @throws IllegalStateException when no listener is set. - */ - - private void ensureStatusStreamListenerIsSet() { - if (statusListeners.size() == 0 && rawStreamListeners.size() == 0) - throw new IllegalStateException("StatusListener is not set."); - } - - private void ensureUserStreamListenerIsSet() { - if (userStreamListeners.size() == 0 && rawStreamListeners.size() == 0) - throw new IllegalStateException("UserStreamListener is not set."); - } - - private StatusStream getCountStream(final String relativeUrl, final int count) throws TwitterException { - ensureAuthorizationEnabled(); - try { - return new StatusStreamImpl(getDispatcher(), http.post(conf.getStreamBaseURL() + relativeUrl, - conf.getStreamBaseURL() + relativeUrl, - new HttpParameter[] { new HttpParameter("count", String.valueOf(count)), STALL_WARNINGS }, auth), - conf); - } catch (final IOException e) { - throw new TwitterException(e); - } - } - - private Dispatcher getDispatcher() { - if (null == TwitterStreamImpl.dispatcher) { - synchronized (TwitterStreamImpl.class) { - if (null == TwitterStreamImpl.dispatcher) { - // dispatcher is held statically, but it'll be instantiated - // with - // the configuration instance associated with this - // TwitterStream - // instance which invokes getDispatcher() on the first time. - TwitterStreamImpl.dispatcher = new DispatcherFactory(conf).getInstance(); - } - } - } - return TwitterStreamImpl.dispatcher; - } - - private synchronized void startHandler(final TwitterStreamConsumer handler) { - cleanUp(); - this.handler = handler; - this.handler.start(); - numberOfHandlers++; - } - - InputStream getSiteStream(final boolean withFollowings, final long[] follow) throws TwitterException { - ensureOAuthEnabled(); - return http.post( - conf.getSiteStreamBaseURL() + "site.json", - conf.getSiteStreamBaseURL() + "site.json", - new HttpParameter[] { new HttpParameter("with", withFollowings ? "followings" : "user"), - new HttpParameter("follow", InternalStringUtil.join(follow)), STALL_WARNINGS }, auth) - .asStream(); - } - - abstract class TwitterStreamConsumer extends Thread { - private StatusStreamBase stream = null; - private final String NAME = "Twitter Stream consumer-" + ++count; - private volatile boolean closed = false; - private final StreamListener[] streamListeners; - private final RawStreamListener[] rawStreamListeners; - - TwitterStreamConsumer(final List streamListeners, - final List rawStreamListeners) { - super(); - setName(NAME + "[initializing]"); - this.streamListeners = streamListeners.toArray(new StreamListener[streamListeners.size()]); - this.rawStreamListeners = rawStreamListeners.toArray(new RawStreamListener[rawStreamListeners.size()]); - } - - public synchronized void close() { - setStatus("[Disposing thread]"); - try { - if (stream != null) { - try { - stream.close(); - } catch (final IOException ignore) { - } catch (final Exception e) { - e.printStackTrace(); - logger.warn(e.getMessage()); - } - } - } finally { - closed = true; - } - } - - @Override - public void run() { - int timeToSleep = NO_WAIT; - boolean connected = false; - while (!closed) { - try { - if (!closed && null == stream) { - // try establishing connection - logger.info("Establishing connection."); - setStatus("[Establishing connection]"); - stream = (StatusStreamBase) getStream(); - connected = true; - logger.info("Connection established."); - for (final ConnectionLifeCycleListener listener : lifeCycleListeners) { - try { - listener.onConnect(); - } catch (final Exception e) { - logger.warn(e.getMessage()); - } - } - // connection established successfully - timeToSleep = NO_WAIT; - logger.info("Receiving status stream."); - setStatus("[Receiving stream]"); - while (!closed) { - try { - stream.next(streamListeners, rawStreamListeners); - } catch (final IllegalStateException ise) { - logger.warn(ise.getMessage()); - break; - } catch (final TwitterException e) { - logger.info(e.getMessage()); - stream.onException(e, streamListeners, rawStreamListeners); - throw e; - } catch (final Exception e) { - logger.info(e.getMessage()); - stream.onException(e, streamListeners, rawStreamListeners); - closed = true; - break; - } - } - } - } catch (final TwitterException te) { - logger.info(te.getMessage()); - if (!closed) { - if (NO_WAIT == timeToSleep) { - if (te.getStatusCode() == FORBIDDEN) { - logger.warn("This account is not in required role. ", te.getMessage()); - closed = true; - for (final StreamListener statusListener : streamListeners) { - statusListener.onException(te); - } - break; - } - if (te.getStatusCode() == NOT_ACCEPTABLE) { - logger.warn("Parameter not accepted with the role. ", te.getMessage()); - closed = true; - for (final StreamListener statusListener : streamListeners) { - statusListener.onException(te); - } - break; - } - connected = false; - for (final ConnectionLifeCycleListener listener : lifeCycleListeners) { - try { - listener.onDisconnect(); - } catch (final Exception e) { - logger.warn(e.getMessage()); - } - } - if (te.getStatusCode() > 200) { - timeToSleep = HTTP_ERROR_INITIAL_WAIT; - } else if (0 == timeToSleep) { - timeToSleep = TCP_ERROR_INITIAL_WAIT; - } - } - if (te.getStatusCode() > 200 && timeToSleep < HTTP_ERROR_INITIAL_WAIT) { - timeToSleep = HTTP_ERROR_INITIAL_WAIT; - } - if (connected) { - for (final ConnectionLifeCycleListener listener : lifeCycleListeners) { - try { - listener.onDisconnect(); - } catch (final Exception e) { - logger.warn(e.getMessage()); - } - } - } - for (final StreamListener statusListener : streamListeners) { - statusListener.onException(te); - } - // there was a problem establishing the connection, or - // the connection closed by peer - if (!closed) { - // wait for a moment not to overload Twitter API - logger.info("Waiting for " + timeToSleep + " milliseconds"); - setStatus("[Waiting for " + timeToSleep + " milliseconds]"); - try { - Thread.sleep(timeToSleep); - } catch (final InterruptedException ignore) { - } - timeToSleep = Math.min(timeToSleep * 2, te.getStatusCode() > 200 ? HTTP_ERROR_WAIT_CAP - : TCP_ERROR_WAIT_CAP); - } - stream = null; - logger.debug(te.getMessage()); - connected = false; - } - } - } - if (stream != null && connected) { - try { - stream.close(); - } catch (final IOException ignore) { - } catch (final Exception e) { - e.printStackTrace(); - logger.warn(e.getMessage()); - } finally { - for (final ConnectionLifeCycleListener listener : lifeCycleListeners) { - try { - listener.onDisconnect(); - } catch (final Exception e) { - logger.warn(e.getMessage()); - } - } - } - } - for (final ConnectionLifeCycleListener listener : lifeCycleListeners) { - try { - listener.onCleanUp(); - } catch (final Exception e) { - logger.warn(e.getMessage()); - } - } - } - - private void setStatus(final String message) { - final String actualMessage = NAME + message; - setName(actualMessage); - logger.debug(actualMessage); - } - - abstract StatusStream getStream() throws TwitterException; - - } -} \ No newline at end of file diff --git a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/UserStream.java b/twidere.component.twitter4j.streaming/src/main/java/twitter4j/UserStream.java deleted file mode 100644 index 1ab09c20f..000000000 --- a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/UserStream.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2007 Yusuke Yamamoto - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package twitter4j; - -import java.io.IOException; - -/** - * @author Yusuke Yamamoto - yusuke at mac.com - * @since Twitter4J 2.1.3 - */ -public interface UserStream extends StatusStream { - @Override - void close() throws IOException; - - /** - * Reads next element from this stream. - * - * @param listener a UserStreamListener implementation - * @throws TwitterException when the end of the stream has been reached. - * @throws IllegalStateException when the end of the stream had been - * reached. - */ - void next(UserStreamListener listener) throws TwitterException; -} diff --git a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/UserStreamAdapter.java b/twidere.component.twitter4j.streaming/src/main/java/twitter4j/UserStreamAdapter.java deleted file mode 100644 index 8cf32fc46..000000000 --- a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/UserStreamAdapter.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 2007 Yusuke Yamamoto - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package twitter4j; - -/** - * @author yusuke at mac.com - * @since Twitter4J 2.1.3 - */ -public class UserStreamAdapter extends StatusAdapter implements UserStreamListener { - @Override - public void onBlock(final User source, final User blockedUser) { - } - - @Override - public void onDeletionNotice(final long directMessageId, final long userId) { - } - - @Override - public void onDirectMessage(final DirectMessage directMessage) { - } - - @Override - public void onException(final Exception ex) { - } - - @Override - public void onFavorite(final User source, final User target, final Status favoritedStatus) { - } - - @Override - public void onFollow(final User source, final User followedUser) { - } - - @Override - public void onFriendList(final long[] friendIds) { - } - - @Override - public void onUnblock(final User source, final User unblockedUser) { - } - - @Override - public void onUnfavorite(final User source, final User target, final Status unfavoritedStatus) { - } - - @Override - public void onUserListCreation(final User listOwner, final UserList list) { - } - - @Override - public void onUserListDeletion(final User listOwner, final UserList list) { - } - - @Override - public void onUserListMemberAddition(final User addedMember, final User listOwner, final UserList list) { - } - - @Override - public void onUserListMemberDeletion(final User deletedMember, final User listOwner, final UserList list) { - } - - @Override - public void onUserListSubscription(final User subscriber, final User listOwner, final UserList list) { - } - - @Override - public void onUserListUnsubscription(final User subscriber, final User listOwner, final UserList list) { - } - - @Override - public void onUserListUpdate(final User listOwner, final UserList list) { - } - - @Override - public void onUserProfileUpdate(final User updatedUser) { - } -} diff --git a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/UserStreamImpl.java b/twidere.component.twitter4j.streaming/src/main/java/twitter4j/UserStreamImpl.java deleted file mode 100644 index fde5e1af7..000000000 --- a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/UserStreamImpl.java +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright 2007 Yusuke Yamamoto - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package twitter4j; - -import java.io.IOException; -import java.io.InputStream; - -import org.json.JSONException; -import org.json.JSONObject; - -import twitter4j.conf.StreamConfiguration; -import twitter4j.http.HttpResponse; -import twitter4j.internal.async.Dispatcher; - -/** - * @author Yusuke Yamamoto - yusuke at mac.com - * @since Twitter4J 2.1.8 - */ -class UserStreamImpl extends StatusStreamImpl implements UserStream { - /* package */UserStreamImpl(final Dispatcher dispatcher, final HttpResponse response, final StreamConfiguration conf) - throws IOException { - super(dispatcher, response, conf); - } - - /* package */UserStreamImpl(final Dispatcher dispatcher, final InputStream stream, final StreamConfiguration conf) - throws IOException { - super(dispatcher, stream, conf); - } - - @Override - public void next(final UserStreamListener listener) throws TwitterException { - handleNextElement(new StreamListener[] { listener }, EMPTY); - } - - @Override - protected void onBlock(final JSONObject source, final JSONObject target, final StreamListener[] listeners) - throws TwitterException { - for (final StreamListener listener : listeners) { - ((UserStreamListener) listener).onBlock(asUser(source), asUser(target)); - } - } - - @Override - protected void onDirectMessage(final JSONObject json, final StreamListener[] listeners) throws TwitterException, - JSONException { - final DirectMessage directMessage = asDirectMessage(json); - for (final StreamListener listener : listeners) { - ((UserStreamListener) listener).onDirectMessage(directMessage); - } - } - - @Override - protected void onFavorite(final JSONObject source, final JSONObject target, final JSONObject targetObject, - final StreamListener[] listeners) throws TwitterException { - for (final StreamListener listener : listeners) { - ((UserStreamListener) listener).onFavorite(asUser(source), asUser(target), asStatus(targetObject)); - } - } - - @Override - protected void onFollow(final JSONObject source, final JSONObject target, final StreamListener[] listeners) - throws TwitterException { - for (final StreamListener listener : listeners) { - ((UserStreamListener) listener).onFollow(asUser(source), asUser(target)); - } - } - - @Override - protected void onFriends(final JSONObject json, final StreamListener[] listeners) throws TwitterException, - JSONException { - final long[] friendIds = asFriendList(json); - for (final StreamListener listener : listeners) { - ((UserStreamListener) listener).onFriendList(friendIds); - } - } - - @Override - protected void onScrubGeo(final JSONObject json, final StreamListener[] listeners) throws TwitterException { - // Not implemented yet - logger.info("Geo-tagging deletion notice (not implemented yet): " + line); - } - - @Override - protected void onSender(final JSONObject json, final StreamListener[] listeners) throws TwitterException { - for (final StreamListener listener : listeners) { - ((UserStreamListener) listener).onDirectMessage(factory.createDirectMessage(json)); - } - } - - @Override - protected void onUnblock(final JSONObject source, final JSONObject target, final StreamListener[] listeners) - throws TwitterException { - for (final StreamListener listener : listeners) { - ((UserStreamListener) listener).onUnblock(asUser(source), asUser(target)); - } - } - - @Override - protected void onUnfavorite(final JSONObject source, final JSONObject target, final JSONObject targetObject, - final StreamListener[] listeners) throws TwitterException { - for (final StreamListener listener : listeners) { - ((UserStreamListener) listener).onUnfavorite(asUser(source), asUser(target), asStatus(targetObject)); - } - } - - @Override - protected void onUserListCreation(final JSONObject source, final JSONObject target, final StreamListener[] listeners) - throws TwitterException, JSONException { - for (final StreamListener listener : listeners) { - ((UserStreamListener) listener).onUserListCreation(asUser(source), asUserList(target)); - } - } - - @Override - protected void onUserListDestroyed(final JSONObject source, final JSONObject target, - final StreamListener[] listeners) throws TwitterException { - for (final StreamListener listener : listeners) { - ((UserStreamListener) listener).onUserListDeletion(asUser(source), asUserList(target)); - } - } - - @Override - protected void onUserListMemberAddition(final JSONObject addedMember, final JSONObject owner, - final JSONObject target, final StreamListener[] listeners) throws TwitterException, JSONException { - for (final StreamListener listener : listeners) { - ((UserStreamListener) listener).onUserListMemberAddition(asUser(addedMember), asUser(owner), - asUserList(target)); - } - } - - @Override - protected void onUserListMemberDeletion(final JSONObject deletedMember, final JSONObject owner, - final JSONObject target, final StreamListener[] listeners) throws TwitterException, JSONException { - for (final StreamListener listener : listeners) { - ((UserStreamListener) listener).onUserListMemberDeletion(asUser(deletedMember), asUser(owner), - asUserList(target)); - } - } - - @Override - protected void onUserListSubscription(final JSONObject source, final JSONObject owner, final JSONObject target, - final StreamListener[] listeners) throws TwitterException, JSONException { - for (final StreamListener listener : listeners) { - ((UserStreamListener) listener).onUserListSubscription(asUser(source), asUser(owner), asUserList(target)); - } - } - - @Override - protected void onUserListUnsubscription(final JSONObject source, final JSONObject owner, final JSONObject target, - final StreamListener[] listeners) throws TwitterException, JSONException { - for (final StreamListener listener : listeners) { - ((UserStreamListener) listener).onUserListUnsubscription(asUser(source), asUser(owner), asUserList(target)); - } - } - - @Override - protected void onUserListUpdated(final JSONObject source, final JSONObject target, final StreamListener[] listeners) - throws TwitterException, JSONException { - for (final StreamListener listener : listeners) { - ((UserStreamListener) listener).onUserListUpdate(asUser(source), asUserList(target)); - } - } - - @Override - protected void onUserUpdate(final JSONObject source, final JSONObject target, final StreamListener[] listeners) - throws TwitterException { - for (final StreamListener listener : listeners) { - ((UserStreamListener) listener).onUserProfileUpdate(asUser(source)); - } - } - -} \ No newline at end of file diff --git a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/UserStreamListener.java b/twidere.component.twitter4j.streaming/src/main/java/twitter4j/UserStreamListener.java deleted file mode 100644 index b7bf4b7e3..000000000 --- a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/UserStreamListener.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright 2007 Yusuke Yamamoto - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package twitter4j; - -/** - * @author yusuke at mac.com - * @since Twitter4J 2.1.3 - */ -public interface UserStreamListener extends StatusListener { - /** - * @param source - * @param blockedUser - * @since Twitter4J 2.1.3 - */ - void onBlock(User source, User blockedUser); - - void onDeletionNotice(long directMessageId, long userId); - - /** - * @param directMessage - * @since Twitter4J 2.1.3 - */ - void onDirectMessage(DirectMessage directMessage); - - /** - * @param source - * @param target - * @param favoritedStatus - * @since Twitter4J 2.1.3 - */ - void onFavorite(User source, User target, Status favoritedStatus); - - /** - * @param source - * @param followedUser - * @since Twitter4J 2.1.3 - */ - void onFollow(User source, User followedUser); - - /** - * @param friendIds - * @since Twitter4J 2.1.3 - */ - void onFriendList(long[] friendIds); - - /** - * @param source - * @param unblockedUser - * @since Twitter4J 2.1.3 - */ - void onUnblock(User source, User unblockedUser); - - /** - * @param source - * @param target - * @param unfavoritedStatus - * @since Twitter4J 2.1.3 - */ - void onUnfavorite(User source, User target, Status unfavoritedStatus); - - /** - * @param listOwner - * @param list - * @since Twitter4J 2.1.3 - */ - void onUserListCreation(User listOwner, UserList list); - - /** - * @param listOwner - * @param list - * @since Twitter4J 2.1.3 - */ - void onUserListDeletion(User listOwner, UserList list); - - /** - * @param addedMember - * @param listOwner - * @param list - * @since Twitter4J 2.1.11 - */ - void onUserListMemberAddition(User addedMember, User listOwner, UserList list); - - /** - * @param deletedMember - * @param listOwner - * @param list - * @since Twitter4J 2.1.11 - */ - void onUserListMemberDeletion(User deletedMember, User listOwner, UserList list); - - /** - * @param subscriber - * @param listOwner - * @param list - * @since Twitter4J 2.1.3 - */ - void onUserListSubscription(User subscriber, User listOwner, UserList list); - - /** - * @param subscriber - * @param listOwner - * @param list - * @since Twitter4J 2.1.11 - */ - void onUserListUnsubscription(User subscriber, User listOwner, UserList list); - - /** - * @param listOwner - * @param list - * @since Twitter4J 2.1.3 - */ - void onUserListUpdate(User listOwner, UserList list); - - /** - * @param updatedUser updated user - * @since Twitter4J 2.1.9 - */ - void onUserProfileUpdate(User updatedUser); -} diff --git a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/VersionStream.java b/twidere.component.twitter4j.streaming/src/main/java/twitter4j/VersionStream.java deleted file mode 100644 index 591324a8a..000000000 --- a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/VersionStream.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2007 Yusuke Yamamoto - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package twitter4j; - -/** - * @author Yusuke Yamamoto - yusuke at mac.com - */ -public final class VersionStream { - private static final String VERSION = "3.0.3"; - private static final String TITLE = "Twitter4J Streaming API support"; - - private VersionStream() { - throw new AssertionError(); - } - - public static String getVersion() { - return VERSION; - } - - /** - * prints the version string - * - * @param args will be just ignored. - */ - public static void main(final String[] args) { - System.out.println(TITLE + " " + VERSION); - } -} diff --git a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/conf/BaseStreamConfigurationFactory.java b/twidere.component.twitter4j.streaming/src/main/java/twitter4j/conf/BaseStreamConfigurationFactory.java deleted file mode 100644 index edfd5918a..000000000 --- a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/conf/BaseStreamConfigurationFactory.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2007 Yusuke Yamamoto - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package twitter4j.conf; - -/** - * ConfigurationFactory implementation for ConfigurationBase. Currently - * getInstance calls concrete constructor each time. No caching at all. - * - * @author Yusuke Yamamoto - yusuke at mac.com - */ -class BaseStreamConfigurationFactory implements StreamConfigurationFactory { - private static final StreamConfigurationBase ROOT_CONFIGURATION; - - static { - ROOT_CONFIGURATION = new StreamConfigurationBase(); - } - - /** - * {@inheritDoc} - */ - @Override - public void dispose() { - // nothing to do for property based configuration - } - - // It may be preferable to cache the config instance - - /** - * {@inheritDoc} - */ - @Override - public StreamConfiguration getInstance() { - return ROOT_CONFIGURATION; - } - -} diff --git a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/conf/StreamConfiguration.java b/twidere.component.twitter4j.streaming/src/main/java/twitter4j/conf/StreamConfiguration.java deleted file mode 100644 index 1ba0da502..000000000 --- a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/conf/StreamConfiguration.java +++ /dev/null @@ -1,23 +0,0 @@ -package twitter4j.conf; - -public interface StreamConfiguration extends Configuration { - - int getAsyncNumThreads(); - - String getDispatcherImpl(); - - int getHttpStreamingReadTimeout(); - - String getSiteStreamBaseURL(); - - String getStreamBaseURL(); - - String getUserStreamBaseURL(); - - boolean isJSONStoreEnabled(); - - boolean isStallWarningsEnabled(); - - boolean isUserStreamRepliesAllEnabled(); - -} diff --git a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/conf/StreamConfigurationBase.java b/twidere.component.twitter4j.streaming/src/main/java/twitter4j/conf/StreamConfigurationBase.java deleted file mode 100644 index d0e83a5ef..000000000 --- a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/conf/StreamConfigurationBase.java +++ /dev/null @@ -1,153 +0,0 @@ -package twitter4j.conf; - -import twitter4j.TwitterStreamConstants; - -class StreamConfigurationBase extends ConfigurationBase implements StreamConfiguration, TwitterStreamConstants { - - private String dispatcherImpl; - private String siteStreamBaseURL; - private String userStreamBaseURL; - private String streamBaseURL; - - private int httpStreamingReadTimeout; - private int asyncNumThreads; - - private boolean userStreamRepliesAllEnabled; - private boolean jsonStoreEnabled; - private boolean stallWarningsEnabled; - - protected StreamConfigurationBase() { - super(); - setAsyncNumThreads(1); - setHttpStreamingReadTimeout(40 * 1000); - setDispatcherImpl("twitter4j.internal.async.DispatcherImpl"); - setStreamBaseURL(DEFAULT_STREAM_BASE_URL); - setUserStreamBaseURL(DEFAULT_USER_STREAM_BASE_URL); - setSiteStreamBaseURL(DEFAULT_SITE_STREAM_BASE_URL); - setUserStreamRepliesAllEnabled(false); - } - - @Override - public final int getAsyncNumThreads() { - return asyncNumThreads; - } - - @Override - public String getDispatcherImpl() { - return dispatcherImpl; - } - - @Override - public int getHttpStreamingReadTimeout() { - return httpStreamingReadTimeout; - } - - @Override - public String getSiteStreamBaseURL() { - return siteStreamBaseURL; - } - - @Override - public String getStreamBaseURL() { - return streamBaseURL; - } - - @Override - public String getUserStreamBaseURL() { - return userStreamBaseURL; - } - - @Override - public boolean isJSONStoreEnabled() { - return jsonStoreEnabled; - } - - @Override - public boolean isStallWarningsEnabled() { - return stallWarningsEnabled; - } - - @Override - public boolean isUserStreamRepliesAllEnabled() { - return userStreamRepliesAllEnabled; - } - - public void setStallWarningsEnabled(final boolean isStallWarningsEnabled) { - stallWarningsEnabled = isStallWarningsEnabled; - } - - protected final void setAsyncNumThreads(final int asyncNumThreads) { - this.asyncNumThreads = asyncNumThreads; - } - - protected final void setDispatcherImpl(final String dispatcherImpl) { - this.dispatcherImpl = dispatcherImpl; - } - - protected final void setHttpStreamingReadTimeout(final int httpStreamingReadTimeout) { - this.httpStreamingReadTimeout = httpStreamingReadTimeout; - } - - protected final void setJSONStoreEnabled(final boolean enabled) { - jsonStoreEnabled = enabled; - } - - protected final void setSiteStreamBaseURL(String siteStreamBaseURL) { - if (isNullOrEmpty(siteStreamBaseURL)) { - siteStreamBaseURL = DEFAULT_SITE_STREAM_BASE_URL; - } - this.siteStreamBaseURL = fixURLSlash(siteStreamBaseURL); - fixSiteStreamBaseURL(); - } - - protected final void setStreamBaseURL(String streamBaseURL) { - if (isNullOrEmpty(streamBaseURL)) { - streamBaseURL = DEFAULT_STREAM_BASE_URL; - } - this.streamBaseURL = fixURLSlash(streamBaseURL); - fixStreamBaseURL(); - } - - protected final void setUserStreamBaseURL(String userStreamBaseURL) { - if (isNullOrEmpty(userStreamBaseURL)) { - userStreamBaseURL = DEFAULT_USER_STREAM_BASE_URL; - } - this.userStreamBaseURL = fixURLSlash(userStreamBaseURL); - fixUserStreamBaseURL(); - } - - protected final void setUserStreamRepliesAllEnabled(final boolean enabled) { - userStreamRepliesAllEnabled = enabled; - } - - private void fixSiteStreamBaseURL() { - if (DEFAULT_SITE_STREAM_BASE_URL.equals(fixURL(DEFAULT_USE_SSL, siteStreamBaseURL))) { - siteStreamBaseURL = fixURL(isSSLEnabled(), siteStreamBaseURL); - } - if (siteStreamBaseURL != null && siteStreamBaseURL.equals(fixURL(DEFAULT_USE_SSL, siteStreamBaseURL))) { - siteStreamBaseURL = fixURL(isSSLEnabled(), siteStreamBaseURL); - } - initRequestHeaders(); - } - - private void fixStreamBaseURL() { - if (DEFAULT_STREAM_BASE_URL.equals(fixURL(DEFAULT_USE_SSL, streamBaseURL))) { - streamBaseURL = fixURL(isSSLEnabled(), streamBaseURL); - } - if (streamBaseURL != null && streamBaseURL.equals(fixURL(DEFAULT_USE_SSL, streamBaseURL))) { - streamBaseURL = fixURL(isSSLEnabled(), streamBaseURL); - } - initRequestHeaders(); - } - - private void fixUserStreamBaseURL() { - if (DEFAULT_USER_STREAM_BASE_URL.equals(fixURL(DEFAULT_USE_SSL, userStreamBaseURL))) { - userStreamBaseURL = fixURL(isSSLEnabled(), userStreamBaseURL); - } - if (userStreamBaseURL != null && userStreamBaseURL.equals(fixURL(DEFAULT_USE_SSL, userStreamBaseURL))) { - userStreamBaseURL = fixURL(isSSLEnabled(), userStreamBaseURL); - } - initRequestHeaders(); - } - -} diff --git a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/conf/StreamConfigurationBuilder.java b/twidere.component.twitter4j.streaming/src/main/java/twitter4j/conf/StreamConfigurationBuilder.java deleted file mode 100644 index 6d09f7339..000000000 --- a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/conf/StreamConfigurationBuilder.java +++ /dev/null @@ -1,297 +0,0 @@ -/* - * Twidere - Twitter client for Android - * - * Copyright (C) 2012-2015 Mariotaku Lee - * - * 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 . - */ - -package twitter4j.conf; - -import twitter4j.http.HostAddressResolverFactory; -import twitter4j.http.HttpClientFactory; - -/** - * A builder that can be used to construct a twitter4j configuration with - * desired settings. This builder has sensible defaults such that - * {@code new ConfigurationBuilder().build()} would create a usable - * configuration. This configuration builder is useful for clients that wish to - * configure twitter4j in unit tests or from command line flags for example. - * - * @author John Sirois - john.sirois at gmail.com - */ -@SuppressWarnings("unused") -public final class StreamConfigurationBuilder { - - private StreamConfigurationBase configuration = new StreamConfigurationBase(); - - public StreamConfiguration build() { - checkNotBuilt(); - configuration.cacheInstance(); - try { - return configuration; - } finally { - configuration = null; - } - } - - public StreamConfigurationBuilder setAsyncNumThreads(final int asyncNumThreads) { - checkNotBuilt(); - configuration.setAsyncNumThreads(asyncNumThreads); - return this; - } - - public StreamConfigurationBuilder setClientName(final String clientName) { - checkNotBuilt(); - configuration.setClientName(clientName); - return this; - } - - public StreamConfigurationBuilder setClientURL(final String clientURL) { - checkNotBuilt(); - configuration.setClientURL(clientURL); - return this; - } - - public StreamConfigurationBuilder setClientVersion(final String clientVersion) { - checkNotBuilt(); - configuration.setClientVersion(clientVersion); - return this; - } - - public StreamConfigurationBuilder setDebugEnabled(final boolean debugEnabled) { - checkNotBuilt(); - configuration.setDebug(debugEnabled); - return this; - } - - public StreamConfigurationBuilder setDispatcherImpl(final String dispatcherImpl) { - checkNotBuilt(); - configuration.setDispatcherImpl(dispatcherImpl); - return this; - } - - public StreamConfigurationBuilder setGZIPEnabled(final boolean gzipEnabled) { - checkNotBuilt(); - configuration.setGZIPEnabled(gzipEnabled); - return this; - } - - public StreamConfigurationBuilder setHostAddressResolverFactory(final HostAddressResolverFactory factory) { - checkNotBuilt(); - configuration.setHostAddressResolverFactory(factory); - return this; - } - - public void setHttpClientFactory(HttpClientFactory factory) { - configuration.setHttpClientFactory(factory); - } - - public StreamConfigurationBuilder setHttpConnectionTimeout(final int httpConnectionTimeout) { - checkNotBuilt(); - configuration.setHttpConnectionTimeout(httpConnectionTimeout); - return this; - } - - public StreamConfigurationBuilder setHttpDefaultMaxPerRoute(final int httpDefaultMaxPerRoute) { - checkNotBuilt(); - configuration.setHttpDefaultMaxPerRoute(httpDefaultMaxPerRoute); - return this; - } - - public StreamConfigurationBuilder setHttpMaxTotalConnections(final int httpMaxConnections) { - checkNotBuilt(); - configuration.setHttpMaxTotalConnections(httpMaxConnections); - return this; - } - - public StreamConfigurationBuilder setHttpProxyHost(final String httpProxyHost) { - checkNotBuilt(); - configuration.setHttpProxyHost(httpProxyHost); - return this; - } - - public StreamConfigurationBuilder setHttpProxyPassword(final String httpProxyPassword) { - checkNotBuilt(); - configuration.setHttpProxyPassword(httpProxyPassword); - return this; - } - - public StreamConfigurationBuilder setHttpProxyPort(final int httpProxyPort) { - checkNotBuilt(); - configuration.setHttpProxyPort(httpProxyPort); - return this; - } - - public StreamConfigurationBuilder setHttpProxyUser(final String httpProxyUser) { - checkNotBuilt(); - configuration.setHttpProxyUser(httpProxyUser); - return this; - } - - public StreamConfigurationBuilder setHttpReadTimeout(final int httpReadTimeout) { - checkNotBuilt(); - configuration.setHttpReadTimeout(httpReadTimeout); - return this; - } - - public StreamConfigurationBuilder setHttpRetryCount(final int httpRetryCount) { - checkNotBuilt(); - configuration.setHttpRetryCount(httpRetryCount); - return this; - } - - public StreamConfigurationBuilder setHttpRetryIntervalSeconds(final int httpRetryIntervalSeconds) { - checkNotBuilt(); - configuration.setHttpRetryIntervalSeconds(httpRetryIntervalSeconds); - return this; - } - - public StreamConfigurationBuilder setHttpStreamingReadTimeout(final int httpStreamingReadTimeout) { - checkNotBuilt(); - configuration.setHttpStreamingReadTimeout(httpStreamingReadTimeout); - return this; - } - - public StreamConfigurationBuilder setIgnoreSSLError(final boolean ignoreSSLError) { - checkNotBuilt(); - configuration.setIgnoreSSLError(ignoreSSLError); - return this; - } - - public StreamConfigurationBuilder setIncludeEntitiesEnabled(final boolean enabled) { - checkNotBuilt(); - configuration.setIncludeEntitiesEnabled(enabled); - return this; - } - - public StreamConfigurationBuilder setIncludeRTsEnabled(final boolean enabled) { - checkNotBuilt(); - configuration.setIncludeRTsEnabled(enabled); - return this; - } - - public StreamConfigurationBuilder setJSONStoreEnabled(final boolean enabled) { - checkNotBuilt(); - configuration.setJSONStoreEnabled(enabled); - return this; - } - - public StreamConfigurationBuilder setOAuthAccessToken(final String oAuthAccessToken) { - checkNotBuilt(); - configuration.setOAuthAccessToken(oAuthAccessToken); - return this; - } - - public StreamConfigurationBuilder setOAuthAccessTokenSecret(final String oAuthAccessTokenSecret) { - checkNotBuilt(); - configuration.setOAuthAccessTokenSecret(oAuthAccessTokenSecret); - return this; - } - - public StreamConfigurationBuilder setOAuthBaseURL(final String oAuthBaseURL) { - checkNotBuilt(); - configuration.setOAuthBaseURL(oAuthBaseURL); - return this; - } - - public StreamConfigurationBuilder setOAuthConsumerKey(final String oAuthConsumerKey) { - checkNotBuilt(); - configuration.setOAuthConsumerKey(oAuthConsumerKey); - return this; - } - - public StreamConfigurationBuilder setOAuthConsumerSecret(final String oAuthConsumerSecret) { - checkNotBuilt(); - configuration.setOAuthConsumerSecret(oAuthConsumerSecret); - return this; - } - - public StreamConfigurationBuilder setPassword(final String password) { - checkNotBuilt(); - configuration.setPassword(password); - return this; - } - - public StreamConfigurationBuilder setPrettyDebugEnabled(final boolean prettyDebugEnabled) { - checkNotBuilt(); - configuration.setPrettyDebugEnabled(prettyDebugEnabled); - return this; - } - - public StreamConfigurationBuilder setRestBaseURL(final String restBaseURL) { - checkNotBuilt(); - configuration.setRestBaseURL(restBaseURL); - return this; - } - - public StreamConfigurationBuilder setSigningOAuthBaseURL(final String signingOAuthBaseURL) { - checkNotBuilt(); - configuration.setSigningOAuthBaseURL(signingOAuthBaseURL); - return this; - } - - public StreamConfigurationBuilder setSigningRestBaseURL(final String signingRestBaseURL) { - checkNotBuilt(); - configuration.setSigningRestBaseURL(signingRestBaseURL); - return this; - } - - public StreamConfigurationBuilder setSiteStreamBaseURL(final String siteStreamBaseURL) { - checkNotBuilt(); - configuration.setSiteStreamBaseURL(siteStreamBaseURL); - return this; - } - - public StreamConfigurationBuilder setStreamBaseURL(final String streamBaseURL) { - checkNotBuilt(); - configuration.setStreamBaseURL(streamBaseURL); - return this; - } - - public StreamConfigurationBuilder setUser(final String user) { - checkNotBuilt(); - configuration.setUser(user); - return this; - } - - public StreamConfigurationBuilder setHttpUserAgent(final String userAgent) { - checkNotBuilt(); - configuration.setHttpUserAgent(userAgent); - return this; - } - - public StreamConfigurationBuilder setUserStreamBaseURL(final String siteStreamBaseURL) { - checkNotBuilt(); - configuration.setUserStreamBaseURL(siteStreamBaseURL); - return this; - } - - public StreamConfigurationBuilder setUserStreamRepliesAllEnabled(final boolean enabled) { - checkNotBuilt(); - configuration.setUserStreamRepliesAllEnabled(enabled); - return this; - } - - public StreamConfigurationBuilder setUseSSL(final boolean useSSL) { - checkNotBuilt(); - configuration.setUseSSL(useSSL); - return this; - } - - private void checkNotBuilt() { - if (configuration == null) - throw new IllegalStateException("Cannot use this builder any longer, build() has already been called"); - } -} diff --git a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/conf/StreamConfigurationContext.java b/twidere.component.twitter4j.streaming/src/main/java/twitter4j/conf/StreamConfigurationContext.java deleted file mode 100644 index 0a8cc61d6..000000000 --- a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/conf/StreamConfigurationContext.java +++ /dev/null @@ -1,9 +0,0 @@ -package twitter4j.conf; - -public class StreamConfigurationContext { - private static final StreamConfigurationFactory factory = new BaseStreamConfigurationFactory(); - - public static StreamConfiguration getInstance() { - return factory.getInstance(); - } -} diff --git a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/conf/StreamConfigurationFactory.java b/twidere.component.twitter4j.streaming/src/main/java/twitter4j/conf/StreamConfigurationFactory.java deleted file mode 100644 index afa14abfe..000000000 --- a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/conf/StreamConfigurationFactory.java +++ /dev/null @@ -1,12 +0,0 @@ -package twitter4j.conf; - -public interface StreamConfigurationFactory extends ConfigurationFactory { - - /** - * returns the root configuration - * - * @return root configuration - */ - @Override - StreamConfiguration getInstance(); -} diff --git a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/internal/async/Dispatcher.java b/twidere.component.twitter4j.streaming/src/main/java/twitter4j/internal/async/Dispatcher.java deleted file mode 100644 index 4906b41ac..000000000 --- a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/internal/async/Dispatcher.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2007 Yusuke Yamamoto - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package twitter4j.internal.async; - -/** - * @author Yusuke Yamamoto - yusuke at mac.com - */ -public interface Dispatcher { - - void invokeLater(Runnable task); - - void shutdown(); -} diff --git a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/internal/async/DispatcherFactory.java b/twidere.component.twitter4j.streaming/src/main/java/twitter4j/internal/async/DispatcherFactory.java deleted file mode 100644 index 9dc1da024..000000000 --- a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/internal/async/DispatcherFactory.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2007 Yusuke Yamamoto - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package twitter4j.internal.async; - -import java.lang.reflect.InvocationTargetException; - -import twitter4j.conf.StreamConfiguration; -import twitter4j.conf.StreamConfigurationContext; - -/** - * @author Yusuke Yamamoto - yusuke at mac.com - * @since Twitter4J 2.1.2 - */ -public final class DispatcherFactory { - private final String dispatcherImpl; - private final StreamConfiguration conf; - - public DispatcherFactory() { - this(StreamConfigurationContext.getInstance()); - } - - public DispatcherFactory(final StreamConfiguration conf) { - dispatcherImpl = conf.getDispatcherImpl(); - this.conf = conf; - } - - /** - * returns a Dispatcher instance. - * - * @return dispatcher instance - */ - public Dispatcher getInstance() { - try { - return (Dispatcher) Class.forName(dispatcherImpl).getConstructor(StreamConfiguration.class) - .newInstance(conf); - } catch (final InstantiationException e) { - throw new AssertionError(e); - } catch (final IllegalAccessException e) { - throw new AssertionError(e); - } catch (final ClassNotFoundException e) { - throw new AssertionError(e); - } catch (final ClassCastException e) { - throw new AssertionError(e); - } catch (final NoSuchMethodException e) { - throw new AssertionError(e); - } catch (final InvocationTargetException e) { - throw new AssertionError(e); - } - } -} diff --git a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/internal/async/DispatcherImpl.java b/twidere.component.twitter4j.streaming/src/main/java/twitter4j/internal/async/DispatcherImpl.java deleted file mode 100644 index 5d07abf3a..000000000 --- a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/internal/async/DispatcherImpl.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright 2007 Yusuke Yamamoto - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package twitter4j.internal.async; - -import java.util.LinkedList; -import java.util.List; - -import twitter4j.conf.StreamConfiguration; -import twitter4j.internal.logging.Logger; - -/** - * @author Yusuke Yamamoto - yusuke at mac.com - * @since Twitter4J 2.1.2 - */ -final class DispatcherImpl implements Dispatcher { - private final ExecuteThread[] threads; - private final List q = new LinkedList(); - - final Object ticket = new Object(); - - private boolean active = true; - - public DispatcherImpl(final StreamConfiguration conf) { - threads = new ExecuteThread[conf.getAsyncNumThreads()]; - for (int i = 0; i < threads.length; i++) { - threads[i] = new ExecuteThread("Twitter4J Async Dispatcher", this, i); - threads[i].setDaemon(true); - threads[i].start(); - } - Runtime.getRuntime().addShutdownHook(new Thread() { - @Override - public void run() { - if (active) { - shutdown(); - } - } - }); - } - - @Override - public synchronized void invokeLater(final Runnable task) { - synchronized (q) { - q.add(task); - } - synchronized (ticket) { - ticket.notify(); - } - } - - public Runnable poll() { - while (active) { - synchronized (q) { - if (q.size() > 0) { - final Runnable task = q.remove(0); - if (task != null) return task; - } - } - synchronized (ticket) { - try { - ticket.wait(); - } catch (final InterruptedException ignore) { - } - } - } - return null; - } - - @Override - public synchronized void shutdown() { - if (active) { - active = false; - for (final ExecuteThread thread : threads) { - thread.shutdown(); - } - synchronized (ticket) { - ticket.notify(); - } - } - } -} - -class ExecuteThread extends Thread { - private static Logger logger = Logger.getLogger(DispatcherImpl.class); - DispatcherImpl q; - - private boolean alive = true; - - ExecuteThread(final String name, final DispatcherImpl q, final int index) { - super(name + "[" + index + "]"); - this.q = q; - } - - @Override - public void run() { - while (alive) { - final Runnable task = q.poll(); - if (task != null) { - try { - task.run(); - } catch (final Exception ex) { - logger.error("Got an exception while running a task:", ex); - } - } - } - } - - public void shutdown() { - alive = false; - } -} diff --git a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/internal/json/DataObjectFactoryUtil.java b/twidere.component.twitter4j.streaming/src/main/java/twitter4j/internal/json/DataObjectFactoryUtil.java deleted file mode 100644 index d4d734710..000000000 --- a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/internal/json/DataObjectFactoryUtil.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2007 Yusuke Yamamoto - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package twitter4j.internal.json; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -import twitter4j.json.DataObjectFactory; - -/** - * provides public access to package private methods of - * twitter4j.json.DataObjectFactory class.
- * This class is not intended to be used by Twitter4J client. - * - * @author Yusuke Yamamoto - yusuke at mac.com - * @since Twitter4J 2.1.7 - */ -public class DataObjectFactoryUtil { - private static final Method CLEAR_THREAD_LOCAL_MAP; - - private static final Method REGISTER_JSON_OBJECT; - static { - final Method[] methods = DataObjectFactory.class.getDeclaredMethods(); - Method clearThreadLocalMap = null; - Method registerJSONObject = null; - for (final Method method : methods) { - if (method.getName().equals("clearThreadLocalMap")) { - clearThreadLocalMap = method; - clearThreadLocalMap.setAccessible(true); - } else if (method.getName().equals("registerJSONObject")) { - registerJSONObject = method; - registerJSONObject.setAccessible(true); - } - } - if (null == clearThreadLocalMap || null == registerJSONObject) throw new AssertionError(); - CLEAR_THREAD_LOCAL_MAP = clearThreadLocalMap; - REGISTER_JSON_OBJECT = registerJSONObject; - } - - private DataObjectFactoryUtil() { - throw new AssertionError("not intended to be instantiated."); - } - - /** - * provides a public access to {DAOFactory#clearThreadLocalMap} - */ - public static void clearThreadLocalMap() { - try { - CLEAR_THREAD_LOCAL_MAP.invoke(null); - } catch (final IllegalAccessException e) { - throw new AssertionError(e); - } catch (final InvocationTargetException e) { - throw new AssertionError(e); - } - } - - /** - * provides a public access to {DAOFactory#registerJSONObject} - */ - @SuppressWarnings("unchecked") - public static T registerJSONObject(final T key, final Object json) { - try { - return (T) REGISTER_JSON_OBJECT.invoke(null, key, json); - } catch (final IllegalAccessException e) { - throw new AssertionError(e); - } catch (final InvocationTargetException e) { - throw new AssertionError(e); - } - } -} diff --git a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/json/DataObjectFactory.java b/twidere.component.twitter4j.streaming/src/main/java/twitter4j/json/DataObjectFactory.java deleted file mode 100644 index 67c78190d..000000000 --- a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/json/DataObjectFactory.java +++ /dev/null @@ -1,595 +0,0 @@ -/* - * Copyright 2007 Yusuke Yamamoto - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package twitter4j.json; - -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.Map; - -import org.json.JSONException; -import org.json.JSONObject; - -import twitter4j.AccountTotals; -import twitter4j.Category; -import twitter4j.DirectMessage; -import twitter4j.IDs; -import twitter4j.Location; -import twitter4j.OEmbed; -import twitter4j.Place; -import twitter4j.RateLimitStatus; -import twitter4j.Relationship; -import twitter4j.SavedSearch; -import twitter4j.Status; -import twitter4j.StatusDeletionNotice; -import twitter4j.Trend; -import twitter4j.Trends; -import twitter4j.TwitterException; -import twitter4j.User; -import twitter4j.UserList; - -/** - * @author Yusuke Yamamoto - yusuke at mac.com - * @since Twitter4J 2.1.7 - */ -@SuppressWarnings("unchecked") -public final class DataObjectFactory { - private static final Constructor statusConstructor; - - private static final Constructor userConstructor; - private static final Constructor relationshipConstructor; - private static final Constructor placeConstructor; - private static final Constructor savedSearchConstructor; - private static final Constructor trendConstructor; - private static final Constructor trendsConstructor; - private static final Constructor IDsConstructor; - private static final Method rateLimitStatusConstructor; - private static final Constructor categoryConstructor; - private static final Constructor directMessageConstructor; - private static final Constructor locationConstructor; - private static final Constructor userListConstructor; - private static final Constructor statusDeletionNoticeConstructor; - private static final Constructor accountTotalsConstructor; - private static final Constructor oembedConstructor; - static { - try { - statusConstructor = (Constructor) Class.forName("twitter4j.internal.json.StatusJSONImpl") - .getDeclaredConstructor(JSONObject.class); - statusConstructor.setAccessible(true); - - userConstructor = (Constructor) Class.forName("twitter4j.internal.json.UserJSONImpl") - .getDeclaredConstructor(JSONObject.class); - userConstructor.setAccessible(true); - - relationshipConstructor = (Constructor) Class.forName( - "twitter4j.internal.json.RelationshipJSONImpl").getDeclaredConstructor(JSONObject.class); - relationshipConstructor.setAccessible(true); - - placeConstructor = (Constructor) Class.forName("twitter4j.internal.json.PlaceJSONImpl") - .getDeclaredConstructor(JSONObject.class); - placeConstructor.setAccessible(true); - - savedSearchConstructor = (Constructor) Class.forName( - "twitter4j.internal.json.SavedSearchJSONImpl").getDeclaredConstructor(JSONObject.class); - savedSearchConstructor.setAccessible(true); - - trendConstructor = (Constructor) Class.forName("twitter4j.internal.json.TrendJSONImpl") - .getDeclaredConstructor(JSONObject.class); - trendConstructor.setAccessible(true); - - trendsConstructor = (Constructor) Class.forName("twitter4j.internal.json.TrendsJSONImpl") - .getDeclaredConstructor(String.class); - trendsConstructor.setAccessible(true); - - IDsConstructor = (Constructor) Class.forName("twitter4j.internal.json.IDsJSONImpl") - .getDeclaredConstructor(String.class); - IDsConstructor.setAccessible(true); - - rateLimitStatusConstructor = Class.forName("twitter4j.internal.json.RateLimitStatusJSONImpl") - .getDeclaredMethod("createRateLimitStatuses", JSONObject.class); - rateLimitStatusConstructor.setAccessible(true); - - categoryConstructor = (Constructor) Class.forName("twitter4j.internal.json.CategoryJSONImpl") - .getDeclaredConstructor(JSONObject.class); - categoryConstructor.setAccessible(true); - - directMessageConstructor = (Constructor) Class.forName( - "twitter4j.internal.json.DirectMessageJSONImpl").getDeclaredConstructor(JSONObject.class); - directMessageConstructor.setAccessible(true); - - locationConstructor = (Constructor) Class.forName("twitter4j.internal.json.LocationJSONImpl") - .getDeclaredConstructor(JSONObject.class); - locationConstructor.setAccessible(true); - - userListConstructor = (Constructor) Class.forName("twitter4j.internal.json.UserListJSONImpl") - .getDeclaredConstructor(JSONObject.class); - userListConstructor.setAccessible(true); - - statusDeletionNoticeConstructor = (Constructor) Class.forName( - "twitter4j.StatusDeletionNoticeImpl").getDeclaredConstructor(JSONObject.class); - statusDeletionNoticeConstructor.setAccessible(true); - - accountTotalsConstructor = (Constructor) Class.forName( - "twitter4j.internal.json.AccountTotalsJSONImpl").getDeclaredConstructor(JSONObject.class); - accountTotalsConstructor.setAccessible(true); - oembedConstructor = (Constructor) Class.forName("twitter4j.internal.json.OEmbedJSONImpl") - .getDeclaredConstructor(JSONObject.class); - oembedConstructor.setAccessible(true); - } catch (final NoSuchMethodException e) { - throw new ExceptionInInitializerError(e); - } catch (final ClassNotFoundException e) { - throw new ExceptionInInitializerError(e); - } - } - - @SuppressWarnings("rawtypes") - private static final ThreadLocal rawJsonMap = new ThreadLocal() { - @Override - protected Map initialValue() { - return new HashMap(); - } - }; - - private DataObjectFactory() { - throw new AssertionError("not intended to be instantiated."); - } - - /** - * Constructs an AccountTotals object from rawJSON string. - * - * @param rawJSON raw JSON form as String - * @return AccountTotals - * @throws TwitterException when provided string is not a valid JSON string. - * @since Twitter4J 2.1.9 - */ - public static AccountTotals createAccountTotals(final String rawJSON) throws TwitterException { - try { - final JSONObject json = new JSONObject(rawJSON); - return accountTotalsConstructor.newInstance(json); - } catch (final InstantiationException e) { - throw new TwitterException(e); - } catch (final IllegalAccessException e) { - throw new AssertionError(e); - } catch (final InvocationTargetException e) { - throw new TwitterException(e); - } catch (final JSONException e) { - throw new TwitterException(e); - } - } - - /** - * Constructs a Category object from rawJSON string. - * - * @param rawJSON raw JSON form as String - * @return Category - * @throws TwitterException when provided string is not a valid JSON string. - * @since Twitter4J 2.1.7 - */ - public static Category createCategory(final String rawJSON) throws TwitterException { - try { - final JSONObject json = new JSONObject(rawJSON); - return categoryConstructor.newInstance(json); - } catch (final InstantiationException e) { - throw new TwitterException(e); - } catch (final IllegalAccessException e) { - throw new AssertionError(e); - } catch (final InvocationTargetException e) { - throw new TwitterException(e); - } catch (final JSONException e) { - throw new TwitterException(e); - } - } - - /** - * Constructs a DirectMessage object from rawJSON string. - * - * @param rawJSON raw JSON form as String - * @return DirectMessage - * @throws TwitterException when provided string is not a valid JSON string. - * @since Twitter4J 2.1.7 - */ - public static DirectMessage createDirectMessage(final String rawJSON) throws TwitterException { - try { - final JSONObject json = new JSONObject(rawJSON); - return directMessageConstructor.newInstance(json); - } catch (final InstantiationException e) { - throw new TwitterException(e); - } catch (final IllegalAccessException e) { - throw new AssertionError(e); - } catch (final InvocationTargetException e) { - throw new TwitterException(e); - } catch (final JSONException e) { - throw new TwitterException(e); - } - } - - /** - * Constructs a IDs object from rawJSON string. - * - * @param rawJSON raw JSON form as String - * @return IDs - * @throws TwitterException when provided string is not a valid JSON string. - * @since Twitter4J 2.1.7 - */ - public static IDs createIDs(final String rawJSON) throws TwitterException { - try { - return IDsConstructor.newInstance(rawJSON); - } catch (final InstantiationException e) { - throw new TwitterException(e); - } catch (final IllegalAccessException e) { - throw new AssertionError(e); - } catch (final InvocationTargetException e) { - throw new TwitterException(e); - } - } - - /** - * Constructs a Location object from rawJSON string. - * - * @param rawJSON raw JSON form as String - * @return Location - * @throws TwitterException when provided string is not a valid JSON string. - * @since Twitter4J 2.1.7 - */ - public static Location createLocation(final String rawJSON) throws TwitterException { - try { - final JSONObject json = new JSONObject(rawJSON); - return locationConstructor.newInstance(json); - } catch (final InstantiationException e) { - throw new TwitterException(e); - } catch (final IllegalAccessException e) { - throw new AssertionError(e); - } catch (final InvocationTargetException e) { - throw new TwitterException(e); - } catch (final JSONException e) { - throw new TwitterException(e); - } - } - - /** - * Construct an object from rawJSON string. This method may be called when - * you do not know what a given raw JSON string contains. It will do the - * work of determining what type of object the JSON represents, and - * constructing the respective object type. For example, if the JSON - * contents represents a Status, then a Status will be returned. If it - * represents a deletion notice, then a StatusDeletionNotice will be - * returned. The caller can simply use instanceof to handle the returned - * object as applicable. NOTE: the raw JSONObject will be returned in cases - * where there isn't a discrete respective object type that can be - * constructed. That way, the caller can at least have access to the JSON - * itself. - * - * @param rawJSON raw JSON form as String - * @return the respective constructed object, or the JSONObject in the case - * where we cannot determine the object type. - * @throws TwitterException when provided string is not a valid JSON string. - * @since Twitter4J 2.1.9 - */ - public static Object createObject(final String rawJSON) throws TwitterException { - try { - final JSONObject json = new JSONObject(rawJSON); - final JSONObjectType.Type jsonObjectType = JSONObjectType.determine(json); - switch (jsonObjectType) { - case SENDER: - return registerJSONObject( - directMessageConstructor.newInstance(json.getJSONObject("direct_message")), json); - case STATUS: - return registerJSONObject(statusConstructor.newInstance(json), json); - case DIRECT_MESSAGE: - return registerJSONObject( - directMessageConstructor.newInstance(json.getJSONObject("direct_message")), json); - case DELETE: - return registerJSONObject( - statusDeletionNoticeConstructor.newInstance(json.getJSONObject("delete").getJSONObject( - "status")), json); - case LIMIT: - // TODO: Perhaps there should be a TrackLimitationNotice - // object? - // The onTrackLimitationNotice method could take that as an - // arg. - return json; - case SCRUB_GEO: - return json; - default: - // The object type is unrecognized...just return the json - return json; - } - } catch (final InstantiationException e) { - throw new TwitterException(e); - } catch (final IllegalAccessException e) { - throw new AssertionError(e); - } catch (final InvocationTargetException e) { - throw new TwitterException(e); - } catch (final JSONException e) { - throw new TwitterException(e); - } - } - - /** - * Constructs an OEmbed object from rawJSON string. - * - * @param rawJSON raw JSON form as String - * @return OEmbed - * @throws TwitterException when provided string is not a valid JSON string. - * @since Twitter4J 3.0.2 - */ - public static OEmbed createOEmbed(final String rawJSON) throws TwitterException { - try { - final JSONObject json = new JSONObject(rawJSON); - return oembedConstructor.newInstance(json); - } catch (final InstantiationException e) { - throw new TwitterException(e); - } catch (final IllegalAccessException e) { - throw new AssertionError(e); - } catch (final InvocationTargetException e) { - throw new TwitterException(e); - } catch (final JSONException e) { - throw new TwitterException(e); - } - } - - /** - * Constructs a Place object from rawJSON string. - * - * @param rawJSON raw JSON form as String - * @return Place - * @throws TwitterException when provided string is not a valid JSON string. - * @since Twitter4J 2.1.7 - */ - public static Place createPlace(final String rawJSON) throws TwitterException { - try { - final JSONObject json = new JSONObject(rawJSON); - return placeConstructor.newInstance(json); - } catch (final InstantiationException e) { - throw new TwitterException(e); - } catch (final IllegalAccessException e) { - throw new AssertionError(e); - } catch (final InvocationTargetException e) { - throw new TwitterException(e); - } catch (final JSONException e) { - throw new TwitterException(e); - } - } - - /** - * Constructs a RateLimitStatus object from rawJSON string. - * - * @param rawJSON raw JSON form as String - * @return RateLimitStatus - * @throws TwitterException when provided string is not a valid JSON string. - * @since Twitter4J 2.1.7 - */ - public static Map createRateLimitStatus(final String rawJSON) throws TwitterException { - try { - final JSONObject json = new JSONObject(rawJSON); - return (Map) rateLimitStatusConstructor.invoke( - Class.forName("twitter4j.internal.json.RateLimitStatusJSONImpl"), json); - } catch (final ClassNotFoundException e) { - throw new TwitterException(e); - } catch (final IllegalAccessException e) { - throw new AssertionError(e); - } catch (final InvocationTargetException e) { - throw new TwitterException(e); - } catch (final JSONException e) { - throw new TwitterException(e); - } - } - - /** - * Constructs a Relationship object from rawJSON string. - * - * @param rawJSON raw JSON form as String - * @return Relationship - * @throws TwitterException when provided string is not a valid JSON string. - * @since Twitter4J 2.1.7 - */ - public static Relationship createRelationship(final String rawJSON) throws TwitterException { - try { - final JSONObject json = new JSONObject(rawJSON); - return relationshipConstructor.newInstance(json); - } catch (final InstantiationException e) { - throw new TwitterException(e); - } catch (final IllegalAccessException e) { - throw new AssertionError(e); - } catch (final InvocationTargetException e) { - throw new TwitterException(e); - } catch (final JSONException e) { - throw new TwitterException(e); - } - } - - /** - * Constructs a SavedSearch object from rawJSON string. - * - * @param rawJSON raw JSON form as String - * @return SavedSearch - * @throws TwitterException when provided string is not a valid JSON string. - * @since Twitter4J 2.1.7 - */ - public static SavedSearch createSavedSearch(final String rawJSON) throws TwitterException { - try { - final JSONObject json = new JSONObject(rawJSON); - return savedSearchConstructor.newInstance(json); - } catch (final InstantiationException e) { - throw new TwitterException(e); - } catch (final IllegalAccessException e) { - throw new AssertionError(e); - } catch (final InvocationTargetException e) { - throw new TwitterException(e); - } catch (final JSONException e) { - throw new TwitterException(e); - } - } - - /** - * Constructs a Status object from rawJSON string. - * - * @param rawJSON raw JSON form as String - * @return Status - * @throws TwitterException when provided string is not a valid JSON string. - * @since Twitter4J 2.1.7 - */ - public static Status createStatus(final String rawJSON) throws TwitterException { - try { - final JSONObject json = new JSONObject(rawJSON); - return statusConstructor.newInstance(json); - } catch (final InstantiationException e) { - throw new TwitterException(e); - } catch (final IllegalAccessException e) { - throw new AssertionError(e); - } catch (final InvocationTargetException e) { - throw new TwitterException(e); - } catch (final JSONException e) { - throw new TwitterException(e); - } - } - - /** - * Constructs a Trend object from rawJSON string. - * - * @param rawJSON raw JSON form as String - * @return Trend - * @throws TwitterException when provided string is not a valid JSON string. - * @since Twitter4J 2.1.7 - */ - public static Trend createTrend(final String rawJSON) throws TwitterException { - try { - final JSONObject json = new JSONObject(rawJSON); - return trendConstructor.newInstance(json); - } catch (final InstantiationException e) { - throw new TwitterException(e); - } catch (final IllegalAccessException e) { - throw new AssertionError(e); - } catch (final InvocationTargetException e) { - throw new TwitterException(e); - } catch (final JSONException e) { - throw new TwitterException(e); - } - } - - /** - * Constructs a Trends object from rawJSON string. - * - * @param rawJSON raw JSON form as String - * @return Trends - * @throws TwitterException when provided string is not a valid JSON string. - * @since Twitter4J 2.1.7 - */ - public static Trends createTrends(final String rawJSON) throws TwitterException { - try { - return trendsConstructor.newInstance(rawJSON); - } catch (final InstantiationException e) { - throw new TwitterException(e); - } catch (final IllegalAccessException e) { - throw new TwitterException(e); - } catch (final InvocationTargetException e) { - throw new AssertionError(e); - } - } - - /** - * Constructs a User object from rawJSON string. - * - * @param rawJSON raw JSON form as String - * @return User - * @throws TwitterException when provided string is not a valid JSON string. - * @since Twitter4J 2.1.7 - */ - public static User createUser(final String rawJSON) throws TwitterException { - try { - final JSONObject json = new JSONObject(rawJSON); - return userConstructor.newInstance(json); - } catch (final InstantiationException e) { - throw new TwitterException(e); - } catch (final IllegalAccessException e) { - throw new AssertionError(e); - } catch (final InvocationTargetException e) { - throw new TwitterException(e); - } catch (final JSONException e) { - throw new TwitterException(e); - } - } - - /** - * Constructs a UserList object from rawJSON string. - * - * @param rawJSON raw JSON form as String - * @return UserList - * @throws TwitterException when provided string is not a valid JSON string. - * @since Twitter4J 2.1.7 - */ - public static UserList createUserList(final String rawJSON) throws TwitterException { - try { - final JSONObject json = new JSONObject(rawJSON); - return userListConstructor.newInstance(json); - } catch (final InstantiationException e) { - throw new TwitterException(e); - } catch (final IllegalAccessException e) { - throw new AssertionError(e); - } catch (final InvocationTargetException e) { - throw new TwitterException(e); - } catch (final JSONException e) { - throw new TwitterException(e); - } - } - - /** - * Returns a raw JSON form of the provided object.
- * Note that raw JSON forms can be retrieved only from the same thread - * invoked the last method call and will become inaccessible once another - * method call - * - * @param obj - * @return raw JSON - * @since Twitter4J 2.1.7 - */ - public static String getRawJSON(final Object obj) { - final Object json = rawJsonMap.get().get(obj); - if (json instanceof String) - return (String) json; - else if (json != null) // object must be instance of JSONObject - return json.toString(); - else - return null; - } - - /** - * clear raw JSON forms associated with the current thread.
- * Currently this method is called indirectly by - * twitter4j.internal.util.DataObjectFactoryUtil, and should be called - * directly once *JSONImpl classes are migrated to twitter4j.json.* package. - * - * @since Twitter4J 2.1.7 - */ - static void clearThreadLocalMap() { - rawJsonMap.get().clear(); - } - - /** - * associate a raw JSON form to the current thread
- * Currently this method is called indirectly by - * twitter4j.internal.util.DataObjectFactoryUtil, and should be called - * directly once *JSONImpl classes are migrated to twitter4j.json.* package. - * - * @since Twitter4J 2.1.7 - */ - static T registerJSONObject(final T key, final Object json) { - rawJsonMap.get().put(key, json); - return key; - } -} \ No newline at end of file diff --git a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/json/JSONObjectType.java b/twidere.component.twitter4j.streaming/src/main/java/twitter4j/json/JSONObjectType.java deleted file mode 100644 index d4f2db0f3..000000000 --- a/twidere.component.twitter4j.streaming/src/main/java/twitter4j/json/JSONObjectType.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2007 Yusuke Yamamoto - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package twitter4j.json; - -import org.json.JSONException; -import org.json.JSONObject; - -import twitter4j.internal.logging.Logger; - -/** - * @author Dan Checkoway - dcheckoway at gmail.com - * @since Twitter4J 2.1.9 - */ -public final class JSONObjectType { - private static final Logger logger = Logger.getLogger(JSONObjectType.class); - - /** - * Determine the respective object type for a given JSONObject. This method - * inspects the object to figure out what type of object it represents. This - * is useful when processing JSON events of mixed type from a stream, in - * which case you may need to know what type of object to construct, or how - * to handle the event properly. - * - * @param json the JSONObject whose type should be determined - * @return the determined JSONObjectType, or null if not recognized - */ - public static Type determine(final JSONObject json) { - // This code originally lived in AbstractStreamImplementation. - // I've moved it in here to expose it as a public encapsulation of - // the object type determination logic. - if (!json.isNull("sender")) - return Type.SENDER; - else if (!json.isNull("text")) - return Type.STATUS; - else if (!json.isNull("direct_message")) - return Type.DIRECT_MESSAGE; - else if (!json.isNull("delete")) - return Type.DELETE; - else if (!json.isNull("limit")) - return Type.LIMIT; - else if (!json.isNull("warning")) - return Type.STALL_WARNING; - else if (!json.isNull("scrub_geo")) - return Type.SCRUB_GEO; - else if (!json.isNull("friends")) - return Type.FRIENDS; - else if (!json.isNull("event")) { - String event; - try { - event = json.getString("event"); - if ("favorite".equals(event)) - return Type.FAVORITE; - else if ("unfavorite".equals(event)) - return Type.UNFAVORITE; - else if ("follow".equals(event)) - return Type.FOLLOW; - else if ("unfollow".equals(event)) - return Type.UNFOLLOW; - else if (event.startsWith("list")) { - if ("list_member_added".equals(event)) - return Type.USER_LIST_MEMBER_ADDED; - else if ("list_member_removed".equals(event)) - return Type.USER_LIST_MEMBER_DELETED; - else if ("list_user_subscribed".equals(event)) - return Type.USER_LIST_SUBSCRIBED; - else if ("list_user_unsubscribed".equals(event)) - return Type.USER_LIST_UNSUBSCRIBED; - else if ("list_created".equals(event)) - return Type.USER_LIST_CREATED; - else if ("list_updated".equals(event)) - return Type.USER_LIST_UPDATED; - else if ("list_destroyed".equals(event)) return Type.USER_LIST_DESTROYED; - } else if ("user_update".equals(event)) - return Type.USER_UPDATE; - else if ("block".equals(event)) - return Type.BLOCK; - else if ("unblock".equals(event)) return Type.UNBLOCK; - } catch (final JSONException jsone) { - try { - logger.warn("Failed to get event element: ", json.toString(2)); - } catch (final JSONException ignore) { - } - } - } else if (!json.isNull("disconnect")) return Type.DISCONNECTION; - return Type.UNKNOWN; - } - - public enum Type { - SENDER, STATUS, DIRECT_MESSAGE, DELETE, LIMIT, STALL_WARNING, SCRUB_GEO, FRIENDS, FAVORITE, UNFAVORITE, FOLLOW, UNFOLLOW, USER_LIST_MEMBER_ADDED, USER_LIST_MEMBER_DELETED, USER_LIST_SUBSCRIBED, USER_LIST_UNSUBSCRIBED, USER_LIST_CREATED, USER_LIST_UPDATED, USER_LIST_DESTROYED, USER_UPDATE, BLOCK, UNBLOCK, DISCONNECTION, UNKNOWN - } -} \ No newline at end of file diff --git a/twidere.component.twitter4j/.gitignore b/twidere.component.twitter4j/.gitignore deleted file mode 100644 index 796b96d1c..000000000 --- a/twidere.component.twitter4j/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build diff --git a/twidere.component.twitter4j/build.gradle b/twidere.component.twitter4j/build.gradle deleted file mode 100644 index 27ad611e5..000000000 --- a/twidere.component.twitter4j/build.gradle +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Twidere - Twitter client for Android - * - * Copyright (C) 2012-2014 Mariotaku Lee - * - * 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 . - */ - -apply plugin: 'com.android.library' -apply plugin: 'com.neenbedankt.android-apt' -apply from: rootProject.file('global.gradle') - -android { - defaultConfig { - minSdkVersion 14 - targetSdkVersion 22 - versionCode 1 - versionName "1.0" - } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } - } -} - -dependencies { - apt 'com.bluelinelabs:logansquare-compiler:1.0.6' - compile 'com.android.support:support-annotations:22.1.1' - compile 'com.bluelinelabs:logansquare:1.0.6' - compile 'org.apache.commons:commons-lang3:3.4' - compile 'com.squareup.okhttp:okhttp:2.3.0' - compile fileTree(dir: 'libs', include: ['*.jar']) -} diff --git a/twidere.component.twitter4j/src/main/AndroidManifest.xml b/twidere.component.twitter4j/src/main/AndroidManifest.xml deleted file mode 100644 index 4d10a1c97..000000000 --- a/twidere.component.twitter4j/src/main/AndroidManifest.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/ExceptionDiagnosis.java b/twidere.component.twitter4j/src/main/java/twitter4j/ExceptionDiagnosis.java deleted file mode 100644 index 4ac416ba1..000000000 --- a/twidere.component.twitter4j/src/main/java/twitter4j/ExceptionDiagnosis.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright 2007 Yusuke Yamamoto - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package twitter4j; - -/** - * @author Yusuke Yamamoto - yusuke at mac.com - * @since Twitter4J 2.1.3 - */ -final class ExceptionDiagnosis { - int stackLineHash; - int lineNumberHash; - String hexString = ""; - Throwable th; - - ExceptionDiagnosis(final Throwable th) { - this(th, new String[] {}); - } - - ExceptionDiagnosis(final Throwable th, final String[] inclusionFilter) { - this.th = th; - - final StackTraceElement[] stackTrace = th.getStackTrace(); - stackLineHash = 0; - lineNumberHash = 0; - for (int i = stackTrace.length - 1; i >= 0; i--) { - final StackTraceElement line = stackTrace[i]; - for (final String filter : inclusionFilter) { - if (line.getClassName().startsWith(filter)) { - final int hash = line.getClassName().hashCode() + line.getMethodName().hashCode(); - stackLineHash = 31 * stackLineHash + hash; - lineNumberHash = 31 * lineNumberHash + line.getLineNumber(); - break; - } - } - } - hexString += toHexString(stackLineHash) + "-" + toHexString(lineNumberHash); - if (th.getCause() != null) { - hexString += " " + new ExceptionDiagnosis(th.getCause(), inclusionFilter).asHexString(); - } - - } - - @Override - public boolean equals(final Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - final ExceptionDiagnosis that = (ExceptionDiagnosis) o; - - if (lineNumberHash != that.lineNumberHash) return false; - if (stackLineHash != that.stackLineHash) return false; - - return true; - } - - @Override - public int hashCode() { - int result = stackLineHash; - result = 31 * result + lineNumberHash; - return result; - } - - @Override - public String toString() { - return "ExceptionDiagnosis{" + "stackLineHash=" + stackLineHash + ", lineNumberHash=" + lineNumberHash + '}'; - } - - private String toHexString(final int value) { - final String str = "0000000" + Integer.toHexString(value); - return str.substring(str.length() - 8, str.length()); - } - - String asHexString() { - return hexString; - } - - int getLineNumberHash() { - return lineNumberHash; - } - - String getLineNumberHashAsHex() { - return toHexString(lineNumberHash); - } - - int getStackLineHash() { - return stackLineHash; - } - - String getStackLineHashAsHex() { - return toHexString(stackLineHash); - } -} diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/ExtendedEntitySupport.java b/twidere.component.twitter4j/src/main/java/twitter4j/ExtendedEntitySupport.java deleted file mode 100644 index 5ad152da7..000000000 --- a/twidere.component.twitter4j/src/main/java/twitter4j/ExtendedEntitySupport.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Twidere - Twitter client for Android - * - * Copyright (C) 2012-2015 Mariotaku Lee - * - * 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 . - */ - -package twitter4j; - -/** - * @author Mariotaku Lee - * @since Twitter4J 2.2.5 - */ -public interface ExtendedEntitySupport extends EntitySupport { - - /** - * Returns an array of MediaEntities if media are available in the tweet, - * or null if no media is included in the tweet. - * - * @return an array of MediaEntities. - * @since Twitter4J 2.2.3 - */ - MediaEntity[] getExtendedMediaEntities(); - -} diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/RateLimitStatusEvent.java b/twidere.component.twitter4j/src/main/java/twitter4j/RateLimitStatusEvent.java deleted file mode 100644 index cc1be4041..000000000 --- a/twidere.component.twitter4j/src/main/java/twitter4j/RateLimitStatusEvent.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2007 Yusuke Yamamoto - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package twitter4j; - -import java.util.EventObject; - -/** - * A data interface representing Twitter REST API's rate limit status - * - * @author Yusuke Yamamoto - yusuke at mac.com - * @see Rate Limiting | - * Twitter Developers - */ -public final class RateLimitStatusEvent extends EventObject { - - private static final long serialVersionUID = 3749366911109722414L; - - private final RateLimitStatus rateLimitStatus; - - private final boolean isAccountRateLimitStatus; - - RateLimitStatusEvent(final Object source, final RateLimitStatus rateLimitStatus, - final boolean isAccountRateLimitStatus) { - super(source); - this.rateLimitStatus = rateLimitStatus; - this.isAccountRateLimitStatus = isAccountRateLimitStatus; - } - - public RateLimitStatus getRateLimitStatus() { - return rateLimitStatus; - } - - public boolean isAccountRateLimitStatus() { - return isAccountRateLimitStatus; - } - - public boolean isIPRateLimitStatus() { - return !isAccountRateLimitStatus; - } - -} diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/RateLimitStatusListener.java b/twidere.component.twitter4j/src/main/java/twitter4j/RateLimitStatusListener.java deleted file mode 100644 index d79283013..000000000 --- a/twidere.component.twitter4j/src/main/java/twitter4j/RateLimitStatusListener.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2007 Yusuke Yamamoto - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package twitter4j; - -/** - * @author Andrew Hedges - andrew.hedges at gmail.com - */ -public interface RateLimitStatusListener { - - /** - * Called when the account or IP address is hitting the rate limit.
- * onRateLimitStatus will be also called before this event. - * - * @param event rate limit status event. - */ - public void onRateLimitReached(RateLimitStatusEvent event); - - /** - * Called when the response contains rate limit status. - * - * @param event rate limit status event. - */ - public void onRateLimitStatus(RateLimitStatusEvent event); -} diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/Twitter.java b/twidere.component.twitter4j/src/main/java/twitter4j/Twitter.java deleted file mode 100644 index c517676c3..000000000 --- a/twidere.component.twitter4j/src/main/java/twitter4j/Twitter.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2007 Yusuke Yamamoto - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package twitter4j; - -import twitter4j.api.DirectMessagesResources; -import twitter4j.api.FavoritesResources; -import twitter4j.api.FriendsFollowersResources; -import twitter4j.api.HelpResources; -import twitter4j.api.ListsResources; -import twitter4j.api.PlacesGeoResources; -import twitter4j.api.PrivateActivityResources; -import twitter4j.api.PrivateDirectMessagesResources; -import twitter4j.api.PrivateFriendsFollowersResources; -import twitter4j.api.PrivateTimelinesResources; -import twitter4j.api.PrivateTweetResources; -import twitter4j.api.SavedSearchesResources; -import twitter4j.api.SearchResource; -import twitter4j.api.SpamReportingResources; -import twitter4j.api.TimelinesResources; -import twitter4j.api.TrendsResources; -import twitter4j.api.TweetResources; -import twitter4j.api.UsersResources; - -/** - * @author Yusuke Yamamoto - yusuke at mac.com - * @since Twitter4J 2.2.0 - */ -public interface Twitter extends SearchResource, TimelinesResources, - TweetResources, UsersResources, ListsResources, DirectMessagesResources, FriendsFollowersResources, - FavoritesResources, SpamReportingResources, SavedSearchesResources, TrendsResources, PlacesGeoResources, - HelpResources, PrivateActivityResources, PrivateTweetResources, PrivateTimelinesResources, - PrivateFriendsFollowersResources, PrivateDirectMessagesResources { -} diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/TwitterAPIMonitor.java b/twidere.component.twitter4j/src/main/java/twitter4j/TwitterAPIMonitor.java deleted file mode 100644 index 1dc538053..000000000 --- a/twidere.component.twitter4j/src/main/java/twitter4j/TwitterAPIMonitor.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Twidere - Twitter client for Android - * - * Copyright (C) 2012-2015 Mariotaku Lee - * - * 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 . - */ - -package twitter4j; - -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import twitter4j.management.APIStatistics; -import twitter4j.management.APIStatisticsMBean; - -/** - * Singleton instance of all Twitter API monitoring. Handles URL parsing and - * "wire off" logic. We could avoid using a singleton here if Twitter objects - * were instantiated from a factory. - * - * @author Nick Dellamaggiore (nick.dellamaggiore gmail.com) - * @since Twitter4J 2.2.1 - */ -public class TwitterAPIMonitor { - // https?:\/\/[^\/]+\/([a-zA-Z_\.]*).* - // finds the "method" part a Twitter REST API url, ignoring member-specific - // resource names - private static final Pattern pattern = Pattern.compile("https?:\\/\\/[^\\/]+\\/([a-zA-Z_\\.]*).*"); - - private static final TwitterAPIMonitor SINGLETON = new TwitterAPIMonitor(); - - private final APIStatistics STATISTICS = new APIStatistics(100); - - static { - System.setProperty("http.keepAlive", "false"); - } - - /** - * Constructor - */ - private TwitterAPIMonitor() { - } - - public APIStatisticsMBean getStatistics() { - return STATISTICS; - } - - void methodCalled(final String twitterUrl, final long elapsedTime, final boolean success) { - final Matcher matcher = pattern.matcher(twitterUrl); - if (matcher.matches() && matcher.groupCount() > 0) { - final String method = matcher.group(); - STATISTICS.methodCalled(method, elapsedTime, success); - } - } - - public static TwitterAPIMonitor getInstance() { - return SINGLETON; - } -} diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/Version.java b/twidere.component.twitter4j/src/main/java/twitter4j/Version.java deleted file mode 100644 index f22afa3e9..000000000 --- a/twidere.component.twitter4j/src/main/java/twitter4j/Version.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2007 Yusuke Yamamoto - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package twitter4j; - -/** - * @author Yusuke Yamamoto - yusuke at mac.com - */ -public final class Version { - private static final String VERSION = "3.0.3"; - private static final String TITLE = "Twitter4J"; - - private Version() { - throw new AssertionError(); - } - - public static String getVersion() { - return VERSION; - } - - /** - * prints the version string - * - * @param args will be just ignored. - */ - public static void main(final String[] args) { - System.out.println(TITLE + " " + VERSION); - } -} diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/api/PrivateResources.java b/twidere.component.twitter4j/src/main/java/twitter4j/api/PrivateResources.java deleted file mode 100644 index 6dcedd727..000000000 --- a/twidere.component.twitter4j/src/main/java/twitter4j/api/PrivateResources.java +++ /dev/null @@ -1,5 +0,0 @@ -package twitter4j.api; - -public interface PrivateResources { - -} diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/http/HostAddressResolver.java b/twidere.component.twitter4j/src/main/java/twitter4j/http/HostAddressResolver.java deleted file mode 100644 index 9e47526ad..000000000 --- a/twidere.component.twitter4j/src/main/java/twitter4j/http/HostAddressResolver.java +++ /dev/null @@ -1,10 +0,0 @@ -package twitter4j.http; - -import java.io.IOException; -import java.net.InetAddress; - -public interface HostAddressResolver { - - public InetAddress[] resolve(String host) throws IOException; - -} diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/http/HostAddressResolverFactory.java b/twidere.component.twitter4j/src/main/java/twitter4j/http/HostAddressResolverFactory.java deleted file mode 100644 index cc1e1d02b..000000000 --- a/twidere.component.twitter4j/src/main/java/twitter4j/http/HostAddressResolverFactory.java +++ /dev/null @@ -1,7 +0,0 @@ -package twitter4j.http; - -public interface HostAddressResolverFactory { - - public HostAddressResolver getInstance(HttpClientConfiguration conf); - -} diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/http/HttpClientConfiguration.java b/twidere.component.twitter4j/src/main/java/twitter4j/http/HttpClientConfiguration.java deleted file mode 100644 index 678f883d0..000000000 --- a/twidere.component.twitter4j/src/main/java/twitter4j/http/HttpClientConfiguration.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Twidere - Twitter client for Android - * - * Copyright (C) 2012-2015 Mariotaku Lee - * - * 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 . - */ - -package twitter4j.http; - -/** - * @author Yusuke Yamamoto - yusuke at mac.com - */ -public interface HttpClientConfiguration { - - HostAddressResolverFactory getHostAddressResolverFactory(); - - int getHttpConnectionTimeout(); - - int getHttpDefaultMaxPerRoute(); - - int getHttpMaxTotalConnections(); - - String getHttpProxyHost(); - - String getHttpProxyPassword(); - - int getHttpProxyPort(); - - String getHttpProxyUser(); - - int getHttpReadTimeout(); - - int getHttpRetryCount(); - - int getHttpRetryIntervalSeconds(); - - String getHttpUserAgent(); - - boolean isGZIPEnabled(); - - boolean isPrettyDebugEnabled(); - - boolean isProxyConfigured(); - - boolean isSSLEnabled(); - - boolean isSSLErrorIgnored(); -} diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/internal/logging/AndroidLogger.java b/twidere.component.twitter4j/src/main/java/twitter4j/internal/logging/AndroidLogger.java deleted file mode 100644 index 472ddce25..000000000 --- a/twidere.component.twitter4j/src/main/java/twitter4j/internal/logging/AndroidLogger.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright 2007 Yusuke Yamamoto - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package twitter4j.internal.logging; - -import android.util.Log; - -/** - * @author Yusuke Yamamoto - yusuke at mac.com - * @since Twitter4J 2.1.1 - */ -final class AndroidLogger extends Logger { - - private static final String DEFAULT_LOGTAG = "Twitter4J"; - - private final String logTag; - - AndroidLogger() { - logTag = DEFAULT_LOGTAG; - } - - AndroidLogger(final String tag) { - logTag = tag; - } - - /** - * {@inheritDoc} - */ - @Override - public void debug(final String message) { - if (isDebugEnabled()) { - Log.d(logTag, message); - } - } - - /** - * {@inheritDoc} - */ - @Override - public void debug(final String message, final String message2) { - if (isDebugEnabled()) { - Log.d(logTag, message + message2); - } - } - - /** - * {@inheritDoc} - */ - @Override - public void error(final String message) { - if (isErrorEnabled()) { - Log.e(logTag, message); - } - } - - /** - * {@inheritDoc} - */ - @Override - public void error(final String message, final Throwable th) { - if (isErrorEnabled()) { - Log.e(logTag, message, th); - } - } - - /** - * {@inheritDoc} - */ - @Override - public void info(final String message) { - if (isInfoEnabled()) { - Log.i(logTag, message); - } - } - - /** - * {@inheritDoc} - */ - @Override - public void info(final String message, final String message2) { - if (isInfoEnabled()) { - Log.i(logTag, message + message2); - } - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isDebugEnabled() { - return false; - // return Log.isLoggable(DEFAULT_LOGTAG, Log.DEBUG); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isErrorEnabled() { - return Log.isLoggable(DEFAULT_LOGTAG, Log.ERROR); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isInfoEnabled() { - return false; - // return Log.isLoggable(DEFAULT_LOGTAG, Log.INFO); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isWarnEnabled() { - return Log.isLoggable(DEFAULT_LOGTAG, Log.WARN); - } - - /** - * {@inheritDoc} - */ - @Override - public void warn(final String message) { - if (isWarnEnabled()) { - Log.w(logTag, message); - } - } - - /** - * {@inheritDoc} - */ - @Override - public void warn(final String message, final String message2) { - if (isWarnEnabled()) { - Log.w(logTag, message + message2); - } - } -} diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/internal/logging/AndroidLoggerFactory.java b/twidere.component.twitter4j/src/main/java/twitter4j/internal/logging/AndroidLoggerFactory.java deleted file mode 100644 index e77e8127e..000000000 --- a/twidere.component.twitter4j/src/main/java/twitter4j/internal/logging/AndroidLoggerFactory.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2007 Yusuke Yamamoto - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package twitter4j.internal.logging; - -/** - * @author Yusuke Yamamoto - yusuke at mac.com - * @since Twitter4J 2.1.1 - */ -final class AndroidLoggerFactory extends LoggerFactory { - - @Override - public Logger getLogger() { - return new AndroidLogger(); - } - - @Override - public Logger getLogger(final Class clz) { - return new AndroidLogger(clz.getName()); - } - - @Override - public Logger getLogger(final String tag) { - return new AndroidLogger(tag); - } -} diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/internal/logging/Logger.java b/twidere.component.twitter4j/src/main/java/twitter4j/internal/logging/Logger.java deleted file mode 100644 index cf72836c5..000000000 --- a/twidere.component.twitter4j/src/main/java/twitter4j/internal/logging/Logger.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Twidere - Twitter client for Android - * - * Copyright (C) 2012-2015 Mariotaku Lee - * - * 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 . - */ - -package twitter4j.internal.logging; - -/** - * @author Yusuke Yamamoto - yusuke at mac.com - * @since Twitter4J 2.1.0 - */ -public abstract class Logger { - private static final LoggerFactory LOGGER_FACTORY = new AndroidLoggerFactory(); - - /** - * @param message message - */ - public abstract void debug(String message); - - /** - * @param message message - * @param message2 message2 - */ - public abstract void debug(String message, String message2); - - /** - * @param message message - */ - public abstract void error(String message); - - /** - * @param message message - * @param th throwable - */ - public abstract void error(String message, Throwable th); - - /** - * @param message message - */ - public abstract void info(String message); - - /** - * @param message message - * @param message2 message2 - */ - public abstract void info(String message, String message2); - - /** - * tests if debug level logging is enabled - * - * @return if debug level logging is enabled - */ - public abstract boolean isDebugEnabled(); - - /** - * tests if error level logging is enabled - * - * @return if error level logging is enabled - */ - public abstract boolean isErrorEnabled(); - - /** - * tests if info level logging is enabled - * - * @return if info level logging is enabled - */ - public abstract boolean isInfoEnabled(); - - /** - * tests if warn level logging is enabled - * - * @return if warn level logging is enabled - */ - public abstract boolean isWarnEnabled(); - - /** - * @param message message - */ - public abstract void warn(String message); - - /** - * @param message message - * @param message2 message2 - */ - public abstract void warn(String message, String message2); - - /** - * Returns a Logger instance associated with the specified class. - * - * @return logger instance - */ - @Deprecated - public static Logger getLogger() { - return LOGGER_FACTORY.getLogger(); - } - - public static Logger getLogger(final Class clz) { - return LOGGER_FACTORY.getLogger(clz); - } - - public static Logger getLogger(final String tag) { - return LOGGER_FACTORY.getLogger(tag); - } - -} diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/internal/logging/LoggerFactory.java b/twidere.component.twitter4j/src/main/java/twitter4j/internal/logging/LoggerFactory.java deleted file mode 100644 index 345edbc10..000000000 --- a/twidere.component.twitter4j/src/main/java/twitter4j/internal/logging/LoggerFactory.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2007 Yusuke Yamamoto - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package twitter4j.internal.logging; - -/** - * @author Yusuke Yamamoto - yusuke at mac.com - * @since Twitter4J 2.1.1 - */ -public abstract class LoggerFactory { - - /** - * Returns a logger associated with the specified class. - * - * @return a logger instance - */ - public abstract Logger getLogger(); - - /** - * Returns a logger associated with the specified class. - * - * @return a logger instance - */ - public abstract Logger getLogger(Class clz); - - /** - * Returns a logger associated with the specified class. - * - * @return a logger instance - */ - public abstract Logger getLogger(String tag); -} diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/internal/logging/NullLogger.java b/twidere.component.twitter4j/src/main/java/twitter4j/internal/logging/NullLogger.java deleted file mode 100644 index 814c066ba..000000000 --- a/twidere.component.twitter4j/src/main/java/twitter4j/internal/logging/NullLogger.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright 2007 Yusuke Yamamoto - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package twitter4j.internal.logging; - -/** - * @author Yusuke Yamamoto - yusuke at mac.com - * @since Twitter4J 2.1.4 - */ -final class NullLogger extends Logger { - /** - * {@inheritDoc} - */ - @Override - public void debug(final String message) { - } - - /** - * {@inheritDoc} - */ - @Override - public void debug(final String message, final String message2) { - } - - /** - * {@inheritDoc} - */ - @Override - public void error(final String message) { - } - - /** - * {@inheritDoc} - */ - @Override - public void error(final String message, final Throwable th) { - } - - /** - * {@inheritDoc} - */ - @Override - public void info(final String message) { - } - - /** - * {@inheritDoc} - */ - @Override - public void info(final String message, final String message2) { - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isDebugEnabled() { - return false; - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isErrorEnabled() { - return false; - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isInfoEnabled() { - return false; - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isWarnEnabled() { - return false; - } - - /** - * {@inheritDoc} - */ - @Override - public void warn(final String message) { - } - - /** - * {@inheritDoc} - */ - @Override - public void warn(final String message, final String message2) { - } -} diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/internal/logging/NullLoggerFactory.java b/twidere.component.twitter4j/src/main/java/twitter4j/internal/logging/NullLoggerFactory.java deleted file mode 100644 index 08c59574b..000000000 --- a/twidere.component.twitter4j/src/main/java/twitter4j/internal/logging/NullLoggerFactory.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2007 Yusuke Yamamoto - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package twitter4j.internal.logging; - -/** - * @author Yusuke Yamamoto - yusuke at mac.com - * @since Twitter4J 2.1.4 - */ -final class NullLoggerFactory extends LoggerFactory { - private static final Logger SINGLETON = new NullLogger(); - - /** - * {@inheritDoc} - */ - @Override - public Logger getLogger() { - return SINGLETON; - } - - @Override - public Logger getLogger(final Class clz) { - return SINGLETON; - } - - @Override - public Logger getLogger(final String tag) { - return SINGLETON; - } -} diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/internal/util/InternalStringUtil.java b/twidere.component.twitter4j/src/main/java/twitter4j/internal/util/InternalStringUtil.java deleted file mode 100644 index 44507da18..000000000 --- a/twidere.component.twitter4j/src/main/java/twitter4j/internal/util/InternalStringUtil.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright 2007 Yusuke Yamamoto - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package twitter4j.internal.util; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author Yusuke Yamamoto - yusuke at mac.com - * @since Twitter4J 2.1.4 - */ -public class InternalStringUtil { - private InternalStringUtil() { - throw new AssertionError(); - } - - public static String join(final int[] array) { - final StringBuffer buf = new StringBuffer(11 * array.length); - for (final int follow : array) { - if (0 != buf.length()) { - buf.append(","); - } - buf.append(follow); - } - return buf.toString(); - } - - // for JDK1.4 compatibility - - public static String join(final long[] array) { - final StringBuffer buf = new StringBuffer(11 * array.length); - for (final long follow : array) { - if (0 != buf.length()) { - buf.append(","); - } - buf.append(follow); - } - return buf.toString(); - } - - public static String join(final String[] array) { - final StringBuffer buf = new StringBuffer(11 * array.length); - for (final String str : array) { - if (0 != buf.length()) { - buf.append(","); - } - buf.append(str); - } - return buf.toString(); - } - - public static String maskString(final String str) { - final StringBuffer buf = new StringBuffer(str.length()); - for (int i = 0; i < str.length(); i++) { - buf.append("*"); - } - return buf.toString(); - } - - public static String replaceLast(final String text, final String regex, final String replacement) { - if (text == null || regex == null || replacement == null) return text; - return text.replaceFirst("(?s)" + regex + "(?!.*?" + regex + ")", replacement); - } - - public static String[] split(final String str, final String separator) { - String[] returnValue; - int index = str.indexOf(separator); - if (index == -1) { - returnValue = new String[] { str }; - } else { - final List strList = new ArrayList(); - int oldIndex = 0; - while (index != -1) { - final String subStr = str.substring(oldIndex, index); - strList.add(subStr); - oldIndex = index + separator.length(); - index = str.indexOf(separator, oldIndex); - } - if (oldIndex != str.length()) { - strList.add(str.substring(oldIndex)); - } - returnValue = strList.toArray(new String[strList.size()]); - } - - return returnValue; - } -} diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/management/APIStatistics.java b/twidere.component.twitter4j/src/main/java/twitter4j/management/APIStatistics.java deleted file mode 100644 index 5c018b9a0..000000000 --- a/twidere.component.twitter4j/src/main/java/twitter4j/management/APIStatistics.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright 2007 Yusuke Yamamoto - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package twitter4j.management; - -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; - -/** - * Container for all InvocationStatisticsCalculators in a given API (like - * Twitter) - * - * @author Nick Dellamaggiore (nick.dellamaggiore gmail.com) - */ -public class APIStatistics implements APIStatisticsMBean { - private final InvocationStatisticsCalculator API_STATS_CALCULATOR; - private final Map METHOD_STATS_MAP; - private final int HISTORY_SIZE; - - /** - * @param historySize the number of calls to track (for invocation time - * averaging) - */ - public APIStatistics(final int historySize) { - API_STATS_CALCULATOR = new InvocationStatisticsCalculator("API", historySize); - METHOD_STATS_MAP = new HashMap(100); - HISTORY_SIZE = historySize; - } - - @Override - public long getAverageTime() { - return API_STATS_CALCULATOR.getAverageTime(); - } - - @Override - public long getCallCount() { - return API_STATS_CALCULATOR.getCallCount(); - } - - @Override - public long getErrorCount() { - return API_STATS_CALCULATOR.getErrorCount(); - } - - @Override - public synchronized Iterable getInvocationStatistics() { - return METHOD_STATS_MAP.values(); - } - - @Override - public synchronized Map getMethodLevelSummariesAsString() { - final Map summariesMap = new HashMap(); - - final Collection allMethodStats = METHOD_STATS_MAP.values(); - for (final InvocationStatisticsCalculator methodStats : allMethodStats) { - summariesMap.put(methodStats.getName(), methodStats.toString()); - } - - return summariesMap; - } - - @Override - public synchronized String getMethodLevelSummary(final String methodName) { - return METHOD_STATS_MAP.get(methodName).toString(); - } - - /** - * APIStatisticsMBean implementation - */ - - @Override - public String getName() { - return API_STATS_CALCULATOR.getName(); - } - - @Override - public long getTotalTime() { - return API_STATS_CALCULATOR.getTotalTime(); - } - - /** - * @param method the method invoked - * @param time the method execution time - */ - public synchronized void methodCalled(final String method, final long time, final boolean success) { - getMethodStatistics(method).increment(time, success); - - // increment for entire API - API_STATS_CALCULATOR.increment(time, success); - } - - @Override - public synchronized void reset() { - API_STATS_CALCULATOR.reset(); - METHOD_STATS_MAP.clear(); - } - - private synchronized InvocationStatisticsCalculator getMethodStatistics(final String method) { - InvocationStatisticsCalculator methodStats = METHOD_STATS_MAP.get(method); - - if (methodStats == null) { - methodStats = new InvocationStatisticsCalculator(method, HISTORY_SIZE); - METHOD_STATS_MAP.put(method, methodStats); - } - return methodStats; - } -} diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/management/APIStatisticsMBean.java b/twidere.component.twitter4j/src/main/java/twitter4j/management/APIStatisticsMBean.java deleted file mode 100644 index 9bbeaa745..000000000 --- a/twidere.component.twitter4j/src/main/java/twitter4j/management/APIStatisticsMBean.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2007 Yusuke Yamamoto - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package twitter4j.management; - -import java.util.Map; - -/** - * Simple MBean interface for APIStatistics. Method-level statistics are exposed - * as a Map of formatted strings - * - * @author Nick Dellamaggiore (nick.dellamaggiore gmail.com) - */ -public interface APIStatisticsMBean extends InvocationStatistics { - public Iterable getInvocationStatistics(); - - public Map getMethodLevelSummariesAsString(); - - public String getMethodLevelSummary(String methodName); -} diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/management/InvocationStatistics.java b/twidere.component.twitter4j/src/main/java/twitter4j/management/InvocationStatistics.java deleted file mode 100644 index fd0ea9038..000000000 --- a/twidere.component.twitter4j/src/main/java/twitter4j/management/InvocationStatistics.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2007 Yusuke Yamamoto - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package twitter4j.management; - -/** - * @author Nick Dellamaggiore (nick.dellamaggiore gmail.com) - */ -public interface InvocationStatistics { - public long getAverageTime(); - - public long getCallCount(); - - public long getErrorCount(); - - public String getName(); - - public long getTotalTime(); - - public void reset(); -} diff --git a/twidere.component.twitter4j/src/main/java/twitter4j/management/InvocationStatisticsCalculator.java b/twidere.component.twitter4j/src/main/java/twitter4j/management/InvocationStatisticsCalculator.java deleted file mode 100644 index 447a9d671..000000000 --- a/twidere.component.twitter4j/src/main/java/twitter4j/management/InvocationStatisticsCalculator.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright 2007 Yusuke Yamamoto - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package twitter4j.management; - -/** - * Object that collects/aggregates statistics for the invocation of a given - * method. - * - * @author Nick Dellamaggiore (nick.dellamaggiore gmail.com) - */ -public class InvocationStatisticsCalculator implements InvocationStatistics { - private final String name; - private long[] times; - private int index; - private long callCount; - private long errorCount; - private long totalTime; - - /** - * @param name the name of this API method - * @param historySize the number of calls to track (for invocation time - * averaging) - */ - public InvocationStatisticsCalculator(final String name, final int historySize) { - this.name = name; - times = new long[historySize]; - } - - @Override - public synchronized long getAverageTime() { - final int stopIndex = Math.min(Math.abs((int) callCount), times.length); - if (stopIndex == 0) return 0; - - long totalTime = 0; - for (int i = 0; i < stopIndex; i++) { - totalTime += times[i]; - - } - return totalTime / stopIndex; - } - - @Override - public long getCallCount() { - return callCount; - } - - @Override - public long getErrorCount() { - return errorCount; - } - - @Override - public String getName() { - return name; - } - - @Override - public long getTotalTime() { - return totalTime; - } - - public void increment(final long time, final boolean success) { - callCount++; - errorCount += success ? 0 : 1; - totalTime += time; - - times[index] = time; - - if (++index >= times.length) { - index = 0; - } - } - - @Override - public synchronized void reset() { - callCount = 0; - errorCount = 0; - totalTime = 0; - times = new long[times.length]; - index = 0; - } - - @Override - public String toString() { - // StringBuilder is faster... do we still need to support JDK 1.4? - final StringBuffer sb = new StringBuffer(); - sb.append("calls=").append(getCallCount()).append(",").append("errors=").append(getErrorCount()).append(",") - .append("totalTime=").append(getTotalTime()).append(",").append("avgTime=").append(getAverageTime()); - - return sb.toString(); - } -} diff --git a/twidere.extension.streaming/src/main/java/org/mariotaku/twidere/extension/streaming/StreamingService.java b/twidere.extension.streaming/src/main/java/org/mariotaku/twidere/extension/streaming/StreamingService.java index 9f4cc9b3a..80218cd94 100644 --- a/twidere.extension.streaming/src/main/java/org/mariotaku/twidere/extension/streaming/StreamingService.java +++ b/twidere.extension.streaming/src/main/java/org/mariotaku/twidere/extension/streaming/StreamingService.java @@ -45,7 +45,7 @@ import twitter4j.TwitterStreamFactory; import twitter4j.User; import twitter4j.UserList; import twitter4j.UserStreamListener; -import twitter4j.auth.AccessToken; +import org.mariotaku.twidere.api.twitter.auth.AccessToken; import twitter4j.conf.StreamConfigurationBuilder; import static android.text.TextUtils.isEmpty; diff --git a/twidere.extension.streaming/src/main/java/org/mariotaku/twidere/extension/streaming/util/OkHttpClientFactory.java b/twidere.extension.streaming/src/main/java/org/mariotaku/twidere/extension/streaming/util/OkHttpClientFactory.java index d87f0dc27..94f1b5173 100644 --- a/twidere.extension.streaming/src/main/java/org/mariotaku/twidere/extension/streaming/util/OkHttpClientFactory.java +++ b/twidere.extension.streaming/src/main/java/org/mariotaku/twidere/extension/streaming/util/OkHttpClientFactory.java @@ -21,9 +21,9 @@ package org.mariotaku.twidere.extension.streaming.util; import android.content.Context; -import twitter4j.http.HttpClient; -import twitter4j.http.HttpClientConfiguration; -import twitter4j.http.HttpClientFactory; +import org.mariotaku.twidere.api.twitter.http.HttpClient; +import org.mariotaku.twidere.api.twitter.http.HttpClientConfiguration; +import org.mariotaku.twidere.api.twitter.http.HttpClientFactory; /** * Created by mariotaku on 15/1/22. diff --git a/twidere.extension.streaming/src/main/java/org/mariotaku/twidere/extension/streaming/util/OkHttpClientImpl.java b/twidere.extension.streaming/src/main/java/org/mariotaku/twidere/extension/streaming/util/OkHttpClientImpl.java index c8ac2b1fc..28761d4df 100644 --- a/twidere.extension.streaming/src/main/java/org/mariotaku/twidere/extension/streaming/util/OkHttpClientImpl.java +++ b/twidere.extension.streaming/src/main/java/org/mariotaku/twidere/extension/streaming/util/OkHttpClientImpl.java @@ -53,14 +53,14 @@ import javax.net.SocketFactory; import okio.BufferedSink; import twitter4j.TwitterException; -import twitter4j.auth.Authorization; -import twitter4j.http.HostAddressResolver; -import twitter4j.http.HttpClient; -import twitter4j.http.HttpClientConfiguration; -import twitter4j.http.HttpParameter; -import twitter4j.http.HttpRequest; -import twitter4j.http.HttpResponse; -import twitter4j.http.RequestMethod; +import org.mariotaku.twidere.api.twitter.auth.Authorization; +import org.mariotaku.twidere.api.twitter.http.HostAddressResolver; +import org.mariotaku.twidere.api.twitter.http.HttpClient; +import org.mariotaku.twidere.api.twitter.http.HttpClientConfiguration; +import org.mariotaku.twidere.api.twitter.http.HttpParameter; +import org.mariotaku.twidere.api.twitter.http.HttpRequest; +import org.mariotaku.twidere.api.twitter.http.HttpResponse; +import org.mariotaku.twidere.api.twitter.http.RequestMethod; /** * Created by mariotaku on 15/1/22. diff --git a/twidere.extension.streaming/src/main/java/org/mariotaku/twidere/extension/streaming/util/TwidereHostAddressResolver.java b/twidere.extension.streaming/src/main/java/org/mariotaku/twidere/extension/streaming/util/TwidereHostAddressResolver.java index b18a30b9e..cb427f541 100644 --- a/twidere.extension.streaming/src/main/java/org/mariotaku/twidere/extension/streaming/util/TwidereHostAddressResolver.java +++ b/twidere.extension.streaming/src/main/java/org/mariotaku/twidere/extension/streaming/util/TwidereHostAddressResolver.java @@ -30,7 +30,7 @@ import java.net.UnknownHostException; import java.util.Arrays; import java.util.LinkedHashMap; -import twitter4j.http.HostAddressResolver; +import org.mariotaku.twidere.api.twitter.http.HostAddressResolver; public class TwidereHostAddressResolver implements HostAddressResolver { diff --git a/twidere.extension.streaming/src/main/java/org/mariotaku/twidere/extension/streaming/util/TwidereHostAddressResolverFactory.java b/twidere.extension.streaming/src/main/java/org/mariotaku/twidere/extension/streaming/util/TwidereHostAddressResolverFactory.java index f71459e30..2e0fa70b0 100644 --- a/twidere.extension.streaming/src/main/java/org/mariotaku/twidere/extension/streaming/util/TwidereHostAddressResolverFactory.java +++ b/twidere.extension.streaming/src/main/java/org/mariotaku/twidere/extension/streaming/util/TwidereHostAddressResolverFactory.java @@ -21,9 +21,9 @@ package org.mariotaku.twidere.extension.streaming.util; import android.content.Context; -import twitter4j.http.HostAddressResolver; -import twitter4j.http.HostAddressResolverFactory; -import twitter4j.http.HttpClientConfiguration; +import org.mariotaku.twidere.api.twitter.http.HostAddressResolver; +import org.mariotaku.twidere.api.twitter.http.HostAddressResolverFactory; +import org.mariotaku.twidere.api.twitter.http.HttpClientConfiguration; /** * Created by mariotaku on 15/1/11. diff --git a/twidere/src/main/java/org/mariotaku/twidere/activity/support/APIEditorActivity.java b/twidere/src/main/java/org/mariotaku/twidere/activity/support/APIEditorActivity.java index 7edd87db0..97f215f4b 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/activity/support/APIEditorActivity.java +++ b/twidere/src/main/java/org/mariotaku/twidere/activity/support/APIEditorActivity.java @@ -37,7 +37,7 @@ import android.widget.Toast; import org.mariotaku.twidere.R; import org.mariotaku.twidere.provider.TwidereDataStore.Accounts; -import twitter4j.TwitterConstants; +import org.mariotaku.twidere.api.twitter.TwitterConstants; import static org.mariotaku.twidere.util.ParseUtils.parseString; import static org.mariotaku.twidere.util.Utils.getNonEmptyString; diff --git a/twidere/src/main/java/org/mariotaku/twidere/activity/support/BrowserSignInActivity.java b/twidere/src/main/java/org/mariotaku/twidere/activity/support/BrowserSignInActivity.java index 8ae711e5a..8b11f2588 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/activity/support/BrowserSignInActivity.java +++ b/twidere/src/main/java/org/mariotaku/twidere/activity/support/BrowserSignInActivity.java @@ -54,8 +54,8 @@ import org.xmlpull.v1.XmlPullParserException; import java.io.IOException; import java.io.StringReader; -import twitter4j.TwitterConstants; -import twitter4j.TwitterOAuth; +import org.mariotaku.twidere.api.twitter.TwitterConstants; +import org.mariotaku.twidere.api.twitter.TwitterOAuth; import static android.text.TextUtils.isEmpty; import static org.mariotaku.twidere.util.Utils.getNonEmptyString; diff --git a/twidere/src/main/java/org/mariotaku/twidere/activity/support/SignInActivity.java b/twidere/src/main/java/org/mariotaku/twidere/activity/support/SignInActivity.java index f0ea65b83..63b2fe7b8 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/activity/support/SignInActivity.java +++ b/twidere/src/main/java/org/mariotaku/twidere/activity/support/SignInActivity.java @@ -87,11 +87,11 @@ import org.mariotaku.twidere.util.support.ViewSupport; import org.mariotaku.twidere.util.support.view.ViewOutlineProviderCompat; import org.mariotaku.twidere.view.iface.TintedStatusLayout; -import twitter4j.Twitter; -import twitter4j.TwitterConstants; -import twitter4j.TwitterException; -import twitter4j.TwitterOAuth; -import twitter4j.User; +import org.mariotaku.twidere.api.twitter.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterConstants; +import org.mariotaku.twidere.api.twitter.TwitterException; +import org.mariotaku.twidere.api.twitter.TwitterOAuth; +import org.mariotaku.twidere.api.twitter.model.User; import static android.text.TextUtils.isEmpty; import static org.mariotaku.twidere.util.ContentValuesCreator.createAccount; diff --git a/twidere/src/main/java/org/mariotaku/twidere/activity/support/UserListSelectorActivity.java b/twidere/src/main/java/org/mariotaku/twidere/activity/support/UserListSelectorActivity.java index e9245a077..fcfd77e91 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/activity/support/UserListSelectorActivity.java +++ b/twidere/src/main/java/org/mariotaku/twidere/activity/support/UserListSelectorActivity.java @@ -50,13 +50,13 @@ import org.mariotaku.twidere.util.TwitterAPIUtils; import java.util.ArrayList; import java.util.List; -import twitter4j.Paging; -import twitter4j.ResponseList; -import twitter4j.Twitter; -import twitter4j.TwitterException; -import twitter4j.User; -import twitter4j.UserList; -import twitter4j.http.HttpResponseCode; +import org.mariotaku.twidere.api.twitter.model.Paging; +import org.mariotaku.twidere.api.twitter.model.ResponseList; +import org.mariotaku.twidere.api.twitter.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterException; +import org.mariotaku.twidere.api.twitter.model.User; +import org.mariotaku.twidere.api.twitter.model.UserList; +import org.mariotaku.twidere.api.twitter.http.HttpResponseCode; import static android.text.TextUtils.isEmpty; import static org.mariotaku.twidere.util.ParseUtils.parseString; diff --git a/twidere/src/main/java/org/mariotaku/twidere/adapter/SavedSearchesAdapter.java b/twidere/src/main/java/org/mariotaku/twidere/adapter/SavedSearchesAdapter.java index 79b0cbee9..9ab392162 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/adapter/SavedSearchesAdapter.java +++ b/twidere/src/main/java/org/mariotaku/twidere/adapter/SavedSearchesAdapter.java @@ -26,8 +26,8 @@ import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; -import twitter4j.ResponseList; -import twitter4j.SavedSearch; +import org.mariotaku.twidere.api.twitter.model.ResponseList; +import org.mariotaku.twidere.api.twitter.model.SavedSearch; /** * Created by mariotaku on 15/4/29. diff --git a/twidere/src/main/java/org/mariotaku/twidere/app/TwidereApplication.java b/twidere/src/main/java/org/mariotaku/twidere/app/TwidereApplication.java index 783ed69f8..31981d25d 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/app/TwidereApplication.java +++ b/twidere/src/main/java/org/mariotaku/twidere/app/TwidereApplication.java @@ -40,6 +40,7 @@ import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; import com.nostra13.universalimageloader.core.assist.QueueProcessingType; import com.nostra13.universalimageloader.core.download.ImageDownloader; import com.nostra13.universalimageloader.utils.L; +import com.squareup.okhttp.internal.Network; import com.squareup.otto.Bus; import org.mariotaku.twidere.Constants; @@ -67,7 +68,6 @@ import java.io.File; import edu.tsinghua.spice.SpiceService; import edu.ucdavis.earlybird.UCDService; -import twitter4j.http.HostAddressResolver; import static org.mariotaku.twidere.util.Utils.getBestCacheDir; import static org.mariotaku.twidere.util.Utils.getInternalCacheDir; @@ -92,7 +92,7 @@ public class TwidereApplication extends MultiDexApplication implements Constants private TwidereImageDownloader mImageDownloader, mFullImageDownloader; private DiskCache mDiskCache, mFullDiskCache; private SQLiteOpenHelper mSQLiteOpenHelper; - private HostAddressResolver mResolver; + private Network mNetwork; private SQLiteDatabase mDatabase; private Bus mMessageBus; private VideoLoader mVideoLoader; @@ -140,9 +140,9 @@ public class TwidereApplication extends MultiDexApplication implements Constants return mHandler; } - public HostAddressResolver getHostAddressResolver() { - if (mResolver != null) return mResolver; - return mResolver = new TwidereHostAddressResolver(this); + public Network getNetwork() { + if (mNetwork != null) return mNetwork; + return mNetwork = new TwidereHostAddressResolver(this); } public ReadStateManager getReadStateManager() { diff --git a/twidere/src/main/java/org/mariotaku/twidere/fragment/support/SavedSearchesListFragment.java b/twidere/src/main/java/org/mariotaku/twidere/fragment/support/SavedSearchesListFragment.java index 5c99d8465..7df011c9a 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/fragment/support/SavedSearchesListFragment.java +++ b/twidere/src/main/java/org/mariotaku/twidere/fragment/support/SavedSearchesListFragment.java @@ -34,8 +34,8 @@ import org.mariotaku.twidere.loader.support.SavedSearchesLoader; import java.util.Collections; import java.util.Comparator; -import twitter4j.ResponseList; -import twitter4j.SavedSearch; +import org.mariotaku.twidere.api.twitter.model.ResponseList; +import org.mariotaku.twidere.api.twitter.model.SavedSearch; import static org.mariotaku.twidere.util.Utils.openTweetSearch; diff --git a/twidere/src/main/java/org/mariotaku/twidere/fragment/support/StatusFragment.java b/twidere/src/main/java/org/mariotaku/twidere/fragment/support/StatusFragment.java index c072b1eba..be6cd238b 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/fragment/support/StatusFragment.java +++ b/twidere/src/main/java/org/mariotaku/twidere/fragment/support/StatusFragment.java @@ -129,9 +129,9 @@ import java.util.Locale; import edu.tsinghua.spice.Utilies.SpiceProfilingUtil; import edu.tsinghua.spice.Utilies.TypeMappingUtil; -import twitter4j.Paging; -import twitter4j.Twitter; -import twitter4j.TwitterException; +import org.mariotaku.twidere.api.twitter.model.Paging; +import org.mariotaku.twidere.api.twitter.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterException; /** * Created by mariotaku on 14/12/5. @@ -1022,7 +1022,7 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac final Paging paging = new Paging(); paging.setMaxId(status.id); final List conversations = new ArrayList<>(); - for (twitter4j.Status item : twitter.showConversation(status.id, paging)) { + for (org.mariotaku.twidere.api.twitter.model.Status item : twitter.showConversation(status.id, paging)) { if (item.getId() < status.id) { final ParcelableStatus conversation = new ParcelableStatus(item, accountId, false); publishProgress(conversation); diff --git a/twidere/src/main/java/org/mariotaku/twidere/fragment/support/StatusTranslateDialogFragment.java b/twidere/src/main/java/org/mariotaku/twidere/fragment/support/StatusTranslateDialogFragment.java index 96dc9e235..0641995eb 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/fragment/support/StatusTranslateDialogFragment.java +++ b/twidere/src/main/java/org/mariotaku/twidere/fragment/support/StatusTranslateDialogFragment.java @@ -43,9 +43,9 @@ import org.mariotaku.twidere.util.Utils; import org.mariotaku.twidere.view.holder.StatusViewHolder; import org.mariotaku.twidere.view.holder.StatusViewHolder.DummyStatusHolderAdapter; -import twitter4j.TranslationResult; -import twitter4j.Twitter; -import twitter4j.TwitterException; +import org.mariotaku.twidere.api.twitter.model.TranslationResult; +import org.mariotaku.twidere.api.twitter.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterException; public class StatusTranslateDialogFragment extends BaseSupportDialogFragment implements LoaderCallbacks> { diff --git a/twidere/src/main/java/org/mariotaku/twidere/fragment/support/UserFragment.java b/twidere/src/main/java/org/mariotaku/twidere/fragment/support/UserFragment.java index 089172920..339b29f5e 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/fragment/support/UserFragment.java +++ b/twidere/src/main/java/org/mariotaku/twidere/fragment/support/UserFragment.java @@ -148,9 +148,9 @@ import org.mariotaku.twidere.view.iface.IExtendedView.OnSizeChangedListener; import java.util.List; import java.util.Locale; -import twitter4j.Relationship; -import twitter4j.Twitter; -import twitter4j.TwitterException; +import org.mariotaku.twidere.api.twitter.model.Relationship; +import org.mariotaku.twidere.api.twitter.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterException; public class UserFragment extends BaseSupportFragment implements OnClickListener, OnLinkClickListener, OnSizeChangedListener, OnSharedPreferenceChangeListener, diff --git a/twidere/src/main/java/org/mariotaku/twidere/fragment/support/UserListFragment.java b/twidere/src/main/java/org/mariotaku/twidere/fragment/support/UserListFragment.java index 043d8aff3..29cdacb84 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/fragment/support/UserListFragment.java +++ b/twidere/src/main/java/org/mariotaku/twidere/fragment/support/UserListFragment.java @@ -52,7 +52,6 @@ import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.CheckBox; -import android.widget.EditText; import com.rengwuxian.materialedittext.MaterialEditText; @@ -83,10 +82,10 @@ import org.mariotaku.twidere.util.UserColorNameManager; import org.mariotaku.twidere.util.Utils; import org.mariotaku.twidere.view.TabPagerIndicator; -import twitter4j.Twitter; -import twitter4j.TwitterException; -import twitter4j.UserList; -import twitter4j.UserListUpdate; +import org.mariotaku.twidere.api.twitter.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterException; +import org.mariotaku.twidere.api.twitter.model.UserList; +import org.mariotaku.twidere.api.twitter.model.UserListUpdate; import static org.mariotaku.twidere.util.MenuUtils.setMenuItemAvailability; import static org.mariotaku.twidere.util.Utils.addIntentToMenu; diff --git a/twidere/src/main/java/org/mariotaku/twidere/fragment/support/UserListMembersFragment.java b/twidere/src/main/java/org/mariotaku/twidere/fragment/support/UserListMembersFragment.java index e130561c0..2e82922de 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/fragment/support/UserListMembersFragment.java +++ b/twidere/src/main/java/org/mariotaku/twidere/fragment/support/UserListMembersFragment.java @@ -32,9 +32,9 @@ import org.mariotaku.twidere.model.ParcelableUserList; import org.mariotaku.twidere.util.AsyncTaskUtils; import org.mariotaku.twidere.util.TwitterAPIUtils; -import twitter4j.Twitter; -import twitter4j.TwitterException; -import twitter4j.UserList; +import org.mariotaku.twidere.api.twitter.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterException; +import org.mariotaku.twidere.api.twitter.model.UserList; import static org.mariotaku.twidere.util.TwitterAPIUtils.getTwitterInstance; diff --git a/twidere/src/main/java/org/mariotaku/twidere/fragment/support/UserProfileEditorFragment.java b/twidere/src/main/java/org/mariotaku/twidere/fragment/support/UserProfileEditorFragment.java index b16683337..2241bec49 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/fragment/support/UserProfileEditorFragment.java +++ b/twidere/src/main/java/org/mariotaku/twidere/fragment/support/UserProfileEditorFragment.java @@ -69,10 +69,10 @@ import org.mariotaku.twidere.util.Utils; import org.mariotaku.twidere.view.ForegroundColorView; import org.mariotaku.twidere.view.iface.IExtendedView.OnSizeChangedListener; -import twitter4j.ProfileUpdate; -import twitter4j.Twitter; -import twitter4j.TwitterException; -import twitter4j.User; +import org.mariotaku.twidere.api.twitter.model.ProfileUpdate; +import org.mariotaku.twidere.api.twitter.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterException; +import org.mariotaku.twidere.api.twitter.model.User; import static android.text.TextUtils.isEmpty; diff --git a/twidere/src/main/java/org/mariotaku/twidere/loader/support/ActivitiesAboutMeLoader.java b/twidere/src/main/java/org/mariotaku/twidere/loader/support/ActivitiesAboutMeLoader.java index 674d89292..fc2130c97 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/loader/support/ActivitiesAboutMeLoader.java +++ b/twidere/src/main/java/org/mariotaku/twidere/loader/support/ActivitiesAboutMeLoader.java @@ -26,10 +26,10 @@ import org.mariotaku.twidere.model.ParcelableActivity; import java.util.List; -import twitter4j.Activity; -import twitter4j.Paging; -import twitter4j.Twitter; -import twitter4j.TwitterException; +import org.mariotaku.twidere.api.twitter.model.Activity; +import org.mariotaku.twidere.api.twitter.model.Paging; +import org.mariotaku.twidere.api.twitter.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterException; public class ActivitiesAboutMeLoader extends Twitter4JActivitiesLoader { diff --git a/twidere/src/main/java/org/mariotaku/twidere/loader/support/ActivitiesByFriendsLoader.java b/twidere/src/main/java/org/mariotaku/twidere/loader/support/ActivitiesByFriendsLoader.java index cf6bdb1ff..d0082dc4b 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/loader/support/ActivitiesByFriendsLoader.java +++ b/twidere/src/main/java/org/mariotaku/twidere/loader/support/ActivitiesByFriendsLoader.java @@ -26,10 +26,10 @@ import org.mariotaku.twidere.model.ParcelableActivity; import java.util.List; -import twitter4j.Activity; -import twitter4j.Paging; -import twitter4j.Twitter; -import twitter4j.TwitterException; +import org.mariotaku.twidere.api.twitter.model.Activity; +import org.mariotaku.twidere.api.twitter.model.Paging; +import org.mariotaku.twidere.api.twitter.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterException; public class ActivitiesByFriendsLoader extends Twitter4JActivitiesLoader { diff --git a/twidere/src/main/java/org/mariotaku/twidere/loader/support/BaseCursorSupportUsersLoader.java b/twidere/src/main/java/org/mariotaku/twidere/loader/support/BaseCursorSupportUsersLoader.java index 0dd47003f..8f802f9e7 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/loader/support/BaseCursorSupportUsersLoader.java +++ b/twidere/src/main/java/org/mariotaku/twidere/loader/support/BaseCursorSupportUsersLoader.java @@ -27,7 +27,7 @@ import org.mariotaku.twidere.model.ParcelableUser; import java.util.List; -import twitter4j.CursorSupport; +import org.mariotaku.twidere.api.twitter.model.CursorSupport; public abstract class BaseCursorSupportUsersLoader extends Twitter4JUsersLoader implements ICursorSupportLoader { diff --git a/twidere/src/main/java/org/mariotaku/twidere/loader/support/BaseUserListsLoader.java b/twidere/src/main/java/org/mariotaku/twidere/loader/support/BaseUserListsLoader.java index a5bdf4fe6..1100954a6 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/loader/support/BaseUserListsLoader.java +++ b/twidere/src/main/java/org/mariotaku/twidere/loader/support/BaseUserListsLoader.java @@ -30,11 +30,11 @@ import org.mariotaku.twidere.util.collection.NoDuplicatesArrayList; import java.util.Collections; import java.util.List; -import twitter4j.CursorSupport; -import twitter4j.PageableResponseList; -import twitter4j.Twitter; -import twitter4j.TwitterException; -import twitter4j.UserList; +import org.mariotaku.twidere.api.twitter.model.CursorSupport; +import org.mariotaku.twidere.api.twitter.model.PageableResponseList; +import org.mariotaku.twidere.api.twitter.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterException; +import org.mariotaku.twidere.api.twitter.model.UserList; import static org.mariotaku.twidere.util.TwitterAPIUtils.getTwitterInstance; diff --git a/twidere/src/main/java/org/mariotaku/twidere/loader/support/CursorSupportUsersLoader.java b/twidere/src/main/java/org/mariotaku/twidere/loader/support/CursorSupportUsersLoader.java index 32b6c8942..c515016f9 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/loader/support/CursorSupportUsersLoader.java +++ b/twidere/src/main/java/org/mariotaku/twidere/loader/support/CursorSupportUsersLoader.java @@ -25,11 +25,11 @@ import org.mariotaku.twidere.model.ParcelableUser; import java.util.List; -import twitter4j.PageableResponseList; -import twitter4j.Paging; -import twitter4j.Twitter; -import twitter4j.TwitterException; -import twitter4j.User; +import org.mariotaku.twidere.api.twitter.model.PageableResponseList; +import org.mariotaku.twidere.api.twitter.model.Paging; +import org.mariotaku.twidere.api.twitter.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterException; +import org.mariotaku.twidere.api.twitter.model.User; public abstract class CursorSupportUsersLoader extends BaseCursorSupportUsersLoader { diff --git a/twidere/src/main/java/org/mariotaku/twidere/loader/support/IDsUsersLoader.java b/twidere/src/main/java/org/mariotaku/twidere/loader/support/IDsUsersLoader.java index 58299ba17..4d16c7726 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/loader/support/IDsUsersLoader.java +++ b/twidere/src/main/java/org/mariotaku/twidere/loader/support/IDsUsersLoader.java @@ -25,11 +25,11 @@ import org.mariotaku.twidere.model.ParcelableUser; import java.util.List; -import twitter4j.IDs; -import twitter4j.Paging; -import twitter4j.Twitter; -import twitter4j.TwitterException; -import twitter4j.User; +import org.mariotaku.twidere.api.twitter.model.IDs; +import org.mariotaku.twidere.api.twitter.model.Paging; +import org.mariotaku.twidere.api.twitter.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterException; +import org.mariotaku.twidere.api.twitter.model.User; public abstract class IDsUsersLoader extends BaseCursorSupportUsersLoader { diff --git a/twidere/src/main/java/org/mariotaku/twidere/loader/support/IncomingFriendshipsLoader.java b/twidere/src/main/java/org/mariotaku/twidere/loader/support/IncomingFriendshipsLoader.java index 080fdf07c..1191288bf 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/loader/support/IncomingFriendshipsLoader.java +++ b/twidere/src/main/java/org/mariotaku/twidere/loader/support/IncomingFriendshipsLoader.java @@ -25,10 +25,10 @@ import org.mariotaku.twidere.model.ParcelableUser; import java.util.List; -import twitter4j.IDs; -import twitter4j.Paging; -import twitter4j.Twitter; -import twitter4j.TwitterException; +import org.mariotaku.twidere.api.twitter.model.IDs; +import org.mariotaku.twidere.api.twitter.model.Paging; +import org.mariotaku.twidere.api.twitter.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterException; public class IncomingFriendshipsLoader extends IDsUsersLoader { diff --git a/twidere/src/main/java/org/mariotaku/twidere/loader/support/MediaTimelineLoader.java b/twidere/src/main/java/org/mariotaku/twidere/loader/support/MediaTimelineLoader.java index e416738a4..bf359106f 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/loader/support/MediaTimelineLoader.java +++ b/twidere/src/main/java/org/mariotaku/twidere/loader/support/MediaTimelineLoader.java @@ -27,11 +27,11 @@ import org.mariotaku.twidere.model.ParcelableStatus; import java.util.List; -import twitter4j.Paging; -import twitter4j.ResponseList; -import twitter4j.Status; -import twitter4j.Twitter; -import twitter4j.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.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterException; import static org.mariotaku.twidere.util.Utils.getAccountId; import static org.mariotaku.twidere.util.Utils.isFiltered; diff --git a/twidere/src/main/java/org/mariotaku/twidere/loader/support/MutesUsersLoader.java b/twidere/src/main/java/org/mariotaku/twidere/loader/support/MutesUsersLoader.java index d491626ba..129a39758 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/loader/support/MutesUsersLoader.java +++ b/twidere/src/main/java/org/mariotaku/twidere/loader/support/MutesUsersLoader.java @@ -25,11 +25,11 @@ import org.mariotaku.twidere.model.ParcelableUser; import java.util.List; -import twitter4j.PageableResponseList; -import twitter4j.Paging; -import twitter4j.Twitter; -import twitter4j.TwitterException; -import twitter4j.User; +import org.mariotaku.twidere.api.twitter.model.PageableResponseList; +import org.mariotaku.twidere.api.twitter.model.Paging; +import org.mariotaku.twidere.api.twitter.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterException; +import org.mariotaku.twidere.api.twitter.model.User; public class MutesUsersLoader extends CursorSupportUsersLoader { diff --git a/twidere/src/main/java/org/mariotaku/twidere/loader/support/ParcelableStatusLoader.java b/twidere/src/main/java/org/mariotaku/twidere/loader/support/ParcelableStatusLoader.java index 0f6782807..a649c8afd 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/loader/support/ParcelableStatusLoader.java +++ b/twidere/src/main/java/org/mariotaku/twidere/loader/support/ParcelableStatusLoader.java @@ -28,7 +28,7 @@ import org.mariotaku.twidere.model.ParcelableAccount; import org.mariotaku.twidere.model.ParcelableStatus; import org.mariotaku.twidere.model.SingleResponse; -import twitter4j.TwitterException; +import org.mariotaku.twidere.api.twitter.TwitterException; import static org.mariotaku.twidere.constant.IntentConstants.EXTRA_ACCOUNT; import static org.mariotaku.twidere.util.Utils.findStatus; diff --git a/twidere/src/main/java/org/mariotaku/twidere/loader/support/ParcelableUserLoader.java b/twidere/src/main/java/org/mariotaku/twidere/loader/support/ParcelableUserLoader.java index 9ff867511..1b50b7229 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/loader/support/ParcelableUserLoader.java +++ b/twidere/src/main/java/org/mariotaku/twidere/loader/support/ParcelableUserLoader.java @@ -37,9 +37,9 @@ import org.mariotaku.twidere.provider.TwidereDataStore.CachedUsers; import org.mariotaku.twidere.util.TwitterAPIUtils; import org.mariotaku.twidere.util.TwitterWrapper; -import twitter4j.Twitter; -import twitter4j.TwitterException; -import twitter4j.User; +import org.mariotaku.twidere.api.twitter.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterException; +import org.mariotaku.twidere.api.twitter.model.User; import static org.mariotaku.twidere.util.ContentValuesCreator.createCachedUser; import static org.mariotaku.twidere.util.TwitterAPIUtils.getTwitterInstance; diff --git a/twidere/src/main/java/org/mariotaku/twidere/loader/support/RetweetsOfMeLoader.java b/twidere/src/main/java/org/mariotaku/twidere/loader/support/RetweetsOfMeLoader.java index cc2d63ac0..4a4420c10 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/loader/support/RetweetsOfMeLoader.java +++ b/twidere/src/main/java/org/mariotaku/twidere/loader/support/RetweetsOfMeLoader.java @@ -27,12 +27,12 @@ import org.mariotaku.twidere.model.ParcelableStatus; import java.util.List; -import twitter4j.Paging; -import twitter4j.ResponseList; -import twitter4j.Status; -import twitter4j.Twitter; -import twitter4j.TwitterException; -import twitter4j.User; +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.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterException; +import org.mariotaku.twidere.api.twitter.model.User; import static org.mariotaku.twidere.util.Utils.isFiltered; diff --git a/twidere/src/main/java/org/mariotaku/twidere/loader/support/SavedSearchesLoader.java b/twidere/src/main/java/org/mariotaku/twidere/loader/support/SavedSearchesLoader.java index 5c9235c6d..1d3aa5216 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/loader/support/SavedSearchesLoader.java +++ b/twidere/src/main/java/org/mariotaku/twidere/loader/support/SavedSearchesLoader.java @@ -24,10 +24,10 @@ import android.support.v4.content.AsyncTaskLoader; import org.mariotaku.twidere.util.TwitterAPIUtils; -import twitter4j.ResponseList; -import twitter4j.SavedSearch; -import twitter4j.Twitter; -import twitter4j.TwitterException; +import org.mariotaku.twidere.api.twitter.model.ResponseList; +import org.mariotaku.twidere.api.twitter.model.SavedSearch; +import org.mariotaku.twidere.api.twitter.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterException; import static org.mariotaku.twidere.util.TwitterAPIUtils.getTwitterInstance; diff --git a/twidere/src/main/java/org/mariotaku/twidere/loader/support/StatusFavoritersLoader.java b/twidere/src/main/java/org/mariotaku/twidere/loader/support/StatusFavoritersLoader.java index 09d01342f..78a4a8614 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/loader/support/StatusFavoritersLoader.java +++ b/twidere/src/main/java/org/mariotaku/twidere/loader/support/StatusFavoritersLoader.java @@ -25,10 +25,10 @@ import org.mariotaku.twidere.model.ParcelableUser; import java.util.List; -import twitter4j.IDs; -import twitter4j.Paging; -import twitter4j.Twitter; -import twitter4j.TwitterException; +import org.mariotaku.twidere.api.twitter.model.IDs; +import org.mariotaku.twidere.api.twitter.model.Paging; +import org.mariotaku.twidere.api.twitter.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterException; public class StatusFavoritersLoader extends IDsUsersLoader { diff --git a/twidere/src/main/java/org/mariotaku/twidere/loader/support/StatusRepliesLoader.java b/twidere/src/main/java/org/mariotaku/twidere/loader/support/StatusRepliesLoader.java index 75ccdc2e4..1066ba650 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/loader/support/StatusRepliesLoader.java +++ b/twidere/src/main/java/org/mariotaku/twidere/loader/support/StatusRepliesLoader.java @@ -27,10 +27,10 @@ import org.mariotaku.twidere.model.ParcelableStatus; import java.util.ArrayList; import java.util.List; -import twitter4j.Paging; -import twitter4j.Status; -import twitter4j.Twitter; -import twitter4j.TwitterException; +import org.mariotaku.twidere.api.twitter.model.Paging; +import org.mariotaku.twidere.api.twitter.model.Status; +import org.mariotaku.twidere.api.twitter.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterException; import static org.mariotaku.twidere.util.Utils.isOfficialTwitterInstance; import static org.mariotaku.twidere.util.Utils.shouldForceUsingPrivateAPIs; diff --git a/twidere/src/main/java/org/mariotaku/twidere/loader/support/StatusRetweetersLoader.java b/twidere/src/main/java/org/mariotaku/twidere/loader/support/StatusRetweetersLoader.java index d0537dbc9..651a07526 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/loader/support/StatusRetweetersLoader.java +++ b/twidere/src/main/java/org/mariotaku/twidere/loader/support/StatusRetweetersLoader.java @@ -25,10 +25,10 @@ import org.mariotaku.twidere.model.ParcelableUser; import java.util.List; -import twitter4j.IDs; -import twitter4j.Paging; -import twitter4j.Twitter; -import twitter4j.TwitterException; +import org.mariotaku.twidere.api.twitter.model.IDs; +import org.mariotaku.twidere.api.twitter.model.Paging; +import org.mariotaku.twidere.api.twitter.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterException; public class StatusRetweetersLoader extends IDsUsersLoader { diff --git a/twidere/src/main/java/org/mariotaku/twidere/loader/support/TweetSearchLoader.java b/twidere/src/main/java/org/mariotaku/twidere/loader/support/TweetSearchLoader.java index d8739783b..5433083e6 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/loader/support/TweetSearchLoader.java +++ b/twidere/src/main/java/org/mariotaku/twidere/loader/support/TweetSearchLoader.java @@ -27,11 +27,11 @@ import org.mariotaku.twidere.model.ParcelableStatus; import java.util.List; -import twitter4j.Paging; -import twitter4j.SearchQuery; -import twitter4j.Status; -import twitter4j.Twitter; -import twitter4j.TwitterException; +import org.mariotaku.twidere.api.twitter.model.Paging; +import org.mariotaku.twidere.api.twitter.model.SearchQuery; +import org.mariotaku.twidere.api.twitter.model.Status; +import org.mariotaku.twidere.api.twitter.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterException; import static org.mariotaku.twidere.util.Utils.isFiltered; diff --git a/twidere/src/main/java/org/mariotaku/twidere/loader/support/Twitter4JActivitiesLoader.java b/twidere/src/main/java/org/mariotaku/twidere/loader/support/Twitter4JActivitiesLoader.java index 3c6cdf0d6..b61932fcc 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/loader/support/Twitter4JActivitiesLoader.java +++ b/twidere/src/main/java/org/mariotaku/twidere/loader/support/Twitter4JActivitiesLoader.java @@ -42,10 +42,10 @@ import java.util.Comparator; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; -import twitter4j.Activity; -import twitter4j.Paging; -import twitter4j.Twitter; -import twitter4j.TwitterException; +import org.mariotaku.twidere.api.twitter.model.Activity; +import org.mariotaku.twidere.api.twitter.model.Paging; +import org.mariotaku.twidere.api.twitter.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterException; import static org.mariotaku.twidere.util.TwitterAPIUtils.getTwitterInstance; import static org.mariotaku.twidere.util.Utils.truncateActivities; diff --git a/twidere/src/main/java/org/mariotaku/twidere/loader/support/Twitter4JUsersLoader.java b/twidere/src/main/java/org/mariotaku/twidere/loader/support/Twitter4JUsersLoader.java index 4ece82abd..efcb87013 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/loader/support/Twitter4JUsersLoader.java +++ b/twidere/src/main/java/org/mariotaku/twidere/loader/support/Twitter4JUsersLoader.java @@ -27,9 +27,9 @@ import org.mariotaku.twidere.util.TwitterAPIUtils; import java.util.Collections; import java.util.List; -import twitter4j.Twitter; -import twitter4j.TwitterException; -import twitter4j.User; +import org.mariotaku.twidere.api.twitter.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterException; +import org.mariotaku.twidere.api.twitter.model.User; import static org.mariotaku.twidere.util.TwitterAPIUtils.getTwitterInstance; diff --git a/twidere/src/main/java/org/mariotaku/twidere/loader/support/TwitterAPIStatusesLoader.java b/twidere/src/main/java/org/mariotaku/twidere/loader/support/TwitterAPIStatusesLoader.java index a8d321676..9188cbad4 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/loader/support/TwitterAPIStatusesLoader.java +++ b/twidere/src/main/java/org/mariotaku/twidere/loader/support/TwitterAPIStatusesLoader.java @@ -44,10 +44,10 @@ import java.util.Comparator; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; -import twitter4j.Paging; -import twitter4j.Status; -import twitter4j.Twitter; -import twitter4j.TwitterException; +import org.mariotaku.twidere.api.twitter.model.Paging; +import org.mariotaku.twidere.api.twitter.model.Status; +import org.mariotaku.twidere.api.twitter.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterException; import static org.mariotaku.twidere.util.TwitterAPIUtils.getTwitterInstance; import static org.mariotaku.twidere.util.Utils.truncateStatuses; @@ -119,7 +119,7 @@ public abstract class TwitterAPIStatusesLoader extends ParcelableStatusesLoader int minIdx = -1; int rowsDeleted = 0; for (int i = 0, j = statuses.size(); i < j; i++) { - final twitter4j.Status status = statuses.get(i); + final Status status = statuses.get(i); final long id = status.getId(); if (minId == -1 || id < minId) { minId = id; diff --git a/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserBlocksLoader.java b/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserBlocksLoader.java index 505eab8a1..f4a1d6a41 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserBlocksLoader.java +++ b/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserBlocksLoader.java @@ -25,11 +25,11 @@ import org.mariotaku.twidere.model.ParcelableUser; import java.util.List; -import twitter4j.PageableResponseList; -import twitter4j.Paging; -import twitter4j.Twitter; -import twitter4j.TwitterException; -import twitter4j.User; +import org.mariotaku.twidere.api.twitter.model.PageableResponseList; +import org.mariotaku.twidere.api.twitter.model.Paging; +import org.mariotaku.twidere.api.twitter.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterException; +import org.mariotaku.twidere.api.twitter.model.User; public class UserBlocksLoader extends CursorSupportUsersLoader { diff --git a/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserFavoritesLoader.java b/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserFavoritesLoader.java index b3e64b8f5..909c0c382 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserFavoritesLoader.java +++ b/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserFavoritesLoader.java @@ -27,11 +27,11 @@ import org.mariotaku.twidere.model.ParcelableStatus; import java.util.List; -import twitter4j.Paging; -import twitter4j.ResponseList; -import twitter4j.Status; -import twitter4j.Twitter; -import twitter4j.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.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterException; public class UserFavoritesLoader extends TwitterAPIStatusesLoader { diff --git a/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserFollowersLoader.java b/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserFollowersLoader.java index 797f9748d..5879e4a08 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserFollowersLoader.java +++ b/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserFollowersLoader.java @@ -25,11 +25,11 @@ import org.mariotaku.twidere.model.ParcelableUser; import java.util.List; -import twitter4j.PageableResponseList; -import twitter4j.Paging; -import twitter4j.Twitter; -import twitter4j.TwitterException; -import twitter4j.User; +import org.mariotaku.twidere.api.twitter.model.PageableResponseList; +import org.mariotaku.twidere.api.twitter.model.Paging; +import org.mariotaku.twidere.api.twitter.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterException; +import org.mariotaku.twidere.api.twitter.model.User; public class UserFollowersLoader extends CursorSupportUsersLoader { diff --git a/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserFriendsLoader.java b/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserFriendsLoader.java index 73c93fcb6..1352313ee 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserFriendsLoader.java +++ b/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserFriendsLoader.java @@ -25,11 +25,11 @@ import org.mariotaku.twidere.model.ParcelableUser; import java.util.List; -import twitter4j.PageableResponseList; -import twitter4j.Paging; -import twitter4j.Twitter; -import twitter4j.TwitterException; -import twitter4j.User; +import org.mariotaku.twidere.api.twitter.model.PageableResponseList; +import org.mariotaku.twidere.api.twitter.model.Paging; +import org.mariotaku.twidere.api.twitter.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterException; +import org.mariotaku.twidere.api.twitter.model.User; public class UserFriendsLoader extends CursorSupportUsersLoader { diff --git a/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserListMembersLoader.java b/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserListMembersLoader.java index b91d02510..bcb58e610 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserListMembersLoader.java +++ b/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserListMembersLoader.java @@ -25,11 +25,11 @@ import org.mariotaku.twidere.model.ParcelableUser; import java.util.List; -import twitter4j.PageableResponseList; -import twitter4j.Paging; -import twitter4j.Twitter; -import twitter4j.TwitterException; -import twitter4j.User; +import org.mariotaku.twidere.api.twitter.model.PageableResponseList; +import org.mariotaku.twidere.api.twitter.model.Paging; +import org.mariotaku.twidere.api.twitter.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterException; +import org.mariotaku.twidere.api.twitter.model.User; public class UserListMembersLoader extends CursorSupportUsersLoader { diff --git a/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserListMembershipsLoader.java b/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserListMembershipsLoader.java index 2e64d154a..fb4ce5c99 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserListMembershipsLoader.java +++ b/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserListMembershipsLoader.java @@ -25,11 +25,11 @@ import org.mariotaku.twidere.model.ParcelableUserList; import java.util.List; -import twitter4j.PageableResponseList; -import twitter4j.Paging; -import twitter4j.Twitter; -import twitter4j.TwitterException; -import twitter4j.UserList; +import org.mariotaku.twidere.api.twitter.model.PageableResponseList; +import org.mariotaku.twidere.api.twitter.model.Paging; +import org.mariotaku.twidere.api.twitter.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterException; +import org.mariotaku.twidere.api.twitter.model.UserList; public class UserListMembershipsLoader extends BaseUserListsLoader { diff --git a/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserListSubscribersLoader.java b/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserListSubscribersLoader.java index ff657a6e9..16f74da52 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserListSubscribersLoader.java +++ b/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserListSubscribersLoader.java @@ -25,11 +25,11 @@ import org.mariotaku.twidere.model.ParcelableUser; import java.util.List; -import twitter4j.PageableResponseList; -import twitter4j.Paging; -import twitter4j.Twitter; -import twitter4j.TwitterException; -import twitter4j.User; +import org.mariotaku.twidere.api.twitter.model.PageableResponseList; +import org.mariotaku.twidere.api.twitter.model.Paging; +import org.mariotaku.twidere.api.twitter.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterException; +import org.mariotaku.twidere.api.twitter.model.User; public class UserListSubscribersLoader extends CursorSupportUsersLoader { diff --git a/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserListTimelineLoader.java b/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserListTimelineLoader.java index 0e241017f..72413eeb0 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserListTimelineLoader.java +++ b/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserListTimelineLoader.java @@ -27,11 +27,11 @@ import org.mariotaku.twidere.model.ParcelableStatus; import java.util.List; -import twitter4j.Paging; -import twitter4j.ResponseList; -import twitter4j.Status; -import twitter4j.Twitter; -import twitter4j.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.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterException; import static org.mariotaku.twidere.util.Utils.isFiltered; diff --git a/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserListsLoader.java b/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserListsLoader.java index c8c36d8cf..4c3ce70ac 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserListsLoader.java +++ b/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserListsLoader.java @@ -25,10 +25,10 @@ import org.mariotaku.twidere.model.ParcelableUserList; import java.util.List; -import twitter4j.ResponseList; -import twitter4j.Twitter; -import twitter4j.TwitterException; -import twitter4j.UserList; +import org.mariotaku.twidere.api.twitter.model.ResponseList; +import org.mariotaku.twidere.api.twitter.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterException; +import org.mariotaku.twidere.api.twitter.model.UserList; public class UserListsLoader extends BaseUserListsLoader { diff --git a/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserSearchLoader.java b/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserSearchLoader.java index a480ebaf8..8972709ac 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserSearchLoader.java +++ b/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserSearchLoader.java @@ -25,10 +25,10 @@ import org.mariotaku.twidere.model.ParcelableUser; import java.util.List; -import twitter4j.Paging; -import twitter4j.Twitter; -import twitter4j.TwitterException; -import twitter4j.User; +import org.mariotaku.twidere.api.twitter.model.Paging; +import org.mariotaku.twidere.api.twitter.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterException; +import org.mariotaku.twidere.api.twitter.model.User; public class UserSearchLoader extends Twitter4JUsersLoader { diff --git a/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserTimelineLoader.java b/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserTimelineLoader.java index a61952044..b3aa89860 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserTimelineLoader.java +++ b/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserTimelineLoader.java @@ -27,11 +27,11 @@ import org.mariotaku.twidere.model.ParcelableStatus; import java.util.List; -import twitter4j.Paging; -import twitter4j.ResponseList; -import twitter4j.Status; -import twitter4j.Twitter; -import twitter4j.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.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterException; import static org.mariotaku.twidere.util.Utils.getAccountId; import static org.mariotaku.twidere.util.Utils.isFiltered; diff --git a/twidere/src/main/java/org/mariotaku/twidere/model/ParcelableActivity.java b/twidere/src/main/java/org/mariotaku/twidere/model/ParcelableActivity.java index 61db2a6be..7aa83983c 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/model/ParcelableActivity.java +++ b/twidere/src/main/java/org/mariotaku/twidere/model/ParcelableActivity.java @@ -26,10 +26,10 @@ import com.bluelinelabs.logansquare.annotation.JsonObject; import java.util.Arrays; -import twitter4j.Activity; -import twitter4j.Status; -import twitter4j.User; -import twitter4j.UserList; +import org.mariotaku.twidere.api.twitter.model.Activity; +import org.mariotaku.twidere.api.twitter.model.Status; +import org.mariotaku.twidere.api.twitter.model.User; +import org.mariotaku.twidere.api.twitter.model.UserList; @JsonObject public class ParcelableActivity implements Comparable { diff --git a/twidere/src/main/java/org/mariotaku/twidere/preference/DefaultAPIPreference.java b/twidere/src/main/java/org/mariotaku/twidere/preference/DefaultAPIPreference.java index 390595379..785767b8e 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/preference/DefaultAPIPreference.java +++ b/twidere/src/main/java/org/mariotaku/twidere/preference/DefaultAPIPreference.java @@ -40,7 +40,7 @@ import org.mariotaku.twidere.Constants; import org.mariotaku.twidere.R; import org.mariotaku.twidere.provider.TwidereDataStore.Accounts; -import twitter4j.TwitterConstants; +import org.mariotaku.twidere.api.twitter.TwitterConstants; import static android.text.TextUtils.isEmpty; import static org.mariotaku.twidere.util.ParseUtils.parseString; diff --git a/twidere/src/main/java/org/mariotaku/twidere/preference/TranslationDestinationPreference.java b/twidere/src/main/java/org/mariotaku/twidere/preference/TranslationDestinationPreference.java index 7cf6fb2fd..81355a079 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/preference/TranslationDestinationPreference.java +++ b/twidere/src/main/java/org/mariotaku/twidere/preference/TranslationDestinationPreference.java @@ -45,10 +45,10 @@ import java.text.Collator; import java.util.Comparator; import java.util.List; -import twitter4j.ResponseList; -import twitter4j.Twitter; -import twitter4j.TwitterException; -import twitter4j.api.HelpResources.Language; +import org.mariotaku.twidere.api.twitter.model.ResponseList; +import org.mariotaku.twidere.api.twitter.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterException; +import org.mariotaku.twidere.api.twitter.api.HelpResources.Language; import static org.mariotaku.twidere.util.TwitterAPIUtils.getDefaultTwitterInstance; diff --git a/twidere/src/main/java/org/mariotaku/twidere/preference/TrendsLocationPreference.java b/twidere/src/main/java/org/mariotaku/twidere/preference/TrendsLocationPreference.java index fe94fe102..7c8e19d41 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/preference/TrendsLocationPreference.java +++ b/twidere/src/main/java/org/mariotaku/twidere/preference/TrendsLocationPreference.java @@ -43,10 +43,10 @@ import java.text.Collator; import java.util.Comparator; import java.util.List; -import twitter4j.Location; -import twitter4j.ResponseList; -import twitter4j.Twitter; -import twitter4j.TwitterException; +import org.mariotaku.twidere.api.twitter.model.Location; +import org.mariotaku.twidere.api.twitter.model.ResponseList; +import org.mariotaku.twidere.api.twitter.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterException; import static org.mariotaku.twidere.util.TwitterAPIUtils.getDefaultTwitterInstance; diff --git a/twidere/src/main/java/org/mariotaku/twidere/provider/TwidereDataProvider.java b/twidere/src/main/java/org/mariotaku/twidere/provider/TwidereDataProvider.java index 482259bc7..209c73a0b 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/provider/TwidereDataProvider.java +++ b/twidere/src/main/java/org/mariotaku/twidere/provider/TwidereDataProvider.java @@ -55,6 +55,7 @@ import android.text.SpannableStringBuilder; import android.text.style.StyleSpan; import android.util.Log; +import com.squareup.okhttp.internal.Network; import com.squareup.otto.Bus; import org.apache.commons.lang3.ArrayUtils; @@ -109,8 +110,6 @@ import java.util.List; import java.util.Map; import java.util.Set; -import twitter4j.http.HostAddressResolver; - import static org.mariotaku.twidere.util.Utils.clearAccountColor; import static org.mariotaku.twidere.util.Utils.clearAccountName; import static org.mariotaku.twidere.util.Utils.getAccountIds; @@ -130,7 +129,7 @@ public final class TwidereDataProvider extends ContentProvider implements Consta private ReadStateManager mReadStateManager; private SharedPreferencesWrapper mPreferences; private ImagePreloader mImagePreloader; - private HostAddressResolver mHostAddressResolver; + private Network mNetwork; private Handler mHandler; private boolean mHomeActivityInBackground; @@ -320,7 +319,7 @@ public final class TwidereDataProvider extends ContentProvider implements Consta final TwidereApplication app = TwidereApplication.getInstance(context); mHandler = new Handler(Looper.getMainLooper()); mDatabaseWrapper = new SQLiteDatabaseWrapper(this); - mHostAddressResolver = app.getHostAddressResolver(); + mNetwork = app.getNetwork(); mPreferences = SharedPreferencesWrapper.getInstance(context, SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE); mPreferences.registerOnSharedPreferenceChangeListener(this); updatePreferences(); @@ -668,7 +667,7 @@ public final class TwidereDataProvider extends ContentProvider implements Consta private Cursor getDNSCursor(final String host) { final MatrixCursor c = new MatrixCursor(TwidereDataStore.DNS.MATRIX_COLUMNS); try { - final InetAddress[] addresses = mHostAddressResolver.resolve(host); + final InetAddress[] addresses = mNetwork.resolveInetAddresses(host); for (InetAddress address : addresses) { c.addRow(new String[]{host, address.getHostAddress()}); } diff --git a/twidere/src/main/java/org/mariotaku/twidere/service/BackgroundOperationService.java b/twidere/src/main/java/org/mariotaku/twidere/service/BackgroundOperationService.java index 6adbcf6dd..336db92a3 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/service/BackgroundOperationService.java +++ b/twidere/src/main/java/org/mariotaku/twidere/service/BackgroundOperationService.java @@ -90,13 +90,13 @@ import java.util.List; import edu.tsinghua.spice.Utilies.SpiceProfilingUtil; import edu.tsinghua.spice.Utilies.TypeMappingUtil; -import twitter4j.MediaUploadResponse; -import twitter4j.Status; -import twitter4j.StatusUpdate; -import twitter4j.Twitter; -import twitter4j.TwitterException; -import twitter4j.UserMentionEntity; -import twitter4j.api.TwitterUpload; +import org.mariotaku.twidere.api.twitter.model.MediaUploadResponse; +import org.mariotaku.twidere.api.twitter.model.Status; +import org.mariotaku.twidere.api.twitter.model.StatusUpdate; +import org.mariotaku.twidere.api.twitter.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterException; +import org.mariotaku.twidere.api.twitter.model.UserMentionEntity; +import org.mariotaku.twidere.api.twitter.api.TwitterUpload; import static android.text.TextUtils.isEmpty; import static org.mariotaku.twidere.util.ContentValuesCreator.createMessageDraft; diff --git a/twidere/src/main/java/org/mariotaku/twidere/task/CacheUsersStatusesTask.java b/twidere/src/main/java/org/mariotaku/twidere/task/CacheUsersStatusesTask.java index 52e39057a..dccde6a3c 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/task/CacheUsersStatusesTask.java +++ b/twidere/src/main/java/org/mariotaku/twidere/task/CacheUsersStatusesTask.java @@ -27,6 +27,7 @@ import android.os.AsyncTask; import com.twitter.Extractor; import org.mariotaku.twidere.Constants; +import org.mariotaku.twidere.api.twitter.model.Status; import org.mariotaku.twidere.provider.TwidereDataStore.CachedHashtags; import org.mariotaku.twidere.provider.TwidereDataStore.CachedStatuses; import org.mariotaku.twidere.provider.TwidereDataStore.CachedUsers; @@ -42,7 +43,7 @@ import static org.mariotaku.twidere.util.ContentValuesCreator.createCachedUser; import static org.mariotaku.twidere.util.ContentValuesCreator.createStatus; import static org.mariotaku.twidere.util.content.ContentResolverUtils.bulkInsert; -public class CacheUsersStatusesTask extends AsyncTask, Object, Object> implements Constants { +public class CacheUsersStatusesTask extends AsyncTask, Object, Object> implements Constants { private final Context context; @@ -52,19 +53,19 @@ public class CacheUsersStatusesTask extends AsyncTask... args) { + protected final Object doInBackground(final TwitterListResponse... args) { if (args == null || args.length == 0) return null; final ContentResolver resolver = context.getContentResolver(); final Extractor extractor = new Extractor(); - for (final TwitterListResponse response : args) { + for (final TwitterListResponse response : args) { if (response == null || response.list == null) { continue; } - final List list = response.list; + final List list = response.list; for (int bulkIdx = 0, totalSize = list.size(); bulkIdx < totalSize; bulkIdx += 100) { for (int idx = bulkIdx, end = Math.min(totalSize, bulkIdx + ContentResolverUtils.MAX_BULK_COUNT); idx < end; idx++) { - final twitter4j.Status status = list.get(idx); + final org.mariotaku.twidere.api.twitter.model.Status status = list.get(idx); final Set usersValues = new HashSet<>(); final Set statusesValues = new HashSet<>(); diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/AsyncTwitterWrapper.java b/twidere/src/main/java/org/mariotaku/twidere/util/AsyncTwitterWrapper.java index 6a357337d..4b8275859 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/AsyncTwitterWrapper.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/AsyncTwitterWrapper.java @@ -40,6 +40,7 @@ import org.mariotaku.querybuilder.Expression; import org.mariotaku.querybuilder.RawItemArray; import org.mariotaku.querybuilder.SQLFunctions; import org.mariotaku.twidere.R; +import org.mariotaku.twidere.api.twitter.model.Status; import org.mariotaku.twidere.app.TwidereApplication; import org.mariotaku.twidere.constant.SharedPreferenceConstants; import org.mariotaku.twidere.model.ListResponse; @@ -87,17 +88,17 @@ import java.util.concurrent.CopyOnWriteArraySet; import edu.tsinghua.spice.Utilies.SpiceProfilingUtil; import edu.tsinghua.spice.Utilies.TypeMappingUtil; import edu.ucdavis.earlybird.ProfilingUtil; -import twitter4j.DirectMessage; -import twitter4j.Paging; -import twitter4j.ResponseList; -import twitter4j.SavedSearch; -import twitter4j.Trends; -import twitter4j.Twitter; -import twitter4j.TwitterException; -import twitter4j.User; -import twitter4j.UserList; -import twitter4j.UserListUpdate; -import twitter4j.http.HttpResponseCode; +import org.mariotaku.twidere.api.twitter.model.DirectMessage; +import org.mariotaku.twidere.api.twitter.model.Paging; +import org.mariotaku.twidere.api.twitter.model.ResponseList; +import org.mariotaku.twidere.api.twitter.model.SavedSearch; +import org.mariotaku.twidere.api.twitter.model.Trends; +import org.mariotaku.twidere.api.twitter.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterException; +import org.mariotaku.twidere.api.twitter.model.User; +import org.mariotaku.twidere.api.twitter.model.UserList; +import org.mariotaku.twidere.api.twitter.model.UserListUpdate; +import org.mariotaku.twidere.api.twitter.http.HttpResponseCode; import static org.mariotaku.twidere.provider.TwidereDataStore.STATUSES_URIS; import static org.mariotaku.twidere.util.ContentValuesCreator.createDirectMessage; @@ -853,7 +854,7 @@ public class AsyncTwitterWrapper extends TwitterWrapper { final Twitter twitter = TwitterAPIUtils.getTwitterInstance(mContext, account_id, true); if (twitter == null) return SingleResponse.getInstance(); try { - final twitter4j.Status status = twitter.createFavorite(status_id); + final org.mariotaku.twidere.api.twitter.model.Status status = twitter.createFavorite(status_id); Utils.setLastSeen(mContext, status.getUserMentionEntities(), System.currentTimeMillis()); final ContentValues values = new ContentValues(); values.put(Statuses.IS_FAVORITE, true); @@ -1431,7 +1432,7 @@ public class AsyncTwitterWrapper extends TwitterWrapper { final Twitter twitter = TwitterAPIUtils.getTwitterInstance(mContext, account_id, true); if (twitter != null) { try { - final twitter4j.Status status = twitter.destroyFavorite(status_id); + final org.mariotaku.twidere.api.twitter.model.Status status = twitter.destroyFavorite(status_id); final ContentValues values = new ContentValues(); values.put(Statuses.IS_FAVORITE, false); if (status.isRetweet()) { @@ -1896,7 +1897,7 @@ public class AsyncTwitterWrapper extends TwitterWrapper { } @Override - public ResponseList getStatuses(final Twitter twitter, final Paging paging) + public ResponseList getStatuses(final Twitter twitter, final Paging paging) throws TwitterException { return twitter.getHomeTimeline(paging); } @@ -1958,7 +1959,7 @@ public class AsyncTwitterWrapper extends TwitterWrapper { @Override - public ResponseList getStatuses(final Twitter twitter, final Paging paging) + public ResponseList getStatuses(final Twitter twitter, final Paging paging) throws TwitterException { return twitter.getMentionsTimeline(paging); } @@ -2055,7 +2056,7 @@ public class AsyncTwitterWrapper extends TwitterWrapper { } - abstract class GetStatusesTask extends ManagedAsyncTask, List> { + abstract class GetStatusesTask extends ManagedAsyncTask, List> { private final long[] mAccountIds, mMaxIds, mSinceIds; @@ -2066,7 +2067,7 @@ public class AsyncTwitterWrapper extends TwitterWrapper { mSinceIds = since_ids; } - public abstract ResponseList getStatuses(Twitter twitter, Paging paging) + public abstract ResponseList getStatuses(Twitter twitter, Paging paging) throws TwitterException; @NonNull @@ -2080,7 +2081,7 @@ public class AsyncTwitterWrapper extends TwitterWrapper { return mSinceIds != null && mSinceIds.length == mAccountIds.length; } - private void storeStatus(long accountId, List statuses, long maxId, boolean truncated, boolean notify) { + private void storeStatus(long accountId, List statuses, long maxId, boolean truncated, boolean notify) { if (statuses == null || statuses.isEmpty() || accountId <= 0) { return; } @@ -2091,7 +2092,7 @@ public class AsyncTwitterWrapper extends TwitterWrapper { long minId = -1; int minIdx = -1; for (int i = 0, j = statuses.size(); i < j; i++) { - final twitter4j.Status status = statuses.get(i); + final org.mariotaku.twidere.api.twitter.model.Status status = statuses.get(i); values[i] = createStatus(status, accountId); final long id = status.getId(); if (minId == -1 || id < minId) { @@ -2135,7 +2136,7 @@ public class AsyncTwitterWrapper extends TwitterWrapper { @SafeVarargs @Override - protected final void onProgressUpdate(TwitterListResponse... values) { + protected final void onProgressUpdate(TwitterListResponse... values) { AsyncTaskUtils.executeTask(new CacheUsersStatusesTask(mContext), values); } @@ -2179,7 +2180,7 @@ public class AsyncTwitterWrapper extends TwitterWrapper { } else { sinceId = -1; } - final List statuses = new ArrayList<>(); + final List statuses = new ArrayList<>(); final boolean truncated = truncateStatuses(getStatuses(twitter, paging), statuses, sinceId); storeStatus(accountId, statuses, maxId, truncated, true); publishProgress(new StatusListResponse(accountId, statuses)); @@ -2356,7 +2357,7 @@ public class AsyncTwitterWrapper extends TwitterWrapper { return SingleResponse.getInstance(); } try { - final twitter4j.Status status = twitter.retweetStatus(status_id); + final org.mariotaku.twidere.api.twitter.model.Status status = twitter.retweetStatus(status_id); Utils.setLastSeen(mContext, status.getUserMentionEntities(), System.currentTimeMillis()); return SingleResponse.getInstance(new ParcelableStatus(status, account_id, false)); } catch (final TwitterException e) { diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/OAuthPasswordAuthenticator.java b/twidere/src/main/java/org/mariotaku/twidere/util/OAuthPasswordAuthenticator.java index 91f8f85f3..9a76757f2 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/OAuthPasswordAuthenticator.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/OAuthPasswordAuthenticator.java @@ -50,7 +50,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import twitter4j.TwitterOAuth; +import org.mariotaku.twidere.api.twitter.TwitterOAuth; import static android.text.TextUtils.isEmpty; diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/TwitterAPIUtils.java b/twidere/src/main/java/org/mariotaku/twidere/util/TwitterAPIUtils.java index 5a2703f57..82d99d4ff 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/TwitterAPIUtils.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/TwitterAPIUtils.java @@ -9,7 +9,6 @@ import android.util.Pair; import com.squareup.okhttp.OkHttpClient; import com.squareup.okhttp.internal.Internal; -import com.squareup.okhttp.internal.Network; import org.mariotaku.simplerestapi.RestAPIFactory; import org.mariotaku.simplerestapi.RestMethod; @@ -20,33 +19,28 @@ import org.mariotaku.simplerestapi.http.RestHttpClient; import org.mariotaku.simplerestapi.http.RestRequest; import org.mariotaku.simplerestapi.http.RestResponse; import org.mariotaku.twidere.TwidereConstants; -import org.mariotaku.twidere.api.twitter.OkHttpRestClient; -import org.mariotaku.twidere.api.twitter.TwitterConverter; +import org.mariotaku.twidere.api.twitter.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterException; +import org.mariotaku.twidere.api.twitter.TwitterOAuth; +import org.mariotaku.twidere.api.twitter.api.TwitterUpload; import org.mariotaku.twidere.api.twitter.auth.BasicAuthorization; import org.mariotaku.twidere.api.twitter.auth.EmptyAuthorization; import org.mariotaku.twidere.api.twitter.auth.OAuthAuthorization; import org.mariotaku.twidere.api.twitter.auth.OAuthEndpoint; import org.mariotaku.twidere.api.twitter.auth.OAuthToken; +import org.mariotaku.twidere.api.twitter.util.TwitterConverter; import org.mariotaku.twidere.app.TwidereApplication; import org.mariotaku.twidere.model.ConsumerKeyType; import org.mariotaku.twidere.model.ParcelableAccount; import org.mariotaku.twidere.provider.TwidereDataStore; +import org.mariotaku.twidere.util.net.OkHttpRestClient; -import java.io.IOException; -import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.Proxy; import java.net.SocketAddress; -import java.net.UnknownHostException; import java.util.ArrayList; import java.util.concurrent.TimeUnit; -import twitter4j.Twitter; -import twitter4j.TwitterException; -import twitter4j.TwitterOAuth; -import twitter4j.api.TwitterUpload; -import twitter4j.http.HostAddressResolver; - import static android.text.TextUtils.isEmpty; /** @@ -213,18 +207,7 @@ public class TwitterAPIUtils implements TwidereConstants { if (enableProxy) { client.setProxy(getProxy(prefs)); } - final HostAddressResolver resolver = TwidereApplication.getInstance(context).getHostAddressResolver(); - Internal.instance.setNetwork(client, new Network() { - @Override - public InetAddress[] resolveInetAddresses(String host) throws UnknownHostException { - try { - return resolver.resolve(host); - } catch (IOException e) { - if (e instanceof UnknownHostException) throw (UnknownHostException) e; - throw new UnknownHostException("Unable to resolve address " + e.getMessage()); - } - } - }); + Internal.instance.setNetwork(client, TwidereApplication.getInstance(context).getNetwork()); return new OkHttpRestClient(client); } diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/TwitterCardFragmentFactory.java b/twidere/src/main/java/org/mariotaku/twidere/util/TwitterCardFragmentFactory.java index 24cc474ff..a5c949d25 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/TwitterCardFragmentFactory.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/TwitterCardFragmentFactory.java @@ -25,7 +25,7 @@ import org.mariotaku.twidere.fragment.support.CardBrowserFragment; import org.mariotaku.twidere.model.ParcelableStatus.ParcelableCardEntity; import org.mariotaku.twidere.model.ParcelableStatus.ParcelableCardEntity.ParcelableBindingValue; -import twitter4j.CardEntity.BindingValue; +import org.mariotaku.twidere.api.twitter.model.CardEntity.BindingValue; /** * Created by mariotaku on 15/1/1. diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/TwitterWrapper.java b/twidere/src/main/java/org/mariotaku/twidere/util/TwitterWrapper.java index 095e9181d..f0f98cd70 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/TwitterWrapper.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/TwitterWrapper.java @@ -27,7 +27,6 @@ import android.util.Log; import org.mariotaku.twidere.Constants; import org.mariotaku.twidere.model.ListResponse; -import org.mariotaku.twidere.model.ParcelableUser; import org.mariotaku.twidere.model.SingleResponse; import org.mariotaku.twidere.provider.TwidereDataStore.Notifications; import org.mariotaku.twidere.provider.TwidereDataStore.UnreadCounts; @@ -39,13 +38,13 @@ import java.io.InputStream; import java.util.List; import java.util.Set; -import twitter4j.DirectMessage; -import twitter4j.Paging; -import twitter4j.ResponseList; -import twitter4j.Status; -import twitter4j.Twitter; -import twitter4j.TwitterException; -import twitter4j.User; +import org.mariotaku.twidere.api.twitter.model.DirectMessage; +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.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterException; +import org.mariotaku.twidere.api.twitter.model.User; public class TwitterWrapper implements Constants { diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/UserColorNameManager.java b/twidere/src/main/java/org/mariotaku/twidere/util/UserColorNameManager.java index e5998cdef..d9c42102b 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/UserColorNameManager.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/UserColorNameManager.java @@ -34,7 +34,7 @@ import org.mariotaku.twidere.model.ParcelableUserList; import java.util.Map; import java.util.Set; -import twitter4j.User; +import org.mariotaku.twidere.api.twitter.model.User; import static android.text.TextUtils.isEmpty; diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/Utils.java b/twidere/src/main/java/org/mariotaku/twidere/util/Utils.java index 8ccd9eb27..045e2c6bf 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/Utils.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/Utils.java @@ -140,6 +140,7 @@ import org.mariotaku.twidere.activity.support.ColorPickerDialogActivity; import org.mariotaku.twidere.activity.support.MediaViewerActivity; import org.mariotaku.twidere.adapter.iface.IBaseAdapter; import org.mariotaku.twidere.adapter.iface.IBaseCardAdapter; +import org.mariotaku.twidere.api.twitter.model.Status; import org.mariotaku.twidere.api.twitter.auth.OAuthSupport; import org.mariotaku.twidere.fragment.iface.IBaseFragment.SystemWindowsInsetsCallback; import org.mariotaku.twidere.fragment.support.AccountsManagerFragment; @@ -248,14 +249,13 @@ import javax.net.ssl.SSLException; import edu.tsinghua.spice.SpiceService; import edu.ucdavis.earlybird.UCDService; -import twitter4j.DirectMessage; -import twitter4j.RateLimitStatus; -import twitter4j.Relationship; -import twitter4j.Status; -import twitter4j.Twitter; -import twitter4j.TwitterConstants; -import twitter4j.TwitterException; -import twitter4j.UserMentionEntity; +import org.mariotaku.twidere.api.twitter.model.DirectMessage; +import org.mariotaku.twidere.api.twitter.model.RateLimitStatus; +import org.mariotaku.twidere.api.twitter.model.Relationship; +import org.mariotaku.twidere.api.twitter.Twitter; +import org.mariotaku.twidere.api.twitter.TwitterConstants; +import org.mariotaku.twidere.api.twitter.TwitterException; +import org.mariotaku.twidere.api.twitter.model.UserMentionEntity; import static android.text.TextUtils.isEmpty; import static android.text.format.DateUtils.getRelativeTimeSpanString; @@ -3556,10 +3556,10 @@ public final class Utils implements Constants, TwitterConstants { return in.size() != out.size(); } - public static boolean truncateStatuses(final List in, final List out, + public static boolean truncateStatuses(final List in, final List out, final long sinceId) { if (in == null) return false; - for (final twitter4j.Status status : in) { + for (final Status status : in) { if (sinceId > 0 && status.getId() <= sinceId) { continue; } @@ -3568,10 +3568,10 @@ public final class Utils implements Constants, TwitterConstants { return in.size() != out.size(); } - public static boolean truncateActivities(final List in, final List out, + public static boolean truncateActivities(final List in, final List out, final long sinceId) { if (in == null) return false; - for (final twitter4j.Activity status : in) { + for (final org.mariotaku.twidere.api.twitter.model.Activity status : in) { if (sinceId > 0 && status.getMaxPosition() <= sinceId) { continue; } diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/imageloader/TwidereImageDownloader.java b/twidere/src/main/java/org/mariotaku/twidere/util/imageloader/TwidereImageDownloader.java index 9eb094ae3..a13b84eac 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/imageloader/TwidereImageDownloader.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/imageloader/TwidereImageDownloader.java @@ -56,7 +56,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Locale; -import twitter4j.TwitterException; +import org.mariotaku.twidere.api.twitter.TwitterException; public class TwidereImageDownloader extends BaseImageDownloader implements Constants { diff --git a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/OkHttpRestClient.java b/twidere/src/main/java/org/mariotaku/twidere/util/net/OkHttpRestClient.java similarity index 99% rename from twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/OkHttpRestClient.java rename to twidere/src/main/java/org/mariotaku/twidere/util/net/OkHttpRestClient.java index 3acac463c..a9c5c8c54 100644 --- a/twidere.component.twitter4j/src/main/java/org/mariotaku/twidere/api/twitter/OkHttpRestClient.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/net/OkHttpRestClient.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package org.mariotaku.twidere.api.twitter; +package org.mariotaku.twidere.util.net; import android.support.annotation.NonNull; import android.support.annotation.Nullable; diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/net/TwidereHostAddressResolver.java b/twidere/src/main/java/org/mariotaku/twidere/util/net/TwidereHostAddressResolver.java index 68a39be58..c53e474ed 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/net/TwidereHostAddressResolver.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/net/TwidereHostAddressResolver.java @@ -25,6 +25,8 @@ import android.support.annotation.NonNull; import android.util.Log; import android.util.LruCache; +import com.squareup.okhttp.internal.Network; + import org.apache.http.conn.util.InetAddressUtils; import org.mariotaku.twidere.Constants; import org.mariotaku.twidere.util.HostsFileParser; @@ -50,9 +52,7 @@ import java.util.Arrays; import java.util.Map.Entry; import java.util.regex.Pattern; -import twitter4j.http.HostAddressResolver; - -public class TwidereHostAddressResolver implements Constants, HostAddressResolver { +public class TwidereHostAddressResolver implements Constants, Network { private static final String RESOLVER_LOGTAG = "Twidere.Host"; @@ -77,11 +77,6 @@ public class TwidereHostAddressResolver implements Constants, HostAddressResolve mHostCache.remove(host); } - @NonNull - @Override - public InetAddress[] resolve(@NonNull final String host) throws IOException { - return resolveInternal(host, host); - } @NonNull private InetAddress[] resolveInternal(String originalHost, String host) throws IOException { @@ -205,4 +200,13 @@ public class TwidereHostAddressResolver implements Constants, HostAddressResolve return InetAddressUtils.isIPv4Address(address) || InetAddressUtils.isIPv6Address(address); } + @Override + public InetAddress[] resolveInetAddresses(String host) throws UnknownHostException { + try { + return resolveInternal(host, host); + } catch (IOException e) { + if (e instanceof UnknownHostException) throw (UnknownHostException) e; + throw new UnknownHostException("Unable to resolve address " + e.getMessage()); + } + } } diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/net/TwidereHostResolverFactory.java b/twidere/src/main/java/org/mariotaku/twidere/util/net/TwidereHostResolverFactory.java deleted file mode 100644 index 7be4e0267..000000000 --- a/twidere/src/main/java/org/mariotaku/twidere/util/net/TwidereHostResolverFactory.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.mariotaku.twidere.util.net; - -import org.mariotaku.twidere.app.TwidereApplication; - -import twitter4j.http.HostAddressResolver; -import twitter4j.http.HostAddressResolverFactory; -import twitter4j.http.HttpClientConfiguration; - -public class TwidereHostResolverFactory implements HostAddressResolverFactory { - - private final TwidereApplication mApplication; - - public TwidereHostResolverFactory(final TwidereApplication application) { - mApplication = application; - } - - @Override - public HostAddressResolver getInstance(final HttpClientConfiguration conf) { - return mApplication.getHostAddressResolver(); - } - -} diff --git a/twidere/src/main/java/org/mariotaku/twidere/view/holder/StatusViewHolder.java b/twidere/src/main/java/org/mariotaku/twidere/view/holder/StatusViewHolder.java index 0efa126d2..c54870719 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/view/holder/StatusViewHolder.java +++ b/twidere/src/main/java/org/mariotaku/twidere/view/holder/StatusViewHolder.java @@ -41,7 +41,7 @@ import org.mariotaku.twidere.view.iface.IColorLabelView; import java.util.Locale; -import twitter4j.TranslationResult; +import org.mariotaku.twidere.api.twitter.model.TranslationResult; import static org.mariotaku.twidere.util.HtmlEscapeHelper.toPlainText; import static org.mariotaku.twidere.util.Utils.getUserTypeIconRes; diff --git a/twidere/src/main/res/xml/preferences_hidden.xml b/twidere/src/main/res/xml/preferences_hidden.xml index 5f3f9b20e..48bdae4da 100644 --- a/twidere/src/main/res/xml/preferences_hidden.xml +++ b/twidere/src/main/res/xml/preferences_hidden.xml @@ -1,43 +1,37 @@ - - + + android:title="@string/force_using_private_apis" /> + app:progressTextSuffix="s" /> - + android:title="@string/ignore_ssl_error" /> + android:title="@string/status_text_limit" /> + android:targetPackage="org.mariotaku.twidere" /> \ No newline at end of file