private void handlerBackKey() { if (mCurrentFragment == fragment_phone) { mCurrentFragment = fragment_main; if (mPickContactPhoneFragment != null && !mPickContactPhoneFragment.isHidden()) { mFragmentManager.beginTransaction().hide(mPickContactPhoneFragment).commit(); } mPickFriendsFragment = (PickFriendsFragment) mFragmentManager.findFragmentByTag(PICK_MAIN_TAG); if (mPickFriendsFragment == null) { mPickFriendsFragment = new PickFriendsFragment(); mFragmentManager .beginTransaction() .add(R.id.request_container, mPickFriendsFragment, PICK_MAIN_TAG) .commit(); } else { mFragmentManager.beginTransaction().show(mPickFriendsFragment).commit(); mPickFriendsFragment.setAddress(); } } else if (mCurrentFragment == fragment_email) { mCurrentFragment = fragment_main; if (mPickContactEmailFragment != null && !mPickContactEmailFragment.isHidden()) { mFragmentManager.beginTransaction().hide(mPickContactEmailFragment).commit(); } mPickFriendsFragment = (PickFriendsFragment) mFragmentManager.findFragmentByTag(PICK_MAIN_TAG); if (mPickFriendsFragment == null) { mPickFriendsFragment = new PickFriendsFragment(); mFragmentManager .beginTransaction() .add(R.id.request_container, mPickFriendsFragment, PICK_MAIN_TAG) .commit(); } else { mFragmentManager.beginTransaction().show(mPickFriendsFragment).commit(); mPickFriendsFragment.setAddress(); } } else { if (mCurrentFragment == fragment_main) { if (mPickFriendsFragment != null) { if (mPickFriendsFragment.isBackSearch()) { Log.d(TAG, "is back from search mode"); } else { setResult(Activity.RESULT_CANCELED); super.onBackPressed(); } } else { setResult(Activity.RESULT_CANCELED); super.onBackPressed(); } } else { setResult(Activity.RESULT_CANCELED); super.onBackPressed(); } } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.invite_people_main); showLeftActionBtn(false); showRightActionBtn(false); showRightTextActionBtn(true); AddressPadMini.registerNoteActionListener(getClass().getName(), this); parseIntent(); mFragmentManager = getSupportFragmentManager(); mCurrentFragment = fragment_main; mPickFriendsFragment = new PickFriendsFragment(); mFragmentManager .beginTransaction() .add(R.id.request_container, mPickFriendsFragment, PICK_MAIN_TAG) .commit(); // mHandler.post(new Runnable() { // @Override // public void run() { generateAllSelectData(receiveUserAdds); // } // }); }
@Override protected void onDestroy() { super.onDestroy(); if (mCursor != null && !mCursor.isClosed()) { mCursor.close(); } }
@Override protected void onDestroy() { if (mPickFriendsFragment != null) { mPickFriendsFragment.clearAddress(); } AddressPadMini.unregisterNoteActionListener(getClass().getName()); super.onDestroy(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.link_select); setHeadTitle(R.string.link_title); showLeftActionBtn(false); showRightActionBtn(false); showRightTextActionBtn(true); overrideRightTextActionBtn(R.string.label_ok, linkClickListener); linkView = (GridView) findViewById(R.id.link_listview); et_select = (EditText) findViewById(R.id.et_select); et_select.setSelection(et_select.getText().length()); et_select.addTextChangedListener(new MyWatcher()); queryBookMark(current_key); // linkListView.setAdapter(new SimpleCursorAdapter(this, android.R.layout.simple_list_item_1, // mCursor,new String[]{Browser.BookmarkColumns.URL},new int[]{android.R.id.text1})); marksAdapter = new BrowserBookmarksAdapter(this); marksAdapter.changeCursor(mCursor); linkView.setAdapter(marksAdapter); linkView.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // Intent shortIn = (Intent)intent.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT); // link_title = intent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME); // link_url = shortIn.getData().toString(); // mFavicon = intent.getParcelableExtra(Intent.EXTRA_SHORTCUT_ICON); Intent shortIn = new Intent(Intent.EXTRA_SHORTCUT_INTENT); mCursor.moveToPosition(position); BrowserBookmarksAdapterItem item = marksAdapter.getRowObject(mCursor, null); shortIn.putExtra(Intent.EXTRA_SHORTCUT_NAME, item.title); // Bitmap bmp = null; Bitmap favbmp = null; Bitmap touch_icon = null; // if(item.thumbnail != null) { // bmp = item.thumbnail.getBitmap(); // } if (item.favIcon != null) { favbmp = item.favIcon; } if (item.touch_icon != null) { touch_icon = item.touch_icon; } shortIn.putExtra( Intent.EXTRA_SHORTCUT_ICON, BookmarkUtils.createIcon( LinkSelectActivity.this, touch_icon, favbmp, BookmarkUtils.BookmarkIconType.ICON_HOME_SHORTCUT)); if (!TextUtils.isEmpty(item.url)) { shortIn.setData(Uri.parse(item.url)); } setResult(RESULT_OK, shortIn); finish(); } }); }