List of usage examples for android.view LayoutInflater from
public static LayoutInflater from(Context context)
From source file:edu.missouri.bas.activities.AdminManageActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d(TAG, "OnCreate!!~~~"); ctx = this;/*from w ww . j a va 2 s .c o m*/ // Setup the window //requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); // Set result CANCELED incase the user backs out //setResult(Activity.RESULT_CANCELED); //////////////////////////////////////////////////////////////////// tabHost = getTabHost(); LayoutInflater.from(this).inflate(R.layout.activity_admin_manage, tabHost.getTabContentView(), true); tabHost.addTab(tabHost.newTabSpec("Assign ID").setIndicator("Assign ID", null).setContent(R.id.tab_assign)); tabHost.addTab(tabHost.newTabSpec("Remove ID").setIndicator("Remove ID", null).setContent(R.id.tab_logoff)); setContentView(tabHost); shp = getSharedPreferences("PINLOGIN", Context.MODE_PRIVATE); editor = shp.edit(); bedTime = ctx.getSharedPreferences(SensorService.BED_TIME, MODE_PRIVATE); editor2 = bedTime.edit(); asID = (EditText) findViewById(R.id.assigned_ID); deasID = (EditText) findViewById(R.id.deassigned_ID); AssignButton = (Button) findViewById(R.id.btn_assign); RemoveButton = (Button) findViewById(R.id.btn_remove); imm = (InputMethodManager) ctx.getSystemService(Context.INPUT_METHOD_SERVICE); //imm.toggleSoftInput(0, InputMethodManager.RESULT_SHOWN); //imm.showSoftInput(asID, InputMethodManager.RESULT_SHOWN); imm.toggleSoftInput(InputMethodManager.HIDE_NOT_ALWAYS, InputMethodManager.RESULT_HIDDEN); asID.setFocusable(true); asID.setFocusableInTouchMode(true); asID.requestFocus(); setListeners(); Dialog adminPin = AdminPinDialog(this); adminPin.show(); setResult(9); setHints(); }
From source file:arun.com.chromer.settings.widgets.AppPreferenceCardView.java
private void init(AttributeSet attrs, int defStyle) { // Load attributes final TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.AppPreferenceCardView, defStyle, 0);//w w w . ja v a 2s . com if (!a.hasValue(R.styleable.AppPreferenceCardView_preferenceType)) { throw new IllegalArgumentException("Must specify app:preferenceType in xml"); } preferenceType = a.getInt(R.styleable.AppPreferenceCardView_preferenceType, 0); setInitialValues(); a.recycle(); addView(LayoutInflater.from(getContext()).inflate(R.layout.widget_app_preference_cardview_content, this, false)); unbinder = ButterKnife.bind(this); }
From source file:de.electricdynamite.pasty.ClipboardFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); // this is really important in order to save the state across screen // configuration changes for example setRetainInstance(true);/* w w w. ja v a 2 s. co m*/ if (PastySharedStatics.LOCAL_LOG == true) this.LOCAL_LOG = true; //LoaderManager.enableDebugLogging(true); mInflater = LayoutInflater.from(getSherlockActivity()); activity = (PastyClipboardFragmentListener) getSherlockActivity(); mHelpTextBig = (TextView) getActivity().findViewById(R.id.tvHelpTextBig); mHelpTextSmall = (TextView) getActivity().findViewById(R.id.tvHelpTextSmall); mBackground = mHelpTextSmall.getBackground(); if (mAdapter == null) { // Set up our ArrayList and ListAdapter mItems = new ArrayList<ClipboardItem>(); mAdapter = new ClipboardItemListAdapter(getSherlockActivity(), mItems); } getListView().setAdapter(mAdapter); if (this.prefs == null) { this.prefs = new PastyPreferencesProvider(getSherlockActivity().getApplication()); } else { prefs.reload(); } // Try to reconnect with an existing loader if (getSherlockActivity().getSupportLoaderManager().getLoader(PastyLoader.TASK_CLIPBOARD_FETCH) != null) { if (LOCAL_LOG) Log.v(TAG, "onActivityCreated(): Loader already exists, reconnecting"); getSherlockActivity().getSupportLoaderManager().initLoader(PastyLoader.TASK_CLIPBOARD_FETCH, null, this); } else { if (LOCAL_LOG) Log.v(TAG, "onActivityCreated(): No PastyLoader found"); startLoading(); } // ----- end magic lines ----- }
From source file:edu.missouri.niaaa.ema.activity.AdminManageActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d(TAG, "OnCreate!!~~~"); ctx = this;// ww w .j a v a2 s . com // Setup the window //requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); // Set result CANCELED incase the user backs out setResult(Activity.RESULT_CANCELED); //////////////////////////////////////////////////////////////////// tabHost = getTabHost(); LayoutInflater.from(this).inflate(R.layout.activity_admin_manage, tabHost.getTabContentView(), true); tabHost.addTab(tabHost.newTabSpec("Assign ID").setIndicator("Assign ID", null).setContent(R.id.tab_assign)); tabHost.addTab(tabHost.newTabSpec("Remove ID").setIndicator("Remove ID", null).setContent(R.id.tab_logoff)); setContentView(tabHost); shp = getSharedPreferences(Utilities.SP_LOGIN, Context.MODE_PRIVATE); editor = shp.edit(); asID = (EditText) findViewById(R.id.assigned_ID); deasID = (EditText) findViewById(R.id.deassigned_ID); AssignButton = (Button) findViewById(R.id.btn_assign); RemoveButton = (Button) findViewById(R.id.btn_remove); imm = (InputMethodManager) ctx.getSystemService(Context.INPUT_METHOD_SERVICE); //imm.toggleSoftInput(0, InputMethodManager.RESULT_SHOWN); //imm.showSoftInput(asID, InputMethodManager.RESULT_SHOWN); imm.toggleSoftInput(InputMethodManager.HIDE_NOT_ALWAYS, InputMethodManager.RESULT_HIDDEN); asID.setFocusable(true); asID.setFocusableInTouchMode(true); asID.requestFocus(); setListeners(); DialadminPin = AdminPinSetDialog(this); DialadminPin.show(); setHints(); }
From source file:edu.missouri.niaaa.pain.activity.AdminManageActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d(TAG, "OnCreate!!~~~"); ctx = this;/*from ww w .j a v a 2 s .com*/ // Setup the window //requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); // Set result CANCELED in case the user backs out setResult(Activity.RESULT_CANCELED); //////////////////////////////////////////////////////////////////// tabHost = getTabHost(); LayoutInflater.from(this).inflate(R.layout.activity_admin_manage, tabHost.getTabContentView(), true); tabHost.addTab(tabHost.newTabSpec("Assign ID").setIndicator("Assign ID", null).setContent(R.id.tab_assign)); tabHost.addTab(tabHost.newTabSpec("Remove ID").setIndicator("Remove ID", null).setContent(R.id.tab_logoff)); setContentView(tabHost); shp = getSharedPreferences(Util.SP_LOGIN, Context.MODE_PRIVATE); editor = shp.edit(); asID = (EditText) findViewById(R.id.assigned_ID); deasID = (EditText) findViewById(R.id.deassigned_ID); AssignButton = (Button) findViewById(R.id.btn_assign); RemoveButton = (Button) findViewById(R.id.btn_remove); imm = (InputMethodManager) ctx.getSystemService(Context.INPUT_METHOD_SERVICE); //imm.toggleSoftInput(0, InputMethodManager.RESULT_SHOWN); //imm.showSoftInput(asID, InputMethodManager.RESULT_SHOWN); imm.toggleSoftInput(InputMethodManager.HIDE_NOT_ALWAYS, InputMethodManager.RESULT_HIDDEN); asID.setFocusable(true); asID.setFocusableInTouchMode(true); asID.requestFocus(); setListeners(); DialadminPin = AdminPinSetDialog(this); DialadminPin.show(); setHints(); }
From source file:com.pentacog.mctracker.ServerListAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { RelativeLayout serverView = null;/* ww w.ja v a 2 s. co m*/ ServerViewHolder holder = null; Server server = serverList.get(position); server.id = position; if (convertView == null) { serverView = (RelativeLayout) LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item, parent, false); holder = new ServerViewHolder((int) getItemId(position), serverView); serverView.setTag(holder); } else { serverView = (RelativeLayout) convertView; holder = (ServerViewHolder) serverView.getTag(); holder.id = (int) getItemId(position); } //set server name holder.serverTitle.setText(server.name); //set server IP String serverName = server.address.toString(); if (!serverName.startsWith("/")) { int index = serverName.lastIndexOf('/'); if (index != -1) { String tempString; tempString = serverName.substring(index + 1); serverName = serverName.substring(0, index); serverName += " " + tempString; } } else { serverName = serverName.replace("/", ""); } if (server.port != 25565) serverName += ":" + server.port; holder.serverIp.setText(serverName); //set fav icon if (server.favorite) { holder.favStar.setVisibility(View.VISIBLE); } else { holder.favStar.setVisibility(View.INVISIBLE); } if (!server.queried) { AlphaAnimation a = new AlphaAnimation(1.0f, 0.2f); a.setRepeatCount(Animation.INFINITE); a.setRepeatMode(Animation.REVERSE); a.setDuration(300); holder.statusBar.setBackgroundColor(Color.BLUE); holder.statusBar.startAnimation(a); // holder.loading.setVisibility(View.VISIBLE); holder.playerCount.setText("" + server.playerCount + "/" + server.maxPlayers); holder.serverData.setText(R.string.loading); holder.playerCount.setVisibility(View.INVISIBLE); holder.ping.setVisibility(View.INVISIBLE); new ServerViewUpdater(serverView, server); } else { setupServerCell(server, holder); } return serverView; }
From source file:com.knurld.dropboxdemo.KnurldActivity.java
public void showMessage(View view, String message) { Activity parent = (Activity) context; View spinnerView = LayoutInflater.from(parent).inflate(R.layout.instructions_popup, null); TextView textView = (TextView) spinnerView.findViewById(R.id.phraseText); textView.setText(message);/*from w ww.ja va 2 s. com*/ PopupWindow popupWindow = new PopupWindow(spinnerView, 500, 500); popupWindow.setFocusable(true); popupWindow.showAtLocation(view, Gravity.CENTER, 0, 0); final PopupWindow finalPopupWindow = popupWindow; new android.os.Handler().postDelayed(new Runnable() { public void run() { finalPopupWindow.dismiss(); } }, 3000); }
From source file:com.sixwonders.courtkiosk.CheckInActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); activity = this; view = LayoutInflater.from(this).inflate(R.layout.activity_check_in, null); btnInfoSubmit = (Button) view.findViewById(R.id.btnInfoSubmit); btnIdScan = (Button) view.findViewById(R.id.btnLicenseScan); btnIdScan.setOnClickListener(new View.OnClickListener() { @Override//from w w w . j a va 2s . c o m public void onClick(View view) { callToScan(); } }); btnInfoSubmit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { AlertDialog.Builder builder = new AlertDialog.Builder(view.getContext()); builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { } }); final View custom = LayoutInflater.from(activity) .inflate(R.layout.check_in_personal_info_alertdialog, null); builder.setTitle(R.string.userInformationInput).setPositiveButton(R.string.continueText, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { //TODO call webservice to check for user EditText firstName = (EditText) custom.findViewById(R.id.etFirstName); EditText lastName = (EditText) custom.findViewById(R.id.etLastName); DatePicker dob = (DatePicker) custom.findViewById(R.id.dpDob); if (dob == null) { int i = 0; i++; i++; } int monthInt = dob.getMonth() + 1; String month = ""; if (monthInt < 10) { month += "0"; } month += monthInt; int dayInt = dob.getDayOfMonth(); String day = ""; if (dayInt < 10) { day += "0"; } day += dayInt; int yearInt = dob.getYear(); String year = ""; if (yearInt < 10) { year += "0"; } year += yearInt; String dobStr = month + "/" + day + "/" + year; ConnectionUtil connectionUtil = new ConnectionUtil(); connectionUtil.authCall(firstName.getText().toString(), lastName.getText().toString(), dobStr, (AsyncResponse) activity); } }); builder.setView(custom); datePicker = (DatePicker) custom.findViewById(R.id.dpDob); setUpDatePicker(); AlertDialog alert = builder.create(); alert.show(); } }); setContentView(view); }
From source file:biz.wiz.android.wallet.ui.PeerListFragment.java
@Override public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); adapter = new ArrayAdapter<Peer>(activity, 0) { private final LayoutInflater inflater = LayoutInflater.from(activity); @Override//from www .j av a 2 s.c o m public View getView(final int position, View row, final ViewGroup parent) { if (row == null) row = inflater.inflate(R.layout.peer_list_row, null); final Peer peer = getItem(position); final VersionMessage versionMessage = peer.getPeerVersionMessage(); final boolean isDownloading = peer.getDownloadData(); final TextView rowIp = (TextView) row.findViewById(R.id.peer_list_row_ip); final InetAddress address = peer.getAddress().getAddr(); final String hostname = hostnames.get(address); rowIp.setText(hostname != null ? hostname : address.getHostAddress()); final TextView rowHeight = (TextView) row.findViewById(R.id.peer_list_row_height); final long bestHeight = peer.getBestHeight(); rowHeight.setText(bestHeight > 0 ? bestHeight + " blocks" : null); rowHeight.setTypeface(isDownloading ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT); final TextView rowVersion = (TextView) row.findViewById(R.id.peer_list_row_version); rowVersion.setText(versionMessage.subVer); rowVersion.setTypeface(isDownloading ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT); final TextView rowProtocol = (TextView) row.findViewById(R.id.peer_list_row_protocol); rowProtocol.setText("protocol: " + versionMessage.clientVersion); rowProtocol.setTypeface(isDownloading ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT); final TextView rowPing = (TextView) row.findViewById(R.id.peer_list_row_ping); final long pingTime = peer.getPingTime(); rowPing.setText( pingTime < Long.MAX_VALUE ? getString(R.string.peer_list_row_ping_time, pingTime) : null); rowPing.setTypeface(isDownloading ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT); return row; } @Override public boolean isEnabled(final int position) { return false; } }; setListAdapter(adapter); }
From source file:net.olejon.mdapp.InteractionsCardsAdapter.java
@Override public InteractionsViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.activity_interactions_card, viewGroup, false);/*from w ww . j a v a 2s . co m*/ return new InteractionsViewHolder(view); }