implement drawer navigation for headlines activity instead of old hideable sidebar
This commit is contained in:
parent
8a15540c61
commit
acdcf759a0
@ -291,6 +291,9 @@ public class ArticleImagesPagerActivity extends CommonActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
|
case android.R.id.home:
|
||||||
|
finish();
|
||||||
|
return true;
|
||||||
case R.id.article_img_open:
|
case R.id.article_img_open:
|
||||||
if (url != null) {
|
if (url != null) {
|
||||||
try {
|
try {
|
||||||
|
@ -35,11 +35,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
|||||||
protected SharedPreferences m_prefs;
|
protected SharedPreferences m_prefs;
|
||||||
protected long m_lastRefresh = 0;
|
protected long m_lastRefresh = 0;
|
||||||
|
|
||||||
//private boolean m_actionbarUpEnabled = false;
|
|
||||||
//private int m_actionbarRevertDepth = 0;
|
|
||||||
//private SlidingMenu m_slidingMenu;
|
|
||||||
private boolean m_feedIsSelected = false;
|
private boolean m_feedIsSelected = false;
|
||||||
//private boolean m_feedWasSelected = false;
|
|
||||||
|
|
||||||
private ActionBarDrawerToggle m_drawerToggle;
|
private ActionBarDrawerToggle m_drawerToggle;
|
||||||
private DrawerLayout m_drawerLayout;
|
private DrawerLayout m_drawerLayout;
|
||||||
@ -189,7 +185,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
|||||||
m_menu.findItem(R.id.update_headlines).setVisible(false);
|
m_menu.findItem(R.id.update_headlines).setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_menu.findItem(R.id.headlines_toggle_sidebar).setVisible(false);
|
//m_menu.findItem(R.id.headlines_toggle_sidebar).setVisible(false);
|
||||||
|
|
||||||
MenuItem item = m_menu.findItem(R.id.show_feeds);
|
MenuItem item = m_menu.findItem(R.id.show_feeds);
|
||||||
|
|
||||||
@ -229,15 +225,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
|||||||
//m_feedWasSelected = true;
|
//m_feedWasSelected = true;
|
||||||
|
|
||||||
if (m_drawerLayout != null) {
|
if (m_drawerLayout != null) {
|
||||||
/* if (findViewById(R.id.sw600dp_port_anchor) != null) {
|
|
||||||
m_slidingMenu.setBehindWidth(getScreenWidthInPixel() * 2/3);
|
|
||||||
} */
|
|
||||||
|
|
||||||
m_drawerLayout.closeDrawers();
|
m_drawerLayout.closeDrawers();
|
||||||
|
|
||||||
//getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
|
||||||
//m_actionbarUpEnabled = true;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 10);
|
}, 10);
|
||||||
@ -336,13 +324,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
|||||||
public void onSaveInstanceState(Bundle out) {
|
public void onSaveInstanceState(Bundle out) {
|
||||||
super.onSaveInstanceState(out);
|
super.onSaveInstanceState(out);
|
||||||
|
|
||||||
//out.putBoolean("actionbarUpEnabled", m_actionbarUpEnabled);
|
|
||||||
//out.putInt("actionbarRevertDepth", m_actionbarRevertDepth);
|
|
||||||
out.putBoolean("feedIsSelected", m_feedIsSelected);
|
out.putBoolean("feedIsSelected", m_feedIsSelected);
|
||||||
//out.putBoolean("feedWasSelected", m_feedWasSelected);
|
|
||||||
|
|
||||||
//if (m_slidingMenu != null )
|
|
||||||
// out.putBoolean("slidingMenuVisible", m_slidingMenu.isMenuShowing());
|
|
||||||
|
|
||||||
GlobalState.getInstance().save(out);
|
GlobalState.getInstance().save(out);
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,8 @@ 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.widget.DrawerLayout;
|
||||||
|
import android.support.v7.app.ActionBarDrawerToggle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -20,6 +22,9 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL
|
|||||||
|
|
||||||
protected SharedPreferences m_prefs;
|
protected SharedPreferences m_prefs;
|
||||||
|
|
||||||
|
private ActionBarDrawerToggle m_drawerToggle;
|
||||||
|
private DrawerLayout m_drawerLayout;
|
||||||
|
|
||||||
@SuppressLint("NewApi")
|
@SuppressLint("NewApi")
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
@ -32,16 +37,42 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL
|
|||||||
|
|
||||||
setContentView(R.layout.headlines_articles);
|
setContentView(R.layout.headlines_articles);
|
||||||
|
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
m_drawerLayout = (DrawerLayout) findViewById(R.id.headlines_drawer);
|
||||||
|
|
||||||
|
if (m_drawerLayout != null) {
|
||||||
|
|
||||||
|
m_drawerToggle = new ActionBarDrawerToggle(this, m_drawerLayout, R.string.blank, R.string.blank) {
|
||||||
|
@Override
|
||||||
|
public void onDrawerOpened(View drawerView) {
|
||||||
|
super.onDrawerOpened(drawerView);
|
||||||
|
|
||||||
|
invalidateOptionsMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDrawerClosed(View drawerView) {
|
||||||
|
super.onDrawerClosed(drawerView);
|
||||||
|
|
||||||
|
invalidateOptionsMenu();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
m_drawerLayout.setDrawerListener(m_drawerToggle);
|
||||||
|
m_drawerToggle.setDrawerIndicatorEnabled(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
getSupportActionBar().setHomeButtonEnabled(true);
|
||||||
|
|
||||||
setStatusBarTint();
|
setStatusBarTint();
|
||||||
setSmallScreen(findViewById(R.id.sw600dp_anchor) == null);
|
setSmallScreen(findViewById(R.id.sw600dp_anchor) == null);
|
||||||
|
|
||||||
GlobalState.getInstance().load(savedInstanceState);
|
GlobalState.getInstance().load(savedInstanceState);
|
||||||
|
|
||||||
if (isPortrait() || m_prefs.getBoolean("headlines_hide_sidebar", false)) {
|
/* if (isPortrait() || m_prefs.getBoolean("headlines_hide_sidebar", false)) {
|
||||||
findViewById(R.id.headlines_fragment).setVisibility(View.GONE);
|
findViewById(R.id.headlines_fragment).setVisibility(View.GONE);
|
||||||
}
|
} */
|
||||||
|
|
||||||
if (savedInstanceState == null) {
|
if (savedInstanceState == null) {
|
||||||
Intent i = getIntent();
|
Intent i = getIntent();
|
||||||
@ -85,7 +116,7 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL
|
|||||||
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
|
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
|
||||||
|
|
||||||
HeadlinesFragment hf = new HeadlinesFragment();
|
HeadlinesFragment hf = new HeadlinesFragment();
|
||||||
hf.initialize(feed, article);
|
hf.initialize(feed, article, true);
|
||||||
hf.setSearchQuery(searchQuery);
|
hf.setSearchQuery(searchQuery);
|
||||||
|
|
||||||
ArticlePager af = new ArticlePager();
|
ArticlePager af = new ArticlePager();
|
||||||
@ -101,13 +132,14 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if (!isCompatMode()) {
|
|
||||||
((ViewGroup)findViewById(R.id.headlines_fragment)).setLayoutTransition(new LayoutTransition());
|
|
||||||
((ViewGroup)findViewById(R.id.article_fragment)).setLayoutTransition(new LayoutTransition());
|
|
||||||
} */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void onPostCreate(Bundle savedInstanceState) {
|
||||||
|
super.onPostCreate(savedInstanceState);
|
||||||
|
// Sync the toggle state after onRestoreInstanceState has occurred.
|
||||||
|
if (m_drawerToggle != null) m_drawerToggle.syncState();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void refresh() {
|
protected void refresh() {
|
||||||
super.refresh();
|
super.refresh();
|
||||||
@ -133,7 +165,11 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
if (m_drawerToggle != null && m_drawerToggle.onOptionsItemSelected(item)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (item.getItemId()) {
|
||||||
case android.R.id.home:
|
case android.R.id.home:
|
||||||
finish();
|
finish();
|
||||||
overridePendingTransition(0, R.anim.right_slide_out);
|
overridePendingTransition(0, R.anim.right_slide_out);
|
||||||
@ -159,7 +195,7 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL
|
|||||||
//HeadlinesFragment hf = (HeadlinesFragment)getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
|
//HeadlinesFragment hf = (HeadlinesFragment)getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
|
||||||
|
|
||||||
m_menu.setGroupVisible(R.id.menu_group_headlines, !isPortrait() && !isSmallScreen());
|
m_menu.setGroupVisible(R.id.menu_group_headlines, !isPortrait() && !isSmallScreen());
|
||||||
m_menu.findItem(R.id.headlines_toggle_sidebar).setVisible(!isPortrait() && !isSmallScreen());
|
//m_menu.findItem(R.id.headlines_toggle_sidebar).setVisible(!isPortrait() && !isSmallScreen());
|
||||||
|
|
||||||
ArticlePager af = (ArticlePager) getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE);
|
ArticlePager af = (ArticlePager) getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE);
|
||||||
|
|
||||||
@ -210,7 +246,11 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL
|
|||||||
new Handler().postDelayed(new Runnable() {
|
new Handler().postDelayed(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
ArticlePager af = (ArticlePager) getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE);
|
if (m_drawerLayout != null) {
|
||||||
|
m_drawerLayout.closeDrawers();
|
||||||
|
}
|
||||||
|
|
||||||
|
ArticlePager af = (ArticlePager) getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE);
|
||||||
|
|
||||||
if (af != null) {
|
if (af != null) {
|
||||||
af.setActiveArticle(fArticle);
|
af.setActiveArticle(fArticle);
|
||||||
|
@ -91,6 +91,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
private OnlineActivity m_activity;
|
private OnlineActivity m_activity;
|
||||||
private SwipeRefreshLayout m_swipeLayout;
|
private SwipeRefreshLayout m_swipeLayout;
|
||||||
private int m_maxImageSize = 0;
|
private int m_maxImageSize = 0;
|
||||||
|
private boolean m_compactLayoutMode = false;
|
||||||
|
|
||||||
public ArticleList getSelectedArticles() {
|
public ArticleList getSelectedArticles() {
|
||||||
return m_selectedArticles;
|
return m_selectedArticles;
|
||||||
@ -100,8 +101,9 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
m_feed = feed;
|
m_feed = feed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initialize(Feed feed, Article activeArticle) {
|
public void initialize(Feed feed, Article activeArticle, boolean compactMode) {
|
||||||
m_feed = feed;
|
m_feed = feed;
|
||||||
|
m_compactLayoutMode = compactMode;
|
||||||
|
|
||||||
if (activeArticle != null) {
|
if (activeArticle != null) {
|
||||||
m_activeArticle = getArticleById(activeArticle.id);
|
m_activeArticle = getArticleById(activeArticle.id);
|
||||||
@ -293,6 +295,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
m_activeArticle = savedInstanceState.getParcelable("activeArticle");
|
m_activeArticle = savedInstanceState.getParcelable("activeArticle");
|
||||||
m_selectedArticles = savedInstanceState.getParcelable("selectedArticles");
|
m_selectedArticles = savedInstanceState.getParcelable("selectedArticles");
|
||||||
m_searchQuery = (String) savedInstanceState.getCharSequence("searchQuery");
|
m_searchQuery = (String) savedInstanceState.getCharSequence("searchQuery");
|
||||||
|
m_compactLayoutMode = savedInstanceState.getBoolean("compactLayoutMode");
|
||||||
}
|
}
|
||||||
|
|
||||||
DisplayMetrics metrics = new DisplayMetrics();
|
DisplayMetrics metrics = new DisplayMetrics();
|
||||||
@ -570,6 +573,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
out.putParcelable("activeArticle", m_activeArticle);
|
out.putParcelable("activeArticle", m_activeArticle);
|
||||||
out.putParcelable("selectedArticles", m_selectedArticles);
|
out.putParcelable("selectedArticles", m_selectedArticles);
|
||||||
out.putCharSequence("searchQuery", m_searchQuery);
|
out.putCharSequence("searchQuery", m_searchQuery);
|
||||||
|
out.putBoolean("compactLayoutMode", m_compactLayoutMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
static class HeadlineViewHolder {
|
static class HeadlineViewHolder {
|
||||||
@ -586,7 +590,8 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
public ViewGroup flavorImageHolder;
|
public ViewGroup flavorImageHolder;
|
||||||
public ProgressBar flavorImageLoadingBar;
|
public ProgressBar flavorImageLoadingBar;
|
||||||
public View flavorImageArrow;
|
public View flavorImageArrow;
|
||||||
}
|
public View headlineFooter;
|
||||||
|
}
|
||||||
|
|
||||||
private class ArticleListAdapter extends ArrayAdapter<Article> {
|
private class ArticleListAdapter extends ArrayAdapter<Article> {
|
||||||
private ArrayList<Article> items;
|
private ArrayList<Article> items;
|
||||||
@ -680,6 +685,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
holder.flavorImageHolder = (ViewGroup) v.findViewById(R.id.flavorImageHolder);
|
holder.flavorImageHolder = (ViewGroup) v.findViewById(R.id.flavorImageHolder);
|
||||||
holder.flavorImageLoadingBar = (ProgressBar) v.findViewById(R.id.flavorImageLoadingBar);
|
holder.flavorImageLoadingBar = (ProgressBar) v.findViewById(R.id.flavorImageLoadingBar);
|
||||||
holder.flavorImageArrow = v.findViewById(R.id.flavorImageArrow);
|
holder.flavorImageArrow = v.findViewById(R.id.flavorImageArrow);
|
||||||
|
holder.headlineFooter = v.findViewById(R.id.headline_footer);
|
||||||
|
|
||||||
v.setTag(holder);
|
v.setTag(holder);
|
||||||
|
|
||||||
@ -762,7 +768,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
String articleContent = article.content != null ? article.content : "";
|
String articleContent = article.content != null ? article.content : "";
|
||||||
|
|
||||||
if (holder.excerptView != null) {
|
if (holder.excerptView != null) {
|
||||||
if (!m_prefs.getBoolean("headlines_show_content", true)) {
|
if ((m_compactLayoutMode && m_activity.isSmallScreen()) || !m_prefs.getBoolean("headlines_show_content", true)) {
|
||||||
holder.excerptView.setVisibility(View.GONE);
|
holder.excerptView.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
String excerpt = Jsoup.parse(articleContent).text();
|
String excerpt = Jsoup.parse(articleContent).text();
|
||||||
@ -775,129 +781,133 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (holder.flavorImageView != null && m_prefs.getBoolean("headlines_show_flavor_image", true)) {
|
if (!m_compactLayoutMode) {
|
||||||
holder.flavorImageArrow.setVisibility(View.GONE);
|
if (holder.flavorImageView != null && m_prefs.getBoolean("headlines_show_flavor_image", true)) {
|
||||||
|
holder.flavorImageArrow.setVisibility(View.GONE);
|
||||||
|
|
||||||
Document doc = Jsoup.parse(articleContent);
|
Document doc = Jsoup.parse(articleContent);
|
||||||
|
|
||||||
boolean loadableImageFound = false;
|
boolean loadableImageFound = false;
|
||||||
|
|
||||||
if (doc != null) {
|
if (doc != null) {
|
||||||
//Element img = doc.select("img").first();
|
//Element img = doc.select("img").first();
|
||||||
|
|
||||||
final Elements imgs = doc.select("img");
|
final Elements imgs = doc.select("img");
|
||||||
Element img = imgs.first();
|
Element img = imgs.first();
|
||||||
|
|
||||||
if (img != null) {
|
if (img != null) {
|
||||||
String imgSrc = img.attr("src");
|
String imgSrc = img.attr("src");
|
||||||
|
|
||||||
// retarded schema-less urls
|
// retarded schema-less urls
|
||||||
if (imgSrc.indexOf("//") == 0)
|
if (imgSrc.indexOf("//") == 0)
|
||||||
imgSrc = "http:" + imgSrc;
|
imgSrc = "http:" + imgSrc;
|
||||||
|
|
||||||
DisplayImageOptions options = new DisplayImageOptions.Builder()
|
DisplayImageOptions options = new DisplayImageOptions.Builder()
|
||||||
.cacheInMemory(true)
|
.cacheInMemory(true)
|
||||||
.resetViewBeforeLoading(true)
|
.resetViewBeforeLoading(true)
|
||||||
.cacheOnDisk(true)
|
.cacheOnDisk(true)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
holder.flavorImageView.setOnClickListener(new OnClickListener() {
|
holder.flavorImageView.setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
ArrayList<String> imgsList = new ArrayList<String>();
|
ArrayList<String> imgsList = new ArrayList<String>();
|
||||||
|
|
||||||
for (Element img : imgs) {
|
for (Element img : imgs) {
|
||||||
String imgSrc = img.attr("src");
|
String imgSrc = img.attr("src");
|
||||||
|
|
||||||
if (imgSrc.indexOf("//") == 0)
|
if (imgSrc.indexOf("//") == 0)
|
||||||
imgSrc = "http:" + imgSrc;
|
imgSrc = "http:" + imgSrc;
|
||||||
|
|
||||||
|
imgsList.add(imgSrc);
|
||||||
|
}
|
||||||
|
|
||||||
|
Intent intent = new Intent(m_activity, ArticleImagesPagerActivity.class);
|
||||||
|
intent.putExtra("urls", imgsList);
|
||||||
|
intent.putExtra("title", article.title);
|
||||||
|
|
||||||
|
startActivityForResult(intent, 0);
|
||||||
|
//m_activity.overridePendingTransition(android.R.anim.fade_in, 0);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
final ViewGroup flavorImageHolder = holder.flavorImageHolder;
|
||||||
|
final ImageView flavorImageView = holder.flavorImageView;
|
||||||
|
final ProgressBar flavorImageLoadingBar = holder.flavorImageLoadingBar;
|
||||||
|
|
||||||
|
ImageAware imageAware = new ImageViewAware(holder.flavorImageView, false);
|
||||||
|
|
||||||
|
flavorImageHolder.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
if (imgs.size() > 1 && holder.flavorImageArrow != null) {
|
||||||
|
holder.flavorImageArrow.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
final boolean weNeedAnimation = MemoryCacheUtils.findCachedBitmapsForImageUri(imgSrc, ImageLoader.getInstance().getMemoryCache()).size() == 0;
|
||||||
|
|
||||||
|
loadableImageFound = true;
|
||||||
|
ImageLoader.getInstance().displayImage(imgSrc, imageAware, options, new ImageLoadingListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoadingCancelled(String arg0,
|
||||||
|
View arg1) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
imgsList.add(imgSrc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Intent intent = new Intent(m_activity, ArticleImagesPagerActivity.class);
|
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||||
intent.putExtra("urls", imgsList);
|
@Override
|
||||||
intent.putExtra("title", article.title);
|
public void onLoadingComplete(String arg0,
|
||||||
|
View arg1, Bitmap arg2) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
startActivityForResult(intent, 0);
|
if (!isAdded() || arg2 == null) return;
|
||||||
//m_activity.overridePendingTransition(android.R.anim.fade_in, 0);
|
|
||||||
|
|
||||||
|
flavorImageLoadingBar.setVisibility(View.INVISIBLE);
|
||||||
|
|
||||||
}
|
if (arg2.getWidth() > 128 && arg2.getHeight() > 128) {
|
||||||
});
|
if (!m_activity.isCompatMode() && weNeedAnimation) {
|
||||||
|
|
||||||
final ViewGroup flavorImageHolder = holder.flavorImageHolder;
|
ObjectAnimator anim = ObjectAnimator.ofFloat(flavorImageView, "alpha", 0f, 1f);
|
||||||
final ImageView flavorImageView = holder.flavorImageView;
|
anim.setDuration(200);
|
||||||
final ProgressBar flavorImageLoadingBar = holder.flavorImageLoadingBar;
|
anim.start();
|
||||||
|
|
||||||
ImageAware imageAware = new ImageViewAware(holder.flavorImageView, false);
|
|
||||||
|
|
||||||
flavorImageHolder.setVisibility(View.VISIBLE);
|
|
||||||
|
|
||||||
if (imgs.size() > 1 && holder.flavorImageArrow != null) {
|
|
||||||
holder.flavorImageArrow.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
final boolean weNeedAnimation = MemoryCacheUtils.findCachedBitmapsForImageUri(imgSrc, ImageLoader.getInstance().getMemoryCache()).size() == 0;
|
|
||||||
|
|
||||||
loadableImageFound = true;
|
|
||||||
ImageLoader.getInstance().displayImage(imgSrc, imageAware, options, new ImageLoadingListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onLoadingCancelled(String arg0,
|
|
||||||
View arg1) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
|
||||||
@Override
|
|
||||||
public void onLoadingComplete(String arg0,
|
|
||||||
View arg1, Bitmap arg2) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
if (!isAdded() || arg2 == null) return;
|
|
||||||
|
|
||||||
flavorImageLoadingBar.setVisibility(View.INVISIBLE);
|
|
||||||
|
|
||||||
if (arg2.getWidth() > 128 && arg2.getHeight() > 128) {
|
|
||||||
if (!m_activity.isCompatMode() && weNeedAnimation) {
|
|
||||||
|
|
||||||
ObjectAnimator anim = ObjectAnimator.ofFloat(flavorImageView, "alpha", 0f, 1f);
|
|
||||||
anim.setDuration(200);
|
|
||||||
anim.start();
|
|
||||||
|
|
||||||
|
}
|
||||||
|
//flavorImageHolder.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
flavorImageHolder.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
//flavorImageHolder.setVisibility(View.VISIBLE);
|
}
|
||||||
} else {
|
|
||||||
|
@Override
|
||||||
|
public void onLoadingFailed(String arg0,
|
||||||
|
View arg1, FailReason arg2) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
flavorImageHolder.setVisibility(View.GONE);
|
flavorImageHolder.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoadingFailed(String arg0,
|
public void onLoadingStarted(String arg0,
|
||||||
View arg1, FailReason arg2) {
|
View arg1) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
flavorImageHolder.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
}
|
||||||
public void onLoadingStarted(String arg0,
|
|
||||||
View arg1) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
});
|
||||||
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!loadableImageFound && holder.flavorImageHolder != null) {
|
if (!loadableImageFound && holder.flavorImageHolder != null) {
|
||||||
|
holder.flavorImageHolder.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
} else if (holder.flavorImageHolder != null) {
|
||||||
holder.flavorImageHolder.setVisibility(View.GONE);
|
holder.flavorImageHolder.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
} else if (holder.flavorImageHolder != null) {
|
} else {
|
||||||
holder.flavorImageHolder.setVisibility(View.GONE);
|
holder.flavorImageHolder.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
String articleAuthor = article.author != null ? article.author : "";
|
String articleAuthor = article.author != null ? article.author : "";
|
||||||
|
|
||||||
@ -956,6 +966,12 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_compactLayoutMode && m_activity.isSmallScreen()) {
|
||||||
|
if (holder.headlineFooter != null) {
|
||||||
|
holder.headlineFooter.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -651,7 +651,7 @@ public class OnlineActivity extends CommonActivity {
|
|||||||
/* case android.R.id.home:
|
/* case android.R.id.home:
|
||||||
finish();
|
finish();
|
||||||
return true; */
|
return true; */
|
||||||
case R.id.headlines_toggle_sidebar:
|
/* case R.id.headlines_toggle_sidebar:
|
||||||
if (true && !isSmallScreen()) {
|
if (true && !isSmallScreen()) {
|
||||||
View v = findViewById(R.id.headlines_fragment);
|
View v = findViewById(R.id.headlines_fragment);
|
||||||
|
|
||||||
@ -663,7 +663,7 @@ public class OnlineActivity extends CommonActivity {
|
|||||||
v.setVisibility(m_prefs.getBoolean("headlines_hide_sidebar", false) ? View.GONE : View.VISIBLE);
|
v.setVisibility(m_prefs.getBoolean("headlines_hide_sidebar", false) ? View.GONE : View.VISIBLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true; */
|
||||||
case R.id.subscribe_to_feed:
|
case R.id.subscribe_to_feed:
|
||||||
Intent subscribe = new Intent(OnlineActivity.this, SubscribeActivity.class);
|
Intent subscribe = new Intent(OnlineActivity.this, SubscribeActivity.class);
|
||||||
startActivityForResult(subscribe, 0);
|
startActivityForResult(subscribe, 0);
|
||||||
|
@ -20,7 +20,6 @@ import android.view.KeyEvent;
|
|||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
@ -257,7 +256,7 @@ public class OfflineActivity extends CommonActivity {
|
|||||||
/* case android.R.id.home:
|
/* case android.R.id.home:
|
||||||
finish();
|
finish();
|
||||||
return true; */
|
return true; */
|
||||||
case R.id.headlines_toggle_sidebar:
|
/* case R.id.headlines_toggle_sidebar:
|
||||||
if (true && !isSmallScreen()) {
|
if (true && !isSmallScreen()) {
|
||||||
SharedPreferences.Editor editor = m_prefs.edit();
|
SharedPreferences.Editor editor = m_prefs.edit();
|
||||||
editor.putBoolean("headlines_hide_sidebar", !m_prefs.getBoolean("headlines_hide_sidebar", false));
|
editor.putBoolean("headlines_hide_sidebar", !m_prefs.getBoolean("headlines_hide_sidebar", false));
|
||||||
@ -267,7 +266,7 @@ public class OfflineActivity extends CommonActivity {
|
|||||||
ohf.getView().setVisibility(m_prefs.getBoolean("headlines_hide_sidebar", false) ? View.GONE : View.VISIBLE);
|
ohf.getView().setVisibility(m_prefs.getBoolean("headlines_hide_sidebar", false) ? View.GONE : View.VISIBLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true; */
|
||||||
case R.id.go_online:
|
case R.id.go_online:
|
||||||
switchOnline();
|
switchOnline();
|
||||||
return true;
|
return true;
|
||||||
|
@ -155,14 +155,7 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
|
|||||||
public void onSaveInstanceState(Bundle out) {
|
public void onSaveInstanceState(Bundle out) {
|
||||||
super.onSaveInstanceState(out);
|
super.onSaveInstanceState(out);
|
||||||
|
|
||||||
//out.putBoolean("actionbarUpEnabled", m_actionbarUpEnabled);
|
|
||||||
//out.putInt("actionbarRevertDepth", m_actionbarRevertDepth);
|
|
||||||
out.putBoolean("feedIsSelected", m_feedIsSelected);
|
out.putBoolean("feedIsSelected", m_feedIsSelected);
|
||||||
//out.putBoolean("feedWasSelected", m_feedWasSelected);
|
|
||||||
|
|
||||||
|
|
||||||
//if (m_slidingMenu != null )
|
|
||||||
// out.putBoolean("slidingMenuVisible", m_slidingMenu.isMenuShowing());
|
|
||||||
|
|
||||||
GlobalState.getInstance().save(out);
|
GlobalState.getInstance().save(out);
|
||||||
}
|
}
|
||||||
@ -185,7 +178,7 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
|
|||||||
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.headlines_toggle_sidebar).setVisible(false);
|
//m_menu.findItem(R.id.headlines_toggle_sidebar).setVisible(false);
|
||||||
|
|
||||||
MenuItem item = m_menu.findItem(R.id.show_feeds);
|
MenuItem item = m_menu.findItem(R.id.show_feeds);
|
||||||
|
|
||||||
|
@ -12,7 +12,6 @@ import android.support.v4.app.Fragment;
|
|||||||
import android.support.v4.app.FragmentTransaction;
|
import android.support.v4.app.FragmentTransaction;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
|
||||||
|
|
||||||
import org.fox.ttrss.GlobalState;
|
import org.fox.ttrss.GlobalState;
|
||||||
import org.fox.ttrss.R;
|
import org.fox.ttrss.R;
|
||||||
@ -39,9 +38,9 @@ public class OfflineHeadlinesActivity extends OfflineActivity implements Offline
|
|||||||
setStatusBarTint();
|
setStatusBarTint();
|
||||||
setSmallScreen(findViewById(R.id.sw600dp_anchor) == null);
|
setSmallScreen(findViewById(R.id.sw600dp_anchor) == null);
|
||||||
|
|
||||||
if (isPortrait() || m_prefs.getBoolean("headlines_hide_sidebar", false)) {
|
/* if (isPortrait() || m_prefs.getBoolean("headlines_hide_sidebar", false)) {
|
||||||
findViewById(R.id.headlines_fragment).setVisibility(View.GONE);
|
findViewById(R.id.headlines_fragment).setVisibility(View.GONE);
|
||||||
}
|
} */
|
||||||
|
|
||||||
if (savedInstanceState == null) {
|
if (savedInstanceState == null) {
|
||||||
Intent i = getIntent();
|
Intent i = getIntent();
|
||||||
@ -141,7 +140,7 @@ public class OfflineHeadlinesActivity extends OfflineActivity implements Offline
|
|||||||
//OfflineHeadlinesFragment hf = (OfflineHeadlinesFragment)getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
|
//OfflineHeadlinesFragment hf = (OfflineHeadlinesFragment)getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
|
||||||
|
|
||||||
m_menu.setGroupVisible(R.id.menu_group_headlines, !isPortrait() && !isSmallScreen());
|
m_menu.setGroupVisible(R.id.menu_group_headlines, !isPortrait() && !isSmallScreen());
|
||||||
m_menu.findItem(R.id.headlines_toggle_sidebar).setVisible(!isPortrait() && !isSmallScreen());
|
//m_menu.findItem(R.id.headlines_toggle_sidebar).setVisible(!isPortrait() && !isSmallScreen());
|
||||||
|
|
||||||
Fragment af = getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE);
|
Fragment af = getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE);
|
||||||
|
|
||||||
|
@ -12,27 +12,25 @@
|
|||||||
android:visibility="gone" >
|
android:visibility="gone" >
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<android.support.v4.widget.DrawerLayout
|
||||||
android:id="@+id/fragment_container"
|
android:id="@+id/headlines_drawer"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent">
|
||||||
android:orientation="vertical" >
|
|
||||||
|
|
||||||
<FrameLayout
|
|
||||||
android:id="@+id/headlines_fragment"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_weight="0.3"
|
|
||||||
android:background="?headlinesBackgroundSolid" >
|
|
||||||
</FrameLayout>
|
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/article_fragment"
|
android:id="@+id/article_fragment"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="0.7"
|
android:background="?articleBackground">
|
||||||
android:background="?articleBackground" >
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
</LinearLayout>
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/headlines_fragment"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_width="300dp"
|
||||||
|
android:layout_gravity="start"
|
||||||
|
android:background="?headlinesBackgroundSolid">
|
||||||
|
</FrameLayout>
|
||||||
|
</android.support.v4.widget.DrawerLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
@ -4,28 +4,25 @@
|
|||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent">
|
android:layout_height="fill_parent">
|
||||||
|
|
||||||
<LinearLayout
|
<android.support.v4.widget.DrawerLayout
|
||||||
android:id="@+id/fragment_container"
|
android:id="@+id/headlines_drawer"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent">
|
||||||
android:baselineAligned="false"
|
|
||||||
android:orientation="horizontal" >
|
|
||||||
|
|
||||||
<FrameLayout
|
|
||||||
android:id="@+id/headlines_fragment"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="0"
|
|
||||||
android:background="?feedlistBackground" >
|
|
||||||
</FrameLayout>
|
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/article_fragment"
|
android:id="@+id/article_fragment"
|
||||||
android:layout_width="0dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"
|
android:background="?articleBackground">
|
||||||
android:background="?articleBackground" >
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
</LinearLayout>
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/headlines_fragment"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_width="240dp"
|
||||||
|
android:layout_gravity="start"
|
||||||
|
android:background="?headlinesBackgroundSolid">
|
||||||
|
</FrameLayout>
|
||||||
|
</android.support.v4.widget.DrawerLayout>
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
@ -125,6 +125,7 @@
|
|||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:id="@+id/headline_footer"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
|
@ -126,6 +126,7 @@
|
|||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:id="@+id/headline_footer"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
|
@ -127,6 +127,7 @@
|
|||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:id="@+id/headline_footer"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
|
@ -126,6 +126,7 @@
|
|||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:id="@+id/headline_footer"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
|
@ -64,10 +64,10 @@
|
|||||||
app:showAsAction=""
|
app:showAsAction=""
|
||||||
android:title="@string/headlines_view_mode"/>
|
android:title="@string/headlines_view_mode"/>
|
||||||
|
|
||||||
<item
|
<!-- <item
|
||||||
android:id="@+id/headlines_toggle_sidebar"
|
android:id="@+id/headlines_toggle_sidebar"
|
||||||
app:showAsAction=""
|
app:showAsAction=""
|
||||||
android:title="@string/toggle_sidebar"/>
|
android:title="@string/toggle_sidebar"/> -->
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
<item
|
<item
|
||||||
|
@ -33,10 +33,10 @@
|
|||||||
app:showAsAction=""
|
app:showAsAction=""
|
||||||
android:title="@string/headlines_view_mode"/>
|
android:title="@string/headlines_view_mode"/>
|
||||||
|
|
||||||
<item
|
<!-- <item
|
||||||
android:id="@+id/headlines_toggle_sidebar"
|
android:id="@+id/headlines_toggle_sidebar"
|
||||||
app:showAsAction=""
|
app:showAsAction=""
|
||||||
android:title="@string/toggle_sidebar"/>
|
android:title="@string/toggle_sidebar"/> -->
|
||||||
</group>
|
</group>
|
||||||
<!--
|
<!--
|
||||||
<group android:id="@+id/menu_group_headlines_selection" >
|
<group android:id="@+id/menu_group_headlines_selection" >
|
||||||
|
Loading…
Reference in New Issue
Block a user