List of usage examples for android.widget LinearLayout getChildAt
public View getChildAt(int index)
From source file:Main.java
public static LinearLayout fetchAppLayout(Activity activity) { FrameLayout rootView = (FrameLayout) activity.getWindow().getDecorView().getRootView(); LinearLayout rootLayout = (LinearLayout) rootView.getChildAt(0); return ((LinearLayout) ((FrameLayout) rootLayout.getChildAt(1)).getChildAt(0)); }
From source file:Main.java
public static void animateIn(View view) { if (view instanceof RelativeLayout) { RelativeLayout relativeLayout = (RelativeLayout) view; for (int i = 0; i < relativeLayout.getChildCount(); i++) { View child = relativeLayout.getChildAt(i); child.animate().setStartDelay(100 + i * DELAY).alpha(1).scaleX(1).scaleY(1); }// w ww. j ava 2s.c o m } else { LinearLayout linearLayout = (LinearLayout) view; for (int i = 0; i < linearLayout.getChildCount(); i++) { View child = linearLayout.getChildAt(i); child.animate().setStartDelay(100 + i * DELAY).alpha(1).scaleX(1).scaleY(1); } } }
From source file:Main.java
public static void animateOut(View view) { if (view instanceof RelativeLayout) { RelativeLayout relativeLayout = (RelativeLayout) view; for (int i = 0; i < relativeLayout.getChildCount(); i++) { View child = relativeLayout.getChildAt(i); child.animate().setStartDelay(i).alpha(0).scaleX(0f).scaleY(0f); }//w ww . java 2 s . c om } else { LinearLayout linearLayout = (LinearLayout) view; for (int i = 0; i < linearLayout.getChildCount(); i++) { View child = linearLayout.getChildAt(i); child.animate().setStartDelay(i).alpha(0).scaleX(0f).scaleY(0f); } } }
From source file:com.github.tetravex_android.activity.HowToActivity.java
/** * Sets the page indicator dots at the bottom of the screen to indicate which page is displayed * * @param pageIndex the index of the page currently displayed *///from w w w . j av a 2 s . co m private void setIndicatorDots(int pageIndex) { // set the indicator dot for the correct page LinearLayout dotGroup = (LinearLayout) findViewById(R.id.how_to_pager_dots); for (int i = 0; i < dotGroup.getChildCount(); i++) { ImageView view = (ImageView) dotGroup.getChildAt(i); String tagString = (String) view.getTag(); int tagId = Integer.valueOf(tagString); if (tagId == pageIndex) { view.setImageResource(R.drawable.pager_dot_on); } else { view.setImageResource(R.drawable.pager_dot_off); } } }
From source file:com.example.toolbardemo.Fragment.MenuFragment.java
private void initItems(View v) { LinearLayout contentLayout = (LinearLayout) v.findViewById(R.id.drawer_view); int count = contentLayout.getChildCount(); for (int i = 0; i < count; i++) { contentLayout.getChildAt(i).setOnClickListener(this); }//from w w w . ja v a 2 s .c om }
From source file:flex.android.magiccube.welcome.GuideActivity.java
private void initDots() { LinearLayout ll = (LinearLayout) findViewById(R.id.ll); dots = new ImageView[views.size()]; for (int i = 0; i < views.size(); i++) { dots[i] = (ImageView) ll.getChildAt(i); dots[i].setEnabled(true);// }/*w w w. j a v a 2s. c o m*/ currentIndex = 0; dots[currentIndex].setEnabled(false);// }
From source file:org.exoplatform.mobile.tests.SocialTabsActivityTest.java
public void shouldMoveToOtherPage() { create();/*from w w w . ja v a 2 s . c o m*/ init(); tabs.setCurrentItem(SocialTabsActivity.ALL_UPDATES); assertThat("Should be on All Updates tab", pages.getCurrentItem(), equalTo(SocialTabsActivity.ALL_UPDATES)); // remains on All // Updates tabs.setCurrentItem(SocialTabsActivity.MY_CONNECTIONS); assertThat("Should be on My Connections tab", pages.getCurrentItem(), equalTo(SocialTabsActivity.MY_CONNECTIONS)); // moves to My // Connections LinearLayout tabsLayout = (LinearLayout) tabs.getChildAt(0); Robolectric.clickOn((View) tabsLayout.getChildAt(SocialTabsActivity.MY_SPACES)); assertThat("Should be on My Spaces tab", pages.getCurrentItem(), equalTo(SocialTabsActivity.MY_SPACES)); // moves to My Spaces }
From source file:id.ridon.keude.views.fragments.SelectLocalAppsFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setEmptyText(getString(R.string.no_applications_found)); packageManager = getActivity().getPackageManager(); defaultAppIcon = getActivity().getResources().getDrawable(android.R.drawable.sym_def_app_icon); selectLocalAppsActivity = (SelectLocalAppsActivity) getActivity(); ListView listView = getListView(); listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); SimpleCursorAdapter adapter = new SimpleCursorAdapter(getActivity(), R.layout.select_local_apps_list_item, null,/* w w w. j a v a 2s . c o m*/ new String[] { InstalledAppProvider.DataColumns.APPLICATION_LABEL, InstalledAppProvider.DataColumns.APP_ID, }, new int[] { R.id.application_label, R.id.package_name, }, 0); adapter.setViewBinder(new ViewBinder() { @Override public boolean setViewValue(View view, Cursor cursor, int columnIndex) { if (columnIndex == cursor.getColumnIndex(InstalledAppProvider.DataColumns.APP_ID)) { String packageName = cursor.getString(columnIndex); TextView textView = (TextView) view.findViewById(R.id.package_name); textView.setText(packageName); LinearLayout ll = (LinearLayout) view.getParent().getParent(); ImageView iconView = (ImageView) ll.getChildAt(0); Drawable icon; try { icon = packageManager.getApplicationIcon(packageName); } catch (PackageManager.NameNotFoundException e) { icon = defaultAppIcon; } iconView.setImageDrawable(icon); return true; } return false; } }); setListAdapter(adapter); setListShown(false); // start out with a progress indicator // either reconnect with an existing loader or start a new one getLoaderManager().initLoader(0, null, this); // build list of existing apps from what is on the file system if (KeudeApp.selectedApps == null) { HashSet<String> selectedApps = new HashSet<String>(); for (String filename : LocalRepoManager.get(selectLocalAppsActivity).repoDir.list()) { if (filename.matches(".*\\.apk")) { String packageName = filename.substring(0, filename.indexOf("_")); selectedApps.add(packageName); } } KeudeApp.selectedApps = selectedApps; } }
From source file:org.fdroid.fdroid.views.fragments.SelectLocalAppsFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setEmptyText(getString(R.string.no_applications_found)); packageManager = getActivity().getPackageManager(); defaultAppIcon = getActivity().getResources().getDrawable(android.R.drawable.sym_def_app_icon); selectLocalAppsActivity = (SelectLocalAppsActivity) getActivity(); ListView listView = getListView(); listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); SimpleCursorAdapter adapter = new SimpleCursorAdapter(getActivity(), R.layout.select_local_apps_list_item, null,/*from w w w. ja v a2 s. c o m*/ new String[] { InstalledAppProvider.DataColumns.APPLICATION_LABEL, InstalledAppProvider.DataColumns.APP_ID, }, new int[] { R.id.application_label, R.id.package_name, }, 0); adapter.setViewBinder(new ViewBinder() { @Override public boolean setViewValue(View view, Cursor cursor, int columnIndex) { if (columnIndex == cursor.getColumnIndex(InstalledAppProvider.DataColumns.APP_ID)) { String packageName = cursor.getString(columnIndex); TextView textView = (TextView) view.findViewById(R.id.package_name); textView.setText(packageName); LinearLayout ll = (LinearLayout) view.getParent().getParent(); ImageView iconView = (ImageView) ll.getChildAt(0); Drawable icon; try { icon = packageManager.getApplicationIcon(packageName); } catch (PackageManager.NameNotFoundException e) { icon = defaultAppIcon; } iconView.setImageDrawable(icon); return true; } return false; } }); setListAdapter(adapter); setListShown(false); // start out with a progress indicator // either reconnect with an existing loader or start a new one getLoaderManager().initLoader(0, null, this); // build list of existing apps from what is on the file system if (FDroidApp.selectedApps == null) { Set<String> selectedApps = new HashSet<>(); for (String filename : LocalRepoManager.get(selectLocalAppsActivity).repoDir.list()) { if (filename.matches(".*\\.apk")) { String packageName = filename.substring(0, filename.indexOf("_")); selectedApps.add(packageName); } } FDroidApp.selectedApps = selectedApps; } }
From source file:mobisocial.musubi.objects.PictureObj.java
@Override public void render(Context context, View view, DbObjCursor obj, boolean allowInteractions) { LinearLayout frame = (LinearLayout) view; ImageView imageView = (ImageView) frame.getChildAt(0); FileDescriptor fd = obj.getFileDescriptorForRaw(); byte[] raw = null; if (fd == null) { raw = obj.getRaw();// w w w. jav a2 s. c o m } bindImageToView(context, imageView, raw, fd); String text = obj.getJson().optString(TEXT); TextView textView = (TextView) frame.getChildAt(1); textView.setText(text); }