mirror of
https://github.com/k0shk0sh/FastHub.git
synced 2025-12-08 19:05:54 +00:00
this commit fixes #169 by allowing users to download the whole repo files and it also improves commits layout margin and centering.
This commit is contained in:
parent
23241a0aaa
commit
37b0dfd40c
@ -1,6 +1,7 @@
|
||||
package com.fastaccess.ui.modules.repos.code.files.paths;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
@ -19,6 +20,7 @@ import com.fastaccess.helper.BundleConstant;
|
||||
import com.fastaccess.helper.Bundler;
|
||||
import com.fastaccess.helper.InputHelper;
|
||||
import com.fastaccess.helper.Logger;
|
||||
import com.fastaccess.provider.rest.RestProvider;
|
||||
import com.fastaccess.ui.adapter.RepoFilePathsAdapter;
|
||||
import com.fastaccess.ui.base.BaseFragment;
|
||||
import com.fastaccess.ui.modules.repos.RepoPagerMvp;
|
||||
@ -59,6 +61,21 @@ public class RepoFilePathView extends BaseFragment<RepoFilePathMvp.View, RepoFil
|
||||
return view;
|
||||
}
|
||||
|
||||
@OnClick(R.id.downloadRepoFiles) void onDownloadRepoFiles() {
|
||||
if (InputHelper.isEmpty(ref)) {
|
||||
ref = getPresenter().getDefaultBranch();
|
||||
}
|
||||
Uri uri = new Uri.Builder()
|
||||
.scheme("https")
|
||||
.authority("github.com")
|
||||
.appendPath(getPresenter().getLogin())
|
||||
.appendPath(getPresenter().getRepoId())
|
||||
.appendPath("archive")
|
||||
.appendPath(ref + ".zip")
|
||||
.build();
|
||||
RestProvider.downloadFile(getContext(), uri.toString());
|
||||
}
|
||||
|
||||
@OnClick(R.id.toParentFolder) void onBackClicked() {
|
||||
if (adapter.getItemCount() > 0) {
|
||||
getPresenter().getPaths().clear();
|
||||
|
||||
@ -33,12 +33,23 @@
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/recycler"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal"
|
||||
app:layoutManager="@string/linear_layout_manager"
|
||||
tools:listitem="@layout/file_path_row_item"/>
|
||||
|
||||
<com.fastaccess.ui.widgets.ForegroundImageView
|
||||
android:id="@+id/downloadRepoFiles"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="?selectableItemBackgroundBorderless"
|
||||
android:contentDescription="@string/download"
|
||||
android:padding="@dimen/spacing_normal"
|
||||
android:src="@drawable/ic_download"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -64,7 +75,6 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginEnd="@dimen/spacing_normal"
|
||||
android:layout_weight="1"
|
||||
android:spinnerMode="dialog"
|
||||
app:backgroundTint="?colorAccent"
|
||||
|
||||
@ -33,13 +33,24 @@
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/recycler"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginEnd="@dimen/spacing_normal"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal"
|
||||
app:layoutManager="@string/linear_layout_manager"
|
||||
tools:listitem="@layout/file_path_row_item"/>
|
||||
|
||||
<com.fastaccess.ui.widgets.ForegroundImageView
|
||||
android:id="@+id/downloadRepoFiles"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="?selectableItemBackgroundBorderless"
|
||||
android:contentDescription="@string/download"
|
||||
android:padding="@dimen/spacing_normal"
|
||||
android:src="@drawable/ic_download"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -47,7 +58,6 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.6"
|
||||
android:background="@drawable/left_border"
|
||||
android:clickable="true"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.fastaccess.ui.widgets.ForegroundImageView
|
||||
@ -65,7 +75,6 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginEnd="@dimen/spacing_normal"
|
||||
android:layout_weight="1"
|
||||
android:spinnerMode="dialog"
|
||||
app:backgroundTint="?colorAccent"
|
||||
|
||||
@ -26,8 +26,9 @@
|
||||
app:theme="@style/ToolbarStyleDark">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:padding="@dimen/spacing_normal">
|
||||
@ -65,16 +66,12 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center|end"
|
||||
android:layout_marginEnd="@dimen/spacing_xs_large"
|
||||
android:background="?selectableItemBackgroundBorderless"
|
||||
android:drawablePadding="@dimen/spacing_micro"
|
||||
android:drawableTop="@drawable/ic_clear"
|
||||
android:gravity="center"
|
||||
tools:text="100"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</android.support.v7.widget.Toolbar>
|
||||
|
||||
<android.support.design.widget.TabLayout
|
||||
|
||||
@ -22,28 +22,37 @@
|
||||
android:id="@+id/toParentFolder"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?selectableItemBackgroundBorderless"
|
||||
android:layout_gravity="center"
|
||||
android:background="?selectableItemBackgroundBorderless"
|
||||
android:contentDescription="@string/home"
|
||||
android:padding="@dimen/spacing_normal"
|
||||
android:src="@drawable/ic_home"/>
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/recycler"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="@dimen/spacing_xs_large"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal"
|
||||
app:layoutManager="@string/linear_layout_manager"
|
||||
tools:listitem="@layout/file_path_row_item"/>
|
||||
|
||||
<com.fastaccess.ui.widgets.ForegroundImageView
|
||||
android:id="@+id/downloadRepoFiles"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="?selectableItemBackgroundBorderless"
|
||||
android:contentDescription="@string/download"
|
||||
android:padding="@dimen/spacing_normal"
|
||||
android:src="@drawable/ic_download"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/grid_spacing"
|
||||
android:clickable="true"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.fastaccess.ui.widgets.ForegroundImageView
|
||||
@ -52,6 +61,7 @@
|
||||
android:layout_gravity="center"
|
||||
android:contentDescription="@string/switch_branch"
|
||||
android:padding="@dimen/spacing_normal"
|
||||
android:layout_marginEnd="@dimen/spacing_xs_large"
|
||||
android:src="@drawable/ic_branch"/>
|
||||
|
||||
<android.support.v7.widget.AppCompatSpinner
|
||||
@ -59,8 +69,6 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginEnd="@dimen/spacing_xs_large"
|
||||
android:layout_marginStart="@dimen/spacing_xs_large"
|
||||
android:layout_weight="1"
|
||||
android:spinnerMode="dialog"
|
||||
app:backgroundTint="?colorAccent"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user