Updated layout resources of map configuration. Renamed method to not having the same name.

This commit is contained in:
Denis_Bars 2014-10-22 15:13:04 +03:00
parent 7aaac35942
commit 035b37a601
13 changed files with 96 additions and 67 deletions

View file

@ -1,16 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="48dp">
<ImageView android:id="@+id/back"
android:layout_gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView android:id="@+id/header"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"/>
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginLeft="4dp">
<ImageView android:id="@+id/back"
android:layout_gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView android:id="@+id/header"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"/>
</LinearLayout>

View file

@ -1,20 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp">
<ImageView android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView android:id="@+id/name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<CheckBox android:id="@+id/chek"
android:layout_marginLeft="11dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp">
<ImageView android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<LinearLayout android:layout_marginLeft="8dp"
android:layout_width="wrap_content"
android:layout_weight="1"
android:layout_height="0dp">
<TextView android:id="@+id/header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextureView android:id="@+id/descr"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<CheckBox android:id="@+id/chek"
android:layout_marginLeft="11dp"
android:layout_marginRight="8dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>

View file

@ -1,9 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="64dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp">
<LinearLayout android:layout_width="wrap_content"
android:layout_marginLeft="8dp"
android:layout_weight="1"
android:orientation="vertical"
android:layout_height="0dp">
<TextView android:id="@+id/header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextureView android:id="@+id/descr"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<CheckBox android:id="@+id/check"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="8dp"/>
</LinearLayout>

View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="16dp">
<TextView android:id="@+id/header"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_marginLeft="8dp"
android:layout_height="wrap_content"/>
</LinearLayout>

View file

@ -53,7 +53,7 @@ public class ContextMenuAdapter {
return items.size();
}
public int getItemId(int pos){
public int getElementId(int pos){
return items.get(pos);
}
@ -237,14 +237,14 @@ public class ContextMenuAdapter {
if(selectedList.get(position) != -1) {
ch.setOnCheckedChangeListener(null);
ch.setVisibility(View.VISIBLE);
ch.setSelected(selectedList.get(position) > 0);
ch.setChecked(selectedList.get(position) > 0);
ch.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
OnContextMenuClick ca = getClickAdapter(position);
if(ca != null) {
ca.onContextMenuClick(position, position, isChecked);
ca.onContextMenuClick(getElementId(position), position, isChecked);
}
}
});

View file

