move to v7 toolbar widget instead of old-style actionbar

This commit is contained in:
Andrew Dolgov 2015-06-04 00:30:35 +03:00
parent 6b6107b276
commit c54d13e072
34 changed files with 282 additions and 131 deletions

View File

@ -14,6 +14,7 @@ import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewCompat; import android.support.v4.view.ViewCompat;
import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager;
import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBar;
import android.support.v7.widget.Toolbar;
import android.util.Log; import android.util.Log;
import android.view.ContextMenu; import android.view.ContextMenu;
import android.view.GestureDetector; import android.view.GestureDetector;
@ -261,6 +262,9 @@ public class ArticleImagesPagerActivity extends CommonActivity implements Gestur
setContentView(R.layout.article_images_pager); 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); m_progress = (ProgressBar) findViewById(R.id.article_images_progress);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);

View File

@ -222,13 +222,8 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe
m_list = (ListView)view.findViewById(R.id.feeds); m_list = (ListView)view.findViewById(R.id.feeds);
m_adapter = new FeedCategoryListAdapter(getActivity(), R.layout.feeds_row, (ArrayList<FeedCategory>)m_cats); m_adapter = new FeedCategoryListAdapter(getActivity(), R.layout.feeds_row, (ArrayList<FeedCategory>)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 // TODO: better check
if (m_activity.findViewById(R.id.headlines_drawer) != null) { if (true /*m_activity.findViewById(R.id.headlines_drawer) != null*/) {
try { try {
View layout = inflater.inflate(R.layout.drawer_header, m_list, false); View layout = inflater.inflate(R.layout.drawer_header, m_list, false);
m_list.addHeaderView(layout, null, false); m_list.addHeaderView(layout, null, false);

View File

@ -13,6 +13,7 @@ import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction; import android.support.v4.app.FragmentTransaction;
import android.support.v4.widget.DrawerLayout; import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.widget.Toolbar;
import android.util.Log; import android.util.Log;
import android.view.Gravity; import android.view.Gravity;
import android.view.MenuItem; import android.view.MenuItem;
@ -57,6 +58,9 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
setSmallScreen(findViewById(R.id.sw600dp_anchor) == null); setSmallScreen(findViewById(R.id.sw600dp_anchor) == null);
Toolbar toolbar = (Toolbar) findViewById(R.id.actionbar_toolbar);
setSupportActionBar(toolbar);
GlobalState.getInstance().load(savedInstanceState); GlobalState.getInstance().load(savedInstanceState);
m_drawerLayout = (DrawerLayout) findViewById(R.id.headlines_drawer); 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); Fragment cf = getSupportFragmentManager().findFragmentByTag(FRAG_CATS);
HeadlinesFragment hf = (HeadlinesFragment)getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES); HeadlinesFragment hf = (HeadlinesFragment)getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
if (m_drawerLayout != null) { /* if (m_drawerLayout != null) {
boolean isDrawerOpen = m_drawerLayout.isDrawerOpen(Gravity.START); boolean isDrawerOpen = m_drawerLayout.isDrawerOpen(Gravity.START);
m_menu.setGroupVisible(R.id.menu_group_feeds, isDrawerOpen); m_menu.setGroupVisible(R.id.menu_group_feeds, isDrawerOpen);
@ -218,7 +222,10 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
m_menu.setGroupVisible(R.id.menu_group_headlines, hf != null && hf.isAdded()); m_menu.setGroupVisible(R.id.menu_group_headlines, hf != null && hf.isAdded());
m_menu.findItem(R.id.update_headlines).setVisible(false); 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); //m_menu.findItem(R.id.headlines_toggle_sidebar).setVisible(false);
@ -375,10 +382,10 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
invalidateOptionsMenu(); invalidateOptionsMenu();
refresh(); refresh();
return true; return true;
case R.id.update_feeds: /*case R.id.update_feeds:
//m_pullToRefreshAttacher.setRefreshing(true); //m_pullToRefreshAttacher.setRefreshing(true);
refresh(); refresh();
return true; return true;*/
default: default:
Log.d(TAG, "onOptionsItemSelected, unhandled id=" + item.getItemId()); Log.d(TAG, "onOptionsItemSelected, unhandled id=" + item.getItemId());
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);

View File

@ -6,9 +6,11 @@ import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
@ -27,7 +29,6 @@ import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemClickListener; import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ListView; import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;
@ -287,25 +288,8 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
m_list = (ListView)view.findViewById(R.id.feeds); 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);
}
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);
} else {
// TODO: better check // TODO: better check
if (m_activity.findViewById(R.id.headlines_drawer) != null) { if (true /*m_activity.findViewById(R.id.headlines_drawer) != null*/) {
try { try {
View layout = inflater.inflate(R.layout.drawer_header, m_list, false); View layout = inflater.inflate(R.layout.drawer_header, m_list, false);
m_list.addHeaderView(layout, null, false); m_list.addHeaderView(layout, null, false);
@ -319,6 +303,21 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
} catch (MalformedURLException e) { } catch (MalformedURLException e) {
server.setText(""); 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) { } catch (InflateException e) {
// welp couldn't inflate header i guess // welp couldn't inflate header i guess
e.printStackTrace(); e.printStackTrace();
@ -326,6 +325,18 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
e.printStackTrace(); e.printStackTrace();
} }
} }
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<Feed>)m_feeds); m_adapter = new FeedListAdapter(getActivity(), R.layout.feeds_row, (ArrayList<Feed>)m_feeds);

