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.giovanniterlingen.windesheim.view.Adapters.NatschoolContentAdapter.java

@Override
public void onBindViewHolder(final ViewHolder holder, final int position) {
    final TextView contentName = holder.contentName;
    final ImageView icon = holder.icon;
    final FrameLayout menuButton = holder.menuButton;
    final ImageView menuButtonImage = holder.menuButtonImage;
    contentName.setText(content.get(position).name);
    holder.itemView.setOnClickListener(new View.OnClickListener() {
        @Override/*from ww  w .  j a  v  a2  s  . com*/
        public void onClick(View v) {
            onContentClick(content.get(holder.getAdapterPosition()), holder.getAdapterPosition());
        }
    });
    if (content.get(position).type == -1) {
        icon.setImageDrawable(ResourcesCompat.getDrawable(activity.getResources(),
                getDrawableByName(content.get(position).name), null));
        menuButton.setVisibility(View.VISIBLE);
        menuButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                menuButtonImage.setImageDrawable(
                        ResourcesCompat.getDrawable(activity.getResources(), R.drawable.overflow_open, null));
                PopupMenu popupMenu = new PopupMenu(activity, menuButton);
                popupMenu.inflate(R.menu.menu_file);
                popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
                    public boolean onMenuItemClick(MenuItem item) {
                        if (item.getItemId() == R.id.delete_file) {
                            showPromptDialog(holder.getAdapterPosition());
                            return true;
                        }
                        return true;
                    }
                });
                popupMenu.setOnDismissListener(new PopupMenu.OnDismissListener() {
                    @Override
                    public void onDismiss(PopupMenu menu) {
                        menuButtonImage.setImageDrawable(ResourcesCompat.getDrawable(activity.getResources(),
                                R.drawable.overflow_normal, null));
                    }
                });
                popupMenu.show();
            }
        });
    } else if (content.get(position).url == null || (content.get(position).url.length() == 0)) {
        if (content.get(position).imageUrl != null) {
            icon.setImageDrawable(
                    ResourcesCompat.getDrawable(activity.getResources(), R.drawable.ic_work, null));
        } else {
            icon.setImageDrawable(
                    ResourcesCompat.getDrawable(activity.getResources(), R.drawable.ic_folder, null));
        }
    } else {
        if (content.get(position).type == 1 || content.get(position).type == 3
                || content.get(position).type == 11) {
            icon.setImageDrawable(
                    ResourcesCompat.getDrawable(activity.getResources(), R.drawable.ic_link, null));
        } else if (content.get(position).type == 10) {
            icon.setImageDrawable(ResourcesCompat.getDrawable(activity.getResources(),
                    getDrawableByName(content.get(position).url), null));

            final TextView progressTextView = holder.progressTextView;
            final ProgressBar progressBar = holder.progressBar;
            final FrameLayout cancelButton = holder.cancelButton;

            if (content.get(position).downloading) {
                contentName.setVisibility(View.GONE);
                progressTextView.setVisibility(View.VISIBLE);
                progressBar.setVisibility(View.VISIBLE);
                if (content.get(position).progress == -1 && content.get(position).progressString == null) {
                    progressTextView.setText(activity.getResources().getString(R.string.downloading));
                    progressBar.setIndeterminate(true);
                } else {
                    progressTextView.setText(content.get(position).progressString);
                    progressBar.setIndeterminate(false);
                    progressBar.setMax(100);
                    progressBar.setProgress(content.get(position).progress);
                }
                cancelButton.setVisibility(View.VISIBLE);
                cancelButton.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        NotificationCenter.getInstance().postNotificationName(
                                NotificationCenter.downloadCancelled,
                                content.get(holder.getAdapterPosition()).id);
                        contentName.setVisibility(View.VISIBLE);
                        progressTextView.setVisibility(View.GONE);
                        progressBar.setVisibility(View.GONE);
                        cancelButton.setVisibility(View.GONE);
                    }
                });
            } else {
                contentName.setVisibility(View.VISIBLE);
                progressTextView.setVisibility(View.GONE);
                progressBar.setVisibility(View.GONE);
                cancelButton.setVisibility(View.GONE);
            }
        }
    }
}

From source file:com.max2idea.android.limbo.main.LimboActivity.java

