Android Open Source - ShareSDK-for-Android Follower List Fake Activity






From Project

Back to project page ShareSDK-for-Android.

License

The source code is released under:

MIT License

If you think the Android project ShareSDK-for-Android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package cn.sharesdk.onekeyshare;
/*  ww  w .j  a v a2  s  . c om*/
import java.util.ArrayList;
import java.util.HashMap;

import cn.sharesdk.framework.FakeActivity;
import cn.sharesdk.framework.Platform;

public class FollowerListFakeActivity extends FakeActivity {
  protected Platform platform;

  public void setPlatform(Platform platform) {
    this.platform = platform;
  }

  public Platform getPlatform() {
    return platform;
  }

  public boolean isRadioMode(String platformName) {
    return "FacebookMessenger".equals(platformName);
  }

  public void setResultForChecked(ArrayList<String> checked) {
    HashMap<String, Object> res = new HashMap<String, Object>();
    res.put("selected", checked);
    res.put("platform", platform);
    setResult(res);
  }

  public static class Following {
    public boolean checked;
    public String screenName;
    public String description;
    public String uid;
    public String icon;
    //@Name ????????????????????
    public String atName;
  }

  public static class FollowersResult {
    public ArrayList<Following> list;
    public boolean hasNextPage = false;
  }

  public static FollowersResult parseFollowers(String platformName, HashMap<String, Object> res, HashMap<String, Boolean> uidMap) {
    if (res == null || res.size() <= 0) {
      return null;
    }

    boolean hasNext = false;
    ArrayList<Following> data = new ArrayList<Following>();
    if ("SinaWeibo".equals(platformName)) {
      // users[id, name, description]
      @SuppressWarnings("unchecked")
      ArrayList<HashMap<String, Object>> users
          = (ArrayList<HashMap<String,Object>>) res.get("users");
      for (HashMap<String, Object> user : users) {
        String uid = String.valueOf(user.get("id"));
        if (!uidMap.containsKey(uid)) {
          Following following = new Following();
          following.uid = uid;
          following.screenName = String.valueOf(user.get("name"));
          following.description = String.valueOf(user.get("description"));
          following.icon = String.valueOf(user.get("profile_image_url"));
          following.atName = following.screenName;
          uidMap.put(following.uid, true);
          data.add(following);
        }
      }
      hasNext = (Integer) res.get("total_number") > uidMap.size();
    }
    else if ("TencentWeibo".equals(platformName)) {
      hasNext = ((Integer)res.get("hasnext") == 0);
      // info[nick, name, tweet[text]]
      @SuppressWarnings("unchecked")
      ArrayList<HashMap<String, Object>> infos
          = (ArrayList<HashMap<String,Object>>) res.get("info");
      for (HashMap<String, Object> info : infos) {
        String uid = String.valueOf(info.get("name"));
        if (!uidMap.containsKey(uid)) {
          Following following = new Following();
          following.screenName = String.valueOf(info.get("nick"));
          following.uid = uid;
          following.atName = uid;
          @SuppressWarnings("unchecked")
          ArrayList<HashMap<String, Object>> tweets = (ArrayList<HashMap<String,Object>>) info.get("tweet");
          for (HashMap<String, Object> tweet : tweets) {
            following.description = String.valueOf(tweet.get("text"));
            break;
          }
          following.icon = String.valueOf(info.get("head")) + "/100";
          uidMap.put(following.uid, true);
          data.add(following);
        }
      }
    }
    else if ("Facebook".equals(platformName)) {
      // data[id, name]
      @SuppressWarnings("unchecked")
      ArrayList<HashMap<String, Object>> datas
          = (ArrayList<HashMap<String,Object>>) res.get("data");
      for (HashMap<String, Object> d : datas) {
        String uid = String.valueOf(d.get("id"));
        if (!uidMap.containsKey(uid)) {
          Following following = new Following();
          following.uid = uid;
          following.atName = "["+uid+"]";
          following.screenName = String.valueOf(d.get("name"));
          @SuppressWarnings("unchecked")
          HashMap<String, Object> picture = (HashMap<String, Object>) d.get("picture");
          if (picture != null) {
            @SuppressWarnings("unchecked")
            HashMap<String, Object> pData = (HashMap<String, Object>) picture.get("data");
            following.icon = String.valueOf(pData.get("url"));
          }
          uidMap.put(following.uid, true);
          data.add(following);
        }
      }
      @SuppressWarnings("unchecked")
      HashMap<String, Object> paging = (HashMap<String, Object>) res.get("paging");
      hasNext = paging.containsKey("next");
    }
    else if ("Twitter".equals(platformName)) {
      // users[screen_name, name, description]
      @SuppressWarnings("unchecked")
      ArrayList<HashMap<String, Object>> users
          = (ArrayList<HashMap<String,Object>>) res.get("users");
      for (HashMap<String, Object> user : users) {
        String uid = String.valueOf(user.get("screen_name"));
        if (!uidMap.containsKey(uid)) {
          Following following = new Following();
          following.uid = uid;
          following.atName = uid;
          following.screenName = String.valueOf(user.get("name"));
          following.description = String.valueOf(user.get("description"));
          following.icon = String.valueOf(user.get("profile_image_url"));
          uidMap.put(following.uid, true);
          data.add(following);
        }
      }
    }
    else if ("FacebookMessenger".equals(platformName)) {
      @SuppressWarnings("unchecked")
      ArrayList<HashMap<String, Object>> users
          = (ArrayList<HashMap<String,Object>>) res.get("users");
      for (HashMap<String, Object> user : users) {
        String userAddr = String.valueOf(user.get("jid"));
        if (!uidMap.containsKey(userAddr)) {
          Following following = new Following();
          following.uid = userAddr;
          following.atName = userAddr;
          following.screenName = String.valueOf(user.get("name"));
          uidMap.put(following.uid, true);
          data.add(following);
        }
      }
      hasNext = false;
    }

    FollowersResult ret = new FollowersResult();
    ret.list = data;
    ret.hasNextPage = hasNext;
    return ret;
  }
}