View File

@ -9,11 +9,10 @@ import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.v4.app.FragmentTransaction; import android.support.v4.app.FragmentTransaction;
import android.support.v4.view.WindowCompat; import android.support.v7.widget.Toolbar;
import android.util.Log; import android.util.Log;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.Window;
import org.fox.ttrss.types.Article; import org.fox.ttrss.types.Article;
import org.fox.ttrss.types.ArticleList; import org.fox.ttrss.types.ArticleList;
@ -38,6 +37,9 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL
setContentView(R.layout.headlines_articles); setContentView(R.layout.headlines_articles);
Toolbar toolbar = (Toolbar) findViewById(R.id.actionbar_toolbar);
setSupportActionBar(toolbar);
m_forceDisableActionMode = isPortrait() || isSmallScreen(); m_forceDisableActionMode = isPortrait() || isSmallScreen();
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);

View File

@ -19,6 +19,7 @@ import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.v7.view.ActionMode; import android.support.v7.view.ActionMode;
import android.support.v7.widget.Toolbar;
import android.util.Log; import android.util.Log;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.Menu; import android.view.Menu;
@ -164,6 +165,9 @@ public class OnlineActivity extends CommonActivity {
setContentView(R.layout.login); setContentView(R.layout.login);
Toolbar toolbar = (Toolbar) findViewById(R.id.actionbar_toolbar);
setSupportActionBar(toolbar);
if (!ImageLoader.getInstance().isInited()) { if (!ImageLoader.getInstance().isInited()) {
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext()) ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext())
.diskCache( .diskCache(
@ -1022,12 +1026,12 @@ public class OnlineActivity extends CommonActivity {
} }
return true; return true;
case R.id.update_headlines: /*case R.id.update_headlines:
if (hf != null) { if (hf != null) {
//m_pullToRefreshAttacher.setRefreshing(true); //m_pullToRefreshAttacher.setRefreshing(true);
hf.refresh(false, true); hf.refresh(false, true);
} }
return true; return true;*/
default: default:
Log.d(TAG, "onOptionsItemSelected, unhandled id=" + item.getItemId()); Log.d(TAG, "onOptionsItemSelected, unhandled id=" + item.getItemId());
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);

View File

@ -1,21 +1,10 @@
package org.fox.ttrss; 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.os.Bundle;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.v4.app.FragmentTransaction; import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.MenuItem; 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 { public class PreferencesActivity extends CommonActivity {
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
@ -29,6 +18,9 @@ public class PreferencesActivity extends CommonActivity {
setContentView(R.layout.preferences); setContentView(R.layout.preferences);
Toolbar toolbar = (Toolbar) findViewById(R.id.actionbar_toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setHomeButtonEnabled(true);

View File

@ -15,6 +15,7 @@ import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.provider.BaseColumns; import android.provider.BaseColumns;
import android.support.v7.view.ActionMode; import android.support.v7.view.ActionMode;
import android.support.v7.widget.Toolbar;
import android.util.Log; import android.util.Log;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.Menu; import android.view.Menu;
@ -171,6 +172,9 @@ public class OfflineActivity extends CommonActivity {
setContentView(R.layout.login); setContentView(R.layout.login);
Toolbar toolbar = (Toolbar) findViewById(R.id.actionbar_toolbar);
setSupportActionBar(toolbar);
invalidateOptionsMenu(); invalidateOptionsMenu();
Intent intent = getIntent(); Intent intent = getIntent();

View File

@ -2,9 +2,11 @@ package org.fox.ttrss.offline;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.database.Cursor; import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.provider.BaseColumns; import android.provider.BaseColumns;
@ -14,6 +16,7 @@ import android.support.v4.widget.SwipeRefreshLayout;
import android.util.Log; import android.util.Log;
import android.view.ContextMenu; import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo; import android.view.ContextMenu.ContextMenuInfo;
import android.view.InflateException;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
@ -23,12 +26,14 @@ import android.widget.AdapterView;
import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemClickListener; import android.widget.AdapterView.OnItemClickListener;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ListView; import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;
import org.fox.ttrss.R; import org.fox.ttrss.R;
import java.net.MalformedURLException;
import java.net.URL;
public class OfflineFeedCategoriesFragment extends Fragment implements OnItemClickListener, OnSharedPreferenceChangeListener { public class OfflineFeedCategoriesFragment extends Fragment implements OnItemClickListener, OnSharedPreferenceChangeListener {
private final String TAG = this.getClass().getSimpleName(); private final String TAG = this.getClass().getSimpleName();
private SharedPreferences m_prefs; private SharedPreferences m_prefs;
@ -142,16 +147,49 @@ public class OfflineFeedCategoriesFragment extends Fragment implements OnItemCli
m_list = (ListView)view.findViewById(R.id.feeds); 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_cursor = createCursor();
m_adapter = new FeedCategoryListAdapter(getActivity(), R.layout.feeds_row, m_cursor, 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); 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.setAdapter(m_adapter);
m_list.setOnItemClickListener(this); m_list.setOnItemClickListener(this);
m_list.setEmptyView(view.findViewById(R.id.no_feeds)); m_list.setEmptyView(view.findViewById(R.id.no_feeds));

View File

@ -15,6 +15,7 @@ import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction; import android.support.v4.app.FragmentTransaction;
import android.support.v4.widget.DrawerLayout; import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.widget.Toolbar;
import android.util.Log; import android.util.Log;
import android.view.Gravity; import android.view.Gravity;
import android.view.MenuItem; import android.view.MenuItem;
@ -46,6 +47,9 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
setContentView(R.layout.headlines); setContentView(R.layout.headlines);
Toolbar toolbar = (Toolbar) findViewById(R.id.actionbar_toolbar);
setSupportActionBar(toolbar);
setSmallScreen(findViewById(R.id.sw600dp_anchor) == null); setSmallScreen(findViewById(R.id.sw600dp_anchor) == null);
GlobalState.getInstance().load(savedInstanceState); GlobalState.getInstance().load(savedInstanceState);
@ -204,7 +208,7 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
Fragment cf = getSupportFragmentManager().findFragmentByTag(FRAG_CATS); Fragment cf = getSupportFragmentManager().findFragmentByTag(FRAG_CATS);
OfflineHeadlinesFragment hf = (OfflineHeadlinesFragment)getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES); OfflineHeadlinesFragment hf = (OfflineHeadlinesFragment)getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
if (m_drawerLayout != null) { /* if (m_drawerLayout != null) {
boolean isDrawerOpen = m_drawerLayout.isDrawerOpen(Gravity.START); boolean isDrawerOpen = m_drawerLayout.isDrawerOpen(Gravity.START);
m_menu.setGroupVisible(R.id.menu_group_feeds, isDrawerOpen); m_menu.setGroupVisible(R.id.menu_group_feeds, isDrawerOpen);
@ -212,7 +216,10 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
} else { } else {
m_menu.setGroupVisible(R.id.menu_group_feeds, (ff != null && ff.isAdded()) || (cf != null && cf.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.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); //m_menu.findItem(R.id.headlines_toggle_sidebar).setVisible(false);

View File

@ -2,21 +2,20 @@ package org.fox.ttrss.offline;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.database.Cursor; import android.database.Cursor;
import android.graphics.Bitmap; import android.net.Uri;
import android.graphics.BitmapFactory;
import android.os.Bundle; import android.os.Bundle;
import android.os.Environment;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.provider.BaseColumns;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.widget.SimpleCursorAdapter; import android.support.v4.widget.SimpleCursorAdapter;
import android.support.v4.widget.SwipeRefreshLayout; import android.support.v4.widget.SwipeRefreshLayout;
import android.util.Log; import android.util.Log;
import android.view.ContextMenu; import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo; import android.view.ContextMenu.ContextMenuInfo;
import android.view.InflateException;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
@ -26,13 +25,13 @@ import android.widget.AdapterView;
import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemClickListener; import android.widget.AdapterView.OnItemClickListener;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ListView; import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;
import org.fox.ttrss.R; 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 { public class OfflineFeedsFragment extends Fragment implements OnItemClickListener, OnSharedPreferenceChangeListener {
private final String TAG = this.getClass().getSimpleName(); private final String TAG = this.getClass().getSimpleName();
@ -155,9 +154,42 @@ public class OfflineFeedsFragment extends Fragment implements OnItemClickListene
m_list = (ListView)view.findViewById(R.id.feeds); m_list = (ListView)view.findViewById(R.id.feeds);
if (m_activity.isSmallScreen()) { // TODO: better check
View layout = inflater.inflate(R.layout.headlines_heading_spacer, m_list, false); if (true /*m_activity.findViewById(R.id.headlines_drawer) != null*/) {
m_list.addHeaderView(layout); 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) { if (m_enableParentBtn) {

View File

@ -12,6 +12,7 @@ import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction; import android.support.v4.app.FragmentTransaction;
import android.support.v4.widget.DrawerLayout; import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.widget.Toolbar;
import android.util.Log; import android.util.Log;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
@ -39,6 +40,9 @@ public class OfflineHeadlinesActivity extends OfflineActivity implements Offline
setContentView(R.layout.headlines_articles); setContentView(R.layout.headlines_articles);
Toolbar toolbar = (Toolbar) findViewById(R.id.actionbar_toolbar);
setSupportActionBar(toolbar);
m_drawerLayout = (DrawerLayout) findViewById(R.id.headlines_drawer); m_drawerLayout = (DrawerLayout) findViewById(R.id.headlines_drawer);
if (m_drawerLayout != null) { if (m_drawerLayout != null) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 431 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 457 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 549 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 595 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 726 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 804 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 900 B

View File

@ -1,16 +1,23 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/main" android:id="@+id/main"
android:fitsSystemWindows="true" android:fitsSystemWindows="true"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent">
android:orientation="vertical" >
<include layout="@layout/actionbar_toolbar" android:id="@+id/actionbar_toolbar" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_below="@+id/actionbar_toolbar">
<FrameLayout <FrameLayout
android:id="@+id/sw600dp_anchor" android:id="@+id/sw600dp_anchor"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="gone" > android:visibility="gone" >
</FrameLayout> </FrameLayout>
<LinearLayout <LinearLayout
@ -39,3 +46,4 @@
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</RelativeLayout>

View File

@ -5,6 +5,8 @@
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:orientation="vertical" > android:orientation="vertical" >
<include layout="@layout/actionbar_toolbar" android:id="@+id/actionbar_toolbar" />
<FrameLayout <FrameLayout
android:id="@+id/sw600dp_anchor" android:id="@+id/sw600dp_anchor"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -1,9 +1,9 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/headlines" android:id="@+id/headlines"
android:fitsSystemWindows="true"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent">
android:orientation="vertical" >
<include layout="@layout/actionbar_toolbar" android:id="@+id/actionbar_toolbar" />
<FrameLayout <FrameLayout
android:id="@+id/sw600dp_anchor" android:id="@+id/sw600dp_anchor"
@ -17,7 +17,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:baselineAligned="false" android:baselineAligned="false"
android:orientation="horizontal" > android:orientation="horizontal"
android:layout_below="@+id/actionbar_toolbar">
<FrameLayout <FrameLayout
android:paddingRight="4dp" android:paddingRight="4dp"
@ -38,4 +39,4 @@
</FrameLayout> </FrameLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </RelativeLayout>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/actionbar_toolbar"
android:elevation="4dp"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorPrimary" />

View File

@ -1,19 +1,17 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/article_images" android:id="@+id/article_images"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:animateLayoutChanges="true"
android:background="?headlinesBackground" android:background="?headlinesBackground"
android:layout_height="fill_parent"> android:layout_height="fill_parent">
/*
android:paddingLeft="@dimen/activity_horizontal_margin" <include layout="@layout/actionbar_toolbar" android:id="@+id/actionbar_toolbar" />
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"> */
<org.fox.ttrss.ArticleImagesPager <org.fox.ttrss.ArticleImagesPager
android:id="@+id/article_images_pager" android:id="@+id/article_images_pager"
android:layout_alignParentTop="true"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" /> android:layout_height="fill_parent"
android:layout_below="@+id/actionbar_toolbar" />
<ProgressBar <ProgressBar
style="?android:attr/progressBarStyleHorizontal" style="?android:attr/progressBarStyleHorizontal"

View File

@ -19,8 +19,8 @@
android:layout_height="21dp" android:layout_height="21dp"
android:layout_weight="0" android:layout_weight="0"
android:scaleType="fitXY" android:scaleType="fitXY"
android:visibility="invisible" android:tint="?colorAccent"
android:src="?ic_rss_box" /> android:src="?ic_keyboard_backspace" />
<TextView <TextView
android:fontFamily="sans-serif-medium" android:fontFamily="sans-serif-medium"
@ -29,7 +29,7 @@
android:gravity="center_vertical" android:gravity="center_vertical"
android:layout_weight="1" android:layout_weight="1"
android:ellipsize="end" android:ellipsize="end"
android:paddingLeft="30dp" android:paddingLeft="35dp"
android:singleLine="true" android:singleLine="true"
android:text=".." android:text=".."
android:paddingBottom="2dp" android:paddingBottom="2dp"

View File

@ -7,12 +7,22 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<FrameLayout
android:animateLayoutChanges="true"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout <FrameLayout
android:id="@+id/headlines_fragment" android:id="@+id/headlines_fragment"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?headlinesBackground"></FrameLayout> android:background="?headlinesBackground"></FrameLayout>
<include layout="@layout/actionbar_toolbar" android:id="@+id/actionbar_toolbar" />
</FrameLayout>
<FrameLayout <FrameLayout
android:id="@+id/feeds_fragment" android:id="@+id/feeds_fragment"
android:layout_width="240dp" android:layout_width="240dp"

View File

@ -1,5 +1,6 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/headlines" android:id="@+id/headlines"
android:animateLayoutChanges="true"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent"> android:layout_height="fill_parent">
@ -18,4 +19,5 @@
android:background="?headlinesBackground"> android:background="?headlinesBackground">
</FrameLayout> </FrameLayout>
<include layout="@layout/actionbar_toolbar" android:id="@+id/actionbar_toolbar" />
</FrameLayout> </FrameLayout>

View File

@ -1,15 +1,15 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/loading_container" android:id="@+id/loading_container"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:fitsSystemWindows="true"
android:gravity="center"
android:layout_height="fill_parent" > android:layout_height="fill_parent" >
<include layout="@layout/actionbar_toolbar" android:id="@+id/actionbar_toolbar" />
<TextView <TextView
android:id="@+id/loading_message" android:id="@+id/loading_message"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:gravity="center_horizontal" android:gravity="center"
android:text="@string/loading_message" /> android:text="@string/loading_message" />
</LinearLayout> </FrameLayout>

View File

@ -1,8 +1,20 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout
android:id="@+id/preferences_container" xmlns:android="http://schemas.android.com/apk/res/android"
android:fitsSystemWindows="true"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
</FrameLayout> <FrameLayout
android:id="@+id/preferences_container"
android:fitsSystemWindows="true"
android:layout_width="match_parent"
android:layout_height="502dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:layout_below="@+id/actionbar_toolbar">
</FrameLayout>
<include layout="@layout/actionbar_toolbar" android:id="@+id/actionbar_toolbar" />
</RelativeLayout>

View File

@ -6,8 +6,8 @@
<item <item
android:id="@+id/subscribe_to_feed" android:id="@+id/subscribe_to_feed"
android:icon="@drawable/ic_plus_circle" android:icon="@drawable/ic_plus_circle"
app:showAsAction="ifRoom" app:showAsAction=""
android:title="@string/subscribe_to_feed"/> android:title="@string/subscribe_to_feed"/> <!-- iRroom -->
<item <item
android:id="@+id/show_feeds" android:id="@+id/show_feeds"
@ -17,25 +17,27 @@
<item <item
android:id="@+id/go_offline" android:id="@+id/go_offline"
android:icon="@drawable/ic_cloud_download" android:icon="@drawable/ic_cloud_download"
app:showAsAction="ifRoom" android:orderInCategory="800"
android:title="@string/go_offline"/> app:showAsAction=""
<item android:title="@string/go_offline"/> <!-- iRroom -->
<!-- <item
android:id="@+id/update_feeds" android:id="@+id/update_feeds"
android:icon="@drawable/ic_refresh" android:icon="@drawable/ic_refresh"
app:showAsAction="" app:showAsAction=""
android:title="@string/update_feeds"/> android:title="@string/update_feeds"/> -->
<item <item
android:orderInCategory="900"
android:id="@+id/logout" android:id="@+id/logout"
android:icon="@drawable/ic_logout" android:icon="@drawable/ic_logout"
app:showAsAction="" app:showAsAction=""
android:title="@string/logout"/> android:title="@string/logout"/>
</group> </group>
<group android:id="@+id/menu_group_headlines" > <group android:id="@+id/menu_group_headlines" >
<item <!-- <item
android:id="@+id/update_headlines" android:id="@+id/update_headlines"
android:icon="@drawable/ic_refresh" android:icon="@drawable/ic_refresh"
app:showAsAction="" app:showAsAction=""
android:title="@string/update_headlines"/> android:title="@string/update_headlines"/> -->
<item <item
android:id="@+id/search" android:id="@+id/search"
android:icon="@drawable/ic_magnify" android:icon="@drawable/ic_magnify"
@ -114,6 +116,7 @@
</group> </group>
<item <item
android:orderInCategory="999"
android:id="@+id/preferences" android:id="@+id/preferences"
android:icon="@drawable/ic_settings" android:icon="@drawable/ic_settings"
app:showAsAction="" app:showAsAction=""

View File

@ -4,9 +4,9 @@
<item <item
android:id="@+id/go_online" android:id="@+id/go_online"
android:icon="@drawable/ic_cloud_upload" android:icon="@drawable/ic_cloud_upload"
app:showAsAction="ifRoom|withText" app:showAsAction=""
android:title="@string/go_online" android:title="@string/go_online"
android:visible="false"/> android:visible="false"/> <!-- ifRoom|withText -->
<item <item
android:id="@+id/show_feeds" android:id="@+id/show_feeds"
android:icon="@drawable/ic_filter_remove" android:icon="@drawable/ic_filter_remove"

View File

@ -35,4 +35,5 @@
<attr name="ic_star" format="reference" /> <attr name="ic_star" format="reference" />
<attr name="ic_star_outline" format="reference" /> <attr name="ic_star_outline" format="reference" />
<attr name="ic_share" format="reference" /> <attr name="ic_share" format="reference" />
<attr name="ic_keyboard_backspace" format="reference" />
</resources> </resources>

View File

@ -1,7 +1,7 @@
<resources xmlns:android="http://schemas.android.com/apk/res/android"> <resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="LightTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <style name="LightTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="windowActionBarOverlay">true</item> <item name="windowActionModeOverlay">true</item>
<item name="statusBarHintColor">?colorPrimary</item> <item name="statusBarHintColor">?colorPrimary</item>
<item name="ttrssHorizontalDivider">@android:drawable/divider_horizontal_bright</item> <item name="ttrssHorizontalDivider">@android:drawable/divider_horizontal_bright</item>
@ -43,10 +43,11 @@
<item name="ic_star">@drawable/ic_star_dark</item> <item name="ic_star">@drawable/ic_star_dark</item>
<item name="ic_star_outline">@drawable/ic_star_outline_dark</item> <item name="ic_star_outline">@drawable/ic_star_outline_dark</item>
<item name="ic_share">@drawable/ic_share_dark</item> <item name="ic_share">@drawable/ic_share_dark</item>
<item name="ic_keyboard_backspace">@drawable/ic_keyboard_backspace_dark</item>
</style> </style>
<style name="DarkTheme" parent="Theme.AppCompat"> <style name="DarkTheme" parent="Theme.AppCompat.NoActionBar">
<item name="windowActionBarOverlay">true</item> <item name="windowActionModeOverlay">true</item>
<item name="statusBarHintColor">?colorPrimary</item> <item name="statusBarHintColor">?colorPrimary</item>
<item name="unreadCounterColor">#909090</item> <item name="unreadCounterColor">#909090</item>
@ -88,6 +89,7 @@
<item name="ic_star">@drawable/ic_star</item> <item name="ic_star">@drawable/ic_star</item>
<item name="ic_star_outline">@drawable/ic_star_outline</item> <item name="ic_star_outline">@drawable/ic_star_outline</item>
<item name="ic_share">@drawable/ic_share</item> <item name="ic_share">@drawable/ic_share</item>
<item name="ic_keyboard_backspace">@drawable/ic_keyboard_backspace</item>
</style> </style>
<style name="DarkDialogTheme" parent="android:Theme"></style> <style name="DarkDialogTheme" parent="android:Theme"></style>