Git Product home page Git Product logo

collapsingtoolbarlayout-subtitle's Introduction

Travis CI Codecov Maven Central Plugin Portal

Any nitwit can understand computers. Many do.

โ€” Ted Nelson (1974)

collapsingtoolbarlayout-subtitle's People

Contributors

hendraanggrian avatar timusus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

collapsingtoolbarlayout-subtitle's Issues

Propose app logo

Hello, Im flat raphic designer. I want to propose a logo for branding your project. Can I make a logo for you?

collapse Toolbar programmatically

Hi,

it would be great if you could provide a function to collapse the toolbar programmatically.
Or is a workaround with the existing functions possible?

Cheers.

Issues with Navigation Drawer

Using this library, my toolbar will hide the navigation drawer hamburger icon when the toolbar is collapsed. Unsure of what could be causing this.

expandedTitleGravity="center_horizontal" not working.

xml:

` <android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:theme="@style/AppTheme.AppBarOverlay">

    <android.support.design.widget.SubtitleCollapsingToolbarLayout
        android:id="@+id/toolbar_layout"
        android:layout_width="match_parent"
        android:minHeight="@dimen/contact_profile_toolbar_min_height"
        app:contentScrim="?colorPrimary"
        app:expandedTitleMarginTop="@dimen/contact_profile_toolbar_lyt_ext_title_margin_top"
        app:layout_scrollFlags="scroll|exitUntilCollapsed"
        app:expandedTitleMargin="@dimen/contact_profile_toolbar_lyt_ext_title_margin"
        android:layout_height="@dimen/contact_profile_toolbar_lyt_height"
        app:subtitle="CollapsingToolbarLayout"
        app:title="Subtitle"
        android:fitsSystemWindows="true"
        app:expandedTitleGravity="center_horizontal">

        <View
            android:id="@+id/background"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_collapseMode="parallax"
            android:scaleType="centerCrop"
            android:background="@color/colorPrimary" />

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            app:layout_collapseMode="pin"
            app:popupTheme="@style/AppTheme.PopupOverlay">

            <Space
                android:id="@+id/circle_collapsed_target"
                android:layout_width="@dimen/contact_profile_circle_collapsed"
                android:layout_height="@dimen/contact_profile_circle_collapsed"/>

        </android.support.v7.widget.Toolbar>

    <!--</android.support.design.widget.CollapsingToolbarLayout>-->
    </android.support.design.widget.SubtitleCollapsingToolbarLayout>

</android.support.design.widget.AppBarLayout> `

expandedSubtitleTextAppearance bug with shadows

Hi,

Adding shadows around the subtitle when it is expanded using:
app:expandedSubtitleTextAppearance="@style/CollapsingToolbarShadow"

with the simple following style doesn't work:

<style name="CollapsingToolbarShadow">
      <item name="android:shadowDy">0</item>
      <item name="android:shadowDx">0</item>
      <item name="android:shadowRadius">8</item>
      <item name="android:shadowColor">@color/black</item>
</style>

The shadows are not visible on the subtitle, but the same style works with the title.

No collapsedTitleMargin

Hi. Thanks for this awesome library.
There is just one thing I need which is lacking and that is although it has expandedTitleMargin but there is no collapsedTitleMargin only gravity. I am using a rtl language and I want to show a profile picture on the right of the toolbar and I want the title and subtitle to have Right margin so they don't go behind the picture. I tried setting the toolbar titleMarginStart but it's not working correctly. Can you address this please?

cannot find symbol method makeRestartActivityTask(ComponentName)

Hi all:
after compile collapsingtoolbarlayout-subtitle, can't build project for this error:
Error:(155, 53) error: cannot find symbol method makeRestartActivityTask(ComponentName)
IntentCompat.makeRestartActivityTask(cn) : cn is :ComponentName cn = intent.getComponent();

Is there any conflict reason?

Title and subtitle display issue.

Hello , I just integrated your library and it works perfect, except of one issue. The title and subtitle are not getting left padding as required, they just stick to start of screen which looks just ugly. Can you tell me what am I missing here?

ellipsize Subtitle

Hi,
is it somehow possible to ellipsize the subtitle?
I've already tried it using TextAppearance, but it's not working. So i assume you are not using TextView...

