do not show drawer header in tablet horizontal mode

This commit is contained in:
Andrew Dolgov 2015-06-05 20:01:27 +03:00
parent cb0c9b06e0
commit 99216872d0
5 changed files with 54 additions and 44 deletions

View File

@ -28,33 +28,36 @@ public abstract class BaseFeedlistFragment extends Fragment {
if (true /*m_activity.findViewById(R.id.headlines_drawer) != null*/) {
try {
View layout = inflater.inflate(R.layout.drawer_header, list, false);
list.addHeaderView(layout, null, false);
TextView login = (TextView) view.findViewById(R.id.drawer_header_login);
TextView server = (TextView) view.findViewById(R.id.drawer_header_server);
if (activity.isSmallScreen()) {
View layout = inflater.inflate(R.layout.drawer_header, list, false);
list.addHeaderView(layout, null, false);
login.setText(prefs.getString("login", ""));
try {
server.setText(new URL(prefs.getString("ttrss_url", "")).getHost());
} catch (MalformedURLException e) {
server.setText("");
}
TextView login = (TextView) view.findViewById(R.id.drawer_header_login);
TextView server = (TextView) view.findViewById(R.id.drawer_header_server);
View account = view.findViewById(R.id.drawer_header_account);
account.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
Intent intent = new Intent(Intent.ACTION_VIEW,
Uri.parse(prefs.getString("ttrss_url", "")));
startActivity(intent);
} catch (Exception e) {
}
login.setText(prefs.getString("login", ""));
try {
server.setText(new URL(prefs.getString("ttrss_url", "")).getHost());
} catch (MalformedURLException e) {
server.setText("");
}
});
View account = view.findViewById(R.id.drawer_header_account);
account.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
Intent intent = new Intent(Intent.ACTION_VIEW,
Uri.parse(prefs.getString("ttrss_url", "")));
startActivity(intent);
} catch (Exception e) {
}
}
});
}
/* deal with ~material~ footers */

View File

@ -225,7 +225,10 @@ public class FeedCategoriesFragment extends BaseFeedlistFragment implements OnIt
registerForContextMenu(m_list);
View loadingBar = (View) view.findViewById(R.id.feeds_loading_bar);
loadingBar.setVisibility(View.VISIBLE);
if (loadingBar != null) {
loadingBar.setVisibility(View.VISIBLE);
}
//m_activity.m_pullToRefreshAttacher.addRefreshableView(list, this);

View File

@ -309,7 +309,10 @@ public class FeedsFragment extends BaseFeedlistFragment implements OnItemClickLi
//m_enableFeedIcons = m_prefs.getBoolean("download_feed_icons", false);
View loadingBar = (View) view.findViewById(R.id.feeds_loading_bar);
loadingBar.setVisibility(View.VISIBLE);
if (loadingBar != null) {
loadingBar.setVisibility(View.VISIBLE);
}
//Log.d(TAG, "mpTRA=" + m_activity.m_pullToRefreshAttacher);
//m_activity.m_pullToRefreshAttacher.addRefreshableView(list, this);

View File

@ -1,11 +1,18 @@
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fitsSystemWindows="true"
xmlns:android="http://schemas.android.com/apk/res/android">
<include layout="@layout/actionbar_toolbar" android:id="@+id/actionbar_toolbar" />
<LinearLayout
android:fitsSystemWindows="true"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fragment_container"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:baselineAligned="false"
android:orientation="horizontal" >
android:orientation="horizontal"
android:layout_below="@+id/actionbar_toolbar">
<FrameLayout
android:id="@+id/sw600dp_anchor"
@ -14,7 +21,6 @@
android:visibility="gone" >
</FrameLayout>
<FrameLayout
android:id="@+id/feeds_fragment"
android:layout_width="0dp"
@ -23,21 +29,16 @@
android:background="?feedlistBackground" >
</FrameLayout>
<RelativeLayout
<FrameLayout
android:layout_width="0dp"
android:layout_weight="0.75"
android:id="@+id/headlines_fragment"
android:background="?headlinesBackground"
android:elevation="4dp"
android:layout_height="match_parent">
<include layout="@layout/actionbar_toolbar" android:id="@+id/actionbar_toolbar" />
<FrameLayout
android:id="@+id/headlines_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?headlinesBackground"
android:layout_below="@+id/actionbar_toolbar">
</FrameLayout>
</RelativeLayout>
</FrameLayout>
</LinearLayout>
</RelativeLayout>

View File

@ -26,7 +26,7 @@
android:id="@+id/headlines_fragment"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.4"
android:layout_weight="0.3"
android:background="?headlinesBackground" >
</FrameLayout>
@ -34,7 +34,7 @@
android:id="@+id/article_fragment"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.6"
android:layout_weight="0.7"
android:elevation="4dp"
android:background="?articleBackground" >
</FrameLayout>