mirror of
https://github.com/nuclearfog/Shitter.git
synced 2025-01-30 10:55:06 +01:00
bug fix, suppressed warnings
This commit is contained in:
parent
688aaf066d
commit
ab9d2b747f
@ -1160,25 +1160,29 @@ public class Twitter implements GlobalSettings.SettingsListener {
|
|||||||
Directmessages result = new Directmessages(cursor, nextCursor);
|
Directmessages result = new Directmessages(cursor, nextCursor);
|
||||||
for (int pos = 0; pos < array.length(); pos++) {
|
for (int pos = 0; pos < array.length(); pos++) {
|
||||||
JSONObject item = array.getJSONObject(pos);
|
JSONObject item = array.getJSONObject(pos);
|
||||||
DirectmessageV1 message = new DirectmessageV1(item);
|
try {
|
||||||
long senderId = message.getSenderId();
|
DirectmessageV1 message = new DirectmessageV1(item);
|
||||||
long receiverId = message.getReceiverId();
|
long senderId = message.getSenderId();
|
||||||
// cache user instances to reduce API calls
|
long receiverId = message.getReceiverId();
|
||||||
if (userCache.containsKey(senderId)) {
|
// cache user instances to reduce API calls
|
||||||
message.addSender(userCache.get(senderId));
|
if (userCache.containsKey(senderId)) {
|
||||||
} else {
|
message.addSender(userCache.get(senderId));
|
||||||
User user = showUser(senderId);
|
} else {
|
||||||
userCache.put(senderId, user);
|
User user = showUser(senderId);
|
||||||
message.addSender(user);
|
userCache.put(senderId, user);
|
||||||
|
message.addSender(user);
|
||||||
|
}
|
||||||
|
if (userCache.containsKey(receiverId)) {
|
||||||
|
message.addReceiver(userCache.get(receiverId));
|
||||||
|
} else {
|
||||||
|
User user = showUser(receiverId);
|
||||||
|
userCache.put(receiverId, user);
|
||||||
|
message.addReceiver(user);
|
||||||
|
}
|
||||||
|
result.add(message);
|
||||||
|
} catch (JSONException e) {
|
||||||
|
Log.w("directmessage", e);
|
||||||
}
|
}
|
||||||
if (userCache.containsKey(receiverId)) {
|
|
||||||
message.addReceiver(userCache.get(receiverId));
|
|
||||||
} else {
|
|
||||||
User user = showUser(receiverId);
|
|
||||||
userCache.put(receiverId, user);
|
|
||||||
message.addReceiver(user);
|
|
||||||
}
|
|
||||||
result.add(message);
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -1687,6 +1691,7 @@ public class Twitter implements GlobalSettings.SettingsListener {
|
|||||||
* @param params additional http parameters
|
* @param params additional http parameters
|
||||||
* @return http resonse
|
* @return http resonse
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("SameParameterValue")
|
||||||
private Response post(String endpoint, List<String> params, JSONObject json) throws IOException {
|
private Response post(String endpoint, List<String> params, JSONObject json) throws IOException {
|
||||||
RequestBody body = RequestBody.create(TYPE_JSON, json.toString());
|
RequestBody body = RequestBody.create(TYPE_JSON, json.toString());
|
||||||
return post(endpoint, params, body);
|
return post(endpoint, params, body);
|
||||||
@ -1767,6 +1772,7 @@ public class Twitter implements GlobalSettings.SettingsListener {
|
|||||||
* @param endpoint endpoint url
|
* @param endpoint endpoint url
|
||||||
* @return http response
|
* @return http response
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("SameParameterValue")
|
||||||
private Response delete(String endpoint, List<String> params) throws IOException {
|
private Response delete(String endpoint, List<String> params) throws IOException {
|
||||||
String authHeader = buildHeader("DELETE", endpoint, params);
|
String authHeader = buildHeader("DELETE", endpoint, params);
|
||||||
String url = appendParams(endpoint, params);
|
String url = appendParams(endpoint, params);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user