UntrackMe-app-android-redir.../app/src/main/java/app/fedilab/nitterizeme/activities/AboutActivity.java

138 lines
5.7 KiB
Java
Raw Normal View History

2020-04-15 17:51:18 +02:00
package app.fedilab.nitterizeme.activities;
2020-01-25 10:25:02 +01:00
/* Copyright 2020 Thomas Schneider
*
2020-04-10 17:25:19 +02:00
* This file is a part of UntrackMe
2020-01-25 10:25:02 +01:00
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
* License, or (at your option) any later version.
*
2020-04-10 17:25:19 +02:00
* UntrackMe is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
2020-01-25 10:25:02 +01:00
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
2020-04-10 17:25:19 +02:00
* You should have received a copy of the GNU General Public License along with UntrackMe; if not,
2020-01-25 10:25:02 +01:00
* see <http://www.gnu.org/licenses>. */
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.text.SpannableString;
import android.text.style.ForegroundColorSpan;
import android.text.style.UnderlineSpan;
import android.view.MenuItem;
2020-12-01 10:29:24 +01:00
import android.view.View;
2020-01-25 10:25:02 +01:00
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
2020-05-04 17:27:41 +02:00
import app.fedilab.nitterizeme.BuildConfig;
2020-04-15 17:51:18 +02:00
import app.fedilab.nitterizeme.R;
2020-12-01 10:29:24 +01:00
import app.fedilab.nitterizeme.databinding.ActivityAboutBinding;
2020-04-15 17:51:18 +02:00
2020-01-25 10:25:02 +01:00
public class AboutActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
2020-12-01 10:29:24 +01:00
ActivityAboutBinding binding = ActivityAboutBinding.inflate(getLayoutInflater());
View viewRoot = binding.getRoot();
setContentView(viewRoot);
2020-01-25 10:25:02 +01:00
try {
PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
String version = pInfo.versionName;
2020-12-01 10:29:24 +01:00
binding.aboutVersion.setText(getResources().getString(R.string.about_vesrion, version));
2020-02-18 12:25:20 +01:00
} catch (PackageManager.NameNotFoundException ignored) {
}
2020-01-25 10:25:02 +01:00
setTitle(R.string.about_the_app);
2020-02-18 12:25:20 +01:00
if (getSupportActionBar() != null) {
2020-01-25 10:25:02 +01:00
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
}
//Developer click for Mastodon account
2020-12-01 10:29:24 +01:00
SpannableString content = new SpannableString(binding.developerMastodon.getText().toString());
2020-02-18 12:25:20 +01:00
content.setSpan(new ForegroundColorSpan(ContextCompat.getColor(AboutActivity.this, R.color.colorAccent)), 0, content.length(), 0);
2020-12-01 10:29:24 +01:00
binding.developerMastodon.setText(content);
binding.developerMastodon.setOnClickListener(v -> {
2021-10-25 12:14:43 +02:00
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://toot.fedilab.app/@apps"));
2020-01-25 10:25:02 +01:00
startActivity(browserIntent);
});
2020-05-04 17:27:41 +02:00
//App Name:
2020-12-01 10:29:24 +01:00
2020-05-04 17:27:41 +02:00
if (BuildConfig.fullLinks) {
2020-12-01 10:29:24 +01:00
binding.appName.setText(R.string.app_name);
2020-05-04 17:27:41 +02:00
} else {
2020-12-01 10:29:24 +01:00
binding.appName.setText(R.string.app_name_lite);
2020-05-04 17:27:41 +02:00
}
2020-01-25 10:25:02 +01:00
//Developer Github
2020-12-01 10:29:24 +01:00
content = new SpannableString(binding.github.getText().toString());
2020-01-25 10:25:02 +01:00
content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
2020-12-01 10:29:24 +01:00
binding.github.setText(content);
binding.github.setOnClickListener(v -> {
2020-01-25 10:25:02 +01:00
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/stom79"));
startActivity(browserIntent);
});
//Developer Framagit
2020-12-01 10:29:24 +01:00
content = new SpannableString(binding.framagit.getText().toString());
2020-01-25 10:25:02 +01:00
content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
2020-12-01 10:29:24 +01:00
binding.framagit.setText(content);
binding.framagit.setOnClickListener(v -> {
2022-07-19 22:19:05 +02:00
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://framagit.org/tom79"));
2020-01-25 10:25:02 +01:00
startActivity(browserIntent);
});
//Developer Codeberg
2020-12-01 10:29:24 +01:00
content = new SpannableString(binding.codeberg.getText().toString());
2020-01-25 10:25:02 +01:00
content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
2020-12-01 10:29:24 +01:00
binding.codeberg.setText(content);
binding.codeberg.setOnClickListener(v -> {
2020-01-25 10:25:02 +01:00
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://codeberg.org/tom79"));
startActivity(browserIntent);
});
//Developer donation
2020-12-01 10:29:24 +01:00
binding.donatePaypal.setOnClickListener(v -> {
2020-02-19 17:42:49 +01:00
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.paypal.me/Mastalab"));
startActivity(browserIntent);
2020-01-25 10:25:02 +01:00
});
2020-12-01 10:29:24 +01:00
binding.donateLiberapay.setOnClickListener(v -> {
2020-06-05 18:47:20 +02:00
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://liberapay.com/tom79"));
2020-02-19 17:42:49 +01:00
startActivity(browserIntent);
2020-02-17 17:32:28 +01:00
});
2020-01-25 10:25:02 +01:00
2020-12-01 10:29:24 +01:00
binding.howTo.setOnClickListener(v -> {
2020-05-31 18:34:22 +02:00
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://fedilab.app/wiki/untrackme/"));
2020-02-17 17:59:06 +01:00
startActivity(browserIntent);
});
2020-12-01 10:29:24 +01:00
content = new SpannableString(binding.license.getText().toString());
2020-02-18 12:25:20 +01:00
content.setSpan(new ForegroundColorSpan(ContextCompat.getColor(AboutActivity.this, R.color.colorAccent)), 0, content.length(), 0);
2020-01-25 10:25:02 +01:00
content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
2020-12-01 10:29:24 +01:00
binding.license.setText(content);
binding.license.setOnClickListener(v -> {
2020-01-25 10:25:02 +01:00
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.gnu.org/licenses/quick-guide-gplv3.fr.html"));
startActivity(browserIntent);
});
}
2020-02-17 17:59:06 +01:00
2020-01-25 10:25:02 +01:00
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
}