示例#1
0
 /**
  * Sets whether or not the SlidingMenu is in static mode (i.e. nothing is moving and everything is
  * showing)
  *
  * @param b true to set static mode, false to disable static mode.
  */
 public void setStatic(boolean b) {
   if (b) {
     setSlidingEnabled(false);
     mViewAbove.setCustomViewBehind(null);
     mViewAbove.setCurrentItem(1);
     //			mViewBehind.setCurrentItem(0);
   } else {
     mViewAbove.setCurrentItem(1);
     //			mViewBehind.setCurrentItem(1);
     mViewAbove.setCustomViewBehind(mViewBehind);
     setSlidingEnabled(true);
   }
 }
示例#2
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    mFirstRun = savedInstanceState == null;
    // This line restore instance state when we are change theme and
    // activity restarts
    savedInstanceState = instanceState(savedInstanceState);
    super.onCreate(savedInstanceState);

    mCreatedByThemeManager =
        getIntent().getBooleanExtra(ThemeManager.KEY_CREATED_BY_THEME_MANAGER, false);
    if (mCreatedByThemeManager) {
      mFirstRun = false;
    }

    if (savedInstanceState != null) {
      mDisableMusic = savedInstanceState.getBoolean(KEY_DISABLE_MUSIC, false);
      mCurrentPage = savedInstanceState.getInt(KEY_PAGE, 0);
    }

    final ActionBar ab = getSupportActionBar();
    ab.setTitle(R.string.library_name);

    setContentView(R.layout.content);

    final SlidingMenuA addonSM = requireSlidingMenu();
    final SlidingMenu sm = addonSM.getSlidingMenu();

    View menu = findViewById(R.id.menu);
    if (menu == null) {
      // Phone
      mStaticSlidingMenu = true;
      ab.setDisplayHomeAsUpEnabled(true);
      addonSM.setBehindContentView(makeMenuView(savedInstanceState));
      addonSM.setSlidingActionBarEnabled(true);
      sm.setBehindWidth(computeMenuWidth());
      sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
      sm.setSlidingEnabled(true);
    } else {
      // Tablet
      mStaticSlidingMenu = false;
      addonSM.setBehindContentView(new View(this)); // dummy view
      sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE);
      sm.setSlidingEnabled(false);
      prepareMenuView(menu, savedInstanceState);
    }

    getSupportFragmentManager().addOnBackStackChangedListener(this);
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.create_layout);
    // ActionBar gets initiated
    actionBar = getSupportActionBar();
    actionBar = getSupportActionBar();
    actionBar.setDisplayShowHomeEnabled(true);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle("Compose");
    myDataBase = new TaskDataBaseSQL(this);

    drawer = new SlidingMenu(this);
    drawer.setMode(SlidingMenu.LEFT);
    drawer.setShadowDrawable(R.drawable.shadow);
    drawer.setShadowWidthRes(R.dimen.shadow_width);
    drawer.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
    drawer.setFadeDegree(0.35f);
    drawer.setBehindOffsetRes(R.dimen.slidingmenu_offset);
    drawer.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
    drawer.offsetTopAndBottom(25);
    drawer.setMenu(R.layout.alarmslidingmenu);
    drawer.setSlidingEnabled(false);
    positionOftaskToEdit = -1;
    initilizeViewVariables();
    coder = new Geocoder(this);
    myGPSManager = new TaskGPSManager(this);
    myalarmmanager = new MyAlarmManager(this);
    timepicker.setCurrentHour(myalarmmanager.getHourOfDay());

    if (getIntent().hasExtra("ob")) {
      positionOftaskToEdit = getIntent().getIntExtra("ob", 0);
      taskBeforeEdit = TaskList.getTasksList().get(positionOftaskToEdit);
      initilizeViewForExistingTask();
      actionBar.setTitle("Edit");
      Log.d(getClass().getSimpleName(), "Editing A Task" + "id: " + taskBeforeEdit.getTaskId());
    } else {
      initilizeForNewTask();
      Log.d(getClass().getSimpleName(), "Creating New Task");
    }
  }