mirror of
https://codeberg.org/gitnex/GitNex.git
synced 2023-12-13 20:50:18 +01:00
VIsual updates + FAB button for creating new file
This commit is contained in:
parent
aa0e315dd2
commit
a12f8663a3
|
@ -270,6 +270,7 @@ public class CreateFileActivity extends BaseActivity {
|
||||||
result.putExtra("fileModified", true);
|
result.putExtra("fileModified", true);
|
||||||
result.putExtra("fileAction", fileAction);
|
result.putExtra("fileAction", fileAction);
|
||||||
setResult(200, result);
|
setResult(200, result);
|
||||||
|
RepoDetailActivity.updateFABActions = true;
|
||||||
finish();
|
finish();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -64,6 +64,7 @@ import retrofit2.Response;
|
||||||
*/
|
*/
|
||||||
public class RepoDetailActivity extends BaseActivity implements BottomSheetListener {
|
public class RepoDetailActivity extends BaseActivity implements BottomSheetListener {
|
||||||
|
|
||||||
|
public static boolean updateFABActions = false;
|
||||||
public static boolean updateRepo = false;
|
public static boolean updateRepo = false;
|
||||||
private final ActivityResultLauncher<Intent> settingsLauncher =
|
private final ActivityResultLauncher<Intent> settingsLauncher =
|
||||||
registerForActivityResult(
|
registerForActivityResult(
|
||||||
|
|
|
@ -17,8 +17,14 @@ import androidx.appcompat.widget.SearchView;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import moe.feng.common.view.breadcrumbs.DefaultBreadcrumbsCallback;
|
||||||
|
import moe.feng.common.view.breadcrumbs.model.BreadcrumbItem;
|
||||||
import org.gitnex.tea4j.v2.models.ContentsResponse;
|
import org.gitnex.tea4j.v2.models.ContentsResponse;
|
||||||
import org.mian.gitnex.R;
|
import org.mian.gitnex.R;
|
||||||
|
import org.mian.gitnex.activities.CreateFileActivity;
|
||||||
import org.mian.gitnex.activities.FileViewActivity;
|
import org.mian.gitnex.activities.FileViewActivity;
|
||||||
import org.mian.gitnex.activities.RepoDetailActivity;
|
import org.mian.gitnex.activities.RepoDetailActivity;
|
||||||
import org.mian.gitnex.adapters.FilesAdapter;
|
import org.mian.gitnex.adapters.FilesAdapter;
|
||||||
|
@ -30,11 +36,6 @@ import org.mian.gitnex.helpers.AppUtil;
|
||||||
import org.mian.gitnex.helpers.Path;
|
import org.mian.gitnex.helpers.Path;
|
||||||
import org.mian.gitnex.helpers.contexts.RepositoryContext;
|
import org.mian.gitnex.helpers.contexts.RepositoryContext;
|
||||||
import org.mian.gitnex.viewmodels.FilesViewModel;
|
import org.mian.gitnex.viewmodels.FilesViewModel;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import moe.feng.common.view.breadcrumbs.DefaultBreadcrumbsCallback;
|
|
||||||
import moe.feng.common.view.breadcrumbs.model.BreadcrumbItem;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author M M Arif
|
* @author M M Arif
|
||||||
|
@ -78,10 +79,7 @@ public class FilesFragment extends Fragment implements FilesAdapter.FilesAdapter
|
||||||
binding.breadcrumbsView.setItems(
|
binding.breadcrumbsView.setItems(
|
||||||
new ArrayList<>(
|
new ArrayList<>(
|
||||||
Collections.singletonList(
|
Collections.singletonList(
|
||||||
BreadcrumbItem.createSimpleItem(
|
BreadcrumbItem.createSimpleItem(repository.getBranchRef()))));
|
||||||
getResources().getString(R.string.filesBreadcrumbRoot)
|
|
||||||
+ getResources().getString(R.string.colonDivider)
|
|
||||||
+ repository.getBranchRef()))));
|
|
||||||
// noinspection unchecked
|
// noinspection unchecked
|
||||||
binding.breadcrumbsView.setCallback(
|
binding.breadcrumbsView.setCallback(
|
||||||
new DefaultBreadcrumbsCallback<BreadcrumbItem>() {
|
new DefaultBreadcrumbsCallback<BreadcrumbItem>() {
|
||||||
|
@ -150,15 +148,7 @@ public class FilesFragment extends Fragment implements FilesAdapter.FilesAdapter
|
||||||
new ArrayList<>(
|
new ArrayList<>(
|
||||||
Collections.singletonList(
|
Collections.singletonList(
|
||||||
BreadcrumbItem.createSimpleItem(
|
BreadcrumbItem.createSimpleItem(
|
||||||
getResources()
|
repository.getBranchRef()))));
|
||||||
.getString(
|
|
||||||
R.string
|
|
||||||
.filesBreadcrumbRoot)
|
|
||||||
+ getResources()
|
|
||||||
.getString(
|
|
||||||
R.string
|
|
||||||
.colonDivider)
|
|
||||||
+ repository.getBranchRef()))));
|
|
||||||
refresh();
|
refresh();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -172,9 +162,22 @@ public class FilesFragment extends Fragment implements FilesAdapter.FilesAdapter
|
||||||
}
|
}
|
||||||
refresh();
|
refresh();
|
||||||
|
|
||||||
|
binding.newFile.setOnClickListener(
|
||||||
|
v17 -> startActivity(repository.getIntent(getContext(), CreateFileActivity.class)));
|
||||||
|
|
||||||
return binding.getRoot();
|
return binding.getRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
|
||||||
|
if (RepoDetailActivity.updateFABActions) {
|
||||||
|
refresh();
|
||||||
|
RepoDetailActivity.updateFABActions = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClickFile(ContentsResponse file) {
|
public void onClickFile(ContentsResponse file) {
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:shape="rectangle">
|
android:shape="rectangle">
|
||||||
|
|
||||||
<corners android:radius="@dimen/dimen8dp"/>
|
<corners android:radius="@dimen/dimen12dp"/>
|
||||||
<solid android:color="@color/releasePre"/>
|
<solid android:color="?attr/materialCardBackgroundColor"/>
|
||||||
|
|
||||||
</shape>
|
</shape>
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
android:text="@string/pageTitleIssues"
|
android:text="@string/pageTitleIssues"
|
||||||
android:textColor="@color/lightGray"
|
android:textColor="@color/lightGray"
|
||||||
android:textSize="@dimen/dimen16sp"
|
android:textSize="@dimen/dimen16sp"
|
||||||
app:textAllCaps="true"/>
|
app:textAllCaps="true" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/counterBadgeIssue"
|
android:id="@+id/counterBadgeIssue"
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
android:background="@drawable/shape_badge_background"
|
android:background="@drawable/shape_badge_background"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="@string/infoTabRepoZero"
|
android:text="@string/infoTabRepoZero"
|
||||||
android:textColor="@color/colorWhite"
|
android:textColor="?attr/primaryBackgroundColor"
|
||||||
android:textSize="@dimen/dimen12sp"/>
|
android:textSize="@dimen/dimen12sp" />
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
android:paddingStart="@dimen/dimen4dp"
|
android:paddingStart="@dimen/dimen4dp"
|
||||||
android:paddingEnd="@dimen/dimen4dp"
|
android:paddingEnd="@dimen/dimen4dp"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:textColor="?attr/primaryTextColor"
|
android:textColor="?attr/primaryBackgroundColor"
|
||||||
android:textSize="@dimen/dimen12sp"
|
android:textSize="@dimen/dimen12sp"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
android:layout_marginStart="@dimen/dimen8dp"
|
android:layout_marginStart="@dimen/dimen8dp"
|
||||||
android:background="@drawable/shape_badge_background"
|
android:background="@drawable/shape_badge_background"
|
||||||
android:text="@string/infoTabRepoZero"
|
android:text="@string/infoTabRepoZero"
|
||||||
android:textColor="@color/colorWhite"
|
android:textColor="?attr/primaryBackgroundColor"
|
||||||
android:textSize="@dimen/dimen12sp"/>
|
android:textSize="@dimen/dimen12sp"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
android:layout_marginStart="@dimen/dimen8dp"
|
android:layout_marginStart="@dimen/dimen8dp"
|
||||||
android:background="@drawable/shape_badge_background"
|
android:background="@drawable/shape_badge_background"
|
||||||
android:text="@string/infoTabRepoZero"
|
android:text="@string/infoTabRepoZero"
|
||||||
android:textColor="@color/colorWhite"
|
android:textColor="?attr/primaryBackgroundColor"
|
||||||
android:textSize="@dimen/dimen12sp"/>
|
android:textSize="@dimen/dimen12sp"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -36,8 +36,8 @@
|
||||||
android:saveEnabled="false"
|
android:saveEnabled="false"
|
||||||
android:text="@string/filesBreadcrumbRoot"
|
android:text="@string/filesBreadcrumbRoot"
|
||||||
app:CustomTextSize="@dimen/dimen16sp"
|
app:CustomTextSize="@dimen/dimen16sp"
|
||||||
app:SelectedTextColor="?attr/inputSelectedColor"
|
app:SelectedTextColor="?attr/primaryTextColor"
|
||||||
app:UnSelectedTextColor="?attr/primaryTextColor" />
|
app:UnSelectedTextColor="?attr/inputSelectedColor" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -57,7 +57,9 @@
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/recyclerView"
|
android:id="@+id/recyclerView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent"
|
||||||
|
android:clipToPadding="false"
|
||||||
|
android:paddingBottom="@dimen/dimen72dp" />
|
||||||
|
|
||||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||||
|
|
||||||
|
@ -85,4 +87,17 @@
|
||||||
android:indeterminate="true"
|
android:indeterminate="true"
|
||||||
app:indicatorColor="?attr/progressIndicatorColor" />
|
app:indicatorColor="?attr/progressIndicatorColor" />
|
||||||
|
|
||||||
|
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
|
||||||
|
android:id="@+id/newFile"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="end|bottom"
|
||||||
|
android:layout_margin="@dimen/dimen16dp"
|
||||||
|
android:text="@string/pageTitleNewFile"
|
||||||
|
android:contentDescription="@string/pageTitleNewFile"
|
||||||
|
android:textColor="?attr/primaryBackgroundColor"
|
||||||
|
android:backgroundTint="?attr/fabColor"
|
||||||
|
app:iconTint="?attr/primaryBackgroundColor"
|
||||||
|
app:icon="@drawable/ic_add" />
|
||||||
|
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
|
|
|
@ -54,9 +54,9 @@
|
||||||
android:layout_margin="@dimen/dimen16dp"
|
android:layout_margin="@dimen/dimen16dp"
|
||||||
android:text="@string/newNote"
|
android:text="@string/newNote"
|
||||||
android:contentDescription="@string/newNote"
|
android:contentDescription="@string/newNote"
|
||||||
android:textColor="@color/colorWhite"
|
android:textColor="?attr/primaryBackgroundColor"
|
||||||
android:backgroundTint="?attr/fabColor"
|
android:backgroundTint="?attr/fabColor"
|
||||||
app:iconTint="@color/colorWhite"
|
app:iconTint="?attr/primaryBackgroundColor"
|
||||||
app:icon="@drawable/ic_add" />
|
app:icon="@drawable/ic_add" />
|
||||||
|
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:indeterminate="true"
|
android:indeterminate="true"
|
||||||
style="@style/Widget.MaterialComponents.LinearProgressIndicator"
|
style="@style/Widget.MaterialComponents.LinearProgressIndicator"
|
||||||
app:indicatorColor="?attr/progressIndicatorColor"/>
|
app:indicatorColor="?attr/progressIndicatorColor" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/noDataNotifications"
|
android:id="@+id/noDataNotifications"
|
||||||
|
@ -45,7 +45,7 @@
|
||||||
android:text="@string/noDataNotifications"
|
android:text="@string/noDataNotifications"
|
||||||
android:textColor="?attr/primaryTextColor"
|
android:textColor="?attr/primaryTextColor"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
android:visibility="gone"/>
|
android:visibility="gone" />
|
||||||
|
|
||||||
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
|
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
|
||||||
android:id="@+id/markAllAsRead"
|
android:id="@+id/markAllAsRead"
|
||||||
|
@ -55,10 +55,10 @@
|
||||||
android:layout_margin="16dp"
|
android:layout_margin="16dp"
|
||||||
android:text="@string/markAsRead"
|
android:text="@string/markAsRead"
|
||||||
android:contentDescription="@string/markAsRead"
|
android:contentDescription="@string/markAsRead"
|
||||||
android:textColor="@color/colorWhite"
|
android:textColor="?attr/primaryBackgroundColor"
|
||||||
android:backgroundTint="?attr/fabColor"
|
android:backgroundTint="?attr/fabColor"
|
||||||
app:layout_behavior="com.google.android.material.behavior.HideBottomViewOnScrollBehavior"
|
app:layout_behavior="com.google.android.material.behavior.HideBottomViewOnScrollBehavior"
|
||||||
app:iconTint="@color/colorWhite"
|
app:iconTint="?attr/primaryBackgroundColor"
|
||||||
app:icon="@drawable/ic_done"/>
|
app:icon="@drawable/ic_done" />
|
||||||
|
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
|
|
|
@ -52,9 +52,9 @@
|
||||||
android:layout_margin="16dp"
|
android:layout_margin="16dp"
|
||||||
android:text="@string/pageTitleCreateOrganization"
|
android:text="@string/pageTitleCreateOrganization"
|
||||||
android:contentDescription="@string/pageTitleCreateOrganization"
|
android:contentDescription="@string/pageTitleCreateOrganization"
|
||||||
android:textColor="@color/colorWhite"
|
android:textColor="?attr/primaryBackgroundColor"
|
||||||
android:backgroundTint="?attr/fabColor"
|
android:backgroundTint="?attr/fabColor"
|
||||||
app:iconTint="@color/colorWhite"
|
app:iconTint="?attr/primaryBackgroundColor"
|
||||||
app:icon="@drawable/ic_add"/>
|
app:icon="@drawable/ic_add" />
|
||||||
|
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
|
|
|
@ -26,9 +26,11 @@
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:text="@string/archivedRepositoryMessage"
|
android:text="@string/archivedRepositoryMessage"
|
||||||
android:background="@drawable/shape_archived"
|
android:background="@drawable/shape_archived"
|
||||||
android:padding="@dimen/dimen6dp"
|
android:padding="@dimen/dimen10dp"
|
||||||
android:layout_marginBottom="@dimen/dimen8dp"
|
android:layout_marginBottom="@dimen/dimen10dp"
|
||||||
android:textColor="@color/colorWhite"/>
|
android:textStyle="bold"
|
||||||
|
android:textSize="@dimen/dimen14sp"
|
||||||
|
android:textColor="?attr/fabColor" />
|
||||||
|
|
||||||
<com.google.android.material.card.MaterialCardView
|
<com.google.android.material.card.MaterialCardView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -54,9 +54,9 @@
|
||||||
android:layout_margin="16dp"
|
android:layout_margin="16dp"
|
||||||
android:text="@string/pageTitleNewRepo"
|
android:text="@string/pageTitleNewRepo"
|
||||||
android:contentDescription="@string/pageTitleNewRepo"
|
android:contentDescription="@string/pageTitleNewRepo"
|
||||||
android:textColor="@color/colorWhite"
|
android:textColor="?attr/primaryBackgroundColor"
|
||||||
android:backgroundTint="?attr/fabColor"
|
android:backgroundTint="?attr/fabColor"
|
||||||
app:iconTint="@color/colorWhite"
|
app:iconTint="?attr/primaryBackgroundColor"
|
||||||
app:icon="@drawable/ic_add"/>
|
app:icon="@drawable/ic_add"/>
|
||||||
|
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
|
|
Loading…
Reference in a new issue