Created
February 3, 2020 08:48
-
-
Save waqasakram117/a084cd6a96edc5fd0e95b0e3b87a3a81 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.lightbeem.securemessages.common | |
| import android.content.Context | |
| import android.util.Log | |
| import android.view.inputmethod.InputMethodManager | |
| import androidx.appcompat.app.AppCompatActivity | |
| import androidx.fragment.app.FragmentActivity | |
| import com.lightbeem.securemessages.BuildConfig | |
| fun Any.showLog(msg: String){ | |
| if (BuildConfig.DEBUG){ | |
| val trace = Thread.currentThread().stackTrace[6] | |
| Log.i(trace.className,"${trace.methodName}: $msg") | |
| } | |
| } | |
| fun Any.showError(msg: String){ | |
| if (BuildConfig.DEBUG){ | |
| val trace = Thread.currentThread().stackTrace[3] | |
| Log.e(trace.className,"${trace.methodName}: $msg") | |
| } | |
| } | |
| fun FragmentActivity.hideKeyboard(){ | |
| val view = this.currentFocus | |
| view?.let { v -> | |
| val imm = getSystemService(Context.INPUT_METHOD_SERVICE) as? InputMethodManager | |
| imm?.hideSoftInputFromWindow(v.windowToken, 0) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment