List of usage examples for android.view View findViewById
@Nullable public final <T extends View> T findViewById(@IdRes int id)
From source file:com.adithya321.sharesanalysis.fragments.DetailFragment.java
private void setSharePurchases(View view) { TextView totalSharesPurchasedTV = (TextView) view.findViewById(R.id.detail_total_shares_purchased); TextView totalValueTV = (TextView) view.findViewById(R.id.detail_total_purchased_value); TextView averageShareValueTV = (TextView) view.findViewById(R.id.detail_average_value); TextView dateOfInitialPurchaseTV = (TextView) view.findViewById(R.id.detail_date_of_purchase); int totalSharesPurchased = 0; double totalValue = 0; double averageShareValue = 0; RealmList<Purchase> purchases = share.getPurchases(); for (Purchase purchase : purchases) { if (purchase.getType().equals("buy")) { totalSharesPurchased += purchase.getQuantity(); totalValue += (purchase.getQuantity() * purchase.getPrice()); }//from w w w.ja va 2 s . c o m } if (totalSharesPurchased != 0) averageShareValue = totalValue / totalSharesPurchased; Calendar calendar = Calendar.getInstance(); calendar.setTime(share.getDateOfInitialPurchase()); String date = calendar.get(Calendar.DAY_OF_MONTH) + "/" + (calendar.get(Calendar.MONTH) + 1) + "/" + calendar.get(Calendar.YEAR); totalSharesPurchasedTV.setText(String.valueOf(totalSharesPurchased)); totalValueTV.setText(String.valueOf(NumberUtils.round(totalValue, 2))); averageShareValueTV.setText(String.valueOf(NumberUtils.round(averageShareValue, 2))); dateOfInitialPurchaseTV.setText(date); }
From source file:com.app.sniffy.MainActivity.java
public void showTerms() { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); final View dialoglayout = inflater.inflate(R.layout.terms, null); WebView webView = (WebView) dialoglayout.findViewById(R.id.termsView); webView.loadUrl("file:///android_asset/license.html"); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Terms & Conditions"); builder.setView(dialoglayout).setCancelable(false).setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { CheckBox checkBox = (CheckBox) dialoglayout.findViewById(R.id.checkBox); if (checkBox.isChecked()) { SharedPreferences.Editor editor = settings.edit(); editor.putBoolean("userconsent", true); editor.commit(); try { new GetKey(context).execute( new URI(Utils.getConfigProperty(getResources(), "generate-key") + mDeviceId + Utils.getConfigProperty(getResources(), "securekey"))); } catch (URISyntaxException e1) { Log.d("main activity key generate", e1.toString()); }//from w ww. j a v a2 s . c om } else { showTerms(); } } }); AlertDialog alert = builder.create(); alert.show(); }
From source file:com.hybris.mobile.adapter.CartAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); Object cartItem = items.get(position); View rowView = null; if (cartItem instanceof CartEntry) { CartEntry cartEntry = (CartEntry) cartItem; rowView = inflater.inflate(R.layout.cart_row, parent, false); TextView lblProductTitle = (TextView) rowView.findViewById(R.id.lbl_product_title); TextView lblProductPrice = (TextView) rowView.findViewById(R.id.lbl_price_quantity); TextView lblManufacturer = (TextView) rowView.findViewById(R.id.lbl_productManufacturer); TextView lblTotal = (TextView) rowView.findViewById(R.id.lbl_total); ImageView productImage = (ImageView) rowView.findViewById(R.id.img_product); if (StringUtils.isEmpty(cartEntry.getProduct().getManufacturer())) { lblManufacturer.setHeight(0); } else {//from ww w . j ava2 s.com lblManufacturer.setText(cartEntry.getProduct().getManufacturer()); } lblProductTitle.setText(cartEntry.getProduct().getName()); lblProductPrice.setText(cartEntry.getBasePrice().getFormattedValue() + " - " + this.getContext().getString(R.string.cartentry_quantity_placeholder) + cartEntry.getQuantity().toString()); lblManufacturer.setText(cartEntry.getProduct().getManufacturer()); lblTotal.setText(cartEntry.getTotalPrice().getFormattedValue()); UrlImageViewHelper.setUrlDrawable(productImage, cartEntry.getProduct().getThumbnail(), R.drawable.loading_drawable); } // Promotions else if (cartItem instanceof CartPromotion) { CartPromotion cartPromotion = (CartPromotion) cartItem; rowView = inflater.inflate(R.layout.promotion_row, parent, false); // Update promotions section TextView promotionsTextView = (TextView) rowView.findViewById(R.id.textView); promotionsTextView.setMovementMethod(LinkMovementMethod.getInstance()); promotionsTextView.setText(Html.fromHtml(Cart.generatePromotionString(cartPromotion))); StringUtil.removeUnderlines((Spannable) promotionsTextView.getText()); } return rowView; }
From source file:com.sakisds.icymonitor.fragments.disk.DiskFSFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); ViewGroup viewGroup = (ViewGroup) view; mEmptyView = view.findViewById(R.id.emptyhidden); mEmptyView.setOnClickListener(this); mProgressBar = view.findViewById(R.id.progressBar_list); mPullToRefreshLayout = new PullToRefreshLayout(viewGroup.getContext()); ActionBarPullToRefresh.from(getActivity()).insertLayoutInto(viewGroup) .theseChildrenArePullable(android.R.id.list, android.R.id.empty).listener(this) .setup(mPullToRefreshLayout); // Refresh fragment data refreshData();/* w w w .j av a 2 s.com*/ }
From source file:com.xixicm.de.presentation.view.adapter.SentenceDetailPageAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { View view = mInflater.inflate(R.layout.sentence_detail, null); final Sentence sentence = mSentences.get(position); JSONObject content = sentence.getJsonObjectContent(); final Checkable checkable = (Checkable) view.findViewById(R.id.content); checkable.setChecked(sentence.getIsStar()); final CheckableImageView favoriteBtn = (CheckableImageView) view.findViewById(R.id.favorite); favoriteBtn.setOnClickListener(new View.OnClickListener() { @Override/*from w ww .ja v a 2 s . co m*/ public void onClick(View v) { checkable.toggle(); if (mFavoriteClickListener != null) { mFavoriteClickListener.onFavoriteClick(sentence, checkable.isChecked()); } } }); ((TextView) view.findViewById(R.id.day)).setText(sentence.getDateline()); ((TextView) view.findViewById(R.id.en_content)).setText(" " + sentence.getContent()); ((TextView) view.findViewById(R.id.cn_content)).setText(" " + content.optString("note")); loadImg(sentence, (NetworkImageView) view.findViewById(R.id.image)); container.addView(view); return view; }
From source file:gov.in.bloomington.georeporter.adapters.ServicesAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder;/*from w w w . j av a 2 s . c o m*/ JSONObject service = getItem(position); if (convertView == null) { convertView = mInflater.inflate(android.R.layout.simple_list_item_2, null); holder = new ViewHolder(); holder.name = (TextView) convertView.findViewById(android.R.id.text1); holder.description = (TextView) convertView.findViewById(android.R.id.text2); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.name.setText(service.optString("service_name")); holder.description.setText(service.optString("description")); return convertView; }
From source file:org.openhab.habdroid.ui.OpenHABNotificationFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment Log.i(TAG, "onCreateView"); Log.d(TAG, "isAdded = " + isAdded()); View view = inflater.inflate(R.layout.openhabnotificationlist_fragment, container, false); mSwipeLayout = (SwipeRefreshLayout) view.findViewById(R.id.swipe_container); mSwipeLayout.setOnRefreshListener(this); return view;// w w w . j ava 2s . c om }
From source file:org.deviceconnect.android.uiapp.fragment.profile.DeviceOrientationProfileFragment.java
@Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { super.onCreate(savedInstanceState); View view = inflater.inflate(R.layout.fragment_device_orientation_service, container, false); view.setBackgroundColor(getResources().getColor(android.R.color.background_light)); Button registerBtn = (Button) view.findViewById(R.id.fragment_orientation_register); registerBtn.setOnClickListener(new OnClickListener() { @Override/* w ww. j a v a2 s.c o m*/ public void onClick(final View v) { registerEvent(); } }); Button unregisterBtn = (Button) view.findViewById(R.id.fragment_orientation_unregister); unregisterBtn.setOnClickListener(new OnClickListener() { @Override public void onClick(final View v) { unregisterEvent(); } }); return view; }
From source file:de.kirchnerei.bicycle.battery.BatteryListFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); mBatteryList = (RecyclerView) view.findViewById(R.id.battery_list); mBatteryList.setHasFixedSize(true);//from w w w . j a v a2s . c om // update the layout manager LinearLayoutManager linearManager = new LinearLayoutManager(getActivity()); linearManager.setOrientation(LinearLayoutManager.VERTICAL); mBatteryList.setLayoutManager(linearManager); mFormatter = getBicycleApplication().getFormatter(); mAdapter = new BatteryListAdapter(batteryItemClick, mFormatter); mBatteryList.setAdapter(mAdapter); mSwipeRefresh = (SwipeRefreshLayout) view.findViewById(R.id.swipe_container); mSwipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { doRefreshBatteryList(); } }); }
From source file:com.app.jdy.adapter.FaceValueAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null || convertView.getTag() == null) { // ?list_item convertView = listContainer.inflate(this.itemViewResource, null); TextView face_user_time = (TextView) convertView.findViewById(R.id.face_user_time); TextView face_user_name = (TextView) convertView.findViewById(R.id.face_user_name); TextView face_user_momey = (TextView) convertView.findViewById(R.id.face_user_momey); if (position % 2.0 == 0) { face_user_time.setBackgroundResource(R.drawable.item_color); face_user_name.setBackgroundResource(R.drawable.item_color); face_user_momey.setBackgroundResource(R.drawable.item_color); }/*from www.j a v a 2 s. com*/ face_user_name.setText(list.get(position).getName()); face_user_momey.setText("+" + list.get(position).getMoney()); face_user_time.setText(changeTime(list.get(position).getTime())); } return convertView; }