switch to drawerlayout where applicable

remove loading_container stuff
various other changes related to drawerlayout
This commit is contained in:
Andrew Dolgov 2014-10-31 01:02:06 +03:00
parent 519602d92a
commit 7746b4636e
34 changed files with 424 additions and 588 deletions

View File

@ -27,7 +27,7 @@ dependencies {
compile files('libs/dashclock-api-r1.1.jar')
compile files('libs/jsoup-1.6.1.jar')
compile files('libs/universal-image-loader-1.9.3.jar')
compile 'com.jeremyfeinstein.slidingmenu:library:1.3@aar'
/* compile 'com.jeremyfeinstein.slidingmenu:library:1.3@aar' */
compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'
compile 'com.viewpagerindicator:library:2.4.1'
compile 'com.android.support:cardview-v7:21.0.0'

View File

@ -86,7 +86,6 @@
<orderEntry type="library" exported="" name="dashclock-api-r1.1" level="project" />
<orderEntry type="library" exported="" name="systembartint-1.0.3" level="project" />
<orderEntry type="library" exported="" name="jsoup-1.6.1" level="project" />
<orderEntry type="library" exported="" name="library-1.3" level="project" />
<orderEntry type="library" exported="" name="gson-1.7.1" level="project" />
<orderEntry type="library" exported="" name="library-2.4.1" level="project" />
<orderEntry type="library" exported="" name="universal-image-loader-1.9.3" level="project" />

View File

@ -1,20 +1,5 @@
package org.fox.ttrss;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.fox.ttrss.types.Article;
import org.fox.ttrss.types.Attachment;
import org.fox.ttrss.util.TypefaceCache;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
@ -40,6 +25,21 @@ import android.webkit.WebView;
import android.webkit.WebView.HitTestResult;
import android.widget.TextView;
import org.fox.ttrss.types.Article;
import org.fox.ttrss.types.Attachment;
import org.fox.ttrss.util.TypefaceCache;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
public class ArticleFragment extends Fragment {
private final String TAG = this.getClass().getSimpleName();
@ -262,9 +262,7 @@ public class ArticleFragment extends Fragment {
String theme = m_prefs.getString("theme", CommonActivity.THEME_DEFAULT);
if (CommonActivity.THEME_HOLO.equals(theme)) {
cssOverride = "body { background : transparent; color : #e0e0e0}";
} else if (CommonActivity.THEME_DARK.equals(theme)) {
if (CommonActivity.THEME_DARK.equals(theme)) {
cssOverride = "body { background : transparent; color : #e0e0e0}";
} else {
cssOverride = "body { background : transparent; }";

View File

@ -1,12 +1,5 @@
package org.fox.ttrss;
import java.util.HashMap;
import org.fox.ttrss.types.Article;
import org.fox.ttrss.types.ArticleList;
import org.fox.ttrss.types.Feed;
import org.fox.ttrss.util.HeadlinesRequest;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.SharedPreferences;
@ -16,9 +9,7 @@ import android.preference.PreferenceManager;
import android.support.v4.app.ClassloaderWorkaroundFragmentStatePagerAdapter;
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.v7.widget.Toolbar;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
@ -28,6 +19,13 @@ import android.view.WindowManager;
import com.google.gson.JsonElement;
import com.viewpagerindicator.UnderlinePageIndicator;
import org.fox.ttrss.types.Article;
import org.fox.ttrss.types.ArticleList;
import org.fox.ttrss.types.Feed;
import org.fox.ttrss.util.HeadlinesRequest;
import java.util.HashMap;
public class ArticlePager extends Fragment {
private final String TAG = "ArticlePager";
@ -144,8 +142,7 @@ public class ArticlePager extends Fragment {
@SuppressWarnings({ "serial" })
protected void refresh(boolean append) {
m_activity.setLoadingStatus(R.string.blank, true);
//m_activity.setLoadingStatus(R.string.blank, true);
m_activity.setProgressBarVisibility(true);
//m_activity.m_pullToRefreshAttacher.setRefreshing(true);

View File

@ -1,34 +1,23 @@
package org.fox.ttrss;
import java.io.File;
import java.io.IOException;
import org.fox.ttrss.util.DatabaseHelper;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
import com.nostra13.universalimageloader.utils.StorageUtils;
import com.readystatesoftware.systembartint.SystemBarTintManager;
import android.annotation.SuppressLint;
import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.BitmapFactory;
import android.graphics.Point;
import android.net.http.HttpResponseCache;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
import android.util.TypedValue;
import android.view.Display;
import android.view.View;
import android.view.WindowManager;
import android.widget.TextView;
import android.widget.Toast;
import com.readystatesoftware.systembartint.SystemBarTintManager;
import org.fox.ttrss.util.DatabaseHelper;
public class CommonActivity extends ActionBarActivity {
private final String TAG = this.getClass().getSimpleName();
@ -40,7 +29,6 @@ public class CommonActivity extends ActionBarActivity {
public final static String THEME_DARK = "THEME_DARK";
public final static String THEME_LIGHT = "THEME_LIGHT";
public final static String THEME_SEPIA = "THEME_SEPIA";
public final static String THEME_HOLO = "THEME_HOLO";
public final static String THEME_DEFAULT = CommonActivity.THEME_LIGHT;
public static final int EXCERPT_MAX_SIZE = 200;
@ -83,18 +71,6 @@ public class CommonActivity extends ActionBarActivity {
editor.commit();
}
public void setLoadingStatus(int status, boolean showProgress) {
TextView tv = (TextView) findViewById(R.id.loading_message);
if (tv != null) {
tv.setText(status);
}
findViewById(R.id.loading_container).setVisibility(status == R.string.blank ? View.GONE : View.VISIBLE);
setProgressBarIndeterminateVisibility(showProgress);
}
public void toast(int msgId) {
Toast toast = Toast.makeText(CommonActivity.this, msgId, Toast.LENGTH_SHORT);
toast.show();
@ -226,7 +202,7 @@ public class CommonActivity extends ActionBarActivity {
public boolean isDarkTheme() {
String theme = m_prefs.getString("theme", THEME_DEFAULT);
return theme.equals(THEME_DARK) || theme.equals(THEME_HOLO);
return theme.equals(THEME_DARK);
}
protected void setAppTheme(SharedPreferences prefs) {
@ -236,8 +212,6 @@ public class CommonActivity extends ActionBarActivity {
setTheme(R.style.DarkTheme);
} else if (theme.equals(THEME_SEPIA)) {
setTheme(R.style.SepiaTheme);
} else if (theme.equals(THEME_HOLO)) {
setTheme(R.style.HoloTheme);
} else {
setTheme(R.style.LightTheme);
}

View File

@ -1,16 +1,5 @@
package org.fox.ttrss;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import org.fox.ttrss.types.Feed;
import org.fox.ttrss.types.FeedCategory;
import org.fox.ttrss.types.FeedCategoryList;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
@ -26,10 +15,10 @@ import android.support.v4.widget.SwipeRefreshLayout;
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;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.AdapterContextMenuInfo;
@ -45,6 +34,17 @@ import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.reflect.TypeToken;
import org.fox.ttrss.types.Feed;
import org.fox.ttrss.types.FeedCategory;
import org.fox.ttrss.types.FeedCategoryList;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
public class FeedCategoriesFragment extends Fragment implements OnItemClickListener, OnSharedPreferenceChangeListener {
private final String TAG = this.getClass().getSimpleName();
private SharedPreferences m_prefs;
@ -363,7 +363,7 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe
else */
//m_adapter.notifyDataSetChanged(); (done by sortCats)
m_activity.setLoadingStatus(R.string.blank, false);
//m_activity.setLoadingStatus(R.string.blank, false);
return;
}
@ -376,7 +376,7 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe
if (m_lastError == ApiError.LOGIN_FAILED) {
m_activity.login(true);
} else {
m_activity.setLoadingStatus(getErrorMessage(), false);
//m_activity.setLoadingStatus(getErrorMessage(), false);
}
}
@ -429,7 +429,7 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe
public int getItemViewType(int position) {
FeedCategory cat = items.get(position);
if (!m_activity.isSmallScreen() && m_selectedCat != null && cat.id == m_selectedCat.id) {
if (m_selectedCat != null && cat.id == m_selectedCat.id) {
return VIEW_SELECTED;
} else {
return VIEW_NORMAL;
@ -521,8 +521,7 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe
}
}
//if (!m_activity.isSmallScreen())
// m_selectedCat = cat;
m_selectedCat = cat;
m_adapter.notifyDataSetChanged();
}

View File

@ -10,12 +10,15 @@ import android.os.Handler;
import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.util.Log;
import android.view.Gravity;
import android.view.MenuItem;
import android.view.View;
import android.widget.LinearLayout;
import com.google.gson.JsonElement;
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
import org.fox.ttrss.types.Article;
import org.fox.ttrss.types.ArticleList;
@ -34,12 +37,15 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
protected SharedPreferences m_prefs;
protected long m_lastRefresh = 0;
private boolean m_actionbarUpEnabled = false;
private int m_actionbarRevertDepth = 0;
private SlidingMenu m_slidingMenu;
//private boolean m_actionbarUpEnabled = false;
//private int m_actionbarRevertDepth = 0;
//private SlidingMenu m_slidingMenu;
private boolean m_feedIsSelected = false;
private boolean m_feedWasSelected = false;
//private boolean m_feedWasSelected = false;
private ActionBarDrawerToggle m_drawerToggle;
private DrawerLayout m_drawerLayout;
@SuppressLint("NewApi")
@Override
public void onCreate(Bundle savedInstanceState) {
@ -57,53 +63,38 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
findViewById(R.id.sw600dp_port_anchor) == null);
GlobalState.getInstance().load(savedInstanceState);
if (isSmallScreen() || findViewById(R.id.sw600dp_port_anchor) != null) {
m_slidingMenu = new SlidingMenu(this);
/* if (findViewById(R.id.sw600dp_port_anchor) != null) {
m_slidingMenu.setBehindWidth(getScreenWidthInPixel() * 2/3);
} */
m_slidingMenu.setMode(SlidingMenu.LEFT);
m_slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
m_slidingMenu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
m_slidingMenu.setMenu(R.layout.feeds);
m_slidingMenu.setSlidingEnabled(true);
m_slidingMenu.setOnClosedListener(new SlidingMenu.OnClosedListener() {
@Override
public void onClosed() {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
m_actionbarUpEnabled = true;
m_feedIsSelected = true;
initMenu();
}
});
m_slidingMenu.setOnOpenedListener(new SlidingMenu.OnOpenedListener() {
@Override
public void onOpened() {
if (m_actionbarRevertDepth == 0) {
m_actionbarUpEnabled = false;
getSupportActionBar().setDisplayHomeAsUpEnabled(false);
refresh(false);
}
setTitle(R.string.app_name);
m_drawerLayout = (DrawerLayout) findViewById(R.id.headlines_drawer);
m_feedIsSelected = false;
initMenu();
}
});
}
if (m_drawerLayout != null) {
if (savedInstanceState == null) {
if (m_slidingMenu != null)
m_slidingMenu.showMenu();
m_drawerToggle = new ActionBarDrawerToggle(this, m_drawerLayout, R.string.blank, R.string.blank) {
@Override
public void onDrawerOpened(View drawerView) {
super.onDrawerOpened(drawerView);
invalidateOptionsMenu();
}
@Override
public void onDrawerClosed(View drawerView) {
super.onDrawerClosed(drawerView);
invalidateOptionsMenu();
}
};
m_drawerLayout.setDrawerListener(m_drawerToggle);
m_drawerToggle.setDrawerIndicatorEnabled(true);
}
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
if (savedInstanceState == null) {
if (m_drawerLayout != null) {
m_drawerLayout.openDrawer(Gravity.START);
}
final Intent i = getIntent();
boolean shortcutMode = i.getBooleanExtra("shortcut_mode", false);
@ -157,25 +148,17 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
checkTrial(true);
} else { // savedInstanceState != null
m_actionbarUpEnabled = savedInstanceState.getBoolean("actionbarUpEnabled");
m_actionbarRevertDepth = savedInstanceState.getInt("actionbarRevertDepth");
//m_actionbarUpEnabled = savedInstanceState.getBoolean("actionbarUpEnabled");
//m_actionbarRevertDepth = savedInstanceState.getInt("actionbarRevertDepth");
m_feedIsSelected = savedInstanceState.getBoolean("feedIsSelected");
m_feedWasSelected = savedInstanceState.getBoolean("feedWasSelected");
//m_feedWasSelected = savedInstanceState.getBoolean("feedWasSelected");
if (findViewById(R.id.sw600dp_port_anchor) != null && m_feedWasSelected && m_slidingMenu != null) {
/* if (findViewById(R.id.sw600dp_port_anchor) != null && m_feedWasSelected && m_slidingMenu != null) {
m_slidingMenu.setBehindWidth(getScreenWidthInPixel() * 2/3);
}
} */
if (m_slidingMenu != null && m_feedIsSelected == false) {
m_slidingMenu.showMenu();
} else if (m_slidingMenu != null) {
m_actionbarUpEnabled = true;
} else {
m_actionbarUpEnabled = m_actionbarRevertDepth > 0;
}
if (m_actionbarUpEnabled) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
if (m_drawerLayout != null && m_feedIsSelected == false) {
m_drawerLayout.openDrawer(Gravity.START);
}
if (!isSmallScreen()) {
@ -194,7 +177,13 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
} */
}
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
// Sync the toggle state after onRestoreInstanceState has occurred.
if (m_drawerToggle != null) m_drawerToggle.syncState();
}
@Override
protected void initMenu() {
super.initMenu();
@ -204,9 +193,11 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
Fragment cf = getSupportFragmentManager().findFragmentByTag(FRAG_CATS);
HeadlinesFragment hf = (HeadlinesFragment)getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
if (m_slidingMenu != null) {
m_menu.setGroupVisible(R.id.menu_group_feeds, m_slidingMenu.isMenuShowing());
m_menu.setGroupVisible(R.id.menu_group_headlines, hf != null && hf.isAdded() && !m_slidingMenu.isMenuShowing());
if (m_drawerLayout != null) {
boolean isDrawerOpen = m_drawerLayout.isDrawerOpen(Gravity.START);
m_menu.setGroupVisible(R.id.menu_group_feeds, isDrawerOpen);
m_menu.setGroupVisible(R.id.menu_group_headlines, hf != null && hf.isAdded() && !isDrawerOpen);
} else {
m_menu.setGroupVisible(R.id.menu_group_feeds, (ff != null && ff.isAdded()) || (cf != null && cf.isAdded()));
m_menu.setGroupVisible(R.id.menu_group_headlines, hf != null && hf.isAdded());
@ -263,16 +254,17 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
ft.commit();
m_feedIsSelected = true;
m_feedWasSelected = true;
//m_feedWasSelected = true;
if (m_slidingMenu != null) {
if (findViewById(R.id.sw600dp_port_anchor) != null) {
if (m_drawerLayout != null) {
/* if (findViewById(R.id.sw600dp_port_anchor) != null) {
m_slidingMenu.setBehindWidth(getScreenWidthInPixel() * 2/3);
}
} */
m_slidingMenu.showContent();
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
m_actionbarUpEnabled = true;
m_drawerLayout.closeDrawers();
//getSupportActionBar().setDisplayHomeAsUpEnabled(true);
//m_actionbarUpEnabled = true;
}
}
@ -302,15 +294,15 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
.beginTransaction();
FeedsFragment ff = new FeedsFragment();
ff.initialize(cat);
ff.initialize(cat, true);
ft.replace(R.id.feeds_fragment, ff, FRAG_FEEDS);
ft.addToBackStack(null);
ft.commit();
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
m_actionbarUpEnabled = true;
m_actionbarRevertDepth = m_actionbarRevertDepth + 1;
//getSupportActionBar().setDisplayHomeAsUpEnabled(true);
//m_actionbarUpEnabled = true;
//m_actionbarRevertDepth = m_actionbarRevertDepth + 1;
} else {
@ -329,10 +321,12 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
@Override
public void onBackPressed() {
if (m_actionbarRevertDepth > 0) {
super.onBackPressed();
/* if (m_actionbarRevertDepth > 0) {
if (m_feedIsSelected && m_slidingMenu != null && !m_slidingMenu.isMenuShowing()) {
m_slidingMenu.showMenu();
if (m_feedIsSelected && m_drawerLayout != null && !m_drawerLayout.isDrawerOpen(Gravity.START)) {
m_drawerLayout.closeDrawers();
} else {
m_actionbarRevertDepth = m_actionbarRevertDepth - 1;
m_actionbarUpEnabled = m_actionbarRevertDepth > 0;
@ -344,15 +338,18 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
m_slidingMenu.showMenu();
} else {
super.onBackPressed();
}
} */
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
if (m_drawerToggle != null && m_drawerToggle.onOptionsItemSelected(item)) {
return true;
}
switch (item.getItemId()) {
case android.R.id.home:
if (m_actionbarUpEnabled)
onBackPressed();
onBackPressed();
return true;
case R.id.show_feeds:
setUnreadOnly(!getUnreadOnly());
@ -371,10 +368,8 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
@Override
protected void loginSuccess(boolean refresh) {
setLoadingStatus(R.string.blank, false);
//findViewById(R.id.loading_container).setVisibility(View.GONE);
initMenu();
if (refresh) refresh();
}
@ -382,10 +377,10 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
public void onSaveInstanceState(Bundle out) {
super.onSaveInstanceState(out);
out.putBoolean("actionbarUpEnabled", m_actionbarUpEnabled);
out.putInt("actionbarRevertDepth", m_actionbarRevertDepth);
//out.putBoolean("actionbarUpEnabled", m_actionbarUpEnabled);
//out.putInt("actionbarRevertDepth", m_actionbarRevertDepth);
out.putBoolean("feedIsSelected", m_feedIsSelected);
out.putBoolean("feedWasSelected", m_feedWasSelected);
//out.putBoolean("feedWasSelected", m_feedWasSelected);
//if (m_slidingMenu != null )
// out.putBoolean("slidingMenuVisible", m_slidingMenu.isMenuShowing());

View File

@ -1,22 +1,5 @@
package org.fox.ttrss;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.lang.reflect.Type;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import org.fox.ttrss.types.Feed;
import org.fox.ttrss.types.FeedCategory;
import org.fox.ttrss.types.FeedList;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
@ -39,15 +22,16 @@ 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;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ListView;
@ -58,6 +42,23 @@ import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.reflect.TypeToken;
import org.fox.ttrss.types.Feed;
import org.fox.ttrss.types.FeedCategory;
import org.fox.ttrss.types.FeedList;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.lang.reflect.Type;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
public class FeedsFragment extends Fragment implements OnItemClickListener, OnSharedPreferenceChangeListener {
private final String TAG = this.getClass().getSimpleName();
private SharedPreferences m_prefs;
@ -70,9 +71,11 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
private boolean m_enableFeedIcons;
private boolean m_feedIconsChecked = false;
private SwipeRefreshLayout m_swipeLayout;
private boolean m_enableParentBtn = false;
public void initialize(FeedCategory cat) {
m_activeCategory = cat;
public void initialize(FeedCategory cat, boolean enableParentBtn) {
m_activeCategory = cat;
m_enableParentBtn = enableParentBtn;
}
@SuppressLint("DefaultLocale")
@ -273,6 +276,7 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
m_feeds = savedInstanceState.getParcelable("feeds");
m_feedIconsChecked = savedInstanceState.getBoolean("feedIconsChecked");
m_activeCategory = savedInstanceState.getParcelable("activeCat");
m_enableParentBtn = savedInstanceState.getBoolean("enableParentBtn");
}
View view = inflater.inflate(R.layout.feeds_fragment, container, false);
@ -292,7 +296,22 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
android.R.color.holo_blue_dark,
android.R.color.holo_orange_dark);
}
Button parentBtn = (Button) view.findViewById(R.id.open_parent);
if (parentBtn != null) {
if (m_enableParentBtn) {
parentBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
m_activity.onBackPressed();
}
});
} else {
parentBtn.setVisibility(View.GONE);
}
}
ListView list = (ListView)view.findViewById(R.id.feeds);
m_adapter = new FeedListAdapter(getActivity(), R.layout.feeds_row, (ArrayList<Feed>)m_feeds);
list.setAdapter(m_adapter);
@ -342,7 +361,8 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
out.putParcelable("selectedFeed", m_selectedFeed);
out.putParcelable("feeds", m_feeds);
out.putBoolean("feedIconsChecked", m_feedIconsChecked);
out.putParcelable("activeCat", m_activeCategory);
out.putParcelable("activeCat", m_activeCategory);
out.putBoolean("enableParentBtn", m_enableParentBtn);
}
@Override
@ -524,7 +544,7 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
setLoadingStatus(R.string.no_feeds_to_display, false);
else */
m_activity.setLoadingStatus(R.string.blank, false);
//m_activity.setLoadingStatus(R.string.blank, false);
//m_adapter.notifyDataSetChanged(); (done by sortFeeds)
if (m_enableFeedIcons && !m_feedIconsChecked && Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState()))
@ -541,7 +561,7 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
if (m_lastError == ApiError.LOGIN_FAILED) {
m_activity.login(true);
} else {
m_activity.setLoadingStatus(getErrorMessage(), false);
//m_activity.setLoadingStatus(getErrorMessage(), false);
}
}
}
@ -567,7 +587,7 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
public int getItemViewType(int position) {
Feed feed = items.get(position);
if (!m_activity.isSmallScreen() && m_selectedFeed != null && feed.id == m_selectedFeed.id) {
if (m_selectedFeed != null && feed.id == m_selectedFeed.id) {
return VIEW_SELECTED;
} else {
return VIEW_NORMAL;

View File

@ -118,10 +118,7 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL
@Override
protected void loginSuccess(boolean refresh) {
Log.d(TAG, "loginSuccess");
setLoadingStatus(R.string.blank, false);
findViewById(R.id.loading_container).setVisibility(View.GONE);
initMenu();
if (refresh) refresh();

View File

@ -485,7 +485,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
if (m_lastError == ApiError.LOGIN_FAILED) {
m_activity.login(true);
} else {
m_activity.setLoadingStatus(getErrorMessage(), false);
//m_activity.setLoadingStatus(getErrorMessage(), false);
}
}
}
@ -518,7 +518,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
}
} else {
m_activity.setLoadingStatus(R.string.blank, true);
//m_activity.setLoadingStatus(R.string.blank, true);
}
final int fskip = skip;

View File

@ -1194,8 +1194,20 @@ public class OnlineActivity extends CommonActivity {
req.execute(map);
}
protected void logout() {
private void setLoadingStatus(int status, boolean showProgress) {
TextView tv = (TextView) findViewById(R.id.loading_message);
if (tv != null) {
tv.setText(status);
}
findViewById(R.id.loading_container).setVisibility(status == R.string.blank ? View.GONE : View.VISIBLE);
setProgressBarIndeterminateVisibility(showProgress);
}
protected void logout() {
setSessionId(null);
findViewById(R.id.loading_container).setVisibility(View.VISIBLE);

View File

@ -174,12 +174,9 @@ public class OfflineActivity extends CommonActivity {
super.onCreate(savedInstanceState);
setProgressBarVisibility(false);
setContentView(R.layout.login);
setLoadingStatus(R.string.blank, false);
findViewById(R.id.loading_container).setVisibility(View.GONE);
initMenu();
Intent intent = getIntent();

View File

@ -1,21 +1,5 @@
package org.fox.ttrss.offline;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.fox.ttrss.CommonActivity;
import org.fox.ttrss.R;
import org.fox.ttrss.util.ImageCacheService;
import org.fox.ttrss.util.TypefaceCache;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
@ -44,6 +28,22 @@ import android.webkit.WebView;
import android.webkit.WebView.HitTestResult;
import android.widget.TextView;
import org.fox.ttrss.CommonActivity;
import org.fox.ttrss.R;
import org.fox.ttrss.util.ImageCacheService;
import org.fox.ttrss.util.TypefaceCache;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
public class OfflineArticleFragment extends Fragment {
private final String TAG = this.getClass().getSimpleName();
@ -270,9 +270,7 @@ public class OfflineArticleFragment extends Fragment {
String theme = m_prefs.getString("theme", CommonActivity.THEME_DEFAULT);
if (CommonActivity.THEME_HOLO.equals(theme)) {
cssOverride = "body { background : transparent; color : #e0e0e0}";
} else if (CommonActivity.THEME_DARK.equals(theme)) {
if (CommonActivity.THEME_DARK.equals(theme)) {
cssOverride = "body { background : transparent; color : #e0e0e0}";
} else {
cssOverride = "body { background : transparent; }";

View File

@ -1,7 +1,5 @@
package org.fox.ttrss.offline;
import org.fox.ttrss.R;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
@ -16,10 +14,10 @@ import android.support.v4.widget.SwipeRefreshLayout;
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;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.AdapterContextMenuInfo;
@ -29,6 +27,8 @@ import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import org.fox.ttrss.R;
public class OfflineFeedCategoriesFragment extends Fragment implements OnItemClickListener, OnSharedPreferenceChangeListener {
private final String TAG = this.getClass().getSimpleName();
private SharedPreferences m_prefs;
@ -170,8 +170,6 @@ public class OfflineFeedCategoriesFragment extends Fragment implements OnItemCli
list.setEmptyView(view.findViewById(R.id.no_feeds));
registerForContextMenu(list);
view.findViewById(R.id.loading_container).setVisibility(View.GONE);
return view;
}
@ -219,10 +217,9 @@ public class OfflineFeedCategoriesFragment extends Fragment implements OnItemCli
} else {
m_activity.onCatSelected(feedId);
}
/* if (!m_activity.isSmallScreen())
m_selectedCatId = feedId; */
m_selectedCatId = feedId;
m_adapter.notifyDataSetChanged();
}
}
@ -262,7 +259,7 @@ public class OfflineFeedCategoriesFragment extends Fragment implements OnItemCli
public int getItemViewType(int position) {
Cursor cursor = (Cursor) this.getItem(position);
if (!m_activity.isSmallScreen() && cursor.getLong(0) == m_selectedCatId) {
if (cursor.getLong(0) == m_selectedCatId) {
return VIEW_SELECTED;
} else {
return VIEW_NORMAL;

View File

@ -1,11 +1,5 @@
package org.fox.ttrss.offline;
import org.fox.ttrss.GlobalState;
import org.fox.ttrss.R;
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
import android.animation.LayoutTransition;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.database.sqlite.SQLiteStatement;
@ -15,21 +9,29 @@ import android.preference.PreferenceManager;
import android.provider.BaseColumns;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.util.Log;
import android.view.Gravity;
import android.view.MenuItem;
import android.view.ViewGroup;
import android.view.View;
import android.widget.LinearLayout;
import org.fox.ttrss.GlobalState;
import org.fox.ttrss.R;
public class OfflineFeedsActivity extends OfflineActivity implements OfflineHeadlinesEventListener {
private final String TAG = this.getClass().getSimpleName();
private boolean m_actionbarUpEnabled = false;
private int m_actionbarRevertDepth = 0;
private SlidingMenu m_slidingMenu;
//private boolean m_actionbarUpEnabled = false;
//private int m_actionbarRevertDepth = 0;
private boolean m_feedIsSelected = false;
private boolean m_feedWasSelected = false;
@SuppressLint("NewApi")
//private boolean m_feedWasSelected = false;
private ActionBarDrawerToggle m_drawerToggle;
private DrawerLayout m_drawerLayout;
@SuppressLint("NewApi")
@Override
public void onCreate(Bundle savedInstanceState) {
m_prefs = PreferenceManager
@ -47,73 +49,48 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
GlobalState.getInstance().load(savedInstanceState);
if (isSmallScreen() || findViewById(R.id.sw600dp_port_anchor) != null) {
m_slidingMenu = new SlidingMenu(this);
m_drawerLayout = (DrawerLayout) findViewById(R.id.headlines_drawer);
if (m_drawerLayout != null) {
m_drawerToggle = new ActionBarDrawerToggle(this, m_drawerLayout, R.string.blank, R.string.blank) {
@Override
public void onDrawerOpened(View drawerView) {
invalidateOptionsMenu();
}
@Override
public void onDrawerClosed(View drawerView) {
invalidateOptionsMenu();
}
};
m_drawerLayout.setDrawerListener(m_drawerToggle);
m_drawerToggle.setDrawerIndicatorEnabled(true);
}
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
if (savedInstanceState != null) {
/* if (findViewById(R.id.sw600dp_port_anchor) != null) {
//m_actionbarUpEnabled = savedInstanceState.getBoolean("actionbarUpEnabled");
//m_actionbarRevertDepth = savedInstanceState.getInt("actionbarRevertDepth");
m_feedIsSelected = savedInstanceState.getBoolean("feedIsSelected");
//m_feedWasSelected = savedInstanceState.getBoolean("feedWasSelected");
/* if (findViewById(R.id.sw600dp_port_anchor) != null && m_feedWasSelected && m_slidingMenu != null) {
m_slidingMenu.setBehindWidth(getScreenWidthInPixel() * 2/3);
} */
m_slidingMenu.setMode(SlidingMenu.LEFT);
m_slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
m_slidingMenu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
m_slidingMenu.setSlidingEnabled(true);
m_slidingMenu.setMenu(R.layout.feeds);
m_slidingMenu.setOnClosedListener(new SlidingMenu.OnClosedListener() {
@Override
public void onClosed() {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
m_actionbarUpEnabled = true;
m_feedIsSelected = true;
initMenu();
}
});
m_slidingMenu.setOnOpenedListener(new SlidingMenu.OnOpenedListener() {
@Override
public void onOpened() {
if (m_actionbarRevertDepth == 0) {
m_actionbarUpEnabled = false;
m_feedIsSelected = false;
getSupportActionBar().setDisplayHomeAsUpEnabled(false);
refresh();
}
initMenu();
}
});
}
if (m_drawerLayout != null && m_feedIsSelected == false) {
m_drawerLayout.openDrawer(Gravity.START);
}
if (savedInstanceState != null) {
m_actionbarUpEnabled = savedInstanceState.getBoolean("actionbarUpEnabled");
m_actionbarRevertDepth = savedInstanceState.getInt("actionbarRevertDepth");
m_feedIsSelected = savedInstanceState.getBoolean("feedIsSelected");
m_feedWasSelected = savedInstanceState.getBoolean("feedWasSelected");
if (findViewById(R.id.sw600dp_port_anchor) != null && m_feedWasSelected && m_slidingMenu != null) {
m_slidingMenu.setBehindWidth(getScreenWidthInPixel() * 2/3);
}
if (m_slidingMenu != null && m_feedIsSelected == false) {
m_slidingMenu.showMenu();
} else if (m_slidingMenu != null) {
m_actionbarUpEnabled = true;
} else {
m_actionbarUpEnabled = m_actionbarRevertDepth > 0;
}
if (m_actionbarUpEnabled) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
} else {
if (m_slidingMenu != null)
m_slidingMenu.showMenu();
if (m_drawerLayout != null) {
m_drawerLayout.openDrawer(Gravity.START);
}
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
@ -125,17 +102,16 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
ft.commit();
}
setLoadingStatus(R.string.blank, false);
initMenu();
if (!isCompatMode() && !isSmallScreen()) {
((ViewGroup)findViewById(R.id.headlines_fragment)).setLayoutTransition(new LayoutTransition());
((ViewGroup)findViewById(R.id.feeds_fragment)).setLayoutTransition(new LayoutTransition());
}
initMenu();
}
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
// Sync the toggle state after onRestoreInstanceState has occurred.
if (m_drawerToggle != null) m_drawerToggle.syncState();
}
public void openFeedArticles(int feedId, boolean isCat) {
if (isSmallScreen()) {
Intent intent = new Intent(OfflineFeedsActivity.this, OfflineHeadlinesActivity.class);
@ -149,7 +125,9 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
@Override
public void onBackPressed() {
if (m_actionbarRevertDepth > 0) {
super.onBackPressed();
/* if (m_actionbarRevertDepth > 0) {
if (m_feedIsSelected && m_slidingMenu != null && !m_slidingMenu.isMenuShowing()) {
m_slidingMenu.showMenu();
@ -164,15 +142,18 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
m_slidingMenu.showMenu();
} else {
super.onBackPressed();
}
} */
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
if (m_drawerToggle != null && m_drawerToggle.onOptionsItemSelected(item)) {
return true;
}
switch (item.getItemId()) {
case android.R.id.home:
if (m_actionbarUpEnabled)
onBackPressed();
onBackPressed();
return true;
case R.id.show_feeds:
setUnreadOnly(!getUnreadOnly());
@ -189,10 +170,10 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
public void onSaveInstanceState(Bundle out) {
super.onSaveInstanceState(out);
out.putBoolean("actionbarUpEnabled", m_actionbarUpEnabled);
out.putInt("actionbarRevertDepth", m_actionbarRevertDepth);
//out.putBoolean("actionbarUpEnabled", m_actionbarUpEnabled);
//out.putInt("actionbarRevertDepth", m_actionbarRevertDepth);
out.putBoolean("feedIsSelected", m_feedIsSelected);
out.putBoolean("feedWasSelected", m_feedWasSelected);
//out.putBoolean("feedWasSelected", m_feedWasSelected);
//if (m_slidingMenu != null )
@ -209,9 +190,11 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
Fragment cf = getSupportFragmentManager().findFragmentByTag(FRAG_CATS);
OfflineHeadlinesFragment hf = (OfflineHeadlinesFragment)getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
if (m_slidingMenu != null) {
m_menu.setGroupVisible(R.id.menu_group_feeds, m_slidingMenu.isMenuShowing());
m_menu.setGroupVisible(R.id.menu_group_headlines, hf != null && hf.isAdded() && !m_slidingMenu.isMenuShowing());
if (m_drawerLayout != null) {
boolean isDrawerOpen = m_drawerLayout.isDrawerOpen(Gravity.START);
m_menu.setGroupVisible(R.id.menu_group_feeds, isDrawerOpen);
m_menu.setGroupVisible(R.id.menu_group_headlines, hf != null && hf.isAdded() && !isDrawerOpen);
} else {
m_menu.setGroupVisible(R.id.menu_group_feeds, (ff != null && ff.isAdded()) || (cf != null && cf.isAdded()));
m_menu.setGroupVisible(R.id.menu_group_headlines, hf != null && hf.isAdded());
@ -251,14 +234,14 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
.beginTransaction();
OfflineFeedsFragment ff = new OfflineFeedsFragment();
ff.initialize(catId);
ff.initialize(catId, true);
ft.replace(R.id.feeds_fragment, ff, FRAG_FEEDS);
ft.addToBackStack(null);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
m_actionbarUpEnabled = true;
m_actionbarRevertDepth = m_actionbarRevertDepth + 1;
//getSupportActionBar().setDisplayHomeAsUpEnabled(true);
//m_actionbarUpEnabled = true;
//m_actionbarRevertDepth = m_actionbarRevertDepth + 1;
ft.commit();
}
@ -291,16 +274,17 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
ft.commit();
m_feedIsSelected = true;
m_feedWasSelected = true;
//m_feedWasSelected = true;
if (m_slidingMenu != null) {
if (findViewById(R.id.sw600dp_port_anchor) != null) {
if (m_drawerLayout != null) {
/* if (findViewById(R.id.sw600dp_port_anchor) != null) {
m_slidingMenu.setBehindWidth(getScreenWidthInPixel() * 2/3);
}
m_slidingMenu.showContent();
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
m_actionbarUpEnabled = true;
} */
m_drawerLayout.closeDrawers();
//getSupportActionBar().setDisplayHomeAsUpEnabled(true);
//m_actionbarUpEnabled = true;
}
}
}, 10);

View File

@ -1,9 +1,5 @@
package org.fox.ttrss.offline;
import java.io.File;
import org.fox.ttrss.R;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
@ -21,19 +17,24 @@ import android.support.v4.widget.SwipeRefreshLayout;
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;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import org.fox.ttrss.R;
import java.io.File;
public class OfflineFeedsFragment extends Fragment implements OnItemClickListener, OnSharedPreferenceChangeListener {
private final String TAG = this.getClass().getSimpleName();
private SharedPreferences m_prefs;
@ -45,9 +46,11 @@ public class OfflineFeedsFragment extends Fragment implements OnItemClickListene
private Cursor m_cursor;
private OfflineFeedsActivity m_activity;
private SwipeRefreshLayout m_swipeLayout;
public void initialize(int catId) {
private boolean m_enableParentBtn = false;
public void initialize(int catId, boolean enableParentBtn) {
m_catId = catId;
m_enableParentBtn = enableParentBtn;
}
@Override
@ -148,6 +151,7 @@ public class OfflineFeedsFragment extends Fragment implements OnItemClickListene
if (savedInstanceState != null) {
m_selectedFeedId = savedInstanceState.getInt("selectedFeedId");
m_catId = savedInstanceState.getInt("catId");
m_enableParentBtn = savedInstanceState.getBoolean("enableParentBtn");
}
View view = inflater.inflate(R.layout.feeds_fragment, container, false);
@ -168,6 +172,21 @@ public class OfflineFeedsFragment extends Fragment implements OnItemClickListene
android.R.color.holo_orange_dark);
}
Button parentBtn = (Button) view.findViewById(R.id.open_parent);
if (parentBtn != null) {
if (m_enableParentBtn) {
parentBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
m_activity.onBackPressed();
}
});
} else {
parentBtn.setVisibility(View.GONE);
}
}
ListView list = (ListView)view.findViewById(R.id.feeds);
m_cursor = createCursor();
@ -180,8 +199,6 @@ public class OfflineFeedsFragment extends Fragment implements OnItemClickListene
list.setEmptyView(view.findViewById(R.id.no_feeds));
registerForContextMenu(list);
view.findViewById(R.id.loading_container).setVisibility(View.GONE);
m_enableFeedIcons = m_prefs.getBoolean("download_feed_icons", false);
return view;
@ -211,6 +228,7 @@ public class OfflineFeedsFragment extends Fragment implements OnItemClickListene
out.putInt("selectedFeedId", m_selectedFeedId);
out.putInt("catId", m_catId);
out.putBoolean("enableParentBtn", m_enableParentBtn);
}
@Override
@ -230,8 +248,7 @@ public class OfflineFeedsFragment extends Fragment implements OnItemClickListene
m_activity.onFeedSelected(feedId);
}
if (!m_activity.isSmallScreen())
m_selectedFeedId = feedId;
m_selectedFeedId = feedId;
m_adapter.notifyDataSetChanged();
}
@ -272,7 +289,7 @@ public class OfflineFeedsFragment extends Fragment implements OnItemClickListene
public int getItemViewType(int position) {
Cursor cursor = (Cursor) this.getItem(position);
if (!m_activity.isSmallScreen() && cursor.getLong(0) == m_selectedFeedId) {
if (cursor.getLong(0) == m_selectedFeedId) {
return VIEW_SELECTED;
} else {
return VIEW_NORMAL;

View File

@ -1,8 +1,5 @@
package org.fox.ttrss.offline;
import org.fox.ttrss.GlobalState;
import org.fox.ttrss.R;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.content.SharedPreferences;
@ -17,6 +14,9 @@ import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import org.fox.ttrss.GlobalState;
import org.fox.ttrss.R;
public class OfflineHeadlinesActivity extends OfflineActivity implements OfflineHeadlinesEventListener {
private final String TAG = this.getClass().getSimpleName();
@ -86,9 +86,6 @@ public class OfflineHeadlinesActivity extends OfflineActivity implements Offline
}
}
setLoadingStatus(R.string.blank, false);
findViewById(R.id.loading_container).setVisibility(View.GONE);
initMenu();
}

View File

@ -1,16 +1,5 @@
package org.fox.ttrss.util;
import java.lang.reflect.Type;
import java.util.List;
import org.fox.ttrss.ApiRequest;
import org.fox.ttrss.GlobalState;
import org.fox.ttrss.OnlineActivity;
import org.fox.ttrss.R;
import org.fox.ttrss.types.Article;
import org.fox.ttrss.types.ArticleList;
import org.fox.ttrss.types.Feed;
import android.content.Context;
import android.util.Log;
@ -19,6 +8,16 @@ import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.reflect.TypeToken;
import org.fox.ttrss.ApiRequest;
import org.fox.ttrss.GlobalState;
import org.fox.ttrss.OnlineActivity;
import org.fox.ttrss.types.Article;
import org.fox.ttrss.types.ArticleList;
import org.fox.ttrss.types.Feed;
import java.lang.reflect.Type;
import java.util.List;
public class HeadlinesRequest extends ApiRequest {
public static final int HEADLINES_REQUEST_SIZE = 30;
public static final int HEADLINES_BUFFER_MAX = 1500;
@ -78,7 +77,7 @@ public class HeadlinesRequest extends ApiRequest {
m_activity.setLoadingStatus(R.string.no_headlines_to_display, false);
else */
m_activity.setLoadingStatus(R.string.blank, false);
//m_activity.setLoadingStatus(R.string.blank, false);
return;
}
@ -91,7 +90,7 @@ public class HeadlinesRequest extends ApiRequest {
if (m_lastError == ApiError.LOGIN_FAILED) {
m_activity.login();
} else {
m_activity.setLoadingStatus(getErrorMessage(), false);
//m_activity.setLoadingStatus(getErrorMessage(), false);
}
}

View File

@ -13,20 +13,6 @@
</FrameLayout>
<LinearLayout
android:id="@+id/loading_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:visibility="gone" >
<TextView
android:id="@+id/loading_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
<LinearLayout
android:id="@+id/fragment_container"
android:layout_width="match_parent"

View File

@ -12,24 +12,6 @@
android:visibility="gone" >
</FrameLayout>
<LinearLayout
android:id="@+id/loading_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?loadingBackground"
android:gravity="center"
android:orientation="vertical"
android:visibility="visible" >
<TextView
android:id="@+id/loading_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="@string/loading_message"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
<LinearLayout
android:id="@+id/fragment_container"
android:layout_width="match_parent"

View File

@ -1,35 +1,35 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/headlines"
android:fitsSystemWindows="true"
android:orientation="vertical"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
android:layout_height="fill_parent"
android:fitsSystemWindows="true">
<FrameLayout
android:id="@+id/sw600dp_port_anchor"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</FrameLayout>
<LinearLayout
android:id="@+id/loading_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:layout_height="wrap_content"
android:visibility="gone" >
<TextView
android:id="@+id/loading_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
<FrameLayout
android:id="@+id/headlines_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</FrameLayout>
</LinearLayout>
<android.support.v4.widget.DrawerLayout
android:id="@+id/headlines_drawer"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/headlines_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?smallScreenBackground"></FrameLayout>
<FrameLayout
android:id="@+id/feeds_fragment"
android:layout_width="300dp"
android:layout_gravity="start"
android:background="?smallScreenBackground"
android:layout_height="match_parent" >
</FrameLayout>
</android.support.v4.widget.DrawerLayout>
</FrameLayout>

View File

@ -12,24 +12,6 @@
android:visibility="gone" >
</FrameLayout>
<LinearLayout
android:id="@+id/loading_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?loadingBackground"
android:gravity="center"
android:orientation="vertical"
android:visibility="visible" >
<TextView
android:id="@+id/loading_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="@string/loading_message"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
<LinearLayout
android:id="@+id/fragment_container"
android:layout_width="match_parent"

View File

@ -13,20 +13,6 @@
</FrameLayout>
<LinearLayout
android:id="@+id/loading_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:visibility="gone" >
<TextView
android:id="@+id/loading_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
<LinearLayout
android:id="@+id/fragment_container"
android:layout_width="match_parent"

View File

@ -12,24 +12,6 @@
android:visibility="gone" >
</FrameLayout>
<LinearLayout
android:id="@+id/loading_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?loadingBackground"
android:gravity="center"
android:orientation="vertical"
android:visibility="visible" >
<TextView
android:id="@+id/loading_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="@string/loading_message"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
<LinearLayout
android:id="@+id/fragment_container"
android:layout_width="match_parent"

View File

@ -4,20 +4,6 @@
android:layout_width="match_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:id="@+id/loading_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center" >
<TextView
android:id="@+id/loading_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge" >
</TextView>
</LinearLayout>
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/feeds_swipe_container"
android:layout_width="match_parent"

View File

@ -5,20 +5,6 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:id="@+id/loading_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:visibility="gone" >
<TextView
android:id="@+id/loading_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
<FrameLayout
android:id="@+id/feeds_fragment"
android:background="?smallScreenBackground"

View File

@ -1,28 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/feeds_fragment"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="fill_parent" >
<LinearLayout
android:id="@+id/loading_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center" >
<TextView
android:id="@+id/loading_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge" >
</TextView>
</LinearLayout>
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/feeds_swipe_container"
android:layout_width="match_parent"
android:layout_height="match_parent" >
android:layout_height="match_parent"
android:layout_weight="1">
<ListView
android:id="@+id/feeds"
android:layoutAnimation="@anim/layout_feeds"
@ -31,6 +19,15 @@
</ListView>
</android.support.v4.widget.SwipeRefreshLayout>
<Button
style="?android:attr/buttonStyleSmall"
android:background="?parentBtnBackground"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/open_parent"
android:layout_weight="0"
android:id="@+id/open_parent" />
<TextView
android:id="@+id/no_feeds"
android:layout_width="wrap_content"
@ -38,7 +35,7 @@
android:layout_gravity="center"
android:text="@string/no_feeds"
android:textAppearance="?android:attr/textAppearanceLarge"
android:visibility="invisible" >
android:visibility="gone" >
</TextView>
</FrameLayout>
</LinearLayout>

View File

@ -1,29 +1,28 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/headlines"
android:fitsSystemWindows="true"
android:orientation="vertical"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
android:layout_height="fill_parent"
android:fitsSystemWindows="true">
<LinearLayout
android:id="@+id/loading_container"
<android.support.v4.widget.DrawerLayout
android:id="@+id/headlines_drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:visibility="gone" >
android:layout_height="match_parent">
<TextView
android:id="@+id/loading_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
<FrameLayout
android:id="@+id/headlines_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?smallScreenBackground"></FrameLayout>
<FrameLayout
android:id="@+id/headlines_fragment"
android:background="?smallScreenBackground"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</FrameLayout>
<FrameLayout
android:id="@+id/feeds_fragment"
android:layout_width="240dp"
android:layout_gravity="start"
android:background="?smallScreenBackground"
android:layout_height="match_parent" >
</FrameLayout>
</LinearLayout>
</android.support.v4.widget.DrawerLayout>
</FrameLayout>

View File

@ -5,24 +5,6 @@
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/loading_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?loadingBackground"
android:gravity="center"
android:orientation="vertical"
android:visibility="visible" >
<TextView
android:id="@+id/loading_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="@string/loading_message"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
<LinearLayout
android:id="@+id/fragment_container"
android:layout_width="match_parent"

View File

@ -20,20 +20,6 @@
</ListView>
</android.support.v4.widget.SwipeRefreshLayout>
<LinearLayout
android:id="@+id/loading_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center" >
<TextView
android:id="@+id/loading_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge" >
</TextView>
</LinearLayout>
<TextView
android:id="@+id/no_headlines"
android:layout_width="wrap_content"

View File

@ -3,13 +3,11 @@
<item>@string/theme_light</item>
<item>@string/theme_dark</item>
<item>@string/theme_sepia</item>
<item>@string/theme_holo</item>
</string-array>
<string-array name="pref_theme_values" translatable="false">
<item>THEME_LIGHT</item>
<item>THEME_DARK</item>
<item>THEME_SEPIA</item>
<item>THEME_HOLO</item>
</string-array>
<string-array name="pref_view_mode_names">
<item>@string/category_browse_headlines</item>

View File

@ -28,4 +28,5 @@
<attr name="articleNoteBackground" format="reference|color" />
<attr name="articleNoteTextColor" format="reference|color" />
<attr name="statusBarHintColor" format="reference|color" />
<attr name="parentBtnBackground" format="reference|color" />
</resources>

View File

@ -242,5 +242,6 @@
<string name="hello_world">Hello world!</string>
<string name="action_settings">Settings</string>
<string name="error_loading_image">Error loading image.</string>
<string name="open_parent">Open parent</string>
</resources>

View File

@ -29,6 +29,7 @@
<item name="unreadSelectedCounterBackground">@drawable/counter_background_selected_light</item>
<item name="articleNoteTextColor">#9a8c59</item>
<item name="articleNoteBackground">#fff7d5</item>
<item name="parentBtnBackground">#dddddd</item>
<item name="colorPrimary">#6482af</item>
<item name="colorPrimaryDark">#526A8E</item>
@ -89,6 +90,7 @@
<item name="unreadSelectedCounterBackground">@drawable/counter_background_dark</item>
<item name="articleNoteTextColor">@android:color/secondary_text_dark</item>
<item name="articleNoteBackground">#303030</item>
<item name="parentBtnBackground">#101010</item>
</style>
<style name="HoloTheme" parent="HoloThemeBase">