-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6acca6f
commit 58dfab6
Showing
15 changed files
with
144 additions
and
274 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
33 changes: 33 additions & 0 deletions
33
app/src/main/java/com/jakting/shareclean/PreferenceActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.jakting.shareclean | ||
|
||
import android.os.Bundle | ||
import com.jakting.shareclean.fragment.MiscFragment | ||
import com.jakting.shareclean.fragment.SettingFragment | ||
|
||
class PreferenceActivity : BaseActivity() { | ||
private val miscFragment = MiscFragment() | ||
private val settingFragment = SettingFragment() | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_preference) | ||
setSupportActionBar(findViewById(R.id.toolbar)) | ||
supportActionBar?.setDisplayHomeAsUpEnabled(true) | ||
when(intent.getStringExtra("preference")){ | ||
"misc"->{ | ||
supportFragmentManager.beginTransaction().replace(R.id.preference,miscFragment).commit() | ||
if (supportActionBar != null) { | ||
supportActionBar!!.title = getString(R.string.misc_title) | ||
} | ||
} | ||
"setting"->{ | ||
supportFragmentManager.beginTransaction().replace(R.id.preference,settingFragment).commit() | ||
if (supportActionBar != null) { | ||
supportActionBar!!.title = getString(R.string.setting_title) | ||
} | ||
} | ||
} | ||
|
||
|
||
} | ||
} |
99 changes: 0 additions & 99 deletions
99
app/src/main/java/com/jakting/shareclean/SettingsActivity.kt
This file was deleted.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
app/src/main/java/com/jakting/shareclean/fragment/MiscFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.jakting.shareclean.fragment | ||
|
||
import android.content.SharedPreferences | ||
import android.content.SharedPreferences.OnSharedPreferenceChangeListener | ||
import android.os.Bundle | ||
import androidx.preference.PreferenceFragmentCompat | ||
import com.jakting.shareclean.R | ||
import com.jakting.shareclean.utils.setDirectShare | ||
|
||
class MiscFragment : PreferenceFragmentCompat(), OnSharedPreferenceChangeListener { | ||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { | ||
setPreferencesFromResource(R.xml.preference_misc, rootKey) | ||
} | ||
|
||
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences, key: String) { | ||
when(key){ | ||
"switch_disable_direct_share" -> setDirectShare(sharedPreferences, context) | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
app/src/main/java/com/jakting/shareclean/fragment/SettingFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.jakting.shareclean.fragment | ||
|
||
import android.content.SharedPreferences | ||
import android.os.Bundle | ||
import androidx.preference.PreferenceFragmentCompat | ||
import com.jakting.shareclean.R | ||
import com.jakting.shareclean.utils.setDark | ||
import com.jakting.shareclean.utils.setLang | ||
|
||
class SettingFragment : PreferenceFragmentCompat(), | ||
SharedPreferences.OnSharedPreferenceChangeListener { | ||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { | ||
setPreferencesFromResource(R.xml.preference_setting, rootKey) | ||
} | ||
|
||
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences, key: String) { | ||
when (key) { | ||
"drop_dark" -> setDark(sharedPreferences) | ||
"drop_lang" -> setLang() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto"> | ||
<PreferenceCategory app:title="@string/misc_disable"> | ||
<SwitchPreference | ||
app:defaultValue="tr" | ||
app:key="switch_disable_direct_share" | ||
app:summaryOff="@string/misc_disable_direct_msgNo" | ||
app:summaryOn="@string/misc_disable_direct_msg" | ||
app:title="@string/misc_disable_direct" /> | ||
|
||
</PreferenceCategory> | ||
|
||
</PreferenceScreen> |
Oops, something went wrong.