diff options
Diffstat (limited to 'org.fox.ttrss')
-rwxr-xr-x[-rw-r--r--] | org.fox.ttrss/src/main/java/org/fox/ttrss/DetailActivity.java | 14 | ||||
-rwxr-xr-x[-rw-r--r--] | org.fox.ttrss/src/main/java/org/fox/ttrss/GalleryActivity.java | 42 | ||||
-rwxr-xr-x[-rw-r--r--] | org.fox.ttrss/src/main/java/org/fox/ttrss/MasterActivity.java | 30 | ||||
-rwxr-xr-x | org.fox.ttrss/src/main/java/org/fox/ttrss/OnlineActivity.java | 15 | ||||
-rwxr-xr-x | org.fox.ttrss/src/main/java/org/fox/ttrss/YoutubePlayerActivity.java | 20 | ||||
-rwxr-xr-x[-rw-r--r--] | org.fox.ttrss/src/main/java/org/fox/ttrss/share/CommonShareActivity.java | 19 |
6 files changed, 32 insertions, 108 deletions
diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/DetailActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/DetailActivity.java index 6386c5fc..15b37002 100644..100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/DetailActivity.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/DetailActivity.java @@ -19,9 +19,11 @@ import org.fox.ttrss.types.Article; import org.fox.ttrss.types.ArticleList; import org.fox.ttrss.types.Feed; +import icepick.State; + public class DetailActivity extends OnlineActivity implements HeadlinesEventListener { private final String TAG = this.getClass().getSimpleName(); - protected ArticleList m_articles = new ArticleList(); + @State protected ArticleList m_articles = new ArticleList(); protected SharedPreferences m_prefs; private Article m_activeArticle; @@ -38,7 +40,7 @@ public class DetailActivity extends OnlineActivity implements HeadlinesEventList setContentView(R.layout.activity_detail); - Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); m_forceDisableActionMode = isPortrait() || isSmallScreen(); @@ -54,9 +56,7 @@ public class DetailActivity extends OnlineActivity implements HeadlinesEventList findViewById(R.id.headlines_fragment).setVisibility(View.GONE); } - if (savedInstanceState != null) { - m_articles = savedInstanceState.getParcelable("articles"); - } else { + if (savedInstanceState == null) { Intent i = getIntent(); if (i.getExtras() != null) { @@ -126,8 +126,6 @@ public class DetailActivity extends OnlineActivity implements HeadlinesEventList @Override protected void refresh() { super.refresh(); - - } @Override @@ -143,8 +141,6 @@ public class DetailActivity extends OnlineActivity implements HeadlinesEventList public void onSaveInstanceState(Bundle out) { super.onSaveInstanceState(out); - out.putParcelable("articles", m_articles); - Application.getInstance().save(out); } diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/GalleryActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/GalleryActivity.java index 646e52e5..3b9e122e 100644..100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/GalleryActivity.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/GalleryActivity.java @@ -1,34 +1,26 @@ package org.fox.ttrss; -import android.content.Context; import android.graphics.Bitmap; -import android.media.MediaPlayer; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; -import android.os.Parcel; import android.preference.PreferenceManager; import android.support.v4.app.ActivityCompat; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentStatePagerAdapter; -import android.support.v4.app.LoaderManager; -import android.support.v4.content.AsyncTaskLoader; -import android.support.v4.content.Loader; import android.support.v4.view.ViewPager; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; -import android.widget.Gallery; import android.widget.PopupMenu; import android.widget.ProgressBar; import com.ToxicBakery.viewpager.transforms.DepthPageTransformer; import com.bumptech.glide.Glide; import com.bumptech.glide.load.engine.DiskCacheStrategy; -import com.google.gson.JsonElement; import org.fox.ttrss.types.GalleryEntry; import org.jsoup.Jsoup; @@ -36,20 +28,20 @@ import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; -import java.io.Serializable; import java.util.ArrayList; import java.util.List; import java.util.concurrent.ExecutionException; +import icepick.State; import me.relex.circleindicator.CircleIndicator; public class GalleryActivity extends CommonActivity { private final String TAG = this.getClass().getSimpleName(); - private ArrayList<GalleryEntry> m_items = new ArrayList<>(); - private String m_title; + @State protected ArrayList<GalleryEntry> m_items = new ArrayList<>(); + @State protected String m_title; private ArticleImagesPagerAdapter m_adapter; - public String m_content; + @State public String m_content; private ViewPager m_pager; private ProgressBar m_checkProgress; @@ -173,7 +165,7 @@ public class GalleryActivity extends CommonActivity { setContentView(R.layout.activity_gallery); - Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); //m_progress = (ProgressBar) findViewById(R.id.gallery_check_progress); @@ -185,7 +177,6 @@ public class GalleryActivity extends CommonActivity { if (savedInstanceState == null) { m_title = getIntent().getStringExtra("title"); - //m_urls = getIntent().getStringArrayListExtra("urls"); m_content = getIntent().getStringExtra("content"); String imgSrcFirst = getIntent().getStringExtra("firstSrc"); @@ -195,8 +186,6 @@ public class GalleryActivity extends CommonActivity { boolean firstFound = false; - ArrayList<GalleryEntry> tmp = new ArrayList<>(); - for (Element elem : elems) { GalleryEntry item = new GalleryEntry(); @@ -254,11 +243,6 @@ public class GalleryActivity extends CommonActivity { uncheckedItems.add(item); } } - - } else { - m_items = (ArrayList<GalleryEntry>) savedInstanceState.getSerializable("items"); - m_title = savedInstanceState.getString("title"); - m_content = savedInstanceState.getString("content"); } findViewById(R.id.gallery_overflow).setOnClickListener(new View.OnClickListener() { @@ -286,15 +270,15 @@ public class GalleryActivity extends CommonActivity { m_adapter = new ArticleImagesPagerAdapter(getSupportFragmentManager(), m_items); - m_pager = (ViewPager) findViewById(R.id.gallery_pager); + m_pager = findViewById(R.id.gallery_pager); m_pager.setAdapter(m_adapter); m_pager.setPageTransformer(true, new DepthPageTransformer()); - CircleIndicator indicator = (CircleIndicator) findViewById(R.id.gallery_pager_indicator); + CircleIndicator indicator = findViewById(R.id.gallery_pager_indicator); indicator.setViewPager(m_pager); m_adapter.registerDataSetObserver(indicator.getDataSetObserver()); - m_checkProgress = (ProgressBar) findViewById(R.id.gallery_check_progress); + m_checkProgress = findViewById(R.id.gallery_check_progress); Log.d(TAG, "items to check:" + uncheckedItems.size()); @@ -325,16 +309,6 @@ public class GalleryActivity extends CommonActivity { } - - @Override - public void onSaveInstanceState(Bundle out) { - super.onSaveInstanceState(out); - - out.putSerializable("items", m_items); - out.putString("title", m_title); - out.putString("content", m_content); - } - @Override public boolean onContextItemSelected(MenuItem item) { int position = m_pager.getCurrentItem(); diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/MasterActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/MasterActivity.java index 0dd714b0..cb332e95 100644..100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/MasterActivity.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/MasterActivity.java @@ -7,7 +7,6 @@ import android.app.Dialog; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; -import android.os.AsyncTask; import android.os.Bundle; import android.os.Handler; import android.preference.PreferenceManager; @@ -21,7 +20,6 @@ import android.view.Gravity; import android.view.MenuItem; import android.view.View; -import com.bumptech.glide.Glide; import com.google.gson.JsonElement; import org.fox.ttrss.types.Article; @@ -33,6 +31,8 @@ import org.fox.ttrss.widget.SmallWidgetProvider; import java.util.Date; import java.util.HashMap; +import icepick.State; + public class MasterActivity extends OnlineActivity implements HeadlinesEventListener { private final String TAG = this.getClass().getSimpleName(); @@ -42,8 +42,8 @@ public class MasterActivity extends OnlineActivity implements HeadlinesEventList protected long m_lastRefresh = 0; protected long m_lastWidgetRefresh = 0; - private boolean m_feedIsSelected = false; - private boolean m_userFeedSelected = false; + @State protected boolean m_feedIsSelected = false; + @State protected boolean m_userFeedSelected = false; private ActionBarDrawerToggle m_drawerToggle; private DrawerLayout m_drawerLayout; @@ -62,14 +62,14 @@ public class MasterActivity extends OnlineActivity implements HeadlinesEventList setSmallScreen(findViewById(R.id.sw600dp_anchor) == null); - Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); Application.getInstance().load(savedInstanceState); m_lastWidgetRefresh = new Date().getTime(); - m_drawerLayout = (DrawerLayout) findViewById(R.id.headlines_drawer); + m_drawerLayout = findViewById(R.id.headlines_drawer); if (m_drawerLayout != null) { @@ -177,22 +177,11 @@ public class MasterActivity extends OnlineActivity implements HeadlinesEventList checkTrial(true); } else { // savedInstanceState != null - //m_actionbarUpEnabled = savedInstanceState.getBoolean("actionbarUpEnabled"); - //m_actionbarRevertDepth = savedInstanceState.getInt("actionbarRevertDepth"); - m_feedIsSelected = savedInstanceState.getBoolean("feedIsSelected"); - m_userFeedSelected = savedInstanceState.getBoolean("userFeedSelected"); - //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_drawerLayout != null && m_feedIsSelected == false) { + + if (m_drawerLayout != null && !m_feedIsSelected) { m_drawerLayout.openDrawer(Gravity.START); } - } - } protected void onPostCreate(Bundle savedInstanceState) { @@ -427,9 +416,6 @@ public class MasterActivity extends OnlineActivity implements HeadlinesEventList @Override public void onSaveInstanceState(Bundle out) { super.onSaveInstanceState(out); - - out.putBoolean("feedIsSelected", m_feedIsSelected); - out.putBoolean("userFeedSelected", m_userFeedSelected); Application.getInstance().save(out); } diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/OnlineActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/OnlineActivity.java index 8503bf9a..fd22ce10 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/OnlineActivity.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/OnlineActivity.java @@ -3,7 +3,6 @@ package org.fox.ttrss; import android.annotation.TargetApi; import android.app.AlertDialog; import android.app.Dialog; -import android.app.NotificationManager; import android.content.ActivityNotFoundException; import android.content.BroadcastReceiver; import android.content.Context; @@ -15,13 +14,9 @@ import android.content.IntentFilter; import android.content.SharedPreferences; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; -import android.media.Image; import android.net.Uri; import android.os.Bundle; -import android.os.Handler; import android.preference.PreferenceManager; -import android.support.design.widget.Snackbar; -import android.support.v4.app.DialogFragment; import android.support.v7.view.ActionMode; import android.support.v7.widget.Toolbar; import android.util.Log; @@ -29,7 +24,6 @@ import android.view.KeyEvent; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; -import android.view.View; import android.widget.EditText; import android.widget.TextView; @@ -150,7 +144,7 @@ public class OnlineActivity extends CommonActivity { setContentView(R.layout.activity_login); - Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); Intent intent = getIntent(); @@ -1019,7 +1013,7 @@ public class OnlineActivity extends CommonActivity { } private void setLoadingStatus(String status) { - TextView tv = (TextView) findViewById(R.id.loading_message); + TextView tv = findViewById(R.id.loading_message); if (tv != null) { tv.setText(status); @@ -1064,11 +1058,6 @@ public class OnlineActivity extends CommonActivity { } @Override - public void onSaveInstanceState(Bundle out) { - super.onSaveInstanceState(out); - } - - @Override public void onResume() { super.onResume(); diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/YoutubePlayerActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/YoutubePlayerActivity.java index d8a287d1..aafaaffc 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/YoutubePlayerActivity.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/YoutubePlayerActivity.java @@ -14,14 +14,16 @@ import com.google.android.youtube.player.YouTubeInitializationResult; import com.google.android.youtube.player.YouTubePlayer; import com.google.android.youtube.player.YouTubePlayerSupportFragment; +import icepick.State; + public class YoutubePlayerActivity extends CommonActivity implements YouTubePlayer.OnInitializedListener { private final String TAG = this.getClass().getSimpleName(); private static final String DEVELOPER_KEY = "AIzaSyD8BS4Uj21jg_gHZfP4v0VXrAWiwqd05nk"; - private String m_streamUri; - private String m_videoId; + @State private String m_streamUri; + @State private String m_videoId; @Override public void onCreate(Bundle savedInstanceState) { @@ -31,7 +33,7 @@ public class YoutubePlayerActivity extends CommonActivity implements YouTubePlay super.onCreate(savedInstanceState); setContentView(R.layout.activity_youtube_player); - Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); @@ -44,9 +46,6 @@ public class YoutubePlayerActivity extends CommonActivity implements YouTubePlay if (savedInstanceState == null) { m_streamUri = getIntent().getStringExtra("streamUri"); m_videoId = getIntent().getStringExtra("vid"); - } else { - m_streamUri = savedInstanceState.getString("streamUri"); - m_videoId = savedInstanceState.getString("vid"); } YouTubePlayerSupportFragment frag = (YouTubePlayerSupportFragment) getSupportFragmentManager().findFragmentById(R.id.fragment_youtube_player); @@ -63,15 +62,6 @@ public class YoutubePlayerActivity extends CommonActivity implements YouTubePlay } @Override - public void onSaveInstanceState(Bundle out) { - super.onSaveInstanceState(out); - - out.putString("streamUri", m_streamUri); - out.putString("vid", m_videoId); - } - - - @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_youtube_player, menu); return true; diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/share/CommonShareActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/share/CommonShareActivity.java index 1bff11a2..b6a989b1 100644..100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/share/CommonShareActivity.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/share/CommonShareActivity.java @@ -16,11 +16,13 @@ import org.fox.ttrss.PreferencesActivity; import org.fox.ttrss.R; import org.fox.ttrss.util.SimpleLoginManager; +import icepick.State; + public abstract class CommonShareActivity extends CommonActivity { protected SharedPreferences m_prefs; - protected String m_sessionId; - protected int m_apiLevel = 0; + @State protected String m_sessionId; + @State protected int m_apiLevel = 0; private final String TAG = this.getClass().getSimpleName(); @@ -30,19 +32,6 @@ public abstract class CommonShareActivity extends CommonActivity { .getDefaultSharedPreferences(getApplicationContext()); super.onCreate(savedInstanceState); - - if (savedInstanceState != null) { - m_sessionId = savedInstanceState.getString("sessionId"); - m_apiLevel = savedInstanceState.getInt("apiLevel"); - } - } - - @Override - public void onSaveInstanceState(Bundle out) { - super.onSaveInstanceState(out); - - out.putString("sessionId", m_sessionId); - out.putInt("apiLevel", m_apiLevel); } protected abstract void onLoggedIn(int requestId); |