Example #1
0
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    slidingMenu = new SlidingMenu(MonthActivity.this);
    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
      setContentView(R.layout.main);
      slidingMenu.setBehindOffset((int) (getResources().getDisplayMetrics().widthPixels * 0.15));
    } else {
      setContentView(R.layout.main);
      slidingMenu.setBehindOffset((int) (getResources().getDisplayMetrics().widthPixels * 0.5));
      Fragment newFragment = new DetailDayFragment();
      FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
      ft.add(R.id.day_or_pair_frame, newFragment).commit();
    }

    slidingMenu.setMode(SlidingMenu.LEFT);
    slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
    slidingMenu.attachToActivity(this, SlidingMenu.SLIDING_WINDOW);
    slidingMenu.setMenu(R.layout.sliding_menu);

    slidingMenu
        .findViewById(R.id.sliding_menu_lessons)
        .setOnClickListener(new LessonsItemOnClick());
    slidingMenu
        .findViewById(R.id.sliding_menu_teachers)
        .setOnClickListener(new TeachersItemOnClick());

    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    new TestData().addingTo(AppDB.getInstance(this));
  }
Example #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.personal);

    //////////////////
    Bitmap bm = BitmapFactory.decodeResource(this.getResources(), R.drawable.background_personal);
    BitmapDrawable bd = new BitmapDrawable(this.getResources(), bm);
    allLayout = (RelativeLayout) findViewById(R.id.layout_personal);
    allLayout.setBackgroundDrawable(bd);
    //////////////////

    btnPersonal = (Button) findViewById(R.id.btnPersonal);
    btnExpert = (Button) findViewById(R.id.btnExpert);
    btnMessage = (Button) findViewById(R.id.btnMessage);

    btnPersonal.setOnClickListener(new MyButtonOnClickListener());
    btnExpert.setOnClickListener(new MyButtonOnClickListener());
    btnMessage.setOnClickListener(new MyButtonOnClickListener());

    //////////////////
    final SlidingMenu menu = new SlidingMenu(this);
    btnDetails = (Button) findViewById(R.id.btnDetails);
    btnDetails.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {
            menu.toggle();
          }
        });
    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.setBehindWidth(500);
    menu.setFadeDegree(0.35f);
    menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
    menu.setMenu(R.layout.sliding_detalis);
    //////////////////

    btnPersonalData = (Button) findViewById(R.id.btnPersonalData);
    btnEveryDay = (Button) findViewById(R.id.btnEveryDay);
    btnMyPlan = (Button) findViewById(R.id.btnMyPlan);
    btnMyTeacher = (Button) findViewById(R.id.btnMyTeacher);
    btnMyCollection = (Button) findViewById(R.id.btnMyCollection);
    btnMyCard = (Button) findViewById(R.id.btnMyCard);

    btnPersonalData.setOnClickListener(new MyButtonOnClickListener());
    btnEveryDay.setOnClickListener(new MyButtonOnClickListener());
    btnMyPlan.setOnClickListener(new MyButtonOnClickListener());
    btnMyTeacher.setOnClickListener(new MyButtonOnClickListener());
    btnMyCollection.setOnClickListener(new MyButtonOnClickListener());
    btnMyCard.setOnClickListener(new MyButtonOnClickListener());
  }
  @Override
  protected void onCreate(Bundle bundle) {
    super.onCreate(bundle);

    // configure the SlidingMenu
    SlidingMenu menu = new SlidingMenu(this);
    menu.setMode(SlidingMenu.LEFT);
    menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
    menu.attachToActivity(this, SlidingMenu.SLIDING_WINDOW);
    menu.setShadowWidth(15);
    menu.setBehindOffset(60);
    menu.setFadeDegree(0.35f);
    menu.setMenu(R.layout.sidemenu_frame);

    getSupportFragmentManager()
        .beginTransaction()
        .replace(R.id.menu_frame, new SideMenu())
        .commit();
  }
  @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");
    }
  }
