More visible cursor when adding media descriptions

This commit is contained in:
Thomas 2023-09-04 11:20:29 +02:00
parent 0b6c1d6504
commit 95e4952012
3 changed files with 9 additions and 3 deletions

View file

@ -114,6 +114,7 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
private List<Status> statusList; private List<Status> statusList;
private Status statusReply, statusMention, statusQuoted; private Status statusReply, statusMention, statusQuoted;
private StatusDraft statusDraft; private StatusDraft statusDraft;
private ActionBar actionBar;
private ComposeAdapter composeAdapter; private ComposeAdapter composeAdapter;
private final BroadcastReceiver imageReceiver = new BroadcastReceiver() { private final BroadcastReceiver imageReceiver = new BroadcastReceiver() {
@Override @Override
@ -482,7 +483,7 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
setSupportActionBar(binding.toolbar); setSupportActionBar(binding.toolbar);
promptSaveDraft = false; promptSaveDraft = false;
restoredDraft = false; restoredDraft = false;
ActionBar actionBar = getSupportActionBar(); actionBar = getSupportActionBar();
//Remove title //Remove title
if (actionBar != null) { if (actionBar != null) {
actionBar.setDisplayShowTitleEnabled(false); actionBar.setDisplayShowTitleEnabled(false);
@ -1025,6 +1026,7 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
@Override @Override
public void click(ComposeAdapter.ComposeViewHolder holder, Attachment attachment, int messagePosition, int mediaPosition) { public void click(ComposeAdapter.ComposeViewHolder holder, Attachment attachment, int messagePosition, int mediaPosition) {
binding.description.setVisibility(View.VISIBLE); binding.description.setVisibility(View.VISIBLE);
actionBar.hide();
binding.recyclerView.setVisibility(View.GONE); binding.recyclerView.setVisibility(View.GONE);
binding.mediaDescription.setText(""); binding.mediaDescription.setText("");
String attachmentPath = attachment.local_path != null && !attachment.local_path.trim().isEmpty() ? attachment.local_path : attachment.preview_url; String attachmentPath = attachment.local_path != null && !attachment.local_path.trim().isEmpty() ? attachment.local_path : attachment.preview_url;
@ -1042,11 +1044,13 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
binding.mediaSave.setOnClickListener(v -> { binding.mediaSave.setOnClickListener(v -> {
binding.description.setVisibility(View.GONE); binding.description.setVisibility(View.GONE);
actionBar.show();
binding.recyclerView.setVisibility(View.VISIBLE); binding.recyclerView.setVisibility(View.VISIBLE);
composeAdapter.openDescriptionActivity(true, binding.mediaDescription.getText().toString().trim(), holder, attachment, messagePosition, mediaPosition); composeAdapter.openDescriptionActivity(true, binding.mediaDescription.getText().toString().trim(), holder, attachment, messagePosition, mediaPosition);
}); });
binding.mediaCancel.setOnClickListener(v -> { binding.mediaCancel.setOnClickListener(v -> {
binding.description.setVisibility(View.GONE); binding.description.setVisibility(View.GONE);
actionBar.show();
binding.recyclerView.setVisibility(View.VISIBLE); binding.recyclerView.setVisibility(View.VISIBLE);
composeAdapter.openDescriptionActivity(false, binding.mediaDescription.getText().toString().trim(), holder, attachment, messagePosition, mediaPosition); composeAdapter.openDescriptionActivity(false, binding.mediaDescription.getText().toString().trim(), holder, attachment, messagePosition, mediaPosition);
}); });

View file

@ -41,7 +41,6 @@ import java.net.IDN;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantLock;
import app.fedilab.android.BaseMainActivity; import app.fedilab.android.BaseMainActivity;
@ -126,7 +125,9 @@ public class NotificationsHelper {
} }
} }
} finally { } finally {
lock.unlock(); if (lock.isHeldByCurrentThread()) {
lock.unlock();
}
} }
}).start(); }).start();
} }

View file

@ -87,6 +87,7 @@
<androidx.appcompat.widget.AppCompatEditText <androidx.appcompat.widget.AppCompatEditText
android:id="@+id/media_description" android:id="@+id/media_description"
android:textCursorDrawable="@drawable/color_cursor"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"