mirror of
https://github.com/jrpie/Launcher.git
synced 2025-02-23 06:21:31 +01:00
Create date-formats-spinner
This commit is contained in:
parent
6a3145846e
commit
2dd3709e78
3 changed files with 52 additions and 5 deletions
|
@ -7,16 +7,19 @@ import android.os.Build
|
|||
import android.os.Bundle
|
||||
import android.provider.MediaStore
|
||||
import android.util.DisplayMetrics
|
||||
import androidx.fragment.app.Fragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ArrayAdapter
|
||||
import android.widget.Spinner
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.palette.graphics.Palette
|
||||
import com.finnmglas.launcher.*
|
||||
import com.finnmglas.launcher.settings.intendedSettingsPause
|
||||
import kotlinx.android.synthetic.main.settings_theme.*
|
||||
import kotlinx.android.synthetic.main.settings_launcher.*
|
||||
|
||||
|
||||
/**
|
||||
* The [SettingsFragmentLauncher] is a used as a tab in the SettingsActivity.
|
||||
|
@ -29,12 +32,28 @@ class SettingsFragmentLauncher : Fragment(), UIObject {
|
|||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View? {
|
||||
return inflater.inflate(R.layout.settings_theme, container, false)
|
||||
return inflater.inflate(R.layout.settings_launcher, container, false)
|
||||
}
|
||||
|
||||
override fun onStart(){
|
||||
super<Fragment>.onStart()
|
||||
super<UIObject>.onStart()
|
||||
|
||||
val staticSpinner = activity!!.findViewById(R.id.settings_launcher_format_spinner) as Spinner
|
||||
|
||||
// Create an ArrayAdapter using the string array and a default spinner
|
||||
val staticAdapter = ArrayAdapter
|
||||
.createFromResource(
|
||||
activity!!, R.array.settings_launcher_time_formats,
|
||||
android.R.layout.simple_spinner_item
|
||||
)
|
||||
|
||||
// Specify the layout to use when the list of choices appears
|
||||
staticAdapter
|
||||
.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
|
||||
|
||||
// Apply the adapter to the spinner
|
||||
staticSpinner.adapter = staticAdapter
|
||||
}
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
android:id="@+id/settings_theme_scroller"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginBottom="32dp"
|
||||
app:layout_constraintBottom_toTopOf="@id/settings_launcher_text_screen_timeout"
|
||||
android:layout_marginBottom="16dp"
|
||||
app:layout_constraintBottom_toTopOf="@id/settings_launcher_text_time_format"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
@ -139,6 +139,25 @@
|
|||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/settings_launcher_text_time_format"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="32dp"
|
||||
android:text="@string/settings_launcher_time_format"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintBottom_toTopOf="@id/settings_launcher_text_screen_timeout"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/settings_launcher_format_spinner"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:spinnerMode="dropdown"
|
||||
app:layout_constraintBottom_toBottomOf="@id/settings_launcher_text_time_format"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/settings_launcher_text_time_format" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/settings_launcher_text_screen_timeout"
|
||||
android:layout_width="wrap_content"
|
|
@ -49,6 +49,15 @@
|
|||
<string name="settings_select_image">Change Image</string>
|
||||
<string name="settings_theme_examples">Examples</string>
|
||||
<string name="settings_launcher_disable_timeout">Keep screen on</string>
|
||||
<string name="settings_launcher_time_format">Date format</string>
|
||||
|
||||
<string-array name="settings_launcher_time_formats">
|
||||
<item>default</item>
|
||||
<item>inverse</item>
|
||||
<item>time only</item>
|
||||
<item>german</item>
|
||||
<item>german inv</item>
|
||||
</string-array>
|
||||
|
||||
<string name="settings_footer_repo">https://github.com/finnmglas/Launcher#en</string>
|
||||
<string name="settings_footer_web">https://www.finnmglas.com</string>
|
||||
|
|
Loading…
Add table
Reference in a new issue