Use clear text mode for the feed url text input in AddFeedActivity

This commit is contained in:
Shinokuni 2020-09-05 14:23:48 +02:00
parent d59e38ee9d
commit 85fcf03e64
3 changed files with 5 additions and 24 deletions

View File

@ -60,7 +60,7 @@ dependencies {
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.palette:palette:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'

View File

@ -7,7 +7,6 @@ import android.os.Bundle;
import android.util.Patterns;
import android.view.KeyEvent;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import androidx.annotation.Nullable;
@ -70,33 +69,15 @@ public class AddFeedActivity extends AppCompatActivity implements View.OnClickLi
binding.addFeedOk.setOnClickListener(this);
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);
parseItemsAdapter = new ItemAdapter<>();
fastAdapter = FastAdapter.with(parseItemsAdapter);
fastAdapter.withSelectable(true);
fastAdapter.withOnClickListener((v, adapter, item, position) -> {
if (item.isChecked()) {
item.setChecked(false);
fastAdapter.notifyAdapterItemChanged(position);
} else {
item.setChecked(true);
fastAdapter.notifyAdapterItemChanged(position);
}
item.setChecked(!item.isChecked());
fastAdapter.notifyAdapterItemChanged(position);
binding.addFeedOk.setEnabled(recyclerViewHasCheckedItems());
return true;

View File

@ -36,6 +36,7 @@
android:id="@+id/add_feed_input_layout"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:endIconMode="clear_text"
app:layout_constraintEnd_toStartOf="@id/add_feed_load"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
@ -44,7 +45,6 @@
android:id="@+id/add_feed_text_input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableEnd="@drawable/ic_cancel_grey"
android:hint="@string/feed_url"
android:inputType="text" />