net.hockeyapp.android.Strings Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of HockeySDK Show documentation
Show all versions of HockeySDK Show documentation
HockeySDK-Android implements support for using HockeyApp in your Android application. The following features are currently supported:
Collect crash reports:If your app crashes, a crash log is written to the device's storage. If the user starts the app again, they will be asked asked to submit the crash report to HockeyApp. This works for both beta and live apps, i.e. those submitted to Google Play or other app stores. Crash logs contain viable information for you to help resolve the issue. Furthermore, you as a developer can add additional information to the report as well.
Update Alpha/Beta apps: The app will check with HockeyApp if a new version for your alpha/beta build is available. If yes, it will show a dialog to users and let them see the release notes, the version history and start the installation process right away. You can even force the installation of certain updates.
User Metrics: Understand user behavior to improve your app. Track usage through daily and monthly active users. Monitor crash impacted users. Measure customer engagement through session count. Add custom tracking calls to learn which features your users are actually using. This feature requires a minimum API level of 14 (Android 4.x Ice Cream Sandwich).
Feedback: Besides crash reports, collecting feedback from your users from within your app is a great option to help with improving your app. You act on and answer feedback directly from the HockeyApp backend.
Authenticate: Identify and authenticate users against your registered testers with the HockeyApp backend.
package net.hockeyapp.android;
import java.util.HashMap;
import java.util.Map;
/**
* Description
*
* Helper class to hold strings constants and defaults values.
*
* License
*
*
* Copyright (c) 2011-2014 Bit Stadium GmbH
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
*
* @author Thomas Dohmke
* @author Patrick Eschenbach
**/
public class Strings {
///////////////////////////////////////////////////
// Crash Dialog
///////////////////////////////////////////////////
/** Resource ID for the title of the dialog when a new crash was found. */
public final static int CRASH_DIALOG_TITLE_ID = 0x000;
/** Resource ID for the message of the dialog when a new crash was found. */
public final static int CRASH_DIALOG_MESSAGE_ID = 0x001;
/** Resource ID for the negative button label of the dialog when a new crash was found. */
public final static int CRASH_DIALOG_NEGATIVE_BUTTON_ID = 0x002;
/** Resource ID for the neutral button label of the dialog when a new crash was found. */
public final static int CRASH_DIALOG_NEUTRAL_BUTTON_ID = 0x003;
/** Resource ID for the positive button label of the dialog when a new crash was found. */
public final static int CRASH_DIALOG_POSITIVE_BUTTON_ID = 0x004;
///////////////////////////////////////////////////
// Download Failed Dialog
///////////////////////////////////////////////////
/** Resource ID for the title of the dialog when the apk download failed. */
public final static int DOWNLOAD_FAILED_DIALOG_TITLE_ID = 0x100;
/** Resource ID for the message of the dialog when the apk download failed. */
public final static int DOWNLOAD_FAILED_DIALOG_MESSAGE_ID = 0x101;
/** Resource ID for the label on the negative button of the dialog when the apk download failed. */
public final static int DOWNLOAD_FAILED_DIALOG_NEGATIVE_BUTTON_ID = 0x102;
/** Resource ID for the label on the positive button of the dialog when the apk download failed. */
public final static int DOWNLOAD_FAILED_DIALOG_POSITIVE_BUTTON_ID = 0x103;
///////////////////////////////////////////////////
// Update
///////////////////////////////////////////////////
/** Resource ID for the text of the toast when an update is mandatory. */
public final static int UPDATE_MANDATORY_TOAST_ID = 0x200;
/** Resource ID for the title of the dialog when a new update was found. */
public final static int UPDATE_DIALOG_TITLE_ID = 0x201;
/** Resource ID for the message of the dialog when a new update was found. */
public final static int UPDATE_DIALOG_MESSAGE_ID = 0x202;
/** Resource ID for the label on the negative button of the dialog when a new update was found. */
public final static int UPDATE_DIALOG_NEGATIVE_BUTTON_ID = 0x203;
/** Resource ID for the label on the positive button of the dialog when a new update was found. */
public final static int UPDATE_DIALOG_POSITIVE_BUTTON_ID = 0x204;
///////////////////////////////////////////////////
// Expiry Info
///////////////////////////////////////////////////
/** Resource ID for the title of the expiry info view. */
public final static int EXPIRY_INFO_TITLE_ID = 0x300;
/** Resource ID for the text of the expiry info view. */
public final static int EXPIRY_INFO_TEXT_ID = 0x301;
///////////////////////////////////////////////////
// Feedback Activity
///////////////////////////////////////////////////
/** Resource ID for the title of the Feedback Failed info view. */
public final static int FEEDBACK_FAILED_TITLE_ID = 0x400;
/** Resource ID for the text of the Feedback Failed info view. */
public final static int FEEDBACK_FAILED_TEXT_ID = 0x401;
/** Resource ID for the FeedbackView name input hint text. */
public final static int FEEDBACK_NAME_INPUT_HINT_ID = 0x402;
/** Resource ID for the FeedbackView email input hint text. */
public final static int FEEDBACK_EMAIL_INPUT_HINT_ID = 0x403;
/** Resource ID for the FeedbackView subject input hint text. */
public final static int FEEDBACK_SUBJECT_INPUT_HINT_ID = 0x404;
/** Resource ID for the FeedbackView message input hint text. */
public final static int FEEDBACK_MESSAGE_INPUT_HINT_ID = 0x405;
/** Resource ID for the FeedbackView last updated text. */
public final static int FEEDBACK_LAST_UPDATED_TEXT_ID = 0x406;
/** Resource ID for the FeedbackView attachment button text. */
public final static int FEEDBACK_ATTACHMENT_BUTTON_TEXT_ID = 0x407;
/** Resource ID for the FeedbackView send button text. */
public final static int FEEDBACK_SEND_BUTTON_TEXT_ID = 0x408;
/** Resource ID for the FeedbackView response button text. */
public final static int FEEDBACK_RESPONSE_BUTTON_TEXT_ID = 0x409;
/** Resource ID for the FeedbackView refresh button text. */
public final static int FEEDBACK_REFRESH_BUTTON_TEXT_ID = 0x40a;
/** Resource ID for the title of the FeedbackActivity. */
public final static int FEEDBACK_TITLE_ID = 0x40b;
/** Resource ID for the message when feedback could not be sent (generic). */
public final static int FEEDBACK_SEND_GENERIC_ERROR_ID = 0x40c;
/** Resource ID for the message when feedback could not be sent (network error). */
public final static int FEEDBACK_SEND_NETWORK_ERROR_ID = 0x40d;
/** Resource ID for the message when the subject field is not filled out. */
public static final int FEEDBACK_VALIDATE_SUBJECT_ERROR_ID = 0x40e;
/** Resource ID for the message when the entered email is invalid. */
public final static int FEEDBACK_VALIDATE_EMAIL_ERROR_ID = 0x40f;
/** Resource ID for the message when a generic error has occurred. */
public final static int FEEDBACK_GENERIC_ERROR_ID = 0x410;
/** Resource ID for the message when the name field is not filled out. */
public static final int FEEDBACK_VALIDATE_NAME_ERROR_ID = 0x411;
/** Resource ID for the message when the email field is not filled out. */
public static final int FEEDBACK_VALIDATE_EMAIL_EMPTY_ID = 0x412;
/** Resource ID for the message when the text field is not filled out. */
public static final int FEEDBACK_VALIDATE_TEXT_ERROR_ID = 0x413;
/** Resource ID for the button to attach a file to the feedback. **/
public static final int FEEDBACK_ATTACH_FILE_ID = 0x414;
/** Resource ID for the button to attach a picture to the feedback. **/
public static final int FEEDBACK_ATTACH_PICTURE_ID = 0x415;
/** Resource ID for the chooser dialog to select an attachment file. **/
public static final int FEEDBACK_SELECT_FILE_ID = 0x416;
/** Resource ID for the chooser dialog to select an attachment picture. **/
public static final int FEEDBACK_SELECT_PICTURE_ID = 0x417;
/** Resource ID for the warning toast of the maximum number of attachments allowed per feedback. **/
public static final int FEEDBACK_MAX_ATTACHMENTS_ALLOWED = 0x418;
///////////////////////////////////////////////////
// Login Activity
///////////////////////////////////////////////////
/** Resource ID for the LoginView headline. */
public final static int LOGIN_HEADLINE_TEXT_ID = 0x500;
/** Resource ID for the LoginView missing credentials toast. */
public final static int LOGIN_MISSING_CREDENTIALS_TOAST_ID = 0x501;
/** Resource ID for the LoginView email input hint text. */
public final static int LOGIN_EMAIL_INPUT_HINT_ID = 0x502;
/** Resource ID for the LoginView password input hint text. */
public final static int LOGIN_PASSWORD_INPUT_HINT_ID = 0x503;
/** Resource ID for the LoginView login button text. */
public final static int LOGIN_LOGIN_BUTTON_TEXT_ID = 0x504;
///////////////////////////////////////////////////
// Paint Activity
///////////////////////////////////////////////////
/** Resource ID for the PaintActivity indicator toast. */
public final static int PAINT_INDICATOR_TOAST_ID = 0x600;
/** Resource ID for the PaintActivity menu save button. */
public final static int PAINT_MENU_SAVE_ID = 0x601;
/** Resource ID for the PaintActivity menu undo button. */
public final static int PAINT_MENU_UNDO_ID = 0x602;
/** Resource ID for the PaintActivity menu clear button. */
public final static int PAINT_MENU_CLEAR_ID = 0x603;
/** Resource ID for the dialog message when activity is exited with changes. */
public final static int PAINT_DIALOG_MESSAGE_ID = 0x604;
/** Resource ID for the negative button label of the dialog when activity is exited with changes. */
public final static int PAINT_DIALOG_NEGATIVE_BUTTON_ID = 0x605;
/** Resource ID for the positive button label of the dialog when activity is exited with changes. */
public final static int PAINT_DIALOG_POSITIVE_BUTTON_ID = 0x606;
///////////////////////////////////////////////////
// Permissions
///////////////////////////////////////////////////
/** Resource ID for the title of the dialog explaining why permission is necessary. **/
public final static int PERMISSION_UPDATE_TITLE_ID = 0x700;
/** Resource ID for the message of the dialog explaining why permission is necessary **/
public final static int PERMISSION_UPDATE_MESSAGE_ID = 0x701;
/** Resource ID for the cancel button in the dialog. **/
public final static int PERMISSION_DIALOG_NEGATIVE_BUTTON_ID = 0x702;
/** Resource ID for the retry button in the dialog. **/
public final static int PERMISSION_DIALOG_POSITIVE_BUTTON_ID = 0x703;
///////////////////////////////////////////////////
// Dialogs
///////////////////////////////////////////////////
/** Resource ID for the positive button of generic dialogs. **/
public final static int DIALOG_POSITIVE_BUTTON_ID = 0x800;
/** Resource ID for the negative button of generic dialogs. **/
public final static int DIALOG_NEGATIVE_BUTTON_ID = 0x801;
/** Resource ID for the title of an error dialog. **/
public final static int DIALOG_ERROR_TITLE_ID = 0x802;
/** Resource ID for the message of an error dialog. **/
public final static int DIALOG_ERROR_MESSAGE_ID = 0x803;
/**
* Default strings.
*/
private final static Map DEFAULT = new HashMap();
static {
// Crash Dialog
DEFAULT.put(CRASH_DIALOG_TITLE_ID, "Crash Data");
DEFAULT.put(CRASH_DIALOG_MESSAGE_ID, "The app found information about previous crashes. Would you like to send this data to the developer?");
DEFAULT.put(CRASH_DIALOG_NEGATIVE_BUTTON_ID, "Dismiss");
DEFAULT.put(CRASH_DIALOG_NEUTRAL_BUTTON_ID, "Always send");
DEFAULT.put(CRASH_DIALOG_POSITIVE_BUTTON_ID, "Send");
// Download Failed
DEFAULT.put(DOWNLOAD_FAILED_DIALOG_TITLE_ID, "Download Failed");
DEFAULT.put(DOWNLOAD_FAILED_DIALOG_MESSAGE_ID, "The update could not be downloaded. Would you like to try again?");
DEFAULT.put(DOWNLOAD_FAILED_DIALOG_NEGATIVE_BUTTON_ID, "Cancel");
DEFAULT.put(DOWNLOAD_FAILED_DIALOG_POSITIVE_BUTTON_ID, "Retry");
// Update
DEFAULT.put(UPDATE_MANDATORY_TOAST_ID, "Please install the latest version to continue to use this app.");
DEFAULT.put(UPDATE_DIALOG_TITLE_ID, "Update Available");
DEFAULT.put(UPDATE_DIALOG_MESSAGE_ID, "Show information about the new update?");
DEFAULT.put(UPDATE_DIALOG_NEGATIVE_BUTTON_ID, "Dismiss");
DEFAULT.put(UPDATE_DIALOG_POSITIVE_BUTTON_ID, "Show");
// Expiry Info
DEFAULT.put(EXPIRY_INFO_TITLE_ID, "Build Expired");
DEFAULT.put(EXPIRY_INFO_TEXT_ID, "This has build has expired. Please check HockeyApp for any updates.");
// Feedback Activity
DEFAULT.put(FEEDBACK_FAILED_TITLE_ID, "Feedback Failed");
DEFAULT.put(FEEDBACK_FAILED_TEXT_ID, "Would you like to send your feedback again?");
DEFAULT.put(FEEDBACK_NAME_INPUT_HINT_ID, "Name");
DEFAULT.put(FEEDBACK_EMAIL_INPUT_HINT_ID, "Email");
DEFAULT.put(FEEDBACK_SUBJECT_INPUT_HINT_ID, "Subject");
DEFAULT.put(FEEDBACK_MESSAGE_INPUT_HINT_ID, "Message");
DEFAULT.put(FEEDBACK_LAST_UPDATED_TEXT_ID, "Last Updated: ");
DEFAULT.put(FEEDBACK_ATTACHMENT_BUTTON_TEXT_ID, "Add Attachment");
DEFAULT.put(FEEDBACK_SEND_BUTTON_TEXT_ID, "Send Feedback");
DEFAULT.put(FEEDBACK_RESPONSE_BUTTON_TEXT_ID, "Add a Response");
DEFAULT.put(FEEDBACK_REFRESH_BUTTON_TEXT_ID, "Refresh");
DEFAULT.put(FEEDBACK_TITLE_ID, "Feedback");
DEFAULT.put(FEEDBACK_SEND_GENERIC_ERROR_ID, "Message couldn't be posted. Please check your input values and your connection, then try again.");
DEFAULT.put(FEEDBACK_SEND_NETWORK_ERROR_ID, "No response from server. Please check your connection, then try again.");
DEFAULT.put(FEEDBACK_VALIDATE_SUBJECT_ERROR_ID, "Please enter a subject");
DEFAULT.put(FEEDBACK_VALIDATE_NAME_ERROR_ID, "Please enter a name");
DEFAULT.put(FEEDBACK_VALIDATE_EMAIL_EMPTY_ID, "Please enter an email address");
DEFAULT.put(FEEDBACK_VALIDATE_TEXT_ERROR_ID, "Please enter a feedback text");
DEFAULT.put(FEEDBACK_VALIDATE_EMAIL_ERROR_ID, "Message couldn't be posted. Please check the format of your email address.");
DEFAULT.put(FEEDBACK_GENERIC_ERROR_ID, "An error has occurred");
DEFAULT.put(FEEDBACK_ATTACH_FILE_ID, "Attach File");
DEFAULT.put(FEEDBACK_ATTACH_PICTURE_ID, "Attach Picture");
DEFAULT.put(FEEDBACK_SELECT_FILE_ID, "Select File");
DEFAULT.put(FEEDBACK_SELECT_PICTURE_ID, "Select Picture");
DEFAULT.put(FEEDBACK_MAX_ATTACHMENTS_ALLOWED, "Only %s attachments allowed.");
// Login Activity
DEFAULT.put(LOGIN_HEADLINE_TEXT_ID, "Please enter your account credentials.");
DEFAULT.put(LOGIN_MISSING_CREDENTIALS_TOAST_ID, "Please fill in the missing account credentials.");
DEFAULT.put(LOGIN_EMAIL_INPUT_HINT_ID, "Email");
DEFAULT.put(LOGIN_PASSWORD_INPUT_HINT_ID, "Password");
DEFAULT.put(LOGIN_LOGIN_BUTTON_TEXT_ID, "Login");
// Paint Activity
DEFAULT.put(PAINT_INDICATOR_TOAST_ID, "Draw something!");
DEFAULT.put(PAINT_MENU_SAVE_ID, "Save");
DEFAULT.put(PAINT_MENU_UNDO_ID, "Undo");
DEFAULT.put(PAINT_MENU_CLEAR_ID, "Clear");
DEFAULT.put(PAINT_DIALOG_MESSAGE_ID, "Discard your drawings?");
DEFAULT.put(PAINT_DIALOG_NEGATIVE_BUTTON_ID, "No");
DEFAULT.put(PAINT_DIALOG_POSITIVE_BUTTON_ID, "Yes");
// Permissions
DEFAULT.put(PERMISSION_UPDATE_TITLE_ID, "Need storage access");
DEFAULT.put(PERMISSION_UPDATE_MESSAGE_ID, "In order to download and install app updates you will have to allow the app to access your device storage.");
DEFAULT.put(PERMISSION_DIALOG_NEGATIVE_BUTTON_ID, "Cancel");
DEFAULT.put(PERMISSION_DIALOG_POSITIVE_BUTTON_ID, "Retry");
// Dialogs
DEFAULT.put(DIALOG_POSITIVE_BUTTON_ID, "OK");
DEFAULT.put(DIALOG_NEGATIVE_BUTTON_ID, "Cancel");
DEFAULT.put(DIALOG_ERROR_TITLE_ID, "Error");
DEFAULT.put(DIALOG_ERROR_MESSAGE_ID, "An error has occured");
}
/**
* Returns the default string for the given resource ID.
*
* @param resourceID The ID of the string resource.
* @return The default string or null if the resourceID doesn't exist.
*/
public static String get(int resourceID) {
return get(null, resourceID);
}
/**
* Sets the default string for the given resource ID.
*
* @param resourceID The ID of the string resource.
* @param string The new default string.
*/
public static void set(int resourceID, String string) {
if (string != null) {
DEFAULT.put(resourceID, string);
}
}
/**
* Returns a string for the given resource ID. The method first runs the
* callback method from the listener (if specified). If this returns null,
* it then uses the default string.
*
* @param listener An instance of StringListener.
* @param resourceID The ID of the string resource.
* @return The string or null if the resourceID doesn't exist.
*/
public static String get(StringListener listener, int resourceID) {
String result = null;
if (listener != null) {
result = listener.getStringForResource(resourceID);
}
if (result == null) {
result = DEFAULT.get(resourceID);
}
return result;
}
}