moved twitlonger extension to separate repo https://github.com/TwidereProject/Twidere-Android-Extension-TwitLonger/
fixed build warnings
|
@ -5,5 +5,4 @@ include ':twidere.wear'
|
||||||
include ':twidere.donate.nyanwp'
|
include ':twidere.donate.nyanwp'
|
||||||
include ':twidere.donate.nyanwp.wear'
|
include ':twidere.donate.nyanwp.wear'
|
||||||
include ':twidere.component.nyan'
|
include ':twidere.component.nyan'
|
||||||
include ':twidere.extension.twitlonger'
|
|
||||||
include ':twidere.extension.shortener.gist'
|
include ':twidere.extension.shortener.gist'
|
|
@ -24,7 +24,7 @@ import java.lang.reflect.Type;
|
||||||
/**
|
/**
|
||||||
* Created by mariotaku on 15/12/13.
|
* Created by mariotaku on 15/12/13.
|
||||||
*/
|
*/
|
||||||
public class ParameterizedTypeAccessor {
|
public class Twidere_ParameterizedTypeAccessor {
|
||||||
|
|
||||||
public static <T> ParameterizedType<T> create(Type type) {
|
public static <T> ParameterizedType<T> create(Type type) {
|
||||||
return new ParameterizedType.ConcreteParameterizedType<>(type);
|
return new ParameterizedType.ConcreteParameterizedType<>(type);
|
|
@ -2,11 +2,15 @@ package org.mariotaku.twidere.annotation;
|
||||||
|
|
||||||
import android.support.annotation.IntDef;
|
import android.support.annotation.IntDef;
|
||||||
|
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mariotaku on 16/1/8.
|
* Created by mariotaku on 16/1/8.
|
||||||
*/
|
*/
|
||||||
@IntDef({PreferenceType.BOOLEAN, PreferenceType.INT, PreferenceType.LONG, PreferenceType.FLOAT,
|
@IntDef({PreferenceType.BOOLEAN, PreferenceType.INT, PreferenceType.LONG, PreferenceType.FLOAT,
|
||||||
PreferenceType.STRING, PreferenceType.NULL, PreferenceType.INVALID})
|
PreferenceType.STRING, PreferenceType.NULL, PreferenceType.INVALID})
|
||||||
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
public @interface PreferenceType {
|
public @interface PreferenceType {
|
||||||
int BOOLEAN = 1, INT = 2, LONG = 3, FLOAT = 4, STRING = 5, NULL = 0, INVALID = -1;
|
int BOOLEAN = 1, INT = 2, LONG = 3, FLOAT = 4, STRING = 5, NULL = 0, INVALID = -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,8 @@ import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.StringDef;
|
import android.support.annotation.StringDef;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
@ -174,6 +176,7 @@ public class Activity extends TwitterResponseObject implements TwitterResponse,
|
||||||
Action.RETWEETED_RETWEET, Action.QUOTE, Action.RETWEETED_MENTION,
|
Action.RETWEETED_RETWEET, Action.QUOTE, Action.RETWEETED_MENTION,
|
||||||
Action.FAVORITED_MENTION, Action.JOINED_TWITTER, Action.MEDIA_TAGGED,
|
Action.FAVORITED_MENTION, Action.JOINED_TWITTER, Action.MEDIA_TAGGED,
|
||||||
Action.FAVORITED_MEDIA_TAGGED, Action.RETWEETED_MEDIA_TAGGED})
|
Action.FAVORITED_MEDIA_TAGGED, Action.RETWEETED_MEDIA_TAGGED})
|
||||||
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
public @interface Action {
|
public @interface Action {
|
||||||
String FAVORITE = "favorite";
|
String FAVORITE = "favorite";
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -5,6 +5,8 @@ import android.support.annotation.StringDef;
|
||||||
import com.bluelinelabs.logansquare.annotation.JsonField;
|
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||||
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||||
|
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -74,6 +76,7 @@ public class DMResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
@StringDef({DMResponse.Status.HAS_MORE, DMResponse.Status.AT_END})
|
@StringDef({DMResponse.Status.HAS_MORE, DMResponse.Status.AT_END})
|
||||||
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
public @interface Status {
|
public @interface Status {
|
||||||
String HAS_MORE = "HAS_MORE";
|
String HAS_MORE = "HAS_MORE";
|
||||||
String AT_END = "AT_END";
|
String AT_END = "AT_END";
|
||||||
|
|
|
@ -24,6 +24,9 @@ import android.support.annotation.StringDef;
|
||||||
import com.bluelinelabs.logansquare.annotation.JsonField;
|
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||||
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||||
|
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mariotaku on 15/7/8.
|
* Created by mariotaku on 15/7/8.
|
||||||
*/
|
*/
|
||||||
|
@ -84,9 +87,10 @@ public class ExtendedProfile {
|
||||||
}
|
}
|
||||||
|
|
||||||
@StringDef({Visibility.MUTUALFOLLOW, Visibility.PUBLIC})
|
@StringDef({Visibility.MUTUALFOLLOW, Visibility.PUBLIC})
|
||||||
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
public @interface Visibility {
|
public @interface Visibility {
|
||||||
String MUTUALFOLLOW = ("mutualfollow");
|
String MUTUALFOLLOW = "mutualfollow";
|
||||||
String PUBLIC = ("public");
|
String PUBLIC = "public";
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,9 +95,9 @@ public class ScheduledStatus {
|
||||||
}
|
}
|
||||||
|
|
||||||
@StringDef({State.SCHEDULED, State.FAILED, State.CANCELED})
|
@StringDef({State.SCHEDULED, State.FAILED, State.CANCELED})
|
||||||
@Retention(RetentionPolicy.CLASS)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
public @interface State {
|
public @interface State {
|
||||||
String SCHEDULED = ("scheduled"), FAILED = ("failed"), CANCELED = ("canceled");
|
String SCHEDULED = "scheduled", FAILED = "failed", CANCELED = "canceled";
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,20 +23,10 @@ import android.support.annotation.IntDef;
|
||||||
|
|
||||||
import org.mariotaku.restfu.http.HttpResponse;
|
import org.mariotaku.restfu.http.HttpResponse;
|
||||||
|
|
||||||
/**
|
import java.lang.annotation.Retention;
|
||||||
* Super interface of Twitter Response data interfaces which indicates that rate
|
import java.lang.annotation.RetentionPolicy;
|
||||||
* limit status is avaialble.
|
|
||||||
*
|
|
||||||
* @author Yusuke Yamamoto - yusuke at mac.com
|
|
||||||
* @see DirectMessage
|
|
||||||
* @see Status
|
|
||||||
* @see User
|
|
||||||
*/
|
|
||||||
public interface TwitterResponse {
|
public interface TwitterResponse {
|
||||||
int NONE = 0;
|
|
||||||
int READ = 1;
|
|
||||||
int READ_WRITE = 2;
|
|
||||||
int READ_WRITE_DIRECTMESSAGES = 3;
|
|
||||||
|
|
||||||
void processResponseHeader(HttpResponse resp);
|
void processResponseHeader(HttpResponse resp);
|
||||||
|
|
||||||
|
@ -45,8 +35,13 @@ public interface TwitterResponse {
|
||||||
|
|
||||||
RateLimitStatus getRateLimitStatus();
|
RateLimitStatus getRateLimitStatus();
|
||||||
|
|
||||||
@IntDef({NONE, READ, READ_WRITE, READ_WRITE_DIRECTMESSAGES})
|
@IntDef({AccessLevel.NONE, AccessLevel.READ, AccessLevel.READ_WRITE, AccessLevel.READ_WRITE_DIRECTMESSAGES})
|
||||||
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
@interface AccessLevel {
|
@interface AccessLevel {
|
||||||
|
|
||||||
|
int NONE = 0;
|
||||||
|
int READ = 1;
|
||||||
|
int READ_WRITE = 2;
|
||||||
|
int READ_WRITE_DIRECTMESSAGES = 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,8 @@ import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||||
|
|
||||||
import org.mariotaku.twidere.api.twitter.util.TwitterDateConverter;
|
import org.mariotaku.twidere.api.twitter.util.TwitterDateConverter;
|
||||||
|
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -148,6 +150,7 @@ public class UserList extends TwitterResponseObject implements Comparable<UserLi
|
||||||
}
|
}
|
||||||
|
|
||||||
@StringDef({Mode.PRIVATE, Mode.PUBLIC})
|
@StringDef({Mode.PRIVATE, Mode.PUBLIC})
|
||||||
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
public @interface Mode {
|
public @interface Mode {
|
||||||
String PUBLIC = "public";
|
String PUBLIC = "public";
|
||||||
String PRIVATE = "private";
|
String PRIVATE = "private";
|
||||||
|
|
|
@ -36,34 +36,34 @@ public final class InternalParseUtil {
|
||||||
|
|
||||||
@TwitterResponse.AccessLevel
|
@TwitterResponse.AccessLevel
|
||||||
public static int toAccessLevel(final HttpResponse res) {
|
public static int toAccessLevel(final HttpResponse res) {
|
||||||
if (res == null) return TwitterResponse.NONE;
|
if (res == null) return TwitterResponse.AccessLevel.NONE;
|
||||||
final String xAccessLevel = res.getHeader("X-Access-Level");
|
final String xAccessLevel = res.getHeader("X-Access-Level");
|
||||||
int accessLevel;
|
int accessLevel;
|
||||||
if (null == xAccessLevel) {
|
if (null == xAccessLevel) {
|
||||||
accessLevel = TwitterResponse.NONE;
|
accessLevel = TwitterResponse.AccessLevel.NONE;
|
||||||
} else {
|
} else {
|
||||||
// https://dev.twitter.com/pages/application-permission-model-faq#how-do-we-know-what-the-access-level-of-a-user-token-is
|
// https://dev.twitter.com/pages/application-permission-model-faq#how-do-we-know-what-the-access-level-of-a-user-token-is
|
||||||
switch (xAccessLevel.length()) {
|
switch (xAccessLevel.length()) {
|
||||||
// “read” (Read-only)
|
// “read” (Read-only)
|
||||||
case 4:
|
case 4:
|
||||||
accessLevel = TwitterResponse.READ;
|
accessLevel = TwitterResponse.AccessLevel.READ;
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
// “read-write” (Read & Write)
|
// “read-write” (Read & Write)
|
||||||
accessLevel = TwitterResponse.READ_WRITE;
|
accessLevel = TwitterResponse.AccessLevel.READ_WRITE;
|
||||||
break;
|
break;
|
||||||
case 25:
|
case 25:
|
||||||
// “read-write-directmessages” (Read, Write, & Direct
|
// “read-write-directmessages” (Read, Write, & Direct
|
||||||
// Message)
|
// Message)
|
||||||
accessLevel = TwitterResponse.READ_WRITE_DIRECTMESSAGES;
|
accessLevel = TwitterResponse.AccessLevel.READ_WRITE_DIRECTMESSAGES;
|
||||||
break;
|
break;
|
||||||
case 26:
|
case 26:
|
||||||
// “read-write-privatemessages” (Read, Write, & Direct
|
// “read-write-privatemessages” (Read, Write, & Direct
|
||||||
// Message)
|
// Message)
|
||||||
accessLevel = TwitterResponse.READ_WRITE_DIRECTMESSAGES;
|
accessLevel = TwitterResponse.AccessLevel.READ_WRITE_DIRECTMESSAGES;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
accessLevel = TwitterResponse.NONE;
|
accessLevel = TwitterResponse.AccessLevel.NONE;
|
||||||
// unknown access level;
|
// unknown access level;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,9 +30,9 @@ import com.hannesdorfmann.parcelableplease.annotation.ParcelableThisPlease;
|
||||||
import org.mariotaku.library.objectcursor.annotation.CursorField;
|
import org.mariotaku.library.objectcursor.annotation.CursorField;
|
||||||
import org.mariotaku.library.objectcursor.annotation.CursorObject;
|
import org.mariotaku.library.objectcursor.annotation.CursorObject;
|
||||||
import org.mariotaku.twidere.model.draft.ActionExtra;
|
import org.mariotaku.twidere.model.draft.ActionExtra;
|
||||||
import org.mariotaku.twidere.model.util.UserKeysCursorFieldConverter;
|
|
||||||
import org.mariotaku.twidere.model.util.DraftExtrasConverter;
|
import org.mariotaku.twidere.model.util.DraftExtrasConverter;
|
||||||
import org.mariotaku.twidere.model.util.LoganSquareCursorFieldConverter;
|
import org.mariotaku.twidere.model.util.LoganSquareCursorFieldConverter;
|
||||||
|
import org.mariotaku.twidere.model.util.UserKeysCursorFieldConverter;
|
||||||
import org.mariotaku.twidere.provider.TwidereDataStore.Drafts;
|
import org.mariotaku.twidere.provider.TwidereDataStore.Drafts;
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
|
@ -97,7 +97,7 @@ public class Draft implements Parcelable {
|
||||||
};
|
};
|
||||||
|
|
||||||
@StringDef({Action.UPDATE_STATUS, Action.REPLY, Action.QUOTE, Action.SEND_DIRECT_MESSAGE})
|
@StringDef({Action.UPDATE_STATUS, Action.REPLY, Action.QUOTE, Action.SEND_DIRECT_MESSAGE})
|
||||||
@Retention(RetentionPolicy.CLASS)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
public @interface Action {
|
public @interface Action {
|
||||||
|
|
||||||
String UPDATE_STATUS = "update_status";
|
String UPDATE_STATUS = "update_status";
|
||||||
|
|
|
@ -38,6 +38,9 @@ import org.mariotaku.twidere.model.util.UserKeyConverter;
|
||||||
import org.mariotaku.twidere.model.util.UserKeyCursorFieldConverter;
|
import org.mariotaku.twidere.model.util.UserKeyCursorFieldConverter;
|
||||||
import org.mariotaku.twidere.provider.TwidereDataStore.Accounts;
|
import org.mariotaku.twidere.provider.TwidereDataStore.Accounts;
|
||||||
|
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
|
||||||
@CursorObject(valuesCreator = true)
|
@CursorObject(valuesCreator = true)
|
||||||
@ParcelablePlease(allFields = false)
|
@ParcelablePlease(allFields = false)
|
||||||
@JsonObject
|
@JsonObject
|
||||||
|
@ -173,8 +176,8 @@ public class ParcelableAccount implements Parcelable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@StringDef({Type.TWITTER, Type.STATUSNET, Type.FANFOU})
|
@StringDef({Type.TWITTER, Type.STATUSNET, Type.FANFOU})
|
||||||
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
public @interface Type {
|
public @interface Type {
|
||||||
|
|
||||||
String TWITTER = "twitter";
|
String TWITTER = "twitter";
|
||||||
String STATUSNET = "statusnet";
|
String STATUSNET = "statusnet";
|
||||||
String FANFOU = "fanfou";
|
String FANFOU = "fanfou";
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
package org.mariotaku.twidere.model;
|
||||||
|
|
||||||
|
import org.mariotaku.library.objectcursor.annotation.CursorField;
|
||||||
|
import org.mariotaku.library.objectcursor.annotation.CursorObject;
|
||||||
|
import org.mariotaku.twidere.model.util.UserKeyCursorFieldConverter;
|
||||||
|
import org.mariotaku.twidere.provider.TwidereDataStore.Messages.Entries;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by mariotaku on 16/3/28.
|
||||||
|
*/
|
||||||
|
@CursorObject
|
||||||
|
public class ParcelableMessageEntry {
|
||||||
|
|
||||||
|
@CursorField(value = Entries._ID, excludeWrite = true)
|
||||||
|
public long id;
|
||||||
|
@CursorField(value = Entries.ACCOUNT_KEY, converter = UserKeyCursorFieldConverter.class)
|
||||||
|
public UserKey account_key;
|
||||||
|
@CursorField(value = Entries.CONVERSATION_ID)
|
||||||
|
public String conversation_id;
|
||||||
|
@CursorField(value = Entries.UPDATED_AT)
|
||||||
|
public long updated_at;
|
||||||
|
@CursorField(value = Entries.TEXT_CONTENT)
|
||||||
|
public String text_content;
|
||||||
|
|
||||||
|
}
|
|
@ -377,6 +377,15 @@ public interface TwidereDataStore {
|
||||||
String[] COLUMNS = {_ID, NAME, PATH};
|
String[] COLUMNS = {_ID, NAME, PATH};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface Messages extends BaseColumns, InsertedDateColumns, AccountSupportColumns {
|
||||||
|
|
||||||
|
interface Entries extends BaseColumns, InsertedDateColumns, AccountSupportColumns {
|
||||||
|
String CONVERSATION_ID = "conversation_id";
|
||||||
|
String UPDATED_AT = "updated_at";
|
||||||
|
String TEXT_CONTENT = "text_content";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
interface DirectMessages extends BaseColumns, InsertedDateColumns, AccountSupportColumns {
|
interface DirectMessages extends BaseColumns, InsertedDateColumns, AccountSupportColumns {
|
||||||
|
|
||||||
String TABLE_NAME = "messages";
|
String TABLE_NAME = "messages";
|
||||||
|
|
|
@ -3,7 +3,7 @@ package org.mariotaku.twidere.util;
|
||||||
import com.bluelinelabs.logansquare.JsonMapper;
|
import com.bluelinelabs.logansquare.JsonMapper;
|
||||||
import com.bluelinelabs.logansquare.LoganSquare;
|
import com.bluelinelabs.logansquare.LoganSquare;
|
||||||
import com.bluelinelabs.logansquare.ParameterizedType;
|
import com.bluelinelabs.logansquare.ParameterizedType;
|
||||||
import com.bluelinelabs.logansquare.ParameterizedTypeAccessor;
|
import com.bluelinelabs.logansquare.Twidere_ParameterizedTypeAccessor;
|
||||||
|
|
||||||
import org.mariotaku.twidere.common.BuildConfig;
|
import org.mariotaku.twidere.common.BuildConfig;
|
||||||
|
|
||||||
|
@ -24,11 +24,11 @@ public class LoganSquareMapperFinder {
|
||||||
private static final ExecutorService pool = Executors.newSingleThreadExecutor();
|
private static final ExecutorService pool = Executors.newSingleThreadExecutor();
|
||||||
|
|
||||||
public static <T> JsonMapper<T> mapperFor(Class<T> cls) throws ClassLoaderDeadLockException {
|
public static <T> JsonMapper<T> mapperFor(Class<T> cls) throws ClassLoaderDeadLockException {
|
||||||
return mapperFor(ParameterizedTypeAccessor.<T>create(cls));
|
return mapperFor(Twidere_ParameterizedTypeAccessor.<T>create(cls));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> JsonMapper<T> mapperFor(Type type) throws ClassLoaderDeadLockException {
|
public static <T> JsonMapper<T> mapperFor(Type type) throws ClassLoaderDeadLockException {
|
||||||
return mapperFor(ParameterizedTypeAccessor.<T>create(type));
|
return mapperFor(Twidere_ParameterizedTypeAccessor.<T>create(type));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> JsonMapper<T> mapperFor(final ParameterizedType<T> type) throws ClassLoaderDeadLockException {
|
public static <T> JsonMapper<T> mapperFor(final ParameterizedType<T> type) throws ClassLoaderDeadLockException {
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
/build
|
|
|
@ -1,44 +0,0 @@
|
||||||
/*
|
|
||||||
* Twidere - Twitter client for Android
|
|
||||||
*
|
|
||||||
* Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
apply plugin: 'com.android.application'
|
|
||||||
apply plugin: 'com.neenbedankt.android-apt'
|
|
||||||
|
|
||||||
android {
|
|
||||||
defaultConfig {
|
|
||||||
applicationId "org.mariotaku.twidere.extension.twitlonger"
|
|
||||||
minSdkVersion 14
|
|
||||||
targetSdkVersion 23
|
|
||||||
versionCode 7
|
|
||||||
versionName "1.6"
|
|
||||||
}
|
|
||||||
buildTypes {
|
|
||||||
release {
|
|
||||||
minifyEnabled false
|
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
apt 'com.bluelinelabs:logansquare-compiler:1.3.7'
|
|
||||||
compile 'com.github.mariotaku.RestFu:urlconnection:0.9.25'
|
|
||||||
compile project(':twidere.library.extension')
|
|
||||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
|
||||||
}
|
|
Before Width: | Height: | Size: 127 KiB |
|
@ -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 *;
|
|
||||||
#}
|
|
|
@ -1,32 +0,0 @@
|
||||||
/*
|
|
||||||
* Twidere - Twitter client for Android
|
|
||||||
*
|
|
||||||
* Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.mariotaku.extension.twitlonger;
|
|
||||||
|
|
||||||
import android.app.Application;
|
|
||||||
import android.test.ApplicationTestCase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
|
|
||||||
*/
|
|
||||||
public class ApplicationTest extends ApplicationTestCase<Application> {
|
|
||||||
public ApplicationTest() {
|
|
||||||
super(Application.class);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,89 +0,0 @@
|
||||||
<manifest
|
|
||||||
package="org.mariotaku.twidere.extension.twitlonger"
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET"/>
|
|
||||||
|
|
||||||
<application
|
|
||||||
android:allowBackup="false"
|
|
||||||
android:description="@string/description"
|
|
||||||
android:icon="@drawable/ic_launcher"
|
|
||||||
android:label="@string/app_name"
|
|
||||||
android:theme="@style/Theme">
|
|
||||||
<meta-data
|
|
||||||
android:name="org.mariotaku.twidere.extension"
|
|
||||||
android:value="true"/>
|
|
||||||
|
|
||||||
<meta-data
|
|
||||||
android:name="org.mariotaku.twidere.extension.permissions"
|
|
||||||
android:value="accounts"/>
|
|
||||||
|
|
||||||
<activity
|
|
||||||
android:name=".TwitLongerReaderActivity"
|
|
||||||
android:label="@string/extension_reader_name">
|
|
||||||
<meta-data
|
|
||||||
android:name="org.mariotaku.twidere.extension"
|
|
||||||
android:value="true"/>
|
|
||||||
<meta-data
|
|
||||||
android:name="org.mariotaku.twidere.extension.icon"
|
|
||||||
android:resource="@drawable/ic_extension_twitlonger"/>
|
|
||||||
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="org.mariotaku.twidere.EXTENSION_OPEN_STATUS"/>
|
|
||||||
|
|
||||||
<category android:name="android.intent.category.DEFAULT"/>
|
|
||||||
</intent-filter>
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.VIEW"/>
|
|
||||||
|
|
||||||
<category android:name="android.intent.category.DEFAULT"/>
|
|
||||||
<category android:name="android.intent.category.BROWSEABLE"/>
|
|
||||||
|
|
||||||
<data
|
|
||||||
android:host="tl.gd"
|
|
||||||
android:pathPattern=".*"
|
|
||||||
android:scheme="http"/>
|
|
||||||
<data
|
|
||||||
android:host="tl.gd"
|
|
||||||
android:pathPattern=".*"
|
|
||||||
android:scheme="https"/>
|
|
||||||
<data
|
|
||||||
android:host="www.twitlonger.com"
|
|
||||||
android:pathPattern="show/.*"
|
|
||||||
android:scheme="http"/>
|
|
||||||
<data
|
|
||||||
android:host="www.twitlonger.com"
|
|
||||||
android:pathPattern="show/.*"
|
|
||||||
android:scheme="https"/>
|
|
||||||
</intent-filter>
|
|
||||||
</activity>
|
|
||||||
<activity
|
|
||||||
android:name=".RequestPermissionActivity"
|
|
||||||
android:theme="@style/Theme.NoDisplay"/>
|
|
||||||
<activity
|
|
||||||
android:name=".AboutActivity"
|
|
||||||
android:label="@string/about">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="org.mariotaku.twidere.EXTENSION_SETTINGS"/>
|
|
||||||
|
|
||||||
<category android:name="android.intent.category.DEFAULT"/>
|
|
||||||
</intent-filter>
|
|
||||||
</activity>
|
|
||||||
|
|
||||||
<service
|
|
||||||
android:name=".TwitLongerStatusShortenerService"
|
|
||||||
android:permission="org.mariotaku.twidere.permission.SHORTEN_STATUS">
|
|
||||||
|
|
||||||
<meta-data
|
|
||||||
android:name="org.mariotaku.twidere.extension.version.status_shortener"
|
|
||||||
android:value="@string/status_shortener_service_interface_version"/>
|
|
||||||
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="org.mariotaku.twidere.EXTENSION_SHORTEN_STATUS"/>
|
|
||||||
|
|
||||||
<category android:name="android.intent.category.DEFAULT"/>
|
|
||||||
</intent-filter>
|
|
||||||
</service>
|
|
||||||
</application>
|
|
||||||
|
|
||||||
</manifest>
|
|
|
@ -1,24 +0,0 @@
|
||||||
/*
|
|
||||||
* Twidere - Twitter client for Android
|
|
||||||
*
|
|
||||||
* Copyright (C) 2012 Mariotaku Lee <mariotaku.lee@gmail.com>
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.mariotaku.twidere;
|
|
||||||
|
|
||||||
interface ITweetShortener {
|
|
||||||
String shorten(String text, String screen_name, long in_reply_to_status_id);
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
package org.mariotaku.twidere.extension.twitlonger;
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.preference.PreferenceActivity;
|
|
||||||
|
|
||||||
public class AboutActivity extends PreferenceActivity {
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
addPreferencesFromResource(R.xml.about);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
package org.mariotaku.twidere.extension.twitlonger;
|
|
||||||
|
|
||||||
import org.mariotaku.twidere.TwidereConstants;
|
|
||||||
|
|
||||||
public interface Constants extends TwidereConstants{
|
|
||||||
|
|
||||||
String TWITLONGER_API_KEY = "feOj9pqqqUR0Q9TON29qyQ6tQhW1jU4p";
|
|
||||||
}
|
|
|
@ -1,108 +0,0 @@
|
||||||
/*
|
|
||||||
* Twidere - Twitter client for Android
|
|
||||||
*
|
|
||||||
* Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.mariotaku.twidere.extension.twitlonger;
|
|
||||||
|
|
||||||
import android.support.annotation.NonNull;
|
|
||||||
|
|
||||||
import com.bluelinelabs.logansquare.JsonMapper;
|
|
||||||
import com.fasterxml.jackson.core.JsonParseException;
|
|
||||||
|
|
||||||
import org.mariotaku.restfu.RestConverter;
|
|
||||||
import org.mariotaku.restfu.http.HttpResponse;
|
|
||||||
import org.mariotaku.restfu.http.mime.Body;
|
|
||||||
import org.mariotaku.twidere.util.LoganSquareMapperFinder;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.lang.reflect.Type;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/5/5.
|
|
||||||
*/
|
|
||||||
public class LoganSquareConverterFactory extends RestConverter.SimpleFactory<TwitLongerException> {
|
|
||||||
|
|
||||||
private static Map<Type, RestConverter<HttpResponse, ?, TwitLongerException>> sResponseConverters = new HashMap<>();
|
|
||||||
private static Map<Type, RestConverter<?, Body, TwitLongerException>> sBodyConverters = new HashMap<>();
|
|
||||||
|
|
||||||
|
|
||||||
static {
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
private static Object parseOrThrow(Body body, JsonMapper<?> mapper)
|
|
||||||
throws IOException, TwitLongerException, RestConverter.ConvertException {
|
|
||||||
try {
|
|
||||||
final Object parsed = mapper.parse(body.stream());
|
|
||||||
if (parsed == null) {
|
|
||||||
throw new TwitLongerException("Empty data");
|
|
||||||
}
|
|
||||||
return parsed;
|
|
||||||
} catch (JsonParseException e) {
|
|
||||||
throw new RestConverter.ConvertException("Malformed JSON Data");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public RestConverter<HttpResponse, ?, TwitLongerException> forResponse(Type type) throws RestConverter.ConvertException {
|
|
||||||
RestConverter<HttpResponse, ?, TwitLongerException> converter = sResponseConverters.get(type);
|
|
||||||
if (converter != null) {
|
|
||||||
return converter;
|
|
||||||
}
|
|
||||||
final JsonMapper<?> mapper;
|
|
||||||
try {
|
|
||||||
mapper = LoganSquareMapperFinder.mapperFor(type);
|
|
||||||
} catch (LoganSquareMapperFinder.ClassLoaderDeadLockException e) {
|
|
||||||
throw new RestConverter.ConvertException(e);
|
|
||||||
}
|
|
||||||
return new LoganSquareResponseConverter(mapper);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public RestConverter<?, Body, TwitLongerException> forRequest(Type type) throws RestConverter.ConvertException {
|
|
||||||
final RestConverter<?, Body, TwitLongerException> converter = sBodyConverters.get(type);
|
|
||||||
if (converter != null) {
|
|
||||||
return converter;
|
|
||||||
}
|
|
||||||
return super.forRequest(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class UnsupportedTypeException extends UnsupportedOperationException {
|
|
||||||
public UnsupportedTypeException(Type type) {
|
|
||||||
super("Unsupported type " + type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class LoganSquareResponseConverter implements RestConverter<HttpResponse, Object, TwitLongerException> {
|
|
||||||
private final JsonMapper<?> mapper;
|
|
||||||
|
|
||||||
public LoganSquareResponseConverter(JsonMapper<?> mapper) {
|
|
||||||
this.mapper = mapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object convert(HttpResponse httpResponse) throws IOException, ConvertException, TwitLongerException {
|
|
||||||
final Body body = httpResponse.getBody();
|
|
||||||
final Object object = parseOrThrow(body, mapper);
|
|
||||||
return object;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
package org.mariotaku.twidere.extension.twitlonger;
|
|
||||||
|
|
||||||
import org.mariotaku.restfu.http.SimpleValueMap;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 16/2/20.
|
|
||||||
*/
|
|
||||||
public class NewPost extends SimpleValueMap {
|
|
||||||
|
|
||||||
public NewPost(String content) {
|
|
||||||
put("content", content);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setInReplyTo(long inReplyToId, String inReplyToScreenName) {
|
|
||||||
put("reply_to_id", inReplyToId);
|
|
||||||
put("reply_to_screen_name", inReplyToScreenName);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,29 +0,0 @@
|
||||||
|
|
||||||
package org.mariotaku.twidere.extension.twitlonger;
|
|
||||||
|
|
||||||
import com.bluelinelabs.logansquare.annotation.JsonField;
|
|
||||||
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
|
||||||
|
|
||||||
@JsonObject
|
|
||||||
public class Post {
|
|
||||||
|
|
||||||
@JsonField(name = "post_time")
|
|
||||||
public String postTime;
|
|
||||||
@JsonField(name = "reply_to_id")
|
|
||||||
public long replyToId;
|
|
||||||
@JsonField(name = "short_url")
|
|
||||||
public String shortUrl;
|
|
||||||
@JsonField(name = "screen_name")
|
|
||||||
public String screenName;
|
|
||||||
@JsonField(name = "full_url")
|
|
||||||
public String fullUrl;
|
|
||||||
@JsonField(name = "id")
|
|
||||||
public String id;
|
|
||||||
@JsonField(name = "twitter_status_id")
|
|
||||||
public Object twitterStatusId;
|
|
||||||
@JsonField(name = "tweet_content")
|
|
||||||
public String tweetContent;
|
|
||||||
@JsonField(name = "content")
|
|
||||||
public String content;
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,31 +0,0 @@
|
||||||
package org.mariotaku.twidere.extension.twitlonger;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Bundle;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 16/2/20.
|
|
||||||
*/
|
|
||||||
public class RequestPermissionActivity extends Activity implements Constants {
|
|
||||||
private static final int REQUEST_REQUEST_PERMISSION = 1;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
||||||
switch (requestCode) {
|
|
||||||
case REQUEST_REQUEST_PERMISSION: {
|
|
||||||
finish();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
final Intent intent = new Intent(INTENT_ACTION_REQUEST_PERMISSIONS);
|
|
||||||
intent.setPackage(TWIDERE_PACKAGE_NAME);
|
|
||||||
startActivityForResult(intent, REQUEST_REQUEST_PERMISSION);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,37 +0,0 @@
|
||||||
package org.mariotaku.twidere.extension.twitlonger;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 16/2/20.
|
|
||||||
*/
|
|
||||||
public class TaskResponse<O, T extends Throwable> {
|
|
||||||
O object;
|
|
||||||
T throwable;
|
|
||||||
|
|
||||||
public TaskResponse(T throwable) {
|
|
||||||
this.throwable = throwable;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TaskResponse(O object) {
|
|
||||||
this.object = object;
|
|
||||||
}
|
|
||||||
|
|
||||||
public O getObject() {
|
|
||||||
return object;
|
|
||||||
}
|
|
||||||
|
|
||||||
public T getThrowable() {
|
|
||||||
return throwable;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static <O, T extends Throwable> TaskResponse<O, T> getInstance(O post) {
|
|
||||||
return new TaskResponse<>(post);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static <O, T extends Throwable> TaskResponse<O, T> getInstance(T throwable) {
|
|
||||||
return new TaskResponse<>(throwable);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasError() {
|
|
||||||
return throwable != null;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,33 +0,0 @@
|
||||||
package org.mariotaku.twidere.extension.twitlonger;
|
|
||||||
|
|
||||||
import org.mariotaku.restfu.annotation.method.GET;
|
|
||||||
import org.mariotaku.restfu.annotation.method.POST;
|
|
||||||
import org.mariotaku.restfu.annotation.method.PUT;
|
|
||||||
import org.mariotaku.restfu.annotation.param.Headers;
|
|
||||||
import org.mariotaku.restfu.annotation.param.KeyValue;
|
|
||||||
import org.mariotaku.restfu.annotation.param.Param;
|
|
||||||
import org.mariotaku.restfu.annotation.param.Path;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 16/2/20.
|
|
||||||
*/
|
|
||||||
@Headers({@KeyValue(key = "X-API-KEY", valueKey = "tl_api_key")})
|
|
||||||
public interface TwitLonger {
|
|
||||||
|
|
||||||
@GET("/2/posts/{post_id}")
|
|
||||||
Post getPost(@Path("post_id") String postId) throws TwitLongerException;
|
|
||||||
|
|
||||||
@POST("/2/posts")
|
|
||||||
@Headers({@KeyValue(key = "X-API-KEY", valueKey = "tl_api_key"),
|
|
||||||
@KeyValue(key = "X-Auth-Service-Provider", value = "https://api.twitter.com/1.1/account/verify_credentials.json"),
|
|
||||||
@KeyValue(key = "X-Verify-Credentials-Authorization", valueKey = "oauth_echo_authorization")})
|
|
||||||
Post createPost(@Param NewPost newPost) throws TwitLongerException;
|
|
||||||
|
|
||||||
@PUT("/2/posts/{post_id}")
|
|
||||||
@Headers({@KeyValue(key = "X-API-KEY", valueKey = "tl_api_key"),
|
|
||||||
@KeyValue(key = "X-Auth-Service-Provider", value = "https://api.twitter.com/1.1/account/verify_credentials.json"),
|
|
||||||
@KeyValue(key = "X-Verify-Credentials-Authorization", valueKey = "oauth_echo_authorization")})
|
|
||||||
Post updatePost(@Path("post_id") String postId, @Param("twitter_status_id") long twitterStatusId)
|
|
||||||
throws TwitLongerException;
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,45 +0,0 @@
|
||||||
package org.mariotaku.twidere.extension.twitlonger;
|
|
||||||
|
|
||||||
import org.mariotaku.restfu.http.HttpRequest;
|
|
||||||
import org.mariotaku.restfu.http.HttpResponse;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 16/2/20.
|
|
||||||
*/
|
|
||||||
public class TwitLongerException extends Exception {
|
|
||||||
|
|
||||||
private HttpRequest request;
|
|
||||||
private HttpResponse response;
|
|
||||||
|
|
||||||
public TwitLongerException() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
public TwitLongerException(String detailMessage) {
|
|
||||||
super(detailMessage);
|
|
||||||
}
|
|
||||||
|
|
||||||
public TwitLongerException(String detailMessage, Throwable throwable) {
|
|
||||||
super(detailMessage, throwable);
|
|
||||||
}
|
|
||||||
|
|
||||||
public TwitLongerException(Throwable throwable) {
|
|
||||||
super(throwable);
|
|
||||||
}
|
|
||||||
|
|
||||||
public HttpRequest getRequest() {
|
|
||||||
return request;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRequest(HttpRequest request) {
|
|
||||||
this.request = request;
|
|
||||||
}
|
|
||||||
|
|
||||||
public HttpResponse getResponse() {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setResponse(HttpResponse response) {
|
|
||||||
this.response = response;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,105 +0,0 @@
|
||||||
package org.mariotaku.twidere.extension.twitlonger;
|
|
||||||
|
|
||||||
import android.support.annotation.Nullable;
|
|
||||||
|
|
||||||
import org.mariotaku.restfu.ExceptionFactory;
|
|
||||||
import org.mariotaku.restfu.RestAPIFactory;
|
|
||||||
import org.mariotaku.restfu.RestRequest;
|
|
||||||
import org.mariotaku.restfu.annotation.method.GET;
|
|
||||||
import org.mariotaku.restfu.http.Endpoint;
|
|
||||||
import org.mariotaku.restfu.http.HttpRequest;
|
|
||||||
import org.mariotaku.restfu.http.HttpResponse;
|
|
||||||
import org.mariotaku.restfu.http.ValueMap;
|
|
||||||
import org.mariotaku.restfu.urlconnection.URLConnectionRestClient;
|
|
||||||
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.model.ParcelableCredentials;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 16/2/20.
|
|
||||||
*/
|
|
||||||
public class TwitLongerFactory {
|
|
||||||
|
|
||||||
public static TwitLonger getInstance(final String apiKey, @Nullable final ParcelableCredentials credentials) {
|
|
||||||
final RestAPIFactory<TwitLongerException> factory = new RestAPIFactory<>();
|
|
||||||
factory.setEndpoint(new Endpoint("http://api.twitlonger.com/"));
|
|
||||||
factory.setHttpClient(new URLConnectionRestClient());
|
|
||||||
factory.setConstantPool(new TwitLongerConstantPool(apiKey, credentials));
|
|
||||||
factory.setExceptionFactory(new TwitLongerExceptionFactory());
|
|
||||||
factory.setRestConverterFactory(new LoganSquareConverterFactory());
|
|
||||||
return factory.build(TwitLonger.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class TwitLongerConstantPool implements ValueMap {
|
|
||||||
private final String mApiKey;
|
|
||||||
private final OAuthAuthorization mAuthorization;
|
|
||||||
private final OAuthEndpoint mEndpoint;
|
|
||||||
private final RestRequest mRequest;
|
|
||||||
|
|
||||||
public TwitLongerConstantPool(String apiKey, @Nullable ParcelableCredentials credentials) {
|
|
||||||
mApiKey = apiKey;
|
|
||||||
if (credentials != null) {
|
|
||||||
final OAuthToken accessToken = new OAuthToken(credentials.oauth_token,
|
|
||||||
credentials.oauth_token_secret);
|
|
||||||
mAuthorization = new OAuthAuthorization(credentials.consumer_key,
|
|
||||||
credentials.consumer_secret, accessToken);
|
|
||||||
mEndpoint = new OAuthEndpoint("https://api.twitter.com/1.1/");
|
|
||||||
mRequest = new RestRequest(GET.METHOD, false, "/account/verify_credentials.json", null,
|
|
||||||
null, null, null, null, null);
|
|
||||||
} else {
|
|
||||||
mAuthorization = null;
|
|
||||||
mEndpoint = null;
|
|
||||||
mRequest = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean has(String key) {
|
|
||||||
switch (key) {
|
|
||||||
case "tl_api_key":
|
|
||||||
return true;
|
|
||||||
case "oauth_echo_authorization":
|
|
||||||
return mAuthorization != null;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object get(String key) {
|
|
||||||
switch (key) {
|
|
||||||
case "tl_api_key": {
|
|
||||||
return mApiKey;
|
|
||||||
}
|
|
||||||
case "oauth_echo_authorization": {
|
|
||||||
if (mAuthorization != null) {
|
|
||||||
return mAuthorization.getHeader(mEndpoint, mRequest);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String[] keys() {
|
|
||||||
if (mAuthorization == null) return new String[]{"oauth_echo_authorization"};
|
|
||||||
return new String[]{"tl_api_key", "oauth_echo_authorization"};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class TwitLongerExceptionFactory implements ExceptionFactory<TwitLongerException> {
|
|
||||||
@Override
|
|
||||||
public TwitLongerException newException(Throwable throwable, HttpRequest httpRequest, HttpResponse httpResponse) {
|
|
||||||
TwitLongerException exception;
|
|
||||||
if (throwable != null) {
|
|
||||||
exception = new TwitLongerException(throwable);
|
|
||||||
} else {
|
|
||||||
exception = new TwitLongerException();
|
|
||||||
}
|
|
||||||
exception.setRequest(httpRequest);
|
|
||||||
exception.setResponse(httpResponse);
|
|
||||||
return exception;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,175 +0,0 @@
|
||||||
package org.mariotaku.twidere.extension.twitlonger;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.AsyncTask;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.View.OnClickListener;
|
|
||||||
import android.view.Window;
|
|
||||||
import android.widget.ImageButton;
|
|
||||||
import android.widget.ProgressBar;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import org.mariotaku.twidere.Twidere;
|
|
||||||
import org.mariotaku.twidere.model.ParcelableStatus;
|
|
||||||
import org.mariotaku.twidere.model.SpanItem;
|
|
||||||
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
public class TwitLongerReaderActivity extends Activity implements Constants, OnClickListener {
|
|
||||||
|
|
||||||
private TextView mPreview;
|
|
||||||
private ImageButton mActionButton;
|
|
||||||
private ProgressBar mProgress;
|
|
||||||
private String mResult, mUser;
|
|
||||||
private ParcelableStatus mStatus;
|
|
||||||
private TwitLongerReaderTask mTwitLongerPostTask;
|
|
||||||
private static final Pattern PATTERN_TWITLONGER = Pattern.compile(
|
|
||||||
"((tl\\.gd|www.twitlonger.com/show)/([\\w\\d]+))", Pattern.CASE_INSENSITIVE);
|
|
||||||
private static final int GROUP_TWITLONGER_ID = 3;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(final View view) {
|
|
||||||
switch (view.getId()) {
|
|
||||||
case R.id.action: {
|
|
||||||
if (mResult == null) {
|
|
||||||
if (mStatus == null) return;
|
|
||||||
if (mTwitLongerPostTask != null) {
|
|
||||||
mTwitLongerPostTask.cancel(true);
|
|
||||||
}
|
|
||||||
if (mStatus.spans != null) {
|
|
||||||
for (SpanItem span : mStatus.spans) {
|
|
||||||
final Matcher m = PATTERN_TWITLONGER.matcher(span.link);
|
|
||||||
if (m.find()) {
|
|
||||||
mTwitLongerPostTask = new TwitLongerReaderTask(this);
|
|
||||||
mTwitLongerPostTask.execute(m.group(GROUP_TWITLONGER_ID));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (mUser == null) return;
|
|
||||||
final Intent intent = new Intent(Intent.ACTION_SEND);
|
|
||||||
intent.setType("text/plain");
|
|
||||||
intent.putExtra(Intent.EXTRA_TEXT, "@" + mUser + ": " + mResult);
|
|
||||||
startActivity(Intent.createChooser(intent, getString(R.string.share)));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(final Bundle savedInstanceState) {
|
|
||||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
final Intent intent = getIntent();
|
|
||||||
final Uri data = intent.getData();
|
|
||||||
final String action = intent.getAction();
|
|
||||||
setContentView(R.layout.main);
|
|
||||||
mPreview = (TextView) findViewById(R.id.text);
|
|
||||||
mActionButton = (ImageButton) findViewById(R.id.action);
|
|
||||||
mProgress = (ProgressBar) findViewById(R.id.progress);
|
|
||||||
mResult = savedInstanceState != null ? savedInstanceState.getString(Twidere.EXTRA_TEXT) : null;
|
|
||||||
mUser = savedInstanceState != null ? savedInstanceState.getString(Twidere.EXTRA_USER) : null;
|
|
||||||
if (mResult == null || mUser == null) {
|
|
||||||
if (Twidere.INTENT_ACTION_EXTENSION_OPEN_STATUS.equals(action)) {
|
|
||||||
mStatus = Twidere.getStatusFromIntent(getIntent());
|
|
||||||
if (mStatus == null || mStatus.spans == null) {
|
|
||||||
finish();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
mUser = mStatus.user_screen_name;
|
|
||||||
mPreview.setText(mStatus.text_unescaped);
|
|
||||||
mActionButton.setEnabled(false);
|
|
||||||
for (SpanItem span : mStatus.spans) {
|
|
||||||
final Matcher m = PATTERN_TWITLONGER.matcher(span.link);
|
|
||||||
if (m.find()) {
|
|
||||||
mActionButton.setEnabled(true);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (Intent.ACTION_VIEW.equals(action) && data != null) {
|
|
||||||
mPreview.setText(data.toString());
|
|
||||||
final Matcher m = PATTERN_TWITLONGER.matcher(data.toString());
|
|
||||||
if (m.find()) {
|
|
||||||
if (mTwitLongerPostTask != null) {
|
|
||||||
mTwitLongerPostTask.cancel(true);
|
|
||||||
}
|
|
||||||
mTwitLongerPostTask = new TwitLongerReaderTask(this);
|
|
||||||
mTwitLongerPostTask.execute(m.group(GROUP_TWITLONGER_ID));
|
|
||||||
} else {
|
|
||||||
finish();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
mPreview.setText(mResult);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onSaveInstanceState(final Bundle outState) {
|
|
||||||
outState.putString(Twidere.EXTRA_TEXT, mResult);
|
|
||||||
outState.putString(Twidere.EXTRA_USER, mUser);
|
|
||||||
super.onSaveInstanceState(outState);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class TwitLongerReaderTask extends AsyncTask<String, Object, TaskResponse<Post, TwitLongerException>> {
|
|
||||||
|
|
||||||
private final TwitLongerReaderActivity activity;
|
|
||||||
|
|
||||||
public TwitLongerReaderTask(TwitLongerReaderActivity activity) {
|
|
||||||
this.activity = activity;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected TaskResponse<Post, TwitLongerException> doInBackground(final String... args) {
|
|
||||||
final TwitLonger tl = TwitLongerFactory.getInstance(TWITLONGER_API_KEY, null);
|
|
||||||
try {
|
|
||||||
return TaskResponse.getInstance(tl.getPost(args[0]));
|
|
||||||
} catch (final TwitLongerException e) {
|
|
||||||
return TaskResponse.getInstance(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onPostExecute(final TaskResponse<Post, TwitLongerException> result) {
|
|
||||||
if (result.hasError()) {
|
|
||||||
activity.showError(result.getThrowable());
|
|
||||||
} else {
|
|
||||||
activity.showResult(result.getObject());
|
|
||||||
}
|
|
||||||
super.onPostExecute(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onPreExecute() {
|
|
||||||
activity.showProgress();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showProgress() {
|
|
||||||
mProgress.setVisibility(View.VISIBLE);
|
|
||||||
mActionButton.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showResult(Post post) {
|
|
||||||
mProgress.setVisibility(View.GONE);
|
|
||||||
mActionButton.setVisibility(View.VISIBLE);
|
|
||||||
mActionButton.setImageResource(R.drawable.ic_menu_share);
|
|
||||||
mPreview.setText(post.content);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showError(TwitLongerException e) {
|
|
||||||
mProgress.setVisibility(View.GONE);
|
|
||||||
mActionButton.setVisibility(View.VISIBLE);
|
|
||||||
mActionButton.setImageResource(R.drawable.ic_menu_send);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,141 +0,0 @@
|
||||||
package org.mariotaku.twidere.extension.twitlonger;
|
|
||||||
|
|
||||||
import android.app.Notification;
|
|
||||||
import android.app.NotificationManager;
|
|
||||||
import android.app.PendingIntent;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Build;
|
|
||||||
import android.support.annotation.Nullable;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import org.mariotaku.twidere.Twidere;
|
|
||||||
import org.mariotaku.twidere.model.ParcelableAccount;
|
|
||||||
import org.mariotaku.twidere.model.ParcelableCredentials;
|
|
||||||
import org.mariotaku.twidere.model.ParcelableStatus;
|
|
||||||
import org.mariotaku.twidere.model.ParcelableStatusUpdate;
|
|
||||||
import org.mariotaku.twidere.model.StatusShortenResult;
|
|
||||||
import org.mariotaku.twidere.model.UserKey;
|
|
||||||
import org.mariotaku.twidere.service.StatusShortenerService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tweet shortener example
|
|
||||||
*
|
|
||||||
* @author mariotaku
|
|
||||||
*/
|
|
||||||
public class TwitLongerStatusShortenerService extends StatusShortenerService implements Constants {
|
|
||||||
|
|
||||||
private static final int NOTIFICATION_ID_REQUEST_PERMISSION = 1;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Shortened tweet.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected StatusShortenResult shorten(final ParcelableStatusUpdate status,
|
|
||||||
final UserKey currentAccountKey,
|
|
||||||
final String overrideStatusText) {
|
|
||||||
final int granted = Twidere.isPermissionGranted(this);
|
|
||||||
if (granted == Twidere.Permission.DENIED) {
|
|
||||||
return StatusShortenResult.error(-1, getString(R.string.permission_not_granted));
|
|
||||||
} else if (granted != Twidere.Permission.GRANTED) {
|
|
||||||
final NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
|
|
||||||
final Notification.Builder builder = new Notification.Builder(this);
|
|
||||||
builder.setSmallIcon(R.drawable.ic_stat_warning);
|
|
||||||
builder.setTicker(getString(R.string.permission_request));
|
|
||||||
builder.setContentTitle(getString(R.string.permission_is_required_to_shorten_status));
|
|
||||||
builder.setContentText(getString(R.string.app_name));
|
|
||||||
builder.setContentIntent(PendingIntent.getActivity(this, 0, new Intent(this,
|
|
||||||
RequestPermissionActivity.class), PendingIntent.FLAG_ONE_SHOT));
|
|
||||||
builder.setAutoCancel(true);
|
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
|
||||||
nm.notify(NOTIFICATION_ID_REQUEST_PERMISSION, builder.build());
|
|
||||||
} else {
|
|
||||||
//noinspection deprecation
|
|
||||||
nm.notify(NOTIFICATION_ID_REQUEST_PERMISSION, builder.getNotification());
|
|
||||||
}
|
|
||||||
return StatusShortenResult.error(-1, getString(R.string.permission_not_granted));
|
|
||||||
}
|
|
||||||
final ParcelableCredentials credentials;
|
|
||||||
try {
|
|
||||||
credentials = getOAuthCredentials(currentAccountKey);
|
|
||||||
} catch (SecurityException e) {
|
|
||||||
if (BuildConfig.DEBUG) {
|
|
||||||
Log.w(LOGTAG, e);
|
|
||||||
}
|
|
||||||
return StatusShortenResult.error(-1, getString(R.string.permission_not_granted));
|
|
||||||
}
|
|
||||||
if (credentials == null || !isTwitter(credentials)) {
|
|
||||||
return StatusShortenResult.error(-1, "No valid Twitter account found");
|
|
||||||
}
|
|
||||||
final TwitLonger tl = TwitLongerFactory.getInstance(TWITLONGER_API_KEY, credentials);
|
|
||||||
try {
|
|
||||||
final String text;
|
|
||||||
if (overrideStatusText != null) {
|
|
||||||
text = overrideStatusText;
|
|
||||||
} else {
|
|
||||||
text = status.text;
|
|
||||||
}
|
|
||||||
NewPost newPost = new NewPost(text);
|
|
||||||
if (status.in_reply_to_status != null) {
|
|
||||||
final long inReplyToId = Long.parseLong(status.in_reply_to_status.id);
|
|
||||||
final String inReplyToScreenName = status.in_reply_to_status.user_screen_name;
|
|
||||||
newPost.setInReplyTo(inReplyToId, inReplyToScreenName);
|
|
||||||
}
|
|
||||||
final Post response = tl.createPost(newPost);
|
|
||||||
if (response != null) {
|
|
||||||
final StatusShortenResult shortened = StatusShortenResult.shortened(response.tweetContent);
|
|
||||||
shortened.extra = response.id;
|
|
||||||
return shortened;
|
|
||||||
}
|
|
||||||
} catch (final TwitLongerException e) {
|
|
||||||
if (BuildConfig.DEBUG) {
|
|
||||||
Log.w(LOGTAG, e);
|
|
||||||
}
|
|
||||||
return StatusShortenResult.error(-1, e.getMessage());
|
|
||||||
}
|
|
||||||
return StatusShortenResult.error(-1, "Unknown error");
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isTwitter(ParcelableCredentials credentials) {
|
|
||||||
return credentials.account_type == null || ParcelableAccount.Type.TWITTER.equals(credentials.account_type);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean callback(StatusShortenResult result, ParcelableStatus status) {
|
|
||||||
if (result.extra == null) return false;
|
|
||||||
final ParcelableCredentials credentials;
|
|
||||||
try {
|
|
||||||
credentials = getOAuthCredentials(status.account_key);
|
|
||||||
} catch (SecurityException e) {
|
|
||||||
if (BuildConfig.DEBUG) {
|
|
||||||
Log.w(LOGTAG, e);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final TwitLonger tl = TwitLongerFactory.getInstance(TWITLONGER_API_KEY, credentials);
|
|
||||||
try {
|
|
||||||
tl.updatePost(result.extra, Long.parseLong(status.id));
|
|
||||||
} catch (TwitLongerException e) {
|
|
||||||
if (BuildConfig.DEBUG) {
|
|
||||||
Log.w(LOGTAG, e);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
private ParcelableCredentials getOAuthCredentials(UserKey accountId) {
|
|
||||||
ParcelableCredentials credentials = Twidere.getCredentials(this, accountId);
|
|
||||||
if (credentials == null) return null;
|
|
||||||
switch (credentials.auth_type) {
|
|
||||||
case ParcelableCredentials.AUTH_TYPE_OAUTH:
|
|
||||||
case ParcelableCredentials.AUTH_TYPE_XAUTH: {
|
|
||||||
return credentials;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,23 +0,0 @@
|
||||||
package org.mariotaku.twidere.extension.twitlonger;
|
|
||||||
|
|
||||||
import android.text.TextUtils;
|
|
||||||
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
public class Utils {
|
|
||||||
|
|
||||||
private static final Pattern PATTERN_TWITLONGER = Pattern.compile(
|
|
||||||
"(https?://)(tl\\.gd|www.twitlonger.com/show)/([\\w\\d]+)", Pattern.CASE_INSENSITIVE);
|
|
||||||
private static final int GROUP_TWITLONGER_ID = 3;
|
|
||||||
|
|
||||||
public static String getTwitLongerId(String text) {
|
|
||||||
if (TextUtils.isEmpty(text)) return null;
|
|
||||||
return PATTERN_TWITLONGER.matcher(text).group(GROUP_TWITLONGER_ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getTwitLongerUrl(String text) {
|
|
||||||
if (TextUtils.isEmpty(text)) return null;
|
|
||||||
return PATTERN_TWITLONGER.matcher(text).group();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Before Width: | Height: | Size: 724 B |
Before Width: | Height: | Size: 6.8 KiB |
Before Width: | Height: | Size: 347 B |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 495 B |
Before Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 233 B |
Before Width: | Height: | Size: 885 B |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 444 B |
Before Width: | Height: | Size: 163 B |
Before Width: | Height: | Size: 158 B |
Before Width: | Height: | Size: 163 B |
Before Width: | Height: | Size: 190 B |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 617 B |
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<transition xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:exitFadeDuration="@android:integer/config_mediumAnimTime">
|
|
||||||
|
|
||||||
<item android:drawable="@drawable/list_pressed_holo"/>
|
|
||||||
<item android:drawable="@drawable/list_longpressed_holo"/>
|
|
||||||
|
|
||||||
</transition>
|
|
|
@ -1,13 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android" android:exitFadeDuration="@android:integer/config_mediumAnimTime">
|
|
||||||
|
|
||||||
<item android:drawable="@android:color/transparent" android:state_window_focused="false"/>
|
|
||||||
|
|
||||||
<!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. -->
|
|
||||||
<item android:drawable="@drawable/list_selector_disabled_holo_dark" android:state_enabled="false" android:state_focused="true" android:state_pressed="true"/>
|
|
||||||
<item android:drawable="@drawable/list_selector_disabled_holo_dark" android:state_enabled="false" android:state_focused="true"/>
|
|
||||||
<item android:drawable="@drawable/list_selector_background_transition_holo" android:state_focused="true" android:state_pressed="true"/>
|
|
||||||
<item android:drawable="@drawable/list_selector_background_transition_holo" android:state_focused="false" android:state_pressed="true"/>
|
|
||||||
<item android:drawable="@drawable/list_focused_holo" android:state_focused="true"/>
|
|
||||||
|
|
||||||
</selector>
|
|
|
@ -1,63 +0,0 @@
|
||||||
<RelativeLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:minHeight="160dp">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/title_layout"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="56dp"
|
|
||||||
android:layout_alignParentTop="true"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:paddingEnd="0dp"
|
|
||||||
android:paddingLeft="8dp"
|
|
||||||
android:paddingRight="0dp"
|
|
||||||
android:paddingStart="8dp"
|
|
||||||
android:text="@string/title"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge"/>
|
|
||||||
|
|
||||||
<FrameLayout
|
|
||||||
android:id="@+id/action_progress_layout"
|
|
||||||
android:layout_width="56dp"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<ProgressBar
|
|
||||||
android:id="@+id/progress"
|
|
||||||
style="?android:attr/progressBarStyleSmall"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:visibility="gone"/>
|
|
||||||
|
|
||||||
<ImageButton
|
|
||||||
android:id="@+id/action"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="@drawable/list_selector_holo_dark"
|
|
||||||
android:onClick="onClick"
|
|
||||||
android:src="@drawable/ic_menu_send"/>
|
|
||||||
</FrameLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<ScrollView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@+id/title_layout"
|
|
||||||
android:padding="12dp">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/text"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:autoLink="all"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"/>
|
|
||||||
</ScrollView>
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
|
|
||||||
<style name="Theme" parent="android:Theme.Holo.Dialog"/>
|
|
||||||
|
|
||||||
</resources>
|
|
|
@ -1,19 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
|
||||||
|
|
||||||
<string name="description">TwitLonger extension by Mariotaku</string>
|
|
||||||
<string name="app_name">Twidere TwitLonger Extension</string>
|
|
||||||
<string name="extension_post_name">Post TwitLonger tweet</string>
|
|
||||||
<string name="extension_reader_name">Read TwitLonger tweet</string>
|
|
||||||
<string name="title">TwitLonger</string>
|
|
||||||
<string name="share">Share</string>
|
|
||||||
<string name="error_message">Error: <xliff:g id="message">%s</xliff:g></string>
|
|
||||||
<string name="error_unknown_error">Error: Unknown error, this is probably a bug.</string>
|
|
||||||
<string name="more_applications">More applications</string>
|
|
||||||
<string name="donate">Donate</string>
|
|
||||||
<string name="about">About</string>
|
|
||||||
<string name="permission_not_granted">Permission not granted</string>
|
|
||||||
<string name="permission_request">Permission request</string>
|
|
||||||
<string name="permission_is_required_to_shorten_status">Permission is required to shorten tweet</string>
|
|
||||||
|
|
||||||
</resources>
|
|
|
@ -1,17 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
|
|
||||||
<style name="Theme" parent="android:Theme.Dialog">
|
|
||||||
<item name="android:windowBackground">@drawable/popup_holo_dark</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style name="Theme.NoDisplay" parent="android:Theme.DeviceDefault.Dialog">
|
|
||||||
<item name="android:windowBackground">@android:color/transparent</item>
|
|
||||||
<item name="android:windowFrame">@null</item>
|
|
||||||
<item name="android:windowContentOverlay">@null</item>
|
|
||||||
<item name="android:windowIsTranslucent">true</item>
|
|
||||||
<item name="android:windowAnimationStyle">@null</item>
|
|
||||||
<item name="android:windowDisablePreview">true</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
</resources>
|
|
|
@ -1,15 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
|
|
||||||
<PreferenceScreen android:title="@string/more_applications">
|
|
||||||
<intent
|
|
||||||
android:action="android.intent.action.VIEW"
|
|
||||||
android:data="https://play.google.com/store/apps/developer?id=mariotaku"/>
|
|
||||||
</PreferenceScreen>
|
|
||||||
<PreferenceScreen android:title="@string/donate">
|
|
||||||
<intent
|
|
||||||
android:action="android.intent.action.VIEW"
|
|
||||||
android:data="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=mariotaku.lee%40gmail%2ecom&item_name=Donate%20to%20Twidere&currency_code=USD"/>
|
|
||||||
</PreferenceScreen>
|
|
||||||
|
|
||||||
</PreferenceScreen>
|
|
|
@ -261,7 +261,7 @@ public final class Twidere implements TwidereConstants {
|
||||||
}
|
}
|
||||||
|
|
||||||
@IntDef({Permission.DENIED, Permission.NONE, Permission.GRANTED})
|
@IntDef({Permission.DENIED, Permission.NONE, Permission.GRANTED})
|
||||||
@Retention(RetentionPolicy.CLASS)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
public @interface Permission {
|
public @interface Permission {
|
||||||
int NONE = 0;
|
int NONE = 0;
|
||||||
int GRANTED = 1;
|
int GRANTED = 1;
|
||||||
|
|
|
@ -245,11 +245,11 @@
|
||||||
<string name="activity_about_me_retweeted_media_tagged"><xliff:g id="user">%s</xliff:g> retweeted a tweet you were tagged in.</string>
|
<string name="activity_about_me_retweeted_media_tagged"><xliff:g id="user">%s</xliff:g> retweeted a tweet you were tagged in.</string>
|
||||||
<string name="activity_about_me_retweeted_media_tagged_multi"><xliff:g id="user">%1$s</xliff:g> and <xliff:g id="other">%2$s</xliff:g> retweeted a tweet you were tagged in.</string>
|
<string name="activity_about_me_retweeted_media_tagged_multi"><xliff:g id="user">%1$s</xliff:g> and <xliff:g id="other">%2$s</xliff:g> retweeted a tweet you were tagged in.</string>
|
||||||
<string name="activity_about_me_retweeted_mention"><xliff:g id="user">%s</xliff:g> retweeted a tweet you were mentioned in.</string>
|
<string name="activity_about_me_retweeted_mention"><xliff:g id="user">%s</xliff:g> retweeted a tweet you were mentioned in.</string>
|
||||||
<string name="activity_about_me_retweeted_mention_multi"><xliff:g id="user">%s</xliff:g> and <xliff:g id="other">%2$s</xliff:g> retweeted a tweet you were mentioned in.</string>
|
<string name="activity_about_me_retweeted_mention_multi"><xliff:g id="user">%1$s</xliff:g> and <xliff:g id="other">%2$s</xliff:g> retweeted a tweet you were mentioned in.</string>
|
||||||
<string name="activity_about_me_favorited_mention"><xliff:g id="user">%s</xliff:g> favorited a tweet you were mentioned in.</string>
|
<string name="activity_about_me_favorited_mention"><xliff:g id="user">%s</xliff:g> favorited a tweet you were mentioned in.</string>
|
||||||
<string name="activity_about_me_favorited_mention_multi"><xliff:g id="user">%s</xliff:g> and <xliff:g id="other">%2$s</xliff:g> favorited a tweet you were mentioned in.</string>
|
<string name="activity_about_me_favorited_mention_multi"><xliff:g id="user">%1$s</xliff:g> and <xliff:g id="other">%2$s</xliff:g> favorited a tweet you were mentioned in.</string>
|
||||||
<string name="activity_about_me_liked_mention"><xliff:g id="user">%s</xliff:g> liked a tweet you were mentioned in.</string>
|
<string name="activity_about_me_liked_mention"><xliff:g id="user">%s</xliff:g> liked a tweet you were mentioned in.</string>
|
||||||
<string name="activity_about_me_liked_mention_multi"><xliff:g id="user">%s</xliff:g> and <xliff:g id="other">%2$s</xliff:g> liked a tweet you were mentioned in.</string>
|
<string name="activity_about_me_liked_mention_multi"><xliff:g id="user">%1$s</xliff:g> and <xliff:g id="other">%2$s</xliff:g> liked a tweet you were mentioned in.</string>
|
||||||
<string name="activity_about_me_list_member_added"><xliff:g id="user">%s</xliff:g> added you to list.</string>
|
<string name="activity_about_me_list_member_added"><xliff:g id="user">%s</xliff:g> added you to list.</string>
|
||||||
<string name="activity_about_me_list_member_added_with_name"><xliff:g id="user">%1$s</xliff:g> added you to list <xliff:g id="list">%2$s</xliff:g>".</string>
|
<string name="activity_about_me_list_member_added_with_name"><xliff:g id="user">%1$s</xliff:g> added you to list <xliff:g id="list">%2$s</xliff:g>".</string>
|
||||||
<string name="activity_about_me_list_member_added_multi"><xliff:g id="user">%1$s</xliff:g> and <xliff:g id="other">%2$s</xliff:g> added you to their lists.</string>
|
<string name="activity_about_me_list_member_added_multi"><xliff:g id="user">%1$s</xliff:g> and <xliff:g id="other">%2$s</xliff:g> added you to their lists.</string>
|
||||||
|
@ -768,6 +768,7 @@
|
||||||
<string name="translation">Translation</string>
|
<string name="translation">Translation</string>
|
||||||
<string name="shortener_version_incompatible">Incompatible tweet shortener</string>
|
<string name="shortener_version_incompatible">Incompatible tweet shortener</string>
|
||||||
<string name="uploader_version_incompatible">Incompatible media uploader</string>
|
<string name="uploader_version_incompatible">Incompatible media uploader</string>
|
||||||
|
<!-- GNU social group like https://quitter.se/group/qvitter -->
|
||||||
<string name="groups">Groups</string>
|
<string name="groups">Groups</string>
|
||||||
<string name="public_timeline">Public timeline</string>
|
<string name="public_timeline">Public timeline</string>
|
||||||
<string name="external_user_host_format">External user at <xliff:g id="host">%s</xliff:g></string>
|
<string name="external_user_host_format">External user at <xliff:g id="host">%s</xliff:g></string>
|
||||||
|
@ -781,6 +782,7 @@
|
||||||
<string name="new_document_api">New Document API</string>
|
<string name="new_document_api">New Document API</string>
|
||||||
<string name="new_document_api_summary">Open profile and media in new task</string>
|
<string name="new_document_api_summary">Open profile and media in new task</string>
|
||||||
<string name="drawer_toggle">Drawer toggle</string>
|
<string name="drawer_toggle">Drawer toggle</string>
|
||||||
|
<!-- GNU social group like https://quitter.se/group/qvitter -->
|
||||||
<string name="group">Group</string>
|
<string name="group">Group</string>
|
||||||
<string name="your_coarse_location">Your coarse location</string>
|
<string name="your_coarse_location">Your coarse location</string>
|
||||||
</resources>
|
</resources>
|