remove hardcoded gray from headline rows layout

properly deselect active article in headlines when closing article panel
This commit is contained in:
Andrew Dolgov 2012-06-22 17:40:29 +04:00
parent fbb131fa0c
commit 16fda5c5ae
13 changed files with 33 additions and 35 deletions

View File

@ -68,7 +68,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Jan 01, 00:00"
android:textColor="#909090"
android:textColor="?headlineExcerptTextColor"
android:textSize="11sp" />
<TextView

View File

@ -68,7 +68,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Jan 01, 00:00"
android:textColor="#909090"
android:textColor="?headlineSelectedExcerptTextColor"
android:textSize="11sp" />
<TextView
@ -80,7 +80,7 @@
android:gravity="right"
android:singleLine="true"
android:text="{Feed title...}"
android:textColor="?headlineExcerptTextColor"
android:textColor="?headlineSelectedExcerptTextColor"
android:textSize="11sp" />
<ImageView

View File

@ -68,7 +68,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Jan 01, 00:00"
android:textColor="#909090"
android:textColor="?headlineExcerptTextColor"
android:textSize="11sp" />
<TextView

View File

@ -63,7 +63,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Jan 01"
android:textColor="#909090"
android:textColor="?headlineSelectedExcerptTextColor"
android:textSize="13sp" >
</TextView>

View File

@ -64,7 +64,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Jan 01"
android:textColor="#909090"
android:textColor="?headlineExcerptTextColor"
android:textSize="13sp" >
</TextView>

View File

@ -63,7 +63,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Jan 01"
android:textColor="#909090"
android:textColor="?headlineSelectedExcerptTextColor"
android:textSize="13sp" >
</TextView>

View File

@ -63,7 +63,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Jan 01"
android:textColor="#909090"
android:textColor="?headlineExcerptTextColor"
android:textSize="13sp" >
</TextView>

View File

@ -76,7 +76,7 @@
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="Jan 01"
android:textColor="#909090"
android:textColor="?headlineExcerptTextColor"
android:textSize="10sp" >
</TextView>

View File

@ -66,7 +66,7 @@
android:gravity="center_horizontal|right"
android:singleLine="true"
android:text="{Feed title...}"
android:textColor="?headlineExcerptTextColor"
android:textColor="?headlineSelectedExcerptTextColor"
android:textSize="10sp" />
<TextView
@ -75,7 +75,7 @@
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="Jan 01"
android:textColor="#909090"
android:textColor="?headlineSelectedExcerptTextColor"
android:textSize="10sp" >
</TextView>

View File

@ -75,7 +75,7 @@
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="Jan 01"
android:textColor="#909090"
android:textColor="?headlineExcerptTextColor"
android:textSize="10sp" >
</TextView>

View File

