Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 681b0d07 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Text values in inspector select the whole line by default."

parents 7f259b94 0d5ede10
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -21,7 +21,10 @@ import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.graphics.Paint;
import android.support.annotation.Nullable;
import android.text.Selection;
import android.text.Spannable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

@@ -62,7 +65,19 @@ public class KeyValueRow extends LinearLayout {
    }

    public void setValue(CharSequence value) {
        ((TextView) findViewById(R.id.table_row_value)).setText(value);
        TextView text = ((TextView) findViewById(R.id.table_row_value));
        text.setText(value);
        text.setOnLongClickListener((View view) -> {

            CharSequence textValue = text.getText();
            if (textValue instanceof Spannable) {
                Spannable spn = (Spannable) textValue;
                Selection.selectAll(spn);
            }
            // we still want the default selection arrows and menu after we specified to select
            // all text in the TextView.
            return false;
        });
    }

    @Override