Skip to content

Commit 33bc8f7

Browse files
committed
Merge branch 'hotfix/1.5.3'
2 parents bd6cba8 + 0f223f8 commit 33bc8f7

File tree

9 files changed

+121
-28
lines changed

9 files changed

+121
-28
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
### 1.5.3 (May 22, 2016)
4+
5+
* Complete Arabic and Czech translations
6+
* Fix crash at startup
7+
* Fix checkmark widget on custom launchers
8+
39
### 1.5.2 (May 19, 2016)
410

511
* Fix missing attachment on bug reports

app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
<manifest
2222
package="org.isoron.uhabits"
2323
xmlns:android="http://schemas.android.com/apk/res/android"
24-
android:versionCode="18"
25-
android:versionName="1.5.2">
24+
android:versionCode="19"
25+
android:versionName="1.5.3">
2626

2727
<uses-permission android:name="android.permission.VIBRATE"/>
2828

app/src/main/java/org/isoron/uhabits/helpers/ReminderHelper.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ else if (Build.VERSION.SDK_INT >= 19)
9393
else
9494
manager.set(AlarmManager.RTC_WAKEUP, reminderTime, pendingIntent);
9595

96-
Log.d("ReminderHelper", String.format("Setting alarm (%s): %s...",
97-
DateFormat.getDateTimeInstance().format(new Date(reminderTime)),
98-
habit.name.substring(0, 3)));
96+
String name = habit.name.substring(0, Math.min(3, habit.name.length()));
97+
Log.d("ReminderHelper", String.format("Setting alarm (%s): %s",
98+
DateFormat.getDateTimeInstance().format(new Date(reminderTime)), name));
9999
}
100100

101101
@Nullable

app/src/main/java/org/isoron/uhabits/views/CheckmarkWidgetView.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import android.support.annotation.NonNull;
2424
import android.support.annotation.Nullable;
2525
import android.util.AttributeSet;
26+
import android.util.TypedValue;
2627
import android.widget.TextView;
2728

2829
import org.isoron.uhabits.R;
@@ -40,7 +41,6 @@ public class CheckmarkWidgetView extends HabitWidgetView implements HabitDataVie
4041
@Nullable
4142
private String name;
4243

43-
@Nullable
4444
private RingView ring;
4545
private TextView label;
4646
private int checkmarkValue;
@@ -147,8 +147,22 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
147147
w *= scale;
148148
h *= scale;
149149

150+
if(h < getResources().getDimension(R.dimen.checkmarkWidget_heightBreakpoint))
151+
ring.setVisibility(GONE);
152+
else
153+
ring.setVisibility(VISIBLE);
154+
150155
widthMeasureSpec = MeasureSpec.makeMeasureSpec((int) w, MeasureSpec.EXACTLY);
151156
heightMeasureSpec = MeasureSpec.makeMeasureSpec((int) h, MeasureSpec.EXACTLY);
157+
158+
float textSize = 0.15f * h;
159+
float maxTextSize = getResources().getDimension(R.dimen.smallerTextSize);
160+
textSize = Math.min(textSize, maxTextSize);
161+
162+
label.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
163+
ring.setTextSize(textSize);
164+
ring.setThickness(0.15f * textSize);
165+
152166
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
153167
}
154168

app/src/main/java/org/isoron/uhabits/views/RingView.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ public void setColor(int color)
109109
postInvalidate();
110110
}
111111

112+
public void setTextSize(float textSize)
113+
{
114+
this.textSize = textSize;
115+
}
116+
112117
@Override
113118
public void setBackgroundColor(int backgroundColor)
114119
{

app/src/main/java/org/isoron/uhabits/widgets/BaseWidgetProvider.java

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,11 @@
4545

4646
public abstract class BaseWidgetProvider extends AppWidgetProvider
4747
{
48-
49-
private int portraitWidth, portraitHeight;
50-
private int landscapeWidth, landscapeHeight;
48+
private class WidgetDimensions
49+
{
50+
public int portraitWidth, portraitHeight;
51+
public int landscapeWidth, landscapeHeight;
52+
}
5153

5254
protected abstract int getDefaultHeight();
5355

@@ -71,7 +73,7 @@ public void onDeleted(Context context, int[] appWidgetIds)
7173
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(appContext);
7274

7375
for(Integer id : appWidgetIds)
74-
prefs.edit().remove(getHabitIdKey(id));
76+
prefs.edit().remove(getHabitIdKey(id)).apply();
7577
}
7678

7779
@Override
@@ -98,7 +100,7 @@ public void onUpdate(Context context, AppWidgetManager manager, int[] appWidgetI
98100
private void updateWidget(Context context, AppWidgetManager manager,
99101
int widgetId, Bundle options)
100102
{
101-
updateWidgetSize(context, options);
103+
WidgetDimensions dim = getWidgetDimensions(context, options);
102104

103105
Context appContext = context.getApplicationContext();
104106
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(appContext);
@@ -113,7 +115,7 @@ private void updateWidget(Context context, AppWidgetManager manager,
113115
return;
114116
}
115117

116-
new RenderWidgetTask(widgetId, context, habit, manager).execute();
118+
new RenderWidgetTask(widgetId, context, habit, dim, manager).execute();
117119
}
118120

119121
private void drawErrorWidget(Context context, AppWidgetManager manager, int widgetId)
@@ -159,7 +161,7 @@ private void savePreview(Context context, int widgetId, Bitmap widgetCache, int
159161
}
160162
}
161163

162-
private void updateWidgetSize(Context context, Bundle options)
164+
private WidgetDimensions getWidgetDimensions(Context context, Bundle options)
163165
{
164166
int maxWidth = getDefaultWidth();
165167
int minWidth = getDefaultWidth();
@@ -178,11 +180,12 @@ private void updateWidgetSize(Context context, Bundle options)
178180
options.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT));
179181
}
180182

