From 5ee125a9af4a284c539865ce5e19565435176ee7 Mon Sep 17 00:00:00 2001
From: Rahul Kumar <rahulkumar2048@gmail.com>
Date: Mon, 6 Apr 2020 00:28:31 +0530
Subject: [PATCH] Optimize Interstial Ads

---
 app/src/main/AndroidManifest.xml              |  1 -
 .../app/ui/MainActivity.java                  | 32 ++++++++-----------
 .../ui/fragments/BuildPropEditorFragment.java |  9 ++++--
 .../ui/fragments/CpuFrequencyFragment.java    | 12 ++-----
 .../app/ui/fragments/CpuHotplugFragment.java  |  4 +++
 .../app/ui/fragments/GpuControlFragment.java  |  5 +++
 .../app/ui/fragments/IOControlFragment.java   |  4 +++
 .../app/ui/fragments/SettingsFragment.java    | 11 +++++++
 .../ui/fragments/TimeInStatesFragment.java    |  6 ++++
 .../ui/fragments/VirtualMemoryFragment.java   |  4 +++
 .../app/utils/Constants.java                  |  4 +--
 .../app/utils/FANInterstialHelper.java        | 10 +++---
 .../layout/fragment_main_layout_navbar.xml    |  1 +
 .../res/layout/fragment_pref_container.xml    | 19 ++++++-----
 .../main/res/menu/navigation_drawer_menu.xml  | 12 +++----
 15 files changed, 79 insertions(+), 55 deletions(-)

diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index eed5105..cb4a4f9 100755
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -3,7 +3,6 @@
     package="com.performancetweaker.app"
     android:installLocation="internalOnly">
 
-    <uses-permission android:name="android.permission.INTERNET" />
     <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
     <uses-permission android:name="android.permission.ACCESS_SUPERUSER" />
     <uses-permission android:name="android.permission.BATTERY_STATS" />
diff --git a/app/src/main/java/com/performancetweaker/app/ui/MainActivity.java b/app/src/main/java/com/performancetweaker/app/ui/MainActivity.java
index 1a905d6..1ba981f 100755
--- a/app/src/main/java/com/performancetweaker/app/ui/MainActivity.java
+++ b/app/src/main/java/com/performancetweaker/app/ui/MainActivity.java
@@ -14,7 +14,6 @@
 import android.widget.LinearLayout;
 import android.widget.ProgressBar;
 import android.widget.TextView;
-import android.widget.Toast;
 
 import androidx.appcompat.app.ActionBar;
 import androidx.appcompat.app.ActionBarDrawerToggle;
@@ -39,7 +38,6 @@
 import com.performancetweaker.app.ui.fragments.SettingsFragment;
 import com.performancetweaker.app.ui.fragments.TimeInStatesFragment;
 import com.performancetweaker.app.ui.fragments.VirtualMemoryFragment;
-import com.performancetweaker.app.ui.fragments.WakeLocksFragment;
 import com.performancetweaker.app.utils.CPUHotplugUtils;
 import com.performancetweaker.app.utils.Constants;
 import com.performancetweaker.app.utils.FANInterstialHelper;
@@ -60,6 +58,7 @@ public class MainActivity extends AppCompatActivity
     private GpuUtils gpuUtils;
     private AdView adView;
     private LinearLayout adContainer;
+    private FANInterstialHelper fanInterstialHelper;
     private String TAG = Constants.App_Tag;
 
     @Override
