List of usage examples for android.view LayoutInflater inflate
public View inflate(XmlPullParser parser, @Nullable ViewGroup root)
From source file:net.internetTelephone.program.project.init.create.ProjectCreateFragment.java
private void showWarningDialog() { LayoutInflater factory = LayoutInflater.from(getActivity()); final View textEntryView = factory.inflate(R.layout.init_dialog_text_entry2, null); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); AlertDialog dialog = builder.setTitle("??").setView(textEntryView) .setPositiveButton("", new DialogInterface.OnClickListener() { @Override//from ww w. j ava2 s . c o m public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }).show(); }
From source file:com.android.contacts.common.list.PhoneNumberPickerFragment.java
@Override protected View inflateView(LayoutInflater inflater, ViewGroup container) { return inflater.inflate(R.layout.contact_list_content, null); }
From source file:org.silena.main.RegistrationOld.java
private void RenderError(String massage) { LayoutInflater inflater = getLayoutInflater(); View layout = inflater.inflate(R.layout.toast_error, (ViewGroup) findViewById(R.id.toast_layout_root)); TextView text = (TextView) layout.findViewById(R.id.text); text.setText(massage);//from w w w . j a v a2s. c o m Toast toast = new Toast(getApplicationContext()); toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0); toast.setDuration(Toast.LENGTH_LONG); toast.setView(layout); toast.show(); return; }
From source file:net.coding.program.project.init.create.ProjectCreateFragment.java
private void showWarningDialog() { LayoutInflater factory = LayoutInflater.from(getActivity()); final View textEntryView = factory.inflate(R.layout.init_dialog_text_entry2, null); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); AlertDialog dialog = builder.setTitle("??").setView(textEntryView) .setPositiveButton("", new DialogInterface.OnClickListener() { @Override/*from w w w .j av a 2s . c om*/ public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }).show(); CustomDialog.dialogTitleLineColor(getActivity(), dialog); }
From source file:app.hacked.ChatFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.chat_fragment, null); Message = (EditText) view.findViewById(R.id.chatText); ((ImageButton) view.findViewById(R.id.sendButton)).setOnClickListener(new View.OnClickListener() { @Override// w w w .j av a 2 s.co m public void onClick(View view) { if (!canPost) { //Toast.makeText(getActivity(), "You need to agree to the Hacked.io Terms of Attendance before posting", Toast.LENGTH_SHORT).show(); //return; if (settings.getBoolean("agreetoChat", false)) { canPost = true; } else { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); // Add the buttons builder.setPositiveButton("I agree", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { SharedPreferences.Editor editor = PreferenceManager .getDefaultSharedPreferences(getActivity()).edit(); editor.putBoolean("agreetoChat", true); editor.commit(); dialog.dismiss(); canPost = true; } }); builder.setNegativeButton("Nope", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { SharedPreferences.Editor editor = PreferenceManager .getDefaultSharedPreferences(getActivity()).edit(); editor.putBoolean("agreetoChat", false); editor.commit(); dialog.dismiss(); canPost = false; } }); builder.setMessage(getString(R.string.ChatTandC)); // Create the AlertDialog AlertDialog dialog = builder.create(); dialog.setCancelable(false); dialog.show(); } return; } progressBar.setVisibility(View.VISIBLE); Message.setEnabled(false); final String msg = Message.getText().toString(); JSONObject post = new JSONObject(); try { try { post.put("name", accounts[0].name); } catch (Exception e) { e.printStackTrace(); post.put("name", "Anon"); } post.put("msg", msg); post.put("auth", API.md5(API.BETTER_THAN_NOTHING_STUFF_TO_PREVENT_INJECTION_ATTEMPTS + msg)); } catch (Exception e) { e.printStackTrace(); Toast.makeText(getActivity(), "An Error Was encountered parsing the entered details: " + e.getMessage(), Toast.LENGTH_SHORT).show(); return; } JsonObjectRequest jsObjRequest = new JsonObjectRequest(Request.Method.POST, "http://hackedioapp.networksaremadeofstring.co.uk/addchatmsg.php", post, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { Log.e("response", response.toString()); try { if (response.has("success") && response.getBoolean("success")) { //Toast.makeText(getActivity(), "Project added successfully!", Toast.LENGTH_SHORT).show(); //adapter.ChatMessages.add(new ChatMessage(accounts[0].name,msg)); //adapter.notifyDataSetChanged(); Message.setText(""); progressBar.setVisibility(View.INVISIBLE); Message.setEnabled(true); } else { Toast.makeText(getActivity(), "An Error Was encountered", Toast.LENGTH_SHORT).show(); Message.setEnabled(true); } } catch (Exception e) { e.printStackTrace(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { // TODO Auto-generated method stub Toast.makeText(getActivity(), "An Error Was encountered: " + error.getMessage(), Toast.LENGTH_SHORT).show(); } }); queue.add(jsObjRequest); } }); progressBar = view.findViewById(R.id.progressBar); return view; }
From source file:com.coinblesk.client.backup.BackupRestoreDialogFragment.java
@Nullable @Override//from w ww .ja v a2 s . c o m public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_backup_restore_dialog, container); txtPassword = (EditText) view.findViewById(R.id.backup_password_text); txtPassword.addTextChangedListener(new PasswordNotEmptyTextWatcher()); btnOk = (Button) view.findViewById(R.id.fragment_backup_ok); btnOk.setEnabled(false); view.findViewById(R.id.fragment_backup_ok).setOnClickListener(new RestoreOkClickListener()); view.findViewById(R.id.fragment_backup_cancel).setOnClickListener(new RestoreCancelClickListener()); backupFilesList = (Spinner) view.findViewById(R.id.fragment_restore_file_spinner); initBackupFilesList(); return view; }
From source file:firefist.wei.sliding.fragment.LeftFragment.java
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.left, null); left_top_layout = (RelativeLayout) view.findViewById(R.id.left_top_layout); mListView = (ListView) view.findViewById(R.id.left_listview); data.add(""); // data.add("&"); data.add("U2B"); data.add("2B"); data.add("PK"); data.add("Have Fun"); data.add(""); data.add(""); // data.add(getResources().getString(R.string.tab_home)); myAdapter = new MyAdapter(data); mListView.setAdapter(myAdapter);// w w w .jav a 2 s. c o m mListView.setOnItemClickListener(this); myAdapter.setSelectPosition(0); left_avatar = (ImageView) view.findViewById(R.id.left_avatar); left_name = (TextView) view.findViewById(R.id.left_name); return view; }
From source file:com.viettel.view.MainHome.SelectEventPlace.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LayoutInflater lf = LayoutInflater.from(this); app = lf.inflate(R.layout.layout_select_event_place, null); setContentView(app);/*from w w w. j ava 2s .co m*/ cd = new ConnectionDetector(getApplicationContext()); // Check if Internet present isInternetPresent = cd.isConnectingToInternet(); if (!isInternetPresent) { // Internet Connection is not present alertDialog.show(this, getResources().getString(R.string.INTERNET_CONNECTION_ERROR), getResources().getString(R.string.SETUP_CONNECTION), false); // stop executing code by return return; } // creating GPS Class object gps = new GPSTracker(SelectEventPlace.this); // check if GPS location can get if (!gps.canGetLocation()) { // Can't get user's current location alertDialog.show(this, getResources().getString(R.string.GPS_STATUS), getResources().getString(R.string.REQUIRE_ENABLE_GPS), false); return; } bindComponents(); btnSearchPlace.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { new LoadPlaces().execute(); } }); listViewPlace.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View v, int postion, long id) { String placeDetail = placeDataList.get(postion).getTxt_Name() + "," + placeDataList.get(postion).getTxt_Address(); Intent intent = new Intent(SelectEventPlace.this, CreateNewEvent.class); intent.putExtra("EVENT_PLACE", placeDetail); startActivity(intent); } }); btnDefaultPlace.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { String placeDetail = getResources().getString(R.string.PLACE_DEFAULT); Intent intent = new Intent(SelectEventPlace.this, CreateNewEvent.class); intent.putExtra("EVENT_PLACE", placeDetail); startActivity(intent); } }); final View[] children = new View[] { app }; }
From source file:org.envirocar.app.activity.RegisterFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.register_layout, null); mUsernameView = (EditText) view.findViewById(R.id.register_username); mEmailView = (EditText) view.findViewById(R.id.register_email); mPasswordView = (EditText) view.findViewById(R.id.register_password); mPasswordConfirmView = (EditText) view.findViewById(R.id.register_password_second); mPasswordConfirmView.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override/*from w ww . j a v a 2 s.co m*/ public boolean onEditorAction(TextView textView, int id, KeyEvent keyEvent) { if (id == R.id.register || id == EditorInfo.IME_NULL) { attemptRegister(); return true; } return false; } }); mRegisterFormView = view.findViewById(R.id.register_form); mRegisterStatusView = view.findViewById(R.id.register_status); mRegisterStatusMessageView = (TextView) view.findViewById(R.id.register_status_message); view.findViewById(R.id.register_button).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { attemptRegister(); } }); return view; }