Handle popular links (#730)

Fix settings layout

Merge branch 'master' into deeplinks

Support for all links, check gitea instance, add progress indicator

Enhance account checks, improve the experience of coming from links

Merge branch 'master' into deeplinks

Update libs

Minor layout fixes

gradle update

Fix show/hide views

Handle pr, repos. Handle settings for no action.

open issue from link

Add new settings section translation ready - General for generic settings

wip on handle popular links

Co-authored-by: M M Arif <mmarif@swatian.com>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: 6543 <6543@noreply.codeberg.org>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/730
This commit is contained in:
M M Arif
2020-10-23 20:13:13 +02:00
parent 044f6191bf
commit 8e86fa668d
33 changed files with 1099 additions and 155 deletions

View File

@@ -0,0 +1,131 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="?attr/primaryBackgroundColor"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">
<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"
android:layout_centerInParent="true"
app:indicatorColor="?attr/progressIndicatorColor" />
<LinearLayout
android:id="@+id/addNewAccountFrame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="32dp"
android:paddingBottom="16dp"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:visibility="gone"
android:orientation="vertical">
<TextView
android:id="@+id/addAccountText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/accountDoesNotExist"
android:textColor="?attr/primaryTextColor"
android:textSize="16sp" />
<Button
android:id="@+id/addNewAccount"
android:layout_width="match_parent"
android:layout_height="60dp"
android:text="@string/addNewAccountText"
android:textColor="@color/btnTextColor"
android:textSize="16sp"
android:layout_marginTop="24dp" />
<Button
android:id="@+id/openInBrowser"
android:layout_width="match_parent"
android:layout_height="60dp"
android:text="@string/openWebRepo"
android:textColor="@color/btnTextColor"
android:textSize="16sp"
android:layout_marginTop="8dp" />
<Button
android:id="@+id/launchApp"
android:layout_width="match_parent"
android:layout_height="60dp"
android:text="@string/launchApp"
android:textColor="@color/btnTextColor"
android:textSize="16sp"
android:layout_marginTop="8dp" />
</LinearLayout>
<LinearLayout
android:id="@+id/noActionFrame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="32dp"
android:paddingBottom="16dp"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:visibility="gone"
android:orientation="vertical">
<TextView
android:id="@+id/noActionText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/noActionText"
android:textColor="?attr/primaryTextColor"
android:textSize="16sp" />
<Button
android:id="@+id/repository"
android:layout_width="match_parent"
android:layout_height="60dp"
android:text="@string/navRepos"
android:textColor="@color/btnTextColor"
android:textSize="16sp"
android:layout_marginTop="24dp" />
<Button
android:id="@+id/organization"
android:layout_width="match_parent"
android:layout_height="60dp"
android:text="@string/navOrgs"
android:textColor="@color/btnTextColor"
android:textSize="16sp"
android:layout_marginTop="8dp" />
<Button
android:id="@+id/notification"
android:layout_width="match_parent"
android:layout_height="60dp"
android:text="@string/pageTitleNotifications"
android:textColor="@color/btnTextColor"
android:textSize="16sp"
android:layout_marginTop="8dp" />
<Button
android:id="@+id/explore"
android:layout_width="match_parent"
android:layout_height="60dp"
android:text="@string/navExplore"
android:textColor="@color/btnTextColor"
android:textSize="16sp"
android:layout_marginTop="8dp" />
<Button
android:id="@+id/launchApp2"
android:layout_width="match_parent"
android:layout_height="60dp"
android:text="@string/launchApp"
android:textColor="@color/btnTextColor"
android:textSize="16sp"
android:layout_marginTop="8dp" />
</LinearLayout>
</RelativeLayout>

View File

@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/layoutReportingView"
android:orientation="vertical"
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"
android:theme="@style/AppTheme.AppBarOverlay">
<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_close" />
<TextView
android:id="@+id/toolbarTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="@string/settingsGeneralHeader"
android:textColor="?attr/primaryTextColor"
android:maxLines="1"
android:textSize="20sp" />
</com.google.android.material.appbar.MaterialToolbar>
</com.google.android.material.appbar.AppBarLayout>
<LinearLayout
android:id="@+id/setDefaultLinkHandler"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:orientation="vertical">
<TextView
android:id="@+id/generalDeepLinkDefaultScreen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:layout_marginTop="10dp"
android:layout_marginStart="44dp"
android:layout_marginEnd="24dp"
android:text="@string/generalDeepLinkDefaultScreen"
android:textColor="?attr/primaryTextColor"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_marginStart="44dp"
android:layout_marginEnd="44dp"
android:text="@string/generalDeepLinkDefaultScreenHintText"
android:textSize="12sp"
android:textColor="?attr/hintColor" />
<TextView
android:id="@+id/generalDeepLinkSelected"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:layout_marginStart="44dp"
android:layout_marginEnd="24dp"
android:text="@string/generalDeepLinkSelectedText"
android:textColor="?attr/selectedTextColor"/>
</LinearLayout>
</LinearLayout>

View File

@@ -34,7 +34,7 @@
android:textColor="?attr/primaryTextColor"
android:textSize="20sp"
android:textStyle="bold"
android:drawableStart="@drawable/ic_person_add"
app:drawableStartCompat="@drawable/ic_person_add"
android:drawablePadding="16dp"
android:text="@string/newIssueSelectAssigneesListTitle" />

View File

@@ -2,6 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
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">
@@ -25,7 +26,7 @@
android:textColor="?attr/primaryTextColor"
android:textSize="20sp"
android:textStyle="bold"
android:drawableStart="@drawable/ic_filter"
app:drawableStartCompat="@drawable/ic_filter"
android:drawablePadding="16dp"
android:text="@string/exploreFilterDialogTitle"
android:layout_marginBottom="4dp" />

View File

@@ -34,7 +34,7 @@
android:textColor="?attr/primaryTextColor"
android:textSize="20sp"
android:textStyle="bold"
android:drawableStart="@drawable/ic_label"
app:drawableStartCompat="@drawable/ic_label"
android:drawablePadding="16dp"
android:text="@string/newIssueSelectLabelsListTitle" />

View File

@@ -20,7 +20,7 @@
android:textColor="?attr/primaryTextColor"
android:textSize="20sp"
android:textStyle="bold"
android:drawableStart="@drawable/ic_delete"
app:drawableStartCompat="@drawable/ic_delete"
android:drawablePadding="16dp"
android:text="@string/repoSettingsDelete"
android:layout_marginBottom="16dp" />

View File

@@ -21,7 +21,7 @@
android:textColor="?attr/primaryTextColor"
android:textSize="20sp"
android:textStyle="bold"
android:drawableStart="@drawable/ic_arrow_up"
app:drawableStartCompat="@drawable/ic_arrow_up"
android:drawablePadding="16dp"
android:text="@string/repoSettingsTransferOwnership"
android:layout_marginBottom="16dp" />

View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/primaryBackgroundColor">
@@ -17,23 +18,55 @@
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/appearanceFrame"
android:id="@+id/generalFrame"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="wrap_content"
android:layout_marginTop="20dp">
<TextView
android:id="@+id/tvGeneral"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawablePadding="24dp"
android:paddingStart="12dp"
android:paddingEnd="12dp"
android:text="@string/settingsGeneralHeader"
android:textColor="?attr/primaryTextColor"
android:textSize="16sp"
app:drawableStartCompat="@drawable/ic_otp" />
<TextView
android:id="@+id/generalHintText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingStart="60dp"
android:paddingEnd="12dp"
android:text="@string/generalHintText"
android:textColor="?attr/primaryTextColor"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/appearanceFrame"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="wrap_content"
android:layout_marginTop="25dp">
<TextView
android:id="@+id/tvAppearance"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableStart="@drawable/ic_appearance"
android:drawablePadding="24dp"
android:paddingStart="12dp"
android:paddingEnd="12dp"
android:text="@string/settingsAppearanceHeader"
android:textColor="?attr/primaryTextColor"
android:textSize="16sp" />
android:textSize="16sp"
app:drawableStartCompat="@drawable/ic_appearance" />
<TextView
android:id="@+id/appearanceHintText"
@@ -59,13 +92,13 @@
android:id="@+id/fileViewer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableStart="@drawable/ic_file"
android:drawablePadding="24dp"
android:paddingStart="12dp"
android:paddingEnd="12dp"
android:text="@string/fileViewerHeader"
android:textColor="?attr/primaryTextColor"
android:textSize="16sp" />
android:textSize="16sp"
app:drawableStartCompat="@drawable/ic_file" />
<TextView
android:id="@+id/fileViewerHintText"
@@ -91,13 +124,13 @@
android:id="@+id/draftsHeader"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableStart="@drawable/ic_drafts"
android:drawablePadding="24dp"
android:paddingStart="12dp"
android:paddingEnd="12dp"
android:text="@string/draftsHeader"
android:textColor="?attr/primaryTextColor"
android:textSize="16sp" />
android:textSize="16sp"
app:drawableStartCompat="@drawable/ic_drafts" />
<TextView
android:id="@+id/draftsHintText"
@@ -123,13 +156,13 @@
android:id="@+id/tvSecurity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableStart="@drawable/ic_security"
android:drawablePadding="24dp"
android:paddingStart="12dp"
android:paddingEnd="12dp"
android:text="@string/settingsSecurityHeader"
android:textColor="?attr/primaryTextColor"
android:textSize="16sp" />
android:textSize="16sp"
app:drawableStartCompat="@drawable/ic_security" />
<TextView
android:id="@+id/securityHintText"
@@ -155,13 +188,13 @@
android:id="@+id/tvLanguages"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableStart="@drawable/ic_flag"
android:drawablePadding="24dp"
android:paddingStart="12dp"
android:paddingEnd="12dp"
android:text="@string/settingsLanguageHeaderText"
android:textColor="?attr/primaryTextColor"
android:textSize="16sp" />
android:textSize="16sp"
app:drawableStartCompat="@drawable/ic_flag" />
<TextView
android:id="@+id/languagesHintText"
@@ -187,13 +220,13 @@
android:id="@+id/appReports"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableStart="@drawable/ic_bug_report"
android:drawablePadding="24dp"
android:paddingStart="12dp"
android:paddingEnd="12dp"
android:text="@string/reportViewerHeader"
android:textColor="?attr/primaryTextColor"
android:textSize="16sp" />
android:textSize="16sp"
app:drawableStartCompat="@drawable/ic_bug_report" />
<TextView
android:id="@+id/reportsHintText"
@@ -245,19 +278,20 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="25dp">
android:layout_marginTop="25dp"
android:layout_marginBottom="20dp">
<TextView
android:id="@+id/aboutApp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableStart="@drawable/ic_info"
android:drawablePadding="24dp"
android:paddingStart="12dp"
android:paddingEnd="12dp"
android:text="@string/navAbout"
android:textColor="?attr/primaryTextColor"
android:textSize="16sp" />
android:textSize="16sp"
app:drawableStartCompat="@drawable/ic_info" />
<TextView
android:id="@+id/aboutAppHintText"

View File

@@ -270,6 +270,12 @@
<string name="draftsHintText">Comments draft</string>
<string name="settingsEnableCommentsDeletionText">Enable Drafts Deletion</string>
<string name="settingsEnableCommentsDeletionHintText">Delete comment draft when comment is posted</string>
<string name="settingsGeneralHeader">General</string>
<string name="generalHintText">Default actions</string>
<string name="generalDeepLinkDefaultScreen">Default Link Handler</string>
<string name="generalDeepLinkDefaultScreenHintText">Choose what screen should be loaded if the app cannot handle external links. It will redirect you automatically.</string>
<string name="generalDeepLinkSelectedText">N/A</string>
<string name="linkSelectorDialogTitle">Select Default Screen</string>
<!-- settings -->
<string name="noMoreData">No more data available</string>
@@ -716,4 +722,8 @@
<string name="prCreateSuccess">Pull Request created successfully</string>
<string name="prAlreadyExists">A pull request between these branches already exists</string>
<string name="accountDoesNotExist">It seems that account for URI %1$s does not exists in the app. You can add one by tapping on the Add New Account button.</string>
<string name="launchApp">Go to App</string>
<string name="noActionText">GitNex cannot handle the requested resource, you can open an issue at the project repository as an improvement with providing details of the work. Just launch a default screen for now from the buttons below, it can be changed from settings.</string>
</resources>