diff --git a/app/build.gradle b/app/build.gradle
index 1d1c4a2..c8d87ab 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -10,8 +10,8 @@ android {
applicationId "com.denizd.substitutionplan"
minSdkVersion 21
targetSdkVersion 28
- versionCode 36
- versionName "2.2.13"
+ versionCode 37
+ versionName "2.2.14"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
@@ -32,7 +32,7 @@ dependencies {
implementation 'com.google.android.material:material:1.1.0-alpha10'
implementation 'com.android.support:customtabs:28.0.0'
- implementation 'com.google.firebase:firebase-core:17.1.0'
+ implementation 'com.google.firebase:firebase-core:17.2.0'
implementation 'com.google.firebase:firebase-messaging:20.0.0'
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index ad137e1..46b3b8c 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -8,10 +8,10 @@
-
+
(R.id.efab)
- val start = Intent(this, Main::class.java)
- val name = findViewById(R.id.txtName)
- val grade = findViewById(R.id.txtClasses)
- val courses = findViewById(R.id.txtCourses)
- val notif = findViewById(R.id.cbNotif)
- val dark = findViewById(R.id.cbDark)
- val pers = findViewById(R.id.cbPersonalised)
- val helpClasses = findViewById(R.id.chipHelpClasses)
- val helpCourses = findViewById(R.id.chipHelpCourses)
- val greeting = findViewById(R.id.cbGreetings)
+ val mainActivity = Intent(this, Main::class.java)
+ val nameEditText = findViewById(R.id.txtName)
+ val gradeEditText = findViewById(R.id.txtClasses)
+ val courseEditText = findViewById(R.id.txtCourses)
+ val helpGradeButton = findViewById(R.id.chipHelpClasses)
+ val helpCoursesButton = findViewById(R.id.chipHelpCourses)
+ val greetingCheckBox = findViewById(R.id.cbGreetings)
+ val notificationCheckBox = findViewById(R.id.cbNotif)
+ val darkModeCheckBox = findViewById(R.id.cbDark)
+ val personalPlanCheckBox = findViewById(R.id.cbPersonalised)
+
+ notificationCheckBox.isChecked = true
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.P) {
- dark.visibility = View.GONE
+ darkModeCheckBox.visibility = View.GONE
}
- helpClasses.setOnClickListener {
+ helpGradeButton.setOnClickListener {
createDialog(getString(R.string.enterGradeHelpTitle), getString(
R.string.enterGradeHelp
))
}
- helpCourses.setOnClickListener {
+ helpCoursesButton.setOnClickListener {
createDialog(getString(R.string.enterCoursesHelpTitle), getString(
R.string.enterCoursesHelp
))
@@ -89,22 +91,22 @@ internal class FirstTime : AppCompatActivity(R.layout.activity_first_time) {
fab.isClickable = false
edit.putString("firstTimeDev", Calendar.getInstance().time.toString())
- .putString("username", name.text.toString())
- .putString("classes", grade.text.toString())
- .putString("courses", courses.text.toString())
+ .putString("username", nameEditText.text.toString())
+ .putString("classes", gradeEditText.text.toString())
+ .putString("courses", courseEditText.text.toString())
val themeInt = if (Build.VERSION.SDK_INT > Build.VERSION_CODES.P) {
2
} else {
- if (dark.isChecked) {
+ if (darkModeCheckBox.isChecked) {
1
} else {
0
}
}
edit.putInt("themeInt", themeInt)
- edit.putBoolean("notif", notif.isChecked)
- .putBoolean("greeting", greeting.isChecked)
- .putBoolean("defaultPersonalised", pers.isChecked)
+ edit.putBoolean("notif", notificationCheckBox.isChecked)
+ .putBoolean("greeting", greetingCheckBox.isChecked)
+ .putBoolean("defaultPersonalised", personalPlanCheckBox.isChecked)
.putBoolean("firstTime", false)
.putBoolean("colourTransferred", true)
.apply()
@@ -147,17 +149,15 @@ internal class FirstTime : AppCompatActivity(R.layout.activity_first_time) {
}
}, 1000)
handler.postDelayed({
- startActivity(start)
+ startActivity(mainActivity)
finish()
}, 2000)
}
}
private fun createDialog(title: String, text: String) {
- val alertDialog = AlertDialog.Builder(context,
- R.style.AlertDialog
- )
- val dialogView = LayoutInflater.from(context).inflate(R.layout.simple_dialog, null)
+ val alertDialog = AlertDialog.Builder(context, R.style.AlertDialog)
+ val dialogView = View.inflate(context, R.layout.simple_dialog, null)
val dialogTitle = dialogView.findViewById(R.id.textviewtitle)
val dialogText = dialogView.findViewById(R.id.dialogtext)
dialogTitle.text = title
diff --git a/app/src/main/java/com/denizd/substitutionplan/activities/Main.kt b/app/src/main/java/com/denizd/substitutionplan/activities/Main.kt
index c809491..035674c 100644
--- a/app/src/main/java/com/denizd/substitutionplan/activities/Main.kt
+++ b/app/src/main/java/com/denizd/substitutionplan/activities/Main.kt
@@ -109,7 +109,6 @@ internal class Main : AppCompatActivity(R.layout.app_bar_main) {
textViewGreeting.text = if (prefs.getBoolean("greeting", true) && (prefs.getString("username", "") ?: "").isNotEmpty()) {
getGreetingString()
} else {
-// textViewGreeting.visibility = View.GONE
""
}
@@ -213,7 +212,7 @@ internal class Main : AppCompatActivity(R.layout.app_bar_main) {
private fun openInfoDialog() {
val dialog = AlertDialog.Builder(context)
- val dialogView = LayoutInflater.from(context).inflate(R.layout.simple_dialog, null)
+ val dialogView = View.inflate(context, R.layout.simple_dialog, null)
dialogView.findViewById(R.id.textviewtitle).text = getString(
R.string.information
)
@@ -242,7 +241,7 @@ internal class Main : AppCompatActivity(R.layout.app_bar_main) {
return if (prefs.getBoolean("greeting", true)) {
getString(R.string.yourPlan)
} else {
- val user = (prefs.getString("username", "") ?: "").toString()
+ val user = prefs.getString("username", "") ?: ""
if (user.endsWith("s", true) || user.endsWith("x", true) || user.endsWith("z", true)) {
"$user${getString(R.string.noSPlan)}"
} else {
diff --git a/app/src/main/java/com/denizd/substitutionplan/data/DataFetcher.kt b/app/src/main/java/com/denizd/substitutionplan/data/DataFetcher.kt
index 3826138..b90ea1e 100644
--- a/app/src/main/java/com/denizd/substitutionplan/data/DataFetcher.kt
+++ b/app/src/main/java/com/denizd/substitutionplan/data/DataFetcher.kt
@@ -231,7 +231,7 @@ internal class DataFetcher(isPlan: Boolean, isMenu: Boolean, isJobService: Boole
val notification = NotificationCompat.Builder(context, HelperFunctions.notificationChannelId)
.setStyle(NotificationCompat.DecoratedCustomViewStyle())
.setCustomContentView(notificationLayout)
- .setSmallIcon(R.drawable.ic_avh)
+ .setSmallIcon(R.drawable.ic_avhlogo)
.setContentIntent(openAppPending)
.setAutoCancel(true)
.setColor(ContextCompat.getColor(context, R.color.colorAccent))
diff --git a/app/src/main/java/com/denizd/substitutionplan/data/Topic.kt b/app/src/main/java/com/denizd/substitutionplan/data/Topic.kt
new file mode 100644
index 0000000..bed3074
--- /dev/null
+++ b/app/src/main/java/com/denizd/substitutionplan/data/Topic.kt
@@ -0,0 +1,8 @@
+package com.denizd.substitutionplan.data
+
+internal enum class Topic(val tag: String) {
+ ANDROID("substitutions-android"),
+ BROADCAST("substitutions-broadcast"),
+ IOS("substitutions-ios"),
+ DEVELOPMENT("substitutions-debug")
+}
diff --git a/app/src/main/java/com/denizd/substitutionplan/database/FoodViewModel.kt b/app/src/main/java/com/denizd/substitutionplan/database/FoodViewModel.kt
index cd8860a..32dcbef 100644
--- a/app/src/main/java/com/denizd/substitutionplan/database/FoodViewModel.kt
+++ b/app/src/main/java/com/denizd/substitutionplan/database/FoodViewModel.kt
@@ -10,8 +10,7 @@ import com.denizd.substitutionplan.models.Food
internal class FoodViewModel(application: Application) : AndroidViewModel(application) {
- private val repository: FoodRepository =
- FoodRepository(application)
+ private val repository: FoodRepository = FoodRepository(application)
val allFoods: LiveData>?
private val app = application
diff --git a/app/src/main/java/com/denizd/substitutionplan/database/SubstViewModel.kt b/app/src/main/java/com/denizd/substitutionplan/database/SubstViewModel.kt
index e891ff2..9d85f93 100644
--- a/app/src/main/java/com/denizd/substitutionplan/database/SubstViewModel.kt
+++ b/app/src/main/java/com/denizd/substitutionplan/database/SubstViewModel.kt
@@ -10,8 +10,7 @@ import com.denizd.substitutionplan.models.Subst
internal class SubstViewModel(application: Application) : AndroidViewModel(application) {
- private val repository: SubstRepository =
- SubstRepository(application)
+ private val repository: SubstRepository = SubstRepository(application)
val allSubst: LiveData>?
private val app = application
diff --git a/app/src/main/java/com/denizd/substitutionplan/fragments/FoodFragment.kt b/app/src/main/java/com/denizd/substitutionplan/fragments/FoodFragment.kt
index 603f901..9a376fc 100644
--- a/app/src/main/java/com/denizd/substitutionplan/fragments/FoodFragment.kt
+++ b/app/src/main/java/com/denizd/substitutionplan/fragments/FoodFragment.kt
@@ -15,7 +15,6 @@ import com.denizd.substitutionplan.*
import com.denizd.substitutionplan.adapters.FoodAdapter
import com.denizd.substitutionplan.database.FoodViewModel
import com.denizd.substitutionplan.models.Food
-import com.denizd.substitutionplan.data.DataFetcher
internal class FoodFragment : Fragment(R.layout.food_layout) {
diff --git a/app/src/main/java/com/denizd/substitutionplan/fragments/PersonalPlanFragment.kt b/app/src/main/java/com/denizd/substitutionplan/fragments/PersonalPlanFragment.kt
index 1bab74e..ec8ac71 100644
--- a/app/src/main/java/com/denizd/substitutionplan/fragments/PersonalPlanFragment.kt
+++ b/app/src/main/java/com/denizd/substitutionplan/fragments/PersonalPlanFragment.kt
@@ -12,19 +12,19 @@ internal class PersonalPlanFragment : PlanFragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
- smileydown = view.findViewById(R.id.smileydown)
- smileydowntext = view.findViewById(R.id.smileydowntext)
- linearsmiley = view.findViewById(R.id.linearsmiley)
+ personalPlanEmptyEmoticon = view.findViewById(R.id.smileydown)
+ personalPlanEmptyText = view.findViewById(R.id.smileydowntext)
+ personalPlanEmptyLayout = view.findViewById(R.id.linearsmiley)
val coursePreference = prefs.getString("courses", "") ?: ""
val classPreference = prefs.getString("classes", "") ?: ""
substViewModel.allSubst?.observe(this, Observer> { substitutions ->
planCardList.clear()
- smileydown.visibility = View.GONE
- smileydowntext.visibility = View.GONE
- linearsmiley.visibility = View.GONE
- persPlanEmpty = true
+ personalPlanEmptyEmoticon.visibility = View.GONE
+ personalPlanEmptyText.visibility = View.GONE
+ personalPlanEmptyLayout.visibility = View.GONE
+ isPersonalPlanEmpty = true
recyclerView.visibility = View.VISIBLE
substitutions.filter { substItem ->
@@ -37,16 +37,16 @@ internal class PersonalPlanFragment : PlanFragment() {
}.forEach { substItem ->
planCardList.add(substItem)
}
- persPlanEmpty = (planCardList.size == 1 && planCardList[0].date.substring(0, 3) == "psa") || planCardList.isEmpty()
+ isPersonalPlanEmpty = (planCardList.size == 1 && planCardList[0].date.substring(0, 3) == "psa") || planCardList.isEmpty()
recyclerView.scheduleLayoutAnimation()
mAdapter.setSubst(planCardList)
handler.postDelayed({
- if (persPlanEmpty) {
- smileydown.visibility = View.VISIBLE
- smileydowntext.visibility = View.VISIBLE
- linearsmiley.visibility = View.VISIBLE
- linearsmiley.scheduleLayoutAnimation()
+ if (isPersonalPlanEmpty) {
+ personalPlanEmptyEmoticon.visibility = View.VISIBLE
+ personalPlanEmptyText.visibility = View.VISIBLE
+ personalPlanEmptyLayout.visibility = View.VISIBLE
+ personalPlanEmptyLayout.scheduleLayoutAnimation()
}
}, 64)
})
diff --git a/app/src/main/java/com/denizd/substitutionplan/fragments/PlanFragment.kt b/app/src/main/java/com/denizd/substitutionplan/fragments/PlanFragment.kt
index ad3633e..0bd410d 100644
--- a/app/src/main/java/com/denizd/substitutionplan/fragments/PlanFragment.kt
+++ b/app/src/main/java/com/denizd/substitutionplan/fragments/PlanFragment.kt
@@ -18,7 +18,6 @@ import com.denizd.substitutionplan.*
import com.denizd.substitutionplan.adapters.CardAdapter
import com.denizd.substitutionplan.database.SubstViewModel
import com.denizd.substitutionplan.models.Subst
-import com.denizd.substitutionplan.data.DataFetcher
import kotlin.collections.ArrayList
internal open class PlanFragment : Fragment(R.layout.plan) {
@@ -29,10 +28,10 @@ internal open class PlanFragment : Fragment(R.layout.plan) {
private lateinit var mContext: Context
lateinit var prefs: SharedPreferences
- lateinit var smileydown: TextView
- lateinit var smileydowntext: TextView
- lateinit var linearsmiley: LinearLayout
- var persPlanEmpty: Boolean = true
+ lateinit var personalPlanEmptyEmoticon: TextView
+ lateinit var personalPlanEmptyText: TextView
+ lateinit var personalPlanEmptyLayout: LinearLayout
+ var isPersonalPlanEmpty: Boolean = true
val handler = Handler()
override fun onAttach(context: Context) {
diff --git a/app/src/main/java/com/denizd/substitutionplan/fragments/SettingsFragment.kt b/app/src/main/java/com/denizd/substitutionplan/fragments/SettingsFragment.kt
index a9e246d..14bbb14 100644
--- a/app/src/main/java/com/denizd/substitutionplan/fragments/SettingsFragment.kt
+++ b/app/src/main/java/com/denizd/substitutionplan/fragments/SettingsFragment.kt
@@ -14,7 +14,6 @@ import android.preference.PreferenceManager
import android.provider.Settings
import android.text.Editable
import android.text.TextWatcher
-import android.view.LayoutInflater
import android.view.View
import android.view.Window
import android.widget.*
@@ -30,6 +29,7 @@ import com.denizd.substitutionplan.adapters.ColourAdapter
import com.denizd.substitutionplan.adapters.RingtoneAdapter
import com.denizd.substitutionplan.data.DataFetcher
import com.denizd.substitutionplan.data.HelperFunctions
+import com.denizd.substitutionplan.data.Topic
import com.denizd.substitutionplan.models.Colour
import com.denizd.substitutionplan.models.Ringtone
import com.google.android.material.bottomnavigation.BottomNavigationView
@@ -45,7 +45,6 @@ internal class SettingsFragment : Fragment(R.layout.content_settings), View.OnCl
private lateinit var mContext: Context
private lateinit var prefs: SharedPreferences
- private lateinit var edit: SharedPreferences.Editor
private val builder = CustomTabsIntent.Builder()
private val customTabsIntent = builder.build() as CustomTabsIntent
private var cs: Int = 7
@@ -58,50 +57,47 @@ internal class SettingsFragment : Fragment(R.layout.content_settings), View.OnCl
super.onAttach(context)
mContext = context
prefs = PreferenceManager.getDefaultSharedPreferences(mContext)
- edit = prefs.edit()
-
window = activity?.window
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
- val txtName = view.findViewById(R.id.txtName)
- val txtClasses = view.findViewById(R.id.txtClasses)
- val txtCourses = view.findViewById(R.id.txtCourses)
+ val nameEditText = view.findViewById(R.id.txtName)
+ val gradeEditText = view.findViewById(R.id.txtClasses)
+ val courseEditText = view.findViewById(R.id.txtCourses)
- val switchDisableGreeting = view.findViewById(R.id.switchDisableGreeting)
-// val switchDark = view.findViewById(R.id.switchDark)
- val switchNotifications = view.findViewById(R.id.switchNotifications)
- val switchDefaultPlan = view.findViewById(R.id.switchDefaultPlan)
- val switchAutoRefresh = view.findViewById(R.id.switchAutoRefresh)
- val versionNumber = view.findViewById(R.id.txtVersionTwo)
- val helpCourses = view.findViewById(R.id.chipHelpCourses)
- val helpClasses = view.findViewById(R.id.chipHelpClasses)
- val btnCustomiseColours = view.findViewById(R.id.btnCustomiseColours)
- val btnVersion = view.findViewById(R.id.btnVersion)
+ val greetingSwitch = view.findViewById(R.id.switchDisableGreeting)
+ val notificationSwitch = view.findViewById(R.id.switchNotifications)
+ val defaultPlanSwitch = view.findViewById(R.id.switchDefaultPlan)
+ val autoRefreshSwitch = view.findViewById(R.id.switchAutoRefresh)
+ val versionNumberText = view.findViewById(R.id.txtVersionTwo)
+ val helpGradeButton = view.findViewById(R.id.chipHelpClasses)
+ val helpCoursesButton = view.findViewById(R.id.chipHelpCourses)
+ val colourCustomisationButton = view.findViewById(R.id.btnCustomiseColours)
+ val versionButton = view.findViewById(R.id.btnVersion)
currentRingtone = view.findViewById(R.id.txtCustomiseRingtone2)
setRingtoneText()
- val btnForceRefresh = view.findViewById(R.id.btnForceRefresh)
+ val forceRefreshButton = view.findViewById(R.id.btnForceRefresh)
- switchDisableGreeting.setOnCheckedChangeListener(this)
+ greetingSwitch.setOnCheckedChangeListener(this)
// switchDark.setOnCheckedChangeListener(this)
- switchNotifications.setOnCheckedChangeListener(this)
- switchDefaultPlan.setOnCheckedChangeListener(this)
- switchAutoRefresh.setOnCheckedChangeListener(this)
- helpCourses.setOnClickListener(this)
- helpClasses.setOnClickListener(this)
- btnCustomiseColours.setOnClickListener(this)
+ notificationSwitch.setOnCheckedChangeListener(this)
+ defaultPlanSwitch.setOnCheckedChangeListener(this)
+ autoRefreshSwitch.setOnCheckedChangeListener(this)
+ helpCoursesButton.setOnClickListener(this)
+ helpGradeButton.setOnClickListener(this)
+ colourCustomisationButton.setOnClickListener(this)
view.findViewById(R.id.btnNoNotif).setOnClickListener(this)
view.findViewById(R.id.btnCustomiseRingtone).setOnClickListener(this)
view.findViewById(R.id.btnWebsite).setOnClickListener(this)
view.findViewById(R.id.btnLicences).setOnClickListener(this)
view.findViewById(R.id.btnTerms).setOnClickListener(this)
view.findViewById(R.id.btnPrivacyP).setOnClickListener(this)
- btnVersion.setOnClickListener(this)
- btnForceRefresh.setOnClickListener(this)
- btnForceRefresh.setOnLongClickListener {
- edit.putString("timeNew", "").putString("newFoodTime", "").apply()
+ versionButton.setOnClickListener(this)
+ forceRefreshButton.setOnClickListener(this)
+ forceRefreshButton.setOnLongClickListener {
+ prefs.edit().putString("timeNew", "").putString("newFoodTime", "").apply()
makeToast(mContext.getString(R.string.forcedRefreshTimes))
true
}
@@ -124,7 +120,7 @@ internal class SettingsFragment : Fragment(R.layout.content_settings), View.OnCl
darkModeDropDown.setText(darkModeDropDown.adapter.getItem(prefs.getInt("themeInt", 0)).toString(), false)
darkModeDropDown.setOnItemClickListener { _, _, position, _ ->
- edit.putInt("themeInt", position).apply()
+ prefs.edit().putInt("themeInt", position).apply()
val bottomNav = view.rootView.findViewById(R.id.bottom_nav)
when (position) {
@@ -153,42 +149,42 @@ internal class SettingsFragment : Fragment(R.layout.content_settings), View.OnCl
}
}
- switchDisableGreeting.isChecked = prefs.getBoolean("greeting", true)
+ greetingSwitch.isChecked = prefs.getBoolean("greeting", true)
- switchNotifications.isChecked = prefs.getBoolean("notif", false)
- switchDefaultPlan.isChecked = prefs.getBoolean("defaultPersonalised", false)
- switchAutoRefresh.isChecked = prefs.getBoolean("autoRefresh", false)
+ notificationSwitch.isChecked = prefs.getBoolean("notif", false)
+ defaultPlanSwitch.isChecked = prefs.getBoolean("defaultPersonalised", false)
+ autoRefreshSwitch.isChecked = prefs.getBoolean("autoRefresh", false)
- versionNumber.text = BuildConfig.VERSION_NAME
+ versionNumberText.text = BuildConfig.VERSION_NAME
- txtName.setText(prefs.getString("username", ""))
- txtName.addTextChangedListener(object: TextWatcher {
+ nameEditText.setText(prefs.getString("username", ""))
+ nameEditText.addTextChangedListener(object: TextWatcher {
override fun afterTextChanged(s: Editable) {}
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {}
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
- edit.putString("username", txtName.text.toString().trim()).apply()
+ prefs.edit().putString("username", nameEditText.text.toString().trim()).apply()
}
})
- txtClasses.setText(prefs.getString("classes", ""))
- txtClasses.addTextChangedListener(object: TextWatcher {
+ gradeEditText.setText(prefs.getString("classes", ""))
+ gradeEditText.addTextChangedListener(object: TextWatcher {
override fun afterTextChanged(s: Editable) {}
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {}
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
- edit.putString("classes", txtClasses.text.toString()).apply()
+ prefs.edit().putString("classes", gradeEditText.text.toString()).apply()
}
})
- txtCourses.setText(prefs.getString("courses", ""))
- txtCourses.addTextChangedListener(object: TextWatcher {
+ courseEditText.setText(prefs.getString("courses", ""))
+ courseEditText.addTextChangedListener(object: TextWatcher {
override fun afterTextChanged(s: Editable) {}
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {}
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
- edit.putString("courses", txtCourses.text.toString()).apply()
+ prefs.edit().putString("courses", courseEditText.text.toString()).apply()
}
})
- btnVersion.setOnLongClickListener {
+ versionButton.setOnLongClickListener {
makeToast(getString(R.string.madeBy))
debugMenu()
}
@@ -282,31 +278,29 @@ internal class SettingsFragment : Fragment(R.layout.content_settings), View.OnCl
).execute()
}
}
- edit.apply()
}
override fun onCheckedChanged(v: CompoundButton?, isChecked: Boolean) {
if (v?.isPressed == true) {
when (v.id) {
R.id.switchDisableGreeting -> {
- edit.putBoolean("greeting", isChecked)
+ prefs.edit().putBoolean("greeting", isChecked).apply()
}
R.id.switchNotifications -> {
- edit.putBoolean("notif", isChecked)
+ prefs.edit().putBoolean("notif", isChecked).apply()
if (isChecked) {
- subToTopic("android")
+ subscribeToTopic(Topic.ANDROID)
} else {
- unsubFromTopic("android")
+ unsubscribeFromTopic(Topic.ANDROID)
}
}
R.id.switchDefaultPlan -> {
- edit.putBoolean("defaultPersonalised", isChecked)
+ prefs.edit().putBoolean("defaultPersonalised", isChecked).apply()
}
R.id.switchAutoRefresh -> {
- edit.putBoolean("autoRefresh", isChecked)
+ prefs.edit().putBoolean("autoRefresh", isChecked).apply()
}
}
- edit.apply()
}
}
@@ -314,7 +308,7 @@ internal class SettingsFragment : Fragment(R.layout.content_settings), View.OnCl
val alertDialog = AlertDialog.Builder(mContext,
R.style.AlertDialog
)
- val dialogView = LayoutInflater.from(mContext).inflate(R.layout.simple_dialog, null)
+ val dialogView = View.inflate(mContext, R.layout.simple_dialog, null)
dialogView.findViewById(R.id.textviewtitle).text = title
dialogView.findViewById(R.id.dialogtext).text = text
alertDialog.setView(dialogView).show()
@@ -323,7 +317,7 @@ internal class SettingsFragment : Fragment(R.layout.content_settings), View.OnCl
private fun createColourDialog() {
val colourCustomiserBuilder = AlertDialog.Builder(mContext, R.style.AlertDialog)
- val dialogView = LayoutInflater.from(mContext).inflate(R.layout.recycler_dialog, null)
+ val dialogView = View.inflate(mContext, R.layout.recycler_dialog, null)
val titleText = dialogView.findViewById(R.id.empty_textviewtitle)
titleText.text = getString(R.string.customiseColoursTitle)
colourRecycler = dialogView.findViewById(R.id.recyclerView)
@@ -390,7 +384,7 @@ internal class SettingsFragment : Fragment(R.layout.content_settings), View.OnCl
} else {
val ringtoneCustomiserBuilder = AlertDialog.Builder(mContext, R.style.AlertDialog)
- val dialogView = LayoutInflater.from(mContext).inflate(R.layout.recycler_dialog, null)
+ val dialogView = View.inflate(mContext, R.layout.recycler_dialog, null)
val titleText = dialogView.findViewById(R.id.empty_textviewtitle)
titleText.text = getString(R.string.pickRingtone)
@@ -454,12 +448,12 @@ internal class SettingsFragment : Fragment(R.layout.content_settings), View.OnCl
override fun onClick(position: Int, title: String, titleNoLang: String) {
val colourPickerBuilder = AlertDialog.Builder(mContext, R.style.AlertDialog)
- val pickerDialogView = LayoutInflater.from(mContext).inflate(R.layout.empty_dialog, null)
+ val pickerDialogView = View.inflate(mContext, R.layout.empty_dialog, null)
val pickerTitleText = pickerDialogView.findViewById(R.id.empty_textviewtitle)
val pickerLayout = pickerDialogView.findViewById(R.id.empty_linearlayout)
pickerTitleText.text = title
- val picker = LayoutInflater.from(mContext).inflate(R.layout.bg_colour_picker, null)
+ val picker = View.inflate(mContext, R.layout.bg_colour_picker, null)
pickerLayout.addView(picker)
colourPickerBuilder.setView(pickerDialogView)
val colourPickerDialog: AlertDialog = colourPickerBuilder.create()
@@ -472,7 +466,6 @@ internal class SettingsFragment : Fragment(R.layout.content_settings), View.OnCl
for (i2 in buttons.indices) {
picker.findViewById(buttons[i2]).setOnClickListener {
-// prefs.edit().putInt("bg$titleNoLang", colourIntegers[i2]).apply()
prefs.edit().putString("card$titleNoLang", colours[i2]).apply()
val recyclerViewState = colourRecycler.layoutManager?.onSaveInstanceState()
colourRecycler.adapter = ColourAdapter(getColourList(), this)
@@ -484,10 +477,8 @@ internal class SettingsFragment : Fragment(R.layout.content_settings), View.OnCl
}
private fun debugMenu(): Boolean {
- val alertDialog = AlertDialog.Builder(mContext,
- R.style.AlertDialog
- )
- val dialogView = LayoutInflater.from(mContext).inflate(R.layout.edittext_dialog, null)
+ val alertDialog = AlertDialog.Builder(mContext, R.style.AlertDialog)
+ val dialogView = View.inflate(mContext, R.layout.edittext_dialog, null)
val dialogEditText = dialogView.findViewById(R.id.dialog_edittext)
val dialogButton = dialogView.findViewById