Example usage for android.widget LinearLayout VERTICAL

List of usage examples for android.widget LinearLayout VERTICAL

Introduction

In this page you can find the example usage for android.widget LinearLayout VERTICAL.

Prototype

int VERTICAL

To view the source code for android.widget LinearLayout VERTICAL.

Click Source Link

Usage

From source file:com.example.diplimadoapp.SuperAwesomeCardFragment.java

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

    LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);

    FrameLayout fl = new FrameLayout(getActivity());
    fl.setLayoutParams(params);//from  ww  w.java  2 s.c  o m

    final int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8,
            getResources().getDisplayMetrics());

    switch (position) {
    case 0:

        LinearLayout ll = new LinearLayout(getActivity());
        ll.setLayoutParams(new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
        ll.setOrientation(LinearLayout.VERTICAL);

        ImageView iv = new ImageView(getActivity());
        iv.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, 1020));
        //iv.setLayoutParams(new  LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT));
        iv.setMaxHeight(520);
        iv.setImageResource(R.drawable.contact);
        ll.addView(iv);

        TableLayout tl = new TableLayout(getActivity());
        tl.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));

        TableRow tr = new TableRow(getActivity());
        tr.setLayoutParams(new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
        tr.setGravity(Gravity.FILL_HORIZONTAL);
        tr.setPadding(5, 5, 5, 5);

        List<RssItem> lecturaitems = null;
        try {
            // Create RSS reader
            RssReader rssReader = new RssReader(
                    "http://www.senalradionica.gov.co/index.php/home/articulos/itemlist?format=feed");
            // Get a ListView from main view
            //ListView itcItems = (ListView) findViewById(R.id.listMainView);

            lecturaitems = rssReader.getItems();

        } catch (Exception e) {
            Log.e("Diplomado App Reader", e.getMessage());
        }

        TextView v1 = new TextView(getActivity());
        params.setMargins(margin, margin, margin, margin);
        v1.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 2));
        v1.setGravity(Gravity.CENTER);
        v1.setBackgroundResource(R.drawable.background_card);
        if (lecturaitems != null) {
            v1.setText(lecturaitems.get(0).getTitle());
            String urlnoticia = lecturaitems.get(0).getLink();
            v1.setOnClickListener(new NoticiaDestacadaOnClickListener(urlnoticia));
        } else {
            v1.setText("No Registra nuevas noticias");
        }

        tr.addView(v1);

        ImageButton ib = new ImageButton(getActivity());
        ib.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 1));
        ib.setImageResource(R.drawable.facebook);

        ib.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                Intent myWebLink = new Intent(android.content.Intent.ACTION_VIEW);
                myWebLink.setData(Uri.parse("http://www.facebook.com"));
                startActivity(myWebLink);
            }
        });

        tr.addView(ib);

        ImageButton ib2 = new ImageButton(getActivity());
        ib2.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 1));
        ib2.setImageResource(R.drawable.twitter);

        ib2.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                Intent myWebLink = new Intent(android.content.Intent.ACTION_VIEW);
                myWebLink.setData(Uri.parse("http://www.twitter.com"));
                startActivity(myWebLink);
            }
        });

        tr.addView(ib2);

        ImageButton ib3 = new ImageButton(getActivity());
        ib3.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 1));
        ib3.setImageResource(R.drawable.youtube);

        ib3.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                Intent myWebLink = new Intent(android.content.Intent.ACTION_VIEW);
                myWebLink.setData(Uri.parse("http://www.youtube.com"));
                startActivity(myWebLink);
            }
        });

        tr.addView(ib3);

        tl.addView(tr);

        ll.addView(tl);

        fl.addView(ll);

        break;

    case 1:

        LinearLayout ll2 = new LinearLayout(getActivity());
        ll2.setLayoutParams(new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
        ll2.setOrientation(LinearLayout.VERTICAL);

        TableLayout tl2 = new TableLayout(getActivity());
        tl2.setLayoutParams(
                new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));

        TableRow tr2 = new TableRow(getActivity());
        tr2.setLayoutParams(new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
        tr2.setGravity(Gravity.FILL_HORIZONTAL);
        tr2.setPadding(5, 5, 5, 5);

        TextView v0 = new TextView(getActivity());
        params.setMargins(margin, margin, margin, margin);
        v0.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 2));
        v0.setGravity(Gravity.CENTER);
        v0.setText("Acusticos Radionoca. Lunes a Viernes 8:00 a.m. - 9:00 a.m.");
        tr2.addView(v0);

        ImageButton ib20 = new ImageButton(getActivity());
        ib20.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 1));
        ib20.setImageResource(R.drawable.pacusticos);
        ib20.setBackgroundDrawable(null);

        tr2.addView(ib20);

        tl2.addView(tr2);

        TableRow tr3 = new TableRow(getActivity());
        tr3.setLayoutParams(new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
        tr3.setGravity(Gravity.FILL_HORIZONTAL);
        tr3.setPadding(5, 5, 5, 5);

        TextView v03 = new TextView(getActivity());
        params.setMargins(margin, margin, margin, margin);
        v03.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 2));
        v03.setGravity(Gravity.CENTER);
        v03.setText("Acusticos Radionoca. Lunes a Viernes 8:00 a.m. - 9:00 a.m.");
        tr3.addView(v03);

        ImageButton ib30 = new ImageButton(getActivity());
        ib30.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 1));
        ib30.setImageResource(R.drawable.pradionica_lacarta);
        ib30.setBackgroundDrawable(null);

        tr3.addView(ib30);

        tl2.addView(tr3);

        TableRow tr4 = new TableRow(getActivity());
        tr4.setLayoutParams(new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
        tr4.setGravity(Gravity.FILL_HORIZONTAL);
        tr4.setPadding(5, 5, 5, 5);

        TextView v04 = new TextView(getActivity());
        params.setMargins(margin, margin, margin, margin);
        v04.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 2));
        v04.setGravity(Gravity.CENTER);
        v04.setText("Acusticos Radionoca. Lunes a Viernes 8:00 a.m. - 9:00 a.m.");
        tr4.addView(v04);

        tl2.addView(tr4);

        ImageButton ib40 = new ImageButton(getActivity());
        ib40.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 1));
        ib40.setImageResource(R.drawable.prockeros);
        ib40.setBackgroundDrawable(null);

        tr4.addView(ib40);

        ll2.addView(tl2);

        /*
        VideoView videoView = new VideoView(getActivity());
                
        Uri path = Uri.parse("rtmp://cdns840stu0010.multistream.net:80/rtvcRadionicalive/?pass=|radionica|");
                
        videoView.setVideoURI(path);
        videoView.start(); 
                
        TableRow tr5 =new TableRow(getActivity());
        tr5.setLayoutParams(new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
        tr5.setGravity(Gravity.FILL_HORIZONTAL);
        tr5.setPadding(5,5,5,5);
        tr5.addView(videoView);
                
        ll2.addView(tr5);*/

        fl.addView(ll2);
        break;
    case 2:
        ListView lv = new ListView(getActivity());
        params.setMargins(margin, margin, margin, margin);
        lv.setLayoutParams(params);
        lv.setLayoutParams(params);
        lv.setBackgroundResource(R.drawable.background_card);
        try {
            // Create RSS reader
            RssReader rssReader = new RssReader(
                    "http://www.senalradionica.gov.co/index.php/home/articulos/itemlist?format=feed");
            // Get a ListView from main view
            //ListView itcItems = (ListView) findViewById(R.id.listMainView);

            List<RssItem> lecturaitems2 = rssReader.getItems();
            // Create a list adapter
            ArrayAdapter<RssItem> adapter = new ArrayAdapter<RssItem>(getActivity(),
                    android.R.layout.simple_list_item_1, lecturaitems2);
            // Set list adapter for the ListView
            lv.setAdapter(adapter);

            // Set list view item click listener
            lv.setOnItemClickListener(new ListListener(lecturaitems2, getActivity()));

        } catch (Exception e) {
            Log.e("Diplomado App Reader", e.getMessage());
        }
        fl.addView(lv);
        break;
    }

    return fl;
}

From source file:com.pikachu.emoji.widget.EmojiView.java

/**
 * init. Set params and add show emoji views</br>
 *//*from  ww  w  . j a  va 2  s.  com*/
@SuppressWarnings("deprecation")
private void init() {
    computeBoardHeight();
    setOrientation(LinearLayout.VERTICAL);

    setBackgroundColor(Color.parseColor("#f4f4f6"));
    ViewPager viewPager = createVIewpager();
    addView(viewPager);
    ViewGroup container = createPointLinearlayout();
    List<EmojiPage> datas = new ArrayList<EmojiPage>();
    int lens = EmojiSource.DATA.length;
    int pages = lens / PAGE_SIZE; // pages?
    for (int i = 0; i < pages; i++) {
        EmojiBean[] blocks = new EmojiBean[PAGE_SIZE + 1];
        System.arraycopy(EmojiSource.DATA, i * PAGE_SIZE, blocks, 0, blocks.length - 1);
        blocks[PAGE_SIZE] = EmojiBean.fromChars(DELETE_KEY);
        datas.add(new EmojiPage(getContext(), blocks)); // the last is
                                                        // delete icon
    }
    // add remain emoji view
    if (pages * PAGE_SIZE < lens) {
        EmojiBean[] blocks = new EmojiBean[lens - pages * PAGE_SIZE];
        System.arraycopy(EmojiSource.DATA, pages * PAGE_SIZE, blocks, 0, blocks.length);
        datas.add(new EmojiPage(getContext(), blocks));
    }

    // add indicator
    for (int i = 0; i < datas.size(); i++) {
        ImageView indicatorView = createIndicator();
        mIndicators.add(indicatorView);
        container.addView(indicatorView);
    }
    addView(container);

    // set cache view count
    viewPager.setOffscreenPageLimit(datas.size());
    // 
    mIndicators.get(mLastSelectViewPos).setImageDrawable(ResFinder.getDrawable(mSelectIcon));
    mAdapter = new EmojiPagerAdapter(getContext(), datas);
    viewPager.setAdapter(mAdapter);
    viewPager.setOnPageChangeListener(this);
}

