Update build process, fix crash on repo name saving (#1276)

Closes #1227

Co-authored-by: M M Arif <mmarif@swatian.com>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1276
This commit is contained in:
M M Arif 2023-07-18 18:32:32 +00:00
parent 60f1317d6b
commit ea954503bf
17 changed files with 306 additions and 175 deletions

View File

@ -1,13 +1,13 @@
pipeline:
build:
image: alvrme/alpine-android:android-31-jdk11
image: alvrme/alpine-android:android-32-jdk17
commands:
- ./gradlew assembleFreeRelease
when:
path: [ app/**, build.gradle ]
sign:
image: alvrme/alpine-android:android-31-jdk11
image: alvrme/alpine-android:android-32-jdk17
environment:
OUTPUT: "signed.apk"
INSTANCE: "https://codeberg.org"

View File

@ -8,12 +8,12 @@ pipeline:
must_contain: true
style:
image: alvrme/alpine-android:android-31-jdk11
image: alvrme/alpine-android:android-32-jdk17
group: check
commands:
- ./gradlew :app:spotlessCheck
test:
image: alvrme/alpine-android:android-31-jdk11
image: alvrme/alpine-android:android-32-jdk17
commands:
- ./gradlew test

View File

@ -4,13 +4,13 @@ plugins {
apply plugin: 'com.android.application'
android {
compileSdkVersion 33
compileSdkVersion 34
defaultConfig {
applicationId "org.mian.gitnex"
minSdkVersion 23
targetSdkVersion 33
versionCode 510
versionName "5.1.0"
targetSdkVersion 34
versionCode 515
versionName "5.2.0-dev"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
@ -37,7 +37,7 @@ android {
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_17
}
lint {
abortOnError false
@ -54,17 +54,17 @@ configurations {
}
dependencies {
def lifecycle_version = '2.6.0'
def lifecycle_version = '2.6.1'
def markwon_version = '4.6.2'
def work_version = '2.8.1'
def acra = '5.9.7'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.9.0-beta01'
implementation 'androidx.compose.material3:material3:1.1.0-beta01'
implementation 'androidx.compose.material3:material3-window-size-class:1.1.0-beta01'
implementation 'androidx.viewpager2:viewpager2:1.1.0-beta01'
implementation 'com.google.android.material:material:1.11.0-alpha01'
implementation 'androidx.compose.material3:material3:1.2.0-alpha03'
implementation 'androidx.compose.material3:material3-window-size-class:1.2.0-alpha03'
implementation 'androidx.viewpager2:viewpager2:1.1.0-beta02'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation "androidx.legacy:legacy-support-v4:1.0.0"
implementation "androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version"
@ -79,7 +79,7 @@ dependencies {
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.squareup.retrofit2:converter-scalars:2.9.0'
implementation 'com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.2'
implementation 'org.ocpsoft.prettytime:prettytime:5.0.6.Final'
implementation 'org.ocpsoft.prettytime:prettytime:5.0.7.Final'
implementation 'com.github.Pes8:android-material-color-picker-dialog:master'
implementation "io.noties.markwon:core:$markwon_version"
implementation "io.noties.markwon:ext-latex:$markwon_version"
@ -103,8 +103,8 @@ dependencies {
implementation "ch.acra:acra-mail:$acra"
implementation "ch.acra:acra-limiter:$acra"
implementation "ch.acra:acra-notification:$acra"
implementation 'androidx.room:room-runtime:2.5.1'
annotationProcessor 'androidx.room:room-compiler:2.5.1'
implementation 'androidx.room:room-runtime:2.5.2'
annotationProcessor 'androidx.room:room-compiler:2.5.2'
implementation "androidx.work:work-runtime:$work_version"
implementation "io.mikael:urlbuilder:2.0.9"
implementation "org.codeberg.gitnex-garage:emoji-java:v5.1.2"
@ -113,10 +113,10 @@ dependencies {
implementation 'com.github.chrisvest:stormpot:2.4.2'
implementation 'androidx.browser:browser:1.5.0'
implementation 'com.google.android.flexbox:flexbox:3.0.0'
implementation('org.codeberg.gitnex:tea4j-autodeploy:3111bc1b18') {
implementation('org.codeberg.gitnex:tea4j-autodeploy:65f700d036') {
exclude module: 'org.apache.oltu.oauth2.common'
}
implementation 'io.github.amrdeveloper:codeview:1.3.7'
implementation 'io.github.amrdeveloper:codeview:1.3.8'
constraints {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.0")

View File

@ -126,7 +126,17 @@ public class CommitsActivity extends BaseActivity {
Call<List<Commit>> call =
RetrofitClient.getApiInterface(ctx)
.repoGetAllCommits(repoOwner, repoName, branchName, null, 1, resultLimit);
.repoGetAllCommits(
repoOwner,
repoName,
branchName,
null,
true,
false,
true,
1,
resultLimit,
"");
call.enqueue(
new Callback<>() {
@ -180,7 +190,16 @@ public class CommitsActivity extends BaseActivity {
Call<List<Commit>> call =
RetrofitClient.getApiInterface(ctx)
.repoGetAllCommits(
repoOwner, repoName, branchName, null, page, resultLimit);
repoOwner,
repoName,
branchName,
null,
true,
false,
true,
page,
resultLimit,
"");
call.enqueue(
new Callback<>() {

View File

@ -639,6 +639,10 @@ public class LoginActivity extends BaseActivity {
final String credential = Credentials.basic(loginUid, loginPass, StandardCharsets.UTF_8);
CreateAccessTokenOption createUserToken = new CreateAccessTokenOption().name(tokenName);
if (giteaVersion.higherOrEqual("1.19.0")) {
createUserToken.addScopesItem("all");
createUserToken.addScopesItem("sudo");
}
Call<AccessToken> callCreateToken;
if (loginOTP != 0) {

View File

@ -4,28 +4,20 @@ import android.annotation.SuppressLint;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import androidx.annotation.NonNull;
import androidx.appcompat.widget.SearchView;
import androidx.appcompat.widget.Toolbar;
import androidx.lifecycle.ViewModelProvider;
import androidx.recyclerview.widget.LinearLayoutManager;
import java.util.ArrayList;
import java.util.List;
import org.gitnex.tea4j.v2.models.Repository;
import org.mian.gitnex.R;
import org.mian.gitnex.adapters.RepoForksAdapter;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.ActivityRepoForksBinding;
import org.mian.gitnex.helpers.Constants;
import org.mian.gitnex.helpers.contexts.RepositoryContext;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import org.mian.gitnex.viewmodels.RepositoryForksViewModel;
/**
* @author M M Arif
@ -33,13 +25,8 @@ import retrofit2.Response;
public class RepoForksActivity extends BaseActivity {
private ActivityRepoForksBinding activityRepoForksBinding;
private final String TAG = "RepositoryForks";
private int resultLimit;
private int pageSize = 1;
private List<Repository> forksList;
private RepoForksAdapter adapter;
private RepositoryContext repository;
@SuppressLint("DefaultLocale")
@ -55,15 +42,11 @@ public class RepoForksActivity extends BaseActivity {
setSupportActionBar(toolbar);
repository = RepositoryContext.fromIntent(getIntent());
final String repoOwner = repository.getOwner();
final String repoName = repository.getName();
activityRepoForksBinding.toolbarTitle.setText(
ctx.getResources().getString(R.string.infoTabRepoForksCount));
activityRepoForksBinding.close.setOnClickListener(v -> finish());
resultLimit = Constants.getCurrentResultLimit(ctx);
forksList = new ArrayList<>();
activityRepoForksBinding.pullToRefresh.setOnRefreshListener(
() ->
@ -73,128 +56,77 @@ public class RepoForksActivity extends BaseActivity {
pageSize = 1;
activityRepoForksBinding.pullToRefresh.setRefreshing(
false);
loadInitial(repoOwner, repoName, pageSize, resultLimit);
adapter.notifyDataChanged();
fetchData();
activityRepoForksBinding.progressBar.setVisibility(
View.VISIBLE);
},
200));
adapter = new RepoForksAdapter(ctx, forksList);
adapter.setLoadMoreListener(
() ->
activityRepoForksBinding.recyclerView.post(
() -> {
if (forksList.size() == resultLimit
|| pageSize == resultLimit) {
int page = (forksList.size() + resultLimit) / resultLimit;
loadMore(repoOwner, repoName, page, resultLimit);
}
}));
150));
activityRepoForksBinding.recyclerView.setHasFixedSize(true);
activityRepoForksBinding.recyclerView.setLayoutManager(new LinearLayoutManager(ctx));
activityRepoForksBinding.recyclerView.setAdapter(adapter);
loadInitial(repoOwner, repoName, pageSize, resultLimit);
fetchData();
}
private void loadInitial(String repoOwner, String repoName, int pageSize, int resultLimit) {
private void fetchData() {
Call<List<Repository>> call =
RetrofitClient.getApiInterface(ctx)
.listForks(repoOwner, repoName, pageSize, resultLimit);
RepositoryForksViewModel repositoryForksViewModel =
new ViewModelProvider(this).get(RepositoryForksViewModel.class);
call.enqueue(
new Callback<>() {
repositoryForksViewModel
.getForksList(repository.getOwner(), repository.getName(), ctx)
.observe(
this,
forksListMain -> {
adapter = new RepoForksAdapter(ctx, forksListMain);
adapter.setLoadMoreListener(
new RepoForksAdapter.OnLoadMoreListener() {
@Override
public void onResponse(
@NonNull Call<List<Repository>> call,
@NonNull Response<List<Repository>> response) {
@Override
public void onLoadMore() {
if (response.isSuccessful()) {
pageSize += 1;
repositoryForksViewModel.loadMore(
repository.getOwner(),
repository.getName(),
pageSize,
ctx,
adapter);
activityRepoForksBinding.progressBar.setVisibility(
View.VISIBLE);
}
assert response.body() != null;
@Override
public void onLoadFinished() {
if (response.body().size() > 0) {
forksList.clear();
forksList.addAll(response.body());
adapter.notifyDataChanged();
activityRepoForksBinding.progressBar.setVisibility(
View.GONE);
}
});
if (adapter.getItemCount() > 0) {
activityRepoForksBinding.recyclerView.setAdapter(adapter);
activityRepoForksBinding.noData.setVisibility(View.GONE);
} else {
forksList.clear();
adapter.notifyDataChanged();
activityRepoForksBinding.recyclerView.setAdapter(adapter);
activityRepoForksBinding.noData.setVisibility(View.VISIBLE);
}
activityRepoForksBinding.progressBar.setVisibility(View.GONE);
} else {
Log.e(TAG, String.valueOf(response.code()));
}
}
@Override
public void onFailure(
@NonNull Call<List<Repository>> call, @NonNull Throwable t) {
Log.e(TAG, t.toString());
}
});
}
private void loadMore(String repoOwner, String repoName, int page, int resultLimit) {
activityRepoForksBinding.progressLoadMore.setVisibility(View.VISIBLE);
Call<List<Repository>> call =
RetrofitClient.getApiInterface(ctx)
.listForks(repoOwner, repoName, page, resultLimit);
call.enqueue(
new Callback<>() {
@Override
public void onResponse(
@NonNull Call<List<Repository>> call,
@NonNull Response<List<Repository>> response) {
if (response.isSuccessful()) {
// remove loading view
forksList.remove(forksList.size() - 1);
List<Repository> result = response.body();
assert result != null;
if (result.size() > 0) {
pageSize = result.size();
forksList.addAll(result);
} else {
adapter.setMoreDataAvailable(false);
}
adapter.notifyDataChanged();
activityRepoForksBinding.progressLoadMore.setVisibility(View.GONE);
} else {
Log.e(TAG, String.valueOf(response.code()));
}
}
@Override
public void onFailure(
@NonNull Call<List<Repository>> call, @NonNull Throwable t) {
Log.e(TAG, t.toString());
}
});
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
public boolean onCreateOptionsMenu(@NonNull Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.search_menu, menu);
super.onCreateOptionsMenu(menu);
MenuItem searchItem = menu.findItem(R.id.action_search);
SearchView searchView = (SearchView) searchItem.getActionView();
androidx.appcompat.widget.SearchView searchView =
(androidx.appcompat.widget.SearchView) searchItem.getActionView();
searchView.setImeOptions(EditorInfo.IME_ACTION_DONE);
searchView.setOnQueryTextListener(
@ -207,27 +139,13 @@ public class RepoForksActivity extends BaseActivity {
@Override
public boolean onQueryTextChange(String newText) {
filter(newText);
return true;
if (activityRepoForksBinding.recyclerView.getAdapter() != null) {
adapter.getFilter().filter(newText);
}
return false;
}
});
return super.onCreateOptionsMenu(menu);
}
private void filter(String text) {
List<Repository> userRepositories = new ArrayList<>();
for (Repository d : forksList) {
if (d.getOwner().getLogin().contains(text)
|| d.getName().toLowerCase().contains(text)
|| d.getDescription().toLowerCase().contains(text)) {
userRepositories.add(d);
}
}
adapter.updateList(userRepositories);
return false;
}
@Override

View File

@ -42,6 +42,7 @@ public class RepositorySettingsActivity extends BaseActivity {
private View.OnClickListener onClickListener;
private RepositoryContext repository;
private String repositoryName;
@Override
public void onCreate(Bundle savedInstanceState) {
@ -52,6 +53,7 @@ public class RepositorySettingsActivity extends BaseActivity {
setContentView(viewBinding.getRoot());
repository = RepositoryContext.fromIntent(getIntent());
;
ImageView closeActivity = findViewById(R.id.close);
@ -246,6 +248,8 @@ public class RepositorySettingsActivity extends BaseActivity {
propBinding.repoEnableIssues.setChecked(repoInfo.isHasIssues());
repositoryName = repoInfo.getName();
propBinding.repoEnableIssues.setOnCheckedChangeListener(
(buttonView, isChecked) -> {
if (isChecked) {
@ -340,19 +344,22 @@ public class RepositorySettingsActivity extends BaseActivity {
dialogRepo.dismiss();
Toasty.success(ctx, getString(R.string.repoPropertiesSaveSuccess));
assert response.body() != null;
repository.setRepository(response.body());
if (!repository.getName().equals(repoName)) {
int currentActiveAccountId =
tinyDB.getInt("currentActiveAccountId");
Objects.requireNonNull(
BaseApi.getInstance(ctx, RepositoriesApi.class))
.updateRepositoryOwnerAndName(
repository.getOwner(),
repoName,
repository.getRepositoryId());
Intent result = new Intent();
result.putExtra("nameChanged", true);
setResult(200, result);
.deleteRepositoryByName(
currentActiveAccountId, repositoryName);
Intent intent =
new Intent(
RepositorySettingsActivity.this,
MainActivity.class);
RepositorySettingsActivity.this.startActivity(intent);
finish();
}
} else {

View File

@ -8,12 +8,15 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.Filter;
import android.widget.Filterable;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.amulyakhare.textdrawable.TextDrawable;
import com.amulyakhare.textdrawable.util.ColorGenerator;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import org.mian.gitnex.R;
@ -29,19 +32,62 @@ import org.mian.gitnex.helpers.contexts.RepositoryContext;
/**
* @author M M Arif
*/
public class RepoForksAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
public class RepoForksAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
implements Filterable {
private final List<org.gitnex.tea4j.v2.models.Repository> forksListFull;
private final Context context;
private List<org.gitnex.tea4j.v2.models.Repository> forksList;
private Runnable loadMoreListener;
private boolean isLoading = false;
private boolean isMoreDataAvailable = true;
private OnLoadMoreListener loadMoreListener;
private boolean isLoading = false, isMoreDataAvailable = true;
private final Filter forksFilter =
new Filter() {
@Override
protected FilterResults performFiltering(CharSequence constraint) {
List<org.gitnex.tea4j.v2.models.Repository> filteredList = new ArrayList<>();
if (constraint == null || constraint.length() == 0) {
filteredList.addAll(forksListFull);
} else {
String filterPattern = constraint.toString().toLowerCase().trim();
for (org.gitnex.tea4j.v2.models.Repository item : forksListFull) {
if (item.getFullName().toLowerCase().contains(filterPattern)
|| item.getOwner()
.getLogin()
.toLowerCase()
.contains(filterPattern)
|| item.getOwner()
.getEmail()
.toLowerCase()
.contains(filterPattern)) {
filteredList.add(item);
}
}
}
FilterResults results = new FilterResults();
results.values = filteredList;
return results;
}
@Override
protected void publishResults(CharSequence constraint, FilterResults results) {
forksList.clear();
forksList.addAll((List) results.values);
notifyDataChanged();
}
};
public RepoForksAdapter(
Context ctx, List<org.gitnex.tea4j.v2.models.Repository> forksListMain) {
this.context = ctx;
this.forksList = forksListMain;
forksListFull = new ArrayList<>(forksList);
}
@NonNull @Override
@ -59,7 +105,7 @@ public class RepoForksAdapter extends RecyclerView.Adapter<RecyclerView.ViewHold
&& !isLoading
&& loadMoreListener != null) {
isLoading = true;
loadMoreListener.run();
loadMoreListener.onLoadMore();
}
((RepoForksAdapter.ForksHolder) holder).bindData(forksList.get(position));
}
@ -76,15 +122,19 @@ public class RepoForksAdapter extends RecyclerView.Adapter<RecyclerView.ViewHold
public void setMoreDataAvailable(boolean moreDataAvailable) {
isMoreDataAvailable = moreDataAvailable;
if (!isMoreDataAvailable) {
loadMoreListener.onLoadFinished();
}
}
@SuppressLint("NotifyDataSetChanged")
public void notifyDataChanged() {
notifyDataSetChanged();
isLoading = false;
loadMoreListener.onLoadFinished();
}
public void setLoadMoreListener(Runnable loadMoreListener) {
public void setLoadMoreListener(OnLoadMoreListener loadMoreListener) {
this.loadMoreListener = loadMoreListener;
}
@ -93,6 +143,18 @@ public class RepoForksAdapter extends RecyclerView.Adapter<RecyclerView.ViewHold
notifyDataChanged();
}
@Override
public Filter getFilter() {
return forksFilter;
}
public interface OnLoadMoreListener {
void onLoadMore();
void onLoadFinished();
}
class ForksHolder extends RecyclerView.ViewHolder {
private final ImageView image;

View File

@ -79,6 +79,14 @@ public class RepositoriesApi extends BaseApi {
executorService.execute(() -> repositoriesDao.deleteRepository(repositoryId));
}
public void deleteRepositoryByName(
final int currentActiveAccountId, final String repositoryName) {
executorService.execute(
() ->
repositoriesDao.deleteRepositoryByName(
currentActiveAccountId, repositoryName));
}
public void updateRepositoryMostVisited(int mostVisited, int repositoryId) {
executorService.execute(
() -> repositoriesDao.updateRepositoryMostVisited(mostVisited, repositoryId));

View File

@ -46,6 +46,10 @@ public interface RepositoriesDao {
@Query("DELETE FROM Repositories WHERE repositoryId = :repositoryId")
void deleteRepository(int repositoryId);
@Query(
"DELETE FROM Repositories WHERE repositoryName = :repositoryName AND repoAccountId = :currentActiveAccountId")
void deleteRepositoryByName(int currentActiveAccountId, String repositoryName);
@Query("DELETE FROM Repositories WHERE repoAccountId = :repoAccountId")
void deleteRepositoriesByAccount(int repoAccountId);

View File

@ -185,7 +185,7 @@ public class CommitDetailFragment extends Fragment {
private void getCommit() {
RetrofitClient.getApiInterface(requireContext())
.repoGetSingleCommit(repoOwner, repoName, sha)
.repoGetSingleCommit(repoOwner, repoName, sha, true, false, true)
.enqueue(
new Callback<>() {

View File

@ -33,7 +33,7 @@ public class AdminGetUsersViewModel extends ViewModel {
public void loadUsersList(int page, int resultLimit, Context ctx) {
Call<List<User>> call =
RetrofitClient.getApiInterface(ctx).adminGetAllUsers(page, resultLimit);
RetrofitClient.getApiInterface(ctx).adminSearchUsers(null, null, page, resultLimit);
call.enqueue(
new Callback<>() {
@ -61,7 +61,7 @@ public class AdminGetUsersViewModel extends ViewModel {
int page, int resultLimit, Context ctx, AdminGetUsersAdapter adapter) {
Call<List<User>> call =
RetrofitClient.getApiInterface(ctx).adminGetAllUsers(page, resultLimit);
RetrofitClient.getApiInterface(ctx).adminSearchUsers(null, null, page, resultLimit);
call.enqueue(
new Callback<>() {

View File

@ -63,6 +63,7 @@ public class IssuesViewModel extends ViewModel {
null,
null,
null,
null,
1,
resultLimit);
@ -116,6 +117,7 @@ public class IssuesViewModel extends ViewModel {
null,
null,
null,
null,
page,
resultLimit);

View File

@ -0,0 +1,104 @@
package org.mian.gitnex.viewmodels;
import android.content.Context;
import androidx.annotation.NonNull;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
import java.util.List;
import org.gitnex.tea4j.v2.models.Repository;
import org.mian.gitnex.R;
import org.mian.gitnex.adapters.RepoForksAdapter;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.helpers.Constants;
import org.mian.gitnex.helpers.Toasty;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
/**
* @author M M Arif
*/
public class RepositoryForksViewModel extends ViewModel {
private MutableLiveData<List<Repository>> forksList;
private int resultLimit;
public LiveData<List<Repository>> getForksList(String repoOwner, String repoName, Context ctx) {
forksList = new MutableLiveData<>();
resultLimit = Constants.getCurrentResultLimit(ctx);
loadInitialList(repoOwner, repoName, ctx);
return forksList;
}
public void loadInitialList(String repoOwner, String repoName, Context ctx) {
Call<List<Repository>> call =
RetrofitClient.getApiInterface(ctx).listForks(repoOwner, repoName, 1, resultLimit);
call.enqueue(
new Callback<>() {
@Override
public void onResponse(
@NonNull Call<List<Repository>> call,
@NonNull Response<List<Repository>> response) {
if (response.isSuccessful()) {
forksList.postValue(response.body());
} else {
Toasty.error(ctx, ctx.getString(R.string.genericError));
}
}
@Override
public void onFailure(
@NonNull Call<List<Repository>> call, @NonNull Throwable t) {
Toasty.error(ctx, ctx.getString(R.string.genericServerResponseError));
}
});
}
public void loadMore(
String repoOwner, String repoName, int page, Context ctx, RepoForksAdapter adapter) {
Call<List<Repository>> call =
RetrofitClient.getApiInterface(ctx)
.listForks(repoOwner, repoName, page, resultLimit);
call.enqueue(
new Callback<>() {
@Override
public void onResponse(
@NonNull Call<List<Repository>> call,
@NonNull Response<List<Repository>> response) {
if (response.isSuccessful()) {
List<Repository> list = forksList.getValue();
assert list != null;
assert response.body() != null;
if (response.body().size() != 0) {
list.addAll(response.body());
adapter.updateList(list);
} else {
adapter.setMoreDataAvailable(false);
}
} else {
Toasty.error(ctx, ctx.getString(R.string.genericError));
}
}
@Override
public void onFailure(
@NonNull Call<List<Repository>> call, @NonNull Throwable t) {
Toasty.error(ctx, ctx.getString(R.string.genericServerResponseError));
}
});
}
}

View File

@ -7,7 +7,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
classpath 'com.android.tools.build:gradle:8.0.2'
}
}

View File

@ -6,9 +6,12 @@
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
android.defaults.buildfeatures.buildconfig=true
android.enableJetifier=true
android.nonFinalResIds=false
android.nonTransitiveRClass=false
android.useAndroidX=true
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=1024m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.jvmargs=-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.workers.max=12
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit

View File

@ -1,6 +1,6 @@
#Wed Feb 10 19:24:36 CET 2021
#Tue Jul 11 23:34:25 PKT 2023
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-all.zip