remove Google Flavor

This commit is contained in:
Thomas 2020-02-19 17:42:49 +01:00
parent b9000d8f37
commit 01335bb36f
4 changed files with 4 additions and 94 deletions

View File

@ -11,21 +11,12 @@ android {
versionName "1.4.0"
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,18 +19,13 @@ 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;
@ -99,45 +94,13 @@ 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();
}
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.paypal.me/Mastalab"));
startActivity(browserIntent);
});
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();
}
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://liberapay.com/tom79/donate"));
startActivity(browserIntent);
});
Button how_to = findViewById(R.id.how_to);
@ -167,12 +130,4 @@ public class AboutActivity extends AppCompatActivity {
return super.onOptionsItemSelected(item);
}
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);
}
}

View File

@ -1,31 +0,0 @@
<?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

@ -40,9 +40,4 @@
<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>