Update wiki

This commit is contained in:
Victor Shcherb 2015-06-14 20:21:44 +02:00
parent d212c501fa
commit 43a0bd60da
6 changed files with 56 additions and 17 deletions

View file

@ -100,6 +100,15 @@
android:layout_height="@dimen/list_item_height"
android:orientation="horizontal" >
<ImageView
android:id="@+id/CancelAll"
android:layout_width="@dimen/list_item_height"
android:layout_height="@dimen/list_item_height"
android:scaleType="centerInside"
android:src="@drawable/ic_action_remove_dark"
android:background="?attr/downloadButtonBackground"
android:gravity="center"/>
<Button
android:id="@+id/DownloadButton"
android:layout_width="0dp"
@ -115,6 +124,7 @@
android:layout_width="@dimen/list_item_height"
android:layout_height="@dimen/list_item_height"
android:scaleType="centerInside"
android:src="@drawable/ic_action_wikipedia"
android:background="?attr/downloadButtonBackground"
android:gravity="center"/>
</LinearLayout>

View file

@ -9,7 +9,7 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
-->
<string name="download_wikipedia_files">Do you want to download additional Wikipedia data (%1$s MB) ?</string>
<string name="gps_network_not_enabled">Location service is not enabled. Do you want to turn it on?</string>
<string name="disable_recording_once_app_killed">Prevent standalone logging</string>
<string name="disable_recording_once_app_killed_descrp">Will pause GPX logging when the app is killed (via recent apps). (OsmAnd Sleep mode indication disappears from the Android notification bar.)</string>

View file

@ -1,17 +1,15 @@
package net.osmand.plus.activities;
import android.support.v4.app.Fragment;
import android.support.v4.view.MenuCompat;
import android.support.v4.view.MenuItemCompat;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import android.graphics.Shader.TileMode;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.view.MenuItemCompat;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ExpandableListAdapter;
import android.widget.ExpandableListView;
@ -62,6 +60,10 @@ public abstract class OsmandExpandableListFragment extends Fragment
}
public ExpandableListAdapter getAdapter() {
return adapter;
}
public void fixBackgroundRepeat(View view) {
Drawable bg = view.getBackground();
if (bg != null) {

View file

@ -14,6 +14,7 @@ import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R;
import net.osmand.plus.Version;
import net.osmand.plus.activities.LocalIndexInfo;
import net.osmand.plus.activities.OsmAndListFragment;
import net.osmand.plus.activities.OsmandBaseExpandableListAdapter;
import net.osmand.plus.activities.OsmandExpandableListFragment;
import net.osmand.plus.activities.TabActivity;
@ -31,7 +32,9 @@ import android.support.v4.app.ListFragment;
import android.support.v4.view.ViewPager;
import android.view.MenuItem;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.BaseExpandableListAdapter;
import android.widget.Button;
import android.widget.ExpandableListAdapter;
import android.widget.ImageView;
@ -147,7 +150,26 @@ public class DownloadActivity extends BaseDownloadActivity {
downloadWikiFiles();
}
});
((ImageView)findViewById(R.id.WikiButton)).setImageResource(R.drawable.ic_action_wikipedia);
findViewById(R.id.CancelAll).setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
getEntriesToDownload().clear();
updateDownloadButton();
for(WeakReference<Fragment> ref : fragList) {
Fragment f = ref.get();
if(f instanceof OsmAndListFragment) {
if(!f.isDetached() && ((OsmAndListFragment) f).getListAdapter() instanceof ArrayAdapter) {
((ArrayAdapter) ((OsmAndListFragment) f).getListAdapter()).notifyDataSetChanged();
}
} else if (!f.isDetached() && f instanceof OsmandExpandableListFragment &&
((OsmandExpandableListFragment) f).getAdapter() instanceof BaseExpandableListAdapter){
((BaseExpandableListAdapter) ((OsmandExpandableListFragment) f).getAdapter()).notifyDataSetChanged();
}
}
}
});
downloadTypes = createDownloadTypes();
final Intent intent = getIntent();
@ -310,19 +332,16 @@ public class DownloadActivity extends BaseDownloadActivity {
}
protected void downloadWikiFiles() {
if (Version.isFreeVersion(getMyApplication())) {
dialogToInstallPaid();
} else {
Builder bld = new AlertDialog.Builder(this);
// TODO message
String countries = "";
final List<IndexItem> wi = getWikipediaItems();
long size = 0;
for(IndexItem i : wi) {
countries += i.getDescription() +", ";
size += i.getSize();
}
bld.setMessage(countries);
bld.setMessage(getString(R.string.download_wikipedia_files, (size >> 20)));
bld.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {
@Override
@ -330,9 +349,10 @@ public class DownloadActivity extends BaseDownloadActivity {
for(IndexItem i : wi) {
addToDownload(i);
}
updateDownloadButton();
}
});
bld.setPositiveButton(R.string.shared_string_cancel, null);
bld.setNegativeButton(R.string.shared_string_cancel, null);
if(wi.size() > 0) {
bld.show();
}

View file

@ -84,6 +84,11 @@ public class DownloadIndexFragment extends OsmandExpandableListFragment {
filterText.setText(filter);
return view;
}
@Override
public ExpandableListAdapter getAdapter() {
return adapter;
}
@Override
public void onCreate(Bundle savedInstanceState) {

View file

@ -36,7 +36,6 @@ import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import net.osmand.IProgress;
import net.osmand.IndexConstants;
import net.osmand.access.AccessibleToast;
@ -230,7 +229,10 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
}
});
confirm.setNegativeButton(R.string.shared_string_no, null);
confirm.setMessage(getString(R.string.delete_confirmation_msg, info.getFileName()));
String fn = FileNameTranslationHelper.getFileName(getActivity(),
getMyApplication().getResourceManager().getOsmandRegions(),
info.getFileName());
confirm.setMessage(getString(R.string.delete_confirmation_msg, fn));
confirm.show();
} else if (resId == R.string.local_index_mi_backup) {
new LocalIndexOperationTask(BACKUP_OPERATION).execute(info);