From e48bb565a5aa871be18cae4003cb781ef6e2e154 Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Fri, 11 Jan 2019 11:33:32 +0800 Subject: View user details in ViewUserDetailActivity. Follow or unfollow user is not properly implemented right now. Change users and subscribed_users databases' schemes. Press Profile in navigation drawer to view my reddit info. Press the username in the post to view that account's info. --- app/src/main/java/User/FetchUserData.java | 50 ------------------------------- 1 file changed, 50 deletions(-) delete mode 100644 app/src/main/java/User/FetchUserData.java (limited to 'app/src/main/java/User/FetchUserData.java') diff --git a/app/src/main/java/User/FetchUserData.java b/app/src/main/java/User/FetchUserData.java deleted file mode 100644 index edaa3b14..00000000 --- a/app/src/main/java/User/FetchUserData.java +++ /dev/null @@ -1,50 +0,0 @@ -package User; - -import android.support.annotation.NonNull; -import android.util.Log; - -import ml.docilealligator.infinityforreddit.RedditAPI; -import retrofit2.Call; -import retrofit2.Callback; -import retrofit2.Retrofit; - -public class FetchUserData { - public interface FetchUserDataListener { - void onFetchUserDataSuccess(User user); - void onFetchUserDataFail(); - } - - public static void fetchUserData(final Retrofit retrofit, String userName, - final FetchUserDataListener fetchUserDataListener) { - RedditAPI api = retrofit.create(RedditAPI.class); - - Call userInfo = api.getUserData(userName); - userInfo.enqueue(new Callback() { - @Override - public void onResponse(@NonNull Call call, @NonNull retrofit2.Response response) { - if(response.isSuccessful()) { - ParseUserData.parseMyInfo(response.body(), new ParseUserData.ParseUserDataListener() { - @Override - public void onParseUserDataSuccess(User user) { - fetchUserDataListener.onFetchUserDataSuccess(user); - } - - @Override - public void onParseUserDataFail() { - fetchUserDataListener.onFetchUserDataFail(); - } - }); - } else { - Log.i("call failed", response.message()); - fetchUserDataListener.onFetchUserDataFail(); - } - } - - @Override - public void onFailure(@NonNull Call call, @NonNull Throwable t) { - Log.i("call failed", t.getMessage()); - fetchUserDataListener.onFetchUserDataFail(); - } - }); - } -} -- cgit v1.2.3