Java Code Examples for android.view.View#VISIBLE

The following examples show how to use android.view.View#VISIBLE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PlayerActivity.java    From APlayer with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void run() {
  while (mIsForeground) {
    //音量
    if (mVolumeSeekbar.getVisibility() == View.VISIBLE) {
      final int max = mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
      final int current = mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
      runOnUiThread(() -> mVolumeSeekbar.setProgress((int) (current * 1.0 / max * 100)));
    }
    if (!MusicServiceRemote.isPlaying()) {
      continue;
    }
    int progress = MusicServiceRemote.getProgress();
    if (progress > 0 && progress < mDuration) {
      mCurrentTime = progress;
      mHandler.sendEmptyMessage(UPDATE_TIME_ALL);
      try {
        //1000ms时间有点长
        sleep(500);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
  }
}
 
Example 2
Source File: WXViewUtils.java    From ucar-weex-core with Apache License 2.0 6 votes vote down vote up
public static boolean onScreenArea(View view) {
  if (view == null || view.getVisibility() != View.VISIBLE) {
    return false;
  }

  int[] p = new int[2];
  view.getLocationOnScreen(p);
  LayoutParams lp = view.getLayoutParams();
  int viewH = 0;
  if (lp != null) {
    viewH = lp.height;
  } else {
    viewH = view.getHeight();
  }

  return (p[1] > 0 && (p[1] - WXViewUtils.getScreenHeight(WXEnvironment.sApplication) < 0))
         || (viewH + p[1] > 0 && p[1] <= 0);
}
 
Example 3
Source File: PickerFragment.java    From HypFacebook with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
void updateCheckboxState(CheckBox checkBox, boolean graphObjectSelected) {
    checkBox.setChecked(graphObjectSelected);
    int visible = (graphObjectSelected || selectionStrategy
            .shouldShowCheckBoxIfUnselected()) ? View.VISIBLE : View.GONE;
    checkBox.setVisibility(visible);
}
 
Example 4
Source File: CordovaWebViewImpl.java    From cordova-plugin-intent with MIT License 5 votes vote down vote up
@Override
public void onPageFinishedLoading(String url) {
    LOG.d(TAG, "onPageFinished(" + url + ")");

    clearLoadTimeoutTimer();

    // Broadcast message that page has loaded
    pluginManager.postMessage("onPageFinished", url);

    // Make app visible after 2 sec in case there was a JS error and Cordova JS never initialized correctly
    if (engine.getView().getVisibility() != View.VISIBLE) {
        Thread t = new Thread(new Runnable() {
            public void run() {
                try {
                    Thread.sleep(2000);
                    cordova.getActivity().runOnUiThread(new Runnable() {
                        public void run() {
                            pluginManager.postMessage("spinner", "stop");
                        }
                    });
                } catch (InterruptedException e) {
                }
            }
        });
        t.start();
    }

    // Shutdown if blank loaded
    if (url.equals("about:blank")) {
        pluginManager.postMessage("exit", null);
    }
}
 
Example 5
Source File: ViewUtil.java    From weex with Apache License 2.0 5 votes vote down vote up
private static boolean isHittable(View view) {
  if (view.getVisibility() != View.VISIBLE) {
    return false;
  }

  if (ViewCompat.getInstance().getAlpha(view) < 0.001f) {
    return false;
  }

  return true;
}
 
Example 6
Source File: DetailAnimViewGroup.java    From ListItemFold with MIT License 5 votes vote down vote up
private void updateVisibility() {
    if (this.topFoldFactor == DEFAULT_BACKOFF_MULT && this.bottomFoldFactor == DEFAULT_BACKOFF_MULT) {
        if (getVisibility() != View.GONE) {
            setVisibility(View.GONE);
        }
    } else if (getVisibility() != View.VISIBLE) {
        setVisibility(View.VISIBLE);
    }
}
 
Example 7
Source File: LVImageView.java    From VideoOS-Android-SDK with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onWindowVisibilityChanged(int visibility) {
    super.onWindowVisibilityChanged(visibility);

    if (visibility == View.VISIBLE) {
        registerSensorManager();
    } else {
        unregisterSensorManager();
    }
}
 
Example 8
Source File: MoreViewActions.java    From yandex-money-sdk-android with MIT License 5 votes vote down vote up
public WaitVisibilityChange(long duration, int visibility) {
    super(duration);
    if (visibility != View.GONE && visibility != View.INVISIBLE &&
            visibility != View.VISIBLE) {
        throw new IllegalArgumentException("wrong visibility: " + visibility);
    }
    this.visibility = visibility;
}
 
Example 9
Source File: MainActivity.java    From AndroidAutoClick with MIT License 5 votes vote down vote up
@Override
public void onBackPressed() {
	//原生控件点击后退关闭
	if (mNativeAdLayout != null && mNativeAdLayout.getVisibility() == View.VISIBLE) {
		mNativeAdLayout.removeAllViews();
		mNativeAdLayout.setVisibility(View.GONE);
		return;
	}
	// 如果有需要,可以点击后退关闭插播广告。
	if (!SpotManager.getInstance(mContext).disMiss()) {
		super.onBackPressed();
	}
}
 
Example 10
Source File: CreateEosAccountDialog.java    From EosCommander with MIT License 5 votes vote down vote up
@Override
public String getSelectedWalletName() {
    if ( mWalletSpinner.getVisibility() != View.VISIBLE ) {
        return null;
    }

    if ( mWalletSpinner.getSelectedItemPosition() == WALLET_SPINNER_SELECT_NOTICE_INDEX) { // select wallet notice
        return null;
    }

    return mWalletSpinner.getSelectedItem().toString();
}
 
Example 11
Source File: IndicatorLayout.java    From AndroidBase with Apache License 2.0 5 votes vote down vote up
public final boolean isVisible() {
	Animation currentAnim = getAnimation();
	if (null != currentAnim) {
		return mInAnim == currentAnim;
	}

	return getVisibility() == View.VISIBLE;
}
 
Example 12
Source File: SubscriptionsFeedFragment.java    From SkyTube with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Set up the UI depending to the total number of channel the user is subscribed to.
 *
 * @param totalSubbedChannels   Total number of channel the user is subscribed to.
 */
private void setupUiAccordingToNumOfSubbedChannels(int totalSubbedChannels) {
	if (totalSubbedChannels <= 0) {
		swipeRefreshLayout.setVisibility(View.GONE);
		noSubscriptionsText.setVisibility(View.VISIBLE);
	} else {
		if (swipeRefreshLayout.getVisibility() != View.VISIBLE) {
			swipeRefreshLayout.setVisibility(View.VISIBLE);
			noSubscriptionsText.setVisibility(View.GONE);
		}
	}
}
 
Example 13
Source File: RuleViewModel.java    From Jockey with Apache License 2.0 5 votes vote down vote up
private void setupValueAdapter() {
    if (mValueSubscription != null) {
        mValueSubscription.unsubscribe();
    }

    if (getValueSpinnerVisibility() != View.VISIBLE) {
        return;
    }

    mValueAdapter = null;
    switch (mFactory.getType()) {
        case AutoPlaylistRule.SONG:
            setupSongAdapter();
            break;
        case AutoPlaylistRule.ARTIST:
            setupArtistAdapter();
            break;
        case AutoPlaylistRule.ALBUM:
            setupAlbumAdapter();
            break;
        case AutoPlaylistRule.GENRE:
            setupGenreAdapter();
            break;
        case AutoPlaylistRule.PLAYLIST:
            setupPlaylistAdapter();
            break;
    }

    notifyPropertyChanged(BR.valueAdapter);
}
 
Example 14
Source File: DeepShortcutView.java    From LaunchEnr with GNU General Public License v3.0 4 votes vote down vote up
public boolean willDrawIcon() {
    return mIconView.getVisibility() == View.VISIBLE;
}
 
Example 15
Source File: LoginButton.java    From kognitivo with Apache License 2.0 4 votes vote down vote up
private void showToolTipPerSettings(FetchedAppSettings settings) {
    if (settings != null && settings.getNuxEnabled() && getVisibility() == View.VISIBLE) {
        String toolTipString = settings.getNuxContent();
        displayToolTip(toolTipString);
    }
}
 
Example 16
Source File: ActionBarImpl.java    From zen4android with MIT License 4 votes vote down vote up
public boolean isShowing() {
    return mContainerView.getVisibility() == View.VISIBLE;
}
 
Example 17
Source File: StandardVideoOSPlayer.java    From VideoOS-Android-SDK with GNU General Public License v3.0 4 votes vote down vote up
/**
 * 点击触摸显示和隐藏逻辑
 */
@Override
protected void onClickUiToggle() {
    if (mIfCurrentIsFullscreen && mLockCurScreen && mNeedLockFull) {
        setViewShowState(mLockScreen, VISIBLE);
        return;
    }
    if (mCurrentState == CURRENT_STATE_PREPAREING) {
        if (mBottomContainer != null) {
            if (mBottomContainer.getVisibility() == View.VISIBLE) {
                changeUiToPrepareingClear();
            } else {
                changeUiToPreparingShow();
            }
        }
    } else if (mCurrentState == CURRENT_STATE_PLAYING) {
        if (mBottomContainer != null) {
            if (mBottomContainer.getVisibility() == View.VISIBLE) {
                changeUiToPlayingClear();
            } else {
                changeUiToPlayingShow();
            }
        }
    } else if (mCurrentState == CURRENT_STATE_PAUSE) {
        if (mBottomContainer != null) {
            if (mBottomContainer.getVisibility() == View.VISIBLE) {
                changeUiToPauseClear();
            } else {
                changeUiToPauseShow();
            }
        }
    } else if (mCurrentState == CURRENT_STATE_AUTO_COMPLETE) {
        if (mBottomContainer != null) {
            if (mBottomContainer.getVisibility() == View.VISIBLE) {
                changeUiToCompleteClear();
            } else {
                changeUiToCompleteShow();
            }
        }
    } else if (mCurrentState == CURRENT_STATE_PLAYING_BUFFERING_START) {
        if (mBottomContainer != null) {
            if (mBottomContainer.getVisibility() == View.VISIBLE) {
                changeUiToPlayingBufferingClear();
            } else {
                changeUiToPlayingBufferingShow();
            }
        }
    }
}
 
Example 18
Source File: KcaExpeditionCheckViewService.java    From kcanotify_h5-master with GNU General Public License v3.0 4 votes vote down vote up
private void setItemViewVisibilityById(int id, boolean visible) {
    int visible_value = visible ? View.VISIBLE : View.GONE;
    itemView.findViewById(id).setVisibility(visible_value);
}
 
Example 19
Source File: LocationActivity.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
private void updateClipView(int firstVisibleItem) {
    if (firstVisibleItem == RecyclerView.NO_POSITION) {
        return;
    }
    int height = 0;
    int top = 0;
    View child = listView.getChildAt(0);
    if (child != null) {
        if (firstVisibleItem == 0) {
            top = child.getTop();
            height = overScrollHeight + (top < 0 ? top : 0);
        }
        FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) mapViewClip.getLayoutParams();
        if (layoutParams != null) {
            if (height <= 0) {
                if (mapView.getVisibility() == View.VISIBLE) {
                    mapView.setVisibility(View.INVISIBLE);
                    mapViewClip.setVisibility(View.INVISIBLE);
                }
            } else {
                if (mapView.getVisibility() == View.INVISIBLE) {
                    mapView.setVisibility(View.VISIBLE);
                    mapViewClip.setVisibility(View.VISIBLE);
                }
            }

            mapViewClip.setTranslationY(Math.min(0, top));
            mapView.setTranslationY(Math.max(0, -top / 2));
            if (markerImageView != null) {
                markerImageView.setTranslationY(markerTop = -top - AndroidUtilities.dp(42) + height / 2);
                markerXImageView.setTranslationY(-top - AndroidUtilities.dp(7) + height / 2);
            }
            if (routeButton != null) {
                routeButton.setTranslationY(top);
            }
            layoutParams = (FrameLayout.LayoutParams) mapView.getLayoutParams();
            if (layoutParams != null && layoutParams.height != overScrollHeight + AndroidUtilities.dp(10)) {
                layoutParams.height = overScrollHeight + AndroidUtilities.dp(10);
                if (googleMap != null) {
                    googleMap.setPadding(AndroidUtilities.dp(70), 0, AndroidUtilities.dp(70), AndroidUtilities.dp(10));
                }
                mapView.setLayoutParams(layoutParams);
            }
        }
    }
}
 
Example 20
Source File: BasePage.java    From Paginize with MIT License 4 votes vote down vote up
protected boolean isContentViewVisible() {
  return mLayoutContainer.getVisibility() == View.VISIBLE;
}