aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/ui/AboutActivity.java
blob: 0efaa57c1ac3ae2114a64bc964c883944a94877b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package de.pixart.messenger.ui;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

import java.util.Calendar;

import de.pixart.messenger.R;
import de.pixart.messenger.utils.ThemeHelper;
import me.drakeet.support.toast.ToastCompat;

public class AboutActivity extends XmppActivity {

    private Button privacyButton;
    private Button termsOfUseButton;
    private TextView aboutmessage;

    @Override
    protected void refreshUiReal() {

    }

    @Override
    void onBackendConnected() {

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setTheme(ThemeHelper.find(this));
        setContentView(R.layout.activity_about);
        setSupportActionBar(findViewById(R.id.toolbar));
        configureActionBar(getSupportActionBar());

        aboutmessage = findViewById(R.id.aboutmessage);
        String year = String.valueOf(Calendar.getInstance().get(Calendar.YEAR));
        aboutmessage.setText(getString(R.string.pref_about_message, year));

        privacyButton = findViewById(R.id.show_privacy_policy);
        privacyButton.setOnClickListener(view -> {
            try {
                final Uri uri = Uri.parse("https://jabber.pix-art.de/privacy/");
                Intent browserIntent = new Intent(Intent.ACTION_VIEW, uri);
                startActivity(browserIntent);
            } catch (Exception e) {
                ToastCompat.makeText(this, R.string.no_application_found_to_open_link, Toast.LENGTH_SHORT).show();
            }
        });
        termsOfUseButton = findViewById(R.id.show_terms_of_use);
        termsOfUseButton.setOnClickListener(view -> {
            try {
                final Uri uri = Uri.parse("https://jabber.pix-art.de/termsofuse/");
                Intent browserIntent = new Intent(Intent.ACTION_VIEW, uri);
                startActivity(browserIntent);
            } catch (Exception e) {
                ToastCompat.makeText(this, R.string.no_application_found_to_open_link, Toast.LENGTH_SHORT).show();
            }
        });
    }
}