diff --git a/android/app/src/main/java/com/metallic/chiaki/settings/SettingsLogsAdapter.kt b/android/app/src/main/java/com/metallic/chiaki/settings/SettingsLogsAdapter.kt new file mode 100644 index 0000000..3bc6d1c --- /dev/null +++ b/android/app/src/main/java/com/metallic/chiaki/settings/SettingsLogsAdapter.kt @@ -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 . + */ + +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() +{ + class ViewHolder(itemView: View): RecyclerView.ViewHolder(itemView) + + var logFiles: List = 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 + } +} \ No newline at end of file diff --git a/android/app/src/main/java/com/metallic/chiaki/settings/SettingsLogsFragment.kt b/android/app/src/main/java/com/metallic/chiaki/settings/SettingsLogsFragment.kt new file mode 100644 index 0000000..43d5ecb --- /dev/null +++ b/android/app/src/main/java/com/metallic/chiaki/settings/SettingsLogsFragment.kt @@ -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 . + */ + +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) +} \ No newline at end of file diff --git a/android/app/src/main/java/com/metallic/chiaki/settings/SettingsLogsViewModel.kt b/android/app/src/main/java/com/metallic/chiaki/settings/SettingsLogsViewModel.kt new file mode 100644 index 0000000..eb6da95 --- /dev/null +++ b/android/app/src/main/java/com/metallic/chiaki/settings/SettingsLogsViewModel.kt @@ -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 . + */ + +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() +{ +} \ No newline at end of file diff --git a/android/app/src/main/res/layout/fragment_settings_logs.xml b/android/app/src/main/res/layout/fragment_settings_logs.xml new file mode 100644 index 0000000..30f64c7 --- /dev/null +++ b/android/app/src/main/res/layout/fragment_settings_logs.xml @@ -0,0 +1,14 @@ + + + + + + diff --git a/android/app/src/main/res/layout/item_log_file.xml b/android/app/src/main/res/layout/item_log_file.xml new file mode 100644 index 0000000..4fcce3f --- /dev/null +++ b/android/app/src/main/res/layout/item_log_file.xml @@ -0,0 +1,54 @@ + + + + + + + + + + diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml index 1a5b50c..2316ce2 100644 --- a/android/app/src/main/res/values/strings.xml +++ b/android/app/src/main/res/values/strings.xml @@ -52,6 +52,8 @@ General Stream Registered Consoles + Session Logs + Collected log files from previous sessions for debugging Currently registered: %d Resolution FPS diff --git a/android/app/src/main/res/xml/preferences.xml b/android/app/src/main/res/xml/preferences.xml index a46302b..02d091f 100644 --- a/android/app/src/main/res/xml/preferences.xml +++ b/android/app/src/main/res/xml/preferences.xml @@ -13,17 +13,24 @@ app:fragment="com.metallic.chiaki.settings.SettingsRegisteredHostsFragment" app:icon="@drawable/ic_console_simple"/> + + - +