avatar
Untitled

Guest 69 9th Jan, 2020

MARKUP 1.13 KB
                                           
                         fun checkAndShowPortraitTip(context: AppCompatActivity, layoutId: Int): Boolean {

            var shouldShow: Boolean by Preference(KEY_SHOW_INTERVIEWS_TIP, true)
            if (shouldShow) {
                var ft = context.supportFragmentManager
                var result = InterviewsTipFragment()
                var bundle = Bundle()
                bundle.putInt(LAST_TIP_SEEN_INDEX, indexOfLastTipSeen)
                result.arguments = bundle
                ft.beginTransaction()
                        .add(layoutId, result)
                        .addToBackStack(InterviewsTipFragment::class.java.simpleName)
                        .commitAllowingStateLoss()
                if (indexOfLastTipSeen >= 6) shouldShow = false

                if (indexOfLastTipSeen <= 3){
                    context.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
                } else {
                    context.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
                }


                return true
            }

            return false
        }
                      
                                       
To share this paste please copy this url and send to your friends
RAW Paste Data

Comments

Authentication required

You must log in to post a comment.

Log in
    There are no comments yet.