Skip to content

Commit c8985d4

Browse files
authored
Merge branch 'bug-fixes' into check-update
2 parents 157d06c + da2bd5c commit c8985d4

File tree

80 files changed

+628
-468
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+628
-468
lines changed

source-code/app/src/androidTest/java/org/buildmlearn/toolkit/espresso/ComprehensionTest.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ private static void allowPermissionsIfNeeded() {
9393
try {
9494
allowPermissions.click();
9595
} catch (UiObjectNotFoundException e) {
96+
e.printStackTrace();
9697
}
9798
}
9899
}
@@ -118,13 +119,13 @@ public void run() {
118119
});
119120
}
120121

121-
public void toolbarTitle() {
122+
private void toolbarTitle() {
122123
String title = "Comprehension Template";
123124
onView(allOf(instanceOf(TextView.class), withParent(withId(R.id.toolbar))))
124125
.check(matches(withText(title)));
125126
}
126127

127-
public void addMetaDetails() {
128+
private void addMetaDetails() {
128129
String passTitle = "PassageTitle";
129130
String passage = "Short Passage.";
130131
String timer = "180";
@@ -143,7 +144,7 @@ public void addMetaDetails() {
143144

144145
}
145146

146-
public void editMetaDetails() {
147+
private void editMetaDetails() {
147148
String passTitle = "EditedPassageTitle";
148149
String passage = "EditedShort Passage.";
149150

@@ -158,7 +159,7 @@ public void editMetaDetails() {
158159

159160
}
160161

161-
public void addQuestions() {
162+
private void addQuestions() {
162163
String question = "This is just a silly question whose answer is (b).";
163164

164165
onView(withId(R.id.button_add_item)).perform(click());
@@ -180,7 +181,7 @@ public void addQuestions() {
180181

181182
}
182183

183-
public void editQuestions() {
184+
private void editQuestions() {
184185
String question = "This is just a silly question whose answer changed to (a).";
185186

186187
onData(anything()).inAdapterView(withId(R.id.template_editor_listview)).atPosition(1).perform(longClick());
@@ -193,13 +194,13 @@ public void editQuestions() {
193194

194195
}
195196

196-
public void addTemplate() {
197+
private void addTemplate() {
197198

198199
onView(withId(R.id.author_name)).perform(replaceText("Anupam"));
199200
onView(withId(R.id.template_title)).perform(replaceText("Testing template"));
200201
}
201202

202-
public void saveAPK() {
203+
private void saveAPK() {
203204

204205
onView(withId(R.id.action_save)).perform(click());
205206
onView(withText("Save APK")).perform(click());
@@ -235,7 +236,7 @@ public void perform(UiController uiController, View view) {
235236
return stringHolder[0];
236237
}
237238

238-
public void checkSimulator() {
239+
private void checkSimulator() {
239240
onView(withId(R.id.action_simulate)).perform(click());
240241
onView(withText("Testing template")).check(matches(isDisplayed()));
241242
onView(withText("Anupam")).check(matches(isDisplayed()));

source-code/app/src/main/AndroidManifest.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
android:required="true" />
1313

1414
<application
15+
android:fullBackupContent="true"
1516
android:name=".ToolkitApplication"
1617
android:allowBackup="true"
1718
android:icon="@mipmap/ic_launcher"
@@ -22,7 +23,7 @@
2223
android:name=".activity.HomeActivity"
2324
android:configChanges="orientation|screenSize"
2425
android:label="@string/app_name"
25-
android:theme="@style/NoActionBarThemeTransparentStatusBar"></activity>
26+
android:theme="@style/NoActionBarThemeTransparentStatusBar" />
2627
<activity
2728
android:name=".simulator.Simulator"
2829
android:label="@string/title_activity_simulator"
@@ -41,7 +42,7 @@
4142
android:name=".activity.TemplateEditor"
4243
android:configChanges="orientation|screenSize"
4344
android:label="@string/title_activity_template_editor"
44-
android:theme="@style/AppTheme.NoActionBar"></activity>
45+
android:theme="@style/AppTheme.NoActionBar" />
4546
<activity
4647
android:name=".activity.FirstRunActivity"
4748
android:label="@string/app_name"
@@ -56,7 +57,7 @@
5657
<activity
5758
android:name=".activity.TutorialActivity"
5859
android:label="@string/title_activity_tutorial"
59-
android:theme="@style/Buildmlearn.FullScreen"></activity>
60+
android:theme="@style/Buildmlearn.FullScreen" />
6061
<activity
6162
android:name=".activity.AboutBuildmLearn"
6263
android:label="@string/title_activity_about_buildm_learn"
463 Bytes
Binary file not shown.
640 Bytes
Binary file not shown.

source-code/app/src/main/java/org/buildmlearn/toolkit/ToolkitApplication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public String getApkDir() {
104104
public boolean checkExternalStorage() {
105105

106106
boolean result = false;
107-
File f = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/BuildmLearn123/");
107+
File f = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + Constants.BUILD_M_LEARN_PATH_123);
108108
if (!f.isDirectory()) {
109109
result = f.mkdirs();
110110
f.delete();

source-code/app/src/main/java/org/buildmlearn/toolkit/activity/AboutBuildmLearn.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ protected void onCreate(Bundle savedInstanceState) {
3535
((TextView) findViewById(R.id.app_version)).setText(String.format(Locale.ENGLISH, "Version: %s", version));
3636
} catch (PackageManager.NameNotFoundException e) {
3737
assert findViewById(R.id.app_version) != null;
38-
assert ((TextView) findViewById(R.id.app_version)) != null;
39-
((TextView) findViewById(R.id.app_version)).setText("Version: 2.5.0");
38+
assert ( findViewById(R.id.app_version)) != null;
39+
((TextView) findViewById(R.id.app_version)).setText("Version: 1.0");
4040
e.printStackTrace();
4141
}
4242

source-code/app/src/main/java/org/buildmlearn/toolkit/activity/FirstRunActivity.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import android.view.animation.AnimationUtils;
1212
import android.widget.EditText;
1313

14+
1415
import com.crashlytics.android.Crashlytics;
1516

1617
import org.buildmlearn.toolkit.R;
@@ -45,9 +46,9 @@ protected void onCreate(Bundle savedInstanceState) {
4546

4647

4748
findViewById(R.id.focus_thief).clearFocus();
48-
Animation anim_bounceinup=AnimationUtils.loadAnimation(getBaseContext(),R.anim.bounceinup);
49+
Animation animBounceinup=AnimationUtils.loadAnimation(getBaseContext(),R.anim.bounceinup);
4950
name = (EditText) findViewById(R.id.first_name);
50-
name.startAnimation(anim_bounceinup);
51+
name.startAnimation(animBounceinup);
5152
name.setOnKeyListener(new View.OnKeyListener() {
5253
@Override
5354
public boolean onKey(View v, int keyCode, KeyEvent event) {

source-code/app/src/main/java/org/buildmlearn/toolkit/activity/HomeActivity.java

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,19 @@
44
import android.app.FragmentTransaction;
55
import android.content.Intent;
66
import android.content.SharedPreferences;
7+
import android.graphics.drawable.ColorDrawable;
8+
import android.os.Build;
79
import android.os.Bundle;
810
import android.preference.PreferenceManager;
911
import android.support.design.widget.NavigationView;
1012

1113
import android.app.FragmentManager;
14+
import android.support.v4.content.ContextCompat;
1215
import android.support.v4.view.GravityCompat;
1316
import android.os.Handler;
1417
import android.support.v4.widget.DrawerLayout;
1518
import android.support.v7.app.AppCompatActivity;
16-
import android.support.v7.widget.Toolbar;;
19+
import android.support.v7.widget.Toolbar;
1720
import android.view.MenuItem;
1821
import android.view.View;
1922
import android.widget.TextView;
@@ -41,7 +44,7 @@ public class HomeActivity extends AppCompatActivity
4144

4245
private SmoothNavigationToggle smoothNavigationToggle;
4346

44-
NavigationView navigationView;
47+
private NavigationView navigationView;
4548

4649
/**
4750
* {@inheritDoc}
@@ -107,7 +110,7 @@ public boolean onNavigationItemSelected(MenuItem item) {
107110
getSupportActionBar().setDisplayShowHomeEnabled(true);
108111
getSupportActionBar().setDisplayShowTitleEnabled(true);
109112
}
110-
113+
restoreColorScheme();
111114
switch(id){
112115
case R.id.nav_home:
113116
smoothNavigationToggle.runWhenIdle(new Runnable() {
@@ -199,6 +202,16 @@ public void run() {
199202
return true;
200203
}
201204

205+
private void restoreColorScheme() {
206+
int primaryColor = ContextCompat.getColor(HomeActivity.this, R.color.color_primary);
207+
int primaryColorDark = ContextCompat.getColor(HomeActivity.this, R.color.color_primary_dark);
208+
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(primaryColor));
209+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
210+
getWindow().setStatusBarColor(primaryColorDark);
211+
getWindow().setNavigationBarColor(primaryColor);
212+
}
213+
}
214+
202215
@Override
203216
public void onBackPressed() {
204217
FragmentManager fragmentManager = getFragmentManager();

0 commit comments

Comments
 (0)