Office Hours — Today, April 28

Yesterday, April 27

Mark M.
has entered the room
Apr 28
9:15 AM
Ed T.
has entered the room
Mark M.
hello, Ed!
how can I help you today?
Ed T.
good evening?
:-)
hope you are well
Mark M.
can't complain -- and you?
Ed T.
I'm alive --- :-)
at 53 I'll take what I can get lol
9:20 AM
Ed T.
I figured out something on CardIO that is worth passing along
if you do this...
View paste
        // hide PayPal icon from main camera scan page
        scanIntent.putExtra(CardIOActivity.EXTRA_HIDE_CARDIO_LOGO, true);

        // use our app colors which hides PayPal from data entry screen
        scanIntent.putExtra(CardIOActivity.EXTRA_KEEP_APPLICATION_THEME, true);
it wipes all the details out that are of PayPal nature
I have a Constraint Layout question
Mark M.
go ahead
Ed T.
so you suggested I try GONE a while back and that worked for that screen
have another screen of the same nature
GONE isn't working... when I want things to go away
I've got components sliding up into each other
should I try to set Gravity?
I can post screen shots if it helps
Mark M.
"GONE isn't working... when I want things to go away" -- do you mean that the widget is somehow still visible even if its visibility is set to GONE?
Ed T.
no the widget drops
but I get this happening..
Mark M.
"drops"?
Ed T.
9:25 AM
Mark M.
that seems... busy :-)
Ed T.
it's the final purchase screen on a phone
and I don't have a lot of freedom
I'm replicating an iPhone app
Mark M.
OK, I guess I still don't understand your question
Ed T.
so the switch on the screen above
sets the address widgets to GONE if true
and that causes the very first screen
I don't understand why or how to trouble shoot / isolate the issue
do I use gravity
to make them stay to the bottom
Mark M.
I can't really answer that
Ed T.
invisible is not what I want because I don't what all of that white space
Mark M.
since I do not have the layout resource
9:30 AM
Ed T.
I'm trying to understand how to debug constraint layout
and the odd thing
I found a great reference but it turned out to be a beta version of constraint layout
Mark M.
the 1.1.0 series went final a couple of weeks ago, if that was the beta you are referring to
Ed T.
Mark M.
are your address widgets in their own container, or are they immediate children of the ConstraintLayout?
Ed T.
I was looking at using this...
View paste
    <android.support.constraint.Barrier
        android:id="@+id/barrier"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:barrierDirection="right"
        app:constraint_referenced_ids="button_example,text_view_status" />
View paste (447 more lines)
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true">

    <android.support.constraint.ConstraintLayout
        android:id="@+id/parentLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginEnd="8dp"
        android:layout_marginStart="8dp"
        android:columnCount="3"
...
that's the layout
and Barrier didn't work
and yes it is cluttered
but I have to match what is already in production on an iPhone
Mark M.
I don't see address widgets in there
which are they?
Ed T.
sorry, that's my generic term for any type of control on a screen
TextView
Switch
Spinner
EditView
Button
components , controls, widgets, gadgets
Mark M.
I know what widgets are, thanks
but I don't know which are the address widgets that you are trying to make GONE
Ed T.
I don't. :-)
because I'm bouncing around several platforms
9:35 AM
Ed T.
View paste (1 more line)
    void toggleAddressOnSwitch(boolean isChecked) {

        final boolean hideOnIsChecked = !isChecked;
        final int visibleFlag = (hideOnIsChecked ? View.VISIBLE : View.GONE);

        textViewAddressLabel.setVisibility(visibleFlag);
        textViewApartmentLabel.setVisibility(visibleFlag);
        textViewCityLabel.setVisibility(visibleFlag);
        textViewStateLabel.setVisibility(visibleFlag);
        textViewZipCodeLabel.setVisibility(visibleFlag);
        editTextAddress.setVisibility(visibleFlag);
        editTextApartment.setVisibility(visibleFlag);
        editTextCity.setVisibility(visibleFlag);
        spinnerState.setVisibility(visibleFlag);
        editTextZipCode.setVisibility(visibleFlag);
...
Mark M.
there is no widget named textViewAddressLabel in that layout resource, at least that I can find
so, which widgets in that layout resource are the ones that you are trying to make be GONE when that switch is toggled?
Ed T.
checking
wrong screen sorry
View paste (592 more lines)
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    style="@style/cleanup"
    tools:context=".PaymentActivity">

    <android.support.constraint.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <TextView
            android:id="@+id/textView29"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
...
that's the right one
I know it's there because it loads and toggles and I can pour data threw it
Mark M.
so, switchBillingAddressTheSame is the Switch that toggles the visibility?
Ed T.
after expanded it from the Resource Bundle
yes sir
the logic is... basically if your credit card billing is the same.... leave as is
but if it's different I need that info for payment
9:40 AM
Ed T.
I nuked the constraints several times
had everything on the bottom vertical position the vertical anchor from the bottom up
then from the switch do top down vertical anchor
didn't seem to change anything
Mark M.
personally, I would wrap all those address widgets in another container, then make that whole container be GONE
Ed T.
I had done that in the past
Mark M.
and have things outside that container anchor to the container, not to address widgets in the container
Ed T.
but Android Studio complains
Mark M.
complains about what?
Ed T.
because ConstraintLayout is to prevent nesting and 'flatten'
Mark M.
Lint rules are for basic scenarios
Ed T.
because nested containers have over head
Mark M.
yes, and in this case, that overhead is not going to matter
Ed T.
at one point I was using LinearLayout everywhere
thanks for the feedback
I'll nest it
Mark M.
my concern is that you have so many widgets that you're trying to toggle that you're going to confuse the ConstraintLayout rules engine
Ed T.
I'm sure that will work
thanks Mark!
trying to finish all of this for April
Mark M.
if it works, and the only problem is the Lint warning, there should be a quick-fix in the editor to suppress the warning
you are running out of April :-)
Ed T.
I know :)
why I'm working on a Saturday
but it's pretty much the last hard screen. ;-)
9:45 AM
Ed T.
working with JSON data to a backend server
was my first Android app
lot of screens
have a great weekend!
Mark M.
you too!
10:00 AM
Mark M.
that's a wrap for today's chat
as usual, the transcript will be posted to https://commonsware.com/office-hours/ shortly
the next chat is Tuesday, also at 9am US Eastern
have a pleasant day!
Ed T.
has left the room
Mark M.
turned off guest access

Yesterday, April 27

 

Office Hours

People in this transcript

  • Ed Tidwell
  • Mark Murphy