181-
portraitWidth = minWidth;
182-
portraitHeight = maxHeight;
183-
184-
landscapeWidth = maxWidth;
185-
landscapeHeight = minHeight;
183+
WidgetDimensions ws = new WidgetDimensions();
184+
ws.portraitWidth = minWidth;
185+
ws.portraitHeight = maxHeight;
186+
ws.landscapeWidth = maxWidth;
187+
ws.landscapeHeight = minHeight;
188+
return ws;
186189
}
187190

188191
private void measureCustomView(Context context, int w, int h, View customView)
@@ -212,16 +215,18 @@ private class RenderWidgetTask extends BaseTask
212215
private final Context context;
213216
private final Habit habit;
214217
private final AppWidgetManager manager;
215-
public RemoteViews portraitRemoteViews, landscapeRemoteViews;
216-
public View portraitWidgetView, landscapeWidgetView;
218+
private RemoteViews portraitRemoteViews, landscapeRemoteViews;
219+
private View portraitWidgetView, landscapeWidgetView;
220+
private WidgetDimensions dim;
217221

218-
public RenderWidgetTask(int widgetId, Context context, Habit habit,
222+
public RenderWidgetTask(int widgetId, Context context, Habit habit, WidgetDimensions ws,
219223
AppWidgetManager manager)
220224
{
221225
this.widgetId = widgetId;
222226
this.context = context;
223227
this.habit = habit;
224228
this.manager = manager;
229+
this.dim = ws;
225230
}
226231

227232
@Override
@@ -232,11 +237,12 @@ protected void onPreExecute()
232237

233238
portraitRemoteViews = new RemoteViews(context.getPackageName(), getLayoutId());
234239
portraitWidgetView = buildCustomView(context, habit);
235-
measureCustomView(context, portraitWidth, portraitHeight, portraitWidgetView);
240+
measureCustomView(context, dim.portraitWidth, dim.portraitHeight, portraitWidgetView);
236241

237242
landscapeRemoteViews = new RemoteViews(context.getPackageName(), getLayoutId());
238243
landscapeWidgetView = buildCustomView(context, habit);
239-
measureCustomView(context, landscapeWidth, landscapeHeight, landscapeWidgetView);
244+
measureCustomView(context, dim.landscapeWidth, dim.landscapeHeight,
245+
landscapeWidgetView);
240246
}
241247

242248
private void updateAppWidget()
@@ -260,8 +266,10 @@ protected void onPostExecute(Void aVoid)
260266
{
261267
try
262268
{
263-
buildRemoteViews(portraitWidgetView, portraitRemoteViews, portraitWidth, portraitHeight);
264-
buildRemoteViews(landscapeWidgetView, landscapeRemoteViews, landscapeWidth, landscapeHeight);
269+
buildRemoteViews(portraitWidgetView, portraitRemoteViews,
270+
dim.portraitWidth, dim.portraitHeight);
271+
buildRemoteViews(landscapeWidgetView, landscapeRemoteViews,
272+
dim.landscapeWidth, dim.landscapeHeight);
265273
updateAppWidget();
266274
}
267275
catch (Exception e)
@@ -273,7 +281,8 @@ protected void onPostExecute(Void aVoid)
273281
super.onPostExecute(aVoid);
274282
}
275283

