Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2014-09-12 23:50:54 +02:00
commit cb6ba3f095
8 changed files with 51 additions and 42 deletions

View file

@ -7,9 +7,9 @@
android:gravity="center_vertical" android:focusable="false" />
</LinearLayout>
<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"
android:layout_height="wrap_content" style="@style/ListText.Small"></TextView>
android:layout_height="wrap_content" style="@style/ListText.Small"/>
</LinearLayout>

View file

@ -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="left_side_navigation">Left-hand driving</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_location">Position not yet known</string>
<string name="modify_transparency">Modify transparency (0 - transparent, 255 - opaque)</string>

View file

@ -13,6 +13,7 @@ import android.view.View;
import android.widget.*;
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.actionbarsherlock.view.Window;
import net.osmand.plus.*;
import net.osmand.plus.activities.FavouritesActivity;
import net.osmand.plus.base.BasicProgressAsyncTask;
@ -52,7 +53,8 @@ public class DownloadActivity extends SherlockFragmentActivity {
protected void onCreate(Bundle savedInstanceState) {
getMyApplication().applyTheme(this);
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setProgressBarIndeterminateVisibility(false);
setContentView(R.layout.tab_content);
OsmandSettings settings = ((OsmandApplication) getApplication()).getSettings();
@ -124,6 +126,7 @@ public class DownloadActivity extends SherlockFragmentActivity {
}
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
@Override

View file

@ -236,6 +236,12 @@ public class DownloadIndexAdapter extends OsmandBaseExpandableListAdapter implem
v = inflater.inflate(net.osmand.plus.R.layout.download_index_list_item, parent, false);
}
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 description = (TextView) row.findViewById(R.id.download_descr);
IndexItem e = (IndexItem) getChild(groupPosition, childPosition);

View file

@ -67,7 +67,8 @@ public class DownloadIndexFragment extends OsmandExpandableListFragment {
listView.setAdapter(listAdapter);
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
filterText = (EditText) view.findViewById(R.id.search_box);
@ -331,7 +332,7 @@ public class DownloadIndexFragment extends OsmandExpandableListFragment {
@Override
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);
if(ch.isChecked()){

View file

@ -103,6 +103,7 @@ public class DownloadIndexesThread {
app.getResourceManager().getBackupIndexes(indexFileNames);
this.indexFileNames = indexFileNames;
this.indexActivatedFileNames = indexActivatedFileNames;
//updateFilesToDownload();
}
public Map<String, String> getDownloadedIndexFileNames() {
@ -504,7 +505,7 @@ public class DownloadIndexesThread {
DownloadIndexAdapter a = ((DownloadIndexAdapter) uiFragment.getExpandableListAdapter());
a.setLoadedFiles(indexActivatedFileNames, indexFileNames);
a.setIndexFiles(filtered, cats);
prepareFilesToDownload(filtered);
prepareFilesToUpdate(filtered);
a.notifyDataSetChanged();
a.getFilter().filter(uiFragment.getFilterText());
if ((type == DownloadActivityType.SRTM_COUNTRY_FILE || type == DownloadActivityType.HILLSHADE_FILE)
@ -545,7 +546,17 @@ public class DownloadIndexesThread {
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();
for (IndexItem item : filtered) {
String sfName = item.getTargetFileName();

View file

@ -10,6 +10,8 @@ import java.util.Locale;
import java.util.Map;
import java.util.Set;
import android.graphics.Color;
import android.text.method.LinkMovementMethod;
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.view.*;
import net.osmand.IProgress;
@ -71,6 +73,8 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
private ContextMenuAdapter optionsMenuAdapter;
private ActionMode actionMode;
private TextView descriptionText;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.local_index, container, false);
@ -83,6 +87,8 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
listView.setAdapter(listAdapter);
setListView(listView);
//getDownloadActivity().getSupportActionBar().setLogo(R.drawable.tab_download_screen_icon);
descriptionText = (TextView) view.findViewById(R.id.DescriptionText);
updateDescriptionTextWithSize();
return view;
}
@ -93,7 +99,6 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
descriptionLoader = new LoadLocalIndexDescriptionTask();
updateDescriptionTextWithSize();
if (asyncLoader == null || asyncLoader.getResult() == null) {
// getLastNonConfigurationInstance method should be in onCreate() method
// (onResume() doesn't work)
@ -456,6 +461,8 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
//fixes issue when local files not shown after switching tabs
reloadIndexes();
ActionBar actionBar = getDownloadActivity().getSupportActionBar();
//hide action bar from downloadindexfragment
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
@ -503,16 +510,13 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
}
}
}
// @Override
// public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
// if(operationTask == null || operationTask.getStatus() == Status.FINISHED){
// menu.setGroupVisible(0, true);
// } else {
// menu.setGroupVisible(0, false);
// }
// }
if(operationTask == null || operationTask.getStatus() == AsyncTask.Status.FINISHED){
menu.setGroupVisible(0, true);
} else {
menu.setGroupVisible(0, false);
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
@ -606,8 +610,8 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
@Override
public void onDestroyActionMode(ActionMode mode) {
selectionMode = false;
//findViewById(R.id.DescriptionText).setVisibility(View.VISIBLE);
//updateDescriptionTextWithSize();
descriptionText.setVisibility(View.VISIBLE);
updateDescriptionTextWithSize();
listAdapter.cancelFilter();
collapseAllGroups();
listAdapter.notifyDataSetChanged();
@ -625,32 +629,16 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
StatFs fs = new StatFs(dir.getAbsolutePath());
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('.');
if(l == -1) {
l = text.length();
}
SpannableString content = new SpannableString(text);
content.setSpan(new ClickableSpan() {
@Override
public void onClick(View widget) {
asyncLoader.setResult(null);
startActivity(new Intent(getDownloadActivity(), DownloadIndexFragment.class));
descriptionText.setText(text);
descriptionText.setMovementMethod(LinkMovementMethod.getInstance());
}
@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) {
if (itemId == R.string.local_index_download) {
asyncLoader.setResult(null);

View file

@ -82,7 +82,7 @@ public class UpdatesIndexFragment extends SherlockListFragment {
TextView name = (TextView) v.findViewById(R.id.download_item);
TextView description = (TextView) v.findViewById(R.id.download_descr);
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$
String d = e.getDate(format) + "\n" + e.getSizeDescription(getMyApplication());
description.setText(d);