Example #1
0
 @Override
 public void onClick(View v) {
   switch (v.getId()) {
     case R.id.ll_back:
       this.finish();
       break;
     case R.id.tv_ensure:
       UIHandler.sendEmptyMessage(MSG_SHOW_TOAST, SignupPage.this);
       break;
     case R.id.rl_icon:
       // showChangeIconDialog();
       getPicture();
       break;
     case R.id.rl_name:
       showChangeInfo(ChangeUserType.USER_NAME);
       break;
     case R.id.rl_gender:
       showGerderDialog();
       break;
     case R.id.rl_note:
       showChangeInfo(ChangeUserType.USER_NOTE);
       break;
     case R.id.iv_user_icon:
       PicViewer pv = new PicViewer();
       pv.setImagePath(userInfo.getUserIcon());
       pv.show(activity, null);
       break;
     default:
       break;
   }
 }
 @Override
 public void onShare(Platform platform, ShareParams paramsToShare) {
   if (onShareCallback != null) {
     Message msg = new Message();
     msg.what = onShareWhat;
     msg.obj = new Object[] {platform, paramsToShare};
     UIHandler.sendMessage(msg, onShareCallback);
   }
 }
Example #3
0
  /** display platform list */
  public void afterPlatformListGot() {
    int size = platformList == null ? 0 : platformList.length;
    views = new View[size];

    final int dp_24 = dipToPx(getContext(), 24);
    LayoutParams lpItem = new LayoutParams(dp_24, dp_24);
    final int dp_9 = dipToPx(getContext(), 9);
    lpItem.setMargins(0, 0, dp_9, 0);
    FrameLayout.LayoutParams lpMask =
        new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    lpMask.gravity = Gravity.LEFT | Gravity.TOP;
    int selection = 0;
    for (int i = 0; i < size; i++) {
      FrameLayout fl = new FrameLayout(getContext());
      fl.setLayoutParams(lpItem);
      if (i >= size - 1) {
        fl.setLayoutParams(new LayoutParams(dp_24, dp_24));
      }
      llPlat.addView(fl);
      fl.setOnClickListener(this);

      ImageView iv = new ImageView(getContext());
      iv.setScaleType(ScaleType.CENTER_INSIDE);
      iv.setImageBitmap(getPlatLogo(platformList[i]));
      iv.setLayoutParams(
          new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
      fl.addView(iv);

      views[i] = new View(getContext());
      views[i].setBackgroundColor(0xcfffffff);
      views[i].setOnClickListener(this);
      String platformName = platformList[i].getName();
      for (Platform plat : platforms) {
        if (platformName.equals(plat.getName())) {
          views[i].setVisibility(View.INVISIBLE);
          selection = i;
        }
      }
      views[i].setLayoutParams(lpMask);
      fl.addView(views[i]);
    }

    final int postSel = selection;
    UIHandler.sendEmptyMessageDelayed(
        0,
        333,
        new Callback() {
          public boolean handleMessage(Message msg) {
            HorizontalScrollView hsv = (HorizontalScrollView) llPlat.getParent();
            hsv.scrollTo(postSel * (dp_24 + dp_9), 0);
            return false;
          }
        });
  }
 public void onCancel(Platform platform, int action) {
   if (ShareSDKUtils.DEBUG) {
     System.out.println("onCancel");
   }
   HashMap<String, Object> map = new HashMap<String, Object>();
   map.put("platform", ShareSDK.platformNameToId(platform.getName()));
   map.put("action", action);
   map.put("status", 3); // Success = 1, Fail = 2, Cancel = 3
   map.put("reqID", reqID);
   Message msg = new Message();
   msg.obj = new Hashon().fromHashMap(map);
   UIHandler.sendMessage(msg, c2dCallback);
 }
 public void onComplete(Platform platform, int action, HashMap<String, Object> res) {
   if (ShareSDKUtils.DEBUG) {
     System.out.println("onComplete");
     System.out.println(res == null ? "" : res.toString());
   }
   HashMap<String, Object> map = new HashMap<String, Object>();
   map.put("platform", ShareSDK.platformNameToId(platform.getName()));
   map.put("action", action);
   map.put("status", 1); // Success = 1, Fail = 2, Cancel = 3
   if (action == 8 || action == 2) {
     // action = 2, 8, 获取用户列表与用户信息才放入
     map.put("res", res);
   }
   map.put("reqID", reqID);
   Message msg = new Message();
   msg.obj = new Hashon().fromHashMap(map);
   UIHandler.sendMessage(msg, c2dCallback);
 }