Exemplo n.º 1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // 自已切换布局文件看效果
    //		setContentView(R.layout.activity_main02);
    setContentView(R.layout.activity_main02);

    mCircleMenuLayout = (CircleMenuLayout) findViewById(R.id.id_menulayout);
    mCircleMenuLayout.setMenuItemIconsAndTexts(mItemImgs, mItemTexts);

    mCircleMenuLayout.setOnMenuItemClickListener(
        new OnMenuItemClickListener() {

          @Override
          public void itemClick(View view, int pos) {
            Intent intent = null;
            switch (pos) {
              case 0:
                if (!AppConfig.LoginUser.getRightbit().contains(pos + "")) {
                  Toast.makeText(CCBActivity.this, "没有授权", Toast.LENGTH_LONG).show();
                  return;
                }
                intent =
                    new Intent(
                        com.qufei.androidapp.CCBActivity.this, com.qufei.query.QueryActivity.class);
                startActivityForResult(intent, QUERYACTIVITYCODE);
                break;
              case 1:
                if (!AppConfig.LoginUser.getRightbit().contains(pos + "")) {
                  Toast.makeText(CCBActivity.this, "没有授权", Toast.LENGTH_LONG).show();
                  return;
                }
                intent =
                    new Intent(
                        com.qufei.androidapp.CCBActivity.this,
                        com.qufei.addproduct.AddProductActivity.class);
                startActivityForResult(intent, ADDPRODUCTACTIVITY);
                break;
              case 5:
                if (!AppConfig.LoginUser.getRightbit().contains(pos + "")) {
                  Toast.makeText(CCBActivity.this, "没有授权", Toast.LENGTH_LONG).show();
                  return;
                }
                // intent =new
                // Intent(com.qufei.androidapp.CircleActivity.this,com.qufei.mpchartexample.activitys.PieChartActivity.class);
                // intent =new
                // Intent(com.qufei.androidapp.CircleActivity.this,com.qufei.mpchartexample.activitys.BarChartActivity.class);
                intent =
                    new Intent(
                        com.qufei.androidapp.CCBActivity.this, com.qufei.chart.ChartActivity.class);
                startActivity(intent);
              default:
                Toast.makeText(CCBActivity.this, "没有授权", Toast.LENGTH_LONG).show();

                return;
            }
          }

          @Override
          public void itemCenterClick(View view) {
            // 这里是登陆界面
            if (com.qufei.tools.NetworkDetector.isNetworkAvailable(
                com.qufei.androidapp.CCBActivity.this)) {

            } else {
              Toast.makeText(com.qufei.androidapp.CCBActivity.this, "当前网络不不可用", Toast.LENGTH_LONG)
                  .show();
              com.qufei.tools.NetworkDetector.setNetworkMethod(
                  com.qufei.androidapp.CCBActivity.this);
              return;
            }

            Intent intent =
                new Intent(
                    com.qufei.androidapp.CCBActivity.this, com.qufei.login.LoginActivity.class);
            startActivityForResult(intent, LOGINACTIVITYCODE);
          }
        });
  }
Exemplo n.º 2
0
  public void init() {
    // setContentView(R.layout.activity_main);
    AppConfig.LoginUser = new UserModel("", "", "", "", "", "", "");

    mCircleMenuLayout.setOnMenuItemClickListener(
        new OnMenuItemClickListener() {

          @Override
          public void itemClick(View view, int pos) {
            Log.i("pos__", pos + "");
            if (AppConfig.LoginUser.getRightbit() == "") {
              Toast.makeText(CircleActivity.this, "您还没有登录!", Toast.LENGTH_SHORT).show();
              Intent intent =
                  new Intent(
                      com.qufei.androidapp.CircleActivity.this,
                      com.qufei.login.LoginActivity.class);
              startActivityForResult(intent, LOGINACTIVITYCODE);
              return;
            }
            Intent intent = null;
            switch (pos) {
              case 0:
                if (!AppConfig.LoginUser.getRightbit().contains(pos + "")) {
                  Toast.makeText(CircleActivity.this, "没有授权", Toast.LENGTH_SHORT).show();
                  return;
                }
                intent =
                    new Intent(
                        com.qufei.androidapp.CircleActivity.this,
                        com.qufei.query.QueryActivity.class);
                startActivityForResult(intent, QUERYACTIVITYCODE);
                break;
              case 1:
                if (!AppConfig.LoginUser.getRightbit().contains(pos + "")) {
                  Toast.makeText(CircleActivity.this, "没有授权", Toast.LENGTH_SHORT).show();
                  return;
                }

                //					intent = new Intent(com.qufei.androidapp.CircleActivity.this,
                // com.qufei.addproduct.AddProductActivity.class);
                //					startActivityForResult(intent, ADDPRODUCTACTIVITY);

                intent =
                    new Intent(CircleActivity.this, com.qufei.addproduct.SelectTypeActivity.class);
                startActivity(intent);

                break;
              case 2: // 财务对账
                if (!AppConfig.LoginUser.getRightbit().contains(pos + "")) {
                  Toast.makeText(CircleActivity.this, "没有授权", Toast.LENGTH_SHORT).show();
                  return;
                }
                //					intent =new
                // Intent(CircleActivity.this,com.qufei.confirm.ConfirmQueryActivity.class);
                intent =
                    new Intent(CircleActivity.this, com.qufei.confirm.YanshoudanListActivity.class);
                startActivity(intent);
                break;
              case 3: // 单据审核
                if (!AppConfig.LoginUser.getRightbit().contains(pos + "")) {
                  Toast.makeText(CircleActivity.this, "没有授权", Toast.LENGTH_SHORT).show();

                  return;
                }
                intent = new Intent(CircleActivity.this, com.qufei.verify.DaishengheActivity.class);
                startActivity(intent);

                break;
              case 4: // 用户信息查看
                if (!AppConfig.LoginUser.getRightbit().contains(pos + "")) {
                  Toast.makeText(CircleActivity.this, "没有授权", Toast.LENGTH_SHORT).show();

                  return;
                }
                intent = new Intent(CircleActivity.this, com.qufei.user.UserInfoActivity.class);
                startActivity(intent);

                break;

              case 5:
                // 报表
                if (!AppConfig.LoginUser.getRightbit().contains(pos + "")) {
                  Toast.makeText(CircleActivity.this, "没有授权", Toast.LENGTH_SHORT).show();
                  return;
                }
                intent =
                    new Intent(
                        com.qufei.androidapp.CircleActivity.this,
                        com.qufei.chart.ChartActivity.class);
                startActivity(intent);
                break;
              default:
                Toast.makeText(CircleActivity.this, "没有授权", Toast.LENGTH_SHORT).show();
                return;
            }
          }

          @Override
          public void itemCenterClick(View view) {
            // 这里是登陆界面
            if (com.qufei.tools.NetworkDetector.isNetworkAvailable(
                com.qufei.androidapp.CircleActivity.this)) {

            } else {
              Toast.makeText(
                      com.qufei.androidapp.CircleActivity.this, "当前网络不不可用", Toast.LENGTH_LONG)
                  .show();
              com.qufei.tools.NetworkDetector.setNetworkMethod(
                  com.qufei.androidapp.CircleActivity.this);
              return;
            }

            Intent intent =
                new Intent(
                    com.qufei.androidapp.CircleActivity.this, com.qufei.login.LoginActivity.class);
            startActivityForResult(intent, LOGINACTIVITYCODE);
          }
        });
  }