@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 boolean onPreferenceClick(Preference preference) { SearchHistoryProvider.clearHistory(getApplicationContext()); Crouton.showText( SystemSettingsActivity.this, R.string.pref_clearsearch_success, NavigationHelper.CROUTON_INFO_STYLE); 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); } }
@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(); }
/** * Creates a {@link Crouton} with provided text-resource and style for a given activity and * displays it directly. * * @param activity The {@link Activity} that represents the context in which the Crouton should * exist. * @param textResourceId The resource id of the text you want to display. * @param style The style that this {@link Crouton} should be created with. * @param viewGroupResId The resource id of the {@link ViewGroup} that this {@link Crouton} should * be added to. */ public static void showText( Activity activity, int textResourceId, Style style, int viewGroupResId) { showText(activity, activity.getString(textResourceId), style, viewGroupResId); }
/** * Creates a {@link Crouton} with provided text-resource and style for a given activity and * displays it directly. * * @param activity The {@link Activity} that the {@link Crouton} should be attached to. * @param textResourceId The resource id of the text you want to display. * @param style The style that this {@link Crouton} should be created with. */ public static void showText(Activity activity, int textResourceId, Style style) { showText(activity, activity.getString(textResourceId), style); }
@UiThread public void displayCrouton(FragmentActivity activity, Integer resourceId, Style style) { Crouton.showText(activity, resourceId, style); }