From source file:com.yahala.ui.Views.StickersView.java

private void init() {
    setOrientation(LinearLayout.VERTICAL);
    loadRecents();/*  w  ww  .  j  a  v a  2 s. co  m*/
    setBackgroundDrawable(new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, new int[] {
            Color.parseColor("#FF373737"), Color.parseColor("#FF575757"), Color.parseColor("#FF666666") }));

    emojiPagerAdapter = new EmojiPagerAdapter(getContext(), EmojiManager.getInstance().stickersCategories);
    pager = new ViewPager(getContext());
    pager.setAdapter(emojiPagerAdapter);
    FileLog.e("EmojiManager.stickersCategories", "" + EmojiManager.getInstance().stickersCategories.size());
    PagerSlidingTabStripEmoji tabs = new PagerSlidingTabStripEmoji(getContext());
    tabs.setViewPager(pager);
    tabs.setShouldExpand(false);
    tabs.setMinimumWidth(OSUtilities.dp(50));
    tabs.setTabPaddingLeftRight(OSUtilities.dp(10));
    tabs.setIndicatorHeight(3);
    //tabs.setTabBackground(Color.parseColor("#FF3f9fe0"));
    tabs.setTabBackground(R.drawable.bar_selector_main);

    tabs.setIndicatorColor(Color.parseColor("#FFffffff"));
    tabs.setDividerColor(Color.parseColor("#ff222222"));
    tabs.setUnderlineHeight(2);
    tabs.setUnderlineColor(Color.parseColor("#ff373737"));

    //tabs.setTabBackground(0);
    LinearLayout localLinearLayout = new LinearLayout(getContext());
    localLinearLayout.setOrientation(LinearLayout.HORIZONTAL);
    localLinearLayout.addView(tabs,
            new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, 1.0f));
    ImageView localImageView = new ImageView(getContext());
    localImageView.setImageResource(R.drawable.ic_emoji_backspace);
    localImageView.setScaleType(ImageView.ScaleType.CENTER);
    localImageView.setBackgroundResource(R.drawable.bg_emoji_bs);
    localImageView.setOnClickListener(new OnClickListener() {
        public void onClick(View view) {
            if (StickersView.this.listener != null) {
                StickersView.this.listener.onBackspace();
            }
        }
    });
    localLinearLayout.addView(localImageView,
            new LayoutParams(OSUtilities.dpf(61.0f), LayoutParams.MATCH_PARENT));
    /* recentsWrap = new FrameLayout(getContext());
     recentsWrap.addView(views.get(0));
     TextView localTextView = new TextView(getContext());
     localTextView.setText(LocaleController.getString("NoRecent", R.string.NoRecent));
     localTextView.setTextSize(18.0f);
     localTextView.setTextColor(-7829368);
     localTextView.setGravity(17);
     recentsWrap.addView(localTextView);
     views.get(0).setEmptyView(localTextView);*/
    addView(localLinearLayout, new LayoutParams(-1, OSUtilities.dpf(48.0f)));

    addView(pager);

    if (!EmojiManager.getInstance().stickersCategoriesDict.containsKey("recents")
            || EmojiManager.getInstance().stickersCategoriesDict.get("recents").stickers.size() == 0) {
        pager.setCurrentItem(1);
    }
}

From source file:com.umeng.comm.ui.emoji.EmojiBorad.java

/**
 * init. Set params and add show emoji views</br>
 *//*from  w w w  .  java2s  .  c o m*/
private void init() {
    computeBoardHeight();
    setOrientation(LinearLayout.VERTICAL);

    setBackgroundColor(Color.parseColor("#f4f4f6"));
    ViewPager viewPager = createVIewpager();
    addView(viewPager);
    ViewGroup container = createPointLinearlayout();
    List<EmojiView> datas = new ArrayList<EmojiView>();

    int lens = People.DATA.length;
    int pages = lens / PAGE_SIZE; // pages?
    for (int i = 0; i < pages; i++) {
        EmojiBean[] blocks = new EmojiBean[PAGE_SIZE + 1];
        System.arraycopy(People.DATA, i * PAGE_SIZE, blocks, 0, blocks.length - 1);
        blocks[PAGE_SIZE] = EmojiBean.fromChars(DELETE_KEY);
        datas.add(new EmojiView(getContext(), blocks)); // the last is
                                                        // delete icon
    }
    // add remain emoji view
    if (pages * PAGE_SIZE < lens) {
        EmojiBean[] blocks = new EmojiBean[lens - pages * PAGE_SIZE];
        System.arraycopy(People.DATA, pages * PAGE_SIZE, blocks, 0, blocks.length);
        datas.add(new EmojiView(getContext(), blocks));
    }

    // add indicator
    for (int i = 0; i < datas.size(); i++) {
        ImageView indicatorView = createIndicator();
        mIndicators.add(indicatorView);
        container.addView(indicatorView);
    }
    addView(container);
    size = datas.size();
    // set cache view count
    viewPager.setOffscreenPageLimit(datas.size());
    // 
    mIndicators.get(mLastSelectViewPos).setImageDrawable(ResFinder.getDrawable(mSelectIcon));
    mAdapter = new EmojiPagerAdapter(getContext(), datas);
    viewPager.setAdapter(mAdapter);
    viewPager.setOnPageChangeListener(this);
}

From source file:hoahong.facebook.messenger.ui.EmojiView.java

private void init() {
    setOrientation(LinearLayout.VERTICAL);
    for (int i = 0; i < Emoji.data.length; i++) {
        GridView gridView = new GridView(getContext());
        if (Utils.isTablet()) {
            gridView.setColumnWidth(Utils.dp(60));
        } else {/*from  ww  w  . j  av a2  s .c om*/
            gridView.setColumnWidth(Utils.dp(45));
        }
        gridView.setNumColumns(-1);
        views.add(gridView);

        EmojiGridAdapter localEmojiGridAdapter = new EmojiGridAdapter(Emoji.data[i]);
        gridView.setAdapter(localEmojiGridAdapter);
        adapters.add(localEmojiGridAdapter);
    }

    setBackgroundDrawable(
            new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, new int[] { -14145496, -16777216 }));
    pager = new ViewPager(getContext());
    pager.setAdapter(new EmojiPagesAdapter());
    PagerSlidingTabStrip tabs = new PagerSlidingTabStrip(getContext());
    tabs.setViewPager(pager);
    tabs.setShouldExpand(true);
    tabs.setIndicatorColor(0xff33b5e5);
    tabs.setIndicatorHeight(Utils.dpf(2.0f));
    tabs.setUnderlineHeight(Utils.dpf(2.0f));
    tabs.setUnderlineColor(0x66000000);
    tabs.setTabBackground(0);
    LinearLayout localLinearLayout = new LinearLayout(getContext());
    localLinearLayout.setOrientation(LinearLayout.HORIZONTAL);
    localLinearLayout.addView(tabs,
            new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, 1.0f));
    ImageView localImageView = new ImageView(getContext());
    localImageView.setImageResource(R.drawable.ic_emoji_backspace);
    localImageView.setScaleType(ImageView.ScaleType.CENTER);
    localImageView.setBackgroundResource(R.drawable.bg_emoji_bs);
    localImageView.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            if (EmojiView.this.listener != null) {
                EmojiView.this.listener.onBackspace();
            }
        }
    });
    localLinearLayout.addView(localImageView,
            new LinearLayout.LayoutParams(Utils.dp(61), LayoutParams.MATCH_PARENT));
    recentsWrap = new FrameLayout(getContext());
    recentsWrap.addView(views.get(0));
    TextView localTextView = new TextView(getContext());
    localTextView.setText("No recent");
    localTextView.setTextSize(18.0f);
    localTextView.setTextColor(-7829368);
    localTextView.setGravity(17);
    recentsWrap.addView(localTextView);
    views.get(0).setEmptyView(localTextView);
    addView(localLinearLayout, new LinearLayout.LayoutParams(-1, Utils.dpf(48.0f)));
    addView(pager);
    loadRecents();
    if (Emoji.data[0] == null || Emoji.data[0].length == 0) {
        pager.setCurrentItem(1);
    }
}

From source file:com.umeng.comm.ui.imagepicker.emoji.EmojiBorad.java

/**
 * init. Set params and setList show emoji views</br>
 *///from w w  w. j a  v  a  2s  . c o  m
private void init() {
    computeBoardHeight();
    setOrientation(LinearLayout.VERTICAL);

    setBackgroundColor(Color.parseColor("#f4f4f6"));
    ViewPager viewPager = createVIewpager();
    addView(viewPager);
    ViewGroup container = createPointLinearlayout();
    List<EmojiView> datas = new ArrayList<EmojiView>();

    int lens = People.DATA.length;
    int pages = lens / PAGE_SIZE; // pages?
    for (int i = 0; i < pages; i++) {
        EmojiBean[] blocks = new EmojiBean[PAGE_SIZE + 1];
        System.arraycopy(People.DATA, i * PAGE_SIZE, blocks, 0, blocks.length - 1);
        blocks[PAGE_SIZE] = EmojiBean.fromChars(DELETE_KEY);
        datas.add(new EmojiView(getContext(), blocks)); // the last is
                                                        // icon_delete icon
    }
    // setList remain emoji view
    if (pages * PAGE_SIZE < lens) {
        EmojiBean[] blocks = new EmojiBean[lens - pages * PAGE_SIZE];
        System.arraycopy(People.DATA, pages * PAGE_SIZE, blocks, 0, blocks.length);
        datas.add(new EmojiView(getContext(), blocks));
    }

    // setList indicator
    for (int i = 0; i < datas.size(); i++) {
        ImageView indicatorView = createIndicator();
        mIndicators.add(indicatorView);
        container.addView(indicatorView);
    }
    addView(container);
    size = datas.size();
    // set cache view count
    viewPager.setOffscreenPageLimit(datas.size());
    // 
    mIndicators.get(mLastSelectViewPos).setImageDrawable(ResFinder.getDrawable(mSelectIcon));
    mAdapter = new EmojiPagerAdapter(getContext(), datas);
    viewPager.setAdapter(mAdapter);
    viewPager.setOnPageChangeListener(this);
}

From source file:org.mareatlantica.ui.Views.EmojiView.java

private void init() {
    setOrientation(LinearLayout.VERTICAL);
    for (int i = 0; i < Emoji.data.length; i++) {
        GridView gridView = new GridView(getContext());
        gridView.setColumnWidth(AndroidUtilities.dpf(45.0f));
        gridView.setNumColumns(-1);/* w w  w . j  a v a  2s  .  co  m*/
        views.add(gridView);

        EmojiGridAdapter localEmojiGridAdapter = new EmojiGridAdapter(Emoji.data[i]);
        gridView.setAdapter(localEmojiGridAdapter);
        adapters.add(localEmojiGridAdapter);
    }

    setBackgroundDrawable(
            new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, new int[] { -14145496, -16777216 }));
    pager = new ViewPager(getContext());
    pager.setAdapter(new EmojiPagesAdapter());
    PagerSlidingTabStrip tabs = new PagerSlidingTabStrip(getContext());
    tabs.setViewPager(pager);
    tabs.setShouldExpand(true);
    tabs.setIndicatorColor(0xff33b5e5);
    tabs.setIndicatorHeight(AndroidUtilities.dpf(2.0f));
    tabs.setUnderlineHeight(AndroidUtilities.dpf(2.0f));
    tabs.setUnderlineColor(1711276032);
    tabs.setTabBackground(0);
    LinearLayout localLinearLayout = new LinearLayout(getContext());
    localLinearLayout.setOrientation(LinearLayout.HORIZONTAL);
    localLinearLayout.addView(tabs,
            new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, 1.0f));
    ImageView localImageView = new ImageView(getContext());
    localImageView.setImageResource(R.drawable.ic_emoji_backspace);
    localImageView.setScaleType(ImageView.ScaleType.CENTER);
    localImageView.setBackgroundResource(R.drawable.bg_emoji_bs);
    localImageView.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            if (EmojiView.this.listener != null) {
                EmojiView.this.listener.onBackspace();
            }
        }
    });
    localLinearLayout.addView(localImageView,
            new LinearLayout.LayoutParams(AndroidUtilities.dpf(61.0f), LayoutParams.MATCH_PARENT));
    recentsWrap = new FrameLayout(getContext());
    recentsWrap.addView(views.get(0));
    TextView localTextView = new TextView(getContext());
    localTextView.setText(LocaleController.getString("NoRecent", R.string.NoRecent));
    localTextView.setTextSize(18.0f);
    localTextView.setTextColor(-7829368);
    localTextView.setGravity(17);
    recentsWrap.addView(localTextView);
    views.get(0).setEmptyView(localTextView);
    addView(localLinearLayout, new LinearLayout.LayoutParams(-1, AndroidUtilities.dpf(48.0f)));
    addView(pager);
    loadRecents();
    if (Emoji.data[0] == null || Emoji.data[0].length == 0) {
        pager.setCurrentItem(1);
    }
}

From source file:com.yahala.ui.Views.EmojiViewExtra.java

private void init() {
    setOrientation(LinearLayout.VERTICAL);
    loadRecents();/*from   ww w.j a v  a  2s.c o  m*/
    setBackgroundDrawable(new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, new int[] {
            Color.parseColor("#FF373737"), Color.parseColor("#FF575757"), Color.parseColor("#FF666666") }));

    emojiPagerAdapter = new EmojiPagerAdapter(getContext(), EmojiManager.getInstance().categories);
    pager = new ViewPager(getContext());
    pager.setOffscreenPageLimit(5);
    pager.setAdapter(emojiPagerAdapter);
    FileLog.e("EmojiManager.emojiGroups", "" + EmojiManager.getInstance().categories.size());
    PagerSlidingTabStripEmoji tabs = new PagerSlidingTabStripEmoji(getContext());
    tabs.setViewPager(pager);
    tabs.setShouldExpand(false);
    tabs.setMinimumWidth(OSUtilities.dp(50));
    tabs.setTabPaddingLeftRight(OSUtilities.dp(10));
    tabs.setIndicatorHeight(3);
    //tabs.setTabBackground(Color.parseColor("#FF3f9fe0"));
    tabs.setTabBackground(R.drawable.bar_selector_main);

    tabs.setIndicatorColor(Color.parseColor("#FFffffff"));
    tabs.setDividerColor(Color.parseColor("#ff222222"));
    tabs.setUnderlineHeight(2);
    tabs.setUnderlineColor(Color.parseColor("#ff373737"));

    //tabs.setTabBackground(0);
    LinearLayout localLinearLayout = new LinearLayout(getContext());
    localLinearLayout.setOrientation(LinearLayout.HORIZONTAL);
    localLinearLayout.addView(tabs,
            new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, 1.0f));
    ImageView localImageView = new ImageView(getContext());
    localImageView.setImageResource(R.drawable.ic_emoji_backspace);
    localImageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
    localImageView.setBackgroundResource(R.drawable.bg_emoji_bs);
    localImageView.setOnClickListener(new OnClickListener() {
        public void onClick(View view) {
            if (EmojiViewExtra.this.listener != null) {
                EmojiViewExtra.this.listener.onBackspace();
            }
        }
    });
    localLinearLayout.addView(localImageView,
            new LayoutParams(OSUtilities.dpf(61.0f), LayoutParams.MATCH_PARENT));
    /* recentsWrap = new FrameLayout(getContext());
     recentsWrap.addView(views.get(0));
     TextView localTextView = new TextView(getContext());
     localTextView.setText(LocaleController.getString("NoRecent", R.string.NoRecent));
     localTextView.setTextSize(18.0f);
     localTextView.setTextColor(-7829368);
     localTextView.setGravity(17);
     recentsWrap.addView(localTextView);
     views.get(0).setEmptyView(localTextView);*/
    addView(localLinearLayout, new LayoutParams(-1, OSUtilities.dpf(48.0f)));

    addView(pager);

    if (!EmojiManager.getInstance().categoriesDict.containsKey("recents")
            || EmojiManager.getInstance().categoriesDict.get("recents").emojis.size() == 0) {
        pager.setCurrentItem(1);
    }
}

