diff --git a/.travis.yml b/.travis.yml
index 45ca94e9f..da9935529 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -74,8 +74,15 @@ deploy:
on:
repo: TwidereProject/Twidere-Android
tags: true
+ # Publish to Google Play store
- provider: script
script: ./gradlew publishGoogleRelease
on:
repo: TwidereProject/Twidere-Android
tags: true
+ # Upload common component library to Bintray
+ - provider: script
+ script: ./gradlew twidere.component.common:bintrayUpload
+ on:
+ repo: TwidereProject/Twidere-Android
+ tags: true
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index af0ad3549..bb3f94c8b 100644
--- a/build.gradle
+++ b/build.gradle
@@ -16,6 +16,14 @@ buildscript {
}
allprojects {
+
+ ext{
+ projectGroupId = 'org.mariotaku.twidere'
+ projectVersionCode = 379
+ projectVersionName = '3.6.19'
+ }
+
+
repositories {
mavenLocal()
jcenter()
diff --git a/settings.gradle b/settings.gradle
index b14cc8409..1386d66f4 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,5 +1,4 @@
include ':twidere'
include ':twidere.component.common'
include ':twidere.component.nyan'
-include ':twidere.library.extension'
include ':twidere.wear'
diff --git a/twidere.component.common/build.gradle b/twidere.component.common/build.gradle
index 938761749..8a1fb426e 100644
--- a/twidere.component.common/build.gradle
+++ b/twidere.component.common/build.gradle
@@ -21,13 +21,35 @@
apply plugin: 'com.android.library'
apply plugin: 'com.neenbedankt.android-apt'
+apply plugin: 'com.jfrog.bintray'
+apply plugin: 'com.github.dcendents.android-maven'
+
+group = projectGroupId
+version = projectVersionName
+archivesBaseName = 'common-component'
+
+ext {
+ projectDescription = 'Common commonent library for Twidere app'
+ projectUrl = 'https://github.com/TwidereProject/Twidere-Android'
+ projectVcsUrl = 'https://github.com/TwidereProject/Twidere-Android.git'
+}
+
+buildscript {
+ repositories {
+ jcenter()
+ }
+ dependencies {
+ classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
+ classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
+ }
+}
android {
defaultConfig {
minSdkVersion 14
targetSdkVersion 25
- versionCode 1
- versionName "3.0"
+ versionCode projectVersionCode
+ versionName projectVersionName
}
buildTypes {
release {
@@ -37,6 +59,11 @@ android {
}
}
+repositories {
+ mavenLocal()
+ jcenter()
+}
+
dependencies {
apt "com.bluelinelabs:logansquare-compiler:${libVersions['LoganSquare']}"
apt 'com.hannesdorfmann.parcelableplease:processor:1.0.2'
@@ -53,3 +80,66 @@ dependencies {
compile "com.github.mariotaku.CommonsLibrary:objectcursor:${libVersions['MariotakuCommons']}"
compile "com.github.mariotaku.CommonsLibrary:logansquare:${libVersions['MariotakuCommons']}"
}
+
+install {
+ repositories.mavenInstaller {
+ pom.project {
+ name archivesBaseName
+ description projectDescription
+ url projectUrl
+ inceptionYear '2012'
+
+ packaging 'aar'
+ groupId projectGroupId
+ artifactId archivesBaseName
+ version projectVersionName
+
+ licenses {
+ license {
+ name 'The Apache Software License, Version 2.0'
+ url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
+ distribution 'repo'
+ }
+ }
+ scm {
+ connection projectVcsUrl
+ url projectUrl
+
+ }
+ developers {
+ developer {
+ name 'Mariotaku Lee'
+ }
+ }
+ }
+ }
+}
+
+bintray {
+ def properties = new Properties()
+ properties.load(rootProject.file('private/bintray.properties').newDataInputStream())
+ user = properties.getProperty('user')
+ key = properties.getProperty('key')
+
+ pkg {
+ name = archivesBaseName
+ description = projectDescription
+ repo = 'android'
+ userOrg = 'twidere'
+ vcsUrl = projectVcsUrl
+ licenses = ['Apache-2.0']
+ publish = true
+
+ version {
+ name = projectVersionName
+ vcsTag = projectVersionName
+ }
+ }
+
+ configurations = ['archives']
+}
+
+// https://github.com/JFrogDev/build-info/issues/92
+afterEvaluate {
+ bintrayUpload.dependsOn 'install'
+}
\ No newline at end of file
diff --git a/twidere.library.extension/.gitignore b/twidere.library.extension/.gitignore
deleted file mode 100644
index 796b96d1c..000000000
--- a/twidere.library.extension/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build
diff --git a/twidere.library.extension/LICENSE.txt b/twidere.library.extension/LICENSE.txt
deleted file mode 100644
index d64569567..000000000
--- a/twidere.library.extension/LICENSE.txt
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
diff --git a/twidere.library.extension/build.gradle b/twidere.library.extension/build.gradle
deleted file mode 100644
index c5c26ae54..000000000
--- a/twidere.library.extension/build.gradle
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Twidere - Twitter client for Android
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-
-apply plugin: 'com.android.library'
-
-android {
- defaultConfig {
- minSdkVersion 14
- targetSdkVersion 25
- versionCode 1
- versionName "1.0"
- }
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- }
- }
-}
-
-dependencies {
- compile project(':twidere.component.common')
-
- testCompile 'junit:junit:4.12'
-
-}
diff --git a/twidere.library.extension/proguard-rules.pro b/twidere.library.extension/proguard-rules.pro
deleted file mode 100644
index ee5b46f04..000000000
--- a/twidere.library.extension/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.library.extension/src/main/AndroidManifest.xml b/twidere.library.extension/src/main/AndroidManifest.xml
deleted file mode 100644
index b8e6a17c4..000000000
--- a/twidere.library.extension/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/twidere.library.extension/src/main/java/org/mariotaku/twidere/Twidere.java b/twidere.library.extension/src/main/java/org/mariotaku/twidere/Twidere.java
deleted file mode 100644
index 06bc7a1dc..000000000
--- a/twidere.library.extension/src/main/java/org/mariotaku/twidere/Twidere.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * Twidere - Twitter client for Android
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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;
-
-import android.Manifest;
-import android.accounts.Account;
-import android.accounts.AccountManager;
-import android.app.Activity;
-import android.content.ClipData;
-import android.content.ContentResolver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.pm.ApplicationInfo;
-import android.content.pm.PackageManager;
-import android.database.Cursor;
-import android.graphics.Color;
-import android.net.Uri;
-import android.os.Build;
-import android.support.annotation.IntDef;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-import android.support.annotation.RequiresPermission;
-
-import org.mariotaku.twidere.model.AccountDetails;
-import org.mariotaku.twidere.model.ComposingStatus;
-import org.mariotaku.twidere.model.ParcelableStatus;
-import org.mariotaku.twidere.model.ParcelableUser;
-import org.mariotaku.twidere.model.ParcelableUserList;
-import org.mariotaku.twidere.model.UserKey;
-import org.mariotaku.twidere.provider.TwidereDataStore.Permissions;
-import org.mariotaku.twidere.util.JsonSerializer;
-import org.mariotaku.twidere.util.model.AccountDetailsUtils;
-
-import java.io.IOException;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.net.Inet4Address;
-import java.net.Inet6Address;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-
-import static android.text.TextUtils.isEmpty;
-
-@SuppressWarnings("unused")
-public final class Twidere implements TwidereConstants {
-
- public static void setComposeExtensionResult(@NonNull final Activity activity,
- @Nullable final String text, final boolean isReplacementMode, @Nullable Uri[] media) {
- final Intent intent = new Intent();
- intent.putExtra(Intent.EXTRA_TEXT, text);
- intent.putExtra(EXTRA_IS_REPLACE_MODE, isReplacementMode);
-
- if (media != null && media.length > 0) {
- intent.setData(media[0]);
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
- ClipData clipData = ClipData.newUri(activity.getContentResolver(), "Media",
- media[0]);
- for (int i = 1, j = media.length; i < j; i++) {
- Uri uri = media[i];
- clipData.addItem(new ClipData.Item(uri));
- }
- intent.setClipData(clipData);
- }
- }
- intent.putExtra(EXTRA_IS_REPLACE_MODE, isReplacementMode);
- activity.setResult(Activity.RESULT_OK, intent);
- }
-
- public static ComposingStatus getComposingStatusFromIntent(@NonNull final Intent intent) {
- return new ComposingStatus(intent);
- }
-
- public static ParcelableStatus getStatusFromIntent(@NonNull final Intent intent) {
- return intent.getParcelableExtra(EXTRA_STATUS);
- }
-
- public static ParcelableUser getUserFromIntent(@NonNull final Intent intent) {
- return intent.getParcelableExtra(EXTRA_USER);
- }
-
- public static ParcelableUserList getUserListFromIntent(@NonNull final Intent intent) {
- return intent.getParcelableExtra(EXTRA_USER_LIST);
- }
-
- @Permission
- public static int isPermissionGranted(@NonNull final Context context) {
- final PackageManager pm = context.getPackageManager();
- final String pname = context.getPackageName();
- final ApplicationInfo info;
- try {
- info = pm.getPackageInfo(pname, PackageManager.GET_META_DATA).applicationInfo;
- } catch (final PackageManager.NameNotFoundException e) {
- return Permission.NONE;
- }
- if (info.metaData == null) return Permission.NONE;
- final String[] required = parsePermissions(info.metaData.getString(METADATA_KEY_EXTENSION_PERMISSIONS));
- final String[] permissions = getPermissions(context, pname);
- return checkPermissionRequirement(required, permissions);
- }
-
- public static int checkPermissionRequirement(@NonNull String[] required, @NonNull String[] permissions) {
- if (indexOf(permissions, PERMISSION_DENIED) != -1) {
- return Permission.DENIED;
- } else {
- for (String s : required) {
- if (indexOf(permissions, s) == -1) return Permission.NONE;
- }
- return Permission.GRANTED;
- }
- }
-
- @NonNull
- public static String[] getPermissions(@NonNull final Context context, @NonNull String pname) {
- final ContentResolver resolver = context.getContentResolver();
- final Cursor c = resolver.query(Permissions.CONTENT_URI, null, null, null, null);
- if (c == null) return new String[0];
- try {
- c.moveToFirst();
- final int idxPackageName = c.getColumnIndex(Permissions.PACKAGE_NAME), idxPermissions = c
- .getColumnIndex(Permissions.PERMISSION);
- while (!c.isAfterLast()) {
- if (pname.equals(c.getString(idxPackageName))) {
- return parsePermissions(c.getString(idxPermissions));
- }
- c.moveToNext();
- }
- } catch (final SecurityException ignore) {
-
- } finally {
- c.close();
- }
- return new String[0];
- }
-
- @NonNull
- public static String[] parsePermissions(final String permissionsString) {
- if (isEmpty(permissionsString)) return new String[0];
- return permissionsString.split(SEPARATOR_PERMISSION_REGEX);
- }
-
- @Nullable
- @RequiresPermission(allOf = {Manifest.permission.GET_ACCOUNTS}, conditional = true)
- public static Account findByAccountKey(@NonNull Context context, @NonNull UserKey userKey) {
- final AccountManager am = AccountManager.get(context);
- for (Account account : am.getAccountsByType(ACCOUNT_TYPE)) {
- if (userKey.equals(getAccountKey(account, am))) {
- return account;
- }
- }
- return null;
- }
-
- @RequiresPermission(allOf = {"android.permission.AUTHENTICATE_ACCOUNTS"}, conditional = true)
- @NonNull
- public static AccountDetails getAccountDetails(Context context, Account account) throws SecurityException {
- final AccountManager am = AccountManager.get(context);
- final AccountDetails details = new AccountDetails();
- details.account = account;
- details.key = getAccountKey(account, am);
- //noinspection WrongConstant
- details.type = am.getUserData(account, ACCOUNT_USER_DATA_TYPE);
- details.color = Color.parseColor(am.getUserData(account, ACCOUNT_USER_DATA_COLOR));
- details.position = Integer.parseInt(am.getUserData(account, ACCOUNT_USER_DATA_POSITION));
- //noinspection WrongConstant
- details.credentials_type = am.getUserData(account, ACCOUNT_USER_DATA_CREDS_TYPE);
- try {
- details.user = JsonSerializer.parse(am.getUserData(account, ACCOUNT_USER_DATA_USER),
- ParcelableUser.class);
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- details.activated = Boolean.parseBoolean(am.getUserData(account, ACCOUNT_USER_DATA_ACTIVATED));
-
- try {
- details.credentials = AccountDetailsUtils.parseCredentials(am.peekAuthToken(account, ACCOUNT_AUTH_TOKEN_TYPE),
- details.credentials_type);
- } catch (SecurityException e) {
- // Ignore
- }
- details.extras = AccountDetailsUtils.parseAccountExtras(am.getUserData(account, ACCOUNT_USER_DATA_EXTRAS), details.type);
-
- details.user.color = details.color;
-
- return details;
- }
-
- private static InetAddress fromAddressString(String host, String address) throws UnknownHostException {
- InetAddress inetAddress = InetAddress.getByName(address);
- if (inetAddress instanceof Inet4Address) {
- return Inet4Address.getByAddress(host, inetAddress.getAddress());
- } else if (inetAddress instanceof Inet6Address) {
- return Inet6Address.getByAddress(host, inetAddress.getAddress());
- }
- throw new UnknownHostException("Bad address " + host + " = " + address);
- }
-
- @NonNull
- @RequiresPermission(allOf = {"android.permission.AUTHENTICATE_ACCOUNTS"}, conditional = true)
- private static UserKey getAccountKey(Account account, AccountManager am) {
- return UserKey.valueOf(am.getUserData(account, ACCOUNT_USER_DATA_KEY));
- }
-
- private static int indexOf(String[] input, String find) {
- for (int i = 0, inputLength = input.length; i < inputLength; i++) {
- if (find == null) {
- if (input[i] == null) return i;
- } else if (find.equals(input[i])) return i;
- }
- return -1;
- }
-
- @IntDef({Permission.DENIED, Permission.NONE, Permission.GRANTED})
- @Retention(RetentionPolicy.SOURCE)
- public @interface Permission {
- int NONE = 0;
- int GRANTED = 1;
- int DENIED = -1;
- }
-
-
-}
diff --git a/twidere.library.extension/src/main/java/org/mariotaku/twidere/model/ComposingStatus.java b/twidere.library.extension/src/main/java/org/mariotaku/twidere/model/ComposingStatus.java
deleted file mode 100644
index d62e88961..000000000
--- a/twidere.library.extension/src/main/java/org/mariotaku/twidere/model/ComposingStatus.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Twidere - Twitter client for Android
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.model;
-
-import android.content.Intent;
-
-import org.mariotaku.twidere.TwidereConstants;
-
-public class ComposingStatus implements TwidereConstants {
-
- public final String text, name, screen_name, in_reply_to_screen_name, in_reply_to_name;
- public final long in_reply_to_id;
-
- public ComposingStatus(final Intent intent) {
- text = intent.getStringExtra(EXTRA_TEXT);
- name = intent.getStringExtra(EXTRA_NAME);
- screen_name = intent.getStringExtra(EXTRA_SCREEN_NAME);
- in_reply_to_screen_name = intent.getStringExtra(EXTRA_IN_REPLY_TO_SCREEN_NAME);
- in_reply_to_name = intent.getStringExtra(EXTRA_IN_REPLY_TO_NAME);
- in_reply_to_id = intent.getLongExtra(EXTRA_IN_REPLY_TO_ID, -1);
- }
-}
diff --git a/twidere.library.extension/src/main/java/org/mariotaku/twidere/service/MediaUploaderService.java b/twidere.library.extension/src/main/java/org/mariotaku/twidere/service/MediaUploaderService.java
deleted file mode 100644
index a379fa46c..000000000
--- a/twidere.library.extension/src/main/java/org/mariotaku/twidere/service/MediaUploaderService.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Twidere - Twitter client for Android
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.service;
-
-import android.app.Service;
-import android.content.Intent;
-import android.os.Build;
-import android.os.IBinder;
-import android.os.RemoteException;
-
-import org.mariotaku.twidere.IMediaUploader;
-import org.mariotaku.twidere.model.MediaUploadResult;
-import org.mariotaku.twidere.model.ParcelableStatus;
-import org.mariotaku.twidere.model.ParcelableStatusUpdate;
-import org.mariotaku.twidere.model.UploaderMediaItem;
-import org.mariotaku.twidere.model.UserKey;
-import org.mariotaku.twidere.util.JsonSerializer;
-
-import java.io.IOException;
-import java.lang.ref.WeakReference;
-import java.util.List;
-
-/**
- * Abstract media uploader service
- *
- * Created by mariotaku on 16/2/27.
- */
-public abstract class MediaUploaderService extends Service {
-
- private final MediaUploaderStub mBinder = new MediaUploaderStub(this);
-
- @Override
- public final IBinder onBind(final Intent intent) {
- return mBinder;
- }
-
- protected abstract MediaUploadResult upload(ParcelableStatusUpdate status,
- UserKey currentAccount, UploaderMediaItem[] media);
-
- protected abstract boolean callback(MediaUploadResult result, ParcelableStatus status);
-
- /*
- * By making this a static class with a WeakReference to the Service, we
- * ensure that the Service can be GCd even when the system process still has
- * a remote reference to the stub.
- */
- private static final class MediaUploaderStub extends IMediaUploader.Stub {
-
- final WeakReference mService;
-
- public MediaUploaderStub(final MediaUploaderService service) {
- mService = new WeakReference<>(service);
- }
-
- @Override
- public String upload(String statusJson, String currentAccount, String mediaJson) throws RemoteException {
- try {
- final ParcelableStatusUpdate statusUpdate = JsonSerializer.parse(statusJson, ParcelableStatusUpdate.class);
- final List media = JsonSerializer.parseList(mediaJson, UploaderMediaItem.class);
- final MediaUploadResult shorten = mService.get().upload(statusUpdate,
- UserKey.valueOf(currentAccount),
- media.toArray(new UploaderMediaItem[media.size()]));
- return JsonSerializer.serialize(shorten, MediaUploadResult.class);
- } catch (IOException e) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
- throw new RemoteException(e.getMessage());
- } else {
- throw new RemoteException();
- }
- }
- }
-
- @Override
- public boolean callback(String resultJson, String statusJson) throws RemoteException {
- try {
- final MediaUploadResult result = JsonSerializer.parse(resultJson, MediaUploadResult.class);
- final ParcelableStatus status = JsonSerializer.parse(statusJson, ParcelableStatus.class);
- return mService.get().callback(result, status);
- } catch (IOException e) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
- throw new RemoteException(e.getMessage());
- } else {
- throw new RemoteException();
- }
- }
- }
-
- }
-}
diff --git a/twidere.library.extension/src/main/java/org/mariotaku/twidere/service/StatusShortenerService.java b/twidere.library.extension/src/main/java/org/mariotaku/twidere/service/StatusShortenerService.java
deleted file mode 100644
index 9fc7af3c5..000000000
--- a/twidere.library.extension/src/main/java/org/mariotaku/twidere/service/StatusShortenerService.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Twidere - Twitter client for Android
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.service;
-
-import android.app.Service;
-import android.content.Intent;
-import android.os.Build;
-import android.os.IBinder;
-import android.os.RemoteException;
-
-import org.mariotaku.twidere.IStatusShortener;
-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.util.JsonSerializer;
-
-import java.io.IOException;
-import java.lang.ref.WeakReference;
-
-/**
- * Abstract status shortener service
- *
- * Created by mariotaku on 16/2/20.
- */
-public abstract class StatusShortenerService extends Service {
- private final StatusShortenerStub mBinder = new StatusShortenerStub(this);
-
- @Override
- public final IBinder onBind(final Intent intent) {
- return mBinder;
- }
-
- protected abstract StatusShortenResult shorten(ParcelableStatusUpdate status,
- UserKey currentAccountKey,
- String overrideStatusText);
-
- protected abstract boolean callback(StatusShortenResult result, ParcelableStatus status);
-
- /*
- * By making this a static class with a WeakReference to the Service, we
- * ensure that the Service can be GCd even when the system process still has
- * a remote reference to the stub.
- */
- private static final class StatusShortenerStub extends IStatusShortener.Stub {
-
- final WeakReference mService;
-
- public StatusShortenerStub(final StatusShortenerService service) {
- mService = new WeakReference<>(service);
- }
-
- @Override
- public String shorten(final String statusJson, final String currentAccountIdStr,
- final String overrideStatusText)
- throws RemoteException {
- try {
- final ParcelableStatusUpdate statusUpdate = JsonSerializer.parse(statusJson,
- ParcelableStatusUpdate.class);
- final UserKey currentAccountId = UserKey.valueOf(currentAccountIdStr);
- final StatusShortenResult shorten = mService.get().shorten(statusUpdate, currentAccountId,
- overrideStatusText);
- return JsonSerializer.serialize(shorten, StatusShortenResult.class);
- } catch (IOException e) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
- throw new RemoteException(e.getMessage());
- } else {
- throw new RemoteException();
- }
- }
- }
-
- @Override
- public boolean callback(String resultJson, String statusJson) throws RemoteException {
- try {
- final StatusShortenResult result = JsonSerializer.parse(resultJson, StatusShortenResult.class);
- final ParcelableStatus status = JsonSerializer.parse(statusJson, ParcelableStatus.class);
- return mService.get().callback(result, status);
- } catch (IOException e) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
- throw new RemoteException(e.getMessage());
- } else {
- throw new RemoteException();
- }
- }
- }
-
- }
-}
diff --git a/twidere.library.extension/src/test/java/org/mariotaku/twidere/TwidereTest.java b/twidere.library.extension/src/test/java/org/mariotaku/twidere/TwidereTest.java
deleted file mode 100644
index 2064128ac..000000000
--- a/twidere.library.extension/src/test/java/org/mariotaku/twidere/TwidereTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Twidere - Twitter client for Android
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * Created by mariotaku on 16/2/24.
- */
-public class TwidereTest {
-
- @Test
- public void testCheckPermissionRequirement() {
- assertEquals(Twidere.Permission.GRANTED, Twidere.checkPermissionRequirement(new String[]{"a", "b", "c"}, new String[]{"a", "b", "c"}));
- assertEquals(Twidere.Permission.GRANTED, Twidere.checkPermissionRequirement(new String[]{"a", "b"}, new String[]{"a", "b", "c"}));
- assertEquals(Twidere.Permission.NONE, Twidere.checkPermissionRequirement(new String[]{"a", "b"}, new String[]{"a", "c"}));
- assertEquals(Twidere.Permission.DENIED, Twidere.checkPermissionRequirement(new String[]{"a", "b"}, new String[]{"denied"}));
- }
-}
\ No newline at end of file
diff --git a/twidere.library.extension/src/test/java/org/mariotaku/twidere/model/UserKeyLocalTest.java b/twidere.library.extension/src/test/java/org/mariotaku/twidere/model/UserKeyLocalTest.java
deleted file mode 100644
index 30c928088..000000000
--- a/twidere.library.extension/src/test/java/org/mariotaku/twidere/model/UserKeyLocalTest.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Twidere - Twitter client for Android
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.model;
-
-import junit.framework.TestCase;
-
-/**
- * Created by mariotaku on 16/3/10.
- */
-public class UserKeyLocalTest extends TestCase {
-
- public void testToString() throws Exception {
- assertEquals("abc@twitter.com", new UserKey("abc", "twitter.com").toString());
- assertEquals("\\@user@twitter.com", new UserKey("@user", "twitter.com").toString());
- assertEquals("\\@u\\\\ser@twitter.com", new UserKey("@u\\ser", "twitter.com").toString());
- }
-
- public void testValueOf() throws Exception {
- assertEquals(new UserKey("abc", "twitter.com"), UserKey.valueOf("abc@twitter.com"));
- assertEquals(new UserKey("abc@", "twitter.com"), UserKey.valueOf("abc\\@@twitter.com"));
- assertEquals(new UserKey("abc@", "twitter.com"), UserKey.valueOf("a\\bc\\@@twitter.com"));
- assertEquals(new UserKey("a\\bc@", "twitter.com"), UserKey.valueOf("a\\\\bc\\@@twitter.com"));
- assertEquals(new UserKey("abc", "twitter.com"), UserKey.valueOf("abc@twitter.com,def@twitter.com"));
- assertEquals(new UserKey("@abc", "twitter.com"), UserKey.valueOf("\\@abc@twitter.com,def@twitter.com"));
- }
-}
\ No newline at end of file
diff --git a/twidere/build.gradle b/twidere/build.gradle
index f4b69b1d1..81c88ea0c 100644
--- a/twidere/build.gradle
+++ b/twidere/build.gradle
@@ -41,8 +41,8 @@ android {
applicationId "org.mariotaku.twidere"
minSdkVersion 14
targetSdkVersion 25
- versionCode 379
- versionName '3.6.19'
+ versionCode projectVersionCode
+ versionName projectVersionName
multiDexEnabled true
buildConfigField 'boolean', 'LEAK_CANARY_ENABLED', 'Boolean.parseBoolean("true")'