Some Android Settings

This commit is contained in:
Florian Märkl 2019-10-16 16:44:23 +02:00
commit 65193fb575
No known key found for this signature in database
GPG key ID: 125BC8A5A6A1E857
5 changed files with 45 additions and 14 deletions

View file

@ -20,6 +20,7 @@ package com.metallic.chiaki.settings
import android.os.Bundle import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import com.metallic.chiaki.R import com.metallic.chiaki.R
import kotlinx.android.synthetic.main.activity_settings.*
class SettingsActivity: AppCompatActivity() class SettingsActivity: AppCompatActivity()
{ {
@ -27,5 +28,7 @@ class SettingsActivity: AppCompatActivity()
{ {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_settings) setContentView(R.layout.activity_settings)
title = ""
setSupportActionBar(toolbar)
} }
} }

View file

@ -122,7 +122,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:fontFamily="sans-serif-condensed" android:fontFamily="sans-serif-condensed"
android:text="@string/main_title" android:text="@string/title_main"
android:textColor="?attr/colorOnPrimary" android:textColor="?attr/colorOnPrimary"
android:textSize="20dp" /> android:textSize="20dp" />

View file

@ -1,14 +1,32 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
android:theme="@style/AppTheme.Toolbar">
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:fontFamily="sans-serif-condensed"
android:text="@string/title_settings"
android:textColor="?attr/colorOnPrimary"
android:textSize="20dp" />
</com.google.android.material.appbar.MaterialToolbar>
<fragment <fragment
android:id="@+id/settingsFragment" android:id="@+id/settingsFragment"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="0dp"
android:name="com.metallic.chiaki.settings.SettingsFragment" /> android:name="com.metallic.chiaki.settings.SettingsFragment"
app:layout_constraintTop_toBottomOf="@id/toolbar"
app:layout_constraintBottom_toBottomOf="parent"/>
</LinearLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -1,6 +1,7 @@
<resources> <resources>
<string name="app_name">Chiaki</string> <string name="app_name">Chiaki</string>
<string name="main_title">Chiaki 千秋</string> <string name="title_main">Chiaki 千秋</string>
<string name="title_settings">Settings</string>
<string name="alert_message_session_quit">Session has quit: %s</string> <string name="alert_message_session_quit">Session has quit: %s</string>
<string name="alert_message_session_create_error">Failed to create Session: %s</string> <string name="alert_message_session_create_error">Failed to create Session: %s</string>
<string name="alert_message_login_pin_request">Login PIN:</string> <string name="alert_message_login_pin_request">Login PIN:</string>
@ -38,4 +39,8 @@
<string name="alert_regist_duplicate">The console with MAC %s has already been registered. Should the previous record be overwritten?</string> <string name="alert_regist_duplicate">The console with MAC %s has already been registered. Should the previous record be overwritten?</string>
<string name="action_regist_overwrite">Overwrite</string> <string name="action_regist_overwrite">Overwrite</string>
<string name="action_regist_discard">Cancel</string> <string name="action_regist_discard">Cancel</string>
<string name="preferences_category_title_general">General</string>
<string name="preferences_category_title_stream">Stream</string>
<string name="preferences_registered_hosts_title">Registered Consoles</string>
<string name="preferences_registered_hosts_summary">Currently registered: %d</string>
</resources> </resources>

View file

@ -1,11 +1,16 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto"> <PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto">
<SwitchPreferenceCompat <PreferenceCategory
app:key="notifications" app:key="category_general"
app:title="Enable message notifications"/> app:title="@string/preferences_category_title_general">
<Preference <Preference
app:key="feedback" app:key="registered_hosts"
app:title="Send feedback" app:summary="@string/preferences_registered_hosts_summary"
app:summary="Report technical issues or suggest new features"/> app:title="@string/preferences_registered_hosts_title"/>
</PreferenceCategory>
<PreferenceCategory
app:key="category_stream"
app:title="@string/preferences_category_title_stream">
</PreferenceCategory>
</PreferenceScreen> </PreferenceScreen>