@Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    // INIT UI ELEMENTS
    appSpinner = (Spinner) view.findViewById(R.id.appMainEditSpinnerType);
    etDescr = (MaterialEditText) view.findViewById(R.id.appMainEditDescription);
    fabAppMainEdit = (ActionButton) getActivity().findViewById(R.id.fabMain);

    // FAB ANIMATION
    fabAppMainEdit = (ActionButton) getActivity().findViewById(R.id.fabMain);

    fabAppMainEdit.setImageResource(R.mipmap.ic_checked_white);
    fabAppMainEdit.setButtonColor(getResources().getColor(R.color.colorAccent));
    fabAppMainEdit.setButtonColorRipple(android.R.color.white);

    fabAppMainEdit.setShowAnimation(ActionButton.Animations.ROLL_FROM_RIGHT);
    fabAppMainEdit.setHideAnimation(ActionButton.Animations.ROLL_TO_RIGHT);

    fabAppMainEdit.hide();
    fabAppMainEdit.playShowAnimation();
    fabAppMainEdit.show();

    // LOAD DATA
    loadSpinnerData();
    loadDataFromSQLite();

    // LISTENERS
    fabAppMainEdit.setOnClickListener(this);
  }
  @Override
  public void onClick(View v) {
    switch (v.getId()) {
      case R.id.fabMain:
        fabAppMainEdit.hide();
        fabAppMainEdit.playHideAnimation();
        new Handler().postDelayed(getShowRunnable(), MainActivity.ACTION_BUTTON_POST_DELAY_MS);

        break;
    }
  }
Beispiel #3
0
 // Inicia el servicio de reproducción de la canción.
 private void reproducirCancion(int position) {
   lstCanciones.setItemChecked(position, true);
   // Se invalidan los datos paara que se actualice el icono en el elemento que deja de
   // estar reproduciendose y el que pasa a reproducirse.
   mAdaptador.notifyDataSetInvalidated();
   btnPlayStop.setImageResource(R.drawable.fab_stop);
   // Se inicia el servicio pasándole como extra la URL de la canción a reproducir.
   Cancion cancion = (Cancion) lstCanciones.getItemAtPosition(position);
   intentServicio.putExtra(MusicaOnlineService.EXTRA_URL_CANCION, cancion.getUrl());
   startService(intentServicio);
 }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View view = inflater.inflate(R.layout.fragment_single_tweet, container, false);

    up = (ActionButton) view.findViewById(R.id.single_tweet_button_up);
    up.removeShadow();
    up.setImageDrawable(getResources().getDrawable(R.drawable.ic_keyboard_arrow_up_white_36dp));
    up.setButtonColor(R.color.single_tweet_button);
    up.setOnClickListener(this);

    down = (ActionButton) view.findViewById(R.id.single_tweet_button_down);
    down.removeShadow();
    down.setImageDrawable(getResources().getDrawable(R.drawable.ic_keyboard_arrow_down_white_36dp));
    down.setButtonColor(R.color.single_tweet_button);
    down.setOnClickListener(this);

    pager = (VerticalViewPager) view.findViewById(R.id.vertical_view_pager);
    return view;
  }
Beispiel #5
0
 // Obtiene e inicializa las vistas.
 private void initVistas() {
   lstCanciones = (ListView) findViewById(R.id.lstCanciones);
   mAdaptador = new CancionesAdapter(this, getListaCanciones(), lstCanciones);
   lstCanciones.setAdapter(mAdaptador);
   lstCanciones.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
   lstCanciones.setOnItemClickListener(this);
   lstCanciones.setEmptyView(findViewById(R.id.rlListaVacia));
   btnPlayStop = (ActionButton) findViewById(R.id.btnPlayStop);
   btnPlayStop.setOnClickListener(
       new View.OnClickListener() {
         @Override
         public void onClick(View view) {
           if (lstCanciones.getCheckedItemPosition() == AdapterView.INVALID_POSITION) {
             reproducirCancion(0);
           } else {
             pararServicio();
           }
         }
       });
 }
 @Override
 public View onCreateView(
     LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
   // Inflate the layout for this fragment
   Log.i(TAG, "onCreateView");
   Log.d(TAG, "isAdded = " + isAdded());
   View view = inflater.inflate(R.layout.openhabdiscoveryinboxlist_fragment, container, false);
   mSwipeLayout = (SwipeRefreshLayout) view.findViewById(R.id.swipe_container);
   mSwipeLayout.setOnRefreshListener(this);
   discoveryButton = (ActionButton) view.findViewById(R.id.discovery_button);
   if (discoveryButton != null) {
     discoveryButton.setOnClickListener(
         new View.OnClickListener() {
           @Override
           public void onClick(View v) {
             Log.d(TAG, "Discovery button pressed");
             if (mActivity != null) {
               mActivity.openDiscovery();
             }
           }
         });
   }
   return view;
 }
 private void animateActionButtonVisibility(final boolean videoExist) {
   ActionButton videoBtn = binding.playVideoBtn;
   videoBtn.setEnabled(videoExist);
   Runnable r =
       () -> {
         // Button alpha may change during transition, we may have to wait until its end
         // to check its state.
         Timber.w("Action btn alpha: " + videoBtn.getAlpha());
         boolean actionBtnShouldAnimate =
             (videoExist && videoBtn.getAlpha() != 1) || (!videoExist && videoBtn.getAlpha() != 0);
         if (!actionBtnShouldAnimate) {
           return;
         }
         Animator alphaAnimator = AnimatorUtils.getAlphaAnimator(videoBtn, !videoExist);
         alphaAnimator.setDuration(600);
         alphaAnimator.start();
       };
   // Wait just in case transition is still in progress.
   videoBtn.postDelayed(r, ACTION_BUTTON_VISIBILITY_ANIM_DELAY);
 }
  protected void initViews(View layout) {

    // fab action button create
    ActionButton create = (ActionButton) layout.findViewById(R.id.create);
    create.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {

            final ProgressDialog dialog = new ProgressDialog(getActivity());
            dialog.setMessage("Connecting please wait...");
            dialog.setCancelable(false);
            dialog.show();
            FermatWorker worker =
                new FermatWorker() {
                  @Override
                  protected Object doInBackground() throws Exception {
                    List<ActorAssetIssuer> toConnect = new ArrayList<>();
                    for (ActorIssuer actorIssuer : actors) {
                      if (actorIssuer.selected) toConnect.add(actorIssuer.getRecord());
                    }
                    //// TODO: 20/11/15 get Actor asset issuer
                    manager.connectToActorAssetIssuer(null, toConnect);
                    return true;
                  }
                };
            worker.setContext(getActivity());
            worker.setCallBack(
                new FermatWorkerCallBack() {
                  @Override
                  public void onPostExecute(Object... result) {
                    dialog.dismiss();
                    if (swipeRefreshLayout != null)
                      swipeRefreshLayout.post(
                          new Runnable() {
                            @Override
                            public void run() {
                              onRefresh();
                            }
                          });
                  }

                  @Override
                  public void onErrorOccurred(Exception ex) {
                    dialog.dismiss();
                    Toast.makeText(
                            getActivity(),
                            String.format("An exception has been thrown: %s", ex.getMessage()),
                            Toast.LENGTH_LONG)
                        .show();
                    ex.printStackTrace();
                  }
                });
            worker.execute();

            //                return true;
            /* create new asset factory project */
            //                selectedAsset = null;
            //                changeActivity(Activities.DAP_ASSET_EDITOR_ACTIVITY.getCode(),
            // appSession.getAppPublicKey(), getAssetForEdit());
          }
        });
    create.setAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.fab_jump_from_down));
    create.setVisibility(View.VISIBLE);
  }
Beispiel #9
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();
  }
Beispiel #10
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();
    }
  }
Beispiel #11
0
 // Para el servicio y cambia el aspecto visual.
 private void pararServicio() {
   stopService(intentServicio);
   lstCanciones.setItemChecked(lstCanciones.getCheckedItemPosition(), false);
   btnPlayStop.setImageResource(R.drawable.fab_play);
 }