public void promptVNCAllowExternal(final Activity activity) {
    final AlertDialog alertDialog;
    alertDialog = new AlertDialog.Builder(activity).create();
    alertDialog.setTitle("Enable VNC server");

    TextView textView = new TextView(activity);
    textView.setVisibility(View.VISIBLE);
    textView.setId(201012010);//from  w  w  w.  ja  va  2 s  .c  o m
    textView.setText("VNC Server: " + this.getLocalIpAddress() + ":" + "5901\n"
            + "Warning: VNC is not secure make sure you're on a private network!\n");

    EditText passwdView = new EditText(activity);
    passwdView.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
    passwdView.setHint("Password");
    passwdView.setEnabled(true);
    passwdView.setVisibility(View.VISIBLE);
    passwdView.setId(11111);
    passwdView.setSingleLine();

    RelativeLayout mLayout = new RelativeLayout(this);
    mLayout.setId(12222);

    RelativeLayout.LayoutParams textViewParams = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    textViewParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, mLayout.getId());
    mLayout.addView(textView, textViewParams);

    RelativeLayout.LayoutParams passwordViewParams = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);

    passwordViewParams.addRule(RelativeLayout.BELOW, textView.getId());
    // passwordViewParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM,
    // mLayout.getId());
    mLayout.addView(passwdView, passwordViewParams);

    alertDialog.setView(mLayout);

    final Handler handler = this.handler;

    alertDialog.setButton("Set", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {

            // UIUtils.log("Searching...");
            EditText a = (EditText) alertDialog.findViewById(11111);

            if (a.getText().toString().trim().equals("")) {
                Toast.makeText(getApplicationContext(), "Password cannot be empty!", Toast.LENGTH_SHORT).show();
                vnc_passwd = null;
                vnc_allow_external = 0;
                mVNCAllowExternal.setChecked(false);
                // LimboSettingsManager.setVNCAllowExternal(activity, false);
                return;
            } else {
                sendHandlerMessage(handler, Const.VNC_PASSWORD, "vnc_passwd", "passwd");
                vnc_passwd = a.getText().toString();
                vnc_allow_external = 1;
                // LimboSettingsManager.setVNCAllowExternal(activity, true);
            }

        }
    });
    alertDialog.setButton2("Cancel", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            vnc_passwd = null;
            vnc_allow_external = 0;
            mVNCAllowExternal.setChecked(false);
            // LimboSettingsManager.setVNCAllowExternal(activity, false);
            return;
        }
    });
    alertDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
        @Override
        public void onCancel(DialogInterface dialog) {
            mVNCAllowExternal.setChecked(false);
            // LimboSettingsManager.setVNCAllowExternal(activity, false);
            vnc_passwd = null;
            vnc_allow_external = 0;
        }
    });
    alertDialog.show();

}

From source file:biz.bokhorst.xprivacy.ActivityMain.java

private void applyFilter() {
    if (mAppAdapter != null) {
        ProgressBar pbFilter = (ProgressBar) findViewById(R.id.pbFilter);
        TextView tvStats = (TextView) findViewById(R.id.tvStats);
        TextView tvState = (TextView) findViewById(R.id.tvState);

        // Get settings
        int userId = Util.getUserId(Process.myUid());
        boolean fUsed = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFUsed, false);
        boolean fInternet = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFInternet, false);
        boolean fRestriction = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFRestriction,
                false);/*from  www  .j a  va2s.co m*/
        boolean fRestrictionNot = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFRestrictionNot,
                false);
        boolean fPermission = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFPermission, true);
        boolean fOnDemand = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFOnDemand, false);
        boolean fOnDemandNot = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFOnDemandNot,
                false);
        boolean fUser = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFUser, true);
        boolean fSystem = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFSystem, false);

        String filter = String.format("%s\n%b\n%b\n%b\n%b\n%b\n%b\n%b\n%b\n%b", searchQuery, fUsed, fInternet,
                fRestriction, fRestrictionNot, fPermission, fOnDemand, fOnDemandNot, fUser, fSystem);
        pbFilter.setVisibility(ProgressBar.VISIBLE);
        tvStats.setVisibility(TextView.GONE);

        // Adjust progress state width
        RelativeLayout.LayoutParams tvStateLayout = (RelativeLayout.LayoutParams) tvState.getLayoutParams();
        tvStateLayout.addRule(RelativeLayout.LEFT_OF, R.id.pbFilter);

        mAppAdapter.getFilter().filter(filter);
    }
}

From source file:com.example.health_connect.MySampleFragment3.java

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

    mView = inflater.inflate(R.layout.sample_fragment3, container, false);
    Parse.initialize(mView.getContext(), "e0FVFRBMAWJi5shg4XF8zL3SIuRwDIufww3338so",
            "toTJmlHTEF43u7PoAFT4fedwqfhoWiSajj1Se7FT");

    ParseUser currentUser = ParseUser.getCurrentUser();
    Log.d("Check", currentUser.getObjectId());
    ImageView birthdaypic = (ImageView) mView.findViewById(R.id.imageView2);
    TextView wish = (TextView) mView.findViewById(R.id.textView23);
    TextView hbday = (TextView) mView.findViewById(R.id.textView24);

    WebView webview = (WebView) mView.findViewById(R.id.pic);
    webview.setWebViewClient(new WebViewClient() {
        @Override//from ww w.j a v  a2  s  .com
        public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
            Log.i("WEB_VIEW_TEST", "error code: " + errorCode + " " + description);
            super.onReceivedError(view, errorCode, description, failingUrl);
        }
    });
    webview.getSettings().setJavaScriptEnabled(true);
    webview.getSettings().setDomStorageEnabled(true);
    String u_r_l;
    if (currentUser.getString("image_flag").equalsIgnoreCase("1")) {
        u_r_l = "http://cdn.filter.to/100x100/http://s3-ap-southeast-1.amazonaws.com/hconnect/"
                + currentUser.getObjectId();
    } else {
        u_r_l = "http://cdn.filter.to/100x100/cdn1.iconfinder.com/data/icons/PRACTIKA/256/user.png";
    }

    webview.loadUrl(u_r_l);

    String date_of_birth = currentUser.getString("Dob");

    Calendar c = Calendar.getInstance();
    SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
    String formattedDate = df.format(c.getTime());
    //Log.d("Check",formattedDate);
    String str[] = { "Every patient carries her or his own doctor inside.", "Laughter is the best medicine",
            "The art of medicine consists in amusing the patient while nature cures the disease.",
            "Health is wealth", "My health is good,it's my age that's bad.",
            "A healthy body is a guest-chamber for the soul; a sick body is a prison.",
            "Fitness:If it came in a bottle,everybody would have a good body.",
            "Ypu don't get ulcers form what you eat,but from what's eating you.",
            "Those who don't find time for exercise will have to find time for illness.",
            "Sickness comes on horseback and departs on foot.",
            "Health and appetite impart the sweetness to sugar,bread and meat.",
            "Health is not valued till sickness comes.", "Health is not simply the absence of sickness.",
            "To eat is a necessity,but to eat intelligently is an art.",
            "Let food be the medicine,thy medicine shall be thy food.", "Food is fuel,choose wisely.",
            "Health and intellect are the two blessings of life.", "The greatest wealth is health.",
            "Think positive and focus on gratitude.", "Get a good night's sleep.", "Use food over supplements.",
            "Eat 5 servings of fruits and veggies a day.", "Big idea: Be happy :)",
            "Drink water instead of surgery drinks.", "Swap big serves for smaller ones.",
            "Park the car and walk the rest of the way.",
            "No disease that can be treated by diet should be treated with any other means.",
            "Your body hears everything your mind says/",
            "Take care of your body. It's the only place you have to live.",
            "Every human being is the author of his own health or disease." };
    Random r = new Random();
    int High = 30; // 30 excluded
    int Low = 0;
    int random_number = r.nextInt(High - Low) + Low;

    if ((formattedDate.substring(0, 2).equalsIgnoreCase(date_of_birth.substring(0, 2)))
            && (formattedDate.substring(3, 5).equalsIgnoreCase(date_of_birth.substring(3, 5))))
    //   if(d1==d2 && m1==m2)
    {

    } else {
        //   Log.d("Check", d1);
        birthdaypic.setImageDrawable(null);
        wish.setText(null);
        hbday.setText(null);
        wish.setText(str[random_number]);
        //wish.setVisibility(View.GONE);
        hbday.setVisibility(View.GONE);
    }

    TextView a_name = (TextView) mView.findViewById(R.id.pdob);
    TextView a_eid = (TextView) mView.findViewById(R.id.textView8);
    TextView a_add = (TextView) mView.findViewById(R.id.textView10);
    TextView a_dob = (TextView) mView.findViewById(R.id.textView12);
    TextView a_lno = (TextView) mView.findViewById(R.id.textView14);
    TextView a_year = (TextView) mView.findViewById(R.id.textView16);
    TextView a_mschool = (TextView) mView.findViewById(R.id.textView18);
    TextView a_spec = (TextView) mView.findViewById(R.id.textView20);
    TextView a_deg = (TextView) mView.findViewById(R.id.textView22);
    a_name.setText(currentUser.getUsername());
    a_deg.setText(currentUser.getString("Degree"));
    a_dob.setText(currentUser.getString("Dob"));
    a_spec.setText(currentUser.getString("Primary_speciality"));
    a_mschool.setText(currentUser.getString("Medical_School"));
    a_add.setText(currentUser.getString("Address"));
    a_year.setText(currentUser.getString("Start_Practice"));
    a_eid.setText(currentUser.getEmail());
    a_lno.setText(currentUser.getString("LicenseNo"));

    return mView;
}

From source file:se.anyro.tagtider.TransferActivity.java

private void setupTransferData(final Bundle extras) {
    TextView trainView = (TextView) findViewById(R.id.train);

    ViewGroup originGroup = (ViewGroup) findViewById(R.id.origin_group);
    TextView originView = (TextView) findViewById(R.id.origin);
    TextView arrivalView = (TextView) findViewById(R.id.arrival);

    TextView stationTrackView = (TextView) findViewById(R.id.station_track);

    ViewGroup destinationGroup = (ViewGroup) findViewById(R.id.destination_group);
    TextView destinationView = (TextView) findViewById(R.id.destination);
    TextView departureView = (TextView) findViewById(R.id.departure);

    TextView commentView = (TextView) findViewById(R.id.comment);
    mEmptyView = (TextView) findViewById(android.R.id.empty);

    trainView.setText("Tg " + extras.getString("train") + " (" + extras.getString("type") + ")");

    String origin = extras.getString("origin");
    if (origin != null && origin.length() > 0) {
        originView.setText("Frn " + origin);
        originGroup.setVisibility(View.VISIBLE);
    } else {//from  www  .jav a  2  s  . c  o m
        originGroup.setVisibility(View.GONE);
    }

    String track = extras.getString("track");
    if (track == null || track.equalsIgnoreCase("x") || track.equalsIgnoreCase("null"))
        track = "";

    String arrival = extras.getString("arrival");
    if (arrival != null && !arrival.startsWith("0000")) {
        arrivalView.setText("Ankommer " + StringUtils.extractTime(arrival));
        String newArrival = extras.getString("newArrival");
        if (newArrival != null) {
            newArrival = StringUtils.extractTime(newArrival);
            SpannableString strike = new SpannableString(arrivalView.getText() + " " + newArrival);
            strike.setSpan(new StrikethroughSpan(), strike.length() - 11, strike.length() - 6, 0);
            arrivalView.setText(strike, TextView.BufferType.SPANNABLE);
        }
        if (track.length() == 0) {
            SpannableString strike = new SpannableString(arrivalView.getText());
            strike.setSpan(new StrikethroughSpan(), strike.length() - 5, strike.length(), 0);
            arrivalView.setText(strike, TextView.BufferType.SPANNABLE);
        }
    }

    if (extras.getString("stationName") != null) {
        mStationName = extras.getString("stationName");
    }

    if (track.length() > 0 && mStationName != null)
        stationTrackView.setText(mStationName + ", spr " + track);
    else if (mStationName != null)
        stationTrackView.setText(mStationName);
    else if (track.length() > 0)
        stationTrackView.setText("Spr " + track);
    else
        stationTrackView.setText("");

    String destination = extras.getString("destination");
    if (destination != null && destination.length() > 0) {
        destinationView.setText("Till " + destination);
        destinationGroup.setVisibility(View.VISIBLE);
    } else {
        destinationGroup.setVisibility(View.GONE);
    }

    String departure = extras.getString("departure");
    if (departure != null && !departure.startsWith("0000")) {
        departureView.setText("Avgr " + StringUtils.extractTime(departure));
        String newDeparture = extras.getString("newDeparture");
        if (newDeparture != null) {
            newDeparture = StringUtils.extractTime(newDeparture);
            SpannableString strike = new SpannableString(departureView.getText() + " " + newDeparture);
            strike.setSpan(new StrikethroughSpan(), strike.length() - 11, strike.length() - 6, 0);
            departureView.setText(strike, TextView.BufferType.SPANNABLE);
        }
        if (track.length() == 0) {
            SpannableString strike = new SpannableString(departureView.getText());
            strike.setSpan(new StrikethroughSpan(), strike.length() - 5, strike.length(), 0);
            departureView.setText(strike, TextView.BufferType.SPANNABLE);
        }
    }

    String comment = extras.getString("comment");
    if ((comment == null || comment.length() == 0) && track.length() == 0)
        comment = "Instllt";
    if (comment != null && comment.length() > 0) {
        commentView.setText(comment);
        commentView.setVisibility(View.VISIBLE);
    } else {
        commentView.setVisibility(View.GONE);
    }

    mTrain = extras.getString("train");
    mStationId = extras.getString("stationId");

    mTransferId = extras.getString("id");
}

From source file:com.google.samples.apps.iosched.ui.SessionsFragment.java

@Override
public void bindCollectionItemView(Context context, View view, int groupId, int indexInGroup, int dataIndex,
        Object tag) {/*w  ww. j  a  v a 2s  .  c om*/
    if (mCursor == null || !mCursor.moveToPosition(dataIndex)) {
        LOGW(TAG, "Can't bind collection view item, dataIndex=" + dataIndex
                + (mCursor == null ? ": cursor is null" : ": bad data index."));
        return;
    }

    final String sessionId = mCursor.getString(SessionsQuery.SESSION_ID);
    if (sessionId == null) {
        return;
    }

    // first, read session info from cursor and put it in convenience variables
    final String sessionTitle = mCursor.getString(SessionsQuery.TITLE);
    final String speakerNames = mCursor.getString(SessionsQuery.SPEAKER_NAMES);
    final String sessionAbstract = mCursor.getString(SessionsQuery.ABSTRACT);
    final long sessionStart = mCursor.getLong(SessionsQuery.SESSION_START);
    final long sessionEnd = mCursor.getLong(SessionsQuery.SESSION_END);
    final String roomName = mCursor.getString(SessionsQuery.ROOM_NAME);
    int sessionColor = mCursor.getInt(SessionsQuery.COLOR);
    sessionColor = sessionColor == 0 ? getResources().getColor(R.color.default_session_color) : sessionColor;
    int darkSessionColor = 0;
    final String snippet = mIsSearchCursor ? mCursor.getString(SessionsQuery.SNIPPET) : null;
    final Spannable styledSnippet = mIsSearchCursor ? buildStyledSnippet(snippet) : null;
    final boolean starred = mCursor.getInt(SessionsQuery.IN_MY_SCHEDULE) != 0;
    final String[] tags = mCursor.getString(SessionsQuery.TAGS).split(",");

    // now let's compute a few pieces of information from the data, which we will use
    // later to decide what to render where
    final boolean hasLivestream = !TextUtils.isEmpty(mCursor.getString(SessionsQuery.LIVESTREAM_URL));
    final long now = UIUtils.getCurrentTime(context);
    final boolean happeningNow = now >= sessionStart && now <= sessionEnd;

    // text that says "LIVE" if session is live, or empty if session is not live
    final String liveNowText = hasLivestream ? " " + UIUtils.getLiveBadgeText(context, sessionStart, sessionEnd)
            : "";

    // get reference to all the views in the layout we will need
    final TextView titleView = (TextView) view.findViewById(R.id.session_title);
    final TextView subtitleView = (TextView) view.findViewById(R.id.session_subtitle);
    final TextView shortSubtitleView = (TextView) view.findViewById(R.id.session_subtitle_short);
    final TextView snippetView = (TextView) view.findViewById(R.id.session_snippet);
    final TextView abstractView = (TextView) view.findViewById(R.id.session_abstract);
    final TextView categoryView = (TextView) view.findViewById(R.id.session_category);
    final View sessionTargetView = view.findViewById(R.id.session_target);

    if (sessionColor == 0) {
        // use default
        sessionColor = mDefaultSessionColor;
    }

    if (mNoTrackBranding) {
        sessionColor = getResources().getColor(R.color.no_track_branding_session_color);
    }

    darkSessionColor = UIUtils.scaleSessionColorToDefaultBG(sessionColor);

    ImageView photoView = (ImageView) view.findViewById(R.id.session_photo_colored);
    if (photoView != null) {
        if (!mPreloader.isDimensSet()) {
            final ImageView finalPhotoView = photoView;
            photoView.post(new Runnable() {
                @Override
                public void run() {
                    mPreloader.setDimens(finalPhotoView.getWidth(), finalPhotoView.getHeight());
                }
            });
        }
        // colored
        photoView
                .setColorFilter(mNoTrackBranding
                        ? new PorterDuffColorFilter(
                                getResources().getColor(R.color.no_track_branding_session_tile_overlay),
                                PorterDuff.Mode.SRC_ATOP)
                        : UIUtils.makeSessionImageScrimColorFilter(darkSessionColor));
    } else {
        photoView = (ImageView) view.findViewById(R.id.session_photo);
    }
    ViewCompat.setTransitionName(photoView, "photo_" + sessionId);

    // when we load a photo, it will fade in from transparent so the
    // background of the container must be the session color to avoid a white flash
    ViewParent parent = photoView.getParent();
    if (parent != null && parent instanceof View) {
        ((View) parent).setBackgroundColor(darkSessionColor);
    } else {
        photoView.setBackgroundColor(darkSessionColor);
    }

    String photo = mCursor.getString(SessionsQuery.PHOTO_URL);
    if (!TextUtils.isEmpty(photo)) {
        mImageLoader.loadImage(photo, photoView, true /*crop*/);
    } else {
        // cleaning the (potentially) recycled photoView, in case this session has no photo:
        photoView.setImageDrawable(null);
    }

    // render title
    titleView.setText(sessionTitle == null ? "?" : sessionTitle);

    // render subtitle into either the subtitle view, or the short subtitle view, as available
    if (subtitleView != null) {
        subtitleView.setText(UIUtils.formatSessionSubtitle(sessionStart, sessionEnd, roomName, mBuffer, context)
                + liveNowText);
    } else if (shortSubtitleView != null) {
        shortSubtitleView.setText(
                UIUtils.formatSessionSubtitle(sessionStart, sessionEnd, roomName, mBuffer, context, true)
                        + liveNowText);
    }

    // render category
    if (categoryView != null) {
        TagMetadata.Tag groupTag = mTagMetadata.getSessionGroupTag(tags);
        if (groupTag != null && !Config.Tags.SESSIONS.equals(groupTag.getId())) {
            categoryView.setText(groupTag.getName());
            categoryView.setVisibility(View.VISIBLE);
        } else {
            categoryView.setVisibility(View.GONE);
        }
    }

    // if a snippet view is available, render the session snippet there.
    if (snippetView != null) {
        if (mIsSearchCursor) {
            // render the search snippet into the snippet view
            snippetView.setText(styledSnippet);
        } else {
            // render speaker names and abstracts into the snippet view
            mBuffer.setLength(0);
            if (!TextUtils.isEmpty(speakerNames)) {
                mBuffer.append(speakerNames).append(". ");
            }
            if (!TextUtils.isEmpty(sessionAbstract)) {
                mBuffer.append(sessionAbstract);
            }
            snippetView.setText(mBuffer.toString());
        }
    }

    if (abstractView != null && !mIsSearchCursor) {
        // render speaker names and abstracts into the abstract view
        mBuffer.setLength(0);
        if (!TextUtils.isEmpty(speakerNames)) {
            mBuffer.append(speakerNames).append("\n\n");
        }
        if (!TextUtils.isEmpty(sessionAbstract)) {
            mBuffer.append(sessionAbstract);
        }
        abstractView.setText(mBuffer.toString());
    }

    // show or hide the "in my schedule" indicator
    view.findViewById(R.id.indicator_in_schedule).setVisibility(starred ? View.VISIBLE : View.INVISIBLE);

    // if we are in condensed mode and this card is the hero card (big card at the top
    // of the screen), set up the message card if necessary.
    if (!useExpandedMode() && groupId == HERO_GROUP_ID) {
        // this is the hero view, so we might want to show a message card
        final boolean cardShown = setupMessageCard(view);

        // if this is the wide hero layout, show or hide the card or the session abstract
        // view, as appropriate (they are mutually exclusive).
        final View cardContainer = view.findViewById(R.id.message_card_container_wide);
        final View abstractContainer = view.findViewById(R.id.session_abstract);
        if (cardContainer != null && abstractContainer != null) {
            cardContainer.setVisibility(cardShown ? View.VISIBLE : View.GONE);
            abstractContainer.setVisibility(cardShown ? View.GONE : View.VISIBLE);
            abstractContainer.setBackgroundColor(darkSessionColor);
        }
    }

    // if this session is live right now, display the "LIVE NOW" icon on top of it
    View liveNowBadge = view.findViewById(R.id.live_now_badge);
    if (liveNowBadge != null) {
        liveNowBadge.setVisibility(happeningNow && hasLivestream ? View.VISIBLE : View.GONE);
    }

    // if this view is clicked, open the session details view
    final View finalPhotoView = photoView;
    sessionTargetView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mCallbacks.onSessionSelected(sessionId, finalPhotoView);
        }
    });

    // animate this card
    if (dataIndex > mMaxDataIndexAnimated) {
        mMaxDataIndexAnimated = dataIndex;
    }
}

From source file:com.filemanager.free.activities.MainActivity.java

public void updatePath(@NonNull final String news, boolean results, int openmode, int folder_count,
        int file_count) {

    if (news.length() == 0)
        return;// w  w  w  . j  ava 2 s  .  co  m
    if (news == null)
        return;
    if (openmode == 1 && news.startsWith("smb:/"))
        newPath = mainActivityHelper.parseSmbPath(news);
    else if (openmode == 2)
        newPath = mainActivityHelper.getIntegralNames(news);
    else
        newPath = news;
    final TextView bapath = (TextView) pathbar.findViewById(R.id.fullpath);
    final TextView animPath = (TextView) pathbar.findViewById(R.id.fullpath_anim);
    TextView textView = (TextView) pathbar.findViewById(R.id.pathname);
    if (!results) {
        textView.setText(folder_count + " " + getResources().getString(R.string.folders) + "" + " " + file_count
                + " " + getResources().getString(R.string.files));
    } else {
        bapath.setText(R.string.searchresults);
        textView.setText(R.string.empty);
        return;
    }
    final String oldPath = bapath.getText().toString();
    if (null != oldPath && oldPath.equals(newPath))
        return;

    // implement animation while setting text
    newPathBuilder = new StringBuffer().append(newPath);
    oldPathBuilder = new StringBuffer().append(oldPath);

    final Animation slideIn = AnimationUtils.loadAnimation(this, R.anim.slide_in);
    Animation slideOut = AnimationUtils.loadAnimation(this, R.anim.slide_out);

    if (newPath.length() > oldPath.length()
            && newPathBuilder.delete(oldPath.length(), newPath.length()).toString().equals(oldPath)
            && oldPath.length() != 0) {

        // navigate forward
        newPathBuilder.delete(0, newPathBuilder.length());
        newPathBuilder.append(newPath);
        newPathBuilder.delete(0, oldPath.length());
        animPath.setAnimation(slideIn);
        animPath.animate().setListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                new Handler().postDelayed(new Runnable() {
                    @Override
                    public void run() {

                        animPath.setVisibility(View.GONE);
                        bapath.setText(newPath);
                    }
                }, PATH_ANIM_END_DELAY);
            }

            @Override
            public void onAnimationStart(Animator animation) {
                super.onAnimationStart(animation);
                animPath.setVisibility(View.VISIBLE);
                animPath.setText(newPathBuilder.toString());
                //bapath.setText(oldPath);

                scroll.post(new Runnable() {
                    @Override
                    public void run() {
                        scroll1.fullScroll(View.FOCUS_RIGHT);
                    }
                });
            }

            @Override
            public void onAnimationCancel(Animator animation) {
                super.onAnimationCancel(animation);
                //onAnimationEnd(animation);
            }
        }).setStartDelay(PATH_ANIM_START_DELAY).start();
    } else if (newPath.length() < oldPath.length()
            && oldPathBuilder.delete(newPath.length(), oldPath.length()).toString().equals(newPath)) {

        // navigate backwards
        oldPathBuilder.delete(0, oldPathBuilder.length());
        oldPathBuilder.append(oldPath);
        oldPathBuilder.delete(0, newPath.length());
        animPath.setAnimation(slideOut);
        animPath.animate().setListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                animPath.setVisibility(View.GONE);
                bapath.setText(newPath);

                scroll.post(new Runnable() {
                    @Override
                    public void run() {
                        scroll1.fullScroll(View.FOCUS_RIGHT);
                    }
                });
            }

            @Override
            public void onAnimationStart(Animator animation) {
                super.onAnimationStart(animation);
                animPath.setVisibility(View.VISIBLE);
                animPath.setText(oldPathBuilder.toString());
                bapath.setText(newPath);

                scroll.post(new Runnable() {
                    @Override
                    public void run() {
                        scroll1.fullScroll(View.FOCUS_LEFT);
                    }
                });
            }
        }).setStartDelay(PATH_ANIM_START_DELAY).start();
    } else if (oldPath.isEmpty()) {

        // case when app starts
        // FIXME: COUNTER is incremented twice on app startup
        COUNTER++;
        if (COUNTER == 2) {

            animPath.setAnimation(slideIn);
            animPath.setText(newPath);
            animPath.animate().setListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationStart(Animator animation) {
                    super.onAnimationStart(animation);
                    animPath.setVisibility(View.VISIBLE);
                    bapath.setText("");
                    scroll.post(new Runnable() {
                        @Override
                        public void run() {
                            scroll1.fullScroll(View.FOCUS_RIGHT);
                        }
                    });
                }

                @Override
                public void onAnimationEnd(Animator animation) {
                    super.onAnimationEnd(animation);
                    new Handler().postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            animPath.setVisibility(View.GONE);
                            bapath.setText(newPath);
                        }
                    }, PATH_ANIM_END_DELAY);
                }

                @Override
                public void onAnimationCancel(Animator animation) {
                    super.onAnimationCancel(animation);
                    //onAnimationEnd(animation);
                }
            }).setStartDelay(PATH_ANIM_START_DELAY).start();
        }

    } else {

        // completely different path
        // first slide out of old path followed by slide in of new path
        animPath.setAnimation(slideOut);
        animPath.animate().setListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationStart(Animator animator) {
                super.onAnimationStart(animator);
                animPath.setVisibility(View.VISIBLE);
                animPath.setText(oldPath);
                bapath.setText("");

                scroll.post(new Runnable() {
                    @Override
                    public void run() {
                        scroll1.fullScroll(View.FOCUS_LEFT);
                    }
                });
            }

            @Override
            public void onAnimationEnd(Animator animator) {
                super.onAnimationEnd(animator);

                //animPath.setVisibility(View.GONE);
                animPath.setText(newPath);
                bapath.setText("");
                animPath.setAnimation(slideIn);

                animPath.animate().setListener(new AnimatorListenerAdapter() {
                    @Override
                    public void onAnimationEnd(Animator animation) {
                        super.onAnimationEnd(animation);
                        new Handler().postDelayed(new Runnable() {
                            @Override
                            public void run() {
                                animPath.setVisibility(View.GONE);
                                bapath.setText(newPath);
                            }
                        }, PATH_ANIM_END_DELAY);
                    }

                    @Override
                    public void onAnimationStart(Animator animation) {
                        super.onAnimationStart(animation);
                        // we should not be having anything here in path bar
                        animPath.setVisibility(View.VISIBLE);
                        bapath.setText("");
                        scroll.post(new Runnable() {
                            @Override
                            public void run() {
                                scroll1.fullScroll(View.FOCUS_RIGHT);
                            }
                        });
                    }
                }).start();
            }

            @Override
            public void onAnimationCancel(Animator animation) {
                super.onAnimationCancel(animation);
                //onAnimationEnd(animation);
            }
        }).setStartDelay(PATH_ANIM_START_DELAY).start();
    }
}

From source file:com.amaze.filemanager.activities.MainActivity.java

public void updatePath(@NonNull final String news, boolean results, int openmode, int folder_count,
        int file_count) {

    if (news.length() == 0)
        return;/*from w ww  . j a  va2  s  .  c o  m*/
    if (news == null)
        return;
    if (openmode == 1 && news.startsWith("smb:/"))
        newPath = mainActivityHelper.parseSmbPath(news);
    else if (openmode == 2)
        newPath = mainActivityHelper.getIntegralNames(news);
    else
        newPath = news;
    final TextView bapath = (TextView) pathbar.findViewById(R.id.fullpath);
    final TextView animPath = (TextView) pathbar.findViewById(R.id.fullpath_anim);
    TextView textView = (TextView) pathbar.findViewById(R.id.pathname);
    if (!results) {
        textView.setText(folder_count + " " + getResources().getString(R.string.folders) + "" + " " + file_count
                + " " + getResources().getString(R.string.files));
    } else {
        bapath.setText(R.string.searchresults);
        textView.setText(R.string.empty);
        return;
    }
    final String oldPath = bapath.getText().toString();
    if (oldPath != null && oldPath.equals(newPath))
        return;

    // implement animation while setting text
    newPathBuilder = new StringBuffer().append(newPath);
    oldPathBuilder = new StringBuffer().append(oldPath);

    final Animation slideIn = AnimationUtils.loadAnimation(this, R.anim.slide_in);
    Animation slideOut = AnimationUtils.loadAnimation(this, R.anim.slide_out);

    if (newPath.length() > oldPath.length()
            && newPathBuilder.delete(oldPath.length(), newPath.length()).toString().equals(oldPath)
            && oldPath.length() != 0) {

        // navigate forward
        newPathBuilder.delete(0, newPathBuilder.length());
        newPathBuilder.append(newPath);
        newPathBuilder.delete(0, oldPath.length());
        animPath.setAnimation(slideIn);
        animPath.animate().setListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                new Handler().postDelayed(new Runnable() {
                    @Override
                    public void run() {

                        animPath.setVisibility(View.GONE);
                        bapath.setText(newPath);
                    }
                }, PATH_ANIM_END_DELAY);
            }

            @Override
            public void onAnimationStart(Animator animation) {
                super.onAnimationStart(animation);
                animPath.setVisibility(View.VISIBLE);
                animPath.setText(newPathBuilder.toString());
                //bapath.setText(oldPath);

                scroll.post(new Runnable() {
                    @Override
                    public void run() {
                        scroll1.fullScroll(View.FOCUS_RIGHT);
                    }
                });
            }

            @Override
            public void onAnimationCancel(Animator animation) {
                super.onAnimationCancel(animation);
                //onAnimationEnd(animation);
            }
        }).setStartDelay(PATH_ANIM_START_DELAY).start();
    } else if (newPath.length() < oldPath.length()
            && oldPathBuilder.delete(newPath.length(), oldPath.length()).toString().equals(newPath)) {

        // navigate backwards
        oldPathBuilder.delete(0, oldPathBuilder.length());
        oldPathBuilder.append(oldPath);
        oldPathBuilder.delete(0, newPath.length());
        animPath.setAnimation(slideOut);
        animPath.animate().setListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                animPath.setVisibility(View.GONE);
                bapath.setText(newPath);

                scroll.post(new Runnable() {
                    @Override
                    public void run() {
                        scroll1.fullScroll(View.FOCUS_RIGHT);
                    }
                });
            }

            @Override
            public void onAnimationStart(Animator animation) {
                super.onAnimationStart(animation);
                animPath.setVisibility(View.VISIBLE);
                animPath.setText(oldPathBuilder.toString());
                bapath.setText(newPath);

                scroll.post(new Runnable() {
                    @Override
                    public void run() {
                        scroll1.fullScroll(View.FOCUS_LEFT);
                    }
                });
            }
        }).setStartDelay(PATH_ANIM_START_DELAY).start();
    } else if (oldPath.isEmpty()) {

        // case when app starts
        // FIXME: COUNTER is incremented twice on app startup
        COUNTER++;
        if (COUNTER == 2) {

            animPath.setAnimation(slideIn);
            animPath.setText(newPath);
            animPath.animate().setListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationStart(Animator animation) {
                    super.onAnimationStart(animation);
                    animPath.setVisibility(View.VISIBLE);
                    bapath.setText("");
                    scroll.post(new Runnable() {
                        @Override
                        public void run() {
                            scroll1.fullScroll(View.FOCUS_RIGHT);
                        }
                    });
                }

                @Override
                public void onAnimationEnd(Animator animation) {
                    super.onAnimationEnd(animation);
                    new Handler().postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            animPath.setVisibility(View.GONE);
                            bapath.setText(newPath);
                        }
                    }, PATH_ANIM_END_DELAY);
                }

                @Override
                public void onAnimationCancel(Animator animation) {
                    super.onAnimationCancel(animation);
                    //onAnimationEnd(animation);
                }
            }).setStartDelay(PATH_ANIM_START_DELAY).start();
        }

    } else {

        // completely different path
        // first slide out of old path followed by slide in of new path
        animPath.setAnimation(slideOut);
        animPath.animate().setListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationStart(Animator animator) {
                super.onAnimationStart(animator);
                animPath.setVisibility(View.VISIBLE);
                animPath.setText(oldPath);
                bapath.setText("");

                scroll.post(new Runnable() {
                    @Override
                    public void run() {
                        scroll1.fullScroll(View.FOCUS_LEFT);
                    }
                });
            }

            @Override
            public void onAnimationEnd(Animator animator) {
                super.onAnimationEnd(animator);

                //animPath.setVisibility(View.GONE);
                animPath.setText(newPath);
                bapath.setText("");
                animPath.setAnimation(slideIn);

                animPath.animate().setListener(new AnimatorListenerAdapter() {
                    @Override
                    public void onAnimationEnd(Animator animation) {
                        super.onAnimationEnd(animation);
                        new Handler().postDelayed(new Runnable() {
                            @Override
                            public void run() {
                                animPath.setVisibility(View.GONE);
                                bapath.setText(newPath);
                            }
                        }, PATH_ANIM_END_DELAY);
                    }

                    @Override
                    public void onAnimationStart(Animator animation) {
                        super.onAnimationStart(animation);
                        // we should not be having anything here in path bar
                        animPath.setVisibility(View.VISIBLE);
                        bapath.setText("");
                        scroll.post(new Runnable() {
                            @Override
                            public void run() {
                                scroll1.fullScroll(View.FOCUS_RIGHT);
                            }
                        });
                    }
                }).start();
            }

            @Override
            public void onAnimationCancel(Animator animation) {
                super.onAnimationCancel(animation);
                //onAnimationEnd(animation);
            }
        }).setStartDelay(PATH_ANIM_START_DELAY).start();
    }
}