276-
private void buildRemoteViews(View widgetView, RemoteViews remoteViews, int width, int height)
284+
private void buildRemoteViews(View widgetView, RemoteViews remoteViews, int width,
285+
int height)
277286
{
278287
widgetView.invalidate();
279288
widgetView.setDrawingCacheEnabled(true);
@@ -287,7 +296,6 @@ private void buildRemoteViews(View widgetView, RemoteViews remoteViews, int widt
287296
int imageWidth = widgetView.getMeasuredWidth();
288297
int imageHeight = widgetView.getMeasuredHeight();
289298
int p[] = getPadding(width, height, imageWidth, imageHeight);
290-
291299
remoteViews.setViewPadding(R.id.buttonOverlay, p[0], p[1], p[2], p[3]);
292300
}
293301

app/src/main/res/values-ar/strings.xml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,4 +159,32 @@
159159
<string name="bug_report_failed">"فشل في توليد تقرير الاعطال"</string>
160160
<string name="generate_bug_report">"توليد تقرير الاعطال"</string>
161161
<string name="troubleshooting">"استكشاف الأخطاء وإصلاحها"</string>
162+
<string name="help_translate">"المساعدة في ترجمة هذا البرنامج"</string>
163+
<string name="night_mode">"الوضع الليلي"</string>
164+
<string name="use_pure_black">"استخدام أسود نقي في الوضع الليلي"</string>
165+
<string name="pure_black_description">"يستبدل خلفيات رمادية مع أسود نقي في الوضع الليلي. يقلل من استهلاك البطارية في الهواتف مع شاشة AMOLED."</string>
166+
<string name="interface_preferences">"السطح البيني"</string>
167+
<string name="reverse_days">"ترتيب عكسي أيام"</string>
168+
<string name="reverse_days_description">"عرض أيام في ترتيب عكسي على الشاشة الرئيسية"</string>
169+
<string name="day">"يوم"</string>
170+
<string name="week">"أسبوع"</string>
171+
<string name="month">"شهر"</string>
172+
173+
<!-- Three-month period -->
174+
<string name="quarter">"ربع سنه"</string>
175+
<string name="year">"عام"</string>
176+
177+
<!-- Middle part of the sentence '1 time in xx days' -->
178+
<!-- Middle part of the sentence '1 time in xx days' -->
179+
<string name="time_every">"مرات في"</string>
180+
<string name="every_x_days">"كل %d أيام"</string>
181+
<string name="every_x_weeks">"كل %d أسابيع"</string>
182+
<string name="every_x_months">"كل %d أشهر"</string>
183+
184+
<!-- The old "habit strength" has been replaced by "score". Feel free to translate "score" as "strength" or "stability" if it sounds more natural in your language. -->
185+
<string name="score">"النقاط"</string>
186+
<string name="reminder_sound">"صوت تذكير"</string>
187+
188+
<!-- Appears when the user disables the reminder sound. Could also be "no sound", "mute" or "silent". -->
189+
<string name="none">"صامت"</string>
162190
</resources>

app/src/main/res/values-cs/strings.xml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
3-
<string name="app_name">"Loop Habit Tracker</string>
3+
4+
<!-- Fuzzy -->
5+
<string name="app_name">"Loop Habit Tracker"</string>
46
<string name="main_activity_title">"Zvyky"</string>
57
<string name="action_settings">"Nastavení"</string>
68
<string name="edit">"Upravit"</string>
@@ -150,4 +152,32 @@ Upomínky mohou být potvrzen, odloženy nebo smazány přímo z tvého zaříze
150152
<string name="bug_report_failed">"Generace výpisu chyb selhala."</string>
151153
<string name="generate_bug_report">"Generovat výpis chyb"</string>
152154
<string name="troubleshooting">"Řešení problémů"</string>
155+
<string name="help_translate">"Pomozte s překladem aplikace"</string>
156+
<string name="night_mode">"Noční téma"</string>
157+
<string name="use_pure_black">"Zobrazit čistě černou v nočním tématu"</string>
158+
<string name="pure_black_description">"Nahradí šedé pozadí čistou černou v nočním tématu. Snižuje spotřebu baterie v telefonech s AMOLED displejem."</string>
159+
<string name="interface_preferences">"Rozhraní"</string>
160+
<string name="reverse_days">"Otočit pořadí dnů"</string>
161+
<string name="reverse_days_description">"Zobrazí dny na úvodní stránce v obráceném pořadí"</string>
162+
<string name="day">"Den"</string>
163+
<string name="week">"Týden"</string>
164+
<string name="month">"Měsíc"</string>
165+
166+
<!-- Three-month period -->
167+
<string name="quarter">"Čtvrtletí"</string>
168+
<string name="year">"Rok"</string>
169+
170+
<!-- Middle part of the sentence '1 time in xx days' -->
171+
<!-- Middle part of the sentence '1 time in xx days' -->
172+
<string name="time_every">"krát za"</string>
173+
<string name="every_x_days">"Každých %d dní"</string>
174+
<string name="every_x_weeks">"Každých %d týdnů"</string>
175+
<string name="every_x_months">"Každých %d měsíců"</string>
176+
177+
<!-- The old "habit strength" has been replaced by "score". Feel free to translate "score" as "strength" or "stability" if it sounds more natural in your language. -->
178+
<string name="score">"Skóre"</string>
179+
<string name="reminder_sound">"Zvuk upomínky"</string>
180+
181+
<!-- Appears when the user disables the reminder sound. Could also be "no sound", "mute" or "silent". -->
182+
<string name="none">"Žádný"</string>
153183
</resources>

app/src/main/res/values/dimens.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@
2626
<dimen name="history_max_font_size">@dimen/regularTextSize</dimen>
2727
<dimen name="regularTextSize">16sp</dimen>
2828
<dimen name="smallTextSize">14sp</dimen>
29+
<dimen name="smallerTextSize">12sp</dimen>
2930
<dimen name="tinyTextSize">10sp</dimen>
3031
<dimen name="habitNameWidth">160dp</dimen>
3132
<dimen name="progressbarOffset">-10dp</dimen>
33+
<dimen name="checkmarkWidget_heightBreakpoint">55dp</dimen>
3234
</resources>

0 commit comments

Comments
 (0)