1
0

Add sonarqube (#37)

This commit is contained in:
Mikołaj Pich
2017-11-26 16:32:33 +01:00
committed by Rafał Borcz
parent 9ee0ca3010
commit 647ed08460
39 changed files with 277 additions and 148 deletions

View File

@ -86,22 +86,20 @@ public class GradesDialogFragment extends DialogFragment {
public static int colorHexToColorName(String hexColor) {
switch (hexColor) {
case "000000": {
case "000000":
return R.string.color_black_text;
}
case "F04C4C": {
return R.string.color_red_text;
}
case "20A4F7": {
return R.string.color_blue_text;
}
case "6ECD07": {
return R.string.color_green_text;
}
default: {
return R.string.noColor_text;
}
case "F04C4C":
return R.string.color_red_text;
case "20A4F7":
return R.string.color_blue_text;
case "6ECD07":
return R.string.color_green_text;
default:
return R.string.noColor_text;
}
}
}

View File

@ -106,7 +106,7 @@ public class GradesFragment extends Fragment {
for (Subject subject : account.getSubjectList()) {
List<Grade> gradeList = subject.getGradeList();
if (gradeList.size() != 0) {
if (!gradeList.isEmpty()) {
SubjectWithGrades subjectWithGrades = new SubjectWithGrades(subject.getName(), gradeList);
subjectWithGradesList.add(subjectWithGrades);
}
@ -133,11 +133,12 @@ public class GradesFragment extends Fragment {
return null;
}
@Override
protected void onPostExecute(Void result) {
super.onPostExecute(result);
createExpList(mainView.get(), activity.get());
mainView.get().findViewById(R.id.loadingPanel).setVisibility(View.INVISIBLE);
if (subjectWithGradesList.size() == 0) {
if (subjectWithGradesList.isEmpty()) {
mainView.get().findViewById(R.id.fragment_no_grades).setVisibility(View.VISIBLE);
}
}

View File

@ -202,7 +202,7 @@ public class LoginActivity extends Activity {
|| ev.getAction() == MotionEvent.ACTION_MOVE) && view instanceof EditText
&& !view.getClass().getName().startsWith("android.webkit.")) {
int coordinators[] = new int[2];
int[] coordinators = new int[2];
view.getLocationOnScreen(coordinators);
float x = ev.getRawX() + view.getLeft() - coordinators[0];
float y = ev.getRawY() + view.getTop() - coordinators[1];

View File

@ -7,7 +7,11 @@ import java.util.List;
import io.github.wulkanowy.dao.entities.Grade;
public abstract class EntitiesCompare {
public class EntitiesCompare {
private EntitiesCompare() {
throw new IllegalStateException("Utility class");
}
public static List<Grade> compareGradeList(List<Grade> newList, List<Grade> oldList) {
@ -18,7 +22,7 @@ public abstract class EntitiesCompare {
List<Grade> lastList = new ArrayList<>();
for (Grade grade : addedOrUpdatedGradeList) {
if (oldList.size() != 0) {
if (!oldList.isEmpty()) {
grade.setRead(false);
grade.setIsNew(true);
}

View File

@ -8,7 +8,7 @@ import io.github.wulkanowy.utilities.RootUtilities;
public class Safety extends Scrambler {
public String encrypt(String email, String plainText, Context context) throws CryptoException, UnsupportedOperationException {
public String encrypt(String email, String plainText, Context context) throws CryptoException {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
loadKeyStore();

View File

@ -32,7 +32,7 @@ public class Scrambler {
private static final String ANDROID_KEYSTORE = "AndroidKeyStore";
public final static String DEBUG_TAG = "WulkanowySecurity";
public static final String DEBUG_TAG = "WulkanowySecurity";
private KeyStore keyStore;

View File

@ -39,8 +39,7 @@ public class VulcanSynchronization {
}
public void firstLoginSignInStep(Context context, DaoSession daoSession)
throws NotLoggedInErrorException, AccountPermissionException, IOException, CryptoException,
UnsupportedOperationException {
throws NotLoggedInErrorException, AccountPermissionException, IOException, CryptoException {
if (firstAccountLogin != null && certificate != null) {
loginSession = firstAccountLogin.login(context, daoSession, certificate);
} else {

View File

@ -44,8 +44,7 @@ public class FirstAccountLogin {
}
public LoginSession login(Context context, DaoSession daoSession, String certificate)
throws NotLoggedInErrorException, AccountPermissionException, IOException, CryptoException,
UnsupportedOperationException {
throws NotLoggedInErrorException, AccountPermissionException, IOException, CryptoException{
long userId;

View File

@ -4,7 +4,11 @@ import java.util.List;
import io.github.wulkanowy.dao.entities.Grade;
public abstract class AverageCalculator {
public class AverageCalculator {
private AverageCalculator() {
throw new IllegalStateException("Utility class");
}
public static float calculate(List<Grade> gradeList) {

View File

@ -4,7 +4,11 @@ import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
public abstract class ConnectionUtilities {
public class ConnectionUtilities {
private ConnectionUtilities() {
throw new IllegalStateException("Utility class");
}
public static boolean isOnline(Context context) {
ConnectivityManager connectivityManager =

View File

@ -7,7 +7,11 @@ import java.util.List;
import io.github.wulkanowy.dao.entities.Grade;
import io.github.wulkanowy.dao.entities.Subject;
public abstract class ConversionVulcanObject {
public class ConversionVulcanObject {
private ConversionVulcanObject() {
throw new IllegalStateException("Utility class");
}
public static List<Subject> subjectsToSubjectEntities(List<io.github.wulkanowy.api.grades.Subject> subjectList) {

View File

@ -7,12 +7,16 @@ import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
abstract public class DateHelper {
public class DateHelper {
private static final long TICKS_AT_EPOCH = 621355968000000000L;
private static final long TICKS_PER_MILLISECOND = 10000;
private DateHelper() {
throw new IllegalStateException("Utility class");
}
public static long getTicks(Date date) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);

View File

@ -1,11 +1,14 @@
package io.github.wulkanowy.utilities;
import android.os.Build;
import java.io.File;
abstract public class RootUtilities {
public class RootUtilities {
private RootUtilities() {
throw new IllegalStateException("Utility class");
}
public static boolean isRooted() {
String buildTags = Build.TAGS;