@Override
 public void onClick(View v) {
   int position = (int) v.getTag();
   Bundle bundle = new Bundle();
   Intent intent;
   switch (v.getId()) {
     case R.id.iv_cover:
     case R.id.tv_coverTitle:
     case R.id.ll_praise:
       intent = new Intent(mcontext, DisplayDetailActivity.class);
       bundle.putString(DisplayDetailActivity.ShareId, shareList.get(position).shareId);
       intent.putExtras(bundle);
       mcontext.startActivity(intent);
       break;
       //            case R.id.ll_praise:
       //                praisePos = position;
       //                if (praiseRequest == null)
       //                    praiseRequest = new PraiseRequest();
       //                if (praiseResponse == null)
       //                    praiseResponse = new PraiseResponse();
       //                praiseRequest.praiseShare(praiseResponse,
       // shareList.get(praisePos).shareId, !shareList.get(praisePos).hasPraised);
       //                break;
     case R.id.ll_evaluation:
       intent = new Intent(mcontext, CommentDetailActivity.class);
       bundle.putString(CommentDetailActivity.FromId, shareList.get(position).shareId);
       bundle.putString(CommentDetailActivity.CommentType, Comment.CommentType.分享.getBelongs());
       bundle.putBoolean(CommentDetailActivity.IsPraised, shareList.get(position).hasPraised);
       intent.putExtras(bundle);
       mcontext.startActivity(intent);
       break;
   }
 }
Ejemplo n.º 2
0
  public void execute() {
    // Initialize a Reminder or more than one Reminders.
    boolean booleanReminder = false;
    if (mStrReminder.compareTo(mStrReminder) == 0) booleanReminder = true;
    Reminder[] reminders = new Reminder[1];
    if (mStrMinute.compareTo("On day of event") == 0) {
      Date dateReminder = getDateTime(mStrStartTime);
      GregorianCalendar gregorianCalendarReminder = new GregorianCalendar();
      gregorianCalendarReminder.setTime(dateReminder);
      mStrMinute =
          Integer.toString(
              gregorianCalendarReminder.get(Calendar.HOUR_OF_DAY) * 60
                  + gregorianCalendarReminder.get(Calendar.MINUTE));
    }

    reminders[0] = new Reminder(mStrMinute, mStrMethod, booleanReminder);

    // Initialize a Recurrence.

    // Initialize a Where.
    Where where = new Where(mStrLocation);

    // Initialize a When.
    When when =
        new When(
            getStrDateWithTimeZone(mStrStartTime), getStrDateWithTimeZone(mStrEndTime), reminders);

    // Initialize an Event.
    Event event = new Event(mStrTitle, mStrContent, where, when);

    // Post to Calendar for adding a new event of default calendar.
    Event eventNew = null;
    try {
      eventNew = mCalendarServer.postEventEntry("", event);
    } catch (IOException e) {
      Bundle bundleSend = new Bundle();
      eventNew = new Event(false);
      bundleSend.putSerializable("Data", eventNew);
      bundleSend.putInt("ErrorCode", Integer.parseInt(e.getMessage()));

      Intent intentSend = new Intent(IntentCommand.INTENT_ACTION);
      intentSend.setFlags(IntentCommand.GOOGLE_CALENDAR_ADD_EVENT);
      intentSend.putExtras(bundleSend);

      mBaseService.sendBroadcast(intentSend);
      return;
    }

    // Get a response from Calendar, the response is a event entry, update cache.
    if (eventNew != null) {
      Bundle bundleSend = new Bundle();
      bundleSend.putSerializable("Data", eventNew);

      Intent intentSend = new Intent(IntentCommand.INTENT_ACTION);
      intentSend.setFlags(IntentCommand.GOOGLE_CALENDAR_ADD_EVENT);
      intentSend.putExtras(bundleSend);

      mBaseService.sendBroadcast(intentSend);
    }
  }
Ejemplo n.º 3
0
  public void action() {
    Uri uri = mItem.getUri();

    if (uri == null) {
      showToast("Please select a valid video file first");

      return;
    }

    mItem.stopVideoView();

    int segmentFrom = mItem.getSegmentFrom();
    int segmentTo = mItem.getSegmentTo();

    Intent intent = new Intent();
    intent.setClass(this, ComposerCutCoreActivity.class);

    Bundle b = new Bundle();
    b.putString("srcMediaName1", mItem.getMediaFileName());
    intent.putExtras(b);
    b.putString("dstMediaPath", mItem.genDstPath(mItem.getMediaFileName(), "segment"));
    intent.putExtras(b);
    b.putLong("segmentFrom", segmentFrom);
    intent.putExtras(b);
    b.putLong("segmentTo", segmentTo);
    intent.putExtras(b);
    b.putString("srcUri1", uri.getString());
    intent.putExtras(b);

    startActivity(intent);
  }
Ejemplo n.º 4
0
  /** @description function to check the user option and proceed accordingly. */
  @Override
  public void onClick(View v) {

    if (v == appearTestButton) {
      Intent in = new Intent(TestMenu.this, TestList.class);
      Bundle b = new Bundle();
      b.putString("username", username);
      in.putExtras(b);
      startActivity(in);
    } // end of if
    else if (v == viewScoreButton) {
      new RetrieveFeedTask()
          .execute("http://" + new IP().getIp() + "/view_all_score.php?user="******"http://"+new
      // IP().getIp()+"/view_all_score.php?user="******"username", username);
      in.putExtras(b);
      startActivity(in);
    } // end of else if
  } // end of onClick()
Ejemplo n.º 5
0
 @Override
 public void onValidationFinished(ValidationType validationType) {
   if (validationType.equals(ValidationType.SKIPPED)) {
     Log.d("ValidationType: ", "SKIPPED. Launching login activity...");
     startActivityForResult(new Intent(getBaseContext(), WelcomeActivity.class), 364);
     Bundle data = new Bundle();
     data.putString(WelcomeActivity.VALIDATION_TYPE, ValidationType.SKIPPED.name());
     Intent missingToken = new Intent(getBaseContext(), WelcomeActivity.class);
     missingToken.putExtras(data);
     startActivityForResult(missingToken, 364);
   } else if (validationType.equals(ValidationType.MISSING_CREDENTIALS)) {
     Log.d("ValidationType: ", "MISSING_CREDENTIALS. Launching login activity...");
     Bundle data = new Bundle();
     data.putString(WelcomeActivity.VALIDATION_TYPE, ValidationType.MISSING_CREDENTIALS.name());
     Intent missingToken = new Intent(getBaseContext(), WelcomeActivity.class);
     missingToken.putExtras(data);
     startActivityForResult(missingToken, 364);
   } else if (validationType.equals(ValidationType.MISSING_TOKEN)) {
     Log.d("ValidationType:", "MISSING_TOKEN. Launching Login Activity");
     Bundle data = new Bundle();
     data.putString(WelcomeActivity.VALIDATION_TYPE, ValidationType.MISSING_TOKEN.name());
     Intent missingToken = new Intent(getBaseContext(), WelcomeActivity.class);
     missingToken.putExtras(data);
     startActivityForResult(missingToken, 364);
   } else if (validationType.equals(ValidationType.SUCCESS)) {
     Log.d("ValidationType: ", "SUCCESS. Get user info/retrieve updated data from server");
     onLoginSuccess(
         new LinodeUser(
             LinodeApi.getInstance().getPreferences().getCurrentUsername(),
             LinodeApi.getInstance().getPreferences().getCurrentPassword(),
             LinodeApi.getInstance().getPreferences().getCurrentApiKey()));
   } else if (validationType.equals(ValidationType.UNKNOWN_ERROR)) {
     AndroidHelper.shortToast(getBaseContext(), "Unknown error. ¯\\_(ツ)_/¯");
   }
 }
Ejemplo n.º 6
0
  protected Notification getNotification(Context context, Intent intent) {
    JSONObject pushData = getPushData(intent);
    if (pushData == null || (!pushData.has("alert") && !pushData.has("title"))) {
      return null;
    }

    String title = pushData.optString("title", getDisplayName(context));
    String alert = pushData.optString("alert", "Notification received.");
    String tickerText = String.format(Locale.getDefault(), "%s: %s", title, alert);

    Bundle extras = intent.getExtras();

    if (pushData.has("def")) {
      extras.putString(Constant.APP_DEF_TAB, pushData.optString("def", null));
    }

    Random random = new Random();
    int contentIntentRequestCode = random.nextInt();
    int deleteIntentRequestCode = random.nextInt();

    // Security consideration: To protect the app from tampering, we require that intent filters
    // not be exported. To protect the app from information leaks, we restrict the packages which
    // may intercept the push intents.
    String packageName = context.getPackageName();

    Intent contentIntent = new Intent(ParsePushBroadcastReceiver.ACTION_PUSH_OPEN);
    contentIntent.putExtras(extras);
    contentIntent.setPackage(packageName);

    Intent deleteIntent = new Intent(ParsePushBroadcastReceiver.ACTION_PUSH_DELETE);
    deleteIntent.putExtras(extras);
    deleteIntent.setPackage(packageName);

    PendingIntent pContentIntent =
        PendingIntent.getBroadcast(
            context, contentIntentRequestCode, contentIntent, PendingIntent.FLAG_UPDATE_CURRENT);
    PendingIntent pDeleteIntent =
        PendingIntent.getBroadcast(
            context, deleteIntentRequestCode, deleteIntent, PendingIntent.FLAG_UPDATE_CURRENT);

    // The purpose of setDefaults(Notification.DEFAULT_ALL) is to inherit notification properties
    // from system defaults
    NotificationCompat.Builder parseBuilder = new NotificationCompat.Builder(context);
    parseBuilder
        .setContentTitle(title)
        .setContentText(alert)
        .setTicker(tickerText)
        .setSmallIcon(this.getSmallIconId(context, intent))
        .setLargeIcon(getLargeIcon(context))
        .setContentIntent(pContentIntent)
        .setDeleteIntent(pDeleteIntent)
        .setAutoCancel(true)
        .setDefaults(Notification.DEFAULT_ALL);
    if (alert != null
        && alert.length() > ParsePushBroadcastReceiver.SMALL_NOTIFICATION_MAX_CHARACTER_LIMIT) {
      parseBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(alert));
    }
    return parseBuilder.build();
  }
