mirror of
https://github.com/gitnex-org/gitnex.git
synced 2026-03-11 17:34:09 -05:00
Fix some UI layouts, add pinch to zoom for comment popup images, improve pinned issue scroll (#1562)
closes #1558 closes #1534 Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1562 Co-authored-by: M M Arif <mmarif@swatian.com> Co-committed-by: M M Arif <mmarif@swatian.com>
This commit is contained in:
@@ -1743,7 +1743,6 @@ public class IssueDetailActivity extends BaseActivity
|
||||
.load(url + "?token=" + token)
|
||||
.diskCacheStrategy(DiskCacheStrategy.ALL)
|
||||
.placeholder(R.drawable.loader_animated)
|
||||
.centerCrop()
|
||||
.error(R.drawable.ic_close)
|
||||
.into(
|
||||
new CustomTarget<Bitmap>() {
|
||||
|
||||
@@ -8,6 +8,7 @@ import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
@@ -17,6 +18,7 @@ import androidx.core.view.MenuProvider;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.Lifecycle;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.gitnex.tea4j.v2.models.Issue;
|
||||
@@ -130,6 +132,29 @@ public class IssuesFragment extends Fragment {
|
||||
fragmentIssuesBinding.rvPinnedIssues.setLayoutManager(horizontalLayoutManager);
|
||||
fragmentIssuesBinding.rvPinnedIssues.setAdapter(adapterPinned);
|
||||
|
||||
fragmentIssuesBinding.rvPinnedIssues.setHasFixedSize(true);
|
||||
fragmentIssuesBinding.rvPinnedIssues.setNestedScrollingEnabled(false);
|
||||
|
||||
fragmentIssuesBinding.rvPinnedIssues.addOnItemTouchListener(
|
||||
new RecyclerView.OnItemTouchListener() {
|
||||
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(
|
||||
@NonNull RecyclerView rv, @NonNull MotionEvent e) {
|
||||
if (e.getAction() == MotionEvent.ACTION_DOWN
|
||||
|| e.getAction() == MotionEvent.ACTION_MOVE) {
|
||||
rv.getParent().requestDisallowInterceptTouchEvent(true);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTouchEvent(@NonNull RecyclerView rv, @NonNull MotionEvent e) {}
|
||||
|
||||
@Override
|
||||
public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) {}
|
||||
});
|
||||
|
||||
((RepoDetailActivity) requireActivity())
|
||||
.setFragmentRefreshListener(
|
||||
issueState -> refreshIssues(issueState, selectedLabels, mentionedBy));
|
||||
|
||||
@@ -28,6 +28,7 @@ import java.io.OutputStream;
|
||||
import java.security.KeyManagementException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
@@ -217,15 +218,14 @@ public class ReleasesFragment extends Fragment {
|
||||
}
|
||||
|
||||
private void setDefaultView(AtomicBoolean releasesFetched, AtomicBoolean tagsFetched) {
|
||||
|
||||
if (!releasesFetched.get() || !tagsFetched.get()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isInitialLoad) {
|
||||
boolean hasReleases = releasesList != null && !releasesList.isEmpty();
|
||||
boolean hasTags = tagsList != null && !tagsList.isEmpty();
|
||||
boolean hasReleases = releasesList != null && !releasesList.isEmpty();
|
||||
boolean hasTags = tagsList != null && !tagsList.isEmpty();
|
||||
|
||||
if (isInitialLoad) {
|
||||
if (hasReleases) {
|
||||
repository.setReleasesViewTypeIsTag(false);
|
||||
setReleasesAdapter(releasesList);
|
||||
@@ -234,7 +234,7 @@ public class ReleasesFragment extends Fragment {
|
||||
setTagsAdapter(tagsList);
|
||||
} else {
|
||||
repository.setReleasesViewTypeIsTag(false);
|
||||
setReleasesAdapter(releasesList);
|
||||
setReleasesAdapter(Collections.emptyList());
|
||||
}
|
||||
isInitialLoad = false;
|
||||
} else {
|
||||
|
||||
@@ -564,6 +564,15 @@ public class RepoInfoFragment extends Fragment {
|
||||
if (parent instanceof ViewGroup) {
|
||||
((ViewGroup) parent).removeView(plusChip);
|
||||
}
|
||||
|
||||
plusChip.setChipBackgroundColorResource(android.R.color.transparent);
|
||||
plusChip.setRippleColorResource(android.R.color.transparent);
|
||||
plusChip.setBackgroundResource(android.R.color.transparent);
|
||||
plusChip.setForeground(null);
|
||||
plusChip.setBackgroundTintList(ColorStateList.valueOf(Color.TRANSPARENT));
|
||||
plusChip.setStateListAnimator(null);
|
||||
plusChip.setElevation(0f);
|
||||
|
||||
binding.repoTopicsChipGroup.addView(plusChip);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import org.gitnex.tea4j.v2.models.Release;
|
||||
import org.gitnex.tea4j.v2.models.Tag;
|
||||
@@ -51,6 +52,8 @@ public class ReleasesViewModel extends ViewModel {
|
||||
|
||||
if (response.isSuccessful()) {
|
||||
releasesList.postValue(response.body());
|
||||
} else if (response.code() == 404) {
|
||||
releasesList.postValue(Collections.emptyList());
|
||||
} else {
|
||||
Toasty.error(ctx, ctx.getString(R.string.genericError));
|
||||
}
|
||||
@@ -82,14 +85,15 @@ public class ReleasesViewModel extends ViewModel {
|
||||
if (response.isSuccessful()) {
|
||||
List<Release> list = releasesList.getValue();
|
||||
assert list != null;
|
||||
assert response.body() != null;
|
||||
|
||||
if (!response.body().isEmpty()) {
|
||||
if (response.body() != null && !response.body().isEmpty()) {
|
||||
list.addAll(response.body());
|
||||
adapter.updateList(list);
|
||||
} else {
|
||||
adapter.setMoreDataAvailable(false);
|
||||
}
|
||||
} else if (response.code() == 404) {
|
||||
adapter.setMoreDataAvailable(false);
|
||||
} else {
|
||||
Toasty.error(ctx, ctx.getString(R.string.genericError));
|
||||
}
|
||||
@@ -125,6 +129,8 @@ public class ReleasesViewModel extends ViewModel {
|
||||
|
||||
if (response.isSuccessful()) {
|
||||
tagsList.postValue(response.body());
|
||||
} else if (response.code() == 404) {
|
||||
tagsList.postValue(Collections.emptyList());
|
||||
} else {
|
||||
Toasty.error(ctx, ctx.getString(R.string.genericError));
|
||||
}
|
||||
@@ -155,14 +161,15 @@ public class ReleasesViewModel extends ViewModel {
|
||||
|
||||
List<Tag> list = tagsList.getValue();
|
||||
assert list != null;
|
||||
assert response.body() != null;
|
||||
|
||||
if (!response.body().isEmpty()) {
|
||||
if (response.body() != null && !response.body().isEmpty()) {
|
||||
list.addAll(response.body());
|
||||
adapter.updateList(list);
|
||||
} else {
|
||||
adapter.setMoreDataAvailable(false);
|
||||
}
|
||||
} else if (response.code() == 404) {
|
||||
adapter.setMoreDataAvailable(false);
|
||||
} else {
|
||||
Toasty.error(ctx, ctx.getString(R.string.genericError));
|
||||
}
|
||||
|
||||
@@ -4,12 +4,11 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/dimen32dp"
|
||||
android:layout_gravity="center"
|
||||
android:contentDescription="@string/generalImgContentText" />
|
||||
<com.github.chrisbanes.photoview.PhotoView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="fitCenter"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -24,7 +24,8 @@
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rvPinnedIssues"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
android:layout_height="match_parent"
|
||||
android:nestedScrollingEnabled="false" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
@@ -35,6 +35,6 @@
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:gravity="center"
|
||||
android:textSize="20sp"
|
||||
android:visibility="visible"/>
|
||||
android:visibility="gone"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
@@ -126,6 +126,7 @@
|
||||
app:chipIconSize="@dimen/dimen20dp"
|
||||
app:chipIconTint="?attr/primaryTextColor"
|
||||
app:chipBackgroundColor="@android:color/transparent"
|
||||
app:chipSurfaceColor="@android:color/transparent"
|
||||
app:chipStrokeWidth="0dp"
|
||||
app:checkedIconVisible="false"
|
||||
app:rippleColor="@android:color/transparent"
|
||||
|
||||
Reference in New Issue
Block a user