Search in sources :

Example 1 with StartMovingBaseDictionaryListener

use of com.zhan_dui.dictionary.listeners.StartMovingBaseDictionaryListener in project little-bear-dictionary by daimajia.

the class GeneralActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    ThemeUtils.onActivityCreateSetTheme(this);
    super.onCreate(savedInstanceState);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    mContext = this;
    setBehindContentView(R.layout.sliding_menu);
    setContentView(R.layout.activity_main);
    mSlidingMenu = getSlidingMenu();
    mSlidingMenu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
    mSlidingMenu.setFadeDegree(0.35f);
    mSlidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
    mSlidingMenu.setMode(SlidingMenu.LEFT);
    mMenuView = mSlidingMenu.getMenu();
    // start finding ui widget
    mSearch = (Button) mMenuView.findViewById(R.id.search);
    mSetting = (Button) mMenuView.findViewById(R.id.setting);
    mOfflineManage = (Button) mMenuView.findViewById(R.id.offline_manage);
    mSetting = (Button) mMenuView.findViewById(R.id.setting);
    mAbout = (Button) mMenuView.findViewById(R.id.about);
    mRate = (Button) mMenuView.findViewById(R.id.star);
    mWords = (Button) mMenuView.findViewById(R.id.words);
    mSetting.setOnClickListener(this);
    mOfflineManage.setOnClickListener(this);
    mSearch.setOnClickListener(this);
    mAbout.setOnClickListener(this);
    mRate.setOnClickListener(this);
    mAbout.setOnClickListener(this);
    mWords.setOnClickListener(this);
    mSlidingMenu.setOnClosedListener(this);
    // SlidingMenu init;
    getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, new QueryWordFragment(), mTag).commit();
    mCurrentShowID = R.id.search;
    if (isBaseDictionaryExist() == false) {
        AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
        builder.setTitle(R.string.tips);
        builder.setMessage(R.string.init);
        builder.setPositiveButton(R.string.init_start, new StartMovingBaseDictionaryListener(mContext));
        builder.setNegativeButton(R.string.init_not_now, new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                GeneralActivity.this.finish();
            }
        });
        builder.show();
    }
    UMFeedbackService.enableNewReplyNotification(this, NotificationType.AlertDialog);
    Boolean first = PreferenceManager.getDefaultSharedPreferences(mContext).getBoolean(Constants.PREFER_FIRST, true);
    if (first) {
        Intent intent = new Intent(this, GuideActivity.class);
        startActivity(intent);
    }
}
Also used : QueryWordFragment(com.zhan_dui.dictionary.fragments.QueryWordFragment) AlertDialog(org.holoeverywhere.app.AlertDialog) DialogInterface(android.content.DialogInterface) Intent(android.content.Intent) StartMovingBaseDictionaryListener(com.zhan_dui.dictionary.listeners.StartMovingBaseDictionaryListener) SuppressLint(android.annotation.SuppressLint)

Aggregations

SuppressLint (android.annotation.SuppressLint)1 DialogInterface (android.content.DialogInterface)1 Intent (android.content.Intent)1 QueryWordFragment (com.zhan_dui.dictionary.fragments.QueryWordFragment)1 StartMovingBaseDictionaryListener (com.zhan_dui.dictionary.listeners.StartMovingBaseDictionaryListener)1 AlertDialog (org.holoeverywhere.app.AlertDialog)1