List of usage examples for android.view LayoutInflater inflate
public View inflate(XmlPullParser parser, @Nullable ViewGroup root, boolean attachToRoot)
From source file:com.achep.base.ui.DialogBuilder.java
private View createSkeleton() { LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); LinearLayout rootLayout = (LinearLayout) inflater.inflate(R.layout.dialog_main_skeleton, new FrameLayout(mContext), false); TextView titleView = (TextView) rootLayout.findViewById(R.id.title); if (Device.hasLollipopApi()) { // The dividers are quite ugly with material design. rootLayout.setShowDividers(LinearLayout.SHOW_DIVIDER_NONE); }/*from w w w . ja v a2 s . c o m*/ if (mTitleText == null && mIcon == null) { rootLayout.removeView(titleView); } else { if (mTitleText != null) titleView.setText(mTitleText); if (mIcon != null) titleView.setCompoundDrawablesWithIntrinsicBounds(mIcon, null, null, null); } return rootLayout; }
From source file:com.nanostuffs.yurdriver.fragment.BankDetails.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // TODO Auto-generated method stub View view = inflater.inflate(R.layout.bank_details, container, false); submit = (MyFontTextView) view.findViewById(R.id.tvRegisterSubmit); edt_accno = (EditText) view.findViewById(R.id.accountnumber); edt_bankname = (EditText) view.findViewById(R.id.bankname); edt_routing = (EditText) view.findViewById(R.id.routing); edit_paypal = (EditText) view.findViewById(R.id.paypal); preferenceHelper = new PreferenceHelper(registerActivity); submit.setOnClickListener(this); LinearLayout lin = (LinearLayout) view.findViewById(R.id.mainLay); lin.setOnTouchListener(new OnTouchListener() { @Override/* w w w . j a v a2 s . c o m*/ public boolean onTouch(View v, MotionEvent event) { // TODO Auto-generated method stub HideSoftKeyBoard hid = new HideSoftKeyBoard(getActivity()); hid.hideKeyboard(getActivity()); return false; } }); return view; }
From source file:edgargtzg.popularmovies.DiscoverMoviesFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_discover_movies, container, false); // Get a reference to the GridView, and attach the adapter to it. GridView gridView = (GridView) rootView.findViewById(R.id.movies_discovery_gridview); gridView.setAdapter(mMoviePosterAdapter); gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override//ww w . ja va 2 s .co m public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) { MovieItem movieItem = mMoviePosterAdapter.getItem(position); Intent intent = new Intent(getActivity(), MovieDetailsActivity.class) .putExtra(MovieItem.class.getCanonicalName(), movieItem); startActivity(intent); } }); // Registers the preference listener to populate movies. PreferenceManager.getDefaultSharedPreferences(getActivity()).registerOnSharedPreferenceChangeListener(this); return rootView; }
From source file:foam.jellyfish.StarwispFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup root, Bundle savedInstanceState) { super.onCreateView(inflater, root, savedInstanceState); String arg = "none"; String json = m_Owner.m_Scheme .eval("(fragment-callback 'on-create \"" + m_Name + "\" (list \"" + arg + "\"))"); View view = inflater.inflate(R.layout.main_fragment, root, false); try {/*from w w w . j a v a 2s. c o m*/ m_Owner.m_Builder.Build(m_Owner, m_Name, new JSONArray(json), (ViewGroup) view); } catch (JSONException e) { Log.e("starwisp", "Error parsing [" + json + "] " + e.toString()); } return view; }
From source file:com.offbye.bookmaster.android.book.SearchBookContentsActivity.java
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); // Make sure that expired cookies are removed on launch. CookieSyncManager.createInstance(this); CookieManager.getInstance().removeExpiredCookie(); Intent intent = getIntent();/*from w w w. jav a2 s. c o m*/ if (intent == null || (!intent.getAction().equals(Intents.SearchBookContents.ACTION))) { finish(); return; } isbn = intent.getStringExtra(Intents.SearchBookContents.ISBN); if (isbn.startsWith("http://google.com/books?id=")) { setTitle(getString(R.string.sbc_name)); } else { setTitle(getString(R.string.sbc_name) + ": ISBN " + isbn); } setContentView(R.layout.search_book_contents); queryTextView = (EditText) findViewById(R.id.query_text_view); String initialQuery = intent.getStringExtra(Intents.SearchBookContents.QUERY); if (initialQuery != null && initialQuery.length() > 0) { // Populate the search box but don't trigger the search queryTextView.setText(initialQuery); } queryTextView.setOnKeyListener(keyListener); queryButton = (Button) findViewById(R.id.query_button); queryButton.setOnClickListener(buttonListener); resultListView = (ListView) findViewById(R.id.result_list_view); LayoutInflater factory = LayoutInflater.from(this); headerView = (TextView) factory.inflate(R.layout.search_book_contents_header, resultListView, false); resultListView.addHeaderView(headerView); }
From source file:com.df.dfcarchecker.CarReport.CarReportBasicInfoFragment.java
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.inflater = inflater; rootView = inflater.inflate(R.layout.fragment_car_report_basic_info, container, false); if (jsonData != null) { if (parsJsonData()) updateUi();// ww w . j a v a 2 s. c o m } return rootView; }
From source file:eu.codeplumbers.cosi.wizards.firstrun.ConnectFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_connect, container, false); ((TextView) rootView.findViewById(android.R.id.title)).setText(mPage.getTitle()); designOK = false;//from w w w .j a v a 2 s . c o m mUrl = (EditText) rootView.findViewById(R.id.cozy_url); mUsername = (EditText) rootView.findViewById(R.id.cozy_username); mPassword = (EditText) rootView.findViewById(R.id.cozy_password); mDeviceName = (EditText) rootView.findViewById(R.id.cozy_device_name); String deviceName = android.os.Build.MODEL; String deviceMan = android.os.Build.MANUFACTURER; mDeviceName.setText("Android-" + deviceMan + "-" + deviceName + "-Cosi"); mDeviceName.setEnabled(false); btnRegisterDevice = (Button) rootView.findViewById(R.id.btnRegisterDevice); return rootView; }
From source file:com.ymt.demo1.plates.news.FireNewsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_fire_news, container, false); initView(view);/*from w ww.j a va 2s . com*/ return view; }
From source file:net.naonedbus.card.impl.CommentairesCard.java
private View createView(final LayoutInflater inflater, final ViewGroup root, final Commentaire commentaire) { final View view = inflater.inflate(R.layout.card_item_commentaire, root, false); final TextView itemTitle = (TextView) view.findViewById(R.id.itemTitle); final TextView itemDate = (TextView) view.findViewById(R.id.itemTime); final TextView itemDescription = (TextView) view.findViewById(R.id.itemDescription); String title = ""; if (NaonedbusClient.NAONEDBUS.name().equals(commentaire.getSource())) { if (commentaire.getArret() == null && commentaire.getSens() == null && commentaire.getLigne() == null) { title = view.getContext().getString(R.string.commentaire_tout); } else {/*from w w w .j a v a 2 s . co m*/ if (commentaire.getArret() != null) { title = commentaire.getArret().getNomArret() + " "; } if (commentaire.getSens() != null) { title = title + "\u2192 " + commentaire.getSens().text; } } } else { title = getString(CommentaireFomatter.getTitleResId(commentaire.getSource())); } itemDescription.setText(commentaire.getMessage(), BufferType.SPANNABLE); itemDate.setText(commentaire.getDelay()); if (title.trim().length() == 0) { itemTitle.setVisibility(View.GONE); } else { itemTitle.setVisibility(View.VISIBLE); itemTitle.setText(title.trim()); } view.setOnClickListener(new OnClickListener() { @Override public void onClick(final View v) { final Bundle bundle = new Bundle(); bundle.putParcelable(CommentaireDetailDialogFragment.PARAM_COMMENTAIRE, commentaire); final DialogFragment dialogFragment = new CommentaireDetailDialogFragment(); dialogFragment.setArguments(bundle); dialogFragment.show(getFragmentManager(), "CommentaireDetailFragment"); } }); return view; }
From source file:securify.ububble.securify.fragments.Payment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View view = inflater.inflate(R.layout.fragment_payment, container, false); ButterKnife.inject(this, view); SharedPreferences settings = getActivity().getSharedPreferences("pref", 0); userId = settings.getString(Constantes.USER_ID, ""); finder = new TextFinder(getActivity()); for (int element : botones) { view.findViewById(element).setOnClickListener(this); }/* w ww . ja v a 2s . com*/ bp = new BillingProcessor(getActivity(), LICENSEKEY, new BillingProcessor.IBillingHandler() { JSONObject json = null; @Override public void onProductPurchased(String s, TransactionDetails transactionDetails) { if (transactionDetails.productId.equals(finder.getText(OPC.ID_SUBSCRIPTION_ANNUAL))) { try { Calendar calendario = Calendar.getInstance(); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); json = new JSONObject(transactionDetails.purchaseInfo.responseData); txtRegalaronSecurify.setText(json.getInt("purchaseTime")); RequestParams params = new RequestParams(); params.put("transaction_id", json.getString("orderId")); params.put("amount", 23.99); params.put("currency", "USD"); calendario.setTime(new Date(json.getLong("purchaseTime"))); String s_date = format.format(calendario.getTime()); calendario.add(Calendar.MONTH, 1); String e_date = format.format(calendario.getTime()); params.put("d_start", s_date); params.put("d_end", e_date); params.put("type", 2); params.put("hash", new ConvertToMD5(23.99 + userId + json.getString("orderId") + "USD" + 2 + Constantes.AMX_SECRET + e_date + s_date)); params.put("user_app_billing", contentPrincipal.userEmail); Client.post("users/" + userId + "/p", null, new JsonHttpResponseHandler() { @Override public void onSuccess(int statusCode, Header[] headers, JSONObject response) { } }, getActivity()); } catch (JSONException e) { } } else if (transactionDetails.productId.equals(finder.getText(OPC.ID_SUBSCRIPTION_MENSUAL))) { txtRegalaronSecurify.setText(transactionDetails.purchaseInfo.responseData); } else if (transactionDetails.productId.equals(finder.getText(OPC.ID_SUBSCRIPTION_TRAVELER))) { txtRegalaronSecurify.setText(transactionDetails.purchaseInfo.responseData); } } @Override public void onPurchaseHistoryRestored() { } @Override public void onBillingError(int i, Throwable throwable) { showToast("onBillingError: " + Integer.toString(i)); } @Override public void onBillingInitialized() { readyToPurchase = true; } }); Client.get("users/" + userId + "/state", null, new JsonHttpResponseHandler() { @Override public void onSuccess(int statusCode, Header[] headers, JSONObject response) { try { userActive = response.getBoolean("user_active"); remainingDays = response.getInt("remaining_days"); Client.get("users/" + userId, null, new JsonHttpResponseHandler() { JSONObject json = null; Calendar calendario = Calendar.getInstance(); DateFormat formato = DateFormat.getDateInstance(DateFormat.FULL); @Override public void onSuccess(int statusCode, Header[] headers, JSONObject response) { try { name = response.getString("name"); if (remainingDays < 0) { txtRegalaronSecurify.setText( String.format(finder.getText(OPC.TXT_SUSCRIPCION_CADUCADA), name)); } else if (remainingDays > 0) { String texto = remainingDays > 1 ? String.format(finder.getText(OPC.TXT_FREE_TRIALMODE_MORE), name, remainingDays + "") : String.format(finder.getText(OPC.TXT_FREE_TRIALMODE_SIMPLE), name, remainingDays + ""); txtRegalaronSecurify.setText(texto); view.findViewById(R.id.btn_pagar_anual).setOnClickListener(null); } else if (bp.isSubscribed(finder.getText(OPC.ID_SUBSCRIPTION_ANNUAL))) { json = new JSONObject(bp.getSubscriptionTransactionDetails( finder.getText(OPC.ID_SUBSCRIPTION_ANNUAL)).purchaseInfo.responseData); calendario.setTime(new Date(json.getLong("purchaseTime"))); calendario.add(Calendar.MONTH, 1); if (calendario.compareTo(Calendar.getInstance()) >= 0) { txtRegalaronSecurify .setText(String.format(finder.getText(OPC.TXT_SUSCRIPCION_CADUCAR), formato.format(calendario.getTime()))); } } else if (bp.isSubscribed(finder.getText(OPC.ID_SUBSCRIPTION_MENSUAL))) { json = new JSONObject(bp.getSubscriptionTransactionDetails( finder.getText(OPC.ID_SUBSCRIPTION_MENSUAL)).purchaseInfo.responseData); txtRegalaronSecurify.setText(bp.getSubscriptionTransactionDetails( finder.getText(OPC.ID_SUBSCRIPTION_MENSUAL)).purchaseInfo.responseData); } else if (bp.isSubscribed(finder.getText(OPC.ID_SUBSCRIPTION_TRAVELER))) { json = new JSONObject(bp.getSubscriptionTransactionDetails(finder .getText(OPC.ID_SUBSCRIPTION_TRAVELER)).purchaseInfo.responseData); txtRegalaronSecurify.setText(bp.getSubscriptionTransactionDetails(finder .getText(OPC.ID_SUBSCRIPTION_TRAVELER)).purchaseInfo.responseData); } } catch (JSONException e) { } } }, getActivity()); } catch (JSONException e) { } } }, getActivity()); txtRegalaronSecurify.setVisibility(View.VISIBLE); return view; }