Refreshing settings.
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

This commit is contained in:
aminecmi 2022-08-26 23:21:13 +02:00
parent e6afb4702d
commit 8b2be5c55c
3 changed files with 17 additions and 2 deletions

View File

@ -66,8 +66,10 @@ import org.kodein.di.instance
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
import kotlin.concurrent.thread import kotlin.concurrent.thread
class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener, DIAware { class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener, DIAware {
private val SETTINGS_ACTIVITY: Int = 101111
private val DRAWER_ID_TAGS = 100101L private val DRAWER_ID_TAGS = 100101L
private val DRAWER_ID_HIDDEN_TAGS = 101100L private val DRAWER_ID_HIDDEN_TAGS = 101100L
private val DRAWER_ID_SOURCES = 100110L private val DRAWER_ID_SOURCES = 100110L
@ -378,7 +380,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener, DIAwar
iconRes = R.drawable.ic_settings_black_24dp iconRes = R.drawable.ic_settings_black_24dp
isIconTinted = true isIconTinted = true
onDrawerItemClickListener = { _, _, _ -> onDrawerItemClickListener = { _, _, _ ->
startActivity(Intent(this@HomeActivity, SettingsActivity::class.java)) startActivityForResult(Intent(this@HomeActivity, SettingsActivity::class.java), SETTINGS_ACTIVITY)
false false
} }
}) })
@ -1028,5 +1030,12 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener, DIAwar
WorkManager.getInstance(baseContext).enqueueUniquePeriodicWork("selfoss-loading", ExistingPeriodicWorkPolicy.KEEP, backgroundWork) WorkManager.getInstance(baseContext).enqueueUniquePeriodicWork("selfoss-loading", ExistingPeriodicWorkPolicy.KEEP, backgroundWork)
} }
} }
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == SETTINGS_ACTIVITY) {
appSettingsService.refreshUserSettings()
}
}
} }

View File

@ -216,4 +216,11 @@ class SettingsActivity : AppCompatActivity(),
setPreferencesFromResource(R.xml.pref_experimental, rootKey) setPreferencesFromResource(R.xml.pref_experimental, rootKey)
} }
} }
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
android.R.id.home -> super.onBackPressed()
}
return super.onOptionsItemSelected(item)
}
} }

View File

@ -362,7 +362,6 @@ class Repository(private val api: SelfossApi, private val appSettingsService: Ap
appSettingsService.updateApiVersion(fetchedVersion.getApiMajorVersion()) appSettingsService.updateApiVersion(fetchedVersion.getApiMajorVersion())
} }
} }
dateUtils = DateUtils(apiMajorVersion)
} }
fun isNetworkAvailable() = isConnectionAvailable.value && !offlineOverride fun isNetworkAvailable() = isConnectionAvailable.value && !offlineOverride