diff --git a/.woodpecker/build.yml b/.woodpecker/build.yml index d216c01c..a612ae0f 100644 --- a/.woodpecker/build.yml +++ b/.woodpecker/build.yml @@ -22,7 +22,6 @@ steps: upload: image: curlimages/curl:7.82.0 - group: upload environment: WEBDAV_USERNAME: "GitNexBot" PLUGIN_FILE: "signed.apk" @@ -37,7 +36,6 @@ steps: upload-release: image: curlimages/curl:7.82.0 - group: upload environment: WEBDAV_USERNAME: "GitNexBot" PLUGIN_FILE: "signed.apk" diff --git a/.woodpecker/check.yml b/.woodpecker/check.yml index a5eefc89..23004ff1 100644 --- a/.woodpecker/check.yml +++ b/.woodpecker/check.yml @@ -1,7 +1,6 @@ steps: author-header: image: qwerty287/woodpecker-regex-check - group: check settings: pattern: "*.java" regex: " \\\\* \\\\@author [\\\\S\\\\s]+" @@ -9,7 +8,6 @@ steps: style: image: alvrme/alpine-android:android-32-jdk17 - group: check commands: - ./gradlew :app:spotlessCheck diff --git a/app/src/main/java/org/mian/gitnex/fragments/MostVisitedReposFragment.java b/app/src/main/java/org/mian/gitnex/fragments/MostVisitedReposFragment.java index 5cef5abf..93a438c5 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/MostVisitedReposFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/MostVisitedReposFragment.java @@ -124,7 +124,7 @@ public class MostVisitedReposFragment extends Fragment { MenuItem searchItem = menu.findItem(R.id.action_search); SearchView searchView = (SearchView) searchItem.getActionView(); - searchView.setImeOptions(EditorInfo.IME_ACTION_DONE); + Objects.requireNonNull(searchView).setImeOptions(EditorInfo.IME_ACTION_DONE); searchView.setOnQueryTextListener( new SearchView.OnQueryTextListener() { diff --git a/app/src/main/java/org/mian/gitnex/fragments/OrganizationInfoFragment.java b/app/src/main/java/org/mian/gitnex/fragments/OrganizationInfoFragment.java index 2178cbbe..34024d24 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/OrganizationInfoFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/OrganizationInfoFragment.java @@ -6,10 +6,6 @@ import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.widget.ImageView; -import android.widget.LinearLayout; -import android.widget.ProgressBar; -import android.widget.TextView; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; import org.gitnex.tea4j.v2.models.Organization; @@ -27,15 +23,10 @@ import retrofit2.Callback; */ public class OrganizationInfoFragment extends Fragment { + FragmentOrganizationInfoBinding fragmentOrganizationInfoBinding; private static final String orgNameF = "param1"; private Context ctx; - private ProgressBar mProgressBar; private String orgName; - private ImageView orgAvatar; - private TextView orgDescInfo; - private TextView orgWebsiteInfo; - private TextView orgLocationInfo; - private LinearLayout orgInfoLayout; public OrganizationInfoFragment() {} @@ -59,21 +50,11 @@ public class OrganizationInfoFragment extends Fragment { public View onCreateView( @NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - FragmentOrganizationInfoBinding fragmentOrganizationInfoBinding = + fragmentOrganizationInfoBinding = FragmentOrganizationInfoBinding.inflate(inflater, container, false); ctx = getContext(); - mProgressBar = fragmentOrganizationInfoBinding.progressBar; - orgAvatar = fragmentOrganizationInfoBinding.orgAvatar; - TextView orgNameInfo = fragmentOrganizationInfoBinding.orgNameInfo; - orgDescInfo = fragmentOrganizationInfoBinding.orgDescInfo; - orgWebsiteInfo = fragmentOrganizationInfoBinding.orgWebsiteInfo; - orgLocationInfo = fragmentOrganizationInfoBinding.orgLocationInfo; - orgInfoLayout = fragmentOrganizationInfoBinding.orgInfoLayout; - - orgNameInfo.setText(orgName); - getOrgInfo(orgName); return fragmentOrganizationInfoBinding.getRoot(); @@ -84,7 +65,7 @@ public class OrganizationInfoFragment extends Fragment { Call call = RetrofitClient.getApiInterface(getContext()).orgGet(owner); call.enqueue( - new Callback() { + new Callback<>() { @Override public void onResponse( @@ -95,7 +76,8 @@ public class OrganizationInfoFragment extends Fragment { if (response.code() == 200) { - orgInfoLayout.setVisibility(View.VISIBLE); + fragmentOrganizationInfoBinding.orgInfoLayout.setVisibility( + View.VISIBLE); assert orgInfo != null; @@ -106,31 +88,49 @@ public class OrganizationInfoFragment extends Fragment { .transform(new RoundedTransformation(8, 0)) .resize(230, 230) .centerCrop() - .into(orgAvatar); + .into(fragmentOrganizationInfoBinding.orgAvatar); + + if (orgInfo.getFullName() != null && !orgInfo.getFullName().isEmpty()) { + fragmentOrganizationInfoBinding.orgNameInfo.setText( + getString( + R.string.organizationFullname, + orgInfo.getFullName(), + orgName)); + } else { + fragmentOrganizationInfoBinding.orgNameInfo.setText(orgName); + } if (!orgInfo.getDescription().isEmpty()) { - Markdown.render(ctx, orgInfo.getDescription(), orgDescInfo); + Markdown.render( + ctx, + orgInfo.getDescription(), + fragmentOrganizationInfoBinding.orgDescInfo); } else { - orgDescInfo.setText(getString(R.string.noDataDescription)); + fragmentOrganizationInfoBinding.orgDescInfo.setText( + getString(R.string.noDataDescription)); } if (!orgInfo.getWebsite().isEmpty()) { - orgWebsiteInfo.setText(orgInfo.getWebsite()); + fragmentOrganizationInfoBinding.orgWebsiteInfo.setText( + orgInfo.getWebsite()); } else { - orgWebsiteInfo.setText(getString(R.string.noDataWebsite)); + fragmentOrganizationInfoBinding.orgWebsiteInfo.setText( + getString(R.string.noDataWebsite)); } if (!orgInfo.getLocation().isEmpty()) { - orgLocationInfo.setText(orgInfo.getLocation()); + fragmentOrganizationInfoBinding.orgLocationInfo.setText( + orgInfo.getLocation()); } else { - orgLocationInfo.setText(getString(R.string.noDataLocation)); + fragmentOrganizationInfoBinding.orgLocationInfo.setText( + getString(R.string.noDataLocation)); } - mProgressBar.setVisibility(View.GONE); + fragmentOrganizationInfoBinding.progressBar.setVisibility(View.GONE); } else if (response.code() == 404) { - mProgressBar.setVisibility(View.GONE); + fragmentOrganizationInfoBinding.progressBar.setVisibility(View.GONE); } else { Log.e("onFailure", String.valueOf(response.code())); @@ -138,9 +138,7 @@ public class OrganizationInfoFragment extends Fragment { } @Override - public void onFailure(@NonNull Call call, @NonNull Throwable t) { - Log.e("onFailure", t.toString()); - } + public void onFailure(@NonNull Call call, @NonNull Throwable t) {} }); } } diff --git a/app/src/main/java/org/mian/gitnex/fragments/RepoInfoFragment.java b/app/src/main/java/org/mian/gitnex/fragments/RepoInfoFragment.java index 2c65aae7..87434fed 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/RepoInfoFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/RepoInfoFragment.java @@ -400,7 +400,7 @@ public class RepoInfoFragment extends Fragment { binding.repoMetaDescription.setText(getString(R.string.noDataDescription)); } - binding.repoMetaStars.setText(String.valueOf(repoInfo.getStarsCount())); + binding.repoMetaStars.setText(AppUtil.numberFormatter(repoInfo.getStarsCount())); if (repoInfo.getOpenPrCounter() != null) { binding.repoMetaPullRequests.setText(String.valueOf(repoInfo.getOpenPrCounter())); diff --git a/app/src/main/java/org/mian/gitnex/helpers/Version.java b/app/src/main/java/org/mian/gitnex/helpers/Version.java index 6c813fdb..d52687f3 100644 --- a/app/src/main/java/org/mian/gitnex/helpers/Version.java +++ b/app/src/main/java/org/mian/gitnex/helpers/Version.java @@ -1,5 +1,6 @@ package org.mian.gitnex.helpers; +import android.util.Log; import androidx.annotation.NonNull; import java.util.ArrayList; import java.util.List; @@ -55,7 +56,8 @@ public class Version { } if (!valid(raw)) { - throw new IllegalArgumentException("Invalid version format: " + raw); + // throw new IllegalArgumentException("Invalid version format: " + raw); + Log.e("Version", "Invalid version format: " + raw); } if (raw.equals("main")) { dev = true; diff --git a/app/src/main/res/layout/custom_about_dialog.xml b/app/src/main/res/layout/custom_about_dialog.xml index e2139e7c..63b4b8b4 100644 --- a/app/src/main/res/layout/custom_about_dialog.xml +++ b/app/src/main/res/layout/custom_about_dialog.xml @@ -209,6 +209,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="@dimen/dimen12dp" + android:visibility="gone" android:orientation="horizontal"> - + Organization Name Organization Description + %1$s - %2$s Username Password diff --git a/app/src/test/java/org/mian/gitnex/helpers/VersionTest.java b/app/src/test/java/org/mian/gitnex/helpers/VersionTest.java index 1ba83f3f..a7ac6d9c 100644 --- a/app/src/test/java/org/mian/gitnex/helpers/VersionTest.java +++ b/app/src/test/java/org/mian/gitnex/helpers/VersionTest.java @@ -9,10 +9,10 @@ import org.junit.Test; */ public class VersionTest { - @Test + /*@Test public void invalid() { assertThrows(IllegalArgumentException.class, () -> new Version("abcd")); - } + }*/ @Test public void equal() {