Don't show subtitle when text is null/empty

Currently, if the subtitle text is empty/null, it shows up as "testing".

It would be great if the subtitle was hidden, and this just acted like a regular CollapsingToolbarLayout when the subtitle text is empty/null.

Support for androidx 1.0.0

There are a lot of changes in upcoming revision of support library. The major change is that now coordinatorlayout is a separate module and a lot of internals are now changed.

Title not sits bottom when not set SubTitle.

Hello there,

I am setting up sub title only when there will be long string for title, but I when there is no sub title title remain in Vertically center instead of sit in bottom.

Library no longer available in Java

I would recommend that the Kotlin version of this library be hosted under a separate branch - although I love Kotlin, it's a pretty heavy duty dependency if a Java only Android app wants to use the library.

Obviously this comes with extra maintenance overhead..

Toolbar menu icons issue

Hello.
First of all - thanks for great library!
Today, after upgrade this lib to new version I noticed a issue with toolbar icons.
These icons are not vertically centered in toolbar.
Heres example how it looks in my app:
https://www.dropbox.com/s/obqtbmfxh1bd3rr/toolbar_issue.PNG?dl=0
https://www.dropbox.com/s/8ujbzprix420t1q/toolbar_issue2.PNG?dl=0

When I use native CollapsingToolbarLayout everything is ok.

You can simply reproduce this bug in Your sample app. Just add this line to "onCreateOptionsMenu" method:
toolbar.menu.add(R.id.item_article_bookmark)

And now you can see:
https://www.dropbox.com/s/d0nqc5vu8p741i6/toolbar_issue3.PNG?dl=0

Getting Class not found exception

Landroid/support/v4/math/MathUtils

java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/math/MathUtils;
at android.support.design.widget.SubtitleCollapsingToolbarLayout$OffsetUpdateListener.onOffsetChanged(SubtitleCollapsingToolbarLayout.kt:672)
at android.support.design.widget.AppBarLayout.dispatchOffsetUpdates(AppBarLayout.java:468)
at android.support.design.widget.AppBarLayout$Behavior.setHeaderTopBottomOffset(AppBarLayout.java:1160)
at android.support.design.widget.AppBarLayout$Behavior.setHeaderTopBottomOffset(AppBarLayout.java:766)
at android.support.design.widget.HeaderBehavior.setHeaderTopBottomOffset(HeaderBehavior.java:194)
at android.support.design.widget.AppBarLayout$Behavior.onLayoutChild(AppBarLayout.java:1059)
at android.support.design.widget.AppBarLayout$Behavior.onLayoutChild(AppBarLayout.java:766)
at android.support.design.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java:870)
at android.view.View.layout(View.java:16024)
at android.view.ViewGroup.layout(ViewGroup.java:5243)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1195)
at android.view.View.layout(View.java:16024)
at android.view.ViewGroup.layout(ViewGroup.java:5243)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:639)
at android.widget.FrameLayout.onLayout(FrameLayout.java:574)
at android.view.View.layout(View.java:16024)
at android.view.ViewGroup.layout(ViewGroup.java:5243)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1195)
at android.view.View.layout(View.java:16024)
at android.view.ViewGroup.layout(ViewGroup.java:5243)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1195)
at android.view.View.layout(View.java:16024)
at android.view.ViewGroup.layout(ViewGroup.java:5243)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1195)
at android.view.View.layout(View.java:16024)
at android.view.ViewGroup.layout(ViewGroup.java:5243)
at android.support.design.widget.CoordinatorLayout.layoutChild(CoordinatorLayout.java:1167)
at android.support.design.widget.CoordinatorLayout.onLayoutChild(CoordinatorLayout.java:852)
at android.support.design.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java:871)
at android.view.View.layout(View.java:16024)
at android.view.ViewGroup.layout(ViewGroup.java:5243)
at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:1193)
at android.view.View.layout(View.java:16024)
at android.view.ViewGroup.layout(ViewGroup.java:5243)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:639)
at android.widget.FrameLayout.onLayout(FrameLayout.java:574)
at android.view.View.layout(View.java:16024)
at android.view.ViewGroup.layout(ViewGroup.java:5243)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1959)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1813)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1722)
at android.view.View.layout(View.java:16024)
at android.view.ViewGroup.layout(ViewGroup.java:5243)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:639)
at android.widget.FrameLayout.onLayout(FrameLayout.java:574)
at android.view.View.layout(View.java:16024)
at android.view.ViewGroup.layout(ViewGroup.java:5243)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1959)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1813)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1722)
at android.view.View.layout(View.java:16024)
at android.view.ViewGroup.layout(ViewGroup.java:5243)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:639)
at android.widget.FrameLayout.onLayout(FrameLayout.java:574)
at android.view.View.layout(View.java:16024)
at android.view.ViewGroup.layout(ViewGroup.java:5243)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2555)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2245)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1342)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6829)

Sometimes subtitle is not showed in collapsed state in toolbar

Hi,
Thanks for awesome library.

Here is my code.

<com.google.android.material.appbar.AppBarLayout
        android:id="@+id/app_bar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fitsSystemWindows="true"
        android:theme="@style/AppTheme">

        <com.google.android.material.appbar.SubtitleCollapsingToolbarLayout
            android:id="@+id/collapsingToolbar"
            android:layout_width="match_parent"
            android:layout_height="256dp"
            android:animateLayoutChanges="true"
            app:layout_scrollFlags="scroll|exitUntilCollapsed"
            app:contentScrim="?attr/colorPrimary"
            android:fitsSystemWindows="true"
            android:textColor="@color/whiteColor"
            app:expandedSubtitleTextAppearance="@style/TextAppearance.Design.SubtitleCollapsingToolbar.ExpandedSubtitle.Inverse"
            app:expandedTitleTextAppearance="@style/TextAppearance.Design.SubtitleCollapsingToolbar.ExpandedTitle.Inverse"
            >

            <ImageView
                android:id="@+id/image"
                app:layout_collapseMode="parallax"
                android:fitsSystemWindows="true"
                android:src="@drawable/my_image"
                android:contentDescription="@string/app_name"
                android:scaleType="centerCrop"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />

            <androidx.appcompat.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                app:layout_collapseMode="pin"
                app:popupTheme="@style/Theme.MaterialComponents.Light" />

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

When I scroll down, sometimes I see only title in toolbar, but sometimes I see title and subtitle in toolbar in collapsed mode.

Do you know what is wrong in code or this is known bug in library ?

Thanks.

Migrate to mavenCentral

Hello! Are there any plans to migrate from deprecated jcenter() to mavenCentral() ? Thanks!

Set subtitle programmatically

How can I change subtitle programmatically?
I tried
getSupportActionBar().setSubtitle("text");
but it did not work

Multiline title

Hello,

I really love this library but a multilines title feature would make it perfect.

The title length is very limited on small devices, with the default text size it can only be 11 characters long on a 3.7" Nexus One, so the rest of the String is replaced by "..." for both collapsed and regular mode. I'd like a multilines mode for regular mode, that goes back to single line for collapsed mode.

