Example usage for android.widget FrameLayout findViewById

List of usage examples for android.widget FrameLayout findViewById

Introduction

In this page you can find the example usage for android.widget FrameLayout 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.tactfactory.tracscan.harmony.view.DrawerManager.java

/**
 * Initialize the buttons click listeners.
 *//* w w w.jav a  2  s.  com*/
private void initButtons() {
    FrameLayout menuLeftView = this.drawerActivity.getMenuLeftView();
    menuLeftView.findViewById(R.id.menu_itemprod_list_button).setOnClickListener(this);
    menuLeftView.findViewById(R.id.menu_user_list_button).setOnClickListener(this);
    menuLeftView.findViewById(R.id.menu_orderprod_list_button).setOnClickListener(this);
    menuLeftView.findViewById(R.id.menu_zone_list_button).setOnClickListener(this);
    menuLeftView.findViewById(R.id.menu_logprod_list_button).setOnClickListener(this);
    menuLeftView.findViewById(R.id.menu_license_button).setOnClickListener(this);
}

From source file:com.yojiokisoft.japanesecalc.SkinPagerAdapter.java

/**
 * @see PagerAdapter#instantiateItem(ViewGroup, int)
 *//*from  ww w .j  av a  2 s .c  o m*/
@Override
public Object instantiateItem(ViewGroup container, int position) {
    FrameLayout layout = (FrameLayout) this.mInflter.inflate(R.layout.page_skin, null);

    mBigImage = (ImageView) layout.findViewById(R.id.big_image);
    int padding = MyResource.dpi2Px(5);
    if (mOrientation == Configuration.ORIENTATION_LANDSCAPE) {
        mBigImage.setPadding(0, 0, padding, 0);
    } else {
        mBigImage.setPadding(0, padding, 0, 0);
    }

    BackImageEntity item = mList.get(position);
    String resName = item.resourceName;
    int resId = MyResource.getResourceIdByName(resName);
    mBigImage.setImageResource(resId);
    mBigImage.setTag(resName);

    // ?
    container.addView(layout);

    return layout;
}

From source file:com.yojiokisoft.yumekanow.adapter.CardDetailAdapter.java

/**
 * @see PagerAdapter#instantiateItem(ViewGroup, int)
 *///w  ww  .ja  v a  2s .  c  o  m
@Override
public Object instantiateItem(ViewGroup container, int position) {
    FrameLayout layout = (FrameLayout) this.mInflter.inflate(R.layout.card_detail, null);

    mTextView = (TextView) layout.findViewById(R.id.affirmationText);
    mImageView = (ImageView) layout.findViewById(R.id.backImage);

    // ??
    if (mCardDao != null) {
        Integer cardId = mList.get(position);
        try {
            List<CardEntity> list = mCardDao.queryForEq("id", cardId);
            printCard(list.get(0));
        } catch (SQLException e) {
            MyUncaughtExceptionHandler.sendBugReport((Activity) mContext, e);
        }
    }

    // ?
    container.addView(layout);

    return layout;
}

From source file:org.odk.collect.android.fragments.dialogs.RankingWidgetDialog.java

private LinearLayout setUpPositionsLayout(List<String> values) {
    LinearLayout positionsLayout = new LinearLayout(getContext());
    positionsLayout.setOrientation(LinearLayout.VERTICAL);

    LayoutParams layoutParams = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT);
    layoutParams.setMargins(0, 0, 10, 0);
    positionsLayout.setLayoutParams(layoutParams);

    for (String value : values) {
        FrameLayout positionLayout = (FrameLayout) LayoutInflater.from(getContext())
                .inflate(R.layout.ranking_item, positionsLayout, false);
        TextView textView = positionLayout.findViewById(R.id.rank_item_text);
        textView.setText(String.valueOf(values.indexOf(value) + 1));
        textView.setTextSize(Collect.getQuestionFontsize());

        positionsLayout.addView(positionLayout);
    }/*from  www  . j  av  a  2  s .  c o m*/
    return positionsLayout;
}

