예제 #1
0
 @Override
 public void onClick(View v) {
   switch (v.getId()) {
     case R.id.btn_sina_login: // 新浪微博登录
       Platform sina = ShareSDK.getPlatform(SinaWeibo.NAME);
       ShareSDKUtil.login(sina, mPaListener);
       break;
     case R.id.btn_tencent_login: // 腾讯微博登录
       Platform tencentWb = ShareSDK.getPlatform(TencentWeibo.NAME);
       ShareSDKUtil.login(tencentWb, mPaListener);
       break;
     default:
       finish();
   }
 }
  private void testShare() {
    ShareSDK.initSDK(this);
    OnekeyShare oks = new OnekeyShare();
    // 关闭sso授权
    oks.disableSSOWhenAuthorize();

    // 分享时Notification的图标和文字
    oks.setNotification(R.drawable.icon, getString(R.string.app_name));
    // title标题,印象笔记、邮箱、信息、微信、人人网和QQ空间使用
    oks.setTitle(getString(R.string.share));
    // titleUrl是标题的网络链接,仅在人人网和QQ空间使用
    oks.setTitleUrl("http://sharesdk.cn");
    // text是分享文本,所有平台都需要这个字段
    oks.setText(getResources().getString(R.string.app_name) + "征婚交友App,助依然守候的你在茫茫人海中找到相守一生对的那个Ta");
    // imagePath是图片的本地路径,Linked-In以外的平台都支持此参数
    oks.setImagePath(
        Environment.getExternalStorageDirectory().getAbsolutePath()
            + "/test.png"); // 确保SDcard下面存在此张图片
    // url仅在微信(包括好友和朋友圈)中使用
    oks.setUrl("http://himi.me");
    // comment是我对这条分享的评论,仅在人人网和QQ空间使用
    oks.setComment(getResources().getString(R.string.app_name) + ",助依然守候的你在茫茫人海中找到相守一生对的那个Ta");
    // site是分享此内容的网站名称,仅在QQ空间使用
    oks.setSite(getString(R.string.app_name));
    // siteUrl是分享此内容的网站地址,仅在QQ空间使用
    oks.setSiteUrl("http://himi.me");

    // 启动分享GUI
    oks.show(this);
  }
  private void showShare() {
    ShareSDK.initSDK(this);
    OnekeyShare oks = new OnekeyShare();
    // 关闭sso授权
    oks.disableSSOWhenAuthorize();

    // 分享时Notification的图标和文字
    oks.setNotification(R.drawable.ic_launcher, getString(R.string.app_name));
    // title标题,印象笔记、邮箱、信息、微信、人人网和QQ空间使用
    oks.setTitle(getString(R.string.share));
    // titleUrl是标题的网络链接,仅在人人网和QQ空间使用
    oks.setTitleUrl(url);
    // text是分享文本,所有平台都需要这个字段
    oks.setText(detail + url);
    // imagePath是图片的本地路径,Linked-In以外的平台都支持此参数
    // oks.setImagePath(Environment.getExternalStorageDirectory()
    // .getAbsolutePath() + File.separator + "QRCode.jpg");
    oks.setImageUrl(baseURL + image);
    // url仅在微信(包括好友和朋友圈)中使用
    oks.setUrl(url);
    // comment是我对这条分享的评论,仅在人人网和QQ空间使用
    // oks.setComment("我是测试评论文本");
    // site是分享此内容的网站名称,仅在QQ空间使用
    oks.setSite("展恒基金网");
    // siteUrl是分享此内容的网站地址,仅在QQ空间使用
    oks.setSiteUrl(url);

    // 启动分享GUI
    oks.show(this);
  }
예제 #4
0
 private void refreshExit(String result) {
   EMChatManager.getInstance().logout();
   ShareSDK.stopSDK(this);
   Intent intent = new Intent(this, IfanService.class);
   stopService(intent);
   android.os.Process.killProcess(android.os.Process.myPid());
 }
