Fix crash on repo insertion to db, rollback a lib and layout fixes

This commit is contained in:
M M Arif 2022-08-08 01:02:08 +05:00
parent 55478b2e50
commit 46896ece2d
6 changed files with 20 additions and 21 deletions

View file

@ -108,7 +108,7 @@ dependencies {
implementation "androidx.work:work-runtime:$work_version"
implementation "io.mikael:urlbuilder:2.0.9"
implementation "org.codeberg.gitnex-garage:emoji-java:v5.1.2"
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:1.2.0"
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:1.1.5"
implementation 'androidx.biometric:biometric:1.1.0'
implementation 'com.github.chrisvest:stormpot:2.4.2'
implementation 'androidx.browser:browser:1.4.0'

View file

@ -77,7 +77,7 @@ public class MostVisitedReposAdapter extends RecyclerView.Adapter<MostVisitedRep
ColorGenerator generator = ColorGenerator.Companion.getMATERIAL();
int color = generator.getColor(currentItem.getRepositoryOwner());
String firstCharacter = String.valueOf(currentItem.getRepositoryOwner().charAt(0));
TextDrawable drawable = TextDrawable.builder().beginConfig().useFont(Typeface.DEFAULT).fontSize(18).toUpperCase().width(28).height(28).endConfig().buildRoundRect(firstCharacter, color, 3);
TextDrawable drawable = TextDrawable.builder().beginConfig().useFont(Typeface.DEFAULT).fontSize(18).toUpperCase().width(28).height(28).endConfig().buildRoundRect(firstCharacter, color, 14);
holder.image.setImageDrawable(drawable);
holder.orgName.setText(currentItem.getRepositoryOwner());

View file

@ -33,7 +33,6 @@ public class RepositoryContext implements Serializable {
OPEN,
CLOSED;
@NonNull
@Override
public String toString() {
@ -243,11 +242,10 @@ public class RepositoryContext implements Serializable {
RepositoriesApi repositoryData = BaseApi.getInstance(context, RepositoriesApi.class);
assert repositoryData != null;
Integer count = repositoryData.checkRepository(currentActiveAccountId, getOwner(), getName());
Repository getMostVisitedValue = repositoryData.getRepository(currentActiveAccountId, getOwner(), getName());
if(count == 0) {
long id = repositoryData.insertRepository(currentActiveAccountId, getOwner(), getName(), getMostVisitedValue.getMostVisited() + 1);
if(getMostVisitedValue == null) {
long id = repositoryData.insertRepository(currentActiveAccountId, getOwner(), getName(), 1);
setRepositoryId((int) id);
return (int) id;
}

View file

@ -70,7 +70,7 @@
android:layout_marginBottom="@dimen/dimen8dp"
android:hint="@string/protocol"
app:endIconTint="?attr/iconsColor"
style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox.ExposedDropdownMenu">
style="@style/Widget.Material3.TextInputLayout.OutlinedBox.ExposedDropdownMenu">
<AutoCompleteTextView
android:id="@+id/httpsSpinner"

View file

@ -7,23 +7,23 @@
android:background="?android:attr/selectableItemBackground"
android:focusable="true"
android:orientation="vertical"
android:padding="16dp">
android:padding="@dimen/dimen16dp">
<LinearLayout
android:id="@+id/org_info_frame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginBottom="@dimen/dimen8dp"
android:gravity="center_vertical"
android:orientation="horizontal"
tools:ignore="UseCompoundDrawables">
<ImageView
android:id="@+id/image"
android:layout_width="@dimen/list_avatar_size"
android:layout_height="@dimen/list_avatar_size"
android:layout_marginStart="0dp"
android:layout_marginEnd="10dp"
android:layout_width="@dimen/dimen24dp"
android:layout_height="@dimen/dimen24dp"
android:layout_marginStart="@dimen/dimen0dp"
android:layout_marginEnd="@dimen/dimen10dp"
android:contentDescription="@string/repoContentAvatar"
android:src="@drawable/ic_android" />
@ -32,7 +32,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?attr/primaryTextColor"
android:textSize="14sp"
android:textSize="@dimen/dimen14sp"
tools:text="@string/orgName" />
</LinearLayout>
@ -43,14 +43,14 @@
android:layout_height="wrap_content"
android:text="@string/repoName"
android:textColor="?attr/primaryTextColor"
android:textSize="16sp"
android:textSize="@dimen/dimen16sp"
android:textStyle="bold" />
<View
android:id="@+id/spacer_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="8dp" />
android:layout_marginBottom="@dimen/dimen8dp" />
<LinearLayout
android:id="@+id/repo_info_stars_frame"
@ -61,10 +61,10 @@
tools:ignore="UseCompoundDrawables">
<ImageView
android:layout_width="18dp"
android:layout_height="18dp"
android:layout_marginStart="0dp"
android:layout_marginEnd="5dp"
android:layout_width="@dimen/dimen18dp"
android:layout_height="@dimen/dimen18dp"
android:layout_marginStart="@dimen/dimen0dp"
android:layout_marginEnd="@dimen/dimen6dp"
android:contentDescription="@string/generalImgContentText"
app:srcCompat="@drawable/ic_trending"
app:tint="?attr/iconsColor" />
@ -75,7 +75,7 @@
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:textColor="?attr/primaryTextColor"
android:textSize="14sp"
android:textSize="@dimen/dimen14sp"
tools:text="@string/repoStars" />
</LinearLayout>

View file

@ -9,6 +9,7 @@
<dimen name="dimen10dp">10dp</dimen>
<dimen name="dimen12dp">12dp</dimen>
<dimen name="dimen16dp">16dp</dimen>
<dimen name="dimen18dp">18dp</dimen>
<dimen name="dimen20dp">20dp</dimen>
<dimen name="dimen24dp">24dp</dimen>
<dimen name="dimen26dp">26dp</dimen>