From source file:com.druk.bonjour.browser.ui.fragment.ServiceBrowserFragment.java

@Nullable
@Override/*from w  w w .j  ava2s.  c  om*/
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    FrameLayout rootView = (FrameLayout) inflater.inflate(R.layout.fragment_service_browser, container, false);
    mRecyclerView = (RecyclerView) rootView.findViewById(R.id.recycler_view);
    mProgressView = (ProgressBar) rootView.findViewById(R.id.progress);
    mErrorView = (LinearLayout) rootView.findViewById(R.id.error_container);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(mRecyclerView.getContext()));
    mRecyclerView.setHasFixedSize(true);
    mRecyclerView.setAdapter(mAdapter);
    if (savedInstanceState != null) {
        mAdapter.setSelectedItemId(savedInstanceState.getLong(KEY_SELECTED_POSITION, -1L));
    }
    return rootView;
}

From source file:materialtest.vivz.slidenerd.fragments.EnregistrementEtat.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    FragmentActivity EnregistrementEtat = (FragmentActivity) super.getActivity();
    // Replace LinearLayout by the type of the root element of the layout you're trying to load
    FrameLayout llLayout = (FrameLayout) inflater.inflate(R.layout.etat, container, false);
    // Of course you will want to faActivity and llLayout in the class and not this method to access them in the rest of
    // the class, just initialize them here

    // Content of previous onCreate() here
    // ...//w  ww .  ja  va2 s  .  c  o m
    lay1 = (FrameLayout) llLayout.findViewById(R.id.lay1);
    // Don't use this method, it's handled by inflater.inflate() above :
    // setContentView(R.layout.activity_layout);
    declancher = (Button) llLayout.findViewById(R.id.declancher);
    declancher.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Fragment fragment = new TestPoulse();
            FragmentManager fragmentManager = getActivity().getSupportFragmentManager();
            FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
            fragmentTransaction.replace(R.id.lay1, fragment);
            fragmentTransaction.addToBackStack(null);
            fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
            fragmentTransaction.commit();
        }
    });
    annuler = (Button) llLayout.findViewById(R.id.annuler);
    annuler.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Fragment fragment = new FragmentBoxOffice();
            FragmentManager fragmentManager = getActivity().getSupportFragmentManager();
            FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
            fragmentTransaction.replace(R.id.lay1, fragment);

            fragmentTransaction.addToBackStack(null);
            fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
            fragmentTransaction.commit();
        }
    });
    return llLayout; // We must return the loaded Layout
}

From source file:free.yhc.netmbuddy.YTSearchFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    FrameLayout fl = (FrameLayout) inflater.inflate(R.layout.ytsearch_fragment, null);
    mListv = (ListView) fl.findViewById(R.id.list);
    mRootv = fl;// w  w w  . j a v  a 2s  .  co  m
    mListv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long itemId) {
            onListItemClick(view, position, itemId);
        }
    });
    setToPrimary(isPrimary());
    return fl;
}

From source file:org.openmrs.mobile.activities.dialog.CustomFragmentDialog.java

public void addProgressBar(String message) {
    FrameLayout progressBarLayout = (FrameLayout) mInflater.inflate(R.layout.dialog_progress, null);
    TextView textView = (TextView) progressBarLayout.findViewById(R.id.progressTextView);
    textView.setText(message);/*from   www . java 2  s  .  c  o m*/
    mFieldsLayout.addView(progressBarLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));
}

From source file:eu.siacs.conversations.ui.ServiceBrowserFragment.java

