示例#1
0
 private void loginoutQQ() {
   Tencent mTencent = Tencent.createInstance(ConstantS.TENCENT_APP_ID, getApplicationContext());
   if (mTencent != null && mTencent.isSessionValid()) {
     try {
       mTencent.logout(context);
     } catch (Exception e) {
       // TODO: handle exception
     }
   }
 }
示例#2
0
 public void shareToQzone(Activity activity, PandoraShareData shareData, IUiListener listener) {
   final Bundle params = new Bundle();
   params.putInt(QzoneShare.SHARE_TO_QZONE_KEY_TYPE, QzoneShare.SHARE_TO_QZONE_TYPE_IMAGE_TEXT);
   params.putString(QzoneShare.SHARE_TO_QQ_TITLE, shareData.mTitle);
   params.putString(QzoneShare.SHARE_TO_QQ_SUMMARY, shareData.mDesc);
   params.putString(QzoneShare.SHARE_TO_QQ_TARGET_URL, shareData.mWebUrl);
   ArrayList<String> imageUrls = new ArrayList<String>();
   imageUrls.add(shareData.mImageUrl);
   params.putStringArrayList(QzoneShare.SHARE_TO_QQ_IMAGE_URL, imageUrls);
   Tencent mTencent = Tencent.createInstance(QQ_APPID, activity);
   mTencent.shareToQzone(activity, params, listener);
 }
示例#3
0
 public void LoginQQ() {
   // 这里的APP_ID请换成你应用申请的APP_ID,我这里使用的是DEMO中官方提供的测试APP_ID 222222
   mAppid = 222222 + "";
   // 第一个参数就是上面所说的申请的APPID,第二个是全局的Context上下文,这句话实现了调用QQ登录
   mTencent = Tencent.createInstance(mAppid, getApplicationContext());
   /**
    * 通过这句代码,SDK实现了QQ的登录,这个方法有三个参数,第一个参数是context上下文,第二个参数SCOPO 是一个String类型的字符串,表示一些权限
    * 官方文档中的说明:应用需要获得哪些API的权限,由“,”分隔。例如:SCOPE = “get_user_info,add_t”;所有权限用“all”
    * 第三个参数,是一个事件监听器,IUiListener接口的实例,这里用的是该接口的实现类
    */
   mTencent.login(Activity_login.this, "all", new BaseUiListener());
 }
示例#4
0
  public void login(Context context) {

    // 第一个参数就是上面所说的申请的APPID,第二个是全局的Context上下文,这句话实现了调用QQ登录
    mTencent = Tencent.createInstance(ThirdpartyConstant.QQ_APP_ID, AppContext.getAppContext());

    /**
     * 通过这句代码,SDK实现了QQ的登录,这个方法有三个参数,第一个参数是context上下文,第二个参数SCOPO 是一个String类型的字符串,表示一些权限
     * 官方文档中的说明:应用需要获得哪些API的权限,由“,”分隔。例如:SCOPE = “get_user_info,add_t”;所有权限用“all”
     * 第三个参数,是一个事件监听器,IUiListener接口的实例,这里用的是该接口的实现类
     */
    if (!mTencent.isSessionValid()) {
      mTencent.login((Activity) context, "all", new BaseUiListener());
    }
  }
示例#5
0
  private void initView() {
    editor = sp.edit(); // 获取编辑器

    view1 = (PushSlideSwitchView) findViewById(R.id.push_set_warm_switchview1);
    // view2 = (PushSlideSwitchView)
    // findViewById(R.id.push_set_warm_switchview2);
    // view3 = (PushSlideSwitchView)
    // findViewById(R.id.push_set_warm_switchview3);

    cacheTxt = (TextView) findViewById(R.id.txt_setActivity_cache);
    logoutTxt = (TextView) findViewById(R.id.txt_setActivity_logout);
    nowTxt = (TextView) findViewById(R.id.txt_setActivity_nowVersion);
    backLayout = (LinearLayout) findViewById(R.id.layout_setActivity_back);
    opintionLayout = (LinearLayout) findViewById(R.id.layout_setActivity_opintion);
    introduceLayout = (LinearLayout) findViewById(R.id.layout_setActivity_introduce);
    clearCacheLayout = (LinearLayout) findViewById(R.id.layout_setActivity_clearCache);

    mTencent = Tencent.createInstance(ConstantsUtil.APP_ID_TX, this.getApplicationContext());
  }
示例#6
0
 private static Tencent doTencentRegister(Activity activity) {
   Tencent tencent = Tencent.createInstance(ShareConstant.QQ_APP_ID, activity);
   return tencent;
 }
示例#7
0
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.right, null);
    tencent = Tencent.createInstance("101006494", getActivity());
    setting = (RelativeLayout) view.findViewById(R.id.setting);
    update = (RelativeLayout) view.findViewById(R.id.update);
    share = (RelativeLayout) view.findViewById(R.id.share);
    suggestion = (RelativeLayout) view.findViewById(R.id.suggestion);
    about = (RelativeLayout) view.findViewById(R.id.about);
    more = (RelativeLayout) view.findViewById(R.id.more);
    quit = (RelativeLayout) view.findViewById(R.id.quit);
    mProgressDialog = new MPr(getActivity());

    setting.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            intent = new Intent(getActivity(), S.class);
            startActivity(intent);
          }
        });
    update.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            checkRefresh();
          }
        });
    share.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            final Bundle params = new Bundle();
            params.putString(Tencent.SHARE_TO_QQ_TITLE, "【饭小桶团队——QQ互联功能】");
            params.putString(
                Tencent.SHARE_TO_QQ_SUMMARY,
                "欢迎使用饭小桶软件,饭小桶——我们身边的订餐专家,更多信息请访问饭小桶官网:www.fanxiaotong.com——自饭小桶客户端");
            params.putString(Tencent.SHARE_TO_QQ_TARGET_URL, ConfigurationFiles.targetUrl);
            // 支持传多个imageUrl,传图片时使用
            ArrayList<String> imageUrls = new ArrayList<String>();
            params.putStringArrayList(Tencent.SHARE_TO_QQ_IMAGE_URL, imageUrls);
            tencent.shareToQzone(
                getActivity(),
                params,
                new IUiListener() {
                  @Override
                  public void onCancel() {
                    Ut.toastMessage(getActivity(), "onCancel: ");
                  }

                  @Override
                  public void onComplete(JSONObject response) {
                    // TODO Auto-generated method stub
                    Ut.toastMessage(getActivity(), "onComplete: " + response.toString());
                  }

                  @Override
                  public void onError(UiError e) {
                    // TODO Auto-generated method stub
                    Ut.toastMessage(getActivity(), "onComplete: " + e.errorMessage, "e");
                  }
                });
          }
        });
    suggestion.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            intent = new Intent(getActivity(), Sug.class);
            startActivity(intent);
          }
        });
    about.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            intent = new Intent(getActivity(), A.class);
            startActivity(intent);
          }
        });
    more.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            intent = new Intent(getActivity(), Sh.class);
            startActivity(intent);
          }
        });
    quit.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            getActivity().finish();
            System.exit(0);
          }
        });
    return view;
  }
  @Override
  public void treatClickEvent(int id) {
    super.treatClickEvent(id);
    switch (id) {
      case R.id.btn_back:
        finish();
        break;
      case R.id.layout_qq_login:
        mTencent = Tencent.createInstance(mApp.QQ_APP_ID, this);
        onClickLogin(mTencent);
        break;
      case R.id.layout_account:
        UMENG_MAP.clear();

        switchToAccountAct();
        break;
      case R.id.btn_submit:
        showCustomDialog(
            DIALOG_REMOVE_BIND,
            SharedPreferencesMgr.getString("logoutAlert", getString(R.string.unbind_phone_txt)),
            BaseGameActivity.TOW_BUTTONS,
            R.string.title_unbind_phone,
            R.string.cancel);
        break;
      case R.id.layout_phone:
        UMENG_MAP.clear();

        switchToPhoneBindAct();
        break;
      case R.id.layout_hupu:
        if ("".equals(SharedPreferencesMgr.getString("hupu_name", "")) || mToken == null) {
          Intent intent = new Intent(this, HupuUserLoginActivity.class);
          startActivityForResult(intent, REQ_GO_HUPU_LOGIN);
        }

        break;
      case R.id.btn_qq_bind:
        channel = 2;
        HupuLog.e("papa", "----bind_tencent");
        if (SharedPreferencesMgr.getInt("channel" + channel, 0) == 0) {
          mTencent = Tencent.createInstance(mApp.QQ_APP_ID, this.getApplicationContext());
          onClickLogin(mTencent);
        } else {
          showCustomDialog(
              DIALOG_UNBOUND,
              SharedPreferencesMgr.getString("unboundAlert", getString(R.string.unbind_phone_txt)),
              BaseGameActivity.TOW_BUTTONS,
              R.string.title_confirm,
              R.string.cancel);
        }
        break;
      case R.id.btn_phone_bind:
        channel = 1;
        if (SharedPreferencesMgr.getInt("channel" + channel, 0) == 0) {
          UMENG_MAP.clear();
          switchToPhoneBindAct();
        } else {
          //				showCustomDialog(DIALOG_UNBOUND,SharedPreferencesMgr.getString("unboundAlert",
          // getString(R.string.unbind_phone_txt)),
          //						BaseGameActivity.TOW_BUTTONS, R.string.title_confirm,
          //						R.string.cancel);

          Intent updateIntent = new Intent(this, CoinInfoActivity.class);
          updateIntent.putExtra("info_type", HuPuRes.REQ_METHOD_CHANGE_MOBILE);
          startActivity(updateIntent);
        }
        break;
    }
  }
示例#9
0
 public TencentQQHelper(Context context) {
   this.context = context;
   tencent = Tencent.createInstance(APP_ID, context.getApplicationContext());
 }