Google release

This commit is contained in:
Thomas 2020-02-18 17:37:53 +01:00
parent d0657132cc
commit e6db1c3a34
5 changed files with 95 additions and 6 deletions

View File

@ -7,16 +7,26 @@ android {
applicationId "app.fedilab.nitterizeme"
minSdkVersion 15
targetSdkVersion 29
versionCode 4
versionName "1.3.0"
versionCode 5
versionName "1.3.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
flavorDimensions "default"
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
productFlavors {
fdroid {
buildConfigField "boolean", "DONATIONS", "true"
}
playstore {
buildConfigField "boolean", "DONATIONS", "false"
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8

View File

@ -19,13 +19,18 @@ import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.style.ForegroundColorSpan;
import android.text.style.UnderlineSpan;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
@ -94,13 +99,45 @@ public class AboutActivity extends AppCompatActivity {
//Developer donation
Button donatePaypal = findViewById(R.id.donate_paypal);
donatePaypal.setOnClickListener(v -> {
if (BuildConfig.DONATIONS) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.paypal.me/Mastalab"));
startActivity(browserIntent);
}else{
AlertDialog.Builder builder = new AlertDialog.Builder(AboutActivity.this);
builder.setTitle(R.string.donation_unavailable);
View view = getLayoutInflater().inflate(R.layout.popup_cannot_donate, new LinearLayout(getApplicationContext()), false);
ImageView get_fdroid = view.findViewById(R.id.get_fdroid);
get_fdroid.setOnClickListener( v1->{
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://f-droid.org/packages/app.fedilab.nitterizeme/"));
startActivity(browserIntent);
});
builder.setView(view);
builder.setPositiveButton(R.string.close, (dialog, id) -> dialog.dismiss());
TextView textView = view.findViewById(R.id.text);
setColor(textView,getString(R.string.donation_unavailable_title,"PayPal"), "PayPal", ContextCompat.getColor(AboutActivity.this, R.color.colorAccent));
builder.show();
}
});
Button donateLiberapay = findViewById(R.id.donate_liberapay);
donateLiberapay.setOnClickListener(v -> {
if (BuildConfig.DONATIONS) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://liberapay.com/tom79/donate"));
startActivity(browserIntent);
}else{
AlertDialog.Builder builder = new AlertDialog.Builder(AboutActivity.this);
builder.setTitle(R.string.donation_unavailable);
View view = getLayoutInflater().inflate(R.layout.popup_cannot_donate, new LinearLayout(getApplicationContext()), false);
ImageView get_fdroid = view.findViewById(R.id.get_fdroid);
get_fdroid.setOnClickListener( v1->{
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://f-droid.org/packages/app.fedilab.nitterizeme/"));
startActivity(browserIntent);
});
builder.setView(view);
builder.setPositiveButton(R.string.close, (dialog, id) -> dialog.dismiss());
TextView textView = view.findViewById(R.id.text);
setColor(textView,getString(R.string.donation_unavailable_title,"Liberapay"), "Liberapay", ContextCompat.getColor(AboutActivity.this, R.color.colorAccent));
builder.show();
}
});
Button how_to = findViewById(R.id.how_to);
@ -131,4 +168,11 @@ public class AboutActivity extends AppCompatActivity {
}
private void setColor(TextView view, String fulltext, String subtext, int color) {
view.setText(fulltext, TextView.BufferType.SPANNABLE);
Spannable str = (Spannable) view.getText();
int i = fulltext.indexOf(subtext);
str.setSpan(new ForegroundColorSpan(color), i, i + subtext.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="@dimen/fab_margin">
<TextView
android:layout_marginTop="10dp"
android:id="@+id/text"
android:autoLink="web"
android:textSize="16sp"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<TextView
android:layout_marginTop="20dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/get_fdroid"/>
<ImageView
android:layout_gravity="center"
android:layout_width="200dp"
android:layout_height="100dp"
android:id="@+id/get_fdroid"
android:contentDescription="@string/download_with_fdroid"
android:src="@drawable/fdroid"/>
</LinearLayout>

View File

@ -38,4 +38,8 @@
<string name="try_to_redirect">%1$s \n\nwill redirect you to\n\n<b>%2$s</b></string>
<string name="try_to_redirect_again">Then it will redirect you to\n\n<b>%1$s</b></string>
<string name="the_app_failed_shortened">The app didn\'t manage to retrieve the full URL</string>
<string name="donation_unavailable">Donations are unavailable</string>
<string name="donation_unavailable_title">This button should have redirected you to my %1$s donation page but Google does not allow it.\n\nThe best place for using and supporting FOSS apps is <a href='https://f-droid.org/'>https://f-droid.org/</a></string>
<string name="get_fdroid">Get it on F-Droid</string>
<string name="download_with_fdroid">Get the app on F-Droid</string>
</resources>