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("fileAction", fileAction);
|
||||
setResult(200, result);
|
||||
RepoDetailActivity.updateFABActions = true;
|
||||
finish();
|
||||
break;
|
||||
|
||||
|
|
|
@ -64,6 +64,7 @@ import retrofit2.Response;
|
|||
*/
|
||||
public class RepoDetailActivity extends BaseActivity implements BottomSheetListener {
|
||||
|
||||
public static boolean updateFABActions = false;
|
||||
public static boolean updateRepo = false;
|
||||
private final ActivityResultLauncher<Intent> settingsLauncher =
|
||||
registerForActivityResult(
|
||||
|
|
|
@ -17,8 +17,14 @@ import androidx.appcompat.widget.SearchView;
|
|||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
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.mian.gitnex.R;
|
||||
import org.mian.gitnex.activities.CreateFileActivity;
|
||||
import org.mian.gitnex.activities.FileViewActivity;
|
||||
import org.mian.gitnex.activities.RepoDetailActivity;
|
||||
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.contexts.RepositoryContext;
|
||||
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
|
||||
|
@ -78,10 +79,7 @@ public class FilesFragment extends Fragment implements FilesAdapter.FilesAdapter
|
|||
binding.breadcrumbsView.setItems(
|
||||
new ArrayList<>(
|
||||
Collections.singletonList(
|
||||
BreadcrumbItem.createSimpleItem(
|
||||
getResources().getString(R.string.filesBreadcrumbRoot)
|
||||
+ getResources().getString(R.string.colonDivider)
|
||||
+ repository.getBranchRef()))));
|
||||
BreadcrumbItem.createSimpleItem(repository.getBranchRef()))));
|
||||
// noinspection unchecked
|
||||
binding.breadcrumbsView.setCallback(
|
||||
new DefaultBreadcrumbsCallback<BreadcrumbItem>() {
|
||||
|
@ -150,15 +148,7 @@ public class FilesFragment extends Fragment implements FilesAdapter.FilesAdapter
|
|||
new ArrayList<>(
|
||||
Collections.singletonList(
|
||||
BreadcrumbItem.createSimpleItem(
|
||||
getResources()
|
||||
.getString(
|
||||
R.string
|
||||
.filesBreadcrumbRoot)
|
||||
+ getResources()
|
||||
.getString(
|
||||
R.string
|
||||
.colonDivider)
|
||||
+ repository.getBranchRef()))));
|
||||
repository.getBranchRef()))));
|
||||
refresh();
|
||||
});
|
||||
|
||||
|
@ -172,9 +162,22 @@ public class FilesFragment extends Fragment implements FilesAdapter.FilesAdapter
|
|||
}
|
||||
refresh();
|
||||
|
||||
binding.newFile.setOnClickListener(
|
||||
v17 -> startActivity(repository.getIntent(getContext(), CreateFileActivity.class)));
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
if (RepoDetailActivity.updateFABActions) {
|
||||
refresh();
|
||||
RepoDetailActivity.updateFABActions = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickFile(ContentsResponse file) {
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<corners android:radius="@dimen/dimen8dp"/>
|
||||
<solid android:color="@color/releasePre"/>
|
||||
<corners android:radius="@dimen/dimen12dp"/>
|
||||
<solid android:color="?attr/materialCardBackgroundColor"/>
|
||||
|
||||
</shape>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
android:text="@string/pageTitleIssues"
|
||||
android:textColor="@color/lightGray"
|
||||
android:textSize="@dimen/dimen16sp"
|
||||
app:textAllCaps="true"/>
|
||||
app:textAllCaps="true" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/counterBadgeIssue"
|
||||
|
@ -24,7 +24,7 @@
|
|||
android:background="@drawable/shape_badge_background"
|
||||
android:gravity="center"
|
||||
android:text="@string/infoTabRepoZero"
|
||||
android:textColor="@color/colorWhite"
|
||||
android:textSize="@dimen/dimen12sp"/>
|
||||
android:textColor="?attr/primaryBackgroundColor"
|
||||
android:textSize="@dimen/dimen12sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
android:paddingStart="@dimen/dimen4dp"
|
||||
android:paddingEnd="@dimen/dimen4dp"
|
||||
android:singleLine="true"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textColor="?attr/primaryBackgroundColor"
|
||||
android:textSize="@dimen/dimen12sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
android:layout_marginStart="@dimen/dimen8dp"
|
||||
android:background="@drawable/shape_badge_background"
|
||||
android:text="@string/infoTabRepoZero"
|
||||
android:textColor="@color/colorWhite"
|
||||
android:textColor="?attr/primaryBackgroundColor"
|
||||
android:textSize="@dimen/dimen12sp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
android:layout_marginStart="@dimen/dimen8dp"
|
||||
android:background="@drawable/shape_badge_background"
|
||||
android:text="@string/infoTabRepoZero"
|
||||
android:textColor="@color/colorWhite"
|
||||
android:textColor="?attr/primaryBackgroundColor"
|
||||
android:textSize="@dimen/dimen12sp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -36,8 +36,8 @@
|
|||
android:saveEnabled="false"
|
||||
android:text="@string/filesBreadcrumbRoot"
|
||||
app:CustomTextSize="@dimen/dimen16sp"
|
||||
app:SelectedTextColor="?attr/inputSelectedColor"
|
||||
app:UnSelectedTextColor="?attr/primaryTextColor" />
|
||||
app:SelectedTextColor="?attr/primaryTextColor"
|
||||
app:UnSelectedTextColor="?attr/inputSelectedColor" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -57,7 +57,9 @@
|
|||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
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>
|
||||
|
||||
|
@ -85,4 +87,17 @@
|
|||
android:indeterminate="true"
|
||||
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>
|
||||
|
|
|
@ -54,9 +54,9 @@
|
|||
android:layout_margin="@dimen/dimen16dp"
|
||||
android:text="@string/newNote"
|
||||
android:contentDescription="@string/newNote"
|
||||
android:textColor="@color/colorWhite"
|
||||
android:textColor="?attr/primaryBackgroundColor"
|
||||
android:backgroundTint="?attr/fabColor"
|
||||
app:iconTint="@color/colorWhite"
|
||||
app:iconTint="?attr/primaryBackgroundColor"
|
||||
app:icon="@drawable/ic_add" />
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:indeterminate="true"
|
||||
style="@style/Widget.MaterialComponents.LinearProgressIndicator"
|
||||
app:indicatorColor="?attr/progressIndicatorColor"/>
|
||||
app:indicatorColor="?attr/progressIndicatorColor" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/noDataNotifications"
|
||||
|
@ -45,7 +45,7 @@
|
|||
android:text="@string/noDataNotifications"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="20sp"
|
||||
android:visibility="gone"/>
|
||||
android:visibility="gone" />
|
||||
|
||||
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
|
||||
android:id="@+id/markAllAsRead"
|
||||
|
@ -55,10 +55,10 @@
|
|||
android:layout_margin="16dp"
|
||||
android:text="@string/markAsRead"
|
||||
android:contentDescription="@string/markAsRead"
|
||||
android:textColor="@color/colorWhite"
|
||||
android:textColor="?attr/primaryBackgroundColor"
|
||||
android:backgroundTint="?attr/fabColor"
|
||||
app:layout_behavior="com.google.android.material.behavior.HideBottomViewOnScrollBehavior"
|
||||
app:iconTint="@color/colorWhite"
|
||||
app:icon="@drawable/ic_done"/>
|
||||
app:iconTint="?attr/primaryBackgroundColor"
|
||||
app:icon="@drawable/ic_done" />
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
|
|
@ -52,9 +52,9 @@
|
|||
android:layout_margin="16dp"
|
||||
android:text="@string/pageTitleCreateOrganization"
|
||||
android:contentDescription="@string/pageTitleCreateOrganization"
|
||||
android:textColor="@color/colorWhite"
|
||||
android:textColor="?attr/primaryBackgroundColor"
|
||||
android:backgroundTint="?attr/fabColor"
|
||||
app:iconTint="@color/colorWhite"
|
||||
app:icon="@drawable/ic_add"/>
|
||||
app:iconTint="?attr/primaryBackgroundColor"
|
||||
app:icon="@drawable/ic_add" />
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
|
|
@ -26,9 +26,11 @@
|
|||
android:layout_gravity="center"
|
||||
android:text="@string/archivedRepositoryMessage"
|
||||
android:background="@drawable/shape_archived"
|
||||
android:padding="@dimen/dimen6dp"
|
||||
android:layout_marginBottom="@dimen/dimen8dp"
|
||||
android:textColor="@color/colorWhite"/>
|
||||
android:padding="@dimen/dimen10dp"
|
||||
android:layout_marginBottom="@dimen/dimen10dp"
|
||||
android:textStyle="bold"
|
||||
android:textSize="@dimen/dimen14sp"
|
||||
android:textColor="?attr/fabColor" />
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -54,9 +54,9 @@
|
|||
android:layout_margin="16dp"
|
||||
android:text="@string/pageTitleNewRepo"
|
||||
android:contentDescription="@string/pageTitleNewRepo"
|
||||
android:textColor="@color/colorWhite"
|
||||
android:textColor="?attr/primaryBackgroundColor"
|
||||
android:backgroundTint="?attr/fabColor"
|
||||
app:iconTint="@color/colorWhite"
|
||||
app:iconTint="?attr/primaryBackgroundColor"
|
||||
app:icon="@drawable/ic_add"/>
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
|
Loading…
Reference in a new issue