@@ -76,7 +75,6 @@ protected void onCreate(Bundle savedInstanceState) {
 
         setSupportActionBar(toolbar);
         actionBar = getSupportActionBar();
-
         adView = new AdView(this, Constants.BANNER_AD_PLACEMENT_ID, AdSize.BANNER_HEIGHT_50);
         adContainer.addView(adView);
         adView.setAdListener(new AdListener() {
@@ -87,23 +85,22 @@ public void onError(Ad ad, AdError adError) {
 
             @Override
             public void onAdLoaded(Ad ad) {
-                Log.e(TAG, "BANNER-AD: loaded successfully");
+                Log.i(TAG, "BANNER-AD: loaded successfully");
             }
 
             @Override
             public void onAdClicked(Ad ad) {
-                Log.e(TAG, "BANNER-AD: clicked");
+                Log.i(TAG, "BANNER-AD: clicked");
             }
 
             @Override
             public void onLoggingImpression(Ad ad) {
-                Log.e(TAG, "BANNER-AD: logging impression");
+                Log.i(TAG, "BANNER-AD: logging impression");
             }
         });
         adView.loadAd();
-        FANInterstialHelper helper = FANInterstialHelper.getInstance(this);
-        helper.loadAd();
-        helper.showAd();
+        fanInterstialHelper = FANInterstialHelper.getInstance(getBaseContext());
+        fanInterstialHelper.loadAd();
 
         //disable the navigation bar initially
         mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
@@ -133,6 +130,7 @@ protected void onDestroy() {
         if (adView != null) {
             adView.destroy();
         }
+        fanInterstialHelper.destroyAd();
         super.onDestroy();
     }
 
@@ -179,10 +177,10 @@ public void run() {
                         fragment = new IOControlFragment();
                         actionBar.setTitle(getString(R.string.io));
                         break;
-                    case R.id.nav_wakelocks:
-                        fragment = new WakeLocksFragment();
-                        actionBar.setTitle(getString(R.string.wakelocks));
-                        break;
+//                    case R.id.nav_wakelocks:
+//                        fragment = new WakeLocksFragment();
+//                        actionBar.setTitle(getString(R.string.wakelocks));
+//                        break;
                     case R.id.nav_settings:
                         fragment = new SettingsFragment();
                         actionBar.setTitle(getString(R.string.settings));
@@ -203,7 +201,6 @@ public void run() {
                         fragment = new CpuHotplugFragment();
                         actionBar.setTitle(getString(R.string.cpu_hotplug));
                         break;
-
                 }
                 if (fragment != null) {
                     FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
@@ -256,7 +253,6 @@ protected void onPostExecute(Void aVoid) {
             if (hasRoot && hasBusyBox) {
                 populateGui();
             } else {
-
                 progressBar.setVisibility(View.GONE);
 
                 appCompatibilityMessage.setVisibility(View.VISIBLE);
@@ -264,14 +260,12 @@ protected void onPostExecute(Void aVoid) {
                         .setText(!hasRoot ? "No root access found" : "No Busybox found");
 
                 if (hasRoot) {
-                    //TODO redirect to playstore for installing busybox
                     try {
-                        startActivity(
-                                new Intent(Intent.ACTION_VIEW, Uri
-                                        .parse("market://details?id=stericson.busybox")));
+                        startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=stericson.busybox")));
                     } catch (ActivityNotFoundException ignored) {
                     }
                 }
+                fanInterstialHelper.showAd();
             }
         }
     }
diff --git a/app/src/main/java/com/performancetweaker/app/ui/fragments/BuildPropEditorFragment.java b/app/src/main/java/com/performancetweaker/app/ui/fragments/BuildPropEditorFragment.java
index c441dda..5f391c4 100755
--- a/app/src/main/java/com/performancetweaker/app/ui/fragments/BuildPropEditorFragment.java
+++ b/app/src/main/java/com/performancetweaker/app/ui/fragments/BuildPropEditorFragment.java
@@ -26,6 +26,7 @@
 
 import com.performancetweaker.app.R;
 import com.performancetweaker.app.utils.BuildPropUtils;
+import com.performancetweaker.app.utils.FANInterstialHelper;
 
 import java.util.LinkedHashMap;
 
@@ -40,6 +41,7 @@ public class BuildPropEditorFragment extends PreferenceFragment
     Context context;
 
     ProgressBar progressBar;
+    FANInterstialHelper fanInterstialHelper;
 
     @Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container,
@@ -56,6 +58,7 @@ public void onCreate(Bundle savedInstanceState) {
         progressBar.setVisibility(View.VISIBLE);
 
         context = getActivity();
+        fanInterstialHelper = FANInterstialHelper.getInstance(getActivity());
     }
 
     @Override
@@ -66,6 +69,7 @@ public void onResume() {
 
     @Override
     public boolean onPreferenceChange(Preference preference, Object o) {
+        fanInterstialHelper.showAd();
         BuildPropUtils.overwrite(preference.getKey(), preference.getSummary().toString(),
                 preference.getKey(), o.toString());
         preference.setSummary(o.toString());
@@ -132,7 +136,6 @@ public boolean onOptionsItemSelected(MenuItem item) {
     }
 
     private void editBuildPropDialog() {
-
         Activity activity = getActivity();
         final View editDialog =
                 LayoutInflater.from(getActivity()).inflate(R.layout.dialog_build_prop, null, false);
@@ -149,6 +152,7 @@ public void onClick(DialogInterface dialog, int which) {
                     .setPositiveButton("OK", new DialogInterface.OnClickListener() {
                         @Override
                         public void onClick(DialogInterface dialog, int which) {
+                            fanInterstialHelper.showAd();
                             if (etValue.getText() != null && etName.getText() != null) {
                                 BuildPropUtils.addKey(etName.getText().toString().trim(),
                                         etValue.getText().toString().trim());
@@ -156,8 +160,7 @@ public void onClick(DialogInterface dialog, int which) {
                                 return;
                             }
                         }
-                    })
-                    .show();
+                    }).show();
         }
     }
 
diff --git a/app/src/main/java/com/performancetweaker/app/ui/fragments/CpuFrequencyFragment.java b/app/src/main/java/com/performancetweaker/app/ui/fragments/CpuFrequencyFragment.java
index 9b2a811..5e93316 100755
--- a/app/src/main/java/com/performancetweaker/app/ui/fragments/CpuFrequencyFragment.java
+++ b/app/src/main/java/com/performancetweaker/app/ui/fragments/CpuFrequencyFragment.java
@@ -57,6 +57,9 @@ public void onCreate(Bundle savedInstanceState) {
         CpuMaxFreqPreference.setOnPreferenceChangeListener(this);
         CpuMinFreqPreference.setOnPreferenceChangeListener(this);
         GovernorPreference.setOnPreferenceChangeListener(this);
+
+        fanInterstialHelper = FANInterstialHelper.getInstance(getActivity());
+        fanInterstialHelper.loadAd();
     }
 
     @Override
@@ -64,15 +67,6 @@ public void onResume() {
         super.onResume();
         updatePreferences();
         progressBar.setVisibility(View.GONE);
-        fanInterstialHelper = FANInterstialHelper.getInstance(context);
-        fanInterstialHelper.loadAd();
-    }
-
-    @Override
-    public void onDestroy() {
-        fanInterstialHelper.destroyAd();
-        super.onDestroy();
-
     }
 
     public void populatePreferences() {
diff --git a/app/src/main/java/com/performancetweaker/app/ui/fragments/CpuHotplugFragment.java b/app/src/main/java/com/performancetweaker/app/ui/fragments/CpuHotplugFragment.java
index 6584e53..ad007d7 100755
--- a/app/src/main/java/com/performancetweaker/app/ui/fragments/CpuHotplugFragment.java
+++ b/app/src/main/java/com/performancetweaker/app/ui/fragments/CpuHotplugFragment.java
@@ -12,12 +12,14 @@
 import com.performancetweaker.app.R;
 import com.performancetweaker.app.utils.CPUHotplugUtils;
 import com.performancetweaker.app.utils.Constants;
+import com.performancetweaker.app.utils.FANInterstialHelper;
 
 public class CpuHotplugFragment extends PreferenceFragment
         implements Preference.OnPreferenceChangeListener {
 
     Context context;
     SwitchPreference switchPreference;
+    FANInterstialHelper fanInterstialHelper;
 
     @Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container,
@@ -32,6 +34,7 @@ public void onActivityCreated(Bundle savedInstanceState) {
         addPreferencesFromResource(R.xml.cpu_hotplug_preferences);
         switchPreference = (SwitchPreference) findPreference(Constants.PREF_HOTPLUG);
         context = getActivity().getBaseContext();
+        fanInterstialHelper = FANInterstialHelper.getInstance(getActivity());
     }
 
     @Override
@@ -44,6 +47,7 @@ public void onResume() {
 
     @Override
     public boolean onPreferenceChange(Preference preference, Object newValue) {
+        fanInterstialHelper.showAd();
         CPUHotplugUtils.activateMpdecision(Boolean.parseBoolean(newValue.toString()));
         switchPreference.setChecked(CPUHotplugUtils.isMpdecisionActive());
         return Boolean.parseBoolean(newValue.toString());
diff --git a/app/src/main/java/com/performancetweaker/app/ui/fragments/GpuControlFragment.java b/app/src/main/java/com/performancetweaker/app/ui/fragments/GpuControlFragment.java
index aa76904..ccc4315 100755
--- a/app/src/main/java/com/performancetweaker/app/ui/fragments/GpuControlFragment.java
+++ b/app/src/main/java/com/performancetweaker/app/ui/fragments/GpuControlFragment.java
@@ -11,6 +11,7 @@
 
 import com.performancetweaker.app.R;
 import com.performancetweaker.app.utils.Constants;
+import com.performancetweaker.app.utils.FANInterstialHelper;
 import com.performancetweaker.app.utils.GpuUtils;
 
 public class GpuControlFragment extends PreferenceFragment
@@ -27,6 +28,7 @@ public class GpuControlFragment extends PreferenceFragment
     String minFrequency;
     String currentGovernor;
     GpuUtils gpuUtils;
+    FANInterstialHelper fanInterstialHelper;
 
     @Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container,
@@ -54,6 +56,8 @@ public void onCreate(Bundle savedInstanceState) {
         maxGpuFrequencyPreference.setOnPreferenceChangeListener(this);
         minGpuFrequencyPreference.setOnPreferenceChangeListener(this);
         availableGpuGovernorPreference.setOnPreferenceChangeListener(this);
+
+        fanInterstialHelper = FANInterstialHelper.getInstance(getActivity());
     }
 
     @Override
@@ -103,6 +107,7 @@ public void updatePreferences() {
 
     @Override
     public boolean onPreferenceChange(Preference preference, Object value) {
+        fanInterstialHelper.showAd();
         if (preference.getKey().equals(Constants.PREF_GPU_MAX)) {
             gpuUtils.setMaxGpuFrequency(value.toString(), getActivity().getBaseContext());
         } else if (preference.getKey().equals(Constants.PREF_GPU_MIN)) {
diff --git a/app/src/main/java/com/performancetweaker/app/ui/fragments/IOControlFragment.java b/app/src/main/java/com/performancetweaker/app/ui/fragments/IOControlFragment.java
index 5a079cd..adc6299 100755
--- a/app/src/main/java/com/performancetweaker/app/ui/fragments/IOControlFragment.java
+++ b/app/src/main/java/com/performancetweaker/app/ui/fragments/IOControlFragment.java
@@ -11,6 +11,7 @@
 
 import com.performancetweaker.app.R;
 import com.performancetweaker.app.utils.Constants;
+import com.performancetweaker.app.utils.FANInterstialHelper;
 import com.performancetweaker.app.utils.IOUtils;
 
 public class IOControlFragment extends PreferenceFragment
@@ -23,6 +24,7 @@ public class IOControlFragment extends PreferenceFragment
     ListPreference IOScheduler;
     ListPreference ReadAheadCache;
     Context context;
+    FANInterstialHelper fanInterstialHelper;
 
     @Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container,
@@ -44,6 +46,7 @@ public void onActivityCreated(Bundle savedInstanceState) {
 
         IOScheduler.setOnPreferenceChangeListener(this);
         ReadAheadCache.setOnPreferenceChangeListener(this);
+        fanInterstialHelper = FANInterstialHelper.getInstance(getActivity());
     }
 
     private void populatePreferences() {
@@ -91,6 +94,7 @@ public void updateData() {
     }
 
     public void updatePreferences() {
+        fanInterstialHelper.showAd();
         IOScheduler.setSummary(currentScheduler);
         ReadAheadCache.setSummary(currentReadAhead);
     }
diff --git a/app/src/main/java/com/performancetweaker/app/ui/fragments/SettingsFragment.java b/app/src/main/java/com/performancetweaker/app/ui/fragments/SettingsFragment.java
index 14c32da..9d77e4f 100755
--- a/app/src/main/java/com/performancetweaker/app/ui/fragments/SettingsFragment.java
+++ b/app/src/main/java/com/performancetweaker/app/ui/fragments/SettingsFragment.java
@@ -12,6 +12,7 @@
 
 import com.performancetweaker.app.R;
 import com.performancetweaker.app.utils.Constants;
+import com.performancetweaker.app.utils.FANInterstialHelper;
 import com.performancetweaker.app.utils.GpuUtils;
 import com.performancetweaker.app.utils.SystemAppUtilities;
 
@@ -22,6 +23,7 @@ public class SettingsFragment extends PreferenceFragment {
     MultiSelectListPreference mMultiSelectListPreference;
     Preference uninstallSystemAppButton;
     GpuUtils gpuUtils;
+    FANInterstialHelper fanInterstialHelper;
 
     @Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container,
@@ -42,6 +44,7 @@ public void onCreate(Bundle paramBundle) {
         uninstallSystemAppButton.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
             @Override
             public boolean onPreferenceClick(Preference preference) {
+                fanInterstialHelper.showAd();
                 Boolean status = SystemAppUtilities.uninstallAsSystemApp(Constants.APK_NAME);
                 if(status) {
                     if(!SystemAppUtilities.isSystemApp(Constants.APK_NAME)) {
@@ -70,9 +73,17 @@ public boolean onPreferenceClick(Preference preference) {
         }
         mMultiSelectListPreference.setEntries(charSequences);
         mMultiSelectListPreference.setEntryValues(charSequences);
+        mMultiSelectListPreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
+            @Override
+            public boolean onPreferenceChange(Preference preference, Object newValue) {
+                fanInterstialHelper.showAd();
+                return true;
+            }
+        });
 
         if(!SystemAppUtilities.isSystemApp(Constants.APK_NAME)) {
             preferenceCategory.removePreference(uninstallSystemAppButton);
         }
+        fanInterstialHelper = FANInterstialHelper.getInstance(getActivity());
     }
 }
diff --git a/app/src/main/java/com/performancetweaker/app/ui/fragments/TimeInStatesFragment.java b/app/src/main/java/com/performancetweaker/app/ui/fragments/TimeInStatesFragment.java
index cf5abfb..8e2a2a7 100755
--- a/app/src/main/java/com/performancetweaker/app/ui/fragments/TimeInStatesFragment.java
+++ b/app/src/main/java/com/performancetweaker/app/ui/fragments/TimeInStatesFragment.java
@@ -19,6 +19,7 @@
 import com.performancetweaker.app.R;
 import com.performancetweaker.app.ui.adapters.TimeInStatesListAdapter;
 import com.performancetweaker.app.utils.Constants;
+import com.performancetweaker.app.utils.FANInterstialHelper;
 import com.performancetweaker.app.utils.SysUtils;
 
 public class TimeInStatesFragment extends Fragment {
@@ -31,6 +32,7 @@ public class TimeInStatesFragment extends Fragment {
     Context context;
     CardView cardView;
     Integer adClickThreshold = 0;
+    FANInterstialHelper fanInterstialHelper;
 
     @Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container,
@@ -64,6 +66,7 @@ public void onActivityCreated(Bundle savedInstanceState) {
 
         totalTimeInState.setText(SysUtils.secToString(timeInStateAdapter.totaltime / 100));
         timeInStateAdapter.refresh();
+        fanInterstialHelper = FANInterstialHelper.getInstance(getActivity());
     }
 
     @Override
@@ -94,6 +97,9 @@ public boolean onOptionsItemSelected(MenuItem item) {
             default:
                 break;
         }
+        if (adClickThreshold % 2 == 0) {
+            fanInterstialHelper.showAd();
+        }
         return super.onOptionsItemSelected(item);
     }
 }
diff --git a/app/src/main/java/com/performancetweaker/app/ui/fragments/VirtualMemoryFragment.java b/app/src/main/java/com/performancetweaker/app/ui/fragments/VirtualMemoryFragment.java
index 44affbb..e340a10 100755
--- a/app/src/main/java/com/performancetweaker/app/ui/fragments/VirtualMemoryFragment.java
+++ b/app/src/main/java/com/performancetweaker/app/ui/fragments/VirtualMemoryFragment.java
@@ -13,6 +13,7 @@
 import android.widget.ProgressBar;
 
 import com.performancetweaker.app.R;
+import com.performancetweaker.app.utils.FANInterstialHelper;
 import com.performancetweaker.app.utils.VmUtils;
 
 import java.util.LinkedHashMap;
@@ -25,6 +26,7 @@ public class VirtualMemoryFragment extends PreferenceFragment
     EditTextPreference editTextPreferences[];
     LinkedHashMap<String, String> vmEntries = new LinkedHashMap<>();
     ProgressBar progressBar;
+    FANInterstialHelper fanInterstialHelper;
 
     @Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container,
@@ -38,6 +40,7 @@ public void onCreate(Bundle savedInstanceState) {
         progressBar = (ProgressBar) getActivity().findViewById(R.id.loading_main);
         progressBar.setVisibility(View.VISIBLE);
         context = getActivity();
+        fanInterstialHelper = FANInterstialHelper.getInstance(context);
     }
 
     @Override
@@ -48,6 +51,7 @@ public void onResume() {
 
     @Override
     public boolean onPreferenceChange(Preference preference, Object newValue) {
+        fanInterstialHelper.showAd();
         VmUtils.setVM(newValue.toString(), preference.getKey());
         preference.setSummary(VmUtils.getVMValue(preference.getKey()));
         return true;
diff --git a/app/src/main/java/com/performancetweaker/app/utils/Constants.java b/app/src/main/java/com/performancetweaker/app/utils/Constants.java
index 03209e0..3d76613 100755
--- a/app/src/main/java/com/performancetweaker/app/utils/Constants.java
+++ b/app/src/main/java/com/performancetweaker/app/utils/Constants.java
@@ -78,6 +78,6 @@ public interface Constants {
 
     String APK_NAME = "performancetweaker.apk";
 
-    String INTERSTITIAL_AD_PLACEMENT_ID = "2399395553684712_2399705310320403";
-    String BANNER_AD_PLACEMENT_ID =  "IMG_16_9_APP_INSTALL#2399395553684712_2399477567009844";
+    String INTERSTITIAL_AD_PLACEMENT_ID = (BuildConfig.BUILD_TYPE == "debug" ? "IMG_16_9_APP_INSTALL#" : "") + "2399395553684712_2400349406922660";
+    String BANNER_AD_PLACEMENT_ID = (BuildConfig.BUILD_TYPE == "debug" ? "IMG_16_9_APP_INSTALL#" : "") + "2399395553684712_2400350063589261";
 }
diff --git a/app/src/main/java/com/performancetweaker/app/utils/FANInterstialHelper.java b/app/src/main/java/com/performancetweaker/app/utils/FANInterstialHelper.java
index 1324883..189c898 100644
--- a/app/src/main/java/com/performancetweaker/app/utils/FANInterstialHelper.java
+++ b/app/src/main/java/com/performancetweaker/app/utils/FANInterstialHelper.java
@@ -19,12 +19,12 @@ private FANInterstialHelper(Context context) {
         interstitialAd.setAdListener(new InterstitialAdListener() {
             @Override
             public void onInterstitialDisplayed(Ad ad) {
-                Log.e(TAG, "FAN Interstitial ad displayed.");
+                Log.i(TAG, "FAN Interstitial ad displayed.");
             }
 
             @Override
             public void onInterstitialDismissed(Ad ad) {
-                Log.e(TAG, "FAN Interstitial ad dismissed.");
+                Log.i(TAG, "FAN Interstitial ad dismissed.");
                 interstitialAd.loadAd();
             }
 
@@ -35,17 +35,17 @@ public void onError(Ad ad, AdError adError) {
 
             @Override
             public void onAdLoaded(Ad ad) {
-                Log.d(TAG, "FAN: Interstitial ad is loaded and ready to be displayed!");
+                Log.i(TAG, "FAN: Interstitial ad is loaded and ready to be displayed!");
             }
 
             @Override
             public void onAdClicked(Ad ad) {
-                Log.d(TAG, "FAN Interstitial ad clicked!");
+                Log.i(TAG, "FAN Interstitial ad clicked!");
             }
 
             @Override
             public void onLoggingImpression(Ad ad) {
-                Log.d(TAG, "FAN Interstitial ad impression logged!");
+                Log.i(TAG, "FAN Interstitial ad impression logged!");
             }
         });
     }
diff --git a/app/src/main/res/layout/fragment_main_layout_navbar.xml b/app/src/main/res/layout/fragment_main_layout_navbar.xml
index ae61652..2d7aba6 100755
--- a/app/src/main/res/layout/fragment_main_layout_navbar.xml
+++ b/app/src/main/res/layout/fragment_main_layout_navbar.xml
@@ -39,6 +39,7 @@
                 android:layout_width="match_parent"
                 android:layout_height="match_parent"
                 android:orientation="vertical"
+                android:layout_marginBottom="50px"
                 android:scrollbarStyle="outsideOverlay" >
             </LinearLayout>
 
diff --git a/app/src/main/res/layout/fragment_pref_container.xml b/app/src/main/res/layout/fragment_pref_container.xml
index 1ce46fd..d4ff5df 100755
--- a/app/src/main/res/layout/fragment_pref_container.xml
+++ b/app/src/main/res/layout/fragment_pref_container.xml
@@ -1,17 +1,16 @@
 <?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="match_parent"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
     android:orientation="vertical">
 
     <androidx.cardview.widget.CardView
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginLeft="8dp"
-            android:layout_marginRight="8dp"
-            android:layout_marginTop="8dp"
-    >
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginLeft="8dp"
+        android:layout_marginTop="8dp"
+        android:layout_marginRight="8dp"
+        android:layout_marginBottom="40dp">
         <!-- Dirty hack to inflate a preferences inside a cardview-->
         <ListView
                 android:id="@android:id/list"
diff --git a/app/src/main/res/menu/navigation_drawer_menu.xml b/app/src/main/res/menu/navigation_drawer_menu.xml
index 27c8fe1..e28ddc7 100755
--- a/app/src/main/res/menu/navigation_drawer_menu.xml
+++ b/app/src/main/res/menu/navigation_drawer_menu.xml
@@ -34,9 +34,9 @@
                 android:id="@+id/stats"
                 android:checkableBehavior="single">
 
-                <item
-                    android:id="@+id/nav_wakelocks"
-                    android:title="Wakelocks" />
+<!--                <item-->
+<!--                    android:id="@+id/nav_wakelocks"-->
+<!--                    android:title="Wakelocks" />-->
 
                 <item
                     android:id="@+id/nav_tis"
@@ -71,9 +71,9 @@
                 <item
                     android:id="@+id/nav_settings"
                     android:title="Settings" />
-                <item
-                    android:id="@+id/remove_ads_1day"
-                    android:title="Remove Ads(Free)" />
+<!--                <item-->
+<!--                    android:id="@+id/remove_ads_1day"-->
+<!--                    android:title="Remove Ads(Free)" />-->
             </group>
         </menu>
     </item>