Giter VIP home page Giter VIP logo

whatsnew's Introduction

Hi there ๐Ÿ‘‹

  • ๐Ÿ”ญ I'm an Android developer
  • ๐ŸŒฑ I'm currently learning Jetpack Compose and Rust
  • ๐Ÿ’ฌ Ask me about Android development
  • ๐Ÿ“ซ How to reach me: Twitter or Telegram
  • ๐Ÿ˜„ Pronouns: he/him

Mozart, Beethoven, and Chopin never died. They simply became their music.

Anurag's github stats

whatsnew's People

Contributors

finalpets avatar michaelbukachi avatar pserwylo avatar thomhurst avatar tonnyl 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

whatsnew's Issues

feat: Background Color

It would be nice if we could be able to set a background color for the WhatsNew view. I'll probably open a pull request for this over the weekend. :)

How to show the dialog for more than one time?

I was implementing this library and first of all thank you for making my work a bit less with WhatsNew
I am creating the instance for creating the dialog when a user clicks a card and with what I've encountered till now it seems like I am only able to create the dialog once, calling it the second time does nothing. Any solutions for this, I want the change to persist the whole time.

Build error

I'm constantly getting this error while trying to build with the latest version of WhatsNew:

`Execution failed for task ':app:checkDebugAarMetadata'.

Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not find null:unspecified:null.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/null/unspecified/null/unspecified-null.pom
- https://jcenter.bintray.com/null/unspecified/null/unspecified-null.pom
- https://jitpack.io/null/unspecified/null/unspecified-null.pom
- https://oss.sonatype.org/content/repositories/snapshots/null/unspecified/null/unspecified-null.pom
Required by:
project :app > io.github.tonnyl:whatsnew:0.1.3`

Resources$NotFoundException on pre-lollipop devices

I got the following crash when trying to run on pre-lollilop devices:

Fatal Exception: android.content.res.Resources$NotFoundException: File res/drawable/ic_calendar_range.xml from drawable resource ID #0x7f080086. If the resource you are trying to use is a vector resource, you may be referencing it in an unsupported way. See AppCompatDelegate.setCompatVectorFromResourcesEnabled() for more info.
       at android.content.res.Resources.loadDrawable(Resources.java:2974)
       at android.content.res.Resources.getDrawable(Resources.java:1558)
       at androidx.core.content.ContextCompat.getDrawable(ContextCompat.java:465)
       at io.github.tonnyl.whatsnew.adapter.ItemsAdapter.onBindViewHolder(ItemsAdapter.kt:26)
       at androidx.recyclerview.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:6781)
       at androidx.recyclerview.widget.RecyclerView$Adapter.onCreateViewHolder(RecyclerView.java:6823)
       at androidx.recyclerview.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:5752)
       at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6019)
       at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5858)
       at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5854)
       at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2230)
       at androidx.recyclerview.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1557)
       at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1517)
       at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:612)
       at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3924)
       at androidx.recyclerview.widget.RecyclerView.onMeasure(RecyclerView.java:3336)
       at android.view.View.measure(View.java:16831)
       at android.widget.RelativeLayout.measureChild(RelativeLayout.java:698)
       at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:494)
       at android.view.View.measure(View.java:16831)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5245)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
       at android.view.View.measure(View.java:16831)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5245)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
       at android.view.View.measure(View.java:16831)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5245)
       at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1410)
       at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
       at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
       at android.view.View.measure(View.java:16831)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5245)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
       at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2586)
       at android.view.View.measure(View.java:16831)
       at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2189)
       at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1352)
       at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1535)
       at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1249)
       at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6364)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:791)
       at android.view.Choreographer.doCallbacks(Choreographer.java:591)
       at android.view.Choreographer.doFrame(Choreographer.java:561)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:777)
       at android.os.Handler.handleCallback(Handler.java:730)
       at android.os.Handler.dispatchMessage(Handler.java:92)
       at android.os.Looper.loop(Looper.java:176)
       at android.app.ActivityThread.main(ActivityThread.java:5419)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:525)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
       at dalvik.system.NativeStart.main(NativeStart.java)

On further investigation I found the cause of the error was the line below:

class ItemsAdapter(private val mData: Array<WhatsNewItem>, private val mContext: Context) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {

    var titleColor: Int = Color.BLACK
    var contentColor: Int = Color.parseColor("#808080")
    var iconColor: Int = Color.BLACK

