@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); switch (requestCode) { case SCANNIN_GREQUEST_CODE: if (resultCode == RESULT_OK) { Bundle bundle = data.getExtras(); Toast.makeText( MainActivity.this, "result=" + bundle.getString("result") + "", Toast.LENGTH_LONG) .show(); } break; } }
@Override protected void onDestroy() { super.onDestroy(); lm.removeUpdates(locationListener); }
@Override protected void onStart() { super.onStart(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); activity = this; setContentView(R.layout.activity_main); // startService(new Intent(MainActivity.this,GpsActivity.class)); UpdateManager.getUpdateManager().checkAppUpdate(this, false); // 检查是否更新 // mTextView = (TextView) findViewById(R.id.result); // mImageView = (ImageView) findViewById(R.id.qrcode_bitmap); ImageView install = (ImageView) findViewById(R.id.install_image); // 设置按钮 Button img = (Button) findViewById(R.id.code_image); img.setOnClickListener( new OnClickListener() { @Override public void onClick(View arg0) { Intent intent = new Intent(); intent.setClass(MainActivity.this, MipcaActivityCapture.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivityForResult(intent, SCANNIN_GREQUEST_CODE); } }); install.setOnClickListener( new OnClickListener() { @Override public void onClick(View arg0) { Intent intent = new Intent(activity, MoreAct.class); activity.startActivity(intent); } }); CircleLayout circleMenu = (CircleLayout) findViewById(R.id.main_circle_layout); TextView selectedTextView = (TextView) findViewById(R.id.main_selected_textView); selectedTextView.setText(((CircleImageView) circleMenu.getSelectedItem()).getName()); supply = (CircleImageView) circleMenu.findViewById(R.id.supply_image); project = (CircleImageView) circleMenu.findViewById(R.id.project_image); supply.setOnClickListener( new OnClickListener() { @Override public void onClick(View arg0) { if (!PermissHelp.isPermiss("001")) { PermissHelp.showToast(activity); return; } provenance = "supply"; Intent intent = new Intent(MainActivity.this, SupplyMenuActivity.class); intent.putExtra("tables", tables); MainActivity.this.startActivity(intent); } }); project.setOnClickListener( new OnClickListener() { @Override public void onClick(View arg0) { if (!PermissHelp.isPermiss("002")) { PermissHelp.showToast(activity); return; } provenance = "scene"; Intent intent = new Intent(MainActivity.this, SceneMenuActivity.class); MainActivity.this.startActivity(intent); } }); online = (CircleImageView) circleMenu.findViewById(R.id.online_image); // 在线统计 online.setOnClickListener( new OnClickListener() { @Override public void onClick(View arg0) { if (!PermissHelp.isPermiss("029")) { PermissHelp.showToast(activity); return; } provenance = "statistics"; Intent intent = new Intent(); intent.setClass(MainActivity.this, DoStatisticsAct.class); MainActivity.this.startActivity(intent); } }); move_contract = (CircleImageView) circleMenu.findViewById(R.id.move_contract); // 特高压项目管理 move_contract.setOnClickListener( new OnClickListener() { @Override public void onClick(View arg0) { if (!PermissHelp.isPermiss("032")) { PermissHelp.showToast(activity); return; } provenance = "contract"; Intent intent = new Intent(); intent.setClass(MainActivity.this, ContractMenuActivity.class); MainActivity.this.startActivity(intent); } }); move_office = (CircleImageView) circleMenu.findViewById(R.id.move_office); // 日常办公 move_office.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View arg0) { if (!PermissHelp.isPermiss("030")) { PermissHelp.showToast(activity); return; } Intent intent = new Intent(); intent.putExtra("office", office); intent.setClass(MainActivity.this, DailyMenuActivity.class); MainActivity.this.startActivity(intent); } }); approval = (CircleImageView) circleMenu.findViewById(R.id.move_approval); // 移动审批 approval.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View arg0) { if (!PermissHelp.isPermiss("031")) { PermissHelp.showToast(activity); return; } // Toast.makeText(activity, "没有权限", Toast.LENGTH_LONG).show(); Intent intent = new Intent(); intent.putExtra("move", move); intent.setClass(MainActivity.this, MovedMenuActivity.class); MainActivity.this.startActivity(intent); } }); conference = (CircleImageView) circleMenu.findViewById(R.id.conference_image); // 视频会议 conference.setOnClickListener( new OnClickListener() { @Override public void onClick(View arg0) { if (!PermissHelp.isPermiss("039")) { PermissHelp.showToast(activity); return; } if (appContext.user == null) { Toast.makeText(activity, "获取用户信息失败!", Toast.LENGTH_LONG).show(); return; } ComponentName apk2Component1 = new ComponentName( "com.fastonz.fastmeeting", "com.fastonz.fastmeeting.ui.StartTheMiddleTierActivity"); pm = activity.getPackageManager(); Intent mIntent = new Intent(); Bundle mBundle = new Bundle(); mBundle.putString("userName", appContext.user.getFace()); mBundle.putString("userPwd", appContext.user.getPwd()); mIntent.putExtras(mBundle); mIntent.setComponent(apk2Component1); activities = pm.queryIntentActivities(mIntent, PackageManager.MATCH_DEFAULT_ONLY); if (activities == null || activities.size() < 1) { showApprovaDialog(); return; } startActivity(mIntent); } }); final int POSITION_TOP_LEFT = 1; banner_lay = (LinearLayout) findViewById(R.id.banner_lay); // 通知公告警告消息条幅 warnning_lay = (LinearLayout) findViewById(R.id.warnning_lay); // 通知公告消息条幅 bv_review = new BadgeView(this, warnning_lay); bv_review.setBackgroundResource(R.drawable.widget_count_bg); bv_review.setIncludeFontPadding(false); bv_review.setGravity(Gravity.CENTER); bv_review.setTextSize(8f); bv_review.setTextColor(Color.WHITE); bv_review.setBadgePosition(POSITION_TOP_LEFT); warnning_lay.setOnClickListener( new OnClickListener() { @Override public void onClick(View arg0) { Intent intent = new Intent(); intent.putExtra("tag", "0"); intent.setClass(MainActivity.this, DailyActivity.class); MainActivity.this.startActivity(intent); warnning_lay.setVisibility(View.GONE); bv_review.setVisibility(View.GONE); banner_lay.setVisibility(View.GONE); } }); banners_text = (TextView) findViewById(R.id.banners_text); banners_content = (TextView) findViewById(R.id.banners_content); // getServiceConnect(mHandler);// AIDL 方式获取 功能权限 /** ********* 测试 ******** */ reqPermission(); // gps定位 getGps(); }