mirror of
https://github.com/He4eT/yamf_launcher.git
synced 2026-05-05 01:47:24 +00:00
Added About section and Open-Meteo credits
This commit is contained in:
parent
48b0bccbee
commit
a014014e8f
10 changed files with 247 additions and 3 deletions
|
|
@ -48,5 +48,6 @@ dependencies {
|
||||||
implementation("androidx.navigation:navigation-ui-ktx:2.7.7")
|
implementation("androidx.navigation:navigation-ui-ktx:2.7.7")
|
||||||
implementation("com.google.code.gson:gson:2.11.0")
|
implementation("com.google.code.gson:gson:2.11.0")
|
||||||
implementation("androidx.recyclerview:recyclerview:1.3.2")
|
implementation("androidx.recyclerview:recyclerview:1.3.2")
|
||||||
implementation("androidx.preference:preference:1.2.1")
|
implementation("androidx.preference:preference-ktx:1.2.1")
|
||||||
|
implementation ("androidx.activity:activity-ktx:1.9.1")
|
||||||
}
|
}
|
||||||
34
app/src/main/java/eu/ottop/yamlauncher/AboutFragment.kt
Normal file
34
app/src/main/java/eu/ottop/yamlauncher/AboutFragment.kt
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
package eu.ottop.yamlauncher
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.text.Html
|
||||||
|
import android.text.method.LinkMovementMethod
|
||||||
|
import androidx.fragment.app.Fragment
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.widget.TextView
|
||||||
|
|
||||||
|
class AboutFragment : Fragment() {
|
||||||
|
|
||||||
|
private val stringUtils = StringUtils()
|
||||||
|
|
||||||
|
override fun onCreateView(
|
||||||
|
inflater: LayoutInflater, container: ViewGroup?,
|
||||||
|
savedInstanceState: Bundle?
|
||||||
|
): View? {
|
||||||
|
// Inflate the layout for this fragment
|
||||||
|
return inflater.inflate(R.layout.fragment_about, container, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
stringUtils.setLink(requireActivity().findViewById(R.id.codebergLink), getString(R.string.codeberg_link))
|
||||||
|
stringUtils.setLink(requireActivity().findViewById(R.id.githubLink), getString(R.string.github_link))
|
||||||
|
stringUtils.setLink(requireActivity().findViewById(R.id.stripeLink), getString(R.string.stripe_link))
|
||||||
|
stringUtils.setLink(requireActivity().findViewById(R.id.liberaLink), getString(R.string.libera_link))
|
||||||
|
stringUtils.setLink(requireActivity().findViewById(R.id.weatherLink), getString(R.string.weather_link))
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -22,6 +22,7 @@ class LocationFragment : Fragment(), LocationListAdapter.OnItemClickListener {
|
||||||
private var adapter: LocationListAdapter? = null
|
private var adapter: LocationListAdapter? = null
|
||||||
private val weatherSystem = WeatherSystem()
|
private val weatherSystem = WeatherSystem()
|
||||||
private val sharedPreferenceManager = SharedPreferenceManager()
|
private val sharedPreferenceManager = SharedPreferenceManager()
|
||||||
|
private val stringUtils = StringUtils()
|
||||||
|
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
inflater: LayoutInflater, container: ViewGroup?,
|
inflater: LayoutInflater, container: ViewGroup?,
|
||||||
|
|
@ -38,6 +39,8 @@ class LocationFragment : Fragment(), LocationListAdapter.OnItemClickListener {
|
||||||
|
|
||||||
var locationList = mutableListOf<Map<String, String>>()
|
var locationList = mutableListOf<Map<String, String>>()
|
||||||
|
|
||||||
|
stringUtils.setLink(requireActivity().findViewById(R.id.locationLink), getString(R.string.location_link))
|
||||||
|
|
||||||
CoroutineScope(Dispatchers.IO).launch {
|
CoroutineScope(Dispatchers.IO).launch {
|
||||||
locationList = weatherSystem.getSearchedLocations(
|
locationList = weatherSystem.getSearchedLocations(
|
||||||
searchView.text.toString()
|
searchView.text.toString()
|
||||||
|
|
|
||||||
|
|
@ -302,7 +302,7 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onNewIntent(intent: Intent?) {
|
override fun onNewIntent(intent: Intent) {
|
||||||
super.onNewIntent(intent)
|
super.onNewIntent(intent)
|
||||||
backToHome()
|
backToHome()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
||||||
manualLocationPref = findPreference("manual_location")
|
manualLocationPref = findPreference("manual_location")
|
||||||
val leftSwipePref = findPreference<Preference?>("leftSwipeApp")
|
val leftSwipePref = findPreference<Preference?>("leftSwipeApp")
|
||||||
val rightSwipePref = findPreference<Preference?>("rightSwipeApp")
|
val rightSwipePref = findPreference<Preference?>("rightSwipeApp")
|
||||||
|
val aboutPref = findPreference<Preference?>("about_page")
|
||||||
|
|
||||||
manualLocationPref?.summary = sharedPreferenceManager.getWeatherRegion(requireContext())
|
manualLocationPref?.summary = sharedPreferenceManager.getWeatherRegion(requireContext())
|
||||||
leftSwipePref?.summary = sharedPreferenceManager.getGestureName(requireContext(), "left")
|
leftSwipePref?.summary = sharedPreferenceManager.getGestureName(requireContext(), "left")
|
||||||
|
|
@ -105,6 +106,15 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
||||||
rightSwipePref?.summary = appName
|
rightSwipePref?.summary = appName
|
||||||
}
|
}
|
||||||
true }
|
true }
|
||||||
|
|
||||||
|
aboutPref?.onPreferenceClickListener =
|
||||||
|
Preference.OnPreferenceClickListener {
|
||||||
|
requireActivity().supportFragmentManager
|
||||||
|
.beginTransaction()
|
||||||
|
.replace(R.id.settings_layout, AboutFragment())
|
||||||
|
.addToBackStack(null)
|
||||||
|
.commit()
|
||||||
|
true }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,9 @@
|
||||||
package eu.ottop.yamlauncher
|
package eu.ottop.yamlauncher
|
||||||
|
|
||||||
|
import android.text.Html
|
||||||
|
import android.text.method.LinkMovementMethod
|
||||||
|
import android.widget.TextView
|
||||||
|
|
||||||
class StringUtils {
|
class StringUtils {
|
||||||
|
|
||||||
fun addEndTextIfNotEmpty(value: String, addition: String): String {
|
fun addEndTextIfNotEmpty(value: String, addition: String): String {
|
||||||
|
|
@ -14,4 +18,9 @@ class StringUtils {
|
||||||
return string?.replace("[^a-zA-Z0-9]".toRegex(), "")
|
return string?.replace("[^a-zA-Z0-9]".toRegex(), "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun setLink(view: TextView, link: String) {
|
||||||
|
view.text = Html.fromHtml(link, Html.FROM_HTML_MODE_LEGACY)
|
||||||
|
view.movementMethod = LinkMovementMethod.getInstance()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
150
app/src/main/res/layout/fragment_about.xml
Normal file
150
app/src/main/res/layout/fragment_about.xml
Normal file
|
|
@ -0,0 +1,150 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/frameLayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".AboutFragment">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/imageView"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="200dp"
|
||||||
|
android:src="@drawable/ic_launcher_foreground"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView2"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="YAM Launcher"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textSize="34sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintEnd_toEndOf="@+id/imageView"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/imageView" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView3"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="By Otto Petäjä"
|
||||||
|
android:textSize="16sp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="@+id/textView2"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/textView2" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/sourceTitle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="30dp"
|
||||||
|
android:text="Source Code"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textSize="24sp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/textView3" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/divider"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:background="?android:attr/listDivider"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/sourceTitle" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/codebergLink"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:linksClickable="true"
|
||||||
|
android:text="Codeberg"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textSize="20sp"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/githubLink"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/divider" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/githubLink"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:linksClickable="true"
|
||||||
|
android:text="GitHub"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textSize="20sp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/codebergLink"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/divider" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/donationTitle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="40dp"
|
||||||
|
android:text="Donate"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textSize="24sp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/codebergLink" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/divider2"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:background="?android:attr/listDivider"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/donationTitle" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/stripeLink"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:linksClickable="true"
|
||||||
|
android:text="Stripe"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textSize="20sp"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/githubLink"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/divider2" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/liberaLink"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:linksClickable="true"
|
||||||
|
android:text="Liberapay"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textSize="20sp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/codebergLink"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/divider2" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/weatherLink"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="20dp"
|
||||||
|
android:linksClickable="true"
|
||||||
|
android:text="Weather data by Open-Meteo.com\n(CC BY 4.0)"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textSize="16sp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
@ -49,7 +49,7 @@
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:layout_marginHorizontal="32dp"
|
android:layout_marginHorizontal="32dp"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
android:layout_marginBottom="10dp"
|
android:layout_marginBottom="0dp"
|
||||||
android:layout_weight="0.1"
|
android:layout_weight="0.1"
|
||||||
android:background="@android:color/transparent"
|
android:background="@android:color/transparent"
|
||||||
android:cursorVisible="true"
|
android:cursorVisible="true"
|
||||||
|
|
@ -63,5 +63,21 @@
|
||||||
android:textSize="25sp"
|
android:textSize="25sp"
|
||||||
tools:ignore="RtlCompat" />
|
tools:ignore="RtlCompat" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/locationLink"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="0dp"
|
||||||
|
android:layout_marginBottom="15dp"
|
||||||
|
android:linksClickable="true"
|
||||||
|
android:text="Weather data by Open-Meteo.com\n(CC BY 4.0)"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textColor="#A48E8E8E"
|
||||||
|
android:textColorLink="#6880CBC4"
|
||||||
|
android:textSize="14sp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
@ -65,4 +65,13 @@
|
||||||
</string>
|
</string>
|
||||||
<string name="attachment_summary_off">Only download attachments when manually requested</string>
|
<string name="attachment_summary_off">Only download attachments when manually requested</string>
|
||||||
|
|
||||||
|
<string name="codeberg_link"><![CDATA[<a href="https://codeberg.org/ottoptj/yamlauncher">Codeberg</a>]]></string>
|
||||||
|
<string name="github_link"><![CDATA[<a href="https://github.com">GitHub</a>]]></string>
|
||||||
|
|
||||||
|
<string name="stripe_link"><![CDATA[<a href="https://codeberg.org/ottoptj/yamlauncher">Stripe</a>]]></string>
|
||||||
|
<string name="libera_link"><![CDATA[<a href="https://github.com">Liberapay</a>]]></string>
|
||||||
|
|
||||||
|
<string name="weather_link"><![CDATA[Weather data by <a href="https://open-meteo.com/">Open-Meteo.com</a><br>(<a href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a>)]]></string>
|
||||||
|
<string name="location_link"><![CDATA[Location data by <a href="https://open-meteo.com/">Open-Meteo.com</a> (<a href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a>)]]></string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
@ -207,5 +207,17 @@
|
||||||
app:selectable="true"
|
app:selectable="true"
|
||||||
app:title="Manage Hidden Apps" />
|
app:title="Manage Hidden Apps" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
<PreferenceCategory
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:allowDividerAbove="false"
|
||||||
|
app:title="About">
|
||||||
|
<Preference
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:key="about_page"
|
||||||
|
app:selectable="true"
|
||||||
|
app:title="About YAM Launcher" />
|
||||||
|
</PreferenceCategory>
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue