List of usage examples for android.content Context getString
@NonNull public final String getString(@StringRes int resId)
From source file:fr.shywim.antoinedaniel.utils.Utils.java
/** * Unlock an achievement if it is not already unlocked * * @param context Any context.//from w w w. j a va2s . c o m * @param resid Achievement's id. */ public void unlockAchievement(Context context, int resid) { String id = context.getString(resid); if (apiClient != null && this.apiClient.isConnected()) { AnalyticsUtils.sendEvent(context.getString(R.string.ana_cat_game), context.getString(R.string.ana_act_unique_achiev), id); Games.Achievements.unlock(apiClient, id); } }
From source file:com.rothconsulting.android.websms.connector.orange.ConnectorOrange.java
/** * {@inheritDoc}/*from w w w. j ava 2s . co m*/ */ @Override public final ConnectorSpec initSpec(final Context context) { final String name = context.getString(R.string.connector_orange_name); ConnectorSpec c = new ConnectorSpec(name); c.setAuthor(context.getString(R.string.connector_orange_author)); c.setBalance(null); c.setLimitLength(140); c.setAdUnitId(AD_UNITID); c.setCapabilities(ConnectorSpec.CAPABILITIES_BOOTSTRAP | ConnectorSpec.CAPABILITIES_UPDATE | ConnectorSpec.CAPABILITIES_SEND | ConnectorSpec.CAPABILITIES_PREFS); c.addSubConnector("orange", c.getName(), SubConnectorSpec.FEATURE_MULTIRECIPIENTS); return c; }
From source file:com.emuneee.nctrafficcams.tasks.GetLatestCameras.java
public GetLatestCameras(Context context, CameraDBHelper helper, OnFinishListener listener) { mContext = context;//from w w w .ja v a2 s . c o m mDBHelper = helper; mListener = listener; mBaseUrl = mBaseUrl.replace("[hostname]", context.getString(R.string.hostname)); mBaseUrl = mBaseUrl.replace("[port]", context.getString(R.string.port)); }
From source file:org.herrlado.websms.connector.smsge.ConnectorSmsge.java
/** * {@inheritDoc}//w w w. j a va2 s.c o m */ @Override public final ConnectorSpec initSpec(final Context context) { final String name = context.getString(R.string.smsge_name); final ConnectorSpec c = new ConnectorSpec(name); c.setAuthor(// . context.getString(R.string.smsge_author)); c.setBalance(null); // c.setPrefsTitle(context.getString(R.string.preferences)); c.setCapabilities(ConnectorSpec.CAPABILITIES_UPDATE | ConnectorSpec.CAPABILITIES_SEND | ConnectorSpec.CAPABILITIES_PREFS); c.addSubConnector(TAG, c.getName(), SubConnectorSpec.FEATURE_CUSTOMSENDER); return c; }
From source file:com.android.phone.common.mail.store.ImapFolder.java
/** * Removes any content transfer encoding from the stream and returns a Body. * This code is taken/condensed from MimeUtility.decodeBody */// w w w . j ava 2 s . c o m private static Body decodeBody(Context context, InputStream in, String contentTransferEncoding, int size, MessageRetrievalListener listener) throws IOException { // Get a properly wrapped input stream in = MimeUtility.getInputStreamForContentTransferEncoding(in, contentTransferEncoding); BinaryTempFileBody tempBody = new BinaryTempFileBody(); OutputStream out = tempBody.getOutputStream(); try { byte[] buffer = new byte[COPY_BUFFER_SIZE]; int n = 0; int count = 0; while (-1 != (n = in.read(buffer))) { out.write(buffer, 0, n); count += n; } } catch (Base64DataException bde) { String warning = "\n\n" + context.getString(R.string.message_decode_error); out.write(warning.getBytes()); } finally { out.close(); } return tempBody; }
From source file:com.vmihalachi.turboeditor.adapter.AdapterDetailedList.java
public AdapterDetailedList(final Context context, final LinkedList<FileDetail> fileDetails, final boolean isRoot) { super(context, R.layout.item_file_list, fileDetails); this.fileDetails = fileDetails; this.inflater = LayoutInflater.from(context); if (!isRoot) { this.fileDetails.addFirst(new FileDetail("..", context.getString(R.string.folder), "")); } else {/*from w w w . ja v a 2s. c o m*/ this.fileDetails.addFirst( new FileDetail(context.getString(R.string.home), context.getString(R.string.folder), "")); } }
From source file:com.rothconsulting.android.websms.connector.hispeed.ConnectorHispeed.java
/** * {@inheritDoc}//from w w w. j a v a 2 s . c o m */ @Override public final ConnectorSpec initSpec(final Context context) { final String name = context.getString(R.string.connector_hispeed_name); ConnectorSpec c = new ConnectorSpec(name); c.setAuthor(context.getString(R.string.connector_hispeed_author)); c.setBalance(""); c.setLimitLength(1539); c.setAdUnitId(AD_UNITID); c.setCapabilities(ConnectorSpec.CAPABILITIES_BOOTSTRAP | ConnectorSpec.CAPABILITIES_UPDATE | ConnectorSpec.CAPABILITIES_SEND | ConnectorSpec.CAPABILITIES_PREFS); c.addSubConnector("hispeed", c.getName(), SubConnectorSpec.FEATURE_MULTIRECIPIENTS); return c; }
From source file:com.keylesspalace.tusky.util.NotificationManager.java
public static void createNotificationChannels(Context context) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { android.app.NotificationManager mNotificationManager = (android.app.NotificationManager) context .getSystemService(Context.NOTIFICATION_SERVICE); String[] channelIds = new String[] { CHANNEL_MENTION, CHANNEL_FOLLOW, CHANNEL_BOOST, CHANNEL_FAVOURITE };/*from w w w. j av a 2 s. co m*/ int[] channelNames = { R.string.notification_channel_mention_name, R.string.notification_channel_follow_name, R.string.notification_channel_boost_name, R.string.notification_channel_favourite_name }; int[] channelDescriptions = { R.string.notification_channel_mention_descriptions, R.string.notification_channel_follow_description, R.string.notification_channel_boost_description, R.string.notification_channel_favourite_description }; List<NotificationChannel> channels = new ArrayList<>(4); for (int i = 0; i < channelIds.length; i++) { String id = channelIds[i]; String name = context.getString(channelNames[i]); String description = context.getString(channelDescriptions[i]); int importance = android.app.NotificationManager.IMPORTANCE_DEFAULT; NotificationChannel channel = new NotificationChannel(id, name, importance); channel.setDescription(description); channel.enableLights(true); channel.enableVibration(true); channel.setShowBadge(true); channels.add(channel); } //noinspection ConstantConditions mNotificationManager.createNotificationChannels(channels); } }
From source file:edu.mit.mobile.android.locast.net.NetworkClient.java
public static String getBaseUrlFromPreferences(Context context) { final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); return prefs.getString(NetworkClient.PREF_SERVER_URL, context.getString(R.string.default_api_url)); }
From source file:com.gmail.altakey.lucene.AsyncImageLoader.java
protected void onPreExecute() { Context context = this.view.getContext(); this.httpClient = AndroidHttpClient.newInstance(this.getUserAgent()); this.oomMessage = Toast.makeText(context, R.string.toast_out_of_memory, Toast.LENGTH_SHORT); this.progress = new ProgressDialog(context); this.progress.setTitle(context.getString(R.string.dialog_loading_title)); this.progress.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); this.progress.setMessage(context.getString(R.string.dialog_loading_message)); this.progress.show(); ImageUnloader.unload(this.view); }