Esempio n. 1
0
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    fContext = getActivity().getApplicationContext();
    mActivity = (MainActivity) getActivity();
    //        bottomPanel = (LinearLayout) rootView.findViewById(R.id.bottomPanelPhoto);
    progress = (DonutProgress) rootView.findViewById(R.id.donut_progress);
    progress.setVisibility(View.GONE);
    btnSave = (ActionButton) rootView.findViewById(R.id.aBtnSave);

    btnSave.setImageResource(R.drawable.ic_check);
    btnSave.setButtonColor(Color.TRANSPARENT);
    btnSave.setStrokeColor(Color.GREEN);
    btnSave.setStrokeWidth(3.0f);
    btnSave.setButtonColorPressed(Color.LTGRAY);
    btnSave.removeShadow();
    btnSave.setType(ActionButton.Type.BIG);
    btnSave.setShowAnimation(ActionButton.Animations.FADE_IN);
    btnSave.setHideAnimation(ActionButton.Animations.FADE_OUT);
    btnSave.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            new SendFilesTask().execute();
          }
        });
    btnCancel = (ActionButton) rootView.findViewById(R.id.aBtnBack);
    btnCancel.setImageResource(R.drawable.ic_cancel);
    btnCancel.setButtonColor(Color.TRANSPARENT);
    btnCancel.setStrokeColor(Color.RED);
    btnCancel.setStrokeWidth(3.0f);
    btnCancel.setButtonColorPressed(Color.LTGRAY);
    btnCancel.removeShadow();
    btnCancel.setType(ActionButton.Type.BIG);
    btnCancel.setShowAnimation(ActionButton.Animations.FADE_IN);
    btnCancel.setHideAnimation(ActionButton.Animations.FADE_OUT);
    btnCancel.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            btnCancel.playHideAnimation();
            btnSave.playHideAnimation();
            mActivity.onBackPressed();
          }
        });
    imgView = (ImageView) rootView.findViewById(R.id.imgView);
    try {
      ImageLoader.getInstance().displayImage("file:///mnt/" + bmp, imgView);
    } catch (Exception e) {

    }
    mActivity.setIsFAB(false);
    mActivity.updateFAB();
    if (savedInstanceState == null) {
      startAnimation();
    }
  }
Esempio n. 2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mLocationmanager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    if (!mLocationmanager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
      final AlertDialog.Builder builder = new AlertDialog.Builder(this);
      final String action = Settings.ACTION_LOCATION_SOURCE_SETTINGS;
      final String message = "Por favor habilite su GPS";

      builder
          .setMessage(message)
          .setPositiveButton(
              "OK",
              new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface d, int id) {
                  startActivity(new Intent(action));
                  d.dismiss();
                }
              })
          .setNegativeButton(
              "Cancelar",
              new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface d, int id) {
                  d.cancel();
                  finish();
                }
              });
      builder.create().show();
    }

    setContentView(R.layout.activity_maps);
    ButterKnife.bind(this);

    actionButton.setImageResource(R.drawable.qrtr);
    actionButton.setImageSize(50);
    actionButton.setButtonColor(Color.WHITE);
    actionButton.setButtonColorPressed(Color.WHITE);
    actionButton.setRippleEffectEnabled(true);
    actionButton.setShowAnimation(ActionButton.Animations.ROLL_FROM_RIGHT);
    actionButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Intent i = new Intent(AdminMapsActivity.this, qrScannerActivity.class);
            startActivity(i);
          }
        });

    mGoogleApiClient =
        new GoogleApiClient.Builder(this)
            .addConnectionCallbacks(this)
            .addOnConnectionFailedListener(this)
            .addApi(LocationServices.API)
            .build();
    mLocationRequest =
        LocationRequest.create()
            .setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY)
            .setInterval(10 * 1000) // 10 seconds, in milliseconds
            .setFastestInterval(1 * 1000); // 1 second, in millisecond
    mLocationListener =
        new com.google.android.gms.location.LocationListener() {
          @Override
          public void onLocationChanged(Location location) {
            handleNewLocation(location);
          }
        };

    mGoogleApiClient.connect();
    setUpMapIfNeeded();
  }