mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 17:18:52 -06:00
Adjust text size and position on HistoryView and StreakView
This commit is contained in:
@@ -134,8 +134,10 @@ public class HabitHistoryView extends ScrollableDataView implements HabitDataVie
|
||||
setScrollerBucketSize((int) baseSize);
|
||||
|
||||
squareSpacing = UIHelper.dpToPixels(getContext(), 1.0f);
|
||||
float maxTextSize = getResources().getDimensionPixelSize(R.dimen.regularTextSize);
|
||||
float textSize = Math.min(baseSize * 0.5f, maxTextSize);
|
||||
float minTextSize = getResources().getDimension(R.dimen.tinyTextSize);
|
||||
float maxTextSize = getResources().getDimension(R.dimen.regularTextSize);
|
||||
float textSize = height * 0.045f;
|
||||
textSize = Math.max(Math.min(textSize, maxTextSize), minTextSize);
|
||||
|
||||
pSquareFg.setTextSize(textSize);
|
||||
pTextHeader.setTextSize(textSize);
|
||||
@@ -301,11 +303,13 @@ public class HabitHistoryView extends ScrollableDataView implements HabitDataVie
|
||||
|
||||
private void drawAxis(Canvas canvas, RectF location)
|
||||
{
|
||||
float verticalOffset = pTextHeader.getFontSpacing() * 0.4f;
|
||||
|
||||
for (String day : DateHelper.getLocaleDayNames(Calendar.SHORT))
|
||||
{
|
||||
location.offset(0, columnWidth);
|
||||
canvas.drawText(day, location.left + headerTextOffset,
|
||||
location.bottom - headerTextOffset, pTextHeader);
|
||||
location.centerY() + verticalOffset, pTextHeader);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -111,10 +111,11 @@ public class HabitStreakView extends View implements HabitDataView
|
||||
maxStreakCount = height / baseSize;
|
||||
this.width = width;
|
||||
|
||||
int maxTextSize = getResources().getDimensionPixelSize(R.dimen.regularTextSize);
|
||||
float regularTextSize = Math.min(baseSize * 0.56f, maxTextSize);
|
||||
float minTextSize = getResources().getDimension(R.dimen.tinyTextSize);
|
||||
float maxTextSize = getResources().getDimension(R.dimen.regularTextSize);
|
||||
float textSize = baseSize * 0.5f;
|
||||
|
||||
paint.setTextSize(regularTextSize);
|
||||
paint.setTextSize(Math.max(Math.min(textSize, maxTextSize), minTextSize));
|
||||
em = paint.getFontSpacing();
|
||||
textMargin = 0.5f * em;
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
android:minHeight="80dp"
|
||||
android:minWidth="80dp"
|
||||
android:minResizeWidth="40dp"
|
||||
android:minResizeHeight="40dp"
|
||||
android:minResizeHeight="80dp"
|
||||
android:initialLayout="@layout/widget_graph"
|
||||
android:previewImage="@drawable/widget_preview_history"
|
||||
android:resizeMode="vertical|horizontal"
|
||||
|
||||
Reference in New Issue
Block a user