Skip to content

Commit

Permalink
Merge pull request #340 from codingblazer/lint_issues_2
Browse files Browse the repository at this point in the history
#279 lint issues solved
  • Loading branch information
opticod authored Jan 17, 2017
2 parents b8aa45e + d6987c0 commit d1755c2
Show file tree
Hide file tree
Showing 55 changed files with 171 additions and 160 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ private static void allowPermissionsIfNeeded() {
try {
allowPermissions.click();
} catch (UiObjectNotFoundException e) {
e.printStackTrace();
}
}
}
Expand All @@ -118,13 +119,13 @@ public void run() {
});
}

public void toolbarTitle() {
private void toolbarTitle() {
String title = "Comprehension Template";
onView(allOf(instanceOf(TextView.class), withParent(withId(R.id.toolbar))))
.check(matches(withText(title)));
}

public void addMetaDetails() {
private void addMetaDetails() {
String passTitle = "PassageTitle";
String passage = "Short Passage.";
String timer = "180";
Expand All @@ -143,7 +144,7 @@ public void addMetaDetails() {

}

public void editMetaDetails() {
private void editMetaDetails() {
String passTitle = "EditedPassageTitle";
String passage = "EditedShort Passage.";

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

}

public void addQuestions() {
private void addQuestions() {
String question = "This is just a silly question whose answer is (b).";

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

}

public void editQuestions() {
private void editQuestions() {
String question = "This is just a silly question whose answer changed to (a).";

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

}

public void addTemplate() {
private void addTemplate() {

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

public void saveAPK() {
private void saveAPK() {

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

public void checkSimulator() {
private void checkSimulator() {
onView(withId(R.id.action_simulate)).perform(click());
onView(withText("Testing template")).check(matches(isDisplayed()));
onView(withText("Anupam")).check(matches(isDisplayed()));
Expand Down
1 change: 1 addition & 0 deletions source-code/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
android:required="true" />

<application
android:fullBackupContent="true"
android:name=".ToolkitApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ protected void onCreate(Bundle savedInstanceState) {
((TextView) findViewById(R.id.app_version)).setText(String.format(Locale.ENGLISH, "Version: %s", version));
} catch (PackageManager.NameNotFoundException e) {
assert findViewById(R.id.app_version) != null;
assert ((TextView) findViewById(R.id.app_version)) != null;
((TextView) findViewById(R.id.app_version)).setText("Version: 2.5.0");
assert ( findViewById(R.id.app_version)) != null;
((TextView) findViewById(R.id.app_version)).setText("Version: 1.0");
e.printStackTrace();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import android.view.animation.AnimationUtils;
import android.widget.EditText;


import com.crashlytics.android.Crashlytics;

import org.buildmlearn.toolkit.R;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import android.os.Handler;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
Expand Down Expand Up @@ -44,7 +44,7 @@ public class HomeActivity extends AppCompatActivity

private SmoothNavigationToggle smoothNavigationToggle;

NavigationView navigationView;
private NavigationView navigationView;

/**
* {@inheritDoc}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ public void onRequestPermissionsResult(int requestCode,
ToolkitApplication mToolkitApplication = new ToolkitApplication();
mToolkitApplication.storagePathsValidate();
}
return;

}

}
Expand Down Expand Up @@ -683,10 +683,10 @@ private String saveProject() {
EditText authorEditText = (EditText) findViewById(R.id.author_name);
titleEditText = (EditText) findViewById(R.id.template_title);
assert findViewById(R.id.author_name) != null;
assert ((EditText) findViewById(R.id.author_name)) != null;
assert ( findViewById(R.id.author_name)) != null;
String author = ((EditText) findViewById(R.id.author_name)).getText().toString();
assert findViewById(R.id.template_title) != null;
assert ((EditText) findViewById(R.id.template_title)) != null;
assert ( findViewById(R.id.template_title)) != null;
String title = ((EditText) findViewById(R.id.template_title)).getText().toString();
if ("".equals(author)) {
assert authorEditText != null;
Expand Down Expand Up @@ -783,9 +783,9 @@ public void onBackPressed() {
*/
private String saveDraft() {

assert ((EditText) findViewById(R.id.author_name)) != null;
assert ( findViewById(R.id.author_name)) != null;
String author = ((EditText) findViewById(R.id.author_name)).getText().toString();
assert ((EditText) findViewById(R.id.template_title)) != null;
assert ( findViewById(R.id.template_title)) != null;
String title = ((EditText) findViewById(R.id.template_title)).getText().toString();


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public TemplateAdapter(Context context) {
this.context = context;
}

public static boolean cancelPotentialWork(int data, ImageView imageView) {
private static boolean cancelPotentialWork(int data, ImageView imageView) {
final BitmapWorkerTask bitmapWorkerTask = getBitmapWorkerTask(imageView);

if (bitmapWorkerTask != null) {
Expand Down Expand Up @@ -153,8 +153,8 @@ enum ListColor {
final
int color;

ListColor(String colorCode) {
this.color = Color.parseColor(colorCode);
ListColor( String colorCode) {
this.color = Color.parseColor(colorCode);
}

public int getColor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import android.preference.PreferenceManager;
import android.support.annotation.ColorRes;
import android.support.v4.view.PagerAdapter;
import android.view.LayoutInflater;

import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
Expand Down Expand Up @@ -58,15 +58,14 @@ public Object instantiateItem(ViewGroup container, final int position) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mActivity);
boolean SkipTutorial = prefs.getBoolean("SkipTutorial",false);

LayoutInflater inflater = (LayoutInflater) container.getContext()
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);


Tutorial tutorial = getItem(position);


View convertView;
if (tutorial.isLastScreen()) {
convertView = inflater.inflate(R.layout.tutorial_layout_finish, null);
convertView = View.inflate(mActivity,R.layout.tutorial_layout_finish, null);

convertView.findViewById(R.id.finish_tutorial_button).setOnClickListener(new View.OnClickListener() {
@Override
Expand All @@ -78,7 +77,7 @@ public void onClick(View v) {
}
});
} else {
convertView = inflater.inflate(R.layout.tutorial_layout, null);
convertView = View.inflate(mActivity,R.layout.tutorial_layout, null);
View skip_button = convertView.findViewById(R.id.skip_button);
skip_button.setVisibility(View.GONE);
ImageView deviceImage = (ImageView) convertView
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public boolean onMenuItemClick(MenuItem menuItem) {
welcomeAlert.show();
assert welcomeAlert.findViewById(android.R.id.message) != null;
assert welcomeAlert.findViewById(android.R.id.message) != null;
assert ((TextView) welcomeAlert.findViewById(android.R.id.message)) != null;
assert ( welcomeAlert.findViewById(android.R.id.message)) != null;
((TextView) welcomeAlert.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance());
break;
default: //do nothing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public boolean onMenuItemClick(MenuItem menuItem) {
welcomeAlert.show();
assert welcomeAlert.findViewById(android.R.id.message) != null;
assert welcomeAlert.findViewById(android.R.id.message) != null;
assert ((TextView) welcomeAlert.findViewById(android.R.id.message)) != null;
assert ( welcomeAlert.findViewById(android.R.id.message)) != null;
((TextView) welcomeAlert.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance());
break;
default: //do nothing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public boolean onMenuItemClick(MenuItem menuItem) {
welcomeAlert.show();
assert welcomeAlert.findViewById(android.R.id.message) != null;
assert welcomeAlert.findViewById(android.R.id.message) != null;
assert ((TextView) welcomeAlert.findViewById(android.R.id.message)) != null;
assert ( welcomeAlert.findViewById(android.R.id.message)) != null;
((TextView) welcomeAlert.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance());
break;
default: //do nothing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.app.FragmentManager;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.Cursor;
Expand Down Expand Up @@ -99,7 +100,7 @@ public boolean onMenuItemClick(MenuItem menuItem) {
welcomeAlert.show();
assert welcomeAlert.findViewById(android.R.id.message) != null;
assert welcomeAlert.findViewById(android.R.id.message) != null;
assert ((TextView) welcomeAlert.findViewById(android.R.id.message)) != null;
assert ( welcomeAlert.findViewById(android.R.id.message)) != null;
((TextView) welcomeAlert.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance());
break;
default: //do nothing
Expand Down Expand Up @@ -253,7 +254,7 @@ public void onError(String utteranceId) {
});
}

SharedPreferences prefs = getActivity().getSharedPreferences("Radio", getContext().MODE_PRIVATE);
SharedPreferences prefs = getActivity().getSharedPreferences("Radio", Context.MODE_PRIVATE);
float rate = prefs.getInt("radio_b", 1);
if (rate == 0) {
rate = 0.5F;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.buildmlearn.toolkit.dictationtemplate.fragment;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.Cursor;
Expand Down Expand Up @@ -102,7 +103,7 @@ public boolean onMenuItemClick(MenuItem menuItem) {
AlertDialog welcomeAlert = builder.create();
welcomeAlert.show();
assert welcomeAlert.findViewById(android.R.id.message) != null;
assert ((TextView) welcomeAlert.findViewById(android.R.id.message)) != null;
assert ( welcomeAlert.findViewById(android.R.id.message)) != null;
((TextView) welcomeAlert.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance());
break;
default: //do nothing
Expand Down Expand Up @@ -137,7 +138,7 @@ public void onItemClick(AdapterView<?> adapterView, View view, int position, lon
mPosition = savedInstanceState.getInt(SELECTED_KEY);
}

SharedPreferences prefs = getActivity().getSharedPreferences("Radio", getContext().MODE_PRIVATE);
SharedPreferences prefs = getActivity().getSharedPreferences("Radio", Context.MODE_PRIVATE);
int pos = prefs.getInt("radio_b", 1);
RadioGroup rg = (RadioGroup) rootView.findViewById(R.id.radio_group);
rg.check(rg.getChildAt(pos).getId());
Expand Down Expand Up @@ -171,7 +172,7 @@ public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) {
rootView.findViewById(R.id.radioButton1).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SharedPreferences.Editor editor = getActivity().getSharedPreferences("Radio", getContext().MODE_PRIVATE).edit();
SharedPreferences.Editor editor = getActivity().getSharedPreferences("Radio", Context.MODE_PRIVATE).edit();
editor.putInt("radio_b", 0);
editor.apply();
}
Expand All @@ -180,7 +181,7 @@ public void onClick(View v) {
rootView.findViewById(R.id.radioButton2).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SharedPreferences.Editor editor = getActivity().getSharedPreferences("Radio", getContext().MODE_PRIVATE).edit();
SharedPreferences.Editor editor = getActivity().getSharedPreferences("Radio", Context.MODE_PRIVATE).edit();
editor.putInt("radio_b", 1);
editor.apply();
}
Expand All @@ -189,7 +190,7 @@ public void onClick(View v) {
rootView.findViewById(R.id.radioButton3).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SharedPreferences.Editor editor = getActivity().getSharedPreferences("Radio", getContext().MODE_PRIVATE).edit();
SharedPreferences.Editor editor = getActivity().getSharedPreferences("Radio", Context.MODE_PRIVATE).edit();
editor.putInt("radio_b", 2);
editor.apply();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public boolean onMenuItemClick(MenuItem menuItem) {
welcomeAlert.show();
assert welcomeAlert.findViewById(android.R.id.message) != null;
assert welcomeAlert.findViewById(android.R.id.message) != null;
assert ((TextView) welcomeAlert.findViewById(android.R.id.message)) != null;
assert ( welcomeAlert.findViewById(android.R.id.message)) != null;
((TextView) welcomeAlert.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance());
break;
default: //do nothing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public boolean onMenuItemClick(MenuItem menuItem) {
welcomeAlert.show();
assert welcomeAlert.findViewById(android.R.id.message) != null;
assert welcomeAlert.findViewById(android.R.id.message) != null;
assert ((TextView) welcomeAlert.findViewById(android.R.id.message)) != null;
assert ( welcomeAlert.findViewById(android.R.id.message)) != null;
((TextView) welcomeAlert.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance());
break;
default: //do nothing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public boolean onMenuItemClick(MenuItem menuItem) {
welcomeAlert.show();
assert welcomeAlert.findViewById(android.R.id.message) != null;
assert welcomeAlert.findViewById(android.R.id.message) != null;
assert ((TextView) welcomeAlert.findViewById(android.R.id.message)) != null;
assert ( welcomeAlert.findViewById(android.R.id.message)) != null;
((TextView) welcomeAlert.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance());
break;
default: //do nothing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@ public class SettingsFragment extends PreferenceFragment {
private static final int REQUEST_PICK_APK = 9985;
private Preference prefUsername;

public static float deleteDirectory(File file, float size) {
private static float deleteDirectory(File file, float size) {
if (file.exists()) {
File[] listFiles = file.listFiles();
if (listFiles == null) return 0;

for (int i = 0; i < listFiles.length; i++) {
if (listFiles[i].isDirectory()) {
size += deleteDirectory(listFiles[i], 0);
for (File listFile : listFiles) {
if (listFile.isDirectory()) {
size += deleteDirectory(listFile, 0);
} else {
size += listFiles[i].length();
listFiles[i].delete();
size += listFile.length();
listFile.delete();
}
}
}
Expand Down Expand Up @@ -140,9 +140,9 @@ public void initRestoreProjectDialog() {
startActivityForResult(intent, REQUEST_PICK_APK);
}

public void resetUserName() {
LayoutInflater inflater = getActivity().getLayoutInflater();
View dialogView = inflater.inflate(R.layout.dialog_settings_your_name, null);
private void resetUserName() {

View dialogView = View.inflate(getActivity(),R.layout.dialog_settings_your_name, null);
final EditText editInput = (EditText) dialogView.findViewById(R.id.et_dialog_settings_your_name);
editInput.setText(prefUsername.getSummary());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public boolean onMenuItemClick(MenuItem menuItem) {
welcomeAlert.show();
assert welcomeAlert.findViewById(android.R.id.message) != null;
assert welcomeAlert.findViewById(android.R.id.message) != null;
assert ((TextView) welcomeAlert.findViewById(android.R.id.message)) != null;
assert ( welcomeAlert.findViewById(android.R.id.message)) != null;
((TextView) welcomeAlert.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance());
break;
default: //do nothing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public boolean onMenuItemClick(MenuItem menuItem) {
AlertDialog welcomeAlert = builder.create();
welcomeAlert.show();
assert welcomeAlert.findViewById(android.R.id.message) != null;
assert ((TextView) welcomeAlert.findViewById(android.R.id.message)) != null;
assert ( welcomeAlert.findViewById(android.R.id.message)) != null;
((TextView) welcomeAlert.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance());
break;
default: //do nothing
Expand Down
Loading

0 comments on commit d1755c2

Please sign in to comment.