implement workaround to make list items somewhat clickable in combined
mode, make title a link
This commit is contained in:
parent
f16095ce53
commit
f242dcde6a
@ -15,4 +15,20 @@
|
|||||||
android:showAsAction=""
|
android:showAsAction=""
|
||||||
android:title="@string/context_selection_toggle_published"/>
|
android:title="@string/context_selection_toggle_published"/>
|
||||||
|
|
||||||
|
<group android:id="@+id/menu_group_single_article">
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/share_article"
|
||||||
|
android:showAsAction=""
|
||||||
|
android:title="@string/share_article"/>
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/set_unread"
|
||||||
|
android:showAsAction=""
|
||||||
|
android:title="@string/article_set_unread"/>
|
||||||
|
|
||||||
|
|
||||||
|
</group>
|
||||||
|
|
||||||
|
|
||||||
</menu>
|
</menu>
|
@ -117,7 +117,7 @@ public class ArticleFragment extends Fragment implements OnClickListener {
|
|||||||
"<meta name=\"viewport\" content=\"target-densitydpi=device-dpi\" />" +
|
"<meta name=\"viewport\" content=\"target-densitydpi=device-dpi\" />" +
|
||||||
"<style type=\"text/css\">" +
|
"<style type=\"text/css\">" +
|
||||||
cssOverride +
|
cssOverride +
|
||||||
"img { max-width : 90%; }" +
|
//"img { max-width : 90%; }" +
|
||||||
"body { text-align : justify; }" +
|
"body { text-align : justify; }" +
|
||||||
"</style>" +
|
"</style>" +
|
||||||
"</head>" +
|
"</head>" +
|
||||||
|
@ -19,9 +19,11 @@ import android.os.Bundle;
|
|||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
|
import android.text.method.LinkMovementMethod;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.ContextMenu;
|
import android.view.ContextMenu;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ContextMenu.ContextMenuInfo;
|
import android.view.ContextMenu.ContextMenuInfo;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
@ -77,10 +79,12 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
|
|
||||||
if (m_selectedArticles.size() > 0) {
|
if (m_selectedArticles.size() > 0) {
|
||||||
menu.setHeaderTitle(R.string.headline_context_multiple);
|
menu.setHeaderTitle(R.string.headline_context_multiple);
|
||||||
|
menu.setGroupVisible(R.id.menu_group_single_article, false);
|
||||||
} else {
|
} else {
|
||||||
AdapterContextMenuInfo info = (AdapterContextMenuInfo)menuInfo;
|
AdapterContextMenuInfo info = (AdapterContextMenuInfo)menuInfo;
|
||||||
Article article = getArticleAtPosition(info.position);
|
Article article = getArticleAtPosition(info.position);
|
||||||
menu.setHeaderTitle(article.title);
|
menu.setHeaderTitle(article.title);
|
||||||
|
menu.setGroupVisible(R.id.menu_group_single_article, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
super.onCreateContextMenu(menu, v, menuInfo);
|
super.onCreateContextMenu(menu, v, menuInfo);
|
||||||
@ -131,11 +135,18 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
public void onItemClick(AdapterView<?> av, View view, int position, long id) {
|
public void onItemClick(AdapterView<?> av, View view, int position, long id) {
|
||||||
ListView list = (ListView)av;
|
ListView list = (ListView)av;
|
||||||
|
|
||||||
if (list != null && !m_combinedMode) {
|
Log.d(TAG, "onItemClick=" + position);
|
||||||
|
|
||||||
|
if (list != null) {
|
||||||
Article article = (Article)list.getItemAtPosition(position);
|
Article article = (Article)list.getItemAtPosition(position);
|
||||||
if (article.id >= 0) {
|
if (article.id >= 0) {
|
||||||
m_articleOps.openArticle(article, 0);
|
if (m_combinedMode) {
|
||||||
|
article.unread = false;
|
||||||
|
m_articleOps.saveArticleUnread(article);
|
||||||
|
} else {
|
||||||
|
m_articleOps.openArticle(article, 0);
|
||||||
|
}
|
||||||
|
|
||||||
m_activeArticleId = article.id;
|
m_activeArticleId = article.id;
|
||||||
m_adapter.notifyDataSetChanged();
|
m_adapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
@ -337,12 +348,20 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
|
|
||||||
LayoutInflater vi = (LayoutInflater)getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
LayoutInflater vi = (LayoutInflater)getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
v = vi.inflate(layoutId, null);
|
v = vi.inflate(layoutId, null);
|
||||||
|
|
||||||
|
// http://code.google.com/p/android/issues/detail?id=3414
|
||||||
|
((ViewGroup)v).setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
TextView tt = (TextView)v.findViewById(R.id.title);
|
TextView tt = (TextView)v.findViewById(R.id.title);
|
||||||
|
|
||||||
if (tt != null) {
|
if (tt != null) {
|
||||||
tt.setText(Html.fromHtml(article.title));
|
if (m_combinedMode) {
|
||||||
|
tt.setMovementMethod(LinkMovementMethod.getInstance());
|
||||||
|
tt.setText(Html.fromHtml("<a href=\""+article.link.replace("\"", "\\\"")+"\">" + article.title + "</a>"));
|
||||||
|
} else {
|
||||||
|
tt.setText(Html.fromHtml(article.title));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageView marked = (ImageView)v.findViewById(R.id.marked);
|
ImageView marked = (ImageView)v.findViewById(R.id.marked);
|
||||||
@ -416,13 +435,14 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
"<meta name=\"viewport\" content=\"target-densitydpi=device-dpi\" />" +
|
"<meta name=\"viewport\" content=\"target-densitydpi=device-dpi\" />" +
|
||||||
"<style type=\"text/css\">" +
|
"<style type=\"text/css\">" +
|
||||||
cssOverride +
|
cssOverride +
|
||||||
"img { max-width : 90%; }" +
|
//"img { max-width : 90%; }" +
|
||||||
"body { text-align : justify; }" +
|
"body { text-align : justify; }" +
|
||||||
"</style>" +
|
"</style>" +
|
||||||
"</head>" +
|
"</head>" +
|
||||||
"<body>" + article.content + "</body></html>";
|
"<body>" + article.content + "</body></html>";
|
||||||
|
|
||||||
web.loadDataWithBaseURL(null, content, "text/html", "utf-8", null);
|
web.loadDataWithBaseURL(null, content, "text/html", "utf-8", null);
|
||||||
|
//web.setOnTouchListener(new WebViewClickListener(web, parent, position));
|
||||||
} else {
|
} else {
|
||||||
web.setVisibility(View.GONE);
|
web.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
@ -952,7 +952,6 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
|
|||||||
req.execute(map);
|
req.execute(map);
|
||||||
|
|
||||||
setLoadingStatus(R.string.loading_message, true);
|
setLoadingStatus(R.string.loading_message, true);
|
||||||
|
|
||||||
|
|
||||||
loginSuccess();
|
loginSuccess();
|
||||||
return;
|
return;
|
||||||
@ -966,7 +965,7 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
|
|||||||
m_sessionId = null;
|
m_sessionId = null;
|
||||||
|
|
||||||
setLoadingStatus(getErrorMessage(), false);
|
setLoadingStatus(getErrorMessage(), false);
|
||||||
m_menu.findItem(R.id.login).setVisible(true);
|
//m_menu.findItem(R.id.login).setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user