mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 10:49:06 +01:00
Add clickable links to threads (forums/groups)
This commit is contained in:
@@ -13,6 +13,7 @@ import org.briarproject.briar.android.privategroup.memberlist.GroupMemberListAct
|
||||
import org.briarproject.briar.android.privategroup.reveal.RevealContactsActivity;
|
||||
import org.briarproject.briar.android.threaded.ThreadListActivity;
|
||||
import org.briarproject.briar.android.threaded.ThreadListViewModel;
|
||||
import org.briarproject.briar.android.widget.LinkDialogFragment;
|
||||
import org.briarproject.nullsafety.MethodsNotNullByDefault;
|
||||
import org.briarproject.nullsafety.ParametersNotNullByDefault;
|
||||
|
||||
@@ -158,6 +159,12 @@ public class GroupActivity extends
|
||||
if (isDissolved != null && !isDissolved) super.onReplyClick(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLinkClick(String url){
|
||||
LinkDialogFragment f = LinkDialogFragment.newInstance(url);
|
||||
f.show(getSupportFragmentManager(), f.getUniqueTag());
|
||||
}
|
||||
|
||||
private void setGroupEnabled(boolean enabled) {
|
||||
sendController.setReady(enabled);
|
||||
list.getRecyclerView().setAlpha(enabled ? 1f : 0.5f);
|
||||
|
||||
@@ -20,6 +20,7 @@ import androidx.annotation.UiThread;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import static androidx.core.content.ContextCompat.getColor;
|
||||
import static org.briarproject.briar.android.util.UiUtils.makeLinksClickable;
|
||||
|
||||
@UiThread
|
||||
@NotNullByDefault
|
||||
@@ -43,6 +44,7 @@ public abstract class BaseThreadItemViewHolder<I extends ThreadItem>
|
||||
@CallSuper
|
||||
public void bind(I item, ThreadItemListener<I> listener) {
|
||||
textView.setText(StringUtils.trim(item.getText()));
|
||||
makeLinksClickable(textView, listener::onLinkClick);
|
||||
|
||||
author.setAuthor(item.getAuthor(), item.getAuthorInfo());
|
||||
author.setDate(item.getTimestamp());
|
||||
|
||||
@@ -137,6 +137,7 @@ public class ThreadItemAdapter<I extends ThreadItem>
|
||||
|
||||
public interface ThreadItemListener<I> {
|
||||
void onReplyClick(I item);
|
||||
void onLinkClick(String url);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import org.briarproject.briar.android.view.TextSendController;
|
||||
import org.briarproject.briar.android.view.TextSendController.SendListener;
|
||||
import org.briarproject.briar.android.view.TextSendController.SendState;
|
||||
import org.briarproject.briar.android.view.UnreadMessageButton;
|
||||
import org.briarproject.briar.android.widget.LinkDialogFragment;
|
||||
import org.briarproject.briar.api.attachment.AttachmentHeader;
|
||||
import org.briarproject.nullsafety.MethodsNotNullByDefault;
|
||||
import org.briarproject.nullsafety.ParametersNotNullByDefault;
|
||||
@@ -202,6 +203,12 @@ public abstract class ThreadListActivity<I extends ThreadItem, A extends ThreadI
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLinkClick(String url) {
|
||||
LinkDialogFragment f = LinkDialogFragment.newInstance(url);
|
||||
f.show(getSupportFragmentManager(), f.getUniqueTag());
|
||||
}
|
||||
|
||||
protected void setToolbarSubTitle(SharingInfo sharingInfo) {
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
|
||||
@@ -114,6 +114,8 @@
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textIsSelectable="true"
|
||||
android:textSize="@dimen/text_size_medium"
|
||||
android:textColorLink="@color/briar_text_link"
|
||||
android:autoLink="web"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
||||
Reference in New Issue
Block a user