From c69dcf3e208ac049eac41a8f3301970edbc76058 Mon Sep 17 00:00:00 2001 From: Viktor De Pasquale Date: Thu, 14 Nov 2019 15:19:48 +0100 Subject: [PATCH] Added hiding keyboard when "done" button pressed --- .../magisk/redesign/compat/CompatActivity.kt | 11 +++++++++++ .../magisk/redesign/compat/CompatFragment.kt | 5 +++++ .../topjohnwu/magisk/redesign/hide/HideFragment.kt | 2 ++ 3 files changed, 18 insertions(+) diff --git a/app/src/main/java/com/topjohnwu/magisk/redesign/compat/CompatActivity.kt b/app/src/main/java/com/topjohnwu/magisk/redesign/compat/CompatActivity.kt index c0b58d567..42a9e6f59 100644 --- a/app/src/main/java/com/topjohnwu/magisk/redesign/compat/CompatActivity.kt +++ b/app/src/main/java/com/topjohnwu/magisk/redesign/compat/CompatActivity.kt @@ -1,9 +1,12 @@ package com.topjohnwu.magisk.redesign.compat +import android.app.Activity import android.content.Intent import android.os.Bundle import android.view.View import android.view.ViewGroup +import android.view.inputmethod.InputMethodManager +import androidx.core.content.getSystemService import androidx.databinding.OnRebindCallback import androidx.databinding.ViewDataBinding import androidx.fragment.app.Fragment @@ -17,6 +20,7 @@ import com.topjohnwu.magisk.model.navigation.MagiskNavigationEvent import com.topjohnwu.magisk.model.navigation.Navigator import kotlin.reflect.KClass + abstract class CompatActivity : BaseActivity(), CompatView, Navigator { @@ -78,4 +82,11 @@ abstract class CompatActivity() + ?.hideSoftInputFromWindow(view.windowToken, 0) + view.clearFocus() } \ No newline at end of file diff --git a/app/src/main/java/com/topjohnwu/magisk/redesign/compat/CompatFragment.kt b/app/src/main/java/com/topjohnwu/magisk/redesign/compat/CompatFragment.kt index f7eb35d72..6c9c90352 100644 --- a/app/src/main/java/com/topjohnwu/magisk/redesign/compat/CompatFragment.kt +++ b/app/src/main/java/com/topjohnwu/magisk/redesign/compat/CompatFragment.kt @@ -5,6 +5,7 @@ import android.view.View import android.view.ViewGroup import androidx.databinding.OnRebindCallback import androidx.databinding.ViewDataBinding +import androidx.fragment.app.Fragment import com.topjohnwu.magisk.base.BaseFragment import com.topjohnwu.magisk.extensions.startAnimations import com.topjohnwu.magisk.model.events.ViewEvent @@ -48,4 +49,8 @@ abstract class CompatFragment() { MotionRevealHelper.withViews(binding.hideFilter, binding.hideFilterToggle, true) } binding.hideFilterInclude.hideFilterDone.setOnClickListener { + hideKeyboard() MotionRevealHelper.withViews(binding.hideFilter, binding.hideFilterToggle, false) }