diff --git a/build.gradle b/build.gradle index 67e33cf3b..ace481869 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ buildscript { } dependencies { classpath 'com.github.ben-manes:gradle-versions-plugin:0.12.0' - classpath 'com.android.tools.build:gradle:1.5.0' + classpath 'com.android.tools.build:gradle:2.0.0-beta7' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' classpath('fr.avianey.androidsvgdrawable:gradle-plugin:3.0.0') { // should be excluded to avoid conflict @@ -75,14 +75,6 @@ subprojects { } -task clean(type: Delete) { - delete(rootProject.buildDir) -} - -task wrapper(type: Wrapper) { - gradleVersion = '2.9' -} - def loadSigningConfig(def cfg, def file) { Properties signingProp = new Properties() signingProp.load(file.newInputStream()) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 9cfe2974d..1ecd21b02 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,4 +1,4 @@ -#Wed Feb 17 21:33:36 CST 2016 +#Fri Mar 18 11:41:44 CST 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/twidere/build.gradle b/twidere/build.gradle index 0e583cb22..5f7b2f0bc 100644 --- a/twidere/build.gradle +++ b/twidere/build.gradle @@ -80,6 +80,37 @@ dependencies { apt 'com.google.dagger:dagger-compiler:2.1' apt "com.github.mariotaku.ObjectCursor:processor:0.9.6" + compile('com.github.afollestad.app-theme-engine:library:1.0.2-SNAPSHOT@aar') { + transitive = true + } + compile('com.github.afollestad.material-dialogs:commons:0.8.5.8-SNAPSHOT@aar') { + transitive = true + } + // compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.7' + + + compile project(':twidere.component.common') + compile project(':twidere.component.nyan') + + googleCompile 'com.google.android.gms:play-services-maps:8.4.0' + googleCompile 'com.google.maps.android:android-maps-utils:0.4.3' + googleCompile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') { transitive = true } + googleCompile ':YouTubeAndroidPlayerApi:1.2.2@jar' + + fdroidCompile 'org.osmdroid:osmdroid-android:5.1' + + debugCompile 'com.facebook.stetho:stetho:1.3.1' + debugCompile 'com.facebook.stetho:stetho-okhttp3:1.3.1' + debugCompile 'com.squareup.leakcanary:leakcanary-android:1.4-beta1' + + provided 'javax.annotation:jsr250-api:1.0' + + testCompile 'junit:junit:4.12' + + androidTestCompile 'com.android.support:support-annotations:23.2.1' + androidTestCompile 'com.android.support.test:runner:0.5' + androidTestCompile 'com.android.support.test:rules:0.5' + compile 'com.android.support:multidex:1.0.1' compile 'com.android.support:support-v13:23.2.1' compile 'com.android.support:appcompat-v7:23.2.1' @@ -87,8 +118,6 @@ dependencies { compile 'com.android.support:recyclerview-v7:23.2.1' compile 'com.android.support:preference-v7:23.2.1' compile 'com.android.support:preference-v14:23.2.1' - compile('com.github.afollestad.app-theme-engine:library:1.0.2-SNAPSHOT@aar') { transitive = true } - compile('com.github.afollestad.material-dialogs:commons:0.8.5.8-SNAPSHOT@aar') { transitive = true } compile 'com.twitter:twitter-text:1.13.0' compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5' compile 'com.squareup:otto:1.3.8' @@ -97,7 +126,6 @@ dependencies { compile 'com.commonsware.cwac:layouts:0.4.2' compile 'com.rengwuxian.materialedittext:library:2.1.4' compile 'com.pnikosis:materialish-progress:1.7' -// compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.7' compile 'com.github.johnpersano:supertoasts:1.3.4.1@aar' compile 'com.github.mariotaku:MessageBubbleView:1.2' compile 'com.github.mariotaku:DragSortListView:0.6.1' @@ -121,28 +149,6 @@ dependencies { compile 'com.github.mariotaku.MediaViewerLibrary:subsample-image-view:0.9.13' compile 'com.github.mariotaku.SQLiteQB:library:0.9.6' compile 'com.github.mariotaku.ObjectCursor:core:0.9.6' - - compile project(':twidere.component.common') - compile project(':twidere.component.nyan') - - googleCompile 'com.google.android.gms:play-services-maps:8.4.0' - googleCompile 'com.google.maps.android:android-maps-utils:0.4.3' - googleCompile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') { transitive = true } - googleCompile ':YouTubeAndroidPlayerApi:1.2.2@jar' - - fdroidCompile 'org.osmdroid:osmdroid-android:5.1' - - debugCompile 'com.facebook.stetho:stetho:1.3.1' - debugCompile 'com.facebook.stetho:stetho-okhttp3:1.3.1' - debugCompile 'com.squareup.leakcanary:leakcanary-android:1.4-beta1' - - provided 'javax.annotation:jsr250-api:1.0' - - testCompile 'junit:junit:4.12' - - androidTestCompile 'com.android.support:support-annotations:23.2.1' - androidTestCompile 'com.android.support.test:runner:0.5' - androidTestCompile 'com.android.support.test:rules:0.5' } task svgToDrawable(type: SvgDrawableTask) { diff --git a/twidere/src/main/AndroidManifest.xml b/twidere/src/main/AndroidManifest.xml index e8879488f..78095b582 100644 --- a/twidere/src/main/AndroidManifest.xml +++ b/twidere/src/main/AndroidManifest.xml @@ -1,69 +1,67 @@ - + package="org.mariotaku.twidere" + android:installLocation="auto" > - + + android:required="false" /> + android:required="false" /> + android:required="false" /> + android:required="false" /> + android:required="false" /> + android:required="false" /> - - - - - - - - - - - - + android:required="true" /> + + + + + + + + + + + + tools:node="remove" /> + android:label="@string/app_name" /> + android:permissionGroup="org.mariotaku.twidere.permission.PERMISSION_GROUP" /> + android:permissionGroup="org.mariotaku.twidere.permission.PERMISSION_GROUP" /> + android:permissionGroup="org.mariotaku.twidere.permission.PERMISSION_GROUP" /> + tools:ignore="UnusedAttribute" > + android:required="false" /> - + android:value="dc4ee756d3b705e00011782f1426fc8656ad3bd9" /> + android:value="AEdPqrEAAAAIKbKATV1AGbLB4kem3w8QaPVJSPVVumbMHxkfwA" /> + android:value="true" /> + android:value="480dp" /> + android:value="640dp" /> + android:value="240dp" /> + android:value="320dp" /> + android:value="true" /> + android:windowSoftInputMode="adjustNothing" > - + - - - + + + + android:windowSoftInputMode="adjustResize" > - + - - - + + + + android:windowSoftInputMode="adjustResize" > - + - + - + - + + android:resource="@xml/searchable" /> + android:value=".activity.support.HomeActivity" /> - - - - - - - - + android:windowSoftInputMode="adjustResize" > + + + + + + + + - + - - - + + + - + - - + + + android:value=".activity.HomeActivity" /> + android:windowSoftInputMode="adjustResize" > - + - + + android:windowSoftInputMode="adjustResize" > - + - + + android:windowSoftInputMode="adjustResize" > - + - + + android:windowSoftInputMode="adjustResize" > - - + + - + + android:value=".activity.HomeActivity" /> + android:windowSoftInputMode="adjustResize" /> + android:theme="@style/Theme.Twidere.Dialog" > - + - + + android:theme="@style/Theme.Twidere.NoDisplay" /> + android:windowSoftInputMode="adjustResize" > + android:value=".activity.HomeActivity" /> - + - - + + - + - + android:windowSoftInputMode="adjustPan" > + android:value=".activity.HomeActivity" /> - + - - + + - - - + + + + android:windowSoftInputMode="adjustResize" > - - + + - + + android:windowSoftInputMode="adjustResize" > - - - + + + - + + android:windowSoftInputMode="adjustResize" > - - + + - + + android:theme="@style/Theme.Twidere.NoDisplay" > - + - + + android:theme="@style/Theme.Twidere.NoDisplay" /> + android:theme="@style/Theme.Twidere.Dialog" > - + - + + android:theme="@style/Theme.Twidere.Dialog" > - - + + - + + android:theme="@style/Theme.Twidere.NoActionBar" /> + android:theme="@style/Theme.Twidere.NoDisplay" /> + android:theme="@style/Theme.Twidere.NoDisplay" /> + android:theme="@style/Theme.Twidere.Dialog" > - + - + + android:theme="@style/Theme.Twidere.NoDisplay" > + android:scheme="http" /> + android:scheme="https" /> + android:scheme="http" /> + android:scheme="https" /> + android:scheme="http" /> + android:scheme="https" /> - - + + - - + + + android:theme="@style/Theme.Twidere.NoDisplay" > - + - + + android:resource="@drawable/ic_assist_twidere" /> + android:theme="@style/Theme.Twidere.Dialog" /> + android:windowSoftInputMode="adjustResize" > - + - + + android:windowSoftInputMode="stateAlwaysHidden" /> + android:theme="@style/Theme.Twidere.NoDisplay" /> + android:windowSoftInputMode="adjustResize" /> + android:label="@string/label_refresh_service" /> + android:label="@string/label_streaming_service" /> + android:label="@string/label_background_operation_service" /> - - + android:process=":wallpaper" > + + + android:resource="@xml/nyan_wallpaper" /> - - + tools:ignore="ExportedService" > + + - + + tools:ignore="ExportedContentProvider" /> + tools:ignore="ExportedContentProvider" /> + android:grantUriPermissions="true" > + android:resource="@xml/file_paths" /> + android:exported="false" /> - + - + + android:exported="false" > - + + android:label="@string/twidere_test" > - + + android:scheme="android_secret_code" /> - + - - - - + + + + - - + \ No newline at end of file diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/KeyboardShortcutsHandler.java b/twidere/src/main/java/org/mariotaku/twidere/util/KeyboardShortcutsHandler.java index 802063ac7..53a75fc66 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/KeyboardShortcutsHandler.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/KeyboardShortcutsHandler.java @@ -14,7 +14,6 @@ import org.mariotaku.twidere.Constants; import org.mariotaku.twidere.R; import org.mariotaku.twidere.activity.ComposeActivity; import org.mariotaku.twidere.activity.QuickSearchBarActivity; -import org.mariotaku.twidere.app.TwidereApplication; import org.mariotaku.twidere.constant.KeyboardShortcutConstants; import java.util.HashMap; @@ -64,8 +63,9 @@ public class KeyboardShortcutsHandler implements Constants, KeyboardShortcutCons private final SharedPreferencesWrapper mPreferences; - public KeyboardShortcutsHandler(final TwidereApplication context) { - mPreferences = SharedPreferencesWrapper.getInstance(context, KEYBOARD_SHORTCUTS_PREFERENCES_NAME, Context.MODE_PRIVATE); + public KeyboardShortcutsHandler(final Context context) { + mPreferences = SharedPreferencesWrapper.getInstance(context, + KEYBOARD_SHORTCUTS_PREFERENCES_NAME, Context.MODE_PRIVATE); } public String findAction(@NonNull KeyboardShortcutSpec spec) { diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/NotificationManagerWrapper.java b/twidere/src/main/java/org/mariotaku/twidere/util/NotificationManagerWrapper.java index 48bfaacfa..a8d958e07 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/NotificationManagerWrapper.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/NotificationManagerWrapper.java @@ -19,12 +19,11 @@ package org.mariotaku.twidere.util; +import android.app.Application; import android.app.Notification; import android.app.NotificationManager; import android.content.Context; -import org.mariotaku.twidere.app.TwidereApplication; - import java.util.ArrayList; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; @@ -36,8 +35,8 @@ public class NotificationManagerWrapper { private final NotificationManager notificationManager; private final List notifications = new CopyOnWriteArrayList<>(); - public NotificationManagerWrapper(TwidereApplication application) { - notificationManager = (NotificationManager) application.getSystemService(Context.NOTIFICATION_SERVICE); + public NotificationManagerWrapper(Context context) { + notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); } public void notify(String tag, int id, Notification notification) { diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/dagger/ApplicationModule.java b/twidere/src/main/java/org/mariotaku/twidere/util/dagger/ApplicationModule.java index b03fb0d0a..2600e8403 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/dagger/ApplicationModule.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/dagger/ApplicationModule.java @@ -19,6 +19,7 @@ package org.mariotaku.twidere.util.dagger; +import android.app.Application; import android.content.Context; import android.os.Looper; import android.support.annotation.NonNull; @@ -39,7 +40,6 @@ import org.mariotaku.mediaviewer.library.MediaDownloader; import org.mariotaku.restfu.http.RestHttpClient; import org.mariotaku.twidere.BuildConfig; import org.mariotaku.twidere.Constants; -import org.mariotaku.twidere.app.TwidereApplication; import org.mariotaku.twidere.constant.SharedPreferenceConstants; import org.mariotaku.twidere.util.ActivityTracker; import org.mariotaku.twidere.util.AsyncTaskManager; @@ -83,9 +83,11 @@ import static org.mariotaku.twidere.util.Utils.getInternalCacheDir; @Module public class ApplicationModule implements Constants { - private final TwidereApplication application; + private static ApplicationModule sApplicationModule; - public ApplicationModule(TwidereApplication application) { + private final Application application; + + public ApplicationModule(Application application) { if (Thread.currentThread() != Looper.getMainLooper().getThread()) { throw new RuntimeException("Module must be created inside main thread"); } @@ -93,7 +95,9 @@ public class ApplicationModule implements Constants { } static ApplicationModule get(@NonNull Context context) { - return TwidereApplication.getInstance(context).getApplicationModule(); + if (sApplicationModule != null) return sApplicationModule; + Application application = (Application) context.getApplicationContext(); + return sApplicationModule = new ApplicationModule(application); } @Provides diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/imageloader/TwidereImageDownloader.java b/twidere/src/main/java/org/mariotaku/twidere/util/imageloader/TwidereImageDownloader.java index bb335f773..cc76134e1 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/imageloader/TwidereImageDownloader.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/imageloader/TwidereImageDownloader.java @@ -49,14 +49,13 @@ public class TwidereImageDownloader extends BaseImageDownloader implements Const } @Override - protected InputStream getStreamFromNetwork(final String uriString, final Object extras) throws IOException { + protected InputStream getStreamFromNetwork(String uriString, final Object extras) throws IOException { if (uriString == null) return null; try { if (isTwitterProfileImage(uriString)) { - final String replaced = Utils.getTwitterProfileImageOfSize(uriString, mTwitterProfileImageSize); - return getStreamFromNetworkInternal(replaced, extras); - } else - return getStreamFromNetworkInternal(uriString, extras); + uriString = Utils.getTwitterProfileImageOfSize(uriString, mTwitterProfileImageSize); + } + return getStreamFromNetworkInternal(uriString, extras); } catch (final FileNotFoundException e) { if (isTwitterProfileImage(uriString) && !uriString.contains("_normal.")) { return getStreamFromNetworkInternal(Utils.getNormalTwitterProfileImage(uriString), extras); diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/media/TwidereMediaDownloader.java b/twidere/src/main/java/org/mariotaku/twidere/util/media/TwidereMediaDownloader.java index d309ebbe6..a98c28ab0 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/media/TwidereMediaDownloader.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/media/TwidereMediaDownloader.java @@ -37,6 +37,7 @@ import org.mariotaku.twidere.util.UserAgentUtils; import org.mariotaku.twidere.util.media.preview.PreviewMediaExtractor; import org.mariotaku.twidere.util.net.NoIntercept; +import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; @@ -162,7 +163,12 @@ public class TwidereMediaDownloader implements MediaDownloader, Constants { builder.tag(NoIntercept.INSTANCE); final HttpResponse resp = mClient.newCall(builder.build()).execute(); if (!resp.isSuccessful()) { - throw new IOException("Unable to get media, response code: " + resp.getStatus()); + final String detailMessage = "Unable to get " + requestUri + ", response code: " + + resp.getStatus(); + if (resp.getStatus() == 404) { + throw new FileNotFoundException(detailMessage); + } + throw new IOException(detailMessage); } final Body body = resp.getBody(); final CacheMetadata metadata = new CacheMetadata(); diff --git a/twidere/src/main/res/layout/layout_actionbar_message_user_picker.xml b/twidere/src/main/res/layout/layout_actionbar_message_user_picker.xml index b57318fb0..71bd0ed23 100644 --- a/twidere/src/main/res/layout/layout_actionbar_message_user_picker.xml +++ b/twidere/src/main/res/layout/layout_actionbar_message_user_picker.xml @@ -19,6 +19,7 @@ - @@ -38,8 +38,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:layout_toEndOf="@+id/account_spinner" - android:layout_toRightOf="@+id/account_spinner" - android:padding="@dimen/element_spacing_small"> + android:layout_toRightOf="@+id/account_spinner"> + android:tag="tint|primary_color_dependent,text_color|primary_color_dependent"> - + android:src="@drawable/ic_action_search" + android:tag="tint|primary_color_dependent" + app:backgroundTintMode="src_atop"/> \ No newline at end of file