Merge branch 'master' of github.com:gothfox/Tiny-Tiny-RSS-for-Honeycomb

This commit is contained in:
Andrew Dolgov 2013-05-21 14:31:15 +04:00
commit 4f49ae38dd
29 changed files with 338 additions and 87 deletions

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.fox.ttrss"
android:versionCode="168"
android:versionName="1.7.5" >
android:versionCode="169"
android:versionName="1.7.6" >
<uses-sdk
android:minSdkVersion="8"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 287 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 350 B

View File

@ -3,6 +3,8 @@
<item android:drawable="@color/ics_cyan"/>
<item android:drawable="@drawable/shadow"/>
<item><bitmap
xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/arrowhead_dark"

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:drawable="@color/headlines_light"/>
<!-- <item android:drawable="@color/headlines_light"/> -->
<item android:drawable="@drawable/shadow"/>
</layer-list>

View File

@ -4,6 +4,7 @@
android:layout_width="match_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:background="?feedsSelectedBackground"
android:descendantFocusability="blocksDescendants"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingBottom="10dip"
@ -43,4 +44,15 @@
android:textSize="13sp"
android:textStyle="bold" />
<ImageButton
android:id="@+id/feed_menu_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:background="@null"
android:paddingLeft="6dp"
android:paddingTop="6dp"
android:src="@drawable/ic_mailbox_collapsed_holo_light"
android:visibility="gone" />
</LinearLayout>

View File

@ -3,6 +3,7 @@
android:id="@+id/feeds_row"
android:layout_width="match_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:descendantFocusability="blocksDescendants"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingBottom="10dip"
@ -42,4 +43,15 @@
android:textSize="13sp"
android:textStyle="bold" />
<ImageButton
android:id="@+id/feed_menu_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:background="@null"
android:paddingLeft="6dp"
android:paddingTop="6dp"
android:visibility="gone"
android:src="@drawable/ic_mailbox_collapsed_holo_light" />
</LinearLayout>

View File

@ -4,6 +4,7 @@
android:layout_width="match_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:background="?feedsSelectedBackgroundSolid"
android:descendantFocusability="blocksDescendants"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingBottom="10dip"
@ -43,4 +44,15 @@
android:textSize="13sp"
android:textStyle="bold" />
<ImageButton
android:id="@+id/feed_menu_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:background="@null"
android:paddingLeft="6dp"
android:paddingTop="6dp"
android:visibility="gone"
android:src="@drawable/ic_mailbox_collapsed_holo_light" />
</LinearLayout>

View File

@ -120,6 +120,15 @@
android:clickable="true"
android:src="@drawable/ic_rss_bw" />
<ImageButton
android:id="@+id/article_menu_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:background="@null"
android:paddingLeft="6dp"
android:paddingTop="6dp"
android:src="@drawable/ic_mailbox_collapsed_holo_light" />
</LinearLayout>
</LinearLayout>

View File

@ -120,6 +120,16 @@
android:layout_weight="0"
android:clickable="true"
android:src="@drawable/ic_rss_bw" />
<ImageButton
android:id="@+id/article_menu_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:background="@null"
android:paddingLeft="6dp"
android:paddingTop="6dp"
android:src="@drawable/ic_mailbox_collapsed_holo_light" />
</LinearLayout>

View File

@ -122,6 +122,15 @@
android:clickable="true"
android:src="@drawable/ic_rss_bw" />
<ImageButton
android:id="@+id/article_menu_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:background="@null"
android:paddingLeft="6dp"
android:paddingTop="6dp"
android:src="@drawable/ic_mailbox_collapsed_holo_light" />
</LinearLayout>
</LinearLayout>

View File

@ -118,9 +118,19 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:clickable="true"
android:clickable="true"
android:src="@drawable/ic_rss_bw" />
<ImageButton
android:id="@+id/article_menu_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:background="@null"
android:paddingLeft="6dp"
android:paddingTop="6dp"
android:src="@drawable/ic_mailbox_collapsed_holo_light" />
</LinearLayout>
</LinearLayout>

View File

@ -51,7 +51,7 @@
<style name="DarkTheme" parent="Theme.Sherlock">
<item name="smallScreenBackground">@android:color/transparent</item>
<item name="ttrssHorizontalDivider">@android:drawable/divider_horizontal_dark</item>
<item name="feedlistBackground">@drawable/ics_divider_vertical</item>
<item name="feedlistBackground">@android:color/transparent</item>
<item name="unreadCounterColor">@color/ics_cyan</item>
<item name="headlinesBackground">@drawable/headlines_dark</item>
<item name="headlinesBackgroundSolid">@drawable/headlines_dark</item>

View File

@ -196,4 +196,5 @@
<string name="pref_headlines_mark_read_scroll">Mark read on scroll</string>
<string name="pref_headlines_mark_read_scroll_long">Headlines will be marked read when scrolling past them</string>
<string name="mark_num_headlines_as_read">Mark %1$d article(s) as read?</string>
<string name="prefs_confirm_headlines_catchup">Confirm marking articles as read</string>
</resources>

View File

@ -129,6 +129,12 @@
android:defaultValue="false"
android:key="full_screen_mode"
android:title="@string/prefs_fullscreen_mode" />
<CheckBoxPreference
android:defaultValue="true"
android:key="confirm_headlines_catchup"
android:title="@string/prefs_confirm_headlines_catchup" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/offline_mode" >
<ListPreference

View File

@ -166,6 +166,13 @@ public class CommonActivity extends SherlockFragmentActivity {
toast.show();
}
public boolean isDarkTheme() {
String defaultTheme = "THEME_DARK";
return (m_prefs.getString("theme", defaultTheme).equals("THEME_DARK")) ||
m_prefs.getString("theme", defaultTheme).equals("THEME_DARK_GRAY");
}
protected void setAppTheme(SharedPreferences prefs) {
String defaultTheme = "THEME_DARK";

View File

@ -21,6 +21,7 @@ import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.View.OnClickListener;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
@ -29,6 +30,7 @@ import android.widget.AdapterView;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
@ -406,6 +408,21 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe
icon.setImageResource(cat.unread > 0 ? R.drawable.ic_rss : R.drawable.ic_rss_bw);
}
ImageButton ib = (ImageButton) v.findViewById(R.id.feed_menu_button);
if (ib != null) {
if (m_activity.isDarkTheme())
ib.setImageResource(R.drawable.ic_mailbox_collapsed_holo_dark);
ib.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
getActivity().openContextMenu(v);
}
});
}
return v;
}
}
@ -422,6 +439,8 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe
public void onItemClick(AdapterView<?> av, View view, int position, long id) {
ListView list = (ListView)av;
Log.d(TAG, "onItemClick=" + position);
if (list != null) {
FeedCategory cat = (FeedCategory)list.getItemAtPosition(position);
@ -438,8 +457,8 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe
}
}
if (!m_activity.isSmallScreen())
m_selectedCat = cat;
//if (!m_activity.isSmallScreen())
// m_selectedCat = cat;
m_adapter.notifyDataSetChanged();
}

View File

@ -34,6 +34,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
protected long m_lastRefresh = 0;
private boolean m_actionbarUpEnabled = false;
private int m_actionbarRevertDepth = 0;
@SuppressLint("NewApi")
@Override
@ -58,10 +59,8 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
if (intent.getParcelableExtra("feed") != null || intent.getParcelableExtra("category") != null ||
intent.getParcelableExtra("article") != null) {
if (!isCompatMode()) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
m_actionbarUpEnabled = true;
}
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
m_actionbarUpEnabled = true;
Feed feed = (Feed) intent.getParcelableExtra("feed");
FeedCategory cat = (FeedCategory) intent.getParcelableExtra("category");
@ -120,6 +119,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
}
} else { // savedInstanceState != null
m_actionbarUpEnabled = savedInstanceState.getBoolean("actionbarUpEnabled");
m_actionbarRevertDepth = savedInstanceState.getInt("actionbarRevertDepth");
if (!isSmallScreen()) {
// temporary hack because FeedsActivity doesn't track whether active feed is open
@ -127,7 +127,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
container.setWeightSum(3f);
}
if (!isCompatMode() && m_actionbarUpEnabled) {
if (m_actionbarUpEnabled) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
}
@ -237,7 +237,8 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
}
public void onCatSelected(FeedCategory cat, boolean openAsFeed) {
FeedCategoriesFragment fc = (FeedCategoriesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_CATS);
if (!openAsFeed) {
if (isSmallScreen()) {
@ -248,6 +249,10 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
startActivityForResult(intent, 0);
} else {
if (fc != null) {
fc.setSelectedCategory(null);
}
FragmentTransaction ft = getSupportFragmentManager()
.beginTransaction();
@ -257,8 +262,17 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
ft.addToBackStack(null);
ft.commit();
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
m_actionbarUpEnabled = true;
m_actionbarRevertDepth = m_actionbarRevertDepth + 1;
}
} else {
if (fc != null) {
fc.setSelectedCategory(cat);
}
Feed feed = new Feed(cat.id, cat.title, true);
onFeedSelected(feed);
}
@ -271,6 +285,18 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
if (m_actionbarRevertDepth > 0) {
m_actionbarRevertDepth = m_actionbarRevertDepth - 1;
m_actionbarUpEnabled = m_actionbarRevertDepth > 0;
getSupportActionBar().setDisplayHomeAsUpEnabled(m_actionbarUpEnabled);
onBackPressed();
} else {
finish();
}
return true;
case R.id.show_feeds:
setUnreadOnly(!getUnreadOnly());
initMenu();
@ -299,6 +325,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
super.onSaveInstanceState(out);
out.putBoolean("actionbarUpEnabled", m_actionbarUpEnabled);
out.putInt("actionbarRevertDepth", m_actionbarRevertDepth);
GlobalState.getInstance().save(out);
}

View File

@ -34,6 +34,7 @@ import android.util.Base64;
import android.util.Log;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.View.OnClickListener;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
@ -42,6 +43,7 @@ import android.widget.AdapterView;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
@ -529,6 +531,20 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
}
}
ImageButton ib = (ImageButton) v.findViewById(R.id.feed_menu_button);
if (ib != null) {
if (m_activity.isDarkTheme())
ib.setImageResource(R.drawable.ic_mailbox_collapsed_holo_dark);
ib.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
getActivity().openContextMenu(v);
}
});
}
return v;
}

View File

@ -33,9 +33,7 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL
setContentView(R.layout.headlines);
if (!isCompatMode()) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setSmallScreen(findViewById(R.id.headlines_fragment) == null);

View File

@ -41,6 +41,7 @@ import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.CheckBox;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
@ -272,7 +273,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
//list.setEmptyView(view.findViewById(R.id.no_headlines));
registerForContextMenu(list);
if (m_activity.isSmallScreen() || m_activity.isPortrait())
if (m_activity.isSmallScreen())
view.findViewById(R.id.headlines_fragment).setPadding(0, 0, 0, 0);
Log.d(TAG, "onCreateView, feed=" + m_feed);
@ -721,17 +722,19 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
});
}
/* ImageButton ib = (ImageButton) v.findViewById(R.id.article_menu_button);
ImageButton ib = (ImageButton) v.findViewById(R.id.article_menu_button);
if (ib != null) {
ib.setVisibility(android.os.Build.VERSION.SDK_INT >= 10 ? View.VISIBLE : View.GONE);
if (m_activity.isDarkTheme())
ib.setImageResource(R.drawable.ic_mailbox_collapsed_holo_dark);
ib.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
getActivity().openContextMenu(v);
}
});
} */
}
return v;
}

View File

