Пример #1
1
 @Override
 public void onActivityResult(int requestCode, int resultCode, Intent data) {
   LogUtils.d(TAG, "onActivityResult request=" + requestCode + " result=" + resultCode);
   TodoInfo info = null;
   switch (resultCode) {
     case Utils.OPERATOR_INSERT:
       info = (TodoInfo) data.getSerializableExtra(Utils.KEY_PASSED_DATA);
       mTodosListAdapter.addItem(info);
       final int addPos = mTodosListAdapter.getItemPosition(info);
       mTodosListView.setSelection(addPos);
       break;
     case Utils.OPERATOR_UPDATE:
       info = (TodoInfo) data.getSerializableExtra(Utils.KEY_PASSED_DATA);
       if (null == info) {
         LogUtils.e(TAG, "result: OPERATOR_UPDATE, but data didn't contain the info");
         return;
       }
       mTodosListAdapter.updateItemData(info);
       final int updatePos = mTodosListAdapter.getItemPosition(info);
       mTodosListView.setSelection(updatePos);
       break;
     case Utils.OPERATOR_DELETE:
       info = (TodoInfo) data.getSerializableExtra(Utils.KEY_PASSED_DATA);
       if (null == info) {
         LogUtils.e(TAG, "result: OPERATOR_DELETE, but data didn't contain the info");
         return;
       }
       mTodosListAdapter.removeItem(info);
       break;
     default:
       break;
   }
 }
Пример #2
1
 /**
  * Overrides parent's onCreate method. Sets player, opponents and health bars.
  *
  * @param savedInstanceState
  */
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   Intent getIntent = getIntent();
   player = (Player) getIntent.getSerializableExtra("player");
   level = getIntent.getStringExtra("level");
   opponents = new ArrayList<Opponent>();
   playerProgressBar = (ProgressBar) findViewById(R.id.playerProgressBar);
   opProgressBar = (ProgressBar) findViewById(R.id.oppProgressBar);
   playerHealth = (TextView) findViewById(R.id.playerHealthTextView);
   opHealth = (TextView) findViewById(R.id.oppTextView);
   opList = getIntent.getStringArrayListExtra("opList");
   opponents = (ArrayList<Opponent>) getIntent.getSerializableExtra("opponents");
   displayedResults = false;
   if (opList == null) {
     opList = new ArrayList<String>();
   }
   if (opponents == null) {
     opponents = new ArrayList<Opponent>();
   }
   setContentView(R.layout.activity_fight);
   setContent();
   totalEnemyHP = 0;
   for (Opponent enemy : opponents) {
     totalEnemyHP += enemy.getTotalHealth();
   }
 }
 @Override
 public void onActivityResult(int requestCode, int resultCode, Intent data) {
   if (resultCode != Activity.RESULT_OK) {
     return;
   }
   if (requestCode == REQUEST_DATE) {
     Date date = (Date) data.getSerializableExtra(DatePickerFragment.EXTRA_DATE);
     mCrime.setDate(date);
     updateDate();
   } else if (requestCode == REQUEST_CONTACT && data != null) {
     Uri contactUri = data.getData();
     String[] queryFields = new String[] {ContactsContract.Contacts.DISPLAY_NAME};
     Cursor c =
         getActivity().getContentResolver().query(contactUri, queryFields, null, null, null);
     try {
       if (c.getCount() == 0) {
         return;
       }
       c.moveToFirst();
       String suspect = c.getString(0);
       mCrime.setSuspect(suspect);
       mSuspectButton.setText(suspect);
     } finally {
       c.close();
     }
   }
   if (requestCode == REQUEST_TIME) {
     Date date = (Date) data.getSerializableExtra(TimePickerFragment.EXTRA_TIME);
     mCrime.setDate(date);
     updateTime();
   }
 }
 protected void onStart() {
   super.onStart();
   this.a.updateHeader(
       "No current file!",
       R.string.pref_hardware_config_filename,
       R.id.active_filename,
       R.id.included_header);
   Intent intent = this.getIntent();
   Serializable serializable =
       intent.getSerializableExtra("Edit Servo ControllerConfiguration Activity");
   if (serializable != null) {
     this.b = (ServoControllerConfiguration) serializable;
     this.c = (ArrayList) this.b.getServos();
   }
   this.d.setText((CharSequence) this.b.getName());
   TextView textView = (TextView) this.findViewById(R.id.servo_controller_serialNumber);
   String string = this.b.getSerialNumber().toString();
   if (string.equalsIgnoreCase(ControllerConfiguration.NO_SERIAL_NUMBER.toString())) {
     string = "No serial number";
   }
   textView.setText((CharSequence) string);
   for (int i = 0; i < this.c.size(); ++i) {
     this.c(i + 1);
     this.a(i + 1);
     this.b(i + 1);
   }
 }
Пример #5
0
  @Override
  @SuppressWarnings("unchecked")
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    super.setTheme(android.R.style.Theme_DeviceDefault);
    setContentView(R.layout.activity_settings);
    Intent i = getIntent();
    this.contactList = (ArrayList<HashMap<String, String>>) i.getSerializableExtra("contactGroups");
    this.savedContactGroupSettings =
        (ArrayList<HashMap<String, String>>) i.getSerializableExtra("contactGroupSettings");

    TextView settingsExplanation = (TextView) findViewById(R.id.settings_explanation_textview);
    settingsExplanation.setTextSize(12);
    settingsExplanation.setText("Für weitere Einstellungen auf Gruppennamen klicken");
    ListView contactGroupsView = (ListView) findViewById(R.id.activity_settings);

    contactGroupsView.setOnItemClickListener(
        new OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            HashMap<String, String> clickedMap =
                ((HashMap<String, String>) parent.getItemAtPosition(position));
            Intent contactGroupSettings =
                new Intent(getApplicationContext(), ContactGroupSettings.class);
            HashMap<String, String> savedMap = getSavedMap(clickedMap.get("name"));
            savedMap.put("alias", clickedMap.get("alias"));
            contactGroupSettings.putExtra("saved_map", savedMap);
            startActivityForResult(contactGroupSettings, position);
          }
        });
    this.contactGroupsAdapter =
        new SettingsAdapter(this, this.contactList, this.savedContactGroupSettings);
    contactGroupsView.setAdapter(this.contactGroupsAdapter);
  }
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {

    if (resultCode == RESULT_CANCELED) {
      return;
    }
    Serializable extra = null;
    if (requestCode == 1) {
      extra = data.getSerializableExtra(EditMotorControllerActivity.EDIT_MOTOR_CONTROLLER_CONFIG);
    } else if (requestCode == 2) {
      extra = data.getSerializableExtra(EditServoControllerActivity.EDIT_SERVO_ACTIVITY);
    } else if (requestCode == 3) {
      extra = data.getSerializableExtra(EditLegacyModuleControllerActivity.EDIT_LEGACY_CONFIG);
    }
    if (extra != null) {
      ControllerConfiguration newC = (ControllerConfiguration) extra;
      scannedDevices.put(newC.getSerialNumber(), newC.configTypeToDeviceType(newC.getType()));
      deviceControllers.put(newC.getSerialNumber(), newC);
      populateList();

      String name = preferredFilename;
      // only update the filename if it hasn't already been updated to have "unsaved" in it
      if (!name.toLowerCase().contains(Utility.UNSAVED.toLowerCase())) {
        name = Utility.UNSAVED + " " + preferredFilename;
        utility.saveToPreferences(name, R.string.pref_hardware_config_filename);
        preferredFilename = name;
      }

    } else {
      DbgLog.error(
          "Received Result with an incorrect request code: " + String.valueOf(requestCode));
    }
  }
Пример #7
0
  @Override
  protected STATE handleIntent(Intent intent, long updatePeriod, ResultReceiver resultReceiver) {
    String action = intent.getAction();
    if (action == null) {
      return STATE.ERROR;
    }

    if (roomListService.updateRoomDeviceListIfRequired(intent, updatePeriod, this)
        == RoomListService.RemoteUpdateRequired.REQUIRED) {
      return STATE.DONE;
    }

    if (FAVORITE_ROOM_LIST.equals(action)) {
      RoomDeviceList favorites = favoritesService.getFavorites(this);
      sendSingleExtraResult(resultReceiver, SUCCESS, DEVICE_LIST, favorites);
    } else if (FAVORITE_ADD.equals(action)) {
      FhemDevice device = (FhemDevice) intent.getSerializableExtra(DEVICE);
      favoritesService.addFavorite(this, device.getName());
      if (resultReceiver != null) sendNoResult(resultReceiver, SUCCESS);
    } else if (FAVORITE_REMOVE.equals(action)) {
      FhemDevice device = (FhemDevice) intent.getSerializableExtra(DEVICE);
      favoritesService.removeFavorite(this, device.getName());
      if (resultReceiver != null) sendNoResult(resultReceiver, SUCCESS);
    } else if (FAVORITES_PRESENT.equals(action)) {
      boolean hasFavorites = favoritesService.hasFavorites(this);
      sendSingleExtraResult(resultReceiver, SUCCESS, HAS_FAVORITES, hasFavorites);
    } else if (FAVORITES_IS_FAVORITES.equalsIgnoreCase(action)) {
      boolean isFavorite =
          favoritesService.isFavorite(intent.getStringExtra(BundleExtraKeys.DEVICE_NAME), this);
      sendSingleExtraResult(resultReceiver, SUCCESS, IS_FAVORITE, isFavorite);
    }

    return STATE.DONE;
  }
Пример #8
0
  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == MediaPickerConstants.CAPTURE_IMAGE_REQUEST_CODE) {
      if (resultCode == Activity.RESULT_OK) {
        String fileUriString = fileUri.toString().replaceFirst("file:///", "/").trim();
        Media media = new Media(fileUriString, MediaType.MEDIA_TYPE_IMAGE);
        mSelectedMedias.clear();
        mSelectedMedias.add(media);

        setCallback(Activity.RESULT_OK);
        getActivity().finish();
      }
    } else if (requestCode == MediaPickerConstants.PREVIEW_ALBUM_MEDIAS_REQUEST_CODE) {
      if (resultCode == MediaPickerConstants.PREVIEW_MEDIAS_BACK_RESULT_CODE) {
        mSelectedMedias = (ArrayList<Media>) data.getSerializableExtra("selectedMedias");
        mMediaAdapter.setSelectedMedias(mSelectedMedias);

        mCallback.onMediaSelected(mSelectedMedias);
      } else if (resultCode == Activity.RESULT_OK) {
        mSelectedMedias = (ArrayList<Media>) data.getSerializableExtra("selectedMedias");

        setCallback(Activity.RESULT_OK);
        getActivity().finish();
      }
    }
  }
Пример #9
0
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    ParentItem parentResult = null;

    if (requestCode == 1) {
      if (resultCode == RESULT_OK) {
        parentResult = (ParentItem) data.getSerializableExtra("parentList");
        // Toast.makeText(getApplicationContext(), "Create List Worked", Toast.LENGTH_SHORT).show();
      }
    } else if (requestCode == 2) {
      if (resultCode == RESULT_OK) {
        ChildItem childResult = (ChildItem) data.getSerializableExtra("childTask");
        int position = data.getIntExtra("position", 0);
        String listTitle = data.getStringExtra("listTitle");

        if (listTitle.equals(expandableListTitle.get(position).getName())) {
          parentResult = expandableListTitle.get(position);
          parentResult.addChildItem(childResult);

          expandableListTitle.remove(position);
        }
      }
    }
    if (parentResult != null) {
      expandableListDetail.put(parentResult, parentResult.getChildItems());
    }

    expandableListTitle.add(parentResult);
  }
