Commit 15e24cfe authored by Daniel Wolf's avatar Daniel Wolf
Browse files

Added SettingsOverviewFragment which lists all preference categories (without...

Added SettingsOverviewFragment which lists all preference categories (without actual preferences) and opens the appropriate category
parent 1c67b363
......@@ -167,7 +167,7 @@ class MainActivity : NavigationDrawerActivity() {
)
fragmentItem(getString(R.string.menu_settings),
iconLeft = getDrawable(R.drawable.ic_menu_settings),
fragmentCreator = singleInstanceFragment { SettingsFragment() })
fragmentCreator = singleInstanceFragment { SettingsOverviewFragment() })
if (getPreferences().queryLoggingEnabled) {
divider()
fragmentItem(getString(R.string.menu_querylogging),
......
package com.frostnerd.smokescreen.fragment
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import com.frostnerd.smokescreen.R
import com.frostnerd.smokescreen.activity.SettingsActivity
import kotlinx.android.synthetic.main.fragment_settings_overview.*
/*
* Copyright (C) 2019 Daniel Wolf (Ch4t4r)
*
* This program 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.
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* You can contact the developer at daniel.wolf@frostnerd.com.
*/
class SettingsOverviewFragment: Fragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.fragment_settings_overview, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
general.setOnClickListener {
SettingsActivity.showCategory(context!!, SettingsActivity.Category.GENERAL)
}
notification.setOnClickListener {
SettingsActivity.showCategory(context!!, SettingsActivity.Category.NOTIFICATION)
}
pin.setOnClickListener {
SettingsActivity.showCategory(context!!, SettingsActivity.Category.PIN)
}
cache.setOnClickListener {
SettingsActivity.showCategory(context!!, SettingsActivity.Category.CACHE)
}
logging.setOnClickListener {
SettingsActivity.showCategory(context!!, SettingsActivity.Category.LOGGING)
}
ip.setOnClickListener {
SettingsActivity.showCategory(context!!, SettingsActivity.Category.IP)
}
network.setOnClickListener {
SettingsActivity.showCategory(context!!, SettingsActivity.Category.NETWORK)
}
queryLogging.setOnClickListener {
SettingsActivity.showCategory(context!!, SettingsActivity.Category.QUERIES)
}
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:id="@+id/general"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:textSize="16sp"
android:text="@string/preference_category_general"
android:layout_height="wrap_content"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:id="@+id/notification"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:textSize="16sp"
android:text="@string/preference_category_notification"
android:layout_height="wrap_content"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:id="@+id/pin"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:textSize="16sp"
android:text="@string/preference_category_pin"
android:layout_height="wrap_content"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:id="@+id/cache"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:textSize="16sp"
android:text="@string/preference_category_cache"
android:layout_height="wrap_content"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:id="@+id/logging"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:textSize="16sp"
android:text="@string/preference_category_logging"
android:layout_height="wrap_content"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:id="@+id/ip"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:textSize="16sp"
android:text="@string/preference_category_ip"
android:layout_height="wrap_content"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:id="@+id/network"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:textSize="16sp"
android:text="@string/preference_category_network"
android:layout_height="wrap_content"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:id="@+id/queryLogging"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:textSize="16sp"
android:text="@string/preference_category_querylogging"
android:layout_height="wrap_content"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment