Example usage for android.graphics.drawable BitmapDrawable setTileModeXY

List of usage examples for android.graphics.drawable BitmapDrawable setTileModeXY

Introduction

In this page you can find the example usage for android.graphics.drawable BitmapDrawable setTileModeXY.

Prototype

public void setTileModeXY(Shader.TileMode xmode, Shader.TileMode ymode) 

Source Link

Document

Sets the repeat behavior of this drawable on both axis.

Usage

From source file:Main.java

public static Drawable getBitmapDrawable(Context ctx, int value) {
    Bitmap bmp = BitmapFactory.decodeResource(ctx.getResources(), value);
    BitmapDrawable bitmapDrawable = new BitmapDrawable(ctx.getResources(), bmp);
    bitmapDrawable.setTileModeXY(Shader.TileMode.REPEAT, Shader.TileMode.REPEAT);
    return bitmapDrawable;
}

From source file:Main.java

/**
 * from http://stackoverflow.com/questions/4336286/tiled-drawable-sometimes-stretches/9500334#9500334
 *//*from   w  ww .ja va 2s  .c  om*/
public static void fixBackgroundRepeat(View view) {
    Drawable bg = view.getBackground();
    if (bg != null) {
        if (bg instanceof BitmapDrawable) {
            BitmapDrawable bmp = (BitmapDrawable) bg;
            bmp.mutate(); // make sure that we aren't sharing state anymore
            bmp.setTileModeXY(Shader.TileMode.REPEAT, Shader.TileMode.REPEAT);
        }
    }
}

From source file:rowan.application.quickaccess.RowanMainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    // Actionbar loading displays.
    requestWindowFeature(Window.FEATURE_PROGRESS);
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    setTitle(R.string.app_title);/*from w  w w.j  a va  2 s . c o m*/

    super.onCreate(savedInstanceState);
    setContentView(R.layout.fragment_holder);

    FoodRatingFragment.prefetch(this, false, null);

    // think the lines below were taken from the Google IO 2012 app
    //This is a workaround for http://b.android.com/15340 from http://stackoverflow.com/a/5852198/132047
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        BitmapDrawable bg = (BitmapDrawable) getResources()
                .getDrawable(R.drawable.rowan_actionbar_background_pattern_tile);
        bg.setTileModeXY(TileMode.REPEAT, TileMode.REPEAT);
        getSupportActionBar().setBackgroundDrawable(bg);
    }

    manager = getSupportFragmentManager();
    // only load homescreenFragment if there is no saved previous instance
    if (savedInstanceState == null) {
        FragmentTransaction fragmentTransaction = manager.beginTransaction();
        HomescreenFragment fragment = new HomescreenFragment();
        fragmentTransaction.add(R.id.fragmentHolder, fragment);
        fragmentTransaction.commit();
    }
}

From source file:com.xenon.greenup.MainActivity.java

public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Set up the action bar.
    final ActionBar actionBar = getActionBar();

    // Specify that the Home/Up button should not be enabled, since there is no hierarchical parent.
    actionBar.setHomeButtonEnabled(false);

    //Set the stacked background otherwise we get the gross dark gray color under the icon
    BitmapDrawable background = (BitmapDrawable) getResources().getDrawable(R.drawable.bottom_menu);
    background.setTileModeXY(TileMode.REPEAT, TileMode.MIRROR);
    actionBar.setStackedBackgroundDrawable(background);

    // Specify that we will be displaying tabs in the action bar.
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    actionBar.setIcon(R.drawable.bottom_menu);

    _ViewPager = (ViewPager) findViewById(R.id.pager);
    mTabsAdapter = new TabsAdapter(this, _ViewPager);

    // For each of the sections in the app, add a tab to the action bar.
    for (int i = 0; i < 3; i++) {
        // Create a tab with text corresponding to the page title defined by the adapter.
        // Also specify this Activity object, which implements the TabListener interface, as the
        // listener for when this tab is selected.

        ActionBar.Tab tabToAdd = actionBar.newTab();
        if (i == 0)
            //Set the home page as active since we'll start there:
            tabToAdd.setIcon(getActiveIcon(i));
        else/*from   w w w.  j a va  2s.com*/
            tabToAdd.setIcon(getRegularIcon(i));
        mTabsAdapter.addTab(tabToAdd);

    }

    //Setting the display to custom will push the action bar to the top
    //which gives us more real estate
    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
    actionBar.show();
    Log.i("visible", "" + _ViewPager.VISIBLE);

}

From source file:kr.wdream.ui.IntroActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    setTheme(kr.wdream.storyshop.R.style.Theme_TMessages);
    super.onCreate(savedInstanceState);
    Theme.loadRecources(this);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    Log.d(LOG_TAG, "onCreate");

    // ? //from  ww w .ja v a 2 s  .c o m
    if (AndroidUtilities.isTablet()) {
        setContentView(kr.wdream.storyshop.R.layout.intro_layout_tablet);
        View imageView = findViewById(kr.wdream.storyshop.R.id.background_image_intro);
        BitmapDrawable drawable = (BitmapDrawable) getResources()
                .getDrawable(kr.wdream.storyshop.R.drawable.catstile);
        drawable.setTileModeXY(Shader.TileMode.REPEAT, Shader.TileMode.REPEAT);
        imageView.setBackgroundDrawable(drawable);
    } else {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        setContentView(kr.wdream.storyshop.R.layout.intro_layout);
    }

    if (LocaleController.isRTL) {
        icons = new int[] { kr.wdream.storyshop.R.drawable.intro7, kr.wdream.storyshop.R.drawable.intro6,
                kr.wdream.storyshop.R.drawable.intro5, kr.wdream.storyshop.R.drawable.intro4,
                kr.wdream.storyshop.R.drawable.intro3, kr.wdream.storyshop.R.drawable.intro2,
                kr.wdream.storyshop.R.drawable.intro1 };
        titles = new int[] { kr.wdream.storyshop.R.string.Page7Title, kr.wdream.storyshop.R.string.Page6Title,
                kr.wdream.storyshop.R.string.Page5Title, kr.wdream.storyshop.R.string.Page4Title,
                kr.wdream.storyshop.R.string.Page3Title, kr.wdream.storyshop.R.string.Page2Title,
                kr.wdream.storyshop.R.string.Page1Title };
        messages = new int[] { kr.wdream.storyshop.R.string.Page7Message,
                kr.wdream.storyshop.R.string.Page6Message, kr.wdream.storyshop.R.string.Page5Message,
                kr.wdream.storyshop.R.string.Page4Message, kr.wdream.storyshop.R.string.Page3Message,
                kr.wdream.storyshop.R.string.Page2Message, kr.wdream.storyshop.R.string.Page1Message };
    } else {
        icons = new int[] { kr.wdream.storyshop.R.drawable.intro1, kr.wdream.storyshop.R.drawable.intro2,
                kr.wdream.storyshop.R.drawable.intro3, kr.wdream.storyshop.R.drawable.intro4,
                kr.wdream.storyshop.R.drawable.intro5, kr.wdream.storyshop.R.drawable.intro6,
                kr.wdream.storyshop.R.drawable.intro7 };
        titles = new int[] { kr.wdream.storyshop.R.string.Page1Title, kr.wdream.storyshop.R.string.Page2Title,
                kr.wdream.storyshop.R.string.Page3Title, kr.wdream.storyshop.R.string.Page4Title,
                kr.wdream.storyshop.R.string.Page5Title, kr.wdream.storyshop.R.string.Page6Title,
                kr.wdream.storyshop.R.string.Page7Title };
        messages = new int[] { kr.wdream.storyshop.R.string.Page1Message,
                kr.wdream.storyshop.R.string.Page2Message, kr.wdream.storyshop.R.string.Page3Message,
                kr.wdream.storyshop.R.string.Page4Message, kr.wdream.storyshop.R.string.Page5Message,
                kr.wdream.storyshop.R.string.Page6Message, kr.wdream.storyshop.R.string.Page7Message };
    }

    initView();

}

From source file:com.javielinux.tweettopics2.SearchActivity.java

public void refreshTheme() {

    BitmapDrawable bmp = (BitmapDrawable) getResources().getDrawable(themeManager.getResource("search_tile"));
    if (bmp != null) {
        bmp.setTileModeXY(Shader.TileMode.REPEAT, Shader.TileMode.REPEAT);
        searchRoot.setBackgroundDrawable(bmp);
    }//from  w ww  .j a  va2s.c  om

    searchBar.setBackgroundDrawable(
            ImageUtils.createBackgroundDrawable(this, themeManager.getColor("color_top_bar"), false, 0));

    themeManager.setColors();
}

From source file:com.kopysoft.chronos.activities.ClockActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.header);/* w w  w. j ava2s .  com*/

    Chronos chronos = new Chronos(this);

    Job curJob = chronos.getAllJobs().get(0);
    jobId = curJob;
    localPunchTable = chronos.getAllPunchesForThisPayPeriodByJob(curJob);
    chronos.close();

    if (savedInstanceState != null) {
        payHolder = (PayPeriodHolder) savedInstanceState.getSerializable("payPeriod");
    } else {
        payHolder = new PayPeriodHolder(curJob);
    }

    //getSupportActionBar().setListNavigationCallbacks(list, this)
    //This is a workaround for http://b.android.com/15340 from http://stackoverflow.com/a/5852198/132047
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        BitmapDrawable bg = (BitmapDrawable) getResources().getDrawable(R.drawable.bg_striped);
        bg.setTileModeXY(Shader.TileMode.REPEAT, Shader.TileMode.REPEAT);
        getSupportActionBar().setBackgroundDrawable(bg);

        BitmapDrawable bgSplit = (BitmapDrawable) getResources().getDrawable(R.drawable.bg_striped_split_img);
        bgSplit.setTileModeXY(Shader.TileMode.REPEAT, Shader.TileMode.REPEAT);
        getSupportActionBar().setSplitBackgroundDrawable(bgSplit);
    }

    getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    ActionBar.Tab tab = getSupportActionBar().newTab();
    tab.setText("Today");
    tab.setTabListener(this);
    getSupportActionBar().addTab(tab);

    tab = getSupportActionBar().newTab();
    tab.setText("Pay Period");
    tab.setTabListener(this);
    getSupportActionBar().addTab(tab);

    if (savedInstanceState != null) {
        getSupportActionBar().setSelectedNavigationItem(savedInstanceState.getInt("position"));
    }

    Duration dur = PayPeriodAdapterList.getTime(localPunchTable.getPunchPair(DateTime.now()), true);
    Intent runIntent = new Intent().setClass(this, NotificationBroadcast.class);
    runIntent.putExtra("timeToday", dur.getMillis());
    this.sendBroadcast(runIntent);

    /*
    Intent newIntent =
        new Intent().setClass(this,
                PreferenceWizardActivity.class);
            
    this.startActivity(newIntent);
    */
}

From source file:net.bluehack.ui.IntroActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    setTheme(R.style.Theme_TMessages);/*  w ww. ja v  a2s  . c  om*/
    super.onCreate(savedInstanceState);
    Theme.loadRecources(this);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    if (AndroidUtilities.isTablet()) {
        setContentView(R.layout.intro_layout_tablet);
        View imageView = findViewById(R.id.background_image_intro);
        BitmapDrawable drawable = (BitmapDrawable) getResources().getDrawable(R.drawable.catstile);
        drawable.setTileModeXY(Shader.TileMode.REPEAT, Shader.TileMode.REPEAT);
        imageView.setBackgroundDrawable(drawable);
    } else {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        setContentView(R.layout.intro_layout);
    }

    if (LocaleController.isRTL) {
        icons = new int[] { R.drawable.intro7, R.drawable.intro6, R.drawable.intro5, R.drawable.intro4,
                R.drawable.intro3, R.drawable.intro2, R.drawable.intro1 };
        titles = new int[] { R.string.Page7Title, R.string.Page6Title, R.string.Page5Title, R.string.Page4Title,
                R.string.Page3Title, R.string.Page2Title, R.string.Page1Title };
        messages = new int[] { R.string.Page7Message, R.string.Page6Message, R.string.Page5Message,
                R.string.Page4Message, R.string.Page3Message, R.string.Page2Message, R.string.Page1Message };
    } else {
        icons = new int[] { R.drawable.intro1, R.drawable.intro2, R.drawable.intro3, R.drawable.intro4,
                R.drawable.intro5, R.drawable.intro6, R.drawable.intro7 };
        titles = new int[] { R.string.Page1Title, R.string.Page2Title, R.string.Page3Title, R.string.Page4Title,
                R.string.Page5Title, R.string.Page6Title, R.string.Page7Title };
        messages = new int[] { R.string.Page1Message, R.string.Page2Message, R.string.Page3Message,
                R.string.Page4Message, R.string.Page5Message, R.string.Page6Message, R.string.Page7Message };
    }
    viewPager = (ViewPager) findViewById(R.id.intro_view_pager);
    TextView startMessagingButton = (TextView) findViewById(R.id.start_messaging_button);
    startMessagingButton
            .setText(LocaleController.getString("StartMessaging", R.string.StartMessaging).toUpperCase());
    if (Build.VERSION.SDK_INT >= 21) {
        StateListAnimator animator = new StateListAnimator();
        animator.addState(new int[] { android.R.attr.state_pressed }, ObjectAnimator
                .ofFloat(startMessagingButton, "translationZ", AndroidUtilities.dp(2), AndroidUtilities.dp(4))
                .setDuration(200));
        animator.addState(new int[] {}, ObjectAnimator
                .ofFloat(startMessagingButton, "translationZ", AndroidUtilities.dp(4), AndroidUtilities.dp(2))
                .setDuration(200));
        startMessagingButton.setStateListAnimator(animator);
    }
    topImage1 = (ImageView) findViewById(R.id.icon_image1);
    topImage2 = (ImageView) findViewById(R.id.icon_image2);
    bottomPages = (ViewGroup) findViewById(R.id.bottom_pages);
    topImage2.setVisibility(View.GONE);
    viewPager.setAdapter(new IntroAdapter());
    viewPager.setPageMargin(0);
    viewPager.setOffscreenPageLimit(1);
    viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

        }

        @Override
        public void onPageSelected(int i) {

        }

        @Override
        public void onPageScrollStateChanged(int i) {
            if (i == ViewPager.SCROLL_STATE_IDLE || i == ViewPager.SCROLL_STATE_SETTLING) {
                if (lastPage != viewPager.getCurrentItem()) {
                    lastPage = viewPager.getCurrentItem();

                    final ImageView fadeoutImage;
                    final ImageView fadeinImage;
                    if (topImage1.getVisibility() == View.VISIBLE) {
                        fadeoutImage = topImage1;
                        fadeinImage = topImage2;

                    } else {
                        fadeoutImage = topImage2;
                        fadeinImage = topImage1;
                    }

                    fadeinImage.bringToFront();
                    fadeinImage.setImageResource(icons[lastPage]);
                    fadeinImage.clearAnimation();
                    fadeoutImage.clearAnimation();

                    Animation outAnimation = AnimationUtils.loadAnimation(IntroActivity.this,
                            R.anim.icon_anim_fade_out);
                    outAnimation.setAnimationListener(new Animation.AnimationListener() {
                        @Override
                        public void onAnimationStart(Animation animation) {
                        }

                        @Override
                        public void onAnimationEnd(Animation animation) {
                            fadeoutImage.setVisibility(View.GONE);
                        }

                        @Override
                        public void onAnimationRepeat(Animation animation) {

                        }
                    });

                    Animation inAnimation = AnimationUtils.loadAnimation(IntroActivity.this,
                            R.anim.icon_anim_fade_in);
                    inAnimation.setAnimationListener(new Animation.AnimationListener() {
                        @Override
                        public void onAnimationStart(Animation animation) {
                            fadeinImage.setVisibility(View.VISIBLE);
                        }

                        @Override
                        public void onAnimationEnd(Animation animation) {
                        }

                        @Override
                        public void onAnimationRepeat(Animation animation) {

                        }
                    });

                    fadeoutImage.startAnimation(outAnimation);
                    fadeinImage.startAnimation(inAnimation);
                }
            }
        }
    });

    startMessagingButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (startPressed) {
                return;
            }
            startPressed = true;
            Intent intent2 = new Intent(IntroActivity.this, LaunchActivity.class);
            intent2.putExtra("fromIntro", true);
            startActivity(intent2);
            finish();
        }
    });
    if (BuildVars.DEBUG_VERSION) {
        startMessagingButton.setOnLongClickListener(new View.OnLongClickListener() {
            @Override
            public boolean onLongClick(View v) {
                ConnectionsManager.getInstance().switchBackend();
                return true;
            }
        });
    }

    justCreated = true;
}

From source file:com.abcvoipsip.ui.dialpad.DialerFragment.java

private void applyTheme() {
    String theme = prefsWrapper.getPreferenceStringValue(SipConfigManager.THEME);
    if (!TextUtils.isEmpty(theme)) {
        new Theme(getActivity(), theme, new Theme.onLoadListener() {
            @Override/* ww  w.j a v a  2  s .c om*/
            public void onLoad(Theme t) {

                dialPad.applyTheme(t);
                // t.applyBackgroundDrawable(deleteButton,
                // "btn_dial_delete");
                // t.applyBackgroundDrawable(dialButton, "btn_dial_action");
                t.applyBackgroundDrawable(getView().findViewById(R.id.vmButton), "btn_dial_action_left_normal");

                // Bg ... to be done
                Drawable bg = t.getDrawableResource("dialpad_bg");
                if (bg != null) {
                    if (bg instanceof BitmapDrawable) {
                        BitmapDrawable dbg = (BitmapDrawable) bg;
                        dbg.setTileModeXY(Shader.TileMode.REPEAT, Shader.TileMode.REPEAT);
                    }
                    digitDialer.setBackgroundDrawable(bg);
                }

                Drawable dAct = t.getDrawableResource("btn_dial_textfield_activated");
                Drawable dEmpt = t.getDrawableResource("btn_dial_textfield_normal");
                if (dAct != null && dEmpt != null) {
                    digitsBackground = dAct;
                    digitsEmptyBackground = dEmpt;
                    afterTextChanged(digits.getText());
                }
            }
        });
    }
}

From source file:com.javielinux.adapters.TweetsAdapter.java

@Override
public View getView(final int position, View convertView, ViewGroup parent) {

    InfoTweet infoTweet = getItem(position);
    ViewHolder viewHolder = null;/*w  w  w .  ja v a2  s. co  m*/
    if (null == convertView) {
        convertView = activity.getLayoutInflater().inflate(R.layout.tweet_list_view_item, parent, false);
        //view = (RelativeLayout) View.inflate(getContext(), R.layout.tweet_list_view_item, null);
        viewHolder = generateViewHolder(convertView);
        convertView.setTag(viewHolder);
        loadLinks(position);
    } else {
        viewHolder = (ViewHolder) convertView.getTag();
    }

    int typeBackground = -1;

    if (selected_id == position) {
        typeBackground = 2;
        if (infoTweet.isRead())
            typeBackground++;
        if (viewHolder.typeBackground != typeBackground) {
            convertView.setBackgroundDrawable(ImageUtils.createGradientDrawableSelected(getContext(),
                    infoTweet.isRead() ? 0 : color_line));
        }
    } else if (column == TweetTopicsUtils.COLUMN_TIMELINE
            && infoTweet.getText().toLowerCase().contains("@" + usernameColumn.toLowerCase())) {
        typeBackground = 4;
        if (infoTweet.isRead())
            typeBackground++;
        if (viewHolder.typeBackground != typeBackground) {
            convertView.setBackgroundDrawable(ImageUtils.createGradientDrawableMention(getContext(),
                    infoTweet.isRead() ? 0 : color_line));
        }
    } else if ((column == TweetTopicsUtils.COLUMN_MENTIONS || column == TweetTopicsUtils.COLUMN_TIMELINE)
            && infoTweet.isFavorited()) {
        typeBackground = 6;
        if (infoTweet.isRead())
            typeBackground++;
        if (viewHolder.typeBackground != typeBackground) {
            convertView.setBackgroundDrawable(ImageUtils.createGradientDrawableFavorite(getContext(),
                    infoTweet.isRead() ? 0 : color_line));
        }
    } else {

        if (hashColorUsers.containsKey(infoTweet.getUsername())) {
            typeBackground = 8 + (hashColorUsersPosition.get(infoTweet.getUsername()) * 2);
            if (infoTweet.isRead())
                typeBackground++;
            if (viewHolder.typeBackground != typeBackground) {
                convertView.setBackgroundDrawable(ImageUtils.createStateListDrawable(getContext(),
                        hashColorUsers.get(infoTweet.getUsername()), infoTweet.isRead() ? 0 : color_line));
            }
        } else {
            typeBackground = 0;
            if (infoTweet.isRead())
                typeBackground++;
            if (viewHolder.typeBackground != typeBackground) {
                convertView.setBackgroundDrawable(ImageUtils.createStateListDrawable(getContext(),
                        hashThemeColors.get("list_background_row_color"), infoTweet.isRead() ? 0 : color_line));
            }
        }
    }

    viewHolder.typeBackground = typeBackground;

    AQuery aQuery = listAQuery.recycle(convertView);

    // ponerla barra naranja
    if (infoTweet.isMoreTweetDown()) {
        viewHolder.loadMoreBreakListItem.setBackgroundDrawable(ImageUtils.createStateListDrawable(getContext(),
                themeManager.getColor("color_load_more_break")));
        viewHolder.loadMoreBreakListItem.showText();
        try {
            final InfoTweet next = getItem(position + 1);
            if (next != null) {
                viewHolder.loadMoreBreakListItem.showText(Utils.diffDate(infoTweet.getDate(), next.getDate()));
                viewHolder.loadMoreBreakListItem.setTag(infoTweet);
                viewHolder.loadMoreBreakListItem.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        loadMoreBreakTweets((InfoTweet) view.getTag(), next, position);
                    }
                });
            }
        } catch (RuntimeException e) {
        } catch (Exception e) {
        }
        viewHolder.loadMoreBreakListItem.setVisibility(View.VISIBLE);
    } else {
        viewHolder.loadMoreBreakListItem.setVisibility(View.GONE);
    }

    String html = "";

    if (infoTweet.getTextHTMLFinal().equals("")) {
        String[] in = Utils.toHTMLTyped(activity, infoTweet.getText(), infoTweet.getTextURLs());
        html = in[1];
        infoTweet.setTextFinal(in[0]);
        infoTweet.setTextHTMLFinal(in[1]);
    } else {
        html = infoTweet.getTextHTMLFinal();
    }

    viewHolder.statusText.setTextColor(hashThemeColors.get("color_tweet_text"));
    viewHolder.sourceText.setTextColor(hashThemeColors.get("color_tweet_source"));
    viewHolder.retweetUser.setTextColor(hashThemeColors.get("color_tweet_retweet"));
    viewHolder.screenName.setTextColor(hashThemeColors.get("color_tweet_usename"));
    viewHolder.dateText.setTextColor(hashThemeColors.get("color_tweet_date"));

    if (infoTweet.isLastRead()) {
        BitmapDrawable bmp = (BitmapDrawable) getContext().getResources()
                .getDrawable(R.drawable.readafter_tile);
        bmp.setTileModeXY(Shader.TileMode.REPEAT, Shader.TileMode.REPEAT);
        viewHolder.lastReadLayout.setBackgroundDrawable(bmp);
    } else {
        viewHolder.lastReadLayout.setBackgroundColor(Color.TRANSPARENT);
    }

    // TODO mostrar el numero de retweets
    /*
      if (TweetTopicsCore.isTypeList(TweetTopicsCore.TYPE_LIST_RETWEETS)) {
      if (infoTweet.getRetweetCount()>0) {
          viewHolder.tagAvatar.setImageBitmap(Utils.getBitmapNumber(cnt, (int)infoTweet.getRetweetCount(), Color.RED, Utils.TYPE_BUBBLE, 12));
      } else {
          viewHolder.tagAvatar.setImageBitmap(null);
      }
      }
       */
    if (infoTweet.hasGeoLocation()) {
        viewHolder.tagMap.setVisibility(View.VISIBLE);
    } else {
        viewHolder.tagMap.setVisibility(View.GONE);
    }

    if (infoTweet.hasConversation()) {
        viewHolder.tagConversation.setVisibility(View.VISIBLE);
    } else {
        viewHolder.tagConversation.setVisibility(View.GONE);
    }

    aQuery.id(viewHolder.statusText).text(Html.fromHtml(html));
    viewHolder.statusText.setTextSize(PreferenceUtils.getSizeText(getContext()));

    int typeInfo = Integer.parseInt(preference.getString("prf_username_right", "2"));
    String data = "";
    if (typeInfo == 2) {
        if (infoTweet.isRetweet()) {
            data = Html.fromHtml(infoTweet.getSourceRetweet()).toString();
        } else {
            data = Html.fromHtml(infoTweet.getSource()).toString();
        }
    } else if (typeInfo == 3) {
        data = infoTweet.getFullname();
    }
    aQuery.id(viewHolder.sourceText).text(data);
    viewHolder.sourceText.setTextSize(PreferenceUtils.getSizeTitles(getContext()) - 1);

    if (infoTweet.isRetweet()) {
        viewHolder.retweetLayout.setVisibility(View.VISIBLE);
        aQuery.id(viewHolder.screenName).text(infoTweet.getUsernameRetweet());
        aQuery.id(viewHolder.retweetUser).text(infoTweet.getUsername());
        aQuery.id(viewHolder.retweetText).text(R.string.retweet_by);
        viewHolder.retweetAvatar.setVisibility(View.VISIBLE);
    } else {
        aQuery.id(viewHolder.screenName).text(infoTweet.getUsername());
        viewHolder.retweetLayout.setVisibility(View.GONE);
    }

    // si es un DM usamos el layout de retweet para poner el nombre al que le escribimos
    if (infoTweet.isDm()) {
        if (!infoTweet.getToUsername().equals("") && !infoTweet.getToUsername().equals(usernameColumn)) {
            viewHolder.retweetLayout.setVisibility(View.VISIBLE);
            aQuery.id(viewHolder.retweetUser).text(infoTweet.getUsername());
            aQuery.id(viewHolder.retweetText).text(R.string.sent_to);
            viewHolder.retweetAvatar.setVisibility(View.GONE);
        }
    }

    viewHolder.screenName.setTextSize(PreferenceUtils.getSizeTitles(getContext()));

    aQuery.id(viewHolder.dateText).text(infoTweet.getTime(getContext()));
    viewHolder.dateText.setTextSize(PreferenceUtils.getSizeTitles(getContext()) - 4);

    String mUrlAvatar = infoTweet.getUrlAvatar();
    String mRetweetUrlAvatar = infoTweet.getUrlAvatarRetweet();

    boolean isRetweet = infoTweet.isRetweet();

    if (isRetweet) {

        Bitmap retweetAvatar = aQuery.getCachedImage(mUrlAvatar);
        if (retweetAvatar != null) {
            aQuery.id(viewHolder.retweetAvatar).image(retweetAvatar);
        } else {
            aQuery.id(viewHolder.retweetAvatar).image(mUrlAvatar, true, true, 0, R.drawable.avatar_small);
        }

        Bitmap avatar = aQuery.getCachedImage(mRetweetUrlAvatar);
        if (avatar != null) {
            aQuery.id(viewHolder.avatarView).image(avatar);
        } else {
            aQuery.id(viewHolder.avatarView).image(mRetweetUrlAvatar, true, true, 0, R.drawable.avatar,
                    aQuery.getCachedImage(R.drawable.avatar), 0);
        }

        viewHolder.avatarView.setTag(infoTweet.getUsernameRetweet());

    } else {

        Bitmap avatar = aQuery.getCachedImage(mUrlAvatar);
        if (avatar != null) {
            aQuery.id(viewHolder.avatarView).image(avatar);
        } else {
            aQuery.id(viewHolder.avatarView).image(mUrlAvatar, true, true, 0, R.drawable.avatar,
                    aQuery.getCachedImage(R.drawable.avatar), 0);
        }

        viewHolder.avatarView.setTag(infoTweet.getUsername());
    }

    viewHolder.avatarView.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (getActivity() instanceof BaseLayersActivity) {
                Bundle bundle = new Bundle();
                bundle.putString(UserActivity.KEY_EXTRAS_USER, v.getTag().toString());
                ((BaseLayersActivity) getActivity()).startAnimationActivity(UserActivity.class, bundle);
            }
        }

    });

    viewHolder.statusText.setTag(infoTweet);
    // buscar imagenes de los tweets

    //ArrayList<String> links = LinksUtils.pullLinks(infoTweet.getText(), infoTweet.getContentURLs());

    String linkForImage = infoTweet.getBestLink();

    if (linkForImage.equals("")) {
        viewHolder.tweetPhotoImgContainer.setVisibility(View.GONE);
    } else {
        viewHolder.tweetPhotoImgContainer.setTag(infoTweet);
        viewHolder.tweetPhotoImgContainer.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                callLinksIfIsPossible(view);
            }
        });

        viewHolder.tweetPhotoImgContainer.setVisibility(View.VISIBLE);

        if (infoTweet.getLinksCount() > 1) {
            viewHolder.tweetPhotoImgContainer.setBackgroundResource(R.drawable.container_image_multiple);
        } else {
            viewHolder.tweetPhotoImgContainer.setBackgroundResource(R.drawable.container_image_simple);
        }

        InfoLink infoLink = null;

        if (CacheData.getInstance().existCacheInfoLink(linkForImage)) {
            infoLink = CacheData.getInstance().getCacheInfoLink(linkForImage);
        }

        int typeResource = getTypeResource(linkForImage);

        if (infoLink != null) {

            String thumb = infoLink.getLinkImageThumb();

            if (thumb.equals("")) {
                aQuery.id(viewHolder.tweetPhotoImg).image(typeResource);
            } else {
                Bitmap image = aQuery.getCachedImage(infoLink.getLinkImageThumb());
                if (image != null) {
                    aQuery.id(viewHolder.tweetPhotoImg).image(image);
                } else {
                    aQuery.id(viewHolder.tweetPhotoImg).image(infoLink.getLinkImageThumb(), true, true, 0,
                            typeResource, aQuery.getCachedImage(typeResource), 0);
                }
            }

        } else { // si no tenemos InfoLink en cache

            aQuery.id(viewHolder.tweetPhotoImg).image(typeResource);
        }
    }

    return convertView;

}