Idea to use breadcrumb

This commit is contained in:
M M Arif 2019-10-03 20:57:49 +05:00
parent a77716970b
commit 572f93d35c
4 changed files with 56 additions and 27 deletions

View File

@ -19,6 +19,7 @@ import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.inputmethod.EditorInfo; import android.view.inputmethod.EditorInfo;
import android.widget.LinearLayout;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import org.mian.gitnex.R; import org.mian.gitnex.R;
@ -41,6 +42,7 @@ public class FilesFragment extends Fragment {
private FilesAdapter adapter; private FilesAdapter adapter;
private RecyclerView mRecyclerView; private RecyclerView mRecyclerView;
private TextView noDataFiles; private TextView noDataFiles;
private LinearLayout filesFrame;
private static String repoNameF = "param2"; private static String repoNameF = "param2";
private static String repoOwnerF = "param1"; private static String repoOwnerF = "param1";
@ -83,6 +85,7 @@ public class FilesFragment extends Fragment {
final String instanceToken = "token " + tinyDb.getString(loginUid + "-token"); final String instanceToken = "token " + tinyDb.getString(loginUid + "-token");
noDataFiles = v.findViewById(R.id.noDataFiles); noDataFiles = v.findViewById(R.id.noDataFiles);
filesFrame = v.findViewById(R.id.filesFrame);
final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.pullToRefresh); final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.pullToRefresh);
@ -124,13 +127,16 @@ public class FilesFragment extends Fragment {
adapter = new FilesAdapter(getContext(), filesListMain); adapter = new FilesAdapter(getContext(), filesListMain);
if(adapter.getItemCount() > 0) { if(adapter.getItemCount() > 0) {
mRecyclerView.setAdapter(adapter); mRecyclerView.setAdapter(adapter);
filesFrame.setVisibility(View.VISIBLE);
noDataFiles.setVisibility(View.GONE); noDataFiles.setVisibility(View.GONE);
} }
else { else {
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
mRecyclerView.setAdapter(adapter); mRecyclerView.setAdapter(adapter);
filesFrame.setVisibility(View.VISIBLE);
noDataFiles.setVisibility(View.VISIBLE); noDataFiles.setVisibility(View.VISIBLE);
} }
filesFrame.setVisibility(View.VISIBLE);
mProgressBar.setVisibility(View.GONE); mProgressBar.setVisibility(View.GONE);
} }
}); });

View File

@ -6,7 +6,6 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout_marginTop="0dp"
android:fitsSystemWindows="true" android:fitsSystemWindows="true"
android:orientation="vertical" android:orientation="vertical"
android:layout_margin="10dp" android:layout_margin="10dp"

View File

@ -1,45 +1,68 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"
tools:context=".activities.RepoDetailActivity"> tools:context=".activities.RepoDetailActivity">
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout <LinearLayout
android:id="@+id/pullToRefresh" android:id="@+id/filesFrame"
android:visibility="gone"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:orientation="vertical"
>
<androidx.recyclerview.widget.RecyclerView <TextView
android:id="@+id/recyclerView" android:id="@+id/fileBrowserBreadcrumb"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
android:layout_marginTop="20dp"
android:layout_marginBottom="10dp"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:textColor="@color/lightGray"
android:text="@string/filesBreadcrumb" />
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/pullToRefresh"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimary"
android:padding="4dp"
android:scrollbars="vertical"
/>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<TextView
android:id="@+id/noDataFiles"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/colorPrimary" android:layout_margin="15dp"
android:padding="4dp" android:gravity="center"
android:scrollbars="vertical" android:text="@string/noDataFilesTab"
/> android:textColor="@color/white"
android:textSize="20sp"
android:visibility="gone" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout> </LinearLayout>
<TextView
android:id="@+id/noDataFiles"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="15dp"
android:gravity="center"
android:text="@string/noDataFilesTab"
android:textColor="@color/white"
android:textSize="20sp"
android:visibility="gone" />
<ProgressBar <ProgressBar
android:id="@+id/progress_bar" android:id="@+id/progress_bar"
style="@style/Base.Widget.AppCompat.ProgressBar" style="@style/Base.Widget.AppCompat.ProgressBar"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_centerInParent="true" android:layout_gravity="center"
android:indeterminate="true" android:indeterminate="true"
android:visibility="visible" /> android:visibility="visible" />
</RelativeLayout> </LinearLayout>

View File

@ -474,6 +474,7 @@
<string name="noDataFilesTab">No files found</string> <string name="noDataFilesTab">No files found</string>
<string name="filesDirNotSupportedYet">Directory browsing is not supported yet</string> <string name="filesDirNotSupportedYet">Directory browsing is not supported yet</string>
<string name="filesGenericError">Sorry this file cannot be viewed as API return an error</string> <string name="filesGenericError">Sorry this file cannot be viewed as API return an error</string>
<string name="filesBreadcrumb">Root</string>
<!-- generic copy --> <!-- generic copy -->
<string name="okButton">OK</string> <string name="okButton">OK</string>