Update build configuration
Update the build config to further optimize the app - Removed the browser dependency [-10k] - Enabled resource minification [-100k]
This commit is contained in:
parent
b65814fdbd
commit
076d2b3d7e
2 changed files with 16 additions and 31 deletions
|
@ -29,6 +29,7 @@ android {
|
||||||
|
|
||||||
release {
|
release {
|
||||||
minifyEnabled true
|
minifyEnabled true
|
||||||
|
shrinkResources true
|
||||||
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
|
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,8 +63,8 @@ dependencies {
|
||||||
|
|
||||||
// General
|
// General
|
||||||
implementation "androidx.core:core-ktx:1.3.2"
|
implementation "androidx.core:core-ktx:1.3.2"
|
||||||
implementation "androidx.activity:activity-ktx:1.2.1"
|
implementation "androidx.activity:activity-ktx:1.2.2"
|
||||||
implementation "androidx.fragment:fragment-ktx:1.3.0"
|
implementation "androidx.fragment:fragment-ktx:1.3.1"
|
||||||
|
|
||||||
// UI
|
// UI
|
||||||
implementation "androidx.recyclerview:recyclerview:1.1.0"
|
implementation "androidx.recyclerview:recyclerview:1.1.0"
|
||||||
|
@ -88,9 +89,6 @@ dependencies {
|
||||||
// Preferences
|
// Preferences
|
||||||
implementation "androidx.preference:preference-ktx:1.1.1"
|
implementation "androidx.preference:preference-ktx:1.1.1"
|
||||||
|
|
||||||
// Opening links
|
|
||||||
implementation "androidx.browser:browser:1.3.0"
|
|
||||||
|
|
||||||
// --- THIRD PARTY ---
|
// --- THIRD PARTY ---
|
||||||
|
|
||||||
// ExoPlayer
|
// ExoPlayer
|
||||||
|
|
|
@ -5,7 +5,6 @@ import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.browser.customtabs.CustomTabsIntent
|
|
||||||
import androidx.core.net.toUri
|
import androidx.core.net.toUri
|
||||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||||
import org.oxycblt.auxio.BuildConfig
|
import org.oxycblt.auxio.BuildConfig
|
||||||
|
@ -53,34 +52,22 @@ class AboutDialog : BottomSheetDialogFragment() {
|
||||||
check(link in LINKS) { "Invalid link." }
|
check(link in LINKS) { "Invalid link." }
|
||||||
|
|
||||||
try {
|
try {
|
||||||
val tabsIntent = CustomTabsIntent.Builder()
|
|
||||||
.setShareState(CustomTabsIntent.SHARE_STATE_ON)
|
|
||||||
.setShowTitle(true)
|
|
||||||
.build()
|
|
||||||
|
|
||||||
val uri = link.toUri()
|
val uri = link.toUri()
|
||||||
val manager = requireActivity().packageManager
|
|
||||||
val browserCandidates = manager.queryIntentActivities(tabsIntent.intent, 0)
|
|
||||||
|
|
||||||
// If there are candidates for this link, then launch it through that.
|
val browserIntent = Intent(Intent.ACTION_VIEW, uri)
|
||||||
if (browserCandidates.size > 0) {
|
browserIntent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
tabsIntent.launchUrl(requireActivity(), uri)
|
|
||||||
|
val fallbackCandidates = requireContext().packageManager.queryIntentActivities(
|
||||||
|
browserIntent, 0
|
||||||
|
)
|
||||||
|
|
||||||
|
// If there are candidates here, then launch those.
|
||||||
|
if (fallbackCandidates.size > 0) {
|
||||||
|
requireActivity().startActivity(browserIntent)
|
||||||
} else {
|
} else {
|
||||||
// If there are no candidates, then fallback to another list of browsers
|
// Otherwise they don't have a browser on their phone, meaning they should
|
||||||
|
// just see an error.
|
||||||
val browserIntent = Intent(Intent.ACTION_VIEW, uri)
|
getString(R.string.error_no_browser).createToast(requireContext())
|
||||||
browserIntent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
|
||||||
|
|
||||||
val fallbackCandidates = manager.queryIntentActivities(browserIntent, 0)
|
|
||||||
|
|
||||||
// If there are candidates here, then launch those.
|
|
||||||
if (fallbackCandidates.size > 0) {
|
|
||||||
requireActivity().startActivity(browserIntent)
|
|
||||||
} else {
|
|
||||||
// Otherwise they don't have a browser on their phone, meaning they should
|
|
||||||
// just see an error.
|
|
||||||
getString(R.string.error_no_browser).createToast(requireContext())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
logE("Browser intent launching failed [Probably android's fault]")
|
logE("Browser intent launching failed [Probably android's fault]")
|
||||||
|
|
Loading…
Reference in a new issue