예제 #5
0
  private void showShare() {
    ShareSDK.initSDK(this);
    OnekeyShare oks = new OnekeyShare();
    // 关闭sso授权
    oks.disableSSOWhenAuthorize();

    // title标题:微信、QQ(新浪微博不需要标题)
    String title = mNote.getTitle();
    oks.setTitle(title); // 最多30个字符

    // text是分享文本:所有平台都需要这个字段
    String content = mNote.getContent();
    oks.setText(content); // 最多40个字符

    // imagePath是图片的本地路径:除Linked-In以外的平台都支持此参数
    // oks.setImagePath(Environment.getExternalStorageDirectory() + "/meinv.jpg");//确保SDcard下面存在此张图片
    String imagePath = mNote.getImagePath();
    if (!TextUtils.isEmpty(imagePath)) {
      String rawImagePath = Uri.parse(imagePath).getPath();
      oks.setImagePath(rawImagePath);
    }

    // 网络图片的url:所有平台
    // oks.setImageUrl("http://7sby7r.com1.z0.glb.clouddn.com/CYSJ_02.jpg");//网络图片rul

    // url:仅在微信(包括好友和朋友圈)中使用
    //        oks.setUrl("http://sharesdk.cn");   //网友点进链接后,可以看到分享的详情

    // Url:仅在QQ空间使用
    //        oks.setTitleUrl("http://www.baidu.com");  //网友点进链接后,可以看到分享的详情

    // 启动分享GUI
    oks.show(this);
  }
예제 #6
0
  private void showShare(String url, String title) {
    ShareSDK.initSDK(this);
    OnekeyShare oks = new OnekeyShare();
    // 关闭sso授权
    oks.disableSSOWhenAuthorize();

    // 分享时Notification的图标和文字  2.5.9以后的版本不调用此方法
    // oks.setNotification(R.drawable.ic_launcher, getString(R.string.app_name));
    // title标题,印象笔记、邮箱、信息、微信、人人网和QQ空间使用
    oks.setTitle(title);
    // titleUrl是标题的网络链接,仅在人人网和QQ空间使用
    oks.setTitleUrl(url);
    // text是分享文本,所有平台都需要这个字段
    oks.setText(title + " : " + url + "\n通过" + this.getString(R.string.design) + "发布");
    // imagePath是图片的本地路径,Linked-In以外的平台都支持此参数
    // oks.setImagePath("/sdcard/test.jpg");//确保SDcard下面存在此张图片
    // url仅在微信(包括好友和朋友圈)中使用
    oks.setImageUrl(url);
    oks.setUrl(url);
    // comment是我对这条分享的评论,仅在人人网和QQ空间使用
    oks.setComment("测试GankIO Design By Han");
    // site是分享此内容的网站名称,仅在QQ空间使用
    oks.setSite(getString(R.string.app_name));
    // siteUrl是分享此内容的网站地址,仅在QQ空间使用
    oks.setSiteUrl(url);

    // 启动分享GUI
    oks.show(this);
  }
예제 #7
0
  /** shareSDK分享 */
  private void showShare() {
    ShareSDK.initSDK(BaseApplication.getContext());
    OnekeyShare oks = new OnekeyShare();
    // 关闭sso授权
    oks.disableSSOWhenAuthorize();

    // 分享时Notification的图标和文字
    oks.setNotification(
        R.drawable.logo_luache, BaseApplication.getContext().getString(R.string.app_name));
    // title标题,印象笔记、邮箱、信息、微信、人人网和QQ空间使用
    oks.setTitle(BaseApplication.getContext().getString(R.string.share));
    // titleUrl是标题的网络链接,仅在人人网和QQ空间使用
    oks.setTitleUrl("http://a.app.qq.com/o/simple.jsp?pkgname=com.rongdai");
    // text是分享文本,所有平台都需要这个字段
    oks.setText("http://a.app.qq.com/o/simple.jsp?pkgname=com.rongdai");
    // imagePath是图片的本地路径,Linked-In以外的平台都支持此参数
    oks.setImagePath("/sdcard/test.jpg"); // 确保SDcard下面存在此张图片
    // url仅在微信(包括好友和朋友圈)中使用
    oks.setUrl("http://a.app.qq.com/o/simple.jsp?pkgname=com.rongdai");
    // comment是我对这条分享的评论,仅在人人网和QQ空间使用
    oks.setComment("我是测试评论文本");
    // site是分享此内容的网站名称,仅在QQ空间使用
    oks.setSite(BaseApplication.getContext().getString(R.string.app_name));
    // siteUrl是分享此内容的网站地址,仅在QQ空间使用
    oks.setSiteUrl("http://a.app.qq.com/o/simple.jsp?pkgname=com.rongdai");

    // 启动分享GUI
    oks.show(BaseApplication.getContext());
  }
  public boolean onFinish() {
    if (finishing) {
      return super.onFinish();
    }

    if (animHide == null) {
      finishing = true;
      super.finish();
      return super.onFinish();
    }

    // 取消分享菜单的统计
    if (canceled) {
      ShareSDK.logDemoEvent(2, null);
    }
    finishing = true;
    animHide.setAnimationListener(
        new AnimationListener() {
          public void onAnimationStart(Animation animation) {}

          public void onAnimationRepeat(Animation animation) {}

          public void onAnimationEnd(Animation animation) {
            flPage.setVisibility(View.GONE);
            OnekeyShare.super.finish();
          }
        });
    flPage.clearAnimation();
    flPage.startAnimation(animHide);
    return super.onFinish();
  }
