Showing 231 of 426 total issues
Method setUi
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private void setUi() {
// status bar
activity.findViewById(R.id.status_bar).setBackgroundColor(about.getColor());
if (about == null) {
Method onWindowFocusChanged
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
Open
@Override
public void onWindowFocusChanged(boolean hasFocus) {
Log.i("MainActivity", "onWindowFocusChanged");
if (preferences.getStopOnFocusLoss()) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method onAnimationEnd
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
@Override
public void onAnimationEnd(Animation anim) {
if (!isOnAnimationEndCalled) {
Log.d("TutorialView", "animation.onAnimationEnd " + view.getTag());
if (view != null) {
Method onPostExecute
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
@Override
protected void onPostExecute(Void aVoid) {
if (isCancelled()) {
onLoadFinish();
} else {
Method setPad
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
void setPad() {
// set the onTouchListener
if (view != null && color != 0 && colorDef != 0 && activity != null) {
// initialized check
view.setOnTouchListener(new OnSwipeTouchListener(activity) {
Method setViewPager
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private void setViewPager() {
if (hasPermission) {
Log.d(TAG, "setViewPager");
installedFragment = new PresetStoreInstalledFragment();
Consider simplifying this complex logical expression. Open
Open
if (presetName != null) {
// preset available
File folderSound = new File(PROJECT_LOCATION_PRESETS + "/" + presetName + "/sounds");
File folderTiming = new File(PROJECT_LOCATION_PRESETS + "/" + presetName + "/timing");
File folderAbout = new File(PROJECT_LOCATION_PRESETS + "/" + presetName + "/about");
Method setButtonLayout
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private void setButtonLayout() {
int screenWidthPx = (int) (w.getWindowWidthPx(a) * preferences.getDeckMargin());
int marginPx = w.getWindowWidthPx(a) / 160;
int newWidthPx;
int newHeightPx;
Method onPostExecute
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
@Override
protected void onPostExecute(Integer integer) {
if (!isCancelled()) {
// Completed downloading
item.clear();
Method fadeOut
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public void fadeOut(final int id, final int delay, final long duration, Activity activity) {
final AlphaAnimation fadeOut = new AlphaAnimation(1.0f, 0.0f);
final View view = activity.findViewById(id);
if (view.getVisibility() == View.VISIBLE) {
Method setPadColor
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
void setPadColor() {
setPadColor(color);
switch (PAD_PATTERN) {
case 1:
Method fadeOut
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public void fadeOut(final View view, final int delay, final long duration, Activity activity) {
final AlphaAnimation fadeOut = new AlphaAnimation(1.0f, 0.0f);
if (view.getVisibility() == View.VISIBLE) {
PowerManager powerManager = (PowerManager) activity.getSystemService(POWER_SERVICE);
Method setPadColorToDefault
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
void setPadColorToDefault() {
switch (PAD_PATTERN) {
case 1:
// 4 side
if (row - 1 > 0) {
Method fadeOut
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public void fadeOut(final int id, final int delay, final long duration, View parentView, Activity activity) {
final AlphaAnimation fadeOut = new AlphaAnimation(1.0f, 0.0f);
final View view = parentView.findViewById(id);
PowerManager powerManager = (PowerManager) activity.getSystemService(POWER_SERVICE);
Method download
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public void download(final Runnable onFinish, final Activity activity) {
// download the preset from presetStore
final Item item = this;
if (isConnected(activity)) {
if (isWifiConnected(activity)) {
Method fadeIn
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public void fadeIn(final int id, final int delay, final long duration, String handlerName, View parentView, Activity activity) {
final AlphaAnimation fadeIn = new AlphaAnimation(0.0f, 1.0f);
final View view = parentView.findViewById(id);
view.setVisibility(View.INVISIBLE);
PowerManager powerManager = (PowerManager) activity.getSystemService(POWER_SERVICE);
Method fadeIn
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public void fadeIn(final int id, final int delay, final long duration, String handlerName, Activity activity) {
final AlphaAnimation fadeIn = new AlphaAnimation(0.0f, 1.0f);
final View view = activity.findViewById(id);
view.setVisibility(View.INVISIBLE);
PowerManager powerManager = (PowerManager) activity.getSystemService(POWER_SERVICE);
Method setPad
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
@Override
void setPad() {
if (normal != null && view != null && color != 0 && colorDef != 0 && activity != null) {
// initialized check, normal should be not null
view.setOnTouchListener(new OnSwipeTouchListener(activity) {
Method fadeIn
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public void fadeIn(final View view, final int delay, final long duration, String handlerName, Activity activity) {
final AlphaAnimation fadeIn = new AlphaAnimation(0.0f, 1.0f);
view.setVisibility(View.INVISIBLE);
PowerManager powerManager = (PowerManager) activity.getSystemService(POWER_SERVICE);
Method moveXYinDP
has 14 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public void moveXYinDP(View view,
int fromX, int toX,
int durationX, int delayX, TimeInterpolator intX,
int fromY, int toY,
int durationY, int delayY, TimeInterpolator intY,