Forums - Allplay and Android Material Design

2 posts / 0 new
Last post
Allplay and Android Material Design
Pinball Wizard
Join Date: 14 Apr 15
Posts: 50
Posted: Sat, 2015-10-17 04:47

Trying to decipher the hopefully obsolete Android documentation that documents the process in the now obsoleted Eclipse ADT and trying to work out how to get things plumbed up in Android Studio and using Material Design (as this is now 2015, not Android 2.3 and 2008 anymore).

I have added the aar to my project, implemented the interfaces, but the problem comes when trying to add the allplay button to a layout.

Unless I am mistaken, you can't include the allplay layout anymore (not in the material design world).

am using the button directly (by finding the layout and using the code from there), so my layout looks like this:

<android.support.design.widget.CoordinatorLayout
   xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:app="http://schemas.android.com/apk/res-auto"
   xmlns:tools="http://schemas.android.com/tools"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   android:fitsSystemWindows="true"
   tools:context=".StreamDetailActivity"
   tools:ignore="MergeRootFrame">

   <android.support.design.widget.AppBarLayout
      android:id="@+id/app_bar"
      android:layout_width="match_parent"
      android:layout_height="@dimen/app_bar_height"
      android:fitsSystemWindows="true"
      android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
      android:paddingBottom="35sp">

      <android.support.design.widget.CollapsingToolbarLayout
         android:id="@+id/toolbar_layout"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:fitsSystemWindows="true"
         app:contentScrim="?attr/colorPrimary"
         app:layout_scrollFlags="scroll|exitUntilCollapsed"
         app:toolbarId="@+id/toolbar">

         <android.support.v7.widget.Toolbar
            android:id="@+id/detail_toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            app:layout_collapseMode="pin"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>


      </android.support.design.widget.CollapsingToolbarLayout>

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

   <android.support.v4.widget.NestedScrollView
      android:id="@+id/stream_detail_container"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      app:layout_behavior="@string/appbar_scrolling_view_behavior"
      android:paddingTop="30sp"/>

   <android.support.design.widget.FloatingActionButton
      android:id="@+id/fab"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_gravity="center_vertical|start"
      android:layout_margin="@dimen/fab_margin"
      android:src="@android:drawable/ic_media_play"
      app:layout_anchor="@+id/stream_detail_container"
      app:layout_anchorGravity="top|end"/>

   <com.qualcomm.qce.allplay.clicksdk.AllPlayWhiteActionBarButtonView
      android:id="@+id/fab_allplay"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_gravity="center_vertical|start"
      android:layout_margin="@dimen/fab_margin"
      android:src="@drawable/btn_allplay_normal_white"
      app:layout_anchor="@+id/stream_detail_container"
      app:layout_anchorGravity="top"/>


</android.support.design.widget.CoordinatorLayout>

 

and the exception that I get is:

 

java.lang.ClassCastException: android.graphics.drawable.RippleDrawable cannot be cast to android.graphics.drawable.AnimationDrawable
    at com.qualcomm.qce.allplay.clicksdk.AllPlayButtonView$3.run(AllPlayButtonView.java:119)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5417)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
 
  • Up0
  • Down0
Pinball Wizard
Join Date: 14 Apr 15
Posts: 50
Posted: Mon, 2015-10-19 09:35

Fixed the problem in the end, with a workaround.  Used a Floating Actionbar Button that called a hidden allplay button.


You can see my Material Design AllPlay app here:

https://play.google.com/store/apps/details?id=uk.droidsoft.com.allplayst...

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.