show buttons to privacy policy and terms of use during account creation on our server pix-art.de

This commit is contained in:
Christian Schneppe 2018-05-27 00:36:38 +02:00
parent 0444ee9d4a
commit a6207e7b14
2 changed files with 54 additions and 0 deletions

View file

@ -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

View file

@ -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>