headlines fragment: inject footer on setarticles()
top changed: notify via snackbar remove some unused views
This commit is contained in:
parent
1f01a82fb5
commit
31858ef90a
@ -623,7 +623,14 @@ public class HeadlinesFragment extends Fragment {
|
||||
//Log.d(TAG, "first id changed, disabling lazy load");
|
||||
|
||||
if (!(m_activity instanceof DetailActivity)) {
|
||||
m_articles.add(new Article(Article.TYPE_TOP_CHANGED));
|
||||
|
||||
Snackbar.make(getView(), R.string.headlines_row_top_changed, Snackbar.LENGTH_LONG)
|
||||
.setAction(R.string.reload, new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
refresh(false);
|
||||
}
|
||||
}).show();
|
||||
}
|
||||
}
|
||||
|
||||
@ -775,7 +782,6 @@ public class HeadlinesFragment extends Fragment {
|
||||
public ImageView textChecked;
|
||||
public View headlineHeader;
|
||||
public View flavorImageOverflow;
|
||||
public View rowTopChanged;
|
||||
public TextureView flavorVideoView;
|
||||
//public int position;
|
||||
public boolean flavorImageEmbedded;
|
||||
@ -817,7 +823,6 @@ public class HeadlinesFragment extends Fragment {
|
||||
textImage = (ImageView) v.findViewById(R.id.text_image);
|
||||
textChecked = (ImageView) v.findViewById(R.id.text_checked);
|
||||
headlineHeader = v.findViewById(R.id.headline_header);
|
||||
rowTopChanged = v.findViewById(R.id.headlines_row_top_changed);
|
||||
flavorImageOverflow = v.findViewById(R.id.gallery_overflow);
|
||||
flavorVideoView = (TextureView) v.findViewById(R.id.flavor_video);
|
||||
|
||||
@ -866,8 +871,7 @@ public class HeadlinesFragment extends Fragment {
|
||||
public static final int VIEW_SELECTED = 2;
|
||||
public static final int VIEW_SELECTED_UNREAD = 3;
|
||||
public static final int VIEW_LOADMORE = 4;
|
||||
public static final int VIEW_TOP_CHANGED = 5;
|
||||
public static final int VIEW_AMR_FOOTER = 6;
|
||||
public static final int VIEW_AMR_FOOTER = 5;
|
||||
|
||||
public static final int VIEW_COUNT = VIEW_AMR_FOOTER + 1;
|
||||
|
||||
@ -919,9 +923,6 @@ public class HeadlinesFragment extends Fragment {
|
||||
case VIEW_AMR_FOOTER:
|
||||
layoutId = R.layout.headlines_footer;
|
||||
break;
|
||||
case VIEW_TOP_CHANGED:
|
||||
layoutId = R.layout.headlines_row_top_changed;
|
||||
break;
|
||||
case VIEW_LOADMORE:
|
||||
layoutId = R.layout.headlines_row_loadmore;
|
||||
break;
|
||||
@ -960,15 +961,6 @@ public class HeadlinesFragment extends Fragment {
|
||||
holder.view.setLayoutParams(new ListView.LayoutParams(ListView.LayoutParams.MATCH_PARENT, screenHeight));
|
||||
}
|
||||
|
||||
if (holder.rowTopChanged != null) {
|
||||
holder.rowTopChanged.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
refresh(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// nothing else of interest for those below anyway
|
||||
if (article.id < 0) return;
|
||||
|
||||
@ -1499,8 +1491,6 @@ public class HeadlinesFragment extends Fragment {
|
||||
return VIEW_AMR_FOOTER;
|
||||
} else if (a.id == Article.TYPE_LOADMORE) {
|
||||
return VIEW_LOADMORE;
|
||||
} else if (a.id == Article.TYPE_TOP_CHANGED) {
|
||||
return VIEW_TOP_CHANGED;
|
||||
} else if (m_activeArticle != null && a.id == m_activeArticle.id && a.unread) {
|
||||
return VIEW_SELECTED_UNREAD;
|
||||
} else if (m_activeArticle != null && a.id == m_activeArticle.id) {
|
||||
@ -1804,6 +1794,9 @@ public class HeadlinesFragment extends Fragment {
|
||||
public void setArticles(ArticleList articles) {
|
||||
m_articles.clear();
|
||||
m_articles.addAll(articles);
|
||||
|
||||
m_articles.add(new Article(Article.TYPE_AMR_FOOTER));
|
||||
|
||||
m_adapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,6 @@ import java.util.regex.Pattern;
|
||||
public class Article implements Parcelable {
|
||||
public static final int TYPE_LOADMORE = -1;
|
||||
public static final int TYPE_AMR_FOOTER = -2;
|
||||
public static final int TYPE_TOP_CHANGED = -3;
|
||||
|
||||
public int id;
|
||||
public boolean unread;
|
||||
|
@ -1,19 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/headlines_row_top_changed"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:padding="16dp"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
|
||||
<TextView
|
||||
android:background="@drawable/ripple"
|
||||
android:id="@+id/top_changed_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?headlineExcerptTextColor"
|
||||
android:text="@string/headlines_row_top_changed" />
|
||||
|
||||
</LinearLayout>
|
@ -1,29 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/headlines_row_undo"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:background="?colorPrimaryDark"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="16dp"
|
||||
android:weightSum="1">
|
||||
|
||||
<TextView
|
||||
android:background="@drawable/ripple"
|
||||
android:id="@+id/top_changed_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/primary_text_dark"
|
||||
android:text="@string/headline_undo_row_prompt"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<Button
|
||||
android:background="@drawable/ripple"
|
||||
android:id="@+id/headlines_row_undo_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/primary_text_dark"
|
||||
android:text="@string/headline_undo_row_button" />
|
||||
|
||||
</LinearLayout>
|
@ -254,4 +254,5 @@
|
||||
<string name="pref_widget_background">Widget theme</string>
|
||||
<string name="pref_widget_update_interval_summary">This interval is imprecise due to Android limitations</string>
|
||||
<string name="prefs_offline_sort_by_feed">Group headlines by feeds</string>
|
||||
<string name="reload">Reload</string>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user