diff --git a/.gitignore b/.gitignore index ff83e36..834ecc3 100644 --- a/.gitignore +++ b/.gitignore @@ -60,4 +60,7 @@ freeline.py freeline/ freeline_project_description.json .DS_Store +app/src/main/*.xml +app/src/main/res/values/*.xml +app/src/main/AndroidManifest.xml app/src/main/AndroidManifest.xml diff --git a/README.md b/README.md index a55ba83..c501f56 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ Android drawing application for annotating the backbone of worms. - App takes up to 70% less space on devices ### 1.02 (2017-12-08) -- Added Firebase Crashlytics and Performance Monitoring +- Added FireBase Crashlytics and Performance Monitoring - Added feedback and rate app dialog - Removed brush color functionality - Images expanded to fill the screen diff --git a/app/.gitignore b/app/.gitignore index 796b96d..e72eb67 100644 --- a/app/.gitignore +++ b/app/.gitignore @@ -1 +1,3 @@ /build +/src/main/*.xml +/src/main/res/values/*.xml \ No newline at end of file diff --git a/app/.idea/caches/build_file_checksums.ser b/app/.idea/caches/build_file_checksums.ser index 47e82ff..6816980 100644 Binary files a/app/.idea/caches/build_file_checksums.ser and b/app/.idea/caches/build_file_checksums.ser differ diff --git a/app/.idea/workspace.xml b/app/.idea/workspace.xml index ab9e24c..cec141d 100644 --- a/app/.idea/workspace.xml +++ b/app/.idea/workspace.xml @@ -10,25 +10,22 @@ + - - + - + - - - @@ -65,113 +62,84 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - + - - + + + + + + - + - - - - - - - - - - - - + + - - + + - - + + - - + + - - - - - - - - - + + - - + + - - + + - - - @@ -186,12 +154,6 @@ - 28 - drawer_la - send - cl_dt - signou - builder log.d done boolean @@ -206,7 +168,6 @@ pref_general pref_title R.id.home - onre addOnSuccessListener acct account @@ -216,6 +177,13 @@ popu popup google pla + newbie + userScore + bad + pro + leaderboard + oncre + onre @@ -2271,17 +2239,18 @@ @@ -2290,6 +2259,62 @@ + + + + + + + + + Android + + + CorrectnessLintAndroid + + + Groovy + + + Initialization issuesJava + + + J2ME issuesJava + + + Java + + + Kotlin + + + LintAndroid + + + Memory issuesJava + + + Performance issuesJava + + + PerformanceLintAndroid + + + Redundant constructsKotlin + + + RegExp + + + Threading issuesGroovy + + + Threading issuesJava + + + + + @@ -2319,7 +2344,30 @@ - + + + + + + + + + + + + + + + + + + + + + + + + @@ -2342,11 +2390,11 @@ - + - + @@ -2695,13 +2743,14 @@ - + + @@ -2709,10 +2758,10 @@ - + - + @@ -2726,12 +2775,11 @@ - - + @@ -2743,7 +2791,7 @@ - + @@ -2760,7 +2808,7 @@ - + @@ -2803,13 +2851,6 @@ - - - - - - - @@ -2975,35 +3016,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -3024,30 +3036,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - @@ -3096,18 +3084,18 @@ - + - + - + - - + + @@ -3122,8 +3110,8 @@ - - + + @@ -3136,26 +3124,74 @@ - + - - + + - + - - + + - + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -3165,11 +3201,51 @@ - - + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/build.gradle b/app/build.gradle index 06c7739..9508d49 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,7 +10,7 @@ android { minSdkVersion 21 targetSdkVersion 26 versionCode 1 - versionName "1.08" + versionName "1.09" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 76c74c1..c3ab94b 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -76,7 +76,8 @@ android:screenOrientation="portrait" android:label="@string/title_activity_settings" android:parentActivityName=".DrawingActivity" - android:theme="@style/AppTheme.Settings"> + android:theme="@style/AppTheme.Settings" + android:configChanges="locale"> diff --git a/app/src/main/ic_launcher-web.png b/app/src/main/ic_launcher-web.png deleted file mode 100644 index a663a40..0000000 Binary files a/app/src/main/ic_launcher-web.png and /dev/null differ diff --git a/app/src/main/java/com/example/caden/drawingtest/DrawingActivity.java b/app/src/main/java/com/example/caden/drawingtest/DrawingActivity.java index cb4d0d8..095c676 100644 --- a/app/src/main/java/com/example/caden/drawingtest/DrawingActivity.java +++ b/app/src/main/java/com/example/caden/drawingtest/DrawingActivity.java @@ -18,7 +18,6 @@ import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.transition.TransitionManager; -import android.util.Log; import android.util.TypedValue; import android.view.Menu; import android.view.MenuItem; @@ -36,8 +35,6 @@ import com.google.android.gms.games.AchievementsClient; import com.google.android.gms.games.Games; import com.google.android.gms.games.LeaderboardsClient; -import com.google.android.gms.tasks.OnCompleteListener; -import com.google.android.gms.tasks.Task; import com.google.firebase.analytics.FirebaseAnalytics; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; @@ -74,6 +71,7 @@ public class DrawingActivity extends AppCompatActivity private static final int RC_ACHIEVEMENT_UI = 9003; private static final int RC_LEADERBOARD_UI = 9004; private static final int RC_SETTING_UI = 9005; + private static final int RC_LEADERBOARD_SCORE = 1337; /* Variables */ String currBatchName; @@ -159,6 +157,7 @@ protected void onCreate(Bundle savedInstanceState) { /* Get Wurm image from FireBase */ fireBaseRetrieveImage(); fireBaseRetrieveUserScore(); + updateLeaderBoard(); tvUserScore = findViewById(R.id.tv_user_score); tvUserScore.setText(String.valueOf(userScore)); @@ -311,6 +310,8 @@ private void feedbackScreen() { // say he presses home button and then comes back to app, onResume() is called. protected void onResume() { drawView.onResume(); + updateLeaderBoard(); + if (GoogleSignIn.getLastSignedInAccount(this) == null) { FirebaseAuth.getInstance().signOut(); Intent i = new Intent(this, LoginActivity.class); @@ -333,6 +334,12 @@ protected void onPause() { super.onPause(); } + @Override + protected void onStop() { + updateLeaderBoard(); + super.onStop(); + } + @Override public void onBackPressed() { if (drawer.isDrawerOpen(GravityCompat.START)) { @@ -484,10 +491,7 @@ public void sendImage(View v) { /* Update User Score internally, with FireBase and with Google Play Games */ userScore++; - if (mAchClient != null) { - mAchClient.increment(getString(R.string.achievement_newbie_id), 1); - - } + updateWurmsAchievements(); tvUserScore.setText(String.valueOf(userScore)); mDatabase.child("user_scores").child(mUser.getUid()).setValue(userScore); @@ -540,6 +544,7 @@ public void markAsBad(View v) { } mDatabase.child("bad_images").child(currBatchName).child(String.valueOf(currImgNo)) .child(userUID).setValue(textToSend); + updateReporterAchievements(); nextImage(v); dialog.dismiss(); }) @@ -547,6 +552,36 @@ public void markAsBad(View v) { .show(); } + private void updateWurmsAchievements() { + if (isGoogleSignIn) { + mAchClient.increment(getString(R.string.achievement_newbie_1_id), 1); + mAchClient.increment(getString(R.string.achievement_newbie_2_id), 1); + mAchClient.increment(getString(R.string.achievement_growing_1_id), 1); + mAchClient.increment(getString(R.string.achievement_growing_2_id), 1); + mAchClient.increment(getString(R.string.achievement_silver_id), 1); + mAchClient.increment(getString(R.string.achievement_gold_id), 1); + mAchClient.increment(getString(R.string.achievement_diamond_id), 1); + mAchClient.increment(getString(R.string.achievement_platinum_id), 1); + mAchClient.increment(getString(R.string.achievement_master_of_all_id), 1); + } + } + + private void updateReporterAchievements() { + if (isGoogleSignIn) { + mAchClient.increment(getString(R.string.achievement_reporter_1_id), 1); + mAchClient.increment(getString(R.string.achievement_reporter_2_id), 1); + mAchClient.increment(getString(R.string.achievement_exp_reporter_id), 1); + mAchClient.increment(getString(R.string.achievement_pro_reporter_id), 1); + } + } + + private void updateLeaderBoard() { + if (isGoogleSignIn && userScore > 0) { + mLeadClient.submitScore(getString(R.string.leaderboard_wurm_scores_id), RC_LEADERBOARD_SCORE); + } + + } + private void fireBaseRetrieveImage() { mDatabase.child("master_upload").addListenerForSingleValueEvent(new ValueEventListener() { @Override diff --git a/app/src/main/java/com/example/caden/drawingtest/SettingsActivity.java b/app/src/main/java/com/example/caden/drawingtest/SettingsActivity.java index 6c2cd40..d7e3a31 100644 --- a/app/src/main/java/com/example/caden/drawingtest/SettingsActivity.java +++ b/app/src/main/java/com/example/caden/drawingtest/SettingsActivity.java @@ -4,6 +4,7 @@ import android.content.Intent; import android.content.SharedPreferences; import android.content.res.Configuration; +import android.content.res.Resources; import android.os.Bundle; import android.preference.EditTextPreference; import android.preference.ListPreference; @@ -12,6 +13,7 @@ import android.preference.PreferenceManager; import android.support.v4.app.NavUtils; import android.support.v7.app.ActionBar; +import android.util.DisplayMetrics; import android.util.Log; import android.view.MenuItem; @@ -22,12 +24,14 @@ import com.google.firebase.auth.UserProfileChangeRequest; import java.util.List; +import java.util.Locale; import java.util.Objects; public class SettingsActivity extends AppCompatPreferenceActivity { private static FirebaseUser user; private static String userName; + private static SharedPreferences sharedPrefs; /** * A preference value change listener that updates the preference's summary @@ -99,10 +103,11 @@ protected void onCreate(Bundle savedInstanceState) { new WurmPrefFragment()).commit(); setupActionBar(); - SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(this).edit(); + sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this); + + SharedPreferences.Editor editor = sharedPrefs.edit(); editor.putString("user_name", user.getDisplayName()); editor.putString("user_email", user.getEmail()); - editor.apply(); } @@ -141,22 +146,19 @@ protected boolean isValidFragment(String fragmentName) { public static class WurmPrefFragment extends PreferenceFragment { + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.pref_wurm); setHasOptionsMenu(true); - for (UserInfo u : user.getProviderData()) { if (u.getProviderId().equals("google.com")) { findPreference("user_email").setEnabled(false); } } - bindPreferenceSummaryToValue(findPreference("user_name")); bindPreferenceSummaryToValue(findPreference("user_email")); - -// bindPreferenceSummaryToValue(findPreference("example_list")); } @Override diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index bb01051..9986c18 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -25,4 +25,5 @@ 虫涂涂 用户 虫涂涂 设置 关于 虫涂涂 + 更改语言 \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 62b98fb..4b7241f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -28,23 +28,32 @@ Reset Password Re-enter your email Reset + + 52423362671 - CgkI75C0pcMBEAIQAQ + + CgkI75C0pcMBEAIQAQ + CgkI75C0pcMBEAIQBA + CgkI75C0pcMBEAIQBQ + CgkI75C0pcMBEAIQBg + CgkI75C0pcMBEAIQBw + CgkI75C0pcMBEAIQCA + CgkI75C0pcMBEAIQCQ + CgkI75C0pcMBEAIQCg + CgkI75C0pcMBEAIQCw + + CgkI75C0pcMBEAIQAg + CgkI75C0pcMBEAIQDA + CgkI75C0pcMBEAIQDQ + CgkI75C0pcMBEAIQDg + CgkI75C0pcMBEAIQAw + + Wurm Painter Wurm Settings - - Always - When possible - Never - - - 1 - 0 - -1 - System sync settings Add friends to messages @@ -95,7 +104,7 @@

1.02 (2017-12-08)

- - Added Firebase Crashlytics and Performance Monitoring
+ - Added FireBase Crashlytics and Performance Monitoring
- Added feedback and rate app dialog
- Removed brush color functionality
- Images expanded to fill the screen
diff --git a/app/src/main/res/xml/pref_wurm.xml b/app/src/main/res/xml/pref_wurm.xml index 07467bb..48329c4 100644 --- a/app/src/main/res/xml/pref_wurm.xml +++ b/app/src/main/res/xml/pref_wurm.xml @@ -23,7 +23,7 @@