inorichi 9 жил өмнө
parent
commit
e975860420

+ 1 - 1
app/src/main/java/eu/kanade/mangafeed/ui/viewer/RightToLeftViewer.java

@@ -21,7 +21,7 @@ public class RightToLeftViewer extends ViewPagerViewer {
         ArrayList<Page> inversedPages = new ArrayList<>(pages);
         Collections.reverse(inversedPages);
         adapter.setPages(inversedPages);
-        viewPager.setCurrentItem(adapter.getCount()-1);
+        getViewPager().setCurrentItem(adapter.getCount()-1);
     }
 
     @Override

+ 4 - 2
app/src/main/java/eu/kanade/mangafeed/ui/viewer/VerticalViewer.java

@@ -5,6 +5,8 @@ import android.widget.FrameLayout;
 
 import java.util.List;
 
+import butterknife.Bind;
+import butterknife.ButterKnife;
 import eu.kanade.mangafeed.R;
 import eu.kanade.mangafeed.data.models.Page;
 import eu.kanade.mangafeed.ui.activity.ReaderActivity;
@@ -15,15 +17,15 @@ import fr.castorflex.android.verticalviewpager.VerticalViewPager;
 
 public class VerticalViewer extends BaseViewer {
 
-    private VerticalViewPager viewPager;
+    @Bind(R.id.view_pager) VerticalViewPager viewPager;
     private ReaderPageAdapter adapter;
 
     public VerticalViewer(ReaderActivity activity, FrameLayout container) {
         super(activity, container);
         activity.getLayoutInflater().inflate(R.layout.viewer_verticalviewpager, container);
+        ButterKnife.bind(this, container);
 
         adapter = new ReaderPageAdapter(activity.getSupportFragmentManager());
-        viewPager = (VerticalViewPager) activity.findViewById(R.id.view_pager);
         viewPager.setAdapter(adapter);
         viewPager.setOffscreenPageLimit(3);
         viewPager.setOnPageChangeListener(new ReaderViewPager.OnPageChangeListener() {

+ 8 - 2
app/src/main/java/eu/kanade/mangafeed/ui/viewer/base/ViewPagerViewer.java

@@ -5,6 +5,8 @@ import android.widget.FrameLayout;
 
 import java.util.List;
 
+import butterknife.Bind;
+import butterknife.ButterKnife;
 import eu.kanade.mangafeed.R;
 import eu.kanade.mangafeed.data.models.Page;
 import eu.kanade.mangafeed.ui.activity.ReaderActivity;
@@ -13,15 +15,15 @@ import eu.kanade.mangafeed.widget.ReaderViewPager;
 
 public abstract class ViewPagerViewer extends BaseViewer {
 
-    protected ReaderViewPager viewPager;
+    @Bind(R.id.view_pager) ReaderViewPager viewPager;
     protected ReaderPageAdapter adapter;
 
     public ViewPagerViewer(ReaderActivity activity, FrameLayout container) {
         super(activity, container);
         activity.getLayoutInflater().inflate(R.layout.viewer_viewpager, container);
+        ButterKnife.bind(this, container);
 
         adapter = new ReaderPageAdapter(activity.getSupportFragmentManager());
-        viewPager = (ReaderViewPager) activity.findViewById(R.id.view_pager);
         viewPager.setAdapter(adapter);
         viewPager.setOffscreenPageLimit(3);
         viewPager.addOnPageChangeListener(new ReaderViewPager.OnPageChangeListener() {
@@ -54,6 +56,10 @@ public abstract class ViewPagerViewer extends BaseViewer {
         });
     }
 
+    public ReaderViewPager getViewPager() {
+        return viewPager;
+    }
+
     @Override
     public int getTotalPages() {
         return adapter.getCount();

+ 2 - 2
app/src/main/res/xml/pref_reader.xml

@@ -2,12 +2,12 @@
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
 
     <CheckBoxPreference android:title="@string/pref_hide_status_bar"
-        android:key="pref_hide_status_bar_key"
+        android:key="@string/pref_hide_status_bar_key"
         android:defaultValue="false"
         android:summary="@string/pref_hide_status_bar_summary" />
 
     <ListPreference android:title="@string/pref_viewer_type"
-        android:key="pref_default_viewer_key"
+        android:key="@string/pref_default_viewer_key"
         android:entries="@array/viewers"
         android:entryValues="@array/viewers_values"
         android:defaultValue="1"/>