From source file:org.forgerock.openam.mobile.example.authentication.activities.authenticate.AuthenticateActivity.java

/**
 * Interrogates the previous Intent. If we were passed here with an authentication callback
 * to display to the screen, draw it here.
 *
 * @param savedInstanceState/*  ww  w. j  av a2s  . co  m*/
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    final Intent previous = getIntent();
    final String authCallbackString = previous.getStringExtra(AppConstants.AUTH_CALLBACK);

    Authenticate auth = null;
    boolean errored = false;
    try {
        auth = AuthenticateFactory.createFromString(authCallbackString);
    } catch (JSONException e) {
        Log.e(TAG, "Unable to generate JSON representation of authentication stage.", e);
        errored = true;
    }

    if (errored || auth == null || auth.getCallbacks() == null) {
        finish(); //if we error here, we cannot continue with the activity
    }

    final LinearLayout newLayout = new LinearLayout(this);
    newLayout.setOrientation(LinearLayout.VERTICAL);
    newLayout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));

    //for each callback returned to us, create a drawable callback from it, auth not null here
    final DrawableCallback[] dcs = new DrawableCallback[auth.getCallbacks().length];

    //todo: clean this up, take it away from here.
    for (int i = 0; i < auth.getCallbacks().length; i++) {
        Callback cb = auth.getCallbacks()[i];

        if (cb.getType().equals(PasswordCallback.TYPE)) {
            dcs[i] = new PasswordCallback(cb.getOutput()[0].getValue(), cb.getInput()[0].getName(), this);
        } else if (cb.getType().equals(NameCallback.TYPE)) {
            dcs[i] = new NameCallback(cb.getOutput()[0].getValue(), cb.getInput()[0].getName(), this);
        }
    }

    //put our new drawables on to the screen
    for (DrawableCallback dc : dcs) {
        newLayout.addView(dc.getDisplayElement());
    }

    //add a submit button for the user to press
    Button submitButton = createSubmitButton(dcs, authCallbackString);
    newLayout.addView(submitButton);

    setContentView(newLayout);
}

From source file:com.renren.api.connect.android.view.RenrenDialog.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    progress = new ProgressDialog(getContext());
    progress.requestWindowFeature(Window.FEATURE_NO_TITLE);
    progress.setMessage("Loading...");

    content = new LinearLayout(getContext());
    content.setOrientation(LinearLayout.VERTICAL);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    if (this.showTitle) {
        setUpTitle();/*from ww w  . j a  v  a2  s.c  om*/
    }
    setUpWebView();

    Display display = getWindow().getWindowManager().getDefaultDisplay();
    float scale = getContext().getResources().getDisplayMetrics().density;
    float[] dimensions = display.getWidth() < display.getHeight() ? DIMENSIONS_PORTRAIT : DIMENSIONS_LANDSCAPE;
    addContentView(content, new FrameLayout.LayoutParams((int) (dimensions[0] * scale + 0.5f),
            (int) (dimensions[1] * scale + 0.5f)));
}