scrollable toolbar implementation for auto upload

This commit is contained in:
AndyScherzinger 2017-07-15 14:02:30 +02:00
parent 160feb9711
commit 3730883136
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B
2 changed files with 64 additions and 30 deletions

View file

@ -27,6 +27,7 @@ import android.content.pm.PackageManager;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.design.widget.BottomNavigationView; import android.support.design.widget.BottomNavigationView;
import android.support.design.widget.CollapsingToolbarLayout;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction; import android.support.v4.app.FragmentTransaction;
import android.support.v4.widget.DrawerLayout; import android.support.v4.widget.DrawerLayout;
@ -111,6 +112,8 @@ public class SyncedFoldersActivity extends FileActivity implements SyncedFolderA
// setup toolbar // setup toolbar
setupToolbar(); setupToolbar();
((CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar)).setTitle(this.getString(R.string.drawer_synced_folders));
findViewById(R.id.app_bar).setBackgroundColor(this.getResources().getColor(R.color.listItemHighlighted));
// setup drawer // setup drawer
setupDrawer(R.id.nav_synced_folders); setupDrawer(R.id.nav_synced_folders);

View file

@ -2,8 +2,8 @@
<!-- <!--
Nextcloud Android client application Nextcloud Android client application
Copyright (C) 2016 Andy Scherzinger Copyright (C) 2017 Andy Scherzinger
Copyright (C) 2016 Nextcloud. Copyright (C) 2017 Nextcloud.
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
@ -18,43 +18,74 @@
You should have received a copy of the GNU Affero General Public You should have received a copy of the GNU Affero General Public
License along with this program. If not, see <http://www.gnu.org/licenses/>. License along with this program. If not, see <http://www.gnu.org/licenses/>.
--> -->
<android.support.v4.widget.DrawerLayout android:id="@+id/drawer_layout" <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:clickable="true" android:fitsSystemWindows="true"
android:fitsSystemWindows="true"> tools:openDrawer="start">
<!-- The main content view --> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" xmlns:tools="http://schemas.android.com/tools"
android:layout_height="match_parent" android:layout_width="match_parent"
android:orientation="vertical"> android:layout_height="match_parent">
<include <android.support.design.widget.AppBarLayout
layout="@layout/toolbar_standard"/> android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView <android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/add_custom_folder" android:id="@+id/collapsing_toolbar"
android:layout_below="@+id/appbar" android:layout_width="match_parent"
android:layout_width="wrap_content" android:layout_height="110dp"
android:layout_height="wrap_content" app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"
android:layout_centerHorizontal="true" app:titleEnabled="false">
android:drawableLeft="@drawable/ic_folder_star_18dp"
android:drawableStart="@drawable/ic_folder_star_18dp" <RelativeLayout
android:onClick="onAddCustomFolderClick" android:layout_width="match_parent"
android:paddingBottom="@dimen/alternate_half_padding" android:layout_height="wrap_content"
android:paddingTop="@dimen/alternate_half_padding" android:layout_gravity="center_horizontal|bottom"
android:text="@string/autoupload_custom_folder"/> android:gravity="center"
android:onClick="onAddCustomFolderClick"
android:padding="@dimen/standard_padding"
app:layout_collapseMode="pin">
<ImageView
android:id="@+id/custom_folder_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_folder_star_18dp"/>
<TextView
android:id="@+id/add_custom_folder"
android:layout_toRightOf="@id/custom_folder_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/alternate_half_padding"
android:text="@string/autoupload_custom_folder"/>
</RelativeLayout>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_collapseMode="pin"/>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<FrameLayout <FrameLayout
android:id="@+id/ListLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_below="@+id/add_custom_folder"
android:layout_above="@+id/bottom_navigation_view" android:layout_above="@+id/bottom_navigation_view"
android:id="@+id/ListLayout" android:orientation="vertical"
android:orientation="vertical"> app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout <LinearLayout
android:id="@android:id/progress" android:id="@android:id/progress"
@ -114,11 +145,11 @@
app:itemTextColor="@color/primary_button_text_color" app:itemTextColor="@color/primary_button_text_color"
app:menu="@menu/navigation_bar_menu"/> app:menu="@menu/navigation_bar_menu"/>
</RelativeLayout> </android.support.design.widget.CoordinatorLayout>
<include <include
layout="@layout/drawer" layout="@layout/drawer"
android:layout_width="240dp" android:layout_width="@dimen/drawer_width"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="start"/> android:layout_gravity="start"/>