Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 35711e7c authored by Jonathan Klee's avatar Jonathan Klee
Browse files

Implement collapsing toolbar

parent 4f97fee5
Loading
Loading
Loading
Loading
+1 −6
Original line number Diff line number Diff line
@@ -181,18 +181,13 @@
        <activity
            android:name=".ui.MainSettingsActivity"
            android:theme="@style/PreferenceTheme"
            android:icon="@drawable/ic_notification"
            android:label="@string/app_name"
            android:process=":ui"
            android:roundIcon="@drawable/ic_notification"/>
            android:process=":ui"/>

        <activity-alias
            android:name=".ui.SettingsActivityLink"
            android:exported="true"
            android:icon="@drawable/ic_notification"
            android:label="@string/eos_settings_title"
            android:process=":ui"
            android:roundIcon="@drawable/ic_notification"
            android:targetActivity=".ui.MainSettingsActivity">
            <intent-filter>
                <action android:name="com.android.settings.action.EXTRA_SETTINGS" />
+4 −0
Original line number Diff line number Diff line
@@ -16,6 +16,10 @@ class MainSettingsActivity: AppCompatActivity() {
        mBinding = MainSettingsActivityBinding.inflate(layoutInflater)
        setContentView(mBinding.root)

        mBinding.toolbar.setNavigationOnClickListener {
            onBackPressed()
        }

        supportFragmentManager
            .beginTransaction()
            .replace(R.id.fragment_container, PreferencesFragment())
+6 −0
Original line number Diff line number Diff line
package io.heckel.ntfy.ui

import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem
import android.widget.Toolbar
import androidx.preference.PreferenceFragmentCompat
import androidx.preference.SwitchPreferenceCompat
import io.heckel.ntfy.R
import io.heckel.ntfy.service.SubscriberService
import io.heckel.ntfy.util.Log

class PreferencesFragment : PreferenceFragmentCompat() {

+42 −4
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:fitsSystemWindows="true"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.google.android.material.appbar.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fitsSystemWindows="true">

        <com.google.android.material.appbar.CollapsingToolbarLayout
            android:id="@+id/collapsing_toolbar"
            style="?attr/collapsingToolbarLayoutLargeStyle"
            android:background="@color/e_background"
            android:layout_width="match_parent"
            app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"
            android:layout_height="?attr/collapsingToolbarLayoutLargeSize">

            <com.google.android.material.appbar.MaterialToolbar
                app:navigationIcon="@drawable/e_ic_back"
                app:title="@string/eos_settings_title"
                android:id="@+id/toolbar"
                android:background="@color/e_background"
                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>

    <androidx.core.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fillViewport="true"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

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

    </androidx.core.widget.NestedScrollView>

</LinearLayout>
 No newline at end of file
+1 −0
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <SwitchPreferenceCompat
        app:icon="@drawable/ic_notification"
        app:key="isEnabled"
        app:defaultValue="false"
        app:title="@string/eos_settings_enable_title"