Refactored downloadIndex to fragment
This commit is contained in:
parent
d3a7ab2368
commit
9b6b51579f
17 changed files with 162 additions and 177 deletions
|
@ -132,7 +132,6 @@
|
||||||
<activity android:name="net.osmand.access.SettingsAccessibilityActivity" android:configChanges="keyboardHidden|orientation" />
|
<activity android:name="net.osmand.access.SettingsAccessibilityActivity" android:configChanges="keyboardHidden|orientation" />
|
||||||
|
|
||||||
<activity android:name="net.osmand.plus.activities.search.SearchActivity" android:label="@string/search_activity" />
|
<activity android:name="net.osmand.plus.activities.search.SearchActivity" android:label="@string/search_activity" />
|
||||||
<activity android:name="net.osmand.plus.activities.DownloadIndexActivity" android:configChanges="keyboardHidden|orientation" android:label="@string/local_index_download" />
|
|
||||||
<activity android:name="net.osmand.plus.activities.ShowRouteInfoActivity" android:label="@string/show_route" />
|
<activity android:name="net.osmand.plus.activities.ShowRouteInfoActivity" android:label="@string/show_route" />
|
||||||
<activity android:name="net.osmand.plus.activities.FavouritesListActivity" android:label="@string/favourites_list_activity" />
|
<activity android:name="net.osmand.plus.activities.FavouritesListActivity" android:label="@string/favourites_list_activity" />
|
||||||
<activity android:name="net.osmand.plus.activities.FavouritesActivity" android:windowSoftInputMode="adjustPan" />
|
<activity android:name="net.osmand.plus.activities.FavouritesActivity" android:windowSoftInputMode="adjustPan" />
|
||||||
|
|
|
@ -10,12 +10,8 @@ import net.osmand.IProgress;
|
||||||
import net.osmand.IndexConstants;
|
import net.osmand.IndexConstants;
|
||||||
import net.osmand.Location;
|
import net.osmand.Location;
|
||||||
import net.osmand.data.LocationPoint;
|
import net.osmand.data.LocationPoint;
|
||||||
import net.osmand.plus.activities.DownloadIndexActivity;
|
import net.osmand.plus.activities.*;
|
||||||
import net.osmand.plus.activities.FavouritesActivity;
|
import net.osmand.plus.activities.DownloadIndexFragment;
|
||||||
import net.osmand.plus.activities.MainMenuActivity;
|
|
||||||
import net.osmand.plus.activities.MapActivity;
|
|
||||||
import net.osmand.plus.activities.PluginsActivity;
|
|
||||||
import net.osmand.plus.activities.SettingsActivity;
|
|
||||||
import net.osmand.plus.activities.search.SearchActivity;
|
import net.osmand.plus.activities.search.SearchActivity;
|
||||||
import net.osmand.plus.download.DownloadActivity;
|
import net.osmand.plus.download.DownloadActivity;
|
||||||
import net.osmand.plus.download.DownloadActivityType;
|
import net.osmand.plus.download.DownloadActivityType;
|
||||||
|
@ -79,14 +75,14 @@ public class OsmAndAppCustomization {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Class<? extends Activity> getDownloadIndexActivity() {
|
public Class<? extends Activity> getDownloadIndexActivity() {
|
||||||
return DownloadIndexActivity.class;
|
return DownloadActivity.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Class<? extends Activity> getPluginsActivity() {
|
public Class<? extends Activity> getPluginsActivity() {
|
||||||
return PluginsActivity.class;
|
return PluginsActivity.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Class<? extends Activity> getLocalIndexActivity() {
|
public Class<? extends Activity> getDownloadActivity() {
|
||||||
return DownloadActivity.class;
|
return DownloadActivity.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +111,7 @@ public class OsmAndAppCustomization {
|
||||||
return "http://"+IndexConstants.INDEX_DOWNLOAD_DOMAIN+"/get_indexes?gzip&" + Version.getVersionAsURLParam(app); //$NON-NLS-1$;
|
return "http://"+IndexConstants.INDEX_DOWNLOAD_DOMAIN+"/get_indexes?gzip&" + Version.getVersionAsURLParam(app); //$NON-NLS-1$;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void preDownloadActivity(final DownloadIndexActivity da, final List<DownloadActivityType> downloadTypes, ActionBar actionBar ) {
|
public void preDownloadActivity(final DownloadIndexFragment da, final List<DownloadActivityType> downloadTypes, ActionBar actionBar ) {
|
||||||
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
|
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
|
||||||
ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<String>(actionBar.getThemedContext(), R.layout.sherlock_spinner_item,
|
ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<String>(actionBar.getThemedContext(), R.layout.sherlock_spinner_item,
|
||||||
toString(downloadTypes)
|
toString(downloadTypes)
|
||||||
|
|
|
@ -18,11 +18,8 @@ import net.osmand.access.AccessibilityPlugin;
|
||||||
import net.osmand.access.AccessibleAlertBuilder;
|
import net.osmand.access.AccessibleAlertBuilder;
|
||||||
import net.osmand.access.AccessibleToast;
|
import net.osmand.access.AccessibleToast;
|
||||||
import net.osmand.plus.access.AccessibilityMode;
|
import net.osmand.plus.access.AccessibilityMode;
|
||||||
import net.osmand.plus.activities.DayNightHelper;
|
import net.osmand.plus.activities.*;
|
||||||
import net.osmand.plus.activities.DownloadIndexActivity;
|
import net.osmand.plus.activities.DownloadIndexFragment;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
|
||||||
import net.osmand.plus.activities.SavingTrackHelper;
|
|
||||||
import net.osmand.plus.activities.SettingsActivity;
|
|
||||||
import net.osmand.plus.api.SQLiteAPI;
|
import net.osmand.plus.api.SQLiteAPI;
|
||||||
import net.osmand.plus.api.SQLiteAPIImpl;
|
import net.osmand.plus.api.SQLiteAPIImpl;
|
||||||
import net.osmand.plus.helpers.WaypointHelper;
|
import net.osmand.plus.helpers.WaypointHelper;
|
||||||
|
@ -114,7 +111,7 @@ public class OsmandApplication extends Application {
|
||||||
BRouterServiceConnection bRouterServiceConnection;
|
BRouterServiceConnection bRouterServiceConnection;
|
||||||
|
|
||||||
MapActivity mapActivity;
|
MapActivity mapActivity;
|
||||||
DownloadIndexActivity downloadActivity;
|
DownloadIndexFragment downloadActivity;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
|
@ -882,11 +879,11 @@ public class OsmandApplication extends Application {
|
||||||
this.mapActivity = mapActivity;
|
this.mapActivity = mapActivity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDownloadActivity(DownloadIndexActivity downloadActivity) {
|
public void setDownloadActivity(DownloadIndexFragment downloadActivity) {
|
||||||
this.downloadActivity = downloadActivity;
|
this.downloadActivity = downloadActivity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DownloadIndexActivity getDownloadActivity() {
|
public DownloadIndexFragment getDownloadActivity() {
|
||||||
return downloadActivity;
|
return downloadActivity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,10 @@ import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.*;
|
||||||
|
import com.actionbarsherlock.view.MenuInflater;
|
||||||
import net.osmand.IndexConstants;
|
import net.osmand.IndexConstants;
|
||||||
import net.osmand.access.AccessibleAlertBuilder;
|
import net.osmand.access.AccessibleAlertBuilder;
|
||||||
import net.osmand.access.AccessibleToast;
|
import net.osmand.access.AccessibleToast;
|
||||||
|
@ -21,12 +25,7 @@ import net.osmand.plus.Version;
|
||||||
import net.osmand.plus.activities.SettingsGeneralActivity.MoveFilesToDifferentDirectory;
|
import net.osmand.plus.activities.SettingsGeneralActivity.MoveFilesToDifferentDirectory;
|
||||||
import net.osmand.plus.base.BasicProgressAsyncTask;
|
import net.osmand.plus.base.BasicProgressAsyncTask;
|
||||||
import net.osmand.plus.base.SuggestExternalDirectoryDialog;
|
import net.osmand.plus.base.SuggestExternalDirectoryDialog;
|
||||||
import net.osmand.plus.download.DownloadActivityType;
|
import net.osmand.plus.download.*;
|
||||||
import net.osmand.plus.download.DownloadEntry;
|
|
||||||
import net.osmand.plus.download.DownloadIndexAdapter;
|
|
||||||
import net.osmand.plus.download.DownloadIndexesThread;
|
|
||||||
import net.osmand.plus.download.IndexItem;
|
|
||||||
import net.osmand.plus.download.IndexItemCategory;
|
|
||||||
import net.osmand.plus.srtmplugin.SRTMPlugin;
|
import net.osmand.plus.srtmplugin.SRTMPlugin;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.AlertDialog.Builder;
|
import android.app.AlertDialog.Builder;
|
||||||
|
@ -41,21 +40,12 @@ import android.os.Bundle;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.CheckBox;
|
|
||||||
import android.widget.EditText;
|
|
||||||
import android.widget.ExpandableListAdapter;
|
|
||||||
import android.widget.ExpandableListView;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.ProgressBar;
|
|
||||||
import android.widget.TextView;
|
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import com.actionbarsherlock.view.Menu;
|
import com.actionbarsherlock.view.Menu;
|
||||||
import com.actionbarsherlock.view.MenuItem;
|
import com.actionbarsherlock.view.MenuItem;
|
||||||
import com.actionbarsherlock.view.SubMenu;
|
import com.actionbarsherlock.view.SubMenu;
|
||||||
|
|
||||||
public class DownloadIndexActivity extends OsmandExpandableListActivity {
|
public class DownloadIndexFragment extends OsmandExpandableListFragment {
|
||||||
|
|
||||||
/** menus **/
|
/** menus **/
|
||||||
private static final int MORE_ID = 10;
|
private static final int MORE_ID = 10;
|
||||||
|
@ -83,23 +73,24 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
|
||||||
private TextView progressPercent;
|
private TextView progressPercent;
|
||||||
private ImageView cancel;
|
private ImageView cancel;
|
||||||
|
|
||||||
|
DownloadIndexAdapter listAdapter;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
final List<DownloadActivityType> downloadTypes = getDownloadTypes();
|
final List<DownloadActivityType> downloadTypes = getDownloadTypes();
|
||||||
type = downloadTypes.get(0);
|
type = downloadTypes.get(0);
|
||||||
settings = ((OsmandApplication) getApplication()).getSettings();
|
View view = inflater.inflate(R.layout.download_index, container, false);
|
||||||
if(downloadListIndexThread == null) {
|
ExpandableListView listView = (ExpandableListView)view.findViewById(android.R.id.list);
|
||||||
downloadListIndexThread = new DownloadIndexesThread(this);
|
List<IndexItem> list = new ArrayList<IndexItem>();
|
||||||
}
|
listAdapter = new DownloadIndexAdapter(this, list);
|
||||||
setContentView(R.layout.download_index);
|
listView.setAdapter(listAdapter);
|
||||||
indeterminateProgressBar = (ProgressBar) findViewById(R.id.IndeterminateProgressBar);
|
setListView(listView);
|
||||||
determinateProgressBar = (ProgressBar) findViewById(R.id.DeterminateProgressBar);
|
indeterminateProgressBar = (ProgressBar) view.findViewById(R.id.IndeterminateProgressBar);
|
||||||
progressView = findViewById(R.id.ProgressView);
|
determinateProgressBar = (ProgressBar) view.findViewById(R.id.DeterminateProgressBar);
|
||||||
progressMessage = (TextView) findViewById(R.id.ProgressMessage);
|
progressView = view.findViewById(R.id.ProgressView);
|
||||||
progressPercent = (TextView) findViewById(R.id.ProgressPercent);
|
progressMessage = (TextView) view.findViewById(R.id.ProgressMessage);
|
||||||
cancel = (ImageView) findViewById(R.id.Cancel);
|
progressPercent = (TextView) view.findViewById(R.id.ProgressPercent);
|
||||||
|
cancel = (ImageView) view.findViewById(R.id.Cancel);
|
||||||
int d = settings.isLightContent() ? R.drawable.a_1_navigation_cancel_small_light : R.drawable.a_1_navigation_cancel_small_dark;
|
int d = settings.isLightContent() ? R.drawable.a_1_navigation_cancel_small_light : R.drawable.a_1_navigation_cancel_small_dark;
|
||||||
cancel.setImageDrawable(getResources().getDrawable(d));
|
cancel.setImageDrawable(getResources().getDrawable(d));
|
||||||
cancel.setOnClickListener(new View.OnClickListener() {
|
cancel.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@ -109,9 +100,9 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
|
||||||
makeSureUserCancelDownload();
|
makeSureUserCancelDownload();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
getSupportActionBar().setTitle(R.string.local_index_download);
|
//getSupportActionBar().setTitle(R.string.local_index_download);
|
||||||
// recreation upon rotation is pgetaprevented in manifest file
|
// recreation upon rotation is pgetaprevented in manifest file
|
||||||
findViewById(R.id.DownloadButton).setOnClickListener(new View.OnClickListener(){
|
view.findViewById(R.id.DownloadButton).setOnClickListener(new View.OnClickListener(){
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -120,28 +111,28 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
filterText = (EditText) findViewById(R.id.search_box);
|
filterText = (EditText) view.findViewById(R.id.search_box);
|
||||||
textWatcher = new TextWatcher() {
|
textWatcher = new TextWatcher() {
|
||||||
@Override
|
@Override
|
||||||
public void afterTextChanged(Editable s) {
|
public void afterTextChanged(Editable s) {
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void beforeTextChanged(CharSequence s, int start, int count,
|
public void beforeTextChanged(CharSequence s, int start, int count,
|
||||||
int after) {
|
int after) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTextChanged(CharSequence s, int start, int before,
|
public void onTextChanged(CharSequence s, int start, int before,
|
||||||
int count) {
|
int count) {
|
||||||
DownloadIndexAdapter adapter = ((DownloadIndexAdapter)getExpandableListAdapter());
|
if(listAdapter != null){
|
||||||
if(adapter != null){
|
listAdapter.getFilter().filter(s);
|
||||||
adapter.getFilter().filter(s);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
filterText.addTextChangedListener(textWatcher);
|
filterText.addTextChangedListener(textWatcher);
|
||||||
final Intent intent = getIntent();
|
//final Intent intent = getIntent();
|
||||||
|
final Intent intent = null;
|
||||||
if (intent != null && intent.getExtras() != null) {
|
if (intent != null && intent.getExtras() != null) {
|
||||||
final String filter = intent.getExtras().getString(FILTER_KEY);
|
final String filter = intent.getExtras().getString(FILTER_KEY);
|
||||||
if (filter != null) {
|
if (filter != null) {
|
||||||
|
@ -157,19 +148,29 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<IndexItem> list = new ArrayList<IndexItem>();
|
getMyApplication().getAppCustomization().preDownloadActivity(this, downloadTypes, getMyActivity().getSupportActionBar());
|
||||||
|
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
settings = ((OsmandApplication) getMyApplication()).getSettings();
|
||||||
|
if(downloadListIndexThread == null) {
|
||||||
|
downloadListIndexThread = new DownloadIndexesThread(getActivity());
|
||||||
|
}
|
||||||
downloadListIndexThread.setUiActivity(this);
|
downloadListIndexThread.setUiActivity(this);
|
||||||
if (downloadListIndexThread.getCachedIndexFiles() != null && downloadListIndexThread.isDownloadedFromInternet()) {
|
if (downloadListIndexThread.getCachedIndexFiles() != null && downloadListIndexThread.isDownloadedFromInternet()) {
|
||||||
downloadListIndexThread.runCategorization(type);
|
downloadListIndexThread.runCategorization(type);
|
||||||
} else {
|
} else {
|
||||||
downloadListIndexThread.runReloadIndexFiles();
|
downloadListIndexThread.runReloadIndexFiles();
|
||||||
}
|
}
|
||||||
DownloadIndexAdapter adapter = new DownloadIndexAdapter(this, list);
|
|
||||||
setListAdapter(adapter);
|
|
||||||
if(getMyApplication().getResourceManager().getIndexFileNames().isEmpty()) {
|
if(getMyApplication().getResourceManager().getIndexFileNames().isEmpty()) {
|
||||||
boolean showedDialog = false;
|
boolean showedDialog = false;
|
||||||
if(Build.VERSION.SDK_INT < OsmandSettings.VERSION_DEFAULTLOCATION_CHANGED) {
|
if(Build.VERSION.SDK_INT < OsmandSettings.VERSION_DEFAULTLOCATION_CHANGED) {
|
||||||
SuggestExternalDirectoryDialog.showDialog(this, null, null);
|
SuggestExternalDirectoryDialog.showDialog(getActivity(), null, null);
|
||||||
}
|
}
|
||||||
if(!showedDialog) {
|
if(!showedDialog) {
|
||||||
showDialogOfFreeDownloadsIfNeeded();
|
showDialogOfFreeDownloadsIfNeeded();
|
||||||
|
@ -178,7 +179,7 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
|
||||||
showDialogOfFreeDownloadsIfNeeded();
|
showDialogOfFreeDownloadsIfNeeded();
|
||||||
}
|
}
|
||||||
|
|
||||||
getMyApplication().getAppCustomization().preDownloadActivity(this, downloadTypes, getSupportActionBar());
|
|
||||||
if (Build.VERSION.SDK_INT >= OsmandSettings.VERSION_DEFAULTLOCATION_CHANGED) {
|
if (Build.VERSION.SDK_INT >= OsmandSettings.VERSION_DEFAULTLOCATION_CHANGED) {
|
||||||
final String currentStorage = settings.getExternalStorageDirectory().getAbsolutePath();
|
final String currentStorage = settings.getExternalStorageDirectory().getAbsolutePath();
|
||||||
String primaryStorage = settings.getDefaultExternalStorageLocation();
|
String primaryStorage = settings.getDefaultExternalStorageLocation();
|
||||||
|
@ -197,7 +198,7 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
|
||||||
if (currentDirectoryNotWritable) {
|
if (currentDirectoryNotWritable) {
|
||||||
final String newLoc = settings.getMatchingExternalFilesDir(currentStorage);
|
final String newLoc = settings.getMatchingExternalFilesDir(currentStorage);
|
||||||
if (newLoc != null && newLoc.length() != 0) {
|
if (newLoc != null && newLoc.length() != 0) {
|
||||||
AccessibleAlertBuilder ab = new AccessibleAlertBuilder(this);
|
AccessibleAlertBuilder ab = new AccessibleAlertBuilder(getMyActivity());
|
||||||
ab.setMessage(getString(R.string.android_19_location_disabled,
|
ab.setMessage(getString(R.string.android_19_location_disabled,
|
||||||
settings.getExternalStorageDirectory()));
|
settings.getExternalStorageDirectory()));
|
||||||
ab.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener() {
|
ab.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener() {
|
||||||
|
@ -216,7 +217,7 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
|
||||||
|
|
||||||
private void copyFilesForAndroid19(final String newLoc) {
|
private void copyFilesForAndroid19(final String newLoc) {
|
||||||
MoveFilesToDifferentDirectory task =
|
MoveFilesToDifferentDirectory task =
|
||||||
new MoveFilesToDifferentDirectory(DownloadIndexActivity.this,
|
new MoveFilesToDifferentDirectory(getMyActivity(),
|
||||||
new File(settings.getExternalStorageDirectory(), IndexConstants.APP_DIR),
|
new File(settings.getExternalStorageDirectory(), IndexConstants.APP_DIR),
|
||||||
new File(newLoc, IndexConstants.APP_DIR)) {
|
new File(newLoc, IndexConstants.APP_DIR)) {
|
||||||
protected Boolean doInBackground(Void[] params) {
|
protected Boolean doInBackground(Void[] params) {
|
||||||
|
@ -233,13 +234,13 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
getMyApplication().setDownloadActivity(this);
|
getMyApplication().setDownloadActivity(this);
|
||||||
BasicProgressAsyncTask<?, ?, ?> t = downloadListIndexThread.getCurrentRunningTask();
|
BasicProgressAsyncTask<?, ?, ?> t = downloadListIndexThread.getCurrentRunningTask();
|
||||||
updateProgress(false);
|
updateProgress(false);
|
||||||
if(t instanceof DownloadIndexesThread.DownloadIndexesAsyncTask) {
|
if(t instanceof DownloadIndexesThread.DownloadIndexesAsyncTask) {
|
||||||
View mainView = findViewById(R.id.MainLayout);
|
View mainView = getView().findViewById(R.id.MainLayout);
|
||||||
if (mainView != null) {
|
if (mainView != null) {
|
||||||
mainView.setKeepScreenOn(true);
|
mainView.setKeepScreenOn(true);
|
||||||
}
|
}
|
||||||
|
@ -247,7 +248,7 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPause() {
|
public void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
getMyApplication().setDownloadActivity(null);
|
getMyApplication().setDownloadActivity(null);
|
||||||
}
|
}
|
||||||
|
@ -273,7 +274,7 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(count > 0){
|
if(count > 0){
|
||||||
Builder builder = new AlertDialog.Builder(this);
|
Builder builder = new AlertDialog.Builder(getMyActivity());
|
||||||
builder.setMessage(getString(R.string.download_additional_maps, s, sz));
|
builder.setMessage(getString(R.string.download_additional_maps, s, sz));
|
||||||
builder.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener() {
|
builder.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -303,7 +304,7 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
|
||||||
|
|
||||||
private void showDialogOfFreeDownloadsIfNeeded() {
|
private void showDialogOfFreeDownloadsIfNeeded() {
|
||||||
if (Version.isFreeVersion(getMyApplication())) {
|
if (Version.isFreeVersion(getMyApplication())) {
|
||||||
Builder msg = new AlertDialog.Builder(this);
|
Builder msg = new AlertDialog.Builder(getMyActivity());
|
||||||
msg.setTitle(R.string.free_version_title);
|
msg.setTitle(R.string.free_version_title);
|
||||||
String m = getString(R.string.free_version_message, MAXIMUM_AVAILABLE_FREE_DOWNLOADS + "", "") + "\n";
|
String m = getString(R.string.free_version_message, MAXIMUM_AVAILABLE_FREE_DOWNLOADS + "", "") + "\n";
|
||||||
m += getString(R.string.available_downloads_left, MAXIMUM_AVAILABLE_FREE_DOWNLOADS - settings.NUMBER_OF_FREE_DOWNLOADS.get());
|
m += getString(R.string.available_downloads_left, MAXIMUM_AVAILABLE_FREE_DOWNLOADS - settings.NUMBER_OF_FREE_DOWNLOADS.get());
|
||||||
|
@ -346,7 +347,7 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||||
if (getMyApplication().getAppCustomization().showDownloadExtraActions()) {
|
if (getMyApplication().getAppCustomization().showDownloadExtraActions()) {
|
||||||
SubMenu s = menu.addSubMenu(0, MORE_ID, 0, R.string.default_buttons_other_actions);
|
SubMenu s = menu.addSubMenu(0, MORE_ID, 0, R.string.default_buttons_other_actions);
|
||||||
s.add(0, RELOAD_ID, 0, R.string.update_downlod_list);
|
s.add(0, RELOAD_ID, 0, R.string.update_downlod_list);
|
||||||
|
@ -358,7 +359,6 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
|
||||||
: R.drawable.abs__ic_menu_moreoverflow_holo_dark);
|
: R.drawable.abs__ic_menu_moreoverflow_holo_dark);
|
||||||
s.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
s.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||||
}
|
}
|
||||||
return super.onCreateOptionsMenu(menu);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public DownloadActivityType getType() {
|
public DownloadActivityType getType() {
|
||||||
|
@ -378,16 +378,14 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
|
||||||
|
|
||||||
|
|
||||||
public void deselectAll() {
|
public void deselectAll() {
|
||||||
final DownloadIndexAdapter listAdapter = (DownloadIndexAdapter)getExpandableListAdapter();
|
|
||||||
downloadListIndexThread.getEntriesToDownload().clear();
|
downloadListIndexThread.getEntriesToDownload().clear();
|
||||||
listAdapter.notifyDataSetInvalidated();
|
listAdapter.notifyDataSetInvalidated();
|
||||||
|
|
||||||
findViewById(R.id.DownloadButton).setVisibility(View.GONE);
|
getView().findViewById(R.id.DownloadButton).setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void filterExisting() {
|
private void filterExisting() {
|
||||||
final DownloadIndexAdapter listAdapter = (DownloadIndexAdapter)getExpandableListAdapter();
|
|
||||||
final Map<String, String> listAlreadyDownloaded = downloadListIndexThread.getDownloadedIndexFileNames();
|
final Map<String, String> listAlreadyDownloaded = downloadListIndexThread.getDownloadedIndexFileNames();
|
||||||
|
|
||||||
final List<IndexItem> filtered = new ArrayList<IndexItem>();
|
final List<IndexItem> filtered = new ArrayList<IndexItem>();
|
||||||
|
@ -402,7 +400,6 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
|
||||||
|
|
||||||
|
|
||||||
private void selectAll() {
|
private void selectAll() {
|
||||||
final DownloadIndexAdapter listAdapter = (DownloadIndexAdapter)getExpandableListAdapter();
|
|
||||||
int selected = 0;
|
int selected = 0;
|
||||||
for (int j = 0; j < listAdapter.getGroupCount(); j++) {
|
for (int j = 0; j < listAdapter.getGroupCount(); j++) {
|
||||||
for (int i = 0; i < listAdapter.getChildrenCount(j); i++) {
|
for (int i = 0; i < listAdapter.getChildrenCount(j); i++) {
|
||||||
|
@ -413,7 +410,7 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AccessibleToast.makeText(this, MessageFormat.format(getString(R.string.items_were_selected), selected), Toast.LENGTH_SHORT).show();
|
AccessibleToast.makeText(getMyActivity(), MessageFormat.format(getString(R.string.items_were_selected), selected), Toast.LENGTH_SHORT).show();
|
||||||
listAdapter.notifyDataSetInvalidated();
|
listAdapter.notifyDataSetInvalidated();
|
||||||
if(selected > 0){
|
if(selected > 0){
|
||||||
updateDownloadButton(true);
|
updateDownloadButton(true);
|
||||||
|
@ -422,14 +419,15 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
|
||||||
|
|
||||||
|
|
||||||
public void updateDownloadButton(boolean scroll) {
|
public void updateDownloadButton(boolean scroll) {
|
||||||
int x = getListView().getScrollX();
|
View view = getView();
|
||||||
int y = getListView().getScrollY();
|
int x = getExpandableListView().getScrollX();
|
||||||
|
int y = getExpandableListView().getScrollY();
|
||||||
if (getEntriesToDownload().isEmpty()) {
|
if (getEntriesToDownload().isEmpty()) {
|
||||||
findViewById(R.id.DownloadButton).setVisibility(View.GONE);
|
view.findViewById(R.id.DownloadButton).setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
BasicProgressAsyncTask<?, ?, ?> task = downloadListIndexThread.getCurrentRunningTask();
|
BasicProgressAsyncTask<?, ?, ?> task = downloadListIndexThread.getCurrentRunningTask();
|
||||||
boolean running = task instanceof DownloadIndexesThread.DownloadIndexesAsyncTask;
|
boolean running = task instanceof DownloadIndexesThread.DownloadIndexesAsyncTask;
|
||||||
((Button) findViewById(R.id.DownloadButton)).setEnabled(!running);
|
((Button) view.findViewById(R.id.DownloadButton)).setEnabled(!running);
|
||||||
String text;
|
String text;
|
||||||
int downloads = downloadListIndexThread.getDownloads();
|
int downloads = downloadListIndexThread.getDownloads();
|
||||||
if (!running) {
|
if (!running) {
|
||||||
|
@ -437,7 +435,7 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
|
||||||
} else {
|
} else {
|
||||||
text = getString(R.string.downloading_file_new) + " (" + downloads + ")"; //$NON-NLS-1$
|
text = getString(R.string.downloading_file_new) + " (" + downloads + ")"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
findViewById(R.id.DownloadButton).setVisibility(View.VISIBLE);
|
view.findViewById(R.id.DownloadButton).setVisibility(View.VISIBLE);
|
||||||
if (Version.isFreeVersion(getMyApplication())) {
|
if (Version.isFreeVersion(getMyApplication())) {
|
||||||
int countedDownloads = downloadListIndexThread.getDownloads();
|
int countedDownloads = downloadListIndexThread.getDownloads();
|
||||||
int left = MAXIMUM_AVAILABLE_FREE_DOWNLOADS - settings.NUMBER_OF_FREE_DOWNLOADS.get() - downloads;
|
int left = MAXIMUM_AVAILABLE_FREE_DOWNLOADS - settings.NUMBER_OF_FREE_DOWNLOADS.get() - downloads;
|
||||||
|
@ -448,10 +446,10 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
|
||||||
text += " (" + (excessLimit ? "! " : "") + getString(R.string.files_limit, left).toLowerCase() + ")";
|
text += " (" + (excessLimit ? "! " : "") + getString(R.string.files_limit, left).toLowerCase() + ")";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
((Button) findViewById(R.id.DownloadButton)).setText(text);
|
((Button) view.findViewById(R.id.DownloadButton)).setText(text);
|
||||||
}
|
}
|
||||||
if (scroll) {
|
if (scroll) {
|
||||||
getListView().scrollTo(x, y);
|
getExpandableListView().scrollTo(x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -470,9 +468,8 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void changeType(final DownloadActivityType tp) {
|
public void changeType(final DownloadActivityType tp) {
|
||||||
invalidateOptionsMenu();
|
getMyActivity().invalidateOptionsMenu();
|
||||||
if (downloadListIndexThread != null && type != tp) {
|
if (downloadListIndexThread != null && type != tp) {
|
||||||
type = tp;
|
type = tp;
|
||||||
downloadListIndexThread.runCategorization(tp);
|
downloadListIndexThread.runCategorization(tp);
|
||||||
|
@ -480,16 +477,8 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public ExpandableListView getListView() {
|
|
||||||
return super.getExpandableListView();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ExpandableListAdapter getListAdapter() {
|
|
||||||
return super.getExpandableListAdapter();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void makeSureUserCancelDownload() {
|
private void makeSureUserCancelDownload() {
|
||||||
Builder bld = new AlertDialog.Builder(this);
|
Builder bld = new AlertDialog.Builder(getMyActivity());
|
||||||
bld.setTitle(getString(R.string.default_buttons_cancel));
|
bld.setTitle(getString(R.string.default_buttons_cancel));
|
||||||
bld.setMessage(R.string.confirm_interrupt_download);
|
bld.setMessage(R.string.confirm_interrupt_download);
|
||||||
bld.setPositiveButton(R.string.default_buttons_yes, new OnClickListener() {
|
bld.setPositiveButton(R.string.default_buttons_yes, new OnClickListener() {
|
||||||
|
@ -509,7 +498,7 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
|
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
|
||||||
final IndexItem e = (IndexItem) ((DownloadIndexAdapter)getListAdapter()).getChild(groupPosition, childPosition);
|
final IndexItem e = (IndexItem) listAdapter.getChild(groupPosition, childPosition);
|
||||||
final CheckBox ch = (CheckBox) v.findViewById(R.id.check_download_item);
|
final CheckBox ch = (CheckBox) v.findViewById(R.id.check_download_item);
|
||||||
|
|
||||||
if(ch.isChecked()){
|
if(ch.isChecked()){
|
||||||
|
@ -579,7 +568,7 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
|
||||||
}
|
}
|
||||||
if (total > MAXIMUM_AVAILABLE_FREE_DOWNLOADS || wiki) {
|
if (total > MAXIMUM_AVAILABLE_FREE_DOWNLOADS || wiki) {
|
||||||
String msgTx = getString(R.string.free_version_message, MAXIMUM_AVAILABLE_FREE_DOWNLOADS + "");
|
String msgTx = getString(R.string.free_version_message, MAXIMUM_AVAILABLE_FREE_DOWNLOADS + "");
|
||||||
Builder msg = new AlertDialog.Builder(this);
|
Builder msg = new AlertDialog.Builder(getMyActivity());
|
||||||
msg.setTitle(R.string.free_version_title);
|
msg.setTitle(R.string.free_version_title);
|
||||||
msg.setMessage(msgTx);
|
msg.setMessage(msgTx);
|
||||||
msg.setPositiveButton(R.string.default_buttons_ok, null);
|
msg.setPositiveButton(R.string.default_buttons_ok, null);
|
||||||
|
@ -595,7 +584,7 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
|
||||||
|
|
||||||
protected void downloadFilesCheckInternet() {
|
protected void downloadFilesCheckInternet() {
|
||||||
if(!getMyApplication().getSettings().isWifiConnected()) {
|
if(!getMyApplication().getSettings().isWifiConnected()) {
|
||||||
Builder builder = new AlertDialog.Builder(this);
|
Builder builder = new AlertDialog.Builder(getMyActivity());
|
||||||
builder.setMessage(getString(R.string.download_using_mobile_internet));
|
builder.setMessage(getString(R.string.download_using_mobile_internet));
|
||||||
builder.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener() {
|
builder.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -619,7 +608,7 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
|
||||||
// get availabile space
|
// get availabile space
|
||||||
double asz = downloadListIndexThread.getAvailableSpace();
|
double asz = downloadListIndexThread.getAvailableSpace();
|
||||||
if (asz != -1 && asz > 0 && sz / asz > 0.4) {
|
if (asz != -1 && asz > 0 && sz / asz > 0.4) {
|
||||||
Builder builder = new AlertDialog.Builder(this);
|
Builder builder = new AlertDialog.Builder(getMyActivity());
|
||||||
builder.setMessage(MessageFormat.format(getString(R.string.download_files_question_space), list.size(), sz, asz));
|
builder.setMessage(MessageFormat.format(getString(R.string.download_files_question_space), list.size(), sz, asz));
|
||||||
builder.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener() {
|
builder.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -635,23 +624,17 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
public void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
if (textWatcher != null) {
|
if (textWatcher != null) {
|
||||||
EditText filterText = (EditText) findViewById(R.id.search_box);
|
EditText filterText = (EditText) getView().findViewById(R.id.search_box);
|
||||||
filterText.removeTextChangedListener(textWatcher);
|
filterText.removeTextChangedListener(textWatcher);
|
||||||
}
|
}
|
||||||
downloadListIndexThread.setUiActivity(null);
|
downloadListIndexThread.setUiActivity(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void updateProgress(boolean updateOnlyProgress) {
|
public void updateProgress(boolean updateOnlyProgress) {
|
||||||
BasicProgressAsyncTask<?, ?, ?> basicProgressAsyncTask = downloadListIndexThread.getCurrentRunningTask();
|
BasicProgressAsyncTask<?, ?, ?> basicProgressAsyncTask = downloadListIndexThread.getCurrentRunningTask();
|
||||||
if(updateOnlyProgress) {
|
if(updateOnlyProgress) {
|
||||||
|
@ -678,4 +661,10 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
|
||||||
updateDownloadButton(false);
|
updateDownloadButton(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DownloadActivity getMyActivity(){ return (DownloadActivity)getActivity();}
|
||||||
|
|
||||||
|
public ExpandableListAdapter getExpandableListAdapter(){ return listAdapter;}
|
||||||
|
|
||||||
|
public View findViewById(int id){ return getView().findViewById(id);}
|
||||||
}
|
}
|
|
@ -130,7 +130,7 @@ public class FavouritesTreeFragment extends OsmandExpandableListFragment {
|
||||||
|
|
||||||
if(favouritesAdapter.getGroupCount() > 0 &&
|
if(favouritesAdapter.getGroupCount() > 0 &&
|
||||||
"".equals(favouritesAdapter.getGroup(0).name)) {
|
"".equals(favouritesAdapter.getGroup(0).name)) {
|
||||||
getListView().expandGroup(0);
|
getExpandableListView().expandGroup(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@ import net.osmand.plus.R;
|
||||||
import net.osmand.plus.Version;
|
import net.osmand.plus.Version;
|
||||||
import net.osmand.plus.activities.search.SearchActivity;
|
import net.osmand.plus.activities.search.SearchActivity;
|
||||||
import net.osmand.plus.render.MapRenderRepositories;
|
import net.osmand.plus.render.MapRenderRepositories;
|
||||||
import net.osmand.plus.sherpafy.SherpafyCustomization;
|
|
||||||
import net.osmand.plus.sherpafy.TourViewActivity;
|
import net.osmand.plus.sherpafy.TourViewActivity;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog.Builder;
|
import android.app.AlertDialog.Builder;
|
||||||
|
@ -376,7 +375,7 @@ public class MainMenuActivity extends Activity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
startActivity(new Intent(MainMenuActivity.this, DownloadIndexActivity.class));
|
startActivity(new Intent(MainMenuActivity.this, DownloadIndexFragment.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -62,13 +62,9 @@ public abstract class OsmandExpandableListFragment extends SherlockFragment impl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ExpandableListView getListView() {
|
public ExpandableListView getExpandableListView() { return listView; }
|
||||||
return listView;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ExpandableListView getExpandableListView() {
|
public void setListView(ExpandableListView listView) { this.listView = listView;}
|
||||||
return listView;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MenuItem createMenuItem(Menu m, int id, int titleRes, int iconLight, int iconDark, int menuItemType) {
|
public MenuItem createMenuItem(Menu m, int id, int titleRes, int iconLight, int iconDark, int menuItemType) {
|
||||||
int r = isLightActionBar() ? iconLight : iconDark;
|
int r = isLightActionBar() ? iconLight : iconDark;
|
||||||
|
|
|
@ -104,10 +104,10 @@ public class SelectedGPXFragment extends OsmandExpandableListFragment {
|
||||||
|
|
||||||
|
|
||||||
public void setContent() {
|
public void setContent() {
|
||||||
getListView().setFastScrollEnabled(true);
|
getExpandableListView().setFastScrollEnabled(true);
|
||||||
lightContent = app.getSettings().isLightContent();
|
lightContent = app.getSettings().isLightContent();
|
||||||
if (adapter == null) {
|
if (adapter == null) {
|
||||||
adapter = new SelectedGPXAdapter(getListView());
|
adapter = new SelectedGPXAdapter(getExpandableListView());
|
||||||
setAdapter(adapter);
|
setAdapter(adapter);
|
||||||
}
|
}
|
||||||
List<GpxDisplayGroup> groups = selectedGpxHelper.getDisplayGroups();
|
List<GpxDisplayGroup> groups = selectedGpxHelper.getDisplayGroups();
|
||||||
|
@ -131,7 +131,7 @@ public class SelectedGPXFragment extends OsmandExpandableListFragment {
|
||||||
adapter.setDisplayGroups(groups);
|
adapter.setDisplayGroups(groups);
|
||||||
if(isArgumentTrue(ARG_TO_EXPAND_TRACK_INFO)){
|
if(isArgumentTrue(ARG_TO_EXPAND_TRACK_INFO)){
|
||||||
for(int i = 0; i < groups.size(); i++) {
|
for(int i = 0; i < groups.size(); i++) {
|
||||||
getListView().expandGroup(i);
|
getExpandableListView().expandGroup(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,7 +101,7 @@ public class SettingsActivity extends SettingsBaseActivity {
|
||||||
if (empty) {
|
if (empty) {
|
||||||
startActivity(new Intent(this, getMyApplication().getAppCustomization().getDownloadIndexActivity()));
|
startActivity(new Intent(this, getMyApplication().getAppCustomization().getDownloadIndexActivity()));
|
||||||
} else {
|
} else {
|
||||||
startActivity(new Intent(this, getMyApplication().getAppCustomization().getLocalIndexActivity()));
|
startActivity(new Intent(this, getMyApplication().getAppCustomization().getDownloadActivity()));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else if (preference == bidforfix) {
|
} else if (preference == bidforfix) {
|
||||||
|
|
|
@ -372,8 +372,8 @@ public class SettingsGeneralActivity extends SettingsBaseActivity {
|
||||||
if (id.equals(settings.VOICE_PROVIDER.getId())) {
|
if (id.equals(settings.VOICE_PROVIDER.getId())) {
|
||||||
if (MORE_VALUE.equals(newValue)) {
|
if (MORE_VALUE.equals(newValue)) {
|
||||||
// listPref.set(oldValue); // revert the change..
|
// listPref.set(oldValue); // revert the change..
|
||||||
final Intent intent = new Intent(this, DownloadIndexActivity.class);
|
final Intent intent = new Intent(this, DownloadIndexFragment.class);
|
||||||
intent.putExtra(DownloadIndexActivity.FILTER_CAT, DownloadActivityType.VOICE_FILE.getTag());
|
intent.putExtra(DownloadIndexFragment.FILTER_CAT, DownloadActivityType.VOICE_FILE.getTag());
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
} else {
|
} else {
|
||||||
super.onPreferenceChange(preference, newValue);
|
super.onPreferenceChange(preference, newValue);
|
||||||
|
|
|
@ -7,6 +7,7 @@ import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.activities.DownloadIndexFragment;
|
||||||
import net.osmand.plus.activities.FavouritesActivity;
|
import net.osmand.plus.activities.FavouritesActivity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,6 +17,9 @@ public class DownloadActivity extends SherlockFragmentActivity {
|
||||||
|
|
||||||
private TabHost tabHost;
|
private TabHost tabHost;
|
||||||
private FavouritesActivity.TabsAdapter mTabsAdapter;
|
private FavouritesActivity.TabsAdapter mTabsAdapter;
|
||||||
|
public static DownloadIndexesThread downloadListIndexThread;
|
||||||
|
private DownloadActivityType type = DownloadActivityType.NORMAL_FILE;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -31,7 +35,20 @@ public class DownloadActivity extends SherlockFragmentActivity {
|
||||||
mTabsAdapter = new FavouritesActivity.TabsAdapter(this, tabHost, viewPager, settings);
|
mTabsAdapter = new FavouritesActivity.TabsAdapter(this, tabHost, viewPager, settings);
|
||||||
mTabsAdapter.addTab(tabHost.newTabSpec("LOCAL_INDEX").setIndicator("Local maps"),
|
mTabsAdapter.addTab(tabHost.newTabSpec("LOCAL_INDEX").setIndicator("Local maps"),
|
||||||
LocalIndexesFragment.class, null);
|
LocalIndexesFragment.class, null);
|
||||||
|
mTabsAdapter.addTab(tabHost.newTabSpec("DOWNLOADS").setIndicator("Downloads"),
|
||||||
|
DownloadIndexFragment.class, null);
|
||||||
tabHost.setCurrentTab(0);
|
tabHost.setCurrentTab(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DownloadActivityType getType() { return type;}
|
||||||
|
|
||||||
|
public void setType(DownloadActivityType type) { this.type = type;}
|
||||||
|
|
||||||
|
public void changeType(final DownloadActivityType tp) {
|
||||||
|
invalidateOptionsMenu();
|
||||||
|
if (downloadListIndexThread != null && type != tp) {
|
||||||
|
type = tp;
|
||||||
|
downloadListIndexThread.runCategorization(tp);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import java.util.Map;
|
||||||
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;
|
||||||
import net.osmand.plus.activities.DownloadIndexActivity;
|
import net.osmand.plus.activities.DownloadIndexFragment;
|
||||||
import net.osmand.plus.activities.OsmandBaseExpandableListAdapter;
|
import net.osmand.plus.activities.OsmandBaseExpandableListAdapter;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
|
@ -28,7 +28,7 @@ public class DownloadIndexAdapter extends OsmandBaseExpandableListAdapter implem
|
||||||
private DownloadIndexFilter myFilter;
|
private DownloadIndexFilter myFilter;
|
||||||
private final List<IndexItem> indexFiles;
|
private final List<IndexItem> indexFiles;
|
||||||
private final List<IndexItemCategory> list = new ArrayList<IndexItemCategory>();
|
private final List<IndexItemCategory> list = new ArrayList<IndexItemCategory>();
|
||||||
private DownloadIndexActivity downloadActivity;
|
private DownloadIndexFragment downloadActivity;
|
||||||
|
|
||||||
private Map<String, String> indexFileNames = null;
|
private Map<String, String> indexFileNames = null;
|
||||||
private Map<String, String> indexActivatedFileNames = null;
|
private Map<String, String> indexActivatedFileNames = null;
|
||||||
|
@ -38,7 +38,7 @@ public class DownloadIndexAdapter extends OsmandBaseExpandableListAdapter implem
|
||||||
private OsmandRegions osmandRegions;
|
private OsmandRegions osmandRegions;
|
||||||
private java.text.DateFormat format;
|
private java.text.DateFormat format;
|
||||||
|
|
||||||
public DownloadIndexAdapter(DownloadIndexActivity downloadActivity, List<IndexItem> indexFiles) {
|
public DownloadIndexAdapter(DownloadIndexFragment downloadActivity, List<IndexItem> indexFiles) {
|
||||||
this.downloadActivity = downloadActivity;
|
this.downloadActivity = downloadActivity;
|
||||||
this.indexFiles = new ArrayList<IndexItem>(indexFiles);
|
this.indexFiles = new ArrayList<IndexItem>(indexFiles);
|
||||||
List<IndexItemCategory> cats = IndexItemCategory.categorizeIndexItems(downloadActivity.getMyApplication(), indexFiles);
|
List<IndexItemCategory> cats = IndexItemCategory.categorizeIndexItems(downloadActivity.getMyApplication(), indexFiles);
|
||||||
|
@ -48,7 +48,7 @@ public class DownloadIndexAdapter extends OsmandBaseExpandableListAdapter implem
|
||||||
}
|
}
|
||||||
format = downloadActivity.getMyApplication().getResourceManager().getDateFormat();
|
format = downloadActivity.getMyApplication().getResourceManager().getDateFormat();
|
||||||
okColor = downloadActivity.getResources().getColor(R.color.color_ok);
|
okColor = downloadActivity.getResources().getColor(R.color.color_ok);
|
||||||
TypedArray ta = downloadActivity.getTheme().obtainStyledAttributes(new int[]{android.R.attr.textColorPrimary});
|
TypedArray ta = downloadActivity.getMyActivity().getTheme().obtainStyledAttributes(new int[]{android.R.attr.textColorPrimary});
|
||||||
defaultColor = ta.getColor(0, downloadActivity.getResources().getColor(R.color.color_unknown));
|
defaultColor = ta.getColor(0, downloadActivity.getResources().getColor(R.color.color_unknown));
|
||||||
ta.recycle();
|
ta.recycle();
|
||||||
updateColor = downloadActivity.getResources().getColor(R.color.color_update);
|
updateColor = downloadActivity.getResources().getColor(R.color.color_update);
|
||||||
|
@ -62,7 +62,7 @@ public class DownloadIndexAdapter extends OsmandBaseExpandableListAdapter implem
|
||||||
}
|
}
|
||||||
|
|
||||||
public void collapseTrees(final CharSequence constraint) {
|
public void collapseTrees(final CharSequence constraint) {
|
||||||
downloadActivity.runOnUiThread(new Runnable() {
|
downloadActivity.getMyActivity().runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
synchronized (DownloadIndexAdapter.this) {
|
synchronized (DownloadIndexAdapter.this) {
|
||||||
|
@ -125,7 +125,7 @@ public class DownloadIndexAdapter extends OsmandBaseExpandableListAdapter implem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<IndexItem> filter = new ArrayList<IndexItem>();
|
List<IndexItem> filter = new ArrayList<IndexItem>();
|
||||||
Context c = downloadActivity;
|
Context c = downloadActivity.getMyActivity();
|
||||||
for (IndexItem item : indexFiles) {
|
for (IndexItem item : indexFiles) {
|
||||||
boolean add = true;
|
boolean add = true;
|
||||||
String indexLC = osmandRegions.getDownloadNameIndexLowercase(item.getBasename());
|
String indexLC = osmandRegions.getDownloadNameIndexLowercase(item.getBasename());
|
||||||
|
@ -218,7 +218,7 @@ public class DownloadIndexAdapter extends OsmandBaseExpandableListAdapter implem
|
||||||
View v = convertView;
|
View v = convertView;
|
||||||
IndexItemCategory group = getGroup(groupPosition);
|
IndexItemCategory group = getGroup(groupPosition);
|
||||||
if (v == null) {
|
if (v == null) {
|
||||||
LayoutInflater inflater = downloadActivity.getLayoutInflater();
|
LayoutInflater inflater = (LayoutInflater) downloadActivity.getMyActivity().getSystemService( Context.LAYOUT_INFLATER_SERVICE );
|
||||||
v = inflater.inflate(net.osmand.plus.R.layout.expandable_list_item_category, parent, false);
|
v = inflater.inflate(net.osmand.plus.R.layout.expandable_list_item_category, parent, false);
|
||||||
}
|
}
|
||||||
final View row = v;
|
final View row = v;
|
||||||
|
@ -233,7 +233,7 @@ public class DownloadIndexAdapter extends OsmandBaseExpandableListAdapter implem
|
||||||
public View getChildView(final int groupPosition, final int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
|
public View getChildView(final int groupPosition, final int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
|
||||||
View v = convertView;
|
View v = convertView;
|
||||||
if (v == null) {
|
if (v == null) {
|
||||||
LayoutInflater inflater = downloadActivity.getLayoutInflater();
|
LayoutInflater inflater = (LayoutInflater) downloadActivity.getMyActivity().getSystemService( Context.LAYOUT_INFLATER_SERVICE );
|
||||||
v = inflater.inflate(net.osmand.plus.R.layout.download_index_list_item, parent, false);
|
v = inflater.inflate(net.osmand.plus.R.layout.download_index_list_item, parent, false);
|
||||||
}
|
}
|
||||||
final View row = v;
|
final View row = v;
|
||||||
|
@ -253,7 +253,7 @@ public class DownloadIndexAdapter extends OsmandBaseExpandableListAdapter implem
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
final CheckBox ch = (CheckBox) v.findViewById(R.id.check_download_item);
|
final CheckBox ch = (CheckBox) v.findViewById(R.id.check_download_item);
|
||||||
ch.setChecked(!ch.isChecked());
|
ch.setChecked(!ch.isChecked());
|
||||||
downloadActivity.onChildClick(downloadActivity.getListView(), row, groupPosition, childPosition, getChildId(groupPosition, childPosition));
|
downloadActivity.onChildClick(downloadActivity.getExpandableListView(), row, groupPosition, childPosition, getChildId(groupPosition, childPosition));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.OsmandSettings.OsmandPreference;
|
import net.osmand.plus.OsmandSettings.OsmandPreference;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.Version;
|
import net.osmand.plus.Version;
|
||||||
import net.osmand.plus.activities.DownloadIndexActivity;
|
import net.osmand.plus.activities.DownloadIndexFragment;
|
||||||
import net.osmand.plus.base.BasicProgressAsyncTask;
|
import net.osmand.plus.base.BasicProgressAsyncTask;
|
||||||
import net.osmand.plus.download.DownloadFileHelper.DownloadFileShowWarning;
|
import net.osmand.plus.download.DownloadFileHelper.DownloadFileShowWarning;
|
||||||
import net.osmand.plus.resources.ResourceManager;
|
import net.osmand.plus.resources.ResourceManager;
|
||||||
|
@ -47,7 +47,7 @@ import android.view.View;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
public class DownloadIndexesThread {
|
public class DownloadIndexesThread {
|
||||||
private DownloadIndexActivity uiActivity = null;
|
private DownloadIndexFragment uiActivity = null;
|
||||||
private IndexFileList indexFiles = null;
|
private IndexFileList indexFiles = null;
|
||||||
private Map<IndexItem, List<DownloadEntry>> entriesToDownload = new ConcurrentHashMap<IndexItem, List<DownloadEntry>>();
|
private Map<IndexItem, List<DownloadEntry>> entriesToDownload = new ConcurrentHashMap<IndexItem, List<DownloadEntry>>();
|
||||||
private Set<DownloadEntry> currentDownloads = new HashSet<DownloadEntry>();
|
private Set<DownloadEntry> currentDownloads = new HashSet<DownloadEntry>();
|
||||||
|
@ -72,7 +72,7 @@ public class DownloadIndexesThread {
|
||||||
indexFiles = null;
|
indexFiles = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUiActivity(DownloadIndexActivity uiActivity) {
|
public void setUiActivity(DownloadIndexFragment uiActivity) {
|
||||||
this.uiActivity = uiActivity;
|
this.uiActivity = uiActivity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,13 +92,13 @@ public class DownloadIndexesThread {
|
||||||
|
|
||||||
public void updateLoadedFiles() {
|
public void updateLoadedFiles() {
|
||||||
Map<String, String> indexActivatedFileNames = app.getResourceManager().getIndexFileNames();
|
Map<String, String> indexActivatedFileNames = app.getResourceManager().getIndexFileNames();
|
||||||
DownloadIndexActivity.listWithAlternatives(dateFormat, app.getAppPath(""), IndexConstants.EXTRA_EXT,
|
DownloadIndexFragment.listWithAlternatives(dateFormat, app.getAppPath(""), IndexConstants.EXTRA_EXT,
|
||||||
indexActivatedFileNames);
|
indexActivatedFileNames);
|
||||||
Map<String, String> indexFileNames = app.getResourceManager().getIndexFileNames();
|
Map<String, String> indexFileNames = app.getResourceManager().getIndexFileNames();
|
||||||
DownloadIndexActivity.listWithAlternatives(dateFormat, app.getAppPath(""), IndexConstants.EXTRA_EXT,
|
DownloadIndexFragment.listWithAlternatives(dateFormat, app.getAppPath(""), IndexConstants.EXTRA_EXT,
|
||||||
indexFileNames);
|
indexFileNames);
|
||||||
app.getAppCustomization().updatedLoadedFiles(indexFileNames, indexActivatedFileNames);
|
app.getAppCustomization().updatedLoadedFiles(indexFileNames, indexActivatedFileNames);
|
||||||
DownloadIndexActivity.listWithAlternatives(dateFormat, app.getAppPath(IndexConstants.TILES_INDEX_DIR),
|
DownloadIndexFragment.listWithAlternatives(dateFormat, app.getAppPath(IndexConstants.TILES_INDEX_DIR),
|
||||||
IndexConstants.SQLITE_EXT, indexFileNames);
|
IndexConstants.SQLITE_EXT, indexFileNames);
|
||||||
app.getResourceManager().getBackupIndexes(indexFileNames);
|
app.getResourceManager().getBackupIndexes(indexFileNames);
|
||||||
this.indexFileNames = indexFileNames;
|
this.indexFileNames = indexFileNames;
|
||||||
|
@ -230,7 +230,7 @@ public class DownloadIndexesThread {
|
||||||
break downloadCycle;
|
break downloadCycle;
|
||||||
}
|
}
|
||||||
if (exceedsFreelimit(entry)) {
|
if (exceedsFreelimit(entry)) {
|
||||||
breakDownloadMessage = app.getString(R.string.free_version_message, DownloadIndexActivity.MAXIMUM_AVAILABLE_FREE_DOWNLOADS
|
breakDownloadMessage = app.getString(R.string.free_version_message, DownloadIndexFragment.MAXIMUM_AVAILABLE_FREE_DOWNLOADS
|
||||||
+ "");
|
+ "");
|
||||||
break downloadCycle;
|
break downloadCycle;
|
||||||
}
|
}
|
||||||
|
@ -272,7 +272,7 @@ public class DownloadIndexesThread {
|
||||||
|
|
||||||
private boolean exceedsFreelimit(DownloadEntry entry) {
|
private boolean exceedsFreelimit(DownloadEntry entry) {
|
||||||
return Version.isFreeVersion(app) &&
|
return Version.isFreeVersion(app) &&
|
||||||
DownloadActivityType.isCountedInDownloads(entry.item.getType()) && downloads.get() >= DownloadIndexActivity.MAXIMUM_AVAILABLE_FREE_DOWNLOADS;
|
DownloadActivityType.isCountedInDownloads(entry.item.getType()) && downloads.get() >= DownloadIndexFragment.MAXIMUM_AVAILABLE_FREE_DOWNLOADS;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String reindexFiles(List<File> filesToReindex) {
|
private String reindexFiles(List<File> filesToReindex) {
|
||||||
|
@ -323,7 +323,7 @@ public class DownloadIndexesThread {
|
||||||
if (de.isAsset) {
|
if (de.isAsset) {
|
||||||
try {
|
try {
|
||||||
if (uiActivity != null) {
|
if (uiActivity != null) {
|
||||||
ResourceManager.copyAssets(uiActivity.getAssets(), de.assetName, de.targetFile);
|
ResourceManager.copyAssets(uiActivity.getMyActivity().getAssets(), de.assetName, de.targetFile);
|
||||||
boolean changedDate = de.targetFile.setLastModified(de.dateModified);
|
boolean changedDate = de.targetFile.setLastModified(de.dateModified);
|
||||||
if(!changedDate) {
|
if(!changedDate) {
|
||||||
log.error("Set last timestamp is not supported");
|
log.error("Set last timestamp is not supported");
|
||||||
|
@ -386,7 +386,7 @@ public class DownloadIndexesThread {
|
||||||
.createDownloadEntry(uiActivity.getMyApplication(), DownloadActivityType.NORMAL_FILE,
|
.createDownloadEntry(uiActivity.getMyApplication(), DownloadActivityType.NORMAL_FILE,
|
||||||
new ArrayList<DownloadEntry>());
|
new ArrayList<DownloadEntry>());
|
||||||
uiActivity.getEntriesToDownload().put(basemap, downloadEntry);
|
uiActivity.getEntriesToDownload().put(basemap, downloadEntry);
|
||||||
AccessibleToast.makeText(uiActivity, R.string.basemap_was_selected_to_download,
|
AccessibleToast.makeText(uiActivity.getMyActivity(), R.string.basemap_was_selected_to_download,
|
||||||
Toast.LENGTH_LONG).show();
|
Toast.LENGTH_LONG).show();
|
||||||
uiActivity.findViewById(R.id.DownloadButton).setVisibility(View.VISIBLE);
|
uiActivity.findViewById(R.id.DownloadButton).setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
@ -507,7 +507,7 @@ public class DownloadIndexesThread {
|
||||||
if ((type == DownloadActivityType.SRTM_COUNTRY_FILE || type == DownloadActivityType.HILLSHADE_FILE)
|
if ((type == DownloadActivityType.SRTM_COUNTRY_FILE || type == DownloadActivityType.HILLSHADE_FILE)
|
||||||
&& OsmandPlugin.getEnabledPlugin(SRTMPlugin.class) instanceof SRTMPlugin
|
&& OsmandPlugin.getEnabledPlugin(SRTMPlugin.class) instanceof SRTMPlugin
|
||||||
&& !OsmandPlugin.getEnabledPlugin(SRTMPlugin.class).isPaid()) {
|
&& !OsmandPlugin.getEnabledPlugin(SRTMPlugin.class).isPaid()) {
|
||||||
Builder msg = new AlertDialog.Builder(uiActivity);
|
Builder msg = new AlertDialog.Builder(uiActivity.getMyActivity());
|
||||||
msg.setTitle(R.string.srtm_paid_version_title);
|
msg.setTitle(R.string.srtm_paid_version_title);
|
||||||
msg.setMessage(R.string.srtm_paid_version_msg);
|
msg.setMessage(R.string.srtm_paid_version_msg);
|
||||||
msg.setNegativeButton(R.string.button_upgrade_osmandplus, new DialogInterface.OnClickListener() {
|
msg.setNegativeButton(R.string.button_upgrade_osmandplus, new DialogInterface.OnClickListener() {
|
||||||
|
|
|
@ -14,13 +14,10 @@ import com.actionbarsherlock.view.*;
|
||||||
import net.osmand.IProgress;
|
import net.osmand.IProgress;
|
||||||
import net.osmand.IndexConstants;
|
import net.osmand.IndexConstants;
|
||||||
import net.osmand.access.AccessibleToast;
|
import net.osmand.access.AccessibleToast;
|
||||||
import net.osmand.map.OsmandRegions;
|
|
||||||
import net.osmand.plus.*;
|
import net.osmand.plus.*;
|
||||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||||
import net.osmand.plus.activities.*;
|
import net.osmand.plus.activities.*;
|
||||||
import net.osmand.plus.activities.LocalIndexHelper.LocalIndexType;
|
import net.osmand.plus.activities.LocalIndexHelper.LocalIndexType;
|
||||||
import net.osmand.plus.download.DownloadActivity;
|
|
||||||
import net.osmand.plus.download.IndexItem;
|
|
||||||
import net.osmand.plus.helpers.FileNameTranslationHelper;
|
import net.osmand.plus.helpers.FileNameTranslationHelper;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
@ -32,12 +29,10 @@ import android.content.Intent;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.AsyncTask.Status;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.StatFs;
|
import android.os.StatFs;
|
||||||
import android.text.SpannableString;
|
import android.text.SpannableString;
|
||||||
import android.text.TextPaint;
|
import android.text.TextPaint;
|
||||||
import android.text.method.LinkMovementMethod;
|
|
||||||
import android.text.style.ClickableSpan;
|
import android.text.style.ClickableSpan;
|
||||||
import android.view.ContextMenu;
|
import android.view.ContextMenu;
|
||||||
import android.view.ContextMenu.ContextMenuInfo;
|
import android.view.ContextMenu.ContextMenuInfo;
|
||||||
|
@ -459,9 +454,6 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
||||||
localOptionsMenu(itemId);
|
localOptionsMenu(itemId);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
optionsMenuAdapter.item(R.string.local_index_download)
|
|
||||||
.icons(R.drawable.ic_action_gdown_dark, R.drawable.ic_action_gdown_light)
|
|
||||||
.listen(listener).position(0).reg();
|
|
||||||
optionsMenuAdapter.item(R.string.local_index_mi_reload)
|
optionsMenuAdapter.item(R.string.local_index_mi_reload)
|
||||||
.icons(R.drawable.ic_action_refresh_dark, R.drawable.ic_action_refresh_light)
|
.icons(R.drawable.ic_action_refresh_dark, R.drawable.ic_action_refresh_light)
|
||||||
.listen(listener).position(1).reg();
|
.listen(listener).position(1).reg();
|
||||||
|
@ -632,7 +624,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View widget) {
|
public void onClick(View widget) {
|
||||||
asyncLoader.setResult(null);
|
asyncLoader.setResult(null);
|
||||||
startActivity(new Intent(getMyActivity(), DownloadIndexActivity.class));
|
startActivity(new Intent(getMyActivity(), DownloadIndexFragment.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -650,7 +642,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
||||||
public void localOptionsMenu(final int itemId) {
|
public void localOptionsMenu(final int itemId) {
|
||||||
if (itemId == R.string.local_index_download) {
|
if (itemId == R.string.local_index_download) {
|
||||||
asyncLoader.setResult(null);
|
asyncLoader.setResult(null);
|
||||||
startActivity(new Intent(getMyActivity(), DownloadIndexActivity.class));
|
startActivity(new Intent(getMyActivity(), DownloadIndexFragment.class));
|
||||||
} else if (itemId == R.string.local_index_mi_reload) {
|
} else if (itemId == R.string.local_index_mi_reload) {
|
||||||
reloadIndexes();
|
reloadIndexes();
|
||||||
} else if (itemId == R.string.local_index_mi_delete) {
|
} else if (itemId == R.string.local_index_mi_delete) {
|
||||||
|
|
|
@ -31,13 +31,14 @@ import net.osmand.plus.TargetPointsHelper;
|
||||||
import net.osmand.plus.OsmandSettings.CommonPreference;
|
import net.osmand.plus.OsmandSettings.CommonPreference;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.Version;
|
import net.osmand.plus.Version;
|
||||||
import net.osmand.plus.activities.DownloadIndexActivity;
|
import net.osmand.plus.activities.DownloadIndexFragment;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.MapActivityLayers;
|
import net.osmand.plus.activities.MapActivityLayers;
|
||||||
import net.osmand.plus.activities.SelectedGPXFragment;
|
import net.osmand.plus.activities.SelectedGPXFragment;
|
||||||
import net.osmand.plus.activities.actions.ShareLocation;
|
import net.osmand.plus.activities.actions.ShareLocation;
|
||||||
import net.osmand.plus.api.FileSettingsAPIImpl;
|
import net.osmand.plus.api.FileSettingsAPIImpl;
|
||||||
import net.osmand.plus.api.SettingsAPI;
|
import net.osmand.plus.api.SettingsAPI;
|
||||||
|
import net.osmand.plus.download.DownloadActivity;
|
||||||
import net.osmand.plus.download.DownloadActivityType;
|
import net.osmand.plus.download.DownloadActivityType;
|
||||||
import net.osmand.plus.helpers.WaypointHelper;
|
import net.osmand.plus.helpers.WaypointHelper;
|
||||||
import net.osmand.plus.routing.RouteCalculationResult;
|
import net.osmand.plus.routing.RouteCalculationResult;
|
||||||
|
@ -60,7 +61,6 @@ import android.view.Window;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.actionbarsherlock.app.ActionBar;
|
import com.actionbarsherlock.app.ActionBar;
|
||||||
import com.actionbarsherlock.app.SherlockActivity;
|
|
||||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||||
|
|
||||||
public class SherpafyCustomization extends OsmAndAppCustomization {
|
public class SherpafyCustomization extends OsmAndAppCustomization {
|
||||||
|
@ -107,8 +107,8 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
|
||||||
|
|
||||||
public boolean setAccessCode(String acCode) {
|
public boolean setAccessCode(String acCode) {
|
||||||
acCode = acCode.toUpperCase();
|
acCode = acCode.toUpperCase();
|
||||||
if(DownloadIndexActivity.downloadListIndexThread != null) {
|
if(DownloadIndexFragment.downloadListIndexThread != null) {
|
||||||
DownloadIndexActivity.downloadListIndexThread.clear();
|
DownloadIndexFragment.downloadListIndexThread.clear();
|
||||||
}
|
}
|
||||||
if(validate(acCode) || Algorithms.isEmpty(acCode)) {
|
if(validate(acCode) || Algorithms.isEmpty(acCode)) {
|
||||||
accessCodePref.set(acCode);
|
accessCodePref.set(acCode);
|
||||||
|
@ -182,7 +182,7 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updatedLoadedFiles(java.util.Map<String,String> indexFileNames, java.util.Map<String,String> indexActivatedFileNames) {
|
public void updatedLoadedFiles(java.util.Map<String,String> indexFileNames, java.util.Map<String,String> indexActivatedFileNames) {
|
||||||
DownloadIndexActivity.listWithAlternatives(app.getResourceManager().getDateFormat(),
|
DownloadIndexFragment.listWithAlternatives(app.getResourceManager().getDateFormat(),
|
||||||
toursFolder, "", indexFileNames);
|
toursFolder, "", indexFileNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,7 +198,7 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
|
||||||
for(File tr : availableTours) {
|
for(File tr : availableTours) {
|
||||||
if (tr.isDirectory()) {
|
if (tr.isDirectory()) {
|
||||||
String date = app.getResourceManager().getDateFormat()
|
String date = app.getResourceManager().getDateFormat()
|
||||||
.format(new Date(DownloadIndexActivity.findFileInDir(tr).lastModified()));
|
.format(new Date(DownloadIndexFragment.findFileInDir(tr).lastModified()));
|
||||||
indexFileNames.put(tr.getName(), date);
|
indexFileNames.put(tr.getName(), date);
|
||||||
final TourInformation tourInformation = new TourInformation(tr);
|
final TourInformation tourInformation = new TourInformation(tr);
|
||||||
tourPresent.add(tourInformation);
|
tourPresent.add(tourInformation);
|
||||||
|
@ -229,7 +229,7 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
|
||||||
}
|
}
|
||||||
this.tourPresent = tourPresent;
|
this.tourPresent = tourPresent;
|
||||||
if(!suggestToDownloadMap.isEmpty()) {
|
if(!suggestToDownloadMap.isEmpty()) {
|
||||||
final DownloadIndexActivity da = app.getDownloadActivity();
|
final DownloadIndexFragment da = app.getDownloadActivity();
|
||||||
if (da != null) {
|
if (da != null) {
|
||||||
app.runInUIThread(new Runnable() {
|
app.runInUIThread(new Runnable() {
|
||||||
|
|
||||||
|
@ -612,7 +612,7 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void preDownloadActivity(final DownloadIndexActivity da, final List<DownloadActivityType> downloadTypes, ActionBar actionBar) {
|
public void preDownloadActivity(final DownloadActivity da, final List<DownloadActivityType> downloadTypes, ActionBar actionBar) {
|
||||||
actionBar.setTitle(TourDownloadType.TOUR.getString(da));
|
actionBar.setTitle(TourDownloadType.TOUR.getString(da));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import java.util.WeakHashMap;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.DownloadIndexActivity;
|
import net.osmand.plus.activities.DownloadIndexFragment;
|
||||||
import net.osmand.plus.sherpafy.TourInformation.StageFavorite;
|
import net.osmand.plus.sherpafy.TourInformation.StageFavorite;
|
||||||
import net.osmand.plus.sherpafy.TourInformation.StageInformation;
|
import net.osmand.plus.sherpafy.TourInformation.StageInformation;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
@ -376,7 +376,7 @@ public class TourViewActivity extends SherlockFragmentActivity {
|
||||||
|
|
||||||
|
|
||||||
public void startDownloadActivity() {
|
public void startDownloadActivity() {
|
||||||
final Intent download = new Intent(this, DownloadIndexActivity.class);
|
final Intent download = new Intent(this, DownloadIndexFragment.class);
|
||||||
download.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
download.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||||
refreshListAfterDownload = true;
|
refreshListAfterDownload = true;
|
||||||
startActivity(download);
|
startActivity(download);
|
||||||
|
|
|
@ -12,7 +12,7 @@ import net.osmand.binary.BinaryMapDataObject;
|
||||||
import net.osmand.data.RotatedTileBox;
|
import net.osmand.data.RotatedTileBox;
|
||||||
import net.osmand.map.OsmandRegions;
|
import net.osmand.map.OsmandRegions;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.DownloadIndexActivity;
|
import net.osmand.plus.activities.DownloadIndexFragment;
|
||||||
import net.osmand.plus.resources.ResourceManager;
|
import net.osmand.plus.resources.ResourceManager;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
import net.osmand.util.MapUtils;
|
import net.osmand.util.MapUtils;
|
||||||
|
@ -87,7 +87,7 @@ public class DownloadedRegionsLayer extends OsmandMapLayer {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
final Intent intent = new Intent(view.getContext(), view.getApplication().getAppCustomization().getDownloadIndexActivity());
|
final Intent intent = new Intent(view.getContext(), view.getApplication().getAppCustomization().getDownloadIndexActivity());
|
||||||
intent.putExtra(DownloadIndexActivity.FILTER_KEY, filter.toString());
|
intent.putExtra(DownloadIndexFragment.FILTER_KEY, filter.toString());
|
||||||
view.getContext().startActivity(intent);
|
view.getContext().startActivity(intent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue