X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=src%2Fcom%2Fandroid%2Fim%2Fapp%2FChatView.java;h=13acebbae1747771ace6178737f7359f74094c06;hb=7188a472632c22277c84e3cc10459e0c25cbe461;hp=f3d0d344326897c099c4ba71da160c1062c93bd3;hpb=e9ebcf259bb3dcb9debe0d88db4938cdf3218b9d;p=android-x86%2Fpackages-apps-IM.git diff --git a/src/com/android/im/app/ChatView.java b/src/com/android/im/app/ChatView.java index f3d0d34..13acebb 100644 --- a/src/com/android/im/app/ChatView.java +++ b/src/com/android/im/app/ChatView.java @@ -26,7 +26,6 @@ import android.app.AlertDialog; import android.content.AsyncQueryHandler; import android.content.ContentResolver; import android.content.ContentUris; -import android.content.ContentValues; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; @@ -42,6 +41,7 @@ import android.net.Uri; import android.os.Bundle; import android.os.Message; import android.os.RemoteException; +import android.provider.Browser; import android.provider.Im; import android.text.Editable; import android.text.TextUtils; @@ -208,7 +208,7 @@ public class ChatView extends LinearLayout { public void onClick(DialogInterface dialog, int which) { Uri uri = Uri.parse(linkUrls.get(which)); Intent intent = new Intent(Intent.ACTION_VIEW, uri); - intent.addCategory(Intent.CATEGORY_BROWSABLE); + intent.putExtra(Browser.EXTRA_APPLICATION_ID, mScreen.getPackageName()); mScreen.startActivity(intent); } }); @@ -656,12 +656,7 @@ public class ChatView extends LinearLayout { mQueryHandler.cancelOperation(QUERY_TOKEN); } - Uri uri; - if (Im.Contacts.TYPE_GROUP == mType) { - uri = ContentUris.withAppendedId(Im.GroupMessages.CONTENT_URI_GROUP_MESSAGES_BY, mChatId); - } else { - uri = Im.Messages.getContentUriByContact(mProviderId, mAccountId, mUserName); - } + Uri uri = Im.Messages.getContentUriByThreadId(mChatId); if (Log.isLoggable(ImApp.LOG_TAG, Log.DEBUG)){ log("queryCursor: uri=" + uri); @@ -772,8 +767,8 @@ public class ChatView extends LinearLayout { new AlertDialog.Builder(mContext) .setTitle(R.string.confirm) .setMessage(r.getString(R.string.confirm_block_contact, mNickName)) - .setPositiveButton(R.string.no, null) // default button - .setNegativeButton(R.string.yes, confirmListener) + .setPositiveButton(R.string.yes, confirmListener) // default button + .setNegativeButton(R.string.no, null) .setCancelable(false) .show(); } @@ -1054,7 +1049,7 @@ public class ChatView extends LinearLayout { for (int i = 0 ; i < len ; i++) { mColumnNames[i] = columnNames[i]; - if (mColumnNames[i].equals(Im.BaseMessageColumns.DATE)) { + if (mColumnNames[i].equals(Im.Messages.DATE)) { mDateColumn = i; } } @@ -1418,7 +1413,7 @@ public class ChatView extends LinearLayout { private int mScrollState; private boolean mNeedRequeryCursor; - private int mContactColumn; + private int mNicknameColumn; private int mBodyColumn; private int mDateColumn; private int mTypeColumn; @@ -1438,11 +1433,11 @@ public class ChatView extends LinearLayout { } private void resolveColumnIndex(Cursor c) { - mContactColumn = c.getColumnIndexOrThrow(Im.BaseMessageColumns.CONTACT); - mBodyColumn = c.getColumnIndexOrThrow(Im.BaseMessageColumns.BODY); - mDateColumn = c.getColumnIndexOrThrow(Im.BaseMessageColumns.DATE); - mTypeColumn = c.getColumnIndexOrThrow(Im.BaseMessageColumns.TYPE); - mErrCodeColumn = c.getColumnIndexOrThrow(Im.BaseMessageColumns.ERROR_CODE); + mNicknameColumn = c.getColumnIndexOrThrow(Im.Messages.NICKNAME); + mBodyColumn = c.getColumnIndexOrThrow(Im.Messages.BODY); + mDateColumn = c.getColumnIndexOrThrow(Im.Messages.DATE); + mTypeColumn = c.getColumnIndexOrThrow(Im.Messages.TYPE); + mErrCodeColumn = c.getColumnIndexOrThrow(Im.Messages.ERROR_CODE); mDeltaColumn = c.getColumnIndexOrThrow(DeltaCursor.DELTA_COLUMN_NAME); } @@ -1464,7 +1459,7 @@ public class ChatView extends LinearLayout { MessageView chatMsgView = (MessageView) view; int type = cursor.getInt(mTypeColumn); - String contact = isGroupChat() ? cursor.getString(mContactColumn) : mNickName; + String contact = isGroupChat() ? cursor.getString(mNicknameColumn) : mNickName; String body = cursor.getString(mBodyColumn); long delta = cursor.getLong(mDeltaColumn); boolean showTimeStamp = (delta > SHOW_TIME_STAMP_INTERVAL);