@OnClick(R.id.fill_color) public void OnFillColor() { if (mItem.m_tuple.layer.m_layer_properties.m_style != null && mItem.m_tuple.layer.m_layer_properties.m_style.m_colors != null) { for (final GIColor color : mItem.m_tuple.layer.m_layer_properties.m_style.m_colors) { if (color.m_description.equalsIgnoreCase("fill")) { new AmbilWarnaDialog( getActivity(), color.Get(), new AmbilWarnaDialog.OnAmbilWarnaListener() { @Override public void onOk(AmbilWarnaDialog dialog, int new_color) { color.set(new_color); // GIVectorStyle vstyle = new GIVectorStyle(line, // fill, 1); mFillColor.setBackgroundColor(new_color); ((GIEditableRenderer) mItem.m_tuple.layer.renderer()) .m_style.m_paint_brush.setColor(new_color); } @Override public void onCancel(AmbilWarnaDialog dialog) {} }) .show(); } } } }
@OnClick(R.id.stroke_color) public void OnStrokeColor() { if (mItem.m_tuple.layer.m_layer_properties.m_style != null && mItem.m_tuple.layer.m_layer_properties.m_style.m_colors != null) { for (final GIColor color : mItem.m_tuple.layer.m_layer_properties.m_style.m_colors) { if (color.m_description.equalsIgnoreCase("line")) { new AmbilWarnaDialog( getActivity(), color.Get(), new AmbilWarnaDialog.OnAmbilWarnaListener() { @Override public void onOk(AmbilWarnaDialog dialog, int new_color) { color.set(new_color); mStrokeColor.setBackgroundColor(new_color); ((GIEditableRenderer) mItem.m_tuple.layer.renderer()) .m_style.m_paint_pen.setColor(new_color); } @Override public void onCancel(AmbilWarnaDialog dialog) {} }) .show(); } } } }
public void reset() { mName.setText(mItem.m_tuple.layer.getName()); mLocation.setText(mItem.m_tuple.layer.m_layer_properties.m_source.m_name); File file = new File(mItem.m_tuple.layer.m_layer_properties.m_source.m_name); if (file.exists()) { mFileOk.setImageResource(R.drawable.project_mark); } else { mFileOk.setImageResource(R.drawable.project_mark_fail); } // // mRangeMin.setText(String.valueOf(mItem.m_tuple.layer.m_layer_properties.m_range.m_from)); // // mRangeMax.setText(String.valueOf(mItem.m_tuple.layer.m_layer_properties.m_range.m_to)); // mRangeMin.setText(String.valueOf(mItem.m_tuple.scale_range.getIntMin())); // mRangeMax.setText(String.valueOf(mItem.m_tuple.scale_range.getIntMax())); // layer type ArrayAdapter<String> layer_type_adapter = new ArrayAdapter<String>( getActivity(), R.layout.item_spinner, getResources().getStringArray(R.array.layer_type)); layer_type_adapter.setDropDownViewResource(R.layout.item_spinner_dropdown); mType.setAdapter(layer_type_adapter); for (int i = 0; i < getResources().getStringArray(R.array.layer_type).length; i++) { if (getResources() .getStringArray(R.array.layer_type)[i] .equals(mItem.m_tuple.layer.m_layer_properties.m_type.name())) { mType.setSelection(i); } } // source type ArrayAdapter<String> source_type_adapter = new ArrayAdapter<String>( getActivity(), R.layout.item_spinner, getResources().getStringArray(R.array.source_type)); source_type_adapter.setDropDownViewResource(R.layout.item_spinner_dropdown); mLocationType.setAdapter(source_type_adapter); String layer_type = mItem.m_tuple.layer.m_layer_properties.m_source.m_location; for (int i = 0; i < getResources().getStringArray(R.array.source_type).length; i++) { if (getResources().getStringArray(R.array.source_type)[i].equals(layer_type)) { mLocationType.setSelection(i); } } // zoom type if (mItem.m_tuple.layer.m_layer_properties.m_sqldb != null) { ArrayAdapter<String> zoom_type_adapter = new ArrayAdapter<String>( getActivity(), R.layout.item_spinner, getResources().getStringArray(R.array.zoom_type)); zoom_type_adapter.setDropDownViewResource(R.layout.item_spinner_dropdown); mZoomType.setAdapter(zoom_type_adapter); for (int i = 0; i < getResources().getStringArray(R.array.zoom_type).length; i++) { if (getResources() .getStringArray(R.array.zoom_type)[i] .equals(mItem.m_tuple.layer.m_layer_properties.m_sqldb.m_zoom_type)) { mZoomType.setSelection(i); } } // ratio ArrayAdapter<String> ratio_adapter = new ArrayAdapter<String>( getActivity(), R.layout.item_spinner, getResources().getStringArray(R.array.ratio)); ratio_adapter.setDropDownViewResource(R.layout.item_spinner_dropdown); mRatio.setAdapter(ratio_adapter); for (int i = 0; i < getResources().getStringArray(R.array.zoom_type).length; i++) { if (getResources() .getStringArray(R.array.ratio)[i] .equals(String.valueOf(mItem.m_tuple.layer.m_layer_properties.m_sqldb.mRatio))) { mRatio.setSelection(i); } } // zoom max ArrayAdapter<String> zoom_max_adapter = new ArrayAdapter<String>( getActivity(), R.layout.item_spinner, getResources().getStringArray(R.array.zoom_levels)); zoom_max_adapter.setDropDownViewResource(R.layout.item_spinner_dropdown); mZoomMax.setAdapter(zoom_max_adapter); for (int i = 0; i < getResources().getStringArray(R.array.zoom_levels).length; i++) { if (getResources() .getStringArray(R.array.zoom_levels)[i] .equals(String.valueOf(mItem.m_tuple.layer.m_layer_properties.m_sqldb.m_max_z))) { mZoomMax.setSelection(i); } } // zoom min ArrayAdapter<String> zoom_min_adapter = new ArrayAdapter<String>( getActivity(), R.layout.item_spinner, getResources().getStringArray(R.array.zoom_levels)); zoom_min_adapter.setDropDownViewResource(R.layout.item_spinner_dropdown); mZoomMin.setAdapter(zoom_min_adapter); for (int i = 0; i < getResources().getStringArray(R.array.zoom_levels).length; i++) { if (getResources() .getStringArray(R.array.zoom_levels)[i] .equals(String.valueOf(mItem.m_tuple.layer.m_layer_properties.m_sqldb.m_min_z))) { mZoomMin.setSelection(i); } } } // range ArrayAdapter<String> range = new ArrayAdapter<String>( getActivity(), R.layout.item_spinner, getResources().getStringArray(R.array.source_type)); source_type_adapter.setDropDownViewResource(R.layout.item_spinner_dropdown); mRangeFrom.setAdapter(source_type_adapter); ArrayAdapter<String> rangeFromAdapter = new ArrayAdapter<String>( getActivity(), R.layout.item_spinner, getResources().getStringArray(R.array.ranges)); rangeFromAdapter.setDropDownViewResource(R.layout.item_spinner_dropdown); mRangeFrom.setAdapter(rangeFromAdapter); ArrayAdapter<String> rangeToAdapter = new ArrayAdapter<String>( getActivity(), R.layout.item_spinner, getResources().getStringArray(R.array.ranges)); rangeToAdapter.setDropDownViewResource(R.layout.item_spinner_dropdown); mRangeTo.setAdapter(rangeToAdapter); // colors\ if (mItem.m_tuple.layer.m_layer_properties.m_style != null && mItem.m_tuple.layer.m_layer_properties.m_style.m_colors != null) { for (GIColor color : mItem.m_tuple.layer.m_layer_properties.m_style.m_colors) { if (color.m_description.equalsIgnoreCase("line")) { mStrokeColor.setBackgroundColor(color.Get()); } else if (color.m_description.equalsIgnoreCase("fill")) { mFillColor.setBackgroundColor(color.Get()); } } } }