diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/ListView/SubscriptionExpandableListAdapter.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/ListView/SubscriptionExpandableListAdapter.java
index 05938bc7..6e052345 100644
--- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/ListView/SubscriptionExpandableListAdapter.java
+++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/ListView/SubscriptionExpandableListAdapter.java
@@ -107,16 +107,9 @@ public class SubscriptionExpandableListAdapter extends BaseExpandableListAdapter
private FavIconHandler favIconHandler;
LayoutInflater inflater;
- boolean mIsTwoPane;
- public static boolean isTwoPane(Context context) {
- return context.getResources().getBoolean(R.bool.two_pane);
- //return (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
- }
public SubscriptionExpandableListAdapter(Context mContext, DatabaseConnectionOrm dbConn, ListView listView)
{
- mIsTwoPane = isTwoPane(mContext);
-
favIconHandler = new FavIconHandler(mContext);
this.inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsReaderListActivity.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsReaderListActivity.java
index 96a06773..832cec70 100644
--- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsReaderListActivity.java
+++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsReaderListActivity.java
@@ -48,6 +48,7 @@ import android.widget.Toast;
import butterknife.ButterKnife;
import butterknife.InjectView;
+import butterknife.Optional;
import de.greenrobot.event.EventBus;
import de.luhmer.owncloudnewsreader.ListView.SubscriptionExpandableListAdapter;
import de.luhmer.owncloudnewsreader.LoginDialogFragment.LoginSuccessfullListener;
@@ -93,7 +94,7 @@ public class NewsReaderListActivity extends PodcastFragmentActivity implements
private static IReader _Reader;
@InjectView(R.id.toolbar) Toolbar toolbar;
- @InjectView(R.id.drawer_layout) protected DrawerLayout drawerLayout;
+ @Optional @InjectView(R.id.drawer_layout) protected DrawerLayout drawerLayout;
private ActionBarDrawerToggle drawerToggle;
@@ -130,30 +131,33 @@ public class NewsReaderListActivity extends PodcastFragmentActivity implements
.replace(R.id.left_drawer, newsReaderListFragment)
.commit();
- drawerToggle = new ActionBarDrawerToggle(this,drawerLayout, toolbar, R.string.empty_view_content,R.string.empty_view_content) {
- @Override
- public void onDrawerClosed(View drawerView) {
- super.onDrawerClosed(drawerView);
- togglePodcastVideoViewAnimation();
+ if(drawerLayout != null) {
+ drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, R.string.empty_view_content, R.string.empty_view_content) {
+ @Override
+ public void onDrawerClosed(View drawerView) {
+ super.onDrawerClosed(drawerView);
+ togglePodcastVideoViewAnimation();
- syncState();
- EventBus.getDefault().post(new FeedPanelSlideEvent(false));
- }
+ syncState();
+ EventBus.getDefault().post(new FeedPanelSlideEvent(false));
+ }
- @Override
- public void onDrawerOpened(View drawerView) {
- super.onDrawerOpened(drawerView);
- togglePodcastVideoViewAnimation();
- reloadCountNumbersOfSlidingPaneAdapter();
+ @Override
+ public void onDrawerOpened(View drawerView) {
+ super.onDrawerOpened(drawerView);
+ togglePodcastVideoViewAnimation();
+ reloadCountNumbersOfSlidingPaneAdapter();
- syncState();
- }
- };
+ syncState();
+ }
+ };
- drawerLayout.setDrawerListener(drawerToggle);
+ drawerLayout.setDrawerListener(drawerToggle);
+ }
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayShowHomeEnabled(true);
- drawerToggle.syncState();
+ if(drawerToggle != null)
+ drawerToggle.syncState();
if(savedInstanceState == null)//When the app starts (no orientation change)
{
@@ -226,9 +230,9 @@ public class NewsReaderListActivity extends PodcastFragmentActivity implements
StartDetailFragment(savedInstanceState.getLong(OPTIONAL_FOLDER_ID),
- savedInstanceState.getBoolean(IS_FOLDER_BOOLEAN),
- savedInstanceState.getLong(ID_FEED_STRING),
- false);
+ savedInstanceState.getBoolean(IS_FOLDER_BOOLEAN),
+ savedInstanceState.getLong(ID_FEED_STRING),
+ false);
}
}
@@ -246,13 +250,15 @@ public class NewsReaderListActivity extends PodcastFragmentActivity implements
@Override
public void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
- drawerToggle.syncState();
+ if(drawerToggle != null)
+ drawerToggle.syncState();
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
- drawerToggle.onConfigurationChanged(newConfig);
+ if(drawerToggle != null)
+ drawerToggle.onConfigurationChanged(newConfig);
}
public void reloadCountNumbersOfSlidingPaneAdapter() {
@@ -275,10 +281,6 @@ public class NewsReaderListActivity extends PodcastFragmentActivity implements
super.onResume();
}
- public boolean shouldDrawerStayOpen() {
- return getResources().getBoolean(R.bool.two_pane);
- }
-
@Override
public void onRefresh() {
startSync();
@@ -290,7 +292,7 @@ public class NewsReaderListActivity extends PodcastFragmentActivity implements
*/
@Override
public void onTopItemClicked(long idFeed, boolean isFolder, Long optional_folder_id) {
- if(!shouldDrawerStayOpen())
+ if(drawerLayout != null)
drawerLayout.closeDrawer(GravityCompat.START);
StartDetailFragment(idFeed, isFolder, optional_folder_id, true);
@@ -298,7 +300,7 @@ public class NewsReaderListActivity extends PodcastFragmentActivity implements
@Override
public void onChildItemClicked(long idFeed, Long optional_folder_id) {
- if(!shouldDrawerStayOpen())
+ if(drawerLayout != null)
drawerLayout.closeDrawer(GravityCompat.START);
//StartDetailFragment(idSubscription, false, optional_folder_id);
@@ -404,10 +406,12 @@ public class NewsReaderListActivity extends PodcastFragmentActivity implements
@Override
public void onBackPressed() {
if(handlePodcastBackPressed());
- if(drawerLayout.isDrawerOpen(GravityCompat.START))
- super.onBackPressed();
- else
- drawerLayout.openDrawer(GravityCompat.START);
+ if(drawerLayout != null) {
+ if (drawerLayout.isDrawerOpen(GravityCompat.START))
+ super.onBackPressed();
+ else
+ drawerLayout.openDrawer(GravityCompat.START);
+ }
}
private static final int RESULT_SETTINGS = 15642;
@@ -415,7 +419,7 @@ public class NewsReaderListActivity extends PodcastFragmentActivity implements
@Override
public boolean onOptionsItemSelected(MenuItem item) {
- if(drawerToggle.onOptionsItemSelected(item))
+ if(drawerToggle != null && drawerToggle.onOptionsItemSelected(item))
return true;
switch (item.getItemId()) {
diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/PodcastFragmentActivity.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/PodcastFragmentActivity.java
index 429f840b..bb449185 100644
--- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/PodcastFragmentActivity.java
+++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/PodcastFragmentActivity.java
@@ -12,6 +12,7 @@ import android.content.res.Resources;
import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
+import android.support.v4.view.GravityCompat;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.util.TypedValue;
@@ -426,17 +427,15 @@ public class PodcastFragmentActivity extends AppCompatActivity implements IPlayP
public void togglePodcastVideoViewAnimation() {
boolean isLeftSliderOpen = false;
- if(this instanceof NewsReaderListActivity) {
- isLeftSliderOpen = ((NewsReaderListActivity) this).drawerLayout.isDrawerOpen(Gravity.LEFT);
+ if(this instanceof NewsReaderListActivity && ((NewsReaderListActivity) this).drawerLayout != null) {
+ isLeftSliderOpen = ((NewsReaderListActivity) this).drawerLayout.isDrawerOpen(GravityCompat.START);
}
- boolean isTabletView = SubscriptionExpandableListAdapter.isTwoPane(this);
-
int podcastMediaControlHeightDp = pxToDp((int) getResources().getDimension(R.dimen.podcast_media_control_height));
- if(isTabletView && sliding_layout.getPanelState().equals(SlidingUpPanelLayout.PanelState.EXPANDED)) { //On Tablets
+ if(sliding_layout.getPanelState().equals(SlidingUpPanelLayout.PanelState.EXPANDED)) { //On Tablets
animateToPosition(podcastMediaControlHeightDp);
- } else if(!isTabletView && isLeftSliderOpen)
+ } else if(isLeftSliderOpen)
animateToPosition(0);
else if(sliding_layout.getPanelState().equals(SlidingUpPanelLayout.PanelState.EXPANDED)) {
animateToPosition(podcastMediaControlHeightDp);
diff --git a/News-Android-App/src/main/res/layout-sw600dp-land/activity_newsreader.xml b/News-Android-App/src/main/res/layout-sw600dp-land/activity_newsreader.xml
new file mode 100644
index 00000000..0c1651e5
--- /dev/null
+++ b/News-Android-App/src/main/res/layout-sw600dp-land/activity_newsreader.xml
@@ -0,0 +1,67 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/News-Android-App/src/main/res/layout/activity_newsreader_twopane.xml b/News-Android-App/src/main/res/layout/activity_newsreader_twopane.xml
deleted file mode 100644
index 24502814..00000000
--- a/News-Android-App/src/main/res/layout/activity_newsreader_twopane.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/News-Android-App/src/main/res/values-sw600dp-land/dimens.xml b/News-Android-App/src/main/res/values-sw600dp-land/dimens.xml
deleted file mode 100644
index 1ba777d6..00000000
--- a/News-Android-App/src/main/res/values-sw600dp-land/dimens.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/News-Android-App/src/main/res/values-sw600dp-land/refs.xml b/News-Android-App/src/main/res/values-sw600dp-land/refs.xml
deleted file mode 100644
index ea7f4022..00000000
--- a/News-Android-App/src/main/res/values-sw600dp-land/refs.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
- - @layout/activity_newsreader_twopane
- true
-
\ No newline at end of file
diff --git a/News-Android-App/src/main/res/values/attrs.xml b/News-Android-App/src/main/res/values/attrs.xml
index 364aa827..dddad91d 100644
--- a/News-Android-App/src/main/res/values/attrs.xml
+++ b/News-Android-App/src/main/res/values/attrs.xml
@@ -1,6 +1,5 @@
- false