Exemple #1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mDrawer = MenuDrawer.attach(this, Position.RIGHT);
    mDrawer.setContentView(R.layout.activity_alloy_list_stock_in);
    mDrawer.setMenuView(R.layout.drawer_layout_for_alloystockin);
    mDrawer.setDropShadowColor(R.color.client_colour_grey_dark);
    ButterKnife.bind(this);
    activity = this;
    SaleActivitiesStatus.isAlloyListInSAlemOduleIsOpen = true;
    bus.register(this);
    finishpreviousActivities();

    next_Bucket.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            if (SaleActivitiesStatus.isBucketInSalemoduleisopen == true) {
              finish();
              overridePendingTransition(R.anim.no_sliding, R.anim.slide_out_bottom);
            } else {
              startActivity(new Intent(AlloyListSALE.this, SaleBucketActivity.class));
              overridePendingTransition(R.anim.pull_in_right, R.anim.no_sliding);
            }
          }
        });
  }
  /** Create menu drawer ListView and listeners */
  private void initMenuDrawer() {
    mListView = new ListView(this);
    mListView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
    mListView.setDivider(null);
    mListView.setDividerHeight(0);
    mListView.setCacheColorHint(android.R.color.transparent);

    String[] blogNames = getBlogNames();
    if (blogNames.length > 1) {
      addBlogSpinner(blogNames);
    }

    mListView.setOnItemClickListener(mItemClickListener);
    mListView.setOnScrollListener(
        new AbsListView.OnScrollListener() {
          @Override
          public void onScrollStateChanged(AbsListView view, int scrollState) {}

          @Override
          public void onScroll(
              AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
            mMenuDrawer.invalidate();
          }
        });

    mMenuDrawer.setMenuView(mListView);

    updateMenuDrawer();
  }
  @Override
  public void onCreate(Bundle inState) {
    super.onCreate(inState);

    mMenuDrawer = MenuDrawer.attach(this, MenuDrawer.MENU_DRAG_CONTENT);

    TextView menuView = new TextView(this);
    menuView.setGravity(Gravity.CENTER);
    menuView.setTextColor(0xFFFFFFFF);
    final int padding = dpToPx(16);
    menuView.setPadding(padding, padding, padding, padding);
    menuView.setText(R.string.sample_listactivity);
    mMenuDrawer.setMenuView(menuView);
    mMenuDrawer.setOffsetMenuEnabled(false);

    List<String> items = new ArrayList<String>();
    for (int i = 1; i <= 20; i++) {
      items.add("Item " + i);
    }

    setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, items));

    // When running on ICS or higher, the "up" button blinks until it is clicked.
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
      mHandler = new Handler();
      getActionBar().setDisplayHomeAsUpEnabled(true);
      mToggleUpRunnable =
          new Runnable() {
            @Override
            public void run() {
              mDisplayUp = !mDisplayUp;
              getActionBar().setDisplayHomeAsUpEnabled(mDisplayUp);
              mHandler.postDelayed(mToggleUpRunnable, 500);
            }
          };

      mHandler.postDelayed(mToggleUpRunnable, 500);

      mMenuDrawer.setOnDrawerStateChangeListener(
          new MenuDrawer.OnDrawerStateChangeListener() {
            @Override
            public void onDrawerStateChange(int oldState, int newState) {
              if (newState == MenuDrawer.STATE_OPEN) {
                mHandler.removeCallbacks(mToggleUpRunnable);
                if (!mDisplayUp) getActionBar().setDisplayHomeAsUpEnabled(true);
                mMenuDrawer.setOnDrawerStateChangeListener(null);
              }
            }

            @Override
            public void onDrawerSlide(float openRatio, int offsetPixels) {
              // Do nothing
            }
          });
    }
  }
  @Override
  protected void onCreate(Bundle inState) {
    super.onCreate(inState);

    mMenuDrawer = MenuDrawer.attach(this, MenuDrawer.MENU_DRAG_CONTENT, Position.TOP);
    mMenuDrawer.setTouchMode(MenuDrawer.TOUCH_MODE_FULLSCREEN);
    mMenuDrawer.setContentView(R.layout.activity_topmenu);
    mMenuDrawer.setMenuView(R.layout.menu_top);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH)
      getActionBar().setDisplayHomeAsUpEnabled(true);

    mContentTextView = (TextView) findViewById(R.id.contentText);
    findViewById(R.id.item1).setOnClickListener(this);
    findViewById(R.id.item2).setOnClickListener(this);
  }
 /** 侧滑菜单初始化 */
 public void initMenuview() {
   View settingview = getLayoutInflater().inflate(R.layout.main_setting, null);
   mDrawer.setMenuView(settingview);
   // menudrawer的侧滑界面的listview
   mListView = (ListView) settingview.findViewById(R.id.listView1);
   String[] mTitle = getResources().getStringArray(R.array.menu_str);
   int images[] =
       new int[] {
         R.drawable.ic_menu_login,
         R.drawable.ic_menu_home,
         R.drawable.ic_menu_group,
         R.drawable.ic_menu_public,
         R.drawable.ic_menu_setting
       };
   /** 用户登陆判断* */
   //		SharedPreferences sp = getPreferences(MODE_PRIVATE);
   SharedPreferences sp = getSharedPreferences("userinfo", 0);
   // 自动登陆
   autologin = sp.getBoolean("autologin", false);
   if (autologin) {
     username = sp.getString("username", "cpoopc");
   } else {
     sp.edit().putString("username", "").commit();
   }
   // 用户名
   if (username != null && !"".equals(username)) {
     mTitle[0] = username;
   }
   settingAdapter = new SettingAdapter(this, mTitle, images);
   mListView.setAdapter(settingAdapter);
   mListView.setOnItemClickListener(this);
   //		mDrawer.setDropShadowColor(Color.BLUE);
   mDrawer.setSlideDrawable(R.drawable.ic_setting);
   mDrawer.setDrawerIndicatorEnabled(true);
   mDrawer.setTouchMode(MenuDrawer.TOUCH_MODE_FULLSCREEN);
   mDrawer.setMenuSize(250);
   // 第一次使用提示可以侧滑
   boolean firstUse = sp.getBoolean("firstUse", true);
   if (firstUse) {
     mDrawer.peekDrawer(1000, 0);
     Editor edit = sp.edit();
     edit.putBoolean("firstUse", false);
     edit.commit();
   }
 }
  @Override
  protected void onCreate(Bundle inState) {
    super.onCreate(inState);

    if (inState != null) {
      mActivePosition = inState.getInt(STATE_ACTIVE_POSITION);
    }

    mMenuDrawer =
        MenuDrawer.attach(this, MenuDrawer.Type.BEHIND, getDrawerPosition(), getDragMode());

    List<Object> items = new ArrayList<Object>();
    items.add(new Item("Item 1", R.drawable.ic_action_refresh_dark));
    items.add(new Item("Item 2", R.drawable.ic_action_select_all_dark));
    items.add(new Category("Cat 1"));
    items.add(new Item("Item 3", R.drawable.ic_action_refresh_dark));
    items.add(new Item("Item 4", R.drawable.ic_action_select_all_dark));
    items.add(new Category("Cat 2"));
    items.add(new Item("Item 5", R.drawable.ic_action_refresh_dark));
    items.add(new Item("Item 6", R.drawable.ic_action_select_all_dark));
    items.add(new Category("Cat 3"));
    items.add(new Item("Item 7", R.drawable.ic_action_refresh_dark));
    items.add(new Item("Item 8", R.drawable.ic_action_select_all_dark));
    items.add(new Category("Cat 4"));
    items.add(new Item("Item 9", R.drawable.ic_action_refresh_dark));
    items.add(new Item("Item 10", R.drawable.ic_action_select_all_dark));

    mList = new ListView(this);

    mAdapter = new MenuAdapter(this, items);
    mAdapter.setListener(this);
    mAdapter.setActivePosition(mActivePosition);

    mList.setAdapter(mAdapter);
    mList.setOnItemClickListener(mItemClickListener);

    mMenuDrawer.setMenuView(mList);
  }
  @Override
  protected void onCreate(Bundle inState) {
    super.onCreate(inState);
    mDrawer =
        MenuDrawer.attach(
            this, MenuDrawer.MENU_DRAG_CONTENT, Position.RIGHT, MenuDrawer.Type.OVERLAY);

    List<Object> items = new ArrayList<Object>();
    items.add(new Item("Item 1", R.drawable.ic_action_refresh_dark));
    items.add(new Item("Item 2", R.drawable.ic_action_select_all_dark));
    items.add(new Category("Cat 1"));
    items.add(new Item("Item 3", R.drawable.ic_action_refresh_dark));
    items.add(new Item("Item 4", R.drawable.ic_action_select_all_dark));
    items.add(new Category("Cat 2"));
    items.add(new Item("Item 5", R.drawable.ic_action_refresh_dark));
    items.add(new Item("Item 6", R.drawable.ic_action_select_all_dark));
    items.add(new Category("Cat 3"));
    items.add(new Item("Item 7", R.drawable.ic_action_refresh_dark));
    items.add(new Item("Item 8", R.drawable.ic_action_select_all_dark));
    items.add(new Category("Cat 4"));
    items.add(new Item("Item 9", R.drawable.ic_action_refresh_dark));
    items.add(new Item("Item 10", R.drawable.ic_action_select_all_dark));

    mList = new ListView(this);

    mAdapter = new MenuAdapter(this, items);

    mList.setAdapter(mAdapter);

    mDrawer.setMenuView(mList);

    TextView content = new TextView(this);
    content.setText("This is a sample of an overlayed right drawer.");
    content.setGravity(Gravity.CENTER);
    mDrawer.setContentView(content);
  }
Exemple #8
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(
        Window.FEATURE_INDETERMINATE_PROGRESS); // for progress it will be passed before layout

    // navigation
    if (savedInstanceState != null) {
      mActiveViewId = savedInstanceState.getInt(STATE_ACTIVE_VIEW_ID);
    }

    mMenuDrawer = MenuDrawer.attach(this, MenuDrawer.MENU_DRAG_WINDOW);
    mMenuDrawer.setMenuView(R.layout.menu_scrollview); // this is the layout for

    ////////////////////////////////////////////////////
    // Action bar
    ActionBar mActionBar;
    LayoutInflater mInflater;
    View mCustomView;
    TextView mTitleTextView;
    mActionBar = getSupportActionBar();
    mActionBar.setDisplayShowHomeEnabled(false);
    mActionBar.setDisplayShowTitleEnabled(false);
    mInflater = LayoutInflater.from(this);
    mCustomView = mInflater.inflate(R.layout.menu, null);
    mTitleTextView = (TextView) mCustomView.findViewById(R.id.title_text);
    mTitleTextView.setText("Live");
    mTitleTextView.setTextSize(20);

    mActionBar.setCustomView(mCustomView);
    mActionBar.setDisplayShowCustomEnabled(true);
    // mActionBar.setBackgroundDrawable(getResources().getDrawable(R.drawable.at_header_bg));
    ImageButton ibItem1 = (ImageButton) findViewById(R.id.btn_slide);
    ibItem1.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            mMenuDrawer.toggleMenu();
          }
        });

    /////////////////////////////////////////////

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
      //           getActionBar().setDisplayHomeAsUpEnabled(true);
      // this is for the color of title bar
      ColorDrawable colorDrawable = new ColorDrawable();
      int myColor = this.getResources().getColor(R.color.menu4);
      colorDrawable.setColor(myColor);
      android.app.ActionBar actionBar = getActionBar();
      actionBar.setBackgroundDrawable(colorDrawable);
    }

    // mContentTextView = (TextView) findViewById(R.id.contentText);
    findViewById(R.id.item1).setOnClickListener(this);
    findViewById(R.id.item2).setOnClickListener(this);
    findViewById(R.id.item3).setOnClickListener(this);
    findViewById(R.id.item4).setOnClickListener(this);
    findViewById(R.id.item5).setOnClickListener(this);
    findViewById(R.id.item6).setOnClickListener(this);
    findViewById(R.id.item7).setOnClickListener(this);
    findViewById(R.id.item8).setOnClickListener(this);

    TextView activeView = (TextView) findViewById(mActiveViewId);
    if (activeView != null) {
      mMenuDrawer.setActiveView(activeView);
      // mContentTextView.setText("Active item: " + activeView.getText());
    }

    Display display = getWindowManager().getDefaultDisplay();
    int width = display.getWidth();
    mMenuDrawer.setMenuSize(width / 4); // size of menu
    mMenuDrawer.setDropShadow(android.R.color.transparent); // removin showdo
    // navigation

    if (isNetworkOnline() == true) { // starting settings if internet is not working
      internt_count = true;
      iamcallin(); // calling the function to build everything

    } else if (isNetworkOnline() == false) {
      setContentView(R.layout.nointernet); // giving new layout to drawer
      // setContentView(R.layout.nointernet);
      internt_count = false;
      Button button = (Button) findViewById(R.id.nointernet_refresh);

      button.setOnClickListener(
          new OnClickListener() {

            @Override
            public void onClick(View arg0) {

              Intent myIntent = new Intent(live_first.this, live_first.class); // refreshing

              startActivity(myIntent);
              finish();
            }
          });
    }
  }