Skip to content

Instantly share code, notes, and snippets.

View nyinyiz's full-sized avatar
:shipit:

nyinyiz nyinyiz

:shipit:
View GitHub Profile
private fun initPopupQuality() {
val mappedTrackInfo = trackSelector.currentMappedTrackInfo
var videoRenderer : Int? = null
if(mappedTrackInfo == null) return else exo_quality.visibility = View.VISIBLE
for(i in 0 until mappedTrackInfo.rendererCount){
if(isVideoRenderer(mappedTrackInfo, i)){
videoRenderer = i
}
@SuppressLint("SourceLockedOrientationActivity")
private fun openFullscreen(){
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
exo_fullscreen_icon.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_fullscreen_shrink))
player_view.setBackgroundColor(ContextCompat.getColor(this, R.color.colorBlack))
val params: LinearLayout.LayoutParams = player_view.layoutParams as LinearLayout.LayoutParams
params.width = LinearLayout.LayoutParams.MATCH_PARENT
params.height = LinearLayout.LayoutParams.MATCH_PARENT
player_view.layoutParams = params
@SuppressLint("SourceLockedOrientationActivity")
private fun openFullscreenDialog() {
exo_fullscreen_icon.setImageDrawable(
ContextCompat.getDrawable(this, R.drawable.ic_fullscreen_shrink)
)
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
(player_view.parent as ViewGroup).removeView(player_view)
fullscreenDialog?.addContentView(player_view, ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT))
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
private void initPlayer() {
player = new SimpleExoPlayer.Builder(this).build();
playerView.setPlayer(player);
MediaItem mediaItem = MediaItem.fromUri(getString(R.string.media_url_mp4));
player.setMediaItem(mediaItem);
player.setPlayWhenReady(playWhenReady);
player.seekTo(currentWindow, playbackPosition);
player.prepare();
<?xml version="1.0" encoding="utf-8"?>
<layer-list>
<item>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/bgSolidDark" />
</shape>
</item>
package com.ramotion.expandingcollection;
import android.graphics.BitmapFactory;
/**
* Bitmap Factory Options with inScaled flag disabled by default
*/
public class BitmapFactoryOptions extends BitmapFactory.Options {
public BitmapFactoryOptions() {
this.inScaled = false;
package com.ramotion.expandingcollection;
import android.graphics.Bitmap;
import android.util.LruCache;
/**
* LruCache for caching background bitmaps for {@link ECBackgroundSwitcherView}.
* Key is id of page from {@link ECPager} and value is background bitmap from provided data.
*/
public class BackgroundBitmapCache {
package com.ramotion.expandingcollection;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.os.AsyncTask;
import android.support.annotation.DrawableRes;
/**
package com.ramotion.expandingcollection;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.os.AsyncTask;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.view.View;