ritesh
03/27/2020, 12:28 PMclass KnowledgeArticleListController : Typed2EpoxyController<List<Article>, KnowledgeArticleListActionHandler>() {
override fun setDebugLoggingEnabled(enabled: Boolean) {
super.setDebugLoggingEnabled(true)
}
override fun buildModels(data: List<Article>, listener: KnowledgeArticleListActionHandler) {
data.forEachIndexed { index, article ->
knowledgeArticleListItemView {
id(article.id)
article(article)
listener(listener)
lastItem(index == data.lastIndex)
}
}
}
}
@EpoxyModelClass(layout = R.layout.knowledge_article_list_item)
abstract class KnowledgeArticleListItemView : EpoxyModelWithHolder<ViewViewHolder>() {
@EpoxyAttribute
var category: Category? = null
@EpoxyAttribute
var article: Article? = null
@EpoxyAttribute(EpoxyAttribute.Option.DoNotHash)
lateinit var listener: KnowledgeArticleListActionHandler
@EpoxyAttribute(EpoxyAttribute.Option.DoNotHash)
var lastItem: Boolean = false
override fun bind(holder: ViewViewHolder) {
if (category != null) {
} else if (article != null) {
}
holder.knowledgeArticleListItemCell.showTopBorder = false
// don't show bottom border if last item, toolbar border is there
holder.knowledgeArticleListItemCell.showBottomBorder = !lastItem
}
override fun unbind(holder: ViewViewHolder) {
holder.knowledgeArticleListItemCell.setOnClickListener(null)
}
}
class ViewViewHolder : KotlinEpoxyHolder() {
val knowledgeArticleListItemCell by bind<StandardCell>(R.id.knowledgeArticleListItemCell)
}
Smith
03/27/2020, 7:59 PMTravis Griggs
03/27/2020, 10:23 PMval family = 42
val friends = 0
println("Family:Friend ratio = ${family / friends}")
What my investigations some to indicate is that for many error exceptions (though not all), an exception inside of a ${} will cause the remainder of the calling context to be terminated and it just silently move on.
Is this a known phenomenona? A temporary bug that is meant to be fixed? I’m using an up-to-date version of AndroidStudio.Mostafa Fahimi
03/28/2020, 7:28 AMBruno_
03/28/2020, 3:21 PM@Entity
-ies) with the help of the room docs. The thing is that in one-to-many
scenario the parent knows nothing about the children plus every child has only an ID of the parent.
However I absolutely have to have an Ad
as well as the list of application results (not just ids, whole objects) in AdEntry
. Is it possible to do so in Room?kevindmoore
03/28/2020, 8:21 PMkevindmoore
03/28/2020, 8:24 PMJaxon Du
03/29/2020, 7:49 AMJoey
03/30/2020, 2:14 AMclass MainActivity : AppCompatActivity() {
companion object {
init {
System.loadLibrary("encrypt")
}
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
tv_cipher.text = encryptString("test")
}
external fun encryptString(plaintext: String): String
}
Anything wrong? Library is already inside their respective architectures under src/main/jniLibs/<archi>
Gaurav
03/30/2020, 12:43 PMJordan Carlyon
03/30/2020, 6:27 PMsealed class Result<out R>
From the generics documentation
The general rule is: when a type parameterof a classT
is declared out, it may occur only in out-position in the members ofC
, but in returnC
can safely be a supertype ofC<Base>
.C<Derived>
In “clever words” they say that the classSo I can see that type parameteris covariant in the parameterC
, or thatT
is a covariant type parameter. You can think of C as being a producer of `T`'s, and NOT a consumer of `T`’s.T
R
of class Result
can only be returned by Result
, Error
and toString
but what is R
? Is my assumption correct?
I can see here that it is a callable reference
References to functions, properties, and constructors, apart from introspecting the program structure, can also be called or used as instances of function types.
The common supertype for all callable references isBut I am not sure what that is or why it matters here. Is this applicable to this sealed class or is this not considered a callable reference since it is a sealed class? Is the constructor the callable reference and then the return type is, whereKCallable<out R>
is the return value type, which is the property type for properties, and the constructed type for constructors.R
Change<R>
?Andy Gibel
03/30/2020, 10:19 PMSagar Suri
03/31/2020, 4:17 AMdebug.keystore
by default for a debug build?
signingConfigs {
debug {
storeFile file('keystore/debug.jks')
storePassword 'android'
keyAlias = 'android'
keyPassword 'android'
}
}
Reprator
03/31/2020, 11:48 AMSrSouza
03/31/2020, 1:58 PMcompileDebugJavaWithJavac
with no source files
message, When a downgrade to Kotlin 1.3.50 its working.Joey
04/01/2020, 6:59 AMOfir Bar
04/01/2020, 9:07 AMMartinZaubitzer
04/01/2020, 11:59 AMmathew
04/01/2020, 1:03 PMTim
04/01/2020, 1:25 PMLog.d(TAG, "something")
, you could just do d { "something" }
and the logger would automatically figure out what class and method its in. Does anyone either happen to know this library or know how i could implement that myself?Andy Gibel
04/01/2020, 1:52 PMgouravkundu
04/01/2020, 4:47 PMMirmukhsin Sodikov
04/01/2020, 7:05 PMVariable mOnClickListener must be initialized
and underlines the mOnClickListener
inside the init
statement.
I have been doing the same thing in Java and it didn’t say anything like that.
Am I missing something here ?
EDIT : I am trying to make a custom layout here. I have been doing this in Java all the time - assigned OnClickListener
to a private variable and then setting it to a button in the constructor.
class CustomLayout(context: Context) : FrameLayout(context) {
companion object {
const val RESOURCE = R.layout.layout_custom
}
init {
LayoutInflater.from(context).inflate(RESOURCE, this)
// IntelliJ underlined `mOnClickListener` here and it says : "Variable mOnClickListener must be initialized"
btnSend.setOnClickListener(mOnClickListener)
}
private val mOnClickListener = OnClickListener { context.toastInfo("Info") }
}
Java version of the code which works fine
public class CustomLayout extends FrameLayout{
public CustomLayout(){
// inflating the xml layout
...
btnSend.setOnClickListener(mOnClickListener);
}
private OnClickListener mOnClickListener = new OnClickListener() {
@Override
public void onClick(View v) {
// do something
}
};
}
Tash
04/02/2020, 7:01 PMlawlorslaw
04/02/2020, 7:04 PM@Component
and @Module
defined in the same file what would you name that file?Travis Griggs
04/03/2020, 12:20 AMthis.timer = Timer()
this.timer?.scheduleAtFixedRate(timerTask { simulate() }, 0L, 5000L)
I’m not a fan of this solution, because this
isn’t what I expect this to be in that case. But when in rome, I guess? Or is there a different more modern idiomatic way to cause a real closure to tick at a rate?Tim Malseed
04/03/2020, 1:06 AMcontext.contentResolver.delete(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, "${MediaStore.Audio.Media._ID} = ?", arrayOf(id.toString()))
Supposedly, if I don’t have permission, this should throw a RecoverableSecurityException
on Android Q, and I should be able to use an IntentSender to have the user grant permission.
Instead, I just get a result of 0
from the delete()
call, meaning no files were deleted.
Any ideas?Jabez Magomere
04/03/2020, 8:30 AMmyanmarking
04/03/2020, 11:09 AM<item name="toolbarStyle">@style/Widget.Toolbar</item>
and then
<style name="Widget.Toolbar" parent="Widget.MaterialComponents.Toolbar">>
does nothing. does any1 have a clue ?