diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java index 43f019da..987528cf 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java @@ -5,6 +5,7 @@ import android.annotation.TargetApi; import android.arch.lifecycle.ViewModelProviders; import android.content.Context; import android.content.Intent; +import android.content.res.Resources; import android.graphics.Color; import android.graphics.Typeface; import android.graphics.drawable.Drawable; @@ -19,6 +20,7 @@ import android.support.v7.widget.AppCompatButton; import android.support.v7.widget.RecyclerView; import android.text.InputType; import android.text.TextUtils; +import android.util.DisplayMetrics; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -193,9 +195,11 @@ class TopicAdapter extends RecyclerView.Adapter { valuesToCompare.add(new BarEntry(i, entries[i].getVotes())); } BarDataSet data = new BarDataSet(valuesToCompare, "Vote Results"); + data.setColor(context.getResources().getColor(R.color.accent)); YAxis yAxisLeft = holder.voteChart.getAxisLeft(); yAxisLeft.setGranularity(1f); + yAxisLeft.setTextColor(context.getResources().getColor(R.color.primary_text)); YAxis yAxisRight = holder.voteChart.getAxisRight(); yAxisRight.setEnabled(false); @@ -212,6 +216,9 @@ class TopicAdapter extends RecyclerView.Adapter { holder.voteChart.setData(barData); holder.voteChart.getLegend().setEnabled(false); holder.voteChart.getDescription().setEnabled(false); + int chartHeightdp = 10 + 30 * entries.length; + DisplayMetrics metrics = context.getResources().getDisplayMetrics(); + holder.voteChart.setMinimumHeight((int) (chartHeightdp * (metrics.densityDpi / 160f))); holder.voteChart.invalidate(); holder.voteChart.setVisibility(View.VISIBLE); } diff --git a/app/src/main/res/layout/activity_topic_poll.xml b/app/src/main/res/layout/activity_topic_poll.xml index 5c779274..e23b57cf 100644 --- a/app/src/main/res/layout/activity_topic_poll.xml +++ b/app/src/main/res/layout/activity_topic_poll.xml @@ -15,7 +15,7 @@