forked from upstream-mirrors/quik
Remember scroll position of conversation list on rotate
This commit is contained in:
@@ -59,23 +59,27 @@ import com.nispok.snackbar.listeners.ActionClickListener;
|
|||||||
import java.net.URLDecoder;
|
import java.net.URLDecoder;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListener,
|
public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListener, SlidingMenu.OnCloseListener,
|
||||||
SlidingMenu.OnCloseListener, SlidingMenu.OnOpenedListener, SlidingMenu.OnClosedListener,
|
SlidingMenu.OnOpenedListener, SlidingMenu.OnClosedListener, ActionClickListener {
|
||||||
ActionClickListener {
|
|
||||||
|
|
||||||
private final String TAG = "MainActivity";
|
private final String TAG = "MainActivity";
|
||||||
|
|
||||||
public final static String EXTRA_THREAD_ID = "thread_id";
|
public final static String EXTRA_THREAD_ID = "thread_id";
|
||||||
|
|
||||||
|
private final String KEY_TYPE = "type";
|
||||||
|
private final String KEY_POSITION = "position";
|
||||||
|
private final String KEY_THREADID = "thread_id";
|
||||||
|
|
||||||
|
private final int TYPE_COMPOSE = 0;
|
||||||
|
private final int TYPE_CONVERSATION = 1;
|
||||||
|
private final int TYPE_SETTINGS = 2;
|
||||||
|
|
||||||
private static final int THREAD_LIST_QUERY_TOKEN = 1701;
|
private static final int THREAD_LIST_QUERY_TOKEN = 1701;
|
||||||
private static final int UNREAD_THREADS_QUERY_TOKEN = 1702;
|
private static final int UNREAD_THREADS_QUERY_TOKEN = 1702;
|
||||||
public static final int DELETE_CONVERSATION_TOKEN = 1801;
|
public static final int DELETE_CONVERSATION_TOKEN = 1801;
|
||||||
public static final int HAVE_LOCKED_MESSAGES_TOKEN = 1802;
|
public static final int HAVE_LOCKED_MESSAGES_TOKEN = 1802;
|
||||||
private static final int DELETE_OBSOLETE_THREADS_TOKEN = 1803;
|
private static final int DELETE_OBSOLETE_THREADS_TOKEN = 1803;
|
||||||
|
|
||||||
public final static String MENU_FRAGMENT_TAG = "menu";
|
|
||||||
public final static String CONTENT_FRAGMENT_TAG = "content";
|
|
||||||
|
|
||||||
public static final String MMS_SETUP_DONT_ASK_AGAIN = "mmsSetupDontAskAgain";
|
public static final String MMS_SETUP_DONT_ASK_AGAIN = "mmsSetupDontAskAgain";
|
||||||
|
|
||||||
// thread IDs are always nonnegative
|
// thread IDs are always nonnegative
|
||||||
@@ -87,7 +91,7 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen
|
|||||||
private static SharedPreferences prefs;
|
private static SharedPreferences prefs;
|
||||||
|
|
||||||
private SlidingMenu mSlidingMenu;
|
private SlidingMenu mSlidingMenu;
|
||||||
private Fragment menuFragment;
|
private ConversationListFragment menuFragment;
|
||||||
private Fragment content;
|
private Fragment content;
|
||||||
private long mWaitingForThreadId = -1;
|
private long mWaitingForThreadId = -1;
|
||||||
|
|
||||||
@@ -101,6 +105,7 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen
|
|||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
Log.d(TAG, "onCreate");
|
||||||
getPrefs(this);
|
getPrefs(this);
|
||||||
getRes(this);
|
getRes(this);
|
||||||
|
|
||||||
@@ -112,9 +117,52 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen
|
|||||||
mSlidingMenu = (SlidingMenu) findViewById(R.id.sliding_menu);
|
mSlidingMenu = (SlidingMenu) findViewById(R.id.sliding_menu);
|
||||||
setupSlidingMenu();
|
setupSlidingMenu();
|
||||||
|
|
||||||
|
setupFragments(savedInstanceState);
|
||||||
|
onNewIntent(getIntent());
|
||||||
|
|
||||||
showDialogIfNeeded(savedInstanceState);
|
showDialogIfNeeded(savedInstanceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets up menu and content fragments
|
||||||
|
* If the fragments are stored in the bundle, use those. Otherwise, instantiate new ones
|
||||||
|
*/
|
||||||
|
private void setupFragments(Bundle savedInstanceState) {
|
||||||
|
int type = 0;
|
||||||
|
int position = 0;
|
||||||
|
threadId = 0;
|
||||||
|
|
||||||
|
if (savedInstanceState != null) {
|
||||||
|
type = savedInstanceState.getInt(KEY_TYPE, 0);
|
||||||
|
position = savedInstanceState.getInt(KEY_POSITION, 0);
|
||||||
|
threadId = savedInstanceState.getLong(KEY_THREADID, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
menuFragment = new ConversationListFragment();
|
||||||
|
menuFragment.setPosition(position);
|
||||||
|
getFragmentManager().beginTransaction()
|
||||||
|
.replace(R.id.menu_frame, menuFragment)
|
||||||
|
.commit();
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case TYPE_COMPOSE:
|
||||||
|
content = new ComposeFragment();
|
||||||
|
break;
|
||||||
|
case TYPE_CONVERSATION:
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
args.putLong(MessageListFragment.ARG_THREAD_ID, threadId);
|
||||||
|
content = MessageListFragment.getInstance(args);
|
||||||
|
break;
|
||||||
|
case TYPE_SETTINGS:
|
||||||
|
content = SettingsFragment.newInstance(R.xml.settings_simple);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
getFragmentManager().beginTransaction()
|
||||||
|
.replace(R.id.content_frame, content)
|
||||||
|
.commit();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shows at most one dialog using the intent extras and the restored state of the activity.
|
* Shows at most one dialog using the intent extras and the restored state of the activity.
|
||||||
*
|
*
|
||||||
@@ -384,33 +432,6 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen
|
|||||||
isShowing = true;
|
isShowing = true;
|
||||||
ThemeManager.loadThemeProperties(this);
|
ThemeManager.loadThemeProperties(this);
|
||||||
|
|
||||||
if (menuFragment == null || content == null) {
|
|
||||||
menuFragment = new ConversationListFragment();
|
|
||||||
|
|
||||||
if (getIntent().getExtras() != null) {
|
|
||||||
content = getFragmentManager().getFragment(getIntent().getExtras(), "content");
|
|
||||||
}
|
|
||||||
|
|
||||||
threadId = getIntent().getLongExtra(EXTRA_THREAD_ID, -1);
|
|
||||||
if (threadId != -1) {
|
|
||||||
// Open the conversation if a thread ID exists
|
|
||||||
setConversation(threadId);
|
|
||||||
} else {
|
|
||||||
// Otherwise, show the ConversationList and put a compose fragment as the content
|
|
||||||
// fragment.
|
|
||||||
mSlidingMenu.showMenu(false);
|
|
||||||
content = new ComposeFragment();
|
|
||||||
}
|
|
||||||
|
|
||||||
getFragmentManager().beginTransaction()
|
|
||||||
.replace(R.id.content_frame, content)
|
|
||||||
.commitAllowingStateLoss();
|
|
||||||
|
|
||||||
getFragmentManager().beginTransaction()
|
|
||||||
.replace(R.id.menu_frame, menuFragment)
|
|
||||||
.commitAllowingStateLoss();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!mSlidingMenu.isMenuShowing()) {
|
if (!mSlidingMenu.isMenuShowing()) {
|
||||||
QKContentFragment.notifyOnContentOpened(content);
|
QKContentFragment.notifyOnContentOpened(content);
|
||||||
}
|
}
|
||||||
@@ -434,13 +455,13 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen
|
|||||||
|
|
||||||
// This method is called whenever a MainActivity intent is started. Sometimes this is from a
|
// This method is called whenever a MainActivity intent is started. Sometimes this is from a
|
||||||
// notification; other times it's from the user clicking on the app icon in the home screen
|
// notification; other times it's from the user clicking on the app icon in the home screen
|
||||||
long threadId = getIntent().getLongExtra(EXTRA_THREAD_ID, -1);
|
long threadId = intent.getLongExtra(EXTRA_THREAD_ID, -1);
|
||||||
|
|
||||||
// The activity can also be launched by clicking on the message button from the contacts app
|
// The activity can also be launched by clicking on the message button from the contacts app
|
||||||
// Check for {sms,mms}{,to}: schemes, in which case we know to open a conversation
|
// Check for {sms,mms}{,to}: schemes, in which case we know to open a conversation
|
||||||
if (getIntent().getData() != null) {
|
if (intent.getData() != null) {
|
||||||
String data = getIntent().getData().toString();
|
String data = intent.getData().toString();
|
||||||
String scheme = getIntent().getData().getScheme();
|
String scheme = intent.getData().getScheme();
|
||||||
|
|
||||||
if (scheme.startsWith("smsto") || scheme.startsWith("mmsto")) {
|
if (scheme.startsWith("smsto") || scheme.startsWith("mmsto")) {
|
||||||
String address = data.replace("smsto:", "").replace("mmsto:", "");
|
String address = data.replace("smsto:", "").replace("mmsto:", "");
|
||||||
@@ -454,7 +475,11 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen
|
|||||||
// If it has a thread id, then we know it's from a notification and we can set the
|
// If it has a thread id, then we know it's from a notification and we can set the
|
||||||
// conversation.
|
// conversation.
|
||||||
if (threadId != -1) {
|
if (threadId != -1) {
|
||||||
|
Log.v(TAG, "Opening thread: " + threadId);
|
||||||
setConversation(threadId);
|
setConversation(threadId);
|
||||||
|
mSlidingMenu.showContent();
|
||||||
|
} else {
|
||||||
|
mSlidingMenu.showMenu(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise we'll just resume what was previously there, which doesn't require any code.
|
// Otherwise we'll just resume what was previously there, which doesn't require any code.
|
||||||
@@ -495,29 +520,22 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen
|
|||||||
protected void onSaveInstanceState(Bundle outState) {
|
protected void onSaveInstanceState(Bundle outState) {
|
||||||
super.onSaveInstanceState(outState);
|
super.onSaveInstanceState(outState);
|
||||||
FragmentManager m = getFragmentManager();
|
FragmentManager m = getFragmentManager();
|
||||||
|
Log.d(TAG, "-------------------------------");
|
||||||
|
Log.d(TAG, "onSaveInstanceState");
|
||||||
|
Log.d(TAG, "content exists: " + (content != null));
|
||||||
|
Log.d(TAG, "content exists in manager: " + (m.findFragmentById(R.id.content_frame) != null));
|
||||||
|
Log.d(TAG, "menu exists: " + (menuFragment != null));
|
||||||
|
Log.d(TAG, "menu exists in manager: " + (m.findFragmentById(R.id.menu_frame) != null));
|
||||||
|
|
||||||
// Save whether or not the mms setup fragment was dismissed
|
// Save whether or not the mms setup fragment was dismissed
|
||||||
if (getFragmentManager().findFragmentByTag(MMSSetupFragment.TAG) == null) {
|
if (m.findFragmentByTag(MMSSetupFragment.TAG) == null) {
|
||||||
outState.putBoolean(KEY_MMS_SETUP_FRAGMENT_DISMISSED, true);
|
outState.putBoolean(KEY_MMS_SETUP_FRAGMENT_DISMISSED, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check to make sure that the fragments we're looking to save are actually in the fragment
|
outState.putInt(KEY_TYPE, content instanceof MessageListFragment ? TYPE_CONVERSATION :
|
||||||
// manager before saving them. This bug is hard to reproduce, but it's one of the most
|
content instanceof SettingsFragment ? TYPE_SETTINGS : TYPE_COMPOSE);
|
||||||
// reported issues on the Play dev console.
|
outState.putInt(KEY_POSITION, menuFragment.getPosition());
|
||||||
if (content != null && m.findFragmentById(R.id.content_frame) != null) {
|
outState.putLong(KEY_THREADID, threadId);
|
||||||
m.putFragment(outState, CONTENT_FRAGMENT_TAG, content);
|
|
||||||
}
|
|
||||||
if (menuFragment != null && m.findFragmentById(R.id.menu_frame) != null) {
|
|
||||||
m.putFragment(outState, MENU_FRAGMENT_TAG, menuFragment);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onRestoreInstanceState(Bundle savedInstanceState) {
|
|
||||||
super.onRestoreInstanceState(savedInstanceState);
|
|
||||||
|
|
||||||
menuFragment = getFragmentManager().getFragment(savedInstanceState, MENU_FRAGMENT_TAG);
|
|
||||||
content = getFragmentManager().getFragment(savedInstanceState, CONTENT_FRAGMENT_TAG);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void switchContent(Fragment fragment, boolean animate) {
|
public void switchContent(Fragment fragment, boolean animate) {
|
||||||
@@ -565,7 +583,6 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen
|
|||||||
args.putString(MessageListFragment.ARG_HIGHLIGHT, pattern);
|
args.putString(MessageListFragment.ARG_HIGHLIGHT, pattern);
|
||||||
args.putBoolean(MessageListFragment.ARG_SHOW_IMMEDIATE, !animate);
|
args.putBoolean(MessageListFragment.ARG_SHOW_IMMEDIATE, !animate);
|
||||||
|
|
||||||
Fragment contentFragment = getFragmentManager().findFragmentById(R.id.content_frame);
|
|
||||||
MessageListFragment fragment = MessageListFragment.getInstance(args);
|
MessageListFragment fragment = MessageListFragment.getInstance(args);
|
||||||
|
|
||||||
// Save the thread ID here and switch the content
|
// Save the thread ID here and switch the content
|
||||||
|
|||||||
@@ -61,6 +61,10 @@ public abstract class RecyclerCursorAdapter<VH extends RecyclerView.ViewHolder,
|
|||||||
return mCursor;
|
return mCursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getCount() {
|
||||||
|
return mCursor == null ? 0 : mCursor.getColumnCount();
|
||||||
|
}
|
||||||
|
|
||||||
protected abstract DataType getItem(int position);
|
protected abstract DataType getItem(int position);
|
||||||
|
|
||||||
public boolean isInMultiSelectMode() {
|
public boolean isInMultiSelectMode() {
|
||||||
|
|||||||
+19
-1
@@ -62,6 +62,9 @@ public class ConversationListFragment extends QKFragment implements LoaderManage
|
|||||||
private ConversationDetailsDialog mConversationDetailsDialog;
|
private ConversationDetailsDialog mConversationDetailsDialog;
|
||||||
private QKActivity mContext;
|
private QKActivity mContext;
|
||||||
|
|
||||||
|
// This does not hold the current position of the list, rather the position the list is pending being set to
|
||||||
|
private int mPosition;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@@ -244,7 +247,18 @@ public class ConversationListFragment extends QKFragment implements LoaderManage
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).show(((MainActivity) mContext).getFragmentManager(), "conversation options");
|
}).show(mContext.getFragmentManager(), "conversation options");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPosition(int position) {
|
||||||
|
mPosition = position;
|
||||||
|
if (mLayoutManager != null && mAdapter != null) {
|
||||||
|
mLayoutManager.scrollToPosition(Math.min(mPosition, mAdapter.getCount() - 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPosition() {
|
||||||
|
return mLayoutManager.findFirstVisibleItemPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initLoaderManager() {
|
private void initLoaderManager() {
|
||||||
@@ -277,6 +291,10 @@ public class ConversationListFragment extends QKFragment implements LoaderManage
|
|||||||
if (mAdapter != null) {
|
if (mAdapter != null) {
|
||||||
// Swap the new cursor in. (The framework will take care of closing the, old cursor once we return.)
|
// Swap the new cursor in. (The framework will take care of closing the, old cursor once we return.)
|
||||||
mAdapter.changeCursor(data);
|
mAdapter.changeCursor(data);
|
||||||
|
if (mPosition != 0) {
|
||||||
|
mRecyclerView.scrollToPosition(Math.min(mPosition, data.getCount() - 1));
|
||||||
|
mPosition = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,9 @@ public class MessageColumns {
|
|||||||
};
|
};
|
||||||
|
|
||||||
public static class ColumnsMap {
|
public static class ColumnsMap {
|
||||||
|
private final String TAG = "ColumnsMap";
|
||||||
|
private final boolean DEBUG = false;
|
||||||
|
|
||||||
public int mColumnMsgType;
|
public int mColumnMsgType;
|
||||||
public int mColumnMsgId;
|
public int mColumnMsgId;
|
||||||
public int mColumnSmsAddress;
|
public int mColumnSmsAddress;
|
||||||
@@ -123,121 +126,121 @@ public class MessageColumns {
|
|||||||
try {
|
try {
|
||||||
mColumnMsgType = cursor.getColumnIndexOrThrow(Telephony.MmsSms.TYPE_DISCRIMINATOR_COLUMN);
|
mColumnMsgType = cursor.getColumnIndexOrThrow(Telephony.MmsSms.TYPE_DISCRIMINATOR_COLUMN);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
Log.w("colsMap", e.getMessage());
|
if (DEBUG) Log.w(TAG, e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mColumnMsgId = cursor.getColumnIndexOrThrow(BaseColumns._ID);
|
mColumnMsgId = cursor.getColumnIndexOrThrow(BaseColumns._ID);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
Log.w("colsMap", e.getMessage());
|
if (DEBUG) Log.w(TAG, e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mColumnSmsAddress = cursor.getColumnIndexOrThrow(Telephony.Sms.ADDRESS);
|
mColumnSmsAddress = cursor.getColumnIndexOrThrow(Telephony.Sms.ADDRESS);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
Log.w("colsMap", e.getMessage());
|
if (DEBUG) Log.w(TAG, e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mColumnSmsBody = cursor.getColumnIndexOrThrow(Telephony.Sms.BODY);
|
mColumnSmsBody = cursor.getColumnIndexOrThrow(Telephony.Sms.BODY);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
Log.w("colsMap", e.getMessage());
|
if (DEBUG) Log.w(TAG, e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mColumnSmsDate = cursor.getColumnIndexOrThrow(Telephony.Sms.DATE);
|
mColumnSmsDate = cursor.getColumnIndexOrThrow(Telephony.Sms.DATE);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
Log.w("colsMap", e.getMessage());
|
if (DEBUG) Log.w(TAG, e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mColumnSmsDateSent = cursor.getColumnIndexOrThrow(Telephony.Sms.DATE_SENT);
|
mColumnSmsDateSent = cursor.getColumnIndexOrThrow(Telephony.Sms.DATE_SENT);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
Log.w("colsMap", e.getMessage());
|
if (DEBUG) Log.w(TAG, e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mColumnSmsType = cursor.getColumnIndexOrThrow(Telephony.Sms.TYPE);
|
mColumnSmsType = cursor.getColumnIndexOrThrow(Telephony.Sms.TYPE);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
Log.w("colsMap", e.getMessage());
|
if (DEBUG) Log.w(TAG, e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mColumnSmsStatus = cursor.getColumnIndexOrThrow(Telephony.Sms.STATUS);
|
mColumnSmsStatus = cursor.getColumnIndexOrThrow(Telephony.Sms.STATUS);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
Log.w("colsMap", e.getMessage());
|
if (DEBUG) Log.w(TAG, e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mColumnSmsLocked = cursor.getColumnIndexOrThrow(Telephony.Sms.LOCKED);
|
mColumnSmsLocked = cursor.getColumnIndexOrThrow(Telephony.Sms.LOCKED);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
Log.w("colsMap", e.getMessage());
|
if (DEBUG) Log.w(TAG, e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mColumnSmsErrorCode = cursor.getColumnIndexOrThrow(Telephony.Sms.ERROR_CODE);
|
mColumnSmsErrorCode = cursor.getColumnIndexOrThrow(Telephony.Sms.ERROR_CODE);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
Log.w("colsMap", e.getMessage());
|
if (DEBUG) Log.w(TAG, e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mColumnMmsSubject = cursor.getColumnIndexOrThrow(Telephony.Mms.SUBJECT);
|
mColumnMmsSubject = cursor.getColumnIndexOrThrow(Telephony.Mms.SUBJECT);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
Log.w("colsMap", e.getMessage());
|
if (DEBUG) Log.w(TAG, e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mColumnMmsSubjectCharset = cursor.getColumnIndexOrThrow(Telephony.Mms.SUBJECT_CHARSET);
|
mColumnMmsSubjectCharset = cursor.getColumnIndexOrThrow(Telephony.Mms.SUBJECT_CHARSET);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
Log.w("colsMap", e.getMessage());
|
if (DEBUG) Log.w(TAG, e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mColumnMmsMessageType = cursor.getColumnIndexOrThrow(Telephony.Mms.MESSAGE_TYPE);
|
mColumnMmsMessageType = cursor.getColumnIndexOrThrow(Telephony.Mms.MESSAGE_TYPE);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
Log.w("colsMap", e.getMessage());
|
if (DEBUG) Log.w(TAG, e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mColumnMmsMessageBox = cursor.getColumnIndexOrThrow(Telephony.Mms.MESSAGE_BOX);
|
mColumnMmsMessageBox = cursor.getColumnIndexOrThrow(Telephony.Mms.MESSAGE_BOX);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
Log.w("colsMap", e.getMessage());
|
if (DEBUG) Log.w(TAG, e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mColumnMmsDeliveryReport = cursor.getColumnIndexOrThrow(Telephony.Mms.DELIVERY_REPORT);
|
mColumnMmsDeliveryReport = cursor.getColumnIndexOrThrow(Telephony.Mms.DELIVERY_REPORT);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
Log.w("colsMap", e.getMessage());
|
if (DEBUG) Log.w(TAG, e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mColumnMmsReadReport = cursor.getColumnIndexOrThrow(Telephony.Mms.READ_REPORT);
|
mColumnMmsReadReport = cursor.getColumnIndexOrThrow(Telephony.Mms.READ_REPORT);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
Log.w("colsMap", e.getMessage());
|
if (DEBUG) Log.w(TAG, e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mColumnMmsErrorType = cursor.getColumnIndexOrThrow(Telephony.MmsSms.PendingMessages.ERROR_TYPE);
|
mColumnMmsErrorType = cursor.getColumnIndexOrThrow(Telephony.MmsSms.PendingMessages.ERROR_TYPE);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
Log.w("colsMap", e.getMessage());
|
if (DEBUG) Log.w(TAG, e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mColumnMmsLocked = cursor.getColumnIndexOrThrow(Telephony.Mms.LOCKED);
|
mColumnMmsLocked = cursor.getColumnIndexOrThrow(Telephony.Mms.LOCKED);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
Log.w("colsMap", e.getMessage());
|
if (DEBUG) Log.w(TAG, e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mColumnMmsStatus = cursor.getColumnIndexOrThrow(Telephony.Mms.STATUS);
|
mColumnMmsStatus = cursor.getColumnIndexOrThrow(Telephony.Mms.STATUS);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
Log.w("colsMap", e.getMessage());
|
if (DEBUG) Log.w(TAG, e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mColumnMmsTextOnly = cursor.getColumnIndexOrThrow(Telephony.Mms.TEXT_ONLY);
|
mColumnMmsTextOnly = cursor.getColumnIndexOrThrow(Telephony.Mms.TEXT_ONLY);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
Log.w("colsMap", e.getMessage());
|
if (DEBUG) Log.w(TAG, e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -745,7 +745,9 @@ public class MessageListFragment extends QKContentFragment implements ActivityLa
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onContentClosed() {
|
protected void onContentClosed() {
|
||||||
mSensorManager.unregisterListener(this);
|
if (mSensorManager != null) {
|
||||||
|
mSensorManager.unregisterListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
if (mOpened) {
|
if (mOpened) {
|
||||||
if (mConversationLegacy != null) {
|
if (mConversationLegacy != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user