Ejemplo n.º 7
0
 @Override
 public void handleMessage(Message msg) {
   if (msg.what == 0) { // 初始化数据
     Bundle bundle = new Bundle();
     boolean state = false;
     String data = msg.getData().getString("data");
     GetUploadFileUrlReback result = new Gson().fromJson(data, GetUploadFileUrlReback.class);
     String message = result.getMes();
     Log.e("myLog", "-----message" + message);
     if (result.getCode() == 0) {
       state = true;
     }
     bundle.putBoolean("state", state);
     bundle.putInt("type", 0);
     bundle.putString("msg", message);
     intent.putExtras(bundle);
     intent.setClass(AppSignActivity.this, AppSignResultActivity.class);
     startActivity(intent);
     finish();
   }
   if (msg.what == 1) {
     Bundle bundle = new Bundle();
     boolean state = false;
     String data = msg.getData().getString("data");
     GetUploadFileUrlReback result = new Gson().fromJson(data, GetUploadFileUrlReback.class);
     String message = result.getMes();
     Log.e("myLog", "-----message" + message);
     if (result.getCode() == 0) {
       state = true;
     }
     bundle.putBoolean("state", state);
     bundle.putInt("type", 1);
     bundle.putString("msg", message);
     intent.putExtras(bundle);
     intent.setClass(AppSignActivity.this, AppSignResultActivity.class);
     startActivity(intent);
     finish();
   }
   if (msg.what == 2) {
     if (dialog == null) {
       return;
     }
     dialog.dismiss();
     AMapLocation loc = (AMapLocation) msg.obj;
     Constant.location = loc;
     if (Constant.location.getErrorCode() == 0) { // 定位成功
       wz.setText(Constant.location.getAddress());
     } else {
       wz.setText("定位失败,请点击重试...");
       Toast.makeText(
               AppSignActivity.this,
               "定位失败:" + Constant.location.getErrorInfo(),
               Toast.LENGTH_SHORT)
           .show();
     }
     locationClient.stopLocation();
   }
 }
        @Override
        public void onClick(View v) {
          int id = v.getId();
          switch (id) {
            case R.id.btn_picture_tab_1:
            case R.id.btn_picture_tab_2:
            case R.id.btn_picture_tab_3:
              String tid = tabInfo.getTxtTID();
              if (tid == null || "".equals(tid)) {
                showToastMessage("拍照前請先填入EPC與TID資料");
                return;
              }
              Intent intent = new Intent(getActivity(), CameraViewActivity.class);
              Bundle bundle = new Bundle();
              String tag = (String) getView().findViewById(id).getTag();
              String photoName = tid + "_" + tag + ".jpg";
              Log.v(TAG, "PhotoName: " + photoName);
              bundle.putString("photoName", photoName);
              intent.putExtras(bundle);
              startActivityForResult(intent, PHOTO_RESULT_CODE);
              break;
            case R.id.imgView_tab_1:
            case R.id.imgView_tab_2:
            case R.id.imgView_tab_3:
              String t = (String) getView().findViewById(id).getTag();
              String p = ""; // ���ɦW
              if ("1".equals(t)) {
                Bitmap b = getPhoto(tabInfo.getTxtTID() + "_1.jpg");
                if (b != null) p = tabInfo.getTxtTID() + "_" + t + ".jpg";
                else return;
              } else if ("2".equals(t)) {
                Bitmap b = getPhoto(tabInfo.getTxtTID() + "_2.jpg");
                if (b != null) p = tabInfo.getTxtTID() + "_" + t + ".jpg";
                else return;
              } else if ("3".equals(t)) {
                Bitmap b = getPhoto(tabInfo.getTxtTID() + "_3.jpg");
                if (b != null) p = tabInfo.getTxtTID() + "_" + t + ".jpg";
                else return;
              } else {
                showToastMessage("該tag未定義");
                return;
              }

              Intent in =
                  new Intent(
                      UpdateItemTabFragment3.this.getActivity(), ImageViewScaleActivity.class);
              Bundle b = new Bundle();
              b.putString("photoName", p);
              in.putExtras(b);
              startActivity(in);

              break;
          }
        }
  @Override
  public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {

    if (arg0.getId() == R.id.listView1) {
      Log.d("listview", "position" + position);

      switch (position) {
        case 0:
          alertDialog.dismiss();
          prompt();

          break;

        case 1:
          Bundle basket = new Bundle();
          basket.putInt("position", pos);
          basket.putSerializable("abolist", abolist);
          Intent i = new Intent(ProviderList.this, EditBundle.class);
          i.putExtras(basket);
          startActivity(i);

          break;

        case 2:
          alertDialog.dismiss();
          new delete().execute();

          break;

        case 3:
          String provider = abolist.get(pos).getProvider();
          Log.d("basket", provider);
          Bundle b = new Bundle();
          b.putString("provider", provider);
          Intent intent = new Intent(ProviderList.this, Insert.class);
          intent.putExtras(b);
          startActivity(intent);
      }

    } else {
      Bundle basket = new Bundle();
      basket.putInt("position", position);
      basket.putSerializable("abolist", abolist);
      Intent i = new Intent(ProviderList.this, EditBundle.class);
      i.putExtras(basket);
      startActivity(i);
    }
  }
Ejemplo n.º 10
0
  protected void advanceToNextScreen(final GeocodedAddress g) {
    Assert.assertNotNull(g);

    try {
      final Country nat = this.bundleCreatedWith.getParcelable(EXTRAS_COUNTRY_ID);
      DBManager.addZipCode(SDPostcodeUK_BS7666.this, g.getPostalCode(), nat.COUNTRYCODE);
    } catch (final DataBaseException e) {
      // Log.e(DEBUGTAG, "Error on inserting Postcode", e);
    }

    final int mode = SDPostcodeUK_BS7666.this.bundleCreatedWith.getInt(MODE_SD);
    switch (mode) {
      case MODE_SD_DESTINATION:
        /* Add the StreetNumber to the Bundle to be passed further. */
        SDPostcodeUK_BS7666.this.bundleCreatedWith.putInt(EXTRAS_MODE, EXTRAS_MODE_DIRECT_LATLNG);

        SDPostcodeUK_BS7666.this.bundleCreatedWith.putInt(
            EXTRAS_DESTINATION_LATITUDE_ID, g.getLatitudeE6());
        SDPostcodeUK_BS7666.this.bundleCreatedWith.putInt(
            EXTRAS_DESTINATION_LONGITUDE_ID, g.getLongitudeE6());

        /* Create an Intent to open the Map as a SubActivity. */
        final Intent fetchRouteIntent = new Intent(SDPostcodeUK_BS7666.this, OpenStreetDDMap.class);

        /* Pass the Bundle this Activity was created with further. */
        fetchRouteIntent.putExtras(SDPostcodeUK_BS7666.this.bundleCreatedWith);

        startActivityForResult(fetchRouteIntent, REQUESTCODE_FETCHROUTE);
        break;
      case MODE_SD_WAYPOINT:
      case MODE_SD_SETHOME:
      case MODE_SD_RESOLVE:
        final Intent resultData = new Intent();
        /* Add the StreetNumber to the Bundle to be passed further. */
        SDPostcodeUK_BS7666.this.bundleCreatedWith.putInt(EXTRAS_MODE, EXTRAS_MODE_DIRECT_LATLNG);

        SDPostcodeUK_BS7666.this.bundleCreatedWith.putInt(
            EXTRAS_DESTINATION_LATITUDE_ID, g.getLatitudeE6());
        SDPostcodeUK_BS7666.this.bundleCreatedWith.putInt(
            EXTRAS_DESTINATION_LONGITUDE_ID, g.getLongitudeE6());

        resultData.putExtras(SDPostcodeUK_BS7666.this.bundleCreatedWith);

        SDPostcodeUK_BS7666.this.setResult(SUBACTIVITY_RESULTCODE_CHAINCLOSE_SUCCESS, resultData);
        SDPostcodeUK_BS7666.this.finish();
        break;
    }
  }
 @Override
 public void onClick(View v) {
   switch (v.getId()) {
     case R.id.maps_button:
       // if the maps button is pressed create a bundle
       Bundle b = new Bundle();
       b.putString("previousScreen", "HomeScreen");
       // start the maps activity with the new bundle
       Intent mapIntent = new Intent(this, Map.class);
       mapIntent.putExtras(b);
       startActivity(mapIntent);
       break;
     case R.id.near_me_button:
       // if near me is pressed start the near me activity
       startActivity(new Intent(this, NearMe.class));
       break;
     case R.id.create_cache_button:
       // if create geocache is pressed start the create geocache activity
       startActivity(new Intent(this, CreateGeocache.class));
       break;
     case R.id.connect_button:
       // if connect is pressed start the connect activity
       startActivity(new Intent(this, Connect.class));
       break;
     case R.id.leaderboards_button:
       // if leaderboards is pressed start the leaderboards activity
       startActivity(new Intent(this, Leaderboards.class));
       break;
     case R.id.account_button:
       // if account is pressed start the account activity
       startActivity(new Intent(this, MyAccount.class));
       break;
   }
 }
      @Override
      public void onClick(View view) {
        try {
          long genreId = genres.get(getAdapterPosition()).getId();
          Context context = getActivity();
          Intent mIntent = new Intent(context, PlaylistActivity.class);

          Bundle mBundle = new Bundle();
          mBundle.putLong("id", genreId);
          mBundle.putLong("tagfor", PhoneMediaControl.SongsLoadFor.Genre.ordinal());
          mBundle.putString(
              "albumname", ((TextView) view.findViewById(R.id.title)).getText().toString().trim());
          mBundle.putString("title_one", "All my songs");
          mBundle.putString(
              "title_sec",
              ((TextView) view.findViewById(R.id.details)).getText().toString().trim());

          mIntent.putExtras(mBundle);

          context.startActivity(mIntent);
          ((Activity) context).overridePendingTransition(0, 0);
        } catch (Exception e) {
          Log.i(TAG, Log.getStackTraceString(e));
        }
      }
Ejemplo n.º 13
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    if (id == android.R.id.home) {
      onBackPressed();
      return true;
    } else if (id == R.id.menu_refresh) {
      myWebView.reload();
    }

    // This button will only appear if we have a feed item
    else if (id == R.id.menu_comments && hasFeedItem) {

      // Go to the comments
      Intent intent = new Intent(getApplicationContext(), CommentActivity.class);
      Bundle b = new Bundle();
      b.putParcelable("feedItem", feedItem);
      intent.putExtra("thumbnail", thumbnail);
      intent.putExtras(b);
      startActivity(intent);
    }

    return super.onOptionsItemSelected(item);
  }
Ejemplo n.º 14
0
  @Override
  public RemoteViews getViewAt(final int position) {
    if (position >= this.tasks.size()) {
      return null;
    }
    final Task task = this.tasks.get(position);
    // Get The Task
    final boolean isMinimalistic = WidgetHelper.isMinimalistic(this.mContext, this.widgetId);
    RemoteViews rv =
        new RemoteViews(
            this.mContext.getPackageName(),
            isMinimalistic ? R.layout.widget_row_minimal : R.layout.widget_row);

    // Set the Contents of the Row
    rv =
        WidgetHelper.configureItem(
            rv, task, this.mContext, this.list.getId(), isMinimalistic, this.widgetId);

    // Set the Click–Intent
    // We need to do so, because we can not start the Activity directly from
    // the Service

    final Bundle extras = new Bundle();
    extras.putInt(MainWidgetProvider.EXTRA_TASKID, (int) task.getId());
    final Intent fillInIntent = new Intent(MainWidgetProvider.CLICK_TASK);
    fillInIntent.putExtras(extras);
    rv.setOnClickFillInIntent(R.id.tasks_row, fillInIntent);
    return rv;
  }
  @Override
  public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    Activities activities = Model.load(new Activities(), String.valueOf(id));
    String _id = activities.getId();
    String detail = activities.getDetail();
    String memo = activities.getMemo();
    String picbrand = activities.getPicbrand();
    String picpro = activities.getPicpro();
    String www = activities.getWww();
    String reapp = activities.getReapp();
    String picurl = activities.getPicurl();
    String tgno = activities.getTgno();
    Intent intent = new Intent(getActivity(), ActivityDetails.class);
    Bundle bundle = new Bundle();
    bundle.putString("id", _id);
    bundle.putString("detail", detail);
    bundle.putString("memo", memo);
    bundle.putString("picbrand", picbrand);
    bundle.putString("picpro", picpro);
    bundle.putString("www", www);
    bundle.putString("reapp", reapp);
    bundle.putString("picurl", picurl);
    bundle.putString("tgno", tgno);

    intent.putExtras(bundle);
    startActivity(intent);
  }
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   switch (item.getItemId()) {
     case R.id.addplayer:
       showDialog(CHOOSE_TEAM_ADD_DIALOG);
       return true;
     case R.id.removeplayer:
       showDialog(CHOOSE_TEAM_REMOVE_DIALOG);
       return true;
     case R.id.newgame:
       showDialog(NEW_GAME_DIALOG);
       return true;
     case R.id.stats:
       Intent intent = new Intent(NAQTScoresheet.this, StatsScreen.class);
       Bundle bundle = new Bundle();
       bundle.putSerializable("game", this.game);
       intent.putExtras(bundle);
       startActivity(intent);
       return true;
     case R.id.savegame:
       this.saveGame();
       return true;
     case R.id.loadgame:
       showDialog(LOAD_GAME_DIALOG);
       return true;
     case R.id.upload_game:
       showDialog(UPLOAD_GAME_DIALOG);
       return true;
     default:
       return super.onOptionsItemSelected(item);
   }
 }
  /*
   * Customized activity finish. Ensures the notification is in sync and cancels
   * any scheduled reminders (as the user has interrupted the app.
   */
  private void myFinish() {
    if (Log.DEBUG) Log.v("myFinish()");

    if (inbox) {
      ManageNotification.clearAll(getApplicationContext());
    } else {

      // Start a service that will update the notification in the status bar
      Intent i = new Intent(getApplicationContext(), SmsPopupUtilsService.class);
      i.setAction(SmsPopupUtilsService.ACTION_UPDATE_NOTIFICATION);

      // Convert current message to bundle
      i.putExtras(message.toBundle());

      // We need to know if the user is replying - if so, the entire thread id should
      // be ignored when working out the message tally in the notification bar.
      // We can't rely on the system database as it may take a little while for the
      // reply intent to fire and load up the messaging up (after which the messages
      // will be marked read in the database).
      i.putExtra(SmsMmsMessage.EXTRAS_REPLYING, replying);

      // Start the service
      SmsPopupUtilsService.beginStartingService(SmsPopupActivity.this.getApplicationContext(), i);
    }

    // Cancel any reminder notifications
    ReminderReceiver.cancelReminder(getApplicationContext());

    // Finish up the activity
    finish();
  }
 /**
  * startActivity with bundle
  *
  * @param clazz
  * @param bundle
  */
 protected void readyGo(Class<?> clazz, Bundle bundle) {
   Intent intent = new Intent(this, clazz);
   if (null != bundle) {
     intent.putExtras(bundle);
   }
   startActivity(intent);
 }
 /**
  * Device Connectにイベントを送信する.
  *
  * @param event イベントパラメータ
  * @param bundle パラメータ
  * @return 送信成功の場合true、アクセストークンエラーの場合はfalseを返す。
  */
 public final boolean sendEvent(final Event event, final Bundle bundle) {
   Intent intent = EventManager.createEventMessage(event);
   Bundle original = intent.getExtras();
   original.putAll(bundle);
   intent.putExtras(original);
   return sendEvent(intent, event.getAccessToken());
 }