Example #5
0
  @Override
  protected void onCreate(Bundle arg0) {
    // TODO Auto-generated method stub
    super.onCreate(arg0);
    setContentView(R.layout.calendar_activity);
    mGlobalData = (GlobalData) getApplicationContext();

    this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
    intiliazeTop();
    intiliaze();
    view = Calender.this.getLayoutInflater().inflate(R.layout.left_slide, null);
    menu = new SlidingMenu(this);
    menu.setMode(SlidingMenu.LEFT);
    menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
    menu.setBehindOffsetRes(R.dimen.sliding_limit);
    // menu.setFadeDegree(0.35f);
    menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
    menu.setMenu(view);

    menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
    intilazeleft(view);
  }
  /**
   * Further SlidingMenu initialization. Should be called within the activitiy's onPostCreate()
   *
   * @param savedInstanceState the saved instance state (unused)
   */
  public void onPostCreate(Bundle savedInstanceState) {
    if (mViewBehind == null || mViewAbove == null) {
      throw new IllegalStateException(
          "Both setBehindContentView must be called "
              + "in onCreate in addition to setContentView.");
    }

    mOnPostCreateCalled = true;

    mSlidingMenu.attachToActivity(
        mActivity, mEnableSlide ? SlidingMenu.SLIDING_WINDOW : SlidingMenu.SLIDING_CONTENT);

    final boolean open;
    final boolean secondary;
    if (savedInstanceState != null) {
      open = savedInstanceState.getBoolean("SlidingActivityHelper.open");
      secondary = savedInstanceState.getBoolean("SlidingActivityHelper.secondary");
    } else {
      open = false;
      secondary = false;
    }
    new Handler()
        .post(
            new Runnable() {
              public void run() {
                if (open) {
                  if (secondary) {
                    mSlidingMenu.showSecondaryMenu(false);
                  } else {
                    mSlidingMenu.showMenu(false);
                  }
                } else {
                  mSlidingMenu.showContent(false);
                }
              }
            });
  }
Example #7
0
  private void setUpViews() {

    setContentView(R.layout.activity_base_assembly);
    activityContentLayout = (LinearLayout) findViewById(R.id.activity_content);
    errorMessageView = (TextView) findViewById(R.id.error_not_logged_in);

    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.setMenu(R.layout.slidebar);

    mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    mInflater.inflate(resLayout, activityContentLayout);

    menuAdapter = new MenuListAdapter(this);
    menuListView = (ListView) findViewById(R.id.sidebar_list);
    menuListView.setAdapter(menuAdapter);
    menuListView.setOnItemClickListener(
        new OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            MenuListItem item = (MenuListItem) arg1;
            item.getItem().getAction().run();
          }
        });

    menuListView.setOnItemLongClickListener(
        new OnItemLongClickListener() {
          @Override
          public boolean onItemLongClick(AdapterView<?> arg0, View view, int arg2, long arg3) {
            MenuListItem item = (MenuListItem) view;
            OnLongClickListener longClickAction = item.getItem().getLongClickAction();
            if (longClickAction != null) {
              item.getItem().getLongClickAction().onLongClick(view);
            }
            return true;
          }
        });

    loginItem = menuAdapter.getLoginItem();
    loginItem.setAction(
        new Runnable() {
          @Override
          public void run() {
            if (loggedIn) {
              showUserProfile();
            } else {
              authorizeUser();
            }
          }
        });

    loginItem.setLongClickAction(
        new OnLongClickListener() {
          @SuppressLint("NewApi")
          @Override
          public boolean onLongClick(View view) {
            if (loggedIn) {
              if (app.isSupportsHoneyComb()) {
                showProfilePopup(view);
              } else {
                showProfileDialog();
              }
              return true;
            } else {
              return false;
            }
          }
        });
  }
Example #8
0
 /**
  * Attaches the SlidingMenu to an entire Activity
  *
  * @param activity the Activity
  * @param slideStyle either SLIDING_CONTENT or SLIDING_WINDOW
  */
 public void attachToActivity(Activity activity, int slideStyle) {
   attachToActivity(activity, slideStyle, false);
 }
