List of usage examples for android.view View getClass
@HotSpotIntrinsicCandidate public final native Class<?> getClass();
From source file:cl.gisred.android.CatastroActivity.java
private void cerrarFormCrear(boolean bSave, View v) { if (bSave) {/*from www . j a v a 2 s. c o m*/ final AtomicReference<String> resp = new AtomicReference<>(""); if (!validarForm(v)) { DialogoConfirmacion oDialog = new DialogoConfirmacion(); oDialog.show(getFragmentManager(), "tagAlert"); return; } else { View vAction = getLayoutValidate(v); Map<String, Object> objectMap = new HashMap<>(); for (View view : vAction.getTouchables()) { if (view.getClass().getGenericSuperclass().equals(EditText.class)) { EditText oText = (EditText) view; if (oText.getId() == R.id.txtProducto) { String oVal = (oText.getText().toString().isEmpty()) ? "0" : oText.getText().toString(); objectMap.put("producto", oVal); } if (oText.getId() == R.id.txtPoste) objectMap.put("poste", oText.getText().toString()); if (oText.getId() == R.id.txtDireccion) objectMap.put("direccion", oText.getText().toString()); } else if (view.getClass().getGenericSuperclass().equals(Spinner.class)) { Spinner oSpinner = (Spinner) view; String sValue = oSpinner.getSelectedItem().toString(); if (oSpinner.getId() == R.id.spinnerEstado) objectMap.put("estado", sValue); else if (oSpinner.getId() == R.id.spinnerTipoEdif) objectMap.put("tipo_edificacion", sValue); } } Graphic newFeatureGraphic = new Graphic(oUbicacion, null, objectMap); Graphic[] adds = { newFeatureGraphic }; LyAddCatastro.applyEdits(adds, null, null, new CallbackListener<FeatureEditResult[][]>() { @Override public void onCallback(FeatureEditResult[][] featureEditResults) { if (featureEditResults[0] != null) { if (featureEditResults[0][0] != null && featureEditResults[0][0].isSuccess()) { resp.set("Guardado Correctamente Id: " + featureEditResults[0][0].getObjectId()); runOnUiThread(new Runnable() { @Override public void run() { Util.showConfirmation(CatastroActivity.this, resp.get()); } }); } } } @Override public void onError(Throwable throwable) { resp.set("Error al ingresar: " + throwable.getLocalizedMessage()); Log.w("onError", resp.get()); runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(CatastroActivity.this, resp.get(), Toast.LENGTH_SHORT).show(); } }); } }); } } bMapTap = false; oUbicacion = null; if (mBusquedaLayer != null && myMapView.getLayerByID(mBusquedaLayer.getID()) != null) myMapView.removeLayer(mBusquedaLayer); if (mUbicacionLayer != null && myMapView.getLayerByID(mUbicacionLayer.getID()) != null) myMapView.removeLayer(mUbicacionLayer); if (mSeleccionLayer != null && myMapView.getLayerByID(mSeleccionLayer.getID()) != null) myMapView.removeLayer(mSeleccionLayer); if (bVerCapas) toogleCapas(fabVerCapas); menuMultipleActions.setVisibility(View.VISIBLE); menuCatastroActions.setVisibility(View.VISIBLE); fabShowForm.setVisibility(View.GONE); formCrear.dismiss(); if (LyAddCatastro != null) LyAddCatastro.setVisible(true); }
From source file:android.support.design.widget.CoordinatorLayout.java
LayoutParams getResolvedLayoutParams(View child) { final LayoutParams result = (LayoutParams) child.getLayoutParams(); if (!result.mBehaviorResolved) { Class<?> childClass = child.getClass(); DefaultBehavior defaultBehavior = null; while (childClass != null && (defaultBehavior = childClass.getAnnotation(DefaultBehavior.class)) == null) { childClass = childClass.getSuperclass(); }//from w w w. j a v a 2 s. co m if (defaultBehavior != null) { try { result.setBehavior(defaultBehavior.value().newInstance()); } catch (Exception e) { Log.e(TAG, "Default behavior class " + defaultBehavior.value().getName() + " could not be instantiated. Did you forget a default constructor?", e); } } result.mBehaviorResolved = true; } return result; }
From source file:cl.gisred.android.LectorActivity.java
private int recorrerForm(View v) { int contRequeridos = 0; for (View view : v.getTouchables()) { if (view.getClass().getGenericSuperclass().equals(EditText.class)) { EditText oText = (EditText) view; TextInputLayout oTextInput = (TextInputLayout) oText.getParentForAccessibility(); if (oTextInput.getHint() != null && oTextInput.getHint().toString().contains("*")) { if (oText.getText().toString().trim().isEmpty()) { contRequeridos++;//ww w .j a v a2 s . c o m oText.setError("Campo obligatorio"); } else { oText.setError(null); } } } // Validacion especial para estado lectores else if (view.getClass().getGenericSuperclass().equals(Spinner.class)) { Spinner oSpinner = (Spinner) view; if (oSpinner.getSelectedItem().toString().isEmpty()) contRequeridos++; } } return contRequeridos; }
From source file:com.example.mvpdemo.widget.NarrowParentViewPager.java
@Override public boolean onStartNestedScroll(View child, View target, int nestedScrollAxes) { Log.i(TAG,/*from w w w .j a v a2s . co m*/ "onStartNestedScroll nestedScrollAxes = " + (nestedScrollAxes & ViewCompat.SCROLL_AXIS_VERTICAL) + " child = " + child.getClass().getSimpleName() + " target = " + target.getClass().getSimpleName()); Log.i(TAG, "onStartNestedScroll dis = " + mDragDistance + " xsss = " + (OFFSET + PADDING) * (float) getHeight() / getWidth()); return mDragDistance <= (OFFSET + PADDING) * (float) getHeight() / getWidth() && mDragDistance >= 0; }
From source file:cl.gisred.android.MedidorActivity.java
private void cerrarFormCrear(boolean bSave, View v) { if (bSave) {// w w w . j ava 2 s .c om final AtomicReference<String> resp = new AtomicReference<>(""); if (!validarForm(v)) { DialogoConfirmacion oDialog = new DialogoConfirmacion(); oDialog.show(getFragmentManager(), "tagAlert"); return; } else { View vAction = getLayoutValidate(v); Map<String, Object> objectMap = new HashMap<>(); for (View view : vAction.getTouchables()) { if (view.getClass().getGenericSuperclass().equals(EditText.class)) { EditText oText = (EditText) view; if (oText.getId() == R.id.txtNroMedidor) { String oVal = (oText.getText().toString().isEmpty()) ? "0" : oText.getText().toString(); objectMap.put("nro_medidor", oVal); } if (oText.getId() == R.id.txtLectura) { String oVal = (oText.getText().toString().isEmpty()) ? "0" : oText.getText().toString(); objectMap.put("lectura_actual", oVal); } if (oText.getId() == R.id.txtPoste) objectMap.put("poste", oText.getText().toString()); if (oText.getId() == R.id.txtDireccion) objectMap.put("direccion", oText.getText().toString()); } else if (view.getClass().getGenericSuperclass().equals(Spinner.class)) { Spinner oSpinner = (Spinner) view; String sValue = oSpinner.getSelectedItem().toString(); if (oSpinner.getId() == R.id.spinnerEstado) objectMap.put("estado", sValue); else if (oSpinner.getId() == R.id.spinnerTipoEdific) objectMap.put("tipo_edificacion", sValue); else if (oSpinner.getId() == R.id.spinnerUser) objectMap.put("lector", sValue); } } Graphic newFeatureGraphic = new Graphic(oUbicacion, null, objectMap); Graphic[] adds = { newFeatureGraphic }; LyAddMedidores.applyEdits(adds, null, null, new CallbackListener<FeatureEditResult[][]>() { @Override public void onCallback(FeatureEditResult[][] featureEditResults) { if (featureEditResults[0] != null) { if (featureEditResults[0][0] != null && featureEditResults[0][0].isSuccess()) { resp.set("Guardado Correctamente Id: " + featureEditResults[0][0].getObjectId()); runOnUiThread(new Runnable() { @Override public void run() { Util.showConfirmation(MedidorActivity.this, resp.get()); } }); } } } @Override public void onError(Throwable throwable) { resp.set("Error al ingresar: " + throwable.getLocalizedMessage()); Log.w("onError", resp.get()); runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(MedidorActivity.this, resp.get(), Toast.LENGTH_SHORT).show(); } }); } }); } } bMapTap = false; oUbicacion = null; if (mBusquedaLayer != null && myMapView.getLayerByID(mBusquedaLayer.getID()) != null) myMapView.removeLayer(mBusquedaLayer); if (mUbicacionLayer != null && myMapView.getLayerByID(mUbicacionLayer.getID()) != null) myMapView.removeLayer(mUbicacionLayer); if (mSeleccionLayer != null && myMapView.getLayerByID(mSeleccionLayer.getID()) != null) myMapView.removeLayer(mSeleccionLayer); if (bVerCapas) toogleCapas(fabVerCapas); if (bIngCliente) menuMultipleActions.setVisibility(View.VISIBLE); menuMedidorActions.setVisibility(View.VISIBLE); fabShowForm.setVisibility(View.GONE); formCrear.dismiss(); if (LyAddMedidores != null) LyAddMedidores.setVisible(true); }
From source file:com.dian.diabetes.widget.VerticalViewPager.java
public boolean arrowScroll(int direction) { View currentFocused = findFocus(); if (currentFocused == this) { currentFocused = null;//from w w w.j a v a 2s .c om } else if (currentFocused != null) { boolean isChild = false; for (ViewParent parent = currentFocused.getParent(); parent instanceof ViewGroup; parent = parent .getParent()) { if (parent == this) { isChild = true; break; } } if (!isChild) { // This would cause the focus search down below to fail in fun ways. final StringBuilder sb = new StringBuilder(); sb.append(currentFocused.getClass().getSimpleName()); for (ViewParent parent = currentFocused.getParent(); parent instanceof ViewGroup; parent = parent .getParent()) { sb.append(" => ").append(parent.getClass().getSimpleName()); } Log.e(TAG, "arrowScroll tried to find focus based on non-child " + "current focused view " + sb.toString()); currentFocused = null; } } boolean handled = false; View nextFocused = FocusFinder.getInstance().findNextFocus(this, currentFocused, direction); if (nextFocused != null && nextFocused != currentFocused) { if (direction == View.FOCUS_UP) { // If there is nothing to the left, or this is causing us to // jump to the right, then what we really want to do is page left. final int nextUp = getChildRectInPagerCoordinates(mTempRect, nextFocused).top; final int currUp = getChildRectInPagerCoordinates(mTempRect, currentFocused).top; if (currentFocused != null && nextUp >= currUp) { handled = pageUp(); } else { handled = nextFocused.requestFocus(); } } else if (direction == View.FOCUS_DOWN) { // If there is nothing to the right, or this is causing us to // jump to the left, then what we really want to do is page right. final int nextLeft = getChildRectInPagerCoordinates(mTempRect, nextFocused).left; final int currLeft = getChildRectInPagerCoordinates(mTempRect, currentFocused).left; if (currentFocused != null && nextLeft <= currLeft) { handled = pageDown(); } else { handled = nextFocused.requestFocus(); } } } else if (direction == FOCUS_UP || direction == FOCUS_BACKWARD) { // Trying to move left and nothing there; try to page. handled = pageUp(); } else if (direction == FOCUS_DOWN || direction == FOCUS_FORWARD) { // Trying to move right and nothing there; try to page. handled = pageDown(); } if (handled) { playSoundEffect(SoundEffectConstants.getContantForFocusDirection(direction)); } return handled; }
From source file:com.isapp.android.circularviewpager.CircularViewPager.java
public boolean arrowScroll(int direction) { View currentFocused = findFocus(); if (currentFocused == this) { currentFocused = null;//from w w w . ja va 2s .c o m } else if (currentFocused != null) { boolean isChild = false; for (ViewParent parent = currentFocused.getParent(); parent instanceof ViewGroup; parent = parent .getParent()) { if (parent == this) { isChild = true; break; } } if (!isChild) { // This would cause the focus search down below to fail in fun ways. final StringBuilder sb = new StringBuilder(); sb.append(currentFocused.getClass().getSimpleName()); for (ViewParent parent = currentFocused.getParent(); parent instanceof ViewGroup; parent = parent .getParent()) { sb.append(" => ").append(parent.getClass().getSimpleName()); } Log.e(TAG, "arrowScroll tried to find focus based on non-child " + "current focused view " + sb.toString()); currentFocused = null; } } boolean handled = false; View nextFocused = FocusFinder.getInstance().findNextFocus(this, currentFocused, direction); if (nextFocused != null && nextFocused != currentFocused) { if (direction == View.FOCUS_LEFT) { // If there is nothing to the left, or this is causing us to // jump to the right, then what we really want to do is page left. final int nextLeft = getChildRectInPagerCoordinates(mTempRect, nextFocused).left; final int currLeft = getChildRectInPagerCoordinates(mTempRect, currentFocused).left; if (currentFocused != null && nextLeft >= currLeft) { handled = pageLeft(); } else { handled = nextFocused.requestFocus(); } } else if (direction == View.FOCUS_RIGHT) { // If there is nothing to the right, or this is causing us to // jump to the left, then what we really want to do is page right. final int nextLeft = getChildRectInPagerCoordinates(mTempRect, nextFocused).left; final int currLeft = getChildRectInPagerCoordinates(mTempRect, currentFocused).left; if (currentFocused != null && nextLeft <= currLeft) { handled = pageRight(); } else { handled = nextFocused.requestFocus(); } } } else if (direction == FOCUS_LEFT || direction == FOCUS_BACKWARD) { // Trying to move left and nothing there; try to page. handled = pageLeft(); } else if (direction == FOCUS_RIGHT || direction == FOCUS_FORWARD) { // Trying to move right and nothing there; try to page. handled = pageRight(); } if (handled) { playSoundEffect(SoundEffectConstants.getContantForFocusDirection(direction)); } return handled; }
From source file:cl.gisred.android.LectorActivity.java
private void cerrarFormCrear(boolean bSave, View v) { if (bSave) {// www . j a v a 2s. c om final AtomicReference<String> resp = new AtomicReference<>(""); if (!validarForm(v)) { DialogoConfirmacion oDialog = new DialogoConfirmacion(); oDialog.show(getFragmentManager(), "tagAlert"); return; } else { View vAction = getLayoutValidate(v); Map<String, Object> objectMap = new HashMap<>(); for (View view : vAction.getTouchables()) { if (view.getClass().getGenericSuperclass().equals(EditText.class)) { EditText oText = (EditText) view; if (oText.getId() == R.id.txtNroMedidor) { String oVal = (oText.getText().toString().isEmpty()) ? "0" : oText.getText().toString(); objectMap.put("nro_medidor", oVal); } if (oText.getId() == R.id.txtLectura) { String oVal = (oText.getText().toString().isEmpty()) ? "0" : oText.getText().toString(); objectMap.put("lectura_actual", oVal); } if (oText.getId() == R.id.txtPoste) objectMap.put("poste", oText.getText().toString()); if (oText.getId() == R.id.txtDireccion) objectMap.put("direccion", oText.getText().toString()); } else if (view.getClass().getGenericSuperclass().equals(Spinner.class)) { Spinner oSpinner = (Spinner) view; String sValue = oSpinner.getSelectedItem().toString(); if (oSpinner.getId() == R.id.spinnerEstado) objectMap.put("estado", sValue); else if (oSpinner.getId() == R.id.spinnerTipoEdific) objectMap.put("tipo_edificacion", sValue); else if (oSpinner.getId() == R.id.spinnerUser) objectMap.put("lector", sValue); } } Graphic newFeatureGraphic = new Graphic(oUbicacion, null, objectMap); Graphic[] adds = { newFeatureGraphic }; LyAddLectores.applyEdits(adds, null, null, new CallbackListener<FeatureEditResult[][]>() { @Override public void onCallback(FeatureEditResult[][] featureEditResults) { if (featureEditResults[0] != null) { if (featureEditResults[0][0] != null && featureEditResults[0][0].isSuccess()) { resp.set("Guardado Correctamente Id: " + featureEditResults[0][0].getObjectId()); runOnUiThread(new Runnable() { @Override public void run() { Util.showConfirmation(LectorActivity.this, resp.get()); } }); } } } @Override public void onError(Throwable throwable) { resp.set("Error al ingresar: " + throwable.getLocalizedMessage()); Log.w("onError", resp.get()); runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(LectorActivity.this, resp.get(), Toast.LENGTH_SHORT).show(); } }); } }); } } bMapTap = false; oUbicacion = null; if (mBusquedaLayer != null && myMapView.getLayerByID(mBusquedaLayer.getID()) != null) myMapView.removeLayer(mBusquedaLayer); if (mUbicacionLayer != null && myMapView.getLayerByID(mUbicacionLayer.getID()) != null) myMapView.removeLayer(mUbicacionLayer); if (mSeleccionLayer != null && myMapView.getLayerByID(mSeleccionLayer.getID()) != null) myMapView.removeLayer(mSeleccionLayer); if (bVerCapas) toogleCapas(fabVerCapas); if (bIngCliente) menuMultipleActions.setVisibility(View.VISIBLE); menuLectorActions.setVisibility(View.VISIBLE); fabShowForm.setVisibility(View.GONE); formCrear.dismiss(); if (LyAddLectores != null) LyAddLectores.setVisible(true); }
From source file:com.borqs.se.addobject.AddObjectViewPager.java
public boolean arrowScroll(int direction) { View currentFocused = findFocus(); if (currentFocused == this) { currentFocused = null;//from w w w .j a va 2s . c om } else if (currentFocused != null) { boolean isChild = false; for (ViewParent parent = currentFocused.getParent(); parent instanceof ViewGroup; parent = parent .getParent()) { if (parent == this) { isChild = true; break; } } if (!isChild) { // This would cause the focus search down below to fail in fun ways. final StringBuilder sb = new StringBuilder(); sb.append(currentFocused.getClass().getSimpleName()); for (ViewParent parent = currentFocused.getParent(); parent instanceof ViewGroup; parent = parent .getParent()) { sb.append(" => ").append(parent.getClass().getSimpleName()); } currentFocused = null; } } boolean handled = false; View nextFocused = FocusFinder.getInstance().findNextFocus(this, currentFocused, direction); if (nextFocused != null && nextFocused != currentFocused) { if (direction == View.FOCUS_LEFT) { // If there is nothing to the left, or this is causing us to // jump to the right, then what we really want to do is page left. final int nextLeft = getChildRectInPagerCoordinates(mTempRect, nextFocused).left; final int currLeft = getChildRectInPagerCoordinates(mTempRect, currentFocused).left; if (currentFocused != null && nextLeft >= currLeft) { handled = pageLeft(); } else { handled = nextFocused.requestFocus(); } } else if (direction == View.FOCUS_RIGHT) { // If there is nothing to the right, or this is causing us to // jump to the left, then what we really want to do is page right. final int nextLeft = getChildRectInPagerCoordinates(mTempRect, nextFocused).left; final int currLeft = getChildRectInPagerCoordinates(mTempRect, currentFocused).left; if (currentFocused != null && nextLeft <= currLeft) { handled = pageRight(); } else { handled = nextFocused.requestFocus(); } } } else if (direction == FOCUS_LEFT || direction == FOCUS_BACKWARD) { // Trying to move left and nothing there; try to page. handled = pageLeft(); } else if (direction == FOCUS_RIGHT || direction == FOCUS_FORWARD) { // Trying to move right and nothing there; try to page. handled = pageRight(); } if (handled) { playSoundEffect(SoundEffectConstants.getContantForFocusDirection(direction)); } return handled; }
From source file:com.ok.utils.widget.ViewPagerModify.java
public boolean arrowScroll(int direction) { View currentFocused = findFocus(); if (currentFocused == this) { currentFocused = null;/*www . j a va 2 s . c o m*/ } else if (currentFocused != null) { boolean isChild = false; for (ViewParent parent = currentFocused.getParent(); parent instanceof ViewGroup; parent = parent .getParent()) { if (parent == this) { isChild = true; break; } } if (!isChild) { // This would cause the focus search down below to fail in fun ways. final StringBuilder sb = new StringBuilder(); sb.append(currentFocused.getClass().getSimpleName()); for (ViewParent parent = currentFocused.getParent(); parent instanceof ViewGroup; parent = parent .getParent()) { sb.append(" => ").append(parent.getClass().getSimpleName()); } LogUtils.e(TAG, "arrowScroll tried to find focus based on non-child " + "current focused view " + sb.toString()); currentFocused = null; } } boolean handled = false; View nextFocused = FocusFinder.getInstance().findNextFocus(this, currentFocused, direction); if (nextFocused != null && nextFocused != currentFocused) { if (direction == View.FOCUS_LEFT) { // If there is nothing to the left, or this is causing us to // jump to the right, then what we really want to do is page left. final int nextLeft = getChildRectInPagerCoordinates(mTempRect, nextFocused).left; final int currLeft = getChildRectInPagerCoordinates(mTempRect, currentFocused).left; if (currentFocused != null && nextLeft >= currLeft) { handled = pageLeft(); } else { handled = nextFocused.requestFocus(); } } else if (direction == View.FOCUS_RIGHT) { // If there is nothing to the right, or this is causing us to // jump to the left, then what we really want to do is page right. final int nextLeft = getChildRectInPagerCoordinates(mTempRect, nextFocused).left; final int currLeft = getChildRectInPagerCoordinates(mTempRect, currentFocused).left; if (currentFocused != null && nextLeft <= currLeft) { handled = pageRight(); } else { handled = nextFocused.requestFocus(); } } } else if (direction == FOCUS_LEFT || direction == FOCUS_BACKWARD) { // Trying to move left and nothing there; try to page. handled = pageLeft(); } else if (direction == FOCUS_RIGHT || direction == FOCUS_FORWARD) { // Trying to move right and nothing there; try to page. handled = pageRight(); } if (handled) { playSoundEffect(SoundEffectConstants.getContantForFocusDirection(direction)); } return handled; }