Fixed null pointer on rotation. Hided action bar from download index in update index
This commit is contained in:
parent
49a7f0638d
commit
fc7df97e9d
3 changed files with 15 additions and 1 deletions
|
@ -268,6 +268,10 @@ public class DownloadActivity extends SherlockFragmentActivity {
|
||||||
|
|
||||||
public void updateProgress(boolean updateOnlyProgress) {
|
public void updateProgress(boolean updateOnlyProgress) {
|
||||||
BasicProgressAsyncTask<?, ?, ?> basicProgressAsyncTask = DownloadActivity.downloadListIndexThread.getCurrentRunningTask();
|
BasicProgressAsyncTask<?, ?, ?> basicProgressAsyncTask = DownloadActivity.downloadListIndexThread.getCurrentRunningTask();
|
||||||
|
//needed when rotation is performed and progress can be null
|
||||||
|
if (progressView == null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
if(updateOnlyProgress) {
|
if(updateOnlyProgress) {
|
||||||
if(!basicProgressAsyncTask.isIndeterminate()) {
|
if(!basicProgressAsyncTask.isIndeterminate()) {
|
||||||
progressPercent.setText(basicProgressAsyncTask.getProgressPercentage() +"%");
|
progressPercent.setText(basicProgressAsyncTask.getProgressPercentage() +"%");
|
||||||
|
|
|
@ -454,7 +454,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
||||||
@Override
|
@Override
|
||||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||||
ActionBar actionBar = getDownloadActivity().getSupportActionBar();
|
ActionBar actionBar = getDownloadActivity().getSupportActionBar();
|
||||||
//actionBar.removeAllTabs();
|
//hide action bar from downloadindexfragment
|
||||||
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
|
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
|
||||||
optionsMenuAdapter = new ContextMenuAdapter(getDownloadActivity());
|
optionsMenuAdapter = new ContextMenuAdapter(getDownloadActivity());
|
||||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||||
|
|
|
@ -6,7 +6,10 @@ import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.*;
|
import android.widget.*;
|
||||||
|
import com.actionbarsherlock.app.ActionBar;
|
||||||
import com.actionbarsherlock.app.SherlockListFragment;
|
import com.actionbarsherlock.app.SherlockListFragment;
|
||||||
|
import com.actionbarsherlock.view.Menu;
|
||||||
|
import com.actionbarsherlock.view.MenuInflater;
|
||||||
import net.osmand.map.OsmandRegions;
|
import net.osmand.map.OsmandRegions;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
@ -30,6 +33,7 @@ public class UpdatesIndexFragment extends SherlockListFragment {
|
||||||
format = getMyApplication().getResourceManager().getDateFormat();
|
format = getMyApplication().getResourceManager().getDateFormat();
|
||||||
osmandRegions = getMyApplication().getResourceManager().getOsmandRegions();
|
osmandRegions = getMyApplication().getResourceManager().getOsmandRegions();
|
||||||
setListAdapter(new UpdateIndexAdapter(getDownloadActivity(), R.layout.download_index_list_item, DownloadActivity.downloadListIndexThread.getItemsToUpdate()));
|
setListAdapter(new UpdateIndexAdapter(getDownloadActivity(), R.layout.download_index_list_item, DownloadActivity.downloadListIndexThread.getItemsToUpdate()));
|
||||||
|
setHasOptionsMenu(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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(); }
|
public OsmandApplication getMyApplication() { return getDownloadActivity().getMyApplication(); }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue