mirror of https://github.com/readrops/Readrops.git
Use clear text mode for the feed url text input in AddFeedActivity
This commit is contained in:
parent
d59e38ee9d
commit
85fcf03e64
|
@ -60,7 +60,7 @@ dependencies {
|
||||||
|
|
||||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.10'
|
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.10'
|
||||||
|
|
||||||
implementation 'com.google.android.material:material:1.1.0'
|
implementation 'com.google.android.material:material:1.2.0'
|
||||||
implementation 'androidx.cardview:cardview:1.0.0'
|
implementation 'androidx.cardview:cardview:1.0.0'
|
||||||
implementation 'androidx.palette:palette:1.0.0'
|
implementation 'androidx.palette:palette:1.0.0'
|
||||||
implementation 'androidx.recyclerview:recyclerview:1.1.0'
|
implementation 'androidx.recyclerview:recyclerview:1.1.0'
|
||||||
|
|
|
@ -7,7 +7,6 @@ import android.os.Bundle;
|
||||||
import android.util.Patterns;
|
import android.util.Patterns;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.MotionEvent;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
@ -70,33 +69,15 @@ public class AddFeedActivity extends AppCompatActivity implements View.OnClickLi
|
||||||
binding.addFeedOk.setOnClickListener(this);
|
binding.addFeedOk.setOnClickListener(this);
|
||||||
binding.addFeedOk.setEnabled(false);
|
binding.addFeedOk.setEnabled(false);
|
||||||
|
|
||||||
binding.addFeedTextInput.setOnTouchListener((v, event) -> {
|
|
||||||
final int DRAWABLE_RIGHT = 2;
|
|
||||||
|
|
||||||
int drawablePos = (binding.addFeedTextInput.getRight() -
|
|
||||||
binding.addFeedTextInput.getCompoundDrawables()[DRAWABLE_RIGHT].getBounds().width());
|
|
||||||
if (event.getAction() == MotionEvent.ACTION_UP && event.getRawX() >= drawablePos) {
|
|
||||||
binding.addFeedTextInput.setText("");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
viewModel = new ViewModelProvider(this).get(AddFeedsViewModel.class);
|
viewModel = new ViewModelProvider(this).get(AddFeedsViewModel.class);
|
||||||
|
|
||||||
parseItemsAdapter = new ItemAdapter<>();
|
parseItemsAdapter = new ItemAdapter<>();
|
||||||
fastAdapter = FastAdapter.with(parseItemsAdapter);
|
fastAdapter = FastAdapter.with(parseItemsAdapter);
|
||||||
fastAdapter.withSelectable(true);
|
fastAdapter.withSelectable(true);
|
||||||
fastAdapter.withOnClickListener((v, adapter, item, position) -> {
|
fastAdapter.withOnClickListener((v, adapter, item, position) -> {
|
||||||
if (item.isChecked()) {
|
item.setChecked(!item.isChecked());
|
||||||
item.setChecked(false);
|
|
||||||
fastAdapter.notifyAdapterItemChanged(position);
|
fastAdapter.notifyAdapterItemChanged(position);
|
||||||
} else {
|
|
||||||
item.setChecked(true);
|
|
||||||
fastAdapter.notifyAdapterItemChanged(position);
|
|
||||||
}
|
|
||||||
|
|
||||||
binding.addFeedOk.setEnabled(recyclerViewHasCheckedItems());
|
binding.addFeedOk.setEnabled(recyclerViewHasCheckedItems());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
android:id="@+id/add_feed_input_layout"
|
android:id="@+id/add_feed_input_layout"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
app:endIconMode="clear_text"
|
||||||
app:layout_constraintEnd_toStartOf="@id/add_feed_load"
|
app:layout_constraintEnd_toStartOf="@id/add_feed_load"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent">
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
@ -44,7 +45,6 @@
|
||||||
android:id="@+id/add_feed_text_input"
|
android:id="@+id/add_feed_text_input"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:drawableEnd="@drawable/ic_cancel_grey"
|
|
||||||
android:hint="@string/feed_url"
|
android:hint="@string/feed_url"
|
||||||
android:inputType="text" />
|
android:inputType="text" />
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue