Merge branch 'hotfix/1.5.2'

pull/114/merge v1.5.2
Alinson S. Xavier 9 years ago
commit bd6cba8303

@ -1,5 +1,11 @@
# Changelog # Changelog
### 1.5.2 (May 19, 2016)
* Fix missing attachment on bug reports
* Fix bug that prevents some widgets from rendering
* Complete Japanese translation
### 1.5.1 (May 17, 2016) ### 1.5.1 (May 17, 2016)
* Fix build on F-Droid * Fix build on F-Droid

@ -21,8 +21,8 @@
<manifest <manifest
package="org.isoron.uhabits" package="org.isoron.uhabits"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="17" android:versionCode="18"
android:versionName="1.5.1"> android:versionName="1.5.2">
<uses-permission android:name="android.permission.VIBRATE"/> <uses-permission android:name="android.permission.VIBRATE"/>

@ -154,7 +154,7 @@ abstract public class BaseActivity extends AppCompatActivity implements Thread.U
try try
{ {
ex.printStackTrace(); ex.printStackTrace();
HabitsApplication.generateLogFile(); HabitsApplication.dumpBugReportToFile();
} }
catch(Exception e) catch(Exception e)
{ {

@ -36,6 +36,7 @@ import java.io.File;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.util.LinkedList;
public class HabitsApplication extends Application public class HabitsApplication extends Application
{ {
@ -87,6 +88,7 @@ public class HabitsApplication extends Application
public static String getLogcat() throws IOException public static String getLogcat() throws IOException
{ {
int maxNLines = 250;
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
String[] command = new String[] { "logcat", "-d"}; String[] command = new String[] { "logcat", "-d"};
@ -95,10 +97,18 @@ public class HabitsApplication extends Application
InputStreamReader in = new InputStreamReader(process.getInputStream()); InputStreamReader in = new InputStreamReader(process.getInputStream());
BufferedReader bufferedReader = new BufferedReader(in); BufferedReader bufferedReader = new BufferedReader(in);
LinkedList<String> log = new LinkedList<>();
String line; String line;
while ((line = bufferedReader.readLine()) != null) while ((line = bufferedReader.readLine()) != null)
{ {
builder.append(line); log.addLast(line);
if(log.size() > maxNLines) log.removeFirst();
}
for(String l : log)
{
builder.append(l);
builder.append('\n'); builder.append('\n');
} }
@ -130,10 +140,8 @@ public class HabitsApplication extends Application
} }
@NonNull @NonNull
public static File generateLogFile() throws IOException public static File dumpBugReportToFile() throws IOException
{ {
String logcat = getLogcat();
String deviceInfo = getDeviceInfo();
String date = DateHelper.getBackupDateFormat().format(DateHelper.getLocalTime()); String date = DateHelper.getBackupDateFormat().format(DateHelper.getLocalTime());
if(context == null) throw new RuntimeException("application context should not be null"); if(context == null) throw new RuntimeException("application context should not be null");
@ -142,10 +150,17 @@ public class HabitsApplication extends Application
File logFile = new File(String.format("%s/Log %s.txt", dir.getPath(), date)); File logFile = new File(String.format("%s/Log %s.txt", dir.getPath(), date));
FileWriter output = new FileWriter(logFile); FileWriter output = new FileWriter(logFile);
output.write(deviceInfo); output.write(generateBugReport());
output.write(logcat);
output.close(); output.close();
return logFile; return logFile;
} }
@NonNull
public static String generateBugReport() throws IOException
{
String logcat = getLogcat();
String deviceInfo = getDeviceInfo();
return deviceInfo + "\n" + logcat;
}
} }

@ -53,7 +53,6 @@ import org.isoron.uhabits.widgets.HistoryWidgetProvider;
import org.isoron.uhabits.widgets.ScoreWidgetProvider; import org.isoron.uhabits.widgets.ScoreWidgetProvider;
import org.isoron.uhabits.widgets.StreakWidgetProvider; import org.isoron.uhabits.widgets.StreakWidgetProvider;
import java.io.File;
import java.io.IOException; import java.io.IOException;
public class MainActivity extends BaseActivity public class MainActivity extends BaseActivity
@ -239,12 +238,25 @@ public class MainActivity extends BaseActivity
{ {
try try
{ {
File logFile = HabitsApplication.generateLogFile(); HabitsApplication.dumpBugReportToFile();
}
catch (IOException e)
{
// ignored
}
try
{
String log = "---------- BUG REPORT BEGINS ----------\n";
log += HabitsApplication.generateBugReport();
log += "---------- BUG REPORT ENDS ------------\n";
Intent intent = new Intent(); Intent intent = new Intent();
intent.setAction(Intent.ACTION_SENDTO); intent.setAction(Intent.ACTION_SEND);
intent.setData(Uri.parse(getString(R.string.bugReportURL))); intent.setType("message/rfc822");
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(logFile)); intent.putExtra(Intent.EXTRA_EMAIL, new String[] { "dev@loophabits.org" });
intent.putExtra(Intent.EXTRA_SUBJECT, "Bug Report - Loop Habit Tracker");
intent.putExtra(Intent.EXTRA_TEXT, log);
startActivity(intent); startActivity(intent);
} }
catch (IOException e) catch (IOException e)

@ -93,8 +93,9 @@ public class ReminderHelper
else else
manager.set(AlarmManager.RTC_WAKEUP, reminderTime, pendingIntent); manager.set(AlarmManager.RTC_WAKEUP, reminderTime, pendingIntent);
Log.d("ReminderHelper", String.format("Setting alarm (%s): %s", Log.d("ReminderHelper", String.format("Setting alarm (%s): %s...",
DateFormat.getDateTimeInstance().format(new Date(reminderTime)), habit.name)); DateFormat.getDateTimeInstance().format(new Date(reminderTime)),
habit.name.substring(0, 3)));
} }
@Nullable @Nullable

@ -191,7 +191,7 @@ public abstract class UIHelper
{ {
// TODO: Move this to another place, or detect automatically // TODO: Move this to another place, or detect automatically
String fullyTranslatedLanguages[] = { "ca", "zh", "en", "de", "in", "it", "ko", "pl", "pt", String fullyTranslatedLanguages[] = { "ca", "zh", "en", "de", "in", "it", "ko", "pl", "pt",
"es", "tk", "uk"}; "es", "tk", "uk", "ja"};
final String currentLanguage = Locale.getDefault().getLanguage(); final String currentLanguage = Locale.getDefault().getLanguage();

@ -27,6 +27,7 @@ import android.graphics.Paint;
import android.graphics.PorterDuff; import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode; import android.graphics.PorterDuffXfermode;
import android.graphics.RectF; import android.graphics.RectF;
import android.support.annotation.Nullable;
import android.text.TextPaint; import android.text.TextPaint;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.View; import android.view.View;
@ -57,8 +58,10 @@ public class RingView extends View
private float textSize; private float textSize;
private boolean enableFontAwesome; private boolean enableFontAwesome;
@Nullable
private Bitmap drawingCache; private Bitmap drawingCache;
private Canvas cacheCanvas; private Canvas cacheCanvas;
private boolean isTransparencyEnabled; private boolean isTransparencyEnabled;
public RingView(Context context) public RingView(Context context)
@ -175,13 +178,15 @@ public class RingView extends View
{ {
super.onSizeChanged(w, h, oldw, oldh); super.onSizeChanged(w, h, oldw, oldh);
if(isTransparencyEnabled) if(isTransparencyEnabled) reallocateCache();
}
private void reallocateCache()
{ {
if (drawingCache != null) drawingCache.recycle(); if (drawingCache != null) drawingCache.recycle();
drawingCache = Bitmap.createBitmap(diameter, diameter, Bitmap.Config.ARGB_8888); drawingCache = Bitmap.createBitmap(diameter, diameter, Bitmap.Config.ARGB_8888);
cacheCanvas = new Canvas(drawingCache); cacheCanvas = new Canvas(drawingCache);
} }
}
@Override @Override
protected void onDraw(Canvas canvas) protected void onDraw(Canvas canvas)
@ -191,6 +196,7 @@ public class RingView extends View
if(isTransparencyEnabled) if(isTransparencyEnabled)
{ {
if(drawingCache == null) reallocateCache();
activeCanvas = cacheCanvas; activeCanvas = cacheCanvas;
drawingCache.eraseColor(Color.TRANSPARENT); drawingCache.eraseColor(Color.TRANSPARENT);
} }

@ -149,4 +149,32 @@ Android Wear 端末から直接、リマインダーをチェック、スヌー
<string name="bug_report_failed">"バグ報告の生成に失敗しました。"</string> <string name="bug_report_failed">"バグ報告の生成に失敗しました。"</string>
<string name="generate_bug_report">"バグ報告の生成"</string> <string name="generate_bug_report">"バグ報告の生成"</string>
<string name="troubleshooting">"トラブルシューティング"</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> </resources>
Loading…
Cancel
Save