mirror of
https://github.com/gitnex-org/gitnex.git
synced 2026-04-27 11:38:39 -05:00
Move general settings to bottom sheet
This commit is contained in:
@@ -153,9 +153,6 @@
|
||||
android:name=".activities.CreatePullRequestActivity"
|
||||
android:configChanges="orientation|screenSize|smallestScreenSize|density|screenLayout|keyboard|keyboardHidden|navigation"
|
||||
android:windowSoftInputMode="adjustResize"/>
|
||||
<activity
|
||||
android:name=".activities.SettingsGeneralActivity"
|
||||
android:configChanges="orientation|screenSize|smallestScreenSize|density|screenLayout|keyboard|keyboardHidden|navigation"/>
|
||||
<activity
|
||||
android:name=".activities.AdminCronTasksActivity"
|
||||
android:configChanges="orientation|screenSize|smallestScreenSize|density|screenLayout|keyboard|keyboardHidden|navigation"/>
|
||||
|
||||
@@ -1,161 +0,0 @@
|
||||
package org.mian.gitnex.activities;
|
||||
|
||||
import android.os.Bundle;
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.databinding.ActivitySettingsGeneralBinding;
|
||||
import org.mian.gitnex.helpers.AppDatabaseSettings;
|
||||
import org.mian.gitnex.helpers.SnackBar;
|
||||
|
||||
/**
|
||||
* @author M M Arif
|
||||
*/
|
||||
public class SettingsGeneralActivity extends BaseActivity {
|
||||
|
||||
private static int homeScreenSelectedChoice;
|
||||
private static int defaultLinkHandlerScreenSelectedChoice;
|
||||
private ActivitySettingsGeneralBinding viewBinding;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
viewBinding = ActivitySettingsGeneralBinding.inflate(getLayoutInflater());
|
||||
setContentView(viewBinding.getRoot());
|
||||
|
||||
viewBinding.topAppBar.setNavigationOnClickListener(v -> finish());
|
||||
|
||||
// home screen
|
||||
String[] appHomeDefaultScreen =
|
||||
getResources().getStringArray(R.array.appDefaultHomeScreenNew);
|
||||
|
||||
homeScreenSelectedChoice =
|
||||
Integer.parseInt(
|
||||
AppDatabaseSettings.getSettingsValue(
|
||||
ctx, AppDatabaseSettings.APP_HOME_SCREEN_KEY));
|
||||
|
||||
viewBinding.homeScreenSelected.setText(appHomeDefaultScreen[homeScreenSelectedChoice]);
|
||||
|
||||
viewBinding.homeScreenFrame.setOnClickListener(
|
||||
setDefaultHomeScreen -> {
|
||||
MaterialAlertDialogBuilder materialAlertDialogBuilder =
|
||||
new MaterialAlertDialogBuilder(ctx)
|
||||
.setTitle(R.string.settingsHomeScreenSelectorDialogTitle)
|
||||
.setCancelable(homeScreenSelectedChoice != -1)
|
||||
.setSingleChoiceItems(
|
||||
appHomeDefaultScreen,
|
||||
homeScreenSelectedChoice,
|
||||
(dialogInterfaceHomeScreen, i) -> {
|
||||
homeScreenSelectedChoice = i;
|
||||
viewBinding.homeScreenSelected.setText(
|
||||
appHomeDefaultScreen[i]);
|
||||
|
||||
AppDatabaseSettings.updateSettingsValue(
|
||||
ctx,
|
||||
String.valueOf(i),
|
||||
AppDatabaseSettings.APP_HOME_SCREEN_KEY);
|
||||
|
||||
dialogInterfaceHomeScreen.dismiss();
|
||||
SnackBar.success(
|
||||
ctx,
|
||||
findViewById(android.R.id.content),
|
||||
getString(R.string.settingsSave));
|
||||
});
|
||||
|
||||
materialAlertDialogBuilder.create().show();
|
||||
});
|
||||
// home screen
|
||||
|
||||
// link handler
|
||||
String[] linkHandlerDefaultScreenList =
|
||||
getResources().getStringArray(R.array.linkHandlerDefaultScreen);
|
||||
List<String> linkHandlerDefaultScreen =
|
||||
new ArrayList<>(Arrays.asList(linkHandlerDefaultScreenList));
|
||||
|
||||
String[] linksArray = new String[linkHandlerDefaultScreen.size()];
|
||||
linkHandlerDefaultScreen.toArray(linksArray);
|
||||
|
||||
defaultLinkHandlerScreenSelectedChoice =
|
||||
Integer.parseInt(
|
||||
AppDatabaseSettings.getSettingsValue(
|
||||
ctx, AppDatabaseSettings.APP_LINK_HANDLER_KEY));
|
||||
viewBinding.generalDeepLinkSelected.setText(
|
||||
linksArray[defaultLinkHandlerScreenSelectedChoice]);
|
||||
|
||||
viewBinding.setDefaultLinkHandler.setOnClickListener(
|
||||
setDefaultLinkHandler -> {
|
||||
MaterialAlertDialogBuilder materialAlertDialogBuilder =
|
||||
new MaterialAlertDialogBuilder(ctx)
|
||||
.setTitle(R.string.linkSelectorDialogTitle)
|
||||
.setCancelable(defaultLinkHandlerScreenSelectedChoice != -1)
|
||||
.setSingleChoiceItems(
|
||||
linksArray,
|
||||
defaultLinkHandlerScreenSelectedChoice,
|
||||
(dialogInterfaceHomeScreen, i) -> {
|
||||
defaultLinkHandlerScreenSelectedChoice = i;
|
||||
viewBinding.generalDeepLinkSelected.setText(
|
||||
linksArray[i]);
|
||||
|
||||
AppDatabaseSettings.updateSettingsValue(
|
||||
ctx,
|
||||
String.valueOf(i),
|
||||
AppDatabaseSettings.APP_LINK_HANDLER_KEY);
|
||||
|
||||
dialogInterfaceHomeScreen.dismiss();
|
||||
SnackBar.success(
|
||||
ctx,
|
||||
findViewById(android.R.id.content),
|
||||
getString(R.string.settingsSave));
|
||||
});
|
||||
|
||||
materialAlertDialogBuilder.create().show();
|
||||
});
|
||||
// link handler
|
||||
|
||||
// custom tabs switcher
|
||||
viewBinding.switchTabs.setChecked(
|
||||
Boolean.parseBoolean(
|
||||
AppDatabaseSettings.getSettingsValue(
|
||||
ctx, AppDatabaseSettings.APP_CUSTOM_BROWSER_KEY)));
|
||||
viewBinding.switchTabs.setOnCheckedChangeListener(
|
||||
(buttonView, isChecked) -> {
|
||||
AppDatabaseSettings.updateSettingsValue(
|
||||
ctx,
|
||||
String.valueOf(isChecked),
|
||||
AppDatabaseSettings.APP_CUSTOM_BROWSER_KEY);
|
||||
SnackBar.success(
|
||||
ctx,
|
||||
findViewById(android.R.id.content),
|
||||
getString(R.string.settingsSave));
|
||||
});
|
||||
viewBinding.customTabsFrame.setOnClickListener(
|
||||
v -> viewBinding.switchTabs.setChecked(!viewBinding.switchTabs.isChecked()));
|
||||
// custom tabs switcher
|
||||
|
||||
// crash reports switcher
|
||||
viewBinding.crashReportsSwitch.setChecked(
|
||||
Boolean.parseBoolean(
|
||||
AppDatabaseSettings.getSettingsValue(
|
||||
ctx, AppDatabaseSettings.APP_CRASH_REPORTS_KEY)));
|
||||
viewBinding.crashReportsSwitch.setOnCheckedChangeListener(
|
||||
(buttonView, isChecked) -> {
|
||||
AppDatabaseSettings.updateSettingsValue(
|
||||
ctx,
|
||||
String.valueOf(isChecked),
|
||||
AppDatabaseSettings.APP_CRASH_REPORTS_KEY);
|
||||
SnackBar.success(
|
||||
ctx,
|
||||
findViewById(android.R.id.content),
|
||||
getString(R.string.settingsSave));
|
||||
});
|
||||
viewBinding.enableSendReports.setOnClickListener(
|
||||
v ->
|
||||
viewBinding.crashReportsSwitch.setChecked(
|
||||
!viewBinding.crashReportsSwitch.isChecked()));
|
||||
// crash reports switcher
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,213 @@
|
||||
package org.mian.gitnex.fragments;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.databinding.BottomSheetSettingsGeneralBinding;
|
||||
import org.mian.gitnex.helpers.AppDatabaseSettings;
|
||||
import org.mian.gitnex.helpers.SnackBar;
|
||||
|
||||
/**
|
||||
* @author mmarif
|
||||
*/
|
||||
public class BottomSheetSettingsGeneralFragment extends BottomSheetDialogFragment {
|
||||
|
||||
private BottomSheetSettingsGeneralBinding binding;
|
||||
private static int homeScreenSelectedChoice;
|
||||
private static int defaultLinkHandlerScreenSelectedChoice;
|
||||
|
||||
@Nullable @Override
|
||||
public View onCreateView(
|
||||
@NonNull LayoutInflater inflater,
|
||||
@Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
binding = BottomSheetSettingsGeneralBinding.inflate(inflater, container, false);
|
||||
|
||||
homeScreenSelectedChoice =
|
||||
Integer.parseInt(
|
||||
AppDatabaseSettings.getSettingsValue(
|
||||
requireContext(), AppDatabaseSettings.APP_HOME_SCREEN_KEY));
|
||||
defaultLinkHandlerScreenSelectedChoice =
|
||||
Integer.parseInt(
|
||||
AppDatabaseSettings.getSettingsValue(
|
||||
requireContext(), AppDatabaseSettings.APP_LINK_HANDLER_KEY));
|
||||
|
||||
setHomeScreenChipSelection(homeScreenSelectedChoice);
|
||||
setLinkHandlerChipSelection(defaultLinkHandlerScreenSelectedChoice);
|
||||
binding.switchTabs.setChecked(
|
||||
Boolean.parseBoolean(
|
||||
AppDatabaseSettings.getSettingsValue(
|
||||
requireContext(), AppDatabaseSettings.APP_CUSTOM_BROWSER_KEY)));
|
||||
binding.crashReportsSwitch.setChecked(
|
||||
Boolean.parseBoolean(
|
||||
AppDatabaseSettings.getSettingsValue(
|
||||
requireContext(), AppDatabaseSettings.APP_CRASH_REPORTS_KEY)));
|
||||
|
||||
binding.homeScreenChipGroup.setOnCheckedStateChangeListener(
|
||||
(group, checkedIds) -> {
|
||||
if (checkedIds.size() == 1) {
|
||||
int newSelection = getHomeScreenChipPosition(checkedIds.get(0));
|
||||
if (newSelection != homeScreenSelectedChoice) {
|
||||
homeScreenSelectedChoice = newSelection;
|
||||
AppDatabaseSettings.updateSettingsValue(
|
||||
requireContext(),
|
||||
String.valueOf(newSelection),
|
||||
AppDatabaseSettings.APP_HOME_SCREEN_KEY);
|
||||
SettingsFragment.refreshParent = true;
|
||||
SnackBar.success(
|
||||
requireContext(),
|
||||
requireActivity().findViewById(android.R.id.content),
|
||||
getString(R.string.settingsSave));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
binding.linkHandlerChipGroup.setOnCheckedStateChangeListener(
|
||||
(group, checkedIds) -> {
|
||||
if (checkedIds.size() == 1) {
|
||||
int newSelection = getLinkHandlerChipPosition(checkedIds.get(0));
|
||||
if (newSelection != defaultLinkHandlerScreenSelectedChoice) {
|
||||
defaultLinkHandlerScreenSelectedChoice = newSelection;
|
||||
AppDatabaseSettings.updateSettingsValue(
|
||||
requireContext(),
|
||||
String.valueOf(newSelection),
|
||||
AppDatabaseSettings.APP_LINK_HANDLER_KEY);
|
||||
SettingsFragment.refreshParent = true;
|
||||
SnackBar.success(
|
||||
requireContext(),
|
||||
requireActivity().findViewById(android.R.id.content),
|
||||
getString(R.string.settingsSave));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
binding.customTabsFrame.setOnClickListener(
|
||||
v -> binding.switchTabs.setChecked(!binding.switchTabs.isChecked()));
|
||||
binding.switchTabs.setOnCheckedChangeListener(
|
||||
(buttonView, isChecked) -> {
|
||||
AppDatabaseSettings.updateSettingsValue(
|
||||
requireContext(),
|
||||
String.valueOf(isChecked),
|
||||
AppDatabaseSettings.APP_CUSTOM_BROWSER_KEY);
|
||||
SnackBar.success(
|
||||
requireContext(),
|
||||
requireActivity().findViewById(android.R.id.content),
|
||||
getString(R.string.settingsSave));
|
||||
});
|
||||
|
||||
binding.enableSendReports.setOnClickListener(
|
||||
v ->
|
||||
binding.crashReportsSwitch.setChecked(
|
||||
!binding.crashReportsSwitch.isChecked()));
|
||||
binding.crashReportsSwitch.setOnCheckedChangeListener(
|
||||
(buttonView, isChecked) -> {
|
||||
AppDatabaseSettings.updateSettingsValue(
|
||||
requireContext(),
|
||||
String.valueOf(isChecked),
|
||||
AppDatabaseSettings.APP_CRASH_REPORTS_KEY);
|
||||
SnackBar.success(
|
||||
requireContext(),
|
||||
requireActivity().findViewById(android.R.id.content),
|
||||
getString(R.string.settingsSave));
|
||||
});
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
private void setHomeScreenChipSelection(int position) {
|
||||
switch (position) {
|
||||
case 0:
|
||||
binding.chipHomeScreen0.setChecked(true);
|
||||
break;
|
||||
case 1:
|
||||
binding.chipHomeScreen1.setChecked(true);
|
||||
break;
|
||||
case 2:
|
||||
binding.chipHomeScreen2.setChecked(true);
|
||||
break;
|
||||
case 3:
|
||||
binding.chipHomeScreen3.setChecked(true);
|
||||
break;
|
||||
case 4:
|
||||
binding.chipHomeScreen4.setChecked(true);
|
||||
break;
|
||||
case 5:
|
||||
binding.chipHomeScreen5.setChecked(true);
|
||||
break;
|
||||
case 6:
|
||||
binding.chipHomeScreen6.setChecked(true);
|
||||
break;
|
||||
case 7:
|
||||
binding.chipHomeScreen7.setChecked(true);
|
||||
break;
|
||||
case 8:
|
||||
binding.chipHomeScreen8.setChecked(true);
|
||||
break;
|
||||
case 9:
|
||||
binding.chipHomeScreen9.setChecked(true);
|
||||
break;
|
||||
case 10:
|
||||
binding.chipHomeScreen10.setChecked(true);
|
||||
break;
|
||||
case 11:
|
||||
binding.chipHomeScreen11.setChecked(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private int getHomeScreenChipPosition(int checkedId) {
|
||||
if (checkedId == R.id.chipHomeScreen0) return 0;
|
||||
if (checkedId == R.id.chipHomeScreen1) return 1;
|
||||
if (checkedId == R.id.chipHomeScreen2) return 2;
|
||||
if (checkedId == R.id.chipHomeScreen3) return 3;
|
||||
if (checkedId == R.id.chipHomeScreen4) return 4;
|
||||
if (checkedId == R.id.chipHomeScreen5) return 5;
|
||||
if (checkedId == R.id.chipHomeScreen6) return 6;
|
||||
if (checkedId == R.id.chipHomeScreen7) return 7;
|
||||
if (checkedId == R.id.chipHomeScreen8) return 8;
|
||||
if (checkedId == R.id.chipHomeScreen9) return 9;
|
||||
if (checkedId == R.id.chipHomeScreen10) return 10;
|
||||
if (checkedId == R.id.chipHomeScreen11) return 11;
|
||||
return homeScreenSelectedChoice;
|
||||
}
|
||||
|
||||
private void setLinkHandlerChipSelection(int position) {
|
||||
switch (position) {
|
||||
case 0:
|
||||
binding.chipLinkHandler0.setChecked(true);
|
||||
break;
|
||||
case 1:
|
||||
binding.chipLinkHandler1.setChecked(true);
|
||||
break;
|
||||
case 2:
|
||||
binding.chipLinkHandler2.setChecked(true);
|
||||
break;
|
||||
case 3:
|
||||
binding.chipLinkHandler3.setChecked(true);
|
||||
break;
|
||||
case 4:
|
||||
binding.chipLinkHandler4.setChecked(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private int getLinkHandlerChipPosition(int checkedId) {
|
||||
if (checkedId == R.id.chipLinkHandler0) return 0;
|
||||
if (checkedId == R.id.chipLinkHandler1) return 1;
|
||||
if (checkedId == R.id.chipLinkHandler2) return 2;
|
||||
if (checkedId == R.id.chipLinkHandler3) return 3;
|
||||
if (checkedId == R.id.chipLinkHandler4) return 4;
|
||||
return defaultLinkHandlerScreenSelectedChoice;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
binding = null;
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,6 @@ import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.activities.SettingsAppearanceActivity;
|
||||
import org.mian.gitnex.activities.SettingsGeneralActivity;
|
||||
import org.mian.gitnex.databinding.FragmentSettingsBinding;
|
||||
|
||||
/**
|
||||
@@ -39,7 +38,9 @@ public class SettingsFragment extends Fragment {
|
||||
fragmentSettingsBinding.notificationsFrame.setVisibility(View.VISIBLE);
|
||||
|
||||
fragmentSettingsBinding.generalFrame.setOnClickListener(
|
||||
generalFrameCall -> startActivity(new Intent(ctx, SettingsGeneralActivity.class)));
|
||||
v1 ->
|
||||
new BottomSheetSettingsGeneralFragment()
|
||||
.show(getChildFragmentManager(), "BottomSheetSettingsGeneral"));
|
||||
|
||||
fragmentSettingsBinding.appearanceFrame.setOnClickListener(
|
||||
v1 -> startActivity(new Intent(ctx, SettingsAppearanceActivity.class)));
|
||||
|
||||
@@ -1,166 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/primaryBackgroundColor"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appBarLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/primaryBackgroundColor">
|
||||
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
style="?attr/collapsingToolbarLayoutLargeStyle"
|
||||
android:layout_width="match_parent"
|
||||
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"
|
||||
android:background="?attr/primaryBackgroundColor"
|
||||
app:contentScrim="?attr/primaryBackgroundColor"
|
||||
android:layout_height="?attr/collapsingToolbarLayoutLargeSize">
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/topAppBar"
|
||||
android:layout_width="match_parent"
|
||||
android:elevation="0dp"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
app:title="@string/settingsGeneralHeader"
|
||||
app:layout_collapseMode="pin"
|
||||
app:navigationIcon="@drawable/ic_close" />
|
||||
|
||||
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/dimen16dp">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/setDefaultLinkHandler"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dimen8dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/generalDeepLinkDefaultScreen"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/dimen4dp"
|
||||
android:text="@string/generalDeepLinkDefaultScreen"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="@dimen/dimen18sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/generalDeepLinkDefaultScreenHintText"
|
||||
android:textColor="?attr/hintColor"
|
||||
android:textSize="@dimen/dimen12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/generalDeepLinkSelected"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/none"
|
||||
android:textColor="?attr/selectedTextColor"
|
||||
android:textSize="@dimen/dimen16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/homeScreenFrame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dimen32dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/homeScreenHeaderSelector"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/settingsHomeScreenHeaderText"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="@dimen/dimen18sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/homeScreenSelected"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/settingsHomeScreenSelectedText"
|
||||
android:textColor="?attr/selectedTextColor"
|
||||
android:textSize="@dimen/dimen16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/customTabsFrame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dimen32dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/customTabsHeader"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight=".90"
|
||||
android:text="@string/useCustomTabs"
|
||||
android:layout_marginTop="@dimen/dimen4dp"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="@dimen/dimen18sp" />
|
||||
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
android:id="@+id/switchTabs"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/useCustomTabs"
|
||||
android:layout_weight=".10" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/enableSendReports"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dimen32dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/enableReportsHeader"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight=".90"
|
||||
android:text="@string/settingsEnableReportsText"
|
||||
android:layout_marginTop="@dimen/dimen4dp"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="@dimen/dimen18sp" />
|
||||
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
android:id="@+id/crashReportsSwitch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/settingsEnableReportsText"
|
||||
android:layout_weight=".10" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
298
app/src/main/res/layout/bottom_sheet_settings_general.xml
Normal file
298
app/src/main/res/layout/bottom_sheet_settings_general.xml
Normal file
@@ -0,0 +1,298 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
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="wrap_content"
|
||||
android:background="?attr/primaryBackgroundColor"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="@dimen/dimen6dp"
|
||||
android:paddingBottom="@dimen/dimen12dp">
|
||||
|
||||
<View
|
||||
android:layout_width="@dimen/dimen32dp"
|
||||
android:layout_height="@dimen/dimen6dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginBottom="@dimen/dimen8dp"
|
||||
android:background="@drawable/bottom_sheet_handle"
|
||||
android:backgroundTint="?attr/primaryTextColor" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/headerFrame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/dimen8dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/bottomSheetHeader"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="@string/settingsGeneralHeader"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="@dimen/dimen18sp"/>
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
style="?attr/materialCardViewFilledStyle"
|
||||
android:layout_width="@dimen/dimen28dp"
|
||||
android:layout_height="@dimen/dimen4dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="@dimen/dimen8dp"
|
||||
android:layout_marginBottom="@dimen/dimen16dp"
|
||||
app:cardCornerRadius="@dimen/dimen24dp"
|
||||
app:cardElevation="@dimen/dimen0dp">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/fabColor" />
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linkHandlerFrame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dimen24dp"
|
||||
android:paddingStart="@dimen/dimen16dp"
|
||||
android:paddingEnd="@dimen/dimen16dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/linkHandlerHeaderSelector"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/generalDeepLinkDefaultScreen"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="@dimen/dimen16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dimen4dp"
|
||||
android:text="@string/generalDeepLinkDefaultScreenHintText"
|
||||
android:textColor="?attr/hintColor"
|
||||
android:textSize="@dimen/dimen12sp" />
|
||||
|
||||
<com.google.android.material.chip.ChipGroup
|
||||
android:id="@+id/linkHandlerChipGroup"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dimen8dp"
|
||||
app:singleSelection="true"
|
||||
app:selectionRequired="true">
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
android:id="@+id/chipLinkHandler0"
|
||||
style="@style/CustomChipFilter"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/none" />
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
android:id="@+id/chipLinkHandler1"
|
||||
style="@style/CustomChipFilter"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/navRepos" />
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
android:id="@+id/chipLinkHandler2"
|
||||
style="@style/CustomChipFilter"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/navOrg" />
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
android:id="@+id/chipLinkHandler3"
|
||||
style="@style/CustomChipFilter"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/pageTitleNotifications" />
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
android:id="@+id/chipLinkHandler4"
|
||||
style="@style/CustomChipFilter"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/pageTitleExplore" />
|
||||
|
||||
</com.google.android.material.chip.ChipGroup>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/homeScreenFrame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dimen24dp"
|
||||
android:paddingStart="@dimen/dimen16dp"
|
||||
android:paddingEnd="@dimen/dimen16dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/homeScreenHeaderSelector"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/settingsHomeScreenHeaderText"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="@dimen/dimen16sp" />
|
||||
|
||||
<com.google.android.material.chip.ChipGroup
|
||||
android:id="@+id/homeScreenChipGroup"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dimen8dp"
|
||||
app:singleSelection="true"
|
||||
app:selectionRequired="true">
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
android:id="@+id/chipHomeScreen0"
|
||||
style="@style/CustomChipFilter"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/home" />
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
android:id="@+id/chipHomeScreen1"
|
||||
style="@style/CustomChipFilter"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/navMyRepos" />
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
android:id="@+id/chipHomeScreen2"
|
||||
style="@style/CustomChipFilter"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/starredRepos" />
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
android:id="@+id/chipHomeScreen3"
|
||||
style="@style/CustomChipFilter"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/navOrg" />
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
android:id="@+id/chipHomeScreen4"
|
||||
style="@style/CustomChipFilter"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/navRepos" />
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
android:id="@+id/chipHomeScreen5"
|
||||
style="@style/CustomChipFilter"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/pageTitleExplore" />
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
android:id="@+id/chipHomeScreen6"
|
||||
style="@style/CustomChipFilter"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/pageTitleNotifications" />
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
android:id="@+id/chipHomeScreen7"
|
||||
style="@style/CustomChipFilter"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/navMyIssues" />
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
android:id="@+id/chipHomeScreen8"
|
||||
style="@style/CustomChipFilter"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/navMostVisited" />
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
android:id="@+id/chipHomeScreen9"
|
||||
style="@style/CustomChipFilter"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/navNotes" />
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
android:id="@+id/chipHomeScreen10"
|
||||
style="@style/CustomChipFilter"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/activities" />
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
android:id="@+id/chipHomeScreen11"
|
||||
style="@style/CustomChipFilter"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/navWatchedRepositories" />
|
||||
|
||||
</com.google.android.material.chip.ChipGroup>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/customTabsFrame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dimen24dp"
|
||||
android:paddingStart="@dimen/dimen16dp"
|
||||
android:paddingEnd="@dimen/dimen16dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/customTabsHeader"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.90"
|
||||
android:text="@string/useCustomTabs"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:layout_marginTop="@dimen/dimen4dp"
|
||||
android:textSize="@dimen/dimen16sp" />
|
||||
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
android:id="@+id/switchTabs"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/useCustomTabs"
|
||||
style="@style/m3SwitchStyle"
|
||||
android:layout_weight="0.10" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/enableSendReports"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dimen24dp"
|
||||
android:paddingStart="@dimen/dimen16dp"
|
||||
android:paddingEnd="@dimen/dimen16dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/enableReportsHeader"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.90"
|
||||
android:text="@string/settingsEnableReportsText"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:layout_marginTop="@dimen/dimen4dp"
|
||||
android:textSize="@dimen/dimen16sp" />
|
||||
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
android:id="@+id/crashReportsSwitch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/settingsEnableReportsText"
|
||||
style="@style/m3SwitchStyle"
|
||||
android:layout_weight="0.10" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
Reference in New Issue
Block a user