Live updates in progress: draught of UI is done
This commit is contained in:
parent
86dc1fa95c
commit
415633d788
12 changed files with 243 additions and 46 deletions
|
@ -22,7 +22,6 @@
|
||||||
<android.support.v4.view.ViewPager
|
<android.support.v4.view.ViewPager
|
||||||
android:id="@+id/viewpager"
|
android:id="@+id/viewpager"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"/>
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
63
OsmAnd/res/layout/dialog_live_updates_item_settings.xml
Normal file
63
OsmAnd/res/layout/dialog_live_updates_item_settings.xml
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@color/dashboard_blue"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="16dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Flevoland"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="The Netherlands"/>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="@color/color_white"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Update: 4 Dec 2015, 14:41"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<GridLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_gravity="fill_horizontal"
|
||||||
|
android:text="Live update"/>
|
||||||
|
<Switch/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_gravity="fill_horizontal"
|
||||||
|
android:text="Only download over WiFi"
|
||||||
|
android:layout_row="2"
|
||||||
|
android:layout_column="0"/>
|
||||||
|
<Switch/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_gravity="fill_horizontal"
|
||||||
|
android:text="Live update"
|
||||||
|
android:layout_row="3"
|
||||||
|
android:layout_column="0"/>
|
||||||
|
<Spinner/>
|
||||||
|
</GridLayout>
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="@color/color_white"/>
|
||||||
|
</LinearLayout>
|
|
@ -1,12 +1,7 @@
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<ListView android:id="@android:id/list"
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
tools:context=".liveupdates.LiveUpdatesFragment">
|
tools:context=".liveupdates.LiveUpdatesFragment"/>
|
||||||
|
|
||||||
<ListView
|
|
||||||
android:id="@android:id/list"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"/>
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<merge
|
<LinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -141,4 +144,4 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Available maps"/>
|
android:text="Available maps"/>
|
||||||
|
|
||||||
</merge>
|
</LinearLayout>
|
|
@ -1,22 +1,34 @@
|
||||||
package net.osmand.plus.liveupdates;
|
package net.osmand.plus.liveupdates;
|
||||||
|
|
||||||
|
|
||||||
import android.content.Context;
|
import android.app.Dialog;
|
||||||
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
import android.support.v4.app.DialogFragment;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v4.app.FragmentManager;
|
||||||
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.ImageButton;
|
||||||
|
import android.widget.ImageView;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.activities.ActionBarProgressActivity;
|
||||||
|
import net.osmand.plus.activities.LocalIndexHelper;
|
||||||
|
import net.osmand.plus.activities.LocalIndexInfo;
|
||||||
|
import net.osmand.plus.activities.OsmandActionBarActivity;
|
||||||
|
import net.osmand.plus.download.ui.AbstractLoadLocalIndexTask;
|
||||||
|
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
|
||||||
* A simple {@link Fragment} subclass.
|
|
||||||
* Use the {@link LiveUpdatesFragment#newInstance} factory method to
|
|
||||||
* create an instance of this fragment.
|
|
||||||
*/
|
|
||||||
public class LiveUpdatesFragment extends Fragment {
|
public class LiveUpdatesFragment extends Fragment {
|
||||||
public static final String TITILE = "Live Updates";
|
public static final String TITILE = "Live Updates";
|
||||||
|
|
||||||
|
@ -32,13 +44,126 @@ public class LiveUpdatesFragment extends Fragment {
|
||||||
ListView listView = (ListView) view.findViewById(android.R.id.list);
|
ListView listView = (ListView) view.findViewById(android.R.id.list);
|
||||||
View header = inflater.inflate(R.layout.live_updates_header, listView, false);
|
View header = inflater.inflate(R.layout.live_updates_header, listView, false);
|
||||||
listView.addHeaderView(header);
|
listView.addHeaderView(header);
|
||||||
|
LiveUpdatesAdapter adapter = new LiveUpdatesAdapter(this);
|
||||||
|
listView.setAdapter(adapter);
|
||||||
|
new LoadLocalIndexTask(adapter, (ActionBarProgressActivity) getActivity()).execute();
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class LiveUpdatesAdapter extends ArrayAdapter<Object> {
|
private OsmandActionBarActivity getMyActivity() {
|
||||||
|
return (OsmandActionBarActivity) getActivity();
|
||||||
|
}
|
||||||
|
|
||||||
public LiveUpdatesAdapter(Context context, int resource, Object[] objects) {
|
private static class LiveUpdatesAdapter extends ArrayAdapter<LocalIndexInfo> {
|
||||||
super(context, resource, objects);
|
final LiveUpdatesFragment fragment;
|
||||||
|
public LiveUpdatesAdapter(LiveUpdatesFragment fragment) {
|
||||||
|
super(fragment.getActivity(), R.layout.local_index_list_item, R.id.nameTextView);
|
||||||
|
this.fragment = fragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
|
View view = convertView;
|
||||||
|
if (view == null) {
|
||||||
|
LayoutInflater inflater = LayoutInflater.from(getContext());
|
||||||
|
view = inflater.inflate(R.layout.local_index_list_item, parent, false);
|
||||||
|
view.setTag(new LocalFullMapsViewHolder(view, fragment));
|
||||||
|
}
|
||||||
|
LocalFullMapsViewHolder viewHolder = (LocalFullMapsViewHolder) view.getTag();
|
||||||
|
viewHolder.bindLocalIndexInfo(getItem(position));
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class LocalFullMapsViewHolder {
|
||||||
|
private final ImageView icon;
|
||||||
|
private final TextView nameTextView;
|
||||||
|
private final TextView descriptionTextView;
|
||||||
|
private final ImageButton options;
|
||||||
|
private final LiveUpdatesFragment fragment;
|
||||||
|
|
||||||
|
private LocalFullMapsViewHolder(View view, LiveUpdatesFragment context) {
|
||||||
|
icon = (ImageView) view.findViewById(R.id.icon);
|
||||||
|
nameTextView = (TextView) view.findViewById(R.id.nameTextView);
|
||||||
|
descriptionTextView = (TextView) view.findViewById(R.id.descriptionTextView);
|
||||||
|
options = (ImageButton) view.findViewById(R.id.options);
|
||||||
|
this.fragment = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void bindLocalIndexInfo(LocalIndexInfo item) {
|
||||||
|
nameTextView.setText(item.getName());
|
||||||
|
descriptionTextView.setText(item.getDescription());
|
||||||
|
OsmandApplication context = fragment.getMyActivity().getMyApplication();
|
||||||
|
icon.setImageDrawable(context.getIconsCache().getContentIcon(R.drawable.ic_map));
|
||||||
|
options.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
final FragmentManager fragmentManager = fragment.getChildFragmentManager();
|
||||||
|
new SettingsDialogFragment().show(fragmentManager, "settings");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class LoadLocalIndexTask
|
||||||
|
extends AsyncTask<Void, LocalIndexInfo, List<LocalIndexInfo>>
|
||||||
|
implements AbstractLoadLocalIndexTask {
|
||||||
|
|
||||||
|
private List<LocalIndexInfo> result;
|
||||||
|
private ArrayAdapter<LocalIndexInfo> adapter;
|
||||||
|
private ActionBarProgressActivity activity;
|
||||||
|
|
||||||
|
public LoadLocalIndexTask(ArrayAdapter<LocalIndexInfo> adapter,
|
||||||
|
ActionBarProgressActivity activity) {
|
||||||
|
this.adapter = adapter;
|
||||||
|
this.activity = activity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<LocalIndexInfo> doInBackground(Void... params) {
|
||||||
|
LocalIndexHelper helper = new LocalIndexHelper(activity.getMyApplication());
|
||||||
|
return helper.getLocalIndexData(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void loadFile(LocalIndexInfo... loaded) {
|
||||||
|
publishProgress(loaded);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onProgressUpdate(LocalIndexInfo... values) {
|
||||||
|
for (LocalIndexInfo localIndexInfo : values) {
|
||||||
|
if (localIndexInfo.getType() == LocalIndexHelper.LocalIndexType.MAP_DATA) {
|
||||||
|
adapter.add(localIndexInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
adapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPostExecute(List<LocalIndexInfo> result) {
|
||||||
|
this.result = result;
|
||||||
|
adapter.sort(new Comparator<LocalIndexInfo>() {
|
||||||
|
@Override
|
||||||
|
public int compare(@NonNull LocalIndexInfo lhs, @NonNull LocalIndexInfo rhs) {
|
||||||
|
return lhs.getName().compareTo(rhs.getName());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class SettingsDialogFragment extends DialogFragment {
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||||
|
View view = LayoutInflater.from(getActivity())
|
||||||
|
.inflate(R.layout.dialog_live_updates_item_settings, null);
|
||||||
|
builder.setView(view)
|
||||||
|
.setPositiveButton("SAVE", null)
|
||||||
|
.setNegativeButton("CANCEL", null)
|
||||||
|
.setNeutralButton("UPDATE NOW", null);
|
||||||
|
return builder.create();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,9 @@ import android.support.v4.app.FragmentPagerAdapter;
|
||||||
import android.support.v4.view.ViewPager;
|
import android.support.v4.view.ViewPager;
|
||||||
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.OsmandActionBarActivity;
|
import net.osmand.plus.activities.ActionBarProgressActivity;
|
||||||
|
|
||||||
public class LivieUpdatesActivity extends OsmandActionBarActivity {
|
public class LivieUpdatesActivity extends ActionBarProgressActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -30,7 +30,7 @@ public class LivieUpdatesActivity extends OsmandActionBarActivity {
|
||||||
|
|
||||||
public static class MyAdapter extends FragmentPagerAdapter {
|
public static class MyAdapter extends FragmentPagerAdapter {
|
||||||
private final Fragment[] fragments = new Fragment[]{new LiveUpdatesFragment()};
|
private final Fragment[] fragments = new Fragment[]{new LiveUpdatesFragment()};
|
||||||
private final String[] titles = new String[] {LiveUpdatesFragment.TITILE};
|
private final String[] titles = new String[]{LiveUpdatesFragment.TITILE};
|
||||||
|
|
||||||
public MyAdapter(FragmentManager fm) {
|
public MyAdapter(FragmentManager fm) {
|
||||||
super(fm);
|
super(fm);
|
||||||
|
|
|
@ -7,10 +7,6 @@ import android.widget.ProgressBar;
|
||||||
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by Denis
|
|
||||||
* on 23.01.15.
|
|
||||||
*/
|
|
||||||
public class ActionBarProgressActivity extends OsmandActionBarActivity {
|
public class ActionBarProgressActivity extends OsmandActionBarActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -12,7 +12,7 @@ import net.osmand.map.TileSourceManager;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.SQLiteTileSource;
|
import net.osmand.plus.SQLiteTileSource;
|
||||||
import net.osmand.plus.download.ui.LocalIndexesFragment.LoadLocalIndexTask;
|
import net.osmand.plus.download.ui.AbstractLoadLocalIndexTask;
|
||||||
import net.osmand.plus.voice.MediaCommandPlayerImpl;
|
import net.osmand.plus.voice.MediaCommandPlayerImpl;
|
||||||
import net.osmand.plus.voice.TTSCommandPlayerImpl;
|
import net.osmand.plus.voice.TTSCommandPlayerImpl;
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ public class LocalIndexHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<LocalIndexInfo> getLocalIndexData(LoadLocalIndexTask loadTask){
|
public List<LocalIndexInfo> getLocalIndexData(AbstractLoadLocalIndexTask loadTask){
|
||||||
Map<String, String> loadedMaps = app.getResourceManager().getIndexFileNames();
|
Map<String, String> loadedMaps = app.getResourceManager().getIndexFileNames();
|
||||||
List<LocalIndexInfo> result = new ArrayList<>();
|
List<LocalIndexInfo> result = new ArrayList<>();
|
||||||
|
|
||||||
|
@ -106,8 +106,15 @@ public class LocalIndexHelper {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<LocalIndexInfo> getLocalFullMaps(AbstractLoadLocalIndexTask loadTask) {
|
||||||
|
Map<String, String> loadedMaps = app.getResourceManager().getIndexFileNames();
|
||||||
|
List<LocalIndexInfo> result = new ArrayList<>();
|
||||||
|
loadObfData(app.getAppPath(IndexConstants.MAPS_PATH), result, false, loadTask, loadedMaps);
|
||||||
|
|
||||||
private void loadVoiceData(File voiceDir, List<LocalIndexInfo> result, boolean backup, LoadLocalIndexTask loadTask) {
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadVoiceData(File voiceDir, List<LocalIndexInfo> result, boolean backup, AbstractLoadLocalIndexTask loadTask) {
|
||||||
if (voiceDir.canRead()) {
|
if (voiceDir.canRead()) {
|
||||||
//First list TTS files, they are preferred
|
//First list TTS files, they are preferred
|
||||||
for (File voiceF : listFilesSorted(voiceDir)) {
|
for (File voiceF : listFilesSorted(voiceDir)) {
|
||||||
|
@ -139,7 +146,7 @@ public class LocalIndexHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadTilesData(File tilesPath, List<LocalIndexInfo> result, boolean backup, LoadLocalIndexTask loadTask) {
|
private void loadTilesData(File tilesPath, List<LocalIndexInfo> result, boolean backup, AbstractLoadLocalIndexTask loadTask) {
|
||||||
if (tilesPath.canRead()) {
|
if (tilesPath.canRead()) {
|
||||||
for (File tileFile : listFilesSorted(tilesPath)) {
|
for (File tileFile : listFilesSorted(tilesPath)) {
|
||||||
if (tileFile.isFile() && tileFile.getName().endsWith(SQLiteTileSource.EXT)) {
|
if (tileFile.isFile() && tileFile.getName().endsWith(SQLiteTileSource.EXT)) {
|
||||||
|
@ -171,7 +178,7 @@ public class LocalIndexHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void loadSrtmData(File mapPath, List<LocalIndexInfo> result, LoadLocalIndexTask loadTask) {
|
private void loadSrtmData(File mapPath, List<LocalIndexInfo> result, AbstractLoadLocalIndexTask loadTask) {
|
||||||
if (mapPath.canRead()) {
|
if (mapPath.canRead()) {
|
||||||
for (File mapFile : listFilesSorted(mapPath)) {
|
for (File mapFile : listFilesSorted(mapPath)) {
|
||||||
if (mapFile.isFile() && mapFile.getName().endsWith(IndexConstants.BINARY_MAP_INDEX_EXT)) {
|
if (mapFile.isFile() && mapFile.getName().endsWith(IndexConstants.BINARY_MAP_INDEX_EXT)) {
|
||||||
|
@ -184,7 +191,7 @@ public class LocalIndexHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadWikiData(File mapPath, List<LocalIndexInfo> result, LoadLocalIndexTask loadTask) {
|
private void loadWikiData(File mapPath, List<LocalIndexInfo> result, AbstractLoadLocalIndexTask loadTask) {
|
||||||
if (mapPath.canRead()) {
|
if (mapPath.canRead()) {
|
||||||
for (File mapFile : listFilesSorted(mapPath)) {
|
for (File mapFile : listFilesSorted(mapPath)) {
|
||||||
if (mapFile.isFile() && mapFile.getName().endsWith(IndexConstants.BINARY_MAP_INDEX_EXT)) {
|
if (mapFile.isFile() && mapFile.getName().endsWith(IndexConstants.BINARY_MAP_INDEX_EXT)) {
|
||||||
|
@ -197,7 +204,7 @@ public class LocalIndexHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadObfData(File mapPath, List<LocalIndexInfo> result, boolean backup, LoadLocalIndexTask loadTask, Map<String, String> loadedMaps) {
|
private void loadObfData(File mapPath, List<LocalIndexInfo> result, boolean backup, AbstractLoadLocalIndexTask loadTask, Map<String, String> loadedMaps) {
|
||||||
if (mapPath.canRead()) {
|
if (mapPath.canRead()) {
|
||||||
for (File mapFile : listFilesSorted(mapPath)) {
|
for (File mapFile : listFilesSorted(mapPath)) {
|
||||||
if (mapFile.isFile() && mapFile.getName().endsWith(IndexConstants.BINARY_MAP_INDEX_EXT)) {
|
if (mapFile.isFile() && mapFile.getName().endsWith(IndexConstants.BINARY_MAP_INDEX_EXT)) {
|
||||||
|
|
|
@ -50,4 +50,8 @@ public class OsmandActionBarActivity extends AppCompatActivity {
|
||||||
setupHomeButton();
|
setupHomeButton();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public OsmandApplication getMyApplication() {
|
||||||
|
return (OsmandApplication) getApplication();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -208,10 +208,6 @@ public class DownloadActivity extends ActionBarProgressActivity implements Downl
|
||||||
return localIndexInfos;
|
return localIndexInfos;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OsmandApplication getMyApplication() {
|
|
||||||
return (OsmandApplication) getApplication();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
package net.osmand.plus.download.ui;
|
||||||
|
|
||||||
|
import net.osmand.plus.activities.LocalIndexInfo;
|
||||||
|
|
||||||
|
public interface AbstractLoadLocalIndexTask {
|
||||||
|
void loadFile(LocalIndexInfo... loaded);
|
||||||
|
}
|
|
@ -277,7 +277,8 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class LoadLocalIndexTask extends AsyncTask<Void, LocalIndexInfo, List<LocalIndexInfo>> {
|
public class LoadLocalIndexTask extends AsyncTask<Void, LocalIndexInfo, List<LocalIndexInfo>>
|
||||||
|
implements AbstractLoadLocalIndexTask {
|
||||||
|
|
||||||
private List<LocalIndexInfo> result;
|
private List<LocalIndexInfo> result;
|
||||||
|
|
||||||
|
@ -287,6 +288,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
|
||||||
return helper.getLocalIndexData(this);
|
return helper.getLocalIndexData(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void loadFile(LocalIndexInfo... loaded) {
|
public void loadFile(LocalIndexInfo... loaded) {
|
||||||
publishProgress(loaded);
|
publishProgress(loaded);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue