mirror of
https://github.com/moparisthebest/k-9
synced 2025-02-17 07:30:16 -05:00
Fixed warnings about unchecked casts by extracting the code to methods and using the @SuppressWarnings annotation on them.
This commit is contained in:
parent
d48ec4892a
commit
365b106753
@ -376,13 +376,19 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
|||||||
mSelectedContextAccount = Preferences.getPreferences(this).getAccount(accountUuid);
|
mSelectedContextAccount = Preferences.getPreferences(this).getAccount(accountUuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (icicle != null)
|
restoreAccountStats(icicle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
private void restoreAccountStats(Bundle icicle)
|
||||||
|
{
|
||||||
|
if (icicle != null)
|
||||||
|
{
|
||||||
|
Map<String, AccountStats> oldStats = (Map<String, AccountStats>)icicle.get(ACCOUNT_STATS);
|
||||||
|
if (oldStats != null)
|
||||||
{
|
{
|
||||||
Map<String, AccountStats> oldStats = (Map<String, AccountStats>)icicle.get(ACCOUNT_STATS);
|
accountStats.putAll(oldStats);
|
||||||
if (oldStats != null)
|
|
||||||
{
|
|
||||||
accountStats.putAll(oldStats);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -348,14 +348,7 @@ public class FolderList extends K9ListActivity
|
|||||||
private void initializeActivityView()
|
private void initializeActivityView()
|
||||||
{
|
{
|
||||||
mAdapter = new FolderListAdapter();
|
mAdapter = new FolderListAdapter();
|
||||||
|
restorePreviousData();
|
||||||
final Object previousData = getLastNonConfigurationInstance();
|
|
||||||
|
|
||||||
if (previousData != null)
|
|
||||||
{
|
|
||||||
//noinspection unchecked
|
|
||||||
mAdapter.mFolders = (ArrayList<FolderInfoHolder>) previousData;
|
|
||||||
}
|
|
||||||
|
|
||||||
setListAdapter(mAdapter);
|
setListAdapter(mAdapter);
|
||||||
|
|
||||||
@ -363,6 +356,17 @@ public class FolderList extends K9ListActivity
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
private void restorePreviousData()
|
||||||
|
{
|
||||||
|
final Object previousData = getLastNonConfigurationInstance();
|
||||||
|
|
||||||
|
if (previousData != null)
|
||||||
|
{
|
||||||
|
mAdapter.mFolders = (ArrayList<FolderInfoHolder>) previousData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override public Object onRetainNonConfigurationInstance()
|
@Override public Object onRetainNonConfigurationInstance()
|
||||||
{
|
{
|
||||||
|
@ -739,13 +739,7 @@ public class MessageList
|
|||||||
}
|
}
|
||||||
|
|
||||||
mAdapter = new MessageListAdapter();
|
mAdapter = new MessageListAdapter();
|
||||||
final Object previousData = getLastNonConfigurationInstance();
|
restorePreviousData();
|
||||||
|
|
||||||
if (previousData != null)
|
|
||||||
{
|
|
||||||
//noinspection unchecked
|
|
||||||
mAdapter.messages.addAll((List<MessageInfoHolder>) previousData);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mFolderName != null)
|
if (mFolderName != null)
|
||||||
{
|
{
|
||||||
@ -756,6 +750,17 @@ public class MessageList
|
|||||||
mListView.setAdapter(mAdapter);
|
mListView.setAdapter(mAdapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
private void restorePreviousData()
|
||||||
|
{
|
||||||
|
final Object previousData = getLastNonConfigurationInstance();
|
||||||
|
|
||||||
|
if (previousData != null)
|
||||||
|
{
|
||||||
|
mAdapter.messages.addAll((List<MessageInfoHolder>) previousData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPause()
|
public void onPause()
|
||||||
{
|
{
|
||||||
|
@ -493,8 +493,7 @@ public class MessageView extends K9Activity implements OnClickListener
|
|||||||
Uri uri = intent.getData();
|
Uri uri = intent.getData();
|
||||||
if (icicle != null)
|
if (icicle != null)
|
||||||
{
|
{
|
||||||
mMessageReference = (MessageReference) icicle.getSerializable(EXTRA_MESSAGE_REFERENCE);
|
restoreMessageReferences(icicle);
|
||||||
mMessageReferences = (ArrayList<MessageReference>) icicle.getSerializable(EXTRA_MESSAGE_REFERENCES);
|
|
||||||
mPgpData = (PgpData) icicle.getSerializable(STATE_PGP_DATA);
|
mPgpData = (PgpData) icicle.getSerializable(STATE_PGP_DATA);
|
||||||
updateDecryptLayout();
|
updateDecryptLayout();
|
||||||
}
|
}
|
||||||
@ -502,8 +501,7 @@ public class MessageView extends K9Activity implements OnClickListener
|
|||||||
{
|
{
|
||||||
if (uri == null)
|
if (uri == null)
|
||||||
{
|
{
|
||||||
mMessageReference = (MessageReference) intent.getSerializableExtra(EXTRA_MESSAGE_REFERENCE);
|
restoreMessageReferences(icicle);
|
||||||
mMessageReferences = (ArrayList<MessageReference>) intent.getSerializableExtra(EXTRA_MESSAGE_REFERENCES);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -558,6 +556,13 @@ public class MessageView extends K9Activity implements OnClickListener
|
|||||||
displayMessage(mMessageReference);
|
displayMessage(mMessageReference);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
private void restoreMessageReferences(Bundle icicle)
|
||||||
|
{
|
||||||
|
mMessageReference = (MessageReference) icicle.getSerializable(EXTRA_MESSAGE_REFERENCE);
|
||||||
|
mMessageReferences = (ArrayList<MessageReference>) icicle.getSerializable(EXTRA_MESSAGE_REFERENCES);
|
||||||
|
}
|
||||||
|
|
||||||
private void setupButtonViews()
|
private void setupButtonViews()
|
||||||
{
|
{
|
||||||
setOnClickListener(R.id.from);
|
setOnClickListener(R.id.from);
|
||||||
|
Loading…
Reference in New Issue
Block a user