-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
248 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
* This file is part of Metronome. | ||
* Copyright (C) 2023 Philipp Bobek <[email protected]> | ||
* Copyright (C) 2024 Philipp Bobek <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -18,7 +18,6 @@ | |
|
||
package com.bobek.metronome | ||
|
||
import android.Manifest.permission.ACCESS_FINE_LOCATION | ||
import android.Manifest.permission.POST_NOTIFICATIONS | ||
import android.content.Intent | ||
import androidx.annotation.StringRes | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
<!-- | ||
~ This file is part of Metronome. | ||
~ Copyright (C) 2023 Philipp Bobek <[email protected]> | ||
~ Copyright (C) 2024 Philipp Bobek <[email protected]> | ||
~ | ||
~ This program is free software: you can redistribute it and/or modify | ||
~ it under the terms of the GNU General Public License as published by | ||
|
@@ -34,14 +34,14 @@ | |
android:label="@string/metronome" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/Theme.Metronome" | ||
android:theme="@style/Theme.App" | ||
tools:targetApi="31"> | ||
|
||
<activity | ||
android:name=".MainActivity" | ||
android:exported="true" | ||
android:launchMode="singleTask" | ||
android:theme="@style/Theme.Metronome"> | ||
android:theme="@style/Theme.App.NoActionBar"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
* This file is part of Metronome. | ||
* Copyright (C) 2023 Philipp Bobek <[email protected]> | ||
* Copyright (C) 2024 Philipp Bobek <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -19,6 +19,7 @@ | |
package com.bobek.metronome | ||
|
||
import android.os.Bundle | ||
import androidx.navigation.fragment.findNavController | ||
import androidx.preference.Preference | ||
import androidx.preference.Preference.SummaryProvider | ||
import androidx.preference.PreferenceFragmentCompat | ||
|
@@ -31,5 +32,10 @@ class SettingsFragment : PreferenceFragmentCompat() { | |
|
||
findPreference<Preference>(PreferenceConstants.VERSION)?.summaryProvider = | ||
SummaryProvider<Preference> { BuildConfig.VERSION_NAME } | ||
|
||
findPreference<Preference>(PreferenceConstants.THIRD_PARTY_LICENSES)?.setOnPreferenceClickListener { _ -> | ||
findNavController().navigate(R.id.action_SettingsFragment_to_ThirdPartyLicensesFragment) | ||
true | ||
} | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
app/src/main/java/com/bobek/metronome/ThirdPartyLicenseFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* This file is part of Metronome. | ||
* Copyright (C) 2024 Philipp Bobek <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Metronome is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.bobek.metronome | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.fragment.app.Fragment | ||
import com.bobek.metronome.databinding.FragmentThirdPartyLicenseBinding | ||
|
||
class ThirdPartyLicenseFragment : Fragment() { | ||
|
||
private lateinit var binding: FragmentThirdPartyLicenseBinding | ||
|
||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { | ||
binding = FragmentThirdPartyLicenseBinding.inflate(inflater, container, false) | ||
binding.licenseContent = arguments?.getString("licenseContent") | ||
return binding.root | ||
} | ||
} |
71 changes: 71 additions & 0 deletions
71
app/src/main/java/com/bobek/metronome/ThirdPartyLicensesFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
* This file is part of Metronome. | ||
* Copyright (C) 2024 Philipp Bobek <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Metronome is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.bobek.metronome | ||
|
||
import android.os.Bundle | ||
import androidx.core.os.bundleOf | ||
import androidx.navigation.fragment.findNavController | ||
import androidx.preference.Preference | ||
import androidx.preference.PreferenceFragmentCompat | ||
import de.philipp_bobek.oss_licenses_parser.OssLicensesParser | ||
import de.philipp_bobek.oss_licenses_parser.ThirdPartyLicense | ||
import de.philipp_bobek.oss_licenses_parser.ThirdPartyLicenseMetadata | ||
|
||
class ThirdPartyLicensesFragment : PreferenceFragmentCompat() { | ||
|
||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { | ||
val context = preferenceManager.context | ||
val screen = preferenceManager.createPreferenceScreen(context) | ||
|
||
context.resources | ||
.openRawResource(R.raw.third_party_license_metadata) | ||
.use(OssLicensesParser::parseMetadata) | ||
.sortedBy { metadata -> metadata.libraryName } | ||
.map(::getPreference) | ||
.forEach(screen::addPreference) | ||
|
||
preferenceScreen = screen | ||
} | ||
|
||
private fun getPreference(metadata: ThirdPartyLicenseMetadata): Preference { | ||
val preference = Preference(requireContext()) | ||
preference.title = metadata.libraryName | ||
preference.setOnPreferenceClickListener { | ||
navigateToThirdPartyLicenseFragment(metadata) | ||
true | ||
} | ||
return preference | ||
} | ||
|
||
private fun navigateToThirdPartyLicenseFragment(metadata: ThirdPartyLicenseMetadata) { | ||
val thirdPartyLicense = requireContext().resources | ||
.openRawResource(R.raw.third_party_licenses) | ||
.use { thirdPartyLicensesFile -> OssLicensesParser.parseLicense(metadata, thirdPartyLicensesFile) } | ||
|
||
navigateToThirdPartyLicenseFragment(thirdPartyLicense) | ||
} | ||
|
||
private fun navigateToThirdPartyLicenseFragment(thirdPartyLicense: ThirdPartyLicense) { | ||
val bundle = bundleOf( | ||
"libraryName" to thirdPartyLicense.libraryName, | ||
"licenseContent" to thirdPartyLicense.licenseContent | ||
) | ||
findNavController().navigate(R.id.action_ThirdPartyLicensesFragment_to_ThirdPartyLicenseFragment, bundle) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
* This file is part of Metronome. | ||
* Copyright (C) 2023 Philipp Bobek <[email protected]> | ||
* Copyright (C) 2024 Philipp Bobek <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -35,5 +35,7 @@ object PreferenceConstants { | |
|
||
const val POST_NOTIFICATIONS_PERMISSION_REQUESTED = "post_notifications_permission_requested" | ||
|
||
const val THIRD_PARTY_LICENSES = "third_party_licenses" | ||
|
||
const val VERSION = "version" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<!-- | ||
~ This file is part of Metronome. | ||
~ Copyright (C) 2024 Philipp Bobek <[email protected]> | ||
~ | ||
~ This program is free software: you can redistribute it and/or modify | ||
~ it under the terms of the GNU General Public License as published by | ||
~ the Free Software Foundation, either version 3 of the License, or | ||
~ (at your option) any later version. | ||
~ | ||
~ Metronome is distributed in the hope that it will be useful, | ||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
~ GNU General Public License for more details. | ||
~ | ||
~ You should have received a copy of the GNU General Public License | ||
~ along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
--> | ||
|
||
<layout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
tools:context=".ThirdPartyLicenseFragment"> | ||
|
||
<androidx.core.widget.NestedScrollView | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_margin="@dimen/text_margin" | ||
android:autoLink="web" | ||
android:text="@{licenseContent}" /> | ||
|
||
</androidx.core.widget.NestedScrollView> | ||
|
||
<data> | ||
|
||
<variable | ||
name="licenseContent" | ||
type="String" /> | ||
</data> | ||
|
||
</layout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
<!-- | ||
~ This file is part of Metronome. | ||
~ Copyright (C) 2022 Philipp Bobek <[email protected]> | ||
~ Copyright (C) 2024 Philipp Bobek <[email protected]> | ||
~ | ||
~ This program is free software: you can redistribute it and/or modify | ||
~ it under the terms of the GNU General Public License as published by | ||
|
@@ -41,8 +41,34 @@ | |
android:label="@string/settings"> | ||
|
||
<action | ||
android:id="@+id/action_SettingsFragment_to_MetronomeFragment" | ||
app:destination="@id/MetronomeFragment" /> | ||
android:id="@+id/action_SettingsFragment_to_ThirdPartyLicensesFragment" | ||
app:destination="@id/ThirdPartyLicensesFragment" /> | ||
</fragment> | ||
|
||
<fragment | ||
android:id="@+id/ThirdPartyLicensesFragment" | ||
android:name="com.bobek.metronome.ThirdPartyLicensesFragment" | ||
android:label="@string/third_party_licenses"> | ||
|
||
<action | ||
android:id="@+id/action_ThirdPartyLicensesFragment_to_ThirdPartyLicenseFragment" | ||
app:destination="@id/ThirdPartyLicenseFragment" /> | ||
</fragment> | ||
|
||
<fragment | ||
android:id="@+id/ThirdPartyLicenseFragment" | ||
android:name="com.bobek.metronome.ThirdPartyLicenseFragment" | ||
android:label="{libraryName}"> | ||
|
||
<argument | ||
android:name="libraryName" | ||
android:defaultValue="" | ||
app:argType="string" /> | ||
|
||
<argument | ||
android:name="licenseContent" | ||
android:defaultValue="" | ||
app:argType="string" /> | ||
</fragment> | ||
|
||
</navigation> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
<!-- | ||
~ This file is part of Metronome. | ||
~ Copyright (C) 2023 Philipp Bobek <[email protected]> | ||
~ Copyright (C) 2024 Philipp Bobek <[email protected]> | ||
~ | ||
~ This program is free software: you can redistribute it and/or modify | ||
~ it under the terms of the GNU General Public License as published by | ||
|
@@ -54,6 +54,8 @@ | |
<string name="about">O aplikaci</string> | ||
<string name="author">Autor</string> | ||
<string name="license">Licence</string> | ||
<!--TODO<string name="third_party_licenses">Third-party licenses</string>--> | ||
<!--TODO<string name="third_party_licenses_summary">Licenses of included open source libraries</string>--> | ||
<string name="source_code">Zdrojový kód</string> | ||
<string name="version">Verze</string> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
<!-- | ||
~ This file is part of Metronome. | ||
~ Copyright (C) 2023 Philipp Bobek <[email protected]> | ||
~ Copyright (C) 2024 Philipp Bobek <[email protected]> | ||
~ | ||
~ This program is free software: you can redistribute it and/or modify | ||
~ it under the terms of the GNU General Public License as published by | ||
|
@@ -54,6 +54,8 @@ | |
<string name="about">Über die App</string> | ||
<string name="author">Author</string> | ||
<string name="license">Lizenz</string> | ||
<string name="third_party_licenses">Drittanbieter-Lizenzen</string> | ||
<string name="third_party_licenses_summary">Lizenzen von enthaltenen Open-Source-Bibliotheken</string> | ||
<string name="source_code">Quelltext</string> | ||
<string name="version">Version</string> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
<!-- | ||
~ This file is part of Metronome. | ||
~ Copyright (C) 2022 Philipp Bobek <[email protected]> | ||
~ Copyright (C) 2024 Philipp Bobek <[email protected]> | ||
~ | ||
~ This program is free software: you can redistribute it and/or modify | ||
~ it under the terms of the GNU General Public License as published by | ||
|
@@ -20,7 +20,7 @@ | |
|
||
<resources> | ||
|
||
<style name="Base.Theme.Metronome" parent="Theme.Material3.Dark.NoActionBar"> | ||
<style name="Base.Theme.App" parent="Theme.Material3.Dark"> | ||
<item name="colorPrimary">@color/md_theme_dark_primary</item> | ||
<item name="colorOnPrimary">@color/md_theme_dark_onPrimary</item> | ||
<item name="colorPrimaryContainer">@color/md_theme_dark_primaryContainer</item> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.