예제 #9
0
  @SuppressWarnings("unchecked")
  public boolean handleMessage(Message msg) {
    dismissDialog();
    switch (msg.what) {
      case MSG_AUTH_CANCEL:
        {
          // 取消授权
          Toast.makeText(this, R.string.auth_cancel, Toast.LENGTH_SHORT).show();
        }
        break;
      case MSG_AUTH_ERROR:
        {
          // 授权失败
          Toast.makeText(this, R.string.auth_error, Toast.LENGTH_SHORT).show();
        }
        break;
      case MSG_AUTH_COMPLETE:
        {
          // 授权成功
          Toast.makeText(this, R.string.auth_complete, Toast.LENGTH_SHORT).show();
          Object[] objs = (Object[]) msg.obj;
          String platform = (String) objs[0];

          Platform plat = ShareSDK.getPlatform(platform);
          userid = plat.getDb().getUserId();
          username = plat.getDb().getUserName();
          //                edtUsername.setText(usericon);
          presenter.otherSigin(username, userid, usericon, layWx);
        }
        break;
    }
    return false;
  }
예제 #10
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.login_activity);
   //        初始化ShareSDK
   ShareSDK.initSDK(this);
 }
  private void showShare() {
    ShareSDK.initSDK(this);
    OnekeyShare oks = new OnekeyShare();
    // 关闭sso授权
    oks.disableSSOWhenAuthorize();

    // 分享时Notification的图标和文字 2.5.9以后的版本不调用此方法
    // oks.setNotification(R.drawable.ic_launcher,
    // getString(R.string.app_name));
    // title标题,印象笔记、邮箱、信息、微信、人人网和QQ空间使用
    oks.setTitle(getString(R.string.share));
    // titleUrl是标题的网络链接,仅在人人网和QQ空间使用
    oks.setTitleUrl("http://sharesdk.cn");
    // text是分享文本,所有平台都需要这个字段
    oks.setText("我是分享文本");
    // imagePath是图片的本地路径,Linked-In以外的平台都支持此参数
    oks.setImagePath("/sdcard/test.jpg"); // 确保SDcard下面存在此张图片
    // url仅在微信(包括好友和朋友圈)中使用
    oks.setUrl("http://sharesdk.cn");
    // comment是我对这条分享的评论,仅在人人网和QQ空间使用
    oks.setComment("我是测试评论文本");
    // site是分享此内容的网站名称,仅在QQ空间使用
    oks.setSite(getString(R.string.app_name));
    // siteUrl是分享此内容的网站地址,仅在QQ空间使用
    oks.setSiteUrl("http://sharesdk.cn");

    // 启动分享GUI
    oks.show(this);
  }
  /**
   * 分享
   *
   * @param title 标题
   * @param transmiturl 链接
   * @param imagepath 图片路径
   * @param audioId 音频ID
   */
  private void showShare(String title, String musicUrl, String imagepath, final String audioId) {
    String url =
        con.getResources().getString(R.string.server_url)
            + "UpdateShareHdreplayCountByHdreplayid&hdreplayid="
            + audioId
            + "&voicepath="
            + musicUrl;
    SharedPreferences sp_user = con.getSharedPreferences("USER", Context.MODE_PRIVATE);
    final String uid = sp_user.getString("uuid", null);
    ShareSDK.initSDK(con);
    OnekeyShare oks = new OnekeyShare();
    oks.setTitle(title);
    oks.setText("来自畅驾App分享");
    oks.setMusicUrl(url);
    oks.setUrl(url);
    oks.setTitleUrl(url);
    if (!imagepath.isEmpty()) {
      oks.setImageUrl(imagepath);
    } else {
      oks.setImageUrl(con.getResources().getString(R.string.qrcode_url));
    }
    oks.setCallback(
        new PlatformActionListener() {

          @Override
          public void onError(Platform platform, int arg1, Throwable arg2) {
            Toast.makeText(con, "分享失败", Toast.LENGTH_SHORT).show();
          }

          @Override
          public void onComplete(Platform platform, int arg1, HashMap<String, Object> arg2) {

            final String plat = platform.toString();
            new Thread() {
              public void run() {
                // "5" 表示为 音频分享
                ShareCountUtil.ShareCount(
                    con.getResources().getString(R.string.api_url),
                    uid,
                    audioId,
                    "5",
                    plat,
                    "113.129151,23.024514");
              }
            }.start();
          }

          @Override
          public void onCancel(Platform platform, int arg1) {
            Toast.makeText(con, "取消分享", Toast.LENGTH_SHORT).show();
          }
        });
    // 启动分享GUI
    oks.show(con);
  }
  /** 显示平台列表 */
  public void afterPlatformListGot() {
    String name = String.valueOf(reqData.get("platform"));
    int size = platformList == null ? 0 : platformList.length;
    views = new View[size];

    final int dp_24 = dipToPx(getContext(), 24);
    LinearLayout.LayoutParams lpItem = new LinearLayout.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 LinearLayout.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);
      if (name != null && name.equals(platformList[i].getName())) {
        views[i].setVisibility(View.INVISIBLE);
        selection = i;

        // 编辑分享内容的统计
        ShareSDK.logDemoEvent(3, platformList[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;
          }
        });
  }
