From 12c1a7e692468ba819b350849907c0261ee9e140 Mon Sep 17 00:00:00 2001 From: dimqua Date: Sun, 17 Sep 2017 19:50:22 +0000 Subject: [PATCH 1/2] Introduce F-Droid build flavor --- app/build.gradle | 10 ++- .../systemuituner/activites/MainActivity.java | 85 +++++++++++++++++++ app/src/fdroid/res/xml/settings_general.xml | 44 ++++++++++ .../systemuituner/activites/MainActivity.java | 0 .../res/xml/settings_general.xml | 0 5 files changed, 138 insertions(+), 1 deletion(-) create mode 100644 app/src/fdroid/java/com/zacharee1/systemuituner/activites/MainActivity.java create mode 100644 app/src/fdroid/res/xml/settings_general.xml rename app/src/{main => play}/java/com/zacharee1/systemuituner/activites/MainActivity.java (100%) rename app/src/{main => play}/res/xml/settings_general.xml (100%) diff --git a/app/build.gradle b/app/build.gradle index 7886aa54a..1056cab1f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -41,6 +41,14 @@ android { zipAlignEnabled true } } + flavorDimensions "store" + productFlavors { + play { + } + + fdroid { + } + } lintOptions { checkReleaseBuilds false // Add this abortOnError false @@ -58,7 +66,7 @@ dependencies { implementation 'com.android.support.constraint:constraint-layout:1.0.2' implementation 'com.android.support:cardview-v7:26.0.2' implementation 'com.android.billingclient:billing:dp-1' - implementation('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') { + playImplementation('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') { transitive = true } } diff --git a/app/src/fdroid/java/com/zacharee1/systemuituner/activites/MainActivity.java b/app/src/fdroid/java/com/zacharee1/systemuituner/activites/MainActivity.java new file mode 100644 index 000000000..e191c7f28 --- /dev/null +++ b/app/src/fdroid/java/com/zacharee1/systemuituner/activites/MainActivity.java @@ -0,0 +1,85 @@ +package com.zacharee1.systemuituner.activites; + +import android.content.Intent; +import android.content.SharedPreferences; +import android.preference.PreferenceManager; +import android.support.annotation.Nullable; +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; + +import com.zacharee1.systemuituner.R; +import com.zacharee1.systemuituner.misc.BillingUtil; +import com.zacharee1.systemuituner.misc.OptionSelected; +import com.zacharee1.systemuituner.misc.RecreateHandler; + +@SuppressWarnings("unused") +public class MainActivity extends AppCompatActivity +{ + @SuppressWarnings("FieldCanBeLocal") + private static boolean DARK = false; + private BillingUtil mBilling; + + @Override + protected void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + + SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); + DARK = sharedPreferences.getBoolean("dark_mode", false); + + setTheme(DARK ? R.style.AppTheme_Dark : R.style.AppTheme); + + RecreateHandler.onCreate(this); + + setContentView(R.layout.activity_main); + + mBilling = new BillingUtil(this); + } + + @Override + protected void onDestroy() + { + RecreateHandler.onDestroy(this); + super.onDestroy(); + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) + { + getMenuInflater().inflate(R.menu.menu, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) + { + return OptionSelected.doAction(item, this); + } + + public void launchList(@Nullable View v) { + startActivity(new Intent(this, ItemListActivity.class)); + } + + public void onDonatePayPalClicked(View v) { + BillingUtil.onDonatePayPalClicked(this); + } + + public void onDonate1Clicked(View v) { + mBilling.onDonateClicked("donate_1"); + } + + public void onDonate2Clicked(View v) { + mBilling.onDonateClicked("donate_2"); + } + + public void onDonate5Clicked(View v) { + mBilling.onDonateClicked("donate_5"); + } + + public void onDonate10Clicked(View v) { + mBilling.onDonateClicked("donate_10"); + } +} diff --git a/app/src/fdroid/res/xml/settings_general.xml b/app/src/fdroid/res/xml/settings_general.xml new file mode 100644 index 000000000..d279cf63e --- /dev/null +++ b/app/src/fdroid/res/xml/settings_general.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/java/com/zacharee1/systemuituner/activites/MainActivity.java b/app/src/play/java/com/zacharee1/systemuituner/activites/MainActivity.java similarity index 100% rename from app/src/main/java/com/zacharee1/systemuituner/activites/MainActivity.java rename to app/src/play/java/com/zacharee1/systemuituner/activites/MainActivity.java diff --git a/app/src/main/res/xml/settings_general.xml b/app/src/play/res/xml/settings_general.xml similarity index 100% rename from app/src/main/res/xml/settings_general.xml rename to app/src/play/res/xml/settings_general.xml From ca216e53226b59f44b1c3adb28e48e555cac3ec5 Mon Sep 17 00:00:00 2001 From: dimqua Date: Thu, 26 Oct 2017 09:47:20 +0300 Subject: [PATCH 2/2] Update --- app/build.gradle | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 7886aa54a..d1438efc0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -49,14 +49,15 @@ android { dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') - implementation 'com.android.support:appcompat-v7:26.0.2' - implementation 'com.android.support:preference-v7:26.0.2' - implementation 'com.android.support:preference-v14:26.0.2' - implementation 'com.android.support:support-v4:26.0.2' - implementation 'com.android.support:recyclerview-v7:26.0.2' - implementation 'com.android.support:design:26.0.2' + def supportLibVersion = '26.0.2' + implementation 'com.android.support:appcompat-v7:${supportLibVersion}' + implementation 'com.android.support:preference-v7:${supportLibVersion}' + implementation 'com.android.support:preference-v14:${supportLibVersion}' + implementation 'com.android.support:support-v4:${supportLibVersion}' + implementation 'com.android.support:recyclerview-v7:${supportLibVersion}' + implementation 'com.android.support:design:${supportLibVersion}' + implementation 'com.android.support:cardview-v7:${supportLibVersion}' implementation 'com.android.support.constraint:constraint-layout:1.0.2' - implementation 'com.android.support:cardview-v7:26.0.2' implementation 'com.android.billingclient:billing:dp-1' implementation('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') { transitive = true