@Override
 public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
   mActivePosition = position;
   mMenuDrawer.setActiveView(view, position);
   mAdapter.setActivePosition(position);
   onMenuItemClicked(position, (Item) mAdapter.getItem(position));
 }
 /** Click handler for top drawer items. */
 @Override
 public void onClick(View v) {
   String tag = (String) v.getTag();
   mContentTextView.setText(String.format("%s clicked.", tag));
   mMenuDrawer.setActiveView(v);
 }
 @Override
 public void onActiveViewChanged(View v) {
   mMenuDrawer.setActiveView(v, mActivePosition);
 }
Пример #4
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();
            }
          });
    }
  }
Пример #5
0
  @Override
  public void onClick(View v) { // for the click view

    switch (v.getId()) {
      case R.id.item1:
        mMenuDrawer.setActiveView(v);
        // mMenuDrawer.closeMenu();
        Intent myIntent = new Intent(live_first.this, Home.class); // refreshing
        myIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);

        startActivity(myIntent);
        overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
        anmi = 1;
        break;
      case R.id.item2:
        mMenuDrawer.setActiveView(v);

        startActivity(new Intent(this, Event_activity.class));
        overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
        anmi = 1;
        // overridePendingTransition(R.anim.push_down_in,R.anim.push_down_out);//calling anim

        break;
      case R.id.item3:
        startActivity(new Intent(this, Event_top.class));
        overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
        anmi = 1;
        break;
      case R.id.item4:
        mMenuDrawer.setActiveView(v);
        mMenuDrawer.closeMenu();
        // startActivity(new Intent(this, Event_top.class));

        break;
      case R.id.item5:
        mMenuDrawer.setActiveView(v);
        // mMenuDrawer.closeMenu();
        startActivity(new Intent(this, Funnel_activity.class));
        overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
        anmi = 1;

        break;
      case R.id.item6:
        mMenuDrawer.setActiveView(v);
        // mMenuDrawer.closeMenu();
        startActivity(new Intent(this, Revenue_first.class));
        overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
        anmi = 1;

        break;
      case R.id.item7:
        mMenuDrawer.setActiveView(v);
        // mMenuDrawer.closeMenu();
        startActivity(new Intent(this, People_first.class));
        overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
        anmi = 1;

        break;
      case R.id.item8:
        mMenuDrawer.setActiveView(v);
        // mMenuDrawer.closeMenu();
        startActivity(new Intent(this, About.class));
        overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
        anmi = 1;

        break;
    }

    mActiveViewId = v.getId();
  }