List of usage examples for android.widget RelativeLayout findViewById
@Nullable public final <T extends View> T findViewById(@IdRes int id)
From source file:ca.mimic.apphangar.Settings.java
public synchronized static void updateListView(final boolean setAdapter) { Runnable runnable = new Runnable() { public void run() { if (!mAppsLoaded) { RelativeLayout bg = (RelativeLayout) lv.getParent(); bg.findViewById(R.id.loading_text).setVisibility(View.GONE); mAppsLoaded = true;/*from w ww . j av a 2s. c om*/ } if (setAdapter) { lv.setAdapter(mAppRowAdapter); } lv.invalidateViews(); mAppRowAdapter.notifyDataSetChanged(); } }; mInstance.runOnUiThread(runnable); }
From source file:org.openhab.habdroid.ui.OpenHABWidgetArrayAdapter.java
private TextView getValueTextView(RelativeLayout widgetView, OpenHABWidget openHABWidget) { // Get TextView for widget value and set it's color Integer valueColor = openHABWidget.getValueColor(); TextView valueTextView = (TextView) widgetView.findViewById(R.id.widgetvalue); if (valueColor != null && valueTextView != null) { Log.d(HABApplication.getLogTag(), String.format("Setting value color to %d", valueColor)); valueTextView.setTextColor(valueColor); } else if (valueTextView != null) { TextView defaultTextView = new TextView(widgetView.getContext()); valueTextView.setTextColor(defaultTextView.getTextColors().getDefaultColor()); }/*w ww.jav a 2s . c om*/ return valueTextView; }
From source file:org.openhab.habdroid.ui.OpenHABWidgetArrayAdapter.java
private TextView getLabelTextView(RelativeLayout widgetView, OpenHABWidget openHABWidget) { // Get TextView for widget label and set it's color Integer labelColor = openHABWidget.getLabelColor(); TextView labelTextView = (TextView) widgetView.findViewById(R.id.widgetlabel); if (labelColor != null && labelTextView != null) { Log.d(HABApplication.getLogTag(), String.format("Setting label color to %d", labelColor)); labelTextView.setTextColor(labelColor); } else if (labelTextView != null) { TextView defaultTextView = new TextView(widgetView.getContext()); labelTextView.setTextColor(defaultTextView.getTextColors().getDefaultColor()); }//ww w . j av a 2s . c o m return labelTextView; }
From source file:org.openhab.habdroid.ui.OpenHABWidgetArrayAdapter.java
private void processIconImage(RelativeLayout widgetView, OpenHABWidget openHABWidget) { // Process widgets icon image Integer iconColor = openHABWidget.getIconColor(); AutoRefreshImageView widgetImage = (AutoRefreshImageView) widgetView.findViewById(R.id.widgetimage); // Some of widgets, for example Frame doesnt' have an icon, so... if (widgetImage != null) { if (openHABWidget.getIcon() != null) { // This is needed to escape possible spaces and everything according to rfc2396 String iconUrl = openHABBaseUrl + "images/" + Uri.encode(openHABWidget.getIcon() + ".png"); // Log.d(TAG, "Will try to load icon from " + iconUrl); // Now set image URL widgetImage.setImageUrl(iconUrl, R.drawable.blank_icon, openHABUsername, openHABPassword); if (iconColor != null) widgetImage.setColorFilter(iconColor); else/* w ww . j a v a2s. com*/ widgetImage.clearColorFilter(); } } }
From source file:com.nadmm.airports.aeronav.ChartsDownloadFragment.java
protected View addTppVolumeRow(LinearLayout layout, String tppVolume, int total) { if (layout.getChildCount() > 0) { addSeparator(layout);// w ww. j ava2 s. c om } RelativeLayout row = (RelativeLayout) inflate(R.layout.list_item_with_progressbar); TextView tv = (TextView) row.findViewById(R.id.item_label); tv.setText(tppVolume); tv = (TextView) row.findViewById(R.id.item_value); tv.setText(String.format("%d charts", total)); row.setTag(R.id.DTPP_VOLUME_NAME, tppVolume); row.setTag(R.id.DTPP_CHART_TOTAL, total); showStatus(row, 0, total); layout.addView(row, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); mVolumeRowMap.put(tppVolume, row); getChartCount(mTppCycle, tppVolume); return row; }
From source file:cn.com.caronwer.activity.AuthSecondActivity.java
@Override protected void findById() { RelativeLayout rl_head = (RelativeLayout) findViewById(R.id.in_head); assert rl_head != null; tv_title = (TextView) rl_head.findViewById(R.id.tv_title); tv_right = (TextView) rl_head.findViewById(R.id.tv_right); iv_left_white = (ImageView) rl_head.findViewById(R.id.iv_left_white); cardNoUpload = (UploadTextView) findViewById(R.id.upload_card_no); cardNoUpload.setOnClickListener(this); drivingLicenseUpload = (UploadTextView) findViewById(R.id.upload_driving_license); drivingLicenseUpload.setOnClickListener(this); carHeadUpload = (UploadTextView) findViewById(R.id.upload_car_head); carHeadUpload.setOnClickListener(this); carTailUpload = (UploadTextView) findViewById(R.id.upload_car_tail); carTailUpload.setOnClickListener(this); carLeftUpload = (UploadTextView) findViewById(R.id.upload_car_left); carLeftUpload.setOnClickListener(this); carRightUpload = (UploadTextView) findViewById(R.id.upload_car_right); carRightUpload.setOnClickListener(this); cardNoImg = (ImageView) findViewById(R.id.card_no_img); cardNoImg.setOnClickListener(this); drivingLicenseImg = (ImageView) findViewById(R.id.driving_license_img); drivingLicenseImg.setOnClickListener(this); carHeadImg = (ImageView) findViewById(R.id.car_head_img); carHeadImg.setOnClickListener(this); carTailImg = (ImageView) findViewById(R.id.car_tail_img); carTailImg.setOnClickListener(this); carLeftImg = (ImageView) findViewById(R.id.car_left_img); carLeftImg.setOnClickListener(this); carRightImg = (ImageView) findViewById(R.id.car_right_img); carRightImg.setOnClickListener(this); Button button = (Button) findViewById(R.id.bt_ok); button.setOnClickListener(this); }
From source file:com.almalence.opencam.ui.AlmalenceStore.java
public void showStore() { LayoutInflater inflater = LayoutInflater.from(MainScreen.getInstance()); List<RelativeLayout> pages = new ArrayList<RelativeLayout>(); // <!-- -+- final boolean unlocked = false; //-+- -->//from ww w . j a v a 2 s . co m /* <!-- +++ final boolean unlocked = true; +++ --> */ // page 1 RelativeLayout page = (RelativeLayout) inflater.inflate(R.layout.gui_almalence_pager_fragment, null); initStoreList(); RelativeLayout store = (RelativeLayout) inflater.inflate(R.layout.gui_almalence_store, null); final ImageView imgStoreNext = (ImageView) store.findViewById(R.id.storeWhatsNew); GridView gridview = (GridView) store.findViewById(R.id.storeGrid); gridview.setAdapter(storeAdapter); if (!unlocked) { page.addView(store); pages.add(page); } // page 2 page = (RelativeLayout) inflater.inflate(R.layout.gui_almalence_pager_fragment, null); RelativeLayout features = (RelativeLayout) inflater.inflate(R.layout.gui_almalence_features, null); final ImageView imgFeaturesPrev = (ImageView) features.findViewById(R.id.storeWhatsNew); imgFeaturesPrev.setVisibility(View.INVISIBLE); WebView wv = (WebView) features.findViewById(R.id.text_features); wv.loadUrl("file:///android_asset/www/features.html"); page.addView(features); pages.add(page); SamplePagerAdapter pagerAdapter = new SamplePagerAdapter(pages); final ViewPager viewPager = new ViewPager(MainScreen.getInstance()); viewPager.setAdapter(pagerAdapter); if (!unlocked) viewPager.setCurrentItem(0); else viewPager.setCurrentItem(1); viewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { switch (position) { case 0: // 0 imgStoreNext.setVisibility(View.VISIBLE); // 1 imgFeaturesPrev.setVisibility(View.INVISIBLE); break; case 1: // 0 imgStoreNext.setVisibility(View.INVISIBLE); // 1 if (!unlocked) imgFeaturesPrev.setVisibility(View.VISIBLE); else imgFeaturesPrev.setVisibility(View.INVISIBLE); break; default: break; } } }); imgStoreNext.setOnClickListener(new OnClickListener() { public void onClick(View v) { viewPager.setCurrentItem(1); } }); imgFeaturesPrev.setOnClickListener(new OnClickListener() { public void onClick(View v) { viewPager.setCurrentItem(0); } }); guiView.findViewById(R.id.buttonGallery).setEnabled(false); guiView.findViewById(R.id.buttonShutter).setEnabled(false); guiView.findViewById(R.id.buttonSelectMode).setEnabled(false); PluginManager.getInstance().sendMessage(ApplicationInterface.MSG_BROADCAST, ApplicationInterface.MSG_CONTROL_LOCKED); MainScreen.getGUIManager().lockControls = true; // <!-- -+- if (MainScreen.getInstance().showPromoRedeemed) { Toast.makeText(MainScreen.getInstance(), "The promo code has been successfully redeemed. All PRO-Features are unlocked", Toast.LENGTH_LONG).show(); MainScreen.getInstance().showPromoRedeemed = false; } if (MainScreen.getInstance().showPromoRedeemedJulius) { Toast.makeText(MainScreen.getInstance(), MainScreen.getInstance().getResources().getString(R.string.promoRedeemedJulius), Toast.LENGTH_LONG).show(); MainScreen.getInstance().showPromoRedeemedJulius = false; } //-+- --> final RelativeLayout pagerLayout = ((RelativeLayout) guiView.findViewById(R.id.viewPagerLayout)); pagerLayout.addView(viewPager); final RelativeLayout pagerLayoutMain = ((RelativeLayout) guiView.findViewById(R.id.viewPagerLayoutMain)); pagerLayoutMain.setVisibility(View.VISIBLE); pagerLayoutMain.bringToFront(); // We need this timer, to show store on top, after we return from google // play. // In MainScreen there is timer, which brings main buttons on top, // after MainScreen activity resumed. // So this timer "blocks" timer from MainScreen if we want to show // store. new CountDownTimer(600, 10) { public void onTick(long millisUntilFinished) { pagerLayoutMain.bringToFront(); } public void onFinish() { pagerLayoutMain.bringToFront(); } }.start(); }
From source file:cn.com.caronwer.activity.CertificationActivity.java
@Override protected void findById() { RelativeLayout rl_head = (RelativeLayout) findViewById(R.id.in_head); assert rl_head != null; tv_title = (TextView) rl_head.findViewById(R.id.tv_title); tv_right = (TextView) rl_head.findViewById(R.id.tv_right); iv_left_white = (ImageView) rl_head.findViewById(R.id.iv_left_white); mEt_name = (EditText) findViewById(R.id.et_name); mEt_cardNo = (EditText) findViewById(R.id.et_cardNo); mEt_drivingLicense = (EditText) findViewById(R.id.et_drivingLicense); mEt_roadPermit = (EditText) findViewById(R.id.et_road_transport_permit); mEt_carNumber = (EditText) findViewById(R.id.et_carNumber); //mEt_gps = (TextView) findViewById(R.id.tV_gps); mBv_next = (BorderTextView) findViewById(R.id.bv_next); mBv_queren = (BorderTextView) findViewById(R.id.bv_queren); mBv_queren.setOnClickListener(this); mPv_xsz = (InputNameView) findViewById(R.id.pv_xsz); mPv_jsz = (InputNameView) findViewById(R.id.pv_jsz); mPv_cl = (InputNameView) findViewById(R.id.pv_cl); mPv_sfz = (InputNameView) findViewById(R.id.pv_sfz); mIv_sf = (ImageView) findViewById(R.id.iv_sf); mIv_js = (ImageView) findViewById(R.id.iv_js); mIv_xs = (ImageView) findViewById(R.id.iv_xs); mIv_che = (ImageView) findViewById(R.id.iv_che); mLl_cer1 = (LinearLayout) findViewById(R.id.ll_cer1); mLl_cer2 = (LinearLayout) findViewById(R.id.ll_cer2); mDdlCity = (Spinner) findViewById(R.id.vehicleType); ArrayAdapter<String> source = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, items); mDdlCity.setAdapter(source);//ww w.ja va 2s .co m mDdlCity.setOnItemSelectedListener(new Spinner.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) { VehType = arg2; } @Override public void onNothingSelected(AdapterView<?> arg0) { } }); }
From source file:com.RSMSA.policeApp.Dialogues.PaymentConfirmationDialogue.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE); getDialog().setCanceledOnTouchOutside(false); RelativeLayout relativeLayout = (RelativeLayout) inflater.inflate(R.layout.dialogue_payment_confirmation, container, false);/* w w w . java 2 s . c o m*/ TextView costTextView = (TextView) relativeLayout.findViewById(R.id.place); costTextView.setText(cost + ""); TextView nameTextView = (TextView) relativeLayout.findViewById(R.id.name); nameTextView.setText(name); TextView licenceNumberTextView = (TextView) relativeLayout.findViewById(R.id.licence_number); licenceNumberTextView.setText(offence.getDriver_license_number() + ""); TextView plate_numberTextView = (TextView) relativeLayout.findViewById(R.id.plate_number); plate_numberTextView.setText(offence.getVehicle_plate_number()); final String[] paymentMethodsArray = this.getResources().getStringArray(R.array.payment_methods); Spinner paymentMethodSpinner = (Spinner) relativeLayout.findViewById(R.id.payment_method_spinner); PaymentMethodSpinnerAdapter adapter = new PaymentMethodSpinnerAdapter(getActivity(), R.layout.row_menu, paymentMethodsArray); paymentMethodSpinner.setAdapter(adapter); paymentMethodSpinner.setBackground(null); paymentMethodSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { paymentMethod = paymentMethodsArray[position]; } @Override public void onNothingSelected(AdapterView<?> parent) { } }); receiptEditText = (EditText) relativeLayout.findViewById(R.id.receipt); TextView okButton = (TextView) relativeLayout.findViewById(R.id.ok_button); okButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (receiptEditText.getText().toString().equals("")) { receiptEditText.setHintTextColor(Color.RED); } else { new ProcessRegister().execute(); } } }); TextView cancelButton = (TextView) relativeLayout.findViewById(R.id.cancel_button); cancelButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //mListener.onComplete(false, index); dismiss(); } }); return relativeLayout; }
From source file:com.ehret.mixit.fragment.PeopleDetailFragment.java
private void addPeopleLink(Member membre) { //On vide les lments linkLayout.removeAllViews();/*from w w w. ja v a2 s .c om*/ //On affiche les liens que si on a recuperer des choses if (membre != null && membre.getSharedLinks() != null && !membre.getSharedLinks().isEmpty()) { //On ajoute un table layout TableLayout.LayoutParams tableParams = new TableLayout.LayoutParams( TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT); TableLayout tableLayout = new TableLayout(getActivity().getBaseContext()); tableLayout.setLayoutParams(tableParams); if (mInflater != null && membre.getSharedLinks().size() > 0) { for (final Link link : membre.getSharedLinks()) { RelativeLayout row = (RelativeLayout) mInflater.inflate(R.layout.item_link, tableLayout, false); row.setBackgroundResource(R.drawable.row_transparent_background); //Dans lequel nous allons ajouter le contenu que nous faisons mapp dans TextView link_text = (TextView) row.findViewById(R.id.link_text); link_text.setText(Html.fromHtml(String.format("%s : <a href=\"%s\">%s</a>", link.getRel(), link.getHref(), link.getHref()))); link_text.setBackgroundColor(Color.TRANSPARENT); link_text.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent in = new Intent(Intent.ACTION_VIEW, Uri.parse(link.getHref())); getActivity().startActivity(in); } }); tableLayout.addView(row); } } else { RelativeLayout row = (RelativeLayout) mInflater.inflate(R.layout.item_link, tableLayout, false); row.setBackgroundResource(R.drawable.row_transparent_background); //Dans lequel nous allons ajouter le contenu que nous faisons mapp dans TextView link_text = (TextView) row.findViewById(R.id.link_text); link_text.setText("Aucun lien"); link_text.setBackgroundColor(Color.TRANSPARENT); tableLayout.addView(row); } linkLayout.addView(tableLayout); } else { titleLinks.getLayoutParams().height = 0; } }