From fc7df97e9d2bafb210fd408669dec91b946c5386 Mon Sep 17 00:00:00 2001 From: Denis Date: Fri, 12 Sep 2014 10:59:08 +0300 Subject: [PATCH] Fixed null pointer on rotation. Hided action bar from download index in update index --- .../src/net/osmand/plus/download/DownloadActivity.java | 4 ++++ .../net/osmand/plus/download/LocalIndexesFragment.java | 2 +- .../net/osmand/plus/download/UpdatesIndexFragment.java | 10 ++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java b/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java index e008f2ff6e..10252e8ceb 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java @@ -268,6 +268,10 @@ public class DownloadActivity extends SherlockFragmentActivity { public void updateProgress(boolean updateOnlyProgress) { BasicProgressAsyncTask basicProgressAsyncTask = DownloadActivity.downloadListIndexThread.getCurrentRunningTask(); + //needed when rotation is performed and progress can be null + if (progressView == null){ + return; + } if(updateOnlyProgress) { if(!basicProgressAsyncTask.isIndeterminate()) { progressPercent.setText(basicProgressAsyncTask.getProgressPercentage() +"%"); diff --git a/OsmAnd/src/net/osmand/plus/download/LocalIndexesFragment.java b/OsmAnd/src/net/osmand/plus/download/LocalIndexesFragment.java index 2ffe60693b..021481fc78 100644 --- a/OsmAnd/src/net/osmand/plus/download/LocalIndexesFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/LocalIndexesFragment.java @@ -454,7 +454,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment { @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { ActionBar actionBar = getDownloadActivity().getSupportActionBar(); - //actionBar.removeAllTabs(); + //hide action bar from downloadindexfragment actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); optionsMenuAdapter = new ContextMenuAdapter(getDownloadActivity()); OnContextMenuClick listener = new OnContextMenuClick() { diff --git a/OsmAnd/src/net/osmand/plus/download/UpdatesIndexFragment.java b/OsmAnd/src/net/osmand/plus/download/UpdatesIndexFragment.java index 92e4819879..8a0f0189d9 100644 --- a/OsmAnd/src/net/osmand/plus/download/UpdatesIndexFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/UpdatesIndexFragment.java @@ -6,7 +6,10 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.*; +import com.actionbarsherlock.app.ActionBar; import com.actionbarsherlock.app.SherlockListFragment; +import com.actionbarsherlock.view.Menu; +import com.actionbarsherlock.view.MenuInflater; import net.osmand.map.OsmandRegions; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; @@ -30,6 +33,7 @@ public class UpdatesIndexFragment extends SherlockListFragment { format = getMyApplication().getResourceManager().getDateFormat(); osmandRegions = getMyApplication().getResourceManager().getOsmandRegions(); setListAdapter(new UpdateIndexAdapter(getDownloadActivity(), R.layout.download_index_list_item, DownloadActivity.downloadListIndexThread.getItemsToUpdate())); + setHasOptionsMenu(true); } @Override @@ -111,5 +115,11 @@ public class UpdatesIndexFragment extends SherlockListFragment { } } + @Override + public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { + ActionBar actionBar = getDownloadActivity().getSupportActionBar(); + actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); + } + public OsmandApplication getMyApplication() { return getDownloadActivity().getMyApplication(); } }