List of usage examples for android.widget FrameLayout FrameLayout
public FrameLayout(@NonNull Context context)
From source file:io.nuclei.cyto.ui.view.BottomSheetView.java
private void init(Context context) { ViewConfiguration viewConfiguration = ViewConfiguration.get(context); mMinFlingVelocity = viewConfiguration.getScaledMinimumFlingVelocity(); mTouchSlop = viewConfiguration.getScaledTouchSlop(); setClickable(true);/*from w ww . ja v a2s . c o m*/ mBackground = new View(context); mBackground.setBackgroundColor(mBackgroundColor = DEFAULT_BACKGROUND_COLOR); mBackground.setLayoutParams( new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); mBackground.setVisibility(GONE); mBackground.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if ((mState & STATE_MOVING) != STATE_MOVING) { if ((mState & STATE_LOCKED) == STATE_LOCKED) removeState(STATE_LOCKED); setState(STATE_CLOSED); } } }); addView(mBackground); FrameLayout content = new FrameLayout(context); content.setLayoutParams( new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); content.setMinimumHeight(1); content.setBackgroundDrawable(new ColorDrawable(Color.WHITE)); content.setClickable(true); addView(content); mContent = content; mOffsetHelper = new ViewOffsetHelper(mContent); onPrepare(); }
From source file:org.telegram.ui.LanguageSelectActivity.java
@Override public View createView(Context context) { searching = false;//from w ww .j a va2s .co m searchWas = false; actionBar.setBackButtonImage(R.drawable.ic_ab_back); actionBar.setAllowOverlayTitle(true); actionBar.setTitle(LocaleController.getString("Language", R.string.Language)); actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() { @Override public void onItemClick(int id) { if (id == -1) { finishFragment(); } } }); ActionBarMenu menu = actionBar.createMenu(); ActionBarMenuItem item = menu.addItem(0, R.drawable.ic_ab_search).setIsSearchField(true) .setActionBarMenuItemSearchListener(new ActionBarMenuItem.ActionBarMenuItemSearchListener() { @Override public void onSearchExpand() { searching = true; } @Override public void onSearchCollapse() { search(null); searching = false; searchWas = false; if (listView != null) { emptyTextView.setVisibility(View.GONE); listView.setAdapter(listAdapter); } } @Override public void onTextChanged(EditText editText) { String text = editText.getText().toString(); search(text); if (text.length() != 0) { searchWas = true; if (listView != null) { listView.setAdapter(searchListViewAdapter); } } } }); item.getSearchField().setHint(LocaleController.getString("Search", R.string.Search)); listAdapter = new ListAdapter(context); searchListViewAdapter = new SearchAdapter(context); fragmentView = new FrameLayout(context); fragmentView.setBackgroundColor(ContextCompat.getColor(context, R.color.card_background)); LinearLayout emptyTextLayout = new LinearLayout(context); emptyTextLayout.setVisibility(View.INVISIBLE); emptyTextLayout.setOrientation(LinearLayout.VERTICAL); ((FrameLayout) fragmentView).addView(emptyTextLayout); FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) emptyTextLayout.getLayoutParams(); layoutParams.width = LayoutHelper.MATCH_PARENT; layoutParams.height = LayoutHelper.MATCH_PARENT; layoutParams.gravity = Gravity.TOP; emptyTextLayout.setLayoutParams(layoutParams); emptyTextLayout.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { return true; } }); emptyTextView = new TextView(context); emptyTextView.setTextColor(0xff808080); emptyTextView.setTextSize(20); emptyTextView.setGravity(Gravity.CENTER); emptyTextView.setText(LocaleController.getString("NoResult", R.string.NoResult)); emptyTextLayout.addView(emptyTextView); LinearLayout.LayoutParams layoutParams1 = (LinearLayout.LayoutParams) emptyTextView.getLayoutParams(); layoutParams1.width = LayoutHelper.MATCH_PARENT; layoutParams1.height = LayoutHelper.MATCH_PARENT; layoutParams1.weight = 0.5f; emptyTextView.setLayoutParams(layoutParams1); FrameLayout frameLayout = new FrameLayout(context); emptyTextLayout.addView(frameLayout); layoutParams1 = (LinearLayout.LayoutParams) frameLayout.getLayoutParams(); layoutParams1.width = LayoutHelper.MATCH_PARENT; layoutParams1.height = LayoutHelper.MATCH_PARENT; layoutParams1.weight = 0.5f; frameLayout.setLayoutParams(layoutParams1); listView = new ListView(context); listView.setEmptyView(emptyTextLayout); listView.setVerticalScrollBarEnabled(false); listView.setDivider(null); listView.setDividerHeight(0); listView.setAdapter(listAdapter); ((FrameLayout) fragmentView).addView(listView); layoutParams = (FrameLayout.LayoutParams) listView.getLayoutParams(); layoutParams.width = LayoutHelper.MATCH_PARENT; layoutParams.height = LayoutHelper.MATCH_PARENT; listView.setLayoutParams(layoutParams); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { LocaleController.LocaleInfo localeInfo = null; if (searching && searchWas) { if (i >= 0 && i < searchResult.size()) { localeInfo = searchResult.get(i); } } else { if (i >= 0 && i < LocaleController.getInstance().sortedLanguages.size()) { localeInfo = LocaleController.getInstance().sortedLanguages.get(i); } } if (localeInfo != null) { LocaleController.getInstance().applyLanguage(localeInfo, true); parentLayout.rebuildAllFragmentViews(false); } finishFragment(); } }); listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long l) { LocaleController.LocaleInfo localeInfo = null; if (searching && searchWas) { if (i >= 0 && i < searchResult.size()) { localeInfo = searchResult.get(i); } } else { if (i >= 0 && i < LocaleController.getInstance().sortedLanguages.size()) { localeInfo = LocaleController.getInstance().sortedLanguages.get(i); } } if (localeInfo == null || localeInfo.pathToFile == null || getParentActivity() == null) { return false; } final LocaleController.LocaleInfo finalLocaleInfo = localeInfo; AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); builder.setMessage(LocaleController.getString("DeleteLocalization", R.string.DeleteLocalization)); builder.setTitle(LocaleController.getString("AppName", R.string.AppName)); builder.setPositiveButton(LocaleController.getString("Delete", R.string.Delete), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { if (LocaleController.getInstance().deleteLanguage(finalLocaleInfo)) { if (searchResult != null) { searchResult.remove(finalLocaleInfo); } if (listAdapter != null) { listAdapter.notifyDataSetChanged(); } if (searchListViewAdapter != null) { searchListViewAdapter.notifyDataSetChanged(); } } } }); builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); showDialog(builder.create()); return true; } }); listView.setOnScrollListener(new AbsListView.OnScrollListener() { @Override public void onScrollStateChanged(AbsListView absListView, int i) { if (i == SCROLL_STATE_TOUCH_SCROLL && searching && searchWas) { AndroidUtilities.hideKeyboard(getParentActivity().getCurrentFocus()); } } @Override public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount, int totalItemCount) { } }); return fragmentView; }
From source file:com.github.jvanhie.discogsscrobbler.ReleaseVersionsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { //setup list view mList = new ListView(getActivity()); mList.setId(android.R.id.list);/*ww w .j av a2 s. c om*/ mList.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { onListItemClick(view, i, l); } }); //create superframe for adding list and empty view FrameLayout superFrame = new FrameLayout(getActivity()); FrameLayout.LayoutParams layoutparams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); superFrame.setLayoutParams(layoutparams); View emptyView = inflater.inflate(R.layout.fragment_empty, container, false); ((TextView) emptyView.findViewById(R.id.empty_heading)).setText("No versions found"); ((TextView) emptyView.findViewById(R.id.empty_text)).setText( "No alternative versions of this release were found, this could also mean Discogs did not add a master id to this release"); /*initialize list with local discogs collection*/ if (mDiscogs == null) mDiscogs = Discogs.getInstance(getActivity()); if (mRelease == null) { mDiscogs.getRelease(getArguments().getLong(ARG_ITEM_ID, 0), new Discogs.DiscogsDataWaiter<Release>() { @Override public void onResult(boolean success, Release data) { if (success) { mRelease = data; loadList(); } } }); } else { loadList(); } superFrame.addView(emptyView); mList.setEmptyView(emptyView); superFrame.addView(mList); return superFrame; }
From source file:com.hackensack.umc.activity.ProfileSelfieManualCropActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); /* if(savedInstanceState!=null){ imageUri=Uri.parse(savedInstanceState.getString(Constant.CAPTURE_IMAGE_URI)); }*//* ww w . j a v a2 s . c o m*/ //setContentView(R.layout.activity_profile_selfie); getSupportActionBar().setDisplayHomeAsUpEnabled(true); frameLayout = new FrameLayout(this); // creating LayoutParams FrameLayout.LayoutParams frameLayoutParam = new FrameLayout.LayoutParams( FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT); // set LinearLayout as a root element of the screen setContentView(frameLayout, frameLayoutParam); layoutInflater = LayoutInflater.from(this); View mainView = layoutInflater.inflate(R.layout.activity_profile_selfie, null, false); infalteXml(mainView); frameLayout.addView(mainView); //setContentView(R.layout.activity_list); //setContentView(R.layout.activity_list); }
From source file:de.tobiasbielefeld.solitaire.ui.manual.ManualGames.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_manual_games, container, false); ((Manual) getActivity()).setGamePageShown(false); layout1 = (ScrollView) view.findViewById(R.id.manual_games_layout_selection); scrollView = (ScrollView) view.findViewById(R.id.manual_games_scrollView); textName = (TextView) view.findViewById(R.id.manual_games_name); textStructure = (TextView) view.findViewById(R.id.manual_games_structure); textObjective = (TextView) view.findViewById(R.id.manual_games_objective); textRules = (TextView) view.findViewById(R.id.manual_games_rules); textScoring = (TextView) view.findViewById(R.id.manual_games_scoring); textBonus = (TextView) view.findViewById(R.id.manual_games_bonus); layout1.setVisibility(View.VISIBLE); scrollView.setVisibility(View.GONE); //if the manual is called from the in game menu, show the corresponding game rule page if (getArguments() != null && getArguments().containsKey(GAME)) { loadGameText(getArguments().getString(GAME)); }/*from w ww . j a v a 2s . c o m*/ //load the table String[] gameList = lg.getDefaultGameNameList(getResources()); TableRow row = new TableRow(getContext()); TableLayout tableLayout = (TableLayout) view.findViewById(R.id.manual_games_container); TypedValue typedValue = new TypedValue(); getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, typedValue, true); TableRow.LayoutParams params = new TableRow.LayoutParams(0, TableRow.LayoutParams.WRAP_CONTENT); params.weight = 1; //add each button for (int i = 0; i < lg.getGameCount(); i++) { Button entry = new Button(getContext()); if (i % COLUMNS == 0) { row = new TableRow(getContext()); tableLayout.addView(row); } entry.setBackgroundResource(typedValue.resourceId); entry.setEllipsize(TextUtils.TruncateAt.END); entry.setMaxLines(1); entry.setLayoutParams(params); entry.setText(gameList[i]); entry.setOnClickListener(this); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { entry.setAllCaps(false); } row.addView(entry); } //add some dummies to the last row, if necessary while (row.getChildCount() < COLUMNS) { FrameLayout dummy = new FrameLayout(getContext()); dummy.setLayoutParams(params); row.addView(dummy); } return view; }
From source file:org.telegram.ui.myLocationSettingsActivity.java
@Override public View createView(LayoutInflater inflater) { if (fragmentView == null) { actionBar.setBackButtonImage(R.drawable.ic_ab_back); actionBar.setAllowOverlayTitle(true); actionBar.setTitle("My Places"); actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() { @Override//from w w w . j a v a2s .co m public void onItemClick(int id) { if (id == -1) { finishFragment(); } } }); listAdapter = new ListAdapter(getParentActivity()); fragmentView = new FrameLayout(getParentActivity()); FrameLayout frameLayout = (FrameLayout) fragmentView; frameLayout.setBackgroundColor(0xfff0f0f0); ListView listView = new ListView(getParentActivity()); listView.setDivider(null); listView.setDividerHeight(0); listView.setVerticalScrollBarEnabled(false); listView.setDrawSelectorOnTop(true); frameLayout.addView(listView); FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) listView.getLayoutParams(); layoutParams.width = FrameLayout.LayoutParams.MATCH_PARENT; layoutParams.height = FrameLayout.LayoutParams.MATCH_PARENT; layoutParams.gravity = Gravity.TOP; listView.setLayoutParams(layoutParams); listView.setAdapter(listAdapter); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, final int i, long l) { if (i == homeRow) { AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); builder.setTitle("Home"); final ViewGroup.LayoutParams lparams = new ViewGroup.LayoutParams(50, 30); final EditText input = new EditText(getParentActivity()); input.setHint("Insert city"); input.setLayoutParams(lparams); builder.setView(input); builder.setPositiveButton("confirm", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (input.getText().toString().trim().length() > 0) { String city = input.getText().toString().trim(); try { Bundle locationHome = new getCoordinates().execute(city).get(); String latHome = locationHome.getString("lat"); String lonHome = locationHome.getString("lon"); SharedPreferences sharedPreferences = ApplicationLoader.applicationContext .getSharedPreferences("mainconfig", Activity.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putString("latHome", latHome); editor.putString("longHome", lonHome); editor.commit(); Log.i(TAG, "fine! " + lonHome); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } } else { Toast.makeText(getParentActivity(), "That is empty :(", Toast.LENGTH_SHORT) .show(); } } }); builder.setNegativeButton("Why?", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(getParentActivity(), "To website", Toast.LENGTH_SHORT).show(); } }); showAlertDialog(builder); } else if (i == workRow) { AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); builder.setTitle("Work"); final EditText input = new EditText(getParentActivity()); input.setHint("Insert city"); builder.setView(input); builder.setPositiveButton("confirm", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (input.getText().toString().trim().length() > 0) { String city = input.getText().toString().trim(); try { Bundle locationWork = new getCoordinates().execute(city).get(); String latWork = locationWork.getString("lat"); String lonWork = locationWork.getString("lon"); SharedPreferences sharedPreferences = ApplicationLoader.applicationContext .getSharedPreferences("mainconfig", Activity.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putString("latWork", latWork); editor.putString("longWork", lonWork); editor.commit(); Log.i(TAG, "fine! " + latWork); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } } else { Toast.makeText(getParentActivity(), "That is empty :(", Toast.LENGTH_SHORT) .show(); } } }); builder.setNegativeButton("Why?", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(getParentActivity(), "To website", Toast.LENGTH_SHORT).show(); } }); showAlertDialog(builder); } else if (i == entertainmentRow) { AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); builder.setTitle("Entertainment"); final EditText input = new EditText(getParentActivity()); input.setHint("Insert city"); builder.setView(input); builder.setPositiveButton("confirm", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (input.getText().toString().trim().length() > 0) { String city = input.getText().toString().trim(); try { Bundle locationEntertainment = new getCoordinates().execute(city).get(); String latEntertainment = locationEntertainment.getString("lat"); String lonEntertainment = locationEntertainment.getString("lon"); SharedPreferences sharedPreferences = ApplicationLoader.applicationContext .getSharedPreferences("mainconfig", Activity.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putString("latEntertainment", latEntertainment); editor.putString("longEntertainment", lonEntertainment); editor.commit(); Log.i(TAG, "fine! " + latEntertainment); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } } else { Toast.makeText(getParentActivity(), "That is empty :(", Toast.LENGTH_SHORT) .show(); } } }); builder.setNegativeButton("Why?", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(getParentActivity(), "To website", Toast.LENGTH_SHORT).show(); } }); showAlertDialog(builder); } //TODO find a solution for commuteRow as well!! } }); } else { ViewGroup parent = (ViewGroup) fragmentView.getParent(); if (parent != null) { parent.removeView(fragmentView); } } return fragmentView; }
From source file:com.huewu.pla.lib.MultiColumnListFragment.java
/** * Provide default implementation to return a simple list view. Subclasses * can override to replace with their own layout. If doing so, the returned * view hierarchy <em>must</em> have a ListView whose id is * {@link android.R.id#list android.R.id.list} and can optionally have a * sibling view id {@link android.R.id#empty android.R.id.empty} that is to * be shown when the list is empty./*w w w. jav a 2 s .c om*/ * * <p> * If you are overriding this method with your own custom content, consider * including the standard layout {@link android.R.layout#list_content} in * your layout file, so that you continue to retain all of the standard * behavior of ListFragment. In particular, this is currently the only way * to have the built-in indeterminant progress state be shown. */ @Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { final Context context = getActivity(); final FrameLayout root = new FrameLayout(context); // ------------------------------------------------------------------ final LinearLayout pframe = new LinearLayout(context); pframe.setId(INTERNAL_PROGRESS_CONTAINER_ID); pframe.setOrientation(LinearLayout.VERTICAL); pframe.setVisibility(View.GONE); pframe.setGravity(Gravity.CENTER); final ProgressBar progress = new ProgressBar(context, null, android.R.attr.progressBarStyleLarge); pframe.addView(progress, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); root.addView(pframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); // ------------------------------------------------------------------ final FrameLayout lframe = new FrameLayout(context); lframe.setId(INTERNAL_LIST_CONTAINER_ID); final TextView tv = new TextView(getActivity()); tv.setId(INTERNAL_EMPTY_ID); tv.setGravity(Gravity.CENTER); lframe.addView(tv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); final MultiColumnListView lv = createMultiColumnListView(context, inflater); lv.setId(android.R.id.list); lv.setDrawSelectorOnTop(false); lframe.addView(lv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); root.addView(lframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); // ------------------------------------------------------------------ root.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); return root; }
From source file:com.gudong.appkit.ui.fragment.ColorChooseDialog.java
private View getColorItemView(final Context context, int position, boolean isSelect) { int color = mColors[position]; int widthImageCheckView = Utils.convertDensityPix(context, 24); int widthColorView = Utils.convertDensityPix(context, 56); int widthMargin = Utils.convertDensityPix(context, 4); ImageView imageView = new ImageView(context); imageView.setImageResource(R.drawable.ic_check); FrameLayout.LayoutParams ivParams = new FrameLayout.LayoutParams(widthImageCheckView, widthImageCheckView); ivParams.gravity = Gravity.CENTER;//w w w .ja v a 2s . co m imageView.setLayoutParams(ivParams); imageView.setVisibility(isSelect ? View.VISIBLE : View.INVISIBLE); FrameLayout frameLayout = new FrameLayout(context); GridLayout.LayoutParams params = new GridLayout.LayoutParams( new FrameLayout.LayoutParams(widthColorView, widthColorView)); params.setGravity(Gravity.CENTER); params.setMargins(widthMargin, widthMargin, widthMargin, widthMargin); frameLayout.setLayoutParams(params); setBackgroundSelector(frameLayout, color); frameLayout.addView(imageView); frameLayout.setOnClickListener(this); frameLayout.setTag(position); return frameLayout; }
From source file:net.granoeste.scaffold.app.ScaffoldWebViewFragment.java
@SuppressLint("SetJavaScriptEnabled") @Override/*from w w w .j av a 2s.c o m*/ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); FrameLayout root = new FrameLayout(getActivity()); // ------------------ // Progress content // ------------------ mPFrame = new LinearLayout(getActivity()); mPFrame.setId(INTERNAL_PROGRESS_CONTAINER_ID); mPFrame.setOrientation(LinearLayout.VERTICAL); mPFrame.setGravity(Gravity.CENTER); ProgressBar progress = new ProgressBar(getActivity(), null, android.R.attr.progressBarStyleLarge); mPFrame.addView(progress, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); // ---------------- // WebView content // ---------------- mCFrame = new FrameLayout(getActivity()); mCFrame.setId(INTERNAL_CONTENT_CONTAINER_ID); mWebView = new InternalWebView(getActivity()); mWebView.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT); mWebView.getSettings().setJavaScriptEnabled(true); // Flash Support if (UIUtils.hasKitkat()) { // Flash(4.4?????) } else if (UIUtils.hasJellyBeanMr2()) { mWebView.getSettings().setPluginState(WebSettings.PluginState.ON); } else if (UIUtils.hasFroyo()) { // Deprecated Since API level 9, and removed in API level 18 (JellyBeanMr2) // mWebView.getSettings().setPluginEnabled(true); } // mWebView.getSettings().setVerticalScrollbarOverlay(true); mWebView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); // ? mWebView.setDownloadListener(new DownloadListener() { @Override public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setType(mimetype); intent.setData(Uri.parse(url)); startActivity(intent); } }); mWebView.setWebViewClient(new InternalWebViewClient(root, mCallbacks)); mCFrame.addView(mWebView, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); // ------------------------------------------------------------------ root.addView(mCFrame, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); root.addView(mPFrame, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); return root; }
From source file:com.readboy.mathproblem.app.ExpandableListFragment.java
/** * Provide default implementation to return a simple list view. Subclasses * can override to replace with their own layout. If doing so, the * returned view hierarchy <em>must</em> have a ListView whose id * is {@link android.R.id#list android.R.id.list} and can optionally * have a sibling view id {@link android.R.id#empty android.R.id.empty} * that is to be shown when the list is empty. * * <p>If you are overriding this method with your own custom content, * consider including the standard layout {@link android.R.layout#list_content} * in your layout file, so that you continue to retain all of the standard * behavior of ListFragment. In particular, this is currently the only * way to have the built-in indeterminant progress state be shown. *//* w w w .j av a 2 s .c om*/ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final Context context = getActivity(); FrameLayout root = new FrameLayout(context); // ------------------------------------------------------------------ LinearLayout pframe = new LinearLayout(context); pframe.setId(INTERNAL_PROGRESS_CONTAINER_ID); pframe.setOrientation(LinearLayout.VERTICAL); pframe.setVisibility(View.GONE); pframe.setGravity(Gravity.CENTER); ProgressBar progress = new ProgressBar(context, null, android.R.attr.progressBarStyleLarge); pframe.addView(progress, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); root.addView(pframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); // ------------------------------------------------------------------ FrameLayout lframe = new FrameLayout(context); lframe.setId(INTERNAL_LIST_CONTAINER_ID); TextView tv = new TextView(getActivity()); tv.setId(INTERNAL_EMPTY_ID); tv.setGravity(Gravity.CENTER); lframe.addView(tv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); // ------------------------------------------------------------------ /*ExpandableListView expandableListView = (ExpandableListView) View.inflate( getActivity(), R.layout.expandable_gradelist, lframe);*/ // ------------------------------------------------------------------ ExpandableListView lv = new ExpandableListView(getActivity()); lv.setId(android.R.id.list); lv.setDrawSelectorOnTop(false); lframe.addView(lv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); // ------------------------------------------------------------------ /* ListView lv = new ListView(getActivity()); lv.setId(android.R.id.list); lv.setDrawSelectorOnTop(false); lframe.addView(lv, new FrameLayout.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));*/ // ------------------------------------------------------------------ root.addView(lframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); root.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); return root; }