mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-03-02 07:23:38 +00:00
@@ -4,6 +4,8 @@ import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -15,12 +17,17 @@ import org.thoughtcrime.securesms.LoggingFragment;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.components.emoji.EmojiEditText;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
import org.thoughtcrime.securesms.util.text.AfterTextChanged;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class EditNoteFragment extends LoggingFragment {
|
||||
|
||||
private CreatePaymentViewModel viewModel;
|
||||
private EmojiEditText noteEditText;
|
||||
|
||||
private static final int NOTE_MAX_LENGTH = 40;
|
||||
|
||||
public EditNoteFragment() {
|
||||
super(R.layout.edit_note_fragment);
|
||||
}
|
||||
@@ -48,6 +55,11 @@ public class EditNoteFragment extends LoggingFragment {
|
||||
return false;
|
||||
});
|
||||
|
||||
TextView lengthIndicator = view.findViewById(R.id.character_count);
|
||||
noteEditText.addTextChangedListener(new AfterTextChanged(editable -> {
|
||||
lengthIndicator.setText(String.format(Locale.getDefault(), "%d/%d", noteEditText.length(), NOTE_MAX_LENGTH));
|
||||
}));
|
||||
|
||||
View fab = view.findViewById(R.id.edit_note_fragment_fab);
|
||||
fab.setOnClickListener(v -> saveNote());
|
||||
|
||||
|
||||
@@ -29,6 +29,16 @@
|
||||
android:maxLength="40"
|
||||
android:singleLine="true" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/character_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:paddingHorizontal="16dp"
|
||||
android:textColor="@color/signal_text_secondary"
|
||||
tools:text="40/40"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
@@ -41,6 +51,7 @@
|
||||
android:layout_gravity="end"
|
||||
android:layout_margin="16dp"
|
||||
android:tint="@color/core_white"
|
||||
app:srcCompat="@drawable/ic_check_24" />
|
||||
app:srcCompat="@drawable/ic_check_24"
|
||||
android:contentDescription="@string/EditNoteFragment__content_description_save_note" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -3090,6 +3090,8 @@
|
||||
|
||||
<!-- EditNoteFragment -->
|
||||
<string name="EditNoteFragment_note">Note</string>
|
||||
<!-- Content descriptor explaining the use of the save note FAB for Android accessibility settings-->
|
||||
<string name="EditNoteFragment__content_description_save_note">Save note</string>
|
||||
|
||||
<!-- ConfirmPaymentFragment -->
|
||||
<string name="ConfirmPayment__confirm_payment">Confirm payment</string>
|
||||
|
||||
Reference in New Issue
Block a user