Skip to content
Snippets Groups Projects
Commit 452456a9 authored by Nicolas Pomepuy's avatar Nicolas Pomepuy Committed by Duncan McNamara
Browse files

Implement the settings PIN code restriction on TV

parent 257487cc
No related branches found
No related tags found
1 merge request!1753Parental control
......@@ -24,15 +24,20 @@
package org.videolan.television.ui.preferences
import android.annotation.TargetApi
import android.app.Activity
import android.content.Intent
import android.os.Build
import android.os.Bundle
import android.view.MenuItem
import org.videolan.television.R
import org.videolan.television.ui.browser.BaseTvActivity
import org.videolan.tools.KEY_RESTRICT_SETTINGS
import org.videolan.tools.RESULT_RESTART
import org.videolan.tools.RESULT_RESTART_APP
import org.videolan.tools.Settings
import org.videolan.vlc.PlaybackService
import org.videolan.vlc.gui.PinCodeActivity
import org.videolan.vlc.gui.PinCodeReason
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
class PreferencesActivity : BaseTvActivity() {
......@@ -41,6 +46,17 @@ class PreferencesActivity : BaseTvActivity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.tv_preferences_activity)
if (Settings.getInstance(this).getBoolean(KEY_RESTRICT_SETTINGS, false)) {
val intent = PinCodeActivity.getIntent(this, PinCodeReason.CHECK)
startActivityForResult(intent, 0)
}
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
if (resultCode != Activity.RESULT_OK) {
finish()
}
super.onActivityResult(requestCode, resultCode, data)
}
override fun refresh() {}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment