Downdload progress bar in progress. Dialogs refactored as DialogFragments.
This commit is contained in:
parent
09aa80570b
commit
950c7010f9
6 changed files with 25 additions and 32 deletions
|
@ -1,20 +1,5 @@
|
|||
package net.osmand.osm;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.text.Collator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.StringMatcher;
|
||||
import net.osmand.data.Amenity;
|
||||
|
@ -24,6 +9,22 @@ import org.apache.commons.logging.Log;
|
|||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.text.Collator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.TreeMap;
|
||||
|
||||
|
||||
public class MapPoiTypes {
|
||||
private static MapPoiTypes DEFAULT_INSTANCE = null;
|
||||
|
@ -138,7 +139,7 @@ public class MapPoiTypes {
|
|||
}
|
||||
|
||||
public Map<String, PoiType> getAllTranslatedNames() {
|
||||
Map<String, PoiType> translation = new TreeMap<String, PoiType>();
|
||||
Map<String, PoiType> translation = new HashMap<>();
|
||||
for(PoiCategory pc : categories) {
|
||||
for(PoiType pt : pc.getPoiTypes()) {
|
||||
if(pt.isReference()) {
|
||||
|
|
|
@ -78,7 +78,8 @@
|
|||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
android:layout_weight="1"
|
||||
tools:progress="50"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/Cancel"
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<item name="index_item" type="id"/>
|
||||
<item name="fragment" type="id"/>
|
||||
</resources>
|
|
@ -7,14 +7,11 @@ import android.support.v7.widget.Toolbar;
|
|||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.download.DownloadActivity;
|
||||
import net.osmand.plus.download.IndexItem;
|
||||
import net.osmand.plus.helpers.HasName;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
@ -62,12 +59,6 @@ public class MapsInCategoryFragment extends DialogFragment {
|
|||
createInstance(category).show(getChildFragmentManager(), TAG);
|
||||
}
|
||||
|
||||
public void startMapDownload(@NonNull IndexItem indexItem,
|
||||
@NonNull ProgressBar progressBar) {
|
||||
LOG.debug("startMapDownload()");
|
||||
((DownloadActivity) getActivity()).startDownload(indexItem);
|
||||
}
|
||||
|
||||
public static MapsInCategoryFragment createInstance(
|
||||
@NonNull IndexItemCategoryWithSubcat category) {
|
||||
Bundle bundle = new Bundle();
|
||||
|
|
|
@ -20,6 +20,7 @@ import android.widget.TextView;
|
|||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.download.BaseDownloadActivity;
|
||||
import net.osmand.plus.download.DownloadActivity;
|
||||
import net.osmand.plus.download.DownloadActivityType;
|
||||
import net.osmand.plus.download.IndexItem;
|
||||
|
@ -118,7 +119,7 @@ public class SubcategoriesFragment extends Fragment {
|
|||
progressBar = (ProgressBar) convertView.findViewById(R.id.progressBar);
|
||||
}
|
||||
|
||||
public void bindIndexItem(final IndexItem indexItem, DownloadActivity context,
|
||||
public void bindIndexItem(final IndexItem indexItem, final DownloadActivity context,
|
||||
MapsInCategoryFragment fragment) {
|
||||
if (indexItem.getType() == DownloadActivityType.VOICE_FILE) {
|
||||
nameTextView.setText(indexItem.getVisibleName(context,
|
||||
|
@ -133,13 +134,14 @@ public class SubcategoriesFragment extends Fragment {
|
|||
rightImageButton.setImageDrawable(getContextIcon(context,
|
||||
R.drawable.ic_action_import));
|
||||
rightImageButton.setTag(R.id.index_item, indexItem);
|
||||
rightImageButton.setTag(R.id.fragment, fragment);
|
||||
rightImageButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
((MapsInCategoryFragment) v.getTag(R.id.fragment))
|
||||
.startMapDownload((IndexItem) v.getTag(R.id.index_item), progressBar);
|
||||
((BaseDownloadActivity) v.getContext())
|
||||
.startDownload((IndexItem) v.getTag(R.id.index_item));
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
rightImageButton.setImageDrawable(getContextIcon(context,
|
||||
R.drawable.ic_action_remove_dark));
|
||||
}
|
||||
});
|
||||
progressBar.setVisibility(View.GONE);
|
||||
|
|
|
@ -92,7 +92,6 @@ public class AdvancedDataFragment extends Fragment {
|
|||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
// TODO read more about lifecycle
|
||||
mAdapter.updateViews();
|
||||
mTagsChangedListener = new EditPoiData.TagsChangedListener() {
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue