Esempio n. 1
0
 private void setupUserGuide() {
   final FrameLayoutUserInfo userInfoView = myContext.userDataListView.getCenterView();
   final View view = userInfoView.getGuideView();
   view.setVisibility(View.VISIBLE);
   userGuide =
       new UserGuide(myContext, "性 别", "筛选帅哥或美女", Gravity.LEFT, Overlay.Style.Circle, "#33CC99");
   userGuide.addAnotherGuideArea(
       myContext.findViewById(R.id.lj_map_male_female_layout),
       userInfoView.getNickNameView(),
       false,
       "临 近 用 户",
       "滑动查看其他用户信息",
       Gravity.TOP,
       Gravity.CENTER,
       "#FF9900");
   userGuide.addAnotherGuideArea(
       userInfoView.getNickNameView(),
       userInfoView.getGameTypeTextView(),
       false,
       "解 密 游 戏",
       "对方设置的游戏类型",
       Gravity.TOP | Gravity.RIGHT,
       Gravity.CENTER,
       "#1E90FF");
   userGuide.addAnotherGuideArea(
       userInfoView.getGameTypeTextView(),
       view,
       true,
       "GO!",
       "开启探索之旅",
       Gravity.TOP | Gravity.LEFT,
       Gravity.CENTER,
       "#FF6666");
   //		userGuide = new UserGuide(myContext, "临 近 好 友", "左右滑动查看用户信息", Gravity.TOP,
   // Overlay.Style.Circle, "#33CC99");
   //		userGuide.addAnotherGuideArea(userInfoView.getNickNameView(),
   // userInfoView.getGameTypeTextView(), false, "解 密 游 戏", "游戏类型", Gravity.TOP | Gravity.RIGHT,
   // Gravity.CENTER, "#FF9900");
   //		userGuide.addAnotherGuideArea(userInfoView.getGameTypeTextView(),
   // myContext.findViewById(R.id.lj_map_male_female_layout), true, "性 别 筛 选", "显示指定性别的用户",
   // Gravity.LEFT, Gravity.CENTER, "#FF9900");
   userInfoView.getBeginGameTextView().setEnabled(false);
   userGuide.beginWith(
       myContext.findViewById(R.id.lj_map_male_female_layout),
       false,
       new GuideComplete() {
         @Override
         public void onUserGuideCompleted() {
           //		initListener();
           view.setVisibility(View.GONE);
           myContext.gFemaleSelect.setOnClickListener(gSexClickListener);
           myContext.gMaleSelect.setOnClickListener(gSexClickListener);
           userInfoView.getBeginGameTextView().setEnabled(true);
           UserGuide.disableUserGuide(UserGuide.MAP_ACTIVITY);
         }
       });
 }
