diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 86e3a0b556..99c68eb9bb 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -37,6 +37,11 @@
android:name="android.support.PARENT_ACTIVITY"
android:value="eu.kanade.mangafeed.ui.activity.MangaDetailActivity" />
+
+
diff --git a/app/src/main/java/eu/kanade/mangafeed/data/helpers/PreferencesHelper.java b/app/src/main/java/eu/kanade/mangafeed/data/helpers/PreferencesHelper.java
index 46b43e153e..072d5fa294 100644
--- a/app/src/main/java/eu/kanade/mangafeed/data/helpers/PreferencesHelper.java
+++ b/app/src/main/java/eu/kanade/mangafeed/data/helpers/PreferencesHelper.java
@@ -2,28 +2,28 @@ package eu.kanade.mangafeed.data.helpers;
import android.content.Context;
import android.content.SharedPreferences;
+import android.preference.PreferenceManager;
+
+import eu.kanade.mangafeed.R;
public class PreferencesHelper {
private static SharedPreferences mPref;
- public static final String PREF_FILE_NAME = "android_boilerplate_pref_file";
-
+ private static final String PREF_HIDE_STATUS_BAR = "hide_status_bar";
public PreferencesHelper(Context context) {
- mPref = context.getSharedPreferences(PREF_FILE_NAME, Context.MODE_PRIVATE);
+ PreferenceManager.setDefaultValues(context, R.xml.preferences, false);
+
+ mPref = PreferenceManager.getDefaultSharedPreferences(context);
}
public void clear() {
mPref.edit().clear().apply();
}
- public boolean isFirstRun() {
- return mPref.getBoolean("firstrun", true);
- }
-
- public void setNotFirstRun() {
- mPref.edit().putBoolean("firstrun", false).commit();
+ public boolean hideStatusBarSet() {
+ return mPref.getBoolean(PREF_HIDE_STATUS_BAR, false);
}
}
diff --git a/app/src/main/java/eu/kanade/mangafeed/presenter/ReaderPresenter.java b/app/src/main/java/eu/kanade/mangafeed/presenter/ReaderPresenter.java
index 669891e20f..56a8061e8f 100644
--- a/app/src/main/java/eu/kanade/mangafeed/presenter/ReaderPresenter.java
+++ b/app/src/main/java/eu/kanade/mangafeed/presenter/ReaderPresenter.java
@@ -4,7 +4,10 @@ import android.os.Bundle;
import java.util.List;
+import javax.inject.Inject;
+
import de.greenrobot.event.EventBus;
+import eu.kanade.mangafeed.data.helpers.PreferencesHelper;
import eu.kanade.mangafeed.data.models.Chapter;
import eu.kanade.mangafeed.data.models.Page;
import eu.kanade.mangafeed.sources.Source;
@@ -18,6 +21,8 @@ import rx.schedulers.Schedulers;
public class ReaderPresenter extends BasePresenter {
+ @Inject PreferencesHelper prefs;
+
private Source source;
private Chapter chapter;
private List pageList;
@@ -52,6 +57,10 @@ public class ReaderPresenter extends BasePresenter {
protected void onTakeView(ReaderActivity view) {
super.onTakeView(view);
registerForStickyEvents();
+
+ if (prefs.hideStatusBarSet()) {
+ view.hideStatusBar();
+ }
}
@Override
diff --git a/app/src/main/java/eu/kanade/mangafeed/ui/activity/MainActivity.java b/app/src/main/java/eu/kanade/mangafeed/ui/activity/MainActivity.java
index aec529b60a..34b60002be 100644
--- a/app/src/main/java/eu/kanade/mangafeed/ui/activity/MainActivity.java
+++ b/app/src/main/java/eu/kanade/mangafeed/ui/activity/MainActivity.java
@@ -1,5 +1,6 @@
package eu.kanade.mangafeed.ui.activity;
+import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
@@ -16,7 +17,6 @@ import eu.kanade.mangafeed.R;
import eu.kanade.mangafeed.ui.activity.base.BaseActivity;
import eu.kanade.mangafeed.ui.fragment.LibraryFragment;
import eu.kanade.mangafeed.ui.fragment.SourceFragment;
-import nucleus.factory.RequiresPresenter;
public class MainActivity extends BaseActivity {
@@ -54,6 +54,7 @@ public class MainActivity extends BaseActivity {
new PrimaryDrawerItem()
.withName(R.string.settings_title)
.withIdentifier(R.id.nav_drawer_settings)
+ .withSelectable(false)
)
.withSavedInstance(savedInstanceState)
.withOnDrawerItemClickListener(
@@ -70,6 +71,7 @@ public class MainActivity extends BaseActivity {
setFragment(SourceFragment.newInstance());
break;
case R.id.nav_drawer_settings:
+ startActivity(new Intent(this, SettingsActivity.class));
break;
}
}
diff --git a/app/src/main/java/eu/kanade/mangafeed/ui/activity/ReaderActivity.java b/app/src/main/java/eu/kanade/mangafeed/ui/activity/ReaderActivity.java
index ed101b0e6c..6c14a5869c 100644
--- a/app/src/main/java/eu/kanade/mangafeed/ui/activity/ReaderActivity.java
+++ b/app/src/main/java/eu/kanade/mangafeed/ui/activity/ReaderActivity.java
@@ -2,8 +2,11 @@ package eu.kanade.mangafeed.ui.activity;
import android.content.Context;
import android.content.Intent;
+import android.os.Build;
import android.os.Bundle;
import android.support.v4.view.ViewPager;
+import android.view.View;
+import android.view.WindowManager;
import android.widget.TextView;
import java.util.List;
@@ -89,4 +92,16 @@ public class ReaderActivity extends BaseRxActivity {
String page = (currentPage+1) + "/" + adapter.getCount();
pageNumber.setText(page);
}
+
+ public void hideStatusBar() {
+ if (Build.VERSION.SDK_INT < 16) {
+ getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
+ WindowManager.LayoutParams.FLAG_FULLSCREEN);
+ } else {
+ View decorView = getWindow().getDecorView();
+ int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
+ decorView.setSystemUiVisibility(uiOptions);
+ }
+
+ }
}
diff --git a/app/src/main/java/eu/kanade/mangafeed/ui/activity/SettingsActivity.java b/app/src/main/java/eu/kanade/mangafeed/ui/activity/SettingsActivity.java
new file mode 100644
index 0000000000..90da9a2628
--- /dev/null
+++ b/app/src/main/java/eu/kanade/mangafeed/ui/activity/SettingsActivity.java
@@ -0,0 +1,36 @@
+package eu.kanade.mangafeed.ui.activity;
+
+import android.os.Bundle;
+import android.preference.PreferenceFragment;
+import android.support.v7.widget.Toolbar;
+
+import butterknife.Bind;
+import butterknife.ButterKnife;
+import eu.kanade.mangafeed.R;
+import eu.kanade.mangafeed.ui.activity.base.BaseActivity;
+
+public class SettingsActivity extends BaseActivity {
+
+ @Bind(R.id.toolbar) Toolbar toolbar;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_preferences);
+ ButterKnife.bind(this);
+
+ setupToolbar(toolbar);
+
+ getFragmentManager().beginTransaction().replace(R.id.settings_content,
+ new MyPreferenceFragment()).commit();
+ }
+
+ public static class MyPreferenceFragment extends PreferenceFragment {
+ @Override
+ public void onCreate(final Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ addPreferencesFromResource(R.xml.preferences);
+ }
+ }
+
+}
diff --git a/app/src/main/java/eu/kanade/mangafeed/ui/activity/base/BaseActivity.java b/app/src/main/java/eu/kanade/mangafeed/ui/activity/base/BaseActivity.java
index b9bab9229f..72077a1a54 100644
--- a/app/src/main/java/eu/kanade/mangafeed/ui/activity/base/BaseActivity.java
+++ b/app/src/main/java/eu/kanade/mangafeed/ui/activity/base/BaseActivity.java
@@ -1,15 +1,9 @@
package eu.kanade.mangafeed.ui.activity.base;
import android.content.Context;
-import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
-import eu.kanade.mangafeed.App;
-import nucleus.factory.PresenterFactory;
-import nucleus.presenter.Presenter;
-import nucleus.view.NucleusAppCompatActivity;
-
public class BaseActivity extends AppCompatActivity {
protected void setupToolbar(Toolbar toolbar) {
diff --git a/app/src/main/java/eu/kanade/mangafeed/ui/fragment/base/BaseRxFragment.java b/app/src/main/java/eu/kanade/mangafeed/ui/fragment/base/BaseRxFragment.java
index b7f416385c..6308fcd752 100644
--- a/app/src/main/java/eu/kanade/mangafeed/ui/fragment/base/BaseRxFragment.java
+++ b/app/src/main/java/eu/kanade/mangafeed/ui/fragment/base/BaseRxFragment.java
@@ -1,7 +1,6 @@
package eu.kanade.mangafeed.ui.fragment.base;
import android.os.Bundle;
-import android.support.v4.app.Fragment;
import eu.kanade.mangafeed.App;
import nucleus.factory.PresenterFactory;
diff --git a/app/src/main/res/layout/activity_preferences.xml b/app/src/main/res/layout/activity_preferences.xml
new file mode 100644
index 0000000000..55943d6e80
--- /dev/null
+++ b/app/src/main/res/layout/activity_preferences.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index adf1611a60..b5bb1de7d5 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -46,5 +46,8 @@
Info
Chapters
ViewerActivity
+ Settings
+ Hide status bar
+ This option will hide the status bar while reading
diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml
new file mode 100644
index 0000000000..0998906adb
--- /dev/null
+++ b/app/src/main/res/xml/preferences.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
\ No newline at end of file