Ejemplo n.º 20
0
    @Override
    protected Intent doInBackground(String... params) {
      final String userName = mEmailView.getText().toString();
      final String userPass = mPasswordView.getText().toString();

      final String accountType = getIntent().getStringExtra(ARG_ACCOUNT_TYPE);

      Log.d(TAG, "Started authenticating");

      String authtoken = null;
      Bundle data = new Bundle();
      try {
        authtoken = sServerAuthenticate.userSignIn(userName, userPass, mAuthTokenType);

        data.putString(AccountManager.KEY_ACCOUNT_NAME, userName);
        data.putString(AccountManager.KEY_ACCOUNT_TYPE, accountType);
        data.putString(AccountManager.KEY_AUTHTOKEN, authtoken);
        data.putString(PARAM_USER_PASS, userPass);

      } catch (Exception e) {
        data.putString(KEY_ERROR_MESSAGE, e.getMessage());
      }

      final Intent res = new Intent();
      res.putExtras(data);
      return res;
    }
Ejemplo n.º 21
0
 /**
  * Open new activity by action string and bring some params
  *
  * @param action
  * @param pBundle
  */
 protected void openActivity(String action, Bundle pBundle) {
   Intent intent = new Intent(action);
   if (pBundle != null) {
     intent.putExtras(pBundle);
   }
   startActivity(intent);
 }
