use of android.annotation.SuppressLint in project android-gpuimage by CyberAgent.
the class GPUImageFilterGroup method onDraw.
/*
* (non-Javadoc)
* @see jp.co.cyberagent.android.gpuimage.GPUImageFilter#onDraw(int,
* java.nio.FloatBuffer, java.nio.FloatBuffer)
*/
@SuppressLint("WrongCall")
@Override
public void onDraw(final int textureId, final FloatBuffer cubeBuffer, final FloatBuffer textureBuffer) {
runPendingOnDrawTasks();
if (!isInitialized() || mFrameBuffers == null || mFrameBufferTextures == null) {
return;
}
if (mMergedFilters != null) {
int size = mMergedFilters.size();
int previousTexture = textureId;
for (int i = 0; i < size; i++) {
GPUImageFilter filter = mMergedFilters.get(i);
boolean isNotLast = i < size - 1;
if (isNotLast) {
GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, mFrameBuffers[i]);
GLES20.glClearColor(0, 0, 0, 0);
}
if (i == 0) {
filter.onDraw(previousTexture, cubeBuffer, textureBuffer);
} else if (i == size - 1) {
filter.onDraw(previousTexture, mGLCubeBuffer, (size % 2 == 0) ? mGLTextureFlipBuffer : mGLTextureBuffer);
} else {
filter.onDraw(previousTexture, mGLCubeBuffer, mGLTextureBuffer);
}
if (isNotLast) {
GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);
previousTexture = mFrameBufferTextures[i];
}
}
}
}
use of android.annotation.SuppressLint in project bilibili-android-client by HotBitmapGG.
the class VideoDetailsActivity method initToolBar.
@SuppressLint("SetTextI18n")
@Override
public void initToolBar() {
mToolbar.setTitle("");
setSupportActionBar(mToolbar);
ActionBar supportActionBar = getSupportActionBar();
if (supportActionBar != null) {
supportActionBar.setDisplayHomeAsUpEnabled(true);
}
//设置还没收缩时状态下字体颜色
mCollapsingToolbarLayout.setExpandedTitleColor(Color.TRANSPARENT);
//设置收缩后Toolbar上字体的颜色
mCollapsingToolbarLayout.setCollapsedTitleTextColor(Color.WHITE);
//设置StatusBar透明
SystemBarHelper.immersiveStatusBar(this);
SystemBarHelper.setHeightAndPadding(this, mToolbar);
mAvText.setText("av" + av);
}
use of android.annotation.SuppressLint in project bilibili-android-client by HotBitmapGG.
the class VideoPlayerActivity method initMediaPlayer.
@SuppressLint("UseSparseArrays")
private void initMediaPlayer() {
//配置播放器
MediaController mMediaController = new MediaController(this);
mMediaController.setTitle(title);
mPlayerView.setMediaController(mMediaController);
mPlayerView.setMediaBufferingIndicator(mBufferingIndicator);
mPlayerView.requestFocus();
mPlayerView.setOnInfoListener(onInfoListener);
mPlayerView.setOnSeekCompleteListener(onSeekCompleteListener);
mPlayerView.setOnCompletionListener(onCompletionListener);
mPlayerView.setOnControllerEventsListener(onControllerEventsListener);
//设置弹幕开关监听
mMediaController.setDanmakuSwitchListener(this);
//设置返回键监听
mMediaController.setVideoBackEvent(this);
//配置弹幕库
mDanmakuView.enableDanmakuDrawingCache(true);
//设置最大显示行数
HashMap<Integer, Integer> maxLinesPair = new HashMap<>();
//滚动弹幕最大显示5行
maxLinesPair.put(BaseDanmaku.TYPE_SCROLL_RL, 5);
//设置是否禁止重叠
HashMap<Integer, Boolean> overlappingEnablePair = new HashMap<>();
overlappingEnablePair.put(BaseDanmaku.TYPE_SCROLL_RL, true);
overlappingEnablePair.put(BaseDanmaku.TYPE_FIX_TOP, true);
//设置弹幕样式
danmakuContext = DanmakuContext.create();
danmakuContext.setDanmakuStyle(IDisplayer.DANMAKU_STYLE_STROKEN, 3).setDuplicateMergingEnabled(false).setScrollSpeedFactor(1.2f).setScaleTextSize(0.8f).setMaximumLines(maxLinesPair).preventOverlapping(overlappingEnablePair);
loadData();
}
use of android.annotation.SuppressLint in project AndroidChromium by JackyAndroid.
the class ManageSpaceActivity method onCreate.
@SuppressLint("CommitPrefEdits")
@Override
protected void onCreate(Bundle savedInstanceState) {
ensureActivityNotExported();
setContentView(R.layout.manage_space_activity);
Resources r = getResources();
setTitle(String.format(r.getString(R.string.storage_management_activity_label), r.getString(R.string.app_name)));
mSiteDataSizeText = (TextView) findViewById(R.id.site_data_storage_size_text);
mSiteDataSizeText.setText(R.string.storage_management_computing_size);
mUnimportantSiteDataSizeText = (TextView) findViewById(R.id.unimportant_site_data_storage_size_text);
mUnimportantSiteDataSizeText.setText(R.string.storage_management_computing_size);
mManageSiteDataButton = (Button) findViewById(R.id.manage_site_data_storage);
mClearUnimportantButton = (Button) findViewById(R.id.clear_unimportant_site_data_storage);
// We initially disable all of our buttons except for the 'Clear All Data' button, and wait
// until the browser is finished initializing to enable them. We want to make sure the
// 'Clear All Data' button is enabled so users can do this even if it's taking forever for
// the Chromium process to boot up.
mManageSiteDataButton.setEnabled(false);
mClearUnimportantButton.setEnabled(false);
mManageSiteDataButton.setOnClickListener(this);
mClearUnimportantButton.setOnClickListener(this);
// We should only be using this activity if we're >= KitKat.
assert android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT;
mClearAllDataButton = (Button) findViewById(R.id.clear_all_data);
mClearAllDataButton.setOnClickListener(this);
super.onCreate(savedInstanceState);
BrowserParts parts = new EmptyBrowserParts() {
@Override
public void finishNativeInitialization() {
ManageSpaceActivity.this.finishNativeInitialization();
}
@Override
public void onStartupFailure() {
mSiteDataSizeText.setText(R.string.storage_management_startup_failure);
mUnimportantSiteDataSizeText.setText(R.string.storage_management_startup_failure);
}
};
// Allow reading/writing to disk to check whether the last attempt was successful before
// kicking off the browser process initialization.
StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads();
StrictMode.allowThreadDiskWrites();
try {
String productVersion = AboutChromePreferences.getApplicationVersion(this, ChromeVersionInfo.getProductVersion());
String failedVersion = ContextUtils.getAppSharedPreferences().getString(PREF_FAILED_BUILD_VERSION, null);
if (TextUtils.equals(failedVersion, productVersion)) {
parts.onStartupFailure();
return;
}
// If the native library crashes and kills the browser process, there is no guarantee
// java-side the pref will be written before the process dies. We want to make sure we
// don't attempt to start the browser process and have it kill chrome. This activity is
// used to clear data for the chrome app, so it must be particularly error resistant.
ContextUtils.getAppSharedPreferences().edit().putString(PREF_FAILED_BUILD_VERSION, productVersion).commit();
} finally {
StrictMode.setThreadPolicy(oldPolicy);
}
try {
ChromeBrowserInitializer.getInstance(getApplicationContext()).handlePreNativeStartup(parts);
ChromeBrowserInitializer.getInstance(getApplicationContext()).handlePostNativeStartup(true, parts);
} catch (Exception e) {
// We don't want to exit, as the user should still be able to clear all browsing data.
Log.e(TAG, "Unable to load native library.", e);
mSiteDataSizeText.setText(R.string.storage_management_startup_failure);
mUnimportantSiteDataSizeText.setText(R.string.storage_management_startup_failure);
}
}
use of android.annotation.SuppressLint in project bilibili-android-client by HotBitmapGG.
the class MediaController method show.
/**
* 在屏幕上显示控制器
*/
@SuppressLint("InlinedApi")
public void show(int timeout) {
if (!mShowing && mAnchor != null && mAnchor.getWindowToken() != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
mAnchor.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
}
if (mPauseButton != null && mTvPlay != null) {
mPauseButton.requestFocus();
mTvPlay.requestFocus();
}
disableUnsupportedButtons();
if (mFromXml) {
setVisibility(View.VISIBLE);
} else {
int[] location = new int[2];
mAnchor.getLocationOnScreen(location);
Rect anchorRect = new Rect(location[0], location[1], location[0] + mAnchor.getWidth(), location[1] + mAnchor.getHeight());
mWindow.setAnimationStyle(mAnimStyle);
mWindow.showAtLocation(mAnchor, Gravity.BOTTOM, anchorRect.left, 0);
}
mShowing = true;
if (mShownListener != null) {
mShownListener.onShown();
}
}
updatePausePlay();
mHandler.sendEmptyMessage(SHOW_PROGRESS);
if (timeout != 0) {
mHandler.removeMessages(FADE_OUT);
mHandler.sendMessageDelayed(mHandler.obtainMessage(FADE_OUT), timeout);
}
}
Aggregations