Пример #10
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {

    Intent i = getIntent();

    // initialize variables from intent
    tournament = (Tournament) i.getSerializableExtra("Tournament");
    round = (Round) i.getSerializableExtra("Round");
    teamList = round.getTeamList();
    winningTeamList = round.getRoundWinners();
    currentRoundIndex = round.getRoundNumber();
    nextRoundIndex = currentRoundIndex + 1;
    numOfRounds = tournament.getNumberOfRounds();

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_results);

    if (currentRoundIndex == numOfRounds - 1) {

      Button btn = (Button) findViewById(R.id.buttonContinue);
      btn.setText("View stats");
    }

    populateListView();
  }
Пример #11
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    boolean isEntryPoint = false;
    rotateScreen(this);

    ApplicationData applicationData = SplashActivity.getApplicationData();
    if (applicationData != null) {
      Intent intent = getIntent();
      isEntryPoint = (Boolean) intent.getSerializableExtra(ApplicationData.IS_ENTRY_POINT_TAG);
      NextLevel nextLevel = (NextLevel) intent.getSerializableExtra(ApplicationData.NEXT_LEVEL_TAG);

      QrActivityGenerator generator =
          (QrActivityGenerator) applicationData.getFromNextLevel(this, nextLevel);
      DefaultAppLevelData appLevelData =
          (DefaultAppLevelData) generator.getAppLevel().getData(this);
      dataItem = (QrLevelDataItem) appLevelData.findByNextLevel(nextLevel);

      generator.initializeActivity(this);
    } else {
      Intent i = new Intent(this, SplashActivity.class);
      startActivity(i);
      finish();
    }
    // createToolBar(isEntryPoint);
    createMenus(this, isEntryPoint);
  }
Пример #12
0
 private void parseIntent() {
   Intent intent = getIntent();
   receiveUserAdds = intent.getStringArrayExtra(RECEIVE_ADDRESS);
   HashMap<Long, String> tmpUserMap =
       (HashMap<Long, String>) intent.getSerializableExtra(RECEIVE_SELECTUSERCIRCLE_NAME);
   HashMap<String, String> tmpPhoneEmailMap =
       (HashMap<String, String>) intent.getSerializableExtra(RECEIVE_SELECTPHONEEMAIL_NAME);
   if (tmpUserMap != null) {
     mSelectedUserCircleNameMap.clear();
     mSelectedUserCircleNameMap.putAll(tmpUserMap);
   }
   if (tmpPhoneEmailMap != null) {
     mSelectedPhoneEmailNameMap.clear();
     mSelectedPhoneEmailNameMap.putAll(tmpPhoneEmailMap);
   }
   mInviteId = intent.getLongExtra(CircleUtils.CIRCLE_ID, -1);
   if (mInviteId > 0) {
     overrideRightTextActionBtn(R.string.qiupu_invite, inviteClickListener);
   } else {
     overrideRightTextActionBtn(R.string.label_ok, pickClickListener);
   }
   if (intent.getIntExtra(PICK_FROM, -1) == PICK_FROM_COMPOSE) {
     setHeadTitle(R.string.string_select_user);
   } else {
     setHeadTitle(R.string.invite_people_title);
   }
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_formulario);
    formularioHelper = new FormularioHelper(this);

    Intent intent = getIntent();

    if (intent.getSerializableExtra("alunoCarregar") != null) {
      Aluno aluno = (Aluno) intent.getSerializableExtra("alunoCarregar");
      formularioHelper.setAluno(aluno);
    }

    Button btnFoto = (Button) findViewById(R.id.btnFoto);
    btnFoto.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {

            // Apenas uma miniimagem (thumbnails)

            // Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

            // if (takePictureIntent.resolveActivity(getPackageManager()) != null) {

            // startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);

            // }

            dispatchTakePictureIntent();
          }
        });

    imgFoto = (ImageView) findViewById(R.id.imgFoto);
  }
