mirror of
https://codeberg.org/gitnex/GitNex.git
synced 2023-12-13 20:50:18 +01:00
Revamp tags and forks screens
This commit is contained in:
parent
4c9991dc12
commit
947e1d252c
|
@ -10,16 +10,10 @@ import android.view.MenuInflater;
|
|||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.widget.SearchView;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import org.gitnex.tea4j.v2.models.Repository;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.adapters.RepoForksAdapter;
|
||||
|
@ -39,16 +33,13 @@ import retrofit2.Response;
|
|||
|
||||
public class RepoForksActivity extends BaseActivity {
|
||||
|
||||
private ActivityRepoForksBinding activityRepoForksBinding;
|
||||
private final String TAG = "RepositoryForks";
|
||||
private TextView noData;
|
||||
private ProgressBar progressBar;
|
||||
|
||||
private int resultLimit;
|
||||
private int pageSize = 1;
|
||||
|
||||
private RecyclerView recyclerView;
|
||||
private List<Repository> forksList;
|
||||
private RepoForksAdapter adapter;
|
||||
private ProgressBar progressLoadMore;
|
||||
|
||||
private RepositoryContext repository;
|
||||
|
||||
|
@ -58,7 +49,7 @@ public class RepoForksActivity extends BaseActivity {
|
|||
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
ActivityRepoForksBinding activityRepoForksBinding = ActivityRepoForksBinding.inflate(getLayoutInflater());
|
||||
activityRepoForksBinding = ActivityRepoForksBinding.inflate(getLayoutInflater());
|
||||
setContentView(activityRepoForksBinding.getRoot());
|
||||
|
||||
Toolbar toolbar = activityRepoForksBinding.toolbar;
|
||||
|
@ -70,32 +61,21 @@ public class RepoForksActivity extends BaseActivity {
|
|||
|
||||
activityRepoForksBinding.toolbarTitle.setText(ctx.getResources().getString(R.string.infoTabRepoForksCount));
|
||||
|
||||
ImageView closeActivity = activityRepoForksBinding.close;
|
||||
noData = activityRepoForksBinding.noData;
|
||||
progressLoadMore = activityRepoForksBinding.progressLoadMore;
|
||||
progressBar = activityRepoForksBinding.progressBar;
|
||||
SwipeRefreshLayout swipeRefresh = activityRepoForksBinding.pullToRefresh;
|
||||
|
||||
closeActivity.setOnClickListener(v -> finish());
|
||||
|
||||
activityRepoForksBinding.close.setOnClickListener(v -> finish());
|
||||
resultLimit = Constants.getCurrentResultLimit(ctx);
|
||||
|
||||
recyclerView = activityRepoForksBinding.recyclerView;
|
||||
forksList = new ArrayList<>();
|
||||
|
||||
recyclerView.addItemDecoration(new DividerItemDecoration(recyclerView.getContext(), DividerItemDecoration.VERTICAL));
|
||||
|
||||
swipeRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
activityRepoForksBinding.pullToRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
|
||||
pageSize = 1;
|
||||
swipeRefresh.setRefreshing(false);
|
||||
activityRepoForksBinding.pullToRefresh.setRefreshing(false);
|
||||
loadInitial(repoOwner, repoName, pageSize, resultLimit);
|
||||
adapter.notifyDataChanged();
|
||||
|
||||
}, 200));
|
||||
|
||||
adapter = new RepoForksAdapter(ctx, forksList);
|
||||
adapter.setLoadMoreListener(() -> recyclerView.post(() -> {
|
||||
adapter.setLoadMoreListener(() -> activityRepoForksBinding.recyclerView.post(() -> {
|
||||
|
||||
if(forksList.size() == resultLimit || pageSize == resultLimit) {
|
||||
|
||||
|
@ -104,9 +84,9 @@ public class RepoForksActivity extends BaseActivity {
|
|||
}
|
||||
}));
|
||||
|
||||
recyclerView.setHasFixedSize(true);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(ctx));
|
||||
recyclerView.setAdapter(adapter);
|
||||
activityRepoForksBinding.recyclerView.setHasFixedSize(true);
|
||||
activityRepoForksBinding.recyclerView.setLayoutManager(new LinearLayoutManager(ctx));
|
||||
activityRepoForksBinding.recyclerView.setAdapter(adapter);
|
||||
|
||||
loadInitial(repoOwner, repoName, pageSize, resultLimit);
|
||||
}
|
||||
|
@ -128,15 +108,15 @@ public class RepoForksActivity extends BaseActivity {
|
|||
forksList.clear();
|
||||
forksList.addAll(response.body());
|
||||
adapter.notifyDataChanged();
|
||||
noData.setVisibility(View.GONE);
|
||||
activityRepoForksBinding.noData.setVisibility(View.GONE);
|
||||
}
|
||||
else {
|
||||
forksList.clear();
|
||||
adapter.notifyDataChanged();
|
||||
noData.setVisibility(View.VISIBLE);
|
||||
activityRepoForksBinding.noData.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
progressBar.setVisibility(View.GONE);
|
||||
activityRepoForksBinding.progressBar.setVisibility(View.GONE);
|
||||
}
|
||||
else {
|
||||
Log.e(TAG, String.valueOf(response.code()));
|
||||
|
@ -148,12 +128,11 @@ public class RepoForksActivity extends BaseActivity {
|
|||
Log.e(TAG, t.toString());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void loadMore(String repoOwner, String repoName, int page, int resultLimit) {
|
||||
|
||||
progressLoadMore.setVisibility(View.VISIBLE);
|
||||
activityRepoForksBinding.progressLoadMore.setVisibility(View.VISIBLE);
|
||||
|
||||
Call<List<Repository>> call = RetrofitClient.getApiInterface(ctx).listForks(repoOwner, repoName, page, resultLimit);
|
||||
|
||||
|
@ -179,7 +158,7 @@ public class RepoForksActivity extends BaseActivity {
|
|||
}
|
||||
|
||||
adapter.notifyDataChanged();
|
||||
progressLoadMore.setVisibility(View.GONE);
|
||||
activityRepoForksBinding.progressLoadMore.setVisibility(View.GONE);
|
||||
}
|
||||
else {
|
||||
Log.e(TAG, String.valueOf(response.code()));
|
||||
|
|
|
@ -55,12 +55,18 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dimen56dp">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/primaryBackgroundColor"
|
||||
android:scrollbars="vertical"/>
|
||||
android:padding="@dimen/dimen8dp">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
|
|
|
@ -5,153 +5,172 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
android:paddingTop="@dimen/dimen4dp"
|
||||
android:paddingBottom="@dimen/dimen4dp">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/headerFrame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
tools:ignore="UseCompoundDrawables">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tagName"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_weight="0.9"
|
||||
android:singleLine="true"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/tagsOptionsMenu"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||
android:contentDescription="@string/labelMenuContentDesc"
|
||||
android:src="@drawable/ic_dotted_menu_horizontal"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/bodyFrame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="10dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tagBodyContent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:autoLink="web|email"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textColorLink="@color/lightBlue"
|
||||
android:textSize="14sp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/downloadFrame"
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:orientation="vertical">
|
||||
style="?attr/materialCardViewFilledStyle"
|
||||
app:cardElevation="@dimen/dimen0dp">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/downloadCopyFrame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
tools:ignore="UseCompoundDrawables">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/downloadDropdownIcon"
|
||||
android:layout_width="15dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/generalImgContentText"
|
||||
android:src="@drawable/ic_chevron_right"
|
||||
app:srcCompat="@drawable/ic_chevron_right"
|
||||
app:tint="?attr/primaryTextColor"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="3dp"
|
||||
android:text="@string/releaseDownloadText"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="14sp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/downloads"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="8dp"
|
||||
android:visibility="gone">
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
android:background="?attr/materialCardBackgroundColor"
|
||||
android:padding="@dimen/dimen12dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/releaseZipDownloadFrame"
|
||||
android:id="@+id/headerFrame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
tools:ignore="UseCompoundDrawables">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:contentDescription="@string/generalImgContentText"
|
||||
app:srcCompat="@drawable/ic_download"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/releaseZipDownload"
|
||||
android:layout_width="match_parent"
|
||||
android:id="@+id/tagName"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:text="@string/zipArchiveDownloadReleasesTab"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_weight="0.9"
|
||||
android:singleLine="true"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="12sp"/>
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/tagsOptionsMenu"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||
android:contentDescription="@string/labelMenuContentDesc"
|
||||
android:src="@drawable/ic_dotted_menu_horizontal"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/releaseTarDownloadFrame"
|
||||
android:id="@+id/bodyFrame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
tools:ignore="UseCompoundDrawables">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:contentDescription="@string/generalImgContentText"
|
||||
app:srcCompat="@drawable/ic_download"/>
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="10dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/releaseTarDownload"
|
||||
android:id="@+id/tagBodyContent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:text="@string/tarArchiveDownloadReleasesTab"
|
||||
android:autoLink="web|email"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="12sp"/>
|
||||
android:textColorLink="@color/lightBlue"
|
||||
android:textSize="14sp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/downloadFrame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/downloadCopyFrame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
tools:ignore="UseCompoundDrawables">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/downloadDropdownIcon"
|
||||
android:layout_width="15dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/generalImgContentText"
|
||||
android:src="@drawable/ic_chevron_right"
|
||||
app:srcCompat="@drawable/ic_chevron_right"
|
||||
app:tint="?attr/primaryTextColor"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="3dp"
|
||||
android:text="@string/releaseDownloadText"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="14sp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/downloads"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="8dp"
|
||||
android:visibility="gone">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/releaseZipDownloadFrame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
tools:ignore="UseCompoundDrawables">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:contentDescription="@string/generalImgContentText"
|
||||
app:srcCompat="@drawable/ic_download"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/releaseZipDownload"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:text="@string/zipArchiveDownloadReleasesTab"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="12sp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/releaseTarDownloadFrame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
tools:ignore="UseCompoundDrawables">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:contentDescription="@string/generalImgContentText"
|
||||
app:srcCompat="@drawable/ic_download"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/releaseTarDownload"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:text="@string/tarArchiveDownloadReleasesTab"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="12sp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
Loading…
Reference in a new issue