示例#1
1
文件: ax.java 项目: ZoneMo/test
 public final void onClick(View paramView) {
   m.dZN.j(10108, "1");
   Intent localIntent = new Intent(this.gZI.aal(), SelectContactUI.class);
   localIntent.putExtra("Contact_GroupFilter_Type", "@micromsg.qq.com");
   localIntent.putExtra("List_Type", 0);
   this.gZI.aal().startActivity(localIntent);
 }
  public void onPreviewFrame(byte[] data, Camera camera) {
    Camera.Parameters parameters = camera.getParameters();
    Camera.Size size = parameters.getPreviewSize();

    Image barcode = new Image(size.width, size.height, "Y800");
    barcode.setData(data);

    int result = mScanner.scanImage(barcode);

    if (result != 0) {
      mCamera.cancelAutoFocus();
      mCamera.setPreviewCallback(null);
      mCamera.stopPreview();
      mPreviewing = false;
      SymbolSet syms = mScanner.getResults();
      for (Symbol sym : syms) {
        String symData = sym.getData();
        if (!TextUtils.isEmpty(symData)) {
          Intent dataIntent = new Intent();
          dataIntent.putExtra(SCAN_RESULT, symData);
          dataIntent.putExtra(SCAN_RESULT_TYPE, sym.getType());
          setResult(Activity.RESULT_OK, dataIntent);
          finish();
          break;
        }
      }
    }
  }
  @Override
  public void buildContextMenu(ContextMenu menu, XbmcRequester requester) {

    //		intent.putExtra("FOLDER", getFilePath());
    //
    //		intent.putExtra("MEDIA_TYPE", getPlaylistId());
    //
    //		intent.putExtra("TYPE", getType());
    //
    MenuItem playItem = menu.add(R.string.play);
    Intent intent = new Intent();
    intent.putExtra("WHERECLAUSE", "idEpisode = " + idEpisode);
    intent.putExtra("EXEC_MODE", execModeEnum.Play);
    playItem.setIntent(intent);
    playItem.setOnMenuItemClickListener(new playVideoSelectionMenuItemClickListener());
    //
    playItem = menu.add(R.string.enqueue);
    Intent intent2 = new Intent();
    intent2.putExtra("EXEC_MODE", execModeEnum.Enqueue);
    intent2.putExtra("WHERECLAUSE", "idEpisode = " + idEpisode);

    playItem.setIntent(intent2);
    playItem.setOnMenuItemClickListener(new playVideoSelectionMenuItemClickListener());

    playItem = menu.add(R.string.clear_playlist);
    playItem.setOnMenuItemClickListener(new ClearPlaylistMenuItemClickListener());
  }
  /**
   * Set up English voice search button in the widget
   *
   * @param context
   * @param remoteView
   */
  private void setupEnglishVoiceSearch(Context context, RemoteViews remoteView) {
    if (Device.DEVICE_TYPE.equals(Device.DeviceType.Google_TV)) {
      remoteView.setViewVisibility(R.id.eng_voice, View.INVISIBLE);
    } else {
      // ---this intent points to activity that should handle results---
      Intent activityIntent2 = new Intent(_actionVoiceSearch);
      PendingIntent resultsPendingIntent2 =
          PendingIntent.getService(context, 0, activityIntent2, 0);

      // ---this intent calls the English voice recognition---
      Intent englishVoiceIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
      englishVoiceIntent.putExtra(
          RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
      englishVoiceIntent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 2);
      englishVoiceIntent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Speak your search");
      englishVoiceIntent.putExtra(
          RecognizerIntent.EXTRA_RESULTS_PENDINGINTENT, resultsPendingIntent2);

      // ---wraps speech recognition intent---
      PendingIntent englishPendingIntent =
          PendingIntent.getActivity(
              context,
              randomGenerator.nextInt(100),
              englishVoiceIntent,
              PendingIntent.FLAG_CANCEL_CURRENT);
      remoteView.setOnClickPendingIntent(R.id.eng_voice, englishPendingIntent);
    }
  }
 public void onChannelSelected(long paramLong, String paramString) {
   Intent localIntent = new Intent();
   localIntent.putExtra("channel", paramString);
   localIntent.putExtra("channel_id", paramLong);
   setResult(-1, localIntent);
   finish();
 }
 private boolean handleContextItemSelected(MenuItem menu, int position) {
   if (position >= mVideoAdapter.getCount()) return false;
   MediaWrapper media = mVideoAdapter.getItem(position);
   if (media == null) return false;
   switch (menu.getItemId()) {
     case R.id.video_list_play_from_start:
       playVideo(media, true);
       return true;
     case R.id.video_list_play_audio:
       playAudio(media);
       return true;
     case R.id.video_list_info:
       Activity activity = getActivity();
       if (activity instanceof MainActivity)
         ((MainActivity) activity)
             .showSecondaryFragment(SecondaryActivity.MEDIA_INFO, media.getLocation());
       else {
         Intent i = new Intent(activity, SecondaryActivity.class);
         i.putExtra("fragment", "mediaInfo");
         i.putExtra("param", media.getLocation());
         startActivity(i);
       }
       return true;
     case R.id.video_list_delete:
       Snackbar.make(getView(), getString(R.string.file_deleted), Snackbar.LENGTH_LONG)
           .setAction(android.R.string.cancel, mCancelDeleteMediaListener)
           .show();
       Message msg = mDeleteHandler.obtainMessage(DELETE_MEDIA, position, 0);
       mDeleteHandler.sendMessageDelayed(msg, DELETE_DURATION);
       return true;
   }
   return false;
 }
  public void onClickShare(View view) {
    String textToSend =
        mBufferTextView
            .getText()
            .toString(); // (mShowDataInHexFormat ? mHexSpanBuffer : mAsciiSpanBuffer).toString();

    if (textToSend != null && textToSend.length() > 0) {

      Intent sendIntent = new Intent();
      sendIntent.setAction(Intent.ACTION_SEND);
      sendIntent.putExtra(Intent.EXTRA_TEXT, textToSend);
      sendIntent.putExtra(
          Intent.EXTRA_SUBJECT,
          getString(R.string.uart_share_subject)); // subject will be used if sent to an email app
      sendIntent.setType(
          "text/*"); // Note: don't use text/plain because dropbox will not appear as destination
      // startActivity(sendIntent);
      startActivity(
          Intent.createChooser(
              sendIntent,
              getResources()
                  .getText(R.string.uart_sharechooser_title))); // Always show the app-chooser
    } else {
      new AlertDialog.Builder(this)
          .setMessage(getString(R.string.uart_share_empty))
          .setPositiveButton(android.R.string.ok, null)
          .show();
    }
  }
示例#8
0
  /**
   * Receive a new geoloc sharing invitation
   *
   * @param session Geoloc sharing session
   */
  public void receiveGeolocSharingInvitation(GeolocTransferSession session) {
    if (logger.isActivated()) {
      logger.info("Receive geoloc sharing invitation from " + session.getRemoteContact());
    }

    // Extract number from contact
    String number = PhoneUtils.extractNumberFromUri(session.getRemoteContact());

    // Add session in the list
    GeolocSharingImpl sessionApi = new GeolocSharingImpl(session);
    GeolocSharingServiceImpl.addGeolocSharingSession(sessionApi);

    // Broadcast intent related to the received invitation
    Intent intent = new Intent(GeolocSharingIntent.ACTION_NEW_INVITATION);
    intent.addFlags(Intent.FLAG_EXCLUDE_STOPPED_PACKAGES);
    intent.putExtra(GeolocSharingIntent.EXTRA_CONTACT, number);
    intent.putExtra(GeolocSharingIntent.EXTRA_DISPLAY_NAME, session.getRemoteDisplayName());
    intent.putExtra(GeolocSharingIntent.EXTRA_SHARING_ID, session.getSessionID());
    AndroidFactory.getApplicationContext().sendBroadcast(intent);

    // Notify geoloc sharing invitation listeners
    synchronized (lock) {
      final int N = listeners.beginBroadcast();
      for (int i = 0; i < N; i++) {
        try {
          listeners.getBroadcastItem(i).onNewGeolocSharing(session.getSessionID());
        } catch (Exception e) {
          if (logger.isActivated()) {
            logger.error("Can't notify listener", e);
          }
        }
      }
      listeners.finishBroadcast();
    }
  }
示例#9
0
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   Intent intent;
   boolean consumed;
   mDrawerLayout.closeDrawer(Gravity.START, false);
   switch (item.getItemId()) {
     case R.id.menu_item_Ertraege:
       intent = new Intent(this, ActivityActions.class);
       intent.putExtra(ACTION, (Parcelable) Action.EditErtraege);
       startActivity(intent);
       consumed = true;
       break;
     case R.id.awlib_menu_item_hilfe:
       intent = new Intent(this, AWWebViewActivity.class);
       intent.putExtra(ID, "hilfe_finanzuebersicht.html");
       startActivity(intent);
       consumed = true;
       break;
     case R.id.menu_item_show_AllBuchungRegelm:
       intent = new Intent(this, ActivityCash.class);
       intent.putExtra(ACTION, (Parcelable) Action.ShowRegelmBuchungen);
       startActivity(intent);
       consumed = true;
       break;
     default:
       consumed = super.onOptionsItemSelected(item);
       break;
   }
   return consumed;
 }
  public void prevactivity_skipping(View view) {

    if (skip_pressed == true) {
      SharedPreferences.Editor editor = sharedpreferences.edit();
      editor.putString("Radiobuttonteaming1", "NA");
      editor.putString("Radiobuttonteaming2", "NA");
      editor.putString("Teamingskipped", "skipped");
      editor.commit();
      Intent intent = new Intent(this, RecordSkipping.class);
      intent.putExtra("activity", "prevskipping");
      intent.putExtra("TesterName", user_name);
      startActivity(intent);
    } else {
      rgrp1 = (RadioGroup) findViewById(R.id.rgrp1);
      radioButtonID1 = rgrp1.getCheckedRadioButtonId();

      rgrp2 = (RadioGroup) findViewById(R.id.rgrp2);
      radioButtonID2 = rgrp2.getCheckedRadioButtonId();
      //            if (radioButtonID1 == -1 || radioButtonID2 == -1)
      //                Toast.makeText(getBaseContext(), "Please select one option from each type
      // !", Toast.LENGTH_LONG).show();
      //            else {
      SharedPreferences.Editor editor = sharedpreferences.edit();
      editor.putInt("teamingidround1", radioButtonID1);
      editor.putInt("teamingidround2", radioButtonID2);
      editor.putString("Teamingskipped", "notskipped");
      editor.commit();
      Intent intent = new Intent(this, RecordSkipping.class);
      intent.putExtra("activity", "prevskipping");
      intent.putExtra("TesterName", user_name);
      startActivity(intent);
      // }
    }
  }
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      case R.id.info:
        View infoView =
            getActivity().getLayoutInflater().inflate(R.layout.dialog_channel_info, null);
        TextView topicView = (TextView) infoView.findViewById(R.id.topic);
        topicView.setText(mChannel.getTopic());
        Linkify.addLinks(topicView, Linkify.WEB_URLS);
        // FIXME: modes, etc...
        new AlertDialog.Builder(getActivity())
            .setTitle(getString(R.string.info_format, mChannel.getName()))
            .setView(infoView)
            .setPositiveButton(android.R.string.ok, null)
            .show();
        return true;

      case R.id.members:
        Intent intent = new Intent(getActivity(), MemberListActivity.class);
        intent.putExtra(ARG_CONNECTION_ID, getArguments().getLong(ARG_CONNECTION_ID));
        intent.putExtra(ARG_BUFFER_ID, getArguments().getLong(ARG_BUFFER_ID));
        startActivity(intent);
        return true;

      case R.id.part_channel:
        mChannel.part();
        return true;
    }
    return super.onOptionsItemSelected(item);
  }
    @Override
    public boolean onTouch(View v, MotionEvent event) {
      switch (event.getAction()) {
        case MotionEvent.ACTION_DOWN:
          return true;
        case MotionEvent.ACTION_UP:
          if (event.getRawX()
              >= (v.getRight() - ((TextView) v).getCompoundDrawables()[2].getBounds().width())) {
            // 响应右侧图标点击事件
            Intent intent = new Intent(context, TerminalSubmitActivity.class);
            intent.putExtra("operate", "modify");
            intent.putExtra("terminalid", ((String) v.getTag()).split(",")[0]);
            ((Activity) context).startActivityForResult(intent, 0);
          } else {
            // 响应自己的点击事件
            if (!v.performClick()) {
              // 响应ListView点击事件
              int position = Integer.parseInt(((String) v.getTag()).split(",")[1]) + 1;
              listView.performItemClick(
                  listView.getChildAt(position - listView.getFirstVisiblePosition()),
                  position,
                  listView.getItemIdAtPosition(position));
            }
          }
      }

      return false;
    }
  @Override
  public void playTrack(ArrayList<Track> trackList, int selectedTrack) {

    if (mTwoPane) {

      // Create the fragment and show it as a dialog
      PlaybackFragment playbackFragment = new PlaybackFragment();

      Bundle b = new Bundle();
      b.putString(Utils.ARTIST_NAME, mArtistName);
      b.putParcelableArrayList(Utils.TRACK_LIST, trackList);
      b.putInt(Utils.SELECTED_TRACK_POSITION, selectedTrack);

      playbackFragment.setArguments(b);

      playbackFragment.show(getSupportFragmentManager(), PLAYBACK_FRAGMENT_TAG);

    } else {

      Intent playbackIntent = new Intent(MainActivity.this, PlaybackActivity.class);
      playbackIntent.putParcelableArrayListExtra(Utils.TRACK_LIST, trackList);
      playbackIntent.putExtra(Utils.SELECTED_TRACK_POSITION, selectedTrack);
      playbackIntent.putExtra(Utils.ARTIST_NAME, mArtistName);
      startActivity(playbackIntent);
    }
  }
  @Override
  public void displayTracks(String spotifyID, String artistName) {

    if (mTwoPane) {

      Bundle b = new Bundle();
      b.putString(Utils.SPOTIFY_ID, spotifyID);
      b.putString(Utils.ARTIST_NAME, artistName);

      mArtistName = artistName;

      mTrackFragment = new TrackFragment();
      mTrackFragment.setArguments(b);

      getSupportFragmentManager()
          .beginTransaction()
          .replace(R.id.track_fragment_container, mTrackFragment, TRACK_FRAGMENT_TAG)
          .commit();

    } else {

      Intent trackIntent = new Intent(MainActivity.this, TrackActivity.class);
      trackIntent.putExtra(Utils.ARTIST_NAME, artistName);
      trackIntent.putExtra(Utils.SPOTIFY_ID, spotifyID);
      trackIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
      startActivity(trackIntent);
    }
  } // displayTracks
 @Override
 public void onClick(View view) {
   switch (view.getId()) {
     case R.id.layout_trans_btn_back:
       finish();
       break;
     case R.id.layout_trans_btn_cart:
       Intent intent2 = new Intent(this, CarsActivity.class);
       intent2.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
       // intent2.putExtra(MainActivity.SWITCH_INDEX, 2);
       startActivity(intent2);
       break;
     case R.id.product_details_customer_service:
       break;
     case R.id.product_details_favourite:
       break;
     case R.id.product_details_addcart:
       showSkuPopupWindow(0);
       ActivityUtils.startScaleAnimotion(mScrollView, 0.85f, 0.85f);
       break;
     case R.id.product_details_buy_now:
       showSkuPopupWindow(1);
       ActivityUtils.startScaleAnimotion(mScrollView, 0.85f, 0.85f);
       break;
     case R.id.layout_product_comment_more:
       Intent intent4 = new Intent(this, CommentListActivity.class);
       intent4.putExtra("commentList", (Serializable) product.getCommentList());
       intent4.putExtra("point", product.getCommentPoint());
       intent4.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
       startActivity(intent4);
       break;
     default:
       break;
   }
 }
