From 536665be5fe9a0a421ac2b93520c6788b780d9ad Mon Sep 17 00:00:00 2001 From: M M Arif Date: Tue, 3 Dec 2019 18:20:26 +0500 Subject: [PATCH] Load default list of explore repositories --- app/build.gradle | 4 +- .../adapters/ExploreRepositoriesAdapter.java | 3 +- .../ExploreRepositoriesFragment.java | 38 +++++++++++++++++-- 3 files changed, 39 insertions(+), 6 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 6548a4e1..068516b9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,8 +6,8 @@ android { applicationId "org.mian.gitnex" minSdkVersion 21 targetSdkVersion 29 - versionCode 80 - versionName "2.3.0" + versionCode 90 + versionName "2.4.0-dev" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { diff --git a/app/src/main/java/org/mian/gitnex/adapters/ExploreRepositoriesAdapter.java b/app/src/main/java/org/mian/gitnex/adapters/ExploreRepositoriesAdapter.java index 391cbfd2..70cace46 100644 --- a/app/src/main/java/org/mian/gitnex/adapters/ExploreRepositoriesAdapter.java +++ b/app/src/main/java/org/mian/gitnex/adapters/ExploreRepositoriesAdapter.java @@ -26,6 +26,7 @@ import org.mian.gitnex.models.UserRepositories; import org.mian.gitnex.util.TinyDB; import java.lang.reflect.Field; import java.util.List; +import java.util.Objects; /** * Author M M Arif @@ -102,7 +103,7 @@ public class ExploreRepositoriesAdapter extends RecyclerView.Adapter call = RetrofitClient + .getInstance(instanceUrl, getContext()) + .getApiInterface() + .queryRepos(Authorization.returnAuthentication(getContext(), loginUid, instanceToken), null, repoTypeInclude, sort, order, limit); + + call.enqueue(new Callback() { + + @Override + public void onResponse(@NonNull Call call, @NonNull Response response) { + + if (response.isSuccessful()) { + assert response.body() != null; + getReposList(response.body().getSearchedData(), context); + } else { + Log.i("onResponse", String.valueOf(response.code())); + } + + } + + @Override + public void onFailure(@NonNull Call call, @NonNull Throwable t) { + Log.i("onFailure", Objects.requireNonNull(t.getMessage())); + } + + }); + + } + private void loadSearchReposList(String instanceUrl, String instanceToken, String loginUid, String searchKeyword, Boolean repoTypeInclude, String sort, String order, final Context context, int limit) { Call call = RetrofitClient