This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.nickrout.canvasmultilinetext | |
import android.graphics.Canvas | |
import android.os.Build | |
import android.support.annotation.RequiresApi | |
import android.text.* | |
import androidx.core.graphics.withTranslation | |
import androidx.core.util.lruCache | |
@RequiresApi(Build.VERSION_CODES.O) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MIT License | |
Copyright (c) 2018 Nicholas Rout | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.nickrout.actionmode | |
import android.support.annotation.MenuRes | |
import android.view.ActionMode | |
import android.view.Menu | |
import android.view.MenuItem | |
import android.view.View | |
class PrimaryActionModeCallback : ActionMode.Callback { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.nickrout.actionmode | |
import android.graphics.Rect | |
import android.os.Build | |
import android.support.annotation.MenuRes | |
import android.support.annotation.RequiresApi | |
import android.view.ActionMode | |
import android.view.Menu | |
import android.view.MenuItem | |
import android.view.View |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.nickrout.actionmode | |
import android.view.MenuItem | |
interface OnActionItemClickListener { | |
fun onActionItemClick(item: MenuItem) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.nickrout.snaphelperlistener | |
import androidx.recyclerview.widget.RecyclerView | |
import androidx.recyclerview.widget.SnapHelper | |
fun SnapHelper.getSnapPosition(recyclerView: RecyclerView): Int { | |
val layoutManager = recyclerView.layoutManager ?: return RecyclerView.NO_POSITION | |
val snapView = findSnapView(layoutManager) ?: return RecyclerView.NO_POSITION | |
return layoutManager.getPosition(snapView) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.nickrout.snaphelperlistener | |
interface OnSnapPositionChangeListener { | |
fun onSnapPositionChange(position: Int) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.nickrout.snaphelperlistener | |
import androidx.recyclerview.widget.RecyclerView | |
import androidx.recyclerview.widget.SnapHelper | |
class SnapOnScrollListener( | |
private val snapHelper: SnapHelper, | |
var behavior: Behavior = Behavior.NOTIFY_ON_SCROLL, | |
var onSnapPositionChangeListener: OnSnapPositionChangeListener? = null | |
) : RecyclerView.OnScrollListener() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.nickrout.snaphelperlistener | |
import androidx.recyclerview.widget.RecyclerView | |
import androidx.recyclerview.widget.SnapHelper | |
fun RecyclerView.attachSnapHelperWithListener( | |
snapHelper: SnapHelper, | |
behavior: SnapOnScrollListener.Behavior = SnapOnScrollListener.Behavior.NOTIFY_ON_SCROLL, | |
onSnapPositionChangeListener: OnSnapPositionChangeListener) { | |
snapHelper.attachToRecyclerView(this) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: catalog/build.gradle | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- catalog/build.gradle (revision 4d719031e44ca4573e34d5c9d1ce3a72e7c5d5e4) | |
+++ catalog/build.gradle (date 1570086427000) | |
@@ -58,6 +58,7 @@ | |
'menu', | |
'radiobutton', |
OlderNewer