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.lullabot.android.apps.iosched.ui.MapFragment.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   www. ja  v a  2 s . c om*/
            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() {
            // Initialize web view
            if (CLEAR_CACHE_ON_LOAD) {
                mWebView.clearCache(true);
            }

            mWebView.getSettings().setJavaScriptEnabled(true);
            mWebView.loadUrl(MAP_URL);
        }
    });

    return root;
}

From source file:com.google.android.apps.iosched2.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  ww w.j  av  a  2s. 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, TUE_START);

    if (Setup.CONFERENCE_DAYS > 1) {
        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.eutectoid.dosomething.picker.PlacePickerFragment.java

@Override
void setupViews(ViewGroup view) {
    if (showSearchBox) {
        ListView listView = (ListView) view.findViewById(R.id.com_facebook_picker_list_view);

        View searchHeaderView = getActivity().getLayoutInflater().inflate(R.layout.picker_search_box, listView,
                false);//from   w  w  w. j av  a 2 s  .c o  m

        listView.addHeaderView(searchHeaderView, null, false);

        searchBox = (EditText) view.findViewById(R.id.com_facebook_picker_search_text);

        searchBox.addTextChangedListener(new SearchTextWatcher());
        if (!TextUtils.isEmpty(searchText)) {
            searchBox.setText(searchText);
        }
    }
}

From source file:org.alfresco.mobile.android.application.extension.samsung.pen.SNotePagesDialogFragment.java

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

    getDialog().setTitle(R.string.editor_pages_move);
    getDialog().requestWindowFeature(Window.FEATURE_LEFT_ICON);

    ViewGroup v = (ViewGroup) inflater.inflate(R.layout.snote_pages, container, false);

    int width = (int) Math.round(UIUtils.getScreenDimension(getActivity())[0] * (Float.parseFloat(
            getResources().getString(android.R.dimen.dialog_min_width_major).replace("%", "")) * 0.01));
    v.setLayoutParams(new LayoutParams(width, LayoutParams.MATCH_PARENT));

    final SeekBar seekbar = ((SeekBar) v.findViewById(R.id.seekbar_pages));
    final TextView tv = ((TextView) v.findViewById(R.id.pages_number));
    tv.setText(String.valueOf(originPageNumber + 1) + " / " + String.valueOf(totalPages));

    seekbar.setMax(totalPages - 1);//from  w  ww  . j  a  v  a 2s .  c o  m
    seekbar.setProgress(originPageNumber);
    seekbar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            currentPageNumber = progress + 1;
            tv.setText(String.valueOf(currentPageNumber) + " / " + String.valueOf(totalPages));
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }
    });

    final Button validate = (Button) v.findViewById(R.id.create_document);
    final Button cancel = (Button) v.findViewById(R.id.cancel);

    validate.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            ((SNoteEditorActivity) getActivity()).movePage(currentPageNumber - 1);
            dismiss();
        }
    });

    cancel.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            SNotePagesDialogFragment.this.dismiss();
        }
    });

    return v;
}

From source file:com.bullmobi.message.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.easynotification_scene_notification, container,
                false);//from   w  w w .  j a v a2  s.  co  m
        assert sceneView != null;
    }

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

    if (!initialize) {
        return sceneView;
    }

    mNotifyWidget.setCallback(mWidgetCallback);
    return sceneView;
}

From source file:org.ietf.ietfsched.ui.ScheduleFragment.java

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

    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   w ww.  j  a  va 2s  .  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();
        }
    });

    for (long day : START_DAYS) {
        setupDay(inflater, day);
    }

    //        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:net.openwatch.acluaz.FormFragmentActivity.java

private View inflateCustomTab(String tab_title) {
    ViewGroup tab = (ViewGroup) inflater.inflate(R.layout.tab_indicator,
            (ViewGroup) this.findViewById(android.R.id.tabs), false);
    ((TextView) tab.findViewById(R.id.title)).setText(tab_title);
    return tab;// ww w  .  j a v a 2 s .  co  m
}