Ejemplo n.º 22
0
 /**
  * Open new activity and bring some params
  *
  * @param pClass
  * @param bundle
  */
 protected void openActivity(Class<?> pClass, Bundle bundle) {
   Intent intent = new Intent(this, pClass);
   if (bundle != null) {
     intent.putExtras(bundle);
   }
   startActivity(intent);
 }
Ejemplo n.º 23
0
  @Override
  protected void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);

    Cursor note = extObjDB.fetchNote(id);
    startManagingCursor(note);
    ObjSource s;
    int resource_id = note.getInt(note.getColumnIndexOrThrow(ExternObjDB.KEY_RESRC_ID));
    if (resource_id == -1) {
      // obj from sdcard
      String path = note.getString(note.getColumnIndexOrThrow(ExternObjDB.KEY_PATH));
      s = new ObjFromSDcard(path);
    } else {
      // obj from resource
      s = new ObjFromResource(resource_id);
    }
    s.Title = note.getString(note.getColumnIndexOrThrow(ExternObjDB.KEY_TITLE));
    s.Info = note.getString(note.getColumnIndexOrThrow(ExternObjDB.KEY_INFO));
    s.ID = note.getInt(note.getColumnIndexOrThrow(ExternObjDB.KEY_ROWID));
    Bundle bundle = new Bundle();

    bundle.putSerializable(ObjSource.TITLE, s);

    Intent mIntent = new Intent();
    mIntent.putExtras(bundle);
    setResult(RESULT_OK, mIntent);
    finish();
  }
Ejemplo n.º 24
0
  private void writeFrequency() {
    // get the text entered in edit box
    String text = mUserText.getText().toString();
    try {
      int iFreq = Integer.parseInt(text);
      Float validFreq = UpdateFrequency(iFreq);
      if (validFreq != 0) {
        // reset the text in edit box for the next entry
        mUserText.setText(null);

        Bundle bundle = new Bundle();
        bundle.putFloat(FREQ_VALUE, validFreq);
        Intent result = new Intent();
        result.putExtras(bundle);
        setResult(RESULT_OK, result);
        finish();

      } else {
        new AlertDialog.Builder(this)
            .setIcon(android.R.drawable.ic_dialog_alert)
            .setMessage("Enter valid frequency!!")
            .setNegativeButton(android.R.string.ok, null)
            .show();
        mUserText.setText(null);
      }
    } catch (NumberFormatException nfe) {
      if (DBG) Log.d(TAG, "NumberFormatException:" + nfe.getMessage());
      new AlertDialog.Builder(this)
          .setIcon(android.R.drawable.ic_dialog_alert)
          .setMessage("Enter valid number!!")
          .setNegativeButton(android.R.string.ok, null)
          .show();
      mUserText.setText(null);
    }
  }
