Example usage for android.widget LinearLayout findViewWithTag

List of usage examples for android.widget LinearLayout findViewWithTag

Introduction

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

Prototype

public final <T extends View> T findViewWithTag(Object tag) 

Source Link

Document

Look for a child view with the given tag.

Usage

From source file:com.mk4droid.IMC_Activities.FActivity_TabHost.java

private LinearLayout InActivateColorize(LinearLayout ll, String text, Drawable dr) {

    // text/*from  w ww.j  a v  a  2s .  c  o m*/
    TextView v = (TextView) ll.findViewWithTag("tv");

    v.setText(text);
    v.setTextSize(10);
    v.setTextColor(Color.GRAY);
    v.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL);

    dr.setColorFilter(0xFF888888, android.graphics.PorterDuff.Mode.SRC_ATOP);
    v.setCompoundDrawablesWithIntrinsicBounds(null, dr, null, null);
    v.setPadding(0, 5, 0, 2);

    v.setBackgroundDrawable(resources.getDrawable(R.drawable.gradient_tabs));

    // hbar
    View hbar = ll.findViewWithTag("hbar");
    hbar.setBackgroundDrawable(null);
    hbar.setBackgroundColor(resources.getColor(R.color.graylight));
    return ll;
}

From source file:com.mk4droid.IMC_Activities.FActivity_TabHost.java

private LinearLayout ActivateColorize(LinearLayout ll, String text, Drawable dr) {

    // text//  w  ww  .j  a v  a  2  s.com
    TextView v = (TextView) ll.findViewWithTag("tv");
    v.setText(text);
    v.setTextSize(10);
    v.setTextColor(Color.BLACK); //v.setTextColor(Color.WHITE);
    v.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL);

    //dr.setColorFilter(0xFF888888, android.graphics.PorterDuff.Mode.MULTIPLY);
    dr.setColorFilter(resources.getColor(R.color.orange), android.graphics.PorterDuff.Mode.SRC_ATOP);

    v.setCompoundDrawablesWithIntrinsicBounds(null, dr, null, null);
    v.setPadding(0, 5, 0, 2);

    v.setBackgroundDrawable(resources.getDrawable(R.drawable.gradient_tabs_focused));

    // hbar
    View hbar = ll.findViewWithTag("hbar");
    //hbar.setBackgroundColor(resources.getColor(R.color.orange));
    hbar.setBackgroundDrawable(resources.getDrawable(R.drawable.gradient_orange));

    return ll;
}

From source file:com.partypoker.poker.engagement.reach.activity.EngagementPollActivity.java

@Override
protected void onAction() {
    /* Scan U.I radio button states */
    LinearLayout questionsLayout = getView("questions");
    JSONArray questions = mContent.getQuestions();
    try {//from  w ww.j  a v a2  s  .c o m
        for (int i = 0; i < questions.length(); i++) {
            /* Get question */
            JSONObject question = questions.getJSONObject(i);

            /* Get radio group by question */
            String questionId = question.getString("id");
            RadioGroup choicesView = (RadioGroup) questionsLayout.findViewWithTag(question);

            /* Get selected choice id */
            int selectedViewId = choicesView.getCheckedRadioButtonId();
            RadioButton selectedChoiceView = (RadioButton) choicesView.findViewById(selectedViewId);
            String choiceId = selectedChoiceView.getTag().toString();

            /* Fill answer */
            mContent.fillAnswer(questionId, choiceId);
        }
    } catch (JSONException jsone) {
        /* Won't happen */
    }

    /* Submit answers */
    mContent.actionContent(getApplicationContext());
}

From source file:com.mk4droid.IMC_Activities.FActivity_TabHost.java

/**
 * When changing tab manage the other tabs and change tab button colors
 *///  ww  w  .  j  av a  2  s .  co  m
