upgdate packages and migrate to kotlin 1.4.31
This commit is contained in:
parent
e325e886ac
commit
18e42f86a4
17
build.gradle
17
build.gradle
|
@ -2,13 +2,13 @@
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
mavenCentral()
|
||||||
maven { url "https://plugins.gradle.org/m2/" }
|
maven { url "https://plugins.gradle.org/m2/" }
|
||||||
google()
|
google()
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:4.0.0'
|
classpath 'com.android.tools.build:gradle:4.1.2'
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
}
|
}
|
||||||
|
@ -20,16 +20,17 @@ allprojects {
|
||||||
projectVersionCode = 515
|
projectVersionCode = 515
|
||||||
projectVersionName = '4.1.6'
|
projectVersionName = '4.1.6'
|
||||||
|
|
||||||
globalCompileSdkVersion = 29
|
globalCompileSdkVersion = 30
|
||||||
globalBuildToolsVersion = "29.0.3"
|
globalBuildToolsVersion = "30.0.3"
|
||||||
|
|
||||||
globalMinSdkVersion = 16
|
globalMinSdkVersion = 16
|
||||||
globalTargetSdkVersion = 29
|
globalTargetSdkVersion = 30
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
jcenter()
|
jcenter()// exoplayer and glide-transformations still using jcenter
|
||||||
|
mavenCentral()
|
||||||
maven { url "https://jitpack.io" }
|
maven { url "https://jitpack.io" }
|
||||||
google()
|
google()
|
||||||
}
|
}
|
||||||
|
@ -38,12 +39,12 @@ allprojects {
|
||||||
subprojects {
|
subprojects {
|
||||||
buildscript {
|
buildscript {
|
||||||
ext {
|
ext {
|
||||||
kotlinVersion = '1.3.72'
|
kotlinVersion = '1.4.31'
|
||||||
sharedVersions = [
|
sharedVersions = [
|
||||||
Kotlin : "${kotlinVersion}",
|
Kotlin : "${kotlinVersion}",
|
||||||
|
|
||||||
LoganSquare : '1.3.7',
|
LoganSquare : '1.3.7',
|
||||||
Jackson : '2.11.1',
|
Jackson : '2.12.1',
|
||||||
ParcelablePlease : '1.0.2',
|
ParcelablePlease : '1.0.2',
|
||||||
|
|
||||||
ExportablePreferences: '0.9.7',
|
ExportablePreferences: '0.9.7',
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
|
#Mon Mar 01 10:46:00 CST 2021
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4.1-all.zip
|
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip
|
||||||
|
|
|
@ -38,5 +38,5 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'androidx.core:core:1.3.0'
|
implementation 'androidx.core:core:1.3.2'
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,8 +175,8 @@ ext {
|
||||||
libVersions = [
|
libVersions = [
|
||||||
Kovenant : '3.3.0',
|
Kovenant : '3.3.0',
|
||||||
Mime4J : '0.7.2',
|
Mime4J : '0.7.2',
|
||||||
Dagger : '2.28.1',
|
Dagger : '2.32',
|
||||||
Exoplayer : '2.11.7',
|
Exoplayer : '2.13.2',
|
||||||
Glide : '4.11.0',
|
Glide : '4.11.0',
|
||||||
MediaViewerLibrary: '0.9.23',
|
MediaViewerLibrary: '0.9.23',
|
||||||
Stetho : '1.5.1',
|
Stetho : '1.5.1',
|
||||||
|
@ -197,20 +197,18 @@ dependencies {
|
||||||
|
|
||||||
/** Android support **/
|
/** Android support **/
|
||||||
implementation 'androidx.annotation:annotation:1.1.0'
|
implementation 'androidx.annotation:annotation:1.1.0'
|
||||||
implementation 'androidx.appcompat:appcompat:1.3.0-alpha01'
|
implementation 'androidx.appcompat:appcompat:1.3.0-beta01'
|
||||||
implementation 'androidx.browser:browser:1.2.0'
|
implementation 'androidx.browser:browser:1.2.0'
|
||||||
implementation 'androidx.cardview:cardview:1.0.0'
|
implementation 'androidx.cardview:cardview:1.0.0'
|
||||||
implementation 'androidx.core:core:1.3.0'
|
implementation 'androidx.core:core-ktx:1.3.2'
|
||||||
implementation 'androidx.core:core-ktx:1.3.0'
|
implementation 'androidx.drawerlayout:drawerlayout:1.1.1'
|
||||||
implementation 'androidx.drawerlayout:drawerlayout:1.1.0-alpha01'
|
implementation 'androidx.exifinterface:exifinterface:1.3.1'
|
||||||
implementation 'androidx.exifinterface:exifinterface:1.2.0'
|
|
||||||
implementation 'androidx.legacy:legacy-support-core-ui:1.0.0'
|
implementation 'androidx.legacy:legacy-support-core-ui:1.0.0'
|
||||||
implementation 'androidx.multidex:multidex:2.0.1'
|
implementation 'androidx.multidex:multidex:2.0.1'
|
||||||
implementation 'androidx.palette:palette-ktx:1.0.0'
|
implementation 'androidx.palette:palette-ktx:1.0.0'
|
||||||
implementation 'androidx.preference:preference:1.1.1'
|
|
||||||
implementation 'androidx.preference:preference-ktx:1.1.1'
|
implementation 'androidx.preference:preference-ktx:1.1.1'
|
||||||
implementation 'androidx.recyclerview:recyclerview:1.1.0'
|
implementation 'androidx.recyclerview:recyclerview:1.1.0'
|
||||||
implementation 'com.google.android.material:material:1.1.0'
|
implementation 'com.google.android.material:material:1.3.0'
|
||||||
|
|
||||||
|
|
||||||
/** Third-party dependencies **/
|
/** Third-party dependencies **/
|
||||||
|
@ -236,7 +234,7 @@ dependencies {
|
||||||
implementation "com.hannesdorfmann.parcelableplease:annotation:${sharedVersions['ParcelablePlease']}"
|
implementation "com.hannesdorfmann.parcelableplease:annotation:${sharedVersions['ParcelablePlease']}"
|
||||||
kapt "com.hannesdorfmann.parcelableplease:processor:${sharedVersions['ParcelablePlease']}"
|
kapt "com.hannesdorfmann.parcelableplease:processor:${sharedVersions['ParcelablePlease']}"
|
||||||
implementation 'com.squareup.okhttp3:okhttp:3.12.12'
|
implementation 'com.squareup.okhttp3:okhttp:3.12.12'
|
||||||
implementation 'com.squareup.okio:okio:2.6.0'
|
implementation 'com.squareup.okio:okio:2.9.0'
|
||||||
implementation 'com.lnikkila:extendedtouchview:0.1.1'
|
implementation 'com.lnikkila:extendedtouchview:0.1.1'
|
||||||
implementation "com.google.dagger:dagger:${libVersions['Dagger']}"
|
implementation "com.google.dagger:dagger:${libVersions['Dagger']}"
|
||||||
kapt "com.google.dagger:dagger-compiler:${libVersions['Dagger']}"
|
kapt "com.google.dagger:dagger-compiler:${libVersions['Dagger']}"
|
||||||
|
@ -244,8 +242,8 @@ dependencies {
|
||||||
implementation 'com.getkeepsafe.taptargetview:taptargetview:1.13.0'
|
implementation 'com.getkeepsafe.taptargetview:taptargetview:1.13.0'
|
||||||
implementation 'net.ypresto.androidtranscoder:android-transcoder:0.3.0'
|
implementation 'net.ypresto.androidtranscoder:android-transcoder:0.3.0'
|
||||||
implementation 'org.jsoup:jsoup:1.13.1'
|
implementation 'org.jsoup:jsoup:1.13.1'
|
||||||
implementation "com.google.android.exoplayer:exoplayer-core:${libVersions['Exoplayer']}"
|
implementation "com.google.android.exoplayer:exoplayer:${libVersions['Exoplayer']}"
|
||||||
implementation "com.google.android.exoplayer:exoplayer-ui:${libVersions['Exoplayer']}"
|
// implementation "com.google.android.exoplayer:exoplayer-ui:${libVersions['Exoplayer']}"
|
||||||
implementation "com.google.android.exoplayer:extension-okhttp:${libVersions['Exoplayer']}"
|
implementation "com.google.android.exoplayer:extension-okhttp:${libVersions['Exoplayer']}"
|
||||||
implementation "com.github.bumptech.glide:glide:${libVersions['Glide']}"
|
implementation "com.github.bumptech.glide:glide:${libVersions['Glide']}"
|
||||||
implementation "com.github.bumptech.glide:okhttp3-integration:${libVersions['Glide']}@aar"
|
implementation "com.github.bumptech.glide:okhttp3-integration:${libVersions['Glide']}@aar"
|
||||||
|
@ -287,7 +285,8 @@ dependencies {
|
||||||
|
|
||||||
/** Flavor dependencies **/
|
/** Flavor dependencies **/
|
||||||
fdroidImplementation 'org.osmdroid:osmdroid-android:5.6.5'
|
fdroidImplementation 'org.osmdroid:osmdroid-android:5.6.5'
|
||||||
fdroidImplementation 'ch.acra:acra:4.11'
|
fdroidImplementation 'ch.acra:acra-mail:5.7.0'
|
||||||
|
fdroidImplementation 'ch.acra:acra-dialog:5.7.0'
|
||||||
|
|
||||||
if (enableGoogleVariant) {
|
if (enableGoogleVariant) {
|
||||||
// START Non-FOSS component
|
// START Non-FOSS component
|
||||||
|
@ -308,7 +307,7 @@ dependencies {
|
||||||
debugImplementation "com.facebook.stetho:stetho:${libVersions['Stetho']}"
|
debugImplementation "com.facebook.stetho:stetho:${libVersions['Stetho']}"
|
||||||
debugImplementation "com.facebook.stetho:stetho-okhttp3:${libVersions['Stetho']}"
|
debugImplementation "com.facebook.stetho:stetho-okhttp3:${libVersions['Stetho']}"
|
||||||
debugImplementation 'com.github.mariotaku:StethoBeanShellREPL:0.5'
|
debugImplementation 'com.github.mariotaku:StethoBeanShellREPL:0.5'
|
||||||
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.3'
|
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.6'
|
||||||
debugImplementation('com.jayway.jsonpath:json-path:2.4.0') {
|
debugImplementation('com.jayway.jsonpath:json-path:2.4.0') {
|
||||||
exclude group: 'net.minidev', module: 'json-smart'
|
exclude group: 'net.minidev', module: 'json-smart'
|
||||||
}
|
}
|
||||||
|
@ -317,10 +316,10 @@ dependencies {
|
||||||
|
|
||||||
|
|
||||||
/** Testing **/
|
/** Testing **/
|
||||||
testImplementation 'junit:junit:4.13'
|
testImplementation 'junit:junit:4.13.2'
|
||||||
androidTestImplementation 'androidx.annotation:annotation:1.1.0'
|
androidTestImplementation 'androidx.annotation:annotation:1.1.0'
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||||
androidTestImplementation 'androidx.test:rules:1.2.0'
|
androidTestImplementation 'androidx.test:rules:1.3.0'
|
||||||
// https://g.co/androidstudio/app-test-app-conflict
|
// https://g.co/androidstudio/app-test-app-conflict
|
||||||
androidTestImplementation 'com.google.code.findbugs:jsr305:3.0.2'
|
androidTestImplementation 'com.google.code.findbugs:jsr305:3.0.2'
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,15 +38,4 @@ class CrashReportDialogActivity : CrashReportDialog() {
|
||||||
view.setPadding(padding, padding, padding, padding)
|
view.setPadding(padding, padding, padding, padding)
|
||||||
return view
|
return view
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getMainView(): View {
|
|
||||||
val text = TextView(this)
|
|
||||||
TextViewCompat.setTextAppearance(text, android.R.style.TextAppearance_DeviceDefault_Medium)
|
|
||||||
val dialogTextId = this.config.resDialogText()
|
|
||||||
if (dialogTextId != 0) {
|
|
||||||
text.text = this.getText(dialogTextId)
|
|
||||||
}
|
|
||||||
return text
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,8 +27,10 @@ import android.app.Application
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import org.acra.ACRA
|
import org.acra.ACRA
|
||||||
import org.acra.ReportingInteractionMode
|
import org.acra.config.CoreConfigurationBuilder
|
||||||
import org.acra.config.ConfigurationBuilder
|
import org.acra.config.DialogConfigurationBuilder
|
||||||
|
import org.acra.config.MailSenderConfigurationBuilder
|
||||||
|
import org.acra.data.StringFormat
|
||||||
import org.mariotaku.kpreferences.get
|
import org.mariotaku.kpreferences.get
|
||||||
import org.mariotaku.ktextension.addOnAccountsUpdatedListenerSafe
|
import org.mariotaku.ktextension.addOnAccountsUpdatedListenerSafe
|
||||||
import org.mariotaku.twidere.BuildConfig
|
import org.mariotaku.twidere.BuildConfig
|
||||||
|
@ -40,6 +42,7 @@ import org.mariotaku.twidere.constant.themeBackgroundAlphaKey
|
||||||
import org.mariotaku.twidere.constant.themeBackgroundOptionKey
|
import org.mariotaku.twidere.constant.themeBackgroundOptionKey
|
||||||
import org.mariotaku.twidere.constant.themeKey
|
import org.mariotaku.twidere.constant.themeKey
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mariotaku on 2017/5/8.
|
* Created by mariotaku on 2017/5/8.
|
||||||
*/
|
*/
|
||||||
|
@ -56,14 +59,17 @@ class ACRAAnalyzer : Analyzer() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun init(application: Application) {
|
override fun init(application: Application) {
|
||||||
val config = ConfigurationBuilder(application)
|
val builder = CoreConfigurationBuilder(application)
|
||||||
.setReportingInteractionMode(ReportingInteractionMode.DIALOG)
|
builder.setBuildConfigClass(BuildConfig::class.java).setReportFormat(StringFormat.JSON)
|
||||||
.setResDialogText(R.string.message_app_crashed)
|
builder.getPluginConfigurationBuilder(DialogConfigurationBuilder::class.java)
|
||||||
.setResDialogTheme(R.style.Theme_Twidere_NoDisplay_DayNight)
|
.setResText(R.string.message_app_crashed)
|
||||||
|
.setResTheme(R.style.Theme_Twidere_NoDisplay_DayNight)
|
||||||
.setReportDialogClass(CrashReportDialogActivity::class.java)
|
.setReportDialogClass(CrashReportDialogActivity::class.java)
|
||||||
|
.setEnabled(true)
|
||||||
|
builder.getPluginConfigurationBuilder(MailSenderConfigurationBuilder::class.java)
|
||||||
.setMailTo(TWIDERE_PROJECT_EMAIL)
|
.setMailTo(TWIDERE_PROJECT_EMAIL)
|
||||||
.build()
|
.setEnabled(true)
|
||||||
ACRA.init(application, config)
|
ACRA.init(application, builder)
|
||||||
val reporter = ACRA.getErrorReporter()
|
val reporter = ACRA.getErrorReporter()
|
||||||
reporter.putCustomData("debug", BuildConfig.DEBUG.toString())
|
reporter.putCustomData("debug", BuildConfig.DEBUG.toString())
|
||||||
reporter.putCustomData("build.brand", Build.BRAND)
|
reporter.putCustomData("build.brand", Build.BRAND)
|
||||||
|
|
|
@ -23,7 +23,7 @@ import android.content.Intent
|
||||||
import android.os.Parcelable
|
import android.os.Parcelable
|
||||||
|
|
||||||
inline fun <reified T : Parcelable> Intent.getTypedArrayExtra(key: String): Array<T> {
|
inline fun <reified T : Parcelable> Intent.getTypedArrayExtra(key: String): Array<T> {
|
||||||
val extra = getParcelableArrayExtra(key)
|
val extra = getParcelableArrayExtra(key) ?: emptyArray()
|
||||||
return Array(extra.size) { extra[it] as T }
|
return Array(extra.size) { extra[it] as T }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -196,9 +196,10 @@ open class BaseActivity : ChameleonActivity(), IBaseActivity<BaseActivity>, IThe
|
||||||
private set
|
private set
|
||||||
|
|
||||||
override fun getSystemWindowInsets(caller: Fragment, insets: Rect): Boolean {
|
override fun getSystemWindowInsets(caller: Fragment, insets: Rect): Boolean {
|
||||||
if (systemWindowsInsets == null) return false
|
return systemWindowsInsets?.let {
|
||||||
insets.set(systemWindowsInsets)
|
insets.set(it)
|
||||||
return true
|
true
|
||||||
|
} ?: false
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onApplyWindowInsets(v: View, insets: WindowInsetsCompat): WindowInsetsCompat {
|
override fun onApplyWindowInsets(v: View, insets: WindowInsetsCompat): WindowInsetsCompat {
|
||||||
|
|
|
@ -70,7 +70,7 @@ class BrowserSignInActivity : BaseActivity() {
|
||||||
setSupportMultipleWindows(true)
|
setSupportMultipleWindows(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
webView.loadUrl(intent.dataString)
|
intent.dataString?.let { webView.loadUrl(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
|
|
|
@ -124,6 +124,7 @@ class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener
|
||||||
// Utility classes
|
// Utility classes
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var extractor: Extractor
|
lateinit var extractor: Extractor
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var locationManager: LocationManager
|
lateinit var locationManager: LocationManager
|
||||||
|
|
||||||
|
@ -362,7 +363,7 @@ class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener
|
||||||
statusShortenerUsed = !ComponentPickerPreference.isNoneValue(kPreferences[statusShortenerKey])
|
statusShortenerUsed = !ComponentPickerPreference.isNoneValue(kPreferences[statusShortenerKey])
|
||||||
if (kPreferences[attachLocationKey]) {
|
if (kPreferences[attachLocationKey]) {
|
||||||
if (checkAnySelfPermissionsGranted(AndroidPermission.ACCESS_COARSE_LOCATION,
|
if (checkAnySelfPermissionsGranted(AndroidPermission.ACCESS_COARSE_LOCATION,
|
||||||
AndroidPermission.ACCESS_FINE_LOCATION)) {
|
AndroidPermission.ACCESS_FINE_LOCATION)) {
|
||||||
try {
|
try {
|
||||||
startLocationUpdateIfEnabled()
|
startLocationUpdateIfEnabled()
|
||||||
} catch (e: SecurityException) {
|
} catch (e: SecurityException) {
|
||||||
|
@ -379,8 +380,8 @@ class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener
|
||||||
saveAccountSelection()
|
saveAccountSelection()
|
||||||
saveVisibility()
|
saveVisibility()
|
||||||
try {
|
try {
|
||||||
if (locationListener != null) {
|
locationListener?.let {
|
||||||
locationManager.removeUpdates(locationListener)
|
locationManager.removeUpdates(it)
|
||||||
locationListener = null
|
locationListener = null
|
||||||
}
|
}
|
||||||
} catch (ignore: SecurityException) {
|
} catch (ignore: SecurityException) {
|
||||||
|
@ -397,8 +398,8 @@ class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener
|
||||||
if (resultCode == Activity.RESULT_OK && data != null) {
|
if (resultCode == Activity.RESULT_OK && data != null) {
|
||||||
val src = MediaPickerActivity.getMediaUris(data)
|
val src = MediaPickerActivity.getMediaUris(data)
|
||||||
TaskStarter.execute(AddMediaTask(this, src, null,
|
TaskStarter.execute(AddMediaTask(this, src, null,
|
||||||
copySrc = false,
|
copySrc = false,
|
||||||
deleteSrc = false
|
deleteSrc = false
|
||||||
))
|
))
|
||||||
val extras = data.getBundleExtra(MediaPickerActivity.EXTRA_EXTRAS)
|
val extras = data.getBundleExtra(MediaPickerActivity.EXTRA_EXTRAS)
|
||||||
if (extras?.getBoolean(EXTRA_IS_POSSIBLY_SENSITIVE) == true) {
|
if (extras?.getBoolean(EXTRA_IS_POSSIBLY_SENSITIVE) == true) {
|
||||||
|
@ -417,9 +418,9 @@ class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener
|
||||||
REQUEST_EXTENSION_COMPOSE -> {
|
REQUEST_EXTENSION_COMPOSE -> {
|
||||||
if (resultCode == Activity.RESULT_OK && data != null) {
|
if (resultCode == Activity.RESULT_OK && data != null) {
|
||||||
// The latter two is for compatibility
|
// The latter two is for compatibility
|
||||||
val text = data.getCharSequenceExtra(Intent.EXTRA_TEXT) ?:
|
val text = data.getCharSequenceExtra(Intent.EXTRA_TEXT)
|
||||||
data.getStringExtra(EXTRA_TEXT) ?:
|
?: data.getStringExtra(EXTRA_TEXT)
|
||||||
data.getStringExtra(EXTRA_APPEND_TEXT)
|
?: data.getStringExtra(EXTRA_APPEND_TEXT)
|
||||||
val isReplaceMode = data.getBooleanExtra(EXTRA_IS_REPLACE_MODE,
|
val isReplaceMode = data.getBooleanExtra(EXTRA_IS_REPLACE_MODE,
|
||||||
data.getStringExtra(EXTRA_APPEND_TEXT) == null)
|
data.getStringExtra(EXTRA_APPEND_TEXT) == null)
|
||||||
if (text != null) {
|
if (text != null) {
|
||||||
|
@ -433,12 +434,12 @@ class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener
|
||||||
updateTextCount()
|
updateTextCount()
|
||||||
}
|
}
|
||||||
|
|
||||||
val src = MediaPickerActivity.getMediaUris(data)?.takeIf(Array<Uri>::isNotEmpty) ?:
|
val src = MediaPickerActivity.getMediaUris(data)?.takeIf(Array<Uri>::isNotEmpty)
|
||||||
data.getParcelableExtra<Uri>(EXTRA_IMAGE_URI)?.let { arrayOf(it) }
|
?: data.getParcelableExtra<Uri>(EXTRA_IMAGE_URI)?.let { arrayOf(it) }
|
||||||
if (src != null) {
|
if (src != null) {
|
||||||
TaskStarter.execute(AddMediaTask(this, src, null,
|
TaskStarter.execute(AddMediaTask(this, src, null,
|
||||||
copySrc = false,
|
copySrc = false,
|
||||||
deleteSrc = false
|
deleteSrc = false
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -618,7 +619,8 @@ class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener
|
||||||
when (ev.actionMasked) {
|
when (ev.actionMasked) {
|
||||||
MotionEvent.ACTION_DOWN -> {
|
MotionEvent.ACTION_DOWN -> {
|
||||||
if (isAccountSelectorVisible && !TwidereViewUtils.hitView(ev, accountSelectorButton)) {
|
if (isAccountSelectorVisible && !TwidereViewUtils.hitView(ev, accountSelectorButton)) {
|
||||||
val layoutManager = accountSelector.layoutManager ?: return super.dispatchTouchEvent(ev)
|
val layoutManager = accountSelector.layoutManager
|
||||||
|
?: return super.dispatchTouchEvent(ev)
|
||||||
val clickedItem = (0 until layoutManager.childCount).any {
|
val clickedItem = (0 until layoutManager.childCount).any {
|
||||||
val child = layoutManager.getChildAt(it)
|
val child = layoutManager.getChildAt(it)
|
||||||
child != null && TwidereViewUtils.hitView(ev, child)
|
child != null && TwidereViewUtils.hitView(ev, child)
|
||||||
|
@ -786,8 +788,10 @@ class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener
|
||||||
requestOrUpdateLocation()
|
requestOrUpdateLocation()
|
||||||
} else if (locationListener != null) {
|
} else if (locationListener != null) {
|
||||||
try {
|
try {
|
||||||
locationManager.removeUpdates(locationListener)
|
locationListener?.let {
|
||||||
locationListener = null
|
locationManager.removeUpdates(it)
|
||||||
|
locationListener = null
|
||||||
|
}
|
||||||
} catch (e: SecurityException) {
|
} catch (e: SecurityException) {
|
||||||
//Ignore
|
//Ignore
|
||||||
}
|
}
|
||||||
|
@ -1090,20 +1094,20 @@ class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener
|
||||||
if (intent == null) return false
|
if (intent == null) return false
|
||||||
val action = intent.action
|
val action = intent.action
|
||||||
val hasVisibility = intent.hasExtra(EXTRA_VISIBILITY)
|
val hasVisibility = intent.hasExtra(EXTRA_VISIBILITY)
|
||||||
val hasAccountKeys: Boolean
|
val hasAccountKeys: Boolean = when {
|
||||||
when {
|
|
||||||
intent.hasExtra(EXTRA_ACCOUNT_KEYS) -> {
|
intent.hasExtra(EXTRA_ACCOUNT_KEYS) -> {
|
||||||
val accountKeys = intent.getTypedArrayExtra<UserKey>(EXTRA_ACCOUNT_KEYS)
|
val accountKeys = intent.getTypedArrayExtra<UserKey>(EXTRA_ACCOUNT_KEYS)
|
||||||
accountsAdapter.selectedAccountKeys = accountKeys
|
accountsAdapter.selectedAccountKeys = accountKeys
|
||||||
hasAccountKeys = true
|
true
|
||||||
}
|
}
|
||||||
intent.hasExtra(EXTRA_ACCOUNT_KEY) -> {
|
intent.hasExtra(EXTRA_ACCOUNT_KEY) -> {
|
||||||
val accountKey = intent.getParcelableExtra<UserKey>(EXTRA_ACCOUNT_KEY)
|
intent.getParcelableExtra<UserKey>(EXTRA_ACCOUNT_KEY)?.let {
|
||||||
accountsAdapter.selectedAccountKeys = arrayOf(accountKey)
|
accountsAdapter.selectedAccountKeys = arrayOf(it)
|
||||||
hasAccountKeys = true
|
true
|
||||||
|
} ?: false
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
hasAccountKeys = false
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
when (action) {
|
when (action) {
|
||||||
|
@ -1114,8 +1118,8 @@ class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener
|
||||||
if (stream != null) {
|
if (stream != null) {
|
||||||
val src = stream.toTypedArray()
|
val src = stream.toTypedArray()
|
||||||
TaskStarter.execute(AddMediaTask(this, src, null,
|
TaskStarter.execute(AddMediaTask(this, src, null,
|
||||||
copySrc = true,
|
copySrc = true,
|
||||||
deleteSrc = false
|
deleteSrc = false
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1126,8 +1130,8 @@ class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
val src = arrayOf(data)
|
val src = arrayOf(data)
|
||||||
TaskStarter.execute(AddMediaTask(this, src, null,
|
TaskStarter.execute(AddMediaTask(this, src, null,
|
||||||
copySrc = true,
|
copySrc = true,
|
||||||
deleteSrc = false
|
deleteSrc = false
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1246,7 +1250,7 @@ class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleReplyMultipleIntent(screenNames: Array<String>?, accountKey: UserKey?,
|
private fun handleReplyMultipleIntent(screenNames: Array<String>?, accountKey: UserKey?,
|
||||||
inReplyToStatus: ParcelableStatus?): Boolean {
|
inReplyToStatus: ParcelableStatus?): Boolean {
|
||||||
if (screenNames == null || screenNames.isEmpty() || accountKey == null ||
|
if (screenNames == null || screenNames.isEmpty() || accountKey == null ||
|
||||||
inReplyToStatus == null) return false
|
inReplyToStatus == null) return false
|
||||||
val myScreenName = DataStoreUtils.getAccountScreenName(this, accountKey) ?: return false
|
val myScreenName = DataStoreUtils.getAccountScreenName(this, accountKey) ?: return false
|
||||||
|
@ -1444,8 +1448,9 @@ class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener
|
||||||
val provider = locationManager.getBestProvider(criteria, true)
|
val provider = locationManager.getBestProvider(criteria, true)
|
||||||
if (provider != null) {
|
if (provider != null) {
|
||||||
locationLabel.setText(R.string.getting_location)
|
locationLabel.setText(R.string.getting_location)
|
||||||
locationListener = ComposeLocationListener(this)
|
locationListener = ComposeLocationListener(this).also {
|
||||||
locationManager.requestLocationUpdates(provider, 0, 0f, locationListener)
|
locationManager.requestLocationUpdates(provider, 0, 0f, it)
|
||||||
|
}
|
||||||
val location = locationManager.getCachedLocation()
|
val location = locationManager.getCachedLocation()
|
||||||
if (location != null) {
|
if (location != null) {
|
||||||
locationListener?.onLocationChanged(location)
|
locationListener?.onLocationChanged(location)
|
||||||
|
@ -1716,7 +1721,7 @@ class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getTwitterReplyTextAndMentions(text: String = editText.text?.toString().orEmpty(),
|
private fun getTwitterReplyTextAndMentions(text: String = editText.text?.toString().orEmpty(),
|
||||||
accounts: Array<AccountDetails> = accountsAdapter.selectedAccounts): ReplyTextAndMentions? {
|
accounts: Array<AccountDetails> = accountsAdapter.selectedAccounts): ReplyTextAndMentions? {
|
||||||
val inReplyTo = inReplyToStatus ?: return null
|
val inReplyTo = inReplyToStatus ?: return null
|
||||||
if (!ignoreMentions) return null
|
if (!ignoreMentions) return null
|
||||||
val account = accounts.singleOrNull() ?: return null
|
val account = accounts.singleOrNull() ?: return null
|
||||||
|
@ -1841,8 +1846,8 @@ class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener
|
||||||
editText.customSelectionActionModeCallback = this
|
editText.customSelectionActionModeCallback = this
|
||||||
editText.imageInputListener = { contentInfo ->
|
editText.imageInputListener = { contentInfo ->
|
||||||
val task = AddMediaTask(this, arrayOf(contentInfo.contentUri), null,
|
val task = AddMediaTask(this, arrayOf(contentInfo.contentUri), null,
|
||||||
copySrc = true,
|
copySrc = true,
|
||||||
deleteSrc = false
|
deleteSrc = false
|
||||||
)
|
)
|
||||||
task.callback = {
|
task.callback = {
|
||||||
contentInfo.releasePermission()
|
contentInfo.releasePermission()
|
||||||
|
@ -2083,11 +2088,11 @@ class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener
|
||||||
}
|
}
|
||||||
|
|
||||||
private class AddMediaTask(activity: ComposeActivity, sources: Array<Uri>, types: IntArray?,
|
private class AddMediaTask(activity: ComposeActivity, sources: Array<Uri>, types: IntArray?,
|
||||||
copySrc: Boolean, deleteSrc: Boolean) : AbsAddMediaTask<((List<ParcelableMediaUpdate>?) -> Unit)?>(
|
copySrc: Boolean, deleteSrc: Boolean) : AbsAddMediaTask<((List<ParcelableMediaUpdate>?) -> Unit)?>(
|
||||||
activity, sources, types, copySrc, deleteSrc) {
|
activity, sources, types, copySrc, deleteSrc) {
|
||||||
|
|
||||||
override fun afterExecute(callback: ((List<ParcelableMediaUpdate>?) -> Unit)?,
|
override fun afterExecute(callback: ((List<ParcelableMediaUpdate>?) -> Unit)?,
|
||||||
result: List<ParcelableMediaUpdate>?) {
|
result: List<ParcelableMediaUpdate>?) {
|
||||||
callback?.invoke(result)
|
callback?.invoke(result)
|
||||||
val activity = context as? ComposeActivity ?: return
|
val activity = context as? ComposeActivity ?: return
|
||||||
activity.setProgressVisible(false)
|
activity.setProgressVisible(false)
|
||||||
|
|
|
@ -11,11 +11,14 @@ class FragmentContentActivity : BaseActivity() {
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
title = intent.getStringExtra(EXTRA_TITLE)
|
title = intent.getStringExtra(EXTRA_TITLE)
|
||||||
val fragment = Fragment.instantiate(this, intent.getStringExtra(EXTRA_FRAGMENT),
|
intent.getStringExtra(EXTRA_FRAGMENT)?.let {
|
||||||
|
Fragment.instantiate(this, it,
|
||||||
intent.getBundleExtra(EXTRA_FRAGMENT_ARGUMENTS))
|
intent.getBundleExtra(EXTRA_FRAGMENT_ARGUMENTS))
|
||||||
val ft = supportFragmentManager.beginTransaction()
|
}?.let { fragment ->
|
||||||
ft.replace(android.R.id.content, fragment)
|
val ft = supportFragmentManager.beginTransaction()
|
||||||
ft.commit()
|
ft.replace(android.R.id.content, fragment)
|
||||||
|
ft.commit()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
|
@ -732,7 +732,9 @@ class HomeActivity : BaseActivity(), OnClickListener, OnPageChangeListener, Supp
|
||||||
} else {
|
} else {
|
||||||
Utils.getDefaultAccountKey(this)
|
Utils.getDefaultAccountKey(this)
|
||||||
}
|
}
|
||||||
IntentUtils.openSearch(this, accountKey, query)
|
if (query != null) {
|
||||||
|
IntentUtils.openSearch(this, accountKey, query)
|
||||||
|
}
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
val refreshOnStart = preferences.getBoolean(SharedPreferenceConstants.KEY_REFRESH_ON_START, false)
|
val refreshOnStart = preferences.getBoolean(SharedPreferenceConstants.KEY_REFRESH_ON_START, false)
|
||||||
|
|
|
@ -41,18 +41,18 @@ class ImageCropperActivity : BaseActivity(), CropImageView.OnSetImageUriComplete
|
||||||
/**
|
/**
|
||||||
* Persist URI image to crop URI if specific permissions are required
|
* Persist URI image to crop URI if specific permissions are required
|
||||||
*/
|
*/
|
||||||
private val cropImageUri: Uri get() = intent.getParcelableExtra(CropImage.CROP_IMAGE_EXTRA_SOURCE)
|
private val cropImageUri: Uri? get() = intent.getParcelableExtra(CropImage.CROP_IMAGE_EXTRA_SOURCE)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the options that were set for the crop image
|
* the options that were set for the crop image
|
||||||
*/
|
*/
|
||||||
private val options: CropImageOptions get() = intent.getParcelableExtra(CropImage.CROP_IMAGE_EXTRA_OPTIONS)
|
private val options: CropImageOptions? get() = intent.getParcelableExtra(CropImage.CROP_IMAGE_EXTRA_OPTIONS)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Android uri to save the cropped image into.<br></br>
|
* Get Android uri to save the cropped image into.<br></br>
|
||||||
* Use the given in options or create a temp file.
|
* Use the given in options or create a temp file.
|
||||||
*/
|
*/
|
||||||
private val outputUri: Uri get() = options.outputUri
|
private val outputUri: Uri? get() = options?.outputUri
|
||||||
|
|
||||||
@SuppressLint("NewApi")
|
@SuppressLint("NewApi")
|
||||||
public override fun onCreate(savedInstanceState: Bundle?) {
|
public override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
@ -107,11 +107,13 @@ class ImageCropperActivity : BaseActivity(), CropImageView.OnSetImageUriComplete
|
||||||
|
|
||||||
override fun onSetImageUriComplete(view: CropImageView, uri: Uri, error: Exception?) {
|
override fun onSetImageUriComplete(view: CropImageView, uri: Uri, error: Exception?) {
|
||||||
if (error == null) {
|
if (error == null) {
|
||||||
if (options.initialCropWindowRectangle != null) {
|
options?.let { options ->
|
||||||
cropImageView.cropRect = options.initialCropWindowRectangle
|
if (options.initialCropWindowRectangle != null) {
|
||||||
}
|
cropImageView.cropRect = options.initialCropWindowRectangle
|
||||||
if (options.initialRotation > -1) {
|
}
|
||||||
cropImageView.rotatedDegrees = options.initialRotation
|
if (options.initialRotation > -1) {
|
||||||
|
cropImageView.rotatedDegrees = options.initialRotation
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setResult(null, error, 1)
|
setResult(null, error, 1)
|
||||||
|
@ -128,16 +130,18 @@ class ImageCropperActivity : BaseActivity(), CropImageView.OnSetImageUriComplete
|
||||||
* Execute crop image and save the result to output uri.
|
* Execute crop image and save the result to output uri.
|
||||||
*/
|
*/
|
||||||
private fun cropImage() {
|
private fun cropImage() {
|
||||||
if (options.noOutputImage) {
|
options?.let { options ->
|
||||||
setResult(null, null, 1)
|
if (options.noOutputImage) {
|
||||||
} else {
|
setResult(null, null, 1)
|
||||||
val outputUri = outputUri
|
} else {
|
||||||
cropImageView.saveCroppedImageAsync(outputUri,
|
val outputUri = outputUri
|
||||||
options.outputCompressFormat,
|
cropImageView.saveCroppedImageAsync(outputUri,
|
||||||
options.outputCompressQuality,
|
options.outputCompressFormat,
|
||||||
options.outputRequestWidth,
|
options.outputCompressQuality,
|
||||||
options.outputRequestHeight,
|
options.outputRequestWidth,
|
||||||
options.outputRequestSizeOptions)
|
options.outputRequestHeight,
|
||||||
|
options.outputRequestSizeOptions)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,7 @@ class KeyboardShortcutPreferenceCompatActivity : BaseActivity(), OnClickListener
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
private val contextTag: String
|
private val contextTag: String?
|
||||||
get() = intent.getStringExtra(EXTRA_CONTEXT_TAG)
|
get() = intent.getStringExtra(EXTRA_CONTEXT_TAG)
|
||||||
|
|
||||||
private val keyAction: String?
|
private val keyAction: String?
|
||||||
|
|
|
@ -174,7 +174,9 @@ class SignInActivity : BaseActivity(), OnClickListener, TextWatcher,
|
||||||
when (requestCode) {
|
when (requestCode) {
|
||||||
REQUEST_EDIT_API -> {
|
REQUEST_EDIT_API -> {
|
||||||
if (resultCode == Activity.RESULT_OK && data != null) {
|
if (resultCode == Activity.RESULT_OK && data != null) {
|
||||||
apiConfig = data.getParcelableExtra(EXTRA_API_CONFIG)
|
data.getParcelableExtra<CustomAPIConfig>(EXTRA_API_CONFIG)?.let {
|
||||||
|
apiConfig = it
|
||||||
|
}
|
||||||
updateSignInType()
|
updateSignInType()
|
||||||
}
|
}
|
||||||
setSignInButton()
|
setSignInButton()
|
||||||
|
@ -193,7 +195,9 @@ class SignInActivity : BaseActivity(), OnClickListener, TextWatcher,
|
||||||
val clientId = extras.getString(EXTRA_CLIENT_ID)!!
|
val clientId = extras.getString(EXTRA_CLIENT_ID)!!
|
||||||
val clientSecret = extras.getString(EXTRA_CLIENT_SECRET)!!
|
val clientSecret = extras.getString(EXTRA_CLIENT_SECRET)!!
|
||||||
|
|
||||||
finishMastodonBrowserLogin(host, clientId, clientSecret, code)
|
if (code != null) {
|
||||||
|
finishMastodonBrowserLogin(host, clientId, clientSecret, code)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,7 +137,7 @@ class UserListSelectorActivity : BaseActivity(),
|
||||||
when (requestCode) {
|
when (requestCode) {
|
||||||
REQUEST_SELECT_USER -> {
|
REQUEST_SELECT_USER -> {
|
||||||
if (resultCode == Activity.RESULT_OK && data != null) {
|
if (resultCode == Activity.RESULT_OK && data != null) {
|
||||||
val user = data.getParcelableExtra<ParcelableUser>(EXTRA_USER)
|
val user = data.getParcelableExtra<ParcelableUser>(EXTRA_USER) ?: return
|
||||||
loadUserLists(accountKey!!, user.key)
|
loadUserLists(accountKey!!, user.key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,9 @@ abstract class AbsStatusDialogActivity : BaseActivity() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val accountKey = data.getParcelableExtra<UserKey>(EXTRA_ACCOUNT_KEY)
|
val accountKey = data.getParcelableExtra<UserKey>(EXTRA_ACCOUNT_KEY)
|
||||||
showDialogFragment(accountKey, statusId, status)
|
if (accountKey != null) {
|
||||||
|
showDialogFragment(accountKey, statusId, status)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ import org.mariotaku.twidere.model.premium.PurchaseResult
|
||||||
*/
|
*/
|
||||||
|
|
||||||
abstract class AbsExtraFeaturePurchaseActivity : BaseActivity() {
|
abstract class AbsExtraFeaturePurchaseActivity : BaseActivity() {
|
||||||
protected val requestingFeature: String get() = intent.getStringExtra(EXTRA_REQUESTING_FEATURE)
|
protected val requestingFeature: String? get() = intent.getStringExtra(EXTRA_REQUESTING_FEATURE)
|
||||||
|
|
||||||
protected fun finishWithError(code: Int) {
|
protected fun finishWithError(code: Int) {
|
||||||
setResult(code)
|
setResult(code)
|
||||||
|
|
|
@ -44,8 +44,10 @@ abstract class AbsUserListRelatedShortcutCreatorActivity : AbsShortcutCreatorAct
|
||||||
}
|
}
|
||||||
val list = data.getParcelableExtra<ParcelableUserList>(EXTRA_USER_LIST)
|
val list = data.getParcelableExtra<ParcelableUserList>(EXTRA_USER_LIST)
|
||||||
val extras = data.getBundleExtra(EXTRA_EXTRAS)
|
val extras = data.getBundleExtra(EXTRA_EXTRAS)
|
||||||
val accountKey = extras.getParcelable<UserKey>(EXTRA_ACCOUNT_KEY)
|
val accountKey = extras?.getParcelable<UserKey>(EXTRA_ACCOUNT_KEY)
|
||||||
onUserListSelected(accountKey, list)
|
if (list != null) {
|
||||||
|
onUserListSelected(accountKey, list)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
super.onActivityResult(requestCode, resultCode, data)
|
super.onActivityResult(requestCode, resultCode, data)
|
||||||
|
|
|
@ -44,8 +44,10 @@ abstract class AbsUserRelatedShortcutCreatorActivity : AbsShortcutCreatorActivit
|
||||||
}
|
}
|
||||||
val user = data.getParcelableExtra<ParcelableUser>(EXTRA_USER)
|
val user = data.getParcelableExtra<ParcelableUser>(EXTRA_USER)
|
||||||
val extras = data.getBundleExtra(EXTRA_EXTRAS)
|
val extras = data.getBundleExtra(EXTRA_EXTRAS)
|
||||||
val accountKey = extras.getParcelable<UserKey>(EXTRA_ACCOUNT_KEY)
|
val accountKey = extras?.getParcelable<UserKey>(EXTRA_ACCOUNT_KEY)
|
||||||
onUserSelected(accountKey, user)
|
if (user != null) {
|
||||||
|
onUserSelected(accountKey, user)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
super.onActivityResult(requestCode, resultCode, data)
|
super.onActivityResult(requestCode, resultCode, data)
|
||||||
|
|
|
@ -176,7 +176,7 @@ class TwidereApplication : Application(), OnSharedPreferenceChangeListener {
|
||||||
}, updateImmediately = true)
|
}, updateImmediately = true)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onConfigurationChanged(newConfig: Configuration?) {
|
override fun onConfigurationChanged(newConfig: Configuration) {
|
||||||
applyLanguageSettings()
|
applyLanguageSettings()
|
||||||
super.onConfigurationChanged(newConfig)
|
super.onConfigurationChanged(newConfig)
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ val ConnectivityManager.activateNetworkCompat: Network?
|
||||||
return activeNetwork
|
return activeNetwork
|
||||||
}
|
}
|
||||||
val activeInfo = activeNetworkInfo ?: return null
|
val activeInfo = activeNetworkInfo ?: return null
|
||||||
return allNetworks.firstOrNull { activeInfo.same(getNetworkInfo(it)) }
|
return allNetworks.firstOrNull { getNetworkInfo(it)?.let { it1 -> activeInfo.same(it1) } == true }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun NetworkInfo.same(another: NetworkInfo) = type == another.type && subtype == another.subtype
|
private fun NetworkInfo.same(another: NetworkInfo) = type == another.type && subtype == another.subtype
|
|
@ -95,7 +95,7 @@ class AccountsManagerFragment : BaseFragment(), LoaderManager.LoaderCallbacks<Li
|
||||||
if (resultCode != Activity.RESULT_OK || data == null)
|
if (resultCode != Activity.RESULT_OK || data == null)
|
||||||
return
|
return
|
||||||
val am = AccountManager.get(context)
|
val am = AccountManager.get(context)
|
||||||
val accountKey: UserKey = data.getBundleExtra(EXTRA_EXTRAS).getParcelable(EXTRA_ACCOUNT_KEY) ?: return
|
val accountKey: UserKey = data.getBundleExtra(EXTRA_EXTRAS)?.getParcelable(EXTRA_ACCOUNT_KEY) ?: return
|
||||||
val color = data.getIntExtra(EXTRA_COLOR, Color.WHITE)
|
val color = data.getIntExtra(EXTRA_COLOR, Color.WHITE)
|
||||||
val details = adapter.findItem(accountKey) ?: return
|
val details = adapter.findItem(accountKey) ?: return
|
||||||
details.color = color
|
details.color = color
|
||||||
|
|
|
@ -57,7 +57,7 @@ open class BaseWebViewFragment : BaseFragment() {
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?): View? {
|
savedInstanceState: Bundle?): View? {
|
||||||
internalWebView?.destroy()
|
internalWebView?.destroy()
|
||||||
internalWebView = WebView(activity)
|
internalWebView = activity?.let { WebView(it) }
|
||||||
webViewAvailable = true
|
webViewAvailable = true
|
||||||
return internalWebView
|
return internalWebView
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,7 +113,7 @@ class UserListFragment : AbsToolbarTabPagesFragment(), OnClickListener,
|
||||||
val userList = this.userList
|
val userList = this.userList
|
||||||
if (resultCode != Activity.RESULT_OK || !data!!.hasExtra(EXTRA_USER) || userList == null)
|
if (resultCode != Activity.RESULT_OK || !data!!.hasExtra(EXTRA_USER) || userList == null)
|
||||||
return
|
return
|
||||||
val user = data.getParcelableExtra<ParcelableUser>(EXTRA_USER)
|
val user = data.getParcelableExtra<ParcelableUser>(EXTRA_USER) ?: return
|
||||||
twitter.addUserListMembersAsync(userList.account_key, userList.id, user)
|
twitter.addUserListMembersAsync(userList.account_key, userList.id, user)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ class FilteredUsersFragment : BaseFiltersFragment() {
|
||||||
when (requestCode) {
|
when (requestCode) {
|
||||||
REQUEST_SELECT_USER -> {
|
REQUEST_SELECT_USER -> {
|
||||||
if (resultCode != FragmentActivity.RESULT_OK || data == null) return
|
if (resultCode != FragmentActivity.RESULT_OK || data == null) return
|
||||||
val user = data.getParcelableExtra<ParcelableUser>(EXTRA_USER)
|
val user = data.getParcelableExtra<ParcelableUser>(EXTRA_USER) ?: return
|
||||||
executeAfterFragmentResumed { fragment ->
|
executeAfterFragmentResumed { fragment ->
|
||||||
AddUserFilterDialogFragment.show(fragment.childFragmentManager, user)
|
AddUserFilterDialogFragment.show(fragment.childFragmentManager, user)
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ class FilteredUsersFragment : BaseFiltersFragment() {
|
||||||
}
|
}
|
||||||
REQUEST_EXPORT_MUTES_SELECT_ACCOUNT -> {
|
REQUEST_EXPORT_MUTES_SELECT_ACCOUNT -> {
|
||||||
if (resultCode != FragmentActivity.RESULT_OK || data == null) return
|
if (resultCode != FragmentActivity.RESULT_OK || data == null) return
|
||||||
val accountKey = data.getParcelableExtra<UserKey>(EXTRA_ACCOUNT_KEY)
|
val accountKey = data.getParcelableExtra<UserKey>(EXTRA_ACCOUNT_KEY) ?: return
|
||||||
val userKeys = data.getBundleExtra(EXTRA_EXTRAS)?.getNullableTypedArray<UserKey>(EXTRA_ITEMS) ?: return
|
val userKeys = data.getBundleExtra(EXTRA_EXTRAS)?.getNullableTypedArray<UserKey>(EXTRA_ITEMS) ?: return
|
||||||
exportToMutedUsers(accountKey, userKeys)
|
exportToMutedUsers(accountKey, userKeys)
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,10 @@ class ExternalBrowserPageFragment : MediaViewerFragment() {
|
||||||
webSettings.javaScriptEnabled = true
|
webSettings.javaScriptEnabled = true
|
||||||
webSettings.loadsImagesAutomatically = true
|
webSettings.loadsImagesAutomatically = true
|
||||||
val media = arguments?.getParcelable<ParcelableMedia>(EXTRA_MEDIA) ?: throw NullPointerException()
|
val media = arguments?.getParcelable<ParcelableMedia>(EXTRA_MEDIA) ?: throw NullPointerException()
|
||||||
webView.loadUrl(if (TextUtils.isEmpty(media.media_url)) media.url else media.media_url)
|
val target = if (TextUtils.isEmpty(media.media_url)) media.url else media.media_url
|
||||||
|
target?.let {
|
||||||
|
webView.loadUrl(it)
|
||||||
|
}
|
||||||
webViewContainer.setAspectRatioSource(VideoPageFragment.MediaAspectRatioSource(media, this))
|
webViewContainer.setAspectRatioSource(VideoPageFragment.MediaAspectRatioSource(media, this))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -188,8 +188,9 @@ class MessageConversationInfoFragment : BaseFragment(), IToolBarSupportFragment,
|
||||||
when (requestCode) {
|
when (requestCode) {
|
||||||
REQUEST_CONVERSATION_ADD_USER -> {
|
REQUEST_CONVERSATION_ADD_USER -> {
|
||||||
if (resultCode == Activity.RESULT_OK && data != null) {
|
if (resultCode == Activity.RESULT_OK && data != null) {
|
||||||
val user = data.getParcelableExtra<ParcelableUser>(EXTRA_USER)
|
data.getParcelableExtra<ParcelableUser>(EXTRA_USER)?.let { user ->
|
||||||
performAddParticipant(user)
|
performAddParticipant(user)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
REQUEST_PICK_MEDIA -> {
|
REQUEST_PICK_MEDIA -> {
|
||||||
|
@ -299,7 +300,7 @@ class MessageConversationInfoFragment : BaseFragment(), IToolBarSupportFragment,
|
||||||
ProgressDialogFragment.show(childFragmentManager, "leave_conversation_progress")
|
ProgressDialogFragment.show(childFragmentManager, "leave_conversation_progress")
|
||||||
val weakThis = WeakReference(this)
|
val weakThis = WeakReference(this)
|
||||||
val task = DestroyConversationTask(requireContext(), accountKey, conversationId)
|
val task = DestroyConversationTask(requireContext(), accountKey, conversationId)
|
||||||
task.callback = callback@ { succeed ->
|
task.callback = callback@{ succeed ->
|
||||||
val f = weakThis.get() ?: return@callback
|
val f = weakThis.get() ?: return@callback
|
||||||
f.dismissDialogThen("leave_conversation_progress") {
|
f.dismissDialogThen("leave_conversation_progress") {
|
||||||
if (succeed) {
|
if (succeed) {
|
||||||
|
@ -315,7 +316,7 @@ class MessageConversationInfoFragment : BaseFragment(), IToolBarSupportFragment,
|
||||||
ProgressDialogFragment.show(childFragmentManager, "clear_messages_progress")
|
ProgressDialogFragment.show(childFragmentManager, "clear_messages_progress")
|
||||||
val weakThis = WeakReference(this)
|
val weakThis = WeakReference(this)
|
||||||
val task = ClearMessagesTask(requireContext(), accountKey, conversationId)
|
val task = ClearMessagesTask(requireContext(), accountKey, conversationId)
|
||||||
task.callback = callback@ { succeed ->
|
task.callback = callback@{ succeed ->
|
||||||
val f = weakThis.get() ?: return@callback
|
val f = weakThis.get() ?: return@callback
|
||||||
f.dismissDialogThen("clear_messages_progress") {
|
f.dismissDialogThen("clear_messages_progress") {
|
||||||
if (succeed) {
|
if (succeed) {
|
||||||
|
@ -343,7 +344,7 @@ class MessageConversationInfoFragment : BaseFragment(), IToolBarSupportFragment,
|
||||||
ProgressDialogFragment.show(childFragmentManager, "set_notifications_disabled_progress")
|
ProgressDialogFragment.show(childFragmentManager, "set_notifications_disabled_progress")
|
||||||
val weakThis = WeakReference(this)
|
val weakThis = WeakReference(this)
|
||||||
val task = SetConversationNotificationDisabledTask(requireContext(), accountKey, conversationId, disabled)
|
val task = SetConversationNotificationDisabledTask(requireContext(), accountKey, conversationId, disabled)
|
||||||
task.callback = callback@ { _ ->
|
task.callback = callback@{ _ ->
|
||||||
val f = weakThis.get() ?: return@callback
|
val f = weakThis.get() ?: return@callback
|
||||||
f.dismissDialogThen("set_notifications_disabled_progress") {
|
f.dismissDialogThen("set_notifications_disabled_progress") {
|
||||||
LoaderManager.getInstance(this).restartLoader(0, null, this)
|
LoaderManager.getInstance(this).restartLoader(0, null, this)
|
||||||
|
@ -378,7 +379,7 @@ class MessageConversationInfoFragment : BaseFragment(), IToolBarSupportFragment,
|
||||||
|
|
||||||
private fun performSetConversationName(name: String) {
|
private fun performSetConversationName(name: String) {
|
||||||
val conversationId = this.conversationId
|
val conversationId = this.conversationId
|
||||||
performUpdateInfo("set_name_progress", updateAction = updateAction@ { fragment, account, microBlog ->
|
performUpdateInfo("set_name_progress", updateAction = updateAction@{ fragment, account, microBlog ->
|
||||||
val context = fragment.context
|
val context = fragment.context
|
||||||
when (account.type) {
|
when (account.type) {
|
||||||
AccountType.TWITTER -> {
|
AccountType.TWITTER -> {
|
||||||
|
@ -395,7 +396,7 @@ class MessageConversationInfoFragment : BaseFragment(), IToolBarSupportFragment,
|
||||||
|
|
||||||
private fun performSetConversationAvatar(uri: Uri?) {
|
private fun performSetConversationAvatar(uri: Uri?) {
|
||||||
val conversationId = this.conversationId
|
val conversationId = this.conversationId
|
||||||
performUpdateInfo("set_avatar_progress", updateAction = updateAction@ { fragment, account, microBlog ->
|
performUpdateInfo("set_avatar_progress", updateAction = updateAction@{ fragment, account, microBlog ->
|
||||||
val context = fragment.context
|
val context = fragment.context
|
||||||
when (account.type) {
|
when (account.type) {
|
||||||
AccountType.TWITTER -> {
|
AccountType.TWITTER -> {
|
||||||
|
|
|
@ -105,7 +105,7 @@ class MessagesEntriesFragment : AbsContentListRecyclerViewFragment<MessagesEntri
|
||||||
when (requestCode) {
|
when (requestCode) {
|
||||||
REQUEST_SELECT_ACCOUNT -> {
|
REQUEST_SELECT_ACCOUNT -> {
|
||||||
if (resultCode != Activity.RESULT_OK) return
|
if (resultCode != Activity.RESULT_OK) return
|
||||||
val accountKey = data!!.getParcelableExtra<UserKey>(EXTRA_ACCOUNT_KEY)
|
val accountKey = data?.getParcelableExtra<UserKey>(EXTRA_ACCOUNT_KEY) ?: return
|
||||||
startActivity(IntentUtils.newMessageConversation(accountKey))
|
startActivity(IntentUtils.newMessageConversation(accountKey))
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
|
|
|
@ -38,9 +38,10 @@ class AccountActionProvider(
|
||||||
for (i in 0 until subMenu.size()) {
|
for (i in 0 until subMenu.size()) {
|
||||||
val item = subMenu.getItem(i)
|
val item = subMenu.getItem(i)
|
||||||
val intent = item.intent
|
val intent = item.intent
|
||||||
val account: AccountDetails = intent.getParcelableExtra(EXTRA_ACCOUNT)
|
intent.getParcelableExtra<AccountDetails>(EXTRA_ACCOUNT)?.let { account ->
|
||||||
if (it.contains(account.key)) {
|
if (it.contains(account.key)) {
|
||||||
item.isChecked = true
|
item.isChecked = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ data class PurchaseFinished(val productName: String) : Analyzer.Event {
|
||||||
const val NAME_EXTRA_FEATURES = "Enhanced Features"
|
const val NAME_EXTRA_FEATURES = "Enhanced Features"
|
||||||
|
|
||||||
fun create(data: Intent): PurchaseFinished {
|
fun create(data: Intent): PurchaseFinished {
|
||||||
val purchaseResult: PurchaseResult = data.getParcelableExtra(EXTRA_PURCHASE_RESULT)
|
val purchaseResult: PurchaseResult = data.getParcelableExtra(EXTRA_PURCHASE_RESULT)!!
|
||||||
val result = PurchaseFinished(purchaseResult.feature)
|
val result = PurchaseFinished(purchaseResult.feature)
|
||||||
result.price = purchaseResult.price
|
result.price = purchaseResult.price
|
||||||
result.currency = purchaseResult.currency
|
result.currency = purchaseResult.currency
|
||||||
|
|
|
@ -65,8 +65,9 @@ open class TrendsLocationExtraConfiguration(
|
||||||
when (requestCode) {
|
when (requestCode) {
|
||||||
1 -> {
|
1 -> {
|
||||||
if (resultCode == Activity.RESULT_OK && data != null) {
|
if (resultCode == Activity.RESULT_OK && data != null) {
|
||||||
val location = data.getParcelableExtra<Location>(EXTRA_LOCATION)
|
data.getParcelableExtra<Location>(EXTRA_LOCATION)?.let { location ->
|
||||||
value = Place(location.woeid, location.name)
|
value = Place(location.woeid, location.name)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,11 +62,12 @@ class UserExtraConfiguration(key: String) : TabConfiguration.ExtraConfiguration(
|
||||||
when (requestCode) {
|
when (requestCode) {
|
||||||
1 -> {
|
1 -> {
|
||||||
if (resultCode == Activity.RESULT_OK && data != null) {
|
if (resultCode == Activity.RESULT_OK && data != null) {
|
||||||
val user: ParcelableUser = data.getParcelableExtra(EXTRA_USER)
|
data.getParcelableExtra<ParcelableUser>(EXTRA_USER)?.let { user ->
|
||||||
viewHolder.displayUser(user)
|
viewHolder.displayUser(user)
|
||||||
viewHolder.itemView.visibility = View.VISIBLE
|
viewHolder.itemView.visibility = View.VISIBLE
|
||||||
hintView.visibility = View.GONE
|
hintView.visibility = View.GONE
|
||||||
this.value = user
|
this.value = user
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,12 +63,13 @@ class UserListExtraConfiguration(key: String) : TabConfiguration.ExtraConfigurat
|
||||||
when (requestCode) {
|
when (requestCode) {
|
||||||
1 -> {
|
1 -> {
|
||||||
if (resultCode == Activity.RESULT_OK) {
|
if (resultCode == Activity.RESULT_OK) {
|
||||||
val userList: ParcelableUserList = data!!.getParcelableExtra(EXTRA_USER_LIST)
|
data?.getParcelableExtra<ParcelableUserList>(EXTRA_USER_LIST)?.let { userList ->
|
||||||
viewHolder.display(userList)
|
viewHolder.display(userList)
|
||||||
viewHolder.itemView.visibility = View.VISIBLE
|
viewHolder.itemView.visibility = View.VISIBLE
|
||||||
hintView.visibility = View.GONE
|
hintView.visibility = View.GONE
|
||||||
|
|
||||||
this.value = userList
|
this.value = userList
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -158,7 +158,7 @@ class MultiSelectEventHandler(
|
||||||
if (item.groupId == AccountActionProvider.MENU_GROUP) {
|
if (item.groupId == AccountActionProvider.MENU_GROUP) {
|
||||||
val intent = item.intent
|
val intent = item.intent
|
||||||
if (intent == null || !intent.hasExtra(EXTRA_ACCOUNT)) return false
|
if (intent == null || !intent.hasExtra(EXTRA_ACCOUNT)) return false
|
||||||
val account: AccountDetails = intent.getParcelableExtra(EXTRA_ACCOUNT)
|
val account: AccountDetails = intent.getParcelableExtra(EXTRA_ACCOUNT) ?: return false
|
||||||
multiSelectManager.accountKey = account.key
|
multiSelectManager.accountKey = account.key
|
||||||
accountActionProvider?.selectedAccountKeys = arrayOf(account.key)
|
accountActionProvider?.selectedAccountKeys = arrayOf(account.key)
|
||||||
mode.invalidate()
|
mode.invalidate()
|
||||||
|
|
|
@ -14,12 +14,13 @@ private fun Context.fixForLollipop(): Context {
|
||||||
|
|
||||||
class LollipopFixWebView: WebView {
|
class LollipopFixWebView: WebView {
|
||||||
|
|
||||||
constructor(context: Context?) : super(context?.fixForLollipop())
|
constructor(context: Context) : super(context.fixForLollipop())
|
||||||
constructor(context: Context?, attrs: AttributeSet?) : super(context?.fixForLollipop(), attrs)
|
constructor(context: Context, attrs: AttributeSet?) : super(context.fixForLollipop(), attrs)
|
||||||
constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(context?.fixForLollipop(), attrs, defStyleAttr)
|
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(
|
||||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
context.fixForLollipop(),
|
||||||
constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) : super(context?.fixForLollipop(), attrs, defStyleAttr, defStyleRes)
|
attrs,
|
||||||
constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int, privateBrowsing: Boolean) : super(context?.fixForLollipop(), attrs, defStyleAttr, privateBrowsing)
|
defStyleAttr
|
||||||
|
)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
isFocusable = true
|
isFocusable = true
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_centerInParent="true">
|
android:layout_centerInParent="true">
|
||||||
|
|
||||||
<com.google.android.exoplayer2.ui.SimpleExoPlayerView
|
<com.google.android.exoplayer2.ui.PlayerView
|
||||||
android:id="@+id/playerView"
|
android:id="@+id/playerView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
|
Loading…
Reference in New Issue