<commit_before>package chat.rocket.android.app

import DrawableHelper
import android.app.Fragment
import android.os.Build
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import chat.rocket.android.R
import kotlinx.android.synthetic.main.fragment_authentication_log_in.*

/**
 * @author <NAME> (<EMAIL>)
 */
class AuthenticationLoginFragment : Fragment() {

    override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View? = inflater?.inflate(R.layout.fragment_authentication_log_in, container, false)

    override fun onViewCreated(view: View?, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)

        if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
            tintEditTextDrawableStart()
        }
    }

    private fun tintEditTextDrawableStart() {
        val context = activity.applicationContext

        val personDrawable = DrawableHelper.getDrawableFromId(R.drawable.ic_assignment_ind_black_24dp, context)
        val lockDrawable = DrawableHelper.getDrawableFromId(R.drawable.ic_lock_black_24dp, context)

        val drawables = arrayOf(personDrawable, lockDrawable)
        DrawableHelper.wrapDrawables(drawables)
        DrawableHelper.tintDrawables(drawables, context, R.color.colorDrawableTintGrey)
        DrawableHelper.compoundDrawables(arrayOf(text_username, text_password), drawables)
    }
}<commit_msg>Add hard keyboard listener and EditTexts listeners to hide/show the social accounts when the user tap the EditText views/keyboard is shown<commit_after>package chat.rocket.android.app

import DrawableHelper
import android.app.Fragment
import android.content.res.Configuration
import android.os.Build
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import chat.rocket.android.R
import kotlinx.android.synthetic.main.fragment_authentication_log_in.*

/**
 * @author <NAME> (<EMAIL>)
 */
class AuthenticationLoginFragment : Fragment() {

    override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View? = inflater?.inflate(R.layout.fragment_authentication_log_in, container, false)

    override fun onViewCreated(view: View?, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)

        if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) tintEditTextDrawableStart()
        setupEditTextListener()
    }

    override fun onConfigurationChanged(newConfig: Configuration?) {
        super.onConfigurationChanged(newConfig)

        if (KeyboardHelper.isHardKeyboardShown(newConfig)) hideSocialAccountsAndSignUpMsgViews()
        else showSocialAccountsAndSignUpMsgViews()
    }

    private fun tintEditTextDrawableStart() {
        val context = activity.applicationContext

        val personDrawable = DrawableHelper.getDrawableFromId(R.drawable.ic_assignment_ind_black_24dp, context)
        val lockDrawable = DrawableHelper.getDrawableFromId(R.drawable.ic_lock_black_24dp, context)

        val drawables = arrayOf(personDrawable, lockDrawable)
        DrawableHelper.wrapDrawables(drawables)
        DrawableHelper.tintDrawables(drawables, context, R.color.colorDrawableTintGrey)
        DrawableHelper.compoundDrawables(arrayOf(text_username_or_email, text_password), drawables)
    }

    private fun setupEditTextListener() {
        text_username_or_email.viewTreeObserver.addOnGlobalLayoutListener({
            if (KeyboardHelper.isSoftKeyboardShown(text_username_or_email.rootView)) hideSocialAccountsAndSignUpMsgViews()
            else showSocialAccountsAndSignUpMsgViews()
        })

        text_password.viewTreeObserver.addOnGlobalLayoutListener({
            if (KeyboardHelper.isSoftKeyboardShown(text_username_or_email.rootView)) hideSocialAccountsAndSignUpMsgViews()
            else showSocialAccountsAndSignUpMsgViews()
        })
    }

    private fun hideSocialAccountsAndSignUpMsgViews() {
        social_accounts_container.visibility = View.GONE
        text_new_in_rocket_chat.visibility = View.GONE
        button_fab.visibility = View.GONE
        button_log_in.visibility = View.VISIBLE
    }

    private fun showSocialAccountsAndSignUpMsgViews() {
        social_accounts_container.visibility = View.VISIBLE
        text_new_in_rocket_chat.visibility = View.VISIBLE
        button_fab.visibility = View.VISIBLE
        button_log_in.visibility = View.GONE
    }
}
{'fraction_non_alphanumeric': 0.07824553669825876, 'fraction_numerical': 0.001763279700242451, 'mean_word_length': 4.467469879518072, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1920120', 'n_tokens_mistral': 1315, 'n_tokens_neox': 1265, 'n_words': 220}