@ -64,7 +64,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
private final String TAG = this.getClass().getSimpleName();
private Feed m_feed;
private int m_activeArticleId;
private Article m_activeArticle;
private boolean m_refreshInProgress = false;
private boolean m_canLoadMore = false;
private boolean m_combinedMode = true;
@ -128,7 +128,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
if (savedInstanceState != null) {
m_feed = savedInstanceState.getParcelable("feed");
m_articles = savedInstanceState.getParcelable("articles");
m_activeArticleId = savedInstanceState.getInt("activeArticleId");
m_activeArticle = savedInstanceState.getParcelable("activeArticle");
m_selectedArticles = savedInstanceState.getParcelable("selectedArticles");
m_canLoadMore = savedInstanceState.getBoolean("canLoadMore");
m_combinedMode = savedInstanceState.getBoolean("combinedMode");
@ -183,7 +183,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
m_onlineServices.openArticle(article, 0);
}
m_activeArticleId = article.id;
m_activeArticle = article;
m_adapter.notifyDataSetChanged();
}
}
@ -245,7 +245,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
out.putParcelable("feed", m_feed);
out.putParcelable("articles", m_articles);
out.putInt("activeArticleId", m_activeArticleId);
out.putParcelable("activeArticle", m_activeArticle);
out.putParcelable("selectedArticles", m_selectedArticles);
out.putBoolean("canLoadMore", m_canLoadMore);
out.putBoolean("combinedMode", m_combinedMode);
@ -355,7 +355,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
if (a.id == -1) {
return VIEW_LOADMORE;
} else if (a.id == m_activeArticleId) {
} else if (m_activeArticle != null && a.id == m_activeArticle.id) {
return VIEW_SELECTED;
} else if (a.unread) {
return VIEW_UNREAD;
@ -606,23 +606,22 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
m_adapter.notifyDataSetChanged();
Article article = m_onlineServices.getSelectedArticle();
if (article != null) {
setActiveArticleId(article.id);
}
setActiveArticle(article);
}
public ArticleList getAllArticles() {
return m_articles;
}
public void setActiveArticleId(int id) {
m_activeArticleId = id;
public void setActiveArticle(Article article) {
m_activeArticle = article;
m_adapter.notifyDataSetChanged();
ListView list = (ListView)getView().findViewById(R.id.headlines);
if (list != null) {
int position = m_adapter.getPosition(getArticleById(id));
if (list != null && article != null) {
int position = m_adapter.getPosition(article);
list.setSelection(position);
}
}
@ -677,8 +676,8 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
// no-op
}
public int getActiveArticleId() {
return m_activeArticleId;
public Article getActiveArticle() {
return m_activeArticle;
}
public int getArticlePosition(Article article) {

View File

@ -1300,6 +1300,8 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
findViewById(R.id.feeds_fragment).setVisibility(View.VISIBLE);
findViewById(R.id.article_fragment).setVisibility(View.GONE);
ft.replace(R.id.article_fragment, new DummyFragment(), FRAG_ARTICLE);
updateHeadlines();
}
ft.commit();
@ -1717,7 +1719,7 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
.findFragmentByTag(FRAG_HEADLINES);
if (hf != null) {
hf.setActiveArticleId(article.id);
hf.setActiveArticle(article);
}
Fragment frag;
@ -2044,13 +2046,13 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
.findFragmentByTag(FRAG_HEADLINES);
if (hf != null && m_activeFeed != null) {
Article base = hf.getArticleById(hf.getActiveArticleId());
Article base = hf.getActiveArticle();
Article next = base != null ? getRelativeArticle(base,
RelativeArticle.AFTER) : hf.getArticleAtPosition(0);
if (next != null) {
hf.setActiveArticleId(next.id);
hf.setActiveArticle(next);
boolean combinedMode = m_prefs.getBoolean(
"combined_mode", false);
@ -2071,14 +2073,14 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
.findFragmentByTag(FRAG_HEADLINES);
if (hf != null && m_activeFeed != null) {
Article base = hf.getArticleById(hf.getActiveArticleId());
Article base = hf.getActiveArticle();
Article prev = base != null ? getRelativeArticle(base,
RelativeArticle.BEFORE) : hf
.getArticleAtPosition(0);
if (prev != null) {
hf.setActiveArticleId(prev.id);
hf.setActiveArticle(prev);
boolean combinedMode = m_prefs.getBoolean(
"combined_mode", false);

View File

@ -11,7 +11,6 @@ public interface OnlineServices {
public void saveArticleUnread(final Article article);
public void saveArticleMarked(final Article article);
public void saveArticlePublished(final Article article);
public void updateHeadlines();
public void openArticle(Article article, int compatAnimation);
public Article getRelativeArticle(Article article, RelativeArticle ra);
@ -20,8 +19,6 @@ public interface OnlineServices {
public void initMainMenu();
public void login();
//public Feed getActiveFeed();
//public FeedCategory getActiveCategory();
public String getSessionId();
public boolean getUnreadArticlesOnly();
public boolean isSmallScreen();