Example usage for android.widget TextView setVisibility

List of usage examples for android.widget TextView setVisibility

Introduction

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

Prototype

@RemotableViewMethod
public void setVisibility(@Visibility int visibility) 

Source Link

Document

Set the visibility state of this view.

Usage

From source file:com.brq.wallet.activity.main.AddressFragment.java

private void updateUi() {
    if (!isAdded()) {
        return;/*from www  .j a  va 2 s. c  om*/
    }
    if (_mbwManager.getSelectedAccount().isArchived()) {
        return;
    }

    // Update QR code
    QrImageView qrButton = (QrImageView) Preconditions.checkNotNull(_root.findViewById(R.id.ivQR));

    Optional<Address> receivingAddress = getAddress();

    // Update address
    if (receivingAddress.isPresent()) {
        // Set address
        qrButton.setVisibility(View.VISIBLE);
        qrButton.setQrCode(BitcoinUriWithAddress.fromAddress(receivingAddress.get()).toString());
        String[] addressStrings = Utils.stringChopper(receivingAddress.get().toString(), 12);
        ((TextView) _root.findViewById(R.id.tvAddress1)).setText(addressStrings[0]);
        ((TextView) _root.findViewById(R.id.tvAddress2)).setText(addressStrings[1]);
        ((TextView) _root.findViewById(R.id.tvAddress3)).setText(addressStrings[2]);
        if (_showBip44Path && receivingAddress.get() instanceof HdDerivedAddress) {
            HdDerivedAddress hdAdr = (HdDerivedAddress) receivingAddress.get();
            ((TextView) _root.findViewById(R.id.tvAddressPath)).setText(hdAdr.getBip32Path().toString());
        } else {
            ((TextView) _root.findViewById(R.id.tvAddressPath)).setText("");
        }
    } else {
        // No address available
        qrButton.setVisibility(View.INVISIBLE);
        ((TextView) _root.findViewById(R.id.tvAddress1)).setText("");
        ((TextView) _root.findViewById(R.id.tvAddress2)).setText("");
        ((TextView) _root.findViewById(R.id.tvAddress3)).setText("");
        ((TextView) _root.findViewById(R.id.tvAddressPath)).setText("");
    }

    // Show name of bitcoin address according to address book
    TextView tvAddressTitle = (TextView) _root.findViewById(R.id.tvAddressLabel);
    ImageView ivAccountType = (ImageView) _root.findViewById(R.id.ivAccountType);

    String name = _mbwManager.getMetadataStorage().getLabelByAccount(_mbwManager.getSelectedAccount().getId());
    if (name.length() == 0) {
        tvAddressTitle.setVisibility(View.GONE);
        ivAccountType.setVisibility(View.GONE);
    } else {
        tvAddressTitle.setVisibility(View.VISIBLE);
        tvAddressTitle.setText(name);

        // show account type icon next to the name
        Drawable drawableForAccount = Utils.getDrawableForAccount(_mbwManager.getSelectedAccount(), true,
                getResources());
        if (drawableForAccount == null) {
            ivAccountType.setVisibility(View.GONE);
        } else {
            ivAccountType.setImageDrawable(drawableForAccount);
            ivAccountType.setVisibility(View.VISIBLE);
        }
    }

}

From source file:com.neuron.fantecremote.FantecActivity.java

@Override
protected void onResume() {
    super.onResume();
    /**/*from  w w w  .  j a  va 2  s.com*/
     * Check if the API server has been set.
     */
    TextView infoText = (TextView) findViewById(R.id.infotext);
    TableLayout tableLayout = (TableLayout) findViewById(R.id.tableLayout);
    if (Settings.GetApiUrl(prefs) == null) {
        infoText.setVisibility(View.VISIBLE);
        tableLayout.setVisibility(View.GONE);
    } else {
        infoText.setVisibility(View.GONE);
        tableLayout.setVisibility(View.VISIBLE);
    }
}

From source file:com.bonsai.btcreceive.ReceiveFragment.java

