change HttpsEditText to generic PrefixEditText

This commit is contained in:
Vincent Breitmoser
2015-04-25 03:39:40 +02:00
parent 24d407bce3
commit 608b66d192
5 changed files with 27 additions and 10 deletions

View File

@@ -107,7 +107,7 @@ public class LinkedIdCreateTwitterStep1Fragment extends Fragment {
});
mEditHandle = (EditText) view.findViewById(R.id.linked_create_twitter_handle);
mEditHandle.setText("v_debug");
mEditHandle.setText("");
return view;
}

View File

@@ -1,20 +1,27 @@
package org.sufficientlysecure.keychain.ui.widget;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.*;
import android.support.annotation.NonNull;
import android.util.AttributeSet;
import android.widget.EditText;
/** */
public class HttpsPrefixedText extends EditText {
import org.sufficientlysecure.keychain.R;
private String mPrefix; // can be hardcoded for demo purposes
public class PrefixedEditText extends EditText {
private String mPrefix;
private Rect mPrefixRect = new Rect();
public HttpsPrefixedText(Context context, AttributeSet attrs) {
public PrefixedEditText(Context context, AttributeSet attrs) {
super(context, attrs);
mPrefix = "https://";
TypedArray style = context.getTheme().obtainStyledAttributes(
attrs, R.styleable.PrefixedEditText, 0, 0);
mPrefix = style.getString(R.styleable.PrefixedEditText_prefix);
if (mPrefix == null) {
mPrefix = "";
}
}
@Override