Update the provider activity
This commit is contained in:
parent
0a454f0b5f
commit
d14dfee980
@ -40,6 +40,8 @@ object Preferences : KotprefModel() {
|
|||||||
var weatherAppPackage by stringPref(key = "PREF_WEATHER_APP_PACKAGE", default = "")
|
var weatherAppPackage by stringPref(key = "PREF_WEATHER_APP_PACKAGE", default = "")
|
||||||
var weatherProviderApi by stringPref(key = "PREF_WEATHER_PROVIDER_API_KEY", default = "")
|
var weatherProviderApi by stringPref(key = "PREF_WEATHER_PROVIDER_API_KEY", default = "")
|
||||||
var weatherProvider by intPref(default = Constants.WeatherProvider.OPEN_WEATHER.value)
|
var weatherProvider by intPref(default = Constants.WeatherProvider.OPEN_WEATHER.value)
|
||||||
|
var weatherProviderError by stringPref(default = "")
|
||||||
|
var weatherProviderLocationError by stringPref(default = "")
|
||||||
var eventAppName by stringPref(key = "PREF_EVENT_APP_NAME", default = "")
|
var eventAppName by stringPref(key = "PREF_EVENT_APP_NAME", default = "")
|
||||||
var eventAppPackage by stringPref(key = "PREF_EVENT_APP_PACKAGE", default = "")
|
var eventAppPackage by stringPref(key = "PREF_EVENT_APP_PACKAGE", default = "")
|
||||||
var openEventDetails by booleanPref(default = true)
|
var openEventDetails by booleanPref(default = true)
|
||||||
|
@ -62,6 +62,56 @@ object WeatherHelper {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getProviderLinkName(context: Context): String {
|
||||||
|
return context.getString(when(Constants.WeatherProvider.fromInt(Preferences.weatherProvider)) {
|
||||||
|
Constants.WeatherProvider.OPEN_WEATHER -> R.string.action_open_provider_open_weather
|
||||||
|
Constants.WeatherProvider.WEATHER_BIT -> R.string.action_open_provider_weatherbit
|
||||||
|
Constants.WeatherProvider.FORECA -> R.string.action_open_provider_foreca
|
||||||
|
Constants.WeatherProvider.HERE -> R.string.action_open_provider_here
|
||||||
|
Constants.WeatherProvider.ACCUWEATHER -> R.string.action_open_provider_accuweather
|
||||||
|
Constants.WeatherProvider.WEATHER_GOV -> R.string.action_open_provider_weather_gov
|
||||||
|
Constants.WeatherProvider.YR -> R.string.action_open_provider_yr
|
||||||
|
Constants.WeatherProvider.SMHI -> R.string.action_open_provider_smhi
|
||||||
|
Constants.WeatherProvider.WEATHER_CA -> R.string.action_open_provider_weather_ca
|
||||||
|
Constants.WeatherProvider.BOM -> R.string.action_open_provider_bom
|
||||||
|
Constants.WeatherProvider.METEOFRANCE -> R.string.action_open_provider_meteofrance
|
||||||
|
else -> R.string.nothing
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getProviderLink(): String {
|
||||||
|
return when(Constants.WeatherProvider.fromInt(Preferences.weatherProvider)) {
|
||||||
|
Constants.WeatherProvider.OPEN_WEATHER -> "https://home.openweathermap.org/users/sign_up"
|
||||||
|
Constants.WeatherProvider.WEATHER_BIT -> ""
|
||||||
|
Constants.WeatherProvider.FORECA -> ""
|
||||||
|
Constants.WeatherProvider.HERE -> ""
|
||||||
|
Constants.WeatherProvider.ACCUWEATHER -> ""
|
||||||
|
Constants.WeatherProvider.WEATHER_GOV -> ""
|
||||||
|
Constants.WeatherProvider.YR -> ""
|
||||||
|
Constants.WeatherProvider.SMHI -> ""
|
||||||
|
Constants.WeatherProvider.WEATHER_CA -> ""
|
||||||
|
Constants.WeatherProvider.BOM -> ""
|
||||||
|
Constants.WeatherProvider.METEOFRANCE -> ""
|
||||||
|
else -> ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun isKeyRequired(): Boolean = when (Constants.WeatherProvider.fromInt(Preferences.weatherProvider)) {
|
||||||
|
Constants.WeatherProvider.OPEN_WEATHER,
|
||||||
|
Constants.WeatherProvider.WEATHER_BIT,
|
||||||
|
Constants.WeatherProvider.FORECA,
|
||||||
|
Constants.WeatherProvider.HERE,
|
||||||
|
Constants.WeatherProvider.ACCUWEATHER,
|
||||||
|
Constants.WeatherProvider.YR,
|
||||||
|
Constants.WeatherProvider.SMHI,
|
||||||
|
Constants.WeatherProvider.WEATHER_CA,
|
||||||
|
Constants.WeatherProvider.BOM,
|
||||||
|
Constants.WeatherProvider.METEOFRANCE -> true
|
||||||
|
|
||||||
|
Constants.WeatherProvider.WEATHER_GOV -> false
|
||||||
|
else -> true
|
||||||
|
}
|
||||||
|
|
||||||
fun getWeatherIconResource(icon: String, style: Int = Preferences.weatherIconPack): Int {
|
fun getWeatherIconResource(icon: String, style: Int = Preferences.weatherIconPack): Int {
|
||||||
return when (icon) {
|
return when (icon) {
|
||||||
"01d" -> {
|
"01d" -> {
|
||||||
|
@ -1,37 +1,91 @@
|
|||||||
package com.tommasoberlose.anotherwidget.ui.activities
|
package com.tommasoberlose.anotherwidget.ui.activities
|
||||||
|
|
||||||
|
import android.animation.ValueAnimator
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.app.AlertDialog
|
import android.app.AlertDialog
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.Html
|
import android.text.Html
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import android.widget.RelativeLayout
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import androidx.core.animation.addListener
|
||||||
|
import androidx.core.view.isVisible
|
||||||
|
import androidx.core.widget.addTextChangedListener
|
||||||
|
import androidx.lifecycle.Observer
|
||||||
|
import androidx.lifecycle.ViewModelProvider
|
||||||
|
import androidx.lifecycle.lifecycleScope
|
||||||
import com.tommasoberlose.anotherwidget.R
|
import com.tommasoberlose.anotherwidget.R
|
||||||
|
import com.tommasoberlose.anotherwidget.components.BottomSheetMenu
|
||||||
|
import com.tommasoberlose.anotherwidget.global.Constants
|
||||||
import com.tommasoberlose.anotherwidget.global.Preferences
|
import com.tommasoberlose.anotherwidget.global.Preferences
|
||||||
|
import com.tommasoberlose.anotherwidget.helpers.WeatherHelper
|
||||||
|
import com.tommasoberlose.anotherwidget.ui.viewmodels.MainViewModel
|
||||||
|
import com.tommasoberlose.anotherwidget.utils.collapse
|
||||||
|
import com.tommasoberlose.anotherwidget.utils.expand
|
||||||
import com.tommasoberlose.anotherwidget.utils.openURI
|
import com.tommasoberlose.anotherwidget.utils.openURI
|
||||||
import kotlinx.android.synthetic.main.activity_weather_provider.*
|
import kotlinx.android.synthetic.main.activity_weather_provider.*
|
||||||
|
import kotlinx.android.synthetic.main.the_widget_sans.*
|
||||||
|
|
||||||
class WeatherProviderActivity : AppCompatActivity() {
|
class WeatherProviderActivity : AppCompatActivity() {
|
||||||
|
private lateinit var viewModel: MainViewModel
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_weather_provider)
|
setContentView(R.layout.activity_weather_provider)
|
||||||
|
|
||||||
|
viewModel = ViewModelProvider(this).get(MainViewModel::class.java)
|
||||||
|
api_key.editText?.setText(Preferences.weatherProviderApi)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onResume() {
|
||||||
|
super.onResume()
|
||||||
|
|
||||||
|
setListener()
|
||||||
|
subscribeUi(viewModel)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun subscribeUi(viewModel: MainViewModel) {
|
||||||
|
viewModel.weatherProvider.observe(this, Observer {
|
||||||
|
weather_provider.editText?.setText(WeatherHelper.getProviderName(this, Constants.WeatherProvider.fromInt(Preferences.weatherProvider)!!).split("\n").first())
|
||||||
|
|
||||||
|
info_container.isVisible = WeatherHelper.isKeyRequired()
|
||||||
|
api_key_container.isVisible = WeatherHelper.isKeyRequired()
|
||||||
|
|
||||||
|
action_open_provider.text = WeatherHelper.getProviderLinkName(this)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setListener() {
|
||||||
action_back.setOnClickListener {
|
action_back.setOnClickListener {
|
||||||
onBackPressed()
|
onBackPressed()
|
||||||
}
|
}
|
||||||
|
|
||||||
action_save.setOnClickListener {
|
|
||||||
Preferences.weatherProviderApi = api_key.editText?.text.toString()
|
|
||||||
setResult(Activity.RESULT_OK)
|
|
||||||
finish()
|
|
||||||
}
|
|
||||||
|
|
||||||
action_open_provider.setOnClickListener {
|
action_open_provider.setOnClickListener {
|
||||||
openURI("https://home.openweathermap.org/users/sign_up")
|
openURI(WeatherHelper.getProviderLink())
|
||||||
}
|
}
|
||||||
|
|
||||||
api_key.editText?.setText(Preferences.weatherProviderApi)
|
weather_provider_inner.setOnClickListener {
|
||||||
|
if (Preferences.showWeather) {
|
||||||
|
val dialog = BottomSheetMenu<Int>(this, header = getString(R.string.settings_weather_provider_api)).setSelectedValue(Preferences.weatherProvider)
|
||||||
|
(0 until 11).forEach {
|
||||||
|
val item = Constants.WeatherProvider.fromInt(it)
|
||||||
|
dialog.addItem(WeatherHelper.getProviderName(this, item!!), it)
|
||||||
|
}
|
||||||
|
|
||||||
|
dialog.addOnSelectItemListener { value ->
|
||||||
|
Preferences.weatherProvider = value
|
||||||
|
}.show()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
api_key.editText?.addTextChangedListener {
|
||||||
|
Preferences.weatherProviderApi = it?.toString() ?: ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onBackPressed() {
|
||||||
|
setResult(Activity.RESULT_OK)
|
||||||
|
finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,7 @@ import com.tommasoberlose.anotherwidget.global.Preferences
|
|||||||
import com.tommasoberlose.anotherwidget.helpers.BitmapHelper
|
import com.tommasoberlose.anotherwidget.helpers.BitmapHelper
|
||||||
import com.tommasoberlose.anotherwidget.helpers.ColorHelper
|
import com.tommasoberlose.anotherwidget.helpers.ColorHelper
|
||||||
import com.tommasoberlose.anotherwidget.helpers.ColorHelper.isColorDark
|
import com.tommasoberlose.anotherwidget.helpers.ColorHelper.isColorDark
|
||||||
|
import com.tommasoberlose.anotherwidget.helpers.WeatherHelper
|
||||||
import com.tommasoberlose.anotherwidget.ui.activities.MainActivity
|
import com.tommasoberlose.anotherwidget.ui.activities.MainActivity
|
||||||
import com.tommasoberlose.anotherwidget.ui.adapters.ViewPagerAdapter
|
import com.tommasoberlose.anotherwidget.ui.adapters.ViewPagerAdapter
|
||||||
import com.tommasoberlose.anotherwidget.ui.viewmodels.MainViewModel
|
import com.tommasoberlose.anotherwidget.ui.viewmodels.MainViewModel
|
||||||
@ -349,8 +350,15 @@ class MainFragment : Fragment(), SharedPreferences.OnSharedPreferenceChangeList
|
|||||||
tabs?.getTabAt(2)?.orCreateBadge?.apply {
|
tabs?.getTabAt(2)?.orCreateBadge?.apply {
|
||||||
backgroundColor = ContextCompat.getColor(requireContext(), R.color.errorColorText)
|
backgroundColor = ContextCompat.getColor(requireContext(), R.color.errorColorText)
|
||||||
badgeGravity = BadgeDrawable.TOP_END
|
badgeGravity = BadgeDrawable.TOP_END
|
||||||
}?.isVisible = Preferences.showWeather && (Preferences.weatherProviderApi == "" || (Preferences.customLocationAdd == "" && activity?.checkGrantedPermission(if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) Manifest.permission.ACCESS_BACKGROUND_LOCATION else Manifest.permission.ACCESS_FINE_LOCATION) != true))
|
}?.isVisible = if (Preferences.showWeather) {
|
||||||
|
(WeatherHelper.isKeyRequired() && Preferences.weatherProviderApi == "")
|
||||||
|
|| (Preferences.customLocationAdd == "" && activity?.checkGrantedPermission(
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) Manifest.permission.ACCESS_BACKGROUND_LOCATION else Manifest.permission.ACCESS_FINE_LOCATION
|
||||||
|
) != true)
|
||||||
|
|| (Preferences.weatherProviderError != "")
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
// Music error indicator
|
// Music error indicator
|
||||||
tabs?.getTabAt(4)?.orCreateBadge?.apply {
|
tabs?.getTabAt(4)?.orCreateBadge?.apply {
|
||||||
|
@ -105,14 +105,16 @@ class WeatherTabFragment : Fragment() {
|
|||||||
viewModel.weatherProvider.observe(viewLifecycleOwner, Observer {
|
viewModel.weatherProvider.observe(viewLifecycleOwner, Observer {
|
||||||
maintainScrollPosition {
|
maintainScrollPosition {
|
||||||
label_weather_provider.text = WeatherHelper.getProviderName(requireContext(), Constants.WeatherProvider.fromInt(it)!!)
|
label_weather_provider.text = WeatherHelper.getProviderName(requireContext(), Constants.WeatherProvider.fromInt(it)!!)
|
||||||
|
checkWeatherProviderConfig()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
viewModel.weatherProviderApi.observe(viewLifecycleOwner, Observer {
|
viewModel.weatherProviderError.observe(viewLifecycleOwner, Observer {
|
||||||
maintainScrollPosition {
|
checkWeatherProviderConfig()
|
||||||
checkWeatherProviderConfig()
|
})
|
||||||
}
|
|
||||||
checkLocationPermission()
|
viewModel.weatherProviderLocationError.observe(viewLifecycleOwner, Observer {
|
||||||
|
checkWeatherProviderConfig()
|
||||||
})
|
})
|
||||||
|
|
||||||
viewModel.customLocationAdd.observe(viewLifecycleOwner, Observer {
|
viewModel.customLocationAdd.observe(viewLifecycleOwner, Observer {
|
||||||
@ -184,11 +186,11 @@ class WeatherTabFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun checkWeatherProviderConfig() {
|
private fun checkWeatherProviderConfig() {
|
||||||
label_weather_provider_api_key?.text =
|
weather_provider_error.isVisible = Preferences.weatherProviderError != ""
|
||||||
if (Preferences.weatherProviderApi == "") getString(R.string.settings_weather_provider_api_key_subtitle_not_set) else getString(
|
weather_provider_error?.text = Preferences.weatherProviderError
|
||||||
R.string.settings_weather_provider_api_key_subtitle_all_set
|
|
||||||
)
|
weather_provider_location_error.isVisible = Preferences.weatherProviderLocationError != ""
|
||||||
label_weather_provider_api_key?.setTextColor(ContextCompat.getColor(requireContext(), if (Preferences.weatherProviderApi == "" && Preferences.showWeather) R.color.errorColorText else R.color.colorSecondaryText))
|
weather_provider_location_error?.text = Preferences.weatherProviderLocationError
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupListener() {
|
private fun setupListener() {
|
||||||
@ -205,21 +207,6 @@ class WeatherTabFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
action_weather_provider.setOnClickListener {
|
action_weather_provider.setOnClickListener {
|
||||||
if (Preferences.showWeather) {
|
|
||||||
val dialog = BottomSheetMenu<Int>(requireContext(), header = getString(R.string.settings_weather_provider_api)).setSelectedValue(Preferences.weatherProvider)
|
|
||||||
(0 until 11).forEach {
|
|
||||||
val item = Constants.WeatherProvider.fromInt(it)
|
|
||||||
dialog.addItem(WeatherHelper.getProviderName(requireContext(), item!!), it)
|
|
||||||
}
|
|
||||||
|
|
||||||
dialog.addOnSelectItemListener { value ->
|
|
||||||
Preferences.weatherProvider = value
|
|
||||||
checkWeatherProviderConfig()
|
|
||||||
}.show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
action_weather_provider_api_key.setOnClickListener {
|
|
||||||
if (Preferences.showWeather) {
|
if (Preferences.showWeather) {
|
||||||
startActivityForResult(
|
startActivityForResult(
|
||||||
Intent(requireContext(), WeatherProviderActivity::class.java),
|
Intent(requireContext(), WeatherProviderActivity::class.java),
|
||||||
|
@ -68,6 +68,8 @@ class MainViewModel : ViewModel() {
|
|||||||
val showWeatherWarning = Preferences.asLiveData(Preferences::showWeatherWarning)
|
val showWeatherWarning = Preferences.asLiveData(Preferences::showWeatherWarning)
|
||||||
val weatherIconPack = Preferences.asLiveData(Preferences::weatherIconPack)
|
val weatherIconPack = Preferences.asLiveData(Preferences::weatherIconPack)
|
||||||
val weatherProvider = Preferences.asLiveData(Preferences::weatherProvider)
|
val weatherProvider = Preferences.asLiveData(Preferences::weatherProvider)
|
||||||
|
val weatherProviderError = Preferences.asLiveData(Preferences::weatherProviderError)
|
||||||
|
val weatherProviderLocationError = Preferences.asLiveData(Preferences::weatherProviderLocationError)
|
||||||
|
|
||||||
// Glance
|
// Glance
|
||||||
val showGlance = Preferences.asLiveData(Preferences::showGlance)
|
val showGlance = Preferences.asLiveData(Preferences::showGlance)
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_centerInParent="true"
|
android:layout_centerInParent="true"
|
||||||
android:text="@string/settings_weather_provider_api_key_title"
|
android:text="@string/settings_weather_provider_api"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
style="@style/AnotherWidget.Main.Title"/>
|
style="@style/AnotherWidget.Main.Title"/>
|
||||||
<TextView
|
<TextView
|
||||||
@ -41,6 +41,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/action_save"
|
android:text="@string/action_save"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
|
android:visibility="gone"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:padding="16dp"
|
android:padding="16dp"
|
||||||
@ -63,6 +64,45 @@
|
|||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:descendantFocusability="beforeDescendants"
|
android:descendantFocusability="beforeDescendants"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
|
android:focusableInTouchMode="true"
|
||||||
|
android:gravity="center_vertical">
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:id="@+id/weather_provider"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:inputType="textCapWords"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:nextFocusUp="@id/api_key"
|
||||||
|
android:nextFocusLeft="@id/api_key"
|
||||||
|
android:gravity="center_vertical|start"
|
||||||
|
android:textColor="@color/colorPrimaryText"
|
||||||
|
app:boxBackgroundColor="@color/colorPrimary"
|
||||||
|
app:boxStrokeWidth="0dp"
|
||||||
|
app:hintTextColor="@color/colorPrimary"
|
||||||
|
android:hint="@string/settings_weather_provider_api"
|
||||||
|
android:fontFamily="@font/google_sans"
|
||||||
|
android:textAlignment="viewStart"
|
||||||
|
android:textDirection="locale"
|
||||||
|
style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox">
|
||||||
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textAlignment="viewStart"
|
||||||
|
android:focusable="false"
|
||||||
|
android:clickable="false"
|
||||||
|
android:id="@+id/weather_provider_inner"
|
||||||
|
android:textDirection="locale"
|
||||||
|
android:fontFamily="@font/google_sans"
|
||||||
|
android:gravity="center_vertical|start" />
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:descendantFocusability="beforeDescendants"
|
||||||
|
android:focusable="true"
|
||||||
|
android:paddingTop="16dp"
|
||||||
android:id="@+id/api_key_container"
|
android:id="@+id/api_key_container"
|
||||||
android:focusableInTouchMode="true"
|
android:focusableInTouchMode="true"
|
||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical">
|
||||||
@ -79,7 +119,7 @@
|
|||||||
app:boxBackgroundColor="@color/colorPrimary"
|
app:boxBackgroundColor="@color/colorPrimary"
|
||||||
app:boxStrokeWidth="0dp"
|
app:boxStrokeWidth="0dp"
|
||||||
app:hintTextColor="@color/colorAccent"
|
app:hintTextColor="@color/colorAccent"
|
||||||
android:hint="@string/api_key_hint"
|
android:hint="@string/settings_weather_provider_api_key_title"
|
||||||
android:fontFamily="@font/google_sans"
|
android:fontFamily="@font/google_sans"
|
||||||
android:textAlignment="viewStart"
|
android:textAlignment="viewStart"
|
||||||
android:textDirection="locale"
|
android:textDirection="locale"
|
||||||
@ -89,87 +129,56 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textAlignment="viewStart"
|
android:textAlignment="viewStart"
|
||||||
android:textDirection="locale"
|
android:textDirection="locale"
|
||||||
|
android:id="@+id/api_key_inner"
|
||||||
android:fontFamily="@font/google_sans"
|
android:fontFamily="@font/google_sans"
|
||||||
android:gravity="center_vertical|start" />
|
android:gravity="center_vertical|start" />
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="1dp"
|
|
||||||
android:layout_marginTop="24dp"
|
|
||||||
android:layout_marginBottom="32dp"
|
|
||||||
android:background="@color/disabledButtonBackground" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
style="@style/AnotherWidget.Settings.Title"
|
android:orientation="vertical"
|
||||||
android:gravity="start"
|
android:id="@+id/info_container">
|
||||||
android:textAlignment="viewStart"
|
<LinearLayout
|
||||||
android:text="@string/api_key_title_1"/>
|
android:layout_width="match_parent"
|
||||||
<TextView
|
android:layout_height="1dp"
|
||||||
android:layout_width="match_parent"
|
android:layout_marginTop="24dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_marginBottom="24dp"
|
||||||
style="@style/AnotherWidget.Main.Subtitle"
|
android:background="@color/disabledButtonBackground" />
|
||||||
android:textSize="16sp"
|
<TextView
|
||||||
android:gravity="start"
|
android:layout_width="match_parent"
|
||||||
android:textAlignment="viewStart"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/api_key_subtitle_1"/>
|
style="@style/AnotherWidget.Settings.Title"
|
||||||
<TextView
|
android:gravity="start"
|
||||||
android:layout_width="match_parent"
|
android:textAlignment="viewStart"
|
||||||
android:layout_height="wrap_content"
|
android:text="This weather provider needs\nan API key to work correctly."/>
|
||||||
style="@style/AnotherWidget.Settings.Title"
|
<TextView
|
||||||
android:layout_marginTop="12dp"
|
android:layout_width="match_parent"
|
||||||
android:gravity="start"
|
android:layout_height="wrap_content"
|
||||||
android:textAlignment="viewStart"
|
style="@style/AnotherWidget.Main.Subtitle"
|
||||||
android:text="@string/api_key_title_2"/>
|
android:textSize="16sp"
|
||||||
<TextView
|
android:layout_marginTop="12dp"
|
||||||
android:layout_width="match_parent"
|
android:gravity="start"
|
||||||
android:layout_height="wrap_content"
|
android:textAlignment="viewStart"
|
||||||
style="@style/AnotherWidget.Main.Subtitle"
|
android:text="Please, open the provider website, create a personal account and copy here the default key."/>
|
||||||
android:textSize="16sp"
|
<com.google.android.material.button.MaterialButton
|
||||||
android:gravity="start"
|
android:layout_width="match_parent"
|
||||||
android:textAlignment="viewStart"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/api_key_subtitle_2"/>
|
android:textColor="@color/colorAccent"
|
||||||
<TextView
|
android:letterSpacing="0"
|
||||||
android:layout_width="match_parent"
|
android:clickable="true"
|
||||||
android:layout_height="wrap_content"
|
android:focusable="true"
|
||||||
style="@style/AnotherWidget.Settings.Title"
|
android:layout_marginTop="8dp"
|
||||||
android:layout_marginTop="12dp"
|
android:textSize="15sp"
|
||||||
android:gravity="start"
|
android:gravity="start|center_vertical"
|
||||||
android:textAlignment="viewStart"
|
android:textAlignment="viewStart"
|
||||||
android:text="@string/api_key_title_3"/>
|
android:layout_marginStart="-8dp"
|
||||||
<TextView
|
style="@style/Widget.MaterialComponents.Button.TextButton"
|
||||||
android:layout_width="match_parent"
|
android:textAllCaps="false"
|
||||||
android:layout_height="wrap_content"
|
android:id="@+id/action_open_provider"
|
||||||
style="@style/AnotherWidget.Main.Subtitle"
|
android:text="@string/action_open_provider"/>
|
||||||
android:textSize="16sp"
|
</LinearLayout>
|
||||||
android:gravity="start"
|
|
||||||
android:textAlignment="viewStart"
|
|
||||||
android:text="@string/api_key_subtitle_3"/>
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
style="@style/AnotherWidget.Main.Subtitle"
|
|
||||||
android:textSize="16sp"
|
|
||||||
android:gravity="start"
|
|
||||||
android:textAlignment="viewStart"
|
|
||||||
android:text="@string/api_key_info_all_set"/>
|
|
||||||
<com.google.android.material.button.MaterialButton
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textColor="@color/colorAccent"
|
|
||||||
android:letterSpacing="0"
|
|
||||||
android:clickable="true"
|
|
||||||
android:focusable="true"
|
|
||||||
android:gravity="start|center_vertical"
|
|
||||||
android:textAlignment="viewStart"
|
|
||||||
android:layout_marginStart="-8dp"
|
|
||||||
style="@style/Widget.MaterialComponents.Button.TextButton"
|
|
||||||
android:textAllCaps="false"
|
|
||||||
android:id="@+id/action_open_provider"
|
|
||||||
android:text="@string/action_open_provider"/>
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -162,52 +162,22 @@
|
|||||||
style="@style/AnotherWidget.Settings.Subtitle"/>
|
style="@style/AnotherWidget.Settings.Subtitle"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<LinearLayout
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingTop="16dp"
|
android:duplicateParentState="true"
|
||||||
android:paddingBottom="16dp"
|
android:textSize="14sp"
|
||||||
android:paddingLeft="8dp"
|
android:paddingStart="64dp"
|
||||||
android:paddingRight="8dp"
|
android:paddingEnd="16dp"
|
||||||
android:clickable="true"
|
android:paddingBottom="8dp"
|
||||||
android:focusable="true"
|
android:visibility="gone"
|
||||||
android:background="?android:attr/selectableItemBackground"
|
android:id="@+id/weather_provider_error"
|
||||||
android:gravity="center_vertical"
|
android:textColor="@color/errorColorText"
|
||||||
android:id="@+id/action_weather_provider_api_key"
|
android:letterSpacing="0"
|
||||||
android:orientation="horizontal">
|
android:fontFamily="@font/google_sans"
|
||||||
<ImageView
|
android:textStyle="bold"
|
||||||
android:layout_width="48dp"
|
android:textAppearance="@style/TextAppearance.MaterialComponents.Button"
|
||||||
android:layout_height="48dp"
|
app:textAllCaps="false" />
|
||||||
android:padding="12dp"
|
|
||||||
android:src="@drawable/round_vpn_key"
|
|
||||||
app:tint="@color/colorPrimaryText"/>
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:paddingLeft="8dp"
|
|
||||||
android:paddingRight="8dp"
|
|
||||||
android:orientation="vertical">
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
style="@style/AnotherWidget.Settings.Title"
|
|
||||||
android:text="@string/settings_weather_provider_api_key_title"/>
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:id="@+id/label_weather_provider_api_key"
|
|
||||||
style="@style/AnotherWidget.Settings.Subtitle"/>
|
|
||||||
</LinearLayout>
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="48dp"
|
|
||||||
android:layout_height="48dp"
|
|
||||||
android:padding="12dp"
|
|
||||||
android:visibility="gone"
|
|
||||||
android:id="@+id/api_key_alert_icon"
|
|
||||||
android:src="@drawable/round_error"
|
|
||||||
app:tint="@color/errorColorText"/>
|
|
||||||
</LinearLayout>
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@ -262,6 +232,22 @@
|
|||||||
android:text="@string/action_grant_permission"/>
|
android:text="@string/action_grant_permission"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:duplicateParentState="true"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:paddingStart="64dp"
|
||||||
|
android:paddingEnd="16dp"
|
||||||
|
android:paddingBottom="8dp"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:id="@+id/weather_provider_location_error"
|
||||||
|
android:textColor="@color/errorColorText"
|
||||||
|
android:letterSpacing="0"
|
||||||
|
android:fontFamily="@font/google_sans"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textAppearance="@style/TextAppearance.MaterialComponents.Button"
|
||||||
|
app:textAllCaps="false" />
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -130,6 +130,17 @@
|
|||||||
<string name="settings_weather_provider_weather_ca">Weather.gc.ca (Canada)</string>
|
<string name="settings_weather_provider_weather_ca">Weather.gc.ca (Canada)</string>
|
||||||
<string name="settings_weather_provider_bom">BOM (Australia)\nPowered by Australia\'s national weather</string>
|
<string name="settings_weather_provider_bom">BOM (Australia)\nPowered by Australia\'s national weather</string>
|
||||||
<string name="settings_weather_provider_meteofrance">Meteofrance.com (France)</string>
|
<string name="settings_weather_provider_meteofrance">Meteofrance.com (France)</string>
|
||||||
|
<string name="action_open_provider_open_weather">Open openweathermap.com</string>
|
||||||
|
<string name="action_open_provider_weatherbit">Open weatherbit.io</string>
|
||||||
|
<string name="action_open_provider_foreca">Open foreca.com</string>
|
||||||
|
<string name="action_open_provider_here">Open here.com</string>
|
||||||
|
<string name="action_open_provider_accuweather">Open Accuweather.com</string>
|
||||||
|
<string name="action_open_provider_weather_gov">Open Weather.gov</string>
|
||||||
|
<string name="action_open_provider_yr">Open yr.no</string>
|
||||||
|
<string name="action_open_provider_smhi">Open smhi.se</string>
|
||||||
|
<string name="action_open_provider_weather_ca">Open weather.gc.ca</string>
|
||||||
|
<string name="action_open_provider_bom">Open bom.gov.au</string>
|
||||||
|
<string name="action_open_provider_meteofrance">Open meteofrance.com</string>
|
||||||
|
|
||||||
<!-- Clock -->
|
<!-- Clock -->
|
||||||
<string name="settings_clock_title">Clock</string>
|
<string name="settings_clock_title">Clock</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user