There are libs for multilines collapsing toolbar titles (https://github.com/opacapp/multiline-collapsingtoolbar) but can't use both at the same time, there is not much change made to the vanilla CollapsingToolbarLayout, but I guess it would change the way your animations work.

Do you have a solution for this? Thanks!

Ability to adjust spacing between title and subtitle in expanded mode

Hi, is it possible to adjust spacing between title and subitle labels in expanded mode? I need a bit more squeezed view (because my appbar is much smaller than your example shows), but I can't find any way to adjust spacing.

Can you add attribute to do that (if it's not there yet)

Legacy artifact not resolved

implementation "com.android.support:design:$version"
implementation "com.hendraanggrian:collapsingtoolbarlayout-subtitle:$version"

is not worked, please fix it.
And by your code, i should use version of subtitle-library equals support-design?

Error inflating class com.google.android.material.appbar.SubtitleCollapsingToolbarLayout

implementation "com.google.android.material:material:1.5.0"
implementation "com.hendraanggrian.material:collapsingtoolbarlayout-subtitle:1.3.0-SNAPSHOT"
java.lang.RuntimeException: Unable to start activity ComponentInfo{care.viva.app/care.viva.app.profissional.views.ReciboActivity}: android.view.InflateException: Binary XML file line #17: Binary XML file line #17: Error inflating class com.google.android.material.appbar.SubtitleCollapsingToolbarLayout
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
        at android.app.ActivityThread.-wrap11(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:169)
        at android.app.ActivityThread.main(ActivityThread.java:6521)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
     Caused by: android.view.InflateException: Binary XML file line #17: Binary XML file line #17: Error inflating class com.google.android.material.appbar.SubtitleCollapsingToolbarLayout
     Caused by: android.view.InflateException: Binary XML file line #17: Error inflating class com.google.android.material.appbar.SubtitleCollapsingToolbarLayout
     Caused by: java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Constructor.newInstance0(Native Method)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
        at android.view.LayoutInflater.createView(LayoutInflater.java:647)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
        at care.viva.app.databinding.ActivityReciboBinding.inflate(ActivityReciboBinding.java:184)
        at care.viva.app.databinding.ActivityReciboBinding.inflate(ActivityReciboBinding.java:178)
        at care.viva.app.profissional.views.ReciboActivity.onCreate(ReciboActivity.kt:39)
        at android.app.Activity.performCreate(Activity.java:7051)
        at android.app.Activity.performCreate(Activity.java:7042)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1215)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
        at android.app.ActivityThread.-wrap11(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:169)
        at android.app.ActivityThread.main(ActivityThread.java:6521)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
     Caused by: java.lang.IllegalAccessError: Field 'com.google.android.material.resources.TextAppearance.textColor' is inaccessible to class 'com.google.android.material.internal.SubtitleCollapsingTextHelper' (declaration of 'com.google.android.material.internal.SubtitleCollapsingTextHelper' appears in /data/app/care.viva.app-LvNQ-soKPeFPmhHXCBr0Fw==/base.apk!classes18.dex)
        at com.google.android.material.internal.SubtitleCollapsingTextHelper.setExpandedTitleTextAppearance(SubtitleCollapsingTextHelper.java:356)
        at com.google.android.material.appbar.SubtitleCollapsingToolbarLayout.<init>(SubtitleCollapsingToolbarLayout.java:132)
2022-02-22 10:38:21.594 10181-10181/care.viva.app E/AndroidRuntime:     at com.google.android.material.appbar.SubtitleCollapsingToolbarLayout.<init>(SubtitleCollapsingToolbarLayout.java:84)

Change SubTitle text Color progrmmatically

We can change the setExpandedTitleColor & setCollapsedTitleColor but this is not affecting to subTile.

I've applied text color in style and applied that style like this :

app:expandedSubtitleTextAppearance="@style/TextAppearance.AppCompat.Body1.Color"

This worked fine, but I want to change its color dynamically like we do for tile as :

setExpandedTitleColor(textSwatch.getTitleTextColor());

Is there any way that I can do this programmatically?

Android 0

because of #12 I revert to using lib 0.7.0 but here it can't be used with supportLib 26.1.0

java.lang.NoSuchMethodError: No static method objectEquals(Ljava/lang/Object;Ljava/lang/Object;)Z in class Landroid/support/design/widget/ViewUtils; or its super classes (declaration of 'android.support.design.widget.ViewUtils' appears in /data/app/de.xxx-CwA8318Qch206prKNiDGEQ==/base.apk:classes2.dex)
at android.support.design.widget.SubtitleCollapsingToolbarLayout.onWindowInsetChanged(SubtitleCollapsingToolbarLayout.java:202)
at android.support.design.widget.SubtitleCollapsingToolbarLayout$1.onApplyWindowInsets(SubtitleCollapsingToolbarLayout.java:169)
at android.support.v4.view.ViewCompat$ViewCompatApi21Impl$1.onApplyWindowInsets(ViewCompat.java:1256)

Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.design.widget.ThemeUtils" on path: DexPathList

Seems like its time again to update this to the newest support version, but I think you said elsewhere that you are waiting for support v28 to become stable? Anyway I get this error while trying to use v28, "Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.design.widget.ThemeUtils" on path: DexPathList"

Thanks for the great library! Note: Excluding the support library did not help either.

For the time being, I basically just created a local version of the library and disabled the line for ThemeUtils and changed the other lines that I needed to in order to compile.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.