Skip to content

Commit

Permalink
Added collapsed toolbar in settings activity for all fragments
Browse files Browse the repository at this point in the history
  • Loading branch information
WSTxda committed Mar 4, 2024
1 parent da0c3cf commit 76a4f77
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 83 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import android.view.ViewGroup;

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;

Expand All @@ -19,16 +20,16 @@ public abstract class AbstractSettingsActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.settings_activity);
setSupportActionBar((Toolbar) findViewById(R.id.toolbar));

// Temporary toolbar fix
if (showHomeAsUp && getSupportActionBar() != null) {
if (showHomeAsUp) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}

switchBar = findViewById(R.id.switch_bar);
switchBar = (SwitchBar) findViewById(R.id.switch_bar);

customBarContainer = findViewById(R.id.custom_bar);
if (customBarLayout != 0 && customBarContainer != null) {
customBarContainer = (ViewGroup) findViewById(R.id.custom_bar);
if (customBarLayout != 0) {
customBarContainer.addView(getLayoutInflater().inflate(customBarLayout, customBarContainer, false));
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?><!--
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2013-2017 microG Project Team
~
~ Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -13,52 +14,17 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"

<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical">
android:layout_height="wrap_content">

<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
<LinearLayout
android:id="@+id/self_check_root"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">

<com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
style="?attr/collapsingToolbarLayoutLargeStyle"
android:layout_width="match_parent"
android:layout_height="?attr/collapsingToolbarLayoutLargeSize"
app:expandedTitleMarginEnd="@dimen/expanded_title_margin_end"
app:expandedTitleMarginStart="@dimen/expanded_title_margin_start"
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"
app:scrimVisibleHeightTrigger="@dimen/scrim_visible_height_trigger">

<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:title="@string/self_check_title"
app:navigationIcon="@drawable/ic_arrow_back" />

</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:id="@+id/self_check_root"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
android:orientation="vertical">

</LinearLayout>
</ScrollView>
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,68 @@
~ limitations under the License.
-->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.coordinatorlayout.widget.CoordinatorLayout 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:fitsSystemWindows="true"
android:orientation="vertical">

<org.microg.tools.ui.SwitchBar
android:id="@+id/switch_bar"
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/switchbar_background_color"
android:visibility="gone" />
android:layout_height="wrap_content"
android:fitsSystemWindows="true">

<FrameLayout
android:id="@+id/custom_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
style="?attr/collapsingToolbarLayoutLargeStyle"
android:layout_width="match_parent"
android:layout_height="?attr/collapsingToolbarLayoutLargeSize"
android:paddingEnd="8dp"
app:expandedTitleMarginBottom="@dimen/expanded_title_margin_bottom"
app:expandedTitleMarginEnd="@dimen/expanded_title_margin_end"
app:expandedTitleMarginStart="@dimen/expanded_title_margin_start"
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"
app:scrimVisibleHeightTrigger="@dimen/scrim_visible_height_trigger">

<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin" />

</com.google.android.material.appbar.CollapsingToolbarLayout>

</com.google.android.material.appbar.AppBarLayout>

<FrameLayout
android:id="@+id/content_wrapper"
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
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">

<org.microg.tools.ui.SwitchBar
android:id="@+id/switch_bar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/switchbar_background_color"
android:visibility="gone" />

<FrameLayout
android:id="@+id/custom_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

<FrameLayout
android:id="@+id/content_wrapper"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />

</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public class SelfCheckFragment extends AbstractSelfCheckFragment {
@Override
protected void prepareSelfCheckList(List<SelfCheckGroup> checks) {
// checks.add(new RomSpoofSignatureChecks());
checks.add(new SystemChecks());
checks.add(new InstalledPackagesChecks());
// if (SDK_INT >= 23) {
// List<String> permissions = new ArrayList<>();
//// permissions.add(ACCESS_COARSE_LOCATION);
Expand Down Expand Up @@ -96,21 +96,22 @@ protected void prepareSelfCheckList(List<SelfCheckGroup> checks) {
// }
// });
// }
checks.add(new InstalledPackagesChecks());
// checks.add(new NlpOsCompatChecks());
if (SDK_INT >= Build.VERSION_CODES.M) {
checks.add(new SystemChecks());
}
// checks.add(new NlpOsCompatChecks());
// checks.add(new NlpStatusChecks());
}

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
reset(LayoutInflater.from(getContext()));
}

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
reset(LayoutInflater.from(getContext()));
super.onActivityResult(requestCode, resultCode, data);
}

public static class AsActivity extends AbstractSettingsActivity {
Expand All @@ -123,4 +124,4 @@ protected Fragment getFragment() {
return new SelfCheckFragment();
}
}
}
}

0 comments on commit 76a4f77

Please sign in to comment.