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:
@@ -70,10 +70,10 @@ public class AttachmentPreview extends ScrollView implements OnAttachmentClickLi
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
mCloseButton = (ImageButton) findViewById(R.id.close_button);
|
||||
mCloseButton = findViewById(R.id.close_button);
|
||||
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
|
||||
// attachment whenever the space is tight (e.g. when in landscape mode). Per design
|
||||
|
||||
@@ -66,7 +66,7 @@ public class AttachmentPreviewFactory {
|
||||
final int viewType, final boolean startImageRequest,
|
||||
@Nullable final OnAttachmentClickListener clickListener) {
|
||||
final String contentType = attachmentData.getContentType();
|
||||
View attachmentView = null;
|
||||
View attachmentView;
|
||||
if (attachmentData instanceof PendingAttachmentData) {
|
||||
attachmentView = createPendingAttachmentPreview(layoutInflater, parent,
|
||||
(PendingAttachmentData) attachmentData);
|
||||
@@ -85,7 +85,7 @@ public class AttachmentPreviewFactory {
|
||||
}
|
||||
|
||||
// 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) {
|
||||
final String caption = attachmentData.getText();
|
||||
captionView.setVisibility(TextUtils.isEmpty(caption) ? View.GONE : View.VISIBLE);
|
||||
@@ -159,8 +159,7 @@ public class AttachmentPreviewFactory {
|
||||
break;
|
||||
}
|
||||
final View view = layoutInflater.inflate(layoutId, parent, false /* attachToRoot */);
|
||||
final AsyncImageView imageView = (AsyncImageView) view.findViewById(
|
||||
R.id.attachment_image_view);
|
||||
final AsyncImageView imageView = view.findViewById(R.id.attachment_image_view);
|
||||
int maxWidth = imageView.getMaxWidth();
|
||||
int maxHeight = imageView.getMaxHeight();
|
||||
if (viewType == TYPE_CHOOSER_GRID) {
|
||||
@@ -187,8 +186,7 @@ public class AttachmentPreviewFactory {
|
||||
final ViewGroup parent, final PendingAttachmentData attachmentData) {
|
||||
final View pendingItemView = layoutInflater.inflate(R.layout.attachment_pending_item,
|
||||
parent, false);
|
||||
final ImageView imageView = (ImageView)
|
||||
pendingItemView.findViewById(R.id.pending_item_view);
|
||||
final ImageView imageView = pendingItemView.findViewById(R.id.pending_item_view);
|
||||
final ViewGroup.LayoutParams layoutParams = imageView.getLayoutParams();
|
||||
final int defaultSize = layoutInflater.getContext().getResources().getDimensionPixelSize(
|
||||
R.dimen.pending_attachment_size);
|
||||
@@ -218,8 +216,7 @@ public class AttachmentPreviewFactory {
|
||||
break;
|
||||
}
|
||||
final View view = layoutInflater.inflate(layoutId, parent, false /* attachToRoot */);
|
||||
final PersonItemView vcardPreview = (PersonItemView) view.findViewById(
|
||||
R.id.vcard_attachment_view);
|
||||
final PersonItemView vcardPreview = view.findViewById(R.id.vcard_attachment_view);
|
||||
vcardPreview.setAvatarOnly(viewType != AttachmentPreviewFactory.TYPE_SINGLE);
|
||||
vcardPreview.bind(DataModel.get().createVCardContactItemData(layoutInflater.getContext(),
|
||||
attachmentData));
|
||||
@@ -261,8 +258,7 @@ public class AttachmentPreviewFactory {
|
||||
break;
|
||||
}
|
||||
final View view = layoutInflater.inflate(layoutId, parent, false /* attachToRoot */);
|
||||
final AudioAttachmentView audioView = (AudioAttachmentView)
|
||||
view.findViewById(R.id.audio_attachment_view);
|
||||
final AudioAttachmentView audioView = view.findViewById(R.id.audio_attachment_view);
|
||||
audioView.bindMessagePartData(
|
||||
attachmentData, false /* incoming */, false /* showAsSelected */);
|
||||
return view;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
* Copyright (C) 2025 The LineageOS Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -38,8 +39,8 @@ public class AudioAttachmentPlayPauseButton extends ViewSwitcher {
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
mPlayButton = (ImageView) findViewById(R.id.play_button);
|
||||
mPauseButton = (ImageView) findViewById(R.id.pause_button);
|
||||
mPlayButton = findViewById(R.id.play_button);
|
||||
mPauseButton = findViewById(R.id.pause_button);
|
||||
updateAppearance();
|
||||
}
|
||||
|
||||
|
||||
@@ -104,9 +104,9 @@ public class AudioAttachmentView extends LinearLayout {
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
|
||||
mPlayPauseButton = (AudioAttachmentPlayPauseButton) findViewById(R.id.play_pause_button);
|
||||
mChronometer = (PausableChronometer) findViewById(R.id.timer);
|
||||
mProgressBar = (AudioPlaybackProgressBar) findViewById(R.id.progress);
|
||||
mPlayPauseButton = findViewById(R.id.play_pause_button);
|
||||
mChronometer = findViewById(R.id.timer);
|
||||
mProgressBar = findViewById(R.id.progress);
|
||||
mPlayPauseButton.setOnClickListener(v -> {
|
||||
// Has the MediaPlayer already been prepared?
|
||||
if (mMediaPlayer != null && mPrepared) {
|
||||
@@ -352,12 +352,12 @@ public class AudioAttachmentView extends LinearLayout {
|
||||
mProgressBar.setVisibility(GONE);
|
||||
mChronometer.setVisibility(GONE);
|
||||
((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.Theme theme = getContext().getTheme();
|
||||
playButton.setImageDrawable(
|
||||
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(
|
||||
ResourcesCompat.getDrawable(res, R.drawable.ic_preview_pause, theme));
|
||||
break;
|
||||
|
||||
@@ -42,8 +42,8 @@ public class BlockedParticipantListItemView extends LinearLayout {
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
mNameTextView = (TextView) findViewById(R.id.name);
|
||||
mContactIconView = (ContactIconView) findViewById(R.id.contact_icon);
|
||||
mNameTextView = findViewById(R.id.name);
|
||||
mContactIconView = findViewById(R.id.contact_icon);
|
||||
setOnClickListener(v -> mData.unblock(getContext()));
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ public class BlockedParticipantsFragment extends Fragment
|
||||
final Bundle savedInstanceState) {
|
||||
final View view =
|
||||
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);
|
||||
mListView.setAdapter(mAdapter);
|
||||
mBinding.bind(DataModel.get().createBlockedParticipantsData(getActivity(), this));
|
||||
|
||||
@@ -82,7 +82,8 @@ public class ClassZeroActivity extends Activity {
|
||||
|
||||
private boolean queueMsgFromIntent(final Intent msgIntent) {
|
||||
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.
|
||||
final String message = messageValues.getAsString(Sms.BODY);
|
||||
if (TextUtils.isEmpty(message)) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
* Copyright (C) 2025 The LineageOS Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (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(),
|
||||
null /* root */,
|
||||
false /* attachToRoot */);
|
||||
final ListView listView = (ListView) view.findViewById(getListViewResId());
|
||||
final ListView listView = view.findViewById(getListViewResId());
|
||||
listView.setAdapter(mListAdapter);
|
||||
listView.setOnScrollListener(new OnScrollListener() {
|
||||
@Override
|
||||
@@ -90,11 +91,11 @@ public abstract class CustomHeaderPagerListViewHolder extends BasePagerViewHolde
|
||||
*/
|
||||
private void maybeSetEmptyView() {
|
||||
if (mView != null && mListCursorInitialized) {
|
||||
final ListEmptyView emptyView = (ListEmptyView) mView.findViewById(getEmptyViewResId());
|
||||
final ListEmptyView emptyView = mView.findViewById(getEmptyViewResId());
|
||||
if (emptyView != null) {
|
||||
emptyView.setTextHint(getEmptyViewTitleResId());
|
||||
emptyView.setImageHint(getEmptyViewImageResId());
|
||||
final ListView listView = (ListView) mView.findViewById(getListViewResId());
|
||||
final ListView listView = mView.findViewById(getListViewResId());
|
||||
listView.setEmptyView(emptyView);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,8 +45,8 @@ public class CustomHeaderViewPager extends LinearLayout {
|
||||
inflater.inflate(R.layout.custom_header_view_pager, this, true);
|
||||
setOrientation(LinearLayout.VERTICAL);
|
||||
|
||||
mTabstrip = (ViewPagerTabs) findViewById(R.id.tab_strip);
|
||||
mViewPager = (ViewPager) findViewById(R.id.pager);
|
||||
mTabstrip = findViewById(R.id.tab_strip);
|
||||
mViewPager = findViewById(R.id.pager);
|
||||
|
||||
TypedValue tv = new TypedValue();
|
||||
context.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true);
|
||||
|
||||
@@ -108,7 +108,7 @@ public class FixedViewPagerAdapter<T extends PagerViewHolder> extends PagerAdapt
|
||||
((Bundle) state).setClassLoader(Factory.get().getApplicationContext().getClassLoader());
|
||||
for (int i = 0; i < mViewHolders.length; i++) {
|
||||
final Parcelable pageState = restoredViewHolderState
|
||||
.getParcelable(getInstanceStateKeyForPage(i));
|
||||
.getParcelable(getInstanceStateKeyForPage(i), Parcelable.class);
|
||||
getViewHolder(i).restoreState(pageState);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
* Copyright (C) 2025 The LineageOS Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (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) {
|
||||
super.onCreate(bundle);
|
||||
setContentView(R.layout.license_activity);
|
||||
final WebView webView = (WebView) findViewById(R.id.content);
|
||||
final WebView webView = findViewById(R.id.content);
|
||||
webView.loadUrl(LICENSE_URL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,6 @@ public class LineWrapLayout extends ViewGroup {
|
||||
currLineHeight = 0;
|
||||
x = startPadding;
|
||||
currLineWidth = 0;
|
||||
startMargin = 0;
|
||||
}
|
||||
|
||||
x += childMeasuredWidth;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
* Copyright (C) 2025 The LineageOS Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (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() {
|
||||
super.onFinishInflate();
|
||||
|
||||
mEmptyImageHint = (ImageView) findViewById(R.id.empty_image_hint);
|
||||
mEmptyTextHint = (TextView) findViewById(R.id.empty_text_hint);
|
||||
mEmptyImageHint = findViewById(R.id.empty_image_hint);
|
||||
mEmptyTextHint = findViewById(R.id.empty_text_hint);
|
||||
}
|
||||
|
||||
public void setImageHint(final int resId) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
* Copyright (C) 2025 The LineageOS Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (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.scale(mOrientationParams.scaleX, mOrientationParams.scaleY, mCenterX, mCenterY);
|
||||
canvas.rotate(mOrientationParams.rotation, mCenterX, mCenterY);
|
||||
canvas.drawBitmap(getBitmap(), (Rect) null, mDstRect, getPaint());
|
||||
canvas.drawBitmap(getBitmap(), null, mDstRect, getPaint());
|
||||
canvas.restore();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,10 +58,10 @@ public class PermissionCheckActivity extends Activity {
|
||||
|
||||
findViewById(R.id.exit).setOnClickListener(view -> finish());
|
||||
|
||||
mNextView = (TextView) findViewById(R.id.next);
|
||||
mNextView = findViewById(R.id.next);
|
||||
mNextView.setOnClickListener(view -> tryRequestPermission());
|
||||
|
||||
mSettingsView = (TextView) findViewById(R.id.settings);
|
||||
mSettingsView = findViewById(R.id.settings);
|
||||
mSettingsView.setOnClickListener(view -> {
|
||||
final Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
|
||||
Uri.parse(PACKAGE_URI_PREFIX + getPackageName()));
|
||||
|
||||
@@ -68,9 +68,9 @@ public class PersonItemView extends LinearLayout implements PersonItemDataListen
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
mNameTextView = (TextView) findViewById(R.id.name);
|
||||
mDetailsTextView = (TextView) findViewById(R.id.details);
|
||||
mContactIconView = (ContactIconView) findViewById(R.id.contact_icon);
|
||||
mNameTextView = findViewById(R.id.name);
|
||||
mDetailsTextView = findViewById(R.id.details);
|
||||
mContactIconView = findViewById(R.id.contact_icon);
|
||||
mDetailsContainer = findViewById(R.id.details_container);
|
||||
mNameTextView.addOnLayoutChangeListener(this);
|
||||
}
|
||||
|
||||
@@ -214,9 +214,9 @@ public class SnackBar {
|
||||
mParentView = builder.mParentView;
|
||||
mInteractions = Objects.requireNonNullElseGet(builder.mInteractions, ArrayList::new);
|
||||
|
||||
mActionTextView = (TextView) mRootView.findViewById(R.id.snack_bar_action);
|
||||
mMessageView = (TextView) mRootView.findViewById(R.id.snack_bar_message);
|
||||
mMessageWrapper = (FrameLayout) mRootView.findViewById(R.id.snack_bar_message_wrapper);
|
||||
mActionTextView = mRootView.findViewById(R.id.snack_bar_action);
|
||||
mMessageView = mRootView.findViewById(R.id.snack_bar_message);
|
||||
mMessageWrapper = mRootView.findViewById(R.id.snack_bar_message_wrapper);
|
||||
|
||||
setUpButton();
|
||||
setUpTextLines();
|
||||
|
||||
@@ -47,7 +47,7 @@ public class VCardDetailActivity extends BugleActionBarActivity
|
||||
@NonNull final Fragment fragment) {
|
||||
if (fragment instanceof VCardDetailFragment) {
|
||||
final Uri vCardUri =
|
||||
getIntent().getParcelableExtra(UIIntents.UI_INTENT_EXTRA_VCARD_URI);
|
||||
getIntent().getParcelableExtra(UIIntents.UI_INTENT_EXTRA_VCARD_URI, Uri.class);
|
||||
Assert.notNull(vCardUri);
|
||||
final VCardDetailFragment vCardDetailFragment = (VCardDetailFragment) fragment;
|
||||
vCardDetailFragment.setVCardUri(vCardUri);
|
||||
|
||||
@@ -77,7 +77,7 @@ public class VCardDetailFragment extends Fragment implements PersonItemDataListe
|
||||
final Bundle savedInstanceState) {
|
||||
Assert.notNull(mVCardUri);
|
||||
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,
|
||||
oldBottom) -> {
|
||||
mListView.setIndicatorBounds(mListView.getWidth() - getResources().
|
||||
|
||||
@@ -113,7 +113,7 @@ public class VideoThumbnailView extends FrameLayout {
|
||||
mVideoView = null;
|
||||
}
|
||||
|
||||
mPlayButton = (ImageButton) findViewById(R.id.video_thumbnail_play_button);
|
||||
mPlayButton = findViewById(R.id.video_thumbnail_play_button);
|
||||
if (loop) {
|
||||
mPlayButton.setVisibility(View.GONE);
|
||||
} 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) {
|
||||
mThumbnailImage.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
mThumbnailImage.getLayoutParams().height = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
@@ -268,8 +268,8 @@ public class VideoThumbnailView extends FrameLayout {
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
return;
|
||||
}
|
||||
int desiredWidth = 1;
|
||||
int desiredHeight = 1;
|
||||
int desiredWidth;
|
||||
int desiredHeight;
|
||||
if (mVideoView != null) {
|
||||
mVideoView.measure(widthMeasureSpec, heightMeasureSpec);
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ public class ApplicationSettingsActivity extends BugleActionBarActivity {
|
||||
mSmsEnabledPrefKey = getString(R.string.sms_enabled_pref_key);
|
||||
mSmsEnabledPreference = findPreference(mSmsEnabledPrefKey);
|
||||
|
||||
final PreferenceScreen advancedScreen = (PreferenceScreen) findPreference(
|
||||
final PreferenceScreen advancedScreen = findPreference(
|
||||
getString(R.string.advanced_pref_key));
|
||||
final boolean topLevel = getActivity().getIntent().getBooleanExtra(
|
||||
UIIntents.UI_INTENT_EXTRA_TOP_LEVEL_SETTINGS, false);
|
||||
@@ -134,7 +134,7 @@ public class ApplicationSettingsActivity extends BugleActionBarActivity {
|
||||
|
||||
@Override
|
||||
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.putExtra(Settings.EXTRA_APP_PACKAGE, getContext().getPackageName());
|
||||
startActivity(intent);
|
||||
|
||||
@@ -66,10 +66,8 @@ public class GroupMmsSettingDialog {
|
||||
final LayoutInflater inflater = (LayoutInflater) mContext
|
||||
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
final View rootView = inflater.inflate(R.layout.group_mms_setting_dialog, null, false);
|
||||
final RadioButton disableButton = (RadioButton)
|
||||
rootView.findViewById(R.id.disable_group_mms_button);
|
||||
final RadioButton enableButton = (RadioButton)
|
||||
rootView.findViewById(R.id.enable_group_mms_button);
|
||||
final RadioButton disableButton = rootView.findViewById(R.id.disable_group_mms_button);
|
||||
final RadioButton enableButton = rootView.findViewById(R.id.enable_group_mms_button);
|
||||
disableButton.setOnClickListener(view -> changeGroupMmsSettings(false));
|
||||
enableButton.setOnClickListener(view -> changeGroupMmsSettings(true));
|
||||
final boolean mmsEnabled = BuglePrefs.getSubscriptionPrefs(mSubId).getBoolean(
|
||||
|
||||
@@ -95,10 +95,10 @@ public class PerSubscriptionSettingsActivity extends BugleActionBarActivity {
|
||||
addPreferencesFromResource(R.xml.preferences_per_subscription);
|
||||
|
||||
mPhoneNumberKey = getString(R.string.mms_phone_number_pref_key);
|
||||
mPhoneNumberPreference = (PhoneNumberPreference) findPreference(mPhoneNumberKey);
|
||||
final PreferenceCategory advancedCategory = (PreferenceCategory)
|
||||
mPhoneNumberPreference = findPreference(mPhoneNumberKey);
|
||||
final PreferenceCategory advancedCategory =
|
||||
findPreference(getString(R.string.advanced_category_pref_key));
|
||||
final PreferenceCategory mmsCategory = (PreferenceCategory)
|
||||
final PreferenceCategory mmsCategory =
|
||||
findPreference(getString(R.string.mms_messaging_category_pref_key));
|
||||
|
||||
mPhoneNumberPreference.setDefaultPhoneNumber(
|
||||
|
||||
@@ -98,7 +98,7 @@ public class SettingsActivity extends BugleActionBarActivity {
|
||||
public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
|
||||
final Bundle savedInstanceState) {
|
||||
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());
|
||||
mListView.setAdapter(mAdapter);
|
||||
return view;
|
||||
@@ -144,8 +144,8 @@ public class SettingsActivity extends BugleActionBarActivity {
|
||||
R.layout.settings_item_view, parent, false);
|
||||
}
|
||||
final SettingsItem item = getItem(position);
|
||||
final TextView titleTextView = (TextView) itemView.findViewById(R.id.title);
|
||||
final TextView subtitleTextView = (TextView) itemView.findViewById(R.id.subtitle);
|
||||
final TextView titleTextView = itemView.findViewById(R.id.title);
|
||||
final TextView subtitleTextView = itemView.findViewById(R.id.subtitle);
|
||||
final String summaryText = item.getDisplayDetail();
|
||||
titleTextView.setText(item.getDisplayName());
|
||||
if (!TextUtils.isEmpty(summaryText)) {
|
||||
|
||||
@@ -63,7 +63,7 @@ public class AttachmentChooserFragment extends Fragment implements DraftMessageD
|
||||
public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
|
||||
final Bundle savedInstanceState) {
|
||||
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());
|
||||
mAttachmentGridView.setAdapter(mAdapter);
|
||||
mAttachmentGridView.setHost(this);
|
||||
|
||||
@@ -52,8 +52,8 @@ public class AttachmentGridItemView extends FrameLayout {
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
mAttachmentViewContainer = (FrameLayout) findViewById(R.id.attachment_container);
|
||||
mCheckBox = (CheckBox) findViewById(R.id.checkbox);
|
||||
mAttachmentViewContainer = findViewById(R.id.attachment_container);
|
||||
mCheckBox = findViewById(R.id.checkbox);
|
||||
mCheckBox.setOnClickListener(v -> mHostInterface.onItemCheckedChanged(
|
||||
AttachmentGridItemView.this, mAttachmentData));
|
||||
setOnClickListener(v -> mHostInterface.onItemClicked(AttachmentGridItemView.this,
|
||||
|
||||
@@ -142,8 +142,8 @@ public class AttachmentGridView extends GridView implements
|
||||
final int partCount = in.readInt();
|
||||
unselectedParts = new MessagePartData[partCount];
|
||||
for (int i = 0; i < partCount; i++) {
|
||||
unselectedParts[i] = ((MessagePartData) in.readParcelable(
|
||||
MessagePartData.class.getClassLoader()));
|
||||
unselectedParts[i] = in.readParcelable(MessagePartData.class.getClassLoader(),
|
||||
MessagePartData.class);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -74,9 +74,9 @@ public class AddContactsConfirmationDialog implements DialogInterface.OnClickLis
|
||||
private View createBodyView() {
|
||||
final View view = LayoutInflater.from(mContext).inflate(
|
||||
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);
|
||||
final TextView textView = (TextView) view.findViewById(R.id.participant_name);
|
||||
final TextView textView = view.findViewById(R.id.participant_name);
|
||||
textView.setText(mNormalizedDestination);
|
||||
// Accessibility reason : in case phone numbers are mixed in the display name,
|
||||
// we need to vocalize it for talkback.
|
||||
|
||||
@@ -64,13 +64,13 @@ public class ContactListItemView extends LinearLayout implements OnClickListener
|
||||
@Override
|
||||
protected void onFinishInflate () {
|
||||
super.onFinishInflate();
|
||||
mContactNameTextView = (TextView) findViewById(R.id.contact_name);
|
||||
mContactDetailsTextView = (TextView) findViewById(R.id.contact_details);
|
||||
mContactDetailTypeTextView = (TextView) findViewById(R.id.contact_detail_type);
|
||||
mAlphabetHeaderTextView = (TextView) findViewById(R.id.alphabet_header);
|
||||
mContactIconView = (ContactIconView) findViewById(R.id.contact_icon);
|
||||
mContactCheckmarkView = (ImageView) findViewById(R.id.contact_checkmark);
|
||||
mWorkProfileIcon = (ImageView) findViewById(R.id.work_profile_icon);
|
||||
mContactNameTextView = findViewById(R.id.contact_name);
|
||||
mContactDetailsTextView = findViewById(R.id.contact_details);
|
||||
mContactDetailTypeTextView = findViewById(R.id.contact_detail_type);
|
||||
mAlphabetHeaderTextView = findViewById(R.id.alphabet_header);
|
||||
mContactIconView = findViewById(R.id.contact_icon);
|
||||
mContactCheckmarkView = findViewById(R.id.contact_checkmark);
|
||||
mWorkProfileIcon = findViewById(R.id.work_profile_icon);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -172,7 +172,7 @@ public class ContactPickerFragment extends Fragment implements ContactPickerData
|
||||
mFrequentContactsListViewHolder,
|
||||
mAllContactsListViewHolder };
|
||||
|
||||
mCustomHeaderViewPager = (CustomHeaderViewPager) view.findViewById(R.id.contact_pager);
|
||||
mCustomHeaderViewPager = view.findViewById(R.id.contact_pager);
|
||||
mCustomHeaderViewPager.setViewHolders(viewHolders);
|
||||
mCustomHeaderViewPager.setViewPagerTabHeight(CustomHeaderViewPager.DEFAULT_TAB_STRIP_SIZE);
|
||||
mCustomHeaderViewPager.setBackgroundColor(getResources()
|
||||
@@ -181,7 +181,7 @@ public class ContactPickerFragment extends Fragment implements ContactPickerData
|
||||
// The view pager defaults to the frequent contacts page.
|
||||
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.setNavigationContentDescription(R.string.back);
|
||||
mToolbar.setNavigationOnClickListener(v -> mHost.onBackButtonPressed());
|
||||
|
||||
@@ -195,8 +195,7 @@ public class ComposeMessageView extends LinearLayout
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
mComposeEditText = (PlainTextEditText) findViewById(
|
||||
R.id.compose_message_text);
|
||||
mComposeEditText = findViewById(R.id.compose_message_text);
|
||||
mComposeEditText.setOnEditorActionListener(this);
|
||||
mComposeEditText.addTextChangedListener(this);
|
||||
mComposeEditText.setOnFocusChangeListener((v, hasFocus) -> {
|
||||
@@ -216,7 +215,7 @@ public class ComposeMessageView extends LinearLayout
|
||||
new LengthFilter(MmsConfig.get(ParticipantData.DEFAULT_SELF_SUB_ID)
|
||||
.getMaxTextLimit()) });
|
||||
|
||||
mSelfSendIcon = (SimIconView) findViewById(R.id.self_send_icon);
|
||||
mSelfSendIcon = findViewById(R.id.self_send_icon);
|
||||
mSelfSendIcon.setOnClickListener(v -> {
|
||||
boolean shown = mInputManager.toggleSimSelector(true /* animate */,
|
||||
getSelfSubscriptionListEntry());
|
||||
@@ -233,8 +232,7 @@ public class ComposeMessageView extends LinearLayout
|
||||
return true;
|
||||
});
|
||||
|
||||
mComposeSubjectText = (PlainTextEditText) findViewById(
|
||||
R.id.compose_subject_text);
|
||||
mComposeSubjectText = findViewById(R.id.compose_subject_text);
|
||||
// We need the listener to change the avatar to the send button when the user starts
|
||||
// typing a subject without a message.
|
||||
mComposeSubjectText.addTextChangedListener(this);
|
||||
@@ -244,7 +242,7 @@ public class ComposeMessageView extends LinearLayout
|
||||
new LengthFilter(MmsConfig.get(ParticipantData.DEFAULT_SELF_SUB_ID)
|
||||
.getMaxSubjectLength())});
|
||||
|
||||
mDeleteSubjectButton = (ImageButton) findViewById(R.id.delete_subject_button);
|
||||
mDeleteSubjectButton = findViewById(R.id.delete_subject_button);
|
||||
mDeleteSubjectButton.setOnClickListener(clickView -> {
|
||||
hideSubjectEditor();
|
||||
mComposeSubjectText.setText(null);
|
||||
@@ -253,7 +251,7 @@ public class ComposeMessageView extends LinearLayout
|
||||
|
||||
mSubjectView = findViewById(R.id.subject_view);
|
||||
|
||||
mSendButton = (ImageButton) findViewById(R.id.send_message_button);
|
||||
mSendButton = findViewById(R.id.send_message_button);
|
||||
mSendButton.setOnClickListener(clickView ->
|
||||
sendMessageInternal(true /* checkMessageSize */));
|
||||
mSendButton.setOnLongClickListener(arg0 -> {
|
||||
@@ -284,18 +282,17 @@ public class ComposeMessageView extends LinearLayout
|
||||
}
|
||||
});
|
||||
|
||||
mAttachMediaButton =
|
||||
(ImageButton) findViewById(R.id.attach_media_button);
|
||||
mAttachMediaButton = findViewById(R.id.attach_media_button);
|
||||
mAttachMediaButton.setOnClickListener(clickView -> {
|
||||
// Showing the media picker is treated as starting to compose the message.
|
||||
mInputManager.showHideMediaPicker(true /* show */, true /* animate */);
|
||||
});
|
||||
|
||||
mAttachmentPreview = (AttachmentPreview) findViewById(R.id.attachment_draft_view);
|
||||
mAttachmentPreview = findViewById(R.id.attachment_draft_view);
|
||||
mAttachmentPreview.setComposeMessageView(this);
|
||||
|
||||
mMessageBodySize = (TextView) findViewById(R.id.message_body_size);
|
||||
mMmsIndicator = (TextView) findViewById(R.id.mms_indicator);
|
||||
mMessageBodySize = findViewById(R.id.message_body_size);
|
||||
mMmsIndicator = findViewById(R.id.mms_indicator);
|
||||
}
|
||||
|
||||
private void hideAttachmentsWhenShowingSims(final boolean simPickerVisible) {
|
||||
|
||||
@@ -71,7 +71,8 @@ public class ConversationActivity extends BugleActionBarActivity
|
||||
|
||||
// Do our best to restore UI state from saved instance state.
|
||||
if (savedInstanceState != null) {
|
||||
mUiState = savedInstanceState.getParcelable(SAVED_INSTANCE_STATE_UI_STATE_KEY);
|
||||
mUiState = savedInstanceState.getParcelable(SAVED_INSTANCE_STATE_UI_STATE_KEY,
|
||||
ConversationActivityUiState.class);
|
||||
} else {
|
||||
if (intent.
|
||||
getBooleanExtra(UIIntents.UI_INTENT_EXTRA_GOTO_CONVERSATION_LIST, false)) {
|
||||
@@ -321,7 +322,7 @@ public class ConversationActivity extends BugleActionBarActivity
|
||||
conversationFragment, ConversationFragment.FRAGMENT_TAG);
|
||||
}
|
||||
final MessageData draftData = intent.getParcelableExtra(
|
||||
UIIntents.UI_INTENT_EXTRA_DRAFT_DATA);
|
||||
UIIntents.UI_INTENT_EXTRA_DRAFT_DATA, MessageData.class);
|
||||
if (!needContactPickerFragment) {
|
||||
// Once the user has committed the audience,remove the draft data from the
|
||||
// intent to prevent reuse
|
||||
|
||||
@@ -507,7 +507,7 @@ public class ConversationFragment extends Fragment implements ConversationDataLi
|
||||
public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
|
||||
final Bundle savedInstanceState) {
|
||||
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());
|
||||
manager.setStackFromEnd(true);
|
||||
manager.setReverseLayout(false);
|
||||
@@ -529,16 +529,14 @@ public class ConversationFragment extends Fragment implements ConversationDataLi
|
||||
!data.getIsIncoming() &&
|
||||
timeSinceSend < MESSAGE_ANIMATION_MAX_WAIT) {
|
||||
final ConversationMessageBubbleView messageBubble =
|
||||
(ConversationMessageBubbleView) view
|
||||
.findViewById(R.id.message_content);
|
||||
view.findViewById(R.id.message_content);
|
||||
final Rect startRect = UiUtils.getMeasuredBoundsOnScreen(mComposeMessageView);
|
||||
final View composeBubbleView = mComposeMessageView.findViewById(
|
||||
R.id.compose_message_text);
|
||||
final Rect composeBubbleRect =
|
||||
UiUtils.getMeasuredBoundsOnScreen(composeBubbleView);
|
||||
final AttachmentPreview attachmentView =
|
||||
(AttachmentPreview) mComposeMessageView.findViewById(
|
||||
R.id.attachment_draft_view);
|
||||
mComposeMessageView.findViewById(R.id.attachment_draft_view);
|
||||
final Rect attachmentRect = UiUtils.getMeasuredBoundsOnScreen(attachmentView);
|
||||
if (attachmentView.getVisibility() == View.VISIBLE) {
|
||||
startRect.top = attachmentRect.top;
|
||||
@@ -594,7 +592,8 @@ public class ConversationFragment extends Fragment implements ConversationDataLi
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
|
||||
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);
|
||||
@@ -604,8 +603,7 @@ public class ConversationFragment extends Fragment implements ConversationDataLi
|
||||
UiUtils.isRtlMode() ? ConversationFastScroller.POSITION_LEFT_SIDE :
|
||||
ConversationFastScroller.POSITION_RIGHT_SIDE);
|
||||
|
||||
mComposeMessageView = (ComposeMessageView)
|
||||
view.findViewById(R.id.message_compose_view_container);
|
||||
mComposeMessageView = view.findViewById(R.id.message_compose_view_container);
|
||||
// Bind the compose message view to the DraftMessageData
|
||||
mComposeMessageView.bind(DataModel.get().createDraftMessageData(
|
||||
mBinding.getData().getConversationId()), this);
|
||||
@@ -1436,7 +1434,7 @@ public class ConversationFragment extends Fragment implements ConversationDataLi
|
||||
|
||||
@Override
|
||||
public SimSelectorView getSimSelectorView() {
|
||||
return (SimSelectorView) getView().findViewById(R.id.sim_selector);
|
||||
return getView().findViewById(R.id.sim_selector);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1516,8 +1514,7 @@ public class ConversationFragment extends Fragment implements ConversationDataLi
|
||||
actionBar.setCustomView(customView);
|
||||
}
|
||||
|
||||
final TextView conversationNameView =
|
||||
(TextView) customView.findViewById(R.id.conversation_title);
|
||||
final TextView conversationNameView = customView.findViewById(R.id.conversation_title);
|
||||
final String conversationName = getConversationName();
|
||||
if (!TextUtils.isEmpty(conversationName)) {
|
||||
// RTL : To format conversation title if it happens to be phone numbers.
|
||||
|
||||
@@ -54,7 +54,7 @@ public class ConversationMessageBubbleView extends LinearLayout {
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
mBubbleBackground = (ViewGroup) findViewById(R.id.message_text_and_info);
|
||||
mBubbleBackground = findViewById(R.id.message_text_and_info);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -124,37 +124,37 @@ public class ConversationMessageView extends FrameLayout implements View.OnClick
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
mContactIconView = (ContactIconView) findViewById(R.id.conversation_icon);
|
||||
mContactIconView = findViewById(R.id.conversation_icon);
|
||||
mContactIconView.setOnLongClickListener(view -> {
|
||||
ConversationMessageView.this.performLongClick();
|
||||
return true;
|
||||
});
|
||||
|
||||
mMessageAttachmentsView = (LinearLayout) findViewById(R.id.message_attachments);
|
||||
mMultiAttachmentView = (MultiAttachmentLayout) findViewById(R.id.multiple_attachments);
|
||||
mMessageAttachmentsView = findViewById(R.id.message_attachments);
|
||||
mMultiAttachmentView = findViewById(R.id.multiple_attachments);
|
||||
mMultiAttachmentView.setOnAttachmentClickListener(this);
|
||||
|
||||
mMessageImageView = (AsyncImageView) findViewById(R.id.message_image);
|
||||
mMessageImageView = findViewById(R.id.message_image);
|
||||
mMessageImageView.setOnClickListener(this);
|
||||
mMessageImageView.setOnLongClickListener(this);
|
||||
|
||||
mMessageTextView = (TextView) findViewById(R.id.message_text);
|
||||
mMessageTextView = findViewById(R.id.message_text);
|
||||
mMessageTextView.setOnClickListener(this);
|
||||
IgnoreLinkLongClickHelper.ignoreLinkLongClick(mMessageTextView, this);
|
||||
|
||||
mStatusTextView = (TextView) findViewById(R.id.message_status);
|
||||
mTitleTextView = (TextView) findViewById(R.id.message_title);
|
||||
mMmsInfoTextView = (TextView) findViewById(R.id.mms_info);
|
||||
mMessageTitleLayout = (LinearLayout) findViewById(R.id.message_title_layout);
|
||||
mSenderNameTextView = (TextView) findViewById(R.id.message_sender_name);
|
||||
mMessageBubble = (ConversationMessageBubbleView) findViewById(R.id.message_content);
|
||||
mStatusTextView = findViewById(R.id.message_status);
|
||||
mTitleTextView = findViewById(R.id.message_title);
|
||||
mMmsInfoTextView = findViewById(R.id.mms_info);
|
||||
mMessageTitleLayout = findViewById(R.id.message_title_layout);
|
||||
mSenderNameTextView = findViewById(R.id.message_sender_name);
|
||||
mMessageBubble = findViewById(R.id.message_content);
|
||||
mSubjectView = findViewById(R.id.subject_container);
|
||||
mSubjectLabel = (TextView) mSubjectView.findViewById(R.id.subject_label);
|
||||
mSubjectText = (TextView) mSubjectView.findViewById(R.id.subject_text);
|
||||
mSubjectLabel = mSubjectView.findViewById(R.id.subject_label);
|
||||
mSubjectText = mSubjectView.findViewById(R.id.subject_text);
|
||||
mDeliveredBadge = findViewById(R.id.smsDeliveredBadge);
|
||||
mMessageMetadataView = (ViewGroup) findViewById(R.id.message_metadata);
|
||||
mMessageTextAndInfoView = (ViewGroup) findViewById(R.id.message_text_and_info);
|
||||
mSimNameView = (TextView) findViewById(R.id.sim_name);
|
||||
mMessageMetadataView = findViewById(R.id.message_metadata);
|
||||
mMessageTextAndInfoView = findViewById(R.id.message_text_and_info);
|
||||
mSimNameView = findViewById(R.id.sim_name);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -882,8 +882,8 @@ public class ConversationMessageView extends FrameLayout implements View.OnClick
|
||||
|
||||
private void updateTextAppearance() {
|
||||
int messageColorResId;
|
||||
int statusColorResId = -1;
|
||||
int infoColorResId = -1;
|
||||
int statusColorResId;
|
||||
int infoColorResId;
|
||||
int timestampColorResId;
|
||||
int subjectLabelColorResId;
|
||||
if (isSelected()) {
|
||||
|
||||
@@ -57,7 +57,7 @@ public class MessageDetailsDialog {
|
||||
private static String getMessageDetails(final Context context,
|
||||
final ConversationMessageData data,
|
||||
final ConversationParticipantsData participants, final ParticipantData self) {
|
||||
String messageDetails = null;
|
||||
String messageDetails;
|
||||
if (data.getIsSms()) {
|
||||
messageDetails = getSmsMessageDetails(data, participants, self);
|
||||
} else {
|
||||
|
||||
@@ -47,9 +47,9 @@ public class SimSelectorItemView extends LinearLayout {
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
mNameTextView = (TextView) findViewById(R.id.name);
|
||||
mDetailsTextView = (TextView) findViewById(R.id.details);
|
||||
mSimIconView = (SimIconView) findViewById(R.id.sim_icon);
|
||||
mNameTextView = findViewById(R.id.name);
|
||||
mDetailsTextView = findViewById(R.id.details);
|
||||
mSimIconView = findViewById(R.id.sim_icon);
|
||||
setOnClickListener(v -> mHost.onSimItemClicked(mData));
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ public class SimSelectorView extends FrameLayout implements SimSelectorItemView.
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
mSimListView = (ListView) findViewById(R.id.sim_list);
|
||||
mSimListView = findViewById(R.id.sim_list);
|
||||
mSimListView.setAdapter(mAdapter);
|
||||
|
||||
// Clicking anywhere outside the switcher list should dismiss.
|
||||
|
||||
@@ -171,8 +171,8 @@ public class ConversationListFragment extends Fragment implements ConversationLi
|
||||
final Bundle savedInstanceState) {
|
||||
final ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.conversation_list_fragment,
|
||||
container, false);
|
||||
mRecyclerView = (RecyclerView) rootView.findViewById(android.R.id.list);
|
||||
mEmptyListMessageView = (ListEmptyView) rootView.findViewById(R.id.no_conversations_view);
|
||||
mRecyclerView = rootView.findViewById(android.R.id.list);
|
||||
mEmptyListMessageView = rootView.findViewById(R.id.no_conversations_view);
|
||||
mEmptyListMessageView.setImageHint(R.drawable.ic_oobe_conv_list);
|
||||
// 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
|
||||
@@ -189,7 +189,7 @@ public class ConversationListFragment extends Fragment implements ConversationLi
|
||||
mRecyclerView.setLayoutManager(manager);
|
||||
mRecyclerView.setHasFixedSize(true);
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
mRecyclerView.setOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
int mCurrentState = AbsListView.OnScrollListener.SCROLL_STATE_IDLE;
|
||||
|
||||
@Override
|
||||
@@ -216,11 +216,11 @@ public class ConversationListFragment extends Fragment implements ConversationLi
|
||||
mRecyclerView.addOnItemTouchListener(new ConversationListSwipeHelper(mRecyclerView));
|
||||
|
||||
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(
|
||||
R.id.start_new_conversation_button);
|
||||
mStartNewConversationButton = rootView.findViewById(R.id.start_new_conversation_button);
|
||||
if (mArchiveMode || mForwardMessageMode) {
|
||||
mStartNewConversationButton.setVisibility(View.GONE);
|
||||
} else {
|
||||
|
||||
@@ -145,22 +145,21 @@ public class ConversationListItemView extends FrameLayout implements OnClickList
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
mSwipeableContainer = (ViewGroup) findViewById(R.id.swipeableContainer);
|
||||
mCrossSwipeBackground = (ViewGroup) findViewById(R.id.crossSwipeBackground);
|
||||
mSwipeableContent = (ViewGroup) findViewById(R.id.swipeableContent);
|
||||
mConversationNameView = (TextView) findViewById(R.id.conversation_name);
|
||||
mSnippetTextView = (TextView) findViewById(R.id.conversation_snippet);
|
||||
mSubjectTextView = (TextView) findViewById(R.id.conversation_subject);
|
||||
mWorkProfileIconView = (ImageView) findViewById(R.id.work_profile_icon);
|
||||
mTimestampTextView = (TextView) findViewById(R.id.conversation_timestamp);
|
||||
mContactIconView = (ContactIconView) findViewById(R.id.conversation_icon);
|
||||
mContactCheckmarkView = (ImageView) findViewById(R.id.conversation_checkmark);
|
||||
mFailedStatusIconView = (ImageView) findViewById(R.id.conversation_failed_status_icon);
|
||||
mCrossSwipeArchiveLeftImageView = (ImageView) findViewById(R.id.crossSwipeArchiveIconLeft);
|
||||
mCrossSwipeArchiveRightImageView =
|
||||
(ImageView) findViewById(R.id.crossSwipeArchiveIconRight);
|
||||
mImagePreviewView = (AsyncImageView) findViewById(R.id.conversation_image_preview);
|
||||
mAudioAttachmentView = (AudioAttachmentView) findViewById(R.id.audio_attachment_view);
|
||||
mSwipeableContainer = findViewById(R.id.swipeableContainer);
|
||||
mCrossSwipeBackground = findViewById(R.id.crossSwipeBackground);
|
||||
mSwipeableContent = findViewById(R.id.swipeableContent);
|
||||
mConversationNameView = findViewById(R.id.conversation_name);
|
||||
mSnippetTextView = findViewById(R.id.conversation_snippet);
|
||||
mSubjectTextView = findViewById(R.id.conversation_subject);
|
||||
mWorkProfileIconView = findViewById(R.id.work_profile_icon);
|
||||
mTimestampTextView = findViewById(R.id.conversation_timestamp);
|
||||
mContactIconView = findViewById(R.id.conversation_icon);
|
||||
mContactCheckmarkView = findViewById(R.id.conversation_checkmark);
|
||||
mFailedStatusIconView = findViewById(R.id.conversation_failed_status_icon);
|
||||
mCrossSwipeArchiveLeftImageView = findViewById(R.id.crossSwipeArchiveIconLeft);
|
||||
mCrossSwipeArchiveRightImageView = findViewById(R.id.crossSwipeArchiveIconRight);
|
||||
mImagePreviewView = findViewById(R.id.conversation_image_preview);
|
||||
mAudioAttachmentView = findViewById(R.id.audio_attachment_view);
|
||||
mConversationNameView.addOnLayoutChangeListener(this);
|
||||
mSnippetTextView.addOnLayoutChangeListener(this);
|
||||
|
||||
|
||||
@@ -46,7 +46,8 @@ public class ForwardMessageActivity extends BaseBugleActivity
|
||||
final ConversationListFragment fragment =
|
||||
ConversationListFragment.createForwardMessageConversationListFragment();
|
||||
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
|
||||
|
||||
@@ -94,7 +94,7 @@ public class ShareIntentActivity extends BaseBugleActivity implements
|
||||
}
|
||||
|
||||
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)) {
|
||||
LogUtil.i(
|
||||
LogUtil.BUGLE_TAG,
|
||||
@@ -134,7 +134,8 @@ public class ShareIntentActivity extends BaseBugleActivity implements
|
||||
} else if (Intent.ACTION_SEND_MULTIPLE.equals(action)) {
|
||||
final String contentType = intent.getType();
|
||||
// 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()) {
|
||||
ArrayMap<Uri, String> uriMap = new ArrayMap<>();
|
||||
StringBuffer strBuffer = new StringBuffer();
|
||||
|
||||
@@ -71,7 +71,7 @@ public class ShareIntentFragment extends DialogFragment implements ConversationL
|
||||
final Activity activity = getActivity();
|
||||
final LayoutInflater inflater = activity.getLayoutInflater();
|
||||
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);
|
||||
// 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
|
||||
@@ -86,7 +86,7 @@ public class ShareIntentFragment extends DialogFragment implements ConversationL
|
||||
};
|
||||
mListBinding.getData().init(LoaderManager.getInstance(this), mListBinding);
|
||||
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.setHasFixedSize(true);
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
|
||||
@@ -78,7 +78,7 @@ public class PeopleAndOptionsFragment extends Fragment
|
||||
public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
|
||||
final Bundle savedInstanceState) {
|
||||
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());
|
||||
mOptionsListAdapter = new OptionsListAdapter();
|
||||
final CompositeAdapter compositeAdapter = new CompositeAdapter(getActivity());
|
||||
@@ -297,14 +297,14 @@ public class PeopleAndOptionsFragment extends Fragment
|
||||
|
||||
@Override
|
||||
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) {
|
||||
view = convertView;
|
||||
} else {
|
||||
view = LayoutInflater.from(getActivity()).inflate(
|
||||
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);
|
||||
text.setText(mHeaderResId);
|
||||
divider.setVisibility(mNeedDivider ? View.VISIBLE : View.GONE);
|
||||
|
||||
@@ -55,7 +55,7 @@ public class PeopleOptionsItemView extends LinearLayout {
|
||||
@Override
|
||||
protected void onFinishInflate () {
|
||||
super.onFinishInflate();
|
||||
mTitle = (TextView) findViewById(R.id.title);
|
||||
mTitle = findViewById(R.id.title);
|
||||
setOnClickListener(v -> mHostInterface.onOptionsItemViewClicked(mData));
|
||||
}
|
||||
|
||||
|
||||
@@ -114,11 +114,11 @@ public class AudioRecordView extends FrameLayout implements
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
mSoundLevels = (SoundLevels) findViewById(R.id.sound_levels);
|
||||
mRecordButtonVisual = (ImageView) findViewById(R.id.record_button_visual);
|
||||
mSoundLevels = findViewById(R.id.sound_levels);
|
||||
mRecordButtonVisual = findViewById(R.id.record_button_visual);
|
||||
mRecordButton = findViewById(R.id.record_button);
|
||||
mHintTextView = (TextView) findViewById(R.id.hint_text);
|
||||
mTimerTextView = (PausableChronometer) findViewById(R.id.timer_text);
|
||||
mHintTextView = findViewById(R.id.hint_text);
|
||||
mTimerTextView = findViewById(R.id.timer_text);
|
||||
mSoundLevels.setLevelSource(mMediaRecorder.getLevelSource());
|
||||
mRecordButton.setOnTouchListener((v, event) -> {
|
||||
final int action = event.getActionMasked();
|
||||
|
||||
@@ -210,7 +210,7 @@ public class MediaPicker extends Fragment implements DraftMessageSubscriptionDat
|
||||
container,
|
||||
false);
|
||||
mMediaPickerPanel.setMediaPicker(this);
|
||||
mTabStrip = (LinearLayout) mMediaPickerPanel.findViewById(R.id.mediapicker_tabstrip);
|
||||
mTabStrip = mMediaPickerPanel.findViewById(R.id.mediapicker_tabstrip);
|
||||
mTabStrip.setBackgroundColor(mThemeColor);
|
||||
for (final MediaChooser chooser : mChoosers) {
|
||||
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.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||
mViewPager = mMediaPickerPanel.findViewById(R.id.mediapicker_view_pager);
|
||||
mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||
@Override
|
||||
public void onPageScrolled(
|
||||
final int position,
|
||||
|
||||
@@ -96,8 +96,8 @@ public class MediaPickerPanel extends ViewGroup {
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
mTabStrip = (LinearLayout) findViewById(R.id.mediapicker_tabstrip);
|
||||
mViewPager = (PagingAwareViewPager) findViewById(R.id.mediapicker_view_pager);
|
||||
mTabStrip = findViewById(R.id.mediapicker_tabstrip);
|
||||
mViewPager = findViewById(R.id.mediapicker_view_pager);
|
||||
mTouchHandler = new TouchHandler();
|
||||
setOnTouchListener(mTouchHandler);
|
||||
mViewPager.setOnTouchListener(mTouchHandler);
|
||||
|
||||
Reference in New Issue
Block a user