Skip to content

Commit

Permalink
Removed unused BroadcastReceiver
Browse files Browse the repository at this point in the history
  • Loading branch information
francoiscampbell committed Mar 19, 2016
1 parent ca64194 commit 1da2955
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 45 deletions.
2 changes: 0 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
</intent-filter>
</activity>

<receiver android:name=".model.settings.SettingsRelay" />

</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class SettingsChangeBroadcaster(private val context: Context) : SharedPreference

private val res = context.resources
private val settingsUpdatedAction = res.getString(R.string.action_settings_updated)
private val settingsUpdateRequestAction = res.getString(R.string.action_settings_update_request)

override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences, key: String) {
val newPrefValue = sharedPreferences.all[key]
Expand All @@ -31,7 +30,7 @@ class SettingsChangeBroadcaster(private val context: Context) : SharedPreference
if (BuildConfig.DEBUG) {
Log.i("Xposed", "startBroadcastingChanges")
}
context.sendBroadcast(Intent(context, SettingsRelay::class.java)) //trigger push settings to module
prefs.all.forEach { onSharedPreferenceChanged(prefs, it.key) } //push settings to module when opening the settings app
prefs.registerOnSharedPreferenceChangeListener(this)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.github.francoiscampbell.xposeddatausage.model.settings

import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.content.res.XModuleResources
import de.robv.android.xposed.XposedBridge
Expand All @@ -21,10 +20,7 @@ class SettingsImpl : Settings {

private val settingsUpdatedAction = res.getString(R.string.action_settings_updated)

private val RELAY_PACKAGE_NAME = "io.github.francoiscampbell.xposeddatausage"
private val RELAY_CLASS_NAME = "io.github.francoiscampbell.xposeddatausage.model.settings.SettingsRelay"

private val prefsCache = res.getString(R.string.action_settings_update_request) + "_preferences"
private val prefsCache = res.getString(R.string.module_prefs_cache_name)
private val prefs = context.getSharedPreferences(prefsCache, Context.MODE_PRIVATE)

private lateinit var settingsChangedListener: OnSettingsChangedListener
Expand All @@ -51,7 +47,6 @@ class SettingsImpl : Settings {
}
editor.apply()
}
context.sendBroadcast(Intent().setClassName(RELAY_PACKAGE_NAME, RELAY_CLASS_NAME))
}

private fun handleSettingUpdate(key: String, newValue: Any?): Unit {
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<resources>
<string name="app_name">Xposed-DataUsage</string>
<string name="action_settings_updated">xposeddatausage.action.SETTINGS_CHANGED</string>
<string name="action_settings_update_request">xposeddatausage.action.SETTINGS_UPDATE_REQUEST</string>
<string name="module_prefs_cache_name">io.github.francoiscampbell.xposeddatausage.Module_preferences</string>

</resources>

0 comments on commit 1da2955

Please sign in to comment.