diff --git a/app/src/main/java/app/fedilab/android/activities/AboutActivity.java b/app/src/main/java/app/fedilab/android/activities/AboutActivity.java index 2ea60818..209351fc 100644 --- a/app/src/main/java/app/fedilab/android/activities/AboutActivity.java +++ b/app/src/main/java/app/fedilab/android/activities/AboutActivity.java @@ -15,12 +15,16 @@ package app.fedilab.android.activities; * see . */ +import android.content.ClipData; +import android.content.ClipboardManager; +import android.content.Context; import android.content.Intent; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.os.Bundle; import android.view.MenuItem; import android.view.View; +import android.widget.Toast; import androidx.core.app.ActivityOptionsCompat; import androidx.lifecycle.ViewModelProvider; @@ -40,6 +44,7 @@ import app.fedilab.android.mastodon.helper.CrossActionHelper; import app.fedilab.android.mastodon.helper.Helper; import app.fedilab.android.mastodon.helper.MastodonHelper; import app.fedilab.android.mastodon.viewmodel.mastodon.AccountsVM; +import es.dmoral.toasty.Toasty; public class AboutActivity extends BaseBarActivity { @@ -58,10 +63,10 @@ public class AboutActivity extends BaseBarActivity { if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); } - + String version = ""; try { PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0); - String version = pInfo.versionName; + version = pInfo.versionName; binding.aboutVersion.setText(getResources().getString(R.string.about_vesrion, version)); } catch (PackageManager.NameNotFoundException ignored) { } @@ -77,6 +82,20 @@ public class AboutActivity extends BaseBarActivity { } binding.aboutSupportPaypal.setOnClickListener(v -> Helper.openBrowser(AboutActivity.this, "https://www.paypal.me/Mastalab")); + + String finalVersion = version; + binding.aboutVersionCopy.setOnClickListener(v->{ + + ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); + String content = "Fedilab v" + finalVersion + " for " + (BuildConfig.DONATIONS?"FDroid":"Google"); + + ClipData clip = ClipData.newPlainText(Helper.CLIP_BOARD, content); + if (clipboard != null) { + clipboard.setPrimaryClip(clip); + Toasty.info(AboutActivity.this, getString(R.string.clipboard_version), Toast.LENGTH_LONG).show(); + } + + }); if (BuildConfig.DONATIONS) { binding.aboutSupportPaypal.setVisibility(View.VISIBLE); } else { diff --git a/app/src/main/res/layouts/mastodon/layout/activity_about.xml b/app/src/main/res/layouts/mastodon/layout/activity_about.xml index bc940ac2..4d7114ad 100644 --- a/app/src/main/res/layouts/mastodon/layout/activity_about.xml +++ b/app/src/main/res/layouts/mastodon/layout/activity_about.xml @@ -35,14 +35,32 @@ android:text="@string/app_name" android:textSize="20sp" /> - + android:gravity="center" + android:orientation="horizontal"> + + + + Add an account The content of the message has been copied to the clipboard The URL of the message has been copied to the clipboard + Information have been copied to the clipboard Camera Delete all Schedule @@ -407,6 +408,7 @@ Logout account All Copy link + Copy information http calls blocked by the application List of blocked calls Submit