Status Update
Comments
ar...@google.com <ar...@google.com>
da...@google.com <da...@google.com> #2
da...@google.com <da...@google.com> #3
To which directory will it unzip to with the fix? It would be helpful to know so that workarounds for the current version already use that directory.
da...@google.com <da...@google.com> #4
kn...@google.com <kn...@google.com> #5
Is 3.0 already released? Where can I find release notes for cmdline-tools?
sh...@gmail.com <sh...@gmail.com> #6
I guess we don't have release notes right now, beyond looking at the fixed bugs :-/
da...@google.com <da...@google.com> #7
Are the plans or a ticket to move the structure from cmdline-tools/<content>
to cmdline-tools/subfolder/<content>
? As it is you still need to move the content to a subfolder manually for SDK manager to work.
sh...@gmail.com <sh...@gmail.com> #8
I'm kind of short on time for the next few days and won't get time to make a small project till after the weekend.
If I just send you (or github invite you ) the project will it stay within Google?
Also I think I've narrowed down the cause.
I have multiple BindingAdapters annotated with @BindingAdapter("app:text").
One for each of the number types.
//-------------------------------------------------------------------------------------------------//
@BindingAdapter("app:text")
fun setDoubleInTextView(tv: TextView, dbl: Double?) {
try {
//This will occur when view is first created or when the leading zero is omitted
if (dbl == null && (tv.text.toString() == "" || tv.text.toString() == ".")) return
//Check to see what's already there
val tvDbl = tv.text.toString().toDouble()
//If it's the same as what we've just entered then return
// This is when then the double was typed rather than binded
if (tvDbl == dbl)
return
//If it's a new number then set it in the tv
tv.text = dbl?.toString()
} catch (nfe: java.lang.NumberFormatException) {
//This is usually caused when tv.text is blank and we've entered the first digit
tv.text = dbl?.toString() ?: ""
}//catch
}//setDoubleInTextView
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -//
@InverseBindingAdapter(attribute = "app:text")
fun getDoubleFromTextView(editText: TextView): Double? {
return try {
editText.text.toString().toDouble()
} catch (e: NumberFormatException) {
null
}//catch
}//getDoubleFromTextView
//-------------------------------------------------------------------------------------------------//
@BindingAdapter("app:text")
fun setNullableIntegerInTextView(editText: TextView, int: Int?) {
val intStr = int?.toString()
intStr?.let {
if (intStr != editText.text.toString())
editText.text = int.toString()
return
}//let
if (editText.text != null && editText.text.toString() != "")
editText.text = null
}//setIntegerInTextView
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -//
@InverseBindingAdapter(attribute = "app:text")
fun getNullableIntegerFromTextView(editText: TextView): Int? {
return try {
editText.text.toString().toInt()
} catch (e: NumberFormatException) {
null
}//catch
}//getIntegerFromTextView
//-------------------------------------------------------------------------------------------------//
@BindingAdapter("app:text")
fun setIntegerInTextView(editText: TextView, int: Int) {
val intStr = int.toString()
intStr.let {
if (intStr != editText.text.toString())
editText.text = int.toString()
return
}//let
}//setIntegerInTextView
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -//
@InverseBindingAdapter(attribute = "app:text")
fun getIntegerFromTextView(editText: TextView): Int {
return try {
editText.text.toString().toInt()
} catch (e: NumberFormatException) {
0
}//catch
}//getIntegerFromTextView
//-------------------------------------------------------------------------------------------------//
My thinking was (and it seemed to work in version 3.5) that the compiler would figure out what overloaded method I was actually referring to based on the variable type.
It does seem to get it right at runtime.
However if I create another Int type BindingAdapter:
@BindingAdapter("app:textInputEditText")
fun setIntegerInTextInputEditText(editText: TextView, int: Int) {
val intStr = int.toString()
intStr.let {
if (intStr != editText.text.toString())
editText.text = int.toString()
return
}//let
}//setIntegerInTextInputEditText
and then in my layout I do this:
app:textInputEditText="@={viewModel.tempProductQty}"
instead of
app:text="@={viewModel.tempProductQty}"
I don't get any squiggly red lines.
Maybe this is the right way and I had been previously "breaking the rules".
Let me know what you think.
You can give me a quick call if you want to chat about it.
Shane
da...@google.com <da...@google.com> #9
I'll send you an email shortly. If you send us a github invite, yes, I can promise it won't leave outside just us working on this bug.
da...@google.com <da...@google.com>
kn...@google.com <kn...@google.com> #10
Also, if you see similar unwanted "Cannot find a getter" error for custom xml attribute, you can try ctrl/command + B to search the declaration of the xml attribute and check if you can find all declarations for getters and setters.
da...@google.com <da...@google.com> #11
Thank you for sharing your project. As a result, we believe we found the issue, with a fix that should land in 4.1 canary 9.
Description
//-------------------------------------------------------------------------------------------------//
@BindingAdapter("app:text")
fun setNullableIntegerInTextView(editText: TextView, int: Int?) {
val intStr = int?.toString()
intStr?.let {
if (intStr != editText.text.toString())
editText.text = int.toString()
return
}//let
if (editText.text != null && editText.text.toString() != "")
editText.text = null
}//setIntegerInTextView
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -//
@InverseBindingAdapter(attribute = "app:text")
fun getNullableIntegerFromTextView(editText: TextView): Int? {
return try {
editText.text.toString().toInt()
} catch (e: NumberFormatException) {
null
}//catch
}//getIntegerFromTextView
//-------------------------------------------------------------------------------------------------//
I have similar versions of the above for Doubles and Floats etc.
They all have the ("app:text") attribute because they are all used in children of TextView
which I use like this
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="@string/percent"
android:inputType="number"
app:showIfPriceTypeMargin="@{viewModel.priceType}"
app:text="@={viewModel.tempProductMargin}" />
The thing is since updating to Android Studio 4 I'm getting error messages like :
"Cannot find a getter for <EditText app:text> that accepts parameter type 'androidx.lifecycle.MutableLiveData<java.lang.Integer>'"
The app still compiles and runs like it used to.
I can get rid of the error by giving each BindingAdapter a unique attribute (i.e. ("app:intText"))
and using it like this
app:intText="@={viewModel.tempProductQty}" />
Is this the desired behaviour?
Build: AI-193.6911.18.40.6348893, 202003310117,
AI-193.6911.18.40.6348893, JRE 1.8.0_242-release-1644-b01x64 JetBrains s.r.o, OS Windows 10(amd64) v10.0 , screens 1366x768, 1920x1080
AS: 4.0 Beta 4; Kotlin plugin: 1.3.71-release-Studio4.0-1; Android Gradle Plugin: 4.0.0-beta04; Gradle: 6.1.1; NDK: from local.properties: (not specified), latest from SDK: (not found); LLDB: pinned revision 3.1 not found, latest from SDK: (package not found); CMake: from local.properties: (not specified), latest from SDK: (not found), from PATH: (not found)
IMPORTANT: Please read