Add open source licenses and app version to settings fragment
This commit is contained in:
parent
06b9e145cd
commit
80ff96a5b4
7 changed files with 48 additions and 1 deletions
|
@ -5,6 +5,7 @@ plugins {
|
|||
id 'kotlin-kapt'
|
||||
id 'androidx.navigation.safeargs.kotlin'
|
||||
id 'dagger.hilt.android.plugin'
|
||||
id 'com.google.android.gms.oss-licenses-plugin'
|
||||
}
|
||||
|
||||
android {
|
||||
|
@ -94,6 +95,9 @@ dependencies {
|
|||
def timber_version = "4.7.1"
|
||||
implementation "com.jakewharton.timber:timber:$timber_version"
|
||||
|
||||
def oss_licenses_version = "17.0.0"
|
||||
implementation "com.google.android.gms:play-services-oss-licenses:$oss_licenses_version"
|
||||
|
||||
// Testing
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||
|
|
|
@ -27,6 +27,12 @@
|
|||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name="com.google.android.gms.oss.licenses.OssLicensesMenuActivity"
|
||||
android:theme="@style/Theme.AppCompat.DayNight.DarkActionBar"/>
|
||||
|
||||
<activity android:name="com.google.android.gms.oss.licenses.OssLicensesActivity"
|
||||
android:theme="@style/Theme.AppCompat.DayNight.DarkActionBar"/>
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
|
@ -1,11 +1,13 @@
|
|||
package dev.jdtech.jellyfin.fragments
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import androidx.appcompat.app.AppCompatDelegate.*
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import androidx.preference.ListPreference
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.PreferenceFragmentCompat
|
||||
import com.google.android.gms.oss.licenses.OssLicensesMenuActivity
|
||||
import dev.jdtech.jellyfin.R
|
||||
|
||||
class SettingsFragment : PreferenceFragmentCompat() {
|
||||
|
@ -25,5 +27,10 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
|||
}
|
||||
true
|
||||
}
|
||||
|
||||
findPreference<Preference>("ossLicenses")?.setOnPreferenceClickListener {
|
||||
startActivity(Intent(requireContext(), OssLicensesMenuActivity::class.java))
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package dev.jdtech.jellyfin.utils
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import androidx.preference.Preference
|
||||
|
||||
class VersionPreference(context: Context, attrs: AttributeSet): Preference(context, attrs) {
|
||||
init {
|
||||
val packageManager = context.packageManager
|
||||
val packageInfo = packageManager.getPackageInfo(context.packageName, 0)
|
||||
val versionName = packageInfo.versionName
|
||||
summary = versionName
|
||||
}
|
||||
}
|
|
@ -50,4 +50,7 @@
|
|||
<string name="settings_category_appearance">Appearance</string>
|
||||
<string name="theme">Theme</string>
|
||||
<string name="error_preparing_player_items">Error preparing player items</string>
|
||||
<string name="version">Version</string>
|
||||
<string name="open_source_licenses">Open source licenses</string>
|
||||
<string name="about">About</string>
|
||||
</resources>
|
|
@ -36,7 +36,17 @@
|
|||
app:entryValues="@array/themes_value"
|
||||
app:key="theme"
|
||||
app:title="@string/theme"
|
||||
app:useSimpleSummaryProvider="true"/>
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory app:title="@string/about">
|
||||
|
||||
<Preference
|
||||
app:key="ossLicenses"
|
||||
app:title="@string/open_source_licenses" />
|
||||
|
||||
<dev.jdtech.jellyfin.utils.VersionPreference app:title="@string/version" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
|
@ -16,6 +16,9 @@ buildscript {
|
|||
|
||||
def hilt_version = "2.37"
|
||||
classpath "com.google.dagger:hilt-android-gradle-plugin:$hilt_version"
|
||||
|
||||
def oss_licenses_version = "0.10.4"
|
||||
classpath "com.google.android.gms:oss-licenses-plugin:$oss_licenses_version"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue