Search in sources :

Example 1 with KonamiCodeDetector

use of me.zhanghai.android.douya.ui.KonamiCodeDetector in project Douya by DreaminginCodeZH.

the class AboutFragment method onActivityCreated.

@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    ScalpelHelperFragment.attachTo(this);
    AppCompatActivity activity = (AppCompatActivity) getActivity();
    activity.setSupportActionBar(mToolbar);
    activity.getSupportActionBar().setTitle(null);
    // Seems that ScrollView intercepts touch event, so we have to set the onTouchListener on a
    // view inside it.
    mContainerLayout.setOnTouchListener(new KonamiCodeDetector(activity) {

        @Override
        public void onDetected() {
            onEnableScalpel();
        }
    });
    mVersionText.setText(getString(R.string.about_version_format, BuildConfig.VERSION_NAME));
    mDoubanButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            Activity activity = getActivity();
            activity.startActivity(ProfileActivity.makeIntent("douban-douya", activity));
        }
    });
}
Also used : AppCompatActivity(android.support.v7.app.AppCompatActivity) KonamiCodeDetector(me.zhanghai.android.douya.ui.KonamiCodeDetector) ProfileActivity(me.zhanghai.android.douya.profile.ui.ProfileActivity) AppCompatActivity(android.support.v7.app.AppCompatActivity) Activity(android.app.Activity) BindView(butterknife.BindView) TextView(android.widget.TextView) View(android.view.View)

Aggregations

Activity (android.app.Activity)1 AppCompatActivity (android.support.v7.app.AppCompatActivity)1 View (android.view.View)1 TextView (android.widget.TextView)1 BindView (butterknife.BindView)1 ProfileActivity (me.zhanghai.android.douya.profile.ui.ProfileActivity)1 KonamiCodeDetector (me.zhanghai.android.douya.ui.KonamiCodeDetector)1