@Nullable
@Override/*from w  w w.  j  a  va  2s.  c o m*/
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    FrameLayout rootView = (FrameLayout) inflater.inflate(R.layout.fragment_service_browser, container, false);
    mRecyclerView = (RecyclerView) rootView.findViewById(R.id.recycler_view);
    mProgressView = (ProgressBar) rootView.findViewById(R.id.progress);
    mErrorView = (LinearLayout) rootView.findViewById(R.id.error_container);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(mRecyclerView.getContext()));
    mRecyclerView.setHasFixedSize(true);
    mRecyclerView.setAdapter(mAdapter);
    if (savedInstanceState != null) {
        mAdapter.setSelectedItemId(savedInstanceState.getLong(KEY_SELECTED_POSITION, -1L));
    }
    mButtonCancel = (AppCompatButton) rootView.findViewById(R.id.buttonCancel);
    mButtonCancel.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            ((ServiceListener) ServiceBrowserFragment.this.getActivity()).onCancel();
        }
    });
    return rootView;
}

From source file:ru.gkpromtech.exhibition.events.EventsActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // restore saved positions
    int savedPosition = 0;
    if (savedInstanceState != null) {
        savedFilter = savedInstanceState.getInt(SAVE_FILTER, EventReader.EVENT_FILTER_ALL);
        savedPosition = savedInstanceState.getInt(SAVE_PAGE_NUMBER, 0);
    } else {/* w  w  w  .ja v  a2s .c  o  m*/
        // calculate day to position ViewPager
        Calendar calendar = Calendar.getInstance();
        Date d = calendar.getTime();
        List<Date> days = new ArrayList<>(EventReader.getInstance(this).getDays());
        if (days.contains(d))
            savedPosition = days.indexOf(d);
    }

    FrameLayout view = (FrameLayout) findViewById(R.id.container);
    getLayoutInflater().inflate(R.layout.activity_events, view, true);

    TabHost tabHost = (TabHost) view.findViewById(R.id.tabHost);
    tabHost.setup();

    tabHost.addTab(tabHost
            .newTabSpec("tag" + EventReader.EVENT_FILTER_ALL).setIndicator(createIndicatorView(tabHost,
                    getResources().getString(R.string.all_uppercase), R.drawable.ic_events_all))
            .setContent(R.id.tab1));

    tabHost.addTab(tabHost
            .newTabSpec("tag" + EventReader.EVENT_FILTER_SHOW).setIndicator(createIndicatorView(tabHost,
                    getResources().getString(R.string.event_status_business), R.drawable.ic_white_plane))
            .setContent(R.id.tab2));

    tabHost.addTab(tabHost
            .newTabSpec("tag" + EventReader.EVENT_FILTER_MY).setIndicator(createIndicatorView(tabHost,
                    getResources().getString(R.string.event_status_my), R.drawable.ic_person))
            .setContent(R.id.tab3));

    pager = (ViewPager) findViewById(R.id.pager);
    pagerAdapter = new EventsFragmentPagerAdapter(getSupportFragmentManager(), EventReader.getInstance(this),
            savedFilter);
    pager.setAdapter(pagerAdapter);

    // set saved page
    pager.setCurrentItem(savedPosition);
    tabHost.setCurrentTabByTag("tag" + savedFilter);

    pager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {

        @Override
        public void onPageSelected(int position) {
        }

        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
        }

        @Override
        public void onPageScrollStateChanged(int state) {
        }
    });

    tabHost.setOnTabChangedListener(new TabHost.OnTabChangeListener() {
        @Override
        public void onTabChanged(String tabId) {
            switch (tabId) {
            case "tag" + EventReader.EVENT_FILTER_ALL:
                savedFilter = EventReader.EVENT_FILTER_ALL;
                break;
            case "tag" + EventReader.EVENT_FILTER_SHOW:
                savedFilter = EventReader.EVENT_FILTER_SHOW;
                break;
            case "tag" + EventReader.EVENT_FILTER_MY:
                savedFilter = EventReader.EVENT_FILTER_MY;
                break;
            }
            AnalyticsManager.sendEvent(EventsActivity.this, R.string.events_category, R.string.action_change,
                    savedFilter);
            pagerAdapter.setFilter(savedFilter);
        }
    });

    AnalyticsManager.sendEvent(this, R.string.events_category, R.string.action_open, savedFilter);
}