1
0
mirror of https://github.com/TwidereProject/Twidere-Android synced 2025-02-09 00:08:41 +01:00

Down level the min api

This commit is contained in:
Tlaster 2020-05-26 17:14:52 +08:00
parent d7dad43928
commit a38b3c3982
5 changed files with 41 additions and 9 deletions

View File

@ -23,7 +23,7 @@ allprojects {
globalCompileSdkVersion = 29 globalCompileSdkVersion = 29
globalBuildToolsVersion = "29.0.3" globalBuildToolsVersion = "29.0.3"
globalMinSdkVersion = 19 globalMinSdkVersion = 16
globalTargetSdkVersion = 29 globalTargetSdkVersion = 29
} }

View File

@ -26,6 +26,7 @@ import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.database.Cursor; import android.database.Cursor;
import android.net.Uri; import android.net.Uri;
import android.os.Build;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.WorkerThread; import androidx.annotation.WorkerThread;
@ -292,7 +293,15 @@ public class DataImportExportUtils implements Constants {
@NonNull final String preferencesName, @NonNull final String entryName, @NonNull final String preferencesName, @NonNull final String entryName,
@NonNull final SharedPreferencesProcessStrategy strategy, @NonNull final SharedPreferencesProcessStrategy strategy,
@NonNull final String data) throws IOException { @NonNull final String data) throws IOException {
if (!Objects.equals(entry.getName(), entryName)) return; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
if (!Objects.equals(entry.getName(), entryName)) {
return;
}
} else {
if (entry.getName().equals(entryName)) {
return;
}
}
final JsonParser jsonParser = LoganSquare.JSON_FACTORY.createParser(data); final JsonParser jsonParser = LoganSquare.JSON_FACTORY.createParser(data);
if (jsonParser.getCurrentToken() == null) { if (jsonParser.getCurrentToken() == null) {
jsonParser.nextToken(); jsonParser.nextToken();
@ -327,7 +336,15 @@ public class DataImportExportUtils implements Constants {
@NonNull final String data, @NonNull final String data,
@NonNull final ContentResolverProcessStrategy<List<T>> strategy) @NonNull final ContentResolverProcessStrategy<List<T>> strategy)
throws IOException { throws IOException {
if (!Objects.equals(entry.getName(), entryName)) return; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
if (!Objects.equals(entry.getName(), entryName)) {
return;
}
} else {
if (entry.getName().equals(entryName)) {
return;
}
}
List<T> itemsList = JsonSerializer.parseList(data, itemCls); List<T> itemsList = JsonSerializer.parseList(data, itemCls);
strategy.importItem(context.getContentResolver(), itemsList); strategy.importItem(context.getContentResolver(), itemsList);
} }
@ -352,7 +369,15 @@ public class DataImportExportUtils implements Constants {
@NonNull final String data, @NonNull final String data,
@NonNull final ContentResolverProcessStrategy<T> strategy) @NonNull final ContentResolverProcessStrategy<T> strategy)
throws IOException { throws IOException {
if (!Objects.equals(entry.getName(), entryName)) return; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
if (!Objects.equals(entry.getName(), entryName)) {
return;
}
} else {
if (entry.getName().equals(entryName)) {
return;
}
}
T item = JsonSerializer.parse(data, itemCls); T item = JsonSerializer.parse(data, itemCls);
strategy.importItem(context.getContentResolver(), item); strategy.importItem(context.getContentResolver(), item);
} }

View File

@ -19,8 +19,12 @@
package androidx.core.view package androidx.core.view
fun createWindowInsetsCompat(obj: Any) = WindowInsetsCompat(obj) import android.annotation.TargetApi
import android.os.Build
import android.view.WindowInsets
@TargetApi(Build.VERSION_CODES.KITKAT_WATCH)
fun createWindowInsetsCompat(obj: Any) = WindowInsetsCompat.toWindowInsetsCompat(obj as WindowInsets)
val WindowInsetsCompat.unwrapped: Any? val WindowInsetsCompat.unwrapped: Any?
@Suppress("RestrictedApi")
get() = this.toWindowInsets() get() = this.toWindowInsets()

View File

@ -19,12 +19,15 @@
package org.mariotaku.twidere.util.view package org.mariotaku.twidere.util.view
import android.annotation.TargetApi
import android.os.Build
import android.util.FloatProperty import android.util.FloatProperty
import android.util.Property import android.util.Property
import android.view.View import android.view.View
object ViewProperties { object ViewProperties {
val TRANSLATION_X_RELATIVE: Property<View, Float> = object : FloatProperty<View>("xRelative") { val TRANSLATION_X_RELATIVE: Property<View, Float> = @TargetApi(Build.VERSION_CODES.N)
object : FloatProperty<View>("xRelative") {
override fun setValue(obj: View, value: Float) { override fun setValue(obj: View, value: Float) {
obj.translationX = value * obj.width obj.translationX = value * obj.width
} }

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android"> <resources xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android">
<style name="Theme.Twidere" parent="Theme.Twidere.DayNight"> <style name="Theme.Twidere" parent="Theme.Twidere.DayNight">
<item name="darkThemeResource">@style/Theme.Twidere.Dark</item> <item name="darkThemeResource">@style/Theme.Twidere.Dark</item>
@ -41,7 +41,7 @@
<!-- Window attributes --> <!-- Window attributes -->
<item name="android:windowBackground">@android:color/transparent</item> <item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowIsTranslucent">true</item> <item name="android:windowIsTranslucent">true</item>
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item> <item name="android:windowLayoutInDisplayCutoutMode" tools:targetApi="o_mr1">shortEdges</item>
<item name="windowActionBarOverlay">true</item> <item name="windowActionBarOverlay">true</item>
<item name="actionBarStyle">@style/Widget.Twidere.Viewer.ActionBar</item> <item name="actionBarStyle">@style/Widget.Twidere.Viewer.ActionBar</item>