offline: modernize UI
This commit is contained in:
parent
f10c37563a
commit
d9563da33d
@ -51,6 +51,7 @@
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".offline.OfflineFeedsActivity"
|
||||
android:uiOptions="splitActionBarWhenNarrow"
|
||||
android:label="@string/app_name" >
|
||||
</activity>
|
||||
<activity
|
||||
|
@ -3,7 +3,7 @@
|
||||
<item
|
||||
android:id="@+id/selection_toggle_unread"
|
||||
android:showAsAction="ifRoom"
|
||||
android:icon="@drawable/ic_undo_light"
|
||||
android:icon="@drawable/ic_unread_light"
|
||||
android:title="@string/selection_toggle_unread"/>
|
||||
|
||||
<item
|
||||
|
@ -23,10 +23,13 @@
|
||||
android:title="@string/search"/>
|
||||
<item
|
||||
android:id="@+id/headlines_mark_as_read"
|
||||
android:icon="@drawable/ic_accept_light"
|
||||
android:showAsAction="ifRoom"
|
||||
android:title="@string/headlines_mark_as_read"/>
|
||||
<item
|
||||
android:id="@+id/headlines_select"
|
||||
android:showAsAction=""
|
||||
android:icon="@drawable/ic_select_all_light"
|
||||
android:showAsAction="ifRoom"
|
||||
android:title="@string/headlines_select"/>
|
||||
</group>
|
||||
<group android:id="@+id/menu_group_headlines_selection" >
|
||||
@ -62,14 +65,13 @@
|
||||
android:title="@string/article_toggle_published"/>
|
||||
<item
|
||||
android:id="@+id/share_article"
|
||||
android:actionProviderClass="android.widget.ShareActionProvider"
|
||||
android:icon="@drawable/ic_share_light"
|
||||
android:showAsAction=""
|
||||
android:showAsAction="ifRoom"
|
||||
android:title="@string/share_article"/>
|
||||
<item
|
||||
android:id="@+id/set_unread"
|
||||
android:icon="@drawable/ic_read_light"
|
||||
android:showAsAction=""
|
||||
android:showAsAction="ifRoom"
|
||||
android:title="@string/article_set_unread"/>
|
||||
<item
|
||||
android:id="@+id/catchup_above"
|
||||
|
@ -27,7 +27,6 @@ import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.widget.EditText;
|
||||
import android.widget.SearchView;
|
||||
import android.widget.ShareActionProvider;
|
||||
|
||||
public class OfflineActivity extends CommonActivity {
|
||||
private final String TAG = this.getClass().getSimpleName();
|
||||
@ -269,7 +268,7 @@ public class OfflineActivity extends CommonActivity {
|
||||
}
|
||||
return true;
|
||||
case R.id.share_article:
|
||||
if (android.os.Build.VERSION.SDK_INT < 14 && oap != null && android.os.Build.VERSION.SDK_INT < 14) {
|
||||
if (true) {
|
||||
int articleId = oap.getSelectedArticleId();
|
||||
|
||||
shareArticle(articleId);
|
||||
@ -408,20 +407,6 @@ public class OfflineActivity extends CommonActivity {
|
||||
m_menu.setGroupVisible(R.id.menu_group_article, false);
|
||||
m_menu.setGroupVisible(R.id.menu_group_feeds, false);
|
||||
|
||||
if (android.os.Build.VERSION.SDK_INT >= 14) {
|
||||
ShareActionProvider shareProvider = (ShareActionProvider) m_menu.findItem(R.id.share_article).getActionProvider();
|
||||
|
||||
OfflineArticlePager af = (OfflineArticlePager) getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE);
|
||||
|
||||
if (af != null && af.getSelectedArticleId() > 0) {
|
||||
shareProvider.setShareIntent(getShareIntent(getArticleById(af.getSelectedArticleId())));
|
||||
|
||||
if (!isSmallScreen()) {
|
||||
m_menu.findItem(R.id.share_article).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!isCompatMode()) {
|
||||
MenuItem search = m_menu.findItem(R.id.search);
|
||||
|
||||
@ -435,6 +420,31 @@ public class OfflineActivity extends CommonActivity {
|
||||
}
|
||||
}
|
||||
|
||||
OfflineArticlePager ap = (OfflineArticlePager) getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE);
|
||||
|
||||
if (ap != null) {
|
||||
int articleId = ap.getSelectedArticleId();
|
||||
|
||||
Cursor article = getArticleById(articleId);
|
||||
|
||||
if (article != null) {
|
||||
boolean unread = article.getInt(article.getColumnIndex("unread")) == 1;
|
||||
boolean marked = article.getInt(article.getColumnIndex("marked")) == 1;
|
||||
boolean published = article.getInt(article.getColumnIndex("published")) == 1;
|
||||
|
||||
m_menu.findItem(R.id.toggle_marked).setIcon(marked ? R.drawable.ic_important_light :
|
||||
R.drawable.ic_unimportant_light);
|
||||
|
||||
m_menu.findItem(R.id.toggle_published).setIcon(published ? R.drawable.ic_menu_published_light :
|
||||
R.drawable.ic_menu_unpublished_light);
|
||||
|
||||
m_menu.findItem(R.id.set_unread).setIcon(unread ? R.drawable.ic_unread_light :
|
||||
R.drawable.ic_read_light);
|
||||
|
||||
article.close();
|
||||
}
|
||||
}
|
||||
|
||||
SearchView searchView = (SearchView) search.getActionView();
|
||||
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
|
||||
private String query = "";
|
||||
@ -618,8 +628,10 @@ public class OfflineActivity extends CommonActivity {
|
||||
.findFragmentByTag(FRAG_HEADLINES);
|
||||
|
||||
if (ohf != null) {
|
||||
ohf.refresh();
|
||||
}
|
||||
ohf.refresh();
|
||||
}
|
||||
|
||||
initMenu();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -192,11 +192,9 @@ public class OfflineArticlePager extends Fragment {
|
||||
public void onPageSelected(int position) {
|
||||
if (m_cursor.moveToPosition(position)) {
|
||||
int articleId = m_cursor.getInt(m_cursor.getColumnIndex(BaseColumns._ID));
|
||||
|
||||
m_listener.onArticleSelected(articleId, false);
|
||||
|
||||
m_articleId = articleId;
|
||||
|
||||
m_listener.onArticleSelected(articleId, false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -272,6 +272,8 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
|
||||
stmt.execute();
|
||||
stmt.close();
|
||||
|
||||
initMenu();
|
||||
|
||||
if (open) {
|
||||
if (isSmallScreen()) {
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user