GitNex/app/src/main/res/layout/activity_settings_general.xml
qwerty287 5550c153f2 Add support for custom tabs and improve various things (#1019)
Adds support for Custom Tabs (at laest supported by Chrome and Firefox).
This is also useful if you set the app as default app for links from the supported Gitea instances.
If you then try to use the "Open in browser" buttons, this will just open the link in GitNex itself.
With Custom Tabs, the links are opened as Custom Tabs (only if the default browser supports them).
I also deleted the unused `OpenRepoInBrowserActivity` and added the mechanism to open an URL in the browser to the `AppUtil`.

I also improved the setting switches:
* hide settings if required settings are disabled (only notification settings)
* allow click on full layouts

Co-authored-by: qwerty287 <ndev@web.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1019
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2021-12-17 20:56:12 +01:00

159 lines
6.1 KiB
XML

<?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"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="?attr/primaryBackgroundColor"
android:orientation="vertical">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
app:elevation="0dp"
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_marginLeft="15dp"
android:layout_marginRight="15dp"
android:contentDescription="@string/close"
android:gravity="center_vertical"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:focusable="true"
android:clickable="true"
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:maxLines="1"
android:text="@string/settingsGeneralHeader"
android:textColor="?attr/primaryTextColor"
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:background="?android:attr/selectableItemBackground"
android:focusable="true"
android:clickable="true"
android:orientation="vertical"
android:paddingTop="10dp"
android:paddingBottom="10dp">
<TextView
android:id="@+id/generalDeepLinkDefaultScreen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="44dp"
android:layout_marginEnd="24dp"
android:text="@string/generalDeepLinkDefaultScreen"
android:textColor="?attr/primaryTextColor"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="44dp"
android:layout_marginEnd="44dp"
android:text="@string/generalDeepLinkDefaultScreenHintText"
android:textColor="?attr/hintColor"
android:textSize="12sp" />
<TextView
android:id="@+id/generalDeepLinkSelected"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="44dp"
android:layout_marginEnd="24dp"
android:text="@string/generalDeepLinkSelectedText"
android:textColor="?attr/selectedTextColor"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/homeScreenFrame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:focusable="true"
android:clickable="true"
android:orientation="vertical"
android:paddingTop="10dp"
android:paddingBottom="10dp">
<TextView
android:id="@+id/homeScreenHeaderSelector"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="44dp"
android:layout_marginEnd="24dp"
android:text="@string/settingsHomeScreenHeaderText"
android:textColor="?attr/primaryTextColor"
android:textSize="16sp" />
<TextView
android:id="@+id/homeScreenSelected"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="44dp"
android:layout_marginEnd="24dp"
android:text="@string/settingsHomeScreenSelectedText"
android:textColor="?attr/selectedTextColor"
android:textSize="14sp" />
</LinearLayout>
<RelativeLayout
android:id="@+id/customTabsFrame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="10dp"
android:paddingBottom="10dp">
<TextView
android:id="@+id/customTabsHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="44dp"
android:layout_marginEnd="24dp"
android:text="@string/useCustomTabs"
android:textColor="?attr/primaryTextColor"
android:textSize="16sp" />
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/switchTabs"
android:layout_width="wrap_content"
android:layout_height="24dp"
android:layout_alignParentEnd="true"
android:layout_gravity="end"
android:layout_toEndOf="@+id/customTabsHeader"
android:gravity="end"
android:paddingStart="0dp"
android:paddingEnd="24dp"
android:switchMinWidth="56dp" />
</RelativeLayout>
</LinearLayout>