Merge pull request #1091 from k9mail/fix_lint_warnings

Fix/ignore some lint warnings
This commit is contained in:
cketti 2016-02-16 22:50:13 +01:00
commit c7e3e8bf32
11 changed files with 39 additions and 30 deletions

View file

@ -2,6 +2,7 @@
<lint>
<issue id="MissingTranslation" severity="ignore" />
<issue id="OldTargetApi" severity="ignore" />
<issue id="GoogleAppIndexingWarning" severity="ignore" />
<!-- Transifex and Lint disagree on what quantities are necessary -->
<issue id="UnusedQuantity" severity="warning">

View file

@ -829,8 +829,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
mDialog = builder.create();
// Use the dialog's layout inflater so its theme is used (and not the activity's theme).
View layout = mDialog.getLayoutInflater().inflate(
R.layout.accounts_password_prompt, null);
View layout = mDialog.getLayoutInflater().inflate(R.layout.accounts_password_prompt, scrollView);
// Set the intro text that tells the user what to do
TextView intro = (TextView) layout.findViewById(R.id.password_prompt_intro);
@ -890,9 +889,6 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
layout.findViewById(R.id.outgoing_server_prompt).setVisibility(View.GONE);
}
// Add the layout to the ScrollView
scrollView.addView(layout);
// Show the dialog
mDialog.show();

View file

