Repo settings (delete-edit) (#683)

better var names

remove migration

Merge branch 'repo-settings-delete-migrate-edit' of codeberg.org:gitnex/GitNex into repo-settings-delete-migrate-edit

delete repository

Merge branch 'master' into repo-settings-delete-migrate-edit

Can edit repo properties now

Add progress indicator, call for save

Pull repo info into dialog

Repo properties in custom dialog

settings activity with labels

Merge branch 'master' into repo-settings-delete-migrate-edit

Merge branch 'master' of codeberg.org:gitnex/GitNex into master

add bottom sheet entry

endline

Co-authored-by: M M Arif <mmarif@swatian.com>
Co-authored-by: 6543 <6543@noreply.codeberg.org>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/683
This commit is contained in:
M M Arif
2020-09-13 06:54:05 +02:00
parent dbf5be25a5
commit 5e6c600e71
23 changed files with 1078 additions and 67 deletions

View File

@@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="?attr/iconsColor"
android:pathData="M4.75,0A2.75,2.75 0,0 0,2 2.75v16.5A2.75,2.75 0,0 0,4.75 22h11a0.75,0.75 0,0 0,0 -1.5h-11c-0.69,0 -1.25,-0.56 -1.25,-1.25V18A1.5,1.5 0,0 1,5 16.5h7.25a0.75,0.75 0,0 0,0 -1.5H5c-0.546,0 -1.059,0.146 -1.5,0.401V2.75c0,-0.69 0.56,-1.25 1.25,-1.25H18.5v7a0.75,0.75 0,0 0,1.5 0V0.75a0.75,0.75 0,0 0,-0.75 -0.75H4.75z"/>
<path
android:fillColor="?attr/iconsColor"
android:pathData="M20,13.903l2.202,2.359a0.75,0.75 0,0 0,1.096 -1.024l-3.5,-3.75a0.75,0.75 0,0 0,-1.096 0l-3.5,3.75a0.75,0.75 0,1 0,1.096 1.024l2.202,-2.36v9.348a0.75,0.75 0,0 0,1.5 0v-9.347z"/>
</vector>

View File

@@ -0,0 +1,109 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android"
android:background="?attr/primaryBackgroundColor">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/Widget.AppCompat.SearchView">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/primaryBackgroundColor">
<ImageView
android:id="@+id/close"
android:layout_width="@dimen/close_button_size"
android:layout_height="@dimen/close_button_size"
android:layout_marginRight="15dp"
android:layout_marginLeft="15dp"
android:gravity="center_vertical"
android:contentDescription="@string/close"
android:src="@drawable/ic_arrow_back" />
<TextView
android:id="@+id/toolbarTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="@string/repoSettingsTitle"
android:textColor="?attr/primaryTextColor"
android:maxLines="1"
android:textSize="20sp" />
</com.google.android.material.appbar.MaterialToolbar>
</com.google.android.material.appbar.AppBarLayout>
<ScrollView android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/primaryBackgroundColor">
<LinearLayout
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="wrap_content">
<TextView
android:id="@+id/editProperties"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="@string/repoSettingsEditProperties"
android:drawableStart="@drawable/ic_edit"
android:drawablePadding="32dp"
android:textColor="?attr/primaryTextColor"
android:textSize="16sp"
android:padding="16dp" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dividerColor" />
<LinearLayout
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="wrap_content"
android:paddingBottom="16dp">
<TextView
android:id="@+id/deleteRepository"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="@string/repoSettingsDelete"
android:drawableStart="@drawable/ic_delete"
android:drawablePadding="32dp"
android:textColor="?attr/primaryTextColor"
android:textSize="16sp"
android:paddingTop="16dp"
android:paddingStart="16dp"
android:paddingEnd="16dp" />
<TextView
android:id="@+id/deleteRepositoryHint"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="@string/repoSettingsDeleteHint"
android:textColor="?attr/hintColor"
android:textSize="12sp"
android:paddingStart="72dp"
android:paddingEnd="16dp" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>

View File

@@ -189,6 +189,27 @@
android:textSize="16sp"
android:padding="12dp" />
<View
android:id="@+id/repoSettingsDivider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp"
android:layout_marginStart="64dp"
android:background="?attr/dividerColor" />
<TextView
android:id="@+id/repoSettings"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:drawableStart="@drawable/ic_settings"
android:drawablePadding="24dp"
android:text="@string/navSettings"
android:textColor="?attr/primaryTextColor"
android:textSize="16sp"
android:padding="12dp" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>

View File

@@ -0,0 +1,109 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@drawable/shape_custom_dialog"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
android:orientation="vertical">
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?attr/primaryTextColor"
android:textSize="20sp"
android:textStyle="bold"
android:drawableStart="@drawable/ic_delete"
android:drawablePadding="16dp"
android:text="@string/repoSettingsDelete"
android:layout_marginBottom="16dp" />
<TextView
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?attr/primaryTextColor"
android:textSize="16sp"
android:text="@string/repoSettingsDeleteDescription"
android:layout_marginBottom="16dp" />
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/repoNameForDeletionLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:boxBackgroundColor="?attr/inputBackgroundColor"
android:textColorHint="?attr/hintColor"
app:hintTextColor="?attr/hintColor"
app:boxStrokeErrorColor="@color/darkRed"
android:layout_marginBottom="8dp"
android:hint="@string/newRepoTintCopy">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/repoNameForDeletion"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?attr/inputTextColor"
android:textColorHighlight="?attr/hintColor"
android:textColorHint="?attr/hintColor"
android:textSize="16sp" />
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:id="@+id/divider"
android:background="?attr/dividerColor" />
<com.google.android.material.progressindicator.ProgressIndicator
android:id="@+id/processingRequest"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
style="@style/Widget.MaterialComponents.ProgressIndicator.Linear.Indeterminate"
app:indicatorColor="?attr/progressIndicatorColor" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:orientation="horizontal" >
<Button
android:id="@+id/cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="?android:attr/button"
android:layout_alignParentStart="true"
android:text="@string/cancelButton"
android:textColor="@color/colorWhite"
android:textSize="16sp" />
<Button
android:id="@+id/delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="?android:attr/button"
android:layout_alignParentEnd="true"
android:text="@string/menuDeleteText"
android:backgroundTint="@color/darkRed"
android:textColor="@color/colorWhite"
android:textSize="16sp"
tools:ignore="RelativeOverlap" />
</RelativeLayout>
</LinearLayout>

View File

@@ -0,0 +1,231 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@drawable/shape_custom_dialog"
android:orientation="vertical">
<com.google.android.material.progressindicator.ProgressIndicator
android:id="@+id/progressBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/Widget.MaterialComponents.ProgressIndicator.Linear.Indeterminate"
app:indicatorColor="?attr/progressIndicatorColor" />
<androidx.core.widget.NestedScrollView
android:id="@+id/mainView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
android:orientation="vertical">
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/repoNameLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:boxBackgroundColor="?attr/inputBackgroundColor"
android:textColorHint="?attr/hintColor"
app:hintTextColor="?attr/hintColor"
app:boxStrokeErrorColor="@color/darkRed"
android:layout_marginBottom="8dp"
android:hint="@string/newRepoTintCopy">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/repoName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?attr/inputTextColor"
android:textColorHighlight="?attr/hintColor"
android:textColorHint="?attr/hintColor"
android:textSize="16sp" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/repoWebsiteLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:boxBackgroundColor="?attr/inputBackgroundColor"
android:textColorHint="?attr/hintColor"
app:hintTextColor="?attr/hintColor"
app:boxStrokeErrorColor="@color/darkRed"
android:layout_marginBottom="8dp"
android:hint="@string/websiteText">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/repoWebsite"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?attr/inputTextColor"
android:textColorHighlight="?attr/hintColor"
android:textColorHint="?attr/hintColor"
android:textSize="16sp" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/repoDescriptionLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:boxBackgroundColor="?attr/inputBackgroundColor"
android:textColorHint="?attr/hintColor"
app:hintTextColor="?attr/hintColor"
app:boxStrokeErrorColor="@color/darkRed"
android:hint="@string/newRepoDescTintCopy">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/repoDescription"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?attr/inputTextColor"
android:textColorHighlight="?attr/hintColor"
android:textColorHint="?attr/hintColor"
android:textSize="16sp" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/repoPrivate"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:checked="true"
android:textColor="?attr/primaryTextColor"
android:text="@string/newRepoPrivateCopy" />
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/repoAsTemplate"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:checked="true"
android:textColor="?attr/primaryTextColor"
android:text="@string/repoPropertiesTemplate" />
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/repoEnableIssues"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:checked="true"
android:textColor="?attr/primaryTextColor"
android:text="@string/repoPropertiesEnableIssues" />
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/repoEnableWiki"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:checked="true"
android:textColor="?attr/primaryTextColor"
android:text="@string/repoPropertiesEnableWiki" />
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/repoEnablePr"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:checked="true"
android:textColor="?attr/primaryTextColor"
android:text="@string/repoPropertiesEnablePr" />
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/repoEnableTimer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:checked="true"
android:textColor="?attr/primaryTextColor"
android:text="@string/repoPropertiesEnableTimeTracker" />
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/repoEnableMerge"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:checked="true"
android:textColor="?attr/primaryTextColor"
android:text="@string/repoPropertiesEnableMergeCommits" />
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/repoEnableRebase"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:checked="true"
android:textColor="?attr/primaryTextColor"
android:text="@string/repoPropertiesEnableRebase" />
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/repoEnableSquash"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:checked="true"
android:textColor="?attr/primaryTextColor"
android:text="@string/repoPropertiesEnableSquash" />
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/repoEnableForceMerge"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:checked="true"
android:textColor="?attr/primaryTextColor"
android:text="@string/repoPropertiesEnableForceMerge" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:id="@+id/divider"
android:background="?attr/dividerColor" />
<com.google.android.material.progressindicator.ProgressIndicator
android:id="@+id/processingRequest"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
style="@style/Widget.MaterialComponents.ProgressIndicator.Linear.Indeterminate"
app:indicatorColor="?attr/progressIndicatorColor" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:orientation="horizontal" >
<Button
android:id="@+id/cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="?android:attr/button"
android:layout_alignParentStart="true"
android:text="@string/cancelButton"
android:textColor="@color/colorWhite"
android:textSize="16sp" />
<Button
android:id="@+id/save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="?android:attr/button"
android:layout_alignParentEnd="true"
android:text="@string/saveButton"
android:textColor="@color/colorWhite"
android:textSize="16sp"
tools:ignore="RelativeOverlap" />
</RelativeLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>

View File

@@ -661,4 +661,24 @@
<string name="isRead">Read</string>
<string name="isUnread">Unread</string>
<string name="repoSettingsTitle">Repository Settings</string>
<string name="repoSettingsEditProperties">Edit Properties</string>
<string name="repoSettingsDelete">Delete Repository</string>
<string name="repoSettingsDeleteHint">Be careful, this operation CANNOT be undone!</string>
<string name="repoPropertiesTemplate">Set as Template</string>
<string name="repoPropertiesEnableIssues">Enable Issues</string>
<string name="repoPropertiesExternalIssuesUrl">External Issue Tracker Url</string>
<string name="repoPropertiesEnableWiki">Enable Wiki</string>
<string name="repoPropertiesExternalWikiUrl">External Wiki Url</string>
<string name="repoPropertiesEnablePr">Enable Pull Requests</string>
<string name="repoPropertiesEnableTimeTracker">Enable Time Tracker</string>
<string name="repoPropertiesEnableMergeCommits">Enable Merge Commits</string>
<string name="repoPropertiesEnableRebase">Enable Rebase</string>
<string name="repoPropertiesEnableSquash">Enable Squash and Merge</string>
<string name="repoPropertiesEnableForceMerge">Enable Rebase with Merge Commits (&#8212;&#8212;no-ff)</string>
<string name="repoPropertiesSaveSuccess">Repository properties updated successfully</string>
<string name="repoSettingsDeleteDescription">Things to know before deletion:\n\n- This operation CANNOT be undone.\n- This operation will permanently delete the repository including code, issues, comments, wiki data and collaborator settings.\n\nEnter the repository name as confirmation</string>
<string name="repoSettingsDeleteError">Repository name does not match</string>
<string name="repoDeletionSuccess">Repository deleted successfully</string>
</resources>