Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Charles
Nebulo
Commits
9f2c6766
Commit
9f2c6766
authored
Dec 15, 2019
by
Daniel Wolf
Browse files
Current state
parent
8f5c4b36
Changes
8
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/com/frostnerd/smokescreen/activity/SettingsActivity.kt
View file @
9f2c6766
...
...
@@ -65,6 +65,6 @@ class SettingsActivity : BaseActivity() {
}
enum
class
Category
{
GENERAL
,
NOTIFICATION
,
PIN
,
CACHE
,
LOGGING
,
IP
,
NETWORK
,
QUERIES
GENERAL
,
NOTIFICATION
,
PIN
,
CACHE
,
LOGGING
,
IP
,
NETWORK
,
QUERIES
,
SETTINGS_EXPORT
}
}
\ No newline at end of file
app/src/main/java/com/frostnerd/smokescreen/dialog/SettingsExportDialog.kt
0 → 100644
View file @
9f2c6766
package
com.frostnerd.smokescreen.dialog
import
android.content.Context
import
android.content.DialogInterface
import
androidx.appcompat.app.AlertDialog
import
com.frostnerd.smokescreen.R
import
com.frostnerd.smokescreen.getPreferences
/*
* 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
SettingsExportDialog
(
context
:
Context
):
AlertDialog
(
context
,
context
.
getPreferences
().
theme
.
dialogStyle
)
{
init
{
val
view
=
layoutInflater
.
inflate
(
R
.
layout
.
dialog_settingsexport
,
null
,
false
)
setView
(
view
)
setTitle
(
R
.
string
.
title_export_settings
)
setButton
(
DialogInterface
.
BUTTON_NEGATIVE
,
context
.
getString
(
android
.
R
.
string
.
cancel
))
{
dialog
,
_
->
dialog
.
dismiss
()
}
}
}
\ No newline at end of file
app/src/main/java/com/frostnerd/smokescreen/fragment/SettingsFragment.kt
View file @
9f2c6766
...
...
@@ -73,6 +73,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
SettingsActivity
.
Category
.
IP
->
R
.
xml
.
preferences_ip
SettingsActivity
.
Category
.
NETWORK
->
R
.
xml
.
preferences_network
SettingsActivity
.
Category
.
QUERIES
->
R
.
xml
.
preferences_queries
SettingsActivity
.
Category
.
SETTINGS_EXPORT
->
R
.
xml
.
preferences_export
}
setPreferencesFromResource
(
resource
,
rootKey
)
log
(
"Preferences added."
)
...
...
@@ -130,6 +131,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
SettingsActivity
.
Category
.
IP
->
processIPCategory
()
SettingsActivity
.
Category
.
NETWORK
->
processNetworkCategory
()
SettingsActivity
.
Category
.
QUERIES
->
processQueryCategory
()
SettingsActivity
.
Category
.
SETTINGS_EXPORT
->
processSettingsExportCategory
()
}
}
...
...
@@ -446,6 +448,13 @@ class SettingsFragment : PreferenceFragmentCompat() {
}
}
fun
processSettingsExportCategory
()
{
findPreference
(
"export_settings"
).
setOnPreferenceClickListener
{
true
}
}
private
fun
showLogDeletionDialog
()
{
AlertDialog
.
Builder
(
requireContext
(),
requireContext
().
getPreferences
().
theme
.
dialogStyle
)
.
setTitle
(
R
.
string
.
title_delete_all_logs
)
...
...
app/src/main/java/com/frostnerd/smokescreen/fragment/SettingsOverviewFragment.kt
View file @
9f2c6766
...
...
@@ -59,5 +59,8 @@ class SettingsOverviewFragment: Fragment() {
queryLogging
.
setOnClickListener
{
SettingsActivity
.
showCategory
(
context
!!
,
SettingsActivity
.
Category
.
QUERIES
)
}
settingsExport
.
setOnClickListener
{
SettingsActivity
.
showCategory
(
context
!!
,
SettingsActivity
.
Category
.
SETTINGS_EXPORT
)
}
}
}
\ No newline at end of file
app/src/main/res/layout/dialog_settingsexport.xml
0 → 100644
View file @
9f2c6766
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:orientation=
"vertical"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
</LinearLayout>
\ No newline at end of file
app/src/main/res/layout/fragment_settings_overview.xml
View file @
9f2c6766
...
...
@@ -181,6 +181,28 @@
android:layout_centerVertical=
"true"
android:layout_height=
"32dp"
/>
</RelativeLayout>
<RelativeLayout
android:layout_width=
"match_parent"
android:paddingTop=
"12dp"
android:paddingBottom=
"12dp"
android:id=
"@+id/settingsExport"
android:textStyle=
"bold"
android:layout_height=
"wrap_content"
>
<TextView
android:layout_width=
"wrap_content"
android:textSize=
"18sp"
android:textStyle=
"bold"
android:text=
"@string/preference_category_importexport"
android:layout_centerVertical=
"true"
android:layout_height=
"wrap_content"
/>
<ImageView
android:layout_width=
"32dp"
android:src=
"@drawable/ic_chevron_right"
android:tint=
"?android:attr/textColor"
android:layout_alignParentEnd=
"true"
android:layout_centerVertical=
"true"
android:layout_height=
"32dp"
/>
</RelativeLayout>
</LinearLayout>
...
...
app/src/main/res/values/strings-preference.xml
View file @
9f2c6766
...
...
@@ -149,6 +149,10 @@
<string
name=
"title_delete_queries"
>
Clear queries
</string>
<string
name=
"summary_delete_queries"
>
Click here to delete all logged queries.
</string>
<string
name=
"preference_category_importexport"
>
Export/Import
</string>
<string
name=
"title_export_settings"
>
Export settings
</string>
<string
name=
"summary_export_settings"
>
Export some settings of your choice
</string>
<string-array
name=
"languages"
>
<item>
System language
</item>
<item>
English
</item>
...
...
app/src/main/res/xml/preferences_export.xml
0 → 100644
View file @
9f2c6766
<?xml version="1.0" encoding="utf-8" ?>
<PreferenceScreen
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<PreferenceCategory
title=
"@string/preference_category_importexport"
>
<Preference
android:key=
"export_settings"
android:summary=
"@string/summary_export_settings"
android:title=
"@string/title_export_settings"
/>
</PreferenceCategory>
</PreferenceScreen>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment