Example usage for android.widget ImageView setVisibility

List of usage examples for android.widget ImageView setVisibility

Introduction

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

Prototype

@RemotableViewMethod
    @Override
    public void setVisibility(int visibility) 

Source Link

Usage

From source file:im.neon.adapters.VectorMessagesAdapter.java

/**
 * Display the read receipts within the dedicated vector layout.
 * Console application displays them on the message side.
 * Vector application displays them in a dedicated line under the message
 * @param avatarsListView the read receipts layout
 * @param eventId the event Id.//from   w  ww.j  ava2 s .  c o  m
 * @param roomState the room state.
 */
private void displayReadReceipts(final View avatarsListView, final String eventId, final RoomState roomState) {
    if (!mSession.isAlive()) {
        return;
    }

    IMXStore store = mSession.getDataHandler().getStore();

    // sanity check
    if (null == roomState) {
        avatarsListView.setVisibility(View.GONE);
        return;
    }

    // hide the read receipts until there is a way to retrieve them
    // without triggering a request per message
    if (mIsPreviewMode) {
        avatarsListView.setVisibility(View.GONE);
        return;
    }

    List<ReceiptData> receipts = store.getEventReceipts(roomState.roomId, eventId, true, true);

    // if there is no receipt to display
    // hide the dedicated layout
    if ((null == receipts) || (0 == receipts.size())) {
        avatarsListView.setVisibility(View.GONE);
        return;
    }

    avatarsListView.setVisibility(View.VISIBLE);

    ArrayList<View> imageViews = new ArrayList<>();

    imageViews.add(avatarsListView.findViewById(R.id.message_avatar_receipt_1)
            .findViewById(org.matrix.androidsdk.R.id.avatar_img));
    imageViews.add(avatarsListView.findViewById(R.id.message_avatar_receipt_2)
            .findViewById(org.matrix.androidsdk.R.id.avatar_img));
    imageViews.add(avatarsListView.findViewById(R.id.message_avatar_receipt_3)
            .findViewById(org.matrix.androidsdk.R.id.avatar_img));
    imageViews.add(avatarsListView.findViewById(R.id.message_avatar_receipt_4)
            .findViewById(org.matrix.androidsdk.R.id.avatar_img));
    imageViews.add(avatarsListView.findViewById(R.id.message_avatar_receipt_5)
            .findViewById(org.matrix.androidsdk.R.id.avatar_img));

    TextView moreText = (TextView) avatarsListView.findViewById(R.id.message_more_than_expected);

    int index = 0;
    int bound = Math.min(receipts.size(), imageViews.size());

    for (; index < bound; index++) {
        final ReceiptData r = receipts.get(index);
        RoomMember member = roomState.getMember(r.userId);
        ImageView imageView = (ImageView) imageViews.get(index);

        imageView.setVisibility(View.VISIBLE);
        imageView.setTag(null);

        if (null != member) {
            VectorUtils.loadRoomMemberAvatar(mContext, mSession, imageView, member);
        } else {
            // should never happen
            VectorUtils.loadUserAvatar(mContext, mSession, imageView, null, r.userId, r.userId);
        }
    }

    moreText.setVisibility((receipts.size() <= imageViews.size()) ? View.GONE : View.VISIBLE);
    moreText.setText((receipts.size() - imageViews.size()) + "+");

    for (; index < imageViews.size(); index++) {
        imageViews.get(index).setVisibility(View.INVISIBLE);
    }

    if (receipts.size() > 0) {
        avatarsListView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (null != mMessagesAdapterEventsListener) {
                    mMessagesAdapterEventsListener.onMoreReadReceiptClick(eventId);
                }
            }
        });
    } else {
        avatarsListView.setOnClickListener(null);
    }
}

From source file:io.plaidapp.designernews.ui.story.StoryActivity.java

private void bindDescription() {
    final TextView storyComment = header.findViewById(R.id.story_comment);
    if (!TextUtils.isEmpty(story.getComment())) {

        ColorStateList linksColor = ContextCompat.getColorStateList(this, R.color.designer_news_links);
        int highlightColor = ContextCompat.getColor(this, io.plaidapp.R.color.designer_news_link_highlight);

        CharSequence text = HtmlUtils.parseMarkdownAndPlainLinks(story.getComment(), markdown, linksColor,
                highlightColor,/*from   w ww. ja  v a 2  s  .  c  om*/
                (src, loadingSpan) -> GlideApp.with(StoryActivity.this).asBitmap().load(src)
                        .transition(BitmapTransitionOptions.withCrossFade())
                        .diskCacheStrategy(DiskCacheStrategy.ALL)
                        .into(new ImageSpanTarget(storyComment, loadingSpan)));

        HtmlUtils.setTextWithNiceLinks(storyComment, text);

    } else {
        storyComment.setVisibility(View.GONE);
    }

    upvoteStory = header.findViewById(R.id.story_vote_action);
    storyUpvoted(story.getVoteCount());
    upvoteStory.setOnClickListener(v -> upvoteStory());

    final TextView share = header.findViewById(R.id.story_share_action);
    share.setOnClickListener(v -> {
        ((AnimatedVectorDrawable) share.getCompoundDrawables()[1]).start();
        ShareCompat.IntentBuilder.from(StoryActivity.this).setText(story.getUrl()).setType("text/plain")
                .setSubject(story.getTitle()).startChooser();
    });

    TextView storyPosterTime = header.findViewById(R.id.story_poster_time);
    if (story.getUserDisplayName() != null && story.getUserJob() != null) {
        CharSequence storyPosterTimeText = getStoryPosterTimeText(story.getUserDisplayName(),
                story.getUserJob(), story.getCreatedAt());
        storyPosterTime.setText(storyPosterTimeText);
    }
    ImageView avatar = header.findViewById(R.id.story_poster_avatar);
    if (!TextUtils.isEmpty(story.getUserPortraitUrl())) {
        GlideApp.with(this).load(story.getUserPortraitUrl()).transition(withCrossFade())
                .placeholder(io.plaidapp.R.drawable.avatar_placeholder).circleCrop().into(avatar);
    } else {
        avatar.setVisibility(View.GONE);
    }
}

From source file:com.example.android.navigationdrawerexample.Controller.PilihanController.java

private void selectItem(int position) {
    // update the main content by replacing fragments
    /*Fragment fragment = new PlanetFragment();*/
    fragment = null;//from  w  w  w  . ja va 2s  .  c o m
    Bundle args = new Bundle();

    switch (position) {
    case 0:
        fragment = new Fragment() {
            @Override
            public void onResume() {
                super.onResume();
                new GetAllJadwalTask(PilihanController.this).execute(username);
            }

            @Override
            public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
                StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
                StrictMode.setThreadPolicy(policy);

                View view = inflater.inflate(R.layout.list_jadwal, container, false);
                GetAllJadwalListView = (ExpandableListView) view.findViewById(R.id.GetAllJadwalListView);
                ImageView buat = (ImageView) view.findViewById(R.id.button);
                //Button pilihan = (Button) view.findViewById(R.id.button9);
                if (role == 0)
                    buat.setVisibility(View.GONE);
                else
                    buat.setVisibility(View.VISIBLE);

                new GetAllJadwalTask(PilihanController.this).execute(username);

                GetAllJadwalListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {

                    @Override
                    public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
                        GetAllJadwalListView.expandGroup(groupPosition);
                        return true;
                    }
                });

                GetAllJadwalListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {

                    @Override
                    public boolean onChildClick(ExpandableListView parent, View v, int groupPosition,
                            int childPosition, long id) {
                        try {
                            //Toast.makeText(getApplicationContext(), listDataChild2.get(listDataHeader2.get(groupPosition)).get(childPosition).toString(), Toast.LENGTH_LONG).show();
                            int jadwalp = listDataChild2.get(listDataHeader2.get(groupPosition))
                                    .get(childPosition).getInt("Id");
                            int kelasp = listDataChild2.get(listDataHeader2.get(groupPosition))
                                    .get(childPosition).getInt("Id_kelas");
                            ////                                    JSONObject mahasiswaClicked = jsonArray.getJSONObject(groupPosition+childPosition);
                            ////                                    int jadwalp = mahasiswaClicked.getInt("Id");
                            ////                                    int kelasp = mahasiswaClicked.getInt("Id_kelas");
                            Intent showDetails = new Intent(getActivity(), JadwalController.class);
                            showDetails.putExtra("JadwalID", jadwalp);
                            showDetails.putExtra("KelasID", kelasp);
                            showDetails.putExtra("Username", username);
                            showDetails.putExtra("View", "detailJadwal");
                            startActivity(showDetails);

                        } catch (JSONException e) {
                            e.printStackTrace();
                            //Toast.makeText(getApplicationContext(), "lala masuk ex", Toast.LENGTH_LONG).show();
                        }
                        return false;
                    }
                });

                buat.setOnClickListener(new View.OnClickListener() {

                    @Override
                    public void onClick(View v) {

                        Intent showDetails = new Intent(getActivity(), JadwalController.class);
                        //asumsi username gak null
                        showDetails.putExtra("Username", username);
                        showDetails.putExtra("View", "createJadwal");

                        startActivity(showDetails);
                    }
                });
                return view;
            }
        };
        args.putString(FragmentOne.ITEM_NAME, dataList.get(position).getItemName());
        args.putInt(FragmentOne.IMAGE_RESOURCE_ID, dataList.get(position).getImgResID());
        args.putInt("role", 2);
        break;
    case 1:
        fragment = new RoleFragment();
        args.putInt("role", 1);
        break;
    case 2:
        fragment = new Fragment() {
            @Override
            public void onResume() {
                super.onResume();
                new GetAllEnrollTask(PilihanController.this).execute(username);
            }

            @Override
            public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
                StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
                StrictMode.setThreadPolicy(policy);

                view = inflater.inflate(R.layout.list_enroll, container, false);

                //GetAllEnrollListView = (ListView) view.findViewById(R.id.GetAllJadwalListView);
                ImageView enroll = (ImageView) view.findViewById(R.id.button);
                expListView = (ExpandableListView) view.findViewById(R.id.lvExp);

                new GetAllEnrollTask(PilihanController.this).execute(username);

                expListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {

                    @Override
                    public boolean onChildClick(ExpandableListView parent, View v, int groupPosition,
                            int childPosition, long id) {
                        //asumsikan kalo dipencet bisa ngeluarin infromasi asistennya
                        //viewnya di view_profile_personal
                        //kelasnya inten, nah loh pake controller mana nih??
                        //asumsikan gue punya kelas ProfileAsdos.java
                        String userAsdos = listDataChild.get(listDataHeader.get(groupPosition))
                                .get(childPosition);
                        Intent showDetails = new Intent(getActivity(), MenjabatController.class);
                        showDetails.putExtra("Username", userAsdos);
                        startActivity(showDetails);
                        return false;
                    }
                });

                enroll.setOnClickListener(new View.OnClickListener() {

                    @Override
                    public void onClick(View v) {

                        Intent showDetails = new Intent(getActivity(), EnrollController.class);
                        showDetails.putExtra("Username", username);
                        startActivity(showDetails);
                    }
                });
                return view;
            }

        };
        args.putInt("role", 0);
        break;
    case 3:
        fragment = new Fragment() {
            @Override
            public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
                StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
                StrictMode.setThreadPolicy(policy);

                View view = inflater.inflate(R.layout.choose_forum, container, false);

                Button buttonForumReply = (Button) view.findViewById(R.id.choose_forum_1);
                Button buttonForumForum = (Button) view.findViewById(R.id.choose_forum_2);
                Button buttonForumPolling = (Button) view.findViewById(R.id.choose_forum_3);

                buttonForumReply.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        Intent intent = new Intent(getActivity(), ForumQA.class);
                        intent.putExtra("Username", username);
                        startActivity(intent);
                    }
                });

                buttonForumForum.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        Intent intent = new Intent(getActivity(), ForumRequest.class);
                        intent.putExtra("Username", username);
                        startActivity(intent);
                    }
                });

                buttonForumPolling.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        Intent intent = new Intent(getActivity(), ForumPolling.class);
                        intent.putExtra("Username", username);
                        startActivity(intent);
                    }
                });

                return view;
            }

        };
        args.putInt("role", 3);
        break;
    case 4:
        //ProfileController profileController2 = new ProfileController(username);
        if (role == 2) {
            fragment = new Fragment() {

                @Override
                public View onCreateView(LayoutInflater inflater, ViewGroup container,
                        Bundle savedInstanceState) {
                    StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
                    StrictMode.setThreadPolicy(policy);

                    view = inflater.inflate(R.layout.admin, container, false);

                    //GetAllEnrollListView = (ListView) view.findViewById(R.id.GetAllJadwalListView);
                    Button kelas = (Button) view.findViewById(R.id.button9);
                    Button role = (Button) view.findViewById(R.id.button10);
                    Button database = (Button) view.findViewById(R.id.button11);
                    Button forum = (Button) view.findViewById(R.id.button12);

                    kelas.setOnClickListener(new View.OnClickListener() {

                        @Override
                        public void onClick(View v) {

                            Intent showDetails = new Intent(getActivity(), KelasController.class);
                            //asumsi username gak null
                            showDetails.putExtra("Username", username);
                            showDetails.putExtra("View", "listKelas");
                            startActivity(showDetails);
                        }
                    });
                    role.setOnClickListener(new View.OnClickListener() {

                        @Override
                        public void onClick(View v) {

                            Intent showDetails = new Intent(getActivity(), RoleController.class);
                            //asumsi username gak null
                            showDetails.putExtra("Username", username);
                            startActivity(showDetails);
                        }
                    });
                    database.setOnClickListener(new View.OnClickListener() {

                        @Override
                        public void onClick(View v) {

                            Intent showDetails = new Intent(getActivity(), Database.class);
                            startActivity(showDetails);
                        }
                    });

                    forum.setOnClickListener(new View.OnClickListener() {

                        @Override
                        public void onClick(View v) {

                            Intent showDetails = new Intent(getActivity(), AdminThread.class);
                            startActivity(showDetails);
                        }
                    });
                    return view;
                }
            };
        } else {
            fragment = new FragmentOne();
            Toast.makeText(getApplicationContext(), "Hei Anda Bukan Admin", Toast.LENGTH_LONG).show();
        }
        args.putInt("role", 4);
        break;
    case 5:
        session.logoutUser();
        finish();
        return;
    }
    /*args.putInt(PlanetFragment.ARG_PLANET_NUMBER, position);*/
    fragment.setArguments(args);

    FragmentManager fragmentManager = getFragmentManager();
    fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit();

    // update selected item and title, then close the drawer
    mDrawerList.setItemChecked(position, true);
    setTitle(mPlanetTitles[position]);
    mDrawerLayout.closeDrawer(mDrawerList);
}

From source file:com.nttec.everychan.ui.tabs.TabsAdapter.java

@Override
public View getView(final int position, View convertView, ViewGroup parent) {
    View view = convertView == null ? inflater.inflate(R.layout.sidebar_tabitem, parent, false) : convertView;
    View dragHandler = view.findViewById(R.id.tab_drag_handle);
    ImageView favIcon = (ImageView) view.findViewById(R.id.tab_favicon);
    TextView title = (TextView) view.findViewById(R.id.tab_text_view);
    ImageView closeBtn = (ImageView) view.findViewById(R.id.tab_close_button);

    dragHandler.getLayoutParams().width = position == draggingItem ? ViewGroup.LayoutParams.WRAP_CONTENT : 0;
    dragHandler.setLayoutParams(dragHandler.getLayoutParams());

    if (position == selectedItem) {
        TypedValue typedValue = ThemeUtils.resolveAttribute(context.getTheme(), R.attr.sidebarSelectedItem,
                true);/*from w  w w.java2 s . c  om*/
        if (typedValue.type >= TypedValue.TYPE_FIRST_COLOR_INT
                && typedValue.type <= TypedValue.TYPE_LAST_COLOR_INT) {
            view.setBackgroundColor(typedValue.data);
        } else {
            view.setBackgroundResource(typedValue.resourceId);
        }
    } else {
        view.setBackgroundColor(Color.TRANSPARENT);
    }

    TabModel model = this.getItem(position);

    switch (model.type) {
    case TabModel.TYPE_NORMAL:
    case TabModel.TYPE_LOCAL:
        closeBtn.setVisibility(View.VISIBLE);
        String titleText = model.title;
        if (model.unreadPostsCount > 0 || model.autoupdateError) {
            StringBuilder titleStringBuilder = new StringBuilder();
            if (model.unreadSubscriptions)
                titleStringBuilder.append("[*] ");
            if (model.autoupdateError)
                titleStringBuilder.append("[X] ");
            if (model.unreadPostsCount > 0)
                titleStringBuilder.append('[').append(model.unreadPostsCount).append("] ");
            titleText = titleStringBuilder.append(titleText).toString();
        }
        title.setText(titleText);
        ChanModule chan = MainApplication.getInstance().getChanModule(model.pageModel.chanName);
        Drawable icon = chan != null ? chan.getChanFavicon()
                : ResourcesCompat.getDrawable(context.getResources(), android.R.drawable.ic_delete, null);
        if (icon != null) {
            if (model.type == TabModel.TYPE_LOCAL) {
                Drawable[] layers = new Drawable[] { icon, ResourcesCompat.getDrawable(context.getResources(),
                        R.drawable.favicon_overlay_local, null) };
                icon = new LayerDrawable(layers);
            }
            /* XXX
             ?       ( overlay  favicon    ),
             ?   ?? ,   ,     (   ).
            ?    ? ? , , ? -? -  ,    ?.
               ??  ?,   ? ?  .
                    
            else if (model.type == TabModel.TYPE_NORMAL && model.pageModel != null &&
                    model.pageModel.type == UrlPageModel.TYPE_THREADPAGE && model.autoupdateBackground &&
                    MainApplication.getInstance().settings.isAutoupdateEnabled() &&
                    MainApplication.getInstance().settings.isAutoupdateBackground()) {
                Drawable[] layers = new Drawable[] {
                        icon, ResourcesCompat.getDrawable(context.getResources(), R.drawable.favicon_overlay_autoupdate, null) };
                icon = new LayerDrawable(layers);
            }
            */
            favIcon.setImageDrawable(icon);
            favIcon.setVisibility(View.VISIBLE);
        } else {
            favIcon.setVisibility(View.GONE);
        }
        break;
    default:
        closeBtn.setVisibility(View.GONE);
        title.setText(R.string.error_deserialization);
        favIcon.setVisibility(View.GONE);
    }

    closeBtn.setTag(position);
    closeBtn.setOnClickListener(onCloseClick);
    return view;
}

From source file:com.offers.couponempire.ui.BaseActivity.java

private View makeNavDrawerItem(final int itemId, ViewGroup container) {
    boolean selected = getSelfNavDrawerItem() == itemId;
    int layoutToInflate = 0;
    if (itemId == NAVDRAWER_ITEM_SEPARATOR) {
        layoutToInflate = R.layout.navdrawer_separator;
    } else if (itemId == NAVDRAWER_ITEM_SEPARATOR_SPECIAL) {
        layoutToInflate = R.layout.navdrawer_separator;
    } else {// ww  w .  ja  va  2s  .  co  m
        layoutToInflate = R.layout.navdrawer_item;
    }
    View view = getLayoutInflater().inflate(layoutToInflate, container, false);

    if (isSeparator(itemId)) {
        // we are done
        //UIUtils.setAccessibilityIgnore(view);
        return view;
    }

    ImageView iconView = (ImageView) view.findViewById(R.id.icon);
    TextView titleView = (TextView) view.findViewById(R.id.title);
    // titleView.setTypeface(typeface);

    int iconId = itemId >= 0 && itemId < NAVDRAWER_ICON_RES_ID.length ? NAVDRAWER_ICON_RES_ID[itemId] : 0;
    int titleId = itemId >= 0 && itemId < NAVDRAWER_TITLE_RES_ID.length ? NAVDRAWER_TITLE_RES_ID[itemId] : 0;

    // set icon and text
    iconView.setVisibility(iconId > 0 ? View.VISIBLE : View.GONE);
    if (iconId > 0) {
        iconView.setImageResource(iconId);
        /* if(iconId>3)
         {
        iconView.setVisibility(View.GONE);
         }*/
    }
    titleView.setText(getString(titleId));

    formatNavDrawerItem(view, itemId, selected);

    view.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            onNavDrawerItemClicked(itemId);
        }
    });

    return view;
}

From source file:spinnersample.lalongooo.com.viewpager.IntroActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    setContentView(R.layout.intro_layout);

    icons = new int[] { R.drawable.app_overview_1_buy, R.drawable.app_overview_2_smartphone,
            R.drawable.app_overview_3_save_money, R.drawable.app_overview_4_coupons };
    messages = new int[] { R.string.app_overview_1st_item_text, R.string.app_overview_2nd_item_text,
            R.string.app_overview_3rd_item_text, R.string.app_overview_4th_item_text };
    viewPager = (ViewPager) findViewById(R.id.intro_view_pager);
    TextView startMessagingButton = (TextView) findViewById(R.id.start_messaging_button);
    startMessagingButton.setText(getString(R.string.StartMessaging));
    if (Build.VERSION.SDK_INT >= 21) {
        StateListAnimator animator = new StateListAnimator();
        animator.addState(new int[] { android.R.attr.state_pressed },
                ObjectAnimator.ofFloat(startMessagingButton, "translationZ", AndroidUtilities.dp(2, this),
                        AndroidUtilities.dp(4, this)).setDuration(200));
        animator.addState(new int[] {}, ObjectAnimator.ofFloat(startMessagingButton, "translationZ",
                AndroidUtilities.dp(4, this), AndroidUtilities.dp(2, this)).setDuration(200));
        startMessagingButton.setStateListAnimator(animator);
    }/*  w w  w  . j a  va  2 s  .com*/
    topImage1 = (ImageView) findViewById(R.id.icon_image1);
    topImage2 = (ImageView) findViewById(R.id.icon_image2);
    indicator = (CirclePageIndicator) findViewById(R.id.indicator);

    topImage2.setVisibility(View.GONE);
    viewPager.setAdapter(new IntroAdapter());
    viewPager.setPageMargin(0);
    viewPager.setOffscreenPageLimit(1);
    indicator.setViewPager(viewPager);
    indicator.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

            if (lastPage != viewPager.getCurrentItem()) {
                lastPage = viewPager.getCurrentItem();

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

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

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

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

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

                    @Override
                    public void onAnimationRepeat(Animation animation) {

                    }
                });

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

                    @Override
                    public void onAnimationEnd(Animation animation) {
                    }

                    @Override
                    public void onAnimationRepeat(Animation animation) {

                    }
                });

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

        @Override
        public void onPageSelected(int position) {

        }

        @Override
        public void onPageScrollStateChanged(int state) {

        }
    });

    startMessagingButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (startPressed) {
                return;
            }
            startPressed = true;
            Intent intent2 = new Intent(IntroActivity.this, ActivityMain.class);
            startActivity(intent2);
            finish();
        }
    });
}

From source file:com.androidinspain.deskclock.stopwatch.StopwatchFragment.java

private void updateFab(@NonNull ImageView fab, boolean animate) {
    if (getStopwatch().isRunning()) {
        if (animate) {
            fab.setImageResource(R.drawable.ic_play_pause_animation);
        } else {/*  w  w  w  .j  ava2  s . c  o  m*/
            fab.setImageResource(R.drawable.ic_play_pause);
        }
        fab.setContentDescription(fab.getResources().getString(R.string.sw_pause_button));
    } else {
        if (animate) {
            fab.setImageResource(R.drawable.ic_pause_play_animation);
        } else {
            fab.setImageResource(R.drawable.ic_pause_play);
        }
        fab.setContentDescription(fab.getResources().getString(R.string.sw_start_button));
    }
    fab.setVisibility(VISIBLE);
}

From source file:com.pemikir.youtubeplus.VideoItemDetailFragment.java

public void updateInfo(VideoInfo info) {
    Activity a = getActivity();/*from   w w w.j a  va2  s  . com*/
    try {
        ProgressBar progressBar = (ProgressBar) a.findViewById(R.id.detailProgressBar);
        TextView videoTitleView = (TextView) a.findViewById(R.id.detailVideoTitleView);
        TextView uploaderView = (TextView) a.findViewById(R.id.detailUploaderView);
        TextView viewCountView = (TextView) a.findViewById(R.id.detailViewCountView);
        TextView thumbsUpView = (TextView) a.findViewById(R.id.detailThumbsUpCountView);
        TextView thumbsDownView = (TextView) a.findViewById(R.id.detailThumbsDownCountView);
        TextView uploadDateView = (TextView) a.findViewById(R.id.detailUploadDateView);
        TextView descriptionView = (TextView) a.findViewById(R.id.detailDescriptionView);
        ImageView thumbnailView = (ImageView) a.findViewById(R.id.detailThumbnailView);
        ImageView uploaderThumbnailView = (ImageView) a.findViewById(R.id.detailUploaderThumbnailView);
        ImageView thumbsUpPic = (ImageView) a.findViewById(R.id.detailThumbsUpImgView);
        ImageView thumbsDownPic = (ImageView) a.findViewById(R.id.detailThumbsDownImgView);
        View textSeperationLine = a.findViewById(R.id.textSeperationLine);

        if (textSeperationLine != null) {
            textSeperationLine.setVisibility(View.VISIBLE);
        }
        progressBar.setVisibility(View.GONE);
        videoTitleView.setVisibility(View.VISIBLE);
        uploaderView.setVisibility(View.VISIBLE);
        uploadDateView.setVisibility(View.VISIBLE);
        viewCountView.setVisibility(View.VISIBLE);
        thumbsUpView.setVisibility(View.VISIBLE);
        thumbsDownView.setVisibility(View.VISIBLE);
        uploadDateView.setVisibility(View.VISIBLE);
        descriptionView.setVisibility(View.VISIBLE);
        thumbnailView.setVisibility(View.VISIBLE);
        uploaderThumbnailView.setVisibility(View.VISIBLE);
        thumbsUpPic.setVisibility(View.VISIBLE);
        thumbsDownPic.setVisibility(View.VISIBLE);

        switch (info.videoAvailableStatus) {
        case VideoInfo.VIDEO_AVAILABLE: {
            videoTitleView.setText(info.title);
            uploaderView.setText(info.uploader);
            viewCountView.setText(info.view_count + " " + a.getString(R.string.viewSufix));
            thumbsUpView.setText(info.like_count);
            thumbsDownView.setText(info.dislike_count);
            uploadDateView.setText(a.getString(R.string.uploadDatePrefix) + " " + info.upload_date);
            descriptionView.setText(Html.fromHtml(info.description));
            descriptionView.setMovementMethod(LinkMovementMethod.getInstance());

            ActionBarHandler.getHandler().setVideoInfo(info.webpage_url, info.title);

            // parse streams
            Vector<VideoInfo.VideoStream> streamsToUse = new Vector<>();
            for (VideoInfo.VideoStream i : info.videoStreams) {
                if (useStream(i, streamsToUse)) {
                    streamsToUse.add(i);
                }
            }
            VideoInfo.VideoStream[] streamList = new VideoInfo.VideoStream[streamsToUse.size()];
            for (int i = 0; i < streamList.length; i++) {
                streamList[i] = streamsToUse.get(i);
            }
            ActionBarHandler.getHandler().setStreams(streamList, info.audioStreams);
        }
            break;
        case VideoInfo.VIDEO_UNAVAILABLE_GEMA:
            thumbnailView.setImageBitmap(
                    BitmapFactory.decodeResource(getResources(), R.drawable.gruese_die_gema_unangebracht));
            break;
        case VideoInfo.VIDEO_UNAVAILABLE:
            thumbnailView.setImageBitmap(
                    BitmapFactory.decodeResource(getResources(), R.drawable.not_available_monkey));
            break;
        default:
            Log.e(TAG, "Video Availeble Status not known.");
        }

        if (autoPlayEnabled) {
            ActionBarHandler.getHandler().playVideo();
        }
    } catch (java.lang.NullPointerException e) {
        Log.w(TAG, "updateInfo(): Fragment closed before thread ended work... or else");
        e.printStackTrace();
    }
}

From source file:io.plaidapp.ui.DesignerNewsStory.java

private void bindDescription() {
    final TextView storyComment = (TextView) header.findViewById(R.id.story_comment);
    if (!TextUtils.isEmpty(story.comment)) {
        HtmlUtils.setTextWithNiceLinks(storyComment,
                markdown.markdownToSpannable(story.comment, storyComment, new Bypass.LoadImageCallback() {
                    @Override//from  w  ww . j av  a 2  s.c o m
                    public void loadImage(String src, ImageLoadingSpan loadingSpan) {
                        Glide.with(DesignerNewsStory.this).load(src).asBitmap()
                                .diskCacheStrategy(DiskCacheStrategy.ALL)
                                .into(new ImageSpanTarget(storyComment, loadingSpan));
                    }
                }));
    } else {
        storyComment.setVisibility(View.GONE);
    }

    upvoteStory = (Button) header.findViewById(R.id.story_vote_action);
    upvoteStory.setText(getResources().getQuantityString(R.plurals.upvotes, story.vote_count,
            NumberFormat.getInstance().format(story.vote_count)));
    upvoteStory.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(final View v) {
            upvoteStory();
        }
    });

    Button share = (Button) header.findViewById(R.id.story_share_action);
    share.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            startActivity(ShareCompat.IntentBuilder.from(DesignerNewsStory.this).setText(story.url)
                    .setType("text/plain").setSubject(story.title).getIntent());
        }
    });

    TextView storyPosterTime = (TextView) header.findViewById(R.id.story_poster_time);
    SpannableString poster = new SpannableString("" + story.user_display_name);
    poster.setSpan(new TextAppearanceSpan(this, R.style.TextAppearance_CommentAuthor), 0, poster.length(),
            Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    CharSequence job = !TextUtils.isEmpty(story.user_job) ? "\n" + story.user_job : "";
    CharSequence timeAgo = DateUtils.getRelativeTimeSpanString(story.created_at.getTime(),
            System.currentTimeMillis(), DateUtils.SECOND_IN_MILLIS);
    storyPosterTime.setText(TextUtils.concat(poster, job, "\n", timeAgo));
    ImageView avatar = (ImageView) header.findViewById(R.id.story_poster_avatar);
    if (!TextUtils.isEmpty(story.user_portrait_url)) {
        Glide.with(this).load(story.user_portrait_url).placeholder(R.drawable.avatar_placeholder)
                .transform(circleTransform).into(avatar);
    } else {
        avatar.setVisibility(View.GONE);
    }
}

From source file:com.zainsoft.ramzantimetable.QiblaActivity.java

private void requestForValidationOfQibla() {
    // TextView textView = (TextView)
    // findViewById(R.id.location_text_line1);
    TextView textView2 = (TextView) findViewById(R.id.location_text_line2);
    ImageView arrow = ((ImageView) findViewById(R.id.arrowImage));
    ImageView compass = ((ImageView) findViewById(R.id.compassImage));
    ImageView frame = ((ImageView) findViewById(R.id.frameImage));
    FrameLayout qiblaFrame = ((FrameLayout) findViewById(R.id.qiblaLayout));
    LinearLayout noLocationLayout = ((LinearLayout) findViewById(R.id.noLocationLayout));

    if (faceUp && (gpsLocationFound || currentLocation != null)) {
        textView2.setVisibility(View.VISIBLE);
        textView2.setText(location_line2);
        ((LinearLayout) findViewById(R.id.textLayout)).setVisibility(View.VISIBLE);
        noLocationLayout.setVisibility(View.INVISIBLE);
        qiblaFrame.setVisibility(View.VISIBLE);
        arrow.setVisibility(View.VISIBLE);
        compass.setVisibility(View.VISIBLE);
        frame.setVisibility(View.VISIBLE);
    } else {/*w ww .  j  a  v  a 2  s  .  c o m*/
        if (!faceUp) {
            onScreenDown();
        } else if (!(gpsLocationFound || currentLocation != null)) {
            onGPSOn();
        }
    }
}