Messaging: Further code improvements

* Remove redundant casts
* getParcelable(ArrayList|Exra) without class argument is deprecated
* ViewPager.setOnPageChangeListener -> addOnPageChangeListener
* RecyclerView.setOnScrollListener -> addOnScrollListener
* Remove unused initializations
* Remove unused code

Change-Id: I21beb6c90c675a4f2cfd7e3d5ebbd18b745f5911
This commit is contained in:
Michael W
2025-01-01 13:54:07 +01:00
parent 47f5533a73
commit b2f5e3190e
110 changed files with 289 additions and 561 deletions

View File

@@ -290,7 +290,7 @@ class DefaultApnSettingsLoader implements ApnSettingsLoader {
} else { } else {
uri = Telephony.Carriers.CONTENT_URI; uri = Telephony.Carriers.CONTENT_URI;
} }
Cursor cursor = null; Cursor cursor;
try { try {
for (; ; ) { for (; ; ) {
// Try different combinations of queries. Some would work on some platforms. // Try different combinations of queries. Some would work on some platforms.
@@ -448,7 +448,7 @@ class DefaultApnSettingsLoader implements ApnSettingsLoader {
return addr; return addr;
} }
final StringBuilder builder = new StringBuilder(16); final StringBuilder builder = new StringBuilder(16);
String result = null; String result;
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
try { try {
if (octets[i].length() > 3) { if (octets[i].length() > 3) {

View File

@@ -195,7 +195,7 @@ public class MmsHttpClient {
final InputStream in = new BufferedInputStream(connection.getInputStream()); final InputStream in = new BufferedInputStream(connection.getInputStream());
final ByteArrayOutputStream byteOut = new ByteArrayOutputStream(); final ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
final byte[] buf = new byte[4096]; final byte[] buf = new byte[4096];
int count = 0; int count;
while ((count = in.read(buf)) > 0) { while ((count = in.read(buf)) > 0) {
byteOut.write(buf, 0, count); byteOut.write(buf, 0, count);
} }
@@ -438,7 +438,7 @@ public class MmsHttpClient {
if (!TextUtils.isEmpty(naiSuffix)) { if (!TextUtils.isEmpty(naiSuffix)) {
nai = nai + naiSuffix; nai = nai + naiSuffix;
} }
byte[] encoded = null; byte[] encoded;
encoded = Base64.encode(nai.getBytes(StandardCharsets.UTF_8), Base64.NO_WRAP); encoded = Base64.encode(nai.getBytes(StandardCharsets.UTF_8), Base64.NO_WRAP);
return new String(encoded, StandardCharsets.UTF_8); return new String(encoded, StandardCharsets.UTF_8);
} }

View File

@@ -131,7 +131,7 @@ public class MmsManager {
* @return a Bundle containing the overrides * @return a Bundle containing the overrides
*/ */
private static Bundle getConfigOverrides(final int subId) { private static Bundle getConfigOverrides(final int subId) {
Bundle overrides = null; Bundle overrides;
synchronized (sConfigOverridesMap) { synchronized (sConfigOverridesMap) {
overrides = sConfigOverridesMap.get(subId); overrides = sConfigOverridesMap.get(subId);
if (overrides == null) { if (overrides == null) {

View File

@@ -220,7 +220,8 @@ public class MmsService extends Service {
// embedded in the intent to make sure it is indeed from the // embedded in the intent to make sure it is indeed from the
// the current life of this service. // the current life of this service.
if (fromThisProcess(intent)) { if (fromThisProcess(intent)) {
final MmsRequest request = intent.getParcelableExtra(EXTRA_REQUEST); final MmsRequest request = intent.getParcelableExtra(EXTRA_REQUEST,
MmsRequest.class);
if (request != null) { if (request != null) {
try { try {
retainService(request, () -> { retainService(request, () -> {

View File

@@ -72,13 +72,13 @@ public class Base64 {
} }
int numberQuadruple = base64Data.length / FOURBYTE; int numberQuadruple = base64Data.length / FOURBYTE;
byte[] decodedData = null; byte[] decodedData;
byte b1 = 0, b2 = 0, b3 = 0, b4 = 0, marker0 = 0, marker1 = 0; byte b1, b2, b3, b4, marker0, marker1;
// Throw away anything not in base64Data // Throw away anything not in base64Data
int encodedIndex = 0; int encodedIndex = 0;
int dataIndex = 0; int dataIndex;
{ {
// this sizes the output array properly - rlw // this sizes the output array properly - rlw
int lastData = base64Data.length; int lastData = base64Data.length;

View File

@@ -22,7 +22,7 @@ public class GenericPdu {
/** /**
* The headers of pdu. * The headers of pdu.
*/ */
PduHeaders mPduHeaders = null; PduHeaders mPduHeaders;
/** /**
* Constructor. * Constructor.

View File

@@ -21,7 +21,7 @@ package android.support.v7.mms.pdu;
import java.util.Vector; import java.util.Vector;
public class PduBody { public class PduBody {
private Vector<PduPart> mParts = null; private Vector<PduPart> mParts;
/** /**
* Constructor. * Constructor.

View File

@@ -323,7 +323,7 @@ public class PduHeaders {
/** /**
* The map contains the value of all headers. * The map contains the value of all headers.
*/ */
private SparseArray<Object> mHeaderMap = null; private SparseArray<Object> mHeaderMap;
/** /**
* Constructor of PduHeaders. * Constructor of PduHeaders.

View File

@@ -73,7 +73,7 @@ public class PduParser {
/** /**
* The pdu data. * The pdu data.
*/ */
private ByteArrayInputStream mPduDataStream = null; private ByteArrayInputStream mPduDataStream;
/** /**
* Store pdu headers * Store pdu headers
@@ -550,7 +550,7 @@ public class PduParser {
* Value-length * Value-length
* (Address-present-token Encoded-string-value | Insert-address-token) * (Address-present-token Encoded-string-value | Insert-address-token)
*/ */
EncodedStringValue from = null; EncodedStringValue from;
parseValueLength(pduDataStream); /* parse value-length */ parseValueLength(pduDataStream); /* parse value-length */
/* Address-present-token or Insert-address-token */ /* Address-present-token or Insert-address-token */
@@ -1059,7 +1059,7 @@ public class PduParser {
*/ */
assert(null != pduDataStream); assert(null != pduDataStream);
pduDataStream.mark(1); pduDataStream.mark(1);
EncodedStringValue returnValue = null; EncodedStringValue returnValue;
int charset = 0; int charset = 0;
int temp = pduDataStream.read(); int temp = pduDataStream.read();
assert(-1 != temp); assert(-1 != temp);
@@ -1392,7 +1392,7 @@ public class PduParser {
assert(length > 0); assert(length > 0);
int startPos = pduDataStream.available(); int startPos = pduDataStream.available();
int tempPos = 0; int tempPos;
int lastLen = length; int lastLen = length;
while(0 < lastLen) { while(0 < lastLen) {
int param = pduDataStream.read(); int param = pduDataStream.read();
@@ -1561,7 +1561,7 @@ public class PduParser {
*/ */
assert(null != pduDataStream); assert(null != pduDataStream);
byte[] contentType = null; byte[] contentType;
pduDataStream.mark(1); pduDataStream.mark(1);
int temp = pduDataStream.read(); int temp = pduDataStream.read();
assert(-1 != temp); assert(-1 != temp);
@@ -1645,7 +1645,7 @@ public class PduParser {
* contain the corresponding definitions. * contain the corresponding definitions.
*/ */
int startPos = pduDataStream.available(); int startPos = pduDataStream.available();
int tempPos = 0; int tempPos;
int lastLen = length; int lastLen = length;
while(0 < lastLen) { while(0 < lastLen) {
int header = pduDataStream.read(); int header = pduDataStream.read();
@@ -1700,7 +1700,7 @@ public class PduParser {
int len = parseValueLength(pduDataStream); int len = parseValueLength(pduDataStream);
pduDataStream.mark(1); pduDataStream.mark(1);
int thisStartPos = pduDataStream.available(); int thisStartPos = pduDataStream.available();
int thisEndPos = 0; int thisEndPos;
int value = pduDataStream.read(); int value = pduDataStream.read();
if (value == PduPart.P_DISPOSITION_FROM_DATA ) { if (value == PduPart.P_DISPOSITION_FROM_DATA ) {

View File

@@ -106,7 +106,7 @@ public class PduPart {
/** /**
* Header of part. * Header of part.
*/ */
private SparseArray<Object> mPartHeader = null; private SparseArray<Object> mPartHeader;
/** /**
* Data uri. * Data uri.

View File

@@ -433,7 +433,7 @@ public class BugleDatabaseOperations {
Assert.isNotMainThread(); Assert.isNotMainThread();
dbWrapper.beginTransaction(); dbWrapper.beginTransaction();
boolean conversationDeleted = false; boolean conversationDeleted = false;
boolean conversationMessagesDeleted = false; boolean conversationMessagesDeleted;
try { try {
// Delete existing messages // Delete existing messages
if (cutoffTimestamp == Long.MAX_VALUE) { if (cutoffTimestamp == Long.MAX_VALUE) {
@@ -1558,7 +1558,7 @@ public class BugleDatabaseOperations {
public static ParticipantData getOrCreateSelf(final DatabaseWrapper dbWrapper, public static ParticipantData getOrCreateSelf(final DatabaseWrapper dbWrapper,
final int subId) { final int subId) {
Assert.isNotMainThread(); Assert.isNotMainThread();
ParticipantData participant = null; ParticipantData participant;
dbWrapper.beginTransaction(); dbWrapper.beginTransaction();
try { try {
final ParticipantData shell = ParticipantData.getSelfParticipant(subId); final ParticipantData shell = ParticipantData.getSelfParticipant(subId);
@@ -1583,8 +1583,8 @@ public class BugleDatabaseOperations {
Assert.isNotMainThread(); Assert.isNotMainThread();
Assert.isTrue(dbWrapper.getDatabase().inTransaction()); Assert.isTrue(dbWrapper.getDatabase().inTransaction());
int subId = ParticipantData.OTHER_THAN_SELF_SUB_ID; int subId = ParticipantData.OTHER_THAN_SELF_SUB_ID;
String participantId = null; String participantId;
String canonicalRecipient = null; String canonicalRecipient;
if (participant.isSelf()) { if (participant.isSelf()) {
subId = participant.getSubId(); subId = participant.getSubId();
canonicalRecipient = getCanonicalRecipientFromSubId(subId); canonicalRecipient = getCanonicalRecipientFromSubId(subId);

View File

@@ -377,7 +377,7 @@ public abstract class MessageNotificationState extends NotificationState {
@Override @Override
protected NotificationCompat.Style build(final Builder builder) { protected NotificationCompat.Style build(final Builder builder) {
builder.setContentTitle(mTitle); builder.setContentTitle(mTitle);
NotificationCompat.InboxStyle inboxStyle = null; NotificationCompat.InboxStyle inboxStyle;
inboxStyle = new NotificationCompat.InboxStyle(builder); inboxStyle = new NotificationCompat.InboxStyle(builder);
final Context context = Factory.get().getApplicationContext(); final Context context = Factory.get().getApplicationContext();
@@ -507,7 +507,7 @@ public abstract class MessageNotificationState extends NotificationState {
builder.setContentTitle(mTitle) builder.setContentTitle(mTitle)
.setTicker(getTicker()); .setTicker(getTicker());
NotificationCompat.Style notifStyle = null; NotificationCompat.Style notifStyle;
final ConversationLineInfo convInfo = mConvList.mConvInfos.get(0); final ConversationLineInfo convInfo = mConvList.mConvInfos.get(0);
final List<NotificationLineInfo> lineInfos = convInfo.mLineInfos; final List<NotificationLineInfo> lineInfos = convInfo.mLineInfos;
final int messageCount = lineInfos.size(); final int messageCount = lineInfos.size();

View File

@@ -446,7 +446,7 @@ public class MessagingContentProvider extends ContentProvider {
@Override @Override
public boolean onCreate() { public boolean onCreate() {
// This is going to wind up calling into createDatabase() below. // This is going to wind up calling into createDatabase() below.
mDatabaseHelper = (DatabaseHelper) getDatabase(); mDatabaseHelper = getDatabase();
// We cannot initialize mDatabaseWrapper yet as the Factory may not be initialized // We cannot initialize mDatabaseWrapper yet as the Factory may not be initialized
return true; return true;
} }

View File

@@ -109,7 +109,7 @@ public class NoConfirmationSmsSendService extends IntentService {
if (TextUtils.isEmpty(conversationId)) { if (TextUtils.isEmpty(conversationId)) {
InsertNewMessageAction.insertNewMessage(subId, recipients, message, subject); InsertNewMessageAction.insertNewMessage(subId, recipients, message, subject);
} else { } else {
MessageData messageData = null; MessageData messageData;
if (requiresMms) { if (requiresMms) {
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
LogUtil.v(TAG, "Auto-sending MMS message in conversation: " + LogUtil.v(TAG, "Auto-sending MMS message in conversation: " +

View File

@@ -243,7 +243,7 @@ public abstract class Action implements Parcelable {
* Helper method to generate a unique operation index * Helper method to generate a unique operation index
*/ */
protected static long getActionIdx() { protected static long getActionIdx() {
long idx = 0; long idx;
synchronized (sLock) { synchronized (sLock) {
idx = ++sActionIdx; idx = ++sActionIdx;
} }

View File

@@ -196,7 +196,7 @@ public class ActionMonitor {
* Return flag to indicate if action is complete * Return flag to indicate if action is complete
*/ */
public boolean isComplete() { public boolean isComplete() {
boolean complete = false; boolean complete;
synchronized (mLock) { synchronized (mLock) {
complete = (mState == STATE_COMPLETE); complete = (mState == STATE_COMPLETE);
} }
@@ -291,7 +291,7 @@ public class ActionMonitor {
*/ */
private void complete(final Action action, final int expectedOldState, final Object result, private void complete(final Action action, final int expectedOldState, final Object result,
final boolean succeeded) { final boolean succeeded) {
ActionCompletedListener completedListener = null; ActionCompletedListener completedListener;
synchronized (mLock) { synchronized (mLock) {
setState(action, expectedOldState, STATE_COMPLETE); setState(action, expectedOldState, STATE_COMPLETE);
completedListener = mCompletedListener; completedListener = mCompletedListener;
@@ -357,7 +357,7 @@ public class ActionMonitor {
*/ */
final void executed(final Action action, final void executed(final Action action,
final int expectedOldState, final boolean hasBackgroundActions, final Object result) { final int expectedOldState, final boolean hasBackgroundActions, final Object result) {
ActionExecutedListener executedListener = null; ActionExecutedListener executedListener;
synchronized (mLock) { synchronized (mLock) {
if (hasBackgroundActions) { if (hasBackgroundActions) {
setState(action, expectedOldState, STATE_BACKGROUND_ACTIONS_QUEUED); setState(action, expectedOldState, STATE_BACKGROUND_ACTIONS_QUEUED);
@@ -432,7 +432,7 @@ public class ActionMonitor {
* Find monitor associated with particular action * Find monitor associated with particular action
*/ */
private static ActionMonitor lookupActionMonitor(final String actionKey) { private static ActionMonitor lookupActionMonitor(final String actionKey) {
ActionMonitor monitor = null; ActionMonitor monitor;
synchronized (sActionMonitors) { synchronized (sActionMonitors) {
monitor = sActionMonitors.get(actionKey); monitor = sActionMonitors.get(actionKey);
} }

View File

@@ -228,11 +228,6 @@ public class ActionServiceImpl extends JobIntentService {
*/ */
@Override @Override
protected void onHandleWork(@NonNull final Intent intent) { protected void onHandleWork(@NonNull final Intent intent) {
if (intent == null) {
// Shouldn't happen but sometimes does following another crash.
LogUtil.w(TAG, "ActionService.onHandleIntent: Called with null intent");
return;
}
final int opcode = intent.getIntExtra(EXTRA_OP_CODE, 0); final int opcode = intent.getIntExtra(EXTRA_OP_CODE, 0);
Action action; Action action;
@@ -240,20 +235,20 @@ public class ActionServiceImpl extends JobIntentService {
actionBundle.setClassLoader(getClassLoader()); actionBundle.setClassLoader(getClassLoader());
switch(opcode) { switch(opcode) {
case OP_START_ACTION: { case OP_START_ACTION: {
action = (Action) actionBundle.getParcelable(BUNDLE_ACTION); action = actionBundle.getParcelable(BUNDLE_ACTION, Action.class);
executeAction(action); executeAction(action);
break; break;
} }
case OP_RECEIVE_BACKGROUND_RESPONSE: { case OP_RECEIVE_BACKGROUND_RESPONSE: {
action = (Action) actionBundle.getParcelable(BUNDLE_ACTION); action = actionBundle.getParcelable(BUNDLE_ACTION, Action.class);
final Bundle response = intent.getBundleExtra(EXTRA_WORKER_RESPONSE); final Bundle response = intent.getBundleExtra(EXTRA_WORKER_RESPONSE);
processBackgroundResponse(action, response); processBackgroundResponse(action, response);
break; break;
} }
case OP_RECEIVE_BACKGROUND_FAILURE: { case OP_RECEIVE_BACKGROUND_FAILURE: {
action = (Action) actionBundle.getParcelable(BUNDLE_ACTION); action = actionBundle.getParcelable(BUNDLE_ACTION, Action.class);
processBackgroundFailure(action); processBackgroundFailure(action);
break; break;
} }

View File

@@ -116,7 +116,7 @@ public class BackgroundWorkerService extends JobIntentService {
*/ */
private void doBackgroundWork(final Action action, final int attempt) { private void doBackgroundWork(final Action action, final int attempt) {
action.markBackgroundWorkStarting(); action.markBackgroundWorkStarting();
Bundle response = null; Bundle response;
try { try {
final LoggingTimer timer = new LoggingTimer( final LoggingTimer timer = new LoggingTimer(
TAG, action.getClass().getSimpleName() + "#doBackgroundWork"); TAG, action.getClass().getSimpleName() + "#doBackgroundWork");

View File

@@ -237,7 +237,7 @@ public class DownloadMmsAction extends Action implements Parcelable {
final Context context = Factory.get().getApplicationContext(); final Context context = Factory.get().getApplicationContext();
final int subId = actionParameters.getInt(KEY_SUB_ID); final int subId = actionParameters.getInt(KEY_SUB_ID);
final String messageId = actionParameters.getString(KEY_MESSAGE_ID); final String messageId = actionParameters.getString(KEY_MESSAGE_ID);
final Uri notificationUri = actionParameters.getParcelable(KEY_NOTIFICATION_URI); final Uri notificationUri = actionParameters.getParcelable(KEY_NOTIFICATION_URI, Uri.class);
final String subPhoneNumber = actionParameters.getString(KEY_SUB_PHONE_NUMBER); final String subPhoneNumber = actionParameters.getString(KEY_SUB_PHONE_NUMBER);
final String transactionId = actionParameters.getString(KEY_TRANSACTION_ID); final String transactionId = actionParameters.getString(KEY_TRANSACTION_ID);
final String contentLocation = actionParameters.getString(KEY_CONTENT_LOCATION); final String contentLocation = actionParameters.getString(KEY_CONTENT_LOCATION);

View File

@@ -49,8 +49,8 @@ public class FixupMessageStatusOnStartupAction extends Action implements Parcela
// Now mark any messages in active sending or downloading state as inactive // Now mark any messages in active sending or downloading state as inactive
final DatabaseWrapper db = DataModel.get().getDatabase(); final DatabaseWrapper db = DataModel.get().getDatabase();
db.beginTransaction(); db.beginTransaction();
int downloadFailedCnt = 0; int downloadFailedCnt;
int sendFailedCnt = 0; int sendFailedCnt;
try { try {
// For both sending and downloading messages, let's assume they failed. // For both sending and downloading messages, let's assume they failed.
// For MMS sent/downloaded via platform, the sent/downloaded pending intent // For MMS sent/downloaded via platform, the sent/downloaded pending intent

View File

@@ -97,7 +97,8 @@ public class GetOrCreateConversationAction extends Action implements Parcelable
// First find the thread id for this list of participants. // First find the thread id for this list of participants.
final ArrayList<ParticipantData> participants = final ArrayList<ParticipantData> participants =
actionParameters.getParcelableArrayList(KEY_PARTICIPANTS_LIST); actionParameters.getParcelableArrayList(KEY_PARTICIPANTS_LIST,
ParticipantData.class);
BugleDatabaseOperations.sanitizeConversationParticipants(participants); BugleDatabaseOperations.sanitizeConversationParticipants(participants);
final ArrayList<String> recipients = final ArrayList<String> recipients =
BugleDatabaseOperations.getRecipientsFromConversationParticipants(participants); BugleDatabaseOperations.getRecipientsFromConversationParticipants(participants);

View File

@@ -120,7 +120,7 @@ public class InsertNewMessageAction extends Action implements Parcelable {
*/ */
@Override @Override
protected Object executeAction() { protected Object executeAction() {
MessageData message = actionParameters.getParcelable(KEY_MESSAGE); MessageData message = actionParameters.getParcelable(KEY_MESSAGE, MessageData.class);
if (message == null) { if (message == null) {
LogUtil.i(TAG, "InsertNewMessageAction: Creating MessageData with provided data"); LogUtil.i(TAG, "InsertNewMessageAction: Creating MessageData with provided data");
message = createMessage(); message = createMessage();

View File

@@ -56,7 +56,7 @@ public class ProcessDeliveryReportAction extends Action implements Parcelable {
@Override @Override
protected Object executeAction() { protected Object executeAction() {
final Uri smsMessageUri = actionParameters.getParcelable(KEY_URI); final Uri smsMessageUri = actionParameters.getParcelable(KEY_URI, Uri.class);
final int status = actionParameters.getInt(KEY_STATUS); final int status = actionParameters.getInt(KEY_STATUS);
final DatabaseWrapper db = DataModel.get().getDatabase(); final DatabaseWrapper db = DataModel.get().getDatabase();

View File

@@ -98,8 +98,9 @@ public class ProcessDownloadedMmsAction extends Action {
// This is called when MMS lib API returns via PendingIntent // This is called when MMS lib API returns via PendingIntent
public static void processMessageDownloaded(final int resultCode, final Bundle extras) { public static void processMessageDownloaded(final int resultCode, final Bundle extras) {
final String messageId = extras.getString(DownloadMmsAction.EXTRA_MESSAGE_ID); final String messageId = extras.getString(DownloadMmsAction.EXTRA_MESSAGE_ID);
final Uri contentUri = extras.getParcelable(DownloadMmsAction.EXTRA_CONTENT_URI); final Uri contentUri = extras.getParcelable(DownloadMmsAction.EXTRA_CONTENT_URI, Uri.class);
final Uri notificationUri = extras.getParcelable(DownloadMmsAction.EXTRA_NOTIFICATION_URI); final Uri notificationUri = extras.getParcelable(DownloadMmsAction.EXTRA_NOTIFICATION_URI,
Uri.class);
final String conversationId = extras.getString(DownloadMmsAction.EXTRA_CONVERSATION_ID); final String conversationId = extras.getString(DownloadMmsAction.EXTRA_CONVERSATION_ID);
final String participantId = extras.getString(DownloadMmsAction.EXTRA_PARTICIPANT_ID); final String participantId = extras.getString(DownloadMmsAction.EXTRA_PARTICIPANT_ID);
Assert.notNull(messageId); Assert.notNull(messageId);
@@ -245,7 +246,7 @@ public class ProcessDownloadedMmsAction extends Action {
if (downloadedByPlatform) { if (downloadedByPlatform) {
final int resultCode = actionParameters.getInt(KEY_RESULT_CODE); final int resultCode = actionParameters.getInt(KEY_RESULT_CODE);
if (resultCode == Activity.RESULT_OK) { if (resultCode == Activity.RESULT_OK) {
final Uri contentUri = actionParameters.getParcelable(KEY_CONTENT_URI); final Uri contentUri = actionParameters.getParcelable(KEY_CONTENT_URI, Uri.class);
final File downloadedFile = MmsFileProvider.getFile(contentUri); final File downloadedFile = MmsFileProvider.getFile(contentUri);
byte[] downloadedData = null; byte[] downloadedData = null;
try { try {
@@ -273,7 +274,7 @@ public class ProcessDownloadedMmsAction extends Action {
if (retrieveConf != null) { if (retrieveConf != null) {
// Insert the downloaded MMS into telephony // Insert the downloaded MMS into telephony
final Uri notificationUri = actionParameters.getParcelable( final Uri notificationUri = actionParameters.getParcelable(
KEY_NOTIFICATION_URI); KEY_NOTIFICATION_URI, Uri.class);
final String subPhoneNumber = actionParameters.getString( final String subPhoneNumber = actionParameters.getString(
KEY_SUB_PHONE_NUMBER); KEY_SUB_PHONE_NUMBER);
final boolean autoDownload = actionParameters.getBoolean( final boolean autoDownload = actionParameters.getBoolean(
@@ -313,7 +314,7 @@ public class ProcessDownloadedMmsAction extends Action {
// In either case, we just need to copy the status to the response bundle. // In either case, we just need to copy the status to the response bundle.
status = actionParameters.getInt(KEY_STATUS); status = actionParameters.getInt(KEY_STATUS);
rawStatus = actionParameters.getInt(KEY_RAW_STATUS); rawStatus = actionParameters.getInt(KEY_RAW_STATUS);
mmsUri = actionParameters.getParcelable(KEY_MMS_URI); mmsUri = actionParameters.getParcelable(KEY_MMS_URI, Uri.class);
} }
final Bundle response = new Bundle(); final Bundle response = new Bundle();
@@ -335,7 +336,7 @@ public class ProcessDownloadedMmsAction extends Action {
final int status = response.getInt(BUNDLE_REQUEST_STATUS); final int status = response.getInt(BUNDLE_REQUEST_STATUS);
final int rawStatus = response.getInt(BUNDLE_RAW_TELEPHONY_STATUS); final int rawStatus = response.getInt(BUNDLE_RAW_TELEPHONY_STATUS);
final Uri messageUri = response.getParcelable(BUNDLE_MMS_URI); final Uri messageUri = response.getParcelable(BUNDLE_MMS_URI, Uri.class);
final boolean autoDownload = actionParameters.getBoolean(KEY_AUTO_DOWNLOAD); final boolean autoDownload = actionParameters.getBoolean(KEY_AUTO_DOWNLOAD);
final String messageId = actionParameters.getString(KEY_MESSAGE_ID); final String messageId = actionParameters.getString(KEY_MESSAGE_ID);
@@ -411,7 +412,8 @@ public class ProcessDownloadedMmsAction extends Action {
private MessageData processResult(final int status, final int rawStatus, final Uri mmsUri) { private MessageData processResult(final int status, final int rawStatus, final Uri mmsUri) {
final Context context = Factory.get().getApplicationContext(); final Context context = Factory.get().getApplicationContext();
final String messageId = actionParameters.getString(KEY_MESSAGE_ID); final String messageId = actionParameters.getString(KEY_MESSAGE_ID);
final Uri mmsNotificationUri = actionParameters.getParcelable(KEY_NOTIFICATION_URI); final Uri mmsNotificationUri = actionParameters.getParcelable(KEY_NOTIFICATION_URI,
Uri.class);
final String notificationConversationId = actionParameters.getString(KEY_CONVERSATION_ID); final String notificationConversationId = actionParameters.getString(KEY_CONVERSATION_ID);
final String notificationParticipantId = actionParameters.getString(KEY_PARTICIPANT_ID); final String notificationParticipantId = actionParameters.getString(KEY_PARTICIPANT_ID);
final int statusIfFailed = actionParameters.getInt(KEY_STATUS_IF_FAILED); final int statusIfFailed = actionParameters.getInt(KEY_STATUS_IF_FAILED);
@@ -432,8 +434,8 @@ public class ProcessDownloadedMmsAction extends Action {
mms = MmsUtils.loadMms(mmsUri); mms = MmsUtils.loadMms(mmsUri);
} }
boolean messageInFocusedConversation = false; boolean messageInFocusedConversation;
boolean messageInObservableConversation = false; boolean messageInObservableConversation;
String conversationId = null; String conversationId = null;
MessageData message = null; MessageData message = null;
final DatabaseWrapper db = DataModel.get().getDatabase(); final DatabaseWrapper db = DataModel.get().getDatabase();

View File

@@ -306,8 +306,8 @@ public class ProcessPendingMessagesAction extends Action implements Parcelable {
final String selfId) { final String selfId) {
String toSendMessageId = null; String toSendMessageId = null;
Cursor cursor = null; Cursor cursor = null;
int sendingCnt = 0; int sendingCnt;
int pendingCnt = 0; int pendingCnt;
int failedCnt = 0; int failedCnt = 0;
db.beginTransaction(); db.beginTransaction();
try { try {
@@ -390,8 +390,8 @@ public class ProcessPendingMessagesAction extends Action implements Parcelable {
final String selfId) { final String selfId) {
String toDownloadMessageId = null; String toDownloadMessageId = null;
Cursor cursor = null; Cursor cursor = null;
int downloadingCnt = 0; int downloadingCnt;
int pendingCnt = 0; int pendingCnt;
db.beginTransaction(); db.beginTransaction();
try { try {
// First check if we have any messages already downloading // First check if we have any messages already downloading

View File

@@ -86,13 +86,13 @@ public class ProcessSentMessageAction extends Action {
params.putString(KEY_MESSAGE_ID, extras.getString(SendMessageAction.EXTRA_MESSAGE_ID)); params.putString(KEY_MESSAGE_ID, extras.getString(SendMessageAction.EXTRA_MESSAGE_ID));
params.putParcelable(KEY_MESSAGE_URI, messageUri); params.putParcelable(KEY_MESSAGE_URI, messageUri);
params.putParcelable(KEY_UPDATED_MESSAGE_URI, params.putParcelable(KEY_UPDATED_MESSAGE_URI,
extras.getParcelable(SendMessageAction.EXTRA_UPDATED_MESSAGE_URI)); extras.getParcelable(SendMessageAction.EXTRA_UPDATED_MESSAGE_URI, Uri.class));
params.putInt(KEY_SUB_ID, params.putInt(KEY_SUB_ID,
extras.getInt(SendMessageAction.KEY_SUB_ID, ParticipantData.DEFAULT_SELF_SUB_ID)); extras.getInt(SendMessageAction.KEY_SUB_ID, ParticipantData.DEFAULT_SELF_SUB_ID));
params.putInt(KEY_RESULT_CODE, resultCode); params.putInt(KEY_RESULT_CODE, resultCode);
params.putInt(KEY_HTTP_STATUS_CODE, extras.getInt(SmsManager.EXTRA_MMS_HTTP_STATUS, 0)); params.putInt(KEY_HTTP_STATUS_CODE, extras.getInt(SmsManager.EXTRA_MMS_HTTP_STATUS, 0));
params.putParcelable(KEY_CONTENT_URI, params.putParcelable(KEY_CONTENT_URI,
extras.getParcelable(SendMessageAction.EXTRA_CONTENT_URI)); extras.getParcelable(SendMessageAction.EXTRA_CONTENT_URI, Uri.class));
params.putByteArray(KEY_RESPONSE, extras.getByteArray(SmsManager.EXTRA_MMS_DATA)); params.putByteArray(KEY_RESPONSE, extras.getByteArray(SmsManager.EXTRA_MMS_DATA));
params.putBoolean(KEY_RESPONSE_IMPORTANT, params.putBoolean(KEY_RESPONSE_IMPORTANT,
extras.getBoolean(SendMessageAction.EXTRA_RESPONSE_IMPORTANT)); extras.getBoolean(SendMessageAction.EXTRA_RESPONSE_IMPORTANT));
@@ -128,8 +128,9 @@ public class ProcessSentMessageAction extends Action {
protected Object executeAction() { protected Object executeAction() {
final Context context = Factory.get().getApplicationContext(); final Context context = Factory.get().getApplicationContext();
final String messageId = actionParameters.getString(KEY_MESSAGE_ID); final String messageId = actionParameters.getString(KEY_MESSAGE_ID);
final Uri messageUri = actionParameters.getParcelable(KEY_MESSAGE_URI); final Uri messageUri = actionParameters.getParcelable(KEY_MESSAGE_URI, Uri.class);
final Uri updatedMessageUri = actionParameters.getParcelable(KEY_UPDATED_MESSAGE_URI); final Uri updatedMessageUri = actionParameters.getParcelable(KEY_UPDATED_MESSAGE_URI,
Uri.class);
final boolean isSms = actionParameters.getBoolean(KEY_SMS); final boolean isSms = actionParameters.getBoolean(KEY_SMS);
final boolean sentByPlatform = actionParameters.getBoolean(KEY_SENT_BY_PLATFORM); final boolean sentByPlatform = actionParameters.getBoolean(KEY_SENT_BY_PLATFORM);
@@ -140,7 +141,7 @@ public class ProcessSentMessageAction extends Action {
if (sentByPlatform) { if (sentByPlatform) {
// Delete temporary file backing the contentUri passed to MMS service // Delete temporary file backing the contentUri passed to MMS service
final Uri contentUri = actionParameters.getParcelable(KEY_CONTENT_URI); final Uri contentUri = actionParameters.getParcelable(KEY_CONTENT_URI, Uri.class);
Assert.isTrue(contentUri != null); Assert.isTrue(contentUri != null);
final File tempFile = MmsFileProvider.getFile(contentUri); final File tempFile = MmsFileProvider.getFile(contentUri);
long messageSize = 0; long messageSize = 0;

View File

@@ -84,7 +84,8 @@ public class ReadDraftDataAction extends Action implements Parcelable {
protected Object executeAction() { protected Object executeAction() {
final DatabaseWrapper db = DataModel.get().getDatabase(); final DatabaseWrapper db = DataModel.get().getDatabase();
final String conversationId = actionParameters.getString(KEY_CONVERSATION_ID); final String conversationId = actionParameters.getString(KEY_CONVERSATION_ID);
final MessageData incomingDraft = actionParameters.getParcelable(KEY_INCOMING_DRAFT); final MessageData incomingDraft = actionParameters.getParcelable(KEY_INCOMING_DRAFT,
MessageData.class);
final ConversationListItemData conversation = final ConversationListItemData conversation =
ConversationListItemData.getExistingConversation(db, conversationId); ConversationListItemData.getExistingConversation(db, conversationId);
MessageData message = null; MessageData message = null;

View File

@@ -59,7 +59,8 @@ public class ReceiveSmsMessageAction extends Action implements Parcelable {
@Override @Override
protected Object executeAction() { protected Object executeAction() {
final Context context = Factory.get().getApplicationContext(); final Context context = Factory.get().getApplicationContext();
final ContentValues messageValues = actionParameters.getParcelable(KEY_MESSAGE_VALUES); final ContentValues messageValues = actionParameters.getParcelable(KEY_MESSAGE_VALUES,
ContentValues.class);
final DatabaseWrapper db = DataModel.get().getDatabase(); final DatabaseWrapper db = DataModel.get().getDatabase();
// Get the SIM subscription ID // Get the SIM subscription ID

View File

@@ -193,9 +193,9 @@ public class SendMessageAction extends Action implements Parcelable {
*/ */
@Override @Override
protected Bundle doBackgroundWork() { protected Bundle doBackgroundWork() {
final MessageData message = actionParameters.getParcelable(KEY_MESSAGE); final MessageData message = actionParameters.getParcelable(KEY_MESSAGE, MessageData.class);
final String messageId = actionParameters.getString(KEY_MESSAGE_ID); final String messageId = actionParameters.getString(KEY_MESSAGE_ID);
Uri messageUri = actionParameters.getParcelable(KEY_MESSAGE_URI); Uri messageUri = actionParameters.getParcelable(KEY_MESSAGE_URI, Uri.class);
Uri updatedMessageUri = null; Uri updatedMessageUri = null;
final boolean isSms = message.getProtocol() == MessageData.PROTOCOL_SMS; final boolean isSms = message.getProtocol() == MessageData.PROTOCOL_SMS;
final int subId = actionParameters.getInt(KEY_SUB_ID, ParticipantData.DEFAULT_SELF_SUB_ID); final int subId = actionParameters.getInt(KEY_SUB_ID, ParticipantData.DEFAULT_SELF_SUB_ID);
@@ -294,7 +294,7 @@ public class SendMessageAction extends Action implements Parcelable {
@Override @Override
protected Object processBackgroundFailure() { protected Object processBackgroundFailure() {
final String messageId = actionParameters.getString(KEY_MESSAGE_ID); final String messageId = actionParameters.getString(KEY_MESSAGE_ID);
final MessageData message = actionParameters.getParcelable(KEY_MESSAGE); final MessageData message = actionParameters.getParcelable(KEY_MESSAGE, MessageData.class);
final boolean isSms = message.getProtocol() == MessageData.PROTOCOL_SMS; final boolean isSms = message.getProtocol() == MessageData.PROTOCOL_SMS;
final int subId = actionParameters.getInt(KEY_SUB_ID, ParticipantData.DEFAULT_SELF_SUB_ID); final int subId = actionParameters.getInt(KEY_SUB_ID, ParticipantData.DEFAULT_SELF_SUB_ID);
final int resultCode = actionParameters.getInt(ProcessSentMessageAction.KEY_RESULT_CODE); final int resultCode = actionParameters.getInt(ProcessSentMessageAction.KEY_RESULT_CODE);

View File

@@ -489,7 +489,7 @@ class SyncCursorPair {
@Override @Override
public DatabaseMessage next() { public DatabaseMessage next() {
DatabaseMessage result = null; DatabaseMessage result;
if (mNextSms != null && mNextMms != null) { if (mNextSms != null && mNextMms != null) {
if (mNextSms.getTimestampInMillis() >= mNextMms.getTimestampInMillis()) { if (mNextSms.getTimestampInMillis() >= mNextMms.getTimestampInMillis()) {
result = mNextSms; result = mNextSms;

View File

@@ -197,7 +197,7 @@ class SyncMessageBatch {
public static int bugleStatusForSms(final boolean isOutgoing, final int type, public static int bugleStatusForSms(final boolean isOutgoing, final int type,
final int status) { final int status) {
int bugleStatus = MessageData.BUGLE_STATUS_UNKNOWN; int bugleStatus;
// For a message we sync either // For a message we sync either
if (isOutgoing) { if (isOutgoing) {
// Outgoing message not yet been sent // Outgoing message not yet been sent

View File

@@ -272,10 +272,10 @@ public class SyncMessagesAction extends Action implements Parcelable {
final long startTimeMillis = SystemClock.elapsedRealtime(); final long startTimeMillis = SystemClock.elapsedRealtime();
// Number of messages scanned local and remote // Number of messages scanned local and remote
int localPos = 0; int localPos;
int remotePos = 0; int remotePos;
int localTotal = 0; int localTotal;
int remoteTotal = 0; int remoteTotal;
// Scan through the messages on both sides and prepare messages for local message table // Scan through the messages on both sides and prepare messages for local message table
// changes (including adding and deleting) // changes (including adding and deleting)
try { try {
@@ -383,11 +383,12 @@ public class SyncMessagesAction extends Action implements Parcelable {
} else { } else {
// Succeeded // Succeeded
final ArrayList<SmsMessage> smsToAdd = final ArrayList<SmsMessage> smsToAdd =
response.getParcelableArrayList(BUNDLE_KEY_SMS_MESSAGES); response.getParcelableArrayList(BUNDLE_KEY_SMS_MESSAGES, SmsMessage.class);
final ArrayList<MmsMessage> mmsToAdd = final ArrayList<MmsMessage> mmsToAdd =
response.getParcelableArrayList(BUNDLE_KEY_MMS_MESSAGES); response.getParcelableArrayList(BUNDLE_KEY_MMS_MESSAGES, MmsMessage.class);
final ArrayList<LocalDatabaseMessage> messagesToDelete = final ArrayList<LocalDatabaseMessage> messagesToDelete =
response.getParcelableArrayList(BUNDLE_KEY_MESSAGES_TO_DELETE); response.getParcelableArrayList(BUNDLE_KEY_MESSAGES_TO_DELETE,
LocalDatabaseMessage.class);
final int messagesUpdated = smsToAdd.size() + mmsToAdd.size() final int messagesUpdated = smsToAdd.size() + mmsToAdd.size()
+ messagesToDelete.size(); + messagesToDelete.size();

View File

@@ -53,7 +53,7 @@ public class WriteDraftMessageAction extends Action implements Parcelable {
protected Object executeAction() { protected Object executeAction() {
final DatabaseWrapper db = DataModel.get().getDatabase(); final DatabaseWrapper db = DataModel.get().getDatabase();
final String conversationId = actionParameters.getString(KEY_CONVERSATION_ID); final String conversationId = actionParameters.getString(KEY_CONVERSATION_ID);
final MessageData message = actionParameters.getParcelable(KEY_MESSAGE); final MessageData message = actionParameters.getParcelable(KEY_MESSAGE, MessageData.class);
if (message.getSelfId() == null || message.getParticipantId() == null) { if (message.getSelfId() == null || message.getParticipantId() == null) {
// This could happen when this occurs before the draft message is loaded // This could happen when this occurs before the draft message is loaded
// In this case, we just use the conversation's current self id as draft's // In this case, we just use the conversation's current self id as draft's

View File

@@ -185,7 +185,7 @@ public class DraftMessageData extends BindableData implements ReadDraftDataActio
* @return the MessageData for the draft, null if self id is not set * @return the MessageData for the draft, null if self id is not set
*/ */
public MessageData createMessageWithCurrentAttachments(final boolean clearLocalCopy) { public MessageData createMessageWithCurrentAttachments(final boolean clearLocalCopy) {
MessageData message = null; MessageData message;
if (getIsMms()) { if (getIsMms()) {
message = MessageData.createDraftMmsMessage(mConversationId, mSelfId, message = MessageData.createDraftMmsMessage(mConversationId, mSelfId,
mMessageText, mMessageSubject); mMessageText, mMessageSubject);

View File

@@ -837,7 +837,8 @@ public class MessageData implements Parcelable {
mParts = new ArrayList<>(); mParts = new ArrayList<>();
final int partCount = in.readInt(); final int partCount = in.readInt();
for (int i = 0; i < partCount; i++) { for (int i = 0; i < partCount; i++) {
mParts.add((MessagePartData) in.readParcelable(MessagePartData.class.getClassLoader())); mParts.add(in.readParcelable(MessagePartData.class.getClassLoader(),
MessagePartData.class));
} }
} }

View File

@@ -220,7 +220,6 @@ public class DecodedImageResource extends ImageResource {
} finally { } finally {
if (scaledBitmap != null && scaledBitmap != getBitmap()) { if (scaledBitmap != null && scaledBitmap != getBitmap()) {
scaledBitmap.recycle(); scaledBitmap.recycle();
scaledBitmap = null;
} }
releaseLock(); releaseLock();
release(); release();

View File

@@ -59,7 +59,7 @@ public class GifImageResource extends ImageResource {
@Override @Override
public Drawable getDrawable(Resources resources) { public Drawable getDrawable(Resources resources) {
try { try {
return (AnimatedImageDrawable) ImageDecoder.decodeDrawable(mImageDecoderSource); return ImageDecoder.decodeDrawable(mImageDecoderSource);
} catch (final Throwable t) { } catch (final Throwable t) {
// Malicious gif images can make the platform throw different kind of throwables, such // Malicious gif images can make the platform throw different kind of throwables, such
// as OutOfMemoryError and NullPointerException. Catch them all. // as OutOfMemoryError and NullPointerException. Catch them all.

View File

@@ -157,7 +157,7 @@ public class MediaResourceManager {
final MediaRequest<T> mediaRequest) final MediaRequest<T> mediaRequest)
throws Exception { throws Exception {
final List<MediaRequest<T>> chainedRequests = new ArrayList<>(); final List<MediaRequest<T>> chainedRequests = new ArrayList<>();
T loadedResource = null; T loadedResource;
// Try fetching from cache first. // Try fetching from cache first.
final T cachedResource = loadMediaFromCache(mediaRequest); final T cachedResource = loadMediaFromCache(mediaRequest);
if (cachedResource != null) { if (cachedResource != null) {

View File

@@ -222,7 +222,7 @@ public class VCardResourceEntry {
if (vcard.getOrganizationList() != null) { if (vcard.getOrganizationList() != null) {
for (final OrganizationData organtization : vcard.getOrganizationList()) { for (final OrganizationData organtization : vcard.getOrganizationList()) {
String type = null; String type;
try { try {
type = resources.getString(Organization.getTypeLabelResource( type = resources.getString(Organization.getTypeLabelResource(
organtization.getType())); organtization.getType()));

View File

@@ -48,7 +48,7 @@ public class VideoThumbnailRequest extends ImageRequest<UriImageRequestDescripto
@Override @Override
protected Bitmap getBitmapForResource() throws IOException { protected Bitmap getBitmapForResource() throws IOException {
Bitmap bitmap = null; Bitmap bitmap;
// Get a thumbnail through MediaMetadataRetriever to get a representative frame at any time // Get a thumbnail through MediaMetadataRetriever to get a representative frame at any time
// position instead. // position instead.
final MediaMetadataRetrieverWrapper retriever = new MediaMetadataRetrieverWrapper(); final MediaMetadataRetrieverWrapper retriever = new MediaMetadataRetrieverWrapper();

View File

@@ -96,22 +96,22 @@ public class PduComposer {
/** /**
* The output message. * The output message.
*/ */
protected ByteArrayOutputStream mMessage = null; protected ByteArrayOutputStream mMessage;
/** /**
* The PDU. * The PDU.
*/ */
private GenericPdu mPdu = null; private GenericPdu mPdu;
/** /**
* Current visiting position of the mMessage. * Current visiting position of the mMessage.
*/ */
protected int mPosition = 0; protected int mPosition;
/** /**
* Message compose buffer stack. * Message compose buffer stack.
*/ */
private BufferStack mStack = null; private BufferStack mStack;
/** /**
* Content resolver. * Content resolver.
@@ -121,12 +121,12 @@ public class PduComposer {
/** /**
* Header of this pdu. * Header of this pdu.
*/ */
private PduHeaders mPduHeader = null; private PduHeaders mPduHeader;
/** /**
* Map of all content type * Map of all content type
*/ */
private static SimpleArrayMap<String, Integer> mContentTypeMap = null; private static SimpleArrayMap<String, Integer> mContentTypeMap;
static { static {
mContentTypeMap = new SimpleArrayMap<>(); mContentTypeMap = new SimpleArrayMap<>();
@@ -469,7 +469,7 @@ public class PduComposer {
} }
private EncodedStringValue appendAddressType(final EncodedStringValue address) { private EncodedStringValue appendAddressType(final EncodedStringValue address) {
EncodedStringValue temp = null; EncodedStringValue temp;
try { try {
final int addressType = checkAddressType(address.getString()); final int addressType = checkAddressType(address.getString());
@@ -1065,7 +1065,7 @@ public class PduComposer {
try { try {
final byte[] buffer = new byte[PDU_COMPOSER_BLOCK_SIZE]; final byte[] buffer = new byte[PDU_COMPOSER_BLOCK_SIZE];
cr = mResolver.openInputStream(part.getDataUri()); cr = mResolver.openInputStream(part.getDataUri());
int len = 0; int len;
while ((len = cr.read(buffer)) != -1) { while ((len = cr.read(buffer)) != -1) {
mMessage.write(buffer, 0, len); mMessage.write(buffer, 0, len);
mPosition += len; mPosition += len;

View File

@@ -373,7 +373,7 @@ public class PduPersister {
Uri.parse("content://mms/" + msgId + "/part"), Uri.parse("content://mms/" + msgId + "/part"),
PART_PROJECTION, null, null, null); PART_PROJECTION, null, null, null);
PduPart[] parts = null; PduPart[] parts;
try { try {
if ((c == null) || (c.getCount() == 0)) { if ((c == null) || (c.getCount() == 0)) {
@@ -560,7 +560,7 @@ public class PduPersister {
*/ */
public GenericPdu load(final Uri uri) throws MmsException { public GenericPdu load(final Uri uri) throws MmsException {
GenericPdu pdu = null; GenericPdu pdu = null;
PduCacheEntry cacheEntry = null; PduCacheEntry cacheEntry;
int msgBox = 0; int msgBox = 0;
final long threadId = -1; final long threadId = -1;
try { try {
@@ -859,7 +859,7 @@ public class PduPersister {
OutputStream os = null; OutputStream os = null;
InputStream is = null; InputStream is = null;
DrmConvertSession drmConvertSession = null; DrmConvertSession drmConvertSession = null;
Uri dataUri = null; Uri dataUri;
String path = null; String path = null;
try { try {
@@ -936,7 +936,7 @@ public class PduPersister {
} }
final byte[] buffer = new byte[8192]; final byte[] buffer = new byte[8192];
for (int len = 0; (len = is.read(buffer)) != -1; ) { for (int len; (len = is.read(buffer)) != -1; ) {
if (!isDrm) { if (!isDrm) {
os.write(buffer, 0, len); os.write(buffer, 0, len);
} else { } else {
@@ -955,7 +955,6 @@ public class PduPersister {
if (!isDrm) { if (!isDrm) {
os.write(data); os.write(data);
} else { } else {
dataUri = uri;
final byte[] convertedData = drmConvertSession.convert(data, data.length); final byte[] convertedData = drmConvertSession.convert(data, data.length);
if (convertedData != null) { if (convertedData != null) {
os.write(convertedData, 0, convertedData.length); os.write(convertedData, 0, convertedData.length);
@@ -1093,7 +1092,7 @@ public class PduPersister {
PDU_CACHE_INSTANCE.purge(uri); PDU_CACHE_INSTANCE.purge(uri);
final PduHeaders header = pdu.getPduHeaders(); final PduHeaders header = pdu.getPduHeaders();
PduBody body = null; PduBody body;
ContentValues values = new ContentValues(); ContentValues values = new ContentValues();
// Mark new messages as seen in the telephony database so that we don't have to // Mark new messages as seen in the telephony database so that we don't have to

View File

@@ -86,7 +86,7 @@ public class DrmConvertSession {
public byte[] convert(byte[] inBuffer, int size) { public byte[] convert(byte[] inBuffer, int size) {
byte[] result = null; byte[] result = null;
if (inBuffer != null) { if (inBuffer != null) {
DrmConvertedStatus convertedStatus = null; DrmConvertedStatus convertedStatus;
try { try {
if (size != inBuffer.length) { if (size != inBuffer.length) {
byte[] buf = new byte[size]; byte[] buf = new byte[size];
@@ -125,7 +125,7 @@ public class DrmConvertSession {
* Downloads.Impl.STATUS_UNKNOWN_ERROR if a general error occurred. * Downloads.Impl.STATUS_UNKNOWN_ERROR if a general error occurred.
*/ */
public int close(String filename) { public int close(String filename) {
DrmConvertedStatus convertedStatus = null; DrmConvertedStatus convertedStatus;
int result = Downloads.Impl.STATUS_UNKNOWN_ERROR; int result = Downloads.Impl.STATUS_UNKNOWN_ERROR;
if (mDrmClient != null && mConvertSessionId >= 0) { if (mDrmClient != null && mConvertSessionId >= 0) {
try { try {

View File

@@ -188,7 +188,7 @@ public final class PduCache extends AbstractCache<Uri, PduCacheEntry> {
*/ */
private Uri normalizeKey(Uri uri) { private Uri normalizeKey(Uri uri) {
int match = URI_MATCHER.match(uri); int match = URI_MATCHER.match(uri);
Uri normalizedKey = null; Uri normalizedKey;
switch (match) { switch (match) {
case MMS_ALL_ID: case MMS_ALL_ID:

View File

@@ -82,7 +82,7 @@ public class SendStatusReceiver extends BroadcastReceiver {
LogUtil.e(LogUtil.BUGLE_TAG, "SendStatusReceiver: empty report message"); LogUtil.e(LogUtil.BUGLE_TAG, "SendStatusReceiver: empty report message");
return; return;
} }
int status = Sms.STATUS_COMPLETE; int status;
try { try {
final String format = intent.getStringExtra("format"); final String format = intent.getStringExtra("format");
status = smsMessage.getStatus(); status = smsMessage.getStatus();

View File

@@ -466,7 +466,7 @@ public class BugleApnSettingsLoader implements ApnSettingsLoader {
LogUtil.i(LogUtil.BUGLE_TAG, "Loading APNs from local APN table"); LogUtil.i(LogUtil.BUGLE_TAG, "Loading APNs from local APN table");
final SQLiteDatabase database = ApnDatabase.getApnDatabase().getWritableDatabase(); final SQLiteDatabase database = ApnDatabase.getApnDatabase().getWritableDatabase();
final String mccMnc = PhoneUtils.getMccMncString(PhoneUtils.getDefault().getMccMnc()); final String mccMnc = PhoneUtils.getMccMncString(PhoneUtils.getDefault().getMccMnc());
Cursor cursor = null; Cursor cursor;
cursor = queryLocalDatabase(database, mccMnc, apnName); cursor = queryLocalDatabase(database, mccMnc, apnName);
if (cursor == null) { if (cursor == null) {
cursor = queryLocalDatabase(database, mccMnc, null/*apnName*/); cursor = queryLocalDatabase(database, mccMnc, null/*apnName*/);
@@ -513,7 +513,7 @@ public class BugleApnSettingsLoader implements ApnSettingsLoader {
selection = SELECTION_NUMERIC + " AND " + SELECTION_APN; selection = SELECTION_NUMERIC + " AND " + SELECTION_APN;
selectionArgs = new String[] { numeric, apnName }; selectionArgs = new String[] { numeric, apnName };
} }
Cursor cursor = null; Cursor cursor;
try { try {
cursor = db.query(ApnDatabase.APN_TABLE, APN_PROJECTION_LOCAL, selection, selectionArgs, cursor = db.query(ApnDatabase.APN_TABLE, APN_PROJECTION_LOCAL, selection, selectionArgs,
null/*groupBy*/, null/*having*/, ORDER_BY, null/*limit*/); null/*groupBy*/, null/*having*/, ORDER_BY, null/*limit*/);

View File

@@ -476,7 +476,7 @@ public class DatabaseMessages {
mParts = new ArrayList<>(); mParts = new ArrayList<>();
mPartsProcessed = false; mPartsProcessed = false;
for (int i = 0; i < nParts; i++) { for (int i = 0; i < nParts; i++) {
mParts.add((MmsPart) in.readParcelable(getClass().getClassLoader())); mParts.add(in.readParcelable(getClass().getClassLoader()));
} }
} }

View File

@@ -1544,7 +1544,7 @@ public class MmsUtils {
public static int bugleStatusForMms(final boolean isOutgoing, final boolean isNotification, public static int bugleStatusForMms(final boolean isOutgoing, final boolean isNotification,
final int messageBox) { final int messageBox) {
int bugleStatus = MessageData.BUGLE_STATUS_UNKNOWN; int bugleStatus;
// For a message we sync either // For a message we sync either
if (isOutgoing) { if (isOutgoing) {
if (messageBox == Mms.MESSAGE_BOX_OUTBOX || messageBox == Mms.MESSAGE_BOX_FAILED) { if (messageBox == Mms.MESSAGE_BOX_OUTBOX || messageBox == Mms.MESSAGE_BOX_FAILED) {

View File

@@ -70,10 +70,10 @@ public class AttachmentPreview extends ScrollView implements OnAttachmentClickLi
@Override @Override
protected void onFinishInflate() { protected void onFinishInflate() {
super.onFinishInflate(); super.onFinishInflate();
mCloseButton = (ImageButton) findViewById(R.id.close_button); mCloseButton = findViewById(R.id.close_button);
mCloseButton.setOnClickListener(view -> mComposeMessageView.clearAttachments()); mCloseButton.setOnClickListener(view -> mComposeMessageView.clearAttachments());
mAttachmentView = (FrameLayout) findViewById(R.id.attachment_view); mAttachmentView = findViewById(R.id.attachment_view);
// The attachment preview is a scroll view so that it can show the bottom portion of the // The attachment preview is a scroll view so that it can show the bottom portion of the
// attachment whenever the space is tight (e.g. when in landscape mode). Per design // attachment whenever the space is tight (e.g. when in landscape mode). Per design

View File

@@ -66,7 +66,7 @@ public class AttachmentPreviewFactory {
final int viewType, final boolean startImageRequest, final int viewType, final boolean startImageRequest,
@Nullable final OnAttachmentClickListener clickListener) { @Nullable final OnAttachmentClickListener clickListener) {
final String contentType = attachmentData.getContentType(); final String contentType = attachmentData.getContentType();
View attachmentView = null; View attachmentView;
if (attachmentData instanceof PendingAttachmentData) { if (attachmentData instanceof PendingAttachmentData) {
attachmentView = createPendingAttachmentPreview(layoutInflater, parent, attachmentView = createPendingAttachmentPreview(layoutInflater, parent,
(PendingAttachmentData) attachmentData); (PendingAttachmentData) attachmentData);
@@ -85,7 +85,7 @@ public class AttachmentPreviewFactory {
} }
// Some views have a caption, set the text/visibility if one exists // Some views have a caption, set the text/visibility if one exists
final TextView captionView = (TextView) attachmentView.findViewById(R.id.caption); final TextView captionView = attachmentView.findViewById(R.id.caption);
if (captionView != null) { if (captionView != null) {
final String caption = attachmentData.getText(); final String caption = attachmentData.getText();
captionView.setVisibility(TextUtils.isEmpty(caption) ? View.GONE : View.VISIBLE); captionView.setVisibility(TextUtils.isEmpty(caption) ? View.GONE : View.VISIBLE);
@@ -159,8 +159,7 @@ public class AttachmentPreviewFactory {
break; break;
} }
final View view = layoutInflater.inflate(layoutId, parent, false /* attachToRoot */); final View view = layoutInflater.inflate(layoutId, parent, false /* attachToRoot */);
final AsyncImageView imageView = (AsyncImageView) view.findViewById( final AsyncImageView imageView = view.findViewById(R.id.attachment_image_view);
R.id.attachment_image_view);
int maxWidth = imageView.getMaxWidth(); int maxWidth = imageView.getMaxWidth();
int maxHeight = imageView.getMaxHeight(); int maxHeight = imageView.getMaxHeight();
if (viewType == TYPE_CHOOSER_GRID) { if (viewType == TYPE_CHOOSER_GRID) {
@@ -187,8 +186,7 @@ public class AttachmentPreviewFactory {
final ViewGroup parent, final PendingAttachmentData attachmentData) { final ViewGroup parent, final PendingAttachmentData attachmentData) {
final View pendingItemView = layoutInflater.inflate(R.layout.attachment_pending_item, final View pendingItemView = layoutInflater.inflate(R.layout.attachment_pending_item,
parent, false); parent, false);
final ImageView imageView = (ImageView) final ImageView imageView = pendingItemView.findViewById(R.id.pending_item_view);
pendingItemView.findViewById(R.id.pending_item_view);
final ViewGroup.LayoutParams layoutParams = imageView.getLayoutParams(); final ViewGroup.LayoutParams layoutParams = imageView.getLayoutParams();
final int defaultSize = layoutInflater.getContext().getResources().getDimensionPixelSize( final int defaultSize = layoutInflater.getContext().getResources().getDimensionPixelSize(
R.dimen.pending_attachment_size); R.dimen.pending_attachment_size);
@@ -218,8 +216,7 @@ public class AttachmentPreviewFactory {
break; break;
} }
final View view = layoutInflater.inflate(layoutId, parent, false /* attachToRoot */); final View view = layoutInflater.inflate(layoutId, parent, false /* attachToRoot */);
final PersonItemView vcardPreview = (PersonItemView) view.findViewById( final PersonItemView vcardPreview = view.findViewById(R.id.vcard_attachment_view);
R.id.vcard_attachment_view);
vcardPreview.setAvatarOnly(viewType != AttachmentPreviewFactory.TYPE_SINGLE); vcardPreview.setAvatarOnly(viewType != AttachmentPreviewFactory.TYPE_SINGLE);
vcardPreview.bind(DataModel.get().createVCardContactItemData(layoutInflater.getContext(), vcardPreview.bind(DataModel.get().createVCardContactItemData(layoutInflater.getContext(),
attachmentData)); attachmentData));
@@ -261,8 +258,7 @@ public class AttachmentPreviewFactory {
break; break;
} }
final View view = layoutInflater.inflate(layoutId, parent, false /* attachToRoot */); final View view = layoutInflater.inflate(layoutId, parent, false /* attachToRoot */);
final AudioAttachmentView audioView = (AudioAttachmentView) final AudioAttachmentView audioView = view.findViewById(R.id.audio_attachment_view);
view.findViewById(R.id.audio_attachment_view);
audioView.bindMessagePartData( audioView.bindMessagePartData(
attachmentData, false /* incoming */, false /* showAsSelected */); attachmentData, false /* incoming */, false /* showAsSelected */);
return view; return view;

View File

@@ -1,5 +1,6 @@
/* /*
* Copyright (C) 2015 The Android Open Source Project * Copyright (C) 2015 The Android Open Source Project
* Copyright (C) 2025 The LineageOS Project
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -38,8 +39,8 @@ public class AudioAttachmentPlayPauseButton extends ViewSwitcher {
@Override @Override
protected void onFinishInflate() { protected void onFinishInflate() {
super.onFinishInflate(); super.onFinishInflate();
mPlayButton = (ImageView) findViewById(R.id.play_button); mPlayButton = findViewById(R.id.play_button);
mPauseButton = (ImageView) findViewById(R.id.pause_button); mPauseButton = findViewById(R.id.pause_button);
updateAppearance(); updateAppearance();
} }

View File

@@ -104,9 +104,9 @@ public class AudioAttachmentView extends LinearLayout {
protected void onFinishInflate() { protected void onFinishInflate() {
super.onFinishInflate(); super.onFinishInflate();
mPlayPauseButton = (AudioAttachmentPlayPauseButton) findViewById(R.id.play_pause_button); mPlayPauseButton = findViewById(R.id.play_pause_button);
mChronometer = (PausableChronometer) findViewById(R.id.timer); mChronometer = findViewById(R.id.timer);
mProgressBar = (AudioPlaybackProgressBar) findViewById(R.id.progress); mProgressBar = findViewById(R.id.progress);
mPlayPauseButton.setOnClickListener(v -> { mPlayPauseButton.setOnClickListener(v -> {
// Has the MediaPlayer already been prepared? // Has the MediaPlayer already been prepared?
if (mMediaPlayer != null && mPrepared) { if (mMediaPlayer != null && mPrepared) {
@@ -352,12 +352,12 @@ public class AudioAttachmentView extends LinearLayout {
mProgressBar.setVisibility(GONE); mProgressBar.setVisibility(GONE);
mChronometer.setVisibility(GONE); mChronometer.setVisibility(GONE);
((MarginLayoutParams) mPlayPauseButton.getLayoutParams()).setMargins(0, 0, 0, 0); ((MarginLayoutParams) mPlayPauseButton.getLayoutParams()).setMargins(0, 0, 0, 0);
final ImageView playButton = (ImageView) findViewById(R.id.play_button); final ImageView playButton = findViewById(R.id.play_button);
final Resources res = getResources(); final Resources res = getResources();
final Resources.Theme theme = getContext().getTheme(); final Resources.Theme theme = getContext().getTheme();
playButton.setImageDrawable( playButton.setImageDrawable(
ResourcesCompat.getDrawable(res, R.drawable.ic_preview_play, theme)); ResourcesCompat.getDrawable(res, R.drawable.ic_preview_play, theme));
final ImageView pauseButton = (ImageView) findViewById(R.id.pause_button); final ImageView pauseButton = findViewById(R.id.pause_button);
pauseButton.setImageDrawable( pauseButton.setImageDrawable(
ResourcesCompat.getDrawable(res, R.drawable.ic_preview_pause, theme)); ResourcesCompat.getDrawable(res, R.drawable.ic_preview_pause, theme));
break; break;

View File

@@ -42,8 +42,8 @@ public class BlockedParticipantListItemView extends LinearLayout {
@Override @Override
protected void onFinishInflate() { protected void onFinishInflate() {
super.onFinishInflate(); super.onFinishInflate();
mNameTextView = (TextView) findViewById(R.id.name); mNameTextView = findViewById(R.id.name);
mContactIconView = (ContactIconView) findViewById(R.id.contact_icon); mContactIconView = findViewById(R.id.contact_icon);
setOnClickListener(v -> mData.unblock(getContext())); setOnClickListener(v -> mData.unblock(getContext()));
} }

View File

@@ -57,7 +57,7 @@ public class BlockedParticipantsFragment extends Fragment
final Bundle savedInstanceState) { final Bundle savedInstanceState) {
final View view = final View view =
inflater.inflate(R.layout.blocked_participants_fragment, container, false); inflater.inflate(R.layout.blocked_participants_fragment, container, false);
mListView = (ListView) view.findViewById(android.R.id.list); mListView = view.findViewById(android.R.id.list);
mAdapter = new BlockedParticipantListAdapter(getActivity(), null); mAdapter = new BlockedParticipantListAdapter(getActivity(), null);
mListView.setAdapter(mAdapter); mListView.setAdapter(mAdapter);
mBinding.bind(DataModel.get().createBlockedParticipantsData(getActivity(), this)); mBinding.bind(DataModel.get().createBlockedParticipantsData(getActivity(), this));

View File

@@ -82,7 +82,8 @@ public class ClassZeroActivity extends Activity {
private boolean queueMsgFromIntent(final Intent msgIntent) { private boolean queueMsgFromIntent(final Intent msgIntent) {
final ContentValues messageValues = final ContentValues messageValues =
msgIntent.getParcelableExtra(UIIntents.UI_INTENT_EXTRA_MESSAGE_VALUES); msgIntent.getParcelableExtra(UIIntents.UI_INTENT_EXTRA_MESSAGE_VALUES,
ContentValues.class);
// that takes the format argument is a hidden API right now. // that takes the format argument is a hidden API right now.
final String message = messageValues.getAsString(Sms.BODY); final String message = messageValues.getAsString(Sms.BODY);
if (TextUtils.isEmpty(message)) { if (TextUtils.isEmpty(message)) {

View File

@@ -1,5 +1,6 @@
/* /*
* Copyright (C) 2015 The Android Open Source Project * Copyright (C) 2015 The Android Open Source Project
* Copyright (C) 2025 The LineageOS Project
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -51,7 +52,7 @@ public abstract class CustomHeaderPagerListViewHolder extends BasePagerViewHolde
getLayoutResId(), getLayoutResId(),
null /* root */, null /* root */,
false /* attachToRoot */); false /* attachToRoot */);
final ListView listView = (ListView) view.findViewById(getListViewResId()); final ListView listView = view.findViewById(getListViewResId());
listView.setAdapter(mListAdapter); listView.setAdapter(mListAdapter);
listView.setOnScrollListener(new OnScrollListener() { listView.setOnScrollListener(new OnScrollListener() {
@Override @Override
@@ -90,11 +91,11 @@ public abstract class CustomHeaderPagerListViewHolder extends BasePagerViewHolde
*/ */
private void maybeSetEmptyView() { private void maybeSetEmptyView() {
if (mView != null && mListCursorInitialized) { if (mView != null && mListCursorInitialized) {
final ListEmptyView emptyView = (ListEmptyView) mView.findViewById(getEmptyViewResId()); final ListEmptyView emptyView = mView.findViewById(getEmptyViewResId());
if (emptyView != null) { if (emptyView != null) {
emptyView.setTextHint(getEmptyViewTitleResId()); emptyView.setTextHint(getEmptyViewTitleResId());
emptyView.setImageHint(getEmptyViewImageResId()); emptyView.setImageHint(getEmptyViewImageResId());
final ListView listView = (ListView) mView.findViewById(getListViewResId()); final ListView listView = mView.findViewById(getListViewResId());
listView.setEmptyView(emptyView); listView.setEmptyView(emptyView);
} }
} }

View File

@@ -45,8 +45,8 @@ public class CustomHeaderViewPager extends LinearLayout {
inflater.inflate(R.layout.custom_header_view_pager, this, true); inflater.inflate(R.layout.custom_header_view_pager, this, true);
setOrientation(LinearLayout.VERTICAL); setOrientation(LinearLayout.VERTICAL);
mTabstrip = (ViewPagerTabs) findViewById(R.id.tab_strip); mTabstrip = findViewById(R.id.tab_strip);
mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager = findViewById(R.id.pager);
TypedValue tv = new TypedValue(); TypedValue tv = new TypedValue();
context.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true); context.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true);

View File

@@ -108,7 +108,7 @@ public class FixedViewPagerAdapter<T extends PagerViewHolder> extends PagerAdapt
((Bundle) state).setClassLoader(Factory.get().getApplicationContext().getClassLoader()); ((Bundle) state).setClassLoader(Factory.get().getApplicationContext().getClassLoader());
for (int i = 0; i < mViewHolders.length; i++) { for (int i = 0; i < mViewHolders.length; i++) {
final Parcelable pageState = restoredViewHolderState final Parcelable pageState = restoredViewHolderState
.getParcelable(getInstanceStateKeyForPage(i)); .getParcelable(getInstanceStateKeyForPage(i), Parcelable.class);
getViewHolder(i).restoreState(pageState); getViewHolder(i).restoreState(pageState);
} }
} else { } else {

View File

@@ -1,5 +1,6 @@
/* /*
* Copyright (C) 2015 The Android Open Source Project * Copyright (C) 2015 The Android Open Source Project
* Copyright (C) 2025 The LineageOS Project
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -29,7 +30,7 @@ public class LicenseActivity extends Activity {
public void onCreate(final Bundle bundle) { public void onCreate(final Bundle bundle) {
super.onCreate(bundle); super.onCreate(bundle);
setContentView(R.layout.license_activity); setContentView(R.layout.license_activity);
final WebView webView = (WebView) findViewById(R.id.content); final WebView webView = findViewById(R.id.content);
webView.loadUrl(LICENSE_URL); webView.loadUrl(LICENSE_URL);
} }
} }

View File

@@ -76,7 +76,6 @@ public class LineWrapLayout extends ViewGroup {
currLineHeight = 0; currLineHeight = 0;
x = startPadding; x = startPadding;
currLineWidth = 0; currLineWidth = 0;
startMargin = 0;
} }
x += childMeasuredWidth; x += childMeasuredWidth;

View File

@@ -1,5 +1,6 @@
/* /*
* Copyright (C) 2015 The Android Open Source Project * Copyright (C) 2015 The Android Open Source Project
* Copyright (C) 2025 The LineageOS Project
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -40,8 +41,8 @@ public class ListEmptyView extends LinearLayout {
protected void onFinishInflate() { protected void onFinishInflate() {
super.onFinishInflate(); super.onFinishInflate();
mEmptyImageHint = (ImageView) findViewById(R.id.empty_image_hint); mEmptyImageHint = findViewById(R.id.empty_image_hint);
mEmptyTextHint = (TextView) findViewById(R.id.empty_text_hint); mEmptyTextHint = findViewById(R.id.empty_text_hint);
} }
public void setImageHint(final int resId) { public void setImageHint(final int resId) {

View File

@@ -1,5 +1,6 @@
/* /*
* Copyright (C) 2015 The Android Open Source Project * Copyright (C) 2015 The Android Open Source Project
* Copyright (C) 2025 The LineageOS Project
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -98,7 +99,7 @@ public class OrientedBitmapDrawable extends BitmapDrawable {
canvas.save(); canvas.save();
canvas.scale(mOrientationParams.scaleX, mOrientationParams.scaleY, mCenterX, mCenterY); canvas.scale(mOrientationParams.scaleX, mOrientationParams.scaleY, mCenterX, mCenterY);
canvas.rotate(mOrientationParams.rotation, mCenterX, mCenterY); canvas.rotate(mOrientationParams.rotation, mCenterX, mCenterY);
canvas.drawBitmap(getBitmap(), (Rect) null, mDstRect, getPaint()); canvas.drawBitmap(getBitmap(), null, mDstRect, getPaint());
canvas.restore(); canvas.restore();
} }
} }

View File

@@ -58,10 +58,10 @@ public class PermissionCheckActivity extends Activity {
findViewById(R.id.exit).setOnClickListener(view -> finish()); findViewById(R.id.exit).setOnClickListener(view -> finish());
mNextView = (TextView) findViewById(R.id.next); mNextView = findViewById(R.id.next);
mNextView.setOnClickListener(view -> tryRequestPermission()); mNextView.setOnClickListener(view -> tryRequestPermission());
mSettingsView = (TextView) findViewById(R.id.settings); mSettingsView = findViewById(R.id.settings);
mSettingsView.setOnClickListener(view -> { mSettingsView.setOnClickListener(view -> {
final Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS, final Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
Uri.parse(PACKAGE_URI_PREFIX + getPackageName())); Uri.parse(PACKAGE_URI_PREFIX + getPackageName()));

View File

@@ -68,9 +68,9 @@ public class PersonItemView extends LinearLayout implements PersonItemDataListen
@Override @Override
protected void onFinishInflate() { protected void onFinishInflate() {
super.onFinishInflate(); super.onFinishInflate();
mNameTextView = (TextView) findViewById(R.id.name); mNameTextView = findViewById(R.id.name);
mDetailsTextView = (TextView) findViewById(R.id.details); mDetailsTextView = findViewById(R.id.details);
mContactIconView = (ContactIconView) findViewById(R.id.contact_icon); mContactIconView = findViewById(R.id.contact_icon);
mDetailsContainer = findViewById(R.id.details_container); mDetailsContainer = findViewById(R.id.details_container);
mNameTextView.addOnLayoutChangeListener(this); mNameTextView.addOnLayoutChangeListener(this);
} }

View File

@@ -214,9 +214,9 @@ public class SnackBar {
mParentView = builder.mParentView; mParentView = builder.mParentView;
mInteractions = Objects.requireNonNullElseGet(builder.mInteractions, ArrayList::new); mInteractions = Objects.requireNonNullElseGet(builder.mInteractions, ArrayList::new);
mActionTextView = (TextView) mRootView.findViewById(R.id.snack_bar_action); mActionTextView = mRootView.findViewById(R.id.snack_bar_action);
mMessageView = (TextView) mRootView.findViewById(R.id.snack_bar_message); mMessageView = mRootView.findViewById(R.id.snack_bar_message);
mMessageWrapper = (FrameLayout) mRootView.findViewById(R.id.snack_bar_message_wrapper); mMessageWrapper = mRootView.findViewById(R.id.snack_bar_message_wrapper);
setUpButton(); setUpButton();
setUpTextLines(); setUpTextLines();

View File

@@ -47,7 +47,7 @@ public class VCardDetailActivity extends BugleActionBarActivity
@NonNull final Fragment fragment) { @NonNull final Fragment fragment) {
if (fragment instanceof VCardDetailFragment) { if (fragment instanceof VCardDetailFragment) {
final Uri vCardUri = final Uri vCardUri =
getIntent().getParcelableExtra(UIIntents.UI_INTENT_EXTRA_VCARD_URI); getIntent().getParcelableExtra(UIIntents.UI_INTENT_EXTRA_VCARD_URI, Uri.class);
Assert.notNull(vCardUri); Assert.notNull(vCardUri);
final VCardDetailFragment vCardDetailFragment = (VCardDetailFragment) fragment; final VCardDetailFragment vCardDetailFragment = (VCardDetailFragment) fragment;
vCardDetailFragment.setVCardUri(vCardUri); vCardDetailFragment.setVCardUri(vCardUri);

View File

@@ -77,7 +77,7 @@ public class VCardDetailFragment extends Fragment implements PersonItemDataListe
final Bundle savedInstanceState) { final Bundle savedInstanceState) {
Assert.notNull(mVCardUri); Assert.notNull(mVCardUri);
final View view = inflater.inflate(R.layout.vcard_detail_fragment, container, false); final View view = inflater.inflate(R.layout.vcard_detail_fragment, container, false);
mListView = (ExpandableListView) view.findViewById(R.id.list); mListView = view.findViewById(R.id.list);
mListView.addOnLayoutChangeListener((v, left, top, right, bottom, oldLeft, oldTop, oldRight, mListView.addOnLayoutChangeListener((v, left, top, right, bottom, oldLeft, oldTop, oldRight,
oldBottom) -> { oldBottom) -> {
mListView.setIndicatorBounds(mListView.getWidth() - getResources(). mListView.setIndicatorBounds(mListView.getWidth() - getResources().

View File

@@ -113,7 +113,7 @@ public class VideoThumbnailView extends FrameLayout {
mVideoView = null; mVideoView = null;
} }
mPlayButton = (ImageButton) findViewById(R.id.video_thumbnail_play_button); mPlayButton = findViewById(R.id.video_thumbnail_play_button);
if (loop) { if (loop) {
mPlayButton.setVisibility(View.GONE); mPlayButton.setVisibility(View.GONE);
} else { } else {
@@ -136,7 +136,7 @@ public class VideoThumbnailView extends FrameLayout {
}); });
} }
mThumbnailImage = (AsyncImageView) findViewById(R.id.video_thumbnail_image); mThumbnailImage = findViewById(R.id.video_thumbnail_image);
if (mAllowCrop) { if (mAllowCrop) {
mThumbnailImage.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT; mThumbnailImage.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT;
mThumbnailImage.getLayoutParams().height = ViewGroup.LayoutParams.MATCH_PARENT; mThumbnailImage.getLayoutParams().height = ViewGroup.LayoutParams.MATCH_PARENT;
@@ -268,8 +268,8 @@ public class VideoThumbnailView extends FrameLayout {
super.onMeasure(widthMeasureSpec, heightMeasureSpec); super.onMeasure(widthMeasureSpec, heightMeasureSpec);
return; return;
} }
int desiredWidth = 1; int desiredWidth;
int desiredHeight = 1; int desiredHeight;
if (mVideoView != null) { if (mVideoView != null) {
mVideoView.measure(widthMeasureSpec, heightMeasureSpec); mVideoView.measure(widthMeasureSpec, heightMeasureSpec);
} }

View File

@@ -118,7 +118,7 @@ public class ApplicationSettingsActivity extends BugleActionBarActivity {
mSmsEnabledPrefKey = getString(R.string.sms_enabled_pref_key); mSmsEnabledPrefKey = getString(R.string.sms_enabled_pref_key);
mSmsEnabledPreference = findPreference(mSmsEnabledPrefKey); mSmsEnabledPreference = findPreference(mSmsEnabledPrefKey);
final PreferenceScreen advancedScreen = (PreferenceScreen) findPreference( final PreferenceScreen advancedScreen = findPreference(
getString(R.string.advanced_pref_key)); getString(R.string.advanced_pref_key));
final boolean topLevel = getActivity().getIntent().getBooleanExtra( final boolean topLevel = getActivity().getIntent().getBooleanExtra(
UIIntents.UI_INTENT_EXTRA_TOP_LEVEL_SETTINGS, false); UIIntents.UI_INTENT_EXTRA_TOP_LEVEL_SETTINGS, false);
@@ -134,7 +134,7 @@ public class ApplicationSettingsActivity extends BugleActionBarActivity {
@Override @Override
public boolean onPreferenceTreeClick(@NonNull Preference preference) { public boolean onPreferenceTreeClick(@NonNull Preference preference) {
if (preference.getKey() == mNotificationsPreferenceKey) { if (preference.getKey().equals(mNotificationsPreferenceKey)) {
Intent intent = new Intent(Settings.ACTION_APP_NOTIFICATION_SETTINGS); Intent intent = new Intent(Settings.ACTION_APP_NOTIFICATION_SETTINGS);
intent.putExtra(Settings.EXTRA_APP_PACKAGE, getContext().getPackageName()); intent.putExtra(Settings.EXTRA_APP_PACKAGE, getContext().getPackageName());
startActivity(intent); startActivity(intent);

View File

@@ -66,10 +66,8 @@ public class GroupMmsSettingDialog {
final LayoutInflater inflater = (LayoutInflater) mContext final LayoutInflater inflater = (LayoutInflater) mContext
.getSystemService(Context.LAYOUT_INFLATER_SERVICE); .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final View rootView = inflater.inflate(R.layout.group_mms_setting_dialog, null, false); final View rootView = inflater.inflate(R.layout.group_mms_setting_dialog, null, false);
final RadioButton disableButton = (RadioButton) final RadioButton disableButton = rootView.findViewById(R.id.disable_group_mms_button);
rootView.findViewById(R.id.disable_group_mms_button); final RadioButton enableButton = rootView.findViewById(R.id.enable_group_mms_button);
final RadioButton enableButton = (RadioButton)
rootView.findViewById(R.id.enable_group_mms_button);
disableButton.setOnClickListener(view -> changeGroupMmsSettings(false)); disableButton.setOnClickListener(view -> changeGroupMmsSettings(false));
enableButton.setOnClickListener(view -> changeGroupMmsSettings(true)); enableButton.setOnClickListener(view -> changeGroupMmsSettings(true));
final boolean mmsEnabled = BuglePrefs.getSubscriptionPrefs(mSubId).getBoolean( final boolean mmsEnabled = BuglePrefs.getSubscriptionPrefs(mSubId).getBoolean(

View File

@@ -95,10 +95,10 @@ public class PerSubscriptionSettingsActivity extends BugleActionBarActivity {
addPreferencesFromResource(R.xml.preferences_per_subscription); addPreferencesFromResource(R.xml.preferences_per_subscription);
mPhoneNumberKey = getString(R.string.mms_phone_number_pref_key); mPhoneNumberKey = getString(R.string.mms_phone_number_pref_key);
mPhoneNumberPreference = (PhoneNumberPreference) findPreference(mPhoneNumberKey); mPhoneNumberPreference = findPreference(mPhoneNumberKey);
final PreferenceCategory advancedCategory = (PreferenceCategory) final PreferenceCategory advancedCategory =
findPreference(getString(R.string.advanced_category_pref_key)); findPreference(getString(R.string.advanced_category_pref_key));
final PreferenceCategory mmsCategory = (PreferenceCategory) final PreferenceCategory mmsCategory =
findPreference(getString(R.string.mms_messaging_category_pref_key)); findPreference(getString(R.string.mms_messaging_category_pref_key));
mPhoneNumberPreference.setDefaultPhoneNumber( mPhoneNumberPreference.setDefaultPhoneNumber(

View File

@@ -98,7 +98,7 @@ public class SettingsActivity extends BugleActionBarActivity {
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
final Bundle savedInstanceState) { final Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.settings_fragment, container, false); final View view = inflater.inflate(R.layout.settings_fragment, container, false);
mListView = (ListView) view.findViewById(android.R.id.list); mListView = view.findViewById(android.R.id.list);
mAdapter = new SettingsListAdapter(getActivity()); mAdapter = new SettingsListAdapter(getActivity());
mListView.setAdapter(mAdapter); mListView.setAdapter(mAdapter);
return view; return view;
@@ -144,8 +144,8 @@ public class SettingsActivity extends BugleActionBarActivity {
R.layout.settings_item_view, parent, false); R.layout.settings_item_view, parent, false);
} }
final SettingsItem item = getItem(position); final SettingsItem item = getItem(position);
final TextView titleTextView = (TextView) itemView.findViewById(R.id.title); final TextView titleTextView = itemView.findViewById(R.id.title);
final TextView subtitleTextView = (TextView) itemView.findViewById(R.id.subtitle); final TextView subtitleTextView = itemView.findViewById(R.id.subtitle);
final String summaryText = item.getDisplayDetail(); final String summaryText = item.getDisplayDetail();
titleTextView.setText(item.getDisplayName()); titleTextView.setText(item.getDisplayName());
if (!TextUtils.isEmpty(summaryText)) { if (!TextUtils.isEmpty(summaryText)) {

View File

@@ -63,7 +63,7 @@ public class AttachmentChooserFragment extends Fragment implements DraftMessageD
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
final Bundle savedInstanceState) { final Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.attachment_chooser_fragment, container, false); final View view = inflater.inflate(R.layout.attachment_chooser_fragment, container, false);
mAttachmentGridView = (AttachmentGridView) view.findViewById(R.id.grid); mAttachmentGridView = view.findViewById(R.id.grid);
mAdapter = new AttachmentGridAdapter(getActivity()); mAdapter = new AttachmentGridAdapter(getActivity());
mAttachmentGridView.setAdapter(mAdapter); mAttachmentGridView.setAdapter(mAdapter);
mAttachmentGridView.setHost(this); mAttachmentGridView.setHost(this);

View File

@@ -52,8 +52,8 @@ public class AttachmentGridItemView extends FrameLayout {
@Override @Override
protected void onFinishInflate() { protected void onFinishInflate() {
super.onFinishInflate(); super.onFinishInflate();
mAttachmentViewContainer = (FrameLayout) findViewById(R.id.attachment_container); mAttachmentViewContainer = findViewById(R.id.attachment_container);
mCheckBox = (CheckBox) findViewById(R.id.checkbox); mCheckBox = findViewById(R.id.checkbox);
mCheckBox.setOnClickListener(v -> mHostInterface.onItemCheckedChanged( mCheckBox.setOnClickListener(v -> mHostInterface.onItemCheckedChanged(
AttachmentGridItemView.this, mAttachmentData)); AttachmentGridItemView.this, mAttachmentData));
setOnClickListener(v -> mHostInterface.onItemClicked(AttachmentGridItemView.this, setOnClickListener(v -> mHostInterface.onItemClicked(AttachmentGridItemView.this,

View File

@@ -142,8 +142,8 @@ public class AttachmentGridView extends GridView implements
final int partCount = in.readInt(); final int partCount = in.readInt();
unselectedParts = new MessagePartData[partCount]; unselectedParts = new MessagePartData[partCount];
for (int i = 0; i < partCount; i++) { for (int i = 0; i < partCount; i++) {
unselectedParts[i] = ((MessagePartData) in.readParcelable( unselectedParts[i] = in.readParcelable(MessagePartData.class.getClassLoader(),
MessagePartData.class.getClassLoader())); MessagePartData.class);
} }
} }

View File

@@ -74,9 +74,9 @@ public class AddContactsConfirmationDialog implements DialogInterface.OnClickLis
private View createBodyView() { private View createBodyView() {
final View view = LayoutInflater.from(mContext).inflate( final View view = LayoutInflater.from(mContext).inflate(
R.layout.add_contacts_confirmation_dialog_body, null); R.layout.add_contacts_confirmation_dialog_body, null);
final ContactIconView iconView = (ContactIconView) view.findViewById(R.id.contact_icon); final ContactIconView iconView = view.findViewById(R.id.contact_icon);
iconView.setImageResourceUri(mAvatarUri); iconView.setImageResourceUri(mAvatarUri);
final TextView textView = (TextView) view.findViewById(R.id.participant_name); final TextView textView = view.findViewById(R.id.participant_name);
textView.setText(mNormalizedDestination); textView.setText(mNormalizedDestination);
// Accessibility reason : in case phone numbers are mixed in the display name, // Accessibility reason : in case phone numbers are mixed in the display name,
// we need to vocalize it for talkback. // we need to vocalize it for talkback.

View File

@@ -64,13 +64,13 @@ public class ContactListItemView extends LinearLayout implements OnClickListener
@Override @Override
protected void onFinishInflate () { protected void onFinishInflate () {
super.onFinishInflate(); super.onFinishInflate();
mContactNameTextView = (TextView) findViewById(R.id.contact_name); mContactNameTextView = findViewById(R.id.contact_name);
mContactDetailsTextView = (TextView) findViewById(R.id.contact_details); mContactDetailsTextView = findViewById(R.id.contact_details);
mContactDetailTypeTextView = (TextView) findViewById(R.id.contact_detail_type); mContactDetailTypeTextView = findViewById(R.id.contact_detail_type);
mAlphabetHeaderTextView = (TextView) findViewById(R.id.alphabet_header); mAlphabetHeaderTextView = findViewById(R.id.alphabet_header);
mContactIconView = (ContactIconView) findViewById(R.id.contact_icon); mContactIconView = findViewById(R.id.contact_icon);
mContactCheckmarkView = (ImageView) findViewById(R.id.contact_checkmark); mContactCheckmarkView = findViewById(R.id.contact_checkmark);
mWorkProfileIcon = (ImageView) findViewById(R.id.work_profile_icon); mWorkProfileIcon = findViewById(R.id.work_profile_icon);
} }
/** /**

View File

@@ -172,7 +172,7 @@ public class ContactPickerFragment extends Fragment implements ContactPickerData
mFrequentContactsListViewHolder, mFrequentContactsListViewHolder,
mAllContactsListViewHolder }; mAllContactsListViewHolder };
mCustomHeaderViewPager = (CustomHeaderViewPager) view.findViewById(R.id.contact_pager); mCustomHeaderViewPager = view.findViewById(R.id.contact_pager);
mCustomHeaderViewPager.setViewHolders(viewHolders); mCustomHeaderViewPager.setViewHolders(viewHolders);
mCustomHeaderViewPager.setViewPagerTabHeight(CustomHeaderViewPager.DEFAULT_TAB_STRIP_SIZE); mCustomHeaderViewPager.setViewPagerTabHeight(CustomHeaderViewPager.DEFAULT_TAB_STRIP_SIZE);
mCustomHeaderViewPager.setBackgroundColor(getResources() mCustomHeaderViewPager.setBackgroundColor(getResources()
@@ -181,7 +181,7 @@ public class ContactPickerFragment extends Fragment implements ContactPickerData
// The view pager defaults to the frequent contacts page. // The view pager defaults to the frequent contacts page.
mCustomHeaderViewPager.setCurrentItem(0); mCustomHeaderViewPager.setCurrentItem(0);
mToolbar = (Toolbar) view.findViewById(R.id.toolbar); mToolbar = view.findViewById(R.id.toolbar);
mToolbar.setNavigationIcon(R.drawable.ic_arrow_back_light); mToolbar.setNavigationIcon(R.drawable.ic_arrow_back_light);
mToolbar.setNavigationContentDescription(R.string.back); mToolbar.setNavigationContentDescription(R.string.back);
mToolbar.setNavigationOnClickListener(v -> mHost.onBackButtonPressed()); mToolbar.setNavigationOnClickListener(v -> mHost.onBackButtonPressed());

View File

@@ -195,8 +195,7 @@ public class ComposeMessageView extends LinearLayout
@Override @Override
protected void onFinishInflate() { protected void onFinishInflate() {
super.onFinishInflate(); super.onFinishInflate();
mComposeEditText = (PlainTextEditText) findViewById( mComposeEditText = findViewById(R.id.compose_message_text);
R.id.compose_message_text);
mComposeEditText.setOnEditorActionListener(this); mComposeEditText.setOnEditorActionListener(this);
mComposeEditText.addTextChangedListener(this); mComposeEditText.addTextChangedListener(this);
mComposeEditText.setOnFocusChangeListener((v, hasFocus) -> { mComposeEditText.setOnFocusChangeListener((v, hasFocus) -> {
@@ -216,7 +215,7 @@ public class ComposeMessageView extends LinearLayout
new LengthFilter(MmsConfig.get(ParticipantData.DEFAULT_SELF_SUB_ID) new LengthFilter(MmsConfig.get(ParticipantData.DEFAULT_SELF_SUB_ID)
.getMaxTextLimit()) }); .getMaxTextLimit()) });
mSelfSendIcon = (SimIconView) findViewById(R.id.self_send_icon); mSelfSendIcon = findViewById(R.id.self_send_icon);
mSelfSendIcon.setOnClickListener(v -> { mSelfSendIcon.setOnClickListener(v -> {
boolean shown = mInputManager.toggleSimSelector(true /* animate */, boolean shown = mInputManager.toggleSimSelector(true /* animate */,
getSelfSubscriptionListEntry()); getSelfSubscriptionListEntry());
@@ -233,8 +232,7 @@ public class ComposeMessageView extends LinearLayout
return true; return true;
}); });
mComposeSubjectText = (PlainTextEditText) findViewById( mComposeSubjectText = findViewById(R.id.compose_subject_text);
R.id.compose_subject_text);
// We need the listener to change the avatar to the send button when the user starts // We need the listener to change the avatar to the send button when the user starts
// typing a subject without a message. // typing a subject without a message.
mComposeSubjectText.addTextChangedListener(this); mComposeSubjectText.addTextChangedListener(this);
@@ -244,7 +242,7 @@ public class ComposeMessageView extends LinearLayout
new LengthFilter(MmsConfig.get(ParticipantData.DEFAULT_SELF_SUB_ID) new LengthFilter(MmsConfig.get(ParticipantData.DEFAULT_SELF_SUB_ID)
.getMaxSubjectLength())}); .getMaxSubjectLength())});
mDeleteSubjectButton = (ImageButton) findViewById(R.id.delete_subject_button); mDeleteSubjectButton = findViewById(R.id.delete_subject_button);
mDeleteSubjectButton.setOnClickListener(clickView -> { mDeleteSubjectButton.setOnClickListener(clickView -> {
hideSubjectEditor(); hideSubjectEditor();
mComposeSubjectText.setText(null); mComposeSubjectText.setText(null);
@@ -253,7 +251,7 @@ public class ComposeMessageView extends LinearLayout
mSubjectView = findViewById(R.id.subject_view); mSubjectView = findViewById(R.id.subject_view);
mSendButton = (ImageButton) findViewById(R.id.send_message_button); mSendButton = findViewById(R.id.send_message_button);
mSendButton.setOnClickListener(clickView -> mSendButton.setOnClickListener(clickView ->
sendMessageInternal(true /* checkMessageSize */)); sendMessageInternal(true /* checkMessageSize */));
mSendButton.setOnLongClickListener(arg0 -> { mSendButton.setOnLongClickListener(arg0 -> {
@@ -284,18 +282,17 @@ public class ComposeMessageView extends LinearLayout
} }
}); });
mAttachMediaButton = mAttachMediaButton = findViewById(R.id.attach_media_button);
(ImageButton) findViewById(R.id.attach_media_button);
mAttachMediaButton.setOnClickListener(clickView -> { mAttachMediaButton.setOnClickListener(clickView -> {
// Showing the media picker is treated as starting to compose the message. // Showing the media picker is treated as starting to compose the message.
mInputManager.showHideMediaPicker(true /* show */, true /* animate */); mInputManager.showHideMediaPicker(true /* show */, true /* animate */);
}); });
mAttachmentPreview = (AttachmentPreview) findViewById(R.id.attachment_draft_view); mAttachmentPreview = findViewById(R.id.attachment_draft_view);
mAttachmentPreview.setComposeMessageView(this); mAttachmentPreview.setComposeMessageView(this);
mMessageBodySize = (TextView) findViewById(R.id.message_body_size); mMessageBodySize = findViewById(R.id.message_body_size);
mMmsIndicator = (TextView) findViewById(R.id.mms_indicator); mMmsIndicator = findViewById(R.id.mms_indicator);
} }
private void hideAttachmentsWhenShowingSims(final boolean simPickerVisible) { private void hideAttachmentsWhenShowingSims(final boolean simPickerVisible) {

View File

@@ -71,7 +71,8 @@ public class ConversationActivity extends BugleActionBarActivity
// Do our best to restore UI state from saved instance state. // Do our best to restore UI state from saved instance state.
if (savedInstanceState != null) { if (savedInstanceState != null) {
mUiState = savedInstanceState.getParcelable(SAVED_INSTANCE_STATE_UI_STATE_KEY); mUiState = savedInstanceState.getParcelable(SAVED_INSTANCE_STATE_UI_STATE_KEY,
ConversationActivityUiState.class);
} else { } else {
if (intent. if (intent.
getBooleanExtra(UIIntents.UI_INTENT_EXTRA_GOTO_CONVERSATION_LIST, false)) { getBooleanExtra(UIIntents.UI_INTENT_EXTRA_GOTO_CONVERSATION_LIST, false)) {
@@ -321,7 +322,7 @@ public class ConversationActivity extends BugleActionBarActivity
conversationFragment, ConversationFragment.FRAGMENT_TAG); conversationFragment, ConversationFragment.FRAGMENT_TAG);
} }
final MessageData draftData = intent.getParcelableExtra( final MessageData draftData = intent.getParcelableExtra(
UIIntents.UI_INTENT_EXTRA_DRAFT_DATA); UIIntents.UI_INTENT_EXTRA_DRAFT_DATA, MessageData.class);
if (!needContactPickerFragment) { if (!needContactPickerFragment) {
// Once the user has committed the audience,remove the draft data from the // Once the user has committed the audience,remove the draft data from the
// intent to prevent reuse // intent to prevent reuse

View File

@@ -507,7 +507,7 @@ public class ConversationFragment extends Fragment implements ConversationDataLi
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
final Bundle savedInstanceState) { final Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.conversation_fragment, container, false); final View view = inflater.inflate(R.layout.conversation_fragment, container, false);
mRecyclerView = (RecyclerView) view.findViewById(android.R.id.list); mRecyclerView = view.findViewById(android.R.id.list);
final LinearLayoutManager manager = new LinearLayoutManager(getActivity()); final LinearLayoutManager manager = new LinearLayoutManager(getActivity());
manager.setStackFromEnd(true); manager.setStackFromEnd(true);
manager.setReverseLayout(false); manager.setReverseLayout(false);
@@ -529,16 +529,14 @@ public class ConversationFragment extends Fragment implements ConversationDataLi
!data.getIsIncoming() && !data.getIsIncoming() &&
timeSinceSend < MESSAGE_ANIMATION_MAX_WAIT) { timeSinceSend < MESSAGE_ANIMATION_MAX_WAIT) {
final ConversationMessageBubbleView messageBubble = final ConversationMessageBubbleView messageBubble =
(ConversationMessageBubbleView) view view.findViewById(R.id.message_content);
.findViewById(R.id.message_content);
final Rect startRect = UiUtils.getMeasuredBoundsOnScreen(mComposeMessageView); final Rect startRect = UiUtils.getMeasuredBoundsOnScreen(mComposeMessageView);
final View composeBubbleView = mComposeMessageView.findViewById( final View composeBubbleView = mComposeMessageView.findViewById(
R.id.compose_message_text); R.id.compose_message_text);
final Rect composeBubbleRect = final Rect composeBubbleRect =
UiUtils.getMeasuredBoundsOnScreen(composeBubbleView); UiUtils.getMeasuredBoundsOnScreen(composeBubbleView);
final AttachmentPreview attachmentView = final AttachmentPreview attachmentView =
(AttachmentPreview) mComposeMessageView.findViewById( mComposeMessageView.findViewById(R.id.attachment_draft_view);
R.id.attachment_draft_view);
final Rect attachmentRect = UiUtils.getMeasuredBoundsOnScreen(attachmentView); final Rect attachmentRect = UiUtils.getMeasuredBoundsOnScreen(attachmentView);
if (attachmentView.getVisibility() == View.VISIBLE) { if (attachmentView.getVisibility() == View.VISIBLE) {
startRect.top = attachmentRect.top; startRect.top = attachmentRect.top;
@@ -594,7 +592,8 @@ public class ConversationFragment extends Fragment implements ConversationDataLi
mRecyclerView.setAdapter(mAdapter); mRecyclerView.setAdapter(mAdapter);
if (savedInstanceState != null) { if (savedInstanceState != null) {
mListState = savedInstanceState.getParcelable(SAVED_INSTANCE_STATE_LIST_VIEW_STATE_KEY); mListState = savedInstanceState.getParcelable(SAVED_INSTANCE_STATE_LIST_VIEW_STATE_KEY,
Parcelable.class);
} }
mConversationComposeDivider = view.findViewById(R.id.conversation_compose_divider); mConversationComposeDivider = view.findViewById(R.id.conversation_compose_divider);
@@ -604,8 +603,7 @@ public class ConversationFragment extends Fragment implements ConversationDataLi
UiUtils.isRtlMode() ? ConversationFastScroller.POSITION_LEFT_SIDE : UiUtils.isRtlMode() ? ConversationFastScroller.POSITION_LEFT_SIDE :
ConversationFastScroller.POSITION_RIGHT_SIDE); ConversationFastScroller.POSITION_RIGHT_SIDE);
mComposeMessageView = (ComposeMessageView) mComposeMessageView = view.findViewById(R.id.message_compose_view_container);
view.findViewById(R.id.message_compose_view_container);
// Bind the compose message view to the DraftMessageData // Bind the compose message view to the DraftMessageData
mComposeMessageView.bind(DataModel.get().createDraftMessageData( mComposeMessageView.bind(DataModel.get().createDraftMessageData(
mBinding.getData().getConversationId()), this); mBinding.getData().getConversationId()), this);
@@ -1436,7 +1434,7 @@ public class ConversationFragment extends Fragment implements ConversationDataLi
@Override @Override
public SimSelectorView getSimSelectorView() { public SimSelectorView getSimSelectorView() {
return (SimSelectorView) getView().findViewById(R.id.sim_selector); return getView().findViewById(R.id.sim_selector);
} }
@Override @Override
@@ -1516,8 +1514,7 @@ public class ConversationFragment extends Fragment implements ConversationDataLi
actionBar.setCustomView(customView); actionBar.setCustomView(customView);
} }
final TextView conversationNameView = final TextView conversationNameView = customView.findViewById(R.id.conversation_title);
(TextView) customView.findViewById(R.id.conversation_title);
final String conversationName = getConversationName(); final String conversationName = getConversationName();
if (!TextUtils.isEmpty(conversationName)) { if (!TextUtils.isEmpty(conversationName)) {
// RTL : To format conversation title if it happens to be phone numbers. // RTL : To format conversation title if it happens to be phone numbers.

View File

@@ -54,7 +54,7 @@ public class ConversationMessageBubbleView extends LinearLayout {
@Override @Override
protected void onFinishInflate() { protected void onFinishInflate() {
super.onFinishInflate(); super.onFinishInflate();
mBubbleBackground = (ViewGroup) findViewById(R.id.message_text_and_info); mBubbleBackground = findViewById(R.id.message_text_and_info);
} }
@Override @Override

View File

@@ -124,37 +124,37 @@ public class ConversationMessageView extends FrameLayout implements View.OnClick
@Override @Override
protected void onFinishInflate() { protected void onFinishInflate() {
super.onFinishInflate(); super.onFinishInflate();
mContactIconView = (ContactIconView) findViewById(R.id.conversation_icon); mContactIconView = findViewById(R.id.conversation_icon);
mContactIconView.setOnLongClickListener(view -> { mContactIconView.setOnLongClickListener(view -> {
ConversationMessageView.this.performLongClick(); ConversationMessageView.this.performLongClick();
return true; return true;
}); });
mMessageAttachmentsView = (LinearLayout) findViewById(R.id.message_attachments); mMessageAttachmentsView = findViewById(R.id.message_attachments);
mMultiAttachmentView = (MultiAttachmentLayout) findViewById(R.id.multiple_attachments); mMultiAttachmentView = findViewById(R.id.multiple_attachments);
mMultiAttachmentView.setOnAttachmentClickListener(this); mMultiAttachmentView.setOnAttachmentClickListener(this);
mMessageImageView = (AsyncImageView) findViewById(R.id.message_image); mMessageImageView = findViewById(R.id.message_image);
mMessageImageView.setOnClickListener(this); mMessageImageView.setOnClickListener(this);
mMessageImageView.setOnLongClickListener(this); mMessageImageView.setOnLongClickListener(this);
mMessageTextView = (TextView) findViewById(R.id.message_text); mMessageTextView = findViewById(R.id.message_text);
mMessageTextView.setOnClickListener(this); mMessageTextView.setOnClickListener(this);
IgnoreLinkLongClickHelper.ignoreLinkLongClick(mMessageTextView, this); IgnoreLinkLongClickHelper.ignoreLinkLongClick(mMessageTextView, this);
mStatusTextView = (TextView) findViewById(R.id.message_status); mStatusTextView = findViewById(R.id.message_status);
mTitleTextView = (TextView) findViewById(R.id.message_title); mTitleTextView = findViewById(R.id.message_title);
mMmsInfoTextView = (TextView) findViewById(R.id.mms_info); mMmsInfoTextView = findViewById(R.id.mms_info);
mMessageTitleLayout = (LinearLayout) findViewById(R.id.message_title_layout); mMessageTitleLayout = findViewById(R.id.message_title_layout);
mSenderNameTextView = (TextView) findViewById(R.id.message_sender_name); mSenderNameTextView = findViewById(R.id.message_sender_name);
mMessageBubble = (ConversationMessageBubbleView) findViewById(R.id.message_content); mMessageBubble = findViewById(R.id.message_content);
mSubjectView = findViewById(R.id.subject_container); mSubjectView = findViewById(R.id.subject_container);
mSubjectLabel = (TextView) mSubjectView.findViewById(R.id.subject_label); mSubjectLabel = mSubjectView.findViewById(R.id.subject_label);
mSubjectText = (TextView) mSubjectView.findViewById(R.id.subject_text); mSubjectText = mSubjectView.findViewById(R.id.subject_text);
mDeliveredBadge = findViewById(R.id.smsDeliveredBadge); mDeliveredBadge = findViewById(R.id.smsDeliveredBadge);
mMessageMetadataView = (ViewGroup) findViewById(R.id.message_metadata); mMessageMetadataView = findViewById(R.id.message_metadata);
mMessageTextAndInfoView = (ViewGroup) findViewById(R.id.message_text_and_info); mMessageTextAndInfoView = findViewById(R.id.message_text_and_info);
mSimNameView = (TextView) findViewById(R.id.sim_name); mSimNameView = findViewById(R.id.sim_name);
} }
@Override @Override
@@ -882,8 +882,8 @@ public class ConversationMessageView extends FrameLayout implements View.OnClick
private void updateTextAppearance() { private void updateTextAppearance() {
int messageColorResId; int messageColorResId;
int statusColorResId = -1; int statusColorResId;
int infoColorResId = -1; int infoColorResId;
int timestampColorResId; int timestampColorResId;
int subjectLabelColorResId; int subjectLabelColorResId;
if (isSelected()) { if (isSelected()) {

View File

@@ -57,7 +57,7 @@ public class MessageDetailsDialog {
private static String getMessageDetails(final Context context, private static String getMessageDetails(final Context context,
final ConversationMessageData data, final ConversationMessageData data,
final ConversationParticipantsData participants, final ParticipantData self) { final ConversationParticipantsData participants, final ParticipantData self) {
String messageDetails = null; String messageDetails;
if (data.getIsSms()) { if (data.getIsSms()) {
messageDetails = getSmsMessageDetails(data, participants, self); messageDetails = getSmsMessageDetails(data, participants, self);
} else { } else {

View File

@@ -47,9 +47,9 @@ public class SimSelectorItemView extends LinearLayout {
@Override @Override
protected void onFinishInflate() { protected void onFinishInflate() {
super.onFinishInflate(); super.onFinishInflate();
mNameTextView = (TextView) findViewById(R.id.name); mNameTextView = findViewById(R.id.name);
mDetailsTextView = (TextView) findViewById(R.id.details); mDetailsTextView = findViewById(R.id.details);
mSimIconView = (SimIconView) findViewById(R.id.sim_icon); mSimIconView = findViewById(R.id.sim_icon);
setOnClickListener(v -> mHost.onSimItemClicked(mData)); setOnClickListener(v -> mHost.onSimItemClicked(mData));
} }

View File

@@ -60,7 +60,7 @@ public class SimSelectorView extends FrameLayout implements SimSelectorItemView.
@Override @Override
protected void onFinishInflate() { protected void onFinishInflate() {
super.onFinishInflate(); super.onFinishInflate();
mSimListView = (ListView) findViewById(R.id.sim_list); mSimListView = findViewById(R.id.sim_list);
mSimListView.setAdapter(mAdapter); mSimListView.setAdapter(mAdapter);
// Clicking anywhere outside the switcher list should dismiss. // Clicking anywhere outside the switcher list should dismiss.

View File

@@ -171,8 +171,8 @@ public class ConversationListFragment extends Fragment implements ConversationLi
final Bundle savedInstanceState) { final Bundle savedInstanceState) {
final ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.conversation_list_fragment, final ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.conversation_list_fragment,
container, false); container, false);
mRecyclerView = (RecyclerView) rootView.findViewById(android.R.id.list); mRecyclerView = rootView.findViewById(android.R.id.list);
mEmptyListMessageView = (ListEmptyView) rootView.findViewById(R.id.no_conversations_view); mEmptyListMessageView = rootView.findViewById(R.id.no_conversations_view);
mEmptyListMessageView.setImageHint(R.drawable.ic_oobe_conv_list); mEmptyListMessageView.setImageHint(R.drawable.ic_oobe_conv_list);
// The default behavior for default layout param generation by LinearLayoutManager is to // The default behavior for default layout param generation by LinearLayoutManager is to
// provide width and height of WRAP_CONTENT, but this is not desirable for // provide width and height of WRAP_CONTENT, but this is not desirable for
@@ -189,7 +189,7 @@ public class ConversationListFragment extends Fragment implements ConversationLi
mRecyclerView.setLayoutManager(manager); mRecyclerView.setLayoutManager(manager);
mRecyclerView.setHasFixedSize(true); mRecyclerView.setHasFixedSize(true);
mRecyclerView.setAdapter(mAdapter); mRecyclerView.setAdapter(mAdapter);
mRecyclerView.setOnScrollListener(new RecyclerView.OnScrollListener() { mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
int mCurrentState = AbsListView.OnScrollListener.SCROLL_STATE_IDLE; int mCurrentState = AbsListView.OnScrollListener.SCROLL_STATE_IDLE;
@Override @Override
@@ -216,11 +216,11 @@ public class ConversationListFragment extends Fragment implements ConversationLi
mRecyclerView.addOnItemTouchListener(new ConversationListSwipeHelper(mRecyclerView)); mRecyclerView.addOnItemTouchListener(new ConversationListSwipeHelper(mRecyclerView));
if (savedInstanceState != null) { if (savedInstanceState != null) {
mListState = savedInstanceState.getParcelable(SAVED_INSTANCE_STATE_LIST_VIEW_STATE_KEY); mListState = savedInstanceState.getParcelable(SAVED_INSTANCE_STATE_LIST_VIEW_STATE_KEY,
Parcelable.class);
} }
mStartNewConversationButton = (ExtendedFloatingActionButton) rootView.findViewById( mStartNewConversationButton = rootView.findViewById(R.id.start_new_conversation_button);
R.id.start_new_conversation_button);
if (mArchiveMode || mForwardMessageMode) { if (mArchiveMode || mForwardMessageMode) {
mStartNewConversationButton.setVisibility(View.GONE); mStartNewConversationButton.setVisibility(View.GONE);
} else { } else {

View File

@@ -145,22 +145,21 @@ public class ConversationListItemView extends FrameLayout implements OnClickList
@Override @Override
protected void onFinishInflate() { protected void onFinishInflate() {
super.onFinishInflate(); super.onFinishInflate();
mSwipeableContainer = (ViewGroup) findViewById(R.id.swipeableContainer); mSwipeableContainer = findViewById(R.id.swipeableContainer);
mCrossSwipeBackground = (ViewGroup) findViewById(R.id.crossSwipeBackground); mCrossSwipeBackground = findViewById(R.id.crossSwipeBackground);
mSwipeableContent = (ViewGroup) findViewById(R.id.swipeableContent); mSwipeableContent = findViewById(R.id.swipeableContent);
mConversationNameView = (TextView) findViewById(R.id.conversation_name); mConversationNameView = findViewById(R.id.conversation_name);
mSnippetTextView = (TextView) findViewById(R.id.conversation_snippet); mSnippetTextView = findViewById(R.id.conversation_snippet);
mSubjectTextView = (TextView) findViewById(R.id.conversation_subject); mSubjectTextView = findViewById(R.id.conversation_subject);
mWorkProfileIconView = (ImageView) findViewById(R.id.work_profile_icon); mWorkProfileIconView = findViewById(R.id.work_profile_icon);
mTimestampTextView = (TextView) findViewById(R.id.conversation_timestamp); mTimestampTextView = findViewById(R.id.conversation_timestamp);
mContactIconView = (ContactIconView) findViewById(R.id.conversation_icon); mContactIconView = findViewById(R.id.conversation_icon);
mContactCheckmarkView = (ImageView) findViewById(R.id.conversation_checkmark); mContactCheckmarkView = findViewById(R.id.conversation_checkmark);
mFailedStatusIconView = (ImageView) findViewById(R.id.conversation_failed_status_icon); mFailedStatusIconView = findViewById(R.id.conversation_failed_status_icon);
mCrossSwipeArchiveLeftImageView = (ImageView) findViewById(R.id.crossSwipeArchiveIconLeft); mCrossSwipeArchiveLeftImageView = findViewById(R.id.crossSwipeArchiveIconLeft);
mCrossSwipeArchiveRightImageView = mCrossSwipeArchiveRightImageView = findViewById(R.id.crossSwipeArchiveIconRight);
(ImageView) findViewById(R.id.crossSwipeArchiveIconRight); mImagePreviewView = findViewById(R.id.conversation_image_preview);
mImagePreviewView = (AsyncImageView) findViewById(R.id.conversation_image_preview); mAudioAttachmentView = findViewById(R.id.audio_attachment_view);
mAudioAttachmentView = (AudioAttachmentView) findViewById(R.id.audio_attachment_view);
mConversationNameView.addOnLayoutChangeListener(this); mConversationNameView.addOnLayoutChangeListener(this);
mSnippetTextView.addOnLayoutChangeListener(this); mSnippetTextView.addOnLayoutChangeListener(this);

View File

@@ -46,7 +46,8 @@ public class ForwardMessageActivity extends BaseBugleActivity
final ConversationListFragment fragment = final ConversationListFragment fragment =
ConversationListFragment.createForwardMessageConversationListFragment(); ConversationListFragment.createForwardMessageConversationListFragment();
getSupportFragmentManager().beginTransaction().add(android.R.id.content, fragment).commit(); getSupportFragmentManager().beginTransaction().add(android.R.id.content, fragment).commit();
mDraftMessage = getIntent().getParcelableExtra(UIIntents.UI_INTENT_EXTRA_DRAFT_DATA); mDraftMessage = getIntent().getParcelableExtra(UIIntents.UI_INTENT_EXTRA_DRAFT_DATA,
MessageData.class);
} }
@Override @Override

View File

@@ -94,7 +94,7 @@ public class ShareIntentActivity extends BaseBugleActivity implements
} }
if (Intent.ACTION_SEND.equals(action)) { if (Intent.ACTION_SEND.equals(action)) {
final Uri contentUri = (Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM); final Uri contentUri = intent.getParcelableExtra(Intent.EXTRA_STREAM, Uri.class);
if (UriUtil.isFileUri(contentUri)) { if (UriUtil.isFileUri(contentUri)) {
LogUtil.i( LogUtil.i(
LogUtil.BUGLE_TAG, LogUtil.BUGLE_TAG,
@@ -134,7 +134,8 @@ public class ShareIntentActivity extends BaseBugleActivity implements
} else if (Intent.ACTION_SEND_MULTIPLE.equals(action)) { } else if (Intent.ACTION_SEND_MULTIPLE.equals(action)) {
final String contentType = intent.getType(); final String contentType = intent.getType();
// Handle sharing multiple contents. // Handle sharing multiple contents.
final ArrayList<Uri> uris = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM); final ArrayList<Uri> uris = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM,
Uri.class);
if (uris != null && !uris.isEmpty()) { if (uris != null && !uris.isEmpty()) {
ArrayMap<Uri, String> uriMap = new ArrayMap<>(); ArrayMap<Uri, String> uriMap = new ArrayMap<>();
StringBuffer strBuffer = new StringBuffer(); StringBuffer strBuffer = new StringBuffer();

View File

@@ -71,7 +71,7 @@ public class ShareIntentFragment extends DialogFragment implements ConversationL
final Activity activity = getActivity(); final Activity activity = getActivity();
final LayoutInflater inflater = activity.getLayoutInflater(); final LayoutInflater inflater = activity.getLayoutInflater();
View view = inflater.inflate(R.layout.share_intent_conversation_list_view, null); View view = inflater.inflate(R.layout.share_intent_conversation_list_view, null);
mEmptyListMessageView = (ListEmptyView) view.findViewById(R.id.no_conversations_view); mEmptyListMessageView = view.findViewById(R.id.no_conversations_view);
mEmptyListMessageView.setImageHint(R.drawable.ic_oobe_conv_list); mEmptyListMessageView.setImageHint(R.drawable.ic_oobe_conv_list);
// The default behavior for default layout param generation by LinearLayoutManager is to // The default behavior for default layout param generation by LinearLayoutManager is to
// provide width and height of WRAP_CONTENT, but this is not desirable for // provide width and height of WRAP_CONTENT, but this is not desirable for
@@ -86,7 +86,7 @@ public class ShareIntentFragment extends DialogFragment implements ConversationL
}; };
mListBinding.getData().init(LoaderManager.getInstance(this), mListBinding); mListBinding.getData().init(LoaderManager.getInstance(this), mListBinding);
mAdapter = new ShareIntentAdapter(activity, null, this); mAdapter = new ShareIntentAdapter(activity, null, this);
mRecyclerView = (RecyclerView) view.findViewById(android.R.id.list); mRecyclerView = view.findViewById(android.R.id.list);
mRecyclerView.setLayoutManager(manager); mRecyclerView.setLayoutManager(manager);
mRecyclerView.setHasFixedSize(true); mRecyclerView.setHasFixedSize(true);
mRecyclerView.setAdapter(mAdapter); mRecyclerView.setAdapter(mAdapter);

View File

@@ -78,7 +78,7 @@ public class PeopleAndOptionsFragment extends Fragment
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
final Bundle savedInstanceState) { final Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.people_and_options_fragment, container, false); final View view = inflater.inflate(R.layout.people_and_options_fragment, container, false);
mListView = (ListView) view.findViewById(android.R.id.list); mListView = view.findViewById(android.R.id.list);
mPeopleListAdapter = new PeopleListAdapter(getActivity()); mPeopleListAdapter = new PeopleListAdapter(getActivity());
mOptionsListAdapter = new OptionsListAdapter(); mOptionsListAdapter = new OptionsListAdapter();
final CompositeAdapter compositeAdapter = new CompositeAdapter(getActivity()); final CompositeAdapter compositeAdapter = new CompositeAdapter(getActivity());
@@ -297,14 +297,14 @@ public class PeopleAndOptionsFragment extends Fragment
@Override @Override
public View getHeaderView(final View convertView, final ViewGroup parentView) { public View getHeaderView(final View convertView, final ViewGroup parentView) {
View view = null; View view;
if (convertView != null && convertView.getId() == R.id.people_and_options_header) { if (convertView != null && convertView.getId() == R.id.people_and_options_header) {
view = convertView; view = convertView;
} else { } else {
view = LayoutInflater.from(getActivity()).inflate( view = LayoutInflater.from(getActivity()).inflate(
R.layout.people_and_options_section_header, parentView, false); R.layout.people_and_options_section_header, parentView, false);
} }
final TextView text = (TextView) view.findViewById(R.id.header_text); final TextView text = view.findViewById(R.id.header_text);
final View divider = view.findViewById(R.id.divider); final View divider = view.findViewById(R.id.divider);
text.setText(mHeaderResId); text.setText(mHeaderResId);
divider.setVisibility(mNeedDivider ? View.VISIBLE : View.GONE); divider.setVisibility(mNeedDivider ? View.VISIBLE : View.GONE);

View File

@@ -55,7 +55,7 @@ public class PeopleOptionsItemView extends LinearLayout {
@Override @Override
protected void onFinishInflate () { protected void onFinishInflate () {
super.onFinishInflate(); super.onFinishInflate();
mTitle = (TextView) findViewById(R.id.title); mTitle = findViewById(R.id.title);
setOnClickListener(v -> mHostInterface.onOptionsItemViewClicked(mData)); setOnClickListener(v -> mHostInterface.onOptionsItemViewClicked(mData));
} }

View File

@@ -114,11 +114,11 @@ public class AudioRecordView extends FrameLayout implements
@Override @Override
protected void onFinishInflate() { protected void onFinishInflate() {
super.onFinishInflate(); super.onFinishInflate();
mSoundLevels = (SoundLevels) findViewById(R.id.sound_levels); mSoundLevels = findViewById(R.id.sound_levels);
mRecordButtonVisual = (ImageView) findViewById(R.id.record_button_visual); mRecordButtonVisual = findViewById(R.id.record_button_visual);
mRecordButton = findViewById(R.id.record_button); mRecordButton = findViewById(R.id.record_button);
mHintTextView = (TextView) findViewById(R.id.hint_text); mHintTextView = findViewById(R.id.hint_text);
mTimerTextView = (PausableChronometer) findViewById(R.id.timer_text); mTimerTextView = findViewById(R.id.timer_text);
mSoundLevels.setLevelSource(mMediaRecorder.getLevelSource()); mSoundLevels.setLevelSource(mMediaRecorder.getLevelSource());
mRecordButton.setOnTouchListener((v, event) -> { mRecordButton.setOnTouchListener((v, event) -> {
final int action = event.getActionMasked(); final int action = event.getActionMasked();

View File

@@ -210,7 +210,7 @@ public class MediaPicker extends Fragment implements DraftMessageSubscriptionDat
container, container,
false); false);
mMediaPickerPanel.setMediaPicker(this); mMediaPickerPanel.setMediaPicker(this);
mTabStrip = (LinearLayout) mMediaPickerPanel.findViewById(R.id.mediapicker_tabstrip); mTabStrip = mMediaPickerPanel.findViewById(R.id.mediapicker_tabstrip);
mTabStrip.setBackgroundColor(mThemeColor); mTabStrip.setBackgroundColor(mThemeColor);
for (final MediaChooser chooser : mChoosers) { for (final MediaChooser chooser : mChoosers) {
chooser.onCreateTabButton(inflater, mTabStrip); chooser.onCreateTabButton(inflater, mTabStrip);
@@ -221,8 +221,8 @@ public class MediaPicker extends Fragment implements DraftMessageSubscriptionDat
} }
} }
mViewPager = (ViewPager) mMediaPickerPanel.findViewById(R.id.mediapicker_view_pager); mViewPager = mMediaPickerPanel.findViewById(R.id.mediapicker_view_pager);
mViewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override @Override
public void onPageScrolled( public void onPageScrolled(
final int position, final int position,

View File

@@ -96,8 +96,8 @@ public class MediaPickerPanel extends ViewGroup {
@Override @Override
protected void onFinishInflate() { protected void onFinishInflate() {
super.onFinishInflate(); super.onFinishInflate();
mTabStrip = (LinearLayout) findViewById(R.id.mediapicker_tabstrip); mTabStrip = findViewById(R.id.mediapicker_tabstrip);
mViewPager = (PagingAwareViewPager) findViewById(R.id.mediapicker_view_pager); mViewPager = findViewById(R.id.mediapicker_view_pager);
mTouchHandler = new TouchHandler(); mTouchHandler = new TouchHandler();
setOnTouchListener(mTouchHandler); setOnTouchListener(mTouchHandler);
mViewPager.setOnTouchListener(mTouchHandler); mViewPager.setOnTouchListener(mTouchHandler);

View File

@@ -1,6 +1,6 @@
/* /*
* Copyright (C) 2015 The Android Open Source Project * Copyright (C) 2015 The Android Open Source Project
* Copyright (C) 2024 The LineageOS Project * Copyright (C) 2024-2025 The LineageOS Project
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -29,8 +29,6 @@ import com.android.messaging.R;
import javax.annotation.Nullable; import javax.annotation.Nullable;
public class AccessibilityUtil { public class AccessibilityUtil {
public static String sContentDescriptionDivider;
public static boolean isTouchExplorationEnabled(final Context context) { public static boolean isTouchExplorationEnabled(final Context context) {
final AccessibilityManager accessibilityManager = (AccessibilityManager) final AccessibilityManager accessibilityManager = (AccessibilityManager)
context.getSystemService(Context.ACCESSIBILITY_SERVICE); context.getSystemService(Context.ACCESSIBILITY_SERVICE);

View File

@@ -272,5 +272,5 @@ public final class EmailAddress {
protected boolean valid = false; protected boolean valid = false;
protected String user = null; protected String user = null;
protected String host = null; protected String host = null;
protected boolean allowI18n = false; protected boolean allowI18n;
} }

View File

@@ -107,7 +107,6 @@ public class ImageUtils {
if (oomCount <= MAX_OOM_COUNT) { if (oomCount <= MAX_OOM_COUNT) {
Factory.get().reclaimMemory(); Factory.get().reclaimMemory();
} else { } else {
done = true;
LogUtil.w(TAG, "Failed to convert bitmap to bytes. Out of Memory."); LogUtil.w(TAG, "Failed to convert bitmap to bytes. Out of Memory.");
} }
throw e; throw e;

View File

@@ -186,7 +186,7 @@ public class NotificationPlayer implements OnCompletionListener {
@Override @Override
public void run() { public void run() {
while (true) { while (true) {
Command cmd = null; Command cmd;
synchronized (mCmdQueue) { synchronized (mCmdQueue) {
if (mDebug) { if (mDebug) {
@@ -327,31 +327,6 @@ public class NotificationPlayer implements OnCompletionListener {
} }
} }
/**
* We want to hold a wake lock while we do the prepare and play. The stop probably is
* optional, but it won't hurt to have it too. The problem is that if you start a sound
* while you're holding a wake lock (e.g. an alarm starting a notification), you want the
* sound to play, but if the CPU turns off before mThread gets to work, it won't. The
* simplest way to deal with this is to make it so there is a wake lock held while the
* thread is starting or running. You're going to need the WAKE_LOCK permission if you're
* going to call this.
*
* This must be called before the first time play is called.
*
* @hide
*/
public void setUsesWakeLock() {
if (mWakeLock != null || mThread != null) {
// if either of these has happened, we've already played something.
// and our releases will be out of sync.
throw new RuntimeException("assertion failed mWakeLock=" + mWakeLock
+ " mThread=" + mThread);
}
final PowerManager pm = (PowerManager) Factory.get().getApplicationContext()
.getSystemService(Context.POWER_SERVICE);
mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, mTag);
}
private void acquireWakeLock() { private void acquireWakeLock() {
if (mWakeLock != null) { if (mWakeLock != null) {
mWakeLock.acquire(); mWakeLock.acquire();

Some files were not shown because too many files have changed in this diff Show More