From source file:com.example.android.lightcontrol.MainActivity.java

private void theme_to_who() {
    LayoutInflater inflater = LayoutInflater.from(this);
    final View v = inflater.inflate(R.layout.theme_to_who, null);
    final AlertDialog.Builder dialog = new AlertDialog.Builder(this);

    Spinner theme_to_who = (Spinner) v.findViewById(R.id.theme_to_who);
    final Spinner theme_to_area1 = (Spinner) v.findViewById(R.id.area_1);
    final Spinner theme_to_area2 = (Spinner) v.findViewById(R.id.area_2);
    final TextView region1 = (TextView) v.findViewById(R.id.textView16);
    final TextView region2 = (TextView) v.findViewById(R.id.textView17);
    ArrayAdapter<String> arr_theme_to_who_list;
    ArrayAdapter<String> arr_theme_to_area1_list;
    ArrayAdapter<String> arr_theme_to_area2_list;
    final String[] theme_to_who_list = { "All Lights", "Group" };
    final String[] theme_to_area1_list = { "Group 1" };
    final String[] theme_to_area2_list = { "Group 2" };
    arr_theme_to_who_list = new ArrayAdapter<String>(this, R.layout.my_spinner, theme_to_who_list);
    theme_to_who.setAdapter(arr_theme_to_who_list);
    arr_theme_to_area1_list = new ArrayAdapter<String>(this, R.layout.my_spinner, theme_to_area1_list);
    theme_to_area1.setAdapter(arr_theme_to_area1_list);
    arr_theme_to_area2_list = new ArrayAdapter<String>(this, R.layout.my_spinner, theme_to_area2_list);
    theme_to_area2.setAdapter(arr_theme_to_area2_list);

    theme_to_who.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override//from w  w  w  . j av a 2s  .co m
        public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
            if (theme_to_who_list[i].equals("All Lights")) {
                theme_to_area1.setVisibility(View.INVISIBLE);
                theme_to_area2.setVisibility(View.INVISIBLE);
                region1.setVisibility(View.INVISIBLE);
                region2.setVisibility(View.INVISIBLE);
                GlobalVariable.Theme_to_group_or_all = "ff";
                GlobalVariable.Theme_to_area1_group_8X = "";
                GlobalVariable.Theme_to_area2_group_8X = "";
            }
            if (theme_to_who_list[i].equals("Group")) {
                GlobalVariable.Theme_to_group_or_all = "8";
                theme_to_area1.setVisibility(View.VISIBLE);
                theme_to_area2.setVisibility(View.VISIBLE);
                region1.setVisibility(View.VISIBLE);
                region2.setVisibility(View.VISIBLE);
            }

        }

        @Override
        public void onNothingSelected(AdapterView<?> adapterView) {

        }
    });

    theme_to_area1.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {

            if (theme_to_area1_list[i].equals("Group 1")) {
                GlobalVariable.Theme_to_area1_group_8X = "1";
            }

        }

        @Override
        public void onNothingSelected(AdapterView<?> adapterView) {

        }
    });

    theme_to_area2.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {

            if (theme_to_area2_list[i].equals("Group 2")) {
                GlobalVariable.Theme_to_area2_group_8X = "3";
            }

        }

        @Override
        public void onNothingSelected(AdapterView<?> adapterView) {

        }
    });

    dialog.setCancelable(false);
    dialog.setTitle(R.string.about_title);
    dialog.setView(v);
    dialog.setPositiveButton(R.string.ok_label_1, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialoginterface, int i) {

        }
    });
    dialog.show();

}