Esempio n. 2
0
 @Override
 public void handleMessage(Message msg) {
   super.handleMessage(msg);
   switch (msg.what) {
     case ConstantValues.InstructionCode.ERROR_NETWORK:
       Toast.makeText(myContext, "网络连接失败", Toast.LENGTH_LONG).show();
       break;
     case ConstantValues.InstructionCode.SHAKE_HANDLER_USER_GAME_NOT_SET:
       Toast.makeText(myContext, "请先设置自己的解密游戏设置", Toast.LENGTH_LONG).show();
       break;
     case ConstantValues.InstructionCode.HANDLER_WAIT_FOR_DATA:
       myContext.sensorManager.unregisterListener(myContext.shakelistener);
       myContext.locationClient.start();
       break;
     case ConstantValues.InstructionCode.HANDLER_SUCCESS_GET_DATA:
       gUserShakeDataList = (ArrayList<UserShakeData>) msg.obj;
       if (gUserShakeDataList.size() == 1) {
         Toast.makeText(myContext, "很抱歉您的附近没有其他用户。", Toast.LENGTH_SHORT).show();
         return;
       }
       myContext.gShakeBall.startZoominAnimation();
       break;
     case ConstantValues.InstructionCode.SHAKE_HANDLER_MAP_SHOW:
       myContext.gShakeBall.setVisibility(View.GONE);
       myContext.gShakeBallLayout.setVisibility(View.GONE);
       myContext.mapView.setVisibility(View.VISIBLE);
       myContext.userDataListView.setVisibility(View.VISIBLE);
       myContext.userDataListView.bringToFront();
       myContext.gFemaleSelect.bringToFront();
       myContext.gMaleSelect.bringToFront();
       myContext.findViewById(R.id.lj_map_linear).bringToFront();
       myContext.findViewById(R.id.lj_map_male_female_layout).bringToFront();
       myContext.findViewById(R.id.lj_map_male_female_layout).setVisibility(View.VISIBLE);
       locateUsers(gUserShakeDataList);
       initUserShakeData();
       if (UserGuide.isNeedUserGuide(myContext, UserGuide.MAP_ACTIVITY)) setupUserGuide();
       else {
         myContext.gFemaleSelect.setOnClickListener(gSexClickListener);
         myContext.gMaleSelect.setOnClickListener(gSexClickListener);
       }
       break;
     case ConstantValues.InstructionCode.SHAKE_HANDLER_SHAKE_SENSOR:
       myContext.sensorManager.unregisterListener(myContext.shakelistener);
       myContext.vibrator.vibrate(ConstantValues.InstructionCode.VIBRATE_TIME);
       float[] values = (float[]) msg.obj;
       float x = values[0];
       float y = values[1];
       float z = values[2];
       myContext.gShakeBall.setRotateAnimation(Math.abs((int) (10000 / z * 2)));
       myContext.gShakeBall.setVelocity((int) (x * 1.5), (int) (y * 1.5));
       myContext.gShakeBall.setStartRotate(true);
       break;
     case ConstantValues.InstructionCode.SHAKE_HANDLER_MARKER_CLICK:
       Marker marker = (Marker) msg.obj;
       Bundle data = marker.getExtraInfo();
       if (data == null) return;
       int index = data.getInt("index");
       myContext.userDataListView.setDataOfIndex(index);
       UserShakeData userShakeData = null; // gUserShakeDataList.get(indexs);
       if (gSexStatus == SEX_MALE) userShakeData = gUserShakeDataListMale.get(index);
       else if (gSexStatus == SEX_FEMALE) userShakeData = gUserShakeDataListFemale.get(index);
       else userShakeData = gUserShakeDataList.get(index);
       LatLng cenpt = new LatLng(userShakeData.getLatitude(), userShakeData.getLongitude());
       locatePotin(cenpt);
       break;
     case ConstantValues.InstructionCode.SHAKE_HANDLER_GAME:
       int id = msg.arg1;
       int type = msg.arg2;
       Intent intent = new Intent();
       switch (type) {
         case 1:
           intent.setClass(myContext, ActivityEightPuzzleGame.class);
           intent.putExtra("userID", id);
           intent.putExtra("nickname", msg.obj.toString());
           break;
         case 2:
           intent.setClass(myContext, ActivitySongPuzzle.class);
           intent.putExtra("userID", id);
           break;
         case 3:
           if (!CommonUtil.isSdkVersionValid()) {
             Toast.makeText(myContext, "此游戏类型暂时仅对Android 4.4及以上用户开放", Toast.LENGTH_SHORT).show();
             return;
           }
           intent.setClass(myContext, ActivityBazingaBall.class);
           intent.putExtra("userID", id);
           break;
       }
       myContext.startActivityForResult(intent, ActivityShake.REQUEST_CODE_BEGINGAME);
       break;
     case ConstantValues.InstructionCode.SHAKE_HANDLER_CHANGE_MARK:
       int indexs = msg.arg1;
       UserShakeData userShakeDatas = null; // gUserShakeDataList.get(indexs);
       if (gSexStatus == SEX_MALE) userShakeDatas = gUserShakeDataListMale.get(indexs);
       else if (gSexStatus == SEX_FEMALE) userShakeDatas = gUserShakeDataListFemale.get(indexs);
       else userShakeDatas = gUserShakeDataList.get(indexs);
       LatLng cenpts = new LatLng(userShakeDatas.getLatitude(), userShakeDatas.getLongitude());
       locatePotin(cenpts);
       break;
     case ConstantValues.InstructionCode.SHAKE_HANDLER_COLLISION:
       myContext.vibrator.vibrate(ConstantValues.InstructionCode.VIBRATE_TIME);
       break;
   }
 }