public void showAddress() {
    BTCFmt btcfmt = mBase.getBTCFmt();/*from  w w  w.  java  2 s.  c o m*/

    Address addr = mBase.getWalletService().nextReceiveAddress();
    String addrstr = addr.toString();

    TextView addrtv = (TextView) getActivity().findViewById(R.id.receive_addr);
    addrtv.setText(addrstr);
    addrtv.setVisibility(View.VISIBLE);

    String ss = mBTCAmountEditText.getText().toString();
    long bb = btcfmt.parse(ss.toString());
    BigInteger amt = bb == 0 ? null : BigInteger.valueOf(bb);

    String uri = BitcoinURI.convertToBitcoinURI(addrstr, amt, null, null);

    mLogger.info("view address uri=" + uri);

    final int size = (int) (240 * getResources().getDisplayMetrics().density);

    // Load the QR bitmap.
    Bitmap bm = createBitmap(uri, size);
    if (bm != null) {
        ImageView iv = (ImageView) getActivity().findViewById(R.id.receive_qr_view);
        iv.setImageBitmap(bm);
        iv.setVisibility(View.VISIBLE);
    }

    // Find the HDAddress object associated with this address.
    HDAddressDescription addrdesc = mBase.getWalletService().findAddress(addr);
    mHDAddress = addrdesc.hdAddress;
    mTransitioned = false;

    mFiatAmountEditText.setFocusable(false);
    mFiatAmountEditText.setFocusableInTouchMode(false);
    mBTCAmountEditText.setFocusable(false);
    mBTCAmountEditText.setFocusableInTouchMode(false);
}

From source file:at.alladin.rmbt.android.map.overlay.RMBTBalloonOverlayView.java

public void setBalloonData(final RMBTBalloonOverlayItem item, final ViewGroup parent) {
    // map our custom item data to fields
    //        title.setText(item.getTitle());
    resultItems = item.getResultItems();

    resultListView.removeAllViews();/*from   w w w  . j  a v  a 2s.c o m*/

    final float scale = getResources().getDisplayMetrics().density;

    final int leftRightItem = Helperfunctions.dpToPx(5, scale);
    final int topBottomItem = Helperfunctions.dpToPx(3, scale);

    final int leftRightDiv = Helperfunctions.dpToPx(0, scale);
    final int topBottomDiv = Helperfunctions.dpToPx(0, scale);
    final int heightDiv = Helperfunctions.dpToPx(1, scale);

    final int topBottomImg = Helperfunctions.dpToPx(1, scale);

    if (resultItems != null && resultItems.length() > 0) {

        for (int i = 0; i < 1; i++)
            // JSONObject resultListItem;
            try {
                final JSONObject result = resultItems.getJSONObject(i);

                final LayoutInflater resultInflater = (LayoutInflater) context
                        .getSystemService(Context.LAYOUT_INFLATER_SERVICE);

                final View resultView = resultInflater.inflate(R.layout.balloon_overlay_listitem, parent);

                final LinearLayout measurementLayout = (LinearLayout) resultView
                        .findViewById(R.id.resultMeasurementList);
                measurementLayout.setVisibility(View.GONE);

                final LinearLayout netLayout = (LinearLayout) resultView.findViewById(R.id.resultNetList);
                netLayout.setVisibility(View.GONE);

                final TextView measurementHeader = (TextView) resultView.findViewById(R.id.resultMeasurement);
                measurementHeader.setVisibility(View.GONE);

                final TextView netHeader = (TextView) resultView.findViewById(R.id.resultNet);
                netHeader.setVisibility(View.GONE);

                final TextView dateHeader = (TextView) resultView.findViewById(R.id.resultDate);
                dateHeader.setVisibility(View.GONE);

                dateHeader.setText(result.optString("time_string"));

                final JSONArray measurementArray = result.getJSONArray("measurement");

                final JSONArray netArray = result.getJSONArray("net");

                for (int j = 0; j < measurementArray.length(); j++) {

                    final JSONObject singleItem = measurementArray.getJSONObject(j);

                    final LinearLayout measurememtItemLayout = new LinearLayout(context); // (LinearLayout)measurememtItemView.findViewById(R.id.measurement_item);

                    measurememtItemLayout.setLayoutParams(
                            new LinearLayout.LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT,
                                    android.view.ViewGroup.LayoutParams.WRAP_CONTENT));

                    measurememtItemLayout.setGravity(Gravity.CENTER_VERTICAL);
                    measurememtItemLayout.setPadding(leftRightItem, topBottomItem, leftRightItem,
                            topBottomItem);

                    final TextView itemTitle = new TextView(context, null, R.style.balloonResultItemTitle);
                    itemTitle.setLayoutParams(
                            new LinearLayout.LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT,
                                    android.view.ViewGroup.LayoutParams.WRAP_CONTENT, 0.4f));
                    itemTitle.setTextAppearance(context, R.style.balloonResultItemTitle);
                    itemTitle.setWidth(0);
                    itemTitle.setGravity(Gravity.LEFT);
                    itemTitle.setText(singleItem.getString("title"));

                    measurememtItemLayout.addView(itemTitle);

                    final ImageView itemClassification = new ImageView(context);
                    itemClassification.setLayoutParams(
                            new LinearLayout.LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT,
                                    android.view.ViewGroup.LayoutParams.MATCH_PARENT, 0.1f));
                    itemClassification.setPadding(0, topBottomImg, 0, topBottomImg);
                    // itemClassification.set setGravity(Gravity.LEFT);

                    itemClassification.setImageDrawable(getResources().getDrawable(
                            Helperfunctions.getClassificationImage(singleItem.getInt("classification"))));

                    measurememtItemLayout.addView(itemClassification);

                    final TextView itemValue = new TextView(context, null, R.style.balloonResultItemValue);
                    itemValue.setLayoutParams(
                            new LinearLayout.LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT,
                                    android.view.ViewGroup.LayoutParams.WRAP_CONTENT, 0.5f));
                    itemValue.setTextAppearance(context, R.style.balloonResultItemValue);
                    itemValue.setWidth(0);
                    itemValue.setGravity(Gravity.LEFT);
                    itemValue.setText(singleItem.getString("value"));

                    measurememtItemLayout.addView(itemValue);

                    measurementLayout.addView(measurememtItemLayout);

                    final View divider = new View(context);
                    divider.setLayoutParams(new LinearLayout.LayoutParams(
                            android.view.ViewGroup.LayoutParams.MATCH_PARENT, heightDiv, 1));
                    divider.setPadding(leftRightDiv, topBottomDiv, leftRightDiv, topBottomDiv);

                    divider.setBackgroundResource(R.drawable.bg_trans_light_10);

                    measurementLayout.addView(divider);

                    measurementLayout.invalidate();
                }

                for (int j = 0; j < netArray.length(); j++) {

                    final JSONObject singleItem = netArray.getJSONObject(j);

                    final LinearLayout netItemLayout = new LinearLayout(context); // (LinearLayout)measurememtItemView.findViewById(R.id.measurement_item);

                    netItemLayout.setLayoutParams(
                            new LinearLayout.LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT,
                                    android.view.ViewGroup.LayoutParams.WRAP_CONTENT));
                    netItemLayout.setPadding(leftRightItem, topBottomItem, leftRightItem, topBottomItem);

                    netItemLayout.setGravity(Gravity.CENTER_VERTICAL);

                    final TextView itemTitle = new TextView(context, null, R.style.balloonResultItemTitle);
                    itemTitle.setLayoutParams(
                            new LinearLayout.LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT,
                                    android.view.ViewGroup.LayoutParams.WRAP_CONTENT, 0.4f));
                    itemTitle.setTextAppearance(context, R.style.balloonResultItemTitle);
                    itemTitle.setWidth(0);
                    itemTitle.setGravity(Gravity.LEFT);
                    itemTitle.setText(singleItem.getString("title"));

                    netItemLayout.addView(itemTitle);

                    final ImageView itemClassification = new ImageView(context);
                    itemClassification.setLayoutParams(
                            new LinearLayout.LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT,
                                    android.view.ViewGroup.LayoutParams.MATCH_PARENT, 0.1f));
                    itemClassification.setPadding(0, topBottomImg, 0, topBottomImg);

                    itemClassification.setImageDrawable(
                            context.getResources().getDrawable(R.drawable.traffic_lights_none));
                    netItemLayout.addView(itemClassification);

                    final TextView itemValue = new TextView(context, null, R.style.balloonResultItemValue);
                    itemValue.setLayoutParams(
                            new LinearLayout.LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT,
                                    android.view.ViewGroup.LayoutParams.WRAP_CONTENT, 0.5f));
                    itemValue.setTextAppearance(context, R.style.balloonResultItemValue);
                    itemValue.setWidth(0);
                    itemValue.setGravity(Gravity.LEFT);
                    itemValue.setText(singleItem.optString("value", null));

                    netItemLayout.addView(itemValue);

                    netLayout.addView(netItemLayout);

                    final View divider = new View(context);
                    divider.setLayoutParams(new LinearLayout.LayoutParams(
                            android.view.ViewGroup.LayoutParams.MATCH_PARENT, heightDiv, 1));
                    divider.setPadding(leftRightDiv, topBottomDiv, leftRightDiv, topBottomDiv);

                    divider.setBackgroundResource(R.drawable.bg_trans_light_10);

                    netLayout.addView(divider);

                    netLayout.invalidate();
                }

                measurementHeader.setVisibility(View.VISIBLE);
                netHeader.setVisibility(View.VISIBLE);

                measurementLayout.setVisibility(View.VISIBLE);
                netLayout.setVisibility(View.VISIBLE);

                dateHeader.setVisibility(View.VISIBLE);

                resultListView.addView(resultView);

                Log.d(DEBUG_TAG, "View Added");
                // codeText.setText(resultListItem.getString("sync_code"));

            } catch (final JSONException e) {
                e.printStackTrace();
            }

        progessBar.setVisibility(View.GONE);
        emptyView.setVisibility(View.GONE);

        resultListView.setVisibility(View.VISIBLE);

        resultListView.invalidate();
    } else {
        Log.i(DEBUG_TAG, "LEERE LISTE");
        progessBar.setVisibility(View.GONE);
        emptyView.setVisibility(View.VISIBLE);
        emptyView.setText(context.getString(R.string.error_no_data));
        emptyView.invalidate();
    }
}

From source file:com.android.contacts.common.list.ViewPagerTabs.java

private void addTab(CharSequence tabTitle, final int position) {
    View tabView;//ww  w  . jav  a 2 s.c o m
    if (mTabIcons != null && position < mTabIcons.length) {
        View layout = LayoutInflater.from(getContext()).inflate(R.layout.unread_count_tab, null);
        View iconView = layout.findViewById(R.id.icon);
        iconView.setBackgroundResource(mTabIcons[position]);
        iconView.setContentDescription(tabTitle);
        TextView textView = (TextView) layout.findViewById(R.id.count);
        if (mUnreadCounts != null && mUnreadCounts[position] > 0) {
            textView.setText(Integer.toString(mUnreadCounts[position]));
            textView.setVisibility(View.VISIBLE);
            iconView.setContentDescription(
                    getResources().getQuantityString(R.plurals.tab_title_with_unread_items,
                            mUnreadCounts[position], tabTitle.toString(), mUnreadCounts[position]));
        } else {
            textView.setVisibility(View.INVISIBLE);
            iconView.setContentDescription(tabTitle);
        }
        tabView = layout;
    } else {
        final TextView textView = new TextView(getContext());
        textView.setText(tabTitle);
        textView.setBackgroundResource(R.drawable.view_pager_tab_background);

        // Assign various text appearance related attributes to child views.
        if (mTextStyle > 0) {
            textView.setTypeface(textView.getTypeface(), mTextStyle);
        }
        if (mTextSize > 0) {
            textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTextSize);
        }
        if (mTextColor != null) {
            textView.setTextColor(mTextColor);
        }
        textView.setAllCaps(mTextAllCaps);
        textView.setGravity(Gravity.CENTER);

        tabView = textView;
    }

    tabView.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            mPager.setCurrentItem(getRtlPosition(position));
        }
    });

    tabView.setOnLongClickListener(new OnTabLongClickListener(position));

    tabView.setPadding(mSidePadding, 0, mSidePadding, 0);

    mTabStrip.addView(tabView, position,
            new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT, 1));

    // Default to the first child being selected
    if (position == 0) {
        mPrevSelected = 0;
        tabView.setSelected(true);
    }
}

From source file:com.cachirulop.moneybox.activity.MainActivity.java

public void setTotalVisibility(boolean visible) {
    TextView total;

    total = (TextView) findViewById(R.id.txtTotal);
    if (visible) {
        total.setVisibility(View.VISIBLE);
    } else {//  ww  w.j  a v  a 2 s .c o m
        total.setVisibility(View.INVISIBLE);
    }
}

From source file:com.android.talkback.tutorial.TutorialLessonFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedState) {
    int layoutId;
    if (mExercise.needScrollableContainer()) {
        layoutId = R.layout.tutorial_lesson_fragment_scrollable;
    } else {//from w w w.ja  v  a2  s . co  m
        layoutId = R.layout.tutorial_lesson_fragment;
    }
    View view = inflater.inflate(layoutId, container, false);

    mDescription = (TextView) view.findViewById(R.id.description);
    mDescription.setText(mPage.getDescription());

    TextView subTitle = (TextView) view.findViewById(R.id.part_subtitle);
    subTitle.setText(mPage.getSubtitle());

    TextView currentPage = (TextView) view.findViewById(R.id.current_page);
    TextView next = (TextView) view.findViewById(R.id.next);
    if (mCurrentPage < mLesson.getPagesCount() - 1) {
        next.setText(R.string.tutorial_next);
        currentPage.setVisibility(View.VISIBLE);
        currentPage.setText(
                getString(R.string.tutorial_page_number_of, mCurrentPage + 1, mLesson.getPagesCount() - 1));
    } else if (mTutorialController.getNextLesson(mLesson) == null) {
        next.setText(R.string.tutorial_home);
    } else {
        next.setText(R.string.tutorial_next_lesson);
    }
    next.setOnClickListener(this);

    View previous = view.findViewById(R.id.previous_page);
    previous.setOnClickListener(this);
    previous.setContentDescription(getString(R.string.tutorial_previous));

    ViewGroup contentContainer = (ViewGroup) view.findViewById(R.id.practice_area);
    View contentView = mPage.getExercise().getContentView(inflater, contentContainer);
    ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT);
    contentContainer.addView(contentView, params);

    return view;
}

From source file:cn.ucai.superwechat.ui.SettingsActivity.java

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.em_fragment_conversation_settings);

    if (savedInstanceState != null && savedInstanceState.getBoolean("isConflict", false))
        return;// www .j a  va2 s  . c o m
    ImageView back = (ImageView) findViewById(R.id.img_back);
    back.setVisibility(View.VISIBLE);
    back.setOnClickListener(this);
    TextView title = (TextView) findViewById(R.id.txt_title);
    title.setVisibility(View.VISIBLE);
    title.setText(getString(R.string.set));
    rl_switch_notification = (RelativeLayout) findViewById(R.id.rl_switch_notification);
    rl_switch_sound = (RelativeLayout) findViewById(R.id.rl_switch_sound);
    rl_switch_vibrate = (RelativeLayout) findViewById(R.id.rl_switch_vibrate);
    rl_switch_speaker = (RelativeLayout) findViewById(R.id.rl_switch_speaker);
    rl_switch_chatroom_leave = (RelativeLayout) findViewById(R.id.rl_switch_chatroom_owner_leave);
    rl_switch_delete_msg_when_exit_group = (RelativeLayout) findViewById(
            R.id.rl_switch_delete_msg_when_exit_group);
    rl_switch_auto_accept_group_invitation = (RelativeLayout) findViewById(
            R.id.rl_switch_auto_accept_group_invitation);
    rl_switch_adaptive_video_encode = (RelativeLayout) findViewById(R.id.rl_switch_adaptive_video_encode);
    rl_custom_server = (RelativeLayout) findViewById(R.id.rl_custom_server);

    notifiSwitch = (EaseSwitchButton) findViewById(R.id.switch_notification);
    soundSwitch = (EaseSwitchButton) findViewById(R.id.switch_sound);
    vibrateSwitch = (EaseSwitchButton) findViewById(R.id.switch_vibrate);
    speakerSwitch = (EaseSwitchButton) findViewById(R.id.switch_speaker);
    ownerLeaveSwitch = (EaseSwitchButton) findViewById(R.id.switch_owner_leave);
    switch_delete_msg_when_exit_group = (EaseSwitchButton) findViewById(R.id.switch_delete_msg_when_exit_group);
    switch_auto_accept_group_invitation = (EaseSwitchButton) findViewById(
            R.id.switch_auto_accept_group_invitation);
    switch_adaptive_video_encode = (EaseSwitchButton) findViewById(R.id.switch_adaptive_video_encode);
    logoutBtn = (Button) findViewById(R.id.btn_logout);
    if (!TextUtils.isEmpty(EMClient.getInstance().getCurrentUser())) {
        logoutBtn.setText(
                getString(R.string.button_logout) + "(" + EMClient.getInstance().getCurrentUser() + ")");
    }
    customServerSwitch = (EaseSwitchButton) findViewById(R.id.switch_custom_server);

    textview1 = (TextView) findViewById(R.id.textview1);
    textview2 = (TextView) findViewById(R.id.textview2);

    blacklistContainer = (LinearLayout) findViewById(R.id.ll_black_list);
    //      userProfileContainer = (LinearLayout) findViewById(R.id.ll_user_profile);
    llDiagnose = (LinearLayout) findViewById(R.id.ll_diagnose);
    pushNick = (LinearLayout) findViewById(R.id.ll_set_push_nick);

    settingsModel = SuperWeChatHelper.getInstance().getModel();
    chatOptions = EMClient.getInstance().getOptions();

    blacklistContainer.setOnClickListener(this);
    //      userProfileContainer.setOnClickListener(this);
    rl_switch_notification.setOnClickListener(this);
    rl_switch_sound.setOnClickListener(this);
    rl_switch_vibrate.setOnClickListener(this);
    rl_switch_speaker.setOnClickListener(this);
    customServerSwitch.setOnClickListener(this);
    rl_custom_server.setOnClickListener(this);
    logoutBtn.setOnClickListener(this);
    llDiagnose.setOnClickListener(this);
    pushNick.setOnClickListener(this);
    rl_switch_chatroom_leave.setOnClickListener(this);
    rl_switch_delete_msg_when_exit_group.setOnClickListener(this);
    rl_switch_auto_accept_group_invitation.setOnClickListener(this);
    rl_switch_adaptive_video_encode.setOnClickListener(this);

    // the vibrate and sound notification are allowed or not?
    if (settingsModel.getSettingMsgNotification()) {
        notifiSwitch.openSwitch();
    } else {
        notifiSwitch.closeSwitch();
    }

    // sound notification is switched on or not?
    if (settingsModel.getSettingMsgSound()) {
        soundSwitch.openSwitch();
    } else {
        soundSwitch.closeSwitch();
    }

    // vibrate notification is switched on or not?
    if (settingsModel.getSettingMsgVibrate()) {
        vibrateSwitch.openSwitch();
    } else {
        vibrateSwitch.closeSwitch();
    }

    // the speaker is switched on or not?
    if (settingsModel.getSettingMsgSpeaker()) {
        speakerSwitch.openSwitch();
    } else {
        speakerSwitch.closeSwitch();
    }

    // if allow owner leave
    if (settingsModel.isChatroomOwnerLeaveAllowed()) {
        ownerLeaveSwitch.openSwitch();
    } else {
        ownerLeaveSwitch.closeSwitch();
    }

    // delete messages when exit group?
    if (settingsModel.isDeleteMessagesAsExitGroup()) {
        switch_delete_msg_when_exit_group.openSwitch();
    } else {
        switch_delete_msg_when_exit_group.closeSwitch();
    }

    if (settingsModel.isAutoAcceptGroupInvitation()) {
        switch_auto_accept_group_invitation.openSwitch();
    } else {
        switch_auto_accept_group_invitation.closeSwitch();
    }

    if (settingsModel.isAdaptiveVideoEncode()) {
        switch_adaptive_video_encode.openSwitch();
        EMClient.getInstance().callManager().getVideoCallHelper().setAdaptiveVideoFlag(true);
    } else {
        switch_adaptive_video_encode.closeSwitch();
        EMClient.getInstance().callManager().getVideoCallHelper().setAdaptiveVideoFlag(false);
    }

    if (settingsModel.isCustomServerEnable()) {
        customServerSwitch.openSwitch();
    } else {
        customServerSwitch.closeSwitch();
    }
}

