mirror of
https://github.com/TwidereProject/Twidere-Android
synced 2025-02-08 15:58:40 +01:00
Merge pull request #1322 from TacoTheDank/maintenance
Lots of updates and code cleanup
This commit is contained in:
commit
6a155650d3
52
build.gradle
52
build.gradle
@ -8,7 +8,7 @@ buildscript {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.6.3'
|
||||
classpath 'com.android.tools.build:gradle:4.0.0'
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
}
|
||||
@ -39,54 +39,18 @@ subprojects {
|
||||
buildscript {
|
||||
ext {
|
||||
kotlinVersion = '1.3.72'
|
||||
pluginVersions = [
|
||||
AndroidSvgDrawable: '3.0.0',
|
||||
PlayServices : '4.3.3',
|
||||
]
|
||||
libVersions = [
|
||||
sharedVersions = [
|
||||
Kotlin : "${kotlinVersion}",
|
||||
SupportTest : '1.0.0',
|
||||
MariotakuCommons : '0.9.20',
|
||||
RestFu : '0.9.60',
|
||||
ObjectCursor : '0.9.21',
|
||||
PlayServices : '17.0.0',
|
||||
MapsUtils : '0.6.2',
|
||||
DropboxCoreSdk : '3.1.3',
|
||||
GoogleDriveApi : 'v3-rev193-1.25.0',
|
||||
Exoplayer : '2.11.4',
|
||||
Toro : '2.1.0',
|
||||
|
||||
LoganSquare : '1.3.7',
|
||||
IABv3 : '1.1.0',
|
||||
Mime4J : '0.7.2',
|
||||
OkHttp : '3.8.1',
|
||||
Stetho : '1.5.0',
|
||||
OSMDroid : '5.6.5',
|
||||
LeakCanary : '2.1',
|
||||
TwitterText : '1.14.7',
|
||||
MediaViewerLibrary : '0.9.23',
|
||||
MultiValueSwitch : '0.9.8',
|
||||
PickNCrop : '0.9.27',
|
||||
AndroidGIFDrawable : '1.2.6',
|
||||
KPreferences : '0.9.7',
|
||||
Kovenant : '3.3.0',
|
||||
Jackson : '2.7.4',
|
||||
ParcelablePlease : '1.0.2',
|
||||
Chameleon : '0.9.28',
|
||||
UniqR : '0.9.4',
|
||||
SQLiteQB : '0.9.15',
|
||||
Glide : '4.11.0',
|
||||
GlideOkHttp3 : '4.11.0',
|
||||
GlideTransformations : '4.1.0',
|
||||
AndroidImageCropper : '2.4.6',
|
||||
|
||||
ExportablePreferences: '0.9.7',
|
||||
ACRA : '4.9.2',
|
||||
AbstractTask : '0.9.5',
|
||||
Dagger : '2.11',
|
||||
StethoBeanShellREPL : '0.1',
|
||||
MessageBubbleView : '3.5',
|
||||
MariotakuCommons : '0.9.20',
|
||||
ObjectCursor : '0.9.21',
|
||||
RestFu : '0.9.60',
|
||||
]
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
org.gradle.jvmargs=-Xmx3584m
|
||||
#https://github.com/TwidereProject/Twidere-Android/issues/963
|
||||
android.enableAapt2=false
|
||||
# android.enableAapt2=false
|
||||
android.useAndroidX=true
|
||||
android.enableJetifier=true
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4.1-all.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
2
gradlew
vendored
2
gradlew
vendored
@ -82,6 +82,7 @@ esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
@ -129,6 +130,7 @@ fi
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
|
1
gradlew.bat
vendored
1
gradlew.bat
vendored
@ -84,6 +84,7 @@ set CMD_LINE_ARGS=%*
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
|
@ -38,8 +38,8 @@ buildscript {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
|
||||
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
|
||||
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
|
||||
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5'
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,12 +58,19 @@ android {
|
||||
versionCode projectVersionCode
|
||||
versionName projectVersionName
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
encoding = 'UTF-8'
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@ -72,23 +79,23 @@ dependencies {
|
||||
|
||||
|
||||
/** Third-party dependencies **/
|
||||
implementation "com.bluelinelabs:logansquare:${libVersions['LoganSquare']}"
|
||||
annotationProcessor "com.bluelinelabs:logansquare-compiler:${libVersions['LoganSquare']}"
|
||||
implementation "com.fasterxml.jackson.core:jackson-core:2.7.4"
|
||||
implementation "com.hannesdorfmann.parcelableplease:annotation:${libVersions['ParcelablePlease']}"
|
||||
annotationProcessor "com.hannesdorfmann.parcelableplease:processor:${libVersions['ParcelablePlease']}"
|
||||
implementation "com.bluelinelabs:logansquare:${sharedVersions['LoganSquare']}"
|
||||
annotationProcessor "com.bluelinelabs:logansquare-compiler:${sharedVersions['LoganSquare']}"
|
||||
implementation "com.fasterxml.jackson.core:jackson-core:${sharedVersions['Jackson']}"
|
||||
implementation "com.hannesdorfmann.parcelableplease:annotation:${sharedVersions['ParcelablePlease']}"
|
||||
annotationProcessor "com.hannesdorfmann.parcelableplease:processor:${sharedVersions['ParcelablePlease']}"
|
||||
|
||||
|
||||
/** Custom dependencies **/
|
||||
implementation "com.github.mariotaku.RestFu:library:${libVersions['RestFu']}"
|
||||
implementation "com.github.mariotaku.RestFu:oauth:${libVersions['RestFu']}"
|
||||
implementation "com.github.mariotaku.RestFu:oauth2:${libVersions['RestFu']}"
|
||||
implementation "com.github.mariotaku.ObjectCursor:core:${libVersions['ObjectCursor']}"
|
||||
annotationProcessor "com.github.mariotaku.ObjectCursor:processor:${libVersions['ObjectCursor']}"
|
||||
implementation "com.github.mariotaku.ExportablePreferences:core:${libVersions['ExportablePreferences']}"
|
||||
annotationProcessor "com.github.mariotaku.ExportablePreferences:processor:${libVersions['ExportablePreferences']}"
|
||||
implementation "com.github.mariotaku.CommonsLibrary:objectcursor:${libVersions['MariotakuCommons']}"
|
||||
implementation "com.github.mariotaku.CommonsLibrary:logansquare:${libVersions['MariotakuCommons']}"
|
||||
implementation "com.github.mariotaku.ExportablePreferences:core:${sharedVersions['ExportablePreferences']}"
|
||||
annotationProcessor "com.github.mariotaku.ExportablePreferences:processor:${sharedVersions['ExportablePreferences']}"
|
||||
implementation "com.github.mariotaku.CommonsLibrary:logansquare:${sharedVersions['MariotakuCommons']}"
|
||||
implementation "com.github.mariotaku.CommonsLibrary:objectcursor:${sharedVersions['MariotakuCommons']}"
|
||||
implementation "com.github.mariotaku.ObjectCursor:core:${sharedVersions['ObjectCursor']}"
|
||||
annotationProcessor "com.github.mariotaku.ObjectCursor:processor:${sharedVersions['ObjectCursor']}"
|
||||
implementation "com.github.mariotaku.RestFu:library:${sharedVersions['RestFu']}"
|
||||
implementation "com.github.mariotaku.RestFu:oauth:${sharedVersions['RestFu']}"
|
||||
implementation "com.github.mariotaku.RestFu:oauth2:${sharedVersions['RestFu']}"
|
||||
}
|
||||
|
||||
install {
|
||||
|
@ -206,7 +206,7 @@ public class MicroBlogException extends Exception implements TwitterResponse, Ht
|
||||
try {
|
||||
final String retryAfterStr = httpResponse.getHeader("Retry-After");
|
||||
if (retryAfterStr != null) {
|
||||
retryAfter = Integer.valueOf(retryAfterStr);
|
||||
retryAfter = Integer.parseInt(retryAfterStr);
|
||||
}
|
||||
} catch (final NumberFormatException ignore) {
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ public class CardDataMap implements ValueMap {
|
||||
@Override
|
||||
public String[] keys() {
|
||||
final Set<String> keySet = map.keySet();
|
||||
return keySet.toArray(new String[keySet.size()]);
|
||||
return keySet.toArray(new String[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -37,7 +37,6 @@ import java.util.List;
|
||||
@Keep
|
||||
public class IDs$$JsonObjectMapper extends JsonMapper<IDs> {
|
||||
|
||||
@SuppressWarnings("TryWithIdenticalCatches")
|
||||
@Override
|
||||
public IDs parse(JsonParser jsonParser) throws IOException {
|
||||
IDs instance = new IDs();
|
||||
|
@ -61,11 +61,8 @@ public final class ResponseList$$JsonObjectMapper<T> extends JsonMapper<Response
|
||||
|
||||
@Override
|
||||
public void parseField(ResponseList<T> instance, String fieldName, JsonParser jsonParser) throws IOException {
|
||||
switch (fieldName) {
|
||||
case "results": {
|
||||
instance.addAll(m84ClassJsonMapper.parseList(jsonParser));
|
||||
break;
|
||||
}
|
||||
if ("results".equals(fieldName)) {
|
||||
instance.addAll(m84ClassJsonMapper.parseList(jsonParser));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -250,7 +250,7 @@ public class UniversalSearchResult {
|
||||
index.end = jsonParser.nextIntValue(-1);
|
||||
list.add(index);
|
||||
}
|
||||
return list.toArray(new Index[list.size()]);
|
||||
return list.toArray(new Index[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -52,12 +52,9 @@ public final class InternalParseUtil {
|
||||
accessLevel = TwitterResponse.AccessLevel.READ_WRITE;
|
||||
break;
|
||||
case 25:
|
||||
// “read-write-directmessages” (Read, Write, & Direct
|
||||
// Message)
|
||||
accessLevel = TwitterResponse.AccessLevel.READ_WRITE_DIRECTMESSAGES;
|
||||
break;
|
||||
case 26:
|
||||
// “read-write-privatemessages” (Read, Write, & Direct
|
||||
// “read-write-directmessages” (Read, Write, & Direct
|
||||
// Message)
|
||||
accessLevel = TwitterResponse.AccessLevel.READ_WRITE_DIRECTMESSAGES;
|
||||
break;
|
||||
|
@ -56,6 +56,5 @@ public @interface FilterScope {
|
||||
|
||||
// Contains all flags
|
||||
int ALL = 0xFFFFFFFF;
|
||||
@SuppressWarnings("PointlessBitwiseExpression")
|
||||
int DEFAULT = ALL & ~(TARGET_NAME | TARGET_DESCRIPTION);
|
||||
}
|
||||
|
@ -40,7 +40,6 @@ import java.util.Arrays;
|
||||
@JsonObject
|
||||
@ParcelablePlease
|
||||
public class ParcelableMedia implements Parcelable {
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@NonNull
|
||||
@JsonField(name = "url")
|
||||
@ParcelableThisPlease
|
||||
|
@ -31,7 +31,6 @@ import com.hannesdorfmann.parcelableplease.annotation.ParcelablePlease;
|
||||
@ParcelablePlease
|
||||
public class ParcelableMediaUpdate implements Parcelable {
|
||||
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@NonNull
|
||||
@JsonField(name = "uri")
|
||||
public String uri;
|
||||
|
@ -20,7 +20,6 @@ package org.mariotaku.twidere.model;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import androidx.annotation.IntDef;
|
||||
import androidx.annotation.LongDef;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@ -52,13 +51,7 @@ import java.util.Comparator;
|
||||
@ParcelablePlease
|
||||
public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus>, Cloneable {
|
||||
|
||||
public static final Comparator<ParcelableStatus> REVERSE_COMPARATOR = new Comparator<ParcelableStatus>() {
|
||||
|
||||
@Override
|
||||
public int compare(final ParcelableStatus object1, final ParcelableStatus object2) {
|
||||
return object2.compareTo(object1);
|
||||
}
|
||||
};
|
||||
public static final Comparator<ParcelableStatus> REVERSE_COMPARATOR = (object1, object2) -> object2.compareTo(object1);
|
||||
public static final Creator<ParcelableStatus> CREATOR = new Creator<ParcelableStatus>() {
|
||||
@Override
|
||||
public ParcelableStatus createFromParcel(Parcel source) {
|
||||
@ -75,13 +68,11 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
|
||||
@CursorField(value = Statuses._ID, excludeWrite = true, type = TwidereDataStore.TYPE_PRIMARY_KEY)
|
||||
public long _id;
|
||||
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@JsonField(name = "id")
|
||||
@CursorField(Statuses.ID)
|
||||
@NonNull
|
||||
public String id;
|
||||
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@JsonField(name = "account_id", typeConverter = UserKeyConverter.class)
|
||||
@CursorField(value = Statuses.ACCOUNT_KEY, converter = UserKeyCursorFieldConverter.class)
|
||||
@NonNull
|
||||
@ -98,7 +89,6 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
|
||||
@JsonField(name = "timestamp")
|
||||
@CursorField(Statuses.TIMESTAMP)
|
||||
public long timestamp;
|
||||
@SuppressWarnings("NullableProblems")
|
||||
|
||||
@JsonField(name = "user_id", typeConverter = UserKeyConverter.class)
|
||||
@CursorField(value = Statuses.USER_KEY, converter = UserKeyCursorFieldConverter.class)
|
||||
|
@ -41,7 +41,6 @@ import java.util.Arrays;
|
||||
@JsonObject
|
||||
public class ParcelableStatusUpdate implements Parcelable {
|
||||
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@JsonField(name = "accounts")
|
||||
@NonNull
|
||||
@ParcelableThisPlease
|
||||
|
@ -45,7 +45,6 @@ public class ParcelableTrend implements Parcelable {
|
||||
|
||||
@CursorField(value = CachedTrends._ID, excludeWrite = true, type = TwidereDataStore.TYPE_PRIMARY_KEY)
|
||||
long _id;
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@ParcelableThisPlease
|
||||
@JsonField(name = "account_id", typeConverter = UserKeyConverter.class)
|
||||
@CursorField(value = CachedTrends.ACCOUNT_KEY, converter = UserKeyCursorFieldConverter.class)
|
||||
|
@ -35,10 +35,8 @@ import java.io.IOException;
|
||||
public abstract class ConversationExtras implements Parcelable {
|
||||
public static ConversationExtras parse(@NonNull final String extrasType, @Nullable final String json) throws IOException {
|
||||
if (json == null) return null;
|
||||
switch (extrasType) {
|
||||
case ExtrasType.TWITTER_OFFICIAL: {
|
||||
return LoganSquare.parse(json, TwitterOfficialConversationExtras.class);
|
||||
}
|
||||
if (ExtrasType.TWITTER_OFFICIAL.equals(extrasType)) {
|
||||
return LoganSquare.parse(json, TwitterOfficialConversationExtras.class);
|
||||
}
|
||||
return LoganSquare.parse(json, DefaultConversationExtras.class);
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ public class UserKeysConverter implements TypeConverter<UserKey[]> {
|
||||
while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
|
||||
list.add(UserKey.valueOf(jsonParser.getValueAsString()));
|
||||
}
|
||||
return list.toArray(new UserKey[list.size()]);
|
||||
return list.toArray(new UserKey[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -29,6 +29,12 @@ android {
|
||||
minSdkVersion globalMinSdkVersion
|
||||
targetSdkVersion globalTargetSdkVersion
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
encoding = 'UTF-8'
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
@ -314,7 +314,7 @@ public class NyanDrawingHelper {
|
||||
public void dispatchOnDraw(final Canvas canvas) {
|
||||
final int w = canvas.getWidth(), h = canvas.getHeight();
|
||||
if (w <= 0 || h <= 0) return;
|
||||
for (final Star star : mStars.toArray(new Star[mStars.size()])) {
|
||||
for (final Star star : mStars.toArray(new Star[0])) {
|
||||
final int col = star.nextColumn(), row = star.nextRow();
|
||||
final float y = (row + 0.5f) * (h / mStarRows), x = (col + 0.5f) * (w / mStarCols);
|
||||
drawStar(canvas, x, y, star.nextFrame());
|
||||
|
@ -25,7 +25,7 @@ buildscript {
|
||||
|
||||
if (enableGoogleVariant) {
|
||||
// START Non-FOSS component
|
||||
classpath "com.google.gms:google-services:${pluginVersions['PlayServices']}"
|
||||
classpath 'com.google.gms:google-services:4.3.3'
|
||||
// END Non-FOSS component
|
||||
}
|
||||
}
|
||||
@ -91,9 +91,6 @@ android {
|
||||
signingConfig signingConfigs.twidere
|
||||
}
|
||||
|
||||
multiDexEnabled true
|
||||
minifyEnabled false
|
||||
shrinkResources false
|
||||
resValue("bool", "debug", "true")
|
||||
}
|
||||
release {
|
||||
@ -101,7 +98,6 @@ android {
|
||||
signingConfig signingConfigs.twidere
|
||||
}
|
||||
|
||||
multiDexEnabled true
|
||||
minifyEnabled false
|
||||
shrinkResources false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
@ -115,6 +111,7 @@ android {
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
encoding = 'UTF-8'
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
@ -145,7 +142,6 @@ android {
|
||||
exclude 'sdk-version.txt'
|
||||
exclude 'build-data.properties'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
task buildTranslationArray {
|
||||
@ -153,16 +149,16 @@ task buildTranslationArray {
|
||||
foundLocales.append("new String[]{")
|
||||
|
||||
fileTree("src/main/res-localized").visit { FileVisitDetails details ->
|
||||
if(details.file.path.endsWith("strings.xml")){
|
||||
def languageCode = details.file.parentFile.name.replaceAll('values-','').replaceAll('-r','-')
|
||||
languageCode = (languageCode == "values") ? "en" : languageCode;
|
||||
if (details.file.path.endsWith("strings.xml")) {
|
||||
def languageCode = details.file.parentFile.name.replaceAll('values-', '').replaceAll('-r', '-')
|
||||
languageCode = (languageCode == "values") ? "en" : languageCode
|
||||
foundLocales.append("\"").append(languageCode).append("\"").append(",")
|
||||
}
|
||||
}
|
||||
|
||||
foundLocales.append("}")
|
||||
//Don't forget to remove the trailing comma
|
||||
def foundLocalesString = foundLocales.toString().replaceAll(',}','}')
|
||||
def foundLocalesString = foundLocales.toString().replaceAll(',}', '}')
|
||||
android.defaultConfig.buildConfigField "String[]", "TRANSLATION_ARRAY", foundLocalesString
|
||||
}
|
||||
|
||||
@ -175,12 +171,25 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
|
||||
}
|
||||
}
|
||||
|
||||
ext {
|
||||
libVersions = [
|
||||
Kovenant : '3.3.0',
|
||||
Mime4J : '0.7.2',
|
||||
Dagger : '2.28',
|
||||
Exoplayer : '2.11.4',
|
||||
Glide : '4.11.0',
|
||||
MediaViewerLibrary: '0.9.23',
|
||||
PlayServices : '17.0.0',
|
||||
Stetho : '1.5.1',
|
||||
]
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(':twidere.component.common')
|
||||
implementation project(':twidere.component.nyan')
|
||||
|
||||
/** Kotlin **/
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:${libVersions['Kotlin']}"
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:${sharedVersions['Kotlin']}"
|
||||
implementation "nl.komponents.kovenant:kovenant:${libVersions['Kovenant']}"
|
||||
implementation "nl.komponents.kovenant:kovenant-android:${libVersions['Kovenant']}"
|
||||
implementation "nl.komponents.kovenant:kovenant-combine:${libVersions['Kovenant']}"
|
||||
@ -193,99 +202,98 @@ dependencies {
|
||||
implementation 'androidx.browser:browser:1.2.0'
|
||||
implementation 'androidx.cardview:cardview:1.0.0'
|
||||
implementation 'androidx.core:core:1.2.0'
|
||||
implementation 'androidx.core:core-ktx:1.2.0'
|
||||
implementation 'androidx.drawerlayout:drawerlayout:1.1.0-alpha01'
|
||||
implementation 'androidx.exifinterface:exifinterface:1.1.0'
|
||||
implementation "androidx.preference:preference:1.1.1"
|
||||
implementation 'androidx.exifinterface:exifinterface:1.2.0'
|
||||
implementation 'androidx.legacy:legacy-support-core-ui:1.0.0'
|
||||
implementation 'androidx.multidex:multidex:2.0.1'
|
||||
implementation 'androidx.palette:palette:1.0.0'
|
||||
implementation 'androidx.palette:palette-ktx:1.0.0'
|
||||
implementation 'androidx.preference:preference:1.1.1'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.1.0'
|
||||
implementation 'com.google.android.material:material:1.1.0'
|
||||
implementation "androidx.core:core-ktx:1.2.0"
|
||||
|
||||
|
||||
/** Third-party dependencies **/
|
||||
compileOnly 'javax.annotation:jsr250-api:1.0'
|
||||
implementation "com.twitter:twitter-text:${libVersions['TwitterText']}"
|
||||
implementation 'com.twitter:twitter-text:1.14.7'
|
||||
implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0'
|
||||
implementation 'com.squareup:otto:1.3.8'
|
||||
implementation 'dnsjava:dnsjava:2.1.8'
|
||||
implementation 'com.commonsware.cwac:layouts:0.4.3'
|
||||
implementation 'dnsjava:dnsjava:2.1.9'
|
||||
implementation 'com.commonsware.cwac:layouts:0.4.5'
|
||||
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
|
||||
implementation 'com.pnikosis:materialish-progress:1.7'
|
||||
implementation 'com.github.uucky:ColorPicker-Android:0.9.7@aar'
|
||||
implementation "pl.droidsonroids.gif:android-gif-drawable:${libVersions['AndroidGIFDrawable']}"
|
||||
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.15'
|
||||
implementation 'com.sprylab.android.texturevideoview:texturevideoview:1.2.1'
|
||||
implementation 'com.squareup:pollexor:2.0.4'
|
||||
implementation "org.apache.james:apache-mime4j-core:${libVersions['Mime4J']}"
|
||||
implementation "org.apache.james:apache-mime4j-storage:${libVersions['Mime4J']}"
|
||||
implementation "com.bluelinelabs:logansquare:${libVersions['LoganSquare']}"
|
||||
kapt "com.bluelinelabs:logansquare-compiler:${libVersions['LoganSquare']}"
|
||||
implementation "com.fasterxml.jackson.core:jackson-core:2.7.4"
|
||||
implementation "com.hannesdorfmann.parcelableplease:annotation:${libVersions['ParcelablePlease']}"
|
||||
kapt "com.hannesdorfmann.parcelableplease:processor:${libVersions['ParcelablePlease']}"
|
||||
implementation "com.squareup.okhttp3:okhttp:${libVersions['OkHttp']}"
|
||||
implementation "com.squareup.okio:okio:2.4.3"
|
||||
implementation "com.bluelinelabs:logansquare:${sharedVersions['LoganSquare']}"
|
||||
kapt "com.bluelinelabs:logansquare-compiler:${sharedVersions['LoganSquare']}"
|
||||
implementation "com.fasterxml.jackson.core:jackson-core:${sharedVersions['Jackson']}"
|
||||
implementation "com.hannesdorfmann.parcelableplease:annotation:${sharedVersions['ParcelablePlease']}"
|
||||
kapt "com.hannesdorfmann.parcelableplease:processor:${sharedVersions['ParcelablePlease']}"
|
||||
implementation 'com.squareup.okhttp3:okhttp:3.12.12'
|
||||
implementation 'com.squareup.okio:okio:2.6.0'
|
||||
implementation 'com.lnikkila:extendedtouchview:0.1.1'
|
||||
implementation "com.google.dagger:dagger:${libVersions['Dagger']}"
|
||||
kapt "com.google.dagger:dagger-compiler:${libVersions['Dagger']}"
|
||||
implementation 'org.attoparser:attoparser:2.0.4.RELEASE'
|
||||
implementation 'com.getkeepsafe.taptargetview:taptargetview:1.9.1'
|
||||
implementation 'net.ypresto.androidtranscoder:android-transcoder:0.2.0'
|
||||
implementation 'org.attoparser:attoparser:2.0.5.RELEASE'
|
||||
implementation 'com.getkeepsafe.taptargetview:taptargetview:1.13.0'
|
||||
implementation 'net.ypresto.androidtranscoder:android-transcoder:0.3.0'
|
||||
implementation "com.google.android.exoplayer:exoplayer-core:${libVersions['Exoplayer']}"
|
||||
implementation "com.google.android.exoplayer:exoplayer-ui:${libVersions['Exoplayer']}"
|
||||
implementation "com.google.android.exoplayer:extension-okhttp:${libVersions['Exoplayer']}"
|
||||
implementation "com.github.bumptech.glide:glide:${libVersions['Glide']}"
|
||||
implementation "com.github.bumptech.glide:okhttp3-integration:${libVersions['GlideOkHttp3']}@aar"
|
||||
implementation "com.github.bumptech.glide:okhttp3-integration:${libVersions['Glide']}@aar"
|
||||
kapt "com.github.bumptech.glide:compiler:${libVersions['Glide']}"
|
||||
implementation "jp.wasabeef:glide-transformations:${libVersions['GlideTransformations']}"
|
||||
implementation "com.theartofdev.edmodo:android-image-cropper:${libVersions['AndroidImageCropper']}"
|
||||
implementation 'jp.wasabeef:glide-transformations:4.1.0'
|
||||
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
|
||||
|
||||
|
||||
/** Custom dependencies **/
|
||||
implementation 'com.github.mariotaku:AbstractTask:0.9.5'
|
||||
implementation 'com.github.mariotaku:DragSortListView:0.6.1'
|
||||
implementation "com.github.mariotaku:MessageBubbleView:${libVersions['MessageBubbleView']}"
|
||||
implementation 'com.github.mariotaku:DragSortListView:0.6.1'
|
||||
implementation "com.github.mariotaku.MediaViewerLibrary:base:${libVersions['MediaViewerLibrary']}"
|
||||
implementation "com.github.mariotaku.MediaViewerLibrary:subsample-image-view:${libVersions['MediaViewerLibrary']}"
|
||||
implementation "com.github.mariotaku:SQLiteQB:${libVersions['SQLiteQB']}"
|
||||
implementation "com.github.mariotaku.ObjectCursor:core:${libVersions['ObjectCursor']}"
|
||||
kapt "com.github.mariotaku.ObjectCursor:processor:${libVersions['ObjectCursor']}"
|
||||
implementation "com.github.mariotaku.ExportablePreferences:core:${libVersions['ExportablePreferences']}"
|
||||
implementation "com.github.mariotaku:AbstractTask:${libVersions['AbstractTask']}"
|
||||
implementation "com.github.mariotaku.CommonsLibrary:parcel:${libVersions['MariotakuCommons']}"
|
||||
implementation "com.github.mariotaku.CommonsLibrary:io:${libVersions['MariotakuCommons']}"
|
||||
implementation "com.github.mariotaku.CommonsLibrary:text:${libVersions['MariotakuCommons']}"
|
||||
implementation "com.github.mariotaku.CommonsLibrary:text-kotlin:${libVersions['MariotakuCommons']}"
|
||||
implementation("com.github.mariotaku.CommonsLibrary:emojione-android:${libVersions['MariotakuCommons']}") {
|
||||
implementation "com.github.mariotaku.ExportablePreferences:core:${sharedVersions['ExportablePreferences']}"
|
||||
implementation("com.github.mariotaku.CommonsLibrary:emojione-android:${sharedVersions['MariotakuCommons']}") {
|
||||
exclude group: 'org.apache.commons', module: 'commons-text'
|
||||
}
|
||||
implementation "com.github.mariotaku.CommonsLibrary:objectcursor:${libVersions['MariotakuCommons']}"
|
||||
implementation "com.github.mariotaku.CommonsLibrary:logansquare:${libVersions['MariotakuCommons']}"
|
||||
implementation "com.github.mariotaku:KPreferences:${libVersions['KPreferences']}"
|
||||
implementation "com.github.mariotaku.UniqR:android:${libVersions['UniqR']}"
|
||||
implementation "com.github.mariotaku:PickNCrop:${libVersions['PickNCrop']}"
|
||||
implementation "com.github.mariotaku.RestFu:library:${libVersions['RestFu']}"
|
||||
implementation "com.github.mariotaku.RestFu:oauth:${libVersions['RestFu']}"
|
||||
implementation "com.github.mariotaku.RestFu:oauth2:${libVersions['RestFu']}"
|
||||
implementation "com.github.mariotaku.RestFu:okhttp3:${libVersions['RestFu']}"
|
||||
implementation "com.github.mariotaku.RestFu:logansquare:${libVersions['RestFu']}"
|
||||
implementation "com.github.Tlaster:Chameleon:${libVersions['Chameleon']}"
|
||||
implementation "com.github.mariotaku.CommonsLibrary:io:${sharedVersions['MariotakuCommons']}"
|
||||
implementation "com.github.mariotaku.CommonsLibrary:logansquare:${sharedVersions['MariotakuCommons']}"
|
||||
implementation "com.github.mariotaku.CommonsLibrary:objectcursor:${sharedVersions['MariotakuCommons']}"
|
||||
implementation "com.github.mariotaku.CommonsLibrary:parcel:${sharedVersions['MariotakuCommons']}"
|
||||
implementation "com.github.mariotaku.CommonsLibrary:text:${sharedVersions['MariotakuCommons']}"
|
||||
implementation "com.github.mariotaku.CommonsLibrary:text-kotlin:${sharedVersions['MariotakuCommons']}"
|
||||
implementation 'com.github.mariotaku:KPreferences:0.9.8'
|
||||
implementation "com.github.mariotaku.MediaViewerLibrary:base:${libVersions['MediaViewerLibrary']}"
|
||||
implementation "com.github.mariotaku.MediaViewerLibrary:subsample-image-view:${libVersions['MediaViewerLibrary']}"
|
||||
implementation 'com.github.mariotaku:MessageBubbleView:3.5'
|
||||
implementation "com.github.mariotaku.ObjectCursor:core:${sharedVersions['ObjectCursor']}"
|
||||
kapt "com.github.mariotaku.ObjectCursor:processor:${sharedVersions['ObjectCursor']}"
|
||||
implementation 'com.github.mariotaku:PickNCrop:0.9.27'
|
||||
implementation "com.github.mariotaku.RestFu:library:${sharedVersions['RestFu']}"
|
||||
implementation "com.github.mariotaku.RestFu:logansquare:${sharedVersions['RestFu']}"
|
||||
implementation "com.github.mariotaku.RestFu:oauth:${sharedVersions['RestFu']}"
|
||||
implementation "com.github.mariotaku.RestFu:oauth2:${sharedVersions['RestFu']}"
|
||||
implementation "com.github.mariotaku.RestFu:okhttp3:${sharedVersions['RestFu']}"
|
||||
implementation 'com.github.mariotaku:SQLiteQB:0.9.15'
|
||||
implementation 'com.github.mariotaku.UniqR:android:0.9.4'
|
||||
implementation 'com.github.Tlaster:Chameleon:0.9.28'
|
||||
|
||||
|
||||
/** Flavor dependencies **/
|
||||
fdroidImplementation "org.osmdroid:osmdroid-android:${libVersions['OSMDroid']}"
|
||||
fdroidImplementation "ch.acra:acra:${libVersions['ACRA']}"
|
||||
fdroidImplementation 'org.osmdroid:osmdroid-android:5.6.5'
|
||||
fdroidImplementation 'ch.acra:acra:4.11'
|
||||
|
||||
if (enableGoogleVariant) {
|
||||
// START Non-FOSS component
|
||||
googleImplementation "com.google.android.gms:play-services-ads:${libVersions['PlayServices']}"
|
||||
googleImplementation "com.google.android.gms:play-services-auth:${libVersions['PlayServices']}"
|
||||
googleImplementation "com.google.android.gms:play-services-maps:${libVersions['PlayServices']}"
|
||||
googleImplementation "com.google.maps.android:android-maps-utils:${libVersions['MapsUtils']}"
|
||||
googleImplementation "com.anjlab.android.iab.v3:library:${libVersions['IABv3']}"
|
||||
googleImplementation "com.dropbox.core:dropbox-core-sdk:${libVersions['DropboxCoreSdk']}"
|
||||
googleImplementation("com.google.apis:google-api-services-drive:${libVersions['GoogleDriveApi']}") {
|
||||
googleImplementation 'com.google.maps.android:android-maps-utils:0.6.2'
|
||||
googleImplementation 'com.anjlab.android.iab.v3:library:1.1.0'
|
||||
googleImplementation 'com.dropbox.core:dropbox-core-sdk:3.1.3'
|
||||
googleImplementation('com.google.apis:google-api-services-drive:v3-rev195-1.25.0') {
|
||||
exclude group: 'org.apache.httpcomponents'
|
||||
}
|
||||
implementation 'com.google.guava:guava:28.2-android'
|
||||
@ -294,9 +302,9 @@ dependencies {
|
||||
|
||||
debugImplementation "com.facebook.stetho:stetho:${libVersions['Stetho']}"
|
||||
debugImplementation "com.facebook.stetho:stetho-okhttp3:${libVersions['Stetho']}"
|
||||
debugImplementation "com.github.mariotaku:StethoBeanShellREPL:${libVersions['StethoBeanShellREPL']}"
|
||||
debugImplementation "com.squareup.leakcanary:leakcanary-android:${libVersions['LeakCanary']}"
|
||||
debugImplementation('com.jayway.jsonpath:json-path:2.2.0') {
|
||||
debugImplementation 'com.github.mariotaku:StethoBeanShellREPL:0.5'
|
||||
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.3'
|
||||
debugImplementation('com.jayway.jsonpath:json-path:2.4.0') {
|
||||
exclude group: 'net.minidev', module: 'json-smart'
|
||||
}
|
||||
// Stetho dependency, see https://g.co/androidstudio/app-test-app-conflict
|
||||
|
@ -21,7 +21,6 @@ import java.io.Writer;
|
||||
import java.security.InvalidParameterException;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@ -59,10 +58,8 @@ public class LookupTranslator extends CharSequenceTranslator {
|
||||
this.prefixSet = new HashSet<>();
|
||||
int currentShortest = Integer.MAX_VALUE;
|
||||
int currentLongest = 0;
|
||||
Iterator<Map.Entry<CharSequence, CharSequence>> it = lookupMap.entrySet().iterator();
|
||||
|
||||
while (it.hasNext()) {
|
||||
Map.Entry<CharSequence, CharSequence> pair = it.next();
|
||||
for (Map.Entry<CharSequence, CharSequence> pair : lookupMap.entrySet()) {
|
||||
this.lookupMap.put(pair.getKey().toString(), pair.getValue().toString());
|
||||
this.prefixSet.add(pair.getKey().charAt(0));
|
||||
final int sz = pair.getKey().length();
|
||||
|
@ -101,7 +101,7 @@ public class ArrayAdapter<T> extends BaseAdapter implements Filterable {
|
||||
* instantiating views.
|
||||
*/
|
||||
public ArrayAdapter(Context context, int resource) {
|
||||
init(context, resource, new ArrayList<T>());
|
||||
init(context, resource, new ArrayList<>());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -84,12 +84,9 @@ public class ExtendedDividerItemDecoration extends RecyclerView.ItemDecoration {
|
||||
}
|
||||
|
||||
public void setPadding(final int left, final int top, final int right, final int bottom) {
|
||||
mPadding = new Padding() {
|
||||
@Override
|
||||
public boolean get(int position, Rect rect) {
|
||||
rect.set(left, top, right, bottom);
|
||||
return true;
|
||||
}
|
||||
mPadding = (position, rect) -> {
|
||||
rect.set(left, top, right, bottom);
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -66,12 +66,9 @@ public final class DataExportImportTypeSelectorDialogFragment extends BaseDialog
|
||||
|
||||
@Override
|
||||
public final void onClick(final DialogInterface dialog, final int which) {
|
||||
switch (which) {
|
||||
case DialogInterface.BUTTON_POSITIVE: {
|
||||
final int flags = getCheckedFlags();
|
||||
onPositiveButtonClicked(flags);
|
||||
break;
|
||||
}
|
||||
if (which == DialogInterface.BUTTON_POSITIVE) {
|
||||
final int flags = getCheckedFlags();
|
||||
onPositiveButtonClicked(flags);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -118,14 +118,11 @@ public class FileSelectorDialogFragment extends BaseDialogFragment implements Lo
|
||||
builder.setPositiveButton(android.R.string.ok, this);
|
||||
}
|
||||
final AlertDialog dialog = builder.create();
|
||||
dialog.setOnShowListener(new DialogInterface.OnShowListener() {
|
||||
@Override
|
||||
public void onShow(final DialogInterface dialog) {
|
||||
final AlertDialog alertDialog = (AlertDialog) dialog;
|
||||
DialogExtensionsKt.applyTheme(alertDialog);
|
||||
final ListView listView = alertDialog.getListView();
|
||||
listView.setOnItemClickListener(FileSelectorDialogFragment.this);
|
||||
}
|
||||
dialog.setOnShowListener(dialog1 -> {
|
||||
final AlertDialog alertDialog = (AlertDialog) dialog1;
|
||||
DialogExtensionsKt.applyTheme(alertDialog);
|
||||
final ListView listView = alertDialog.getListView();
|
||||
listView.setOnItemClickListener(FileSelectorDialogFragment.this);
|
||||
});
|
||||
return dialog;
|
||||
}
|
||||
@ -268,12 +265,9 @@ public class FileSelectorDialogFragment extends BaseDialogFragment implements Lo
|
||||
private final String[] extensions;
|
||||
private final Pattern extensions_regex;
|
||||
|
||||
private static final Comparator<File> NAME_COMPARATOR = new Comparator<File>() {
|
||||
@Override
|
||||
public int compare(final File file1, final File file2) {
|
||||
final Locale loc = Locale.getDefault();
|
||||
return file1.getName().toLowerCase(loc).compareTo(file2.getName().toLowerCase(loc));
|
||||
}
|
||||
private static final Comparator<File> NAME_COMPARATOR = (file1, file2) -> {
|
||||
final Locale loc = Locale.getDefault();
|
||||
return file1.getName().toLowerCase(loc).compareTo(file2.getName().toLowerCase(loc));
|
||||
};
|
||||
|
||||
public FilesLoader(final Context context, final File path, final String[] extensions) {
|
||||
|
@ -24,7 +24,6 @@ import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnClickListener;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
|
||||
import android.os.Bundle;
|
||||
import androidx.annotation.NonNull;
|
||||
@ -66,12 +65,10 @@ public class KeyboardShortcutsFragment extends BasePreferenceFragment implements
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.reset: {
|
||||
final DialogFragment f = new ResetKeyboardShortcutConfirmDialogFragment();
|
||||
f.show(getFragmentManager(), "reset_keyboard_shortcut_confirm");
|
||||
return true;
|
||||
}
|
||||
if (item.getItemId() == R.id.reset) {
|
||||
final DialogFragment f = new ResetKeyboardShortcutConfirmDialogFragment();
|
||||
f.show(getFragmentManager(), "reset_keyboard_shortcut_confirm");
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
@ -90,12 +87,7 @@ public class KeyboardShortcutsFragment extends BasePreferenceFragment implements
|
||||
mAction = action;
|
||||
setPersistent(false);
|
||||
setTitle(KeyboardShortcutsHandler.getActionLabel(context, action));
|
||||
mPreferencesChangeListener = new OnSharedPreferenceChangeListener() {
|
||||
@Override
|
||||
public void onSharedPreferenceChanged(SharedPreferences preferences, String key) {
|
||||
updateSummary();
|
||||
}
|
||||
};
|
||||
mPreferencesChangeListener = (preferences, key) -> updateSummary();
|
||||
updateSummary();
|
||||
}
|
||||
|
||||
@ -132,11 +124,8 @@ public class KeyboardShortcutsFragment extends BasePreferenceFragment implements
|
||||
implements OnClickListener {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
switch (which) {
|
||||
case DialogInterface.BUTTON_POSITIVE: {
|
||||
keyboardShortcutsHandler.reset();
|
||||
break;
|
||||
}
|
||||
if (which == DialogInterface.BUTTON_POSITIVE) {
|
||||
keyboardShortcutsHandler.reset();
|
||||
}
|
||||
}
|
||||
|
||||
@ -148,12 +137,7 @@ public class KeyboardShortcutsFragment extends BasePreferenceFragment implements
|
||||
builder.setPositiveButton(android.R.string.ok, this);
|
||||
builder.setNegativeButton(android.R.string.cancel, this);
|
||||
final AlertDialog dialog = builder.create();
|
||||
dialog.setOnShowListener(new DialogInterface.OnShowListener() {
|
||||
@Override
|
||||
public void onShow(final DialogInterface dialog) {
|
||||
DialogExtensionsKt.applyTheme((AlertDialog) dialog);
|
||||
}
|
||||
});
|
||||
dialog.setOnShowListener(dialog1 -> DialogExtensionsKt.applyTheme((AlertDialog) dialog1));
|
||||
return dialog;
|
||||
}
|
||||
}
|
||||
|
@ -47,24 +47,21 @@ public class ThemedListPreferenceDialogFragmentCompat extends ThemedPreferenceDi
|
||||
}
|
||||
mClickedDialogEntryIndex = preference.findIndexOfValue(preference.getValue());
|
||||
builder.setSingleChoiceItems(entries, mClickedDialogEntryIndex,
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
mClickedDialogEntryIndex = which;
|
||||
/*
|
||||
* Clicking on an item simulates the positive button
|
||||
* click, and dismisses the dialog.
|
||||
*/
|
||||
ThemedListPreferenceDialogFragmentCompat.this.onClick(dialog,
|
||||
DialogInterface.BUTTON_POSITIVE);
|
||||
dialog.dismiss();
|
||||
}
|
||||
(dialog, which) -> {
|
||||
mClickedDialogEntryIndex = which;
|
||||
/*
|
||||
* Clicking on an item simulates the positive button
|
||||
* click, and dismisses the dialog.
|
||||
*/
|
||||
ThemedListPreferenceDialogFragmentCompat.this.onClick(dialog,
|
||||
DialogInterface.BUTTON_POSITIVE);
|
||||
dialog.dismiss();
|
||||
});
|
||||
/*
|
||||
* The typical interaction for list-based dialogs is to have
|
||||
* click-on-an-item dismiss the dialog instead of the user having to
|
||||
* press 'Ok'.
|
||||
*/
|
||||
//noinspection ConstantConditions
|
||||
builder.setPositiveButton(null, null);
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,6 @@ public class ObjectCursorLoader<T> extends FixedAsyncTaskLoader<List<T>> {
|
||||
return new ObjectCursor<>(cursor, indices, mUseCache);
|
||||
}
|
||||
|
||||
@SuppressWarnings("TryWithIdenticalCatches")
|
||||
@NonNull
|
||||
private ObjectCursor.CursorIndices<T> createIndices(final Cursor cursor) {
|
||||
return ObjectCursor.indicesFrom(cursor, mObjectClass);
|
||||
|
@ -447,7 +447,7 @@ public class CronExpression {
|
||||
if (match) {
|
||||
list.add(str.substring(start, i));
|
||||
}
|
||||
return list.toArray(new String[list.size()]);
|
||||
return list.toArray(new String[0]);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -92,11 +92,7 @@ public abstract class DrawableHolder {
|
||||
}
|
||||
|
||||
public static DrawableHolder parse(String str) {
|
||||
DrawableHolder icon = builtin(str);
|
||||
if (icon != null) {
|
||||
return icon;
|
||||
}
|
||||
return null;
|
||||
return builtin(str);
|
||||
}
|
||||
|
||||
public static List<DrawableHolder> builtins() {
|
||||
|
@ -100,12 +100,7 @@ abstract class MultiSelectListPreference extends DialogPreference implements IDi
|
||||
builder.setNegativeButton(android.R.string.cancel, null);
|
||||
builder.setMultiChoiceItems(mNames, mValues, this);
|
||||
final AlertDialog dialog = builder.create();
|
||||
dialog.setOnShowListener(new DialogInterface.OnShowListener() {
|
||||
@Override
|
||||
public void onShow(final DialogInterface dialog) {
|
||||
DialogExtensionsKt.applyTheme((AlertDialog) dialog);
|
||||
}
|
||||
});
|
||||
dialog.setOnShowListener(dialog1 -> DialogExtensionsKt.applyTheme((AlertDialog) dialog1));
|
||||
return dialog;
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,6 @@ package org.mariotaku.twidere.preference;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import androidx.annotation.NonNull;
|
||||
@ -78,19 +77,9 @@ public class SettingsImportExportPreference extends DialogPreference implements
|
||||
entries[1] = context.getString(R.string.export_settings);
|
||||
values[0] = new Intent(context, DataImportActivity.class);
|
||||
values[1] = new Intent(context, DataExportActivity.class);
|
||||
builder.setItems(entries, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
startActivity(values[which]);
|
||||
}
|
||||
});
|
||||
builder.setItems(entries, (dialog, which) -> startActivity(values[which]));
|
||||
final AlertDialog dialog = builder.create();
|
||||
dialog.setOnShowListener(new DialogInterface.OnShowListener() {
|
||||
@Override
|
||||
public void onShow(final DialogInterface dialog) {
|
||||
DialogExtensionsKt.applyTheme((AlertDialog) dialog);
|
||||
}
|
||||
});
|
||||
dialog.setOnShowListener(dialog1 -> DialogExtensionsKt.applyTheme((AlertDialog) dialog1));
|
||||
return dialog;
|
||||
}
|
||||
|
||||
|
@ -2,8 +2,6 @@ package org.mariotaku.twidere.preference;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnClickListener;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
@ -17,7 +15,6 @@ import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.SeekBar;
|
||||
|
||||
@ -160,42 +157,33 @@ public class ThemeBackgroundPreference extends DialogPreference implements Const
|
||||
final SharedPreferences preferences = preference.getSharedPreferences();
|
||||
preference.setValue(preference.getPersistedString(null));
|
||||
builder.setTitle(preference.getDialogTitle());
|
||||
builder.setSingleChoiceItems(preference.mBackgroundEntries, preference.getValueIndex(), new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
preference.setSelectedOption(which);
|
||||
updateAlphaVisibility();
|
||||
}
|
||||
builder.setSingleChoiceItems(preference.mBackgroundEntries, preference.getValueIndex(), (dialog, which) -> {
|
||||
preference.setSelectedOption(which);
|
||||
updateAlphaVisibility();
|
||||
});
|
||||
builder.setPositiveButton(android.R.string.ok, this);
|
||||
builder.setNegativeButton(android.R.string.cancel, this);
|
||||
final Dialog dialog = builder.create();
|
||||
dialog.setOnShowListener(new DialogInterface.OnShowListener() {
|
||||
@Override
|
||||
public void onShow(DialogInterface dialog) {
|
||||
final AlertDialog alertDialog = (AlertDialog) dialog;
|
||||
DialogExtensionsKt.applyTheme(alertDialog);
|
||||
if (preferences != null) {
|
||||
final LayoutInflater inflater = alertDialog.getLayoutInflater();
|
||||
final ListView listView = alertDialog.getListView();
|
||||
assert listView != null;
|
||||
final ViewGroup listViewParent = (ViewGroup) listView.getParent();
|
||||
listViewParent.removeView(listView);
|
||||
final View view = inflater.inflate(R.layout.dialog_theme_background_preference, listViewParent);
|
||||
((ViewGroup) view.findViewById(R.id.list_container)).addView(listView);
|
||||
mAlphaContainer = view.findViewById(R.id.alpha_container);
|
||||
mAlphaSlider = view.findViewById(R.id.alpha_slider);
|
||||
mAlphaSlider.setMax(MAX_ALPHA - MIN_ALPHA);
|
||||
mAlphaSlider.setProgress(preferences.getInt(KEY_THEME_BACKGROUND_ALPHA, DEFAULT_THEME_BACKGROUND_ALPHA) - MIN_ALPHA);
|
||||
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
preference.setSelectedOption(position);
|
||||
updateAlphaVisibility();
|
||||
}
|
||||
});
|
||||
dialog.setOnShowListener(dialog1 -> {
|
||||
final AlertDialog alertDialog = (AlertDialog) dialog1;
|
||||
DialogExtensionsKt.applyTheme(alertDialog);
|
||||
if (preferences != null) {
|
||||
final LayoutInflater inflater = alertDialog.getLayoutInflater();
|
||||
final ListView listView = alertDialog.getListView();
|
||||
assert listView != null;
|
||||
final ViewGroup listViewParent = (ViewGroup) listView.getParent();
|
||||
listViewParent.removeView(listView);
|
||||
final View view = inflater.inflate(R.layout.dialog_theme_background_preference, listViewParent);
|
||||
((ViewGroup) view.findViewById(R.id.list_container)).addView(listView);
|
||||
mAlphaContainer = view.findViewById(R.id.alpha_container);
|
||||
mAlphaSlider = view.findViewById(R.id.alpha_slider);
|
||||
mAlphaSlider.setMax(MAX_ALPHA - MIN_ALPHA);
|
||||
mAlphaSlider.setProgress(preferences.getInt(KEY_THEME_BACKGROUND_ALPHA, DEFAULT_THEME_BACKGROUND_ALPHA) - MIN_ALPHA);
|
||||
listView.setOnItemClickListener((parent, view1, position, id) -> {
|
||||
preference.setSelectedOption(position);
|
||||
updateAlphaVisibility();
|
||||
}
|
||||
});
|
||||
updateAlphaVisibility();
|
||||
}
|
||||
});
|
||||
return dialog;
|
||||
|
@ -31,7 +31,6 @@ import androidx.annotation.Nullable;
|
||||
import org.mariotaku.twidere.constant.IntentConstants;
|
||||
import org.mariotaku.twidere.util.ServiceUtils.ServiceToken;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.FutureTask;
|
||||
|
||||
@ -73,12 +72,7 @@ public abstract class AbsServiceInterface<I extends IInterface> implements IInte
|
||||
final Intent intent = new Intent(IntentConstants.INTENT_ACTION_EXTENSION_SHORTEN_STATUS);
|
||||
final ComponentName component = ComponentName.unflattenFromString(mShortenerName);
|
||||
intent.setComponent(component);
|
||||
final FutureTask<Boolean> futureTask = new FutureTask<>(new Callable<Boolean>() {
|
||||
@Override
|
||||
public Boolean call() throws Exception {
|
||||
return mIInterface != null;
|
||||
}
|
||||
});
|
||||
final FutureTask<Boolean> futureTask = new FutureTask<>(() -> mIInterface != null);
|
||||
mToken = ServiceUtils.bindToService(mContext, intent, new ServiceConnection() {
|
||||
@Override
|
||||
public void onServiceConnected(final ComponentName name, final IBinder obj) {
|
||||
@ -112,7 +106,6 @@ public abstract class AbsServiceInterface<I extends IInterface> implements IInte
|
||||
}
|
||||
|
||||
public interface CheckServiceAction {
|
||||
@SuppressWarnings("RedundantThrows")
|
||||
void check(@Nullable Bundle metaData) throws CheckServiceException;
|
||||
}
|
||||
|
||||
|
@ -170,7 +170,7 @@ public class DataImportExportUtils implements Constants {
|
||||
ZipInputStream zipInputStream = new ZipInputStream(inputStream)) {
|
||||
int flags = 0;
|
||||
List<String> entryNames = new ArrayList<>();
|
||||
ZipEntry entry = null;
|
||||
ZipEntry entry;
|
||||
while ((entry = zipInputStream.getNextEntry()) != null) {
|
||||
entryNames.add(entry.getName());
|
||||
}
|
||||
@ -204,11 +204,11 @@ public class DataImportExportUtils implements Constants {
|
||||
try (InputStream inputStream = context.getContentResolver().openInputStream(src.getUri());
|
||||
ZipInputStream zipInputStream = new ZipInputStream(inputStream)
|
||||
) {
|
||||
ZipEntry entry = null;
|
||||
ZipEntry entry;
|
||||
while ((entry = zipInputStream.getNextEntry()) != null) {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
byte[] buffer = new byte[1024];
|
||||
int read = 0;
|
||||
int read;
|
||||
while ((read = zipInputStream.read(buffer, 0, 1024)) >= 0) {
|
||||
stringBuilder.append(new String(buffer, 0, read));
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ public class MouseScrollDirectionDecider {
|
||||
}
|
||||
|
||||
@SuppressLint("ViewConstructor")
|
||||
private class InternalHorizontalScrollView extends HorizontalScrollView {
|
||||
private static class InternalHorizontalScrollView extends HorizontalScrollView {
|
||||
|
||||
private final int factor;
|
||||
private final MouseScrollDirectionDecider decider;
|
||||
|
@ -133,7 +133,7 @@ public class MultiSelectManager {
|
||||
userKeys.add(((ParcelableStatus) item).user_key);
|
||||
}
|
||||
}
|
||||
return userKeys.toArray(new UserKey[userKeys.size()]);
|
||||
return userKeys.toArray(new UserKey[0]);
|
||||
}
|
||||
|
||||
public interface Callback {
|
||||
|
@ -113,7 +113,7 @@ public class NotificationManagerWrapper {
|
||||
|
||||
}
|
||||
|
||||
private class PostedNotification {
|
||||
private static class PostedNotification {
|
||||
private final String tag;
|
||||
private final int id;
|
||||
|
||||
|
@ -112,13 +112,11 @@ public class RecyclerViewNavigationHelper implements KeyboardShortcutCallback {
|
||||
public boolean handleKeyboardShortcutSingle(@NonNull KeyboardShortcutsHandler handler, int keyCode, @NonNull KeyEvent event, int metaState) {
|
||||
final String action = handler.getKeyAction(CONTEXT_TAG_NAVIGATION, keyCode, event, metaState);
|
||||
if (action == null) return false;
|
||||
switch (action) {
|
||||
case ACTION_NAVIGATION_TOP: {
|
||||
if (iface != null) {
|
||||
iface.scrollToStart();
|
||||
}
|
||||
return true;
|
||||
if (ACTION_NAVIGATION_TOP.equals(action)) {
|
||||
if (iface != null) {
|
||||
iface.scrollToStart();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -325,7 +325,7 @@ public class SwipeDismissListViewTouchListener implements View.OnTouchListener {
|
||||
return false;
|
||||
}
|
||||
|
||||
class PendingDismissData implements Comparable<PendingDismissData> {
|
||||
static class PendingDismissData implements Comparable<PendingDismissData> {
|
||||
public int position;
|
||||
public View view;
|
||||
|
||||
@ -391,12 +391,9 @@ public class SwipeDismissListViewTouchListener implements View.OnTouchListener {
|
||||
}
|
||||
});
|
||||
|
||||
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
||||
@Override
|
||||
public void onAnimationUpdate(ValueAnimator valueAnimator) {
|
||||
lp.height = (Integer) valueAnimator.getAnimatedValue();
|
||||
dismissView.setLayoutParams(lp);
|
||||
}
|
||||
animator.addUpdateListener(valueAnimator -> {
|
||||
lp.height = (Integer) valueAnimator.getAnimatedValue();
|
||||
dismissView.setLayoutParams(lp);
|
||||
});
|
||||
|
||||
mPendingDismisses.add(new PendingDismissData(dismissPosition, dismissView));
|
||||
|
@ -25,6 +25,7 @@ package org.mariotaku.twidere.util.collection;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.ConcurrentModificationException;
|
||||
import java.util.Iterator;
|
||||
@ -253,8 +254,7 @@ public class CompactHashSet<E> extends java.util.AbstractSet<E> {
|
||||
@Override
|
||||
public void clear() {
|
||||
elements = 0;
|
||||
for (int ix = 0; ix < objects.length; ix++)
|
||||
objects[ix] = null;
|
||||
Arrays.fill(objects, null);
|
||||
freecells = objects.length;
|
||||
modCount++;
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ public class ContentResolverUtils {
|
||||
|
||||
public static int bulkInsert(@NonNull final ContentResolver resolver, @NonNull final Uri uri,
|
||||
@NonNull final Collection<ContentValues> values) {
|
||||
return bulkInsert(resolver, uri, values.toArray(new ContentValues[values.size()]));
|
||||
return bulkInsert(resolver, uri, values.toArray(new ContentValues[0]));
|
||||
}
|
||||
|
||||
public static int bulkInsert(@NonNull final ContentResolver resolver, @NonNull final Uri uri,
|
||||
|
@ -107,7 +107,7 @@ public final class DatabaseUpgradeHelper {
|
||||
newInsertColsList.add(newCol);
|
||||
}
|
||||
}
|
||||
final String[] newInsertCols = newInsertColsList.toArray(new String[newInsertColsList.size()]);
|
||||
final String[] newInsertCols = newInsertColsList.toArray(new String[0]);
|
||||
if (!TwidereArrayUtils.contains(newInsertCols, notNullCols)) return null;
|
||||
qb.columns(newInsertCols);
|
||||
final Columns.Column[] oldDataCols = new Columns.Column[newInsertCols.length];
|
||||
|
@ -15,12 +15,7 @@ public class ImgurProvider implements Provider {
|
||||
public boolean supports(@NonNull String link) {
|
||||
final String authority = UriUtils.getAuthority(link);
|
||||
if (authority == null) return false;
|
||||
switch (authority) {
|
||||
case "i.imgur.com":
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return "i.imgur.com".equals(authority);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@ -28,13 +23,11 @@ public class ImgurProvider implements Provider {
|
||||
public ParcelableMedia from(@NonNull String url) {
|
||||
final String authority = UriUtils.getAuthority(url);
|
||||
if (authority == null) return null;
|
||||
switch (authority) {
|
||||
case "i.imgur.com": {
|
||||
final String path = UriUtils.getPath(url);
|
||||
if (path == null) return null;
|
||||
ParcelableMedia media = new ParcelableMedia();
|
||||
media.url = url;
|
||||
}
|
||||
if ("i.imgur.com".equals(authority)) {
|
||||
final String path = UriUtils.getPath(url);
|
||||
if (path == null) return null;
|
||||
ParcelableMedia media = new ParcelableMedia();
|
||||
media.url = url;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -47,13 +47,8 @@ public final class ViewSupport {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void setBackground(final View view, final Drawable background) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
|
||||
view.setBackgroundDrawable(background);
|
||||
} else {
|
||||
ViewAccessorJB.setBackground(view, background);
|
||||
}
|
||||
ViewAccessorJB.setBackground(view, background);
|
||||
}
|
||||
|
||||
public static void setButtonTintList(CompoundButton view, ColorStateList list) {
|
||||
@ -97,8 +92,8 @@ public final class ViewSupport {
|
||||
if (cls.isAssignableFrom(view.getClass())) return (T) view;
|
||||
if (view instanceof ViewGroup) {
|
||||
for (int i = 0, j = ((ViewGroup) view).getChildCount(); i < j; i++) {
|
||||
final View found = findViewByType(((ViewGroup) view).getChildAt(i), cls);
|
||||
if (found != null) return (T) found;
|
||||
final T found = findViewByType(((ViewGroup) view).getChildAt(i), cls);
|
||||
if (found != null) return found;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@ -130,7 +125,6 @@ public final class ViewSupport {
|
||||
}
|
||||
|
||||
static void setBackground(final View view, final Drawable background) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) return;
|
||||
view.setBackground(background);
|
||||
}
|
||||
}
|
||||
@ -142,10 +136,8 @@ public final class ViewSupport {
|
||||
|
||||
static void setForeground(final View view, final Drawable foreground) {
|
||||
if (view instanceof FrameLayout) {
|
||||
//noinspection RedundantCast
|
||||
((FrameLayout) view).setForeground(foreground);
|
||||
} else if (view instanceof IForegroundView) {
|
||||
//noinspection RedundantCast
|
||||
((IForegroundView) view).setForeground(foreground);
|
||||
}
|
||||
}
|
||||
|
@ -29,14 +29,12 @@ public class WebSettingsSupport {
|
||||
}
|
||||
|
||||
public static void setAllowUniversalAccessFromFileURLs(final WebSettings settings, final boolean flag) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) return;
|
||||
WebSettingsAccessorSDK16.setAllowUniversalAccessFromFileURLs(settings, flag);
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
|
||||
private static class WebSettingsAccessorSDK16 {
|
||||
private static void setAllowUniversalAccessFromFileURLs(final WebSettings settings, final boolean flag) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) return;
|
||||
settings.setAllowUniversalAccessFromFileURLs(flag);
|
||||
}
|
||||
}
|
||||
|
@ -83,7 +83,6 @@ public final class BirthdayView extends LayeredCanvasView {
|
||||
((AnimatedBitmapLayer) layers[2]).setScale(Math.max(1, w / 160));
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
protected boolean fitSystemWindows(@NonNull Rect insets) {
|
||||
final int stripTop = Utils.INSTANCE.getInsetsTopWithoutActionBarHeight(getContext(), insets.top);
|
||||
|
@ -409,13 +409,11 @@ public class HeaderDrawerLayout extends ViewGroup {
|
||||
if (dy > 0 && mDrawer.canScrollCallback(-dy) && mDrawer.isTouchingScrollableContent()) {
|
||||
if (!mDrawer.isUsingDragHelper()) {
|
||||
// Scrolling up while list still has space to scroll, so make header still
|
||||
mScrollingHeaderByHelper = false;
|
||||
return current;
|
||||
} else {
|
||||
mDrawer.scrollByCallback(-dy);
|
||||
mScrollingHeaderByHelper = false;
|
||||
return current;
|
||||
}
|
||||
mScrollingHeaderByHelper = false;
|
||||
return current;
|
||||
}
|
||||
final int min = mDrawer.getHeaderTopMinimum(), max = mDrawer.getHeaderTopMaximum();
|
||||
if (top < min && mDrawer.isTouchingScrollableContent() && mDrawer.isUsingDragHelper()) {
|
||||
|
@ -196,17 +196,14 @@ public class ShapedImageView extends AppCompatImageView {
|
||||
contentHeight = contentBottom - contentTop;
|
||||
final int size = Math.min(contentWidth, contentHeight);
|
||||
|
||||
if (OUTLINE_DRAW) {
|
||||
drawShape(canvas, mDestination, 0, mBackgroundPaint);
|
||||
super.onDraw(canvas);
|
||||
} else {
|
||||
if (!OUTLINE_DRAW) {
|
||||
if (mShadowBitmap != null && mDrawShadow) {
|
||||
canvas.drawBitmap(mShadowBitmap, contentLeft + (contentWidth - size) / 2 - mShadowRadius,
|
||||
contentTop + (contentHeight - size) / 2 - mShadowRadius, null);
|
||||
}
|
||||
drawShape(canvas, mDestination, 0, mBackgroundPaint);
|
||||
super.onDraw(canvas);
|
||||
}
|
||||
drawShape(canvas, mDestination, 0, mBackgroundPaint);
|
||||
super.onDraw(canvas);
|
||||
// Then draw the border.
|
||||
if (mBorderEnabled) {
|
||||
drawBorder(canvas, mDestination);
|
||||
|
@ -33,7 +33,6 @@ import java.util.regex.Pattern;
|
||||
*
|
||||
* @author George T. Steel
|
||||
*/
|
||||
@SuppressWarnings("IfCanBeSwitch")
|
||||
public class SpanFormatter {
|
||||
public static final Pattern FORMAT_SEQUENCE = Pattern.compile("%([0-9]+\\$|<?)([^a-zA-z%]*)([[a-zA-Z%]&&[^tT]]|[tT][a-zA-Z])");
|
||||
|
||||
@ -91,7 +90,7 @@ public class SpanFormatter {
|
||||
} else if (typeTerm.equals("%")) {
|
||||
cookedArg = "\n";
|
||||
} else {
|
||||
int argIdx = 0;
|
||||
int argIdx;
|
||||
if (argTerm.equals("")) argIdx = ++argAt;
|
||||
else if (argTerm.equals("<")) argIdx = argAt;
|
||||
else argIdx = Integer.parseInt(argTerm.substring(0, argTerm.length() - 1)) - 1;
|
||||
|
@ -1,8 +1,5 @@
|
||||
package androidx.loader.app
|
||||
|
||||
import androidx.loader.app.LoaderManager
|
||||
import androidx.loader.app.LoaderManagerImpl
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 2016/11/26.
|
||||
*/
|
||||
|
@ -2,7 +2,6 @@ package androidx.loader.content
|
||||
|
||||
import android.content.Context
|
||||
import android.os.AsyncTask
|
||||
import androidx.loader.content.AsyncTaskLoader
|
||||
import org.mariotaku.twidere.extension.set
|
||||
import org.mariotaku.twidere.util.Analyzer
|
||||
|
||||
|
@ -19,6 +19,4 @@
|
||||
|
||||
package androidx.recyclerview.widget
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
|
||||
val RecyclerView.LayoutManager.recyclerView: RecyclerView? get() = mRecyclerView
|
||||
|
@ -34,7 +34,6 @@ import org.mariotaku.twidere.R
|
||||
import org.mariotaku.twidere.TwidereConstants.*
|
||||
import org.mariotaku.twidere.adapter.AccountDetailsAdapter
|
||||
import org.mariotaku.twidere.annotation.AccountType
|
||||
import org.mariotaku.twidere.app.TwidereApplication
|
||||
import org.mariotaku.twidere.extension.model.isOAuth
|
||||
import org.mariotaku.twidere.model.UserKey
|
||||
import org.mariotaku.twidere.model.util.AccountUtils
|
||||
|
@ -389,6 +389,7 @@ class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener
|
||||
}
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
when (requestCode) {
|
||||
REQUEST_TAKE_PHOTO, REQUEST_PICK_MEDIA -> {
|
||||
if (resultCode == Activity.RESULT_OK && data != null) {
|
||||
@ -1839,8 +1840,8 @@ class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener
|
||||
}
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val context = activity!!
|
||||
val builder = AlertDialog.Builder(context!!)
|
||||
val context = requireActivity()
|
||||
val builder = AlertDialog.Builder(requireContext())
|
||||
builder.setMessage(R.string.quote_protected_status_warning_message)
|
||||
builder.setPositiveButton(R.string.send_anyway, this)
|
||||
builder.setNegativeButton(android.R.string.cancel, null)
|
||||
@ -1873,8 +1874,8 @@ class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener
|
||||
}
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val context = activity!!
|
||||
val builder = AlertDialog.Builder(context!!)
|
||||
val context = requireActivity()
|
||||
val builder = AlertDialog.Builder(requireContext())
|
||||
builder.setMessage(getString(R.string.message_format_compose_message_convert_to_status,
|
||||
"@$screenName"))
|
||||
builder.setPositiveButton(R.string.action_send, this)
|
||||
|
@ -433,6 +433,7 @@ class HomeActivity : BaseActivity(), OnClickListener, OnPageChangeListener, Supp
|
||||
}
|
||||
|
||||
override fun onNewIntent(intent: Intent) {
|
||||
super.onNewIntent(intent)
|
||||
val tabPosition = handleIntent(intent, false)
|
||||
if (tabPosition >= 0) {
|
||||
mainPager.currentItem = tabPosition.coerceInOr(0 until pagerAdapter.count, 0)
|
||||
@ -1070,7 +1071,7 @@ class HomeActivity : BaseActivity(), OnClickListener, OnPageChangeListener, Supp
|
||||
|
||||
class AutoRefreshConfirmDialogFragment : BaseDialogFragment() {
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val builder = AlertDialog.Builder(context!!)
|
||||
val builder = AlertDialog.Builder(requireContext())
|
||||
builder.setTitle(R.string.auto_refresh)
|
||||
builder.setMessage(R.string.message_auto_refresh_confirm)
|
||||
builder.setPositiveButton(android.R.string.ok) { _, _ ->
|
||||
|
@ -171,7 +171,7 @@ class ImageCropperActivity : BaseActivity(), CropImageView.OnSetImageUriComplete
|
||||
private fun getResultIntent(uri: Uri?, error: Exception?, sampleSize: Int): Intent {
|
||||
val result = CropImage.ActivityResult(cropImageView.imageUri, uri, error,
|
||||
cropImageView.cropPoints, cropImageView.cropRect, cropImageView.rotatedDegrees,
|
||||
sampleSize)
|
||||
cropImageView.wholeImageRect, sampleSize)
|
||||
val intent = Intent()
|
||||
intent.putExtra(CropImage.CROP_IMAGE_EXTRA_RESULT, result)
|
||||
return intent
|
||||
|
@ -30,7 +30,7 @@ class InvalidAccountAlertActivity : FragmentActivity() {
|
||||
|
||||
class InvalidAccountAlertDialogFragment : BaseDialogFragment() {
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val builder = AlertDialog.Builder(context!!)
|
||||
val builder = AlertDialog.Builder(requireContext())
|
||||
builder.setTitle(R.string.title_error_invalid_account)
|
||||
builder.setMessage(R.string.message_error_invalid_account)
|
||||
builder.setPositiveButton(android.R.string.ok) { _, _ ->
|
||||
|
@ -26,7 +26,6 @@ import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.os.Environment
|
||||
import android.os.Parcelable
|
||||
import android.provider.MediaStore
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import androidx.fragment.app.Fragment
|
||||
@ -181,6 +180,7 @@ class MediaViewerActivity : BaseActivity(), IMediaViewerActivity, MediaSwipeClos
|
||||
}
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
when (requestCode) {
|
||||
REQUEST_SHARE_MEDIA -> {
|
||||
ShareProvider.clearTempFiles(this)
|
||||
@ -450,11 +450,7 @@ class MediaViewerActivity : BaseActivity(), IMediaViewerActivity, MediaSwipeClos
|
||||
}
|
||||
|
||||
private fun instantiateMediaViewerFragment(args: Bundle): MediaViewerFragment {
|
||||
return if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
|
||||
Fragment.instantiate(this, VideoPageFragment::class.java.name, args) as MediaViewerFragment
|
||||
} else {
|
||||
Fragment.instantiate(this, ExoPlayerPageFragment::class.java.name, args) as MediaViewerFragment
|
||||
}
|
||||
return Fragment.instantiate(this, ExoPlayerPageFragment::class.java.name, args) as MediaViewerFragment
|
||||
}
|
||||
|
||||
private fun processShareIntent(intent: Intent) {
|
||||
|
@ -89,6 +89,7 @@ class PremiumDashboardActivity : BaseActivity() {
|
||||
}
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
when (resultCode) {
|
||||
REQUEST_PURCHASE_EXTRA_FEATURES -> {
|
||||
if (resultCode == Activity.RESULT_OK) {
|
||||
|
@ -215,6 +215,7 @@ class QuickSearchBarActivity : BaseActivity(), OnClickListener, LoaderCallbacks<
|
||||
}
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
when (requestCode) {
|
||||
REQUEST_SCAN_QR -> {
|
||||
if (resultCode == Activity.RESULT_OK && data != null) {
|
||||
|
@ -388,7 +388,7 @@ class SettingsActivity : BaseActivity(), OnItemClickListener, OnPreferenceStartF
|
||||
|
||||
class RestartConfirmDialogFragment : BaseDialogFragment(), DialogInterface.OnClickListener {
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val builder = AlertDialog.Builder(activity!!)
|
||||
val builder = AlertDialog.Builder(requireActivity())
|
||||
if (arguments?.getBoolean(EXTRA_SHOULD_TERMINATE) == true) {
|
||||
builder.setMessage(R.string.app_terminate_confirm)
|
||||
builder.setNegativeButton(R.string.action_dont_terminate, this)
|
||||
|
@ -573,13 +573,13 @@ class SignInActivity : BaseActivity(), OnClickListener, TextWatcher,
|
||||
class SignInTypeChooserDialogFragment : BaseDialogFragment(),
|
||||
LoaderManager.LoaderCallbacks<List<CustomAPIConfig>> {
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val builder = AlertDialog.Builder(context!!)
|
||||
val builder = AlertDialog.Builder(requireContext())
|
||||
builder.setView(R.layout.dialog_expandable_list)
|
||||
val dialog = builder.create()
|
||||
dialog.onShow {
|
||||
it.applyTheme()
|
||||
val listView = it.expandableList
|
||||
val adapter = LoginTypeAdapter(context!!)
|
||||
val adapter = LoginTypeAdapter(requireContext())
|
||||
listView.setAdapter(adapter)
|
||||
listView.setOnGroupClickListener { _, _, groupPosition, _ ->
|
||||
val type = adapter.getGroup(groupPosition)
|
||||
@ -623,7 +623,7 @@ class SignInActivity : BaseActivity(), OnClickListener, TextWatcher,
|
||||
AccountType.MASTODON, AccountType.STATUSNET)
|
||||
val result = supportedAccountTypes.mapNotNullTo(ArrayList()) { type ->
|
||||
if (type == AccountType.MASTODON) return@mapNotNullTo LoginType(type,
|
||||
listOf(CustomAPIConfig.mastodon(context!!)))
|
||||
listOf(CustomAPIConfig.mastodon(requireContext())))
|
||||
return@mapNotNullTo configGroup[type]?.let { list ->
|
||||
LoginType(type, list.sortedBy { !it.isDefault })
|
||||
}
|
||||
@ -632,7 +632,7 @@ class SignInActivity : BaseActivity(), OnClickListener, TextWatcher,
|
||||
}
|
||||
|
||||
override fun onCreateLoader(id: Int, args: Bundle?): Loader<List<CustomAPIConfig>> {
|
||||
return DefaultAPIConfigLoader(context!!)
|
||||
return DefaultAPIConfigLoader(requireContext())
|
||||
}
|
||||
|
||||
override fun onLoaderReset(loader: Loader<List<CustomAPIConfig>>) {
|
||||
@ -694,7 +694,7 @@ class SignInActivity : BaseActivity(), OnClickListener, TextWatcher,
|
||||
var challengeType: String? = null
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val builder = AlertDialog.Builder(context!!)
|
||||
val builder = AlertDialog.Builder(requireContext())
|
||||
builder.setTitle(R.string.login_verification)
|
||||
builder.setView(R.layout.dialog_login_verification_code)
|
||||
builder.positive(android.R.string.ok, this::performVerification)
|
||||
@ -753,7 +753,7 @@ class SignInActivity : BaseActivity(), OnClickListener, TextWatcher,
|
||||
class PasswordSignInDialogFragment : BaseDialogFragment() {
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val builder = AlertDialog.Builder(context!!)
|
||||
val builder = AlertDialog.Builder(requireContext())
|
||||
builder.setView(R.layout.dialog_password_sign_in)
|
||||
builder.positive(R.string.action_sign_in, this::onPositiveButton)
|
||||
builder.setNegativeButton(android.R.string.cancel, null)
|
||||
|
@ -93,7 +93,7 @@ class TrendsLocationSelectorActivity : BaseActivity() {
|
||||
private val list: Array<LocationsMap.LocationsData> get() = arguments?.getTypedArray(EXTRA_DATA) ?: emptyArray()
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val selectorBuilder = AlertDialog.Builder(context!!)
|
||||
val selectorBuilder = AlertDialog.Builder(requireContext())
|
||||
selectorBuilder.setTitle(R.string.trends_location)
|
||||
selectorBuilder.setView(R.layout.dialog_expandable_list)
|
||||
selectorBuilder.setNegativeButton(android.R.string.cancel, null)
|
||||
@ -101,7 +101,7 @@ class TrendsLocationSelectorActivity : BaseActivity() {
|
||||
dialog.onShow {
|
||||
it.applyTheme()
|
||||
val listView = it.expandableList
|
||||
val adapter = ExpandableTrendLocationsListAdapter(context!!)
|
||||
val adapter = ExpandableTrendLocationsListAdapter(requireContext())
|
||||
adapter.data = list
|
||||
listView.setAdapter(adapter)
|
||||
listView.setOnGroupClickListener(ExpandableListView.OnGroupClickListener { _, _, groupPosition, _ ->
|
||||
|
@ -28,7 +28,6 @@ import android.view.View
|
||||
import android.widget.AdapterView.OnItemClickListener
|
||||
import android.widget.TextView
|
||||
import androidx.loader.app.hasRunningLoadersSafe
|
||||
import com.bumptech.glide.Glide
|
||||
import kotlinx.android.synthetic.main.layout_list_with_empty_view.*
|
||||
import org.mariotaku.ktextension.Bundle
|
||||
import org.mariotaku.ktextension.contains
|
||||
@ -135,6 +134,7 @@ class UserListSelectorActivity : BaseActivity(),
|
||||
}
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
when (requestCode) {
|
||||
REQUEST_SELECT_USER -> {
|
||||
if (resultCode == Activity.RESULT_OK && data != null) {
|
||||
|
@ -109,8 +109,8 @@ class UserSelectorActivity : BaseActivity(), OnItemClickListener, LoaderManager.
|
||||
|
||||
override fun onCreateLoader(id: Int, args: Bundle?): Loader<List<ParcelableUser>> {
|
||||
val accountKey = args?.getParcelable<UserKey>(EXTRA_ACCOUNT_KEY)!!
|
||||
val query = args?.getString(EXTRA_QUERY).orEmpty()
|
||||
val fromCache = args?.getBoolean(EXTRA_FROM_CACHE)
|
||||
val query = args.getString(EXTRA_QUERY).orEmpty()
|
||||
val fromCache = args.getBoolean(EXTRA_FROM_CACHE)
|
||||
if (!fromCache) {
|
||||
showProgress()
|
||||
}
|
||||
|
@ -64,6 +64,7 @@ abstract class AbsStatusDialogActivity : BaseActivity() {
|
||||
}
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
when (requestCode) {
|
||||
REQUEST_SELECT_ACCOUNT -> {
|
||||
if (resultCode == RESULT_OK && data != null) {
|
||||
|
@ -46,6 +46,7 @@ abstract class AbsShortcutCreatorActivity : BaseActivity() {
|
||||
}
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
when (requestCode) {
|
||||
REQUEST_SELECT_ACCOUNT -> {
|
||||
if (resultCode != Activity.RESULT_OK || data == null) {
|
||||
|
@ -120,8 +120,7 @@ class MessagesConversationAdapter(
|
||||
}
|
||||
ITEM_LOAD_OLDER_INDICATOR -> {
|
||||
val view = inflater.inflate(LoadIndicatorViewHolder.layoutResource, parent, false)
|
||||
val holder = LoadIndicatorViewHolder(view)
|
||||
return holder
|
||||
return LoadIndicatorViewHolder(view)
|
||||
}
|
||||
}
|
||||
throw UnsupportedOperationException()
|
||||
|
@ -70,8 +70,7 @@ class SelectableUsersAdapter(
|
||||
when (viewType) {
|
||||
ITEM_VIEW_TYPE_USER -> {
|
||||
val view = inflater.inflate(R.layout.list_item_simple_user, parent, false)
|
||||
val holder = SelectableUserViewHolder(view, this)
|
||||
return holder
|
||||
return SelectableUserViewHolder(view, this)
|
||||
}
|
||||
ITEM_VIEW_TYPE_LOAD_INDICATOR -> {
|
||||
val view = inflater.inflate(R.layout.list_item_load_indicator, parent, false)
|
||||
|
@ -67,8 +67,7 @@ class SimpleParcelableUserListsAdapter(
|
||||
return view
|
||||
}
|
||||
1 -> {
|
||||
val view = createViewFromResource(position, convertView, parent, R.layout.list_item_load_indicator)
|
||||
return view
|
||||
return createViewFromResource(position, convertView, parent, R.layout.list_item_load_indicator)
|
||||
}
|
||||
}
|
||||
throw UnsupportedOperationException()
|
||||
|
@ -51,7 +51,7 @@ import org.mariotaku.twidere.view.holder.status.DetailStatusViewHolder
|
||||
|
||||
class StatusDetailsAdapter(
|
||||
val fragment: StatusFragment
|
||||
) : LoadMoreSupportAdapter<RecyclerView.ViewHolder>(fragment.context!!, fragment.requestManager),
|
||||
) : LoadMoreSupportAdapter<RecyclerView.ViewHolder>(fragment.requireContext(), fragment.requestManager),
|
||||
IStatusesAdapter<List<ParcelableStatus>>, IItemCountsAdapter {
|
||||
|
||||
override val twidereLinkify: TwidereLinkify
|
||||
@ -117,7 +117,7 @@ class StatusDetailsAdapter(
|
||||
inflater = LayoutInflater.from(context)
|
||||
cardBackgroundColor = ThemeUtils.getCardBackgroundColor(context!!,
|
||||
preferences[themeBackgroundOptionKey], preferences[themeBackgroundAlphaKey])
|
||||
val listener = StatusAdapterLinkClickHandler<List<ParcelableStatus>>(context!!, preferences)
|
||||
val listener = StatusAdapterLinkClickHandler<List<ParcelableStatus>>(context, preferences)
|
||||
listener.setAdapter(this)
|
||||
twidereLinkify = TwidereLinkify(listener)
|
||||
}
|
||||
@ -306,7 +306,7 @@ class StatusDetailsAdapter(
|
||||
when (holder.itemViewType) {
|
||||
VIEW_TYPE_DETAIL_STATUS -> {
|
||||
holder as DetailStatusViewHolder
|
||||
payloads.forEach { it ->
|
||||
payloads.forEach {
|
||||
when (it) {
|
||||
is StatusFragment.StatusActivity -> {
|
||||
holder.updateStatusActivity(it)
|
||||
|
@ -26,7 +26,6 @@ import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentManager
|
||||
import androidx.viewpager.widget.PagerAdapter
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import org.mariotaku.twidere.fragment.iface.RefreshScrollTopInterface
|
||||
import org.mariotaku.twidere.fragment.iface.SupportFragmentCallback
|
||||
import org.mariotaku.twidere.model.SupportTabSpec
|
||||
|
@ -57,8 +57,7 @@ class VariousItemsAdapter(
|
||||
}
|
||||
VIEW_TYPE_HASHTAG -> {
|
||||
val view = inflater.inflate(R.layout.list_item_two_line_small, parent, false)
|
||||
val holder = HashtagViewHolder(view, hashtagClickListener)
|
||||
return holder
|
||||
return HashtagViewHolder(view, hashtagClickListener)
|
||||
}
|
||||
}
|
||||
throw UnsupportedOperationException()
|
||||
|
@ -38,7 +38,7 @@ fun Account.getCredentials(am: AccountManager): Credentials {
|
||||
if (token != null) return@run token
|
||||
}
|
||||
return@run null
|
||||
} ?: throw NullPointerException("AuthToken is null for ${this}")
|
||||
} ?: throw NullPointerException("AuthToken is null for $this")
|
||||
return parseCredentials(authToken, getCredentialsType(am))
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,6 @@ import androidx.appcompat.app.AlertDialog
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.*
|
||||
import com.bumptech.glide.Glide
|
||||
import com.rengwuxian.materialedittext.MaterialEditText
|
||||
import org.mariotaku.twidere.R
|
||||
import org.mariotaku.twidere.adapter.ArrayAdapter
|
||||
@ -43,7 +42,7 @@ class APIEditorDialogFragment : BaseDialogFragment() {
|
||||
private lateinit var apiConfig: CustomAPIConfig
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val builder = AlertDialog.Builder(context!!)
|
||||
val builder = AlertDialog.Builder(requireContext())
|
||||
builder.setView(R.layout.dialog_api_editor)
|
||||
builder.setPositiveButton(R.string.action_save) { _, _ ->
|
||||
val targetFragment = this.targetFragment
|
||||
@ -76,8 +75,8 @@ class APIEditorDialogFragment : BaseDialogFragment() {
|
||||
|
||||
accountTypeSpinner.adapter = AccountTypeSpinnerAdapter(this)
|
||||
|
||||
editConsumerKey.addValidator(ConsumerKeySecretValidator(context!!.getString(R.string.invalid_consumer_key)))
|
||||
editConsumerSecret.addValidator(ConsumerKeySecretValidator(context!!.getString(R.string.invalid_consumer_secret)))
|
||||
editConsumerKey.addValidator(ConsumerKeySecretValidator(requireContext().getString(R.string.invalid_consumer_key)))
|
||||
editConsumerSecret.addValidator(ConsumerKeySecretValidator(requireContext().getString(R.string.invalid_consumer_secret)))
|
||||
|
||||
editNoVersionSuffix.setOnCheckedChangeListener { _, _ -> editNoVersionSuffixChanged = true }
|
||||
editAuthType.setOnCheckedChangeListener { _, checkedId ->
|
||||
@ -145,8 +144,8 @@ class APIEditorDialogFragment : BaseDialogFragment() {
|
||||
private lateinit var adapter: ArrayAdapter<CustomAPIConfig>
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
adapter = CustomAPIConfigArrayAdapter(context!!)
|
||||
val builder = AlertDialog.Builder(context!!)
|
||||
adapter = CustomAPIConfigArrayAdapter(requireContext())
|
||||
val builder = AlertDialog.Builder(requireContext())
|
||||
builder.setAdapter(adapter, this)
|
||||
loaderManager.initLoader(0, null, this)
|
||||
val dialog = builder.create()
|
||||
@ -162,7 +161,7 @@ class APIEditorDialogFragment : BaseDialogFragment() {
|
||||
}
|
||||
|
||||
override fun onCreateLoader(id: Int, args: Bundle?): Loader<List<CustomAPIConfig>> {
|
||||
return DefaultAPIConfigLoader(context!!)
|
||||
return DefaultAPIConfigLoader(requireContext())
|
||||
}
|
||||
|
||||
override fun onLoadFinished(loader: Loader<List<CustomAPIConfig>>, data: List<CustomAPIConfig>) {
|
||||
@ -189,7 +188,7 @@ class APIEditorDialogFragment : BaseDialogFragment() {
|
||||
|
||||
private class AccountTypeSpinnerAdapter(
|
||||
fragment: APIEditorDialogFragment
|
||||
) : BaseArrayAdapter<String>(fragment.context!!, R.layout.support_simple_spinner_dropdown_item,
|
||||
) : BaseArrayAdapter<String>(fragment.requireContext(), R.layout.support_simple_spinner_dropdown_item,
|
||||
requestManager = fragment.requestManager) {
|
||||
init {
|
||||
add(AccountType.TWITTER)
|
||||
|
@ -185,7 +185,7 @@ abstract class AbsActivitiesFragment protected constructor() :
|
||||
override fun onCreateLoader(id: Int, args: Bundle?): Loader<List<ParcelableActivity>> {
|
||||
val fromUser = args?.getBoolean(EXTRA_FROM_USER)
|
||||
args?.remove(EXTRA_FROM_USER)
|
||||
return onCreateActivitiesLoader(activity!!, args!!, fromUser!!)
|
||||
return onCreateActivitiesLoader(requireActivity(), args!!, fromUser!!)
|
||||
}
|
||||
|
||||
protected fun saveReadPosition() {
|
||||
|
@ -129,12 +129,12 @@ abstract class AbsContentListViewFragment<A : ListAdapter> : BaseFragment(),
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
val backgroundColor = ThemeUtils.getColorBackground(context!!)
|
||||
val backgroundColor = ThemeUtils.getColorBackground(requireContext())
|
||||
val colorRes = TwidereColorUtils.getContrastYIQ(backgroundColor,
|
||||
R.color.bg_refresh_progress_color_light, R.color.bg_refresh_progress_color_dark)
|
||||
swipeLayout.setOnRefreshListener(this)
|
||||
swipeLayout.setProgressBackgroundColorSchemeResource(colorRes)
|
||||
adapter = onCreateAdapter(context!!, requestManager)
|
||||
adapter = onCreateAdapter(requireContext(), requestManager)
|
||||
listView.setOnTouchListener { _, event ->
|
||||
if (event.actionMasked == MotionEvent.ACTION_DOWN) {
|
||||
updateRefreshProgressOffset()
|
||||
|
@ -182,13 +182,13 @@ abstract class AbsContentRecyclerViewFragment<A : LoadMoreSupportAdapter<Recycle
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
drawerCallback = SimpleDrawerCallback(recyclerView)
|
||||
|
||||
val backgroundColor = ThemeUtils.getColorBackground(context!!)
|
||||
val backgroundColor = ThemeUtils.getColorBackground(requireContext())
|
||||
val colorRes = TwidereColorUtils.getContrastYIQ(backgroundColor,
|
||||
R.color.bg_refresh_progress_color_light, R.color.bg_refresh_progress_color_dark)
|
||||
swipeLayout.setOnRefreshListener(this)
|
||||
swipeLayout.setProgressBackgroundColorSchemeResource(colorRes)
|
||||
adapter = onCreateAdapter(context!!, requestManager)
|
||||
layoutManager = onCreateLayoutManager(context!!)
|
||||
adapter = onCreateAdapter(requireContext(), requestManager)
|
||||
layoutManager = onCreateLayoutManager(requireContext())
|
||||
scrollListener = RecyclerViewScrollHandler(this, RecyclerViewScrollHandler.RecyclerViewCallback(recyclerView))
|
||||
|
||||
recyclerView.layoutManager = layoutManager
|
||||
@ -216,7 +216,7 @@ abstract class AbsContentRecyclerViewFragment<A : LoadMoreSupportAdapter<Recycle
|
||||
} else {
|
||||
recyclerView.setOnTouchListener(scrollListener.touchListener)
|
||||
}
|
||||
setupRecyclerView(context!!, recyclerView)
|
||||
setupRecyclerView(requireContext(), recyclerView)
|
||||
recyclerView.adapter = adapter
|
||||
|
||||
scrollListener.touchSlop = ViewConfiguration.get(context).scaledTouchSlop
|
||||
|
@ -88,7 +88,7 @@ abstract class AbsMediaStatusesFragment : AbsContentRecyclerViewFragment<Stagger
|
||||
override fun onCreateLoader(id: Int, args: Bundle?): Loader<List<ParcelableStatus>?> {
|
||||
val fromUser = args?.getBoolean(EXTRA_FROM_USER)
|
||||
args?.remove(EXTRA_FROM_USER)
|
||||
return onCreateStatusesLoader(activity!!, args!!, fromUser!!)
|
||||
return onCreateStatusesLoader(requireActivity(), args!!, fromUser!!)
|
||||
}
|
||||
|
||||
final override fun onLoadFinished(loader: Loader<List<ParcelableStatus>?>, data: List<ParcelableStatus>?) {
|
||||
|
@ -239,7 +239,7 @@ abstract class AbsStatusesFragment : AbsContentListRecyclerViewFragment<Parcelab
|
||||
override fun onCreateLoader(id: Int, args: Bundle?): Loader<List<ParcelableStatus>?> {
|
||||
val fromUser = args?.getBoolean(EXTRA_FROM_USER)
|
||||
args?.remove(EXTRA_FROM_USER)
|
||||
return onCreateStatusesLoader(activity!!, args!!, fromUser!!)
|
||||
return onCreateStatusesLoader(requireActivity(), args!!, fromUser!!)
|
||||
}
|
||||
|
||||
override fun setUserVisibleHint(isVisibleToUser: Boolean) {
|
||||
@ -272,7 +272,7 @@ abstract class AbsStatusesFragment : AbsContentListRecyclerViewFragment<Parcelab
|
||||
val firstLoad = adapterData.isNullOrEmpty()
|
||||
|
||||
var lastReadId: Long = -1
|
||||
var lastReadViewTop: Int = 0
|
||||
var lastReadViewTop = 0
|
||||
var loadMore = false
|
||||
var wasAtTop = false
|
||||
// 1. Save current read position if not first load
|
||||
@ -562,7 +562,7 @@ abstract class AbsStatusesFragment : AbsContentListRecyclerViewFragment<Parcelab
|
||||
resolver?.update(contentUri, values, where, null)
|
||||
return true
|
||||
}
|
||||
else -> return MenuUtils.handleStatusClick(activity!!, this, fragmentManager!!,
|
||||
else -> return MenuUtils.handleStatusClick(requireActivity(), this, requireFragmentManager(),
|
||||
preferences, userColorNameManager, twitterWrapper, status, item)
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ abstract class AbsToolbarTabPagesFragment : BaseFragment(), RefreshScrollTopInte
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
val activity = activity
|
||||
pagerAdapter = SupportTabsAdapter(activity!!, childFragmentManager, null)
|
||||
pagerAdapter = SupportTabsAdapter(requireActivity(), childFragmentManager, null)
|
||||
viewPager.adapter = pagerAdapter
|
||||
viewPager.offscreenPageLimit = 2
|
||||
viewPager.addOnPageChangeListener(this)
|
||||
@ -149,7 +149,7 @@ abstract class AbsToolbarTabPagesFragment : BaseFragment(), RefreshScrollTopInte
|
||||
if (height != 0) {
|
||||
insets.top = height
|
||||
} else {
|
||||
insets.top = ThemeUtils.getActionBarHeight(context!!)
|
||||
insets.top = ThemeUtils.getActionBarHeight(requireContext())
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ abstract class AbsUserMuteBlockDialogFragment : BaseDialogFragment(), DialogInte
|
||||
}
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val builder = AlertDialog.Builder(context!!)
|
||||
val builder = AlertDialog.Builder(requireContext())
|
||||
builder.setTitle(getTitle(user))
|
||||
builder.setView(R.layout.dialog_block_mute_filter_user_confirm)
|
||||
builder.setPositiveButton(getPositiveButtonTitle(user), this)
|
||||
|
@ -46,7 +46,6 @@ import androidx.appcompat.view.SupportMenuInflater
|
||||
import androidx.appcompat.widget.ActionMenuView.OnMenuItemClickListener
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.MenuItemCompat
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.loader.app.LoaderManager.LoaderCallbacks
|
||||
import androidx.loader.content.FixedAsyncTaskLoader
|
||||
import androidx.loader.content.Loader
|
||||
@ -259,7 +258,7 @@ class AccountsDashboardFragment : BaseFragment(), LoaderCallbacks<AccountsInfo>,
|
||||
}
|
||||
|
||||
override fun onCreateLoader(id: Int, args: Bundle?): Loader<AccountsInfo> {
|
||||
return AccountsInfoLoader(activity!!, accountsAdapter.accounts == null)
|
||||
return AccountsInfoLoader(requireActivity(), accountsAdapter.accounts == null)
|
||||
}
|
||||
|
||||
|
||||
@ -538,10 +537,10 @@ class AccountsDashboardFragment : BaseFragment(), LoaderCallbacks<AccountsInfo>,
|
||||
} else if (user.account_color != 0) {
|
||||
ColorDrawable(user.account_color)
|
||||
} else {
|
||||
ColorDrawable(Chameleon.getOverrideTheme(activity!!, activity).colorPrimary)
|
||||
ColorDrawable(Chameleon.getOverrideTheme(requireActivity(), activity).colorPrimary)
|
||||
}
|
||||
|
||||
requestManager.loadProfileBanner(context!!, account.user, width).fallback(fallbackBanner)
|
||||
requestManager.loadProfileBanner(requireContext(), account.user, width).fallback(fallbackBanner)
|
||||
.into(bannerView)
|
||||
}
|
||||
|
||||
@ -557,7 +556,7 @@ class AccountsDashboardFragment : BaseFragment(), LoaderCallbacks<AccountsInfo>,
|
||||
} else {
|
||||
"${if (showType) account.type else ""}@${account.user.screen_name}"
|
||||
}
|
||||
requestManager.loadProfileImage(context!!, account, preferences[profileImageStyleKey],
|
||||
requestManager.loadProfileImage(requireContext(), account, preferences[profileImageStyleKey],
|
||||
accountProfileImageView.cornerRadius, accountProfileImageView.cornerRadiusRatio,
|
||||
ProfileImageSize.REASONABLY_SMALL).placeholder(profileImageSnapshot).into(accountProfileImageView)
|
||||
//TODO complete border color
|
||||
|
@ -60,7 +60,7 @@ class AccountsManagerFragment : BaseFragment(), LoaderManager.LoaderCallbacks<Li
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
setHasOptionsMenu(true)
|
||||
val am = AccountManager.get(context)
|
||||
adapter = AccountDetailsAdapter(context!!, requestManager).apply {
|
||||
adapter = AccountDetailsAdapter(requireContext(), requestManager).apply {
|
||||
sortEnabled = true
|
||||
switchEnabled = true
|
||||
accountToggleListener = { pos, checked ->
|
||||
@ -158,7 +158,7 @@ class AccountsManagerFragment : BaseFragment(), LoaderManager.LoaderCallbacks<Li
|
||||
}
|
||||
|
||||
override fun onCreateLoader(id: Int, args: Bundle?): Loader<List<AccountDetails>> {
|
||||
return AccountDetailsLoader(context!!)
|
||||
return AccountDetailsLoader(requireContext())
|
||||
}
|
||||
|
||||
override fun onLoaderReset(loader: Loader<List<AccountDetails>>) {
|
||||
@ -227,7 +227,7 @@ class AccountsManagerFragment : BaseFragment(), LoaderManager.LoaderCallbacks<Li
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val context = context
|
||||
val builder = AlertDialog.Builder(context!!)
|
||||
val builder = AlertDialog.Builder(requireContext())
|
||||
builder.setNegativeButton(android.R.string.cancel, null)
|
||||
builder.setPositiveButton(android.R.string.ok, this)
|
||||
builder.setTitle(R.string.title_account_delete_confirm)
|
||||
|
@ -48,7 +48,7 @@ class AddStatusFilterDialogFragment : BaseDialogFragment() {
|
||||
private var filterItems: Array<FilterItemInfo>? = null
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val builder = AlertDialog.Builder(context!!)
|
||||
val builder = AlertDialog.Builder(requireContext())
|
||||
filterItems = filterItemsInfo
|
||||
val entries = arrayOfNulls<String>(filterItems!!.size)
|
||||
val nameFirst = preferences[nameFirstKey]
|
||||
|
@ -30,7 +30,6 @@ import okhttp3.Dns
|
||||
import org.mariotaku.kpreferences.KPreferences
|
||||
import org.mariotaku.restfu.http.RestHttpClient
|
||||
import org.mariotaku.twidere.util.AsyncTwitterWrapper
|
||||
import org.mariotaku.twidere.util.DebugModeUtils
|
||||
import org.mariotaku.twidere.util.KeyboardShortcutsHandler
|
||||
import org.mariotaku.twidere.util.UserColorNameManager
|
||||
import org.mariotaku.twidere.util.dagger.GeneralComponent
|
||||
@ -63,7 +62,7 @@ open class BaseDialogFragment : DialogFragment() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
requestManager = Glide.with(context!!)// TODO: Upgrade Glide usage
|
||||
requestManager = Glide.with(requireContext())// TODO: Upgrade Glide usage
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
|
@ -102,7 +102,7 @@ open class BaseFragment : Fragment(), IBaseFragment<BaseFragment> {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
requestManager = Glide.with(context!!)// TODO: Upgrade Glide usage
|
||||
requestManager = Glide.with(requireContext())// TODO: Upgrade Glide usage
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
|
@ -48,7 +48,7 @@ open class BaseWebViewFragment : BaseFragment() {
|
||||
|
||||
|
||||
protected fun createWebViewClient(): WebViewClient {
|
||||
return DefaultWebViewClient(activity!!)
|
||||
return DefaultWebViewClient(requireActivity())
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -68,7 +68,7 @@ class ColorPickerDialogFragment : BaseDialogFragment(), DialogInterface.OnClickL
|
||||
}
|
||||
|
||||
val activity = activity
|
||||
val builder = AlertDialog.Builder(activity!!)
|
||||
val builder = AlertDialog.Builder(requireActivity())
|
||||
builder.setView(me.uucky.colorpicker.R.layout.cp__dialog_color_picker)
|
||||
builder.setPositiveButton(android.R.string.ok, this)
|
||||
if (args!!.getBoolean(EXTRA_CLEAR_BUTTON, false)) {
|
||||
@ -82,7 +82,7 @@ class ColorPickerDialogFragment : BaseDialogFragment(), DialogInterface.OnClickL
|
||||
|
||||
val showAlphaSlider = args.getBoolean(EXTRA_ALPHA_SLIDER, true)
|
||||
for (presetColor in PRESET_COLORS) {
|
||||
controller!!.addColor(ContextCompat.getColor(context!!, presetColor))
|
||||
controller!!.addColor(ContextCompat.getColor(requireContext(), presetColor))
|
||||
}
|
||||
controller!!.setAlphaEnabled(showAlphaSlider)
|
||||
controller!!.setInitialColor(color)
|
||||
@ -100,7 +100,7 @@ class ColorPickerDialogFragment : BaseDialogFragment(), DialogInterface.OnClickL
|
||||
|
||||
override fun onSaveInstanceState(outState: Bundle) {
|
||||
if (controller != null) {
|
||||
outState!!.putInt(EXTRA_COLOR, controller!!.color)
|
||||
outState.putInt(EXTRA_COLOR, controller!!.color)
|
||||
}
|
||||
super.onSaveInstanceState(outState)
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ import org.mariotaku.twidere.util.ParseUtils
|
||||
class CreateUserListDialogFragment : BaseDialogFragment() {
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val builder = AlertDialog.Builder(context!!)
|
||||
val builder = AlertDialog.Builder(requireContext())
|
||||
builder.setView(R.layout.dialog_user_list_detail_editor)
|
||||
|
||||
builder.setTitle(R.string.new_user_list)
|
||||
|
@ -59,7 +59,7 @@ import org.mariotaku.twidere.util.Utils
|
||||
abstract class CursorActivitiesFragment : AbsActivitiesFragment() {
|
||||
|
||||
override val accountKeys: Array<UserKey>
|
||||
get() = Utils.getAccountKeys(context!!, arguments) ?: DataStoreUtils.getActivatedAccountKeys(context!!)
|
||||
get() = Utils.getAccountKeys(requireContext(), arguments) ?: DataStoreUtils.getActivatedAccountKeys(requireContext())
|
||||
|
||||
abstract val contentUri: Uri
|
||||
|
||||
|
@ -70,7 +70,7 @@ abstract class CursorStatusesFragment : AbsStatusesFragment() {
|
||||
get() = false
|
||||
|
||||
override val accountKeys: Array<UserKey>
|
||||
get() = Utils.getAccountKeys(context!!, arguments) ?: DataStoreUtils.getActivatedAccountKeys(context!!)
|
||||
get() = Utils.getAccountKeys(requireContext(), arguments) ?: DataStoreUtils.getActivatedAccountKeys(requireContext())
|
||||
|
||||
abstract val errorInfoKey: String
|
||||
abstract val isFilterEnabled: Boolean
|
||||
|
@ -93,7 +93,7 @@ class CustomTabsFragment : BaseFragment(), LoaderCallbacks<Cursor?>, MultiChoice
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
setHasOptionsMenu(true)
|
||||
adapter = CustomTabsAdapter(context!!)
|
||||
adapter = CustomTabsAdapter(requireContext())
|
||||
listView.choiceMode = ListView.CHOICE_MODE_MULTIPLE_MODAL
|
||||
listView.setMultiChoiceModeListener(this)
|
||||
listView.onItemClickListener = OnItemClickListener { _, _, position, _ ->
|
||||
@ -130,7 +130,7 @@ class CustomTabsFragment : BaseFragment(), LoaderCallbacks<Cursor?>, MultiChoice
|
||||
}
|
||||
|
||||
override fun onCreateLoader(id: Int, args: Bundle?): Loader<Cursor?> {
|
||||
return CursorLoader(activity!!, Tabs.CONTENT_URI, Tabs.COLUMNS, null, null, Tabs.DEFAULT_SORT_ORDER)
|
||||
return CursorLoader(requireActivity(), Tabs.CONTENT_URI, Tabs.COLUMNS, null, null, Tabs.DEFAULT_SORT_ORDER)
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
|
||||
@ -138,7 +138,7 @@ class CustomTabsFragment : BaseFragment(), LoaderCallbacks<Cursor?>, MultiChoice
|
||||
val context = this.context
|
||||
val accounts = AccountUtils.getAllAccountDetails(AccountManager.get(context), false)
|
||||
val itemAdd = menu.findItem(R.id.add_submenu)
|
||||
val theme = Chameleon.getOverrideTheme(context!!, context)
|
||||
val theme = Chameleon.getOverrideTheme(requireContext(), context)
|
||||
if (itemAdd != null && itemAdd.hasSubMenu()) {
|
||||
val subMenu = itemAdd.subMenu
|
||||
subMenu.clear()
|
||||
@ -394,7 +394,7 @@ class CustomTabsFragment : BaseFragment(), LoaderCallbacks<Cursor?>, MultiChoice
|
||||
}
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val builder = AlertDialog.Builder(context!!)
|
||||
val builder = AlertDialog.Builder(requireContext())
|
||||
builder.setView(R.layout.dialog_custom_tab_editor)
|
||||
builder.setPositiveButton(R.string.action_save, null)
|
||||
builder.setNegativeButton(android.R.string.cancel, null)
|
||||
|
@ -44,7 +44,7 @@ class DateTimePickerDialogFragment : BaseDialogFragment() {
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
|
||||
val builder = AlertDialog.Builder(context!!)
|
||||
val builder = AlertDialog.Builder(requireContext())
|
||||
builder.setView(R.layout.dialog_date_time_picker)
|
||||
builder.setNegativeButton(android.R.string.cancel, null)
|
||||
builder.setPositiveButton(android.R.string.ok, null)
|
||||
|
@ -50,7 +50,7 @@ class DeleteUserListMembersDialogFragment : BaseDialogFragment(), DialogInterfac
|
||||
}
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val builder = AlertDialog.Builder(context!!)
|
||||
val builder = AlertDialog.Builder(requireContext())
|
||||
val users = users
|
||||
val userList = userList
|
||||
if (users == null || userList == null) throw NullPointerException()
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user