Example #9
0
  @Override
  public void onClick(View v) {
    // TODO Auto-generated method stub
    switch (v.getId()) {
      case R.id.previous:
        if (month.get(Calendar.MONTH) == month.getActualMinimum(Calendar.MONTH)) {
          month.set((month.get(Calendar.YEAR) - 1), month.getActualMaximum(Calendar.MONTH), 1);
        } else {
          month.set(Calendar.MONTH, month.get(Calendar.MONTH) - 1);
        }
        refreshCalendar();
        break;

      case R.id.wall:
        if (menu != null) {
          menu.toggle();
        }

        Intent i = new Intent(Calender.this, Home.class);
        Calender.this.finish();
        startActivity(i);
        break;

      case R.id.servicelist:
        if (menu != null) {
          menu.toggle();
        }

        Intent service = new Intent(Calender.this, Servicelist.class);
        Calender.this.finish();
        startActivity(service);
        break;

      case R.id.next:
        if (month.get(Calendar.MONTH) == month.getActualMaximum(Calendar.MONTH)) {
          month.set((month.get(Calendar.YEAR) + 1), month.getActualMinimum(Calendar.MONTH), 1);
        } else {
          month.set(Calendar.MONTH, month.get(Calendar.MONTH) + 1);
        }
        refreshCalendar();
        break;

      case R.id.backButton:
        break;

      case R.id.rightButton:
        if (menu1 == null) {
          System.out.println("inside view null");
          view1 = Calender.this.getLayoutInflater().inflate(R.layout.addanappointment, null);
          menu1 = new SlidingMenu(this);
          menu1.setMode(SlidingMenu.RIGHT);
          menu1.setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE);
          menu1.setBehindOffsetRes(R.dimen.sliding_limit);
          menu1.setMenu(view1);
          menu1.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
          menu1.toggle();
          intiliazeright(view1);
        } else {

          System.out.println("inside view not null");
          menu1.toggle();
          try {
            fname.setText("");
          } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          }
          try {
            lname.setText("");
          } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          }
          try {
            adult_counter.setText("1");
            child_counter.setText("0");
          } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          }
        }
        break;

      case R.id.scheduletime:
        Calendar calender = Calendar.getInstance();
        DatePickerDialog datePicker =
            new DatePickerDialog(
                Calender.this,
                new MyDateListener(),
                calender.get(Calendar.YEAR),
                calender.get(Calendar.MONTH),
                calender.get(Calendar.DAY_OF_MONTH));

        datePicker.show();
        break;

      case R.id.adult_plus:
        counter_adult = counter_adult + 1;
        Log.e("add counter", Integer.toString(counter_adult));
        adult_counter.setText(Integer.toString(counter_adult));

        break;
      case R.id.adult_minus:
        if (counter_adult == 0) {
          // adult_counter.setText(Integer.toString(counter_adult));
        } else {
          counter_adult = counter_adult - 1;
          Log.e("add counter", Integer.toString(counter_adult));
          adult_counter.setText(Integer.toString(counter_adult));
        }
        break;

      case R.id.child_plus:
        counter_child = counter_child + 1;
        child_counter.setText(Integer.toString(counter_child));
        break;

      case R.id.child_minus:
        if (counter_child == 0) {

        } else {
          counter_child = counter_child - 1;
          child_counter.setText(Integer.toString(counter_child));
        }
        break;

      case R.id.edit_save:
        if (menu1 != null) {
          menu1.toggle();
        }
        break;

      default:
        break;
    }
  }