@ -621,9 +621,9 @@ public class OnlineActivity extends CommonActivity {
final ArticlePager ap = (ArticlePager)getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE);
switch (item.getItemId()) {
case android.R.id.home:
/* case android.R.id.home:
finish();
return true;
return true; */
case R.id.subscribe_to_feed:
Intent subscribe = new Intent(OnlineActivity.this, SubscribeActivity.class);
startActivityForResult(subscribe, 0);
@ -749,55 +749,35 @@ public class OnlineActivity extends CommonActivity {
int count = hf.getUnreadArticles().size();
boolean confirm = m_prefs.getBoolean("confirm_headlines_catchup", true);
if (count > 0) {
AlertDialog.Builder builder = new AlertDialog.Builder(
OnlineActivity.this)
.setMessage(getString(R.string.mark_num_headlines_as_read, count))
.setPositiveButton(R.string.catchup,
new Dialog.OnClickListener() {
public void onClick(DialogInterface dialog,
int which) {
if (confirm) {
AlertDialog.Builder builder = new AlertDialog.Builder(
OnlineActivity.this)
.setMessage(getString(R.string.mark_num_headlines_as_read, count))
.setPositiveButton(R.string.catchup,
new Dialog.OnClickListener() {
public void onClick(DialogInterface dialog,
int which) {
ArticleList articles = hf.getUnreadArticles();
for (Article a : articles)
a.unread = false;
ApiRequest req = new ApiRequest(getApplicationContext()) {
protected void onPostExecute(JsonElement result) {
if (hf.isAdded()) {
hf.refresh(false);
}
}
};
final String articleIds = articlesToIdString(articles);
@SuppressWarnings("serial")
HashMap<String, String> map = new HashMap<String, String>() {
{
put("sid", getSessionId());
put("op", "updateArticle");
put("article_ids", articleIds);
put("mode", "0");
put("field", "2");
}
};
req.execute(map);
}
})
.setNegativeButton(R.string.dialog_cancel,
new Dialog.OnClickListener() {
public void onClick(DialogInterface dialog,
int which) {
}
});
AlertDialog dlg = builder.create();
dlg.show();
catchupVisibleArticles();
}
})
.setNegativeButton(R.string.dialog_cancel,
new Dialog.OnClickListener() {
public void onClick(DialogInterface dialog,
int which) {
}
});
AlertDialog dlg = builder.create();
dlg.show();
} else {
catchupVisibleArticles();
}
}
}
return true;
@ -1020,6 +1000,39 @@ public class OnlineActivity extends CommonActivity {
}
}
protected void catchupVisibleArticles() {
final HeadlinesFragment hf = (HeadlinesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
if (hf != null) {
ArticleList articles = hf.getUnreadArticles();
for (Article a : articles)
a.unread = false;
ApiRequest req = new ApiRequest(getApplicationContext()) {
protected void onPostExecute(JsonElement result) {
if (hf.isAdded()) {
hf.refresh(false);
}
}
};
final String articleIds = articlesToIdString(articles);
@SuppressWarnings("serial")
HashMap<String, String> map = new HashMap<String, String>() {
{
put("sid", getSessionId());
put("op", "updateArticle");
put("article_ids", articleIds);
put("mode", "0");
put("field", "2");
}
};
req.execute(map);
}
}
public void editArticleNote(final Article article) {
String note = "";

View File

@ -169,9 +169,9 @@ public class OfflineActivity extends CommonActivity {
.findFragmentByTag(FRAG_ARTICLE);
switch (item.getItemId()) {
case android.R.id.home:
/* case android.R.id.home:
finish();
return true;
return true; */
case R.id.go_online:
switchOnline();
return true;

View File

@ -15,6 +15,7 @@ import android.support.v4.widget.SimpleCursorAdapter;
import android.util.Log;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.View.OnClickListener;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
@ -22,6 +23,7 @@ import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
@ -195,8 +197,8 @@ public class OfflineFeedCategoriesFragment extends Fragment implements OnItemCli
m_activity.onCatSelected(feedId);
}
if (!m_activity.isSmallScreen())
m_selectedCatId = feedId;
/* if (!m_activity.isSmallScreen())
m_selectedCatId = feedId; */
m_adapter.notifyDataSetChanged();
}
@ -282,6 +284,21 @@ public class OfflineFeedCategoriesFragment extends Fragment implements OnItemCli
if (icon != null) {
icon.setImageResource(cursor.getInt(cursor.getColumnIndex("unread")) > 0 ? R.drawable.ic_rss : R.drawable.ic_rss_bw);
}
ImageButton ib = (ImageButton) v.findViewById(R.id.feed_menu_button);
if (ib != null) {
if (m_activity.isDarkTheme())
ib.setImageResource(R.drawable.ic_mailbox_collapsed_holo_dark);
ib.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
getActivity().openContextMenu(v);
}
});
}
return v;
}

View File