예제 #14
0
  /** 判断指定平台是否使用客户端分享 */
  public static boolean isUseClientToShare(String platform) {
    if ("Wechat".equals(platform)
        || "WechatMoments".equals(platform)
        || "WechatFavorite".equals(platform)
        || "ShortMessage".equals(platform)
        || "Email".equals(platform)
        || "GooglePlus".equals(platform)
        || "QQ".equals(platform)
        || "Pinterest".equals(platform)
        || "Instagram".equals(platform)
        || "Yixin".equals(platform)
        || "YixinMoments".equals(platform)
        || "QZone".equals(platform)
        || "Mingdao".equals(platform)
        || "Line".equals(platform)
        || "KakaoStory".equals(platform)
        || "KakaoTalk".equals(platform)
        || "Bluetooth".equals(platform)
        || "WhatsApp".equals(platform)
        || "BaiduTieba".equals(platform)
        || "Laiwang".equals(platform)
        || "LaiwangMoments".equals(platform)) {
      return true;
    } else if ("Evernote".equals(platform)) {
      Platform plat = ShareSDK.getPlatform(platform);
      if ("true".equals(plat.getDevinfo("ShareByAppClient"))) {
        return true;
      }
    } else if ("SinaWeibo".equals(platform)) {
      Platform plat = ShareSDK.getPlatform(platform);
      if ("true".equals(plat.getDevinfo("ShareByAppClient"))) {
        Intent test = new Intent(Intent.ACTION_SEND);
        test.setPackage("com.sina.weibo");
        test.setType("image/*");
        ResolveInfo ri = plat.getContext().getPackageManager().resolveActivity(test, 0);
        return (ri != null);
      }
    }

    return false;
  }
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.setContentView(R.layout.fd_common_note_detail);
    ShareSDK.initSDK(this);

    Bundle bundle = getIntent().getExtras();
    if (bundle != null && bundle.containsKey(FD_NOTE_DETAIL_KEY)) {
      favoriteNote = bundle.getParcelable(FD_NOTE_DETAIL_KEY);
    }

    initFavoriteNoteDetailView();
  }
