mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
removed option to select a phone number and changed type of text to email to display an @ directly.
This commit is contained in:
@@ -10,19 +10,21 @@
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<EditText android:id="@+id/search_view"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="0px"
|
||||
android:layout_weight="1"
|
||||
android:hint="@string/contact_selection_activity__enter_name_or_number"
|
||||
android:inputType="textPersonName"
|
||||
style="@style/TextSecure.TitleTextStyle"
|
||||
android:background="@android:color/transparent"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center_vertical"
|
||||
android:textCursorDrawable="@null"
|
||||
android:textSize="18sp"
|
||||
android:fontFamily="sans-serif"/>
|
||||
<EditText
|
||||
android:id="@+id/search_view"
|
||||
style="@style/TextSecure.TitleTextStyle"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:background="@android:color/transparent"
|
||||
android:contentDescription="@string/email_address"
|
||||
android:fontFamily="sans-serif"
|
||||
android:gravity="center_vertical"
|
||||
android:hint="@string/contact_selection_activity__enter_name_or_number"
|
||||
android:inputType="textPersonName"
|
||||
android:textCursorDrawable="@null"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<org.thoughtcrime.securesms.components.AnimatingToggle
|
||||
android:id="@+id/button_toggle"
|
||||
@@ -33,27 +35,6 @@
|
||||
android:paddingRight="10dp"
|
||||
android:gravity="center">
|
||||
|
||||
<ImageView android:id="@+id/search_dialpad"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center_vertical"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:background="@drawable/circle_touch_highlight_background"
|
||||
android:src="@drawable/ic_dialpad_white_24dp" />
|
||||
|
||||
<ImageView android:id="@+id/search_keyboard"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center_vertical"
|
||||
android:clickable="true"
|
||||
android:visibility="gone"
|
||||
android:focusable="true"
|
||||
android:background="@drawable/circle_touch_highlight_background"
|
||||
android:src="@drawable/ic_keyboard_white_24dp" />
|
||||
|
||||
<ImageView android:id="@+id/search_clear"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
@@ -22,8 +22,6 @@ public class ContactFilterToolbar extends Toolbar {
|
||||
|
||||
private EditText searchText;
|
||||
private AnimatingToggle toggle;
|
||||
private ImageView keyboardToggle;
|
||||
private ImageView dialpadToggle;
|
||||
private ImageView clearToggle;
|
||||
private LinearLayout toggleContainer;
|
||||
|
||||
@@ -41,36 +39,15 @@ public class ContactFilterToolbar extends Toolbar {
|
||||
|
||||
this.searchText = ViewUtil.findById(this, R.id.search_view);
|
||||
this.toggle = ViewUtil.findById(this, R.id.button_toggle);
|
||||
this.keyboardToggle = ViewUtil.findById(this, R.id.search_keyboard);
|
||||
this.dialpadToggle = ViewUtil.findById(this, R.id.search_dialpad);
|
||||
this.clearToggle = ViewUtil.findById(this, R.id.search_clear);
|
||||
this.toggleContainer = ViewUtil.findById(this, R.id.toggle_container);
|
||||
|
||||
this.keyboardToggle.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
searchText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PERSON_NAME);
|
||||
ServiceUtil.getInputMethodManager(getContext()).showSoftInput(searchText, 0);
|
||||
displayTogglingView(dialpadToggle);
|
||||
}
|
||||
});
|
||||
|
||||
this.dialpadToggle.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
searchText.setInputType(InputType.TYPE_CLASS_PHONE);
|
||||
ServiceUtil.getInputMethodManager(getContext()).showSoftInput(searchText, 0);
|
||||
displayTogglingView(keyboardToggle);
|
||||
}
|
||||
});
|
||||
searchText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
|
||||
|
||||
this.clearToggle.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
searchText.setText("");
|
||||
|
||||
if (SearchUtil.isTextInput(searchText)) displayTogglingView(dialpadToggle);
|
||||
else displayTogglingView(keyboardToggle);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -88,15 +65,13 @@ public class ContactFilterToolbar extends Toolbar {
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
if (!SearchUtil.isEmpty(searchText)) displayTogglingView(clearToggle);
|
||||
else if (SearchUtil.isTextInput(searchText)) displayTogglingView(dialpadToggle);
|
||||
else if (SearchUtil.isPhoneInput(searchText)) displayTogglingView(keyboardToggle);
|
||||
notifyListener();
|
||||
}
|
||||
});
|
||||
|
||||
setLogo(null);
|
||||
setContentInsetStartWithNavigation(0);
|
||||
expandTapArea(toggleContainer, dialpadToggle);
|
||||
expandTapArea(toggleContainer, clearToggle);
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
@@ -137,14 +112,6 @@ public class ContactFilterToolbar extends Toolbar {
|
||||
}
|
||||
|
||||
private static class SearchUtil {
|
||||
static boolean isTextInput(EditText editText) {
|
||||
return (editText.getInputType() & InputType.TYPE_MASK_CLASS) == InputType.TYPE_CLASS_TEXT;
|
||||
}
|
||||
|
||||
static boolean isPhoneInput(EditText editText) {
|
||||
return (editText.getInputType() & InputType.TYPE_MASK_CLASS) == InputType.TYPE_CLASS_PHONE;
|
||||
}
|
||||
|
||||
public static boolean isEmpty(EditText editText) {
|
||||
return editText.getText().length() <= 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user