From source file:com.closedevice.fastapp.view.tab.SlidingTabLayout.java

public void setMessageCount(int i, int count) {
    if (mTabStrip.getChildAt(i) == null)
        return;// w  w w.  jav a2s .com
    TextView mTvMessageCount = (TextView) mTabStrip.getChildAt(i).findViewById(R.id.tv_unread_count);
    if (mTvMessageCount == null)
        return;
    if (count == 0) {
        mTvMessageCount.setVisibility(View.GONE);
    } else {
        mTvMessageCount.setVisibility(View.VISIBLE);
        String countStr;
        if (count < 100)
            countStr = String.valueOf(count);
        else {
            countStr = "99+";
        }
        mTvMessageCount.setText(countStr);
    }
}

From source file:com.df.dfcarchecker.CarReport.CarReportBasicInfoFragment.java

private void updateUi() {
    try {//w ww. ja  v  a2  s  . c  om
        setTextView(rootView, R.id.vin_text, options.getString("vin"));
        String brandString = options.getString("manufacturer") + " " + options.getString("series") + " "
                + options.getString("model");
        setTextView(rootView, R.id.brand_text, brandString);
        setTextView(rootView, R.id.displacement_text, options.getString("displacement"));
        setTextView(rootView, R.id.driveType_text, options.getString("driveType"));
        setTextView(rootView, R.id.transmission_text, options.getString("transmission"));

        if (options.has("airBags"))
            if (options.get("airBags") != null)
                setTextView(rootView, R.id.airBags_text, options.getString("airBags"));
            else
                setTextView(rootView, R.id.airBags_text, null);
        if (options.has("displacement"))
            setTextView(rootView, R.id.displacement_text, options.getString("displacement"));
        else
            setTextView(rootView, R.id.displacement_text, null);
        if (options.has("driveType"))
            setTextView(rootView, R.id.driveType_text, options.getString("driveType"));
        else
            setTextView(rootView, R.id.driveType_text, null);
        if (options.has("transmission"))
            setTextView(rootView, R.id.transmission_text, options.getString("transmission"));
        else
            setTextView(rootView, R.id.transmission_text, null);
        if (options.has("airBags"))
            setTextView(rootView, R.id.airBags_text, options.getString("airBags"));
        else
            setTextView(rootView, R.id.airBags_text, null);
        if (options.has("abs"))
            setTextView(rootView, R.id.abs_text, options.getString("abs"));
        else
            setTextView(rootView, R.id.abs_text, null);
        if (options.has("powerSteering"))
            setTextView(rootView, R.id.powerSteering_text, options.getString("powerSteering"));
        else
            setTextView(rootView, R.id.powerSteering_text, null);
        if (options.has("powerWindows"))
            setTextView(rootView, R.id.powerWindows_text, options.getString("powerWindows"));
        else
            setTextView(rootView, R.id.powerWindows_text, null);
        if (options.has("sunroof"))
            setTextView(rootView, R.id.sunroof_text, options.getString("sunroof"));
        else
            setTextView(rootView, R.id.sunroof_text, null);
        if (options.has("airConditioning"))
            setTextView(rootView, R.id.airConditioning_text, options.getString("airConditioning"));
        else
            setTextView(rootView, R.id.airConditioning_text, null);
        if (options.has("leatherSeats"))
            setTextView(rootView, R.id.leatherSeats_text, options.getString("leatherSeats"));
        else
            setTextView(rootView, R.id.leatherSeats_text, null);
        if (options.has("powerSeats"))
            setTextView(rootView, R.id.powerSeats_text, options.getString("powerSeats"));
        else
            setTextView(rootView, R.id.powerSeats_text, null);
        if (options.has("powerMirror"))
            setTextView(rootView, R.id.powerMirror_text, options.getString("powerMirror"));
        else
            setTextView(rootView, R.id.powerMirror_text, null);
        if (options.has("reversingRadar"))
            setTextView(rootView, R.id.reversingRadar_text, options.getString("reversingRadar"));
        else
            setTextView(rootView, R.id.reversingRadar_text, null);
        if (options.has("reversingCamera"))
            setTextView(rootView, R.id.reversingCamera_text, options.getString("reversingCamera"));
        else
            setTextView(rootView, R.id.reversingCamera_text, null);
        if (options.has("ccs"))
            setTextView(rootView, R.id.ccs_text, options.getString("ccs"));
        else
            setTextView(rootView, R.id.ccs_text, null);
        if (options.has("softCloseDoors"))
            setTextView(rootView, R.id.softCloseDoors_text, options.getString("softCloseDoors"));
        else
            setTextView(rootView, R.id.softCloseDoors_text, null);
        if (options.has("rearPowerSeats"))
            setTextView(rootView, R.id.rearPowerSeats_text, options.getString("rearPowerSeats"));
        else
            setTextView(rootView, R.id.rearPowerSeats_text, null);
        if (options.has("ahc"))
            setTextView(rootView, R.id.ahc_text, options.getString("ahc"));
        else
            setTextView(rootView, R.id.ahc_text, null);
        if (options.has("parkAssist"))
            setTextView(rootView, R.id.parkAssist_text, options.getString("parkAssist"));
        else
            setTextView(rootView, R.id.parkAssist_text, null);
        if (options.has("clapBoard"))
            setTextView(rootView, R.id.clapboard_text, options.getString("clapBoard"));
        else
            setTextView(rootView, R.id.clapboard_text, null);

        if (procedures.has("regArea"))
            setTextView(rootView, R.id.regArea_text, procedures.getString("regArea"));
        else
            setTextView(rootView, R.id.regArea_text, null);
        if (procedures.has("plateNumber"))
            setTextView(rootView, R.id.plateNumber_text, procedures.getString("plateNumber"));
        else
            setTextView(rootView, R.id.plateNumber_text, null);
        if (procedures.has("licenseModel"))
            setTextView(rootView, R.id.licenceModel_text, procedures.getString("licenseModel"));
        else
            setTextView(rootView, R.id.licenceModel_text, null);
        if (procedures.has("vehicleType"))
            setTextView(rootView, R.id.vehicleType_text, procedures.getString("vehicleType"));
        else
            setTextView(rootView, R.id.vehicleType_text, null);
        if (procedures.has("useCharacter"))
            setTextView(rootView, R.id.useCharacter_text, procedures.getString("useCharacter"));
        else
            setTextView(rootView, R.id.useCharacter_text, null);
        if (procedures.has("mileage"))
            setTextView(rootView, R.id.mileAge_text, procedures.getString("mileage") + "");
        else
            setTextView(rootView, R.id.mileAge_text, null);
        if (procedures.has("exteriorColor"))
            setTextView(rootView, R.id.exteriorColor_text, procedures.getString("exteriorColor"));
        else
            setTextView(rootView, R.id.exteriorColor_text, null);

        setTextView(rootView, R.id.regDate_text, procedures.getString("regDate"));
        setTextView(rootView, R.id.builtDate_text, procedures.getString("builtDate"));
        setTextView(rootView, R.id.transferLastDate_text, procedures.getString("transferLastDate"));
        setTextView(rootView, R.id.annualInspection_text, procedures.getString("annualInspection"));
        if (procedures.getString("compulsoryInsurance").equals("")) {
            setTextView(rootView, R.id.ct_compulsoryInsurance_text, "");
        }
        setTextView(rootView, R.id.compulsoryInsurance_text, procedures.getString("compulsoryInsurance"));
        setTextView(rootView, R.id.insuranceExpiryDate_text, procedures.getString("insuranceExpiryDate"));

        if (procedures.has("invoice")) {
            setTextView(rootView, R.id.invoice_text, procedures.getString("invoice"));

            if (procedures.getString("invoice").equals("")
                    || procedures.getString("invoice").equals("")) {
                //showView(false, rootView, R.id.invoicePrice_text);
                TextView textView = (TextView) rootView.findViewById(R.id.invoicePrice_text);
                textView.setVisibility(View.INVISIBLE);
            }
        } else
            setTextView(rootView, R.id.invoice_text, null);

        if (procedures.has("invoicePrice"))
            setTextView(rootView, R.id.invoicePrice_text, procedures.getString("invoicePrice") + "");
        else
            setTextView(rootView, R.id.invoicePrice_text, null);
        if (procedures.has("surtax"))
            setTextView(rootView, R.id.surtax_text, procedures.getString("surtax"));
        else
            setTextView(rootView, R.id.surtax_text, null);
        if (procedures.has("transferCount")) {
            setTextView(rootView, R.id.transferCount_text, procedures.getString("transferCount"));

            if (procedures.getString("transferCount").equals("0")) {
                showView(false, rootView, R.id.transferLastDate_row);
            }
        } else
            setTextView(rootView, R.id.transferCount_text, null);
        if (procedures.has("licensePhotoMatch"))
            setTextView(rootView, R.id.licencePhotoMatch_text, procedures.getString("licensePhotoMatch"));
        else
            setTextView(rootView, R.id.licencePhotoMatch_text, null);
        if (procedures.has("insurance")) {
            setTextView(rootView, R.id.insurance_text, procedures.getString("insurance"));

            if (procedures.getString("insurance").equals("")) {
                showView(false, rootView, R.id.ct_insurance_table);
            }
        } else
            setTextView(rootView, R.id.insurance_text, null);

        if (procedures.has("insuranceRegion"))
            setTextView(rootView, R.id.insuranceRegion_text, procedures.getString("insuranceRegion"));
        else
            setTextView(rootView, R.id.insuranceRegion_text, null);
        if (procedures.has("insuranceAmount"))
            setTextView(rootView, R.id.insuranceAmount_text, procedures.getString("insuranceAmount") + "");
        else
            setTextView(rootView, R.id.insuranceAmount_text, null);
        if (procedures.has("insuranceCompany"))
            setTextView(rootView, R.id.insuranceCompany_text, procedures.getString("insuranceCompany"));
        else
            setTextView(rootView, R.id.insuranceCompany_text, null);
        if (procedures.has("importProcedures"))
            setTextView(rootView, R.id.importProcedures_text, procedures.getString("importProcedures"));
        else
            setTextView(rootView, R.id.importProcedures_text, null);
        if (procedures.has("spareTire"))
            setTextView(rootView, R.id.spareTire_text, procedures.getString("spareTire"));
        else
            setTextView(rootView, R.id.spareTire_text, null);
        if (procedures.has("spareKey"))
            setTextView(rootView, R.id.spareKey_text, procedures.getString("spareKey"));
        else
            setTextView(rootView, R.id.spareKey_text, null);
        if (procedures.has("ownerName"))
            setTextView(rootView, R.id.ownerName_text, procedures.getString("ownerName"));
        else
            setTextView(rootView, R.id.ownerName_text, null);
        if (procedures.has("ownerIdNumber"))
            setTextView(rootView, R.id.ownerIdNumber_text, procedures.getString("ownerIdNumber"));
        else
            setTextView(rootView, R.id.ownerIdNumber_text, null);
        if (procedures.has("ownerPhone"))
            setTextView(rootView, R.id.ownerPhone_text, procedures.getString("ownerPhone"));
        else
            setTextView(rootView, R.id.ownerPhone_text, null);
        //            if(procedures.has("transferAgree"))
        //                setTextView(rootView, R.id.transferAgree_text, procedures.getString("transferAgree"));
        //            else
        //                setTextView(rootView, R.id.transferAgree_text, null);
        //            if(procedures.has("transferRequire"))
        //                setTextView(rootView, R.id.transferRequire_text, procedures.getString("transferRequire"));
        //            else
        //                setTextView(rootView, R.id.transferRequire_text, null);

    } catch (JSONException e) {
        e.printStackTrace();
    }
}