예제 #16
0
 //    点击事件的实现
 public void loginOperate(View view) {
   if (view != null) {
     int id = view.getId();
     switch (id) {
         //                回退按键退出当前的Activity
       case R.id.login_back:
         finish();
         break;
         //                登录按键
       case R.id.login_button:
         break;
         //                忘记密码处理
       case R.id.login_forgetpwd:
         break;
         //                注册新用户
       case R.id.login_new_user_register:
         break;
         //                第三方微信登录
       case R.id.login_wechat:
         Platform wechat = ShareSDK.getPlatform(this, Wechat.NAME);
         wechat.SSOSetting(false);
         wechat.setPlatformActionListener(this);
         wechat.authorize();
         break;
         //                第三方qq登录
       case R.id.login_qq:
         Platform qq = ShareSDK.getPlatform(this, QQ.NAME);
         qq.setPlatformActionListener(this);
         qq.authorize();
         break;
         //                第三方新浪登录
       case R.id.login_sina:
         Platform sina = ShareSDK.getPlatform(this, SinaWeibo.NAME);
         sina.setPlatformActionListener(this);
         sina.authorize();
         break;
     }
   }
 }
예제 #17
0
  public void onError(Platform platform, int action, Throwable t) {
    t.printStackTrace();

    Message msg = new Message();
    msg.what = MSG_ACTION_CCALLBACK;
    msg.arg1 = 2;
    msg.arg2 = action;
    msg.obj = t;
    UIHandler.sendMessage(msg, this);

    // 分享失败的统计
    ShareSDK.logDemoEvent(4, platform);
  }
예제 #18
0
  private void doExitTask() {
    finish();
    ShareSDK.stopSDK(this);
    IfanService.emptyList();
    Intent intent = new Intent(this, IfanService.class);
    stopService(intent);
    android.os.Process.killProcess(android.os.Process.myPid());

    /*		Map<String, Object> taskParams = new HashMap<String, Object>();
    taskParams.put(Task.FAN_ACTIVITY, HomePageActivity.class.getSimpleName());
    Task task = new Task(Task.FAN_EXIT, taskParams);
    IfanService.addTask(task);	*/
  }
 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);
 }
예제 #20
0
  public void onClick(View v) {
    if (v.equals(llTitle.getBtnBack())) {
      Platform plat = null;
      for (int i = 0; i < views.length; i++) {
        if (views[i].getVisibility() == View.INVISIBLE) {
          plat = platformList[i];
          break;
        }
      }

      // a statistics of Cancel-sharing
      if (plat != null) {
        ShareSDK.logDemoEvent(5, plat);
      }
      finish();
      return;
    }

    if (v.equals(llTitle.getBtnRight())) {
      String text = etContent.getText().toString();
      shareParamMap.put("text", text);

      platforms.clear();
      for (int i = 0; i < views.length; i++) {
        if (views[i].getVisibility() != View.VISIBLE) {
          platforms.add(platformList[i]);
        }
      }

      if (platforms.size() > 0) {
        setResultAndFinish();
      } else {
        int resId = getStringRes(activity, "select_one_plat_at_least");
        if (resId > 0) {
          Toast.makeText(getContext(), resId, Toast.LENGTH_SHORT).show();
        }
      }
      return;
    }

    if (v instanceof FrameLayout) {
      ((FrameLayout) v).getChildAt(1).performClick();
      return;
    }

    if (v.getVisibility() == View.INVISIBLE) {
      v.setVisibility(View.VISIBLE);
    } else {
      v.setVisibility(View.INVISIBLE);
    }
  }
