From: Luke Owncloud Date: Thu, 20 Nov 2014 12:46:54 +0000 (+0100) Subject: integrating @davivels remarks X-Git-Tag: oc-android-1.7.0_signed~80^2^2 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/8de07698d9130a001a325ee39a9ad64cf3b9b191 integrating @davivels remarks --- diff --git a/res/values/strings.xml b/res/values/strings.xml index 665b114b..d62aed34 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -297,7 +297,7 @@ Logs Send History No app for sending logs found. Install mail app! - ownCloud Android app logs + %1$s Android app logs Loading data… Authentication required diff --git a/src/com/owncloud/android/ui/activity/LogHistoryActivity.java b/src/com/owncloud/android/ui/activity/LogHistoryActivity.java index bfb433a9..ce2d0ce0 100644 --- a/src/com/owncloud/android/ui/activity/LogHistoryActivity.java +++ b/src/com/owncloud/android/ui/activity/LogHistoryActivity.java @@ -22,6 +22,7 @@ import java.io.File; import java.io.FileReader; import java.io.IOException; import java.lang.ref.WeakReference; +import java.lang.reflect.Field; import java.util.ArrayList; import android.content.ActivityNotFoundException; @@ -126,7 +127,18 @@ public class LogHistoryActivity extends SherlockFragmentActivity { */ private void sendMail() { - String emailAddress = getString(R.string.mail_logger); + // For the moment we need to consider the possibility that setup.xml + // does not include the "mail_logger" entry. This block prevents that + // compilation fails in this case. + String emailAddress; + try { + Class stringClass = R.string.class; + Field mailLoggerField = stringClass.getField("mail_logger"); + int emailAddressId = (Integer) mailLoggerField.get(null); + emailAddress = getString(emailAddressId); + } catch (Exception e) { + emailAddress = ""; + } ArrayList uris = new ArrayList(); @@ -142,7 +154,8 @@ public class LogHistoryActivity extends SherlockFragmentActivity { Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE); intent.putExtra(Intent.EXTRA_EMAIL, emailAddress); - intent.putExtra(Intent.EXTRA_SUBJECT, getText(R.string.log_send_mail_subject)); + String subject = String.format(getString(R.string.log_send_mail_subject), getString(R.string.app_name)); + intent.putExtra(Intent.EXTRA_SUBJECT, subject); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setType(MAIL_ATTACHMENT_TYPE); intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);