@ -187,7 +187,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
OsmandPlugin.onOptionsMenuActivity(getSherlockActivity(), this, optionsMenuAdapter);
for (int j = 0; j < optionsMenuAdapter.length(); j++) {
MenuItem item;
item = menu.add(0, optionsMenuAdapter.getItemId(j), j + 1, optionsMenuAdapter.getItemName(j));
item = menu.add(0, optionsMenuAdapter.getElementId(j), j + 1, optionsMenuAdapter.getItemName(j));
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM
);
if (optionsMenuAdapter.getImageId(j, isLightActionBar()) != 0) {
@ -213,7 +213,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
public boolean onOptionsItemSelected(MenuItem item) {
int itemId = item.getItemId();
for (int i = 0; i < optionsMenuAdapter.length(); i++) {
if (itemId == optionsMenuAdapter.getItemId(i)) {
if (itemId == optionsMenuAdapter.getElementId(i)) {
optionsMenuAdapter.getClickAdapter(i).onContextMenuClick(itemId, i, false);
return true;
}
@ -479,7 +479,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
public void onClick(DialogInterface dialog, int which) {
OnContextMenuClick clk = adapter.getClickAdapter(which);
if (clk != null) {
clk.onContextMenuClick(adapter.getItemId(which), which, false);
clk.onContextMenuClick(adapter.getElementId(which), which, false);
}
}

View file

@ -256,7 +256,7 @@ public class FavouritesTreeFragment extends OsmandExpandableListFragment {
@Override
public boolean onOptionsItemSelected(com.actionbarsherlock.view.MenuItem item) {
// if (item.getItemId() == EXPORT_ID) {
// if (item.getElementId() == EXPORT_ID) {
// export();
// return true;
// } else

View file

@ -190,7 +190,7 @@ public class MapActivityActions implements DialogProvider {
activity.getString(R.string.add_favorite_dialog_favourite_added_template), point.getName()), Toast.LENGTH_SHORT)
.show();
}
if(activity instanceof MapActivity) {
if (activity instanceof MapActivity) {
((MapActivity) activity).getMapView().refreshMap(true);
}
}
@ -370,12 +370,12 @@ public class MapActivityActions implements DialogProvider {
}
protected void showToast(final String msg){
mapActivity.runOnUiThread(new Runnable(){
mapActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
AccessibleToast.makeText(mapActivity, msg, Toast.LENGTH_LONG).show();
}
});
});
}
@ -513,7 +513,7 @@ public class MapActivityActions implements DialogProvider {
@Override
public void onClick(DialogInterface dialog, int which) {
int standardId = adapter.getItemId(which);
int standardId = adapter.getElementId(which);
OnContextMenuClick click = adapter.getClickAdapter(which);
if (click != null) {
click.onContextMenuClick(standardId, which, false);
@ -770,7 +770,7 @@ public class MapActivityActions implements DialogProvider {
public void onItemClick(AdapterView<?> parent, View view, int which, long id) {
OnContextMenuClick click = cm.getClickAdapter(which);
if (click != null) {
if (click.onContextMenuClick(cm.getItemId(which), which, false)) {
if (click.onContextMenuClick(cm.getElementId(which), which, false)) {
mDrawerLayout.closeDrawer(mDrawerList);
}
} else {
@ -1196,7 +1196,7 @@ public class MapActivityActions implements DialogProvider {
public void onClick(DialogInterface dialog, int which) {
OnContextMenuClick clk = qa.getClickAdapter(which);
if (clk != null) {
clk.onContextMenuClick(qa.getItemId(which), which, false);
clk.onContextMenuClick(qa.getElementId(which), which, false);
}
}
@ -1221,7 +1221,7 @@ public class MapActivityActions implements DialogProvider {
onShow.onClick(v);
}
view.dismiss();
qa.getClickAdapter(ki).onContextMenuClick(qa.getItemId(ki), ki, false);
qa.getClickAdapter(ki).onContextMenuClick(qa.getElementId(ki), ki, false);
}
});

View file

@ -177,7 +177,7 @@ public class SelectedGPXFragment extends OsmandExpandableListFragment {
public void onClick(DialogInterface dialog, int which) {
OnContextMenuClick clk = adapter.getClickAdapter(which);
if (clk != null) {
clk.onContextMenuClick(adapter.getItemId(which), which, false);
clk.onContextMenuClick(adapter.getElementId(which), which, false);
}
}

View file

@ -83,7 +83,7 @@ public class ConfigureMapMenu {
}
ma.getMapLayers().updateLayers(ma.getMapView());
ma.getMapView().refreshMap();
return true;
return false;
}
}

View file

@ -10,7 +10,6 @@ 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.*;
@ -31,15 +30,11 @@ import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.TypedArray;
import android.graphics.Typeface;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.StatFs;
import android.text.SpannableString;
import android.text.TextPaint;
import android.text.style.ClickableSpan;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.LayoutInflater;
@ -146,7 +141,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
public void onClick(DialogInterface dialog, int which) {
OnContextMenuClick clk = adapter.getClickAdapter(which);
if (clk != null) {
clk.onContextMenuClick(adapter.getItemId(which), which, false);
clk.onContextMenuClick(adapter.getElementId(which), which, false);
}
}
@ -506,10 +501,10 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
: R.drawable.abs__ic_menu_moreoverflow_holo_dark);
split.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
}
item = split.add(0, optionsMenuAdapter.getItemId(j), j + 1, optionsMenuAdapter.getItemName(j));
item = split.add(0, optionsMenuAdapter.getElementId(j), j + 1, optionsMenuAdapter.getItemName(j));
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM );
} else {
item = menu.add(0, optionsMenuAdapter.getItemId(j), j + 1, optionsMenuAdapter.getItemName(j));
item = menu.add(0, optionsMenuAdapter.getElementId(j), j + 1, optionsMenuAdapter.getItemName(j));
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM
);
}
@ -530,7 +525,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
public boolean onOptionsItemSelected(MenuItem item) {
int itemId = item.getItemId();
for (int i = 0; i < optionsMenuAdapter.length(); i++) {
if (itemId == optionsMenuAdapter.getItemId(i)) {
if (itemId == optionsMenuAdapter.getElementId(i)) {
optionsMenuAdapter.getClickAdapter(i).onContextMenuClick(itemId, i, false);
return true;
}

View file

@ -631,7 +631,7 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
}
TreeSet<Integer> set = new TreeSet<Integer>(Arrays.asList(ids));
for(int i =0; i < a.length();) {
int itemId = a.getItemId(i);
int itemId = a.getElementId(i);
if(set.contains(itemId)) {
i++;
} else {

View file

@ -10,17 +10,9 @@ import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
import net.osmand.plus.views.mapwidgets.ImageViewWidget;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.Context;
import android.content.DialogInterface.OnClickListener;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
import android.widget.Toast;
public class MonitoringInfoControl {
@ -89,7 +81,7 @@ public class MonitoringInfoControl {
ai.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ca.getClickAdapter(ij).onContextMenuClick(ca.getItemId(ij), ij, false);
ca.getClickAdapter(ij).onContextMenuClick(ca.getElementId(ij), ij, false);
qa.dismiss();
}
});