예제 #21
0
 @Override
 public void onClick(View v) {
   String sharedUrl = Constants.PrefixShareUrl + String.valueOf(app.getId());
   switch (v.getId()) {
     case R.id.wechatcomment:
       ShareParams wxcomment = new ShareParams();
       wxcomment.setTitle("请下载我的App");
       wxcomment.setText("我们这里有最精彩的应用,快快来加入我们吧!");
       wxcomment.setUrl(sharedUrl);
       wxcomment.setImageUrl(app.getIcon());
       wxcomment.setShareType(Platform.SHARE_WEBPAGE);
       Platform wc = ShareSDK.getPlatform(WechatMoments.NAME);
       wc.share(wxcomment);
       this.dismiss();
       break;
     case R.id.wechat:
       ShareParams wechat = new ShareParams();
       wechat.setTitle("请下载我的App");
       wechat.setText("我们这里有最精彩的应用,快快来加入我们吧!");
       wechat.setUrl(sharedUrl);
       wechat.setImageUrl(app.getIcon());
       wechat.setShareType(Platform.SHARE_WEBPAGE);
       Platform we = ShareSDK.getPlatform(Wechat.NAME);
       we.share(wechat);
       this.dismiss();
       break;
     case R.id.sina:
       ShareParams sinasp = new ShareParams();
       sinasp.setText("请下载我的App。  " + sharedUrl);
       sinasp.setImageUrl(app.getIcon());
       // sinasp.setImageData(DrawableStringUtils.stringtoBitmap(selectedApp.getDrawableString()));
       Platform sn = ShareSDK.getPlatform(SinaWeibo.NAME);
       sn.share(sinasp);
       this.dismiss();
       break;
   }
 }
  public void onClick(View v) {
    if (v.getTag() == null) return;
    String tag = (String) v.getTag();
    if (tag.equals("close")) {
      // 取消分享的统计
      for (Platform plat : platforms) {
        ShareSDK.logDemoEvent(5, plat);
      }
      finish();
      return;
    }

    if (tag.equals("ok")) {
      onShareButtonClick(v);
      return;
    }
  }
예제 #23
0
  public void onError(Platform platform, int action, Throwable t) {
    t.printStackTrace();

    Message msg = new Message();
    msg.what = MSG_ACTION_CCALLBACK;
    msg.arg1 = 2;
    msg.arg2 = action;
    msg.obj = t;
    try {
      UIHandler.sendMessage(msg, this);
    } catch (NullPointerException e) {
      // TODO: handle exception
    }

    // 分享失败的统计
    ShareSDK.logDemoEvent(4, platform);
  }
 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);
 }
예제 #25
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.tabbar);
   ShareSDK.initSDK(this);
   AppManager.getAppManager().addActivity(this);
   mainTab = (RadioGroup) findViewById(R.id.main_tab);
   mainTab.setOnCheckedChangeListener(this);
   prepareIntent();
   setupIntent();
   RadioButton homebutton = (RadioButton) findViewById(R.id.radio_button1);
   homebutton.setChecked(true);
   appContext = (MyApplication) getApplication();
   if (!appContext.isNetworkConnected()) {
     UIHelper.ToastMessage(getApplicationContext(), "当前网络不可用,请检查你的网络设置", Toast.LENGTH_SHORT);
     return;
   }
   checkLogin();
 }
예제 #26
0
  // #endif
  public static boolean isUseClientToShare(Context context, String platform) {
    if ("Wechat".equals(platform)
        || "WechatMoments".equals(platform)
        || "ShortMessage".equals(platform)
        || "Email".equals(platform)
        || "GooglePlus".equals(platform)
        || "QQ".equals(platform)
        || "Pinterest".equals(platform)
        || "Instagram".equals(platform)) {
      return true;
    } else if ("Evernote".equals(platform)) {
      Platform plat = ShareSDK.getPlatform(context, platform);
      if ("true".equals(plat.getDevinfo("ShareByAppClient"))) {
        return true;
      }
    }

    return false;
  }
  @JavascriptInterface
  public void share(String platform) {
    String url = BYBlog.HOMEURL + "?p=" + postid;
    ShareSDK.initSDK(getActivity());
    OnekeyShare oks = new OnekeyShare();
    oks.disableSSOWhenAuthorize();
    oks.setTitle(SinglePostActivity.shareTitle);
    // titleUrl是标题的网络链接,仅在人人网和QQ空间使用
    oks.setTitleUrl(url);
    // text是分享文本,所有平台都需要这个字段
    oks.setText(SinglePostActivity.shareContent);
    // imagePath是图片的本地路径,Linked-In以外的平台都支持此参数
    oks.setImagePath(
        Environment.getExternalStorageDirectory() + "/BYBlog/test.jpg"); // 确保SDcard下面存在此张图片
    // url仅在微信(包括好友和朋友圈)中使用
    oks.setUrl(url);
    // comment是我对这条分享的评论,仅在人人网和QQ空间使用
    oks.setComment("我想说两句!");
    // site是分享此内容的网站名称,仅在QQ空间使用
    oks.setSite(getString(R.string.app_name));
    // siteUrl是分享此内容的网站地址,仅在QQ空间使用
    oks.setSiteUrl(url);

    switch (platform) {
      case "weibo":
        oks.setPlatform(SinaWeibo.NAME);
        break;
      case "qq":
        oks.setPlatform(QQ.NAME);
        break;
      case "weixin":
        oks.setPlatform(Wechat.NAME);

        break;
      case "pyq":
        oks.setPlatform(WechatMoments.NAME);
        break;
    }
    // 启动分享GUI
    oks.show(getActivity());
  }