Пример #14
0
 @Test
 public void testSerializableExtra() throws Exception {
   Intent intent = new Intent();
   TestSerializable serializable = new TestSerializable("some string");
   assertSame(intent, intent.putExtra("foo", serializable));
   assertEquals(serializable, intent.getExtras().get("foo"));
   assertNotSame(serializable, intent.getExtras().get("foo"));
   assertEquals(serializable, intent.getSerializableExtra("foo"));
   assertNotSame(serializable, intent.getSerializableExtra("foo"));
 }
Пример #15
0
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   if (resultCode != RESULT_OK) {
     return;
   }
   switch (requestCode) {
     case REQUEST_CODE_SHOW_PRODUCT:
       Trace.e(TAG, "Show Product:result data->" + (null == data ? "null" : data.toString()));
       if (data != null
           && data.hasExtra(ProductDetailActivity.KEY_PRODUCT_REC)
           && data.hasExtra(ProductDetailActivity.KEY_POST_NUMBER)
           && data.hasExtra(ProductDetailActivity.KEY_EDIT_TYPE)) {
         ProductRec productRec =
             (ProductRec) data.getSerializableExtra(ProductDetailActivity.KEY_PRODUCT_REC);
         int pos = (Integer) data.getSerializableExtra(ProductDetailActivity.KEY_POST_NUMBER);
         int editType =
             data.getIntExtra(
                 ProductDetailActivity.KEY_EDIT_TYPE, ProductDetailActivity.TYPE_EDIT_PRODUCT);
         // 移除记录满足以下条件即可:
         // (1)藏品做了移除操作;
         // (2)藏品做了下架操作;
         // (3)藏品做了重新设置了分类操作;
         boolean isNeedRemoveProduct = false;
         if (editType == ProductDetailActivity.TYPE_REMOVE_PRODUCT) {
           isNeedRemoveProduct = true;
         } else {
           //					if(null != productRec){
           ////						isNeedRemoveProduct = !productRec.isOnSale();
           ////						String catId = productRec.getCatId();
           //						String currPageCatId = null == tagRec ? null : tagRec.getId();
           //						if(!isNeedRemoveProduct && null != catId && null != currPageCatId &&
           // !catId.equalsIgnoreCase(currPageCatId)){
           //							isNeedRemoveProduct = true;
           //						}
           //					}
         }
         if (isNeedRemoveProduct) {
           try {
             productList.remove(pos);
           } catch (Exception e) {
             Log.e(TAG, "Remove ProductRec failure: pos outOfArrIndex Exception.", e);
           }
         } else {
           //					productList.get(pos).setInFav(productRec.getInFav());
           //					productList.get(pos).setFavNum(productRec.getFavNum());
         }
         productAdapter.notifyDataSetInvalidated();
       }
       break;
     case FOR_LOGIN_RESULT:
       readyToGetAllGoodsByTagID(tagRec.getId(), true);
       break;
     default:
       break;
   }
 };
Пример #16
0
 private void initIntent() {
   Intent i = getIntent();
   if (i != null) {
     mEnt = (AppsResponse) i.getSerializableExtra(Constant.KEY_ENTITY);
     mAppTypeEnt = (AppTypeEntity) i.getSerializableExtra(Constant.KEY_APPTYPE_ENTITY);
     if (mEnt != null) {
       mDataList.clear();
       mDataList.addAll(mEnt.getOnline());
     }
   }
 }
 private void init(Bundle savedInstanceState) {
   mFragmentManager = getSupportFragmentManager();
   Intent intent = getIntent();
   mProject = (Project) intent.getSerializableExtra(Contanst.PROJECT);
   mIssue = (Issue) intent.getSerializableExtra(Contanst.ISSUE);
   String projectId = intent.getStringExtra(Contanst.PROJECTID);
   String issueId = intent.getStringExtra(Contanst.ISSUEID);
   if (mIssue == null || mProject == null) {
     loadIssueAndProject(projectId, issueId);
   } else {
     initData();
   }
 }