示例#16
0
  static void answerfix(Context context) {
    try {
      Intent buttonDown = new Intent(Intent.ACTION_MEDIA_BUTTON);
      buttonDown.putExtra(
          Intent.EXTRA_KEY_EVENT, new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_HEADSETHOOK));
      context.sendOrderedBroadcast(buttonDown, "android.permission.CALL_PRIVILEGED");

      // froyo and beyond trigger on buttonUp instead of buttonDown
      Intent buttonUp = new Intent(Intent.ACTION_MEDIA_BUTTON);
      buttonUp.putExtra(
          Intent.EXTRA_KEY_EVENT, new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_HEADSETHOOK));
      context.sendOrderedBroadcast(buttonUp, "android.permission.CALL_PRIVILEGED");

      Intent headSetUnPluggedintent = new Intent(Intent.ACTION_HEADSET_PLUG);
      headSetUnPluggedintent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
      headSetUnPluggedintent.putExtra("state", 1); // 0 = unplugged 1 =
      // Headset with
      // microphone 2 =
      // Headset without
      // microphone
      headSetUnPluggedintent.putExtra("name", "Headset");
      // TODO: Should we require a permission?
      context.sendOrderedBroadcast(headSetUnPluggedintent, null);

    } catch (Exception e) {

    }
  }
  /**
   * Launch the SipCallOptionHandler, which is the next step(*) in the outgoing-call sequence after
   * the outgoing call broadcast is complete.
   *
   * <p>(*) We now know exactly what phone number we need to dial, so the next step is for the
   * SipCallOptionHandler to decide which Phone type (SIP or PSTN) should be used. (Depending on the
   * user's preferences, this decision may also involve popping up a dialog to ask the user to
   * choose what type of call this should be.)
   *
   * @param context used for the startActivity() call
   * @param intent the intent from the previous step of the outgoing-call sequence. Normally this
   *     will be the NEW_OUTGOING_CALL broadcast intent that came in to the OutgoingCallReceiver,
   *     although it can also be the original ACTION_CALL intent that started the whole sequence (in
   *     cases where we don't do the NEW_OUTGOING_CALL broadcast at all, like for emergency numbers
   *     or SIP addresses).
   * @param uri the data URI from the original CALL intent, presumably either a tel: or sip: URI.
   *     For tel: URIs, note that the scheme-specific part does *not* necessarily have separators
   *     and keypad letters stripped (so we might see URIs like "tel:(650)%20555-1234" or
   *     "tel:1-800-GOOG-411" here.)
   * @param number the actual number (or SIP address) to dial. This is guaranteed to be either a
   *     PSTN phone number with separators stripped out and keypad letters converted to digits (like
   *     "16505551234"), or a raw SIP address (like "*****@*****.**").
   */
  private void startSipCallOptionHandler(Context context, Intent intent, Uri uri, String number) {
    if (VDBG) {
      Log.i(TAG, "startSipCallOptionHandler...");
      Log.i(TAG, "- intent: " + intent);
      Log.i(TAG, "- uri: " + uri);
      Log.i(TAG, "- number: " + number);
    }

    // Create a copy of the original CALL intent that started the whole
    // outgoing-call sequence.  This intent will ultimately be passed to
    // CallController.placeCall() after the SipCallOptionHandler step.

    Intent newIntent = new Intent(Intent.ACTION_CALL, uri);
    newIntent.putExtra(EXTRA_ACTUAL_NUMBER_TO_DIAL, number);
    newIntent.putExtra(SUBSCRIPTION_KEY, mSubscription);
    PhoneUtils.checkAndCopyPhoneProviderExtras(intent, newIntent);

    // Finally, launch the SipCallOptionHandler, with the copy of the
    // original CALL intent stashed away in the EXTRA_NEW_CALL_INTENT
    // extra.

    Intent selectPhoneIntent = new Intent(ACTION_SIP_SELECT_PHONE, uri);
    selectPhoneIntent.setClass(context, SipCallOptionHandler.class);
    selectPhoneIntent.putExtra(EXTRA_NEW_CALL_INTENT, newIntent);
    selectPhoneIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    if (DBG)
      Log.v(TAG, "startSipCallOptionHandler(): " + "calling startActivity: " + selectPhoneIntent);
    context.startActivity(selectPhoneIntent);
    // ...and see SipCallOptionHandler.onCreate() for the next step of the sequence.
  }
 private void switchToConversation(
     Conversation conversation, String text, String nick, boolean pm, boolean newTask) {
   Intent viewConversationIntent = new Intent(this, ConversationActivity.class);
   viewConversationIntent.setAction(Intent.ACTION_VIEW);
   viewConversationIntent.putExtra(ConversationActivity.CONVERSATION, conversation.getUuid());
   if (text != null) {
     viewConversationIntent.putExtra(ConversationActivity.TEXT, text);
   }
   if (nick != null) {
     viewConversationIntent.putExtra(ConversationActivity.NICK, nick);
     viewConversationIntent.putExtra(ConversationActivity.PRIVATE_MESSAGE, pm);
   }
   viewConversationIntent.setType(ConversationActivity.VIEW_CONVERSATION);
   if (newTask) {
     viewConversationIntent.setFlags(
         viewConversationIntent.getFlags()
             | Intent.FLAG_ACTIVITY_NEW_TASK
             | Intent.FLAG_ACTIVITY_SINGLE_TOP);
   } else {
     viewConversationIntent.setFlags(
         viewConversationIntent.getFlags() | Intent.FLAG_ACTIVITY_CLEAR_TOP);
   }
   startActivity(viewConversationIntent);
   finish();
 }
