Пример #1
0
 public void SaveToDataBase() {
   if (this.point != null) {
     point.sms = sms;
     point.done = true;
     point.Update();
     Conf.codePoint = null;
     this.toastText("Задание завершено. Информация сохранена.");
     finish();
   }
 }
Пример #2
0
  @Override
  public void onTabSelected(Tab tab, FragmentTransaction ft) {

    LayoutInflater ltInflater = getLayoutInflater();
    View view = ltInflater.inflate(R.layout.tab1, null, false);

    if (tab.getPosition() == 0) {
      view = ltInflater.inflate(R.layout.tab1, null, false);
    } else if (tab.getPosition() == 1) {
      if (point != null) view = ltInflater.inflate(R.layout.tab2, null, false);
    } else if (tab.getPosition() == 2) {
      if (point != null) view = ltInflater.inflate(R.layout.tab3, null, false);
    } else if (tab.getPosition() == 3) {
      if (point != null) view = ltInflater.inflate(R.layout.tab4, null, false);
    }

    LinearLayout linLayout = (LinearLayout) findViewById(R.id.linLayout);
    linLayout.removeAllViews();
    linLayout.addView(view);

    /////////////////////////////////////////
    // TAB 1
    /////////////////////////////////////////
    if (tab.getPosition() == 0) {
      FillInfo();
    }
    /////////////////////////////////////////
    // TAB 2
    /////////////////////////////////////////
    else if (tab.getPosition() == 1 && point != null) {
      ImageView im = (ImageView) findViewById(R.id.imageCam);
      if (chPhoto()) {
        Bitmap bitmap = BitmapFactory.decodeFile("/sdcard/iMedia/" + getPhotoName() + ".jpg");
        im.setImageBitmap(bitmap);
      } else {
        im.setVisibility(View.INVISIBLE);
      }
    }
    /////////////////////////////////////////
    // TAB 3
    /////////////////////////////////////////
    else if (tab.getPosition() == 2 && point != null) {

    }
    /////////////////////////////////////////
    // TAB 4
    /////////////////////////////////////////
    else if (tab.getPosition() == 3 && point != null) {
      // Inicialize map
      mapView = (MapView) findViewById(R.id.map);
      mMapController = mapView.getMapController();
      mOverlayManager = mMapController.getOverlayManager();
      mOverlay = new Overlay(mMapController);
      mMapController.setZoomCurrent(16);
      mMapController.setPositionNoAnimationTo(new GeoPoint(55.808613, 49.119530));
      mapView.showBuiltInScreenButtons(true);
      mOverlayManager.getMyLocation().setEnabled(true);

      if (point != null)
        mMapController.setPositionAnimationTo(new GeoPoint(point.getX(), point.getY()));

      Resources res = getResources();
      mOverlay.clearOverlayItems();
      OverlayItem p;

      p =
          new OverlayItem(
              new GeoPoint(point.getX(), point.getY()), res.getDrawable(R.drawable.point_g));
      mOverlay.addOverlayItem(p);

      mOverlayManager.addOverlay(mOverlay);
    }
  }