Пример #1
1
  private void holdIntent(Intent intent) {
    if (intent == null) {
      finishAfterDone(0);
      return;
    }
    PlatformManager.getInstance().onHandleNewIntent(this, intent);

    final String action = intent.getAction();
    final int platform = intent.getIntExtra(EXTRA_PLATFORM, -1);
    final boolean onlyWeixin = intent.getBooleanExtra(EXTRA_ONLY_WEIXIN, false);
    final CharSequence title = intent.getCharSequenceExtra(EXTRA_TITLE);
    final Serializable extra = intent.getSerializableExtra(EXTRA_DATA);

    if (extra instanceof ShareState) {
      Pattern pattern = Pattern.compile("★");
      Matcher matcher = pattern.matcher(title);
      if (matcher.find()) {
        ((SpannableString) title)
            .setSpan(
                new ImageSpan(getContext(), R.drawable.app_ic_red_packet),
                matcher.start(),
                matcher.end(),
                Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
      }
    }
    isToBinded = intent.getBooleanExtra(EXTRA_TO_BIND, false);
    if (ACTION_SHARE.equals(action)) {
      final ShareDialog shareDialog;
      if (Build.BRAND.equals("vivo")) {
        shareDialog = new ShareDialog(this, title, onlyWeixin, null);
      } else {
        shareDialog = new ShareDialog(this, title, onlyWeixin);
      }
      shareDialog.setAlarmListener(
          new IAlarm.AlarmListener() {
            @Override
            public void onShow(IAlarm alarm) {}

            @Override
            public void onDismiss(IAlarm alarm) {}

            @Override
            public void onCancel(IAlarm alarm) {
              finishAfterDone(0);
            }
          });
      shareDialog.setOnPositionClickListener(
          new ShareDialog.OnPositionClickListener() {
            @Override
            public void onClick(int platformType) {
              showLoading();
              prepareData(platformType, extra);
            }
          });
      shareDialog.show();
    } else if (ACTION_LOGIN.equals(action)) {
      showLoading();
      PlatformManager.getInstance().bind(getContext(), platform, PlatformActivity.this);
    }
  }
Пример #2
0
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   super.onActivityResult(requestCode, resultCode, data);
   PlatformManager.getInstance().onHandleActivityResult(this, requestCode, resultCode, data);
 }