Example usage for android.widget TextView postInvalidate

List of usage examples for android.widget TextView postInvalidate

Introduction

In this page you can find the example usage for android.widget TextView postInvalidate.

Prototype

public void postInvalidate() 

Source Link

Document

Cause an invalidate to happen on a subsequent cycle through the event loop.

Usage

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

/**
 *    OnCreateView/*from w ww. j a va  2 s . c o  m*/
 */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    isVisible = true;

    vfrag_issue_details = inflater.inflate(R.layout.fragment_issue_details, container, false);
    ctx = vfrag_issue_details.getContext();
    resources = setResources();
    mfrag_issue_details = this;

    //========= Image =================
    dbHandler = new DatabaseHandler(ctx);
    imvFull = (ImageView) vfrag_issue_details.findViewById(R.id.imvIssue_Full);

    IssuePic issuepic = dbHandler.getIssuePic(mIssue._id);

    if (issuepic._IssuePicData != null) {
        bmI = My_System_Utils.LowMemBitmapDecoder(issuepic._IssuePicData);
    } else {
        //------- Try to download from internet --------------  
        if (InternetConnCheck.getInstance(ctx).isOnline(ctx) && !mIssue._urlphoto.equals("null")
                && !mIssue._urlphoto.equals("") && mIssue._urlphoto.length() > 0) {

            mIssue._urlphoto = mIssue._urlphoto.replaceFirst("/thumbs", "");
            new ThumbnailTask_IssDetails(mIssue._urlphoto, mIssue._id).execute();
        }
    }

    dbHandler.db.close();

    imvFull.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            dialogZoomIm = null;

            if (FActivity_TabHost.IndexGroup == 0)
                dialogZoomIm = new Dialog(ctx, android.R.style.Theme_Black_NoTitleBar_Fullscreen);
            else if (FActivity_TabHost.IndexGroup == 1)
                dialogZoomIm = new Dialog(FActivity_TabHost.ctx,
                        android.R.style.Theme_Black_NoTitleBar_Fullscreen);

            dialogZoomIm.requestWindowFeature(Window.FEATURE_NO_TITLE);
            dialogZoomIm.setContentView(R.layout.custom_dialog);
            dialogZoomIm.show();
        }
    });

    // ============ Title and id =========
    tv_id = (TextView) vfrag_issue_details.findViewById(R.id.tv_issuenumber);
    TextView tvTitB = (TextView) vfrag_issue_details.findViewById(R.id.tvTitleIssDetB);

    tv_id.setText(Html.fromHtml("<b><big>#</big></b> " + issueId));
    tv_id.setMovementMethod(new ScrollingMovementMethod());

    tvTitB.setText(mIssue._title);

    //=============== Description ======================
    tvDescription = (TextView) vfrag_issue_details.findViewById(R.id.textViewDescription);
    if (!mIssue._description.equals(""))
        tvDescription.setText(mIssue._description);
    else {
        tvDescription.setVisibility(View.GONE);
    }

    // ============== CATEGORY ===============================
    TextView tvCateg = (TextView) vfrag_issue_details.findViewById(R.id.textViewCategContent);

    int iCateg = 0;
    for (int i = 0; i < Service_Data.mCategL.size(); i++)
        if (Service_Data.mCategL.get(i)._id == mIssue._catid) {
            iCateg = i;
            break;
        }

    tvCateg.setText(Service_Data.mCategL.get(iCateg)._name);

    try {
        bmCateg = My_System_Utils.LowMemBitmapDecoder(Service_Data.mCategL.get(iCateg)._icon);
        BitmapDrawable drCateg = new BitmapDrawable(bmCateg);

        tvCateg.setCompoundDrawablesWithIntrinsicBounds(drCateg, null, null, null);
        tvCateg.setCompoundDrawablePadding(10);
        tvCateg.postInvalidate();
    } catch (Exception e) {

    }

    markerOptions = new MarkerOptions().position(new LatLng(mIssue._latitude, mIssue._longitude))
            .title(mIssue._title).icon(BitmapDescriptorFactory.fromBitmap(bmCateg));

    //================  STATUS ================      
    tvStatus_ack = (TextView) vfrag_issue_details.findViewById(R.id.tv_Status_issuedetails_ack);
    tvStatus_cl = (TextView) vfrag_issue_details.findViewById(R.id.tv_Status_issuedetails_cl);

    vStatus_ack = vfrag_issue_details.findViewById(R.id.v_Status_issuedetails_acknow);
    vStatus_cl = vfrag_issue_details.findViewById(R.id.v_Status_issuedetails_cl);

    int CurrStat = mIssue._currentstatus;

    Colora(CurrStat);

    // ============== Time and Author ================
    TextView tvSubmitted = (TextView) vfrag_issue_details.findViewById(R.id.tvSubmitted);

    String TimeStampRep = mIssue._reported.replace("-", "/");

    tvSubmitted.setText(resources.getString(R.string.Submitted) + " "
            + My_Date_Utils.SubtractDate(TimeStampRep, LangSTR) + " " + resources.getString(R.string.ago) + " "
            + resources.getString(R.string.by) + " " + mIssue._username);

    //============== Votes========================
    TextView tvVotes = (TextView) vfrag_issue_details.findViewById(R.id.textViewVotes);
    tvVotes.setText(Integer.toString(mIssue._votes) + " " + resources.getString(R.string.peoplevoted));

    Button btVote = (Button) vfrag_issue_details.findViewById(R.id.buttonVote);
    //-------- Check if state is Ack or Closed then can not vote ----
    if (CurrStat == 2 || CurrStat == 3)
        btVote.setEnabled(false);

    //-------- Check if Has Voted ----------
    DatabaseHandler dbHandler = new DatabaseHandler(ctx);
    HasVotedSW = dbHandler.CheckIfHasVoted(issueId);

    OwnIssue = false;
    if (UserID_STR.length() > 0)
        OwnIssue = dbHandler.checkIfOwnIssue(Integer.toString(issueId), UserID_STR);

    dbHandler.db.close();

    // if has not voted, it is not his issue, and authenticated then able to vote 
    if (!OwnIssue && !HasVotedSW && AuthFlag) {
        btVote.setEnabled(true);
    }

    if (OwnIssue || HasVotedSW) {
        btVote.setEnabled(false);
        btVote.setText(resources.getString(R.string.AlreadyVoted));
    }

    if (!AuthFlag) {
        btVote.setText(resources.getString(R.string.Vote));
    }

    btVote.setOnClickListener(new View.OnClickListener() {
        public void onClick(View arg0) {
            if (InternetConnCheck.getInstance(ctx).isOnline(ctx) && AuthFlag) {
                new AsynchTaskVote().execute();
            } else if (!InternetConnCheck.getInstance(ctx).isOnline(ctx)) {
                Toast.makeText(ctx, resources.getString(R.string.NoInternet), Toast.LENGTH_SHORT).show();
            } else if (!AuthFlag) {
                Toast.makeText(ctx, resources.getString(R.string.OnlyRegistered), Toast.LENGTH_SHORT).show();
            }
        }
    });

    //============ Address - MapStatic - Button Map dynamic ========================
    TextView tvAddr = (TextView) vfrag_issue_details.findViewById(R.id.textViewAddressContent);
    tvAddr.setText(mIssue._address);

    fmap_issdet = SupportMapFragment.newInstance();

    FragmentTransaction fragmentTransaction = getChildFragmentManager().beginTransaction();
    fragmentTransaction.add(R.id.lliss_det_map, fmap_issdet);
    fragmentTransaction.commit();

    // ============ COMMENTS ===========================
    Button btCommentsSW = (Button) vfrag_issue_details.findViewById(R.id.btCommentsSW);

    btCommentsSW.setText(resources.getString(R.string.ViewComments));

    btCommentsSW.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            if (InternetConnCheck.getInstance(ctx).isOnline(ctx)) {
                FragmentTransaction ft2 = getFragmentManager().beginTransaction();

                Fragment_Comments newfrag_comments = new Fragment_Comments(); // Instantiate a new fragment.
                Bundle args = new Bundle();
                args.putInt("issueId", issueId);
                args.putString("issueTitle", mIssue._title);
                newfrag_comments.setArguments(args); // Add the fragment to the activity, pushing this transaction on to the back stack.

                if (FActivity_TabHost.IndexGroup == 0)
                    ft2.add(R.id.flmain, newfrag_comments, "FTAG_COMMENTS");
                else if (FActivity_TabHost.IndexGroup == 1) {
                    ft2.add(R.id.fl_IssuesList_container, newfrag_comments, "FTAG_COMMENTS");
                }

                ft2.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
                ft2.addToBackStack(null);
                ft2.commit();
            } else {
                Toast.makeText(ctx, resources.getString(R.string.NoInternet), Toast.LENGTH_SHORT).show();
            }
        }
    });

    return vfrag_issue_details;
}

From source file:com.xperia64.rompatcher.MainActivity.java

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == 1) {
        if (resultCode == RESULT_OK) {
            TextView tv1 = (TextView) findViewById(R.id.romText);
            TextView tv2 = (TextView) findViewById(R.id.patchText);
            if (Globals.fileToPatch.lastIndexOf("/") > -1) {
                tv1.setText(Globals.fileToPatch.substring(Globals.fileToPatch.lastIndexOf("/") + 1));
            }/*from   w w  w  . j  av  a2  s  . c o m*/
            if (Globals.fileToPatch.toLowerCase(Locale.US).endsWith(".ecm")) {
                tv2.setEnabled(false);
                ((Button) findViewById(R.id.patchButton)).setEnabled(false);
            } else {
                tv2.setEnabled(true);
                ((Button) findViewById(R.id.patchButton)).setEnabled(true);
                if (Globals.patchToApply.lastIndexOf("/") > -1) {
                    tv2.setText(Globals.patchToApply.substring(Globals.patchToApply.lastIndexOf("/") + 1));
                }
            }
            tv1.postInvalidate();
            tv2.postInvalidate();
        }
    }
}