@Override
public void onTabChanged(String arg0) {

    // if setup is pressed return as it is
    if (mTabHost.getCurrentTab() == 4)
        return;

    // remove some irrelevant fragments from previous tabs
    if (prevTab == 1 || prevTab == 0) {
        if (Fragment_Comments.mfrag_comments != null) {
            FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
            ft.remove(Fragment_Comments.mfrag_comments);
            ft.commit();
            Fragment_Comments.mfrag_comments = null;
            getSupportFragmentManager().popBackStack();
        }

        if (Fragment_Issue_Details.mfrag_issue_details != null) {
            FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
            ft.remove(Fragment_Issue_Details.mfrag_issue_details);
            ft.commit();
            Fragment_Issue_Details.mfrag_issue_details = null;
            getSupportFragmentManager().popBackStack();
        }
    }

    // Stack of tab new Issue: Two maps v2 are not allowed, so remove the
    // newIssueMap
    if (prevTab == 2) {
        if (Fragment_NewIssueB.mfrag_nIssueB != null) {
            FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
            ft.remove(Fragment_NewIssueB.mfrag_nIssueB);
            ft.commit();
            Fragment_NewIssueB.mfrag_nIssueB = null;
            getSupportFragmentManager().popBackStack();
        }
        Fragment_NewIssueA.llnewissue_a.setVisibility(View.VISIBLE);
    }

    // --------- Set Color of Tabs ---------------
    for (int i = 0; i < NTabs; i++) {
        LinearLayout ll = (LinearLayout) mTabHost.getTabWidget().getChildAt(i);
        TextView tv = (TextView) ll.findViewWithTag("tv");
        String txt = tv.getText().toString();
        Drawable[] dr = tv.getCompoundDrawables();

        if (mTabHost.getCurrentTab() == i) {
            ll = ActivateColorize(ll, txt, dr[1]);
            FActivity_TabHost.IndexGroup = i;
            prevTab = i;
        } else
            ll = InActivateColorize(ll, txt, dr[1]);
    }
}

From source file:com.cssweb.android.quote.QHSCGridActivity.java

public void setSelectRow(int paramInt) throws Exception {
    LinearLayout localLinearLayout1 = this.mLinerLock;
    Integer localInteger1 = Integer.valueOf(this.m_nPos);
    View localView1 = localLinearLayout1.findViewWithTag(localInteger1);
    if (localView1 != null) {
        int l = this.residCol;
        localView1.setBackgroundResource(l);
    }/*from ww w .  j  av a  2 s .  c  om*/
    LinearLayout localLinearLayout2 = this.mLinerLock;
    Integer localInteger2 = Integer.valueOf(paramInt);
    View localView2 = localLinearLayout2.findViewWithTag(localInteger2);
    if (localView2 != null) {
        int i1 = this.residSelColor;
        localView2.setBackgroundColor(i1);
    }

    if (true) {
        LinearLayout localLinerLock = this.mLinerLock2;
        Integer localLockInteger = Integer.valueOf(this.m_nPos);
        View localLockView = localLinerLock.findViewWithTag(localLockInteger);
        if (localLockView != null) {
            int l = this.residCol;
            localLockView.setBackgroundResource(l);
        }
        LinearLayout localLinerLock2 = this.mLinerLock2;
        Integer localLockInteger2 = Integer.valueOf(paramInt);
        View localLockView2 = localLinerLock2.findViewWithTag(localLockInteger2);
        if (localLockView2 != null) {
            int i1 = this.residSelColor;
            localLockView2.setBackgroundColor(i1);
        }
    }

    LinearLayout localLinearLayout3 = this.mLinerHScroll;
    Integer localInteger3 = Integer.valueOf(this.m_nPos);
    LinearLayout localLinearLayout4 = (LinearLayout) localLinearLayout3.findViewWithTag(localInteger3);

    if (localLinearLayout4 != null) {
        int i3 = localLinearLayout4.getChildCount();
        for (int i = 0; i < i3; i++) {
            View localView3 = localLinearLayout4.getChildAt(i);
            int i0 = 0;
            if (i == i3 - 1)
                i0 = this.residScrollCol[2];
            else if (i == 13)
                i0 = this.residScrollCol[1];
            else if (i % 2 == 0)
                i0 = this.residScrollCol[0];
            else
                i0 = this.residScrollCol[1];
            localView3.setBackgroundResource(i0);
        }
    }

    LinearLayout localLinearLayout5 = this.mLinerHScroll;
    Integer localInteger4 = Integer.valueOf(paramInt);
    LinearLayout localLinearLayout6 = (LinearLayout) localLinearLayout5.findViewWithTag(localInteger4);
    if (localLinearLayout6 != null) {
        int i4 = this.residSelColor;
        localLinearLayout6.setBackgroundColor(i4);
    }
    int i6 = localLinearLayout6.getChildCount();
    for (int i = 0; i < i6; i++) {
        View localView6 = localLinearLayout6.getChildAt(i);
        int i10 = this.residSelColor;
        localView6.setBackgroundColor(i10);
    }
    this.m_nPos = paramInt;

    if (null != stringList && stringList.size() > paramInt && null != temp2[m_nPos - 1]
            && !"".equals(temp2[m_nPos - 1]) && null != temp1[m_nPos - 1] && !"".equals(temp1[m_nPos - 1])
            && temp1[m_nPos - 1].length() > 2) {

        Log.i("tag", "stringList.length" + stringList.size() + " : paramInt : " + paramInt);

        String[] data = stringList.get(paramInt - 1);
        String market = data[data.length - 2];
        cssStock = new CssStock();
        cssStock.setStkcode(temp1[m_nPos - 1].substring(2)); // 
        cssStock.setStkname(temp2[m_nPos - 1]);
        cssStock.setMarket(market);
    }
    // this.cssStock = list.get(paramInt - 1);
}

From source file:com.cssweb.android.base.QuoteGridActivity.java

public void setSelectRow(int paramInt) throws Exception {
    LinearLayout localLinearLayout1 = this.mLinerLock;
    Integer localInteger1 = Integer.valueOf(this.m_nPos);
    View localView1 = localLinearLayout1.findViewWithTag(localInteger1);
    if (localView1 != null) {
        int l = this.residCol;
        //         int l = this.residSelColor;
        localView1.setBackgroundResource(l);
    }/* ww w . j a v a  2s . co  m*/
    LinearLayout localLinearLayout2 = this.mLinerLock;
    Integer localInteger2 = Integer.valueOf(paramInt);
    View localView2 = localLinearLayout2.findViewWithTag(localInteger2);
    if (localView2 != null) {
        int i1 = this.residSelColor;
        localView2.setBackgroundColor(i1);
    }

    LinearLayout localLinearLayout3 = this.mLinerHScroll;
    Integer localInteger3 = Integer.valueOf(this.m_nPos);
    LinearLayout localLinearLayout4 = (LinearLayout) localLinearLayout3.findViewWithTag(localInteger3);

    if (localLinearLayout4 != null) {
        int i3 = localLinearLayout4.getChildCount();
        for (int i = 0; i < i3; i++) {
            View localView3 = localLinearLayout4.getChildAt(i);
            int i0 = 0;
            if (i == i3 - 1)
                i0 = this.residScrollCol[2];
            else if (i == 13)
                i0 = this.residScrollCol[1];
            else if (i % 2 == 0)
                i0 = this.residScrollCol[0];
            else
                i0 = this.residScrollCol[1];
            localView3.setBackgroundResource(i0);
        }
    }

    LinearLayout localLinearLayout5 = this.mLinerHScroll;
    Integer localInteger4 = Integer.valueOf(paramInt);
    LinearLayout localLinearLayout6 = (LinearLayout) localLinearLayout5.findViewWithTag(localInteger4);
    if (localLinearLayout6 != null) {
        int i4 = this.residSelColor;
        localLinearLayout6.setBackgroundColor(i4);
    }
    int i6 = localLinearLayout6.getChildCount();
    for (int i = 0; i < i6; i++) {
        View localView6 = localLinearLayout6.getChildAt(i);
        int i10 = this.residSelColor;
        localView6.setBackgroundColor(i10);
    }

    this.m_nPos = paramInt;
    this.cssStock = list.get(paramInt - 1);
}

From source file:com.ninetwozero.battlelog.fragments.ProfileOverviewFragment.java

public final void showProfile(ProfileInformation data) {

    // Do we have valid data?
    if (data == null) {
        return;/*from  w  ww.  j  a  v  a 2 s  . co  m*/
    }

    // Get activity
    Activity activity = getActivity();
    if (activity == null) {
        return;
    }

    // Let's start drawing the... layout
    ((TextView) activity.findViewById(R.id.text_username)).setText(data.getUsername());

    // When did was the users last login?
    if (data.isPlaying() && data.isOnline()) {

        ((TextView) activity.findViewById(R.id.text_online)).setText(

                getString(R.string.info_profile_playing).replace(

                        "{server name}", data.getCurrentServer()

                )

        );

    } else if (data.isOnline()) {

        ((TextView) activity.findViewById(R.id.text_online)).setText(R.string.info_profile_online);

    } else {

        ((TextView) activity.findViewById(R.id.text_online)).setText(data.getLastLogin(context));

    }

    // Is the status ""?
    if (!data.getStatusMessage().equals("")) {

        // Set the status
        ((TextView) activity.findViewById(R.id.text_status)).setText(data.getStatusMessage());
        ((TextView) activity.findViewById(R.id.text_status_date)).setText(
                PublicUtils.getRelativeDate(context, data.getStatusMessageChanged(), R.string.info_lastupdate));

    } else {

        // Hide the view
        ((RelativeLayout) activity.findViewById(R.id.wrap_status)).setVisibility(View.GONE);

    }

    // Do we have a presentation?
    if (data.getPresentation() != null && !data.getPresentation().equals("")) {

        ((TextView) activity.findViewById(R.id.text_presentation)).setText(data.getPresentation());

    } else {

        ((TextView) activity.findViewById(R.id.text_presentation)).setText(R.string.info_profile_empty_pres);

    }

    // Any platoons?
    if (data.getNumPlatoons() > 0) {

        // Init
        View convertView;
        LinearLayout platoonWrapper = (LinearLayout) activity.findViewById(R.id.list_platoons);

        // Clear the platoonWrapper
        ((TextView) activity.findViewById(R.id.text_platoon)).setVisibility(View.GONE);
        platoonWrapper.removeAllViews();

        // Iterate over the platoons
        for (PlatoonData currentPlatoon : data.getPlatoons()) {

            // Does it already exist?
            if (platoonWrapper.findViewWithTag(currentPlatoon) != null) {
                continue;
            }

            // Recycle
            convertView = layoutInflater.inflate(R.layout.list_item_platoon, platoonWrapper, false);

            // Set the TextViews
            ((TextView) convertView.findViewById(R.id.text_name)).setText(currentPlatoon.getName());
            ((TextView) convertView.findViewById(R.id.text_tag)).setText("[" + currentPlatoon.getTag() + "]");
            ((TextView) convertView.findViewById(R.id.text_members))
                    .setText(currentPlatoon.getCountMembers() + "");
            ((TextView) convertView.findViewById(R.id.text_fans)).setText(currentPlatoon.getCountFans() + "");

            // Almost forgot - we got a Bitmap too!
            ((ImageView) convertView.findViewById(R.id.image_badge)).setImageBitmap(

                    BitmapFactory.decodeFile(PublicUtils.getCachePath(context) + currentPlatoon.getImage())

            );

            // Store it in the tag
            convertView.setTag(currentPlatoon);
            convertView.setOnClickListener(

                    new OnClickListener() {

                        @Override
                        public void onClick(View v) {

                            // On-click
                            startActivity(

                                    new Intent(context, PlatoonActivity.class).putExtra(

                                            "platoon", (PlatoonData) v.getTag()

                                    )

                    );

                        }

                    }

            );
            // Add it!
            platoonWrapper.addView(convertView);

        }

    } else {

        ((LinearLayout) activity.findViewById(R.id.list_platoons)).removeAllViews();
        ((TextView) activity.findViewById(R.id.text_platoon)).setVisibility(View.VISIBLE);

    }

    // Set the username
    ((TextView) activity.findViewById(R.id.text_username)).setText(data.getUsername());
}