@Override protected void doAfterLoginNothing() { super.doAfterLoginNothing(); FacebookProfileActivity.this.setResult(RESULT_CANCELED); FacebookProfileActivity.this.finish(); }
// check the permission @Override protected void onResume() { super.onResume(); validatePermisson(); this.finish(); }
@Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); Log.d(TAG, "onNewIntent=" + intent); if (intent.getAction() != null && intent.getAction().equals(ACTION_CHECK_CONTECT)) { setTitle(); setTitle(title); setIntent(intent); } }
@Override public void onLogin() { super.onLogin(); Log.d(TAG, "call onLogin=" + this); if (facebookA != null) { lauchGetPages(); } }
@Override protected void onDestroy() { super.onDestroy(); if (event != null) { try { event.close(); } catch (Exception ne) { } event = null; } }
@Override protected void onDestroy() { if (fcursor != null) { try { fcursor.close(); } catch (Exception ne) { } fcursor = null; } clearAsyncFacebook(true); super.onDestroy(); }
@Override protected void onPause() { super.onPause(); AlarmManager alarmMgr = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE); Intent i = new Intent(); i.setClassName("com.ast.free", "com.ast.free.ui.FacebookProfileActivity"); i.setAction(ACTION_CHECK_CONTECT); PendingIntent pi = PendingIntent.getActivity(this, 0, i, PendingIntent.FLAG_CANCEL_CURRENT); alarmMgr.cancel(pi); Log.d(TAG, "Cancel alarm"); }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent intent) { switch (requestCode) { case FACEBOOK_NOTIFICATION_RESULT: { // make the unread to read facebook_bottom_region.setText(R.string.menu_title_notifications); facebook_bottom_region_notification_size.setVisibility(View.GONE); facebook_bottom_region.setCompoundDrawables(null, null, null, null); return; } } super.onActivityResult(requestCode, resultCode, intent); }
@Override protected void onDestroy() { int count = this.mGrid.getChildCount(); if (count > 0) { for (int i = 0; i < count; i++) { View tmpView = mGrid.getChildAt(i); if (ActivityItemView.class.isInstance(tmpView)) { ((ActivityItemView) tmpView).revoke(); } } } clearAsyncFacebook(true); super.onDestroy(); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent = this.getIntent(); setContentView(R.layout.facebook_friends_ui); friendList = (ListView) this.findViewById(R.id.facebook_user_list); friendList.setFocusableInTouchMode(true); friendList.setFocusable(true); friendList.setOnCreateContextMenuListener(this); friendList.setOnItemClickListener(listItemClickListener); friendList.setOnScrollListener(scrollListener); current_postion = (TextView) this.findViewById(R.id.current_postion); // current_postion.setVisibility(View.GONE); searchSpan = this.findViewById(R.id.facebook_search_span); searchSpan.setVisibility(View.VISIBLE); keyEdit = (EditText) this.findViewById(R.id.embedded_text_editor); watcher = new MyWatcher(); keyEdit.addTextChangedListener(watcher); pageHandler = new PageHandler(); View v = findViewById(R.id.progress_horizontal); if (v != null) { progressHorizontal = (ProgressBar) v; } setTitle(""); SocialORM.Account account = orm.getFacebookAccount(); if (checkFacebookAccount(this, account)) { perm_session = loginHelper.getPermanentSesstion(this); if (perm_session != null) { perm_session.attachActivity(this); facebookA = new AsyncFacebook(perm_session); handler.obtainMessage(FACEBOOK_PAGE_UI).sendToTarget(); Cursor tmp = orm.getAllPageCursor(); if (tmp == null || tmp.getCount() == 0) { Log.d(TAG, "I have no data, so load from web server"); lauchGetPages(); } } else { launchFacebookLogin(); } } }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent intent) { switch (requestCode) { case EVENT_REQUEST_CODE: { Log.d(TAG, "back from event detail"); if (intent != null) { long eid = intent.getLongExtra("eid", -1); Log.d(TAG, "eid is =" + eid); removeEid(eid); reShowUI(); } break; } } super.onActivityResult(requestCode, resultCode, intent); }
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.facebook_event_ui); contentList = (ListView) this.findViewById(R.id.facebook_event_list); contentList.setFocusableInTouchMode(true); contentList.setFocusable(true); contentList.setOnCreateContextMenuListener(this); contentList.setOnItemClickListener(itemClick); infoSpan = (View) findViewById(R.id.facebook_info_span); eventinfoview = (TextView) findViewById(R.id.facebook_info); fornotification = this.getIntent().getBooleanExtra("fornotification", false); eids = this.getIntent().getLongArrayExtra("eids"); setTitle(); setTitle(title); SocialORM.Account account = orm.getFacebookAccount(); if (checkFacebookAccount(this, account)) { perm_session = loginHelper.getPermanentSesstion(this); if (perm_session != null) { perm_session.attachActivity(this); facebookA = new AsyncFacebook(perm_session); if (fornotification == true) { event = orm.getFacebookeventsNotificationCursor(eids); if (event != null && event.getCount() > 0) { handler.obtainMessage(FACEBOOK_EVENT_UI).sendToTarget(); } launchLoadEvents(); } else { event = orm.getFacebookeventsCursor(); if (event == null || event.getCount() == 0) { launchLoadEvents(); } else { handler.obtainMessage(FACEBOOK_EVENT_UI).sendToTarget(); } } } else { launchFacebookLogin(); } } }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); perm = this.getIntent().getStringExtra("permission"); // prompt sub-activity Browser to get the permission Log.d(TAG, "create FacebookExtPermissionActivity=" + perm); this.setTitle(perm); String extPermURL = loginHelper.getExtPermURL(perm); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(extPermURL)); intent.setData(Uri.parse(extPermURL)); intent.putExtra("facebook_loginURL", extPermURL); intent.putExtra(Browser.EXTRA_APPLICATION_ID, mContext.getPackageName()); formatFacebookIntent(intent, orm); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); startActivityForResult(intent, RETRUN_FROM_BROWSER); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent = this.getIntent(); setContentView(R.layout.facebook_set_contact); this.setTitle(R.string.facebook_set_contact_title); email = (EditText) this.findViewById(R.id.contact_email); cell = (EditText) this.findViewById(R.id.contact_cell); other = (EditText) this.findViewById(R.id.contact_other); getcontact_status = (TextView) this.findViewById(R.id.facebook_get_contact); SocialORM.Account account = orm.getFacebookAccount(); // email.setText(account.email); String simsn = android.telephony.TelephonyManager.getDefault().getLine1Number(); if (simsn != null && simsn.length() > 0) { cell.setText(simsn); other.setText(simsn); } setB = (Button) this.findViewById(R.id.contact_setup); setB.setOnClickListener(updateClick); if (checkFacebookAccount(this, account)) { perm_session = loginHelper.getPermanentSesstion(this); if (perm_session != null) { // show get_contact_info worked in background so need a new AsyncFacebook without // connectionListener to avoid // onKeyDown-->stopLoading() // perm_session.attachActivity(this); facebookA = new AsyncFacebook(perm_session); getContactInfo(); } else { launchFacebookLogin(); } } }
@Override protected void onResume() { super.onResume(); if (doSetTitleAfterLoginInOnResume == true) { String temptitle = getString(R.string.facebook_main_menu); FacebookUser.SimpleFBUser user = orm.getSimpleFacebookUser(getLoginUserID()); if (user != null) { temptitle = user.name; user.despose(); user = null; } setTitle(temptitle); setTitle(); if (notifies != null) { notifies.msg.unread = 0; notifies.entInvite.uids.clear(); notifies.poke.unread = 0; notifies.grdInvite.uids.clear(); notifies.frdRequest.uids.clear(); processNotificationSummary(notifies); } } doSetTitleAfterLoginInOnResume = false; // cancel first AlarmManager alarmMgr = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE); Intent i = new Intent(); i.setClassName("com.ast.free", "com.ast.free.ui.FacebookProfileActivity"); i.setAction(ACTION_CHECK_CONTECT); PendingIntent pi = PendingIntent.getActivity(this, 0, i, PendingIntent.FLAG_CANCEL_CURRENT); alarmMgr.cancel(pi); // resume to call alarmComming(false); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.i(TAG, "onCreate"); loadApps(); // do this in onresume? setContentView(R.layout.facebook_start_ui); mContainer = (ViewGroup) findViewById(R.id.container); mContainer.setPersistentDrawingCache(ViewGroup.PERSISTENT_ANIMATION_CACHE); // this.getWindow().setBackgroundDrawable(); mGrid = (GridView) findViewById(R.id.myGrid); mGrid.setAdapter(new AppsAdapter(this.getApplicationContext(), mApps)); mGrid.setFocusableInTouchMode(true); mGrid.setFocusable(true); mGrid.setSelected(true); mGrid.setClickable(true); mGrid.setOnCreateContextMenuListener(this); mGrid.setOnItemClickListener(listItemClickListener); mGrid.setVisibility(View.VISIBLE); flipper = (ViewFlipper) findViewById(R.id.facebook_start_ui_flipper); facebook_bottom_region = (Button) this.findViewById(R.id.facebook_bottom_region); facebook_bottom_region.setText(R.string.menu_title_notifications); facebook_bottom_region.setOnClickListener(showNotificationClick); facebook_current_pos = (Button) this.findViewById(R.id.facebook_current_pos); setPosition(true); facebook_bottom_region_notification_size = (TextView) this.findViewById(R.id.facebook_bottom_region_notification_size); inboxlayout = (LinearLayout) findViewById(R.id.inboxlayout); facebook_inbox_unread_size_tv = (TextView) findViewById(R.id.facebook_inbox_unread_size_tv); requestlayout = (LinearLayout) findViewById(R.id.requestlayout); facebook_request_unread_size_tv = (TextView) findViewById(R.id.facebook_request_unread_size_tv); eventlayout = (LinearLayout) findViewById(R.id.eventlayout); facebook_request_unread_size_event = (TextView) findViewById(R.id.facebook_request_unread_size_event); facebook_search_span = this.findViewById(R.id.facebook_search_span); facebook_bottom_span = this.findViewById(R.id.facebook_bottom_span); embedded_search_text_editor = (EditText) this.findViewById(R.id.embedded_search_text_editor); // embedded_search_text_editor.setOnFocusChangeListener(focusChangeListener); embedded_search_text_editor.clearFocus(); // embedded_search_text_editor.setFocusable(false); embedded_search_text_editor.setOnClickListener(clickListener); Intent in = new Intent(this.getApplicationContext(), SNSService.class); startService(in); // add to app. init code segment, pops up a warning message if (android.os.Build.DEVICE.trim().toLowerCase().equals(TARGET_DEVICE) || android.os.Build.MODEL.trim().toLowerCase().equals(TARGET_DEVICE2) || android.os.Build.DEVICE.trim().toLowerCase().equals(TARGET_DEVICE_Blu) || android.os.Build.MODEL.trim().toLowerCase().equals(TARGET_DEVICE_vibo_A300) || android.os.Build.DEVICE.trim().toLowerCase().equals(TARGET_DEVICE_vibo_A600)) { // it is under define } else { if (false) { new AlertDialog.Builder(this) .setView(getLinkfiedView(this, R.string.not_target_device)) .setCancelable(true) .setNegativeButton("OK", null) .show(); } } // don't let the input has focus mGrid.requestFocus(); // SocialORM.Account account = orm.getFacebookAccount(); if (checkFacebookAccount(this, account)) { perm_session = loginHelper.getPermanentSesstion(this); if (perm_session != null) { // perm_session.attachActivity(this); facebookA = new AsyncFacebook(perm_session); handler.obtainMessage(FACEBOOK_NOTIFICATION_GET).sendToTarget(); reschedule(); // checkProduct(); } else { launchFacebookLogin(); } } if (false && SystemProperties.getInt("enable_trail", 1) == 1) { trailversion(); } setTitle(); setTitle(title); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.facebook_phonebook_detail); setTitle(); setTitle(title); long uid = this.getIntent().getLongExtra("phonebookid", -1); phonebook = orm.getPhonebook(uid); user = orm.getFacebookUser(uid); userLogo = (ImageView) this.findViewById(R.id.phonebook_img_logo_ui); phonebook_info_list = (ListView) this.findViewById(R.id.phonebook_info_list); phonebook_info_list.setOnItemClickListener(itemClickListener); userName = (TextView) this.findViewById(R.id.phonebook_user_name); if (user != null) { if (isEmpty(user.name) == false) userName.setText(user.name); userName.setOnClickListener(toUserDetailClick); userLogo.setOnClickListener(toUserDetailClick); String tmpurl = getImgURL(user); // first set small icon and then set the right icon String smallFile = TwitterHelper.getImagePathFromURL_noFetch(user.pic_square); int ret = -1; if (new File(smallFile).exists() == true) { try { Bitmap tmp = BitmapFactory.decodeFile(smallFile); if (tmp != null) { // ImageCacheManager.instance().addCache(user.pic_square, tmp); // userLogo.setImageBitmap(tmp); Matrix matrix = new Matrix(); int h = 120; Bitmap mBaseImage = tmp; float scale = (float) h / (float) mBaseImage.getWidth(); matrix.setScale(scale, scale); mBaseImage = Bitmap.createBitmap( mBaseImage, 0, 0, mBaseImage.getWidth(), mBaseImage.getHeight(), matrix, true); userLogo.setImageBitmap(mBaseImage); } else { ret = R.drawable.no_avatar; } } catch (Exception ne) { ret = R.drawable.no_avatar; } } else { ret = R.drawable.no_avatar; } if (ret > -1) { Matrix matrix = new Matrix(); int h = 120; Bitmap mBaseImage = BitmapFactory.decodeResource(SNSService.getSNSService().getResources(), ret); float scale = (float) h / (float) mBaseImage.getWidth(); matrix.setScale(scale, scale); mBaseImage = Bitmap.createBitmap( mBaseImage, 0, 0, mBaseImage.getWidth(), mBaseImage.getHeight(), matrix, true); userLogo.setImageBitmap(mBaseImage); } if (tmpurl != null) { setImage(tmpurl); } } else { Log.e(TAG, "***************Why user is null"); userLogo.setImageResource(R.drawable.no_avatar); } // cell/mobile/email/address List<PhoneBookDetailItem> items = createPhonebookDetailItems(); if (items.size() > 0) { FacebookPhoneBookDetailAdapter adapter = new FacebookPhoneBookDetailAdapter(mContext, items); phonebook_info_list.setAdapter(adapter); } else { phonebook_info_list.setAdapter(null); } setTitle(""); SocialORM.Account account = orm.getFacebookAccount(); if (checkFacebookAccount(this, account)) { perm_session = loginHelper.getPermanentSesstion(this); if (perm_session != null) { perm_session.attachActivity(this); facebookA = new AsyncFacebook(perm_session); } else { launchFacebookLogin(); } } }