Skip to content

Commit

Permalink
Merge branch 'hotfix/1.5.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
iSoron committed May 22, 2016
2 parents bd6cba8 + 0f223f8 commit 33bc8f7
Show file tree
Hide file tree
Showing 9 changed files with 121 additions and 28 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

### 1.5.3 (May 22, 2016)

* Complete Arabic and Czech translations
* Fix crash at startup
* Fix checkmark widget on custom launchers

### 1.5.2 (May 19, 2016)

* Fix missing attachment on bug reports
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
<manifest
package="org.isoron.uhabits"
xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="18"
android:versionName="1.5.2">
android:versionCode="19"
android:versionName="1.5.3">

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ else if (Build.VERSION.SDK_INT >= 19)
else
manager.set(AlarmManager.RTC_WAKEUP, reminderTime, pendingIntent);

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

@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.widget.TextView;

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

@Nullable
private RingView ring;
private TextView label;
private int checkmarkValue;
Expand Down Expand Up @@ -147,8 +147,22 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
w *= scale;
h *= scale;

if(h < getResources().getDimension(R.dimen.checkmarkWidget_heightBreakpoint))
ring.setVisibility(GONE);
else
ring.setVisibility(VISIBLE);

widthMeasureSpec = MeasureSpec.makeMeasureSpec((int) w, MeasureSpec.EXACTLY);
heightMeasureSpec = MeasureSpec.makeMeasureSpec((int) h, MeasureSpec.EXACTLY);

float textSize = 0.15f * h;
float maxTextSize = getResources().getDimension(R.dimen.smallerTextSize);
textSize = Math.min(textSize, maxTextSize);

label.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
ring.setTextSize(textSize);
ring.setThickness(0.15f * textSize);

super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}

Expand Down
5 changes: 5 additions & 0 deletions app/src/main/java/org/isoron/uhabits/views/RingView.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ public void setColor(int color)
postInvalidate();
}

public void setTextSize(float textSize)
{
this.textSize = textSize;
}

@Override
public void setBackgroundColor(int backgroundColor)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@

public abstract class BaseWidgetProvider extends AppWidgetProvider
{

private int portraitWidth, portraitHeight;
private int landscapeWidth, landscapeHeight;
private class WidgetDimensions
{
public int portraitWidth, portraitHeight;
public int landscapeWidth, landscapeHeight;
}

protected abstract int getDefaultHeight();

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

for(Integer id : appWidgetIds)
prefs.edit().remove(getHabitIdKey(id));
prefs.edit().remove(getHabitIdKey(id)).apply();
}

@Override
Expand All @@ -98,7 +100,7 @@ public void onUpdate(Context context, AppWidgetManager manager, int[] appWidgetI
private void updateWidget(Context context, AppWidgetManager manager,
int widgetId, Bundle options)
{
updateWidgetSize(context, options);
WidgetDimensions dim = getWidgetDimensions(context, options);

Context appContext = context.getApplicationContext();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(appContext);
Expand All @@ -113,7 +115,7 @@ private void updateWidget(Context context, AppWidgetManager manager,
return;
}

new RenderWidgetTask(widgetId, context, habit, manager).execute();
new RenderWidgetTask(widgetId, context, habit, dim, manager).execute();
}

private void drawErrorWidget(Context context, AppWidgetManager manager, int widgetId)
Expand Down Expand Up @@ -159,7 +161,7 @@ private void savePreview(Context context, int widgetId, Bitmap widgetCache, int
}
}

private void updateWidgetSize(Context context, Bundle options)
private WidgetDimensions getWidgetDimensions(Context context, Bundle options)
{
int maxWidth = getDefaultWidth();
int minWidth = getDefaultWidth();
Expand All @@ -178,11 +180,12 @@ private void updateWidgetSize(Context context, Bundle options)
options.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT));
}

portraitWidth = minWidth;
portraitHeight = maxHeight;

