Example usage for android.view ViewGroup setVisibility

List of usage examples for android.view ViewGroup setVisibility

Introduction

In this page you can find the example usage for android.view ViewGroup setVisibility.

Prototype

@RemotableViewMethod
public void setVisibility(@Visibility int visibility) 

Source Link

Document

Set the visibility state of this view.

Usage

From source file:org.adblockplus.android.Preferences.java

private void showConfigurationMsg(final String message) {
    final ViewGroup grp = (ViewGroup) findViewById(R.id.grp_configuration);
    final TextView msg = (TextView) findViewById(R.id.txt_configuration);
    msg.setText(Html.fromHtml(message));
    grp.setVisibility(View.VISIBLE);
}

From source file:com.woodblockwithoutco.quickcontroldock.ui.factory.ServiceViewFactory.java

@SuppressWarnings("deprecation")
public View getServiceView() {

    boolean sameLayout = GeneralResolver.isSameLayoutForLandscape(mContext);
    int inflateId = 0;
    if (ScreenUtils.getScreenOrientation(mContext) == Configuration.ORIENTATION_PORTRAIT || sameLayout) {
        inflateId = R.layout.panel_layout;
    } else {/*from ww w  .j a va  2s  .com*/
        inflateId = R.layout.panel_layout_land;
    }

    View view = LayoutInflater.from(mContext).inflate(inflateId, null, false);

    final DragViewGroup dragView = (DragViewGroup) view.findViewById(R.id.panel_drag_handler);
    dragView.setBackgroundDrawable(ColorsResolver.getBackgroundDrawable(mContext));

    if (ConstantHolder.getIsDebug()) {
        initTestVersionText(dragView);
    }

    ViewGroup viewToHide;
    if (ScreenUtils.getScreenOrientation(mContext) == Configuration.ORIENTATION_PORTRAIT || sameLayout) {
        LinearLayout panelsContainer = (LinearLayout) dragView.findViewById(R.id.panels_container);
        viewToHide = panelsContainer;
        if (ScreenUtils.getScreenOrientation(mContext) == Configuration.ORIENTATION_PORTRAIT) {
            panelsContainer.setTranslationY(GeneralResolver.getPanelsOffset(mContext));
        }

        List<String> panelsOrder = PanelsOrderResolver.getPanelsOrder(mContext);
        if (ShortcutsResolver.isShortcutsEnabled(mContext)) {
            ShortcutsViewFactory svFactory = new ShortcutsViewFactory(mContext);
            int id = getContainerIdForPanelType(panelsOrder, PanelType.SHORTCUTS.name());
            FrameLayout section = (FrameLayout) view.findViewById(id);
            adjustPanelMargins(section);
            section.addView(svFactory.getShortcutsSectionView());
        }

        if (MusicResolver.isMusicPanelEnabled(mContext)) {
            MusicViewFactory mvFactory = new MusicViewFactory(mContext);
            int id = getContainerIdForPanelType(panelsOrder, PanelType.MUSIC.name());
            FrameLayout section = (FrameLayout) view.findViewById(id);
            adjustPanelMargins(section);
            section.addView(mvFactory.getMusicView());
        }

        if (TogglesResolver.isTogglesEnabled(mContext)) {
            TogglesViewFactory tvFactory = new TogglesViewFactory(mContext);
            int id = getContainerIdForPanelType(panelsOrder, PanelType.TOGGLES.name());
            FrameLayout section = (FrameLayout) view.findViewById(id);
            adjustPanelMargins(section);
            section.addView(tvFactory.getTogglesSectionView());
        }

        if (InfoResolver.isInfoPanelEnabled(mContext)) {
            InfoViewFactory ivFactory = new InfoViewFactory(mContext);
            int id = getContainerIdForPanelType(panelsOrder, PanelType.INFO.name());
            FrameLayout section = (FrameLayout) view.findViewById(id);
            adjustPanelMargins(section);
            section.addView(ivFactory.getInfoView());
        }

        if (NotificationsResolver.isNotificationsEnabled(mContext)) {
            final ImageView fakeNotificationsButton = (ImageView) dragView
                    .findViewById(R.id.notifications_button_fake);
            PressImageView notificationsButton = (PressImageView) dragView
                    .findViewById(R.id.notifications_button);
            fakeNotificationsButton.setVisibility(View.VISIBLE);
            notificationsButton.setVisibility(View.VISIBLE);
            fakeNotificationsButton.setImageResource(R.drawable.ic_notification_switch);
            fakeNotificationsButton.setColorFilter(ColorsResolver.getActiveColor(mContext));
            final float SCALE = 1.5f;
            fakeNotificationsButton.setScaleX(SCALE);
            fakeNotificationsButton.setScaleY(SCALE);
            notificationsButton.setOnPressedStateChangeListener(new OnPressedStateChangeListener() {
                private final int BG_COLOR = ColorsResolver.getPressedColor(mContext);

                @Override
                public void onPressedStateChange(ImageView v, boolean pressed) {
                    if (pressed) {
                        fakeNotificationsButton.setBackgroundColor(BG_COLOR);
                    } else {
                        fakeNotificationsButton.setBackgroundColor(0x00000000);
                    }
                }
            });

            NotificationViewFactory nvFactory = new NotificationViewFactory(mContext);
            ViewGroup notificationsView = nvFactory.getNotificationsView();
            notificationsView.setAlpha(0.0f);
            notificationsView.setVisibility(View.INVISIBLE);
            FrameLayout notificationsContainer = (FrameLayout) dragView
                    .findViewById(R.id.notifications_section);
            notificationsContainer.addView(notificationsView);
            notificationsButton
                    .setOnClickListener(new NotificationButtonClickListener(viewToHide, notificationsView));
        }

    } else {

        ViewPager pager = (ViewPager) view.findViewById(R.id.landscape_pager);
        viewToHide = pager;
        List<View> views = new ArrayList<View>();

        if (NotificationsResolver.isNotificationsEnabled(mContext)) {
            NotificationViewFactory nvFactory = new NotificationViewFactory(mContext);
            ViewGroup notificationsView = nvFactory.getNotificationsView();
            views.add(notificationsView);
        }

        List<String> panelsOrder = PanelsOrderResolver.getPanelsOrder(mContext);
        for (String t : panelsOrder) {
            PanelType type = PanelType.valueOf(t);
            View v = null;
            FrameLayout container = (FrameLayout) LayoutInflater.from(mContext)
                    .inflate(R.layout.panel_section_land, null, false);
            switch (type) {
            case INFO:
                //     
                if (InfoResolver.isInfoPanelEnabled(mContext)) {
                    InfoViewFactory ivFactory = new InfoViewFactory(mContext);
                    FrameLayout fourthSection = (FrameLayout) view.findViewById(R.id.fourth_section);
                    fourthSection.addView(ivFactory.getInfoView());
                }
                break;
            case MUSIC:
                if (MusicResolver.isMusicPanelEnabled(mContext)) {
                    MusicViewFactory mvFactory = new MusicViewFactory(mContext);
                    v = mvFactory.getMusicView();
                }
                break;
            case SHORTCUTS:
                if (ShortcutsResolver.isShortcutsEnabled(mContext)) {
                    ShortcutsViewFactory svFactory = new ShortcutsViewFactory(mContext);
                    v = svFactory.getShortcutsSectionView();
                }
                break;
            case TOGGLES:
                if (TogglesResolver.isTogglesEnabled(mContext)) {
                    TogglesViewFactory tvFactory = new TogglesViewFactory(mContext);
                    v = tvFactory.getTogglesSectionView();
                }
                break;
            }

            if (v != null) {
                views.add(v);
                container.addView(v);
            }
        }

        LandscapePanelsAdapter adapter = new LandscapePanelsAdapter(views);
        pager.setAdapter(adapter);
        pager.setOverScrollMode(View.OVER_SCROLL_NEVER);
        pager.setOffscreenPageLimit(VIEW_PAGER_OFFSCREEN_PAGES_COUNT);
        pager.setPageMargin(mContext.getResources().getDimensionPixelSize(R.dimen.pager_margin));
    }

    return view;
}

