Exemplo n.º 1
0
      @Override
      protected String doInBackground(Integer... params) {
        if (isCancelled()) {
          return null;
        }

        if (Config.CORE_URL == null) {
          URL_APPROVE_FRIEND =
              Config.makeUrl(user.getCoreUrl(), "denyFriendRequest", true)
                  + "&token="
                  + user.getTokenkey();
        } else {
          URL_APPROVE_FRIEND =
              Config.makeUrl(Config.CORE_URL, "denyFriendRequest", true)
                  + "&token="
                  + user.getTokenkey();
        }

        List<NameValuePair> pairs = new ArrayList<NameValuePair>();
        pairs.add(new BasicNameValuePair("user_id", "" + params[0]));
        pairs.add(new BasicNameValuePair("action", "deny"));

        resultstring = networkUntil.makeHttpRequest(URL_APPROVE_FRIEND, "POST", pairs);

        Log.i("DEBUG", resultstring);

        return resultstring;
      }
Exemplo n.º 2
0
      @Override
      protected String doInBackground(String... params) {
        if (isCancelled()) {
          return null;
        }
        try {
          String likerequest;

          String URL = null;
          if (Config.CORE_URL == null) {
            URL =
                Config.makeUrl(user.getCoreUrl(), "addFriendRequest", true)
                    + "&token="
                    + user.getTokenkey();
          } else {
            URL =
                Config.makeUrl(Config.CORE_URL, "addFriendRequest", true)
                    + "&token="
                    + user.getTokenkey();
          }

          // Use BasicNameValuePair to create GET data
          List<NameValuePair> pairs = new ArrayList<NameValuePair>();

          pairs.add(new BasicNameValuePair("user_id", objProfileInfo.getUser_id()));

          likerequest = networkUntil.makeHttpRequest(URL, "POST", pairs);

          Log.i("add Friend", likerequest);
        } catch (Exception ex) {
          // Log.i(DEBUG_TAG, ex.getMessage());
        }
        return null;
      }
Exemplo n.º 3
0
      @Override
      protected String doInBackground(String... params) {
        if (isCancelled()) {
          return null;
        }
        try {
          String likerequest;
          // Use BasicNameValuePair to create GET data
          List<NameValuePair> pairs = new ArrayList<NameValuePair>();
          pairs.add(new BasicNameValuePair("token", user.getTokenkey()));

          if (("like").equals(params[3])) {
            pairs.add(new BasicNameValuePair("method", "accountapi.like"));
          } else {
            pairs.add(new BasicNameValuePair("method", "accountapi.unlike"));
          }

          if (params[1] != null) {
            pairs.add(new BasicNameValuePair("type", "" + params[1]));
            pairs.add(new BasicNameValuePair("item_id", "" + params[0]));
          } else {
            pairs.add(new BasicNameValuePair("feed_id", "" + params[2]));
          }

          // url request
          String URL = null;
          if (Config.CORE_URL == null) {
            URL = Config.makeUrl(user.getCoreUrl(), null, false);
          } else {
            URL = Config.makeUrl(Config.CORE_URL, null, false);
          }
          // request GET method to server

          likerequest = networkUntil.makeHttpRequest(URL, "GET", pairs);
          Log.i("like pages", likerequest);
        } catch (Exception ex) {
          // Log.i(DEBUG_TAG, ex.getMessage());
        }
        return null;
      }
    @Override
    protected String doInBackground(String... params) {
      try {

        // Use BasicNameValuePair to create GET data
        List<NameValuePair> pairs = new ArrayList<NameValuePair>();
        pairs.add(new BasicNameValuePair("token", user.getTokenkey()));
        pairs.add(new BasicNameValuePair("method", "accountapi.getPhotoAlbums"));

        if (params[0] != null) {
          if (user_id != null) {
            pairs.add(new BasicNameValuePair("user_id", "" + params[0]));
          } else if (page_id != null) {
            pairs.add(new BasicNameValuePair("module", "pages"));
            pairs.add(new BasicNameValuePair("item_id", "" + params[0]));
          }
        }
        pairs.add(new BasicNameValuePair("limit", "2"));
        pairs.add(new BasicNameValuePair("page", "0"));

        // url request
        String URL = null;
        if (Config.CORE_URL == null) {
          URL = Config.makeUrl(user.getCoreUrl(), null, false);
        } else {
          URL = Config.makeUrl(Config.CORE_URL, null, false);
        }

        // request GET method to server

        resultstring = networkUntil.makeHttpRequest(URL, "GET", pairs);

        JSONObject mainJSON = new JSONObject(resultstring);
        JSONArray outJson = mainJSON.getJSONArray("output");

        arrayOfList = new ArrayList<Album>();

        for (int i = 0; i < outJson.length(); i++) {

          JSONObject JsonAlbum = outJson.getJSONObject(i);

          Album album = new Album();

          album.setAlbum_id(JsonAlbum.getString("album_id"));

          album.setUser_id(JsonAlbum.getString("user_id"));

          album.setName(JsonAlbum.getString("name"));

          album.setDescription(JsonAlbum.getString("description"));

          album.setTime_phrase(JsonAlbum.getString("time_phrase"));

          album.setAlbum_total(JsonAlbum.getString("total_photo"));

          album.setAlbum_pic(JsonAlbum.getJSONObject("photo_sizes").getString("100"));

          arrayOfList.add(album);
        }

      } catch (Exception ex) {
        // Log.i("comment item", ex.getMessage());
      }

      return resultstring;
    }
    @Override
    protected String doInBackground(String... params) {
      try {

        // Use BasicNameValuePair to create GET data
        List<NameValuePair> pairs = new ArrayList<NameValuePair>();
        pairs.add(new BasicNameValuePair("token", user.getTokenkey()));
        pairs.add(new BasicNameValuePair("method", "accountapi.getPhotos"));
        if (page > 1) {
          pairs.add(new BasicNameValuePair("page", "" + page));
        } else {
          pairs.add(new BasicNameValuePair("page", "undefined"));
        }

        if (params[0] != null) {
          if (user_id != null) {
            pairs.add(new BasicNameValuePair("user_id", "" + params[0]));
          } else if (page_id != null) {
            pairs.add(new BasicNameValuePair("module", "pages"));
            pairs.add(new BasicNameValuePair("item_id", "" + params[0]));
          } else if (module_id != null) {
            pairs.add(new BasicNameValuePair("module", "pages"));
            pairs.add(new BasicNameValuePair("item_id", "" + params[0]));
          }
          if (params[1] != null) {
            pairs.add(new BasicNameValuePair("album_id", "" + params[1]));
          }
        }
        // url request
        String URL = null;
        if (Config.CORE_URL == null) {
          URL = Config.makeUrl(user.getCoreUrl(), null, false);
        } else {
          URL = Config.makeUrl(Config.CORE_URL, null, false);
        }

        // request GET method to server

        resultstring = networkUntil.makeHttpRequest(URL, "GET", pairs);

        JSONObject mainJSON = new JSONObject(resultstring);
        JSONArray outJson = mainJSON.getJSONArray("output");

        if (stringArrayList == null) {
          stringArrayList = new ArrayList<String>();
          PagerList = new ArrayList<String>();
          ImagesId = new ArrayList<String>();

          HasLike = new ArrayList<String>();
          FeedisLike = new ArrayList<String>();
          Total_like = new ArrayList<String>();
          Total_comment = new ArrayList<String>();
          Itemid = new ArrayList<String>();
          Type = new ArrayList<String>();
        }

        if (outJson.length() < 20) {
          viewmore = 1;
        } else {
          float leng = outJson.length();
          float itemv = itemView;
          countImage = leng / itemv;
        }

        System.out.println(outJson.length());
        System.out.println(countImage);

        for (int i = 0; i < outJson.length(); i++) {

          JSONObject JsonPic = outJson.getJSONObject(i);

          stringArrayList.add(JsonPic.getJSONObject("photo_sizes").getString("100"));

          ImagesId.add(JsonPic.getString("photo_id"));

          if (JsonPic.has("feed_total_like")) {
            HasLike.add(JsonPic.getString("feed_total_like"));
            Total_like.add(JsonPic.getString("feed_total_like"));
          }

          if (JsonPic.has("item_id")) {
            Itemid.add(JsonPic.getString("item_id"));
          }
          if (!JsonPic.isNull("feed_is_liked") && JsonPic.getString("feed_is_liked") != "false") {
            if (!"".equals(JsonPic.getString("feed_is_liked"))) {
              FeedisLike.add("feed_is_liked");
            } else {
              FeedisLike.add("null");
            }
          }
          if (JsonPic.has("total_comment")) {
            Total_comment.add(JsonPic.getString("total_comment"));
          }

          Type.add(JsonPic.getJSONObject("social_app").getString("type_id"));

          if (Build.VERSION.SDK_INT == Build.VERSION_CODES.GINGERBREAD) {

            PagerList.add(JsonPic.getJSONObject("photo_sizes").getString("240"));
          } else {

            PagerList.add(JsonPic.getJSONObject("photo_sizes").getString("500"));
          }
        }

        imagePhotoIds = ImagesId.toArray(new String[ImagesId.size()]);
        imageUrls = stringArrayList.toArray(new String[stringArrayList.size()]);
        imageCount = stringArrayList.size();
        imagePager = PagerList.toArray(new String[stringArrayList.size()]);

        imageHasLike = HasLike.toArray(new String[HasLike.size()]);

        imageFeedisLike = FeedisLike.toArray(new String[FeedisLike.size()]);

        imageTotal_like = Total_like.toArray(new String[Total_like.size()]);

        imageTotal_comment = Total_comment.toArray(new String[Total_comment.size()]);

        imageItemid = Itemid.toArray(new String[Itemid.size()]);

        imageType = Type.toArray(new String[Type.size()]);

        imageType = Type.toArray(new String[Type.size()]);

      } catch (Exception ex) {
      }
      return resultstring;
    }
Exemplo n.º 6
0
    @Override
    protected String doInBackground(String... params) {
      if (isCancelled()) {
        return null;
      }

      String result = null;
      try {
        // String url
        String URL = null;
        if (Config.CORE_URL == null) {
          URL = Config.makeUrl(user.getCoreUrl(), null, false);
        } else {
          URL = Config.makeUrl(Config.CORE_URL, null, false);
        }

        // Use BasicNameValuePair to store POST data
        List<NameValuePair> pairs = new ArrayList<NameValuePair>();
        pairs.add(new BasicNameValuePair("token", user.getTokenkey()));

        if (sUserId != null) {
          pairs.add(new BasicNameValuePair("method", "accountapi.getUserInfo"));
          pairs.add(new BasicNameValuePair("user_id", "" + params[0]));
        } else if (sPagesId != null) {
          pairs.add(new BasicNameValuePair("method", "accountapi.getItem"));
          pairs.add(new BasicNameValuePair("module", "pages"));
          pairs.add(new BasicNameValuePair("item_id", "" + params[0]));
        }

        result = networkUntil.makeHttpRequest(URL, "GET", pairs);
        Log.d("userfragmentvalue", result);

        JSONObject mainJSON = new JSONObject(result);

        JSONObject outputJson = mainJSON.getJSONObject("output");

        if (outputJson.has("full_name")) {
          objProfileInfo.setFullname(Html.fromHtml(outputJson.getString("full_name")).toString());
        }

        // bronislaw
        if (outputJson.has("user_name")) {
          objProfileInfo.setUsername(outputJson.getString("user_name"));
        }

        if (outputJson.has("quickbloxid")) {
          objProfileInfo.setQuickbloxID(outputJson.getString("quickbloxid"));
        }

        if (outputJson.has("user_id")) {
          objProfileInfo.setUser_id(outputJson.getString("user_id"));
        }

        if (outputJson.has("dob_setting")) {
          objProfileInfo.setDob(Html.fromHtml(outputJson.getString("dob_setting")).toString());
        }

        if (outputJson.has("location_phrase")) {
          objProfileInfo.setLocation(
              Html.fromHtml(outputJson.getString("location_phrase")).toString());
        } else {
          objProfileInfo.setLocation(null);
        }

        if (outputJson.has("sexuality")) {
          objProfileInfo.setSexuality(Html.fromHtml(outputJson.getString("sexuality")).toString());
        }

        if (outputJson.has("birthday_phrase")
            && !"false".equals(outputJson.getString("birthday_phrase"))) {
          objProfileInfo.setBirthday(
              Html.fromHtml(outputJson.getString("birthday_phrase")).toString());
        } else {
          objProfileInfo.setBirthday(null);
        }

        if (outputJson.has("photo_120px_square")) {
          objProfileInfo.setUserImage(outputJson.getString("photo_120px_square"));
        }

        if (outputJson.has("photo_200px_square")) {
          objProfileInfo.setUserImage(outputJson.getString("photo_200px_square"));
        }

        if (outputJson.has("cover_photo")) {
          Object intervention = outputJson.get("cover_photo");

          if (intervention instanceof JSONObject) {
            JSONObject coverJson = outputJson.getJSONObject("cover_photo");
            objProfileInfo.setCoverPhoto(coverJson.getString("500"));
          } else {
            objProfileInfo.setCoverPhoto(null);
          }
        }

        // get data pages

        if (outputJson.has("title")) {
          objProfileInfo.setTitle(Html.fromHtml(outputJson.getString("title")).toString());
        }

        if (outputJson.has("category_name")) {
          objProfileInfo.setCategory(
              Html.fromHtml(outputJson.getString("category_name")).toString());
        }

        if (outputJson.has("photo_sizes")) {
          Object intervention = outputJson.get("photo_sizes");

          if (intervention instanceof JSONObject) {
            JSONObject coverJson = outputJson.getJSONObject("photo_sizes");
            objProfileInfo.setPagesImage(coverJson.getString("120"));
          } else {
            objProfileInfo.setPagesImage(null);
          }
        }

        if (outputJson.has("feed_callback")) {
          Object intervention = outputJson.get("feed_callback");

          if (intervention instanceof JSONObject) {
            callback = outputJson.getJSONObject("feed_callback");
          }
        }

        if (outputJson.has("info")) {

          JSONObject info = outputJson.getJSONObject("info");
          if (info.has("Gender")) {
            objProfileInfo.setGender(Html.fromHtml(info.getString("Gender")).toString());
          }
          if (info.has("Age")) {
            objProfileInfo.setAge(Html.fromHtml(info.getString("Age")).toString());
          }

          if (info.has("Relationship Status")) {
            objProfileInfo.setRelationship_status(
                Html.fromHtml(info.getString("Relationship Status")).toString());
          }
          if (info.has("Location")) {
            objProfileInfo.setLocation_info(Html.fromHtml(info.getString("Location")).toString());
          }
          if (info.has("Last Login")) {
            objProfileInfo.setLast_login(Html.fromHtml(info.getString("Last Login")).toString());
          }
          if (info.has("Member Since")) {
            objProfileInfo.setMember_since(
                Html.fromHtml(info.getString("Member Since")).toString());
          }
          if (info.has("Membership")) {
            objProfileInfo.setMembership(Html.fromHtml(info.getString("Membership")).toString());
          }
          if (info.has("Profile Views")) {
            objProfileInfo.setProfile_views(
                Html.fromHtml(info.getString("Profile Views")).toString());
          }
          if (info.has("RSS Subscribers")) {
            objProfileInfo.setRSS_Subscribers(
                Html.fromHtml(info.getString("RSS Subscribers")).toString());
          }
        }

        if (outputJson.has("is_friend")) {
          objProfileInfo.setIs_friend(outputJson.get("is_friend").toString());
        }

        if (outputJson.has("is_friend_request") && !outputJson.isNull("is_friend_request")) {
          Log.d("psyh", "is_friend_request" + outputJson.getString("is_friend_request"));
          if (outputJson.getString("is_friend_request").equals("2")) {
            objProfileInfo.setIs_friend("2");
            Log.d("psyh", "objProfileInfo.getIs_friend" + objProfileInfo.getIs_friend());
          }
        }

        if (outputJson.has("total_friend")) {
          objProfileInfo.setTotal_friend(outputJson.getString("total_friend"));
        }

        if (outputJson.has("request_id")) {
          objProfileInfo.setRequest_id(Integer.parseInt(outputJson.getString("request_id")));
        }
        if (outputJson.has("text") && !outputJson.isNull("text")) {
          objProfileInfo.setText(Html.fromHtml(outputJson.getString("text")).toString());
        }

        if (!outputJson.isNull("is_liked") && outputJson.getString("is_liked") != "false") {
          objProfileInfo.setIs_liked("is_liked");
        }

        if (outputJson.has("total_like")) {
          objProfileInfo.setTotal_like(outputJson.getString("total_like"));
        }

      } catch (Exception ex) {
        // scrollViewLayout.setVisibility(View.GONE);
        // noInternetLayout.setVisibility(View.VISIBLE);
        ex.printStackTrace();
      }

      return result;
    }