Java Source Code List

cn.sharesdk.demo.AuthPage.java
cn.sharesdk.demo.CustomShareFieldsPage.java
cn.sharesdk.demo.CustomerPage.java
cn.sharesdk.demo.DemoPage.java
cn.sharesdk.demo.GetInforPage.java
cn.sharesdk.demo.GetTokenPage.java
cn.sharesdk.demo.JsonPage.java
cn.sharesdk.demo.Laiwang.java
cn.sharesdk.demo.MainActivity.java
cn.sharesdk.demo.MainAdapter.java
cn.sharesdk.demo.MyAdapter.java
cn.sharesdk.demo.MyQZoneWebShareAdapter.java
cn.sharesdk.demo.OneKeyShareCallback.java
cn.sharesdk.demo.ShareContentCustomizeDemo.java
cn.sharesdk.demo.SlidingMenuPage.java
cn.sharesdk.demo.WechatPage.java
cn.sharesdk.demo.YixinPage.java
cn.sharesdk.demo.wxapi.WXEntryActivity.java
cn.sharesdk.demo.yxapi.YXEntryActivity.java
cn.sharesdk.onekeyshare.CustomerLogo.java
cn.sharesdk.onekeyshare.CustomerLogo.java
cn.sharesdk.onekeyshare.EditPageFakeActivity.java
cn.sharesdk.onekeyshare.EditPageFakeActivity.java
cn.sharesdk.onekeyshare.FollowerListFakeActivity.java
cn.sharesdk.onekeyshare.FollowerListFakeActivity.java
cn.sharesdk.onekeyshare.OnekeyShareTheme.java
cn.sharesdk.onekeyshare.OnekeyShareTheme.java
cn.sharesdk.onekeyshare.OnekeyShare.java
cn.sharesdk.onekeyshare.OnekeyShare.java
cn.sharesdk.onekeyshare.PicViewer.java
cn.sharesdk.onekeyshare.PicViewer.java
cn.sharesdk.onekeyshare.PlatformListFakeActivity.java
cn.sharesdk.onekeyshare.PlatformListFakeActivity.java
cn.sharesdk.onekeyshare.Shake2Share.java
cn.sharesdk.onekeyshare.Shake2Share.java
cn.sharesdk.onekeyshare.ShareContentCustomizeCallback.java
cn.sharesdk.onekeyshare.ShareContentCustomizeCallback.java
cn.sharesdk.onekeyshare.ShareCore.java
cn.sharesdk.onekeyshare.ShareCore.java
cn.sharesdk.onekeyshare.ThemeShareCallback.java
cn.sharesdk.onekeyshare.ThemeShareCallback.java
cn.sharesdk.onekeyshare.theme.classic.EditPage.java
cn.sharesdk.onekeyshare.theme.classic.EditPage.java
cn.sharesdk.onekeyshare.theme.classic.FollowListPage.java
cn.sharesdk.onekeyshare.theme.classic.FollowListPage.java
cn.sharesdk.onekeyshare.theme.classic.PlatformGridView.java
cn.sharesdk.onekeyshare.theme.classic.PlatformGridView.java
cn.sharesdk.onekeyshare.theme.classic.PlatformListPage.java
cn.sharesdk.onekeyshare.theme.classic.PlatformListPage.java
cn.sharesdk.onekeyshare.theme.skyblue.EditPage.java
cn.sharesdk.onekeyshare.theme.skyblue.EditPage.java
cn.sharesdk.onekeyshare.theme.skyblue.FollowListPage.java
cn.sharesdk.onekeyshare.theme.skyblue.FollowListPage.java
cn.sharesdk.onekeyshare.theme.skyblue.PlatformGridViewAdapter.java
cn.sharesdk.onekeyshare.theme.skyblue.PlatformGridViewAdapter.java
cn.sharesdk.onekeyshare.theme.skyblue.PlatformListPage.java
cn.sharesdk.onekeyshare.theme.skyblue.PlatformListPage.java
cn.sharesdk.socialization.sample.MainActivity.java
cn.sharesdk.socialization.sample.MyPlatform.java
cn.sharesdk.socialization.sample.wxapi.WXEntryActivity.java
cn.sharesdk.socialization.sample.yxapi.YXEntryActivity.java