mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-11-03 23:58:55 +01:00 
			
		
		
		
	Label Kitsu login field as email address instead of username
This commit is contained in:
		@@ -53,7 +53,7 @@ class SettingsTrackingController : SettingsController(),
 | 
			
		||||
                tabsIntent.launchUrl(activity!!, AnilistApi.authUrl())
 | 
			
		||||
            }
 | 
			
		||||
            trackPreference(trackManager.kitsu) {
 | 
			
		||||
                val dialog = TrackLoginDialog(trackManager.kitsu)
 | 
			
		||||
                val dialog = TrackLoginDialog(trackManager.kitsu, context.getString(R.string.email))
 | 
			
		||||
                dialog.targetController = this@SettingsTrackingController
 | 
			
		||||
                dialog.showDialog(router)
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -15,10 +15,12 @@ import eu.kanade.tachiyomi.widget.SimpleTextWatcher
 | 
			
		||||
import kotlinx.android.synthetic.main.pref_account_login.view.login
 | 
			
		||||
import kotlinx.android.synthetic.main.pref_account_login.view.password
 | 
			
		||||
import kotlinx.android.synthetic.main.pref_account_login.view.show_password
 | 
			
		||||
import kotlinx.android.synthetic.main.pref_account_login.view.username_label
 | 
			
		||||
import rx.Subscription
 | 
			
		||||
import uy.kohesive.injekt.injectLazy
 | 
			
		||||
 | 
			
		||||
abstract class LoginDialogPreference(bundle: Bundle? = null) : DialogController(bundle) {
 | 
			
		||||
abstract class LoginDialogPreference(private val usernameLabel: String? = null, bundle: Bundle? = null) :
 | 
			
		||||
        DialogController(bundle) {
 | 
			
		||||
 | 
			
		||||
    var v: View? = null
 | 
			
		||||
        private set
 | 
			
		||||
@@ -47,6 +49,10 @@ abstract class LoginDialogPreference(bundle: Bundle? = null) : DialogController(
 | 
			
		||||
                    password.transformationMethod = PasswordTransformationMethod()
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (!usernameLabel.isNullOrEmpty()) {
 | 
			
		||||
                username_label.text = usernameLabel
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            login.setMode(ActionProcessButton.Mode.ENDLESS)
 | 
			
		||||
            login.setOnClickListener { checkLogin() }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -15,11 +15,15 @@ import rx.schedulers.Schedulers
 | 
			
		||||
import uy.kohesive.injekt.Injekt
 | 
			
		||||
import uy.kohesive.injekt.api.get
 | 
			
		||||
 | 
			
		||||
class TrackLoginDialog(bundle: Bundle? = null) : LoginDialogPreference(bundle) {
 | 
			
		||||
class TrackLoginDialog(usernameLabel: String? = null, bundle: Bundle? = null) :
 | 
			
		||||
        LoginDialogPreference(usernameLabel, bundle) {
 | 
			
		||||
 | 
			
		||||
    private val service = Injekt.get<TrackManager>().getService(args.getInt("key"))!!
 | 
			
		||||
 | 
			
		||||
    constructor(service: TrackService) : this(Bundle().apply { putInt("key", service.id) })
 | 
			
		||||
    constructor(service: TrackService) : this(service, null)
 | 
			
		||||
 | 
			
		||||
    constructor(service: TrackService, usernameLabel: String?) :
 | 
			
		||||
            this(usernameLabel, Bundle().apply { putInt("key", service.id) })
 | 
			
		||||
 | 
			
		||||
    override fun setCredentialsOnView(view: View) = with(view) {
 | 
			
		||||
        dialog_title.text = context.getString(R.string.login_title, service.name)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user