Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
cb6ba3f095
8 changed files with 51 additions and 42 deletions
|
@ -7,9 +7,9 @@
|
||||||
android:gravity="center_vertical" android:focusable="false" />
|
android:gravity="center_vertical" android:focusable="false" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<TextView android:id="@+id/download_item" android:gravity="center_vertical" android:layout_width="0dp" android:layout_height="wrap_content"
|
<TextView android:id="@+id/download_item" android:gravity="center_vertical" android:layout_width="0dp" android:layout_height="wrap_content"
|
||||||
android:maxLines="7" android:layout_weight="1" style="@style/ListText.Small"></TextView>
|
android:maxLines="7" android:layout_weight="1" style="@style/ListText.Small"/>
|
||||||
|
|
||||||
<TextView android:id="@+id/download_descr" android:layout_marginLeft="3dp" android:gravity="right" android:layout_width="wrap_content"
|
<TextView android:id="@+id/download_descr" android:layout_marginLeft="3dp" android:gravity="right" android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content" style="@style/ListText.Small"></TextView>
|
android:layout_height="wrap_content" style="@style/ListText.Small"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -1100,7 +1100,7 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A
|
||||||
<string name="offline_navigation_not_available">OsmAnd offline navigation is temporarily not available.</string>
|
<string name="offline_navigation_not_available">OsmAnd offline navigation is temporarily not available.</string>
|
||||||
<string name="left_side_navigation">Left-hand driving</string>
|
<string name="left_side_navigation">Left-hand driving</string>
|
||||||
<string name="left_side_navigation_descr">Select for countries with left-hand traffic</string>
|
<string name="left_side_navigation_descr">Select for countries with left-hand traffic</string>
|
||||||
<string name="download_link_and_local_description">Click here to download or update offline map files. \nClick any existing item to see more details, press and hold to deactivate or delete. Current data on device (%1$s free):</string>
|
<string name="local_index_description">Click any existing item to see more details, press and hold to deactivate or delete. Current data on device (%1$s free):</string>
|
||||||
<string name="unknown_from_location">Starting point is not yet determined</string>
|
<string name="unknown_from_location">Starting point is not yet determined</string>
|
||||||
<string name="unknown_location">Position not yet known</string>
|
<string name="unknown_location">Position not yet known</string>
|
||||||
<string name="modify_transparency">Modify transparency (0 - transparent, 255 - opaque)</string>
|
<string name="modify_transparency">Modify transparency (0 - transparent, 255 - opaque)</string>
|
||||||
|
|
|
@ -13,6 +13,7 @@ import android.view.View;
|
||||||
import android.widget.*;
|
import android.widget.*;
|
||||||
import com.actionbarsherlock.app.ActionBar;
|
import com.actionbarsherlock.app.ActionBar;
|
||||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||||
|
import com.actionbarsherlock.view.Window;
|
||||||
import net.osmand.plus.*;
|
import net.osmand.plus.*;
|
||||||
import net.osmand.plus.activities.FavouritesActivity;
|
import net.osmand.plus.activities.FavouritesActivity;
|
||||||
import net.osmand.plus.base.BasicProgressAsyncTask;
|
import net.osmand.plus.base.BasicProgressAsyncTask;
|
||||||
|
@ -52,7 +53,8 @@ public class DownloadActivity extends SherlockFragmentActivity {
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
getMyApplication().applyTheme(this);
|
getMyApplication().applyTheme(this);
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
|
||||||
|
setProgressBarIndeterminateVisibility(false);
|
||||||
|
|
||||||
setContentView(R.layout.tab_content);
|
setContentView(R.layout.tab_content);
|
||||||
OsmandSettings settings = ((OsmandApplication) getApplication()).getSettings();
|
OsmandSettings settings = ((OsmandApplication) getApplication()).getSettings();
|
||||||
|
@ -124,6 +126,7 @@ public class DownloadActivity extends SherlockFragmentActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
getSupportActionBar().setHomeButtonEnabled(true);
|
getSupportActionBar().setHomeButtonEnabled(true);
|
||||||
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -236,6 +236,12 @@ public class DownloadIndexAdapter extends OsmandBaseExpandableListAdapter implem
|
||||||
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;
|
||||||
|
row.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
downloadFragment.onChildClick(downloadFragment.getExpandableListView(), row, groupPosition, childPosition, getChildId(groupPosition, childPosition));
|
||||||
|
}
|
||||||
|
});
|
||||||
TextView item = (TextView) row.findViewById(R.id.download_item);
|
TextView item = (TextView) row.findViewById(R.id.download_item);
|
||||||
TextView description = (TextView) row.findViewById(R.id.download_descr);
|
TextView description = (TextView) row.findViewById(R.id.download_descr);
|
||||||
IndexItem e = (IndexItem) getChild(groupPosition, childPosition);
|
IndexItem e = (IndexItem) getChild(groupPosition, childPosition);
|
||||||
|
|
|
@ -67,7 +67,8 @@ public class DownloadIndexFragment extends OsmandExpandableListFragment {
|
||||||
listView.setAdapter(listAdapter);
|
listView.setAdapter(listAdapter);
|
||||||
setListView(listView);
|
setListView(listView);
|
||||||
|
|
||||||
//getSupportActionBar().setTitle(R.string.local_index_download);
|
|
||||||
|
getDownloadActivity().getSupportActionBar().setTitle(R.string.local_index_download);
|
||||||
// recreation upon rotation is pgetaprevented in manifest file
|
// recreation upon rotation is pgetaprevented in manifest file
|
||||||
|
|
||||||
filterText = (EditText) view.findViewById(R.id.search_box);
|
filterText = (EditText) view.findViewById(R.id.search_box);
|
||||||
|
@ -331,7 +332,7 @@ public class DownloadIndexFragment extends OsmandExpandableListFragment {
|
||||||
|
|
||||||
@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) listAdapter.getChild(groupPosition, childPosition);
|
final IndexItem e = 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()){
|
||||||
|
|
|
@ -103,6 +103,7 @@ public class DownloadIndexesThread {
|
||||||
app.getResourceManager().getBackupIndexes(indexFileNames);
|
app.getResourceManager().getBackupIndexes(indexFileNames);
|
||||||
this.indexFileNames = indexFileNames;
|
this.indexFileNames = indexFileNames;
|
||||||
this.indexActivatedFileNames = indexActivatedFileNames;
|
this.indexActivatedFileNames = indexActivatedFileNames;
|
||||||
|
//updateFilesToDownload();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, String> getDownloadedIndexFileNames() {
|
public Map<String, String> getDownloadedIndexFileNames() {
|
||||||
|
@ -504,7 +505,7 @@ public class DownloadIndexesThread {
|
||||||
DownloadIndexAdapter a = ((DownloadIndexAdapter) uiFragment.getExpandableListAdapter());
|
DownloadIndexAdapter a = ((DownloadIndexAdapter) uiFragment.getExpandableListAdapter());
|
||||||
a.setLoadedFiles(indexActivatedFileNames, indexFileNames);
|
a.setLoadedFiles(indexActivatedFileNames, indexFileNames);
|
||||||
a.setIndexFiles(filtered, cats);
|
a.setIndexFiles(filtered, cats);
|
||||||
prepareFilesToDownload(filtered);
|
prepareFilesToUpdate(filtered);
|
||||||
a.notifyDataSetChanged();
|
a.notifyDataSetChanged();
|
||||||
a.getFilter().filter(uiFragment.getFilterText());
|
a.getFilter().filter(uiFragment.getFilterText());
|
||||||
if ((type == DownloadActivityType.SRTM_COUNTRY_FILE || type == DownloadActivityType.HILLSHADE_FILE)
|
if ((type == DownloadActivityType.SRTM_COUNTRY_FILE || type == DownloadActivityType.HILLSHADE_FILE)
|
||||||
|
@ -545,7 +546,17 @@ public class DownloadIndexesThread {
|
||||||
execute(inst, new Void[0]);
|
execute(inst, new Void[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void prepareFilesToDownload(List<IndexItem> filtered) {
|
private void updateFilesToDownload(){
|
||||||
|
for (IndexItem item : itemsToUpdate){
|
||||||
|
for (String key : indexFileNames.keySet()){
|
||||||
|
if (item.getFileName().equals(indexFileNames.get(key))){
|
||||||
|
itemsToUpdate.remove(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void prepareFilesToUpdate(List<IndexItem> filtered) {
|
||||||
itemsToUpdate.clear();
|
itemsToUpdate.clear();
|
||||||
for (IndexItem item : filtered) {
|
for (IndexItem item : filtered) {
|
||||||
String sfName = item.getTargetFileName();
|
String sfName = item.getTargetFileName();
|
||||||
|
|
|
@ -10,6 +10,8 @@ import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.text.method.LinkMovementMethod;
|
||||||
import com.actionbarsherlock.app.ActionBar;
|
import com.actionbarsherlock.app.ActionBar;
|
||||||
import com.actionbarsherlock.view.*;
|
import com.actionbarsherlock.view.*;
|
||||||
import net.osmand.IProgress;
|
import net.osmand.IProgress;
|
||||||
|
@ -71,6 +73,8 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
||||||
private ContextMenuAdapter optionsMenuAdapter;
|
private ContextMenuAdapter optionsMenuAdapter;
|
||||||
private ActionMode actionMode;
|
private ActionMode actionMode;
|
||||||
|
|
||||||
|
private TextView descriptionText;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
View view = inflater.inflate(R.layout.local_index, container, false);
|
View view = inflater.inflate(R.layout.local_index, container, false);
|
||||||
|
@ -83,6 +87,8 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
||||||
listView.setAdapter(listAdapter);
|
listView.setAdapter(listAdapter);
|
||||||
setListView(listView);
|
setListView(listView);
|
||||||
//getDownloadActivity().getSupportActionBar().setLogo(R.drawable.tab_download_screen_icon);
|
//getDownloadActivity().getSupportActionBar().setLogo(R.drawable.tab_download_screen_icon);
|
||||||
|
descriptionText = (TextView) view.findViewById(R.id.DescriptionText);
|
||||||
|
updateDescriptionTextWithSize();
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +99,6 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
||||||
|
|
||||||
descriptionLoader = new LoadLocalIndexDescriptionTask();
|
descriptionLoader = new LoadLocalIndexDescriptionTask();
|
||||||
|
|
||||||
updateDescriptionTextWithSize();
|
|
||||||
if (asyncLoader == null || asyncLoader.getResult() == null) {
|
if (asyncLoader == null || asyncLoader.getResult() == null) {
|
||||||
// getLastNonConfigurationInstance method should be in onCreate() method
|
// getLastNonConfigurationInstance method should be in onCreate() method
|
||||||
// (onResume() doesn't work)
|
// (onResume() doesn't work)
|
||||||
|
@ -456,6 +461,8 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||||
|
//fixes issue when local files not shown after switching tabs
|
||||||
|
reloadIndexes();
|
||||||
ActionBar actionBar = getDownloadActivity().getSupportActionBar();
|
ActionBar actionBar = getDownloadActivity().getSupportActionBar();
|
||||||
//hide action bar from downloadindexfragment
|
//hide action bar from downloadindexfragment
|
||||||
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
|
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
|
||||||
|
@ -503,16 +510,13 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// @Override
|
if(operationTask == null || operationTask.getStatus() == AsyncTask.Status.FINISHED){
|
||||||
// public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
menu.setGroupVisible(0, true);
|
||||||
// if(operationTask == null || operationTask.getStatus() == Status.FINISHED){
|
} else {
|
||||||
// menu.setGroupVisible(0, true);
|
menu.setGroupVisible(0, false);
|
||||||
// } else {
|
}
|
||||||
// menu.setGroupVisible(0, false);
|
}
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
@ -606,8 +610,8 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
||||||
@Override
|
@Override
|
||||||
public void onDestroyActionMode(ActionMode mode) {
|
public void onDestroyActionMode(ActionMode mode) {
|
||||||
selectionMode = false;
|
selectionMode = false;
|
||||||
//findViewById(R.id.DescriptionText).setVisibility(View.VISIBLE);
|
descriptionText.setVisibility(View.VISIBLE);
|
||||||
//updateDescriptionTextWithSize();
|
updateDescriptionTextWithSize();
|
||||||
listAdapter.cancelFilter();
|
listAdapter.cancelFilter();
|
||||||
collapseAllGroups();
|
collapseAllGroups();
|
||||||
listAdapter.notifyDataSetChanged();
|
listAdapter.notifyDataSetChanged();
|
||||||
|
@ -625,32 +629,16 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
||||||
StatFs fs = new StatFs(dir.getAbsolutePath());
|
StatFs fs = new StatFs(dir.getAbsolutePath());
|
||||||
size = formatGb.format(new Object[]{(float) (fs.getAvailableBlocks()) * fs.getBlockSize() / (1 << 30) });
|
size = formatGb.format(new Object[]{(float) (fs.getAvailableBlocks()) * fs.getBlockSize() / (1 << 30) });
|
||||||
}
|
}
|
||||||
//TextView ds = (TextView) findViewById(R.id.DescriptionText);
|
|
||||||
String text = getString(R.string.download_link_and_local_description, size);
|
String text = getString(R.string.local_index_description, size);
|
||||||
int l = text.indexOf('.');
|
int l = text.indexOf('.');
|
||||||
if(l == -1) {
|
if(l == -1) {
|
||||||
l = text.length();
|
l = text.length();
|
||||||
}
|
}
|
||||||
SpannableString content = new SpannableString(text);
|
descriptionText.setText(text);
|
||||||
content.setSpan(new ClickableSpan() {
|
descriptionText.setMovementMethod(LinkMovementMethod.getInstance());
|
||||||
@Override
|
|
||||||
public void onClick(View widget) {
|
|
||||||
asyncLoader.setResult(null);
|
|
||||||
startActivity(new Intent(getDownloadActivity(), DownloadIndexFragment.class));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateDrawState(TextPaint ds) {
|
|
||||||
super.updateDrawState(ds);
|
|
||||||
// ds.setColor(Color.GREEN);
|
|
||||||
}
|
|
||||||
}, 0, l, 0);
|
|
||||||
//ds.setText(content);
|
|
||||||
//ds.setMovementMethod(LinkMovementMethod.getInstance());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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);
|
||||||
|
|
|
@ -82,7 +82,7 @@ public class UpdatesIndexFragment extends SherlockListFragment {
|
||||||
TextView name = (TextView) v.findViewById(R.id.download_item);
|
TextView name = (TextView) v.findViewById(R.id.download_item);
|
||||||
TextView description = (TextView) v.findViewById(R.id.download_descr);
|
TextView description = (TextView) v.findViewById(R.id.download_descr);
|
||||||
IndexItem e = items.get(position);
|
IndexItem e = items.get(position);
|
||||||
String eName = e.getVisibleDescription(getMyApplication()) + "\n" + e.getVisibleName(getMyApplication(), osmandRegions);
|
String eName = e.getVisibleName(getMyApplication(), osmandRegions);
|
||||||
name.setText(eName.trim()); //$NON-NLS-1$
|
name.setText(eName.trim()); //$NON-NLS-1$
|
||||||
String d = e.getDate(format) + "\n" + e.getSizeDescription(getMyApplication());
|
String d = e.getDate(format) + "\n" + e.getSizeDescription(getMyApplication());
|
||||||
description.setText(d);
|
description.setText(d);
|
||||||
|
|
Loading…
Reference in a new issue