when paused, do not update widget more than once a minute (unless
finishing)
This commit is contained in:
parent
02810f6eee
commit
432228011c
@ -38,6 +38,7 @@ public class MasterActivity extends OnlineActivity implements HeadlinesEventList
|
|||||||
|
|
||||||
protected SharedPreferences m_prefs;
|
protected SharedPreferences m_prefs;
|
||||||
protected long m_lastRefresh = 0;
|
protected long m_lastRefresh = 0;
|
||||||
|
protected long m_lastWidgetRefresh = 0;
|
||||||
|
|
||||||
private boolean m_feedIsSelected = false;
|
private boolean m_feedIsSelected = false;
|
||||||
private boolean m_userFeedSelected = false;
|
private boolean m_userFeedSelected = false;
|
||||||
@ -64,6 +65,8 @@ public class MasterActivity extends OnlineActivity implements HeadlinesEventList
|
|||||||
|
|
||||||
Application.getInstance().load(savedInstanceState);
|
Application.getInstance().load(savedInstanceState);
|
||||||
|
|
||||||
|
m_lastWidgetRefresh = new Date().getTime();
|
||||||
|
|
||||||
m_drawerLayout = (DrawerLayout) findViewById(R.id.headlines_drawer);
|
m_drawerLayout = (DrawerLayout) findViewById(R.id.headlines_drawer);
|
||||||
|
|
||||||
if (m_drawerLayout != null) {
|
if (m_drawerLayout != null) {
|
||||||
@ -476,13 +479,20 @@ public class MasterActivity extends OnlineActivity implements HeadlinesEventList
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStop() {
|
public void onPause() {
|
||||||
super.onStop();
|
super.onPause();
|
||||||
|
|
||||||
|
Date date = new Date();
|
||||||
|
|
||||||
|
if (isFinishing() || date.getTime() - m_lastWidgetRefresh > 60*1000) {
|
||||||
|
m_lastWidgetRefresh = date.getTime();
|
||||||
|
|
||||||
Intent updateWidgetIntent = new Intent(SmallWidgetProvider.ACTION_REQUEST_UPDATE);
|
Intent updateWidgetIntent = new Intent(SmallWidgetProvider.ACTION_REQUEST_UPDATE);
|
||||||
sendBroadcast(updateWidgetIntent);
|
sendBroadcast(updateWidgetIntent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onArticleSelected(Article article) {
|
public void onArticleSelected(Article article) {
|
||||||
onArticleSelected(article, true);
|
onArticleSelected(article, true);
|
||||||
|
Loading…
Reference in New Issue
Block a user