Skip to content

Commit

Permalink
Merge branch 'bugfix-0.6.1' into FDroid
Browse files Browse the repository at this point in the history
  • Loading branch information
k3b committed Aug 15, 2017
2 parents 7b323ba + e2c80a4 commit fe1d05d
Show file tree
Hide file tree
Showing 9 changed files with 108 additions and 22 deletions.
6 changes: 4 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ android {
// 0.6.0.170404 (28) same as 0.6.0.170402. try to fix fdroid build
// 0.6.0.170421 (29) bugfix Map
// 0.6.0.170502 (30) workaround "android stock icon as activity icon breaks aapt check in frdoid build"
// 0.6.1.170803 (31) edit exif; enhanced media scanner
// 0.6.1.170816 (32) Bugfix crash android-7.1

versionCode = 31
versionName = '0.6.1.170803'
versionCode = 32
versionName = '0.6.1.170816'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
package de.k3b.android.androFotoFinder;

import android.app.Application;
import android.content.Context;
import android.support.annotation.NonNull;
import android.util.Log;

Expand Down Expand Up @@ -80,10 +81,7 @@ public static RefWatcher getRefWatcher(Context context) {
SettingsActivity.prefs2Global(this);

// create sensible defaults for domain-independant QueryParameter parsing
QueryParameter.sParserComment = getString(R.string.bookmark_file_comment_format,
getString(R.string.app_name),
GuiUtil.getAppVersionName(this),
new Date().toString());
QueryParameter.sParserComment = getBookMarkComment(this);

QueryParameter.sParserDefaultFrom = FotoSql.SQL_TABLE_EXTERNAL_CONTENT_URI_FILE.toString();
QueryParameter.sParserDefaultQueryTypeId = FotoSql.QUERY_TYPE_DEFAULT;
Expand All @@ -108,6 +106,13 @@ public static RefWatcher getRefWatcher(Context context) {
Log.i(Global.LOG_CONTEXT, getAppId() + " created");
}

public static String getBookMarkComment(Context context) {
return context.getString(R.string.bookmark_file_comment_format,
context.getString(R.string.app_name),
GuiUtil.getAppVersionName(context),
new Date().toString());
}

@NonNull
private String getAppId() {
return getString(R.string.app_name) + " " + GuiUtil.getAppVersionName(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ public class SettingsActivity extends PreferenceActivity {
protected void onCreate(final Bundle savedInstanceState) {
LocalizedActivity.fixLocale(this); // #21: Support to change locale at runtime
super.onCreate(savedInstanceState);

if (Global.debugEnabled) {
// todo create junit integration tests with arabic locale from this.
StringFormatResourceTests.test(this);
}

final Intent intent = getIntent();
if (Global.debugEnabled && (intent != null)){
Log.d(Global.LOG_CONTEXT, "SettingsActivity onCreate " + intent.toUri(Intent.URI_INTENT_SCHEME));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package de.k3b.android.androFotoFinder;

import android.content.Context;
import android.util.Log;

import de.k3b.android.util.AndroidFileCommands;

/**
* todo create junit integration tests with arabic locale from this.
*
* Created by k3b on 15.08.2017.
*/
public class StringFormatResourceTests {
public static void test(Context context) {
Log.i(Global.LOG_CONTEXT,"testing some translation parameters");
Log.i(Global.LOG_CONTEXT,AndroFotoFinderApp.getBookMarkComment(context));
Log.i(Global.LOG_CONTEXT,AndroidFileCommands.getModifyMessage(context, AndroidFileCommands.OP_DELETE, 5, 15));
Log.i(Global.LOG_CONTEXT,context.getString(R.string.folder_hide_images_question_message_format, "param"));
Log.i(Global.LOG_CONTEXT,context.getString(R.string.global_err_sql_message_format, "param", "param2"));
Log.i(Global.LOG_CONTEXT,context.getString(R.string.file_err_writeprotected, "param", "param2"));
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015-2016 by k3b.
* Copyright (c) 2015-2017 by k3b.
*
* This file is part of AndroFotoFinder.
*
Expand All @@ -24,6 +24,7 @@
import android.widget.ImageView;

import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache;
import com.nostra13.universalimageloader.cache.disc.impl.ext.LruDiskCache;
import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
Expand All @@ -32,34 +33,53 @@
import com.nostra13.universalimageloader.core.display.SimpleBitmapDisplayer;

import java.io.File;
import java.io.IOException;

import de.k3b.android.androFotoFinder.queries.FotoSql;

/**
* Service facade hiding com.nostra13.universalimageloader
* from the rest of the app.
*
* Created by k3b on 02.07.2016.
*/
public class ThumbNailUtils {
public static final String LOG_TAG = "ImageLoader";
public static final int MAX_CACHE_SIZE_50MB = 50 * 1024 * 1024;
public static final int MAX_FILE_COUNT = 1024;
public static boolean DEBUG = false;

public static void init(Context context, File previousCacheRoot) {

// if chache dir has just changed (in SettingsActivity) clear old cache.
if ((previousCacheRoot != null) && (!previousCacheRoot.equals(Global.thumbCacheRoot))) {
ImageLoader.getInstance().clearDiskCache();
}

// This configuration tuning is custom. You can tune every option, you may tune some of them,
// or you can create default configuration by
// ImageLoaderConfiguration.createDefault(this);
// method.
ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(context);
config.threadPriority(Thread.NORM_PRIORITY - 2);
config.denyCacheImageMultipleSizesInMemory();
config.diskCache(new UnlimitedDiskCache(Global.thumbCacheRoot));
final Md5FileNameGenerator fileNameGenerator = new Md5FileNameGenerator();
config.diskCacheFileNameGenerator(fileNameGenerator);
config.diskCacheSize(50 * 1024 * 1024); // 50 MiB
config.diskCacheFileCount(160);
config.diskCacheSize(MAX_CACHE_SIZE_50MB); // 50 MiB
config.diskCacheFileCount(MAX_FILE_COUNT);
config.tasksProcessingOrder(QueueProcessingType.LIFO);

// config.diskCache(new LimitedAgeDiskCache(Global.thumbCacheRoot, 60 * 60 * 24)); // lifetime 1 day
// config.diskCache(new UnlimitedDiskCache(Global.thumbCacheRoot));

try {
// #83: limit size of cache. default factory has no parameter for cache-dir so do it manually.
config.diskCache(new LruDiskCache(Global.thumbCacheRoot, null, fileNameGenerator, MAX_CACHE_SIZE_50MB, MAX_FILE_COUNT));
} catch (IOException e) {
// does not obey the config limits diskCacheSize/diskCacheFileCount
config.diskCache(new UnlimitedDiskCache(Global.thumbCacheRoot));
}

// #83 this should make the cache-items smaller but it makes gallery scrolling much slower on my android-4.4.
// config.diskCacheExtraOptions(Global.imageDetailThumbnailIfBiggerThan, Global.imageDetailThumbnailIfBiggerThan, null);

Expand Down
11 changes: 8 additions & 3 deletions app/src/main/java/de/k3b/android/util/AndroidFileCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ protected void onPostProcess(String what, String[] oldPathNames, String[] newPat
}
super.onPostProcess(what, oldPathNames, newPathNames, modifyCount, itemCount, opCode);

int resId = getResourceId(opCode);
String message = mContext.getString(resId, Integer.valueOf(modifyCount), Integer.valueOf(itemCount));
Context context = this.mContext;
String message = getModifyMessage(context, opCode, modifyCount, itemCount);
if ((itemCount > 0) && (mScanner != null)) {
MediaScannerAsyncTask.updateMediaDBInBackground(mScanner, mContext, message, oldPathNames, newPathNames);
}
Expand All @@ -129,6 +129,11 @@ protected void onPostProcess(String what, String[] oldPathNames, String[] newPat
Toast.makeText(mContext, message, Toast.LENGTH_LONG).show();
}

public static String getModifyMessage(Context context, int opCode, int modifyCount, int itemCount) {
int resId = getResourceId(opCode);
return context.getString(resId, Integer.valueOf(modifyCount), Integer.valueOf(itemCount));
}

/** called for every cath(Exception...). Version with Android specific logging */
@Override
protected void onException(final Throwable e, Object... params) {
Expand All @@ -145,7 +150,7 @@ protected void onException(final Throwable e, Object... params) {
// e.printStackTrace();
}

private int getResourceId(int opCode) {
private static int getResourceId(int opCode) {
switch (opCode) {
case OP_COPY: return R.string.copy_result_format;
case OP_MOVE: return R.string.move_result_format;
Expand Down
35 changes: 29 additions & 6 deletions app/src/main/res/values-ar/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@
<string name="about_summary">\"A Photo Manager%1$s\" الم</string>
<string name="area_menu_title">مرشح الخريطة</string>
<string name="background">الخلفية</string>
<string name="bookmark_delete_answer_format">%1$s علامات مرجعية تمت إزالتها</string>
<string name="bookmark_delete_error_format">%1$s لا يمكن إزالة العلامة المرجعية </string>
<string name="bookmark_delete_answer_format">علامات مرجعية تمت إزالتها %1$s.</string>
<string name="bookmark_delete_error_format">لا يمكن إزالة العلامة المرجعية %s$1.</string>
<string name="bookmark_delete_question">هل تريد إزالة هذه العلامة المرجعية؟</string>
<string name="bookmark_err_not_found_format">لا يوجد علامات في %1$s</string>
<string name="bookmark_file_comment_format">تم توليده في %3$s بـ %1$s إصدار %2$s شاهد
https://github.com/k3b/APhotoManager/wiki/intentap#EXTRA_SQL لمزيد من التفاصيل</string>
<string name="bookmark_load_from_menu_title">تحميل العلامات المرجعية من&#8230;</string>
<string name="bookmark_save_as_menu_title">حفظ العلامة المرجعية كـ &#8230;</string>
<string name="btn_cancel">إلغاء</string>
Expand All @@ -36,20 +39,26 @@
<string name="btn_ok">حسنًا</string>
<string name="btn_pause">ايقاف مؤقت</string>
<string name="copy_menu_title">نسخ</string>

<string name="copy_result_format">تم نسخ %1$d من %2$d ملفات</string>
<string name="delete_menu_title">إزالة</string>
<string name="delete_question_message_format">"هل أنت متأكد من أنك تود إزالة هذه الملفات كليًا؟
%1$s"</string>
<string name="delete_question_title">إزالة صورة(صور)؟</string>
<string name="delete_result_format">إزالة %1$d من %2$d ملفات</string>
<string name="destination_copy">نسخ المكان المقصود</string>
<string name="destination_move">تحريك المكان المقصود</string>
<string name="details_menu_title">التفاصيل</string>
<string name="edit_chooser_title">اختيار محرر الصور</string>
<string name="edit_err_editor_not_found">لم نجد محرر الصور</string>
<string name="edit_menu_title">تحرير</string>
<string name="filter_err_invalid_date_format">\'%1$s\' ليست بيانات صالحة.</string>
<string name="filter_err_invalid_location_format">\'%1$s\' ليست بتنسيق صالح.</string>
<string name="file_err_writeprotected">"محمي ضد الكتابة %1$s

%2$s غير ممكن"</string>
<string name="filter_err_invalid_date_format">%1$s ليست بيانات صالحة.</string>
<string name="filter_err_invalid_location_format">%1$s ليست بتنسيق صالح.</string>
<string name="filter_menu_title">المرشح</string>
<string name="folder_dialog_title_format">اختيار %1$s</string>
<string name="folder_err_load_failed_format">فشل تحميل الملف %1$s</string>
<string name="folder_menu_title">مرشح الملف</string>
<string name="gallery_title">الصور</string>
<string name="geo_show_menu_title">اظهر في الخريطة</string>
Expand All @@ -58,24 +67,36 @@
<string name="geo_edit_update_in_progress">تغير المعلومات الجغرافية للصور المختارة</string>
<string name="geo_picker_err_not_found">لم يتم إيجاد المنتقي الجغرافي</string>
<string name="geo_picker_title">اختيار جغرافي جديد للصور</string>
<string name="global_err_sql_message_format">خطأ SQL \'%1$s\'\n\n%2$s</string>
<string name="global_err_sql_message_format">"خطأ SQL %1$s\n\n%2$s"</string>
<string name="global_err_sql_title_reload">Sql غير صالح. إعادة تحميل الافتراضي</string>
<string name="global_err_system">خطأ في النظام. موجود</string>
<string name="image_err_file_exists_format">الملف %1$s موجود بالفعل. .\n هل بالفعل تريد استبداله؟</string>
<string name="image_err_file_rename_format">لا يمكن اعادة تسمية الملف %1$s.</string>
<string name="image_err_not_found_format">لا توجد صور لـ %1$s.</string>
<string name="image_err_not_in_db_format">الصور لا توجد في قاعدة البيانات %1$s بعد. البحث في %2$d ملفات جديدة. الصور الناقصة ستكون متاحة قريبًا.</string>
<string name="image_loading_at_position_format">"تحميل (%1$d) …"</string>
<string name="image_success_update_format">صور %1$d المحدثة.</string>
<string name="lbl_date">التاريخ</string>
<string name="lbl_latitude_short">لات</string>
<string name="lbl_longitude_short">لون</string>
<string name="lbl_path">المسار</string>
<string name="lbl_with_no_geo">بدون معلومات جيو</string>
<string name="mk_dir_default">مجلد_جديد</string>
<string name="mk_dir_menu_title">إنشاء مجلد</string>
<string name="mk_err_failed_format">لا يمكن إنشاء %1$s</string>
<string name="mk_success_format">تم إنشاء %1$s</string>
<string name="more_menu_title">المزيد &#8230;</string>
<string name="move_menu_title">تحريك</string>
<string name="move_result_format">تحريك ملفات %1$d من %2$d</string>
<string name="osm_cright_title">ملفات خريطة © المساهمين <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a></string>
<string name="overwrite_question_title">الكتابة على الملف؟</string>
<string name="rename_menu_title">إعادة تسمية</string>
<string name="rename_result_format">إعادة تسمية ملفات %1$d من %2$d</string>
<string name="scanner_dir_question">أين تبدأ الفحص؟</string>
<string name="scanner_err_busy">لا نستطيع معالجة ملفات الصور حينما يكون ماسح وسائط الأندرويد مشغول. حاول مرة أخرى لاحقًا.</string>
<string name="scanner_menu_title">ماسح الوسائط</string>
<string name="scanner_update_result_format">تم تحديث عناصر قاعدة بيانات الوسائط %1$d</string>
<string name="selection_status_format">تم اختيار %1$d</string>
<string name="selection_none_hint">تم اختيار مجلد الصور لتفعيله</string>
<string name="selected_only_menu_title">المختارة فقط</string>
<string name="selection_add_all_menu_title">الاختيار: أضف كل المرئي</string>
Expand Down Expand Up @@ -114,6 +135,7 @@
<string name="sort_by_none">غير مصنف</string>
<string name="sort_by_place">المكان</string>
<string name="sort_menu_title">التصنيف</string>
<string name="update_result_format">تحديث ملفات %1$d من %2$d</string>
<string name="zoom_to_fit_menu_title">التكبير ليناسب الحجم</string>
<string name="settings_image_thumb_if_bigger_than_title">عرض صور مصغرة للصور الكبيرة</string>
<string name="settings_image_thumb_if_bigger_than_summary">عرض صور مصغرة في عرض تفاصيل الصورة إذا كان عرض او ارتفاع الصورة أكبر من هذه القيمة (بيكسيل).
Expand Down Expand Up @@ -149,6 +171,7 @@
<string name="tags_add_default">وسم_جديد</string>
<string name="tags_delete_children_title">ازالة الاطفال</string>
<string name="tags_update_photos">تحديث الوسوم في الصور المتأثرة</string>
<string name="tags_update_result_format">تحديث وسوم صور %1$d</string>
<string name="tags_hint">الشريط-الطويل في قائمة فتح اسماء الوسوم</string>
<string name="tags_defaults">النشاطات، الاشخاص، الاماكن، الموضوعات، المشروعات</string>
</resources>
4 changes: 3 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@
<string name="edit_chooser_title">Choose photo editor</string>
<string name="edit_err_editor_not_found">No photo editor found</string>
<string name="edit_menu_title">Edit</string>
<string name="file_err_writeprotected">writeprotected \'%1$s\'.\n\n \'%2$s\' is not possible.</string>
<string name="file_err_writeprotected">"writeprotected \'%1$s\'.

\'%2$s\' is not possible."</string>
<string name="filter_err_invalid_date_format">\'%1$s\' is not a valid date.</string>
<string name="filter_err_invalid_location_format">\'%1$s\' is not a valid coordinate.</string>
<string name="filter_menu_title">Filter</string>
Expand Down
5 changes: 3 additions & 2 deletions fotolib2/src/main/java/de/k3b/io/DirectoryFormatter.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,9 @@ public static String getLastPath(String path) {
* Format "lat,lon" or "lat,lon-lat,lon"
*/
public static IGeoRectangle parseLatLon(String path) {
if (path != null) {
String[] minMax = getLastPath(path).split(GeoRectangle.DELIM_FIELD);
String lastPath = getLastPath(path);
if (lastPath != null) {
String[] minMax = lastPath.split(GeoRectangle.DELIM_FIELD);
if ((minMax == null) || (minMax.length == 0)) return null;

String[] elements = minMax[0].split(GeoRectangle.DELIM_SUB_FIELD);
Expand Down

0 comments on commit fe1d05d

Please sign in to comment.