Backwards support back to API 21

Things still crash pre-21
This commit is contained in:
topjohnwu 2020-01-05 16:05:22 +08:00
parent b38e940088
commit e04f943980
13 changed files with 24 additions and 24 deletions

View File

@ -130,7 +130,7 @@ dependencies {
implementation 'androidx.work:work-runtime:2.2.0'
implementation 'androidx.transition:transition:1.3.0-rc02'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.core:core-ktx:1.1.0'
implementation 'androidx.core:core-ktx:1.2.0-rc01'
// DO NOT UPDATE, 1.2.x has bunch of things broken in functionality against 1.1.x
implementation 'com.google.android.material:material:1.1.0-beta02'
}

View File

@ -1,11 +1,11 @@
package com.topjohnwu.magisk.redesign
import android.graphics.Insets
import android.os.Bundle
import android.view.MenuItem
import android.view.View
import android.view.ViewTreeObserver
import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.core.graphics.Insets
import androidx.core.view.setPadding
import androidx.core.view.updateLayoutParams
import androidx.fragment.app.Fragment
@ -155,4 +155,4 @@ open class MainActivity : CompatActivity<MainViewModel, ActivityMainMd2Binding>(
binding.mainToolbar.invalidate()
}
}
}

View File

@ -1,7 +1,7 @@
package com.topjohnwu.magisk.redesign.compat
import android.graphics.Insets
import android.view.View
import androidx.core.graphics.Insets
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.fragment.app.Fragment

View File

@ -1,7 +1,7 @@
package com.topjohnwu.magisk.redesign.compat
import android.graphics.Insets
import android.view.View
import androidx.core.graphics.Insets
internal interface CompatView<ViewModel : CompatViewModel> {
@ -12,4 +12,4 @@ internal interface CompatView<ViewModel : CompatViewModel> {
fun peekSystemWindowInsets(insets: Insets) = Unit
fun consumeSystemWindowInsets(insets: Insets): Insets? = null
}
}

View File

@ -1,7 +1,7 @@
package com.topjohnwu.magisk.redesign.compat
import android.graphics.Insets
import androidx.annotation.CallSuper
import androidx.core.graphics.Insets
import androidx.databinding.Observable
import com.topjohnwu.magisk.base.viewmodel.BaseViewModel
import com.topjohnwu.magisk.utils.KObservableField
@ -42,4 +42,4 @@ abstract class CompatViewModel(
super.onCleared()
}
}
}

View File

@ -1,12 +1,12 @@
package com.topjohnwu.magisk.redesign.hide
import android.content.Context
import android.graphics.Insets
import android.os.Bundle
import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem
import android.view.View
import androidx.core.graphics.Insets
import androidx.core.view.isVisible
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
@ -83,4 +83,4 @@ class HideFragment : CompatFragment<HideViewModel, FragmentHideMd2Binding>() {
return super.onOptionsItemSelected(item)
}
}
}

View File

@ -1,9 +1,9 @@
package com.topjohnwu.magisk.redesign.home
import android.graphics.Insets
import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem
import androidx.core.graphics.Insets
import com.topjohnwu.magisk.R
import com.topjohnwu.magisk.databinding.FragmentHomeMd2Binding
import com.topjohnwu.magisk.model.navigation.Navigation
@ -32,4 +32,4 @@ class HomeFragment : CompatFragment<HomeViewModel, FragmentHomeMd2Binding>() {
else -> null
}?.let { true } ?: super.onOptionsItemSelected(item)
}
}

View File

@ -1,7 +1,7 @@
package com.topjohnwu.magisk.redesign.install
import android.content.Intent
import android.graphics.Insets
import androidx.core.graphics.Insets
import com.topjohnwu.magisk.R
import com.topjohnwu.magisk.databinding.FragmentInstallMd2Binding
import com.topjohnwu.magisk.model.events.RequestFileEvent
@ -25,4 +25,4 @@ class InstallFragment : CompatFragment<InstallViewModel, FragmentInstallMd2Bindi
requireActivity().setTitle(R.string.install)
}
}
}

View File

@ -1,11 +1,11 @@
package com.topjohnwu.magisk.redesign.log
import android.graphics.Insets
import android.os.Bundle
import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem
import android.view.View
import androidx.core.graphics.Insets
import androidx.core.view.isVisible
import com.topjohnwu.magisk.R
import com.topjohnwu.magisk.databinding.FragmentLogMd2Binding
@ -73,4 +73,4 @@ class LogFragment : CompatFragment<LogViewModel, FragmentLogMd2Binding>() {
return super.onBackPressed()
}
}
}

View File

@ -1,12 +1,12 @@
package com.topjohnwu.magisk.redesign.module
import android.content.Intent
import android.graphics.Insets
import android.os.Bundle
import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem
import android.view.View
import androidx.core.graphics.Insets
import androidx.core.view.isVisible
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.StaggeredGridLayoutManager
@ -140,4 +140,4 @@ class ModuleFragment : CompatFragment<ModuleViewModel, FragmentModuleMd2Binding>
listeners.add(listener)
}
}
}

View File

@ -1,8 +1,8 @@
package com.topjohnwu.magisk.redesign.settings
import android.graphics.Insets
import android.os.Bundle
import android.view.View
import androidx.core.graphics.Insets
import com.topjohnwu.magisk.R
import com.topjohnwu.magisk.databinding.FragmentSettingsMd2Binding
import com.topjohnwu.magisk.redesign.compat.CompatFragment
@ -37,4 +37,4 @@ class SettingsFragment : CompatFragment<SettingsViewModel, FragmentSettingsMd2Bi
viewModel.items.forEach { it.refresh() }
}
}
}

View File

@ -1,11 +1,11 @@
package com.topjohnwu.magisk.redesign.superuser
import android.graphics.Insets
import android.os.Bundle
import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem
import android.view.View
import androidx.core.graphics.Insets
import com.topjohnwu.magisk.R
import com.topjohnwu.magisk.databinding.FragmentSuperuserMd2Binding
import com.topjohnwu.magisk.model.navigation.Navigation
@ -45,4 +45,4 @@ class SuperuserFragment : CompatFragment<SuperuserViewModel, FragmentSuperuserMd
else -> null
}?.let { true } ?: super.onOptionsItemSelected(item)
}
}

View File

@ -1,6 +1,6 @@
package com.topjohnwu.magisk.redesign.theme
import android.graphics.Insets
import androidx.core.graphics.Insets
import com.topjohnwu.magisk.R
import com.topjohnwu.magisk.databinding.FragmentThemeMd2Binding
import com.topjohnwu.magisk.redesign.compat.CompatFragment
@ -19,4 +19,4 @@ class ThemeFragment : CompatFragment<ThemeViewModel, FragmentThemeMd2Binding>()
activity.title = getString(R.string.section_theme)
}
}
}