Skip to content

Commit

Permalink
Add share hint for sharing group link.
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-signal committed Feb 25, 2021
1 parent f707c1d commit f81f506
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
Expand Up @@ -6,6 +6,7 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.NonNull;
Expand Down Expand Up @@ -54,10 +55,11 @@ public void onCreate(@Nullable Bundle savedInstanceState) {
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.group_link_share_bottom_sheet, container, false);

View shareViaSignalButton = view.findViewById(R.id.group_link_bottom_sheet_share_via_signal_button);
View copyButton = view.findViewById(R.id.group_link_bottom_sheet_copy_button);
View viewQrButton = view.findViewById(R.id.group_link_bottom_sheet_qr_code_button);
View shareBySystemButton = view.findViewById(R.id.group_link_bottom_sheet_share_via_system_button);
View shareViaSignalButton = view.findViewById(R.id.group_link_bottom_sheet_share_via_signal_button);
View copyButton = view.findViewById(R.id.group_link_bottom_sheet_copy_button);
View viewQrButton = view.findViewById(R.id.group_link_bottom_sheet_qr_code_button);
View shareBySystemButton = view.findViewById(R.id.group_link_bottom_sheet_share_via_system_button);
TextView hint = view.findViewById(R.id.group_link_bottom_sheet_hint);

GroupId.V2 groupId = GroupId.parseOrThrow(Objects.requireNonNull(requireArguments().getString(ARG_GROUP_ID))).requireV2();

Expand All @@ -70,6 +72,10 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c
return;
}

hint.setText(groupLink.isRequiresApproval() ? R.string.GroupLinkBottomSheet_share_hint_requiring_approval
: R.string.GroupLinkBottomSheet_share_hint_not_requiring_approval);
hint.setVisibility(View.VISIBLE);

shareViaSignalButton.setOnClickListener(v -> {
Context context = requireContext();
Intent intent = new Intent(context, ShareActivity.class);
Expand Down
14 changes: 14 additions & 0 deletions app/src/main/res/layout/group_link_share_bottom_sheet.xml
Expand Up @@ -16,6 +16,20 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

<TextView
android:id="@+id/group_link_bottom_sheet_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="8dp"
android:textAlignment="center"
android:textAppearance="@style/TextAppearance.Signal.Body2"
android:textColor="@color/signal_text_secondary"
android:visibility="gone"
tools:text="@string/GroupLinkBottomSheet_share_hint_requiring_approval"
tools:visibility="visible" />

<Button
android:id="@+id/group_link_bottom_sheet_share_via_signal_button"
style="@style/Widget.Signal.Button.TextButton.Drawable"
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Expand Up @@ -2780,6 +2780,8 @@
<string name="GroupsLearnMore_paragraph_3">Signal will offer a way to upgrade Legacy Groups in the future.</string>

<!-- GroupLinkBottomSheetDialogFragment -->
<string name="GroupLinkBottomSheet_share_hint_requiring_approval">Anyone with this link can view the group\'s name and photo and request to join. Share it with people you trust.</string>
<string name="GroupLinkBottomSheet_share_hint_not_requiring_approval">Anyone with this link can view the group\'s name and photo and join the group. Share it with people you trust.</string>
<string name="GroupLinkBottomSheet_share_via_signal">Share via Signal</string>
<string name="GroupLinkBottomSheet_copy">Copy</string>
<string name="GroupLinkBottomSheet_qr_code">QR Code</string>
Expand Down

0 comments on commit f81f506

Please sign in to comment.