remove combined mode stuff

This commit is contained in:
Andrew Dolgov 2012-12-31 01:43:23 +04:00
parent 204ee6d4b9
commit 7357c546b2
12 changed files with 12 additions and 527 deletions

View File

@ -96,40 +96,6 @@
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" />
<LinearLayout
android:id="@+id/attachments_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0" >
<Spinner
android:id="@+id/attachments"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:prompt="@string/attachments_prompt" />
<Button
android:id="@+id/attachment_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="@string/attachment_view" />
<Button
android:id="@+id/attachment_copy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="@string/attachment_copy" />
</LinearLayout>
<ImageButton
android:id="@+id/article_menu_button"
android:layout_width="50dp"

View File

@ -96,41 +96,6 @@
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="Article content" />
<LinearLayout
android:id="@+id/attachments_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0" >
<Spinner
android:id="@+id/attachments"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:prompt="@string/attachments_prompt" />
<Button
android:id="@+id/attachment_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="@string/attachment_view" />
<Button
android:id="@+id/attachment_copy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="@string/attachment_copy" />
</LinearLayout>
<ImageButton
android:id="@+id/article_menu_button"
android:layout_width="50dp"

View File

@ -96,40 +96,6 @@
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" />
<LinearLayout
android:id="@+id/attachments_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0" >
<Spinner
android:id="@+id/attachments"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:prompt="@string/attachments_prompt" />
<Button
android:id="@+id/attachment_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="@string/attachment_view" />
<Button
android:id="@+id/attachment_copy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="@string/attachment_copy" />
</LinearLayout>
<ImageButton
android:id="@+id/article_menu_button"
android:layout_width="50dp"

View File

@ -93,42 +93,6 @@
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:padding="3dip" >
</TextView>
<LinearLayout
android:id="@+id/attachments_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0" >
<Spinner
android:id="@+id/attachments"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:prompt="@string/attachments_prompt" />
<Button
android:id="@+id/attachment_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="@string/attachment_view" />
<Button
android:id="@+id/attachment_copy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="@string/attachment_copy" />
</LinearLayout>
<ImageButton
android:id="@+id/article_menu_button"
android:layout_width="50dp"

View File

@ -93,42 +93,6 @@
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:padding="3dip" >
</TextView>
<LinearLayout
android:id="@+id/attachments_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0" >
<Spinner
android:id="@+id/attachments"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:prompt="@string/attachments_prompt" />
<Button
android:id="@+id/attachment_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="@string/attachment_view" />
<Button
android:id="@+id/attachment_copy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="@string/attachment_copy" />
</LinearLayout>
<ImageButton
android:id="@+id/article_menu_button"
android:layout_width="50dp"

View File

@ -93,42 +93,6 @@
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:padding="3dip" >
</TextView>
<LinearLayout
android:id="@+id/attachments_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0" >
<Spinner
android:id="@+id/attachments"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:prompt="@string/attachments_prompt" />
<Button
android:id="@+id/attachment_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="@string/attachment_view" />
<Button
android:id="@+id/attachment_copy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="@string/attachment_copy" />
</LinearLayout>
<ImageButton
android:id="@+id/article_menu_button"
android:layout_width="50dp"

View File

@ -93,42 +93,6 @@
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:padding="3dip" >
</TextView>
<LinearLayout
android:id="@+id/attachments_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0" >
<Spinner
android:id="@+id/attachments"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:prompt="@string/attachments_prompt" />
<Button
android:id="@+id/attachment_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="@string/attachment_view" />
<Button
android:id="@+id/attachment_copy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="@string/attachment_copy" />
</LinearLayout>
<ImageButton
android:id="@+id/article_menu_button"
android:layout_width="50dp"

View File

@ -105,42 +105,6 @@
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:padding="3dip" >
</TextView>
<LinearLayout
android:id="@+id/attachments_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0" >
<Spinner
android:id="@+id/attachments"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:prompt="@string/attachments_prompt" />
<Button
android:id="@+id/attachment_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="@string/attachment_view" />
<Button
android:id="@+id/attachment_copy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="@string/attachment_copy" />
</LinearLayout>
<ImageButton
android:id="@+id/article_menu_button"
android:layout_width="50dp"

View File

@ -105,42 +105,6 @@
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:padding="3dip" >
</TextView>
<LinearLayout
android:id="@+id/attachments_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0" >
<Spinner
android:id="@+id/attachments"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:prompt="@string/attachments_prompt" />
<Button
android:id="@+id/attachment_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="@string/attachment_view" />
<Button
android:id="@+id/attachment_copy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="@string/attachment_copy" />
</LinearLayout>
<ImageButton
android:id="@+id/article_menu_button"
android:layout_width="50dp"

View File

@ -105,42 +105,6 @@
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:padding="3dip" >
</TextView>
<LinearLayout
android:id="@+id/attachments_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0" >
<Spinner
android:id="@+id/attachments"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:prompt="@string/attachments_prompt" />
<Button
android:id="@+id/attachment_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="@string/attachment_view" />
<Button
android:id="@+id/attachment_copy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="@string/attachment_copy" />
</LinearLayout>
<ImageButton
android:id="@+id/article_menu_button"
android:layout_width="50dp"

View File

@ -63,7 +63,6 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
private Feed m_feed;
private Article m_activeArticle;
private boolean m_combinedMode = true;
private String m_searchQuery = "";
private boolean m_refreshInProgress = false;
@ -263,7 +262,6 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
//m_articles = savedInstanceState.getParcelable("articles");
m_activeArticle = savedInstanceState.getParcelable("activeArticle");
m_selectedArticles = savedInstanceState.getParcelable("selectedArticles");
m_combinedMode = savedInstanceState.getBoolean("combinedMode");
m_searchQuery = (String) savedInstanceState.getCharSequence("searchQuery");
}
@ -314,8 +312,6 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
m_prefs = PreferenceManager.getDefaultSharedPreferences(getActivity().getApplicationContext());
m_activity = (OnlineActivity) activity;
m_listener = (HeadlinesEventListener) activity;
m_combinedMode = false; /* m_prefs.getBoolean("combined_mode", false); */
}
@Override
@ -327,12 +323,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
if (list != null) {
Article article = (Article)list.getItemAtPosition(position);
if (article.id >= 0) {
if (m_combinedMode) {
article.unread = false;
m_activity.saveArticleUnread(article);
} else {
m_listener.onArticleSelected(article);
}
// only set active article when it makes sense (in HeadlinesActivity)
if (getActivity().findViewById(R.id.article_fragment) != null) {
@ -443,7 +434,6 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
//out.putParcelable("articles", m_articles);
out.putParcelable("activeArticle", m_activeArticle);
out.putParcelable("selectedArticles", m_selectedArticles);
out.putBoolean("combinedMode", m_combinedMode);
out.putCharSequence("searchQuery", m_searchQuery);
}
@ -591,13 +581,8 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
TextView tt = (TextView)v.findViewById(R.id.title);
if (tt != null) {
if (m_combinedMode) {
tt.setMovementMethod(LinkMovementMethod.getInstance());
tt.setText(Html.fromHtml("<a href=\""+article.link.trim().replace("\"", "\\\"")+"\">" + article.title + "</a>"));
} else {
tt.setText(Html.fromHtml(article.title));
}
}
TextView ft = (TextView)v.findViewById(R.id.feed_title);
@ -654,16 +639,12 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
String articleContent = article.content != null ? article.content : "";
if (te != null) {
if (!m_combinedMode) {
String excerpt = Jsoup.parse(articleContent).text();
if (excerpt.length() > 100)
excerpt = excerpt.substring(0, 100) + "...";
te.setText(excerpt);
} else {
te.setVisibility(View.GONE);
}
}
/* ImageView separator = (ImageView)v.findViewById(R.id.headlines_separator);
@ -672,97 +653,6 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
separator.setVisibility(View.GONE);
} */
TextView content = (TextView)v.findViewById(R.id.content);
if (content != null) {
if (m_combinedMode) {
content.setMovementMethod(LinkMovementMethod.getInstance());
final Spinner spinner = (Spinner) v.findViewById(R.id.attachments);
ArrayList<Attachment> spinnerArray = new ArrayList<Attachment>();
ArrayAdapter<Attachment> spinnerArrayAdapter = new ArrayAdapter<Attachment>(
getActivity(), android.R.layout.simple_spinner_item, spinnerArray);
spinnerArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
if (article.attachments != null && article.attachments.size() != 0) {
for (Attachment a : article.attachments) {
if (a.content_type != null && a.content_url != null) {
try {
URL url = new URL(a.content_url.trim());
if (a.content_type.indexOf("image") != -1) {
articleContent += "<br/><img src=\"" + url.toString().trim().replace("\"", "\\\"") + "\">";
}
spinnerArray.add(a);
} catch (MalformedURLException e) {
//
} catch (Exception e) {
e.printStackTrace();
}
}
}
spinner.setAdapter(spinnerArrayAdapter);
Button attachmentsView = (Button) v.findViewById(R.id.attachment_view);
attachmentsView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Attachment attachment = (Attachment) spinner.getSelectedItem();
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(attachment.content_url));
startActivity(browserIntent);
}
});
Button attachmentsCopy = (Button) v.findViewById(R.id.attachment_copy);
attachmentsCopy.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Attachment attachment = (Attachment) spinner.getSelectedItem();
if (attachment != null) {
m_activity.copyToClipboard(attachment.content_url);
}
}
});
} else {
v.findViewById(R.id.attachments_holder).setVisibility(View.GONE);
}
//content.setText(Html.fromHtml(article.content, new URLImageGetter(content, getActivity()), null));
content.setText(Html.fromHtml(articleContent, m_dummyGetter, null));
switch (Integer.parseInt(m_prefs.getString("font_size", "0"))) {
case 0:
content.setTextSize(15F);
break;
case 1:
content.setTextSize(18F);
break;
case 2:
content.setTextSize(21F);
break;
}
} else {
content.setVisibility(View.GONE);
v.findViewById(R.id.attachments_holder).setVisibility(View.GONE);
}
}
TextView dv = (TextView) v.findViewById(R.id.date);
if (dv != null) {

View File

@ -49,7 +49,6 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
private int m_feedId;
private boolean m_feedIsCat = false;
private int m_activeArticleId;
private boolean m_combinedMode = true;
private String m_searchQuery = "";
private SharedPreferences m_prefs;
@ -266,7 +265,6 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
m_feedId = savedInstanceState.getInt("feedId");
m_activeArticleId = savedInstanceState.getInt("activeArticleId");
//m_selectedArticles = savedInstanceState.getParcelableArrayList("selectedArticles");
m_combinedMode = savedInstanceState.getBoolean("combinedMode");
m_searchQuery = (String) savedInstanceState.getCharSequence("searchQuery");
m_feedIsCat = savedInstanceState.getBoolean("feedIsCat");
} else {
@ -324,7 +322,6 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
m_activity = (OfflineActivity) activity;
m_prefs = PreferenceManager.getDefaultSharedPreferences(getActivity().getApplicationContext());
m_combinedMode = false; /* m_prefs.getBoolean("combined_mode", false); */
}
@Override
@ -344,17 +341,7 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
m_activeArticleId = articleId;
}
if (!m_combinedMode) {
m_listener.onArticleSelected(articleId);
} else {
SQLiteStatement stmt = m_activity.getWritableDb().compileStatement(
"UPDATE articles SET modified = 1, unread = 0 " + "WHERE " + BaseColumns._ID
+ " = ?");
stmt.bindLong(1, articleId);
stmt.execute();
stmt.close();
}
refresh();
}
@ -367,7 +354,6 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
out.putInt("feedId", m_feedId);
out.putInt("activeArticleId", m_activeArticleId);
//out.putParcelableArrayList("selectedArticles", m_selectedArticles);
out.putBoolean("combinedMode", m_combinedMode);
out.putCharSequence("searchQuery", m_searchQuery);
out.putBoolean("feedIsCat", m_feedIsCat);
}
@ -451,14 +437,8 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
TextView tt = (TextView)v.findViewById(R.id.title);
if (tt != null) {
if (m_combinedMode) {
tt.setMovementMethod(LinkMovementMethod.getInstance());
tt.setText(Html.fromHtml("<a href=\""+article.getString(article.getColumnIndex("link")).trim().replace("\"", "\\\"")+"\">" +
article.getString(article.getColumnIndex("title")) + "</a>"));
} else {
tt.setText(Html.fromHtml(article.getString(article.getColumnIndex("title"))));
}
}
TextView ft = (TextView)v.findViewById(R.id.feed_title);
@ -524,16 +504,12 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
TextView te = (TextView)v.findViewById(R.id.excerpt);
if (te != null) {
if (!m_combinedMode) {
String excerpt = Jsoup.parse(article.getString(article.getColumnIndex("content"))).text();
if (excerpt.length() > 100)
excerpt = excerpt.substring(0, 100) + "...";
te.setText(excerpt);
} else {
te.setVisibility(View.GONE);
}
}
/* ImageView separator = (ImageView)v.findViewById(R.id.headlines_separator);
@ -542,32 +518,6 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
separator.setVisibility(View.GONE);
} */
TextView content = (TextView)v.findViewById(R.id.content);
if (content != null) {
if (m_combinedMode) {
content.setMovementMethod(LinkMovementMethod.getInstance());
content.setText(Html.fromHtml(article.getString(article.getColumnIndex("content")), m_dummyGetter, null));
switch (Integer.parseInt(m_prefs.getString("font_size", "0"))) {
case 0:
content.setTextSize(15F);
break;
case 1:
content.setTextSize(18F);
break;
case 2:
content.setTextSize(21F);
break;
}
} else {
content.setVisibility(View.GONE);
}
}
v.findViewById(R.id.attachments_holder).setVisibility(View.GONE);
TextView dv = (TextView) v.findViewById(R.id.date);
if (dv != null) {