switch to ICS native fragments

This commit is contained in:
Andrew Dolgov 2012-06-19 13:54:04 +04:00
parent c13dd67f43
commit ca65a6cdfa
16 changed files with 82 additions and 99 deletions

View File

@ -5,7 +5,7 @@
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="lib" path="C:/Users/fox/workspace/org.fox.ttrss/libs/gson-1.7.1.jar"/> <classpathentry kind="lib" path="C:/Users/fox/workspace/org.fox.ttrss/libs/gson-1.7.1.jar"/>
<classpathentry kind="lib" path="C:/Users/fox/workspace/org.fox.ttrss/libs/jsoup-1.6.1.jar"/> <classpathentry kind="lib" path="C:/Users/fox/workspace/org.fox.ttrss/libs/jsoup-1.6.1.jar"/>
<classpathentry kind="lib" path="libs/android-support-v4.jar"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/> <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="lib" path="libs/android-support-v4.jar"/>
<classpathentry kind="output" path="bin/classes"/> <classpathentry kind="output" path="bin/classes"/>
</classpath> </classpath>

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.fox.ttrss" package="org.fox.ttrss"
android:versionCode="72" android:versionCode="73"
android:versionName="0.5.7" > android:versionName="0.6.0" >
<uses-sdk android:minSdkVersion="8" /> <uses-sdk android:minSdkVersion="14" />
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

Binary file not shown.

View File

@ -8,4 +8,4 @@
# project structure. # project structure.
# Project target. # Project target.
target=android-14 target=android-15

View File

@ -1,6 +1,5 @@
package org.fox.ttrss; package org.fox.ttrss;
import java.io.File;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
@ -14,32 +13,27 @@ import org.jsoup.select.Elements;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.app.Fragment;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
import android.text.Html; import android.text.Html;
import android.text.method.LinkMovementMethod; import android.text.method.LinkMovementMethod;
import android.util.Log;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.ContextMenu; import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.ContextMenu.ContextMenuInfo;
import android.webkit.WebSettings; import android.webkit.WebSettings;
import android.webkit.WebView; import android.webkit.WebView;
import android.widget.AdapterView;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.Button; import android.widget.Button;
import android.widget.Spinner; import android.widget.Spinner;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast;
import android.widget.AdapterView.AdapterContextMenuInfo;
public class ArticleFragment extends Fragment { public class ArticleFragment extends Fragment {
@SuppressWarnings("unused") @SuppressWarnings("unused")

View File

@ -1,10 +1,9 @@
package org.fox.ttrss; package org.fox.ttrss;
import android.app.Activity; import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentManager;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@ -55,7 +54,7 @@ public class ArticlePager extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.article_pager, container, false); View view = inflater.inflate(R.layout.article_pager, container, false);
m_adapter = new PagerAdapter(getActivity().getSupportFragmentManager()); m_adapter = new PagerAdapter(getActivity().getFragmentManager());
ViewPager pager = (ViewPager) view.findViewById(R.id.article_pager); ViewPager pager = (ViewPager) view.findViewById(R.id.article_pager);
@ -94,7 +93,7 @@ public class ArticlePager extends Fragment {
public void onAttach(Activity activity) { public void onAttach(Activity activity) {
super.onAttach(activity); super.onAttach(activity);
m_hf = (HeadlinesFragment) getActivity().getSupportFragmentManager().findFragmentById(R.id.headlines_fragment); m_hf = (HeadlinesFragment) getActivity().getFragmentManager().findFragmentById(R.id.headlines_fragment);
m_onlineServices = (OnlineServices)activity; m_onlineServices = (OnlineServices)activity;
} }

View File

@ -1,7 +1,7 @@
package org.fox.ttrss; package org.fox.ttrss;
import android.app.Fragment;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;

View File

@ -8,12 +8,12 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import android.app.Activity; import android.app.Activity;
import android.app.Fragment;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
import android.view.ContextMenu; import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo; import android.view.ContextMenu.ContextMenuInfo;
import android.view.LayoutInflater; import android.view.LayoutInflater;

View File

@ -7,7 +7,6 @@ import java.io.InputStream;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
@ -21,18 +20,13 @@ import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider; import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.protocol.ClientContext; import org.apache.http.client.protocol.ClientContext;
import org.apache.http.conn.scheme.PlainSocketFactory;
import org.apache.http.conn.scheme.Scheme; import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.impl.client.BasicCredentialsProvider; import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpParams;
import org.apache.http.protocol.BasicHttpContext; import org.apache.http.protocol.BasicHttpContext;
import org.apache.http.protocol.HttpContext; import org.apache.http.protocol.HttpContext;
import android.app.Activity; import android.app.Activity;
import android.app.Fragment;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
@ -43,7 +37,6 @@ import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.os.Environment; import android.os.Environment;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
import android.util.Log; import android.util.Log;
import android.view.ContextMenu; import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo; import android.view.ContextMenu.ContextMenuInfo;

View File

@ -1,6 +1,5 @@
package org.fox.ttrss; package org.fox.ttrss;
import java.io.File;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
@ -15,6 +14,7 @@ import java.util.TimeZone;
import org.jsoup.Jsoup; import org.jsoup.Jsoup;
import android.app.Activity; import android.app.Activity;
import android.app.Fragment;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
@ -23,7 +23,6 @@ import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
import android.text.Html; import android.text.Html;
import android.text.Html.ImageGetter; import android.text.Html.ImageGetter;
import android.text.method.LinkMovementMethod; import android.text.method.LinkMovementMethod;

View File

@ -7,8 +7,11 @@ import java.util.Timer;
import java.util.TimerTask; import java.util.TimerTask;
import android.animation.LayoutTransition; import android.animation.LayoutTransition;
import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
import android.app.Fragment;
import android.app.FragmentTransaction;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
@ -24,9 +27,6 @@ import android.net.ConnectivityManager;
import android.net.NetworkInfo; import android.net.NetworkInfo;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTransaction;
import android.util.Log; import android.util.Log;
import android.view.ActionMode; import android.view.ActionMode;
import android.view.KeyEvent; import android.view.KeyEvent;
@ -48,7 +48,7 @@ import com.google.gson.JsonElement;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
public class MainActivity extends FragmentActivity implements OnlineServices { public class MainActivity extends Activity implements OnlineServices {
private final String TAG = this.getClass().getSimpleName(); private final String TAG = this.getClass().getSimpleName();
private SharedPreferences m_prefs; private SharedPreferences m_prefs;
@ -133,7 +133,7 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
}; };
public void updateHeadlines() { public void updateHeadlines() {
HeadlinesFragment frag = (HeadlinesFragment) getSupportFragmentManager() HeadlinesFragment frag = (HeadlinesFragment) getFragmentManager()
.findFragmentById(R.id.headlines_fragment); .findFragmentById(R.id.headlines_fragment);
if (frag != null) { if (frag != null) {
frag.notifyUpdated(); frag.notifyUpdated();
@ -351,7 +351,7 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
private synchronized void refreshFeeds() { private synchronized void refreshFeeds() {
if (m_sessionId != null) { if (m_sessionId != null) {
FeedsFragment frag = (FeedsFragment) getSupportFragmentManager() FeedsFragment frag = (FeedsFragment) getFragmentManager()
.findFragmentById(R.id.feeds_fragment); .findFragmentById(R.id.feeds_fragment);
Log.d(TAG, "Refreshing feeds..."); Log.d(TAG, "Refreshing feeds...");
@ -364,7 +364,7 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
private synchronized void refreshHeadlines() { private synchronized void refreshHeadlines() {
if (m_sessionId != null) { if (m_sessionId != null) {
HeadlinesFragment frag = (HeadlinesFragment) getSupportFragmentManager() HeadlinesFragment frag = (HeadlinesFragment) getFragmentManager()
.findFragmentById(R.id.headlines_fragment); .findFragmentById(R.id.headlines_fragment);
Log.d(TAG, "Refreshing headlines..."); Log.d(TAG, "Refreshing headlines...");
@ -377,7 +377,7 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
private synchronized void refreshCategories() { private synchronized void refreshCategories() {
if (m_sessionId != null) { if (m_sessionId != null) {
FeedCategoriesFragment frag = (FeedCategoriesFragment) getSupportFragmentManager() FeedCategoriesFragment frag = (FeedCategoriesFragment) getFragmentManager()
.findFragmentById(R.id.cats_fragment); .findFragmentById(R.id.cats_fragment);
Log.d(TAG, "Refreshing categories..."); Log.d(TAG, "Refreshing categories...");
@ -407,7 +407,7 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
* = unread; * = unread;
* *
* HeadlinesFragment frag = * HeadlinesFragment frag =
* (HeadlinesFragment)getSupportFragmentManager().findFragmentById * (HeadlinesFragment)getFragmentManager().findFragmentById
* (R.id.headlines_fragment); * (R.id.headlines_fragment);
* *
* if (frag != null) frag.refresh(false); } * if (frag != null) frag.refresh(false); }
@ -754,7 +754,7 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
m_activeCategory = null; m_activeCategory = null;
FeedCategoriesFragment cf = (FeedCategoriesFragment) getSupportFragmentManager() FeedCategoriesFragment cf = (FeedCategoriesFragment) getFragmentManager()
.findFragmentById(R.id.cats_fragment); .findFragmentById(R.id.cats_fragment);
if (cf != null) { if (cf != null) {
@ -767,7 +767,7 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
} }
private void deselectAllArticles() { private void deselectAllArticles() {
HeadlinesFragment hf = (HeadlinesFragment) getSupportFragmentManager() HeadlinesFragment hf = (HeadlinesFragment) getFragmentManager()
.findFragmentById(R.id.headlines_fragment); .findFragmentById(R.id.headlines_fragment);
if (hf != null) { if (hf != null) {
@ -797,11 +797,11 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
findViewById(R.id.cats_fragment) findViewById(R.id.cats_fragment)
.setVisibility(View.VISIBLE); .setVisibility(View.VISIBLE);
FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.headlines_fragment, new HeadlinesFragment()); ft.replace(R.id.headlines_fragment, new HeadlinesFragment());
ft.commit(); ft.commit();
FeedCategoriesFragment cf = (FeedCategoriesFragment) getSupportFragmentManager() FeedCategoriesFragment cf = (FeedCategoriesFragment) getFragmentManager()
.findFragmentById(R.id.cats_fragment); .findFragmentById(R.id.cats_fragment);
if (cf != null) { if (cf != null) {
@ -816,14 +816,14 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
findViewById(R.id.feeds_fragment).setVisibility( findViewById(R.id.feeds_fragment).setVisibility(
View.VISIBLE); View.VISIBLE);
FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.headlines_fragment, new HeadlinesFragment()); ft.replace(R.id.headlines_fragment, new HeadlinesFragment());
ft.commit(); ft.commit();
refreshFeeds(); refreshFeeds();
} }
FeedsFragment ff = (FeedsFragment) getSupportFragmentManager() FeedsFragment ff = (FeedsFragment) getFragmentManager()
.findFragmentById(R.id.feeds_fragment); .findFragmentById(R.id.feeds_fragment);
if (ff != null) { if (ff != null) {
@ -855,7 +855,7 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
findViewById(R.id.headlines_fragment).setVisibility( findViewById(R.id.headlines_fragment).setVisibility(
View.INVISIBLE); View.INVISIBLE);
FeedsFragment ff = (FeedsFragment) getSupportFragmentManager() FeedsFragment ff = (FeedsFragment) getFragmentManager()
.findFragmentById(R.id.feeds_fragment); .findFragmentById(R.id.feeds_fragment);
if (ff != null) { if (ff != null) {
@ -864,7 +864,7 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
m_activeFeed = null; m_activeFeed = null;
FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.headlines_fragment, new HeadlinesFragment()); ft.replace(R.id.headlines_fragment, new HeadlinesFragment());
ft.commit(); ft.commit();
@ -880,7 +880,7 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
final HeadlinesFragment hf = (HeadlinesFragment) getSupportFragmentManager() final HeadlinesFragment hf = (HeadlinesFragment) getFragmentManager()
.findFragmentById(R.id.headlines_fragment); .findFragmentById(R.id.headlines_fragment);
switch (item.getItemId()) { switch (item.getItemId()) {
@ -1276,7 +1276,7 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
m_selectedArticle = null; m_selectedArticle = null;
FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.article_fragment, new DummyFragment()); ft.replace(R.id.article_fragment, new DummyFragment());
ft.commit(); ft.commit();
@ -1303,7 +1303,7 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
m_menu.setGroupVisible(R.id.menu_group_logged_in, true); m_menu.setGroupVisible(R.id.menu_group_logged_in, true);
m_menu.setGroupVisible(R.id.menu_group_logged_out, false); m_menu.setGroupVisible(R.id.menu_group_logged_out, false);
HeadlinesFragment hf = (HeadlinesFragment) getSupportFragmentManager() HeadlinesFragment hf = (HeadlinesFragment) getFragmentManager()
.findFragmentById(R.id.headlines_fragment); .findFragmentById(R.id.headlines_fragment);
int numSelected = 0; int numSelected = 0;
@ -1335,7 +1335,7 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
@Override @Override
public boolean onQueryTextSubmit(String query) { public boolean onQueryTextSubmit(String query) {
HeadlinesFragment frag = (HeadlinesFragment) getSupportFragmentManager() HeadlinesFragment frag = (HeadlinesFragment) getFragmentManager()
.findFragmentById(R.id.headlines_fragment); .findFragmentById(R.id.headlines_fragment);
if (frag != null) { if (frag != null) {
@ -1349,7 +1349,7 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
@Override @Override
public boolean onQueryTextChange(String newText) { public boolean onQueryTextChange(String newText) {
if (newText.equals("") && !newText.equals(this.query)) { if (newText.equals("") && !newText.equals(this.query)) {
HeadlinesFragment frag = (HeadlinesFragment) getSupportFragmentManager() HeadlinesFragment frag = (HeadlinesFragment) getFragmentManager()
.findFragmentById(R.id.headlines_fragment); .findFragmentById(R.id.headlines_fragment);
if (frag != null) { if (frag != null) {
@ -1509,7 +1509,7 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
if (hasPendingOfflineData()) if (hasPendingOfflineData())
syncOfflineData(); syncOfflineData();
FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); FragmentTransaction ft = getFragmentManager().beginTransaction();
if (m_enableCats) { if (m_enableCats) {
FeedCategoriesFragment frag = new FeedCategoriesFragment(); FeedCategoriesFragment frag = new FeedCategoriesFragment();
@ -1623,12 +1623,12 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
HeadlinesFragment hf = new HeadlinesFragment(); HeadlinesFragment hf = new HeadlinesFragment();
FragmentTransaction ft = getSupportFragmentManager() FragmentTransaction ft = getFragmentManager()
.beginTransaction(); .beginTransaction();
ft.replace(R.id.headlines_fragment, hf); ft.replace(R.id.headlines_fragment, hf);
ft.commit(); ft.commit();
} else { } else {
HeadlinesFragment hf = (HeadlinesFragment) getSupportFragmentManager() HeadlinesFragment hf = (HeadlinesFragment) getFragmentManager()
.findFragmentById(R.id.headlines_fragment); .findFragmentById(R.id.headlines_fragment);
if (hf != null) { if (hf != null) {
hf.refresh(true); hf.refresh(true);
@ -1648,7 +1648,7 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
FeedsFragment frag = new FeedsFragment(); FeedsFragment frag = new FeedsFragment();
FragmentTransaction ft = getSupportFragmentManager() FragmentTransaction ft = getFragmentManager()
.beginTransaction(); .beginTransaction();
ft.replace(R.id.feeds_fragment, frag); ft.replace(R.id.feeds_fragment, frag);
ft.commit(); ft.commit();
@ -1671,7 +1671,7 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
HeadlinesFragment frag = new HeadlinesFragment(); HeadlinesFragment frag = new HeadlinesFragment();
FragmentTransaction ft = getSupportFragmentManager() FragmentTransaction ft = getFragmentManager()
.beginTransaction(); .beginTransaction();
ft.replace(R.id.headlines_fragment, frag); ft.replace(R.id.headlines_fragment, frag);
ft.commit(); ft.commit();
@ -1691,7 +1691,7 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
initMainMenu(); initMainMenu();
HeadlinesFragment hf = (HeadlinesFragment) getSupportFragmentManager() HeadlinesFragment hf = (HeadlinesFragment) getFragmentManager()
.findFragmentById(R.id.headlines_fragment); .findFragmentById(R.id.headlines_fragment);
if (hf != null) { if (hf != null) {
@ -1715,7 +1715,7 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
frag = new ArticleFragment(article); frag = new ArticleFragment(article);
} }
FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.article_fragment, frag); ft.replace(R.id.article_fragment, frag);
ft.commit(); ft.commit();
@ -1810,11 +1810,11 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item AdapterContextMenuInfo info = (AdapterContextMenuInfo) item
.getMenuInfo(); .getMenuInfo();
HeadlinesFragment hf = (HeadlinesFragment) getSupportFragmentManager() HeadlinesFragment hf = (HeadlinesFragment) getFragmentManager()
.findFragmentById(R.id.headlines_fragment); .findFragmentById(R.id.headlines_fragment);
FeedsFragment ff = (FeedsFragment) getSupportFragmentManager() FeedsFragment ff = (FeedsFragment) getFragmentManager()
.findFragmentById(R.id.feeds_fragment); .findFragmentById(R.id.feeds_fragment);
FeedCategoriesFragment cf = (FeedCategoriesFragment) getSupportFragmentManager() FeedCategoriesFragment cf = (FeedCategoriesFragment) getFragmentManager()
.findFragmentById(R.id.cats_fragment); .findFragmentById(R.id.cats_fragment);
switch (item.getItemId()) { switch (item.getItemId()) {
@ -1972,7 +1972,7 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
@Override @Override
public Article getRelativeArticle(Article article, RelativeArticle ra) { public Article getRelativeArticle(Article article, RelativeArticle ra) {
HeadlinesFragment frag = (HeadlinesFragment) getSupportFragmentManager() HeadlinesFragment frag = (HeadlinesFragment) getFragmentManager()
.findFragmentById(R.id.headlines_fragment); .findFragmentById(R.id.headlines_fragment);
if (frag != null) { if (frag != null) {
ArticleList articles = frag.getAllArticles(); ArticleList articles = frag.getAllArticles();
@ -2006,7 +2006,7 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
switch (keyCode) { switch (keyCode) {
case KeyEvent.KEYCODE_VOLUME_DOWN: case KeyEvent.KEYCODE_VOLUME_DOWN:
if (action == KeyEvent.ACTION_DOWN) { if (action == KeyEvent.ACTION_DOWN) {
HeadlinesFragment hf = (HeadlinesFragment) getSupportFragmentManager() HeadlinesFragment hf = (HeadlinesFragment) getFragmentManager()
.findFragmentById(R.id.headlines_fragment); .findFragmentById(R.id.headlines_fragment);
if (hf != null && m_activeFeed != null) { if (hf != null && m_activeFeed != null) {
@ -2033,7 +2033,7 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
return true; return true;
case KeyEvent.KEYCODE_VOLUME_UP: case KeyEvent.KEYCODE_VOLUME_UP:
if (action == KeyEvent.ACTION_UP) { if (action == KeyEvent.ACTION_UP) {
HeadlinesFragment hf = (HeadlinesFragment) getSupportFragmentManager() HeadlinesFragment hf = (HeadlinesFragment) getFragmentManager()
.findFragmentById(R.id.headlines_fragment); .findFragmentById(R.id.headlines_fragment);
if (hf != null && m_activeFeed != null) { if (hf != null && m_activeFeed != null) {

View File

@ -3,8 +3,11 @@ package org.fox.ttrss;
import org.fox.ttrss.OnlineServices.RelativeArticle; import org.fox.ttrss.OnlineServices.RelativeArticle;
import android.animation.LayoutTransition; import android.animation.LayoutTransition;
import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
import android.app.Fragment;
import android.app.FragmentTransaction;
import android.app.NotificationManager; import android.app.NotificationManager;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
@ -18,9 +21,6 @@ import android.database.sqlite.SQLiteStatement;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.provider.BaseColumns; import android.provider.BaseColumns;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTransaction;
import android.util.Log; import android.util.Log;
import android.view.ActionMode; import android.view.ActionMode;
import android.view.KeyEvent; import android.view.KeyEvent;
@ -36,7 +36,7 @@ import android.widget.SearchView;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
public class OfflineActivity extends FragmentActivity implements public class OfflineActivity extends Activity implements
OfflineServices { OfflineServices {
private final String TAG = this.getClass().getSimpleName(); private final String TAG = this.getClass().getSimpleName();
@ -190,7 +190,7 @@ public class OfflineActivity extends FragmentActivity implements
} }
if (m_activeFeedId == 0) { if (m_activeFeedId == 0) {
FragmentTransaction ft = getSupportFragmentManager() FragmentTransaction ft = getFragmentManager()
.beginTransaction(); .beginTransaction();
OfflineFeedsFragment frag = new OfflineFeedsFragment(); OfflineFeedsFragment frag = new OfflineFeedsFragment();
ft.replace(R.id.feeds_fragment, frag); ft.replace(R.id.feeds_fragment, frag);
@ -337,14 +337,14 @@ public class OfflineActivity extends FragmentActivity implements
// } // }
m_activeFeedId = 0; m_activeFeedId = 0;
OfflineFeedsFragment ff = (OfflineFeedsFragment) getSupportFragmentManager() OfflineFeedsFragment ff = (OfflineFeedsFragment) getFragmentManager()
.findFragmentById(R.id.feeds_fragment); .findFragmentById(R.id.feeds_fragment);
if (ff != null) { if (ff != null) {
ff.setSelectedFeedId(0); ff.setSelectedFeedId(0);
} }
FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.headlines_fragment, new OfflineHeadlinesFragment()); ft.replace(R.id.headlines_fragment, new OfflineHeadlinesFragment());
ft.commit(); ft.commit();
@ -361,14 +361,14 @@ public class OfflineActivity extends FragmentActivity implements
findViewById(R.id.headlines_fragment).setVisibility(View.INVISIBLE); findViewById(R.id.headlines_fragment).setVisibility(View.INVISIBLE);
m_activeFeedId = 0; m_activeFeedId = 0;
OfflineFeedsFragment ff = (OfflineFeedsFragment) getSupportFragmentManager() OfflineFeedsFragment ff = (OfflineFeedsFragment) getFragmentManager()
.findFragmentById(R.id.feeds_fragment); .findFragmentById(R.id.feeds_fragment);
if (ff != null) { if (ff != null) {
ff.setSelectedFeedId(0); ff.setSelectedFeedId(0);
} }
FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.headlines_fragment, new OfflineHeadlinesFragment()); ft.replace(R.id.headlines_fragment, new OfflineHeadlinesFragment());
ft.commit(); ft.commit();
@ -466,7 +466,7 @@ public class OfflineActivity extends FragmentActivity implements
} }
private void refreshHeadlines() { private void refreshHeadlines() {
OfflineHeadlinesFragment ohf = (OfflineHeadlinesFragment) getSupportFragmentManager() OfflineHeadlinesFragment ohf = (OfflineHeadlinesFragment) getFragmentManager()
.findFragmentById(R.id.headlines_fragment); .findFragmentById(R.id.headlines_fragment);
if (ohf != null) { if (ohf != null) {
@ -476,7 +476,7 @@ public class OfflineActivity extends FragmentActivity implements
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
final OfflineHeadlinesFragment ohf = (OfflineHeadlinesFragment) getSupportFragmentManager() final OfflineHeadlinesFragment ohf = (OfflineHeadlinesFragment) getFragmentManager()
.findFragmentById(R.id.headlines_fragment); .findFragmentById(R.id.headlines_fragment);
switch (item.getItemId()) { switch (item.getItemId()) {
@ -689,7 +689,7 @@ public class OfflineActivity extends FragmentActivity implements
} }
private void refreshFeeds() { private void refreshFeeds() {
OfflineFeedsFragment frag = (OfflineFeedsFragment) getSupportFragmentManager() OfflineFeedsFragment frag = (OfflineFeedsFragment) getFragmentManager()
.findFragmentById(R.id.feeds_fragment); .findFragmentById(R.id.feeds_fragment);
if (frag != null) { if (frag != null) {
@ -717,7 +717,7 @@ public class OfflineActivity extends FragmentActivity implements
m_selectedArticleId = 0; m_selectedArticleId = 0;
FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.article_fragment, new DummyFragment()); ft.replace(R.id.article_fragment, new DummyFragment());
ft.commit(); ft.commit();
@ -766,7 +766,7 @@ public class OfflineActivity extends FragmentActivity implements
@Override @Override
public boolean onQueryTextSubmit(String query) { public boolean onQueryTextSubmit(String query) {
OfflineHeadlinesFragment frag = (OfflineHeadlinesFragment) getSupportFragmentManager() OfflineHeadlinesFragment frag = (OfflineHeadlinesFragment) getFragmentManager()
.findFragmentById(R.id.headlines_fragment); .findFragmentById(R.id.headlines_fragment);
if (frag != null) { if (frag != null) {
@ -780,7 +780,7 @@ public class OfflineActivity extends FragmentActivity implements
@Override @Override
public boolean onQueryTextChange(String newText) { public boolean onQueryTextChange(String newText) {
if (newText.equals("") && !newText.equals(this.query)) { if (newText.equals("") && !newText.equals(this.query)) {
OfflineHeadlinesFragment frag = (OfflineHeadlinesFragment) getSupportFragmentManager() OfflineHeadlinesFragment frag = (OfflineHeadlinesFragment) getFragmentManager()
.findFragmentById(R.id.headlines_fragment); .findFragmentById(R.id.headlines_fragment);
if (frag != null) { if (frag != null) {
@ -848,9 +848,9 @@ public class OfflineActivity extends FragmentActivity implements
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item AdapterContextMenuInfo info = (AdapterContextMenuInfo) item
.getMenuInfo(); .getMenuInfo();
OfflineHeadlinesFragment hf = (OfflineHeadlinesFragment) getSupportFragmentManager() OfflineHeadlinesFragment hf = (OfflineHeadlinesFragment) getFragmentManager()
.findFragmentById(R.id.headlines_fragment); .findFragmentById(R.id.headlines_fragment);
OfflineFeedsFragment ff = (OfflineFeedsFragment) getSupportFragmentManager() OfflineFeedsFragment ff = (OfflineFeedsFragment) getFragmentManager()
.findFragmentById(R.id.feeds_fragment); .findFragmentById(R.id.feeds_fragment);
switch (item.getItemId()) { switch (item.getItemId()) {
@ -1013,7 +1013,7 @@ public class OfflineActivity extends FragmentActivity implements
case KeyEvent.KEYCODE_VOLUME_DOWN: case KeyEvent.KEYCODE_VOLUME_DOWN:
if (action == KeyEvent.ACTION_DOWN) { if (action == KeyEvent.ACTION_DOWN) {
OfflineHeadlinesFragment ohf = (OfflineHeadlinesFragment) getSupportFragmentManager() OfflineHeadlinesFragment ohf = (OfflineHeadlinesFragment) getFragmentManager()
.findFragmentById(R.id.headlines_fragment); .findFragmentById(R.id.headlines_fragment);
int nextId = getRelativeArticleId(m_selectedArticleId, int nextId = getRelativeArticleId(m_selectedArticleId,
@ -1042,7 +1042,7 @@ public class OfflineActivity extends FragmentActivity implements
case KeyEvent.KEYCODE_VOLUME_UP: case KeyEvent.KEYCODE_VOLUME_UP:
if (action == KeyEvent.ACTION_UP) { if (action == KeyEvent.ACTION_UP) {
OfflineHeadlinesFragment ohf = (OfflineHeadlinesFragment) getSupportFragmentManager() OfflineHeadlinesFragment ohf = (OfflineHeadlinesFragment) getFragmentManager()
.findFragmentById(R.id.headlines_fragment); .findFragmentById(R.id.headlines_fragment);
int prevId = getRelativeArticleId(m_selectedArticleId, int prevId = getRelativeArticleId(m_selectedArticleId,
@ -1151,7 +1151,7 @@ public class OfflineActivity extends FragmentActivity implements
} }
} }
FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); FragmentTransaction ft = getFragmentManager().beginTransaction();
OfflineHeadlinesFragment frag = new OfflineHeadlinesFragment(); OfflineHeadlinesFragment frag = new OfflineHeadlinesFragment();
ft.replace(R.id.headlines_fragment, frag); ft.replace(R.id.headlines_fragment, frag);
ft.commit(); ft.commit();
@ -1164,7 +1164,7 @@ public class OfflineActivity extends FragmentActivity implements
initMainMenu(); initMainMenu();
OfflineHeadlinesFragment hf = (OfflineHeadlinesFragment) getSupportFragmentManager() OfflineHeadlinesFragment hf = (OfflineHeadlinesFragment) getFragmentManager()
.findFragmentById(R.id.headlines_fragment); .findFragmentById(R.id.headlines_fragment);
if (hf != null) { if (hf != null) {
@ -1187,7 +1187,7 @@ public class OfflineActivity extends FragmentActivity implements
frag = new OfflineArticleFragment(articleId); frag = new OfflineArticleFragment(articleId);
} }
FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.article_fragment, frag); ft.replace(R.id.article_fragment, frag);
ft.commit(); ft.commit();

View File

@ -9,20 +9,20 @@ import org.jsoup.nodes.Element;
import org.jsoup.select.Elements; import org.jsoup.select.Elements;
import android.app.Activity; import android.app.Activity;
import android.app.Fragment;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.database.Cursor; import android.database.Cursor;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.provider.BaseColumns; import android.provider.BaseColumns;
import android.support.v4.app.Fragment;
import android.text.Html; import android.text.Html;
import android.text.method.LinkMovementMethod; import android.text.method.LinkMovementMethod;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.ContextMenu; import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.ContextMenu.ContextMenuInfo;
import android.webkit.WebSettings; import android.webkit.WebSettings;
import android.webkit.WebView; import android.webkit.WebView;
import android.widget.TextView; import android.widget.TextView;

View File

@ -1,13 +1,11 @@
package org.fox.ttrss; package org.fox.ttrss;
import android.app.Activity; import android.app.Activity;
import android.database.Cursor; import android.app.Fragment;
import android.app.FragmentManager;
import android.database.sqlite.SQLiteStatement; import android.database.sqlite.SQLiteStatement;
import android.os.Bundle; import android.os.Bundle;
import android.provider.BaseColumns; import android.provider.BaseColumns;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@ -58,7 +56,7 @@ public class OfflineArticlePager extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.article_pager, container, false); View view = inflater.inflate(R.layout.article_pager, container, false);
m_adapter = new PagerAdapter(getActivity().getSupportFragmentManager()); m_adapter = new PagerAdapter(getActivity().getFragmentManager());
ViewPager pager = (ViewPager) view.findViewById(R.id.article_pager); ViewPager pager = (ViewPager) view.findViewById(R.id.article_pager);
@ -101,7 +99,7 @@ public class OfflineArticlePager extends Fragment {
public void onAttach(Activity activity) { public void onAttach(Activity activity) {
super.onAttach(activity); super.onAttach(activity);
m_hf = (OfflineHeadlinesFragment) getActivity().getSupportFragmentManager().findFragmentById(R.id.headlines_fragment); m_hf = (OfflineHeadlinesFragment) getActivity().getFragmentManager().findFragmentById(R.id.headlines_fragment);
m_offlineServices = (OfflineServices)activity; m_offlineServices = (OfflineServices)activity;
} }

View File

@ -3,6 +3,7 @@ package org.fox.ttrss;
import java.io.File; import java.io.File;
import android.app.Activity; import android.app.Activity;
import android.app.Fragment;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
@ -13,8 +14,6 @@ import android.os.Bundle;
import android.os.Environment; import android.os.Environment;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.provider.BaseColumns; import android.provider.BaseColumns;
import android.support.v4.app.Fragment;
import android.support.v4.widget.SimpleCursorAdapter;
import android.util.Log; import android.util.Log;
import android.view.ContextMenu; import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo; import android.view.ContextMenu.ContextMenuInfo;
@ -26,6 +25,7 @@ import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemClickListener; import android.widget.AdapterView.OnItemClickListener;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.ListView; import android.widget.ListView;
import android.widget.SimpleCursorAdapter;
import android.widget.TextView; import android.widget.TextView;
public class OfflineFeedsFragment extends Fragment implements OnItemClickListener, OnSharedPreferenceChangeListener { public class OfflineFeedsFragment extends Fragment implements OnItemClickListener, OnSharedPreferenceChangeListener {

View File

@ -8,6 +8,7 @@ import java.util.TimeZone;
import org.jsoup.Jsoup; import org.jsoup.Jsoup;
import android.app.Activity; import android.app.Activity;
import android.app.Fragment;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.database.Cursor; import android.database.Cursor;
@ -17,8 +18,6 @@ import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.provider.BaseColumns; import android.provider.BaseColumns;
import android.support.v4.app.Fragment;
import android.support.v4.widget.SimpleCursorAdapter;
import android.text.Html; import android.text.Html;
import android.text.Html.ImageGetter; import android.text.Html.ImageGetter;
import android.text.method.LinkMovementMethod; import android.text.method.LinkMovementMethod;
@ -35,6 +34,7 @@ import android.widget.AdapterView.OnItemClickListener;
import android.widget.CheckBox; import android.widget.CheckBox;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.ListView; import android.widget.ListView;
import android.widget.SimpleCursorAdapter;
import android.widget.TextView; import android.widget.TextView;
public class OfflineHeadlinesFragment extends Fragment implements OnItemClickListener { public class OfflineHeadlinesFragment extends Fragment implements OnItemClickListener {