/** * 节点浏览示例 * * @param v */ public void nodeClick(View v) { if (nodeIndex < -1 || route == null || nodeIndex >= route.getNumSteps()) return; viewCache = getLayoutInflater().inflate(R.layout.custom_text_view, null); popupText = (TextView) viewCache.findViewById(R.id.textcache); // 上一个节点 if (mBtnPre.equals(v) && nodeIndex > 0) { // 索引减 nodeIndex--; // 移动到指定索引的坐标 mMapView.getController().animateTo(route.getStep(nodeIndex).getPoint()); // 弹出泡泡 popupText.setText(route.getStep(nodeIndex).getContent()); popupText.setBackgroundResource(R.drawable.popup); pop.showPopup(BMapUtil.getBitmapFromView(popupText), route.getStep(nodeIndex).getPoint(), 5); } // 下一个节点 if (mBtnNext.equals(v) && nodeIndex < (route.getNumSteps() - 1)) { // 索引加 nodeIndex++; // 移动到指定索引的坐标 mMapView.getController().animateTo(route.getStep(nodeIndex).getPoint()); // 弹出泡泡 popupText.setText(route.getStep(nodeIndex).getContent()); popupText.setBackgroundDrawable(getResources().getDrawable(R.drawable.popup)); pop.showPopup(BMapUtil.getBitmapFromView(popupText), route.getStep(nodeIndex).getPoint(), 5); } }
/** * 发起路线规划搜索示例 * * @param v */ void SearchButtonProcess(View v) { // 重置浏览节点的路线数据 route = null; routeOverlay = null; transitOverlay = null; mBtnPre.setVisibility(View.INVISIBLE); mBtnNext.setVisibility(View.INVISIBLE); // 对起点终点的name进行赋值,也可以直接对坐标赋值,赋值坐标则将根据坐标进行搜索 MKPlanNode stNode = new MKPlanNode(); stNode.name = editSt.getText().toString(); if (ptStart != null) { stNode.pt = ptStart; } MKPlanNode enNode = new MKPlanNode(); enNode.name = editEn.getText().toString(); if (ptEnd != null) { enNode.pt = ptEnd; } pb.show(); // 实际使用中请对起点终点城市进行正确的设定 if (mBtnDrive.equals(v)) { mSearch.drivingSearch("上海", stNode, "上海", enNode); } else if (mBtnTransit.equals(v)) { mSearch.transitSearch("上海", stNode, enNode); } else if (mBtnWalk.equals(v)) { mSearch.walkingSearch("上海", stNode, "上海", enNode); } ptEnd = null; ptStart = null; }
@Override public void onClick(View v) { if (backBtn.equals(v)) { backAction(); } else if (controlMoreControlBtn.equals(v)) { displayPopupControl(); } else if (controlRefreshBtn.equals(v)) { refreshFeed(true); } }
@Override public void onClick(View view) { if (btnFindPrimitiveRoot.equals(view)) { startPrimitiveRootFinder(); } else if (btnCancel.equals(view)) { cancelPrimitiveRootFinder(); progressBar.setVisibility(View.INVISIBLE); lblTimeMeasurement.setVisibility(View.INVISIBLE); lblPrime.setVisibility(View.INVISIBLE); lblModulusNumber.setVisibility(View.INVISIBLE); btnFindPrimitiveRoot.setEnabled(true); btnCancel.setVisibility(View.INVISIBLE); } }
// Method will be called when a button is clicked to answer a question. // It will grey out all the answers except the correct one, which will be in green // if the user selected the wrong answer, it will be shown in red. public void checkAnswer(View v) { buttons[0] = (Button) findViewById(R.id.button1); buttons[1] = (Button) findViewById(R.id.button2); buttons[2] = (Button) findViewById(R.id.button3); buttons[3] = (Button) findViewById(R.id.button4); Button btnChosen = (Button) findViewById(v.getId()); TextView scoreView = (TextView) findViewById(R.id.evScore); /* can change getText to getKey and set a key in the xml*/ // checks the buttons text against the Question boolean correct = currentQuestion.checkAnswer(btnChosen); if (correct) { btnChosen.setBackgroundColor(Color.GREEN); score++; scoreView.setText(Integer.toString(score)); btnChosen.setEnabled(false); } else btnChosen.setBackgroundColor(Color.RED); for (int i = 0; i < 4; i++) { if (btnChosen.equals(buttons[i])) continue; if (currentQuestion.checkAnswer(buttons[i])) buttons[i].setBackgroundColor(Color.GREEN); else buttons[i].setBackgroundColor(Color.GRAY); buttons[i].setEnabled(false); } // savedInstanceState.putInt(KEY_SCORE, score); }
public void findCorrect(Button btnSkip) { // finds the correct answer and makes it green all others are gray for (int i = 0; i < 4; i++) { if (btnSkip.equals(buttons[i])) continue; if (currentQuestion.checkAnswer(buttons[i])) buttons[i].setBackgroundColor(Color.GREEN); else buttons[i].setBackgroundColor(Color.GRAY); } }
/** * 发起检索 * * @param v */ void SearchButtonProcess(View v) { busLineIDList.clear(); busLineIndex = 0; mBtnPre.setVisibility(View.INVISIBLE); mBtnNext.setVisibility(View.INVISIBLE); if (mBtnSearch.equals(v)) { EditText editCity = (EditText) findViewById(R.id.city); EditText editSearchKey = (EditText) findViewById(R.id.searchkey); // 发起poi检索,从得到所有poi中找到公交线路类型的poi,再使用该poi的uid进行公交详情搜索 mSearch.poiSearchInCity(editCity.getText().toString(), editSearchKey.getText().toString()); } }
public void onClick(View v) { // Toast.makeText(this,String.valueOf(v.getId()),Toast.LENGTH_SHORT).show(); Button botonPresionado = (Button) v; Intent intentQueVuelveATabActivity = new Intent( this, com.example.nicolas.clientefinalandroid2.Activities.VentanaContabulaciones.class); if (botonPresionado.equals(botonResultadosIZQ)) { ManejadorCliente.vaciarConjuntoJugadas(); intentQueVuelveATabActivity.putExtra("tab?", 1); startActivity(intentQueVuelveATabActivity); this.finish(); } else if (botonPresionado.equals(botonResultadosDER)) { botonResultadosDER.setEnabled(false); botonResultadosIZQ.setEnabled(false); ManejadorCliente.enviarConjuntoJugadasAlServer(); intentQueVuelveATabActivity.putExtra("tab?", 2); startActivity(intentQueVuelveATabActivity); this.finish(); } }
@Override public void onClick(View v) { if (uploadphotoBtn.equals(v)) { if (null == getLastPhoto(photoName)) { DialogUtil.displayWarning( GpsCameraActivity.this, getString(R.string.sys_msg), getString(R.string.no_photo), false, new OnClickListener() { @Override public void onClick(View v) {} }); } else { try { String photoPath = GlobalInfo.getStringSharedPre(photoName, ""); File file = new File(photoPath); new UploadPhoto(GpsCameraActivity.this, file, upLoadAdd, null).execute(); } catch (Exception e) { e.printStackTrace(); } } } else if (cancle.equals(v)) { finish(); } else if (photoBtn.equals(v)) { startCamera("", false, "", "", ""); } else if (delPhotoBtn.equals(v)) { previewImage.setImageBitmap(null); deleteOldPhotos(photoRealPath); savePhoto(photoName, ""); } }
/** * 节点浏览示例 * * @param v */ public void nodeClick(View v) { viewCache = getLayoutInflater().inflate(R.layout.custom_text_view, null); popupText = (TextView) viewCache.findViewById(R.id.textcache); if (searchType == 0 || searchType == 2) { // 驾车、步行使用的数据结构相同,因此类型为驾车或步行,节点浏览方法相同 if (nodeIndex < -1 || route == null || nodeIndex >= route.getNumSteps()) return; // 上一个节点 if (mBtnPre.equals(v) && nodeIndex > 0) { // 索引减 nodeIndex--; // 移动到指定索引的坐标 mMapView.getController().animateTo(route.getStep(nodeIndex).getPoint()); // 弹出泡泡 popupText.setBackgroundResource(R.drawable.popup); popupText.setText(route.getStep(nodeIndex).getContent()); pop.showPopup( BMapUtil.getBitmapFromView(popupText), route.getStep(nodeIndex).getPoint(), 5); } // 下一个节点 if (mBtnNext.equals(v) && nodeIndex < (route.getNumSteps() - 1)) { // 索引加 nodeIndex++; // 移动到指定索引的坐标 mMapView.getController().animateTo(route.getStep(nodeIndex).getPoint()); // 弹出泡泡 popupText.setBackgroundResource(R.drawable.popup); popupText.setText(route.getStep(nodeIndex).getContent()); pop.showPopup( BMapUtil.getBitmapFromView(popupText), route.getStep(nodeIndex).getPoint(), 5); } } if (searchType == 1) { // 公交换乘使用的数据结构与其他不同,因此单独处理节点浏览 if (nodeIndex < -1 || transitOverlay == null || nodeIndex >= transitOverlay.getAllItem().size()) return; // 上一个节点 if (mBtnPre.equals(v) && nodeIndex > 1) { // 索引减 nodeIndex--; // 移动到指定索引的坐标 mMapView.getController().animateTo(transitOverlay.getItem(nodeIndex).getPoint()); // 弹出泡泡 popupText.setBackgroundResource(R.drawable.popup); popupText.setText(transitOverlay.getItem(nodeIndex).getTitle()); pop.showPopup( BMapUtil.getBitmapFromView(popupText), transitOverlay.getItem(nodeIndex).getPoint(), 5); } // 下一个节点 if (mBtnNext.equals(v) && nodeIndex < (transitOverlay.getAllItem().size() - 2)) { // 索引加 nodeIndex++; // 移动到指定索引的坐标 mMapView.getController().animateTo(transitOverlay.getItem(nodeIndex).getPoint()); // 弹出泡泡 popupText.setBackgroundResource(R.drawable.popup); popupText.setText(transitOverlay.getItem(nodeIndex).getTitle()); pop.showPopup( BMapUtil.getBitmapFromView(popupText), transitOverlay.getItem(nodeIndex).getPoint(), 5); } } }