Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
levinli303 committed Jun 5, 2021
1 parent 7ef0e1e commit 99b3d1c
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 27 deletions.
5 changes: 3 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,17 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'androidx.core:core-ktx:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.recyclerview:recyclerview:1.2.0'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"

implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.0"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.3.1"

implementation 'com.google.android.material:material:1.3.0'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.google.code.gson:gson:2.8.7'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation "com.squareup.okhttp3:okhttp:4.9.1"

implementation 'net.lingala.zip4j:zip4j:2.8.0'

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="space.celestia.mobilecelestia"
android:versionCode="187"
android:versionCode="191"
android:versionName="1.3.5">

<uses-feature android:glEsVersion="0x00020000" android:required="true" />
Expand Down
29 changes: 10 additions & 19 deletions app/src/main/java/space/celestia/mobilecelestia/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,14 @@ import android.view.*
import android.widget.Toast
import androidx.activity.result.ActivityResultLauncher
import androidx.activity.result.contract.ActivityResultContracts
import androidx.annotation.RequiresApi
import androidx.appcompat.app.AppCompatActivity
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.constraintlayout.widget.Guideline
import androidx.core.animation.addListener
import androidx.core.app.ShareCompat
import androidx.core.content.FileProvider
import androidx.core.graphics.contains
import androidx.core.view.WindowCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.WindowInsetsControllerCompat
import androidx.core.view.*
import androidx.fragment.app.Fragment
import androidx.lifecycle.lifecycleScope
import com.google.gson.Gson
Expand Down Expand Up @@ -196,15 +193,12 @@ class MainActivity : AppCompatActivity(R.layout.activity_main),
reporter.register(this)

// Handle notch
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
val rootView = findViewById<View>(android.R.id.content).rootView
rootView.setOnApplyWindowInsetsListener { _, insets ->
insets.displayCutout?.let {
applyCutout(it)
}
return@setOnApplyWindowInsetsListener insets
ViewCompat.setOnApplyWindowInsetsListener( findViewById<View>(android.R.id.content).rootView, { _, insets ->
insets?.displayCutout?.let {
applyDisplayCutout(it)
}
}
return@setOnApplyWindowInsetsListener insets
})

findViewById<View>(R.id.overlay_container).setOnTouchListener { _, e ->
if (e.actionMasked == MotionEvent.ACTION_UP) {
Expand Down Expand Up @@ -399,16 +393,13 @@ class MainActivity : AppCompatActivity(R.layout.activity_main),
override fun onAttachedToWindow() {
super.onAttachedToWindow()

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
val rootView = findViewById<View>(android.R.id.content).rootView
rootView.rootWindowInsets.displayCutout?.let {
applyCutout(it)
}
val rootView = findViewById<View>(android.R.id.content).rootView
ViewCompat.getRootWindowInsets(rootView)?.displayCutout?.let {
applyDisplayCutout(it)
}
}

@RequiresApi(Build.VERSION_CODES.P)
private fun applyCutout(cutout: DisplayCutout) {
private fun applyDisplayCutout(cutout: DisplayCutoutCompat) {
val density = resources.displayMetrics.density

val ltr = resources.configuration.layoutDirection != View.LAYOUT_DIRECTION_RTL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ class CelestiaActionItem(val action: CelestiaAction, val image: Int)
class BottomControlFragment : Fragment() {

private var listener: Listener? = null
private var items: List<CelestiaAction>? = null
private var items: List<CelestiaAction> = listOf()

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

arguments?.let {
@Suppress("UNCHECKED_CAST")
items = it.getSerializable(ARG_ACTIONS) as? List<CelestiaAction>
items = it.getSerializable(ARG_ACTIONS) as? List<CelestiaAction> ?: listOf()
}
}

Expand All @@ -74,7 +74,7 @@ class BottomControlFragment : Fragment() {
manager.orientation = LinearLayoutManager.HORIZONTAL
layoutManager = manager
adapter = BottomControlRecyclerViewAdapter(
items!!.map {
items.map {
CelestiaActionItem(
it,
it.imageID() ?: 0
Expand Down Expand Up @@ -105,7 +105,6 @@ class BottomControlFragment : Fragment() {
}

companion object {

const val ARG_ACTIONS = "action"

@JvmStatic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class ResourceManager {
val call = client.newCall(Request.Builder().url(item.item).get().build())
try {
val response = call.execute()
val body = response.body()
val body = response.body
if (!response.isSuccessful || body == null) {
return@executeAsyncTask false
}
Expand Down

0 comments on commit 99b3d1c

Please sign in to comment.