From source file:org.csp.everyaware.fragments.FragmentWizardStep2.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Log.d("FragmentWizardStep2", "onCreateView()");

    //inflating del layout del fragment
    ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_wizard_step2, container, false);

    mUserEt = (EditText) rootView.findViewById(R.id.usernameEt);
    mPswdEt = (EditText) rootView.findViewById(R.id.passwordEt);
    mOpResTv = (TextView) rootView.findViewById(R.id.operationResultTv);
    mActivateBtn = (Button) rootView.findViewById(R.id.activateAccountBtn);

    mActivateBtn.setOnClickListener(new OnClickListener() {
        @Override/* w  ww .j  a  va  2 s.  c o m*/
        public void onClick(View v) {
            if (!mUserMod || !mPswdMod) {
                Toast.makeText(getActivity().getApplicationContext(),
                        getResources().getString(R.string.fill_both_field_str), Toast.LENGTH_LONG).show();
                mOpResTv.setText("");
                return;
            }
            mActivateBtn.setEnabled(false);

            String[] credentials = new String[2];

            credentials[0] = mUserEt.getText().toString();
            credentials[1] = mPswdEt.getText().toString();

            Log.d("OnClickListener", "onClick()--> credentials: " + credentials[0] + " " + credentials[1]);

            //is internet connection available? 
            boolean[] connectivity = Utils.haveNetworkConnection(getActivity().getApplicationContext());
            boolean connectivityOn = connectivity[0] || connectivity[1];

            if (connectivityOn)
                new ActivateAccountTask().execute(credentials);
            else {
                mActivateBtn.setEnabled(true);
                Toast.makeText(getActivity().getApplicationContext(), R.string.alert_dialog_no_internet,
                        Toast.LENGTH_LONG).show();
            }
        }
    });

    mUserMod = false;

    mUserEt.addTextChangedListener(new TextWatcher() {
        @Override
        public void afterTextChanged(Editable s) {
            if (mUserEt.getText().toString().length() > 0)
                mUserMod = true;
            else
                mUserMod = false;
        }

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
        }
    });

    mPswdMod = false;

    mPswdEt.addTextChangedListener(new TextWatcher() {
        @Override
        public void afterTextChanged(Editable s) {
            if (mPswdEt.getText().toString().length() > 0)
                mPswdMod = true;
            else
                mPswdMod = false;
        }

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
        }
    });

    return rootView;
}

From source file:heartware.com.FB_picker.PlacePickerFragment.java

@Override
void setupViews(ViewGroup view) {
    if (showSearchBox) {
        ListView listView = (ListView) view.findViewById(R.id.com_facebook_picker_list_view);

        View searchHeaderView = getActivity().getLayoutInflater().inflate(R.layout.fb_picker_search_box,
                listView, false);//from  w  w  w.j av  a2 s . c  o m

        listView.addHeaderView(searchHeaderView, null, false);

        searchBox = (EditText) view.findViewById(R.id.com_facebook_picker_search_text);

        searchBox.addTextChangedListener(new SearchTextWatcher());
        if (!TextUtils.isEmpty(searchText)) {
            searchBox.setText(searchText);
        }
    }
}

From source file:com.swisscom.safeconnect.activity.TutorialActivity.java

protected void setUpContent(final int width) {
    final String[] pageDescriptions = getResources().getStringArray(R.array.tutorial_page_descriptions);

    for (int i = 0; i < viewPager.getAdapter().getCount(); i++) {
        ViewGroup viewGroup = (ViewGroup) viewPager.getAdapter().instantiateItem(null, i);
        viewGroup.getLayoutParams().width = width;

        if (i < pageDescriptions.length) {
            TextView descriptionTextView = (TextView) viewGroup.findViewById(R.id.descriptionTextView);
            descriptionTextView.setText(pageDescriptions[i]);
        }/*  w  w  w  .j  av a2  s .  c o m*/
    }
}