Skip to content

Commit

Permalink
Merge branch 'bug-fixes' into lint_issues_2
Browse files Browse the repository at this point in the history
  • Loading branch information
opticod authored Jan 17, 2017
2 parents 9dc32e7 + b8aa45e commit d6987c0
Show file tree
Hide file tree
Showing 31 changed files with 212 additions and 77 deletions.
6 changes: 3 additions & 3 deletions source-code/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
android:name=".activity.HomeActivity"
android:configChanges="orientation|screenSize"
android:label="@string/app_name"
android:theme="@style/NoActionBarThemeTransparentStatusBar"></activity>
android:theme="@style/NoActionBarThemeTransparentStatusBar" />
<activity
android:name=".simulator.Simulator"
android:label="@string/title_activity_simulator"
Expand All @@ -42,7 +42,7 @@
android:name=".activity.TemplateEditor"
android:configChanges="orientation|screenSize"
android:label="@string/title_activity_template_editor"
android:theme="@style/AppTheme.NoActionBar"></activity>
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".activity.FirstRunActivity"
android:label="@string/app_name"
Expand All @@ -57,7 +57,7 @@
<activity
android:name=".activity.TutorialActivity"
android:label="@string/title_activity_tutorial"
android:theme="@style/Buildmlearn.FullScreen"></activity>
android:theme="@style/Buildmlearn.FullScreen" />
<activity
android:name=".activity.AboutBuildmLearn"
android:label="@string/title_activity_about_buildm_learn"
Expand Down
Binary file modified source-code/app/src/main/assets/MatchApp.apk
Binary file not shown.
Binary file modified source-code/app/src/main/assets/VideoCollectionApp.apk
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public String getApkDir() {
public boolean checkExternalStorage() {

boolean result = false;
File f = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/BuildmLearn123/");
File f = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + Constants.BUILD_M_LEARN_PATH_123);
if (!f.isDirectory()) {
result = f.mkdirs();
f.delete();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
import android.app.FragmentTransaction;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.drawable.ColorDrawable;
import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.design.widget.NavigationView;

import android.app.FragmentManager;
import android.support.v4.content.ContextCompat;
import android.support.v4.view.GravityCompat;
import android.os.Handler;
import android.support.v4.widget.DrawerLayout;
Expand Down Expand Up @@ -107,7 +110,7 @@ public boolean onNavigationItemSelected(MenuItem item) {
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setDisplayShowTitleEnabled(true);
}

restoreColorScheme();
switch(id){
case R.id.nav_home:
smoothNavigationToggle.runWhenIdle(new Runnable() {
Expand Down Expand Up @@ -199,6 +202,16 @@ public void run() {
return true;
}

private void restoreColorScheme() {
int primaryColor = ContextCompat.getColor(HomeActivity.this, R.color.color_primary);
int primaryColorDark = ContextCompat.getColor(HomeActivity.this, R.color.color_primary_dark);
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(primaryColor));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().setStatusBarColor(primaryColorDark);
getWindow().setNavigationBarColor(primaryColor);
}
}

@Override
public void onBackPressed() {
FragmentManager fragmentManager = getFragmentManager();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
import android.Manifest;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
Expand Down Expand Up @@ -583,25 +586,19 @@ public boolean onOptionsItemSelected(MenuItem item) {

switch (id) {
case R.id.action_delete:

final AlertDialog dialog = new AlertDialog.Builder(this)
.setTitle(R.string.dialog_delete_title)
.setMessage(R.string.dialog_delete_msg)
.setPositiveButton(R.string.dialog_yes, null)
.setNegativeButton(R.string.dialog_no, null)
.create();
dialog.show();

dialog.getButton(DialogInterface.BUTTON_POSITIVE).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
selectedTemplate.deleteItem(TemplateEditor.this, selectedPosition);
selectedPosition = -1;
restoreSelectedView();
}
});

final int restorePosition = selectedPosition;
final Object object = selectedTemplate.deleteItem(TemplateEditor.this,selectedPosition);
selectedPosition = -1;
restoreSelectedView();
Snackbar.make(findViewById(R.id.relative_layout),
R.string.snackbar_deleted_message,Snackbar.LENGTH_LONG)
.setAction(R.string.snackbar_undo, new View.OnClickListener() {
@Override
public void onClick(View v) {
selectedTemplate.restoreItem(TemplateEditor.this,restorePosition,object);
Snackbar.make(v,R.string.snackbar_restored_message,Snackbar.LENGTH_LONG).show();
}
}).show();
break;
case R.id.action_edit:
selectedTemplate.editItem(this, selectedPosition);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
public final static String PROJECT_FILE_PATH = "PROJECT_FILE_PATH";
public final static String START_ACTIVITY = "START_ACTIVITY";
public final static String START_FRAGMENT = "START_FRAGMENT";
public final static String BUILD_M_LEARN_PATH_123 = "/BuildmLearn123/";


}
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,19 @@ public boolean onPreferenceClick(Preference preference) {
}
});

