mirror of
https://git.sr.ht/~thestr4ng3r/chiaki
synced 2025-08-21 05:53:12 -07:00
Add stub SettingsLogsFragment to Android
This commit is contained in:
parent
84cdbe41dc
commit
7257ceb2ce
7 changed files with 212 additions and 5 deletions
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* This file is part of Chiaki.
|
||||
*
|
||||
* Chiaki 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.
|
||||
*
|
||||
* Chiaki 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 Chiaki. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.metallic.chiaki.settings
|
||||
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.metallic.chiaki.R
|
||||
import com.metallic.chiaki.common.RegisteredHost
|
||||
import com.metallic.chiaki.common.ext.inflate
|
||||
import kotlinx.android.synthetic.main.item_registered_host.view.*
|
||||
|
||||
class SettingsLogsAdapter: RecyclerView.Adapter<SettingsLogsAdapter.ViewHolder>()
|
||||
{
|
||||
class ViewHolder(itemView: View): RecyclerView.ViewHolder(itemView)
|
||||
|
||||
var logFiles: List<String> = listOf()
|
||||
set(value)
|
||||
{
|
||||
field = value
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ViewHolder(parent.inflate(R.layout.item_log_file))
|
||||
|
||||
override fun getItemCount() = logFiles.size
|
||||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int)
|
||||
{
|
||||
val view = holder.itemView
|
||||
val logFile = logFiles[position]
|
||||
// TODO
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* This file is part of Chiaki.
|
||||
*
|
||||
* Chiaki 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.
|
||||
*
|
||||
* Chiaki 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 Chiaki. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.metallic.chiaki.settings
|
||||
|
||||
import android.content.res.Resources
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.appcompat.app.AppCompatDialogFragment
|
||||
import androidx.lifecycle.ViewModelProviders
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.metallic.chiaki.R
|
||||
import com.metallic.chiaki.common.ext.viewModelFactory
|
||||
import kotlinx.android.synthetic.main.fragment_settings_logs.*
|
||||
|
||||
class SettingsLogsFragment: AppCompatDialogFragment(), TitleFragment
|
||||
{
|
||||
private lateinit var viewModel: SettingsLogsViewModel
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View =
|
||||
inflater.inflate(R.layout.fragment_settings_logs, container, false)
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?)
|
||||
{
|
||||
viewModel = ViewModelProviders
|
||||
.of(this, viewModelFactory { SettingsLogsViewModel() })
|
||||
.get(SettingsLogsViewModel::class.java)
|
||||
|
||||
val adapter = SettingsLogsAdapter()
|
||||
logsRecyclerView.layoutManager = LinearLayoutManager(context)
|
||||
logsRecyclerView.adapter = adapter
|
||||
}
|
||||
|
||||
override fun getTitle(resources: Resources): String = resources.getString(R.string.preferences_logs_title)
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* This file is part of Chiaki.
|
||||
*
|
||||
* Chiaki 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.
|
||||
*
|
||||
* Chiaki 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 Chiaki. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.metallic.chiaki.settings
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.metallic.chiaki.common.AppDatabase
|
||||
import com.metallic.chiaki.common.RegisteredHost
|
||||
import com.metallic.chiaki.common.ext.toLiveData
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.rxkotlin.addTo
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
|
||||
class SettingsLogsViewModel: ViewModel()
|
||||
{
|
||||
}
|
14
android/app/src/main/res/layout/fragment_settings_logs.xml
Normal file
14
android/app/src/main/res/layout/fragment_settings_logs.xml
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/rootLayout">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/logsRecyclerView"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
54
android/app/src/main/res/layout/item_log_file.xml
Normal file
54
android/app/src/main/res/layout/item_log_file.xml
Normal file
|
@ -0,0 +1,54 @@
|
|||
<?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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingEnd="?android:attr/scrollbarSize"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iconImageView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxWidth="48dp"
|
||||
android:maxHeight="48dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginStart="16dp"
|
||||
android:src="@drawable/ic_log"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/nameTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:ellipsize="marquee"
|
||||
android:fadingEdge="horizontal"
|
||||
app:layout_constraintStart_toEndOf="@id/iconImageView"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginStart="32dp"
|
||||
tools:text="Name" />
|
||||
|
||||
<!--<TextView
|
||||
android:id="@+id/summaryTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@android:id/title"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:maxLines="4"
|
||||
app:layout_constraintStart_toStartOf="@id/nameTextView"
|
||||
app:layout_constraintTop_toBottomOf="@id/nameTextView"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
tools:text="Summary"/>-->
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -52,6 +52,8 @@
|
|||
<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_logs_title">Session Logs</string>
|
||||
<string name="preferences_logs_summary">Collected log files from previous sessions for debugging</string>
|
||||
<string name="preferences_registered_hosts_summary">Currently registered: %d</string>
|
||||
<string name="preferences_resolution_title">Resolution</string>
|
||||
<string name="preferences_fps_title">FPS</string>
|
||||
|
|
|
@ -13,17 +13,24 @@
|
|||
app:fragment="com.metallic.chiaki.settings.SettingsRegisteredHostsFragment"
|
||||
app:icon="@drawable/ic_console_simple"/>
|
||||
|
||||
<SwitchPreference
|
||||
app:key="@string/preferences_swap_cross_moon_key"
|
||||
app:title="@string/preferences_swap_cross_moon_title"
|
||||
app:summary="@string/preferences_swap_cross_moon_summary"
|
||||
app:icon="@drawable/ic_gamepad" />
|
||||
|
||||
<SwitchPreference
|
||||
app:key="@string/preferences_log_verbose_key"
|
||||
app:title="@string/preferences_log_verbose_title"
|
||||
app:summary="@string/preferences_log_verbose_summary"
|
||||
app:icon="@drawable/ic_log" />
|
||||
|
||||
<SwitchPreference
|
||||
app:key="@string/preferences_swap_cross_moon_key"
|
||||
app:title="@string/preferences_swap_cross_moon_title"
|
||||
app:summary="@string/preferences_swap_cross_moon_summary"
|
||||
app:icon="@drawable/ic_gamepad" />
|
||||
<Preference
|
||||
app:key="logs"
|
||||
app:summary="@string/preferences_logs_summary"
|
||||
app:title="@string/preferences_logs_title"
|
||||
app:fragment="com.metallic.chiaki.settings.SettingsLogsFragment"
|
||||
app:icon="@drawable/ic_log"/>
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue