Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
bin
gen
*.apk
.hg/
local.properties
*.DS_Store
*.BridgeSort
out/
tmp/
build/
.gradle/
.idea/
*.iml
.project
.classpath
*.pem
mirror/
17 changes: 9 additions & 8 deletions AppRate/.classpath
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
34 changes: 34 additions & 0 deletions AppRate/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apply plugin: 'android-library'

dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}

android {
compileSdkVersion 17
buildToolsVersion "18.1.0"

sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}

// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')

// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}
21 changes: 21 additions & 0 deletions AppRate/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
<resources>

<string name="app_name">AppRate</string>
<string name="dialog_title">Rate %1$s</string>
<string name="dialog_message">"If you enjoy using %1$s, please take a moment to rate it. Thanks for your support!"</string>
<string name="dialog_positive_button">Rate it!</string>
<string name="dialog_neutral_button">Remind me later</string>
<string name="dialog_negative_button">No thanks</string>
<string name="like_app_dialog_title">Tell Us</string>
<string name="like_app_dialog_message">"Do you like %1$s?"</string>
<string name="like_app_dialog_positive_button">Yes</string>
<string name="like_app_dialog_negative_button">No</string>
<string name="send_feedback_dialog_title">Oh no!</string>
<string name="send_feedback_dialog_message">Please let us know what we can do to make it better for you.</string>
<string name="send_feedback_dialog_positive_button">Send Feedback</string>
<string name="send_feedback_dialog_negative_button">Cancel</string>
<string name="toast_play_store_missing_error">No Play Store installed on device</string>
<string name="application_name_unknown">(unknown)</string>
<string name="feedback_email_subject_line">"%1$s Feedback"</string>
<string name="feedback_email_header">Please enter your feedback above this line</string>
<string name="send_email">Send Email&#8230;</string>
<string name="email_heading_android_device">Android Device: %s</string>
<string name="email_heading_android_version">Android Version: %s</string>
<string name="email_heading_app_version">App Version: %s</string>

</resources>
75 changes: 75 additions & 0 deletions AppRate/src/com/tjeannin/apprate/AppInfo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package com.tjeannin.apprate;

import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.util.Log;

/**
* Created by bdonahue on 1/10/14.
*/
public class AppInfo {
private static final String TAG = AppInfo.class.getSimpleName();

/**
* @param context A context of the current application.
* @return The application name of the current application.
*/
public static final String getApplicationName(Context context) {
final PackageManager packageManager = context.getPackageManager();
ApplicationInfo applicationInfo;

try {
applicationInfo = packageManager.getApplicationInfo(context.getPackageName(), 0);
} catch (final PackageManager.NameNotFoundException e) {
applicationInfo = null;
}

return (String) (applicationInfo != null ? packageManager.getApplicationLabel(applicationInfo) : context.getString(R.string.application_name_unknown));
}

/**
* Get the application version code
*
* @param context
* @return The version name or null if there was an error
*/
public static final Integer getApplicationVersionCode(Context context) {
try {
if (context != null) {
PackageManager pm = context.getPackageManager();
if (pm != null) {
PackageInfo pi = pm.getPackageInfo(context.getPackageName(), 0);
if (pi != null) {
return pi.versionCode;
}
}
}

} catch (PackageManager.NameNotFoundException e) {
Log.e(TAG, "Unable to get application version code");
}

return 0;
}

public static String getApplicationVersionName(Context context) {
try {
if (context != null) {
PackageManager pm = context.getPackageManager();
if (pm != null) {
PackageInfo pi = pm.getPackageInfo(context.getPackageName(), 0);
if (pi != null) {
return pi.versionName;
}
}
}

} catch (PackageManager.NameNotFoundException e) {
Log.e(TAG, "Unable to get application version name");
}

return "";
}
}
Loading