예제 #28
0
  private void showShare() {
    ShareSDK.initSDK(this);
    OnekeyShare oks = new OnekeyShare();
    // 关闭sso授权
    oks.disableSSOWhenAuthorize();

    // title标题,印象笔记、邮箱、信息、微信、人人网和QQ空间使用
    oks.setTitle(getString(R.string.share));

    // text是分享文本,所有平台都需要这个字段
    oks.setText("我是分享文本");

    // imagePath是图片的本地路径,Linked-In以外的平台都支持此参数
    oks.setImagePath("/sdcard/test.jpg"); // 确保SDcard下面存在此张图片

    // url仅在微信(包括好友和朋友圈)中使用
    oks.setUrl("http://sharesdk.cn");

    // 启动分享GUI
    oks.show(this);
  }
예제 #29
0
  /** 分享 */
  @JavascriptInterface
  public void showShare(String json) {
    System.out.println("分享    json====" + json);
    ShowShareBean shareBean = shareBean(json);
    if (shareBean.getStatus().equals("1")) {
      ShareSDK.initSDK(context);
      OnekeyShare oks = new OnekeyShare();

      // 关闭sso授权
      oks.disableSSOWhenAuthorize();

      // 分享时Notification的图标和文字  2.5.9以后的版本不调用此方法
      // oks.setNotification(R.drawable.ic_launcher, getString(R.string.app_name));
      // title标题,印象笔记、邮箱、信息、微信、人人网和QQ空间使用
      oks.setTitle(shareBean.getData().getTitle());
      // titleUrl是标题的网络链接,仅在人人网和QQ空间使用
      oks.setTitleUrl(shareBean.getData().getUrl());
      // text是分享文本,所有平台都需要这个字段
      oks.setText(shareBean.getData().getContent());
      // 网络获取图片
      oks.setImageUrl(shareBean.getData().getSharethumb());
      // imagePath是图片的本地路径,Linked-In以外的a平台都支持此参数
      //
      // oks.setImagePath("http://f1.sharesdk.cn/imgs/2014/02/26/owWpLZo_638x960.jpg");//确保SDcard下面存在此张图片
      // url仅在微信(包括好友和朋友圈)中使用
      oks.setUrl(shareBean.getData().getUrl());
      // comment是我对这条分享的评论,仅在人人网和QQ空间使用
      oks.setComment(shareBean.getData().getDefaultcontent());
      // site是分享此内容的网站名称,仅在QQ空间使用
      oks.setSite("Beeway");
      // siteUrl是分享此内容的网站地址,仅在QQ空间使用
      oks.setSiteUrl(shareBean.getData().getUrl());

      // 启动分享GUI
      oks.show(context);
    } else {
      Toast.makeText(context, "无内容分享!", Toast.LENGTH_SHORT).show();
    }
  }
예제 #30
0
  protected void share() {
    ShareSDK.initSDK(this);
    OnekeyShare oks = new OnekeyShare();
    // 关闭sso授权
    oks.disableSSOWhenAuthorize();

    oks.setTitle("我正在使用小末");

    oks.setTitleUrl("http://www.showmo365.com.cn/index.php/FileServer/AppDownload");

    oks.setText(getResources().getString(R.string.sms_share));

    oks.setImagePath(SHARE_IMAGE);

    oks.setUrl("http://www.showmo365.com.cn/index.php/FileServer/AppDownload");

    oks.setSite(getString(R.string.app_name));

    oks.setSiteUrl("http://www.showmo365.com.cn");

    oks.setDialogMode();

    oks.show(this);
  }