示例#19
0
  public void writeReview(View view) {
    Intent intent = new Intent(this, WriteReviewActivity.class);
    intent.putExtra("previous", "venue");
    intent.putExtra("venue", receivedVenue);

    startActivity(intent);
  }
        public void handleMessage(Message msg) {
          switch (msg.what) {
            case 1:
              pb.setVisibility(4);
              isRun = false;
              image.setImageBitmap(bm);

              break;
            case 3:
              progressDialog.dismiss();
              mThread = null;
              Toast.makeText(context, "Convert Success!!", Toast.LENGTH_SHORT).show();
              File file = new File(root_Path2 + MyApplication.folder_path + ".pdf");
              Intent mailIntent = new Intent(Intent.ACTION_SEND);
              mailIntent.putExtra(Intent.EXTRA_SUBJECT, "TinyScan");
              mailIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
              if (file.getName().endsWith(".gz")) {
                mailIntent.setType("application/x-gzip"); // 如果是gz使用gzip的mime
              } else if (file.getName().endsWith(".txt")) {
                mailIntent.setType("text/plain"); // 纯文本则用text/plain的mime
              } else {
                mailIntent.setType("application/octet-stream"); // 其他的均使用流当做二进制数据来发送
              }
              startActivity(Intent.createChooser(mailIntent, "Export"));
              break;
            default:
              break;
          }
          super.handleMessage(msg);
        }
 private void startHelp() {
   // Launch app help activity
   Intent intent = new Intent(this, CommonHelpActivity.class);
   intent.putExtra("title", getString(R.string.uart_help_title));
   intent.putExtra("help", "uart_help.html");
   startActivity(intent);
 }
 private void gotoChat() {
   Intent mIntent = new Intent(CustomerDetailActivity.this, DummyChatActivity.class);
   mIntent.putExtra("deviceId", device_id);
   mIntent.putExtra("fromDeviceInfo", mFromDeviceInfo);
   mIntent.putExtra("customerName", mCustomerName);
   startActivity(mIntent);
 }
 @Override
 public void onInfoWindowClick(Marker marker) {
   if (marker.getTitle().equals(getString(R.string.Marker_NotRegistered))) {
     // 未登録のマーカーであれば情報を追加する
     // 地点情報追加画面に遷移
     Intent intent = new Intent(this, AddPlaceActivity.class);
     intent.putExtra("latitude", marker.getPosition().latitude);
     intent.putExtra("longitude", marker.getPosition().longitude);
     startActivityForResult(intent, 123);
   }
   PlaceInfo pInfo = new PlaceInfo();
   pInfo.mMarker = marker;
   if (mPlaceInfoList.contains(pInfo)) {
     // マーカーの詳細情報画面を開く
     Intent intent = new Intent(this, DisplayDetailActivity.class);
     PlaceInfo pClone = mPlaceInfoList.get(mPlaceInfoList.indexOf(pInfo)).getSeralizable();
     intent.putExtra("placeInfo", pClone);
     try {
       startActivity(intent);
     } catch (RuntimeException e) {
       Toast t = Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG);
       t.show();
       e.getStackTrace();
     }
   }
 }
