mirror of
https://github.com/CatimaLoyalty/Android.git
synced 2026-02-01 10:42:01 -05:00
feature/About-Page (#440)
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
package protect.card_locker;
|
||||
|
||||
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.method.LinkMovementMethod;
|
||||
import android.util.Log;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
@@ -17,12 +19,15 @@ import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.core.text.HtmlCompat;
|
||||
|
||||
public class AboutActivity extends CatimaAppCompatActivity
|
||||
public class AboutActivity extends CatimaAppCompatActivity implements View.OnClickListener
|
||||
{
|
||||
private static final String TAG = "Catima";
|
||||
ConstraintLayout version_history, translate, license, repo, privacy, error, credits, rate;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState)
|
||||
@@ -93,39 +98,82 @@ public class AboutActivity extends CatimaAppCompatActivity
|
||||
Log.w(TAG, "Package name not found", e);
|
||||
}
|
||||
|
||||
TextView copyright = findViewById(R.id.copyright);
|
||||
copyright.setText(String.format(getString(R.string.app_copyright_fmt), year));
|
||||
TextView vHistory = findViewById(R.id.history);
|
||||
vHistory.setText(String.format(getString(R.string.debug_version_fmt), version));
|
||||
|
||||
setTitle(String.format(getString(R.string.about_title_fmt), appName));
|
||||
|
||||
TextView aboutTextView = findViewById(R.id.aboutText);
|
||||
aboutTextView.setText(HtmlCompat.fromHtml(String.format(getString(R.string.debug_version_fmt), version) +
|
||||
"<br/><br/>" +
|
||||
String.format(getString(R.string.app_revision_fmt),
|
||||
"<a href=\"" + getString(R.string.app_revision_url) + "\">" +
|
||||
"GitHub" +
|
||||
"</a>") +
|
||||
"<br/><br/>" +
|
||||
String.format(getString(R.string.app_copyright_fmt), year) +
|
||||
"<br/><br/>" +
|
||||
getString(R.string.app_copyright_old) +
|
||||
"<br/><br/>" +
|
||||
getString(R.string.app_license) +
|
||||
"<br/><br/>" +
|
||||
String.format(getString(R.string.app_contributors), contributors.toString()) +
|
||||
"<br/><br/>" +
|
||||
String.format(getString(R.string.app_libraries), libs.toString()) +
|
||||
"<br/><br/>" +
|
||||
String.format(getString(R.string.app_resources), resources.toString()), HtmlCompat.FROM_HTML_MODE_COMPACT));
|
||||
aboutTextView.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
version_history = findViewById(R.id.version_history);
|
||||
translate = findViewById(R.id.translate);
|
||||
license = findViewById(R.id.License);
|
||||
repo = findViewById(R.id.repo);
|
||||
privacy = findViewById(R.id.privacy);
|
||||
error = findViewById(R.id.report_error);
|
||||
credits = findViewById(R.id.credits);
|
||||
rate = findViewById(R.id.rate);
|
||||
|
||||
version_history.setOnClickListener(this);
|
||||
translate.setOnClickListener(this);
|
||||
license.setOnClickListener(this);
|
||||
repo.setOnClickListener(this);
|
||||
privacy.setOnClickListener(this);
|
||||
error.setOnClickListener(this);
|
||||
rate.setOnClickListener(this);
|
||||
|
||||
StringBuilder contributorInfo = new StringBuilder();
|
||||
contributorInfo.append(HtmlCompat.fromHtml(String.format(getString(R.string.app_contributors), contributors.toString()),
|
||||
HtmlCompat.FROM_HTML_MODE_COMPACT));
|
||||
credits.setOnClickListener(view -> new AlertDialog.Builder(this)
|
||||
.setTitle(R.string.credits)
|
||||
.setMessage(contributorInfo.toString())
|
||||
.setPositiveButton(R.string.ok, (dialogInterface, i) -> {})
|
||||
.show());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item)
|
||||
{
|
||||
int id = item.getItemId();
|
||||
|
||||
if (id == android.R.id.home) {
|
||||
finish();
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
if (R.id.version_history == view.getId()) {
|
||||
String url = "https://catima.app/changelog/";
|
||||
intent.setData(Uri.parse(url));
|
||||
startActivity(intent);
|
||||
} else if (R.id.translate == view.getId()) {
|
||||
String translateUrl = "https://hosted.weblate.org/engage/catima/";
|
||||
intent.setData(Uri.parse(translateUrl));
|
||||
startActivity(intent);
|
||||
} else if (R.id.License == view.getId()) {
|
||||
String licenseUrl = "https://github.com/TheLastProject/Catima/blob/master/LICENSE";
|
||||
intent.setData(Uri.parse(licenseUrl));
|
||||
startActivity(intent);
|
||||
} else if (R.id.repo == view.getId()) {
|
||||
String repo = "https://github.com/TheLastProject/Catima/";
|
||||
intent.setData(Uri.parse(repo));
|
||||
startActivity(intent);
|
||||
} else if (R.id.privacy == view.getId()) {
|
||||
String privacy = "https://catima.app/privacy-policy/";
|
||||
intent.setData(Uri.parse(privacy));
|
||||
startActivity(intent);
|
||||
} else if (R.id.report_error == view.getId()) {
|
||||
String errorUrl = "https://github.com/TheLastProject/Catima/issues";
|
||||
intent.setData(Uri.parse(errorUrl));
|
||||
startActivity(intent);
|
||||
} else if (R.id.rate == view.getId()) {
|
||||
String rateUrl = "https://play.google.com/store/apps/details?id=me.hackerchick.catima";
|
||||
intent.setData(Uri.parse(rateUrl));
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user