@ -1,6 +1,8 @@
package com.fsck.k9.activity;
import com.fsck.k9.R;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.content.*;
import android.view.LayoutInflater;
@ -35,6 +37,7 @@ public class ColorPickerDialog extends AlertDialog {
super(context);
mColorChangedListener = listener;
@SuppressLint("InflateParams")
View view = LayoutInflater.from(context).inflate(R.layout.color_picker_dialog, null);
mColorPicker = (ColorPicker) view.findViewById(R.id.color_picker);

View file

@ -6,6 +6,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import android.annotation.SuppressLint;
import android.app.ActionBar;
import android.content.Context;
import android.content.Intent;
@ -256,7 +257,7 @@ public class FolderList extends K9ListActivity {
return;
}
mActionBarProgressView = getLayoutInflater().inflate(R.layout.actionbar_indeterminate_progress_actionview, null);
mActionBarProgressView = getActionBarProgressView();
mActionBar = getActionBar();
initializeActionBar();
setContentView(R.layout.folder_list);
@ -294,6 +295,11 @@ public class FolderList extends K9ListActivity {
}
}
@SuppressLint("InflateParams")
private View getActionBarProgressView() {
return getLayoutInflater().inflate(R.layout.actionbar_indeterminate_progress_actionview, null);
}
private void initializeActionBar() {
mActionBar.setDisplayShowCustomEnabled(true);
mActionBar.setCustomView(R.layout.actionbar_custom);

View file

@ -3,6 +3,7 @@ package com.fsck.k9.activity;
import java.util.Collection;
import java.util.List;
import android.annotation.SuppressLint;
import android.app.ActionBar;
import android.app.SearchManager;
import android.content.Context;
@ -17,6 +18,7 @@ import android.app.FragmentManager.OnBackStackChangedListener;
import android.app.FragmentTransaction;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
@ -341,7 +343,9 @@ public class MessageList extends K9Activity implements MessageListFragmentListen
private void initializeLayout() {
mMessageViewContainer = (ViewGroup) findViewById(R.id.message_view_container);
mMessageViewPlaceHolder = getLayoutInflater().inflate(R.layout.empty_message_view, null);
LayoutInflater layoutInflater = getLayoutInflater();
mMessageViewPlaceHolder = layoutInflater.inflate(R.layout.empty_message_view, mMessageViewContainer, false);
}
private void displayViews() {
@ -532,12 +536,16 @@ public class MessageList extends K9Activity implements MessageListFragmentListen
mActionBarSubTitle = (TextView) customView.findViewById(R.id.actionbar_title_sub);
mActionBarUnread = (TextView) customView.findViewById(R.id.actionbar_unread_count);
mActionBarProgress = (ProgressBar) customView.findViewById(R.id.actionbar_progress);
mActionButtonIndeterminateProgress =
getLayoutInflater().inflate(R.layout.actionbar_indeterminate_progress_actionview, null);
mActionButtonIndeterminateProgress = getActionButtonIndeterminateProgress();
mActionBar.setDisplayHomeAsUpEnabled(true);
}
@SuppressLint("InflateParams")
private View getActionButtonIndeterminateProgress() {
return getLayoutInflater().inflate(R.layout.actionbar_indeterminate_progress_actionview, null);
}
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
boolean ret = false;

View file

@ -14,6 +14,7 @@ import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.Future;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.DialogFragment;
import android.app.Fragment;
@ -1120,7 +1121,7 @@ public class MessageListFragment extends Fragment implements OnItemClickListener
private void initializePullToRefresh(LayoutInflater inflater, View layout) {
mPullToRefreshView = (PullToRefreshListView) layout.findViewById(R.id.message_list);
// Set empty view
@SuppressLint("InflateParams")
View loadingView = inflater.inflate(R.layout.message_list_loading, null);
mPullToRefreshView.setEmptyView(loadingView);
@ -1838,7 +1839,6 @@ public class MessageListFragment extends Fragment implements OnItemClickListener
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
View view = mInflater.inflate(R.layout.message_list_item, parent, false);
view.setId(R.layout.message_list_item);
MessageViewHolder holder = new MessageViewHolder();
holder.date = (TextView) view.findViewById(R.id.date);
@ -2151,7 +2151,6 @@ public class MessageListFragment extends Fragment implements OnItemClickListener
private View getFooterView(ViewGroup parent) {
if (mFooterView == null) {
mFooterView = mInflater.inflate(R.layout.message_list_item_footer, parent, false);
mFooterView.setId(R.layout.message_list_item_footer);
FooterViewHolder holder = new FooterViewHolder();
holder.main = (TextView) mFooterView.findViewById(R.id.main_text);
mFooterView.setTag(holder);

View file

@ -47,7 +47,7 @@ public class AttachmentController {
AttachmentController(MessagingController controller, DownloadManager downloadManager,
MessageViewFragment messageViewFragment, AttachmentViewInfo attachment) {
this.context = messageViewFragment.getContext();
this.context = messageViewFragment.getApplicationContext();
this.controller = controller;
this.downloadManager = downloadManager;
this.messageViewFragment = messageViewFragment;

View file

@ -20,6 +20,7 @@ import android.view.MenuItem.OnMenuItemClickListener;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnCreateContextMenuListener;
import android.view.ViewGroup;
import android.view.ViewStub;
import android.webkit.WebView;
import android.webkit.WebView.HitTestResult;
@ -79,6 +80,8 @@ public class MessageContainerView extends LinearLayout implements OnClickListene
@Override
public void onFinishInflate() {
super.onFinishInflate();
mSidebar = findViewById(R.id.message_sidebar);
mMessageContentView = (MessageWebView) findViewById(R.id.message_content);
@ -492,28 +495,16 @@ public class MessageContainerView extends LinearLayout implements OnClickListene
public void renderAttachments(MessageViewContainer messageContainer) throws MessagingException {
for (AttachmentViewInfo attachment : messageContainer.attachments) {
AttachmentView view = (AttachmentView) mInflater.inflate(R.layout.message_view_attachment, null);
ViewGroup parent = attachment.firstClassAttachment ? mAttachments : mHiddenAttachments;
AttachmentView view = (AttachmentView) mInflater.inflate(R.layout.message_view_attachment, parent, false);
view.setCallback(attachmentCallback);
view.setAttachment(attachment);
attachments.put(attachment, view);
if (attachment.firstClassAttachment) {
addAttachment(view);
} else {
addHiddenAttachment(view);
}
parent.addView(view);
}
}
public void addAttachment(View attachmentView) {
mAttachments.addView(attachmentView);
}
public void addHiddenAttachment(View attachmentView) {
mHiddenAttachments.addView(attachmentView);
}
public void zoom(KeyEvent event) {
if (event.isShiftPressed()) {
mMessageContentView.zoomIn();

View file

@ -43,6 +43,8 @@ public class MessageTopView extends LinearLayout implements ShowPicturesControll
@Override
public void onFinishInflate() {
super.onFinishInflate();
mHeaderContainer = (MessageHeader) findViewById(R.id.header_container);
// mHeaderContainer.setOnLayoutChangedListener(this);
mInflater = LayoutInflater.from(getContext());
@ -89,7 +91,8 @@ public class MessageTopView extends LinearLayout implements ShowPicturesControll
shouldAutomaticallyLoadPictures(showPicturesSetting, messageViewInfo.message);
for (MessageViewContainer container : messageViewInfo.containers) {
MessageContainerView view = (MessageContainerView) mInflater.inflate(R.layout.message_container, null);
MessageContainerView view = (MessageContainerView) mInflater.inflate(R.layout.message_container,
containerViews, false);
boolean displayPgpHeader = account.isOpenPgpProviderConfigured();
view.displayMessageViewContainer(container, automaticallyLoadPictures, this, attachmentCallback,
openPgpHeaderViewCallback, displayPgpHeader);

View file

@ -656,7 +656,7 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF
}
}
public Context getContext() {
public Context getApplicationContext() {
return mContext;
}

View file

@ -89,6 +89,8 @@ public class MessageHeader extends LinearLayout implements OnClickListener {
@Override
protected void onFinishInflate() {
super.onFinishInflate();
mAnsweredIcon = findViewById(R.id.answered);
mForwardedIcon = findViewById(R.id.forwarded);
mFromView = (TextView) findViewById(R.id.from);