Example #10
0
  /** 初始化控件 */
  public void initWidget() {
    slidingMenu = new SlidingMenu(this);
    slidingMenu.setMode(SlidingMenu.LEFT);
    slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
    slidingMenu.setBehindScrollScale(0);
    slidingMenu.setFadeDegree(1f);
    slidingMenu.setFadeEnabled(true);
    slidingMenu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);

    slidingMenu.setBehindOffset(getScreenWidth() / 2);
    slidingMenu.setMenu(R.layout.sidebar_layout);

    editTopLayout = (RelativeLayout) findViewById(R.id.edit_top_title);
    searchTitle = (RelativeLayout) findViewById(R.id.main_top_search);
    bottomLayout = (LinearLayout) findViewById(R.id.main_bottom);
    seeAllButton = (ImageButton) findViewById(R.id.seeallbtn);
    addNoteButton = (ImageButton) findViewById(R.id.addnotebtn);
    addTypeButton = (ImageButton) findViewById(R.id.addtype_btn);
    deleteButton = (ImageButton) findViewById(R.id.delete_btn_main);
    shareButton = (ImageButton) findViewById(R.id.share_btn_main);
    moveButton = (ImageButton) findViewById(R.id.move_btn_main);
    lockedButton = (ImageButton) findViewById(R.id.locked_btn_main);
    unlockedButton = (ImageButton) findViewById(R.id.unlocked_btn_main);
    showTypeView = (TextView) findViewById(R.id.showtype);
    showSelectView = (TextView) findViewById(R.id.showselect);
    showNowDateView = (TextView) findViewById(R.id.nowdate_tv);
    typeGroup = (RadioGroup) findViewById(R.id.typegroup);
    noteListView = (ListView) findViewById(R.id.notelist);
    showEmptyView = (LinearLayout) findViewById(R.id.showempty_view);
    showSearchButton = (Button) findViewById(R.id.searchbtn_sidebar);
    calendarButton = (Button) findViewById(R.id.calendarbtn_sidebar);
    albumButton = (Button) findViewById(R.id.albumbtn_sidebar);
    passwdButton = (Button) findViewById(R.id.passwdbtn_sidebar);
    feedbackButton = (Button) findViewById(R.id.feedbackbtn_sidebar);
    shareAppButton = (Button) findViewById(R.id.shareappbtn_sidebar);
    aboutButton = (Button) findViewById(R.id.aboutbtn_sidebar);
    startSearchButton = (ImageButton) findViewById(R.id.startsearch_btn);
    voiceSearchButton = (ImageButton) findViewById(R.id.voice_search_btn);
    searchEditText = (EditText) findViewById(R.id.edittext_search);
    changeOrderButton = (ImageButton) findViewById(R.id.changebtn);

    seeAllButton.setOnClickListener(this);
    addNoteButton.setOnClickListener(this);
    addTypeButton.setOnClickListener(this);
    deleteButton.setOnClickListener(this);
    shareButton.setOnClickListener(this);
    moveButton.setOnClickListener(this);
    lockedButton.setOnClickListener(this);
    unlockedButton.setOnClickListener(this);
    showSearchButton.setOnClickListener(this);
    startSearchButton.setOnClickListener(this);
    calendarButton.setOnClickListener(this);
    albumButton.setOnClickListener(this);
    passwdButton.setOnClickListener(this);
    feedbackButton.setOnClickListener(this);
    shareAppButton.setOnClickListener(this);
    aboutButton.setOnClickListener(this);
    voiceSearchButton.setOnClickListener(this);
    changeOrderButton.setOnClickListener(this);
    noteListView.setOnItemClickListener(this);
    noteListView.setOnItemLongClickListener(this);

    noteTypeDao = new NoteTypeDao(MainActivity.this);

    // 初始化语音识别器
    initVoiceRecognizer();

    // 获取所有分类
    typeList = noteTypeDao.getAllTyep();
    // 动态加载radiobutton
    for (int i = 0; i < typeList.size(); i++) {
      AddRadioButton(typeList.get(i).get("type").toString());
    }

    // 初始化所有的记事本并显示
    noteDetailDao = new NoteDetailDao(MainActivity.this);

    // 显示当前时间
    showNowDate();

    // 创建需要用到的文件夹
    createDir();
  }