move the HashListener interface in a separate file

This commit is contained in:
tibbi 2017-08-01 23:34:28 +02:00
parent 2684fde107
commit 805633dfb6
4 changed files with 10 additions and 7 deletions

View file

@ -6,9 +6,10 @@ import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.R
import com.simplemobiletools.gallery.interfaces.HashListener
import com.simplemobiletools.gallery.views.PatternTab import com.simplemobiletools.gallery.views.PatternTab
class PasswordTypesAdapter(val context: Context, val requiredHash: String, val hashListener: PatternTab.HashListener) : PagerAdapter() { class PasswordTypesAdapter(val context: Context, val requiredHash: String, val hashListener: HashListener) : PagerAdapter() {
override fun instantiateItem(container: ViewGroup, position: Int): Any { override fun instantiateItem(container: ViewGroup, position: Int): Any {
val view = LayoutInflater.from(context).inflate(layoutSelection(position), container, false) val view = LayoutInflater.from(context).inflate(layoutSelection(position), container, false)

View file

@ -9,11 +9,11 @@ import com.simplemobiletools.gallery.R
import com.simplemobiletools.gallery.activities.SimpleActivity import com.simplemobiletools.gallery.activities.SimpleActivity
import com.simplemobiletools.gallery.adapters.PasswordTypesAdapter import com.simplemobiletools.gallery.adapters.PasswordTypesAdapter
import com.simplemobiletools.gallery.extensions.config import com.simplemobiletools.gallery.extensions.config
import com.simplemobiletools.gallery.interfaces.HashListener
import com.simplemobiletools.gallery.views.MyDialogViewPager import com.simplemobiletools.gallery.views.MyDialogViewPager
import com.simplemobiletools.gallery.views.PatternTab
import kotlinx.android.synthetic.main.dialog_security.view.* import kotlinx.android.synthetic.main.dialog_security.view.*
class SecurityDialog(val activity: SimpleActivity, val requiredHash: String, val callback: (hash: String) -> Unit) : PatternTab.HashListener { class SecurityDialog(val activity: SimpleActivity, val requiredHash: String, val callback: (hash: String) -> Unit) : HashListener {
var dialog: AlertDialog? = null var dialog: AlertDialog? = null
val view = LayoutInflater.from(activity).inflate(R.layout.dialog_security, null) val view = LayoutInflater.from(activity).inflate(R.layout.dialog_security, null)

View file

@ -0,0 +1,5 @@
package com.simplemobiletools.gallery.interfaces
interface HashListener {
fun receivedHash(hash: String)
}

View file

@ -11,6 +11,7 @@ import com.simplemobiletools.commons.extensions.toast
import com.simplemobiletools.commons.extensions.updateTextColors import com.simplemobiletools.commons.extensions.updateTextColors
import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.R
import com.simplemobiletools.gallery.extensions.config import com.simplemobiletools.gallery.extensions.config
import com.simplemobiletools.gallery.interfaces.HashListener
import kotlinx.android.synthetic.main.tab_pattern.view.* import kotlinx.android.synthetic.main.tab_pattern.view.*
class PatternTab(context: Context, attrs: AttributeSet) : RelativeLayout(context, attrs) { class PatternTab(context: Context, attrs: AttributeSet) : RelativeLayout(context, attrs) {
@ -70,8 +71,4 @@ class PatternTab(context: Context, attrs: AttributeSet) : RelativeLayout(context
} }
} }
} }
interface HashListener {
fun receivedHash(hash: String)
}
} }