@ -24,6 +24,7 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
private final String TAG = this.getClass().getSimpleName();
private boolean m_actionbarUpEnabled = false;
private int m_actionbarRevertDepth = 0;
@SuppressLint("NewApi")
@Override
@ -44,8 +45,9 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
if (savedInstanceState != null) {
m_actionbarUpEnabled = savedInstanceState.getBoolean("actionbarUpEnabled");
m_actionbarRevertDepth = savedInstanceState.getInt("actionbarRevertDepth");
if (!isCompatMode() && m_actionbarUpEnabled) {
if (m_actionbarUpEnabled) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
@ -55,10 +57,8 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
if (intent.getIntExtra("feed", -10000) != -10000 || intent.getIntExtra("category", -10000) != -10000 ||
intent.getIntExtra("article", -10000) != -10000) {
if (!isCompatMode()) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
m_actionbarUpEnabled = true;
}
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
m_actionbarUpEnabled = true;
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
@ -129,6 +129,18 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
if (m_actionbarRevertDepth > 0) {
m_actionbarRevertDepth = m_actionbarRevertDepth - 1;
m_actionbarUpEnabled = m_actionbarRevertDepth > 0;
getSupportActionBar().setDisplayHomeAsUpEnabled(m_actionbarUpEnabled);
onBackPressed();
} else {
finish();
}
return true;
case R.id.show_feeds:
setUnreadOnly(!getUnreadOnly());
initMenu();
@ -145,6 +157,7 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
super.onSaveInstanceState(out);
out.putBoolean("actionbarUpEnabled", m_actionbarUpEnabled);
out.putInt("actionbarRevertDepth", m_actionbarRevertDepth);
GlobalState.getInstance().save(out);
}
@ -181,7 +194,13 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
}
public void onCatSelected(int catId, boolean openAsFeed) {
OfflineFeedCategoriesFragment fc = (OfflineFeedCategoriesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_CATS);
if (openAsFeed) {
if (fc != null) {
fc.setSelectedFeedId(catId);
}
onFeedSelected(catId, true, true);
} else {
if (isSmallScreen()) {
@ -190,6 +209,10 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
startActivityForResult(intent, 0);
} else {
if (fc != null) {
fc.setSelectedFeedId(-1);
}
FragmentTransaction ft = getSupportFragmentManager()
.beginTransaction();
@ -198,6 +221,10 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
ft.replace(R.id.feeds_fragment, ff, FRAG_FEEDS);
ft.addToBackStack(null);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
m_actionbarUpEnabled = true;
m_actionbarRevertDepth = m_actionbarRevertDepth + 1;
ft.commit();
}
@ -305,7 +332,9 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
intent.putExtra("isCat", hf.getFeedIsCat());
intent.putExtra("article", articleId);
startActivityForResult(intent, 0);
startActivityForResult(intent, 0);
overridePendingTransition(R.anim.right_slide_in, 0);
}
} else {
refresh();

View File

@ -20,6 +20,7 @@ import android.support.v4.widget.SimpleCursorAdapter;
import android.util.Log;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.View.OnClickListener;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
@ -27,6 +28,7 @@ import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
@ -307,6 +309,20 @@ public class OfflineFeedsFragment extends Fragment implements OnItemClickListene
}
ImageButton ib = (ImageButton) v.findViewById(R.id.feed_menu_button);
if (ib != null) {
if (m_activity.isDarkTheme())
ib.setImageResource(R.drawable.ic_mailbox_collapsed_holo_dark);
ib.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
getActivity().openContextMenu(v);
}
});
}
return v;
}
}

View File

@ -3,6 +3,8 @@ package org.fox.ttrss.offline;
import org.fox.ttrss.GlobalState;
import org.fox.ttrss.R;
import com.actionbarsherlock.view.MenuItem;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.content.SharedPreferences;
@ -13,6 +15,7 @@ import android.preference.PreferenceManager;
import android.provider.BaseColumns;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.util.Log;
import android.view.View;
public class OfflineHeadlinesActivity extends OfflineActivity implements OfflineHeadlinesEventListener {
@ -33,9 +36,7 @@ public class OfflineHeadlinesActivity extends OfflineActivity implements Offline
setContentView(R.layout.headlines);
if (!isCompatMode()) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setSmallScreen(findViewById(R.id.headlines_fragment) == null);
@ -92,6 +93,19 @@ public class OfflineHeadlinesActivity extends OfflineActivity implements Offline
initMenu();
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
overridePendingTransition(0, R.anim.right_slide_out);
return true;
default:
Log.d(TAG, "onOptionsItemSelected, unhandled id=" + item.getItemId());
return super.onOptionsItemSelected(item);
}
}
@Override
public void onArticleSelected(int articleId, boolean open) {
SQLiteStatement stmt = getWritableDb().compileStatement(
@ -144,4 +158,10 @@ public class OfflineHeadlinesActivity extends OfflineActivity implements Offline
public void onArticleSelected(int articleId) {
onArticleSelected(articleId, true);
}
@Override
public void onBackPressed() {
super.onBackPressed();
overridePendingTransition(0, R.anim.right_slide_out);
}
}

View File

@ -38,6 +38,7 @@ import android.widget.AdapterView;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.CheckBox;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
@ -283,7 +284,7 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
list.setEmptyView(view.findViewById(R.id.no_headlines));
registerForContextMenu(list);
if (m_activity.isSmallScreen() || m_activity.isPortrait())
if (m_activity.isSmallScreen())
view.findViewById(R.id.headlines_fragment).setPadding(0, 0, 0, 0);
getActivity().setProgressBarIndeterminateVisibility(false);
@ -576,18 +577,20 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
});
}
/* ImageButton ib = (ImageButton) v.findViewById(R.id.article_menu_button);
ImageButton ib = (ImageButton) v.findViewById(R.id.article_menu_button);
if (ib != null) {
ib.setVisibility(android.os.Build.VERSION.SDK_INT >= 10 ? View.VISIBLE : View.GONE);
if (m_activity.isDarkTheme())
ib.setImageResource(R.drawable.ic_mailbox_collapsed_holo_dark);
ib.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
getActivity().openContextMenu(v);
}
});
} */
}
return v;
}