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

Commit 0d5ede10 authored by Austin Kolander's avatar Austin Kolander
Browse files

Text values in inspector select the whole line by default.

When a user selects an inspector value the whole line is selected,
they will then have the change to move the selection arrows to what
they want to select.

Bug: 64082214
Test: Manual
Change-Id: I749377795c2a2745ddad795a6dfbf6993a1a3f49
parent e76007b8
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