Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: DropletCreateActivity crash - Fedora Atomic unhandled #103

Merged
merged 1 commit into from
Jul 25, 2018

Conversation

firefinchdev
Copy link
Contributor

No description provided.

@firefinchdev
Copy link
Contributor Author

Fixes #102

@codecov
Copy link

codecov bot commented Jul 24, 2018

Codecov Report

Merging #103 into master will decrease coverage by 0.05%.
The diff coverage is 0%.

Impacted file tree graph

@@             Coverage Diff             @@
##             master    #103      +/-   ##
===========================================
- Coverage     26.65%   26.6%   -0.06%     
  Complexity       33      33              
===========================================
  Files            83      83              
  Lines          1883    1887       +4     
  Branches         93      93              
===========================================
  Hits            502     502              
- Misses         1343    1347       +4     
  Partials         38      38
Impacted Files Coverage Δ Complexity Δ
...in/tosc/digitaloceanapp/adapters/ImageAdapter.java 46.83% <0%> (-2.5%) 0 <0> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 039bb50...85744d8. Read the comment docs.

@firefinchdev
Copy link
Contributor Author

screenshot_20180725-011652

@4lch4
Copy link
Contributor

4lch4 commented Jul 25, 2018

In order to fix the CodeClimate issue, I'd recommend we do something like so:

public void selectImage(int position, ViewHolder holder) {
    String distro = imageList.get(position).getDistribution();
    int selectorImage = 0;

    if (distro.contains("CoreOS")) selectorImage = R.drawable.coreos_selected;
    else if (distro.contains("FreeBSD")) selectorImage = R.drawable.freebsd_selected;
    else if (distro.contains("Fedora")) selectorImage = R.drawable.fedora_selected;
    else if (distro.contains("Debian")) selectorImage = R.drawable.debian_selected;
    else if (distro.contains("CentOS")) selectorImage = R.drawable.centos_selected;
    else if (distro.contains("Ubuntu")) selectorImage = R.drawable.ubuntu_selected;

    holder.imageImage.setBackground(ContextCompat.getDrawable(context, selectorImage));
    Log.i("OnClick", imageList.get(position).getDistribution());
    holder.imageImage.setTag(true);
}

This way we can check for multiple variations of Fedora or Ubuntu w/out adding a bunch of case statements.

@championswimmer championswimmer merged commit a598ff3 into coding-blocks:master Jul 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants