List of usage examples for android.widget LinearLayout setTag
public void setTag(final Object tag)
From source file:com.lkunic.lib.activityaddonlib.twopane.fragments.showcase.ItemShowcaseFragment.java
/** * Sets up the fragment and it's views.// w w w .j a va 2s . c o m * @param view The layout view. */ @Override protected void setupContent(View view) { // Make sure item data is available before setting up content. getItemData(); // Populate the view holder if needed if (viewHolder == null) { viewHolder = new ViewHolder(); viewHolder.showcaseItemImage = (ImageView) view.findViewById(R.id.showcase_image); viewHolder.showcaseItemTitle = (TextView) view.findViewById(R.id.showcase_title); viewHolder.viewPager = (ViewPager) view.findViewById(R.id.pager); viewHolder.pagerButtonBar = (LinearLayout) view.findViewById(R.id.pager_button_bar); } // Set the item image viewHolder.showcaseItemImage.setImageBitmap(getShowcaseImage()); // Set the item title viewHolder.showcaseItemTitle.setText(getShowcaseItemTitle()); // Set up the view pager ItemShowcaseInfoFragment[] infoFragments = getInfoFragments(); if (viewHolder.viewPager.getAdapter() == null) { // The ViewPager doesn't have an adapter yet, create it and populate with info fragments viewHolder.viewPager.setAdapter(new ShowcasePagerAdapter(getChildFragmentManager(), infoFragments)); viewHolder.viewPager.setOnPageChangeListener(showcasePageChangeListener); } else { // The ViewPager already has an adapter, populate it with new info fragments ShowcasePagerAdapter adapter = (ShowcasePagerAdapter) viewHolder.viewPager.getAdapter(); adapter.setPagerItems(infoFragments); adapter.notifyDataSetChanged(); } // Build the button bar for controlling the view pager ShowcaseButton showcaseButton; LinearLayout showcaseButtonContainer; LayoutParams showcaseButtonParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, 1); // Remove all buttons that could have been populated by previous item viewHolder.pagerButtonBar.removeAllViews(); for (int i = 0, n = infoFragments.length; i < n; i++) { // Create a new showcase button and populate it with data from corresponding fragment showcaseButton = new ShowcaseButton(getActivity(), infoFragments[i].getQuantity(), infoFragments[i].getQuantityName()); // Setup the showcase view so that it can be used as a tab button showcaseButtonContainer = (LinearLayout) showcaseButton.findViewById(R.id.container); showcaseButtonContainer.setTag(i); showcaseButtonContainer.setOnClickListener(showcaseButtonClickListener); showcaseButtonContainer.setBackgroundResource(i % 2 == 0 ? R.drawable.showcase_button_background_light : R.drawable.showcase_button_background_dark); // Add the button to the button bar showcaseButton.setLayoutParams(showcaseButtonParams); viewHolder.pagerButtonBar.addView(showcaseButton); } viewHolder.viewPager.setCurrentItem(0, true); selectPageButton(0); }
From source file:com.lkunic.libs.apptoolbox.twopane.fragments.ShowcaseFragment.java
/** * Sets up the fragment and it's views.//from ww w .j a va 2 s.c om * @param view The layout view. */ @Override protected void setupContent(View view) { // Make sure item data is available before setting up content. getItemData(); // Populate the view holder if needed if (viewHolder == null) { viewHolder = new ViewHolder(); viewHolder.showcaseItemImage = (ImageView) view.findViewById(R.id.item_image); viewHolder.showcaseItemTitle = (TextView) view.findViewById(R.id.item_title); viewHolder.viewPager = (ViewPager) view.findViewById(R.id.pager); viewHolder.pagerButtonBar = (LinearLayout) view.findViewById(R.id.pager_button_bar); } // Set the item image viewHolder.showcaseItemImage.setImageBitmap(getShowcaseImage()); // Set the item title viewHolder.showcaseItemTitle.setText(getShowcaseItemTitle()); // Set up the view pager ShowcaseInfoFragment[] infoFragments = getInfoFragments(); if (viewHolder.viewPager.getAdapter() == null) { // The ViewPager doesn't have an adapter yet, create it and populate with info fragments viewHolder.viewPager.setAdapter(new ShowcasePagerAdapter(getChildFragmentManager(), infoFragments)); viewHolder.viewPager.addOnPageChangeListener(showcasePageChangeListener); } else { // The ViewPager already has an adapter, populate it with new info fragments ShowcasePagerAdapter adapter = (ShowcasePagerAdapter) viewHolder.viewPager.getAdapter(); adapter.setPagerItems(infoFragments); adapter.notifyDataSetChanged(); } // Build the button bar for controlling the view pager TextButton textButton; LinearLayout showcaseButtonContainer; LinearLayout.LayoutParams showcaseButtonParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT, 1); // Remove all buttons that could have been populated by previous item viewHolder.pagerButtonBar.removeAllViews(); for (int i = 0, n = infoFragments.length; i < n; i++) { // Create a new showcase button and populate it with data from corresponding fragment textButton = new TextButton(getContext(), infoFragments[i].getPrimaryText(), infoFragments[i].getSecondaryText()); // Setup the showcase view so that it can be used as a tab button showcaseButtonContainer = (LinearLayout) textButton.findViewById(R.id.container); showcaseButtonContainer.setTag(i); showcaseButtonContainer.setOnClickListener(showcaseButtonClickListener); showcaseButtonContainer.setBackgroundResource(i % 2 == 0 ? R.drawable.pager_tab_control_background_1 : R.drawable.pager_tab_control_background_2); // Add the button to the button bar textButton.setLayoutParams(showcaseButtonParams); viewHolder.pagerButtonBar.addView(textButton); } viewHolder.viewPager.setCurrentItem(0, true); selectPageButton(0); }
From source file:org.openremote.android.console.AppSettingsActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); setTitle(R.string.settings);/*from w ww . j av a2 s. c o m*/ this.autoMode = AppSettingsModel.isAutoMode(AppSettingsActivity.this); // The main layout contains all application configuration items. LinearLayout mainLayout = new LinearLayout(this); mainLayout .setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); mainLayout.setOrientation(LinearLayout.VERTICAL); mainLayout.setBackgroundColor(0); mainLayout.setTag(R.string.settings); loadingPanelProgress = new ProgressDialog(this); // The scroll view contains appSettingsView, and make the appSettingsView can be scrolled. ScrollView scroll = new ScrollView(this); scroll.setVerticalScrollBarEnabled(true); scroll.setLayoutParams( new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, 1)); appSettingsView = new LinearLayout(this); appSettingsView .setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); appSettingsView.setOrientation(LinearLayout.VERTICAL); appSettingsView.addView(createAutoLayout()); appSettingsView.addView(createChooseControllerLabel()); currentServer = ""; if (autoMode) { appSettingsView.addView(constructAutoServersView()); } else { appSettingsView.addView(constructCustomServersView()); } appSettingsView.addView(createChoosePanelLabel()); panelSelectSpinnerView = new PanelSelectSpinnerView(this); appSettingsView.addView(panelSelectSpinnerView); appSettingsView.addView(createCacheText()); appSettingsView.addView(createClearImageCacheButton()); appSettingsView.addView(createSSLLayout()); scroll.addView(appSettingsView); mainLayout.addView(scroll); mainLayout.addView(createDoneAndCancelLayout()); setContentView(mainLayout); initSSLState(); addOnclickListenerOnDoneButton(); addOnclickListenerOnCancelButton(); progressLayout = (LinearLayout) findViewById(R.id.choose_controller_progress); }
From source file:org.ounl.lifelonglearninghub.learntracker.gis.ou.swipe.TimeLineActivity.java
/** * Recording time ASYNCHRONOUSLY//w w w . j a va 2 s. c o m * * @param v */ public void onClickRecord(View v) { LinearLayout llTimePicker = (LinearLayout) v.getParent(); LinearLayout lllFrag = (LinearLayout) llTimePicker.getParent(); LinearLayout llTime = (LinearLayout) llTimePicker.findViewById(R.id.llTimePicker); TimePicker tp = (TimePicker) llTime.findViewById(R.id.tpTask); Integer oiHour = tp.getCurrentHour(); Integer oiMin = tp.getCurrentMinute(); DateUtils du = new DateUtils(); long lmills = du.toMills(oiHour, oiMin); ActivitySession as = Session.getSingleInstance().getActivity(mViewPager.getCurrentItem()); String sSubjectId = as.getId_subject(); double dLat = as.getLocation_latitude(); double dLong = as.getLocation_longitude(); long lCheckIn = new Date().getTime(); long lCheckOut = lCheckIn + lmills; // Save data into both databases Log.i(CLASSNAME, "Recording activity into both databasees:" + as.getId_subject() + " / " + du.duration(lCheckIn, lCheckOut)); // TODO make some control here to make this transactional recordActivityBackend(sSubjectId, lCheckIn, lCheckOut, dLat, dLong, ActivityDO.ACTIVITY_RECORD_MODE_ASYNCHRONOUS); recordActivitySQLite(sSubjectId, lCheckIn, lCheckOut, dLat, dLong); TextView tvDuration = (TextView) lllFrag.findViewById(R.id.tvDuration); tvDuration.setText( du.duration(Session.getSingleInstance().getDatabaseHandler().getAccumulatedTime(sSubjectId))); // // Update history layout // LayoutInflater inflater = LayoutInflater.from(this); LinearLayout llParent = (LinearLayout) inflater.inflate(R.layout.check_item, null); LinearLayout liContent = (LinearLayout) llParent.getChildAt(0); TextView tvTimeStamp = (TextView) liContent.findViewById(R.id.textViewTimeStamp); tvTimeStamp.setText(Constants.TIME_FORMAT.format(lCheckIn)); tvTimeStamp.setTag(Long.valueOf(lCheckIn)); TextView tvDurRecord = (TextView) liContent.findViewById(R.id.textViewDuration); tvDurRecord.setText(" [" + du.duration(lCheckIn, lCheckOut) + "]"); // Passing subject id as parameter tvDurRecord.setTag(sSubjectId); LinearLayout llHistory = (LinearLayout) lllFrag.findViewById(R.id.llHistory); // Set index number so that the record can be removed int iTag = (llHistory.getChildCount() - 1) / 2; llParent.setTag(iTag); llHistory.addView(inflater.inflate(R.layout.tag_divider, llHistory, false), 1); llHistory.addView(llParent, 2); Toast.makeText(getApplicationContext(), "Recorded " + du.duration(lCheckIn, lCheckOut), Toast.LENGTH_SHORT) .show(); }
From source file:org.gots.allotment.adapter.ListAllotmentAdapter.java
@SuppressWarnings("deprecation") @Override//from w w w . jav a 2 s. c o m public View getView(final int position, View convertView, ViewGroup parent) { LinearLayout ll = (LinearLayout) convertView; Holder holder; if (ll == null) { holder = new Holder(); ll = (LinearLayout) LayoutInflater.from(mContext).inflate(R.layout.list_allotments, parent, false); if (GotsPreferences.DEBUG) { TextView textView = new TextView(mContext); textView.setText("(" + getItem(position).getId() + ")" + getItem(position).getUUID()); ll.addView(textView); } holder.listSeeds = (GridView) ll.findViewById(R.id.IdGrowingSeedList); holder.titlebar = (LinearLayout) ll.findViewById(R.id.idAllotmentTitlebar); holder.allotmentName = (TextView) ll.findViewById(R.id.textAllotmentName); holder.menu = (LinearLayout) ll.findViewById(R.id.idAllotmentMenu); holder.allotment = getItem(position); ll.setTag(holder); ll.setDescendantFocusability(LinearLayout.FOCUS_BLOCK_DESCENDANTS); // ll.setOnClickListener(this); } else holder = (Holder) ll.getTag(); WindowManager wm = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE); Display display = wm.getDefaultDisplay(); int width; int sdk = android.os.Build.VERSION.SDK_INT; if (sdk < android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH) { width = display.getWidth(); } else { Point size = new Point(); display.getSize(size); width = size.x; } int layoutsize = 150; if (width <= 480) layoutsize = 50; int nbcolumn = (width - 200) / layoutsize; if (nbcolumn < 1) nbcolumn = 1; holder.listSeeds.setNumColumns(nbcolumn); listGrowingSeedAdapter = new ListGrowingSeedAdapter(mContext, getItem(position).getSeeds()); holder.listSeeds.setAdapter(listGrowingSeedAdapter); holder.listSeeds.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, layoutsize)); if (listGrowingSeedAdapter.getCount() > 0) { holder.listSeeds.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, (holder.listSeeds.getCount() / nbcolumn + 1) * layoutsize + layoutsize)); // holder.listSeeds.setLayoutParams(new // LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, // LayoutParams.WRAP_CONTENT)); } // else // holder.listSeeds.setLayoutParams(new // LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, // ((holder.listSeeds.getCount() / nbcolumn) + 1) * layoutsize)); holder.allotmentName.setText(getItem(position).getName()); // holder.titlebar.removeAllViews(); holder.menu.setTag(holder); holder.menu.setOnClickListener(this); // SowingAction sow = new SowingAction(mContext); // ActionWidget widget = new ActionWidget(mContext, sow); // widget.setTag(position); if (isSelectable) { holder.menu.setBackgroundResource(R.anim.rotate_alerte); // Animation myFadeInAnimation = // AnimationUtils.loadAnimation(mContext, R.anim.rotate_alerte); // menu.startAnimation(myFadeInAnimation); AnimationDrawable frameAnimation = (AnimationDrawable) holder.menu.getBackground(); frameAnimation.start(); holder.menu.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { new AsyncTask<Void, Integer, GrowingSeedInterface>() { @Override protected GrowingSeedInterface doInBackground(Void... params) { GotsGrowingSeedManager growingSeedManager = GotsGrowingSeedManager.getInstance() .initIfNew(mContext); GotsSeedManager seedManager = GotsSeedManager.getInstance().initIfNew(mContext); // NuxeoGrowingSeedProvider provider = new // NuxeoGrowingSeedProvider(mContext); GrowingSeedInterface growingSeed = (GrowingSeedInterface) seedManager .getSeedById(currentSeedId); growingSeed.setDateSowing(Calendar.getInstance().getTime()); return growingSeedManager.plantingSeed(growingSeed, getItem(position)); } @Override protected void onPostExecute(GrowingSeedInterface seed) { // notifyDataSetChanged(); Toast.makeText(mContext, "Sowing" + " " + SeedUtil.translateSpecie(mContext, seed), Toast.LENGTH_LONG).show(); mContext.sendBroadcast(new Intent(BroadCastMessages.SEED_DISPLAYLIST)); ((Activity) mContext).finish(); } }.execute(); } }); } // widget.setPadding(4, 4, 4, 8); // holder.menu.addView(widget); // // SowingAction sow = new SowingAction(mContext); // ImageView widgetSensor = new ImageView(mContext); // widgetSensor.setImageDrawable(mContext.getResources().getDrawable(R.drawable.ic_sensor)); // widgetSensor.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.action_selector)); // widgetSensor.setTag(position); // widgetSensor.setOnClickListener(new View.OnClickListener() { // // @Override // public void onClick(View v) { // // GotsPurchaseItem purchaseItem = new GotsPurchaseItem(mContext); // // // if (!purchaseItem.getFeatureParrot() ? true : // purchaseItem.isPremium()) { // if (!purchaseItem.getFeatureParrot() || purchaseItem.isPremium()) { // FragmentManager fm = mContext.getSupportFragmentManager(); // GotsBillingDialog editNameDialog = new // GotsBillingDialog(GotsPurchaseItem.SKU_FEATURE_PARROT); // editNameDialog.setStyle(DialogFragment.STYLE_NORMAL, // R.style.CustomDialog); // editNameDialog.show(fm, "fragment_edit_name"); // } else { // Intent sensorIntent = new Intent(mContext, SensorActivity.class); // mContext.startActivity(sensorIntent); // }// new AsyncTask<Void, Void, List<ParrotLocation>>() { // // private LocationListAdapter sensorListAdapter; // // // // List<ParrotSampleFertilizer> samplesFertilizer = null; // // // // List<ParrotSampleTemperature> samplesTemp = null; // // // // @Override // // protected List<ParrotLocation> doInBackground(Void... params) { // // ParrotSensorProvider sensorProvider = new // ParrotSensorProvider(mContext); // // List<ParrotLocation> locations = sensorProvider.getLocations(); // // sensorProvider.getStatus(); // // samplesFertilizer = // sensorProvider.getSamples(locations.get(0).getLocation_identifier()); // // samplesTemp = // sensorProvider.getSamples2(locations.get(0).getLocation_identifier()); // // // // return locations; // // } // // // // protected void onPostExecute(List<ParrotLocation> result) { // // // sensorListAdapter = new SensorListAdapter(mContext, result); // // sensorListAdapter = new LocationListAdapter(mContext, result); // // // new AlertDialog.Builder(mContext).setAdapter(sensorListAdapter, // // // new DialogInterface.OnClickListener() { // // // // // // @Override // // // public void onClick(DialogInterface dialog, int which) { // // // Toast.makeText(mContext, // sensorListAdapter.getItem(which).getSensor_serial(), // // // Toast.LENGTH_SHORT).show(); // // // ; // // // } // // // }).show(); // // // // Intent sensorIntent = new Intent(mContext, SensorActivity.class); // // mContext.startActivity(sensorIntent); // // // // if (samplesFertilizer != null) { // // WebView webView = new WebView(mContext); // // String chd = new String(); // // for (ParrotSampleFertilizer fertilizer : samplesFertilizer) { // // chd = chd.concat(String.valueOf(fertilizer.getFertilizer_level() * // 100)); // // chd = chd.concat(","); // // } // // chd = chd.substring(0, chd.length() - 1); // // String url = // "http://chart.apis.google.com/chart?cht=ls&chs=250x100&chd=t:" + chd; // // webView.loadUrl(url); // // Log.d(ListAllotmentAdapter.class.getName(), url); // // AlertDialog.Builder alert = new AlertDialog.Builder(mContext); // // alert.setView(webView); // // alert.show(); // // } // // if (samplesTemp != null) { // // WebView webView = new WebView(mContext); // // String chd = new String(); // // int i = 0; // // for (ParrotSampleTemperature sampleTemp : samplesTemp) { // // chd = // chd.concat(String.valueOf(sampleTemp.getAir_temperature_celsius())); // // chd = chd.concat(","); // // if (i++ >= 50) // // break; // // } // // chd = chd.substring(0, chd.length() - 1); // // String url = // "http://chart.apis.google.com/chart?cht=ls&chs=250x100&chd=t:" + chd; // // webView.loadUrl(url); // // Log.d(ListAllotmentAdapter.class.getName(), url); // // AlertDialog.Builder alert = new AlertDialog.Builder(mContext); // // alert.setView(webView); // // alert.show(); // // } // // }; // // }.execute(); // } // }); // // widgetSensor.setPadding(4, 4, 4, 8); // holder.menu.addView(widgetSensor); return ll; }
From source file:org.ounl.lifelonglearninghub.learntracker.gis.ou.swipe.TimeLineActivity.java
/** * On click image view to start stop recording * // w w w . j a v a 2 s .c om * Records time SYNCHRONOUSLY * * @param v */ public void onClickSwitchAction(View v) { Drawable drwStart = getResources().getDrawable(R.drawable.play); Drawable drwStop = getResources().getDrawable(R.drawable.stop); LinearLayout lllFrag = (LinearLayout) v.getParent(); LinearLayout llTimePicker = (LinearLayout) lllFrag.findViewById(R.id.llTimePicker); LinearLayout llStatus = (LinearLayout) lllFrag.findViewById(R.id.llStatus); TextView tvRecording = (TextView) llStatus.findViewById(R.id.tvRecording); ImageView ivRecording = (ImageView) llStatus.findViewById(R.id.ivRecording); Animation anim = new AlphaAnimation(0.0f, 1.0f); Log.d(CLASSNAME, "BEFORE: " + Session.getSingleInstance().getActivity(mViewPager.getCurrentItem()).toString()); ImageView iv = (ImageView) v; int currentStatus = Session.getSingleInstance().getActivity(mViewPager.getCurrentItem()).getStatus(); if (currentStatus == ActivitySession.STATUS_STOPPED) { Log.d(CLASSNAME, "Status is STOPPED. Shift to STARTED"); iv.setImageDrawable(drwStop); llTimePicker.setVisibility(View.INVISIBLE); anim.setDuration(500); anim.setStartOffset(20); anim.setRepeatMode(Animation.REVERSE); anim.setRepeatCount(Animation.INFINITE); Session.getSingleInstance().getActivity(mViewPager.getCurrentItem()).doCheckIn(); } else { Log.d(CLASSNAME, "Status is STARTED. Shift to STOPPED"); iv.setImageDrawable(drwStart); llTimePicker.setVisibility(View.VISIBLE); anim.setRepeatCount(0); ActivitySession as = Session.getSingleInstance().getActivity(mViewPager.getCurrentItem()); String sSubjectId = as.getId_subject(); double dLat = as.getLocation_latitude(); double dLong = as.getLocation_longitude(); long lCheckOut = new Date().getTime(); long lCheckIn = Session.getSingleInstance().getActivity(mViewPager.getCurrentItem()).doCheckOut(); // Save data into both databases DateUtils du = new DateUtils(); Log.i(CLASSNAME, "Recording activity into both databasees:" + as.getId_subject() + " / " + du.duration(lCheckIn, lCheckOut)); // TODO make some control here to make this transactional // Save in backend recordActivityBackend(sSubjectId, lCheckIn, lCheckOut, dLat, dLong, ActivityDO.ACTIVITY_RECORD_MODE_SYNCHRONOUS); // Save in local database recordActivitySQLite(sSubjectId, lCheckIn, lCheckOut, dLat, dLong); TextView tvDuration = (TextView) lllFrag.findViewById(R.id.tvDuration); tvDuration.setText( du.duration(Session.getSingleInstance().getDatabaseHandler().getAccumulatedTime(sSubjectId))); Toast.makeText(getApplicationContext(), "Recorded " + du.duration(lCheckIn, lCheckOut), Toast.LENGTH_SHORT).show(); // // Update history layout // LayoutInflater inflater = LayoutInflater.from(this); LinearLayout llParent = (LinearLayout) inflater.inflate(R.layout.check_item, null); LinearLayout liContent = (LinearLayout) llParent.getChildAt(0); // ImageView ivParent = (ImageView) liContent.findViewById(R.id.imageViewStart); // ivParent.setImageResource(R.drawable.rec_50x); //TextView tvTimeStamp = (TextView) liContent.getChildAt(1); TextView tvTimeStamp = (TextView) liContent.findViewById(R.id.textViewTimeStamp); tvTimeStamp.setText(Constants.TIME_FORMAT.format(lCheckIn)); tvTimeStamp.setTag(Long.valueOf(lCheckIn)); TextView tvDurRecord = (TextView) liContent.findViewById(R.id.textViewDuration); tvDurRecord.setText(" [" + du.duration(lCheckIn, lCheckOut) + "]"); // Passing subject id as parameter tvDurRecord.setTag(sSubjectId); LinearLayout llHistory = (LinearLayout) lllFrag.findViewById(R.id.llHistory); // Set index number so that the record can be removed int iTag = (llHistory.getChildCount() - 1) / 2; llParent.setTag(iTag); llHistory.addView(inflater.inflate(R.layout.tag_divider, llHistory, false), 1); llHistory.addView(llParent, 2); } tvRecording.startAnimation(anim); ivRecording.startAnimation(anim); Log.d(CLASSNAME, "AFTER: " + Session.getSingleInstance().getActivity(mViewPager.getCurrentItem()).toString()); }
From source file:com.example.zf_android.trade.ApplyDetailActivity.java
private LinearLayout getDetailItem(int itemType, String key, String value, Object tag) { LinearLayout item; switch (itemType) { case ITEM_EDIT: item = (LinearLayout) mInflater.inflate(R.layout.apply_detail_item_edit, null); break;/* w w w. jav a 2 s .co m*/ case ITEM_CHOOSE: item = (LinearLayout) mInflater.inflate(R.layout.apply_detail_item_choose, null); break; case ITEM_UPLOAD: item = (LinearLayout) mInflater.inflate(R.layout.apply_detail_item_upload, null); break; case ITEM_VIEW: item = (LinearLayout) mInflater.inflate(R.layout.apply_detail_item_view, null); break; default: item = (LinearLayout) mInflater.inflate(R.layout.apply_detail_item_edit, null); } item.setTag(tag); setupItem(item, itemType, key, value); return item; }
From source file:com.cssweb.android.base.QuoteGridActivity.java
protected void refreshHSZSUI(List<CssStock> list, String[] cols) throws JSONException { LinearLayout localLinearLayout1 = (LinearLayout) this.findViewById(R.id.zr_htable_lock); LinearLayout localLinearLayout2 = (LinearLayout) this.findViewById(R.id.zr_htable_linearlayout); this.mLinerLock = localLinearLayout1; this.mLinerHScroll = localLinearLayout2; this.mLinerLock.removeAllViews(); this.mLinerHScroll.removeAllViews(); if (nameOrcode) AddViewItem(cols[0], Utils.getTextColor(mContext, 0), mLinerLock, -1, 0, 0, true); else/* w ww. j ava 2 s. c o m*/ AddViewItem(cols[1], Utils.getTextColor(mContext, 0), mLinerLock, -1, 0, 0, true); LinearLayout l1 = new LinearLayout(this); for (int i = 2; i < cols.length; i++) { if (i == cols.length - 1) AddViewItem(cols[i], Utils.getTextColor(mContext, 0), l1, -i, 100, 0, true); else AddViewItem(cols[i], Utils.getTextColor(mContext, 0), l1, -i, i - 1, 0, true); } mLinerHScroll.addView(l1); int mDigit = 1; double d0 = 0; for (int i = 1; i <= list.size(); i++) { CssStock cs = list.get(i - 1); try { d0 = cs.getZrsp(); //?? mDigit = Utils.getNumFormat(cs.getMarket(), cs.getStkcode()); if (nameOrcode) AddViewItem(cs.getStkname(), Utils.getTextColor(mContext, 1), mLinerLock, i, 0, i, true); else AddViewItem(cs.getStkcode(), Utils.getTextColor(mContext, 1), mLinerLock, i, 0, i, true); l1 = new LinearLayout(this); l1.setTag(i); if (cs.getStkcode() == null || cs.getStkcode().equals("") || cs.getStkname() == null || cs.getStkname().equals("")) { AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 1, i, false); AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 2, i, false); AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 3, i, false); AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 4, i, false); AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 5, i, false); AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 6, i, false); AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 7, i, false); AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 8, i, false); AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 9, i, false); } else { String str1; if (cs.getZf() == 0) str1 = Utils.dataFormation(cs.getZf() * 100, 1); else str1 = Utils.dataFormation(cs.getZf() * 100, 1); AddViewItem(Utils.dataFormation(cs.getZjcj(), mDigit), Utils.getTextColor(mContext, cs.getZjcj(), d0), l1, i, 1, i, true); AddViewItem(str1, Utils.getTextColor(mContext, cs.getZf()), l1, i, 2, i, true); AddViewItem(Utils.dataFormation(cs.getZd(), mDigit), Utils.getTextColor(mContext, cs.getZd()), l1, i, 3, i, true); AddViewItem(Utils.getAmountFormat(cs.getZje(), false, 1), Utils.getTextColor(mContext, 2), l1, i, 4, i, true); AddViewItem(Utils.dataFormation(cs.getJrkp(), mDigit), Utils.getTextColor(mContext, cs.getJrkp(), d0), l1, i, 5, i, true); AddViewItem(Utils.dataFormation(cs.getZrsp(), mDigit), Utils.getTextColor(mContext, 0), l1, i, 6, i, true); AddViewItem(Utils.dataFormation(cs.getZgcj(), mDigit), Utils.getTextColor(mContext, cs.getZgcj(), d0), l1, i, 7, i, true); AddViewItem(Utils.dataFormation(cs.getZdcj(), mDigit), Utils.getTextColor(mContext, cs.getZdcj(), d0), l1, i, 8, i, true); AddViewItem(Utils.dataFormation(cs.getAmp() * 100, 1) + "%", Utils.getTextColor(mContext, 5), l1, i, 100, i, true); } } catch (Exception e) { for (int j = 1; j <= len - 2; j++) { AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, j, i, false); } e.printStackTrace(); } mLinerHScroll.addView(l1); } }
From source file:com.cssweb.android.base.QuoteGridActivity.java
protected void refreshIndexUI(List<CssStock> list, String[] cols) throws JSONException { LinearLayout localLinearLayout1 = (LinearLayout) this.findViewById(R.id.zr_htable_lock); LinearLayout localLinearLayout2 = (LinearLayout) this.findViewById(R.id.zr_htable_linearlayout); this.mLinerLock = localLinearLayout1; this.mLinerHScroll = localLinearLayout2; this.mLinerLock.removeAllViews(); this.mLinerHScroll.removeAllViews(); if (nameOrcode) AddViewItem(cols[0], Utils.getTextColor(mContext, 0), mLinerLock, -1, 0, 0, true); else/* ww w .ja v a 2 s.c o m*/ AddViewItem(cols[1], Utils.getTextColor(mContext, 0), mLinerLock, -1, 0, 0, true); LinearLayout l1 = new LinearLayout(this); for (int i = 2; i < cols.length; i++) { if (i == cols.length - 1) AddViewItem(cols[i], Utils.getTextColor(mContext, 0), l1, -i, 100, 0, true); else AddViewItem(cols[i], Utils.getTextColor(mContext, 0), l1, -i, i - 1, 0, true); } mLinerHScroll.addView(l1); int mDigit = 1; double d0 = 0; for (int i = 1; i <= list.size(); i++) { CssStock cs = list.get(i - 1); d0 = cs.getZrsp(); //?? mDigit = Utils.getNumFormat(cs.getMarket(), cs.getStkcode()); //mLinerLock.setTag(i); if (nameOrcode) AddViewItem(Utils.clearSpace(cs.getStkname()), Utils.getTextColor(mContext, 1), mLinerLock, i, 0, i, true); else AddViewItem(cs.getStkcode(), Utils.getTextColor(mContext, 1), mLinerLock, i, 0, i, true); l1 = new LinearLayout(this); l1.setTag(i); if (cs.getStkcode() == null || cs.getStkcode().equals("") || cs.getStkname() == null || cs.getStkname().equals("")) { AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 1, i, true); AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 2, i, true); AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 3, i, true); AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 4, i, true); AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 5, i, true); AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 6, i, true); AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 7, i, true); AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 8, i, true); AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 9, i, true); AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 10, i, true); AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 11, i, true); AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 11, i, true); AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 11, i, true); AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 11, i, true); AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 11, i, true); AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 11, i, true); AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 11, i, true); AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 100, i, true); } else { // String str1; // if(cs.getZf()==0) // str1 = Utils.dataFormation(cs.getZf()*100, 1) + "%"; // else // str1 = Utils.dataFormation(cs.getZf()*100, 1) + "%"; AddViewItem(Utils.dataFormation(cs.getZjcj(), mDigit), Utils.getTextColor(mContext, cs.getZjcj(), d0), l1, i, 1, i, true); AddViewItem(Utils.dataFormation(cs.getZf() * 100, 1), Utils.getTextColor(mContext, cs.getZf()), l1, i, 2, i, true); AddViewItem(Utils.getAmountFormat(cs.getZje(), false, 1), Utils.getTextColor(mContext, 2), l1, i, 3, i, true); AddViewItem(Utils.dataFormation(cs.getZd(), mDigit), Utils.getTextColor(mContext, cs.getZd()), l1, i, 4, i, true); AddViewItem(Utils.getAmountFormat(cs.getZl(), false, 1), Utils.getTextColor(mContext, 1), l1, i, 5, i, true); AddViewItem(Utils.getAmountFormat(cs.getXs(), false, 1), Utils.getTextColor(mContext, 1), l1, i, 6, i, true); AddViewItem(Utils.dataFormation(cs.getJrkp(), mDigit), Utils.getTextColor(mContext, cs.getJrkp(), d0), l1, i, 7, i, true); AddViewItem(Utils.dataFormation(cs.getZrsp(), mDigit), Utils.getTextColor(mContext, 0), l1, i, 8, i, true); AddViewItem(Utils.dataFormation(cs.getZgcj(), mDigit), Utils.getTextColor(mContext, cs.getZgcj(), d0), l1, i, 9, i, true); AddViewItem(Utils.dataFormation(cs.getZdcj(), mDigit), Utils.getTextColor(mContext, cs.getZdcj(), d0), l1, i, 10, i, true); AddViewItem(Utils.dataFormation(cs.getAmp() * 100, 1), Utils.getTextColor(mContext, 5), l1, i, 11, i, true); //AddViewItem(Utils.dataFormation(cs.getLb(), 1), Utils.getTextColor(mContext, 1), l1, i, 100, i, true); AddViewItem(Utils.dataFormation(cs.getLb(), 1), Utils.getTextColor(mContext, 1), l1, i, 12, i, true); AddViewItem(cs.getJtsy(), Utils.getTextColor(mContext, 0), l1, i, 13, i, true); AddViewItem(cs.getPjgb(), Utils.getTextColor(mContext, 0), l1, i, 14, i, true); AddViewItem(cs.getZsz(), Utils.getTextColor(mContext, 0), l1, i, 15, i, true); AddViewItem(cs.getZb(), Utils.getTextColor(mContext, 0), l1, i, 16, i, true); AddViewItem(cs.getYbjj(), Utils.getTextColor(mContext, 0), l1, i, 17, i, true); AddViewItem(cs.getYbsl(), Utils.getTextColor(mContext, 0), l1, i, 100, i, true); } mLinerHScroll.addView(l1); } }
From source file:com.cssweb.android.base.QuoteGridActivity.java
protected void refreshUI(List<CssStock> list, String[] cols) throws JSONException { LinearLayout localLinearLayout1 = (LinearLayout) this.findViewById(R.id.zr_htable_lock); LinearLayout localLinearLayout2 = (LinearLayout) this.findViewById(R.id.zr_htable_linearlayout); this.mLinerLock = localLinearLayout1; this.mLinerHScroll = localLinearLayout2; this.mLinerLock.removeAllViews(); this.mLinerHScroll.removeAllViews(); if (nameOrcode) AddViewItem(cols[0], Utils.getTextColor(mContext, 0), mLinerLock, -1, 0, 0, true); else/*from w w w . ja v a2 s. co m*/ AddViewItem(cols[1], Utils.getTextColor(mContext, 0), mLinerLock, -1, 0, 0, true); LinearLayout l1 = new LinearLayout(this); for (int i = 2; i < cols.length; i++) { if (i == cols.length - 1) AddViewItem(cols[i], Utils.getTextColor(mContext, 0), l1, -i, 100, 0, true); else AddViewItem(cols[i], Utils.getTextColor(mContext, 0), l1, -i, i - 1, 0, true); } mLinerHScroll.addView(l1); int mDigit = 1; double d0 = 0; for (int i = 1; i <= list.size(); i++) { CssStock cs = list.get(i - 1); d0 = cs.getZrsp(); //?? mDigit = Utils.getNumFormat(cs.getMarket(), cs.getStkcode()); //mLinerLock.setTag(i); if (nameOrcode) AddViewItem(Utils.clearSpace(cs.getStkname()), Utils.getTextColor(mContext, 1), mLinerLock, i, 0, i, true); else AddViewItem(cs.getStkcode(), Utils.getTextColor(mContext, 1), mLinerLock, i, 0, i, true); l1 = new LinearLayout(this); l1.setTag(i); if (cs.getStkcode() == null || cs.getStkcode().equals("") || cs.getStkname() == null || cs.getStkname().equals("")) { AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 1, i, true); AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 2, i, true); AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 3, i, true); AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 4, i, true); AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 5, i, true); AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 6, i, true); AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 7, i, true); AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 8, i, true); AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 9, i, true); AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 10, i, true); AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 11, i, true); AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 12, i, true); AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 13, i, true); AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 14, i, true); AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 15, i, true); AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 16, i, true); AddViewItem("", Utils.getTextColor(mContext, 0), l1, i, 100, i, true); } else if (cs.getTp() == 1) { AddViewItem(Utils.TP_TAG, Utils.getTextColor(mContext, 0), l1, i, 1, i, true); AddViewItem(Utils.TP_TAG, Utils.getTextColor(mContext, 0), l1, i, 2, i, true); AddViewItem(Utils.TP_TAG, Utils.getTextColor(mContext, 0), l1, i, 3, i, true); AddViewItem(Utils.TP_TAG, Utils.getTextColor(mContext, 0), l1, i, 4, i, true); AddViewItem(Utils.TP_TAG, Utils.getTextColor(mContext, 0), l1, i, 5, i, true); AddViewItem(Utils.TP_TAG, Utils.getTextColor(mContext, 0), l1, i, 6, i, true); AddViewItem(Utils.TP_TAG, Utils.getTextColor(mContext, 0), l1, i, 7, i, true); AddViewItem(Utils.TP_TAG, Utils.getTextColor(mContext, 0), l1, i, 8, i, true); AddViewItem(Utils.TP_TAG, Utils.getTextColor(mContext, 0), l1, i, 9, i, true); AddViewItem(Utils.dataFormation(cs.getZrsp(), mDigit), Utils.getTextColor(mContext, 0), l1, i, 10, i, true); AddViewItem(Utils.TP_TAG, Utils.getTextColor(mContext, 0), l1, i, 11, i, true); AddViewItem(Utils.TP_TAG, Utils.getTextColor(mContext, 0), l1, i, 12, i, true); AddViewItem(Utils.TP_TAG, Utils.getTextColor(mContext, 0), l1, i, 13, i, true); AddViewItem(Utils.TP_TAG, Utils.getTextColor(mContext, 0), l1, i, 14, i, true); AddViewItem(Utils.TP_TAG, Utils.getTextColor(mContext, 0), l1, i, 15, i, true); AddViewItem(Utils.TP_TAG, Utils.getTextColor(mContext, 0), l1, i, 16, i, true); AddViewItem(Utils.TP_TAG, Utils.getTextColor(mContext, 0), l1, i, 100, i, true); } else { // String str1; // if(cs.getZf()==0) // str1 = Utils.dataFormation(cs.getZf()*100, 1) + "%"; // else // str1 = Utils.dataFormation(cs.getZf()*100, 1) + "%"; AddViewItem(Utils.dataFormation(cs.getZf() * 100, 1), Utils.getTextColor(mContext, cs.getZf()), l1, i, 1, i, true); AddViewItem(Utils.dataFormation(cs.getZjcj(), mDigit), Utils.getTextColor(mContext, cs.getZjcj(), d0), l1, i, 2, i, true); AddViewItem(Utils.dataFormation(cs.getZd(), mDigit), Utils.getTextColor(mContext, cs.getZd()), l1, i, 3, i, true); AddViewItem(Utils.dataFormation(cs.getBjw1(), mDigit), Utils.getTextColor(mContext, cs.getBjw1(), d0), l1, i, 4, i, true); AddViewItem(Utils.dataFormation(cs.getSjw1(), mDigit), Utils.getTextColor(mContext, cs.getSjw1(), d0), l1, i, 5, i, true); AddViewItem(Utils.getAmountFormat(cs.getZl(), false, 1), Utils.getTextColor(mContext, 1), l1, i, 6, i, true); //AddViewItem(Utils.getAmountFormat(cs.getXs(), false, 1), Utils.getTextColor(mContext, 1), l1, i, 7, i, true); AddViewItem(Utils.getAmountFormat(cs.getXs(), false, 1), Utils.getTextColor(mContext, Utils.getColorFromBS(cs.getBsFlag())), l1, i, 7, i, true); // AddViewItem(Utils.dataFormation(cs.getHs()*100, 1) + "%", Utils.getTextColor(mContext, 5), l1, i, 8, i, true); //%? AddViewItem(Utils.dataFormation(cs.getHs() * 100, 1), Utils.getTextColor(mContext, 5), l1, i, 8, i, true); AddViewItem(Utils.dataFormation(cs.getJrkp(), mDigit), Utils.getTextColor(mContext, cs.getJrkp(), d0), l1, i, 9, i, true); AddViewItem(Utils.dataFormation(cs.getZrsp(), mDigit), Utils.getTextColor(mContext, 0), l1, i, 10, i, true); AddViewItem(Utils.dataFormation(cs.getZgcj(), mDigit), Utils.getTextColor(mContext, cs.getZgcj(), d0), l1, i, 11, i, true); AddViewItem(Utils.dataFormation(cs.getZdcj(), mDigit), Utils.getTextColor(mContext, cs.getZdcj(), d0), l1, i, 12, i, true); AddViewItem(Utils.getAmountFormat(cs.getZje(), false, 1), Utils.getTextColor(mContext, 2), l1, i, 13, i, true); AddViewItem(Utils.dataFormation(cs.getAmp() * 100, 1), Utils.getTextColor(mContext, 5), l1, i, 14, i, true); AddViewItem(Utils.dataFormation(cs.getLb(), 1), Utils.getTextColor(mContext, 1), l1, i, 15, i, true); // AddViewItem(Utils.dataFormation(cs.getWb(), 1), Utils.getTextColor(mContext, 5), l1, i, 16, i, true); //??? AddViewItem(Utils.dataFormation(cs.getWb() * 100, 1), Utils.getTextColor(mContext, cs.getWb()), l1, i, 16, i, true); AddViewItem(Utils.getAmountFormat(cs.getWc(), false), Utils.getTextColor(mContext, cs.getWc()), l1, i, 100, i, true); } mLinerHScroll.addView(l1); } }