Java Code Examples for android.view.View#VISIBLE

The following examples show how to use android.view.View#VISIBLE . These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
@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 Project: ucar-weex-core   File: WXViewUtils.java    License: 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 Project: AndroidAutoClick   File: MainActivity.java    License: 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 4
@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 Project: weex   File: ViewUtil.java    License: 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 Project: ListItemFold   File: DetailAnimViewGroup.java    License: 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 Project: AndroidBase   File: IndicatorLayout.java    License: 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 8
/**
 * 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 9
Source Project: Jockey   File: RuleViewModel.java    License: 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 10
Source Project: EosCommander   File: CreateEosAccountDialog.java    License: 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
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 12
@Override
protected void onWindowVisibilityChanged(int visibility) {
    super.onWindowVisibilityChanged(visibility);

    if (visibility == View.VISIBLE) {
        registerSensorManager();
    } else {
        unregisterSensorManager();
    }
}
 
Example 13
@Override
void updateCheckboxState(CheckBox checkBox, boolean graphObjectSelected) {
    checkBox.setChecked(graphObjectSelected);
    int visible = (graphObjectSelected || selectionStrategy
            .shouldShowCheckBoxIfUnselected()) ? View.VISIBLE : View.GONE;
    checkBox.setVisibility(visible);
}
 
Example 14
Source Project: Paginize   File: BasePage.java    License: MIT License 4 votes vote down vote up
protected boolean isContentViewVisible() {
  return mLayoutContainer.getVisibility() == View.VISIBLE;
}
 
Example 15
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 16
private void setItemViewVisibilityById(int id, boolean visible) {
    int visible_value = visible ? View.VISIBLE : View.GONE;
    itemView.findViewById(id).setVisibility(visible_value);
}
 
Example 17
/**
 * 点击触摸显示和隐藏逻辑
 */
@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
public boolean willDrawIcon() {
    return mIconView.getVisibility() == View.VISIBLE;
}
 
Example 19
Source Project: zen4android   File: ActionBarImpl.java    License: MIT License 4 votes vote down vote up
public boolean isShowing() {
    return mContainerView.getVisibility() == View.VISIBLE;
}
 
Example 20
Source Project: kognitivo   File: LoginButton.java    License: 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);
    }
}