diff --git a/app/build.gradle b/app/build.gradle index f806f2682..8d45af77d 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 @@ -49,16 +57,17 @@ android { dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') - implementation 'com.android.support:appcompat-v7:26.1.0' - implementation 'com.android.support:preference-v7:26.1.0' - implementation 'com.android.support:preference-v14:26.1.0' - implementation 'com.android.support:support-v4:26.1.0' - implementation 'com.android.support:recyclerview-v7:26.1.0' - implementation 'com.android.support:design:26.1.0' + 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.1.0' - implementation 'com.android.billingclient:billing:1.0' - implementation('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') { + implementation 'com.android.billingclient:billing:dp-1' + 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