diff options
Diffstat (limited to '')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/EditAccountActivity.java | 24 | ||||
-rw-r--r-- | src/main/res/layout/activity_edit_account.xml | 30 |
2 files changed, 54 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java index 28c0e1146..7a5210e8f 100644 --- a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java +++ b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java @@ -328,6 +328,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat @Override public void onTextChanged(final CharSequence s, final int start, final int before, final int count) { updateSaveButton(); + updateInfoButtons(); } @Override @@ -429,6 +430,18 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat } } + protected void updateInfoButtons() { + if (this.binding.accountRegisterNew.isChecked()) { + if (!mUsernameMode && Jid.ofEscaped(this.binding.accountJid.getText()).getDomain().toLowerCase().equals("pix-art.de")) { + this.binding.showPrivacyPolicy.setVisibility(View.VISIBLE); + this.binding.showTermsOfUse.setVisibility(View.VISIBLE); + } + } else { + this.binding.showPrivacyPolicy.setVisibility(View.GONE); + this.binding.showTermsOfUse.setVisibility(View.GONE); + } + } + protected void updateSaveButton() { boolean accountInfoEdited = accountInfoEdited(); @@ -539,12 +552,23 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat @Override public void onCheckedChanged(final CompoundButton buttonView, final boolean isChecked) { updateSaveButton(); + updateInfoButtons(); } }; this.binding.accountRegisterNew.setOnCheckedChangeListener(OnCheckedShowConfirmPassword); if (Config.DISALLOW_REGISTRATION_IN_UI) { this.binding.accountRegisterNew.setVisibility(View.GONE); } + this.binding.showPrivacyPolicy.setOnClickListener(view -> { + final Uri uri = Uri.parse("https://jabber.pix-art.de/privacy/"); + Intent browserIntent = new Intent(Intent.ACTION_VIEW, uri); + startActivity(browserIntent); + }); + this.binding.showTermsOfUse.setOnClickListener(view -> { + final Uri uri = Uri.parse("https://jabber.pix-art.de/termsofuse/"); + Intent browserIntent = new Intent(Intent.ACTION_VIEW, uri); + startActivity(browserIntent); + }); } @Override diff --git a/src/main/res/layout/activity_edit_account.xml b/src/main/res/layout/activity_edit_account.xml index f4f01dea1..8a77f939a 100644 --- a/src/main/res/layout/activity_edit_account.xml +++ b/src/main/res/layout/activity_edit_account.xml @@ -57,6 +57,7 @@ app:riv_corner_radius="5dp" /> <LinearLayout + android:id="@+id/jid_password_box" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@+id/avater" @@ -163,6 +164,35 @@ android:layout_marginTop="8dp" android:text="@string/register_account" /> </LinearLayout> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_below="@id/jid_password_box" + android:orientation="vertical"> + + <Button + android:id="@+id/show_privacy_policy" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_centerHorizontal="true" + android:layout_gravity="center_horizontal" + android:layout_marginBottom="4dp" + android:layout_marginTop="4dp" + android:text="@string/show_privacy" + android:visibility="gone" /> + + <Button + android:id="@+id/show_terms_of_use" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_centerHorizontal="true" + android:layout_gravity="center_horizontal" + android:layout_marginBottom="4dp" + android:layout_marginTop="4dp" + android:text="@string/show_termsofuse" + android:visibility="gone" /> + </LinearLayout> </RelativeLayout> </android.support.v7.widget.CardView> |