Git Product home page Git Product logo

androidforegroundcompat's Introduction

AndroidForegroundCompat

Backported view foreground support for Android 5.0+.

This is not an officially supported Google product.

Why AndroidForegroundCompat?

android:foreground was only available on FrameLayout until API level 23 (Android 6.0), but sometimes having foreground support on any view can be really handy, for reducing nesting in view hierarchy or better readability.

This library takes the foreground implementation from FrameLayout and allows using it on other views. When running on API level 23 or above, framework foreground support will automatically be used instead.

Integration

Gradle:

implementation 'me.zhanghai.android.foregroundcompat:library:1.0.2'

Usage

Just use one of the supported views. The ForegroundCompat class can also be used to access foreground related methods in a backward compatible fashion.

License

Copyright 2019 Google LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

androidforegroundcompat's People

Contributors

zhanghai 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

Watchers

 avatar  avatar  avatar

androidforegroundcompat's Issues

Security Policy violation Binary Artifacts

This issue was automatically created by Allstar.

Security Policy Violation
Project is out of compliance with Binary Artifacts policy: binaries present in source code

Rule Description
Binary Artifacts are an increased security risk in your repository. Binary artifacts cannot be reviewed, allowing the introduction of possibly obsolete or maliciously subverted executables. For more information see the Security Scorecards Documentation for Binary Artifacts.

Remediation Steps
To remediate, remove the generated executable artifacts from the repository.

Artifacts Found

  • gradle/wrapper/gradle-wrapper.jar

Additional Information
This policy is drawn from Security Scorecards, which is a tool that scores a project's adherence to security best practices. You may wish to run a Scorecards scan directly on this repository for more details.


Allstar has been installed on all Google managed GitHub orgs. Policies are gradually being rolled out and enforced by the GOSST and OSPO teams. Learn more at http://go/allstar

This issue will auto resolve when the policy is in compliance.

Issue created by Allstar. See https://github.com/ossf/allstar/ for more information. For questions specific to the repository, please contact the owner or maintainer.

Canvas: trying to use a recycled bitmap android.graphics.Bitmap@734eead

Expected Behavior

No Exceptions thrown

Actual Behavior

Fatal Exception: java.lang.RuntimeException
Canvas: trying to use a recycled bitmap android.graphics.Bitmap@734eead
android.graphics.BaseCanvas.throwIfCannotDraw (BaseCanvas.java:55)
android.view.View.draw (View.java:20373)
me.zhanghai.android.foregroundcompat.ForegroundImageView.draw (ForegroundImageView.java:66)
android.view.View.updateDisplayListIfDirty (View.java:19318)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1374)

Steps to Reproduce the Problem

Background
I am using RecyclerView to show a photos/videos list, so, I am using ForegroudImageView to show an item whether or not it's a photo or video, I got some crashes from firebase Crashlytics just like above Actual Behavior shown
in my adapter, I also do the following and don't know if it caused this issue
override fun onViewRecycled(holder: BaseViewHolder) {
super.onViewRecycled(holder)
Timber.d("onViewRecycled")

    holder.view.blurView?.clearBackground()

    holder.view.imageViewAuthor?.GlideClear()
    ((holder.view.media0?.tag) as? ImageView)?.GlideClear()
    ((holder.view.media1?.tag) as? ImageView)?.GlideClear()
    ((holder.view.media2?.tag) as? ImageView)?.GlideClear()
    ((holder.view.media3?.tag) as? ImageView)?.GlideClear()
    ((holder.view.media4?.tag) as? ImageView)?.GlideClear()
}

fun ImageView.GlideClear() {
GlideApp.with(context).clear(this)
}
1.
1.
1.

Specifications

  • Version:1.0.0
  • Platform:
    Android 8.0.0
    Galaxy A5(2017)

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.