landscapeWidth = maxWidth;
landscapeHeight = minHeight;
WidgetDimensions ws = new WidgetDimensions();
ws.portraitWidth = minWidth;
ws.portraitHeight = maxHeight;
ws.landscapeWidth = maxWidth;
ws.landscapeHeight = minHeight;
return ws;
}

private void measureCustomView(Context context, int w, int h, View customView)
Expand Down Expand Up @@ -212,16 +215,18 @@ private class RenderWidgetTask extends BaseTask
private final Context context;
private final Habit habit;
private final AppWidgetManager manager;
public RemoteViews portraitRemoteViews, landscapeRemoteViews;
public View portraitWidgetView, landscapeWidgetView;
private RemoteViews portraitRemoteViews, landscapeRemoteViews;
private View portraitWidgetView, landscapeWidgetView;
private WidgetDimensions dim;

public RenderWidgetTask(int widgetId, Context context, Habit habit,
public RenderWidgetTask(int widgetId, Context context, Habit habit, WidgetDimensions ws,
AppWidgetManager manager)
{
this.widgetId = widgetId;
this.context = context;
this.habit = habit;
this.manager = manager;
this.dim = ws;
}

@Override
Expand All @@ -232,11 +237,12 @@ protected void onPreExecute()

portraitRemoteViews = new RemoteViews(context.getPackageName(), getLayoutId());
portraitWidgetView = buildCustomView(context, habit);
measureCustomView(context, portraitWidth, portraitHeight, portraitWidgetView);
measureCustomView(context, dim.portraitWidth, dim.portraitHeight, portraitWidgetView);

landscapeRemoteViews = new RemoteViews(context.getPackageName(), getLayoutId());
landscapeWidgetView = buildCustomView(context, habit);
measureCustomView(context, landscapeWidth, landscapeHeight, landscapeWidgetView);
measureCustomView(context, dim.landscapeWidth, dim.landscapeHeight,
landscapeWidgetView);
}

private void updateAppWidget()
Expand All @@ -260,8 +266,10 @@ protected void onPostExecute(Void aVoid)
{
try
{
buildRemoteViews(portraitWidgetView, portraitRemoteViews, portraitWidth, portraitHeight);
buildRemoteViews(landscapeWidgetView, landscapeRemoteViews, landscapeWidth, landscapeHeight);
buildRemoteViews(portraitWidgetView, portraitRemoteViews,
dim.portraitWidth, dim.portraitHeight);
buildRemoteViews(landscapeWidgetView, landscapeRemoteViews,
dim.landscapeWidth, dim.landscapeHeight);
updateAppWidget();
}
catch (Exception e)
Expand All @@ -273,7 +281,8 @@ protected void onPostExecute(Void aVoid)
super.onPostExecute(aVoid);
}

private void buildRemoteViews(View widgetView, RemoteViews remoteViews, int width, int height)
private void buildRemoteViews(View widgetView, RemoteViews remoteViews, int width,
int height)
{
widgetView.invalidate();
widgetView.setDrawingCacheEnabled(true);
Expand All @@ -287,7 +296,6 @@ private void buildRemoteViews(View widgetView, RemoteViews remoteViews, int widt
int imageWidth = widgetView.getMeasuredWidth();
int imageHeight = widgetView.getMeasuredHeight();
int p[] = getPadding(width, height, imageWidth, imageHeight);

remoteViews.setViewPadding(R.id.buttonOverlay, p[0], p[1], p[2], p[3]);
}

Expand Down
28 changes: 28 additions & 0 deletions app/src/main/res/values-ar/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -159,4 +159,32 @@
<string name="bug_report_failed">"فشل في توليد تقرير الاعطال"</string>
<string name="generate_bug_report">"توليد تقرير الاعطال"</string>
<string name="troubleshooting">"استكشاف الأخطاء وإصلاحها"</string>
<string name="help_translate">"المساعدة في ترجمة هذا البرنامج"</string>
<string name="night_mode">"الوضع الليلي"</string>
<string name="use_pure_black">"استخدام أسود نقي في الوضع الليلي"</string>
<string name="pure_black_description">"يستبدل خلفيات رمادية مع أسود نقي في الوضع الليلي. يقلل من استهلاك البطارية في الهواتف مع شاشة AMOLED."</string>
<string name="interface_preferences">"السطح البيني"</string>
<string name="reverse_days">"ترتيب عكسي أيام"</string>
<string name="reverse_days_description">"عرض أيام في ترتيب عكسي على الشاشة الرئيسية"</string>
<string name="day">"يوم"</string>
<string name="week">"أسبوع"</string>
<string name="month">"شهر"</string>

<!-- Three-month period -->
<string name="quarter">"ربع سنه"</string>
<string name="year">"عام"</string>

<!-- Middle part of the sentence '1 time in xx days' -->
<!-- Middle part of the sentence '1 time in xx days' -->
<string name="time_every">"مرات في"</string>
<string name="every_x_days">"كل %d أيام"</string>
<string name="every_x_weeks">"كل %d أسابيع"</string>
<string name="every_x_months">"كل %d أشهر"</string>

<!-- 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. -->
<string name="score">"النقاط"</string>
<string name="reminder_sound">"صوت تذكير"</string>

<!-- Appears when the user disables the reminder sound. Could also be "no sound", "mute" or "silent". -->
<string name="none">"صامت"</string>
</resources>
32 changes: 31 additions & 1 deletion app/src/main/res/values-cs/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">"Loop Habit Tracker</string>

<!-- Fuzzy -->
<string name="app_name">"Loop Habit Tracker"</string>
<string name="main_activity_title">"Zvyky"</string>
<string name="action_settings">"Nastavení"</string>
<string name="edit">"Upravit"</string>
Expand Down Expand Up @@ -150,4 +152,32 @@ Upomínky mohou být potvrzen, odloženy nebo smazány přímo z tvého zaříze
<string name="bug_report_failed">"Generace výpisu chyb selhala."</string>
<string name="generate_bug_report">"Generovat výpis chyb"</string>
<string name="troubleshooting">"Řešení problémů"</string>
<string name="help_translate">"Pomozte s překladem aplikace"</string>
<string name="night_mode">"Noční téma"</string>
<string name="use_pure_black">"Zobrazit čistě černou v nočním tématu"</string>
<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>
<string name="interface_preferences">"Rozhraní"</string>
<string name="reverse_days">"Otočit pořadí dnů"</string>
<string name="reverse_days_description">"Zobrazí dny na úvodní stránce v obráceném pořadí"</string>
<string name="day">"Den"</string>
<string name="week">"Týden"</string>
<string name="month">"Měsíc"</string>

<!-- Three-month period -->
<string name="quarter">"Čtvrtletí"</string>
<string name="year">"Rok"</string>

<!-- Middle part of the sentence '1 time in xx days' -->
<!-- Middle part of the sentence '1 time in xx days' -->
<string name="time_every">"krát za"</string>
<string name="every_x_days">"Každých %d dní"</string>
<string name="every_x_weeks">"Každých %d týdnů"</string>
<string name="every_x_months">"Každých %d měsíců"</string>

<!-- 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. -->
<string name="score">"Skóre"</string>
<string name="reminder_sound">"Zvuk upomínky"</string>

<!-- Appears when the user disables the reminder sound. Could also be "no sound", "mute" or "silent". -->
<string name="none">"Žádný"</string>
</resources>
2 changes: 2 additions & 0 deletions app/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
<dimen name="history_max_font_size">@dimen/regularTextSize</dimen>
<dimen name="regularTextSize">16sp</dimen>
<dimen name="smallTextSize">14sp</dimen>
<dimen name="smallerTextSize">12sp</dimen>
<dimen name="tinyTextSize">10sp</dimen>
<dimen name="habitNameWidth">160dp</dimen>
<dimen name="progressbarOffset">-10dp</dimen>
<dimen name="checkmarkWidget_heightBreakpoint">55dp</dimen>
</resources>

0 comments on commit 33bc8f7

Please sign in to comment.