From source file:org.alfresco.mobile.android.application.fragments.workflow.task.TaskDetailsFragment.java

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

    container.setVisibility(View.VISIBLE);
    setSession(SessionUtils.getSession(getActivity()));
    SessionUtils.checkSession(getActivity(), getSession());
    vRoot = inflater.inflate(R.layout.app_task_details, container, false);

    if (getSession() == null) {
        return vRoot;
    }

    currentTask = (Task) getArguments().get(ARGUMENT_TASK);
    currentProcess = (Process) getArguments().get(ARGUMENT_PROCESS);
    if (currentTask == null && currentProcess == null) {
        return null;
    }

    // Init variable depending on object
    initVariables();

    // Header
    TextView tv = (TextView) vRoot.findViewById(R.id.title);
    tv.setText(description);

    // Other parts
    initHeader();
    initCompleteForm();
    initInitiator();

    if (items == null) {
        Operator.with(getActivity(), SessionUtils.getAccount(getActivity()))
                .load(new ItemsRequest.Builder(currentProcess, currentTask));
    } else {
        diplayAttachment();
    }

    return vRoot;
}

From source file:com.tasomaniac.openwith.resolver.ResolverActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    final Intent intent = makeMyIntent();

    setTheme(R.style.BottomSheet_Light);
    super.onCreate(savedInstanceState);

    mPm = getPackageManager();/*from  www . j  av  a2  s .  c  o m*/

    mRequestedUri = intent.getData();

    boolean isCallerPackagePreferred = false;
    final String callerPackage = getCallerPackage();

    ResolveInfo lastChosen = null;
    final Cursor query = getContentResolver().query(withHost(intent.getData().getHost()), null, null, null,
            null);

    if (query != null && query.moveToFirst()) {

        final boolean isPreferred = query.getInt(query.getColumnIndex(PREFERRED)) == 1;
        final boolean isLastChosen = query.getInt(query.getColumnIndex(LAST_CHOSEN)) == 1;

        if (isPreferred || isLastChosen) {
            final String componentString = query.getString(query.getColumnIndex(COMPONENT));

            final Intent lastChosenIntent = new Intent();
            final ComponentName lastChosenComponent = ComponentName.unflattenFromString(componentString);
            lastChosenIntent.setComponent(lastChosenComponent);
            ResolveInfo ri = mPm.resolveActivity(lastChosenIntent, PackageManager.MATCH_DEFAULT_ONLY);

            if (isPreferred && ri != null) {
                isCallerPackagePreferred = ri.activityInfo.packageName.equals(callerPackage);
                if (!isCallerPackagePreferred) {
                    intent.setComponent(lastChosenComponent);
                    startActivity(intent);
                    finish();
                    return;
                }
            }

            lastChosen = ri;
        }
        query.close();
    }

    mPackageMonitor.register(this, getMainLooper(), false);
    mRegistered = true;

    final ActivityManager am = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
    mIconDpi = am.getLauncherLargeIconDensity();

    mAdapter = new ResolveListAdapter(this, getHistory(), intent, callerPackage, lastChosen, true);
    mAdapter.setPriorityItems(intent.getStringArrayExtra(EXTRA_PRIORITY_PACKAGES));

    mAlwaysUseOption = true;
    final int layoutId;
    final boolean useHeader;
    if (mAdapter.hasFilteredItem()) {
        layoutId = R.layout.resolver_list_with_default;
        mAlwaysUseOption = false;
        useHeader = true;
    } else {
        useHeader = false;
        layoutId = R.layout.resolver_list;
    }

    //If the caller is already the preferred, don't change it.
    if (isCallerPackagePreferred) {
        mAlwaysUseOption = false;
    }

    int count = mAdapter.mList.size();
    if (count > 1) {
        setContentView(layoutId);
        mListView = (RecyclerView) findViewById(R.id.resolver_list);
        mListView.setAdapter(mAdapter);
        mAdapter.setOnItemClickedListener(this);
        mAdapter.setOnItemLongClickedListener(this);

        if (mAlwaysUseOption) {
            mAdapter.setSelectable(true);
        }
        if (useHeader) {
            mAdapter.setHeader(new ResolveListAdapter.Header());
        }
    } else if (count == 1) {
        startActivity(mAdapter.intentForPosition(0, false));
        mPackageMonitor.unregister();
        mRegistered = false;
        finish();
        return;
    } else {
        setContentView(R.layout.resolver_list);

        final TextView empty = (TextView) findViewById(R.id.empty);
        empty.setVisibility(View.VISIBLE);

        mListView = (RecyclerView) findViewById(R.id.resolver_list);
        mListView.setVisibility(View.GONE);
    }

    mListView.setLayoutManager(new LinearLayoutManager(this));

    // Prevent the Resolver window from becoming the top fullscreen window and thus from taking
    // control of the system bars.
    getWindow().clearFlags(FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR);

    final ResolverDrawerLayout rdl = (ResolverDrawerLayout) findViewById(R.id.contentPanel);
    if (rdl != null) {
        rdl.setOnDismissedListener(new ResolverDrawerLayout.OnDismissedListener() {
            @Override
            public void onDismissed() {
                finish();
            }
        });
    }

    CharSequence title = getTitleForAction();
    if (!TextUtils.isEmpty(title)) {
        final TextView titleView = (TextView) findViewById(R.id.title);
        if (titleView != null) {
            titleView.setText(title);
        }
        setTitle(title);
    }

    final ImageView iconView = (ImageView) findViewById(R.id.icon);
    final DisplayResolveInfo iconInfo = mAdapter.getFilteredItem();
    if (iconView != null && iconInfo != null) {
        new LoadIconIntoViewTask(iconView).execute(iconInfo);
    }

    if (mAlwaysUseOption || mAdapter.hasFilteredItem()) {
        final ViewGroup buttonLayout = (ViewGroup) findViewById(R.id.button_bar);
        if (buttonLayout != null) {
            buttonLayout.setVisibility(View.VISIBLE);
            mAlwaysButton = (Button) buttonLayout.findViewById(R.id.button_always);
            mOnceButton = (Button) buttonLayout.findViewById(R.id.button_once);
        } else {
            mAlwaysUseOption = false;
        }
    }

    if (mAdapter.hasFilteredItem()) {
        mAlwaysButton.setEnabled(true);
        mOnceButton.setEnabled(true);
    }
}

From source file:dev.drsoran.moloko.util.UIUtils.java

public final static void inflateTags(Context context, ViewGroup container, Collection<String> tags,
        Bundle configuration) {// ww  w .  j  a  va  2s.c o  m
    if (configuration == null) {
        configuration = Bundle.EMPTY;
    }

    final int tagPos = getTaggedViewPos(container, "tag_name");

    if (tagPos != -1) {
        container.removeViews(tagPos, container.getChildCount() - tagPos);
    }

    // inflate the stub and add tags
    if (tags.size() > 0 && !configuration.containsKey(REMOVE_ALL_TAGS)) {
        try {
            final String[] tagsToRemove = configuration.getStringArray(REMOVE_TAGS_EQUALS);

            for (String tagText : tags) {
                boolean remove = false;

                if (tagsToRemove != null) {
                    for (int i = 0; i < tagsToRemove.length && !remove; i++) {
                        remove = tagsToRemove[i].equalsIgnoreCase(tagText);
                    }
                }

                if (!remove) {
                    final TextView tagView = (TextView) View.inflate(context, R.layout.tag_button, null);
                    tagView.setText(tagText);
                    container.addView(tagView);
                }
            }
        } catch (Throwable e) {
            throw new InflateException(e);
        }
    }

    if (container.getChildCount() > 0)
        container.setVisibility(View.VISIBLE);
    else
        container.setVisibility(View.GONE);
}

From source file:org.onebusaway.android.ui.TripDetailsListFragment.java

private void setUpHeader() {
    ObaTripStatus status = mTripInfo.getStatus();
    ObaReferences refs = mTripInfo.getRefs();

    Context context = getActivity();

    String tripId = mTripInfo.getId();

    ObaTrip trip = refs.getTrip(tripId);
    ObaRoute route = refs.getRoute(trip.getRouteId());
    TextView shortName = (TextView) getView().findViewById(R.id.short_name);
    shortName.setText(route.getShortName());

    TextView longName = (TextView) getView().findViewById(R.id.long_name);
    longName.setText(trip.getHeadsign());

    TextView agency = (TextView) getView().findViewById(R.id.agency);
    agency.setText(refs.getAgency(route.getAgencyId()).getName());

    TextView vehicleView = (TextView) getView().findViewById(R.id.vehicle);
    TextView vehicleDeviation = (TextView) getView().findViewById(R.id.status);
    ViewGroup realtime = (ViewGroup) getView().findViewById(R.id.eta_realtime_indicator);
    realtime.setVisibility(View.GONE);
    ViewGroup statusLayout = (ViewGroup) getView().findViewById(R.id.status_layout);

    if (status == null) {
        // Show schedule info only
        vehicleView.setText(null);//from w  w  w .  ja va 2  s .co  m
        vehicleView.setVisibility(View.GONE);
        vehicleDeviation.setText(context.getString(R.string.trip_details_scheduled_data));
        return;
    }

    if (!TextUtils.isEmpty(status.getVehicleId())) {
        // Show vehicle info
        vehicleView.setText(context.getString(R.string.trip_details_vehicle, status.getVehicleId()));
        vehicleView.setVisibility(View.VISIBLE);
    } else {
        vehicleView.setVisibility(View.GONE);
    }

    // Set status color in header
    statusLayout.setBackgroundResource(R.drawable.round_corners_style_b_header_status);
    GradientDrawable d = (GradientDrawable) statusLayout.getBackground();

    int statusColor;

    if (!status.isPredicted()) {
        // We have only schedule info, but the bus position can still be interpolated
        vehicleDeviation.setText(context.getString(R.string.trip_details_scheduled_data));
        statusColor = R.color.stop_info_scheduled_time;
        d.setColor(getResources().getColor(statusColor));
        return;
    }

    /**
     * We have real-time info
     */
    realtime.setVisibility(View.VISIBLE);

    long deviation = status.getScheduleDeviation();
    long deviationMin = TimeUnit.SECONDS.toMinutes(status.getScheduleDeviation());
    long minutes = Math.abs(deviation) / 60;
    long seconds = Math.abs(deviation) % 60;
    String lastUpdate = DateUtils.formatDateTime(getActivity(), status.getLastUpdateTime(),
            DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_NO_NOON | DateUtils.FORMAT_NO_MIDNIGHT);

    statusColor = ArrivalInfo.computeColorFromDeviation(deviationMin);
    if (statusColor != R.color.stop_info_ontime) {
        // Show early/late/scheduled color
        d.setColor(getResources().getColor(statusColor));
    } else {
        // For on-time, use header default color
        d.setColor(getResources().getColor(R.color.theme_primary));
    }

    if (deviation >= 0) {
        if (deviation < 60) {
            vehicleDeviation
                    .setText(context.getString(R.string.trip_details_real_time_sec_late, seconds, lastUpdate));
        } else {
            vehicleDeviation.setText(context.getString(R.string.trip_details_real_time_min_sec_late, minutes,
                    seconds, lastUpdate));
        }
    } else {
        if (deviation > -60) {
            vehicleDeviation
                    .setText(context.getString(R.string.trip_details_real_time_sec_early, seconds, lastUpdate));
        } else {
            vehicleDeviation.setText(context.getString(R.string.trip_details_real_time_min_sec_early, minutes,
                    seconds, lastUpdate));
        }
    }
}

From source file:com.cw.litenote.note.Note_adapter.java

@Override
public void setPrimaryItem(final ViewGroup container, int position, Object object) {
    // set primary item only
    if (mLastPosition != position) {
        System.out.println("Note_adapter / _setPrimaryItem / mLastPosition = " + mLastPosition);
        System.out.println("Note_adapter / _setPrimaryItem / position = " + position);

        String lastPictureStr = null;
        String lastLinkUri = null;
        String lastAudioUri = null;

        if (mLastPosition != -1) {
            lastPictureStr = db_page.getNotePictureUri(mLastPosition, true);
            lastLinkUri = db_page.getNoteLinkUri(mLastPosition, true);
            lastAudioUri = db_page.getNoteAudioUri(mLastPosition, true);
        }/*from w w  w  .j a v a  2s  .c  om*/

        String pictureStr = db_page.getNotePictureUri(position, true);
        String linkUri = db_page.getNoteLinkUri(position, true);
        String audioUri = db_page.getNoteAudioUri(position, true);

        // remove last text web view
        if (!Note.isPictureMode()) {
            String tag = "current" + mLastPosition + "textWebView";
            CustomWebView textWebView = (CustomWebView) pager.findViewWithTag(tag);
            if (textWebView != null) {
                textWebView.onPause();
                textWebView.onResume();
            }
        }

        // for web view
        if (!UtilImage.hasImageExtension(pictureStr, act) && !UtilVideo.hasVideoExtension(pictureStr, act)) {
            // remove last link web view
            if (!UtilImage.hasImageExtension(lastPictureStr, act)
                    && !UtilVideo.hasVideoExtension(lastPictureStr, act)
                    && !UtilAudio.hasAudioExtension(lastAudioUri) && !Util.isYouTubeLink(lastLinkUri)) {
                String tag = "current" + mLastPosition + "linkWebView";
                CustomWebView lastLinkWebView = (CustomWebView) pager.findViewWithTag(tag);

                if (lastLinkWebView != null) {
                    CustomWebView.pauseWebView(lastLinkWebView);
                    CustomWebView.blankWebView(lastLinkWebView);
                }
            }

            // set current link web view in case no picture Uri
            if (Util.isEmptyString(pictureStr) && !Util.isYouTubeLink(linkUri) && linkUri.startsWith("http")
                    && !Note.isTextMode()) {
                if (Note.isViewAllMode()) {
                    String tagStr = "current" + position + "linkWebView";
                    CustomWebView linkWebView = (CustomWebView) pager.findViewWithTag(tagStr);
                    linkWebView.setVisibility(View.VISIBLE);
                    setWebView(linkWebView, object, CustomWebView.LINK_VIEW);
                    System.out.println("Note_adapter / _setPrimaryItem / load linkUri = " + linkUri);
                    linkWebView.loadUrl(linkUri);

                    //Add for non-stop showing of full screen web view
                    linkWebView.setWebViewClient(new WebViewClient() {
                        @Override
                        public boolean shouldOverrideUrlLoading(WebView view, String url) {
                            view.loadUrl(url);
                            return true;
                        }
                    });

                    //cf. https://stackoverflow.com/questions/13576153/how-to-get-text-from-a-webview
                    //                  linkWebView.addJavascriptInterface(new JavaScriptInterface(act), "Android");
                } else if (Note.isPictureMode()) {
                    Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(linkUri));
                    act.startActivity(i);
                }
            }
        }

        // for video view
        if (!Note.isTextMode()) {

            // stop last video view running
            if (mLastPosition != -1) {
                String tagVideoStr = "current" + mLastPosition + "videoView";
                VideoViewCustom lastVideoView = (VideoViewCustom) pager.findViewWithTag(tagVideoStr);
                lastVideoView.stopPlayback();
            }

            // Show picture view UI
            if (Note.isViewAllMode() || Note.isPictureMode()) {
                NoteUi.cancel_UI_callbacks();
                picUI_primary = new NoteUi(act, pager, position);
                picUI_primary.tempShow_picViewUI(5002, pictureStr);
            }

            // Set video view
            if (UtilVideo.hasVideoExtension(pictureStr, act) && !UtilImage.hasImageExtension(pictureStr, act)) {
                // update current pager view
                UtilVideo.mCurrentPagerView = (View) object;

                // for view mode change
                if (Note.mIsViewModeChanged && (Note.mPlayVideoPositionOfInstance == 0)) {
                    UtilVideo.mPlayVideoPosition = Note.mPositionOfChangeView;
                    UtilVideo.setVideoViewLayout(pictureStr);

                    if (UtilVideo.mPlayVideoPosition > 0)
                        UtilVideo.playOrPauseVideo(pager, pictureStr);
                } else {
                    // for key protect
                    if (Note.mPlayVideoPositionOfInstance > 0) {
                        UtilVideo.setVideoState(UtilVideo.VIDEO_AT_PAUSE);
                        UtilVideo.setVideoViewLayout(pictureStr);

                        if (!UtilVideo.hasMediaControlWidget) {
                            NoteUi.updateVideoPlayButtonState(pager, NoteUi.getFocus_notePos());
                            picUI_primary.tempShow_picViewUI(5003, pictureStr);
                        }

                        UtilVideo.playOrPauseVideo(pager, pictureStr);
                    } else {
                        if (UtilVideo.hasMediaControlWidget)
                            UtilVideo.setVideoState(UtilVideo.VIDEO_AT_PLAY);
                        else
                            UtilVideo.setVideoState(UtilVideo.VIDEO_AT_STOP);

                        UtilVideo.mPlayVideoPosition = 0; // make sure play video position is 0 after page is changed
                        UtilVideo.initVideoView(pager, pictureStr, act, position);
                    }
                }

                UtilVideo.currentPicturePath = pictureStr;
            }
        }

        ViewGroup audioBlock = (ViewGroup) act.findViewById(R.id.audioGroup);
        audioBlock.setVisibility(View.VISIBLE);

        // init audio block of pager
        if (UtilAudio.hasAudioExtension(audioUri)
                || UtilAudio.hasAudioExtension(Util.getDisplayNameByUriString(audioUri, act))) {
            AudioUi_note.initAudioProgress(act, audioUri, pager);

            if (Audio_manager.getAudioPlayMode() == Audio_manager.NOTE_PLAY_MODE) {
                if (Audio_manager.getPlayerState() != Audio_manager.PLAYER_AT_STOP)
                    AudioUi_note.updateAudioProgress(act);
            }

            AudioUi_note.updateAudioPlayState(act);
        } else
            audioBlock.setVisibility(View.GONE);
    }
    mLastPosition = position;

}

From source file:org.apache.cordova.engine.crosswalk.XWalkCordovaWebView.java

@Override
public void showCustomView(View view, CustomViewCallback callback) {
    // This code is adapted from the original Android Browser code, licensed under the Apache License, Version 2.0
    Log.d(TAG, "showing Custom View");
    // if a view already exists then immediately terminate the new one
    if (mCustomView != null) {
        callback.onCustomViewHidden();/*from   w ww. j a va  2 s  .co m*/
        return;
    }

    // Store the view and its callback for later (to kill it properly)
    mCustomView = view;
    mCustomViewCallback = callback;

    // Add the custom view to its container.
    ViewGroup parent = (ViewGroup) webview.getParent();
    parent.addView(view, COVER_SCREEN_GRAVITY_CENTER);

    // Hide the content view.
    webview.setVisibility(View.GONE);

    // Finally show the custom view container.
    parent.setVisibility(View.VISIBLE);
    parent.bringToFront();
}

From source file:com.example.administrator.mywebviewdrawsign.SysWebView.java

public void showCustomView(View view, WebChromeClient.CustomViewCallback callback) {
    // This code is adapted from the original Android Browser code, licensed under the Apache License, Version 2.0
    LogUtils.d("showing Custom View");
    // if a view already exists then immediately terminate the new one
    if (mCustomView != null) {
        callback.onCustomViewHidden();//  w w w  .  j  a  v a  2 s . c  o  m
        return;
    }

    // Store the view and its callback for later (to kill it properly)
    mCustomView = view;
    mCustomViewCallback = callback;

    // Add the custom view to its container.
    ViewGroup parent = (ViewGroup) this.getParent();
    background = parent.getBackground();
    parent.setBackground(new ColorDrawable(Color.BLACK));
    parent.addView(view, COVER_SCREEN_GRAVITY_CENTER);

    // Hide the content view.
    this.setVisibility(View.GONE);

    // Finally show the custom view container.
    parent.setVisibility(View.VISIBLE);
    parent.bringToFront();
    if (objects != null && objects.length > 0) {
        for (Object obj : objects) {
            if (obj instanceof View) {
                ((View) obj).setVisibility(View.GONE);
            } else if (obj instanceof Fragment) {
                ((Fragment) obj).getView().setVisibility(View.GONE);
            }
        }
    }
    ((Activity) mContext).setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    ((Activity) mContext).getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
}

From source file:com.wanikani.androidnotifier.DashboardFragment.java

/**
 * Shows or hides the alerts layout, depending on the state of the visibility
 * of its children//from w  ww.  jav  a2s.  co m
 *    @param show if it shall be shown  
 */
protected void showAlertsLayout(boolean show) {
    ViewGroup lay;

    lay = (ViewGroup) parent.findViewById(R.id.lay_alerts);
    lay.setVisibility(show ? View.VISIBLE : View.GONE);
}