private static void showTip(
     Activity activity,
     String tip,
     View.OnClickListener secondButtonListener,
     String secondButtonTitle) {
   tipTextView.setText(tip);
   final Crouton crouton = Crouton.make(activity, tipView);
   crouton.setConfiguration(CONFIGURATION_INFINITE);
   crouton.show();
   tipButton.setOnClickListener(
       new View.OnClickListener() {
         @Override
         public void onClick(View v) {
           crouton.hide();
         }
       });
   if (secondButtonListener != null) {
     tipAlternativeButton.setVisibility(View.VISIBLE);
     tipAlternativeButton.setOnClickListener(secondButtonListener);
     tipAlternativeButton.setText(secondButtonTitle);
     tipAlternativeButton.setOnTouchListener(
         new View.OnTouchListener() {
           @Override
           public boolean onTouch(View v, MotionEvent event) {
             crouton.hide();
             return false;
           }
         });
   } else {
     tipAlternativeButton.setVisibility(View.GONE);
   }
 }
  @Override
  public void refresh() {
    if (!ConnectivityUtils.hasNetwork(getActivity())) {
      if (mi != null) {
        mi.setActionView(null);
      }
      if (!ConnectivityUtils.hasNetwork(getActivity())) {
        Crouton.cancelAllCroutons();
        Crouton.showText(
            getActivity(),
            Html.fromHtml(
                getString(org.alfresco.mobile.android.foundation.R.string.error_session_nodata)),
            Style.INFO,
            (ViewGroup) (getRootView().getParent()));
      }
      refreshHelper.setRefreshComplete();
      return;
    }

    SyncContentManager.getInstance(getActivity()).sync(acc);
    if (mi != null) {
      // Display spinning wheel instead of refresh
      mi.setActionView(R.layout.app_spinning);
    }

    if (adapter != null) {
      ((SyncCursorAdapter) adapter).refresh();
      gv.setAdapter(adapter);
    }
  }
  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {

    if (requestCode == 1) {

      Style primaryBlue =
          new Style.Builder()
              .setBackgroundColorValue(getResources().getColor(R.color.primary))
              .build();

      if (resultCode == AddMovementActivity.RESULT_EDIT) {
        Crouton.makeText(getActivity(), getString(R.string.Updated), primaryBlue, croutonParent)
            .show();
      } else if (resultCode == AddMovementActivity.RESULT_ADDED) {
        Crouton.makeText(getActivity(), getString(R.string.Added), primaryBlue, croutonParent)
            .show();
      } else if (resultCode == AddMovementActivity.RESULT_ADDED_WITH_REPEATING) {
        // Crouton.makeText(getActivity(),"Added with repeating",primaryBlue ,croutonParent).show();
      } else if (resultCode == AddMovementActivity.RESULT_CANCELLED) {
        Crouton.makeText(getActivity(), getString(R.string.Cancelled), primaryBlue, croutonParent)
            .show();
      }

      cursorCardAdapter.swapCursor(
          dbHelper.getMovementsOfWallet(
              Utils.getDefaultWalletIdPref(getActivity()), Const.KEY_MOVEMENT_DATE, true));
    }
  }
  public void connect(View v) {
    initData();

    if (checkFields()) {
      if (email.matches("^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[a-zA-Z]{2,4}$")) {
        //				if (AppointmentsApp.httpRequest(this))
        authentification(email, password);
      } else Crouton.makeText(this, R.string.toast_error_email, Style.ALERT).show();
    } else Crouton.makeText(this, R.string.toast_fields_empty, Style.ALERT).show();
  }
 public void showMessage(String message, Style style) {
   if (croutonViewContainer == null) {
     // ViewGroup used to show Crouton keeping compatibility with the new Toolbar
     croutonViewContainer = (ViewGroup) findViewById(R.id.crouton_handle);
   }
   Crouton.makeText(this, message, style, croutonViewContainer).show();
 }
 @Override
 protected void onDestroy() {
   // TODO Auto-generated method stub
   // Protect crouton
   Crouton.clearCroutonsForActivity(this);
   super.onDestroy();
 }
Example #7
0
 @Override
 protected void onDestroy() {
   // Workaround until there's a way to detach the Activity from Crouton while
   // there are still some in the Queue.
   Crouton.clearCroutonsForActivity(this);
   super.onDestroy();
 }
 @Override
 public boolean onPreferenceClick(Preference preference) {
   SearchHistoryProvider.clearHistory(getApplicationContext());
   Crouton.showText(
       SystemSettingsActivity.this,
       R.string.pref_clearsearch_success,
       NavigationHelper.CROUTON_INFO_STYLE);
   return true;
 }
  private void getUserDetails() {
    CharSequence cs;
    firstname = edit_firstname.getText().toString().trim();
    lastname = edit_lastname.getText().toString().trim();
    username = edit_username.getText().toString().trim();
    email = edit_email.getText().toString().trim();
    dob = text_dob.getText().toString().trim();
    password = edit_password.getText().toString().trim();

    cs = (CharSequence) email;

    if (firstname.length() < 4) {
      edit_firstname.setError("Enter atleast 4 characters");
    }
    if (username.length() < 6) {
      edit_username.setError("Enter atleast 6 characters");
    }
    if (password.length() < 6) {
      edit_password.setError("Enter atleast 6 characters");
    }
    if (!isEmailValid(cs)) {
      edit_email.setError("Enter a valid email");
    }

    if (spinner_gender.getSelectedItemPosition() <= 0) {
      Toast.makeText(RegisterNormal.this, "Please select the gender", Toast.LENGTH_SHORT).show();
    }

    if (dob.length() <= 0) {
      Toast.makeText(RegisterNormal.this, "Please select the DOB", Toast.LENGTH_SHORT).show();
    }

    if (firstname.length() > 4
        && (username.length() >= 6)
        && (password.length() >= 6)
        && (isEmailValid(cs))
        && (spinner_gender.getSelectedItemPosition() > 0)
        && dob.length() > 0) {
      if (terms_check.isChecked()) {
        // call for async for registering the user
        ConnectionDetector conn = new ConnectionDetector(RegisterNormal.this);
        if (conn.isConnectingToInternet()) {
          new Register().execute();
        } else {
          Crouton.makeText(RegisterNormal.this, getString(R.string.crouton_message), Style.ALERT)
              .show();
        }
      } else {
        Toast.makeText(RegisterNormal.this, "Accept the terms and conditions", Toast.LENGTH_SHORT)
            .show();
      }
    } else {
      // Toast.makeText(RegisterNormal.this,"Enter valid details",Toast.LENGTH_LONG).show();
    }
  }
 private boolean verifyInputs(String email, String password, String repassword) {
   if (TextUtils.isEmpty(email)) {
     ViewAnimation.blink(this, ed_email);
     Crouton.cancelAllCroutons();
     AppSnackBar.showTopSnackbar(this, getString(R.string.BR_SIGN_005), Color.RED, Color.WHITE);
     return false;
   } else if (!mValidator.isValidEmail(email)) {
     ViewAnimation.blink(this, ed_email);
     Crouton.cancelAllCroutons();
     AppSnackBar.showTopSnackbar(this, getString(R.string.BR_GNL_002), Color.RED, Color.WHITE);
     return false;
   } else if (TextUtils.isEmpty(password)) {
     ViewAnimation.blink(this, ed_new_password);
     Crouton.cancelAllCroutons();
     AppSnackBar.showTopSnackbar(this, getString(R.string.BR_SIGN_002), Color.RED, Color.WHITE);
     return false;
   } else if (!mValidator.isValidPassword(password)) {
     ViewAnimation.blink(this, ed_new_password);
     Crouton.cancelAllCroutons();
     AppSnackBar.showTopSnackbar(this, getString(R.string.BR_GNL_003), Color.RED, Color.WHITE);
     return false;
   } else if (TextUtils.isEmpty(repassword)) {
     ViewAnimation.blink(this, ed_repassword);
     Crouton.cancelAllCroutons();
     AppSnackBar.showTopSnackbar(this, getString(R.string.BR_SIGN_003), Color.RED, Color.WHITE);
     return false;
   } else if (!mValidator.isPasswordsMatched(password, repassword)) {
     ViewAnimation.blink(this, ed_new_password);
     ViewAnimation.blink(this, ed_repassword);
     Crouton.cancelAllCroutons();
     AppSnackBar.showTopSnackbar(this, getString(R.string.BR_SIGN_006), Color.RED, Color.WHITE);
     return false;
   }
   return true;
 }
 @Override
 public void onClick(DialogInterface dialog, int which) {
   SharedPreferences prefs =
       PreferenceManager.getDefaultSharedPreferences(SystemSettingsActivity.this);
   try {
     settingsPersistence.exportSettings(prefs, SettingsPersistence.DEFAULT_SETTINGS_FILE);
     Crouton.showText(
         SystemSettingsActivity.this,
         R.string.pref_export_success,
         NavigationHelper.CROUTON_INFO_STYLE);
   } catch (JSONException e) {
     Crouton.showText(
         SystemSettingsActivity.this,
         R.string.error_cant_write_settings_file,
         NavigationHelper.CROUTON_ERROR_STYLE);
   } catch (IOException e) {
     Crouton.showText(
         SystemSettingsActivity.this,
         R.string.error_cant_write_settings_file,
         NavigationHelper.CROUTON_ERROR_STYLE);
   }
 }
 @Override
 public void onClick(DialogInterface dialog, int which) {
   SharedPreferences prefs =
       PreferenceManager.getDefaultSharedPreferences(SystemSettingsActivity.this);
   try {
     settingsPersistence.importSettings(prefs, SettingsPersistence.DEFAULT_SETTINGS_FILE);
     Crouton.showText(
         SystemSettingsActivity.this,
         R.string.pref_import_success,
         NavigationHelper.CROUTON_INFO_STYLE);
   } catch (FileNotFoundException e) {
     Crouton.showText(
         SystemSettingsActivity.this,
         R.string.error_file_not_found,
         NavigationHelper.CROUTON_ERROR_STYLE);
   } catch (JSONException e) {
     Crouton.showText(
         SystemSettingsActivity.this,
         getString(R.string.error_no_valid_settings_file, getString(R.string.app_name)),
         NavigationHelper.CROUTON_ERROR_STYLE);
   }
 }
Example #13
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {

    switch (item.getItemId()) {
      case R.id.menu_add:
        Intent intent = new Intent(this, AddActivity.class);
        startActivity(intent);
        return true;
      case R.id.action_map:
        Crouton.makeText(this, "map works", Style.INFO).show();
        return true;
      case R.id.action_calendar:
        Crouton.makeText(this, "calendar works", Style.INFO).show();
        return true;
      case R.id.action_list:
        Crouton.makeText(this, "list works", Style.INFO).show();

        return true;
      default:
        return super.onOptionsItemSelected(item);
    }
  }
    @Override
    public void onDrawerOpened(View drawerView) {
      super.onDrawerOpened(drawerView);

      Crouton.cancelAllCroutons();

      baseActivity.invalidateOptionsMenu();

      if (!userLearnedDrawer) {
        userLearnedDrawer = true;
        saveUserLearnedDrawer();
      }

      navigationDrawerCounterListener.onUpdateCountUnreadDialogs(getCountUnreadDialogs());
    }
 @SuppressWarnings("deprecation")
 protected void storeScgiMountFolder(String result) {
   Editor edit =
       PreferenceManager.getDefaultSharedPreferences(XirvikSharedSettingsActivity.this).edit();
   EditTextPreference pref =
       (EditTextPreference) findPreference("seedbox_xirvikshared_rpc_" + key);
   if (result == null) {
     Crouton.showText(
         this, R.string.pref_seedbox_xirviknofolder, NavigationHelper.CROUTON_ERROR_STYLE);
     edit.remove("seedbox_xirvikshared_rpc_" + key);
     pref.setSummary("");
   } else {
     edit.putString("seedbox_xirvikshared_rpc_" + key, result);
     pref.setSummary(result);
   }
   edit.commit();
 }
 @Override
 public void onLoadFinished(Loader<Result<Credential>> loader, Result<Credential> result) {
   if (loader.getId() == LOADER_GET_TOKEN) {
     message.setText(result.success ? result.data.getAccessToken() : "");
   } else {
     message.setText("");
   }
   if (result.success) {
     if (loader.getId() == LOADER_GET_TOKEN) {
       setButtonText(R.string.delete_token);
     } else {
       setButtonText(R.string.get_token);
     }
   } else {
     setButtonText(R.string.get_token);
     Crouton.makeText(getActivity(), result.errorMessage, Style.ALERT).show();
   }
   getActivity().setProgressBarIndeterminateVisibility(false);
   button.setEnabled(true);
 }
 public void onEventMainThread(RequestFailure requestFailure) {
   Crouton.makeText(this, requestFailure.getThrowable().getMessage(), Style.ALERT).show();
 }
 public void serverError() {
   Crouton.makeText(this, getString(R.string.serv_error), Style.ALERT).show();
 }
 public void errorPlayingVideo() {
   Crouton.makeText(this, getString(R.string.play_error), Style.ALERT).show();
 }
Example #20
0
 @Override
 protected void onPause() {
   super.onPause();
   Crouton.cancelAllCroutons();
 }
 public void connectionError() {
   Crouton.makeText(this, getString(R.string.conn_error), Style.ALERT).show();
 }
Example #22
0
 /**
  * Allows hiding of a previously displayed {@link Crouton}.
  *
  * @param crouton The {@link Crouton} you want to hide.
  */
 public static void hide(Crouton crouton) {
   crouton.hide();
 }
Example #23
0
 /** Clean the file cache when root activity exits. */
 @Override
 protected void onDestroy() {
   super.onDestroy();
   if (Constants.DEBUG) Log.d(getLogTag(), "onDestroy");
   Crouton.cancelAllCroutons();
 }
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   Crouton.makeText(this, "Teste", Style.CONFIRM).show();
 }
Example #25
0
 private void showSettings() {
   Crouton.makeText(this, R.string.settingText, Style.INFO).show();
 }
Example #26
0
 public void showAbout() {
   Crouton.makeText(this, R.string.aboutText, Style.INFO).show();
 }
Example #27
0
 @UiThread
 public void displayCrouton(FragmentActivity activity, Integer resourceId, Style style) {
   Crouton.showText(activity, resourceId, style);
 }
 @Override
 protected void onDestroy() {
   super.onDestroy();
   Crouton.cancelAllCroutons();
 }
 /** calls delete on content provider passing in current uri */
 public void deleteRecord() {
   getContentResolver().delete(todoUri, null, null);
   Crouton.makeText(this, "Record Deleted", Style.CONFIRM).show();
   //        Toast.makeText(this,"Record Deleted",Toast.LENGTH_SHORT).show();
   returnToParentActivity();
 }
Example #30
0
 private void showCrouton(String croutonText, Style croutonStyle, Configuration configuration) {
   Crouton.makeText(getActivity(), croutonText, croutonStyle).show();
 }