Example usage for android.view ViewGroup findViewById

List of usage examples for android.view ViewGroup findViewById

Introduction

In this page you can find the example usage for android.view ViewGroup findViewById.

Prototype

@Nullable
public final <T extends View> T findViewById(@IdRes int id) 

Source Link

Document

Finds the first descendant view with the given ID, the view itself if the ID matches #getId() , or null if the ID is invalid (< 0) or there is no matching view in the hierarchy.

Usage

From source file:com.google.android.apps.iosched.ui.ScheduleFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_schedule, null);

    mWorkspace = (Workspace) root.findViewById(R.id.workspace);

    mTitle = (TextView) root.findViewById(R.id.block_title);

    mLeftIndicator = root.findViewById(R.id.indicator_left);
    mLeftIndicator.setOnTouchListener(new View.OnTouchListener() {
        public boolean onTouch(View view, MotionEvent motionEvent) {
            if ((motionEvent.getAction() & MotionEventUtils.ACTION_MASK) == MotionEvent.ACTION_DOWN) {
                mWorkspace.scrollLeft();
                return true;
            }// w  w w.  ja  v a 2  s  .  co  m
            return false;
        }
    });
    mLeftIndicator.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            mWorkspace.scrollLeft();
        }
    });

    mRightIndicator = root.findViewById(R.id.indicator_right);
    mRightIndicator.setOnTouchListener(new View.OnTouchListener() {
        public boolean onTouch(View view, MotionEvent motionEvent) {
            if ((motionEvent.getAction() & MotionEventUtils.ACTION_MASK) == MotionEvent.ACTION_DOWN) {
                mWorkspace.scrollRight();
                return true;
            }
            return false;
        }
    });
    mRightIndicator.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            mWorkspace.scrollRight();
        }
    });

    setupDay(inflater, TUE_START);
    setupDay(inflater, WED_START);

    updateWorkspaceHeader(0);
    mWorkspace.setOnScrollListener(new Workspace.OnScrollListener() {
        public void onScroll(float screenFraction) {
            updateWorkspaceHeader(Math.round(screenFraction));
        }
    }, true);

    return root;
}

From source file:com.lullabot.android.apps.iosched.ui.ScheduleFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_schedule, null);

    mWorkspace = (Workspace) root.findViewById(R.id.workspace);

    mTitle = (TextView) root.findViewById(R.id.block_title);

    mLeftIndicator = root.findViewById(R.id.indicator_left);
    mLeftIndicator.setOnTouchListener(new View.OnTouchListener() {
        public boolean onTouch(View view, MotionEvent motionEvent) {
            if ((motionEvent.getAction() & MotionEventUtils.ACTION_MASK) == MotionEvent.ACTION_DOWN) {
                mWorkspace.scrollLeft();
                return true;
            }/*from   www.ja  v  a2  s . c om*/
            return false;
        }
    });
    mLeftIndicator.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            mWorkspace.scrollLeft();
        }
    });

    mRightIndicator = root.findViewById(R.id.indicator_right);
    mRightIndicator.setOnTouchListener(new View.OnTouchListener() {
        public boolean onTouch(View view, MotionEvent motionEvent) {
            if ((motionEvent.getAction() & MotionEventUtils.ACTION_MASK) == MotionEvent.ACTION_DOWN) {
                mWorkspace.scrollRight();
                return true;
            }
            return false;
        }
    });
    mRightIndicator.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            mWorkspace.scrollRight();
        }
    });

    setupDay(inflater, SAT_START);

    updateWorkspaceHeader(0);
    mWorkspace.setOnScrollListener(new Workspace.OnScrollListener() {
        public void onScroll(float screenFraction) {
            updateWorkspaceHeader(Math.round(screenFraction));
        }
    }, true);

    return root;
}

From source file:com.achep.acdisplay.ui.components.NotifyWidget.java

@Override
protected ViewGroup onCreateView(@NonNull LayoutInflater inflater, @NonNull ViewGroup container,
        @Nullable ViewGroup sceneView) {
    boolean initialize = sceneView == null;
    if (initialize) {
        sceneView = (ViewGroup) inflater.inflate(R.layout.acdisplay_scene_notification, container, false);
        assert sceneView != null;
    }//from   w w  w  .j av a2s .  co m

    mNotifyWidget = (NotificationWidget) sceneView.findViewById(R.id.notification);

    if (!initialize) {
        return sceneView;
    }

    mNotifyWidget.setCallback(mWidgetCallback);
    return sceneView;
}

From source file:com.lullabot.android.apps.iosched.ui.TagStreamFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_webview_with_spinner, null);

    // For some reason, if we omit this, NoSaveStateFrameLayout thinks we are
    // FILL_PARENT / WRAP_CONTENT, making the progress bar stick to the top of the activity.
    root.setLayoutParams(/* w  w  w.ja  v a2 s.  co m*/
            new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));

    mLoadingSpinner = root.findViewById(R.id.loading_spinner);
    mWebView = (WebView) root.findViewById(R.id.webview);
    mWebView.setWebViewClient(mWebViewClient);

    mWebView.post(new Runnable() {
        public void run() {
            mWebView.getSettings().setJavaScriptEnabled(true);
            mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
            mWebView.loadUrl("http://drupalcampnyc.org/mobile/news");
        }
    });

    return root;
}

From source file:org.androidtitlan.estoesgoogle.ui.ScheduleFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_schedule, null);

    mWorkspace = (Workspace) root.findViewById(R.id.workspace);

    mTitle = (TextView) root.findViewById(R.id.block_title);

    mLeftIndicator = root.findViewById(R.id.indicator_left);
    mLeftIndicator.setOnTouchListener(new View.OnTouchListener() {
        public boolean onTouch(View view, MotionEvent motionEvent) {
            if ((motionEvent.getAction() & MotionEventUtils.ACTION_MASK) == MotionEvent.ACTION_DOWN) {
                mWorkspace.scrollLeft();
                return true;
            }/*  ww  w  .ja  v  a  2 s. c o  m*/
            return false;
        }
    });
    mLeftIndicator.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            mWorkspace.scrollLeft();
        }
    });

    mRightIndicator = root.findViewById(R.id.indicator_right);
    mRightIndicator.setOnTouchListener(new View.OnTouchListener() {
        public boolean onTouch(View view, MotionEvent motionEvent) {
            if ((motionEvent.getAction() & MotionEventUtils.ACTION_MASK) == MotionEvent.ACTION_DOWN) {
                mWorkspace.scrollRight();
                return true;
            }
            return false;
        }
    });
    mRightIndicator.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            mWorkspace.scrollRight();
        }
    });

    setupDay(inflater, LUNES);
    setupDay(inflater, MARTES);
    setupDay(inflater, MIERCOLES);

    updateWorkspaceHeader(0);
    mWorkspace.setOnScrollListener(new Workspace.OnScrollListener() {
        public void onScroll(float screenFraction) {
            updateWorkspaceHeader(Math.round(screenFraction));
        }
    }, true);

    return root;
}

From source file:angeloid.dreamnarae.Prev_Main.java

 @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
      Bundle savedInstanceState) {//from ww  w. j  av  a2s .com
   ViewGroup root = (ViewGroup) inflater.inflate(
         R.layout.tab_tab2_prev_install, null);
   previ = (Button) root.findViewById(R.id.tab_tab2_prev_reboot_ok);
   previi = (Button) root.findViewById(R.id.tab_tab2_prev_reboot_no);
   previ.setTypeface(Tab_MainActivity.Fonts.THEOREM);
   previi.setTypeface(Tab_MainActivity.Fonts.THEOREM);
   usercheck_prev = (ImageView) root
         .findViewById(R.id.tab_tab2_prev_usercheck);
   progresstext_prev = (TextView) root
         .findViewById(R.id.tab_tab2_prev_running);
   progresstext_prev.setTypeface(Tab_MainActivity.Fonts.THEOREM);

   //   

   if (new File("/system/98banner_dreamnarae_prev").exists()) {
      usercheck_prev.setImageResource(R.drawable.apply);
      previ.setEnabled(false);
      previ.setFocusable(false);
      previi.setEnabled(false);
      previi.setFocusable(false);
      progresstext_prev.setText(R.string.tab_tab2_installed);

   } else {
      usercheck_prev.setImageResource(R.drawable.not_apply);

   }
   //  
   previ.setOnClickListener(new View.OnClickListener() {

      public void onClick(View v) {
         // TODO
         v.postDelayed(new Runnable() {
            public void run() {
               DialogProgress1(false);
            }
         }, 10); // 0.01      
      }
   });
   //  
   previi.setOnClickListener(new View.OnClickListener() {

      public void onClick(View v) {
         // TODO
         v.postDelayed(new Runnable() {
            public void run() {
               DialogProgress2(false);
            }
         }, 10); // 0.01      
      }
   });
   return root;
}

From source file:com.goliathonline.android.kegbot.ui.BulletinFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_webview_with_spinner, null);

    // For some reason, if we omit this, NoSaveStateFrameLayout thinks we are
    // FILL_PARENT / WRAP_CONTENT, making the progress bar stick to the top of the activity.
    root.setLayoutParams(// w  w  w . java  2 s. co m
            new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));

    mLoadingSpinner = root.findViewById(R.id.loading_spinner);
    mWebView = (WebView) root.findViewById(R.id.webview);
    mWebView.setWebViewClient(mWebViewClient);

    mWebView.post(new Runnable() {
        public void run() {
            mWebView.getSettings().setJavaScriptEnabled(true);
            mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(false);
            mWebView.loadUrl(BULLETIN_URL);
        }
    });

    return root;
}

From source file:com.google.android.apps.dashclock.configuration.ConfigureAppearanceFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mAnimationDuration = getResources().getInteger(android.R.integer.config_shortAnimTime);

    final SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity());

    ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_configure_appearance, container, false);

    mCurrentStyleNames.put(AppearanceConfig.PREF_STYLE_TIME,
            sp.getString(AppearanceConfig.PREF_STYLE_TIME, AppearanceConfig.TIME_STYLE_NAMES[0]));
    configureStylePager((ViewPager) rootView.findViewById(R.id.pager_time_style),
            (PagerPositionStrip) rootView.findViewById(R.id.pager_time_position_strip),
            AppearanceConfig.TIME_STYLE_NAMES, AppearanceConfig.COMPONENT_TIME,
            Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM, AppearanceConfig.PREF_STYLE_TIME);

    mCurrentStyleNames.put(AppearanceConfig.PREF_STYLE_DATE,
            sp.getString(AppearanceConfig.PREF_STYLE_DATE, AppearanceConfig.DATE_STYLE_NAMES[0]));
    configureStylePager((ViewPager) rootView.findViewById(R.id.pager_date_style),
            (PagerPositionStrip) rootView.findViewById(R.id.pager_date_position_strip),
            AppearanceConfig.DATE_STYLE_NAMES, AppearanceConfig.COMPONENT_DATE,
            Gravity.CENTER_HORIZONTAL | Gravity.TOP, AppearanceConfig.PREF_STYLE_DATE);
    ((ConfigurationActivity) getActivity()).showWallpaper();

    mAppearanceContainerView = rootView.findViewById(R.id.appearance_container);

    if (savedInstanceState == null) {
        getChildFragmentManager().beginTransaction()
                .add(R.id.appearance_more_container, new ConfigureAppearanceMoreFragment()).commit();
    }/*from www.  j ava 2  s  .c  o m*/
    return rootView;
}

From source file:angeloid.dreamnarae.Miracle_Main.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.tab_tab2_miracle_install, null);
    miraclei = (Button) root.findViewById(R.id.tab_tab2_miracle_reboot_ok);
    miracleii = (Button) root.findViewById(R.id.tab_tab2_miracle_reboot_no);
    miraclei.setTypeface(Tab_MainActivity.Fonts.THEOREM);
    miracleii.setTypeface(Tab_MainActivity.Fonts.THEOREM);
    usercheck_miracle = (ImageView) root.findViewById(R.id.tab_tab2_miracle_usercheck);
    progresstext_miracle = (TextView) root.findViewById(R.id.tab_tab2_miracle_running);
    progresstext_miracle.setTypeface(Tab_MainActivity.Fonts.THEOREM);

    //   //w ww.j a va  2s  .  co m

    if (new File("/system/98banner_dreamnarae_miracle").exists()) {
        usercheck_miracle.setImageResource(R.drawable.apply);
        miraclei.setEnabled(false);
        miraclei.setFocusable(false);
        miracleii.setEnabled(false);
        miracleii.setFocusable(false);
        progresstext_miracle.setText(R.string.tab_tab2_installed);
    } else {

        usercheck_miracle.setImageResource(R.drawable.not_apply);

    }
    //  
    miraclei.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            // TODO
            v.postDelayed(new Runnable() {
                public void run() {
                    DialogProgress1(false);
                }
            }, 10); // 0.01      
        }
    });
    //  
    miracleii.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            // TODO
            v.postDelayed(new Runnable() {
                public void run() {
                    DialogProgress2(false);
                }
            }, 10); // 0.01      
        }
    });
    return root;
}

From source file:org.androidtitlan.estoesgoogle.ui.TagStreamFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_webview_with_spinner, null);

    // For some reason, if we omit this, NoSaveStateFrameLayout thinks we are
    // FILL_PARENT / WRAP_CONTENT, making the progress bar stick to the top of the activity.
    root.setLayoutParams(//from  w  w w  .ja  v  a2s .co  m
            new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));

    mLoadingSpinner = root.findViewById(R.id.loading_spinner);
    mWebView = (WebView) root.findViewById(R.id.webview);
    mWebView.setWebViewClient(mWebViewClient);

    mWebView.post(new Runnable() {
        public void run() {
            mWebView.getSettings().setJavaScriptEnabled(true);
            mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(false);
            mWebView.getSettings().setUserAgentString(
                    "Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3");
            mWebView.loadUrl("http://mobile.twitter.com/searches?q=%23EstoEsGoogle");
        }
    });

    return root;
}