@Override protected void onStart() { // TODO Auto-generated method stub super.onStart(); isRunning = true; crowdroidApplication = (CrowdroidApplication) getApplicationContext(); settingData = crowdroidApplication.getSettingData(); statusData = crowdroidApplication.getStatusData(); accountData = crowdroidApplication.getAccountList().getCurrentAccount(); String fontColor = settingData.getFontColor(); String fontSize = settingData.getFontSize(); imageShow = settingData.getSelectionShowImage(); // myImageBinder = new MyImageBinder(fontColor, fontSize, null, this); // adapter.setViewBinder(myImageBinder); headName.setText(getIntent().getExtras().getString("name")); // Bind Api Service Intent intent = new Intent(this, ApiService.class); bindService(intent, this, Context.BIND_AUTO_CREATE); // Bind Service Intent intentTranslation = new Intent(this, TranslationService.class); bindService(intentTranslation, this, Context.BIND_AUTO_CREATE); }
@Override public void onReceive(Context context, Intent intent) { // Check Setting Parameter and create Intent Data CrowdroidApplication crowdroidApplication = (CrowdroidApplication) context.getApplicationContext(); SettingData settingData = crowdroidApplication.getSettingData(); boolean isNotification = settingData.isNotification(); boolean isAt = settingData.isAtMessage(); boolean isGeneral = settingData.isGeneralMessage(); boolean isDirect = settingData.isDirectMessage(); boolean isFollower = settingData.isFollowerMessage(); boolean istwFollow = settingData.isTwitterFollowerMessage(); boolean isUnfollow = settingData.isUnfollowerMessage(); boolean isComment = settingData.isCommentMessage(); boolean isRetweetOfMe = settingData.isRetweetOfMe(); boolean isFeedState = settingData.isFeedState(); boolean isFeedAlbum = settingData.isFeedAlbum(); boolean isFeedShare = settingData.isFeedShare(); boolean isFeedBlog = settingData.isFeedBlog(); boolean isAutoBroadcast = settingData.isAutoBroadcast(); // Start Notification Service with Intent Data if (isNotification) { Intent i = new Intent(context, NotificationService.class); i.setAction(NotificationService.ACTION_NOTIFICATION); Bundle bundle = new Bundle(); bundle.putBoolean(NotificationService.INTENT_DATA_AT_CHECK, isAt); bundle.putBoolean(NotificationService.INTENT_DATA_NORMAL_CHECK, isGeneral); bundle.putBoolean(NotificationService.INTENT_DATA_DIRECT_CHECK, isDirect); bundle.putBoolean(NotificationService.INTENT_DATA_TWITTER_FOLLOW_CHECK, istwFollow); bundle.putBoolean(NotificationService.INTENT_DATA_FOLLOWER_CHECK, isFollower); bundle.putBoolean(NotificationService.INTENT_DATA_UNFOLLOW_CHECK, isUnfollow); bundle.putBoolean(NotificationService.INTENT_DATA_COMMENT_CHECK, isComment); bundle.putBoolean(NotificationService.INTENT_DATA_RETWEET_OF_ME_CHECK, isRetweetOfMe); bundle.putBoolean(NotificationService.INTENT_DATA_FEED_SHARE_CHECK, isFeedShare); bundle.putBoolean(NotificationService.INTENT_DATA_FEED_STATE_CHECK, isFeedState); bundle.putBoolean(NotificationService.INTENT_DATA_FEED_BLOG_CHECK, isFeedBlog); bundle.putBoolean(NotificationService.INTENT_DATA_FEED_ALBUM_CHECK, isFeedAlbum); if (isAutoBroadcast) { bundle.putBoolean(NotificationService.INTENT_DATA_AUTO_BROADCAST_CHECK, isAutoBroadcast); } i.putExtras(bundle); context.startService(i); } else if (isAutoBroadcast) { Intent i = new Intent(context, NotificationService.class); i.setAction(NotificationService.ACTION_NOTIFICATION); Bundle bundle = new Bundle(); bundle.putBoolean(NotificationService.INTENT_DATA_AT_CHECK, false); bundle.putBoolean(NotificationService.INTENT_DATA_NORMAL_CHECK, false); bundle.putBoolean(NotificationService.INTENT_DATA_DIRECT_CHECK, false); bundle.putBoolean(NotificationService.INTENT_DATA_TWITTER_FOLLOW_CHECK, false); bundle.putBoolean(NotificationService.INTENT_DATA_FOLLOWER_CHECK, false); bundle.putBoolean(NotificationService.INTENT_DATA_UNFOLLOW_CHECK, false); bundle.putBoolean(NotificationService.INTENT_DATA_COMMENT_CHECK, false); bundle.putBoolean(NotificationService.INTENT_DATA_RETWEET_OF_ME_CHECK, false); bundle.putBoolean(NotificationService.INTENT_DATA_FEED_SHARE_CHECK, false); bundle.putBoolean(NotificationService.INTENT_DATA_FEED_STATE_CHECK, false); bundle.putBoolean(NotificationService.INTENT_DATA_FEED_BLOG_CHECK, false); bundle.putBoolean(NotificationService.INTENT_DATA_FEED_ALBUM_CHECK, false); bundle.putBoolean(NotificationService.INTENT_DATA_AUTO_BROADCAST_CHECK, isAutoBroadcast); i.putExtras(bundle); context.startService(i); } }