示例#24
0
  private void processOfflineMessages() {
    Log.i(LOG_TAG, "Begin retrieval of offline messages from server");

    OfflineMessageManager offlineMessageManager = new OfflineMessageManager(con);
    try {
      if (!offlineMessageManager.supportsFlexibleRetrieval()) {
        Log.d(LOG_TAG, "Offline messages not supported");
        return;
      }

      List<Message> msgs = offlineMessageManager.getMessages();
      for (Message msg : msgs) {
        Intent intent =
            new Intent(MessageService.ACTION_MESSAGE_RECEIVED, null, context, MessageService.class);
        intent.putExtra(
            MessageService.EXTRA_DATA_NAME_FROM, StringUtils.parseBareAddress(msg.getFrom()));
        intent.putExtra(MessageService.EXTRA_DATA_NAME_MESSAGE_BODY, msg.getBody());

        context.startService(intent);
      }

      offlineMessageManager.deleteMessages();
    } catch (Exception e) {
      Log.e(LOG_TAG, "handle offline messages error ", e);
    }

    Log.i(LOG_TAG, "End of retrieval of offline messages from server");
  }
示例#25
0
 public void Alarm(View view) {
   String str = "Long Jumping (Girls)";
   Intent it = new Intent("android.intent.action.SETNOTIFICATION");
   it.putExtra("event", str);
   it.putExtra("address", "android.intent.action.LONGJUMPINGGIRLS");
   startActivity(it);
 }
 @Override
 public void onReceive(Context context, Intent intent) {
   // Log.v(TAG, "Receiving: " + intent.getAction());
   if (intent.getAction().equals(OppProbe.getStatusAction(probeName))) {
     OppProbe.Status status = new OppProbe.Status(intent.getExtras());
     if (probeName.equals(status.getName())) {
       Log.i(TAG, "Is a status action for " + probeName);
       long nonce = intent.getLongExtra(OppProbe.ReservedParamaters.NONCE.name, 0L);
       Log.i(TAG, "Nonce is " + nonce + "'");
       if (!sent && nonce != 0L) {
         sent = true;
         expirationTimer.cancel();
         try {
           context.unregisterReceiver(DataResponder.this);
         } catch (IllegalArgumentException e) {
           // already removed;
         }
         final Intent i = new Intent(OppProbe.getGetAction(probeName));
         Log.i(TAG, "Sending intent '" + i.getAction() + "'");
         i.setPackage(context.getPackageName()); // Send only to this app for right now
         i.putExtra(OppProbe.ReservedParamaters.PACKAGE.name, context.getPackageName());
         if (requestId != null && !"".equals(requestId)) {
           i.putExtra(OppProbe.ReservedParamaters.REQUEST_ID.name, requestId);
         }
         i.putExtra(OppProbe.ReservedParamaters.REQUESTS.name, requests);
         i.putExtra(OppProbe.ReservedParamaters.NONCE.name, nonce);
         context.sendBroadcast(i);
       }
     }
   }
 }
 private void initializeValidAllocatableCategory() {
   Intent i = new Intent();
   i.putExtra("allocationCategory", VALID_ALLOCATABLE_CATEGORY_ID);
   i.putExtra(
       AllocatableDetailsActivity.INTENT_STRING_ALLOCATABLE_CATEGORY_ELEMENT_KEY, "default");
   this.setActivityIntent(i);
 }
  private void broadcastUpdate(
      final String action, final BluetoothGattCharacteristic characteristic) {
    final Intent intent = new Intent(action);

    // This is special handling for the Heart Rate Measurement profile.  Data parsing is
    // carried out as per profile specifications:
    // http://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.heart_rate_measurement.xml
    if (UUID_HEART_RATE_MEASUREMENT.equals(characteristic.getUuid())) {
      int flag = characteristic.getProperties();
      int format = -1;
      if ((flag & 0x01) != 0) {
        format = BluetoothGattCharacteristic.FORMAT_UINT16;
        Log.d(TAG, "Heart rate format UINT16.");
      } else {
        format = BluetoothGattCharacteristic.FORMAT_UINT8;
        Log.d(TAG, "Heart rate format UINT8.");
      }
      final int heartRate = characteristic.getIntValue(format, 1);
      Log.d(TAG, String.format("Received heart rate: %d", heartRate));
      intent.putExtra(EXTRA_DATA, String.valueOf(heartRate));
    } else {
      // For all other profiles, writes the data formatted in HEX.
      final byte[] data = characteristic.getValue();
      if (data != null && data.length > 0) {
        final StringBuilder stringBuilder = new StringBuilder(data.length);
        for (byte byteChar : data) stringBuilder.append(String.format("%02X ", byteChar));
        intent.putExtra(EXTRA_DATA, new String(data) + "\n" + stringBuilder.toString());
      }
    }
    sendBroadcast(intent);
  }