    override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
        if (position <= mData.size) {
            with(holder as ItemViewHolder) {
                with(itemView) {
                    mData[position].imageRes?.let {
               ---->      ContextCompat.getDrawable(mContext, it)?.let { drawable ->
                            DrawableCompat.setTint(drawable, iconColor)
                            itemTitleTextView.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null)
                        }
}
......

From this answer it seems ContextCompat.getDrawable won't work with vector drawables unless AppCompatDelegate.setCompatVectorFromResourcesEnabled(true); is set. I would recommend replacing ContextCompat with AppCompatResources so that consumers of your library aren't forced to use AppCompatDelegate.setCompatVectorFromResourcesEnabled(true); in their Application classes. Hopefully, I'll be able to make a pull request some time this week.

"buttonBackground" isn't working?

I am using code from example:

 with(whatsNew) {
            presentationOption = PresentationOption.DEBUG

            titleColor = ContextCompat.getColor(this@MainActivity, R.color.colorAccent)
            titleText = "What's Up"

            buttonText = "Got it!"
            buttonBackground = ContextCompat.getColor(this@MainActivity, R.color.colorPrimaryDark)
            buttonTextColor = ContextCompat.getColor(this@MainActivity, R.color.colorAccent)

            itemContentColor = Color.parseColor("#808080")
            itemTitleColor = ContextCompat.getColor(this@MainActivity, R.color.colorAccent)
        }

But unfortunately gets button with accent color every time

2019-02-19 11 39 25

Data lost when fragment is recreated

Hi @TonnyL , when the WhatsNew fragment is recreated by the system (eg: Screen Rotation), all the fragment properties are reset, except "list" (the list of items).
That's because all the other properties are set via apply in the dsl, and "list" is the only one passed in the bundle and set in the fragment lifecycle (by lazy).

Icons become mismatched when more than 10 items

I have a list of 10 items, and the first few have icons. The last ones use WhatsNewItem.NO_IMAGE_RES_ID and everything is fine...until I add more than 10 items. Then the icons become mismatched.

Example:

new WhatsNewItem("Item 1", "This is item 1.", R.drawable.ic_whatsnew_check),
new WhatsNewItem("Item 2", "This is item 2.", R.drawable.ic_whatsnew_check),
new WhatsNewItem("Item 3", "This is item 3.", R.drawable.ic_whatsnew_check),
new WhatsNewItem("Item 4", "This is item 4.", R.drawable.ic_whatsnew_check),
new WhatsNewItem("Item 5", "This is item 5.", R.drawable.ic_whatsnew_check),
new WhatsNewItem("Item 6", "This is item 6.", WhatsNewItem.NO_IMAGE_RES_ID),
new WhatsNewItem("Item 7", "This is item 7.", WhatsNewItem.NO_IMAGE_RES_ID),
new WhatsNewItem("Item 8", "This is item 8.", WhatsNewItem.NO_IMAGE_RES_ID),
new WhatsNewItem("Item 9", "This is item 9.", WhatsNewItem.NO_IMAGE_RES_ID),
new WhatsNewItem("Item 10", "This is item 10.", WhatsNewItem.NO_IMAGE_RES_ID),
new WhatsNewItem("Item 11", "This is item 11.", WhatsNewItem.NO_IMAGE_RES_ID),
new WhatsNewItem("Item 12", "This is item 11.", WhatsNewItem.NO_IMAGE_RES_ID)

results in:

(ICON) Item 1 - This is item 1
(ICON) Item 2 - This is item 2
(ICON) Item 3 - This is item 3
(ICON) Item 4 - This is item 4
(ICON) Item 5 - This is item 5
Item 6 - This is item 6
Item 7 - This is item 7
Item 8 - This is item 8
Item 9 - This is item 9
Item 10 - This is item 10
(ICON) Item 11 - This is item 11
(ICON) Item 12 - This is item 12

ClassCastException on Create

Recently I get this crash very often. Is there a way to fix it ?
Crashes occured on Android 9 and Android 6 on different phones.

Caused by java.lang.ClassCastException
android.os.Parcelable[] cannot be cast to io.github.tonnyl.whatsnew.item.WhatsNewItem[]
at io.github.tonnyl.whatsnew.WhatsNew.onCreate (WhatsNew.kt:63)
com.mypackage.MainActivity.onCreate (MainActivity.java:30)

I have only drawables and text in the WhatsNewItems like in the example.

Only notify when upgrading application, not on first usage

Thanks for the library. Would you be open to a pull request to only show the dialog if it is not the first run of the application?

Specifically, my use case is:

  • App is mature and is installed on many devices.
  • New users are still coming on board and installing for the first time.
  • A new version has substantial changes, which I want to:
    • Notify existing users about
    • Not bother new users about (because it isn't a change for them, it is just the way the app is)

I'm thinking: PresentationOption.ALWAYS_IF_UPGRADING, which will check the shared preferences for LAST_VERSION_CODE and only display if:

  • There is an existing value for this preference, and
  • The rules for PresentationOption.ALWAYS apply.

It is worth noting that in my example, I am introducing WhatsNew for the first time, so for this particular new feature, I'll likely just manually set the LAST_VERSION_CODE preference to the previous version code based on special knowledge I have about the app (e.g. if there are high scores already in the database - that indicates it was installed before and therefore the LAST_VERSION_CODE should be set and PresentationOption.ALWAYS_IF_UPGRADING will trigger the dialog, otherwise it should be blank and therefore PresentationOption.ALWAYS_IF_UPGRADING will not trigger the dialog (but WhatsNew will stil record the new version for future upgrades which require notification).

Although I could manually set the appropriate shared preferences, they are implementation details of this library, so would it also make sense to have some sort of WhatsNew.manuallySetPreviousVersion(versionCode: Int, versionName: String) to manage the situation where other people wish to incorporate the library for the first time?

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.