Пример #18
0
 /** Display Patients from ER sorted by urgency value and seen by doctor. */
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_urgency_list);
   Intent intent = getIntent();
   TextView newUrgencyList = (TextView) findViewById(R.id.textViewUrgency);
   er = (ER) intent.getSerializableExtra("erKey");
   user = (String) intent.getSerializableExtra("user");
   List<Patient> patientsList = er.getPatients();
   List<Patient> sorted_patients = new ArrayList<Patient>();
   int index;
   for (Patient p : patientsList) {
     index = 0;
     if (p.getSeenByDoctor().size() > 1) {
       index = p.getSeenByDoctor().size() - 2;
     }
     String doctorseen = p.getSeenByDoctor().get(index);
     if (doctorseen.equals("No")) {
       sorted_patients.add(p);
     }
   }
   String newUrgencyList1 =
       "List of patients haven't yet been seen by a doctor sorted by decreasing urgency:" + "\n";
   Collections.sort(sorted_patients, new UrgencyComparator());
   for (Patient p1 : sorted_patients) {
     newUrgencyList1 +=
         ("\n"
             + p1.getName()
             + ", "
             + p1.getDob()
             + ", "
             + p1.getHealthCardNum()
             + ", Urgency: "
             + String.valueOf(p1.getUrgency())
             + "\n");
     if (!p1.getVitalSigns().getDiastolic().equals("None")) {
       newUrgencyList1 += p1.getVitalSigns().getDiastolic();
     }
     if (!p1.getVitalSigns().getSystolic().equals("None")) {
       newUrgencyList1 += ", " + p1.getVitalSigns().getSystolic();
     }
     if (!p1.getVitalSigns().getHr().equals("None")) {
       newUrgencyList1 += ", " + p1.getVitalSigns().getHr();
     }
     if (!p1.getVitalSigns().getTemp().equals("None")) {
       newUrgencyList1 += ", " + p1.getVitalSigns().getTemp();
     }
     newUrgencyList1 += "\n";
   }
   newUrgencyList.setText(newUrgencyList1);
 }
  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode != Activity.RESULT_OK) {
      return;
    } else if (requestCode == REQUEST_DATE) {
      Date date = (Date) data.getSerializableExtra(DatePickerFragment.EXTRA_DATE);
      mCrime.setDate(date);
      mCallbacks.onCrimeUpdated(mCrime);
      updateDate();
    } else if (requestCode == REQUEST_TIME) {
      Date date = (Date) data.getSerializableExtra(TimePickerFragment.EXTRA_TIME);
      mCrime.setDate(date);
      updateTime();
    } else if (requestCode == REQUEST_PHOTO) {
      // Create a new Photo object and attach it to the crime
      String filename = data.getStringExtra(CrimeCameraFragment.EXTRA_PHOTO_FILENAME);

      if (filename != null) {
        Photo p = new Photo(filename);
        mCrime.setPhoto(p);
        mCallbacks.onCrimeUpdated(mCrime);
        showPhoto();
      }
    } else if (requestCode == REQUEST_CONTACT) {
      Uri contactUri = data.getData();

      // Specify which fields you want your quwery to return
      // values for.
      String[] queryFields = new String[] {ContactsContract.Contacts.DISPLAY_NAME};

      // Perform your query - the contactUri is like a "where"
      // clause here
      Cursor c =
          getActivity().getContentResolver().query(contactUri, queryFields, null, null, null);

      // Double check that you actually got results
      if (c.getCount() == 0) {
        c.close();
        return;
      }

      // Pull out the first column of the first row of data -
      // that is your suspect's name.
      c.moveToFirst();
      String suspect = c.getString(0);
      mCrime.setSuspect(suspect);
      mCallbacks.onCrimeUpdated(mCrime);
      mSuspectButton.setText(suspect);
      c.close();
    }
  }
