List of usage examples for android.view LayoutInflater inflate
public View inflate(XmlPullParser parser, @Nullable ViewGroup root, boolean attachToRoot)
From source file:com.desarrollodroide.youtubeincardlibs.extrasyoutube.YouTubeFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { //Picasso.with(getActivity()).setDebugging(true); View rootView = inflater.inflate(R.layout.demo_extras_fragment_picasso, container, false); // restore the playlist after an orientation change if (savedInstanceState != null) { mPlaylist = new Gson().fromJson(savedInstanceState.getString(PLAYLIST_KEY), Playlist.class); }/* w w w. j ava 2s . c o m*/ // ensure the adapter and listview are initialized if (mPlaylist != null) { mCardArrayAdapter = null; cards.clear(); mListCount = 0; mPlaylist = null; } // start loading the first page of our playlist new GetYouTubePlaylistAsyncTask() { @Override public EtagCache getEtagCache() { return mEtagCache; } @Override public void onPostExecute(JSONObject result) { handlePlaylistResult(result); } }.execute(YOUTUBE_PLAYLIST, null); return rootView; }
From source file:runtmobile.udea.edu.co.runtmobile.Capture.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.capture, container, false); surfaceView = (SurfaceView) v.findViewById(R.id.surface); tabHost = (FragmentTabHost) getActivity().findViewById(android.R.id.tabhost); // Configuracion del surface para colocarle la camara surfaceHolder = surfaceView.getHolder(); surfaceHolder.addCallback(this); surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); takePicture = (ImageButton) v.findViewById(R.id.buttonCam); // Evento del boton para tomar la foto takePicture.setOnClickListener(new OnClickListener() { @Override//from ww w . j av a 2s.co m public void onClick(View v) { camera.takePicture(shutterCallback, pictureCallback, pictureJPEG); } }); return v; }
From source file:com.socialapp.eventmanager.SplashFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.splash, container, false); callbackManager = CallbackManager.Factory.create(); loginButton = (LoginButton) view.findViewById(R.id.login_button); //loginButton.setReadPermissions(Arrays.asList("user_friends, public_profile, email, user_birthday")); loginButton.setReadPermissions("user_friends"); loginButton.setFragment(this); loginButton.registerCallback(callbackManager, new FacebookCallback<LoginResult>() { @Override/* w w w . j a v a 2 s .c om*/ public void onSuccess(LoginResult loginResult) { //Toast.makeText(getActivity(), "Facebook Login successful2", Toast.LENGTH_SHORT).show(); AccessToken accessToken = loginResult.getAccessToken(); Profile profile = Profile.getCurrentProfile(); //TextView welcomeMsg = (TextView) findViewById(R.id.welcomeMsg); //welcomeMsg.setText(constructWelcomeMessage(profile)); // Using Facebook API for getting User details as well as // friends that are using this app. JSONArray friendsIDarray = new JSONArray(); JSONObject user_friend_list; GraphRequestBatch batch = new GraphRequestBatch( GraphRequest.newMeRequest(accessToken, new GraphRequest.GraphJSONObjectCallback() { @Override public void onCompleted(JSONObject jsonObject, GraphResponse response) { Log.i("Info Msg:", "Response = ." + response.toString()); try { Log.i("Info Msg:", "Logged in Users FB id = ." + jsonObject.getString("id")); Log.i("Info Msg:", "Logged in Users FB name = ." + jsonObject.getString("name")); friendsUsingApp.put(jsonObject.getString("id"), jsonObject.getString("name")); } catch (Exception e) { } } }), // FB API for getting users friends that are using this app. GraphRequest.newMyFriendsRequest(accessToken, new GraphRequest.GraphJSONArrayCallback() { @Override public void onCompleted(JSONArray jsonArray, GraphResponse response) { try { friendsUsingApp.clear(); for (int i = 0; i < jsonArray.length(); i++) { Log.i("Info Msg:", "id = ." + jsonArray.getJSONObject(i).getString("id")); Log.i("Info Msg:", "name = ." + jsonArray.getJSONObject(i).getString("name")); friendsUsingApp.put(jsonArray.getJSONObject(i).getString("id"), jsonArray.getJSONObject(i).getString("name")); } Log.i("Info Msg:", "Response = ." + response.toString()); } catch (Exception e) { } } })); batch.addCallback(new GraphRequestBatch.Callback() { @Override public void onBatchCompleted(GraphRequestBatch graphRequests) { // Application code for when the batch finishes } }); batch.executeAsync(); if (null != profile) { SharedPreferences prefs = PreferenceManager .getDefaultSharedPreferences(getActivity().getApplicationContext()); SharedPreferences.Editor editor = prefs.edit(); //editor.putString("id", profile.getId()); editor.putString("fbFirstName", profile.getFirstName()); editor.putString("fbLastName", profile.getLastName()); editor.commit(); } //Intent intent = new Intent(getActivity().getApplicationContext(), MainActivity.class); //startActivity(intent); } @Override public void onCancel() { Toast.makeText(getActivity(), "Facebook Login canceled", Toast.LENGTH_SHORT).show(); } @Override public void onError(FacebookException exception) { Toast.makeText(getActivity(), "Facebook Login error", Toast.LENGTH_SHORT).show(); } }); return view; }
From source file:behsaman.storytellerandroid.ScreenSlidePageFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout containing a title and body text. ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_screen_slide_page, container, false); // Set the title view to show the page number. ((TextView) rootView.findViewById(android.R.id.text1)).setText( //getString(R.string.title_template_step, mPageNumber + 1)); "Piece " + dataModel.getIndex()); ((TextView) rootView.findViewById(R.id.textview_fragment_textviewer)).setText(this.dataModel.getText_val()); final ImageView imgView = (ImageView) rootView.findViewById(R.id.imageViewComic); //Comics has picture as well if (storyType == STORY_TYPE.TEXT_ONLY) imgView.setVisibility(View.INVISIBLE); else {/*from w w w .j ava 2 s .c o m*/ //Load picture //dataModel.get // Start downloading piece one and show progress bar ServerIO.getInstance().download(dataModel.getPicture_file_addr(), new MyBinaryHttpResponseHandler() { @Override public void onFailure(int statusCode, Header[] headers, byte[] binaryData, Throwable error) { Log.e(TAG, "FAILLLEEEDDD:" + error.getMessage() + "\tStatusCode:" + statusCode + "\tBinaryData:" + binaryData); ServerIO.getInstance().connectionError(parentContext); } @Override public void onSuccess(int statusCode, Header[] headers, byte[] binaryData) { String dir = Utils.getCacheDir(parentContext).getAbsolutePath(); File f = new File( dir + "/" + dataModel.getStory_id().toString() + dataModel.getId().toString()); try { FileOutputStream writer = new FileOutputStream(f); writer.write(binaryData); writer.close(); FileInputStream inStream = new FileInputStream(f); Bitmap bitmap_skip = BitmapFactory.decodeStream(inStream); imgView.setImageBitmap(bitmap_skip); } catch (Exception e) { Log.e(TAG, e.getMessage()); } } }); } return rootView; }
From source file:com.ymt.demo1.plates.news.FileNoticeFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_scrollview_ultra_list_view, container, false); scrollView = (ObservableScrollView) view.findViewById(R.id.scroll); Fragment parentFragment = getParentFragment(); ViewGroup viewGroup = (ViewGroup) parentFragment.getView(); if (viewGroup != null) { scrollView.setTouchInterceptionViewGroup((ViewGroup) viewGroup.findViewById(R.id.container)); if (parentFragment instanceof ObservableScrollViewCallbacks) { scrollView.setScrollViewCallbacks((ObservableScrollViewCallbacks) parentFragment); }//w w w.j av a 2 s . c o m } initView(view); return view; }
From source file:com.miz.mizuu.fragments.AccountsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.account_layout, container, false); }
From source file:com.pgmacdesign.lacunacompanion.fragments.MailFragment.java
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.view_mail, container, false); //Initialize all variables Initialize();/*from w w w . j a v a 2 s.c om*/ return view; }
From source file:it.scoppelletti.mobilepower.widget.DateControl.java
/** * Inizializzazione.//from w w w . ja va 2 s. co m * * @param ctx Contesto. */ private void init(Context ctx) { View view; ImageButton cmd; LayoutInflater inflater; inflater = LayoutInflater.from(ctx); view = inflater.inflate(R.layout.datecontrol, this, false); addView(view); myValueControl = (EditText) findViewById(R.id.txt_value); myValueControl.setKeyListener(null); cmd = (ImageButton) findViewById(R.id.cmd_set); cmd.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { onSetClick(); } }); setValue(SimpleDate.NIL); cmd = (ImageButton) findViewById(R.id.cmd_reset); if (myIsResetEnabled) { cmd.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { setValue(SimpleDate.NIL); } }); } else { cmd.setVisibility(View.GONE); } }
From source file:org.deviceconnect.android.uiapp.fragment.profile.PhoneProfileFragment.java
@Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { super.onCreate(savedInstanceState); View view = inflater.inflate(R.layout.fragment_phone_service, container, false); view.setBackgroundColor(getResources().getColor(android.R.color.background_light)); final TextView num = (TextView) view.findViewById(R.id.fragment_phone_number); final OnClickListener l = new OnClickListener() { @Override//from ww w. java2s . co m public void onClick(final View v) { String phone = num.getText().toString(); int id = v.getId(); if (id == R.id.fragment_phone_1) { phone += "1"; } else if (id == R.id.fragment_phone_2) { phone += "2"; } else if (id == R.id.fragment_phone_3) { phone += "3"; } else if (id == R.id.fragment_phone_4) { phone += "4"; } else if (id == R.id.fragment_phone_5) { phone += "5"; } else if (id == R.id.fragment_phone_6) { phone += "6"; } else if (id == R.id.fragment_phone_7) { phone += "7"; } else if (id == R.id.fragment_phone_8) { phone += "8"; } else if (id == R.id.fragment_phone_9) { phone += "9"; } else if (id == R.id.fragment_phone_a) { phone += "*"; } else if (id == R.id.fragment_phone_0) { phone += "0"; } else if (id == R.id.fragment_phone_s) { phone += "#"; } else if (id == R.id.fragment_phone_clear) { phone = ""; } num.setText(phone); } }; int[] ids = { R.id.fragment_phone_1, R.id.fragment_phone_2, R.id.fragment_phone_3, R.id.fragment_phone_4, R.id.fragment_phone_5, R.id.fragment_phone_6, R.id.fragment_phone_7, R.id.fragment_phone_8, R.id.fragment_phone_9, R.id.fragment_phone_a, R.id.fragment_phone_0, R.id.fragment_phone_s, R.id.fragment_phone_clear }; for (int i = 0; i < ids.length; i++) { Button btn = (Button) view.findViewById(ids[i]); btn.setOnClickListener(l); } Button send = (Button) view.findViewById(R.id.fragment_phone_send); send.setOnClickListener(new OnClickListener() { @Override public void onClick(final View v) { callPhone(num.getText().toString()); } }); return view; }
From source file:com.citrus.sdk.fragments.CreditCard.java
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { returnView = inflater.inflate(R.layout.activity_credit_card, container, false); Bundle data = getArguments();//from www. j a va2 s . co m paymentType = data.getString(Constants.PAY_TYPE); initEditText(); initSubmitButton(); return returnView; }