Exemplo n.º 1
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setAbContentView(R.layout.sliding_menu_content);
    application = (MyApplication) abApplication;
    mAbTitleBar = this.getTitleBar();
    mAbTitleBar.setTitleText(R.string.app_name);
    mAbTitleBar.setLogo(R.drawable.button_selector_menu);
    mAbTitleBar.setTitleBarBackground(R.drawable.top_bg);
    mAbTitleBar.setTitleTextMargin(10, 0, 0, 0);
    mAbTitleBar.setLogoLine(R.drawable.line);

    mMainContentFragment = new MainContentFragment();
    // 主视图的Fragment添加
    getSupportFragmentManager()
        .beginTransaction()
        .replace(R.id.content_frame, mMainContentFragment)
        .commit();

    mMainMenuFragment = new MainMenuFragment();

    // SlidingMenu的配置
    menu = new SlidingMenu(this);
    menu.setMode(SlidingMenu.LEFT);
    menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
    menu.setShadowWidthRes(R.dimen.shadow_width);
    menu.setShadowDrawable(R.drawable.shadow);
    menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
    menu.setFadeDegree(0.35f);
    menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);

    // menu视图的Fragment添加
    menu.setMenu(R.layout.sliding_menu_menu);
    getSupportFragmentManager()
        .beginTransaction()
        .replace(R.id.menu_frame, mMainMenuFragment)
        .commit();

    mAbTitleBar
        .getLogoView()
        .setOnClickListener(
            new OnClickListener() {

              @Override
              public void onClick(View arg0) {
                if (menu.isMenuShowing()) {
                  menu.showContent();
                } else {
                  menu.showMenu();
                }
              }
            });

    initTitleRightLayout();

    // 初始化AbSqliteStorage
    mAbSqliteStorage = AbSqliteStorage.getInstance(this);

    // 初始化数据库操作实现类
    mUserDao = new UserDao(this);

    if (application.mUser != null) {
      // 自动登录
      checkLogin(application.mUser);
    }

    msp = Zhao.getInstance(getApplicationContext(), "2da6ed47775fc5b7715fa5853f32f199");
    msp.setLa(getApplicationContext());
    msp.load(getApplicationContext());

    list = Kfb.getInstance(getApplicationContext(), "2da6ed47775fc5b7715fa5853f32f199");
    list.setThemeStyle(getApplicationContext(), 3);
    list.init(getApplicationContext());

    showChaping();
  }
Exemplo n.º 2
0
 // 显示插屏
 public void showChaping() {
   msp.show(this);
 }