本文整理汇总了Java中de.keyboardsurfer.android.widget.crouton.Crouton类的典型用法代码示例。如果您正苦于以下问题:Java Crouton类的具体用法?Java Crouton怎么用?Java Crouton使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Crouton类属于de.keyboardsurfer.android.widget.crouton包,在下文中一共展示了Crouton类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import de.keyboardsurfer.android.widget.crouton.Crouton; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
context = this;
textView = (TextView) findViewById(R.id.textView);
button = (Button) findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Style style = new Style.Builder()
.setImageResource(R.mipmap.ic_launcher)
.setTextShadowRadius(10)
.setGravity(Gravity.CENTER)
.build();
Crouton.makeText((Activity) context, "data: ", style).show();
// Crouton.make((Activity) context, LayoutInflater.from(context).inflate(R.layout.crouton_view, null), R.id.content).show();
requestJSON();
}
});
}
示例2: showStorageToast
import de.keyboardsurfer.android.widget.crouton.Crouton; //导入依赖的package包/类
public static void showStorageToast(Activity activity, int remaining) {
String noStorageText = null;
if (remaining == NO_STORAGE_ERROR) {
String state = Environment.getExternalStorageState();
if (state.equals(Environment.MEDIA_CHECKING)) {
noStorageText = activity.getString(R.string.preparing_card);
} else {
noStorageText = activity.getString(R.string.no_storage_card);
}
} else if (remaining < 1) {
noStorageText = activity.getString(R.string.not_enough_space);
}
if (noStorageText != null) {
Crouton.makeText(activity, noStorageText, Style.ALERT).show();
}
}
示例3: createPlaceRequestErrorListener
import de.keyboardsurfer.android.widget.crouton.Crouton; //导入依赖的package包/类
private Response.ErrorListener createPlaceRequestErrorListener() {
return new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
if (BuildConfig.DEBUG) {
Log.e(YourApplication.LOG_TAG, "PlaceRemoteProvider.onErrorResponse", error.getCause());
}
PlaceRemoteProvider.this.mRequestRunning = false ;
Crouton.makeText(
PlaceRemoteProvider.this.mFragment.getActivity(),
PlaceRemoteProvider.this.mFragment.getString(R.string.error_retrievingdata),
Style.ALERT).show();
}
};
}
示例4: createAirportRequestErrorListener
import de.keyboardsurfer.android.widget.crouton.Crouton; //导入依赖的package包/类
private Response.ErrorListener createAirportRequestErrorListener() {
return new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
if (BuildConfig.DEBUG) {
Log.i(YourApplication.LOG_TAG, "AirportListFragment.onErrorResponse");
}
AirportListFragment.this.mSwipeRefreshWidget.setRefreshing(false);
AirportListFragment.this.mRequestRunning = false ;
if ( !isDetached()) {
Crouton.makeText(
AirportListFragment.this.getActivity(),
getString(R.string.error_retrievingdata),
Style.ALERT).show();
}
}
};
}
示例5: removePassword
import de.keyboardsurfer.android.widget.crouton.Crouton; //导入依赖的package包/类
private void removePassword() {
unlockAllNotes();
passwordCheck.setText("");
password.setText("");
question.setText("");
answer.setText("");
answerCheck.setText("");
prefs.edit()
.remove(Constants.PREF_PASSWORD)
.remove(Constants.PREF_PASSWORD_QUESTION)
.remove(Constants.PREF_PASSWORD_ANSWER)
.remove("settings_password_access")
.apply();
Crouton.makeText(mActivity, R.string.password_successfully_removed,
ONStyle.ALERT, crouton_handle).show();
}
示例6: enableLocationCapture
import de.keyboardsurfer.android.widget.crouton.Crouton; //导入依赖的package包/类
public void enableLocationCapture(int action){
expectingLocation = true;
expectingAction = action;
int msg_res;
switch (action) {
case ACTION_NEW_PIN: msg_res = R.string.tap_to_pin;
break;
case ACTION_GET_ORIGIN: msg_res = R.string.tap_origin;
break;
case ACTION_GET_DESTINATION: msg_res = R.string.tap_destination;
break;
default: msg_res = R.string.error;
break;
}
final Crouton crouton = Crouton.makeText(this, msg_res, new Style.Builder()
.setBackgroundColorValue(getResources().getColor(R.color.purple)).setHeight(getActionbarHeight()).build(),
(RelativeLayout)findViewById(R.id.root_layout))
.setConfiguration(new Configuration.Builder().setDuration(Configuration.DURATION_INFINITE).build());
crouton.show();
}
示例7: onMapClick
import de.keyboardsurfer.android.widget.crouton.Crouton; //导入依赖的package包/类
/**
* This callback is executed when a click occurs somewhere in map.
* If there is
* @param point
*/
@Override
public void onMapClick(LatLng point) {
if(expectingLocation){
Crouton.cancelAllCroutons();
expectingLocation=false;
if(expectingAction == ACTION_NEW_PIN){
new EditPinDialog(this, new Place(point.latitude, point.longitude), this).show();
expectingAction = ACTION_NONE;
}
else if(expectingAction == ACTION_GET_ORIGIN){
new ReverseGeocodingTask(getBaseContext()).execute(point.latitude, point.longitude);
}
else if(expectingAction == ACTION_GET_DESTINATION){
new ReverseGeocodingTask(getBaseContext()).execute(point.latitude, point.longitude);
}
}
else{
removeSelectedMarker();
}
}
示例8: onSubmit
import de.keyboardsurfer.android.widget.crouton.Crouton; //导入依赖的package包/类
/**
* This executed when place data are submitted through the dialog.
*/
@Override
public void onSubmit(Place place) {
if(place!=null && place.isValid()){
int id = (int) db.insertOrReplacePlace(place);
if(place.isNew()){
place.setId(id);
PlaceMarker pm = PlaceMarker.fromPlace(place);
mClusterManager.addItem(pm);
mClusterManager.cluster();
}
else{
removeSelectedMarker();
reloadItems();
}
Crouton.makeText(this, R.string.pin_saved, Style.CONFIRM, (RelativeLayout)findViewById(R.id.root_layout)).show();
}
}
示例9: onQuerySuccess
import de.keyboardsurfer.android.widget.crouton.Crouton; //导入依赖的package包/类
/**
* Ответ от сервера
* @param res
*/
@Override
public void onQuerySuccess(ShikiStatusResult res) {
if(activity == null)
return;
activity.getAC().getLoaderController().hide();
// success auth
if(res.isSuccess() && activity.getAC().getShikiUser().getId()!=null){
activity.startActivity(new Intent(activity, MainActivity.class));
activity.finish();
// error auth
} else if(res.isError() && !TextUtils.isEmpty(res.getMsg())){
Crouton.cancelAllCroutons();
Crouton.makeText(activity, res.getMsg(), Style.ALERT).show();
}
}
示例10: onClick
import de.keyboardsurfer.android.widget.crouton.Crouton; //导入依赖的package包/类
@Override
public void onClick(View v) {
if (v.getId() == R.id.bLoadApk) {
if(versionUrl == null){
Crouton.showText(activity, R.string.url_apk_notfound, Style.ALERT);
return;
}
h.setVisible(pbLoaderApk);
h.setVisibleGone(bLoadApk);
permission.checkPermission(PermissionSontroller.WRITE_EXTERNAL_STORAGE, new BasePermissionController.OnRequestPermission() {
@Override
public void requestDone(boolean allow) {
if(allow){
new UpdateApp(activity)
.setProgresListener(AboutFragment.this)
.startLoad(versionUrl);
} else {
h.setVisibleGone(pbLoaderApk);
h.setVisible(bLoadApk);
h.showMsg(activity, R.string.access_sd);
}
}
});
}
}
示例11: onLoginSuccess
import de.keyboardsurfer.android.widget.crouton.Crouton; //导入依赖的package包/类
@Override
public void onLoginSuccess(final int networkId) {
((StatisticsActivity) getActivity()).hideProgress();
SocialNetwork socialNetwork = mSocialNetworkManager.getSocialNetwork(networkId);
if (networkId == GooglePlusSocialNetwork.ID
&& !ConnChecker.isOnline(getActivity())) {
socialNetwork.logout();
Crouton.makeText(getActivity(),
getActivity().getString(R.string.wrong_msg), Style.INFO).show();
return;
}
setLoginState(true, networkId);
socialNetwork.setOnRequestCurrentPersonCompleteListener(this);
socialNetwork.requestCurrentPerson();
aQuery.id(R.id.share).enabled(true);
}
示例12: onActivityResult
import de.keyboardsurfer.android.widget.crouton.Crouton; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case REQ_CODE_SPEECH_INPUT: {
if (resultCode == RESULT_OK && data != null) {
ArrayList<String> result = data
.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
gameHandler.sendResultToHandler(result.get(0));
} else {
Crouton.makeText(this, getString(R.string.error_with_input), Style.INFO).show();
gameHandler.skip();
}
break;
}
}
}
示例13: onError
import de.keyboardsurfer.android.widget.crouton.Crouton; //导入依赖的package包/类
@Override
public void onError(Exception exc)
{
if (progressDialog != null && progressDialog.isShowing())
{
progressDialog.dismiss();
}
Log.d("AuthResult", exc.getClass().getName() + " err " + exc.getLocalizedMessage());
if (exc instanceof AuthenticationCancelError)
{
SinglePaneActivity.start(IntroductionFragment.class, this);
finish();
}
else
{
/**
* If activity destroyed, just do nothing
*/
if (!isDestoryed)
{
Crouton.makeText(this, R.string.login_error, Style.ALERT).show();
}
}
}
示例14: onAccountResetSent
import de.keyboardsurfer.android.widget.crouton.Crouton; //导入依赖的package包/类
@Subscribe
public void onAccountResetSent(OnAccountPasswordResetEvent event) {
Crouton c = getInfoCrouton(getString(R.string.reset_link_sent));
c.setLifecycleCallback(new LifecycleCallback() {
@Override
public void onDisplayed() {
}
@Override
public void onRemoved() {
finish();
}
});
c.show();
}
示例15: aPlusB
import de.keyboardsurfer.android.widget.crouton.Crouton; //导入依赖的package包/类
/**
* Set up for "Incorrect Dimensions" Crouton
*
**/
public void aPlusB(View view) {
CreateA_Array();
CreateB_Array();
if (matrix_A_array.length == matrix_B_array.length &&
matrix_A_array[0].length == matrix_B_array[0].length) {
if (dimension_good) Equal_AplusB();
if (dimension_good) SetResult();
if (dimension_good) ShowResultDialog();
} else {
Configuration croutonConfiguration = new Configuration.Builder().setDuration(700).build();
Style croutonStyle = new Style.Builder()
.setConfiguration(croutonConfiguration)
.setBackgroundColorValue(getResources().getColor(R.color.crouton_color))
.build();
String croutonText = getString(R.string.crouton_incorrect_dimension);
Crouton.showText(this, croutonText, croutonStyle);
// Crouton.showText(this, getString(R.string.crouton_incorrect_dimension), Style.ALERT);
}
}