示例#29
0
  void showDetails(int index) {
    mCurCheckPosition = index;

    Log.d("HabrQA", "TitleFragment requests qestion with ID: " + questionsList.get(index).getId());

    if (mDualPane) {
      getListView().setItemChecked(index, true);

      DetailsFragment details =
          (DetailsFragment) getFragmentManager().findFragmentById(R.id.details);
      if (details == null /*|| details.getShownIndex() != index*/) {
        details =
            DetailsFragment.newInstance(
                questionsList.get(index).getId(),
                questionsList.get(index).getTitle(),
                questionsList.get(index).getDescription(),
                questionsList.get(index).getUrl().toString());

        FragmentTransaction ft = getFragmentManager().beginTransaction();
        ft.replace(R.id.details, details);
        ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
        ft.commit();
      }

    } else {
      Intent intent = new Intent();
      intent.setClass(getActivity(), DetailsActivity.class);
      //			intent.putExtra("index", index);
      intent.putExtra("id", questionsList.get(index).getId());
      intent.putExtra("title", questionsList.get(index).getTitle());
      intent.putExtra("data", questionsList.get(index).getDescription());
      intent.putExtra("link", questionsList.get(index).getUrl().toString());
      startActivity(intent);
    }
  }
 @Override
 public boolean shouldOverrideUrlLoading(WebView view, String url) {
   if (url.startsWith("file")) {
     // Keep local assets in this WebView.
     return false;
   } else if (url.startsWith("mailto:")) {
     try {
       MailTo mt = MailTo.parse(url);
       Intent i = new Intent(Intent.ACTION_SEND);
       i.setType("message/rfc822");
       i.putExtra(Intent.EXTRA_EMAIL, new String[] {mt.getTo()});
       i.putExtra(Intent.EXTRA_SUBJECT, mt.getSubject());
       context.startActivity(i);
       view.reload();
     } catch (ActivityNotFoundException e) {
       Log.w(TAG, "Problem with Intent.ACTION_SEND", e);
       new AlertDialog.Builder(context)
           .setTitle("Contact Info")
           .setMessage("Please send your feedback to: [email protected]")
           .setPositiveButton(
               "Done",
               new DialogInterface.OnClickListener() {
                 public void onClick(DialogInterface dialog, int which) {
                   Log.d("AlertDialog", "Positive");
                 }
               })
           .show();
     }
     return true;
   } else {
     // Open external URLs in Browser.
     startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
     return true;
   }
 }