List of usage examples for android.widget LinearLayout findViewById
@Nullable public final <T extends View> T findViewById(@IdRes int id)
From source file:com.todoroo.astrid.taskrabbit.TaskRabbitActivity.java
private void displayViewsForMode(int mode) { taskControls.removeAllViews();/*from w ww.j a v a 2 s . c om*/ descriptionControls.removeAllViews(); if (row == null) { row = new LinearLayout(this); row.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); row.setOrientation(LinearLayout.HORIZONTAL); } else { row.removeAllViews(); } if (menuTitle != null) { menuTitle.setText(getResources().getStringArray(R.array.tr_preset_types)[mode]); } int[] presetValues = getPresetValues(mode); TypedArray keys = getResources().obtainTypedArray(R.array.tr_default_set_key); JSONObject parameters = defaultValuesToJSON(keys, presetValues); for (int i = 0; i < controls.size(); i++) { if (presetValues[i] == -1) continue; TaskRabbitSetListener set = controls.get(i); int arrayID = keys.getResourceId(i, 0); if (arrayID == R.string.tr_set_key_cost_in_cents || arrayID == R.string.tr_set_key_named_price) { if (row.getParent() == null) taskControls.addView(row); else { // View separator = getLayoutInflater().inflate(R.layout.tea_separator, row); // separator.setLayoutParams(new LayoutParams(1, LayoutParams.FILL_PARENT)); } LinearLayout displayRow = (LinearLayout) ((TaskEditControlSet) set).getDisplayView(); LinearLayout.LayoutParams layoutParams = null; if (arrayID == R.string.tr_set_key_named_price) { layoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT, 1); displayRow.findViewById(R.id.display_row_body).setPadding(5, 0, 10, 0); displayRow.setMinimumWidth(130); } else { layoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT, 1); displayRow.findViewById(R.id.display_row_body).setPadding(10, 0, 5, 0); } row.addView(displayRow, layoutParams); } else if (arrayID == R.string.tr_set_key_description) { descriptionControls.addView(((TaskEditControlSet) set).getDisplayView()); } else { taskControls.addView(((TaskEditControlSet) set).getDisplayView()); } ((TaskRabbitSetListener) set).readFromModel(parameters, getString(arrayID), currentSelectedItem); } }
From source file:com.thingsee.tracker.MainActivity.java
@SuppressLint("InflateParams") private Marker makeMarkerToMap(LatLng latLng, boolean visible, boolean alarmActive, String name, double timeStamp, double accuracy) { String snippet;//w w w . j a va 2 s .c o m LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); LinearLayout tv = (LinearLayout) inflater.inflate(R.layout.tracker_map_marker, null, false); TextView trackerName = (TextView) tv.findViewById(R.id.tracker_name); trackerName.setText(name); ImageView image2 = (ImageView) tv.findViewById(R.id.tracker_marker_icon); if (alarmActive) { image2.setColorFilter(mResources.getColor(R.color.red)); trackerName.setTextColor(mResources.getColor(R.color.white_effect)); } else { image2.setColorFilter(mResources.getColor(R.color.dark_blue)); trackerName.setTextColor(mResources.getColor(R.color.white_effect)); } tv.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)); tv.layout(0, 0, tv.getMeasuredWidth(), tv.getMeasuredHeight()); tv.setDrawingCacheEnabled(true); tv.buildDrawingCache(); Bitmap bm = tv.getDrawingCache(); tv = null; if (accuracy != -1) { snippet = String.format(mResources.getString(R.string.tracker_accuracy), accuracy); } else { snippet = String.format(mResources.getString(R.string.tracker_accuracy), 0.0f); } if (timeStamp != 0) { String timeStampText = Utilities.getSmartTimeStampString(mContext, mResources, timeStamp); snippet = snippet + "\n" + mResources.getString(R.string.tracker_timestamp) + " " + timeStampText; } else { snippet = snippet + "\n" + mResources.getString(R.string.tracker_timestamp) + " - "; } return mMap.addMarker(new MarkerOptions().position(latLng).icon(BitmapDescriptorFactory.fromBitmap(bm)) .visible(visible).title(name).snippet(snippet)); }
From source file:org.ale.scanner.zotero.EditItemActivity.java
private void fillForm() { // Clear any previous data from the form LinearLayout container = ((LinearLayout) findViewById(R.id.editContainer)); container.removeAllViews();/* ww w .ja va 2 s . co m*/ // Get the JSON we'll be working from. JSONObject info = mWorkingItem.getSelectedInfo(); final String[] fields; // XXX: temporary hack. In-order list of fields if (ItemType.book.equals(info.optString(ItemField.itemType))) { fields = new String[] { "title", "creators", "abstractNote", "series", "seriesNumber", "volume", "numberOfVolumes", "edition", "place", "publisher", "date", "numPages", "language", "ISBN", "shortTitle", "url", "accessDate", "archive", "archiveLocation", "libraryCatalog", "callNumber", "rights", "extra", "notes", "tags" }; } else { // XXX: Assumes journalArticle fields = new String[] { "title", "creators", "abstractNote", "publicationTitle", "volume", "issue", "pages", "date", "series", "seriesTitle", "seriesText", "journalAbbreviation", "language", "DOI", "ISSN", "shortTitle", "url", "accessDate", "archive", "archiveLocation", "libraryCatalog", "callNumber", "rights", "extra", "tags", "notes" }; } LinearLayout row; LinearLayout crow; int row_ctr = 0; for (String field : fields) { if (field.equals(ItemField.itemType)) continue; if (field.equals(ItemField.creators)) { row = mCreatorList = (LinearLayout) mInflater.inflate(R.layout.edit_creators, container, false); JSONArray creators = info.optJSONArray(field); if (creators == null || creators.length() == 0) { addCreator(); // Empty creator row for new creators } else { for (int c = 0; c < creators.length(); c++) { JSONObject creator = creators.optJSONObject(c); if (creator == null) continue; crow = addCreator(); Spinner sp = (Spinner) crow.findViewById(R.id.creator_type); EditText et = (EditText) crow.findViewById(R.id.creator); String curtype = creator.optString(CreatorType.type); int selection = CreatorType.Book.indexOf(curtype); sp.setSelection(selection >= 0 ? selection : 0); String name = creator.optString(ItemField.Creator.name); if (TextUtils.isEmpty(name)) { String[] firstlast = { creator.optString(ItemField.Creator.firstName), creator.optString(ItemField.Creator.lastName) }; name = TextUtils.join(" ", firstlast); } et.setText(name); } } } else if (field.equals(ItemField.notes)) { row = mNoteList = (LinearLayout) mInflater.inflate(R.layout.edit_notes, container, false); JSONArray notes = info.optJSONArray(field); if (notes == null || notes.length() == 0) { addNote(); // Empty note row for new notes } else { for (int c = 0; c < notes.length(); c++) { JSONObject note = notes.optJSONObject(c); if (note == null) continue; crow = addNote(); EditText et = (EditText) crow.findViewById(R.id.content); et.setText(note.optString(ItemField.Note.note)); } } } else if (field.equals(ItemField.tags)) { row = mTagList = (LinearLayout) mInflater.inflate(R.layout.edit_tags, container, false); JSONArray tags = info.optJSONArray(field); if (tags == null || tags.length() == 0) { addTag(); // Empty tag row for new tags } else { for (int c = 0; c < tags.length(); c++) { JSONObject tag = tags.optJSONObject(c); if (tag == null) continue; crow = addTag(); EditText et = (EditText) crow.findViewById(R.id.content); et.setText(tag.optString(ItemField.Tag.tag)); } } } else { row = (LinearLayout) mInflater.inflate(R.layout.edit_field, container, false); TextView tv_lbl = (TextView) row.findViewById(R.id.label); EditText et = (EditText) row.findViewById(R.id.content); tv_lbl.setText(ItemField.Localized.get(field)); tv_lbl.setTag(field); et.setText(info.optString(field)); } container.addView(row); setRowColor(row, row_ctr); row_ctr++; } }
From source file:com.example.zf_android.activity.MerchantEdit.java
@Override protected void onActivityResult(final int requestCode, int resultCode, final Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode != RESULT_OK) { return;//from w w w . ja v a 2 s .co m } String value = ""; if (data != null) { value = data.getStringExtra("value"); } switch (requestCode) { case TYPE_1: merchantEntity.setTitle(value); tv1.setText(value); break; case TYPE_2: merchantEntity.setLegalPersonName(value); tv2.setText(value); break; case TYPE_3: merchantEntity.setLegalPersonCardId(value); tv3.setText(value); break; case TYPE_4: merchantEntity.setBusinessLicenseNo(value); tv4.setText(value); break; case TYPE_5: merchantEntity.setTaxRegisteredNo(value); tv5.setText(value); break; case TYPE_6: merchantEntity.setOrganizationCodeNo(value); tv6.setText(value); break; case TYPE_7: Province province = (Province) data.getSerializableExtra(Constants.CityIntent.SELECTED_PROVINCE); City city = (City) data.getSerializableExtra(Constants.CityIntent.SELECTED_CITY); if (province == null || city == null) { merchantEntity.setCityId(0); tv7.setText(""); } else { merchantEntity.setCityId(city.getId()); tv7.setText(province.getName() + city.getName()); } break; case TYPE_KHYH: merchantEntity.setAccountBankName(value); tvkhyh.setText(value); break; case TYPE_8: merchantEntity.setBankOpenAccount(value); tv8.setText(value); break; case REQUEST_UPLOAD_IMAGE: case REQUEST_TAKE_PHOTO: { final LinearLayout layout = linearLayout.get(MerchantEdit.this.type); final Handler handler = new Handler() { private int type; @Override public void handleMessage(Message msg) { this.type = MerchantEdit.this.type; if (msg.what == 1) { // CommonUtil.toastShort(MerchantEdit.this, // (String) msg.obj); layout.setClickable(false); layout.findViewById(R.id.imgView).setVisibility(View.VISIBLE); layout.findViewById(R.id.textView).setVisibility(View.GONE); String url = (String) msg.obj; layout.setClickable(true); switch (type) { case TYPE_10: merchantEntity.setCardIdFrontPhotoPath(url); break; case TYPE_11: merchantEntity.setCardIdBackPhotoPath(url); break; case TYPE_12: merchantEntity.setBodyPhotoPath(url); break; case TYPE_13: merchantEntity.setLicenseNoPicPath(url); break; case TYPE_14: merchantEntity.setTaxNoPicPath(url); break; case TYPE_15: merchantEntity.setOrgCodeNoPicPath(url); break; case TYPE_16: merchantEntity.setAccountPicPath(url); break; default: break; } } else { CommonUtil.toastShort(MerchantEdit.this, getString(R.string.toast_upload_failed)); layout.setClickable(true); } } }; if (null != layout) { ImageView imgView = (ImageView) layout.findViewById(R.id.imgView); TextView textView = (TextView) layout.findViewById(R.id.textView); imgView.setVisibility(View.GONE); textView.setVisibility(View.VISIBLE); textView.setText(getString(R.string.apply_uploading)); layout.setClickable(false); } new Thread() { @Override public void run() { String realPath = ""; if (requestCode == REQUEST_TAKE_PHOTO) { realPath = photoPath; } else { Uri uri = data.getData(); if (uri != null) { realPath = Tools.getRealPathFromURI(MerchantEdit.this, uri); } } if (TextUtils.isEmpty(realPath)) { handler.sendEmptyMessage(0); return; } CommonUtil.uploadFile(realPath, "img", new CommonUtil.OnUploadListener() { @Override public void onSuccess(String result) { try { JSONObject jo = new JSONObject(result); String url = jo.getString("result"); Message msg = new Message(); msg.what = 1; msg.obj = url; handler.sendMessage(msg); } catch (JSONException e) { handler.sendEmptyMessage(0); } } @Override public void onFailed(String message) { handler.sendEmptyMessage(0); } }); } }.start(); break; } default: break; } }
From source file:so.contacts.hub.basefunction.account.ui.YellowpagePersonalInfoActivity.java
private void showWheelCityDialog() { dismissLoadingDialog();// w w w. j av a2 s . co m if (mCityDialog == null) { mCityDialog = CommonDialogFactory.getDialog(this, R.style.Theme_Ptui_Dialog_Wheel); mCityDialog.setTitle(getString(R.string.putao_personal_data_area)); mCityDialog.setNegativeButton(getString(R.string.putao_cancel), new OnClickListener() { @Override public void onClick(View view) { mCityDialog.dismiss(); } }); mCityDialog.setPositiveButton(getString(R.string.putao_confirm), new OnClickListener() { @Override public void onClick(View view) { mCityDialog.dismiss(); mChangeFlag = true; // ???? ProvinceItem provinceItem = mProvinceItems.get(0); String city = ""; int provinceIndex = mProvinceWheelView.getCurrentItem(); if (provinceIndex >= 0 && provinceIndex < mProvinceItems.size()) { provinceItem = mProvinceItems.get(provinceIndex); mCitiesList.clear(); mCitiesList.addAll(provinceItem.cityList); int cityIndex = mCityWheelView.getCurrentItem(); if (cityIndex >= 0 && cityIndex < mCitiesList.size()) { city = mCitiesList.get(cityIndex); if ("---".equals(city)) { city = ""; } } StringBuilder sb = new StringBuilder(); sb.append(provinceItem.provinceName).append(" ").append(city); mCitySTR = sb.toString(); mCityTextView.setText(mCitySTR); } } }); LinearLayout wheelContainer = (LinearLayout) mCityDialog.getContainerLayout(); // ???wheelview wheelContainer.findViewById(R.id.wheel_center).setVisibility(View.GONE); mProvinceWheelView = (WheelView) wheelContainer.findViewById(R.id.wheel_left); mProvinceWheelView.setVisibleItems(3); mProvinceAdapter = new WheelTextAdapter(this, mProvincesList); mProvinceWheelView.setViewAdapter(mProvinceAdapter); mProvinceWheelView.addChangingListener(this); mCityWheelView = (WheelView) wheelContainer.findViewById(R.id.wheel_right); mCityWheelView.setVisibleItems(3); mCityAdapter = new WheelTextAdapter(this, mCitiesList); mCityWheelView.setViewAdapter(mCityAdapter); mCityWheelView.addChangingListener(this); } // if (!TextUtils.isEmpty(mCitySTR)) { // ?? String[] area = mCitySTR.split(" "); String province = ""; String city = ""; if (area.length > 0) { province = area[0]; } if (area.length > 1) { city = area[1]; } // ??? if (!mProvinceItems.isEmpty() && !TextUtils.isEmpty(province)) { for (int i = 0; i < mProvinceItems.size(); i++) { if (mProvinceItems.get(i).provinceName.equals(province)) { mProvinceWheelView.setCurrentItem(i); mCitiesList.clear(); mCitiesList.addAll(mProvinceItems.get(i).cityList); break; } } } // ?? if (!mCitiesList.isEmpty() && !TextUtils.isEmpty(city)) { for (int j = 0; j < mCitiesList.size(); j++) { if (mCitiesList.get(j).equals(city)) { mCityWheelView.setCurrentItem(j); break; } } } } else { mProvinceWheelView.setCurrentItem(0); mProvinceAdapter.setData(mProvincesList); mCityWheelView.setCurrentItem(0); mCityAdapter.setData(mCitiesList); } mCityDialog.show(); }
From source file:com.example.zf_android.trade.ApplyDetailActivity.java
@Override protected void onActivityResult(final int requestCode, int resultCode, final Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode != RESULT_OK) return;//ww w . j a va2 s. c o m switch (requestCode) { case REQUEST_CHOOSE_MERCHANT: { mAgentId = mMerchantId = data.getIntExtra(AGENT_ID, 0); mAgentName = data.getStringExtra(AGENT_NAME); setItemValue(mMerchantKeys[0], mAgentName); getAgentInfo(); break; } case REQUEST_CHOOSE_BANK: { mBankName = data.getStringExtra("bank_name"); mBankNo = data.getStringExtra("bank_no"); setItemValue(customTag, mBankName); setItemValue(mBankKeys[0], mBankName); //FIXME no // setItemValue(mBankKeys[1], mBankNo); break; } case REQUEST_CHOOSE_CITY: { mMerchantProvince = (Province) data.getSerializableExtra(SELECTED_PROVINCE); mMerchantCity = (City) data.getSerializableExtra(SELECTED_CITY); mCityId = mMerchantCity.getId(); setItemValue(mMerchantKeys[8], mMerchantCity.getName()); break; } case REQUEST_CHOOSE_CHANNEL: { mChannelId = data.getIntExtra("channelId", 0); mBillingId = data.getIntExtra("billId", 0); String channelName = data.getStringExtra("channelName"); String billName = data.getStringExtra("billName"); setItemValue(getString(R.string.apply_detail_channel), channelName + " " + billName); break; } case REQUEST_UPLOAD_IMAGE: case REQUEST_TAKE_PHOTO: { final Handler handler = new Handler() { @Override public void handleMessage(Message msg) { if (msg.what == 1) { // CommonUtil.toastShort(ApplyDetailActivity.this, (String) msg.obj); if (null != uploadingTextView) { final String url = (String) msg.obj; LinearLayout item = (LinearLayout) uploadingTextView.getParent().getParent(); updateCustomerDetails(item.getTag(), url); uploadingTextView.setVisibility(View.GONE); ImageView iv_view = (ImageView) item.findViewById(R.id.apply_detail_view); iv_view.setVisibility(View.VISIBLE); iv_view.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(ApplyDetailActivity.this, ImageViewer.class); i.putExtra("url", url); i.putExtra("justviewer", true); startActivity(i); } }); } } else { CommonUtil.toastShort(ApplyDetailActivity.this, getString(R.string.toast_upload_failed)); if (null != uploadingTextView) { uploadingTextView.setText(getString(R.string.apply_upload_again)); uploadingTextView.setClickable(true); } } } }; if (null != uploadingTextView) { uploadingTextView.setText(getString(R.string.apply_uploading)); uploadingTextView.setClickable(false); } new Thread() { @Override public void run() { String realPath = ""; if (requestCode == REQUEST_TAKE_PHOTO) { realPath = photoPath; } else { Uri uri = data.getData(); if (uri != null) { realPath = getRealPathFromURI(uri); } } if (TextUtils.isEmpty(realPath)) { handler.sendEmptyMessage(0); return; } CommonUtil.uploadFile(realPath, "img", new CommonUtil.OnUploadListener() { @Override public void onSuccess(String result) { try { JSONObject jo = new JSONObject(result); String url = jo.getString("result"); Message msg = new Message(); msg.what = 1; msg.obj = url; handler.sendMessage(msg); } catch (JSONException e) { handler.sendEmptyMessage(0); } } @Override public void onFailed(String message) { handler.sendEmptyMessage(0); } }); } }.start(); break; } } }
From source file:org.sirimangalo.meditationplus.ActivityMain.java
private void populateLog(JSONArray jsonLogged) { Calendar utc = Calendar.getInstance(TimeZone.getTimeZone("UTC")); int hour = utc.get(Calendar.HOUR_OF_DAY); int max_hour = 0; int max_height = 100; LinearLayout hll = (LinearLayout) findViewById(R.id.time_log); if (hll == null) return;// ww w . j av a2 s. co m hll.removeAllViews(); try { max_hour = jsonLogged.getInt(0); for (int i = 1; i < jsonLogged.length(); i++) { max_hour = Math.max(max_hour, jsonLogged.getInt(i)); } for (int i = 0; i < jsonLogged.length(); i++) { int height = (int) Math.ceil(max_height * jsonLogged.getInt(i) / max_hour); LinearLayout ll = (LinearLayout) context.getLayoutInflater().inflate(R.layout.list_item_log, null); ImageView iv = (ImageView) ll.findViewById(R.id.min_cell); iv.getLayoutParams().height = height; iv.getLayoutParams().width = hll.getWidth() / 24; TextView tv = (TextView) ll.findViewById(R.id.hour_no); tv.setText(i + ""); if (hour == i) tv.setBackgroundColor(0xFFFFFF33); ImageView sv = (ImageView) ll.findViewById(R.id.space_cell); sv.getLayoutParams().height = 100 - height; hll.addView(ll); } } catch (JSONException e) { e.printStackTrace(); } }
From source file:net.sf.aria2.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); boolean offerUpNav; // at some point after API 11 framework begins to throw, when you use old style.. if (Build.VERSION.SDK_INT < HONEYCOMB) { initLegacyPrefs();//from ww w. j a va 2 s.co m offerUpNav = false; } else offerUpNav = isOfferingUpNav(); final LinearLayout toolbarContainer = (LinearLayout) View.inflate(this, R.layout.activity_prefs, null); // transplant content view children (created for us by framework) final ViewGroup root = (ViewGroup) findViewById(android.R.id.content); final int contentChildrenCount = root.getChildCount(); final List<View> childViews = new ArrayList<>(contentChildrenCount); for (int i = 0; i < contentChildrenCount; ++i) childViews.add(root.getChildAt(i)); root.removeAllViews(); for (View childView : childViews) toolbarContainer.addView(childView); root.addView(toolbarContainer); // initialize toolbar final Toolbar toolbar = (Toolbar) toolbarContainer.findViewById(R.id.toolbar); toolbar.setTitle(getTitle()); if (offerUpNav) { toolbar.setLogo(null); toolbar.setNavigationIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha); toolbar.setNavigationOnClickListener(v -> goUp()); } else { toolbar.setNavigationIcon(null); toolbar.setLogo(R.drawable.aria2_logo); } }
From source file:so.contacts.hub.basefunction.account.ui.YellowpagePersonalInfoActivity.java
/** * //from w ww . jav a 2 s . c om * void */ private void showBirthdayDialog() { if (mBirthdayDialog == null) { mBirthdayDialog = CommonDialogFactory.getDialog(this, R.style.Theme_Ptui_Dialog_Wheel); mBirthdayDialog.setTitle(getString(R.string.putao_personal_data_birthday)); mBirthdayDialog.setNegativeButton(R.string.putao_cancel, new OnClickListener() { @Override public void onClick(View view) { mBirthdayDialog.dismiss(); } }); mBirthdayDialog.setPositiveButton(R.string.putao_confirm, new OnClickListener() { @Override public void onClick(View view) { mBirthdayDialog.dismiss(); mChangeFlag = true; int year = mYearWheelView.getCurrentItem() + mCurrentYear - 100; int month = mMonthWheelView.getCurrentItem() + 1; int day = mDayWheelView.getCurrentItem() + 1; StringBuilder sb = new StringBuilder(); sb.append(year).append("-").append(month).append("-").append(day); mBirthdaySTR = sb.toString(); mBirthdayTextView.setText(mBirthdaySTR); } }); LinearLayout wheelContainer = (LinearLayout) mBirthdayDialog.getContainerLayout(); // ?? Calendar calendar = Calendar.getInstance(); mCurrentYear = calendar.get(Calendar.YEAR); mYearWheelView = (WheelView) wheelContainer.findViewById(R.id.wheel_left); mYearWheelView.setVisibleItems(3); mYearAdapter = new WheelNumericAdapter(this, mCurrentYear - 100, mCurrentYear, getString(R.string.putao_personal_data_year)); mYearWheelView.setViewAdapter(mYearAdapter); // mMonthWheelView = (WheelView) wheelContainer.findViewById(R.id.wheel_center); mMonthWheelView.setVisibleItems(3); mMonthAdapter = new WheelNumericAdapter(this, 1, 12, getString(R.string.putao_personal_data_month)); mMonthWheelView.setViewAdapter(mMonthAdapter); // mDayWheelView = (WheelView) wheelContainer.findViewById(R.id.wheel_right); mDayWheelView.setVisibleItems(3); OnWheelChangedListener listener = new OnWheelChangedListener() { @Override public void onChanged(WheelView wheel, int oldValue, int newValue) { //????????? updateDays(mYearWheelView, mMonthWheelView, mDayWheelView); } }; mYearWheelView.addChangingListener(listener); mMonthWheelView.addChangingListener(listener); updateDays(mYearWheelView, mMonthWheelView, mDayWheelView); } //mBirthdaySTR? if (!TextUtils.isEmpty(mBirthdaySTR)) { try { String[] date = mBirthdaySTR.split("-"); String year = ""; String month = ""; String day = ""; if (date.length > 0) { year = date[0]; } // yearyear index if (!TextUtils.isEmpty(year)) { int yearIndex = Integer.parseInt(year) - (mCurrentYear - 100); mYearWheelView.setCurrentItem(yearIndex); } if (date.length > 1) { month = date[1]; } //monthmonth index if (!TextUtils.isEmpty(month)) { int monthIndex = Integer.parseInt(month) - 1; mMonthWheelView.setCurrentItem(monthIndex); } if (date.length > 2) { day = date[2]; } //dayday index if (!TextUtils.isEmpty(day)) { int dayIndex = Integer.parseInt(day) - 1; mDayWheelView.setCurrentItem(dayIndex); } } catch (Exception e) { LogUtil.w("YellowpagePersonalInfoActivity", "catch Exception throw by choosePicture", e); } } else { mYearWheelView.setCurrentItem(73); } mBirthdayDialog.show(); }
From source file:com.sim2dial.dialer.InCallActivity.java
private void displayOrHideContactPicture(LinearLayout callView, Uri pictureUri, boolean hide) { ImageView contactPicture = (ImageView) callView.findViewById(R.id.contactPicture); if (pictureUri != null) { LinphoneUtils.setImagePictureFromUri(callView.getContext(), contactPicture, Uri.parse(pictureUri.toString()), R.drawable.ic_contact); }//from w ww . j a v a 2s.c o m callView.setVisibility(hide ? View.GONE : View.VISIBLE); }