diff --git a/app/build.gradle b/app/build.gradle index b7b3c77..83e6432 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -33,13 +33,13 @@ android { productFlavors { lightningPlus { - buildConfigField "boolean", "FULL_VERSION", "true" + buildConfigField "boolean", "FULL_VERSION", "Boolean.parseBoolean(\"true\")" applicationId "acr.browser.lightning" versionCode 91 } lightningLite { - buildConfigField "boolean", "FULL_VERSION", "false" + buildConfigField "boolean", "FULL_VERSION", "Boolean.parseBoolean(\"false\")" applicationId "acr.browser.barebones" versionCode 93 } diff --git a/app/src/main/java/acr/browser/lightning/browser/BrowserPresenter.java b/app/src/main/java/acr/browser/lightning/browser/BrowserPresenter.java index 291ec1c..8aa1e5b 100644 --- a/app/src/main/java/acr/browser/lightning/browser/BrowserPresenter.java +++ b/app/src/main/java/acr/browser/lightning/browser/BrowserPresenter.java @@ -12,6 +12,7 @@ import com.anthonycr.bonsai.Schedulers; import javax.inject.Inject; +import acr.browser.lightning.BuildConfig; import acr.browser.lightning.R; import acr.browser.lightning.activity.TabsManager; import acr.browser.lightning.app.BrowserApp; @@ -317,7 +318,7 @@ public class BrowserPresenter { */ public synchronized boolean newTab(@Nullable String url, boolean show) { // Limit number of tabs for limited version of app - if (!Constants.FULL_VERSION && mTabsModel.size() >= 10) { + if (!BuildConfig.FULL_VERSION && mTabsModel.size() >= 10) { mView.showSnackbar(R.string.max_tabs); return false; } diff --git a/app/src/main/java/acr/browser/lightning/constant/Constants.java b/app/src/main/java/acr/browser/lightning/constant/Constants.java index 00c9287..2e76e78 100644 --- a/app/src/main/java/acr/browser/lightning/constant/Constants.java +++ b/app/src/main/java/acr/browser/lightning/constant/Constants.java @@ -15,8 +15,6 @@ public final class Constants { private Constants() { } - public static final boolean FULL_VERSION = BuildConfig.FULL_VERSION; - // Hardcoded user agents public static final String DESKTOP_USER_AGENT = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049.0 Safari/537.36"; public static final String MOBILE_USER_AGENT = "Mozilla/5.0 (Linux; U; Android 4.4; en-us; Nexus 4 Build/JOP24G) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30"; diff --git a/app/src/main/java/acr/browser/lightning/fragment/GeneralSettingsFragment.java b/app/src/main/java/acr/browser/lightning/fragment/GeneralSettingsFragment.java index 7365b48..da03e5d 100644 --- a/app/src/main/java/acr/browser/lightning/fragment/GeneralSettingsFragment.java +++ b/app/src/main/java/acr/browser/lightning/fragment/GeneralSettingsFragment.java @@ -22,6 +22,7 @@ import android.view.ViewGroup; import android.widget.EditText; import android.widget.LinearLayout; +import acr.browser.lightning.BuildConfig; import acr.browser.lightning.R; import acr.browser.lightning.constant.Constants; import acr.browser.lightning.dialog.BrowserDialog; @@ -151,13 +152,13 @@ public class GeneralSettingsFragment extends LightningPreferenceFragment impleme boolean imagesBool = mPreferenceManager.getBlockImagesEnabled(); boolean enableJSBool = mPreferenceManager.getJavaScriptEnabled(); - cbAds.setEnabled(Constants.FULL_VERSION); + cbAds.setEnabled(BuildConfig.FULL_VERSION); cbFlash.setEnabled(API < Build.VERSION_CODES.KITKAT); cbImages.setChecked(imagesBool); cbJsScript.setChecked(enableJSBool); cbFlash.setChecked(flashNum > 0); - cbAds.setChecked(Constants.FULL_VERSION && mPreferenceManager.getAdBlockEnabled()); + cbAds.setChecked(BuildConfig.FULL_VERSION && mPreferenceManager.getAdBlockEnabled()); cbColorMode.setChecked(mPreferenceManager.getColorModeEnabled()); } diff --git a/app/src/main/java/acr/browser/lightning/utils/AdBlock.java b/app/src/main/java/acr/browser/lightning/utils/AdBlock.java index 5c504a2..43d8f12 100644 --- a/app/src/main/java/acr/browser/lightning/utils/AdBlock.java +++ b/app/src/main/java/acr/browser/lightning/utils/AdBlock.java @@ -22,6 +22,7 @@ import java.util.Set; import javax.inject.Inject; import javax.inject.Singleton; +import acr.browser.lightning.BuildConfig; import acr.browser.lightning.constant.Constants; import acr.browser.lightning.preference.PreferenceManager; @@ -48,7 +49,7 @@ public class AdBlock { AdBlock(@NonNull Application application, @NonNull PreferenceManager preferenceManager) { mApplication = application; mPreferenceManager = preferenceManager; - if (mBlockedDomainsList.isEmpty() && Constants.FULL_VERSION) { + if (mBlockedDomainsList.isEmpty() && BuildConfig.FULL_VERSION) { loadHostsFile().subscribeOn(Schedulers.io()).subscribe(); } mBlockAds = mPreferenceManager.getAdBlockEnabled();