Ejemplo n.º 25
0
 public void back(View view) {
   Intent i = new Intent(getApplicationContext(), ListaURL.class);
   Bundle b = new Bundle();
   b.putStringArrayList("lista", lista);
   i.putExtras(b);
   startActivity(i);
 }
 public void handleIntent(Intent intent) {
   if (intent == null) {
     return;
   }
   try {
     Intent firstIntent = getIntent();
     int type = intent.getIntExtra("ntype", 0);
     ;
     switch (type) {
       case ENotification.F_TYPE_PUSH:
         if (null != mBrowser) {
           String data = intent.getStringExtra("data");
           String pushMessage = intent.getStringExtra("message");
           SharedPreferences sp =
               getSharedPreferences(PushReportConstants.PUSH_DATA_SHAREPRE, Context.MODE_PRIVATE);
           Editor editor = sp.edit();
           editor.putString(PushReportConstants.PUSH_DATA_SHAREPRE_DATA, data);
           editor.putString(PushReportConstants.PUSH_DATA_SHAREPRE_MESSAGE, pushMessage);
           editor.commit();
           mBrowser.pushNotify();
         }
         break;
       case ENotification.F_TYPE_USER:
         break;
       case ENotification.F_TYPE_SYS:
         break;
       default:
         getIntentData(intent);
         firstIntent.putExtras(intent);
         break;
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
 /**
  * startActivityForResult with bundle
  *
  * @param clazz
  * @param requestCode
  * @param bundle
  */
 protected void readyGoForResult(Class<?> clazz, int requestCode, Bundle bundle) {
   Intent intent = new Intent(this, clazz);
   if (null != bundle) {
     intent.putExtras(bundle);
   }
   startActivityForResult(intent, requestCode);
 }
Ejemplo n.º 28
0
    /**
     * React to tap events on Map by showing an appropriate detail activity
     *
     * @see com.google.android.maps.ItemizedOverlay#onTap(com.google.android.maps.GeoPoint,
     *     com.google.android.maps.MapView)
     */
    @Override
    public boolean onTap(GeoPoint p, MapView mvMap1) {
      long lat = p.getLatitudeE6();
      long lon = p.getLongitudeE6();

      long rowid = -1;
      JobsCursor c = db.getJobs(JobsCursor.SortBy.title);
      for (int i = 0; i < c.getCount(); i++) {
        if (Math.abs(c.getColLatitude() - lat) < 1000
            && Math.abs(c.getColLongitude() - lon) < 1000) {
          rowid = c.getColJobsId();
          break;
        } else {
          c.moveToNext();
        }
      }

      if (0 > rowid) {
        return false;
      }

      Bundle b = new Bundle();
      b.putLong("_id", rowid);
      Intent i = new Intent(MicroJobs.this, MicroJobsDetail.class);
      i.putExtras(b);
      startActivity(i);

      return true;
    }
Ejemplo n.º 29
0
 public void showText(String filename) {
   Intent showIt = new Intent(this, TipsAndTricksShowTextView.class);
   Bundle toShow = new Bundle();
   toShow.putString("tat_show_file", filename);
   showIt.putExtras(toShow);
   startActivity(showIt);
 }
Ejemplo n.º 30
0
	// 长按菜单响应函数
	@Override
	public boolean onContextItemSelected(MenuItem item) {
		int itemIndex = item.getItemId();
		AdapterView.AdapterContextMenuInfo menuInfo = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
		View v = menuInfo.targetView;
		switch (itemIndex) {
			case R.id.menu_unrss://取消订阅
				default:
				//显示ProgressDialog  
	            progressDialog = ProgressDialog.show(MyFavActivity.this, "删除收藏", "正在删除收藏中,请稍候", true, false);
				TextView tvId=(TextView)v.findViewById(R.id.recommend_text_id);
				int contentId=Integer.valueOf(tvId.getText().toString());
				FavList.EnumContentType contentType=FavList.EnumContentType.Blog;
				
				try{
					FavListHelper.RemoveFav(contentId,contentType,getApplicationContext());
					Toast.makeText(getApplicationContext(), R.string.unfav_succ, Toast.LENGTH_SHORT).show();
				}catch(Exception ex){
					Toast.makeText(getApplicationContext(), R.string.unfav_fail, Toast.LENGTH_SHORT).show();
				}
				progressDialog.dismiss();
				// 广播
				Intent intent = new Intent();
				Bundle bundle = new Bundle();
				bundle.putInt("contentId",contentId);
				bundle.putInt("contentType", contentType.ordinal());
				bundle.putBoolean("isfav", false);
				intent.putExtras(bundle);
				intent.setAction("android.cnblogs.com.update_favlist");
				sendBroadcast(intent);
		}
		return super.onContextItemSelected(item);
	}