From c54d13e072968fe74f0e3c43ec664a12b115bdfa Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 4 Jun 2015 00:30:35 +0300 Subject: [PATCH] move to v7 toolbar widget instead of old-style actionbar --- .../fox/ttrss/ArticleImagesPagerActivity.java | 4 + .../org/fox/ttrss/FeedCategoriesFragment.java | 7 +- .../java/org/fox/ttrss/FeedsActivity.java | 17 ++-- .../java/org/fox/ttrss/FeedsFragment.java | 85 ++++++++++-------- .../java/org/fox/ttrss/HeadlinesActivity.java | 6 +- .../java/org/fox/ttrss/OnlineActivity.java | 8 +- .../org/fox/ttrss/PreferencesActivity.java | 16 +--- .../fox/ttrss/offline/OfflineActivity.java | 4 + .../OfflineFeedCategoriesFragment.java | 50 +++++++++-- .../ttrss/offline/OfflineFeedsActivity.java | 13 ++- .../ttrss/offline/OfflineFeedsFragment.java | 52 ++++++++--- .../offline/OfflineHeadlinesActivity.java | 4 + .../drawable-hdpi/ic_keyboard_backspace.png | Bin 0 -> 344 bytes .../ic_keyboard_backspace_dark.png | Bin 0 -> 431 bytes .../drawable-xhdpi/ic_keyboard_backspace.png | Bin 0 -> 457 bytes .../ic_keyboard_backspace_dark.png | Bin 0 -> 549 bytes .../drawable-xxhdpi/ic_keyboard_backspace.png | Bin 0 -> 595 bytes .../ic_keyboard_backspace_dark.png | Bin 0 -> 726 bytes .../ic_keyboard_backspace.png | Bin 0 -> 804 bytes .../ic_keyboard_backspace_dark.png | Bin 0 -> 900 bytes .../res/layout-sw600dp-land/headlines.xml | 18 ++-- .../headlines_articles.xml | 2 + .../headlines_articles.xml | 13 +-- .../src/main/res/layout/actionbar_toolbar.xml | 12 +++ .../main/res/layout/article_images_pager.xml | 12 ++- .../src/main/res/layout/feeds_goback.xml | 6 +- .../src/main/res/layout/headlines.xml | 16 +++- .../main/res/layout/headlines_articles.xml | 2 + org.fox.ttrss/src/main/res/layout/login.xml | 12 +-- .../src/main/res/layout/preferences.xml | 20 ++++- org.fox.ttrss/src/main/res/menu/main_menu.xml | 19 ++-- .../src/main/res/menu/offline_menu.xml | 4 +- org.fox.ttrss/src/main/res/values/attrs.xml | 1 + org.fox.ttrss/src/main/res/values/style.xml | 10 ++- 34 files changed, 282 insertions(+), 131 deletions(-) create mode 100644 org.fox.ttrss/src/main/res/drawable-hdpi/ic_keyboard_backspace.png create mode 100644 org.fox.ttrss/src/main/res/drawable-hdpi/ic_keyboard_backspace_dark.png create mode 100644 org.fox.ttrss/src/main/res/drawable-xhdpi/ic_keyboard_backspace.png create mode 100644 org.fox.ttrss/src/main/res/drawable-xhdpi/ic_keyboard_backspace_dark.png create mode 100644 org.fox.ttrss/src/main/res/drawable-xxhdpi/ic_keyboard_backspace.png create mode 100644 org.fox.ttrss/src/main/res/drawable-xxhdpi/ic_keyboard_backspace_dark.png create mode 100644 org.fox.ttrss/src/main/res/drawable-xxxhdpi/ic_keyboard_backspace.png create mode 100644 org.fox.ttrss/src/main/res/drawable-xxxhdpi/ic_keyboard_backspace_dark.png create mode 100644 org.fox.ttrss/src/main/res/layout/actionbar_toolbar.xml diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleImagesPagerActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleImagesPagerActivity.java index 7598cef7..cf532b81 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleImagesPagerActivity.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleImagesPagerActivity.java @@ -14,6 +14,7 @@ import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewCompat; import android.support.v4.view.ViewPager; import android.support.v7.app.ActionBar; +import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.ContextMenu; import android.view.GestureDetector; @@ -261,6 +262,9 @@ public class ArticleImagesPagerActivity extends CommonActivity implements Gestur setContentView(R.layout.article_images_pager); + Toolbar toolbar = (Toolbar) findViewById(R.id.actionbar_toolbar); + setSupportActionBar(toolbar); + m_progress = (ProgressBar) findViewById(R.id.article_images_progress); getSupportActionBar().setDisplayHomeAsUpEnabled(true); diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedCategoriesFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedCategoriesFragment.java index 67a06d74..83f0ec25 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedCategoriesFragment.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedCategoriesFragment.java @@ -222,13 +222,8 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe m_list = (ListView)view.findViewById(R.id.feeds); m_adapter = new FeedCategoryListAdapter(getActivity(), R.layout.feeds_row, (ArrayList)m_cats); - if (m_activity.isSmallScreen()) { - View layout = inflater.inflate(R.layout.headlines_heading_spacer, m_list, false); - m_list.addHeaderView(layout); - } - // TODO: better check - if (m_activity.findViewById(R.id.headlines_drawer) != null) { + if (true /*m_activity.findViewById(R.id.headlines_drawer) != null*/) { try { View layout = inflater.inflate(R.layout.drawer_header, m_list, false); m_list.addHeaderView(layout, null, false); diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsActivity.java index a10c6045..5ad9b476 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsActivity.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsActivity.java @@ -13,6 +13,7 @@ import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; +import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.Gravity; import android.view.MenuItem; @@ -57,6 +58,9 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe setSmallScreen(findViewById(R.id.sw600dp_anchor) == null); + Toolbar toolbar = (Toolbar) findViewById(R.id.actionbar_toolbar); + setSupportActionBar(toolbar); + GlobalState.getInstance().load(savedInstanceState); m_drawerLayout = (DrawerLayout) findViewById(R.id.headlines_drawer); @@ -208,7 +212,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe Fragment cf = getSupportFragmentManager().findFragmentByTag(FRAG_CATS); HeadlinesFragment hf = (HeadlinesFragment)getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES); - if (m_drawerLayout != null) { + /* if (m_drawerLayout != null) { boolean isDrawerOpen = m_drawerLayout.isDrawerOpen(Gravity.START); m_menu.setGroupVisible(R.id.menu_group_feeds, isDrawerOpen); @@ -218,8 +222,11 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe m_menu.setGroupVisible(R.id.menu_group_headlines, hf != null && hf.isAdded()); m_menu.findItem(R.id.update_headlines).setVisible(false); - } - + } */ + + m_menu.setGroupVisible(R.id.menu_group_feeds, (ff != null && ff.isAdded()) || (cf != null && cf.isAdded())); + m_menu.setGroupVisible(R.id.menu_group_headlines, hf != null && hf.isAdded()); + //m_menu.findItem(R.id.headlines_toggle_sidebar).setVisible(false); MenuItem item = m_menu.findItem(R.id.show_feeds); @@ -375,10 +382,10 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe invalidateOptionsMenu(); refresh(); return true; - case R.id.update_feeds: + /*case R.id.update_feeds: //m_pullToRefreshAttacher.setRefreshing(true); refresh(); - return true; + return true;*/ default: Log.d(TAG, "onOptionsItemSelected, unhandled id=" + item.getItemId()); return super.onOptionsItemSelected(item); diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsFragment.java index 42e32f20..ce25cdf5 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsFragment.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsFragment.java @@ -6,9 +6,11 @@ import android.app.AlertDialog; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; +import android.content.Intent; import android.content.SharedPreferences; import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.graphics.Typeface; +import android.net.Uri; import android.os.Bundle; import android.preference.PreferenceManager; import android.support.v4.app.Fragment; @@ -27,7 +29,6 @@ import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter; import android.widget.ImageButton; -import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; @@ -287,48 +288,58 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh m_list = (ListView)view.findViewById(R.id.feeds); - if (m_activity.isSmallScreen()) { - View layout = inflater.inflate(R.layout.headlines_heading_spacer, m_list, false); - m_list.addHeaderView(layout); - } + // TODO: better check + if (true /*m_activity.findViewById(R.id.headlines_drawer) != null*/) { + try { + View layout = inflater.inflate(R.layout.drawer_header, m_list, false); + m_list.addHeaderView(layout, null, false); - if (m_enableParentBtn) { - View layout = inflater.inflate(R.layout.feeds_goback, m_list, false); + TextView login = (TextView) view.findViewById(R.id.drawer_header_login); + TextView server = (TextView) view.findViewById(R.id.drawer_header_server); - layout.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View view) { - m_activity.getSupportFragmentManager().popBackStack(); - } - }); + login.setText(m_prefs.getString("login", "")); + try { + server.setText(new URL(m_prefs.getString("ttrss_url", "")).getHost()); + } catch (MalformedURLException e) { + server.setText(""); + } - m_list.addHeaderView(layout, null, false); - } else { - // TODO: better check - if (m_activity.findViewById(R.id.headlines_drawer) != null) { - try { - View layout = inflater.inflate(R.layout.drawer_header, m_list, false); - m_list.addHeaderView(layout, null, false); + View account = view.findViewById(R.id.drawer_header_account); - TextView login = (TextView) view.findViewById(R.id.drawer_header_login); - TextView server = (TextView) view.findViewById(R.id.drawer_header_server); + account.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + try { + Intent intent = new Intent(Intent.ACTION_VIEW, + Uri.parse(m_prefs.getString("ttrss_url", ""))); + startActivity(intent); + } catch (Exception e) { - login.setText(m_prefs.getString("login", "")); - try { - server.setText(new URL(m_prefs.getString("ttrss_url", "")).getHost()); - } catch (MalformedURLException e) { - server.setText(""); - } - } catch (InflateException e) { - // welp couldn't inflate header i guess - e.printStackTrace(); - } catch (java.lang.UnsupportedOperationException e) { - e.printStackTrace(); - } - } - } + } + } + }); + } catch (InflateException e) { + // welp couldn't inflate header i guess + e.printStackTrace(); + } catch (java.lang.UnsupportedOperationException e) { + e.printStackTrace(); + } + } - m_adapter = new FeedListAdapter(getActivity(), R.layout.feeds_row, (ArrayList)m_feeds); + if (m_enableParentBtn) { + View layout = inflater.inflate(R.layout.feeds_goback, m_list, false); + + layout.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View view) { + m_activity.getSupportFragmentManager().popBackStack(); + } + }); + + m_list.addHeaderView(layout, null, false); + } + + m_adapter = new FeedListAdapter(getActivity(), R.layout.feeds_row, (ArrayList)m_feeds); m_list.setAdapter(m_adapter); //list.setEmptyView(view.findViewById(R.id.no_feeds)); m_list.setOnItemClickListener(this); diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesActivity.java index 2f83245a..17915a57 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesActivity.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesActivity.java @@ -9,11 +9,10 @@ import android.os.Bundle; import android.os.Handler; import android.preference.PreferenceManager; import android.support.v4.app.FragmentTransaction; -import android.support.v4.view.WindowCompat; +import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.MenuItem; import android.view.View; -import android.view.Window; import org.fox.ttrss.types.Article; import org.fox.ttrss.types.ArticleList; @@ -38,6 +37,9 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL setContentView(R.layout.headlines_articles); + Toolbar toolbar = (Toolbar) findViewById(R.id.actionbar_toolbar); + setSupportActionBar(toolbar); + m_forceDisableActionMode = isPortrait() || isSmallScreen(); getSupportActionBar().setDisplayHomeAsUpEnabled(true); diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/OnlineActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/OnlineActivity.java index 3dcb6ff9..646f5f34 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/OnlineActivity.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/OnlineActivity.java @@ -19,6 +19,7 @@ import android.net.Uri; import android.os.Bundle; import android.preference.PreferenceManager; import android.support.v7.view.ActionMode; +import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.KeyEvent; import android.view.Menu; @@ -164,6 +165,9 @@ public class OnlineActivity extends CommonActivity { setContentView(R.layout.login); + Toolbar toolbar = (Toolbar) findViewById(R.id.actionbar_toolbar); + setSupportActionBar(toolbar); + if (!ImageLoader.getInstance().isInited()) { ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext()) .diskCache( @@ -1022,12 +1026,12 @@ public class OnlineActivity extends CommonActivity { } return true; - case R.id.update_headlines: + /*case R.id.update_headlines: if (hf != null) { //m_pullToRefreshAttacher.setRefreshing(true); hf.refresh(false, true); } - return true; + return true;*/ default: Log.d(TAG, "onOptionsItemSelected, unhandled id=" + item.getItemId()); return super.onOptionsItemSelected(item); diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/PreferencesActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/PreferencesActivity.java index be2e35a0..525ec37a 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/PreferencesActivity.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/PreferencesActivity.java @@ -1,21 +1,10 @@ package org.fox.ttrss; -import android.content.pm.ApplicationInfo; -import android.content.pm.PackageInfo; -import android.content.pm.PackageManager; import android.os.Bundle; -import android.preference.PreferenceActivity; import android.preference.PreferenceManager; -import android.support.v4.app.FragmentTransaction; -import android.util.Log; +import android.support.v7.widget.Toolbar; import android.view.MenuItem; -import java.io.IOException; -import java.text.SimpleDateFormat; -import java.util.Locale; -import java.util.zip.ZipEntry; -import java.util.zip.ZipFile; - public class PreferencesActivity extends CommonActivity { @Override public void onCreate(Bundle savedInstanceState) { @@ -29,6 +18,9 @@ public class PreferencesActivity extends CommonActivity { setContentView(R.layout.preferences); + Toolbar toolbar = (Toolbar) findViewById(R.id.actionbar_toolbar); + setSupportActionBar(toolbar); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineActivity.java index aa61a496..1bd2342c 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineActivity.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineActivity.java @@ -15,6 +15,7 @@ import android.os.Bundle; import android.preference.PreferenceManager; import android.provider.BaseColumns; import android.support.v7.view.ActionMode; +import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.KeyEvent; import android.view.Menu; @@ -171,6 +172,9 @@ public class OfflineActivity extends CommonActivity { setContentView(R.layout.login); + Toolbar toolbar = (Toolbar) findViewById(R.id.actionbar_toolbar); + setSupportActionBar(toolbar); + invalidateOptionsMenu(); Intent intent = getIntent(); diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineFeedCategoriesFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineFeedCategoriesFragment.java index 7a0702bc..340b5997 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineFeedCategoriesFragment.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineFeedCategoriesFragment.java @@ -2,9 +2,11 @@ package org.fox.ttrss.offline; import android.app.Activity; import android.content.Context; +import android.content.Intent; import android.content.SharedPreferences; import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.database.Cursor; +import android.net.Uri; import android.os.Bundle; import android.preference.PreferenceManager; import android.provider.BaseColumns; @@ -14,6 +16,7 @@ import android.support.v4.widget.SwipeRefreshLayout; import android.util.Log; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; +import android.view.InflateException; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; @@ -23,12 +26,14 @@ import android.widget.AdapterView; import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.AdapterView.OnItemClickListener; import android.widget.ImageButton; -import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; import org.fox.ttrss.R; +import java.net.MalformedURLException; +import java.net.URL; + public class OfflineFeedCategoriesFragment extends Fragment implements OnItemClickListener, OnSharedPreferenceChangeListener { private final String TAG = this.getClass().getSimpleName(); private SharedPreferences m_prefs; @@ -142,16 +147,49 @@ public class OfflineFeedCategoriesFragment extends Fragment implements OnItemCli m_list = (ListView)view.findViewById(R.id.feeds); - if (m_activity.isSmallScreen()) { - View layout = inflater.inflate(R.layout.headlines_heading_spacer, m_list, false); - m_list.addHeaderView(layout); - } - m_cursor = createCursor(); m_adapter = new FeedCategoryListAdapter(getActivity(), R.layout.feeds_row, m_cursor, new String[] { "title", "unread" }, new int[] { R.id.title, R.id.unread_counter }, 0); + // TODO: better check + if (true /*m_activity.findViewById(R.id.headlines_drawer) != null*/) { + try { + View layout = inflater.inflate(R.layout.drawer_header, m_list, false); + m_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); + + login.setText(m_prefs.getString("login", "")); + try { + server.setText(new URL(m_prefs.getString("ttrss_url", "")).getHost()); + } catch (MalformedURLException e) { + server.setText(""); + } + + View account = view.findViewById(R.id.drawer_header_account); + + account.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + try { + Intent intent = new Intent(Intent.ACTION_VIEW, + Uri.parse(m_prefs.getString("ttrss_url", ""))); + startActivity(intent); + } catch (Exception e) { + + } + } + }); + } catch (InflateException e) { + // welp couldn't inflate header i guess + e.printStackTrace(); + } catch (java.lang.UnsupportedOperationException e) { + e.printStackTrace(); + } + } + m_list.setAdapter(m_adapter); m_list.setOnItemClickListener(this); m_list.setEmptyView(view.findViewById(R.id.no_feeds)); diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineFeedsActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineFeedsActivity.java index f390b890..3d6817de 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineFeedsActivity.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineFeedsActivity.java @@ -15,6 +15,7 @@ import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; +import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.Gravity; import android.view.MenuItem; @@ -46,6 +47,9 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead setContentView(R.layout.headlines); + Toolbar toolbar = (Toolbar) findViewById(R.id.actionbar_toolbar); + setSupportActionBar(toolbar); + setSmallScreen(findViewById(R.id.sw600dp_anchor) == null); GlobalState.getInstance().load(savedInstanceState); @@ -204,7 +208,7 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead Fragment cf = getSupportFragmentManager().findFragmentByTag(FRAG_CATS); OfflineHeadlinesFragment hf = (OfflineHeadlinesFragment)getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES); - if (m_drawerLayout != null) { + /* if (m_drawerLayout != null) { boolean isDrawerOpen = m_drawerLayout.isDrawerOpen(Gravity.START); m_menu.setGroupVisible(R.id.menu_group_feeds, isDrawerOpen); @@ -212,8 +216,11 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead } else { m_menu.setGroupVisible(R.id.menu_group_feeds, (ff != null && ff.isAdded()) || (cf != null && cf.isAdded())); m_menu.setGroupVisible(R.id.menu_group_headlines, hf != null && hf.isAdded()); - } - + } */ + + m_menu.setGroupVisible(R.id.menu_group_feeds, (ff != null && ff.isAdded()) || (cf != null && cf.isAdded())); + m_menu.setGroupVisible(R.id.menu_group_headlines, hf != null && hf.isAdded()); + //m_menu.findItem(R.id.headlines_toggle_sidebar).setVisible(false); MenuItem item = m_menu.findItem(R.id.show_feeds); diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineFeedsFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineFeedsFragment.java index 4024219f..27f729f6 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineFeedsFragment.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineFeedsFragment.java @@ -2,21 +2,20 @@ package org.fox.ttrss.offline; import android.app.Activity; import android.content.Context; +import android.content.Intent; import android.content.SharedPreferences; import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.database.Cursor; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; +import android.net.Uri; import android.os.Bundle; -import android.os.Environment; import android.preference.PreferenceManager; -import android.provider.BaseColumns; import android.support.v4.app.Fragment; import android.support.v4.widget.SimpleCursorAdapter; import android.support.v4.widget.SwipeRefreshLayout; import android.util.Log; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; +import android.view.InflateException; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; @@ -26,13 +25,13 @@ import android.widget.AdapterView; import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.AdapterView.OnItemClickListener; import android.widget.ImageButton; -import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; import org.fox.ttrss.R; -import java.io.File; +import java.net.MalformedURLException; +import java.net.URL; public class OfflineFeedsFragment extends Fragment implements OnItemClickListener, OnSharedPreferenceChangeListener { private final String TAG = this.getClass().getSimpleName(); @@ -155,10 +154,43 @@ public class OfflineFeedsFragment extends Fragment implements OnItemClickListene m_list = (ListView)view.findViewById(R.id.feeds); - if (m_activity.isSmallScreen()) { - View layout = inflater.inflate(R.layout.headlines_heading_spacer, m_list, false); - m_list.addHeaderView(layout); - } + // TODO: better check + if (true /*m_activity.findViewById(R.id.headlines_drawer) != null*/) { + try { + View layout = inflater.inflate(R.layout.drawer_header, m_list, false); + m_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); + + login.setText(m_prefs.getString("login", "")); + try { + server.setText(new URL(m_prefs.getString("ttrss_url", "")).getHost()); + } catch (MalformedURLException e) { + server.setText(""); + } + + View account = view.findViewById(R.id.drawer_header_account); + + account.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + try { + Intent intent = new Intent(Intent.ACTION_VIEW, + Uri.parse(m_prefs.getString("ttrss_url", ""))); + startActivity(intent); + } catch (Exception e) { + + } + } + }); + } catch (InflateException e) { + // welp couldn't inflate header i guess + e.printStackTrace(); + } catch (java.lang.UnsupportedOperationException e) { + e.printStackTrace(); + } + } if (m_enableParentBtn) { View layout = inflater.inflate(R.layout.feeds_goback, container, false); diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineHeadlinesActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineHeadlinesActivity.java index a52252dd..967c7f75 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineHeadlinesActivity.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineHeadlinesActivity.java @@ -12,6 +12,7 @@ import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; +import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.MenuItem; import android.view.View; @@ -39,6 +40,9 @@ public class OfflineHeadlinesActivity extends OfflineActivity implements Offline setContentView(R.layout.headlines_articles); + Toolbar toolbar = (Toolbar) findViewById(R.id.actionbar_toolbar); + setSupportActionBar(toolbar); + m_drawerLayout = (DrawerLayout) findViewById(R.id.headlines_drawer); if (m_drawerLayout != null) { diff --git a/org.fox.ttrss/src/main/res/drawable-hdpi/ic_keyboard_backspace.png b/org.fox.ttrss/src/main/res/drawable-hdpi/ic_keyboard_backspace.png new file mode 100644 index 0000000000000000000000000000000000000000..87546b1698842678c09fa21fea816255fb119b0b GIT binary patch literal 344 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezpTCwj^(N7a$D;Kb?2i11Zh|kH}&m z?E%JaC$sH9f@KAc=|CE+pW)oQo^T-Nv8Rh;NXEUlGc38790gqei#zKpS12&QJn+;> z&ht!+Us9Z!?74fs;hO&s9xyn$hut>ButC6yL$O8U(3wdyRr|}=XP;p9_$jBdUY9v+ z>l5RXXTI4BUQpy`kZ0IFjd6`my~v@;@04{d@W~cD}BHeePh2UiM!Ydt7 zt6QR7&ZeGIUG&ZBu1!*)!;+4p&1=&Aau{-=PlhZ0pSa`s>j!Uxg#_#Jg+T87VZJYS XOUL_fd11Cd?=pD0`njxgN@xNAC!2ke literal 0 HcmV?d00001 diff --git a/org.fox.ttrss/src/main/res/drawable-hdpi/ic_keyboard_backspace_dark.png b/org.fox.ttrss/src/main/res/drawable-hdpi/ic_keyboard_backspace_dark.png new file mode 100644 index 0000000000000000000000000000000000000000..47bad2204bc89d6d732973f87872cc74a6895232 GIT binary patch literal 431 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezpTCwj^(N7a$D;Kb?2i11Zh|kH}&m z?E%JaC$sH9f@KAc=|CE+pW)oQo^S>RMk`Mj$B>MBZ)aHh9WfAbUC$|^b1=y3$d@$f z$)y`)?7SJdz6l)dyrkgT;V(RW%4HWb(MuUF#|njR@_+PusrLLt=RDblM2R*aifjqW zT0P~~vWl{8Z8i-|2i&|klYPFYGktqff5StQJ^4)bnuf`uPZ<-Q&#CTIT%*c_Lwpra?gyW$ zW_EirdBN6w|8i?f_yQ)`AKU0?mhCoy^Fow8Q-zoAi{w-8F$@+qneR5~?AAa1Nw>72 zTu3_EN^>bg!Orb9&*tnt^?A?h-~YNx7`}F#Ojleb=-6)AC3tXoV3y$Kyp$o=uoHXAS$lJYF;winx>#t9$%wd!M=TF|C!h9*G8s2Jj>SugOtJ3 L)z4*}Q$iB}fuO5T literal 0 HcmV?d00001 diff --git a/org.fox.ttrss/src/main/res/drawable-xhdpi/ic_keyboard_backspace.png b/org.fox.ttrss/src/main/res/drawable-xhdpi/ic_keyboard_backspace.png new file mode 100644 index 0000000000000000000000000000000000000000..c2908bf9f82899ae26b0c37f4a48eebf49c46f2d GIT binary patch literal 457 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=Y)RhkE(}A=D7{B`bBY}Z|F~rlwF{I+w+nHy5j~WQDr3>m_;1th#*u|t8 zz}a5nAbH0!m_b2hLB~@EK8}DlDrMLD_D!7kWyyEGnG-*6=HpOo5pV(%B1i7Bm&-5e zPwu-s>(c>)+T&-AW!(I~;npX6iRhk!O_Oa7Ja{+#;-OIHGbfn$F!NtLv|qD~OXZ1u z!@)Cgi(6N-ya<)!n!_ad>H6AJhmVO)(EKl?YkB;Y=mf?3%e!pW#4yhMbpB#dD3gq5 zU17uGlloi}Ca_m9-CNZ9k7L%|JiZBv_jS_B?7mlj(z~#^hVN+m!h0TUGu&=GJ9Z-| zCAVY7%@^-3Jajd9x$VjM&esRk@AvOJzK2)N)T!6~;X0)?^Vs@@7Cy7Mn5Im*+@gTe~DWM4fVfDHy literal 0 HcmV?d00001 diff --git a/org.fox.ttrss/src/main/res/drawable-xhdpi/ic_keyboard_backspace_dark.png b/org.fox.ttrss/src/main/res/drawable-xhdpi/ic_keyboard_backspace_dark.png new file mode 100644 index 0000000000000000000000000000000000000000..1722a89dbdaad44081790fcadbdbd1bd3adfa80e GIT binary patch literal 549 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=Y)RhkE(}A=D7{B`bBY}Z|af7FeV@SoVw=-@14jVAI*-z$q6FY0I@R=Vn zZ!g|rF5uQkddRm;W3JVLyu4-s9gh`jg_bSi^7=O`QV6TK!9DD zZl;!2+X>Tb8ouAnd){gjkjN%7LH@TA|CAV(&ri%}pG~owU#-kPWd@_=Cjlp& z%O2)be(d@FYy;aEvL$xVmk{iEzJ;Dnp30wrn)6+-O<{(}8pX7+2iB`GtXj@t&uPV@SoVw|A`lm<>f*9~KM#UbrxwS%=w| zJyD;d%cLXp!iJU)w|FjCx~h3;eAWO$rCh`3QPTjChnXEvH<}C0yq*m6nX9y zUnzNKd*GJDAA^5-#hcs96EBxiJKfR}2=nnS{!GE`&co*nCaQKluS?}SQ*ZlI5 z`&4)pTe8<%dKYUdDAjmIc~pI#vAOM4z9Z+u`?GJxzqQO>8Rd}j$9>~Z;(U0%iZ}k$ zAFd9b|K6+9|Mi!1%-baD@FR1Rh{KPUetHTY)Ho4h~WniR)4WrF{wXaUtH2iXnN<)$lXBz9jvYT+eO z8P~UrMf65Tpwk?&ut~AgFPsY6cUvgRYTBh#&b6{sKoabz0qCyjyeO)5kAk zr(F2OD>YgF;8QhQuNwt7J6z*V?VC{Y)G(blPy1wtkldL!SF_JuiYY(jKIKD3n*KcF zY0vgexgUIJ@=V+6^VfSn&JGfLe7^U)P3)_Wud@(Q0c81{7n&6CH*8z=>(}8pX7+2iB`GtXjDbdr#F{I+w+dH;Jw;UvneGD(m5?y(L)o1^6 zgXbq|6`p^1l09k46NYIS8a^L*T#XiaGKyvxY51CW9*cjoX}A93zyGt2?Xl?(Kb9me z2s9S~I8I0ur}pf;G*5XM_ghA*`X>3#6B{(RR=%!UXdBFv9(ch1VfiFY$Gr{ghu*6M zHf1sTx7>eO%bCS0BUqPiA;D9(?)vNZQJdSoI6d~%Jv4n=ZvO0LJ1@>KZqxZDY}N8V z&2GN=#mSv2uedhw)L;Dm!Bt5tLAY*OYWK2CwOamol}oB8%>LZXo9^;MNieJ-^~e1n zu6UIXTm>BUbAo;-Dd{`^O}PEReD>LtoiS>n`#ctiK9KkqXU)TVk6WR}IxgS!MvK1E z>9=LGOMWQHg*Q0=czors_{T41SIqv{oS*#v?E5(}Ktszb=lL(Y{L=4t>-_G?dXCc` zsxQ6@fLr17qHaNxz8Hd zB(ENSzSmG$(6Y?_dF;IB$^Qg@zkV{iuryY`YtadpC!adn_uqQ|efr^tAJVo){k>H8 z@%e$%cLTf%p1&sdm5!X?#Ksy6yRelmDf zL``9qn(|>shI)#|!^FUTjle^-7tePD9{L}`_wwen3nsp?*T3@jMmh&ut7ZlsDvg{L zzx5f9@7FmWidDDd{@%7~mHsT_wq~>{|y)mvG?l{|{RjV>8RYb!Wvvf}XB^F6*2Ung9U~JEZ^s literal 0 HcmV?d00001 diff --git a/org.fox.ttrss/src/main/res/drawable-xxxhdpi/ic_keyboard_backspace.png b/org.fox.ttrss/src/main/res/drawable-xxxhdpi/ic_keyboard_backspace.png new file mode 100644 index 0000000000000000000000000000000000000000..beb70fa1457a9b9217137827a07cc9e64a0fd32e GIT binary patch literal 804 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H1|$#LC7uRSY)RhkE(}8pY7#ln^oW;PvwBFOjF{I+w+q=GbR~!V6ehlwWZrtI~*YHfQ zMpcnR>@bs{(!N82I~Y2Q3#O($p17&;M)2L((1-sgyPZl~vguy%?XJ6WoInGyfrJIu zZmrw8t$W_$O}{TP%VcxbZU3WdeB1qe$V6BEf}YtA?{8Sna(k-wf%rrA3s|J5Y8}vh zC?C+odrBlB^#}Wugr!2PHzfWsszyAF`@*o@(x}Gs*4ArsuIJ~+zGAXCG<}J;@o&Le zo|{W`8;t+(rh%3Vi+ zS3wMi)}M|A61rE78)ux4ZAkqs8oixm) zDGJlOq7Q30x+mT~tm(+N@ICtimXE9UD>MmNw2C_{Vwo5u0we=3fk?q1Q6RZ_sdj@4 zXPQ?eL#NQ0N!u8NRA(rD-N*3UxJ`YMoSVFJ*-CDOon8fbY4(espVzBpT(a1!ATcfc zVsUuDB8E%Lg!UM1KK-I{wMH;QW+-Re?3=$|SZZsAGQ6CxT9KUge$n&8DyQ|^|3}&N nFMjUGP-iEHEinPb{_y`}_-yQU|H%BNc_1a8u6{1-oD!M(}8pY7#ln^oW;Pv%Oa~8v2^;~3{53RfCNptrHr?XAE^s+TRb|qK*OKSWh3_qoe>r=O@cSFDzj^^p z#R|AT-Fsj4zI^TTjGMNv8K3Rqs`J0(cmKQ8@sEe9mWi20HrOAEU(8}`8s3l%W|)LF zM1vU7S<4utTlTwgZoA;ZxQ(N}S14!2FQzjb^|{O6|DONY;@_q?=dXC_oYK^D7Ge?X4_% zu+R5J)mRn&REgAcd+_`he)v4}i;luarSs1v9`EC@U!9cCD0!$}@6h>m9*i9OYDoJcCnuju;V%%#&9Ssi_a`u2REWb*x?Zw!}S z#zxsa-|PI1y$il3UI_k}c;S)QZ<7L<NcQIW0BUBPwZoqRm{PoZ5@LI+tZ@nMPv6g9jc%|x{m`NZ*=4zom zJc@H7&fo4z<5Kv$o8_{}-Y&y^+vjao^%Zs4wUcG~^y%x*pFe*;^8EE#&wwgonV#R7 tE%7+|_0E79-|PD4_p@V7s0<9{ck|EJ%v$w;=N2 + android:layout_height="fill_parent"> + + + + - - \ No newline at end of file + + \ No newline at end of file diff --git a/org.fox.ttrss/src/main/res/layout-sw600dp-land/headlines_articles.xml b/org.fox.ttrss/src/main/res/layout-sw600dp-land/headlines_articles.xml index f4ff2c59..008efa4c 100755 --- a/org.fox.ttrss/src/main/res/layout-sw600dp-land/headlines_articles.xml +++ b/org.fox.ttrss/src/main/res/layout-sw600dp-land/headlines_articles.xml @@ -5,6 +5,8 @@ android:layout_height="fill_parent" android:orientation="vertical" > + + + android:layout_height="fill_parent"> + + + android:orientation="horizontal" + android:layout_below="@+id/actionbar_toolbar"> - \ No newline at end of file + \ No newline at end of file diff --git a/org.fox.ttrss/src/main/res/layout/actionbar_toolbar.xml b/org.fox.ttrss/src/main/res/layout/actionbar_toolbar.xml new file mode 100644 index 00000000..85ebaeb2 --- /dev/null +++ b/org.fox.ttrss/src/main/res/layout/actionbar_toolbar.xml @@ -0,0 +1,12 @@ + + \ No newline at end of file diff --git a/org.fox.ttrss/src/main/res/layout/article_images_pager.xml b/org.fox.ttrss/src/main/res/layout/article_images_pager.xml index 93b7eec3..250bd084 100644 --- a/org.fox.ttrss/src/main/res/layout/article_images_pager.xml +++ b/org.fox.ttrss/src/main/res/layout/article_images_pager.xml @@ -1,19 +1,17 @@ -/* - android:paddingLeft="@dimen/activity_horizontal_margin" - android:paddingRight="@dimen/activity_horizontal_margin" - android:paddingTop="@dimen/activity_vertical_margin" - android:paddingBottom="@dimen/activity_vertical_margin"> */ + + + android:layout_height="fill_parent" + android:layout_below="@+id/actionbar_toolbar" /> + android:tint="?colorAccent" + android:src="?ic_keyboard_backspace" /> + android:layout_height="match_parent"> + + + + + + + @@ -18,4 +19,5 @@ android:background="?headlinesBackground"> + \ No newline at end of file diff --git a/org.fox.ttrss/src/main/res/layout/login.xml b/org.fox.ttrss/src/main/res/layout/login.xml index 2cfc44b1..f64a14f1 100644 --- a/org.fox.ttrss/src/main/res/layout/login.xml +++ b/org.fox.ttrss/src/main/res/layout/login.xml @@ -1,15 +1,15 @@ - + + - \ No newline at end of file + \ No newline at end of file diff --git a/org.fox.ttrss/src/main/res/layout/preferences.xml b/org.fox.ttrss/src/main/res/layout/preferences.xml index e68fa9e4..55015d09 100644 --- a/org.fox.ttrss/src/main/res/layout/preferences.xml +++ b/org.fox.ttrss/src/main/res/layout/preferences.xml @@ -1,8 +1,20 @@ - - \ No newline at end of file + + + + + + \ No newline at end of file diff --git a/org.fox.ttrss/src/main/res/menu/main_menu.xml b/org.fox.ttrss/src/main/res/menu/main_menu.xml index 76ef4cbf..3ebfade5 100755 --- a/org.fox.ttrss/src/main/res/menu/main_menu.xml +++ b/org.fox.ttrss/src/main/res/menu/main_menu.xml @@ -6,8 +6,8 @@ + app:showAsAction="" + android:title="@string/subscribe_to_feed"/> - + - + android:title="@string/update_headlines"/> --> + android:visible="false"/> + \ No newline at end of file diff --git a/org.fox.ttrss/src/main/res/values/style.xml b/org.fox.ttrss/src/main/res/values/style.xml index 4f343839..ffe02dc8 100755 --- a/org.fox.ttrss/src/main/res/values/style.xml +++ b/org.fox.ttrss/src/main/res/values/style.xml @@ -1,7 +1,7 @@ - -