Preference tell_friend=findPreference(getString(R.string.pref_tell_key));
tell_friend.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_TEXT,getString(R.string.pref_tell_message)+" http://play.google.com/store/apps/details?id=" + getActivity().getPackageName());
shareIntent.setType("text/plain");
startActivity(shareIntent);
return true;
}
});

Preference restoreProject = findPreference(getString(R.string.key_restore_project));
restoreProject.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,18 +154,18 @@ public boolean onMenuItemClick(MenuItem menuItem) {

handleListViewListeners();

listViewA.setAdapter(matchListAdapterA);
listViewB.setAdapter(matchListAdapterB);

View header_A = getLayoutInflater(savedInstanceState).inflate(R.layout.match_template_detail_header_a, null);
View footer_A = getLayoutInflater(savedInstanceState).inflate(R.layout.match_template_detail_footer_a, null);
listViewA.addHeaderView(header_A);
listViewA.addFooterView(footer_A);
listViewA.setAdapter(matchListAdapterA);

View header_B = getLayoutInflater(savedInstanceState).inflate(R.layout.match_template_detail_header_b, null);
View footer_B = getLayoutInflater(savedInstanceState).inflate(R.layout.match_template_detail_footer_b, null);
listViewB.addHeaderView(header_B);
listViewB.addFooterView(footer_B);
listViewB.setAdapter(matchListAdapterB);

((TextView) rootView.findViewById(R.id.score)).setText(String.format(Locale.ENGLISH, "Score : %d of %d", countScore, matchListA.size()));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public boolean onMenuItemClick(MenuItem menuItem) {
new AlertDialog.Builder(getActivity());
builder.setTitle(String.format("%1$s", getString(R.string.comprehension_about_us)));
builder.setMessage(getResources().getText(R.string.comprehension_about_text));
builder.setPositiveButton("OK", null);
builder.setPositiveButton(getString(R.string.info_template_ok), null);
AlertDialog welcomeAlert = builder.create();
welcomeAlert.show();
assert welcomeAlert.findViewById(android.R.id.message) != null;
Expand All @@ -72,9 +72,9 @@ public boolean onMenuItemClick(MenuItem menuItem) {
});

((TextView) rootView.findViewById(R.id.text)).setText(getResources().getString(R.string.completed_message_quiz));
((TextView) rootView.findViewById(R.id.correct)).setText(String.format(Locale.getDefault(), "Total Correct : %1$d", stat[0]));
((TextView) rootView.findViewById(R.id.wrong)).setText(String.format(Locale.getDefault(), "Total Wrong : %1$d", stat[1]));
((TextView) rootView.findViewById(R.id.un_answered)).setText(String.format(Locale.getDefault(), "Total Unanswered : %1$d", stat[2]));
((TextView) rootView.findViewById(R.id.correct)).setText(String.format(Locale.getDefault(), getString(R.string.total_correct),stat[0]));
((TextView) rootView.findViewById(R.id.wrong)).setText(String.format(Locale.getDefault(), getString(R.string.total_wrong),stat[1]));
((TextView) rootView.findViewById(R.id.un_answered)).setText(String.format(Locale.getDefault(), getString(R.string.total_unanswered), stat[2]));

rootView.findViewById(R.id.restart).setOnClickListener(new View.OnClickListener() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public boolean onMenuItemClick(MenuItem menuItem) {
new AlertDialog.Builder(getActivity());
builder.setTitle(String.format("%1$s", getString(R.string.comprehension_about_us)));
builder.setMessage(getResources().getText(R.string.comprehension_about_text));
builder.setPositiveButton("OK", null);
builder.setPositiveButton(getString(R.string.info_template_ok), null);
AlertDialog welcomeAlert = builder.create();
welcomeAlert.show();
assert welcomeAlert.findViewById(android.R.id.message) != null;
Expand Down Expand Up @@ -110,7 +110,7 @@ public boolean onMenuItemClick(MenuItem menuItem) {
toolbar.setTitle(getResources().getString(R.string.app_name_quiz));

Menu m = navigationView.getMenu();
SubMenu topChannelMenu = m.addSubMenu("Questions");
SubMenu topChannelMenu = m.addSubMenu(getString(R.string.quiz_new_question));
long numQues = db.getCountQuestions();

final String finalQuestionId = questionId;
Expand All @@ -122,7 +122,7 @@ public boolean onMenuItemClick(MenuItem menuItem) {
rg.check(rg.getChildAt(Integer.parseInt(answered)).getId());
}
for (int i = 1; i <= numQues; i++) {
topChannelMenu.add(String.format(Locale.getDefault(), "Question %1$d", i));
topChannelMenu.add(String.format(Locale.getDefault(), getString(R.string.question), i));
topChannelMenu.getItem(i - 1).setIcon(R.drawable.ic_assignment_black_24dp);
final int finalI = i;
topChannelMenu.getItem(i - 1).setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
Expand Down Expand Up @@ -150,7 +150,7 @@ public boolean onMenuItemClick(MenuItem item) {
});
}

((TextView) rootView.findViewById(R.id.question_title)).setText(String.format(Locale.getDefault(), "Question No : %1$s", questionId));
((TextView) rootView.findViewById(R.id.question_title)).setText(String.format(Locale.getDefault(), getString(R.string.quiz_question_no), questionId));
((TextView) rootView.findViewById(R.id.question)).setText(question);
if (option_1 != null) {
rootView.findViewById(R.id.radioButton1).setVisibility(View.VISIBLE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected void onCreate(Bundle savedInstanceState) {
actionBar.setDisplayHomeAsUpEnabled(true);
templateId = getIntent().getIntExtra(Constants.TEMPLATE_ID, -1);
if (templateId == -1) {
Toast.makeText(this, "Invalid template ID, closing Template Editor activity", Toast.LENGTH_LONG).show();
Toast.makeText(this, getString(R.string.invalidTemplate), Toast.LENGTH_LONG).show();
finish();
return;
}
Expand Down Expand Up @@ -101,7 +101,7 @@ private void restoreTemplateEditor(Bundle savedInstanceState) {
Log.d(TAG, "Activity Restored");
selectedTemplate = (TemplateInterface) savedInstanceState.getSerializable(Constants.TEMPLATE_OBJECT);
if (selectedTemplate == null) {
Toast.makeText(this, "Unable to restore Activity state, finsihing Template Editor activity", Toast.LENGTH_LONG).show();
Toast.makeText(this, getString(R.string.unableToRestore), Toast.LENGTH_LONG).show();
finish();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,12 @@ public void onClick(View v) {
boolean isValidated = true;
int checkedAns = getCheckedAnswer(buttons);
if (checkedAns < 0) {
Toast.makeText(context, "Choose a correct option", Toast.LENGTH_SHORT).show();
Toast.makeText(context, R.string.choose_correct_option, Toast.LENGTH_SHORT).show();
isValidated = false;
}
if (question.getText().toString().equals("")) {

question.setError("Question is required");
question.setError(context.getString(R.string.ques_required));
isValidated = false;
}

Expand All @@ -220,7 +220,7 @@ public void onClick(View v) {
}
}
if (optionCount < 2) {
Toast.makeText(context, "Minimum two multiple answers are required.", Toast.LENGTH_SHORT).show();
Toast.makeText(context, R.string.min_answers_required, Toast.LENGTH_SHORT).show();
isValidated = false;
}

Expand Down Expand Up @@ -258,7 +258,7 @@ private void checkButton(ArrayList<RadioButton> buttons, ArrayList<EditText> opt
if (button.getId() == id) {
int index = buttons.indexOf(button);
if (options.get(index).getText().toString().equals("")) {
Toast.makeText(context, "Enter a valid option before marking it as answer", Toast.LENGTH_LONG).show();
Toast.makeText(context, R.string.enter_valid_option, Toast.LENGTH_LONG).show();
button.setChecked(false);
return;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,7 @@ public Object deleteItem(Activity activity, int position) {
setEmptyView(activity);
adapter.notifyDataSetChanged();
}
setEmptyView(activity);
if (comprehensionMetaModel==null)
{
return comprehensionModel;
Expand Down Expand Up @@ -559,7 +560,7 @@ public void restoreItem(Activity activity, int position, Object object) {
}
}
}

setEmptyView(activity);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ public Object deleteItem(Activity activity, int position) {
dictData.remove(position);
setEmptyView(activity);
adapter.notifyDataSetChanged();
setEmptyView(activity);
return dictationModel;
}

Expand All @@ -242,6 +243,7 @@ public void restoreItem(Activity activity, int position, Object object) {
{
dictData.add(position,dictationModel);
adapter.notifyDataSetChanged();
setEmptyView(activity);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public View getView(final int position, View convertView, ViewGroup parent) {
holder.edit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(mContext, "Long press to edit this item", Toast.LENGTH_SHORT).show();
Toast.makeText(mContext, R.string.LongPress_toedit, Toast.LENGTH_SHORT).show();
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ public Object deleteItem(Activity activity, int position) {
mData.remove(position);
setEmptyView(activity);
mAdapter.notifyDataSetChanged();

setEmptyView(activity);
return flashCardModel;
}

Expand All @@ -278,6 +278,7 @@ public void restoreItem(Activity activity, int position, Object object) {
{
mData.add(position,flashCardModel);
mAdapter.notifyDataSetChanged();
setEmptyView(activity);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ public Object deleteItem(Activity activity, int position) {
infoData.remove(position);
setEmptyView(activity);
adapter.notifyDataSetChanged();
setEmptyView(activity);
return infoModel;
}

Expand All @@ -205,6 +206,7 @@ public void restoreItem(Activity activity, int position, Object object) {
{
infoData.add(position,infoModel);
adapter.notifyDataSetChanged();
setEmptyView(activity);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ public Object deleteItem(Activity activity, int position) {
mLearnSpellingData.remove(position);
setEmptyView(activity);
adapter.notifyDataSetChanged();
setEmptyView(activity);
return learnSpellingModel;
}

Expand All @@ -207,6 +208,7 @@ public void restoreItem(Activity activity, int position, Object object) {
{
mLearnSpellingData.add(position,learnSpellingModel);
adapter.notifyDataSetChanged();
setEmptyView(activity);
}
}
}
Expand Down
Loading

0 comments on commit d6987c0

Please sign in to comment.