Loading android/app/res/values/strings.xml +6 −8 Original line number Original line Diff line number Diff line Loading @@ -211,14 +211,12 @@ <string name="transfer_clear_dlg_msg">All items will be cleared from the list.</string> <string name="transfer_clear_dlg_msg">All items will be cleared from the list.</string> <string name="outbound_noti_title">Bluetooth share: Sent files</string> <string name="outbound_noti_title">Bluetooth share: Sent files</string> <string name="inbound_noti_title">Bluetooth share: Received files</string> <string name="inbound_noti_title">Bluetooth share: Received files</string> <plurals name="noti_caption_unsuccessful"> <string name="noti_caption_unsuccessful"> {count, plural, <item quantity="one"><xliff:g id="unsuccessful_number">%1$d</xliff:g> unsuccessful.</item> other {# unsuccessful.} <item quantity="other"><xliff:g id="unsuccessful_number">%1$d</xliff:g> unsuccessful.</item> }</string> </plurals> <string name="noti_caption_success"> {count, plural, <plurals name="noti_caption_success"> other {# successful, %1$s} <item quantity="one"><xliff:g id="successful_number">%1$d</xliff:g> successful, %2$s</item> }</string> <item quantity="other"><xliff:g id="successful_number">%1$d</xliff:g> successful, %2$s</item> </plurals> <string name="transfer_menu_clear_all">Clear list</string> <string name="transfer_menu_clear_all">Clear list</string> <string name="transfer_menu_open">Open</string> <string name="transfer_menu_open">Open</string> Loading android/app/src/com/android/bluetooth/opp/BluetoothOppNotification.java +4 −12 Original line number Original line Diff line number Diff line Loading @@ -438,12 +438,8 @@ class BluetoothOppNotification { outboundNum = outboundSuccNumber + outboundFailNumber; outboundNum = outboundSuccNumber + outboundFailNumber; // create the outbound notification // create the outbound notification if (outboundNum > 0) { if (outboundNum > 0) { String unsuccessCaption = mContext.getResources() String caption = BluetoothOppUtility.formatResultText(outboundSuccNumber, .getQuantityString(R.plurals.noti_caption_unsuccessful, outboundFailNumber, outboundFailNumber, mContext); outboundFailNumber); String caption = mContext.getResources() .getQuantityString(R.plurals.noti_caption_success, outboundSuccNumber, outboundSuccNumber, unsuccessCaption); Intent contentIntent = new Intent(Constants.ACTION_OPEN_OUTBOUND_TRANSFER).setClassName( Intent contentIntent = new Intent(Constants.ACTION_OPEN_OUTBOUND_TRANSFER).setClassName( Constants.THIS_PACKAGE_NAME, BluetoothOppReceiver.class.getName()); Constants.THIS_PACKAGE_NAME, BluetoothOppReceiver.class.getName()); Intent deleteIntent = new Intent(Constants.ACTION_COMPLETE_HIDE).setClassName( Intent deleteIntent = new Intent(Constants.ACTION_COMPLETE_HIDE).setClassName( Loading Loading @@ -508,12 +504,8 @@ class BluetoothOppNotification { inboundNum = inboundSuccNumber + inboundFailNumber; inboundNum = inboundSuccNumber + inboundFailNumber; // create the inbound notification // create the inbound notification if (inboundNum > 0) { if (inboundNum > 0) { String unsuccessCaption = mContext.getResources() String caption = BluetoothOppUtility.formatResultText(inboundSuccNumber, .getQuantityString(R.plurals.noti_caption_unsuccessful, inboundFailNumber, inboundFailNumber, mContext); inboundFailNumber); String caption = mContext.getResources() .getQuantityString(R.plurals.noti_caption_success, inboundSuccNumber, inboundSuccNumber, unsuccessCaption); Intent contentIntent = new Intent(Constants.ACTION_OPEN_INBOUND_TRANSFER).setClassName( Intent contentIntent = new Intent(Constants.ACTION_OPEN_INBOUND_TRANSFER).setClassName( Constants.THIS_PACKAGE_NAME, BluetoothOppReceiver.class.getName()); Constants.THIS_PACKAGE_NAME, BluetoothOppReceiver.class.getName()); Intent deleteIntent = new Intent(Constants.ACTION_COMPLETE_HIDE).setClassName( Intent deleteIntent = new Intent(Constants.ACTION_COMPLETE_HIDE).setClassName( Loading android/app/src/com/android/bluetooth/opp/BluetoothOppUtility.java +24 −0 Original line number Original line Diff line number Diff line Loading @@ -43,6 +43,7 @@ import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.content.pm.ResolveInfo; import android.database.Cursor; import android.database.Cursor; import android.icu.text.MessageFormat; import android.net.Uri; import android.net.Uri; import android.os.Environment; import android.os.Environment; import android.os.ParcelFileDescriptor; import android.os.ParcelFileDescriptor; Loading @@ -57,7 +58,10 @@ import java.math.RoundingMode; import java.text.DecimalFormat; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.ArrayList; import java.util.Arrays; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap; /** /** Loading Loading @@ -314,6 +318,26 @@ public class BluetoothOppUtility { return df.format(percent); return df.format(percent); } } /** * Helper function to build the result notification text content. */ static String formatResultText(int countSuccess, int countUnsuccessful, Context context) { if (context == null) { return null; } Map<String, Object> mapUnsuccessful = new HashMap<>(); mapUnsuccessful.put("count", countUnsuccessful); Map<String, Object> mapSuccess = new HashMap<>(); mapSuccess.put("count", countSuccess); return new MessageFormat(context.getResources().getString(R.string.noti_caption_success, new MessageFormat(context.getResources().getString( R.string.noti_caption_unsuccessful), Locale.getDefault()).format(mapUnsuccessful)), Locale.getDefault()).format(mapSuccess); } /** /** * Whether the device has the "nosdcard" characteristic or not. * Whether the device has the "nosdcard" characteristic or not. */ */ Loading Loading
android/app/res/values/strings.xml +6 −8 Original line number Original line Diff line number Diff line Loading @@ -211,14 +211,12 @@ <string name="transfer_clear_dlg_msg">All items will be cleared from the list.</string> <string name="transfer_clear_dlg_msg">All items will be cleared from the list.</string> <string name="outbound_noti_title">Bluetooth share: Sent files</string> <string name="outbound_noti_title">Bluetooth share: Sent files</string> <string name="inbound_noti_title">Bluetooth share: Received files</string> <string name="inbound_noti_title">Bluetooth share: Received files</string> <plurals name="noti_caption_unsuccessful"> <string name="noti_caption_unsuccessful"> {count, plural, <item quantity="one"><xliff:g id="unsuccessful_number">%1$d</xliff:g> unsuccessful.</item> other {# unsuccessful.} <item quantity="other"><xliff:g id="unsuccessful_number">%1$d</xliff:g> unsuccessful.</item> }</string> </plurals> <string name="noti_caption_success"> {count, plural, <plurals name="noti_caption_success"> other {# successful, %1$s} <item quantity="one"><xliff:g id="successful_number">%1$d</xliff:g> successful, %2$s</item> }</string> <item quantity="other"><xliff:g id="successful_number">%1$d</xliff:g> successful, %2$s</item> </plurals> <string name="transfer_menu_clear_all">Clear list</string> <string name="transfer_menu_clear_all">Clear list</string> <string name="transfer_menu_open">Open</string> <string name="transfer_menu_open">Open</string> Loading
android/app/src/com/android/bluetooth/opp/BluetoothOppNotification.java +4 −12 Original line number Original line Diff line number Diff line Loading @@ -438,12 +438,8 @@ class BluetoothOppNotification { outboundNum = outboundSuccNumber + outboundFailNumber; outboundNum = outboundSuccNumber + outboundFailNumber; // create the outbound notification // create the outbound notification if (outboundNum > 0) { if (outboundNum > 0) { String unsuccessCaption = mContext.getResources() String caption = BluetoothOppUtility.formatResultText(outboundSuccNumber, .getQuantityString(R.plurals.noti_caption_unsuccessful, outboundFailNumber, outboundFailNumber, mContext); outboundFailNumber); String caption = mContext.getResources() .getQuantityString(R.plurals.noti_caption_success, outboundSuccNumber, outboundSuccNumber, unsuccessCaption); Intent contentIntent = new Intent(Constants.ACTION_OPEN_OUTBOUND_TRANSFER).setClassName( Intent contentIntent = new Intent(Constants.ACTION_OPEN_OUTBOUND_TRANSFER).setClassName( Constants.THIS_PACKAGE_NAME, BluetoothOppReceiver.class.getName()); Constants.THIS_PACKAGE_NAME, BluetoothOppReceiver.class.getName()); Intent deleteIntent = new Intent(Constants.ACTION_COMPLETE_HIDE).setClassName( Intent deleteIntent = new Intent(Constants.ACTION_COMPLETE_HIDE).setClassName( Loading Loading @@ -508,12 +504,8 @@ class BluetoothOppNotification { inboundNum = inboundSuccNumber + inboundFailNumber; inboundNum = inboundSuccNumber + inboundFailNumber; // create the inbound notification // create the inbound notification if (inboundNum > 0) { if (inboundNum > 0) { String unsuccessCaption = mContext.getResources() String caption = BluetoothOppUtility.formatResultText(inboundSuccNumber, .getQuantityString(R.plurals.noti_caption_unsuccessful, inboundFailNumber, inboundFailNumber, mContext); inboundFailNumber); String caption = mContext.getResources() .getQuantityString(R.plurals.noti_caption_success, inboundSuccNumber, inboundSuccNumber, unsuccessCaption); Intent contentIntent = new Intent(Constants.ACTION_OPEN_INBOUND_TRANSFER).setClassName( Intent contentIntent = new Intent(Constants.ACTION_OPEN_INBOUND_TRANSFER).setClassName( Constants.THIS_PACKAGE_NAME, BluetoothOppReceiver.class.getName()); Constants.THIS_PACKAGE_NAME, BluetoothOppReceiver.class.getName()); Intent deleteIntent = new Intent(Constants.ACTION_COMPLETE_HIDE).setClassName( Intent deleteIntent = new Intent(Constants.ACTION_COMPLETE_HIDE).setClassName( Loading
android/app/src/com/android/bluetooth/opp/BluetoothOppUtility.java +24 −0 Original line number Original line Diff line number Diff line Loading @@ -43,6 +43,7 @@ import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.content.pm.ResolveInfo; import android.database.Cursor; import android.database.Cursor; import android.icu.text.MessageFormat; import android.net.Uri; import android.net.Uri; import android.os.Environment; import android.os.Environment; import android.os.ParcelFileDescriptor; import android.os.ParcelFileDescriptor; Loading @@ -57,7 +58,10 @@ import java.math.RoundingMode; import java.text.DecimalFormat; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.ArrayList; import java.util.Arrays; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap; /** /** Loading Loading @@ -314,6 +318,26 @@ public class BluetoothOppUtility { return df.format(percent); return df.format(percent); } } /** * Helper function to build the result notification text content. */ static String formatResultText(int countSuccess, int countUnsuccessful, Context context) { if (context == null) { return null; } Map<String, Object> mapUnsuccessful = new HashMap<>(); mapUnsuccessful.put("count", countUnsuccessful); Map<String, Object> mapSuccess = new HashMap<>(); mapSuccess.put("count", countSuccess); return new MessageFormat(context.getResources().getString(R.string.noti_caption_success, new MessageFormat(context.getResources().getString( R.string.noti_caption_unsuccessful), Locale.getDefault()).format(mapUnsuccessful)), Locale.getDefault()).format(mapSuccess); } /** /** * Whether the device has the "nosdcard" characteristic or not. * Whether the device has the "nosdcard" characteristic or not. */ */ Loading