From b3d79c67fc2c0d3910d9794e19e76e087ba29b8e Mon Sep 17 00:00:00 2001 From: Mariotaku Lee Date: Mon, 4 Apr 2016 17:22:36 +0800 Subject: [PATCH] moved classes --- .../api/twitter/annotation/NoObfuscate.java | 11 +++++ .../model/Activity$$JsonObjectMapper.java | 2 + .../twidere/api/twitter/model/Activity.java | 6 +++ .../twitter/model/IDs$$JsonObjectMapper.java | 1 + .../twidere/api/twitter/model/IDs.java | 3 ++ .../twitter/model/PageableResponseList.java | 4 ++ .../api/twitter/model/ResponseList.java | 3 ++ twidere/build.gradle | 1 + twidere/proguard-rules.pro | 48 ++++++++++++++----- .../fragment/AccountsDashboardFragment.java | 2 +- .../twidere/fragment/StatusFragment.java | 2 +- .../{support => }/AccountToggleProvider.java | 2 +- .../{support => }/FavoriteItemProvider.java | 2 +- .../org/mariotaku/twidere/util/MenuUtils.java | 2 +- .../menu/action_dashboard_timeline_toggle.xml | 11 +++-- .../src/main/res/menu/menu_detail_status.xml | 2 +- 16 files changed, 79 insertions(+), 23 deletions(-) create mode 100644 twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/annotation/NoObfuscate.java rename twidere/src/main/java/org/mariotaku/twidere/menu/{support => }/AccountToggleProvider.java (98%) rename twidere/src/main/java/org/mariotaku/twidere/menu/{support => }/FavoriteItemProvider.java (98%) diff --git a/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/annotation/NoObfuscate.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/annotation/NoObfuscate.java new file mode 100644 index 000000000..e596138e9 --- /dev/null +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/annotation/NoObfuscate.java @@ -0,0 +1,11 @@ +package org.mariotaku.twidere.api.twitter.annotation; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +/** + * Created by mariotaku on 16/4/4. + */ +@Retention(RetentionPolicy.CLASS) +public @interface NoObfuscate { +} diff --git a/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/Activity$$JsonObjectMapper.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/Activity$$JsonObjectMapper.java index 0f0e6f2d6..75c171f87 100644 --- a/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/Activity$$JsonObjectMapper.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/Activity$$JsonObjectMapper.java @@ -31,6 +31,7 @@ import java.text.SimpleDateFormat; import java.util.Locale; /** + * ObjectMapper for Activity object * Created by mariotaku on 15/10/21. */ public class Activity$$JsonObjectMapper extends JsonMapper { @@ -74,6 +75,7 @@ public class Activity$$JsonObjectMapper extends JsonMapper { throw new UnsupportedOperationException(); } + @Override public void parseField(Activity instance, String fieldName, JsonParser jsonParser) throws IOException { if ("action".equals(fieldName)) { //noinspection ResourceType diff --git a/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/Activity.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/Activity.java index 9f9550356..e553ddaaa 100644 --- a/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/Activity.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/Activity.java @@ -23,11 +23,17 @@ import android.support.annotation.NonNull; import android.support.annotation.StringDef; import android.text.TextUtils; +import org.mariotaku.twidere.api.twitter.annotation.NoObfuscate; + import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.Arrays; import java.util.Date; +/** + * Twitter Activity object + */ +@NoObfuscate public class Activity extends TwitterResponseObject implements TwitterResponse, Comparable { @Action diff --git a/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/IDs$$JsonObjectMapper.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/IDs$$JsonObjectMapper.java index 301a9fc08..01eba32dc 100644 --- a/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/IDs$$JsonObjectMapper.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/IDs$$JsonObjectMapper.java @@ -61,6 +61,7 @@ public class IDs$$JsonObjectMapper extends JsonMapper { throw new UnsupportedOperationException(); } + @Override public void parseField(IDs instance, String fieldName, JsonParser jsonParser) throws IOException { if ("ids".equals(fieldName)) { parseIDsArray(instance, jsonParser); diff --git a/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/IDs.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/IDs.java index c4e8ea18f..5962de720 100644 --- a/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/IDs.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/IDs.java @@ -25,11 +25,14 @@ import com.bluelinelabs.logansquare.typeconverters.TypeConverter; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonParser; +import org.mariotaku.twidere.api.twitter.annotation.NoObfuscate; + import java.io.IOException; /** * Created by mariotaku on 15/5/10. */ +@NoObfuscate public class IDs extends TwitterResponseObject implements TwitterResponse, CursorSupport { long previousCursor; diff --git a/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/PageableResponseList.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/PageableResponseList.java index 7de3ab378..23137ca6a 100644 --- a/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/PageableResponseList.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/PageableResponseList.java @@ -19,9 +19,13 @@ package org.mariotaku.twidere.api.twitter.model; +import org.mariotaku.twidere.api.twitter.annotation.NoObfuscate; + /** + * Response list supports cursor pagination * Created by mariotaku on 15/5/7. */ +@NoObfuscate public class PageableResponseList extends ResponseList implements TwitterResponse, CursorSupport { long previousCursor; diff --git a/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/ResponseList.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/ResponseList.java index baf82492a..1cd5a1255 100644 --- a/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/ResponseList.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/model/ResponseList.java @@ -20,6 +20,7 @@ package org.mariotaku.twidere.api.twitter.model; import org.mariotaku.restfu.http.HttpResponse; +import org.mariotaku.twidere.api.twitter.annotation.NoObfuscate; import org.mariotaku.twidere.api.twitter.util.InternalParseUtil; import java.util.AbstractList; @@ -27,8 +28,10 @@ import java.util.ArrayList; import java.util.List; /** + * Response list * Created by mariotaku on 15/5/7. */ +@NoObfuscate public class ResponseList extends AbstractList implements TwitterResponse { private List list; diff --git a/twidere/build.gradle b/twidere/build.gradle index 13d39edb9..21775ebbd 100644 --- a/twidere/build.gradle +++ b/twidere/build.gradle @@ -64,6 +64,7 @@ android { testOptions { unitTests.returnDefaultValues = true } + } repositories { diff --git a/twidere/proguard-rules.pro b/twidere/proguard-rules.pro index f1640ee56..1f6ca8ce3 100644 --- a/twidere/proguard-rules.pro +++ b/twidere/proguard-rules.pro @@ -18,23 +18,40 @@ #-dontobfuscate --dontwarn sun.net.spi.** --dontwarn java.nio.file.** --dontwarn org.codehaus.mojo.** --dontwarn com.makeramen.roundedimageview.** -dontwarn com.squareup.haha.** --dontwarn com.google.android.gms.** --dontwarn com.google.android.youtube.** +-dontwarn com.makeramen.roundedimageview.** -dontwarn jnamed** +-dontwarn org.xbill.DNS.** -dontwarn com.bluelinelabs.logansquare.** +-dontwarn okio.** +-dontwarn android.support.** +-dontwarn com.afollestad.** +-dontwarn com.facebook.stetho.** +-dontwarn com.google.android.** +-dontwarn okhttp3.** +-dontwarn sun.net.spi.** +-dontwarn sun.misc.** +-dontwarn sun.nio.** +-dontwarn java.nio.file.** + -keepattributes *Annotation* -keepattributes EnclosingMethod +-keepattributes SourceFile +-keepattributes LineNumberTable +-keepattributes Signature +-keepattributes InnetClasses # https://github.com/bluelinelabs/LoganSquare --keep class com.bluelinelabs.logansquare.** { *; } +-keep class com.bluelinelabs.logansquare.annotation.JsonObject +-keep class * extends com.bluelinelabs.logansquare.JsonMapper -keep @com.bluelinelabs.logansquare.annotation.JsonObject class * --keep class **$$JsonObjectMapper { *; } + +-keep class org.mariotaku.twidere.api.twitter.annotation.NoObfuscate +-keep @org.mariotaku.twidere.api.twitter.annotation.NoObfuscate class * + +# https://github.com/mariotaku/RestFu +-keep class org.mariotaku.restfu.annotation.** { *; } # http://square.github.io/otto/ -keepclassmembers class ** { @@ -42,10 +59,15 @@ @com.squareup.otto.Produce public *; } --keepclassmembers class org.mariotaku.twidere.activity.BrowserSignInActivity$InjectorJavaScriptInterface { - public *; +-keep class * extends android.support.v4.view.ActionProvider +-keepclassmembers class * extends android.support.v4.view.ActionProvider { + (android.content.Context); } -# Fuck shitsung http://stackoverflow.com/a/34896262/859190 -# ... and fuck xiaomi http://crashes.to/s/675ac9aff5e --keep class !android.support.v7.view.menu.*MenuBuilder*, !org.apache.commons.** { *; } +-keepclassmembers class * { + private ; +} + +-keepclassmembers class org.mariotaku.twidere.activity.BrowserSignInActivity$InjectorJavaScriptInterface { + public *; +} \ No newline at end of file diff --git a/twidere/src/main/java/org/mariotaku/twidere/fragment/AccountsDashboardFragment.java b/twidere/src/main/java/org/mariotaku/twidere/fragment/AccountsDashboardFragment.java index 76076aa8d..64df8ceca 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/fragment/AccountsDashboardFragment.java +++ b/twidere/src/main/java/org/mariotaku/twidere/fragment/AccountsDashboardFragment.java @@ -76,7 +76,7 @@ import org.mariotaku.twidere.activity.HomeActivity; import org.mariotaku.twidere.activity.QuickSearchBarActivity; import org.mariotaku.twidere.activity.SettingsActivity; import org.mariotaku.twidere.annotation.CustomTabType; -import org.mariotaku.twidere.menu.support.AccountToggleProvider; +import org.mariotaku.twidere.menu.AccountToggleProvider; import org.mariotaku.twidere.model.ParcelableAccount; import org.mariotaku.twidere.model.SupportTabSpec; import org.mariotaku.twidere.model.UserKey; diff --git a/twidere/src/main/java/org/mariotaku/twidere/fragment/StatusFragment.java b/twidere/src/main/java/org/mariotaku/twidere/fragment/StatusFragment.java index cf29462f6..00947b4ea 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/fragment/StatusFragment.java +++ b/twidere/src/main/java/org/mariotaku/twidere/fragment/StatusFragment.java @@ -100,7 +100,7 @@ import org.mariotaku.twidere.api.twitter.model.Status; import org.mariotaku.twidere.api.twitter.model.TranslationResult; import org.mariotaku.twidere.loader.ConversationLoader; import org.mariotaku.twidere.loader.ParcelableStatusLoader; -import org.mariotaku.twidere.menu.support.FavoriteItemProvider; +import org.mariotaku.twidere.menu.FavoriteItemProvider; import org.mariotaku.twidere.model.ParcelableAccount; import org.mariotaku.twidere.model.ParcelableActivity; import org.mariotaku.twidere.model.ParcelableActivityCursorIndices; diff --git a/twidere/src/main/java/org/mariotaku/twidere/menu/support/AccountToggleProvider.java b/twidere/src/main/java/org/mariotaku/twidere/menu/AccountToggleProvider.java similarity index 98% rename from twidere/src/main/java/org/mariotaku/twidere/menu/support/AccountToggleProvider.java rename to twidere/src/main/java/org/mariotaku/twidere/menu/AccountToggleProvider.java index 9b4ac39ee..1902de123 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/menu/support/AccountToggleProvider.java +++ b/twidere/src/main/java/org/mariotaku/twidere/menu/AccountToggleProvider.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package org.mariotaku.twidere.menu.support; +package org.mariotaku.twidere.menu; import android.content.Context; import android.content.Intent; diff --git a/twidere/src/main/java/org/mariotaku/twidere/menu/support/FavoriteItemProvider.java b/twidere/src/main/java/org/mariotaku/twidere/menu/FavoriteItemProvider.java similarity index 98% rename from twidere/src/main/java/org/mariotaku/twidere/menu/support/FavoriteItemProvider.java rename to twidere/src/main/java/org/mariotaku/twidere/menu/FavoriteItemProvider.java index 0e1f1510d..95667e471 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/menu/support/FavoriteItemProvider.java +++ b/twidere/src/main/java/org/mariotaku/twidere/menu/FavoriteItemProvider.java @@ -1,4 +1,4 @@ -package org.mariotaku.twidere.menu.support; +package org.mariotaku.twidere.menu; import android.content.Context; import android.graphics.PorterDuff; diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/MenuUtils.java b/twidere/src/main/java/org/mariotaku/twidere/util/MenuUtils.java index 38c2bfb6b..17c05a9af 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/MenuUtils.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/MenuUtils.java @@ -55,7 +55,7 @@ import org.mariotaku.twidere.fragment.SetUserNicknameDialogFragment; import org.mariotaku.twidere.graphic.ActionIconDrawable; import org.mariotaku.twidere.graphic.PaddingDrawable; import org.mariotaku.twidere.menu.SupportStatusShareProvider; -import org.mariotaku.twidere.menu.support.FavoriteItemProvider; +import org.mariotaku.twidere.menu.FavoriteItemProvider; import org.mariotaku.twidere.model.ParcelableCredentials; import org.mariotaku.twidere.model.ParcelableStatus; import org.mariotaku.twidere.model.util.ParcelableCredentialsUtils; diff --git a/twidere/src/main/res/menu/action_dashboard_timeline_toggle.xml b/twidere/src/main/res/menu/action_dashboard_timeline_toggle.xml index be37cc26b..38046f997 100644 --- a/twidere/src/main/res/menu/action_dashboard_timeline_toggle.xml +++ b/twidere/src/main/res/menu/action_dashboard_timeline_toggle.xml @@ -18,13 +18,15 @@ --> + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools"> + app:showAsAction="always" + tools:ignore="AlwaysShowAction"/> + app:actionProviderClass="org.mariotaku.twidere.menu.AccountToggleProvider" + app:showAsAction="always" + tools:ignore="AlwaysShowAction"/> \ No newline at end of file diff --git a/twidere/src/main/res/menu/menu_detail_status.xml b/twidere/src/main/res/menu/menu_detail_status.xml index 52c5ea2e5..92c776cb8 100644 --- a/twidere/src/main/res/menu/menu_detail_status.xml +++ b/twidere/src/main/res/menu/menu_detail_status.xml @@ -18,7 +18,7 @@ android:id="@id/favorite" android:icon="@drawable/ic_action_heart" android:title="@string/like" - app:actionProviderClass="org.mariotaku.twidere.menu.support.FavoriteItemProvider" + app:actionProviderClass="org.mariotaku.twidere.menu.FavoriteItemProvider" app:showAsAction="always"/>