Merge tag 'v1.5.3' into dev

Version 1.5.3
pull/114/merge
Alinson S. Xavier 9 years ago
commit ca9745f550

@ -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

@ -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"/>

@ -93,9 +93,9 @@ public class ReminderHelper
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

@ -23,6 +23,7 @@ import android.content.Context;
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;
@ -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;
@ -147,8 +147,22 @@ public class CheckmarkWidgetView extends HabitWidgetView implements HabitDataVie
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);
}

@ -109,6 +109,11 @@ public class RingView extends View
postInvalidate();
}
public void setTextSize(float textSize)
{
this.textSize = textSize;
}
@Override
public void setBackgroundColor(int backgroundColor)
{

@ -45,9 +45,11 @@ import java.io.IOException;
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();
@ -71,7 +73,7 @@ public abstract class BaseWidgetProvider extends AppWidgetProvider
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(appContext);
for(Integer id : appWidgetIds)
prefs.edit().remove(getHabitIdKey(id));
prefs.edit().remove(getHabitIdKey(id)).apply();
}
@Override
@ -98,7 +100,7 @@ public abstract class BaseWidgetProvider extends AppWidgetProvider
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);
@ -113,7 +115,7 @@ public abstract class BaseWidgetProvider extends AppWidgetProvider
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)
@ -159,7 +161,7 @@ public abstract class BaseWidgetProvider extends AppWidgetProvider
}
}
private void updateWidgetSize(Context context, Bundle options)
private WidgetDimensions getWidgetDimensions(Context context, Bundle options)
{
int maxWidth = getDefaultWidth();
int minWidth = getDefaultWidth();
@ -178,11 +180,12 @@ public abstract class BaseWidgetProvider extends AppWidgetProvider
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)
@ -212,16 +215,18 @@ public abstract class BaseWidgetProvider extends AppWidgetProvider
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
@ -232,11 +237,12 @@ public abstract class BaseWidgetProvider extends AppWidgetProvider
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()
@ -260,8 +266,10 @@ public abstract class BaseWidgetProvider extends AppWidgetProvider
{
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)
@ -273,7 +281,8 @@ public abstract class BaseWidgetProvider extends AppWidgetProvider
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);
@ -287,7 +296,6 @@ public abstract class BaseWidgetProvider extends AppWidgetProvider
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]);
}

@ -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>

@ -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>
@ -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>

@ -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>
Loading…
Cancel
Save