Пример #20
0
  @Override
  protected void onHandleIntent(Intent intent) {

    if (intent != null) {
      final String action = intent.getAction();
      if (ACTION_ADD.equals(action)) {
        final Parking parkings = (Parking) intent.getSerializableExtra(EXTRA_ADD);
        postCustomerPark(parkings);
      } else if (ACTION_UPDATE.equals(action)) {
        final Parking parkings = (Parking) intent.getSerializableExtra(EXTRA_UPDATE);
        updateCustomerPark(parkings);
      }
    }
  }
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   Option option;
   switch (resultCode) {
     case Constants.ITEM:
       option = (Option) data.getSerializableExtra("option");
       itemnum.setText(option.getName());
       break;
     case Constants.LOCATIONSCODE:
       option = (Option) data.getSerializableExtra("option");
       location.setText(option.getName());
       break;
   }
 }
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   Option option;
   switch (resultCode) {
     case Constants.LABORCRAFTRATE:
       option = (Option) data.getSerializableExtra("option");
       laborcode.setText(option.getName());
       craft.setText(option.getDescription());
       break;
     case Constants.CRAFTRATE:
       option = (Option) data.getSerializableExtra("option");
       craft.setText(option.getName());
       break;
   }
 }
  /* (non-Javadoc)
   * @see android.app.Activity#onCreate(android.os.Bundle)
   */
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_view_prescription);

    name = (TextView) findViewById(R.id.PrescPatientName2);
    prescription = (TextView) findViewById(R.id.viewPrescription);

    Intent i = getIntent();
    u = (Physician) i.getSerializableExtra("Physician");
    p = (Patient) i.getSerializableExtra("Patient");
    name.setText(p.getName());
    String s = i.getStringExtra("Prescription");
    prescription.setText(s);
  }
Пример #24
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {

    Intent intent = getIntent();
    receivedVenue = (Venue) intent.getSerializableExtra("venue");

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_venue);

    fillInfo(receivedVenue);

    RetrieveEventsTask task = new RetrieveEventsTask();
    task.execute(new String[] {(urlEvent)});

    RetrieveVenueAverageTask task2 = new RetrieveVenueAverageTask();
    task2.execute(new String[] {(urlRate)});

    RetrieveReviewsTask task3 = new RetrieveReviewsTask();
    task3.execute(new String[] {(urlGetReviews)});

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
      // Show the Up button in the action bar.
      getActionBar().setDisplayHomeAsUpEnabled(true);
    }
  }
