Welcome to mirror list, hosted at ThFree Co, Russian Federation.

AboutFragmentLicenseTab.java « about « ui « deck « nextcloud « niedermann « it « java « main « src « app - github.com/stefan-niedermann/nextcloud-deck.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3ab1ea2b13e405088573b23e3d63d5f928f5fb64 (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
package it.niedermann.nextcloud.deck.ui.about;

import android.content.Intent;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;

import butterknife.BindString;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import it.niedermann.nextcloud.deck.R;
import it.niedermann.nextcloud.deck.util.LinkUtil;

public class AboutFragmentLicenseTab extends Fragment {

    @BindView(R.id.about_icons_disclaimer)
    TextView iconsDisclaimer;
    @BindView(R.id.about_app_license_button)
    Button appLicenseButton;

    @BindString(R.string.paragraph_start)
    String paragraphStart;
    @BindString(R.string.paragraph_end)
    String paragraphEnd;

    @OnClick(R.id.about_app_license_button)
    void openLicense() {
        startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.url_license))));
    }

    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View v = inflater.inflate(R.layout.fragment_about_license_tab, container, false);
        ButterKnife.bind(this, v);
        Resources resources = getResources();
        LinkUtil.setHtml(iconsDisclaimer, paragraphStart, resources.getString(R.string.about_icons_disclaimer, getAppIconHint(resources), getMdiLink(resources)), paragraphEnd);
        return v;
    }

    private String getAppIconHint(Resources resources) {
        return LinkUtil.makeLink(resources, R.string.url_about_icon_author, R.string.about_app_icon_author_link_label) + paragraphEnd + paragraphStart;
    }

    private String getMdiLink(Resources resources) {
        return LinkUtil.makeLink(resources, R.string.url_about_icons_disclaimer_mdi, R.string.about_icons_disclaimer_mdi);
    }
}