Пример #25
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.s1_product_update);

    Intent intent = getIntent();
    mProduct = (SIMPLE_PRODUCT) intent.getSerializableExtra("product");
    init(mProduct);
    mShared = getSharedPreferences(MemberAppConst.USERINFO, 0);
    mAlertView =
        new AlertView(
                "信息提示",
                "确定删除该条记录!",
                "取消",
                new String[] {"确定"},
                null,
                this,
                AlertView.Style.Alert,
                this)
            .setCancelable(true)
            .setOnDismissListener(this);

    mProductModel = new ProductModel(this);
    mProductModel.addResponseListener(this);

    EventBus.getDefault().register(this);
  }
  /** 获取上个页面传递过来的数据 */
  private void getIntentData(Intent intent) {

    if (intent != null) {

      HotNewsInfo hotNewsInfo = (HotNewsInfo) intent.getSerializableExtra("data");

      title = hotNewsInfo.getTitle();
      view_count = hotNewsInfo.getView_count();
      tvTitle.setText(title);
      tvViewCount.setText(view_count + "万次播放");
      tvTags.setText("标签:" + hotNewsInfo.getTag());
      tvLink.setText(hotNewsInfo.getLink());
      tIBtnUP.setText(hotNewsInfo.getUp_count() + "万");
      tIBtnDown.setText(hotNewsInfo.getDown_count());
      tvCategory.setText("类型:" + hotNewsInfo.getCategory());
      tvPublished.setText(hotNewsInfo.getPublished());
      // 判断是不是本地视频
      isFromLocal = intent.getBooleanExtra("isFromLocal", false);

      if (isFromLocal) { // 播放本地视频
        local_vid = intent.getStringExtra("video_id");
      } else { // 在线播放
        id = intent.getStringExtra("vid");
      }
    }
  }
  @Override
  protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.downloader);

    _downloadingText = (TextView) findViewById(R.id.downloadDownloadingText);
    _infoText = (TextView) findViewById(R.id.downloadInfoText);
    _progressBar = (ProgressBar) findViewById(R.id.downloadProgressBar);
    _progressText = (TextView) findViewById(R.id.downloadProgressText);

    _progressBar.setMax(100);

    _handler = new DownloadMessageHandler(this);

    final WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
    _wifiLock =
        wifiManager.createWifiLock(WifiManager.WIFI_MODE_FULL, DownloadActivity.class.getName());

    scheduleDownloadingTextAnimation();

    final Intent intent = getIntent();
    final EpisodeModel episode =
        (EpisodeModel) intent.getSerializableExtra(getString(R.string.key_episode));

    final ProgrammeModel programme = episode.getProgramme();
    final String programmeName = programme.getName();
    final String name = episode.getName();
    final Date date = episode.getDate();
    final String dateStr = DATE_FORMAT.format(date);
    setTitle(getString(R.string.download_title) + " - " + programmeName);
    _infoText.setText(programmeName + " " + dateStr + "\n" + name);

    new Downloader(this, episode, 10, _wifiLock, _handler).start();
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    Log.e(TAG, "onCreate");
    super.onCreate(savedInstanceState);

    MyAppApplication myApp = ((MyAppApplication) getApplicationContext());
    mGoogleApiClient = myApp.getClient();
    room = myApp.getRoom();
    mRoomId = room.getRoomId();
    mParticipants = room.getParticipants();

    Intent i = getIntent();
    myself = (Player) i.getSerializableExtra("myself");

    AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
    initialize(new CatMath(this, myself), config); // updated by siyuan

    myId = room.getParticipantId(Games.Players.getCurrentPlayerId(myApp.getClient()));
    GameWorld.isOwner = isServer();
    Log.e("isOwner:", String.valueOf(GameWorld.isOwner));
    playerMap.put(myId, 1);
    GameWorld.numberOfPlayers = mParticipants.size();

    Log.e(TAG, "onCreate ends");
  } // end of onCreate
 @OnActivityResult(RESULT_SHARE_LINK)
 void onResultShareLink(int result, Intent intent) {
   if (result == RESULT_OK) {
     mAttachmentFileObject = (AttachmentFileObject) intent.getSerializableExtra("data");
     setResult(result, intent);
   }
 }
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent i) {

    if (resultCode == RESULT_OK) {
      final Menu.Item item = (Menu.Item) i.getSerializableExtra("picked-item");
      final int groupId = i.getIntExtra("group-id", -1);

      Utils.getApi(this)
          .createMenuGroupItem(item, menuId, groupId)
          .enqueue(
              new Callback<Group>() {
                public void onResponse(Response<Group> response, Retrofit retrofit) {
                  if (response.isSuccess()) {
                    adapter.addItem(groupId, item);
                  } else
                    Toast.makeText(
                            MenuActivity.this, "Kunde inte lägga till maträtt", Toast.LENGTH_SHORT)
                        .show();
                }

                public void onFailure(Throwable t) {
                  Toast.makeText(
                          MenuActivity.this, "Ingen anslutning. Försök igen.", Toast.LENGTH_SHORT)
                      .show();
                }
              });
    }
  }