This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import sys | |
import os | |
filename=sys.argv[1] | |
newline = "" | |
with open(filename, 'r') as file: | |
for line in file.readlines(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function | |
import json | |
import time | |
import os | |
from flask import Flask | |
from googleapiclient.discovery import build | |
SCOPES = ['https://www.googleapis.com/auth/spreadsheets.readonly'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Starts circular reveal animation | |
* [fromLeft] if `true` then start animation from the bottom left of the [View] else start from the bottom right | |
*/ | |
fun View.startCircularReveal(fromLeft: Boolean) { | |
addOnLayoutChangeListener(object : View.OnLayoutChangeListener { | |
override fun onLayoutChange(v: View, left: Int, top: Int, right: Int, bottom: Int, oldLeft: Int, oldTop: Int, | |
oldRight: Int, oldBottom: Int) { | |
v.removeOnLayoutChangeListener(this) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class OneFragment : Fragment(), ExitWithAnimation { | |
override var posX: Int? = null | |
override var posY: Int? = null | |
override fun isToBeExitedWithAnimation(): Boolean = true | |
companion object { | |
@JvmStatic | |
fun newInstance(exit: IntArray? = null): OneFragment = OneFragment().apply { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LocalCacheDataSourceFactory(private val context: Context) : DataSource.Factory { | |
private val defaultDataSourceFactory: DefaultDataSourceFactory | |
//TODO Needs to be a singleton | |
private val simpleCache: SimpleCache = SimpleCache( | |
File(context.cacheDir, "media"), | |
LeastRecentlyUsedCacheEvictor(MAX_CACHE_SIZE) | |
) | |
private val cacheDataSink: CacheDataSink = CacheDataSink(simpleCache, MAX_FILE_SIZE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@BindingAdapter("video_url", "on_state_change") | |
fun PlayerView.loadVideo(url: String, callback: PlayerStateChange) { | |
if (url == null) return | |
val player = ExoPlayerFactory.newSimpleInstance( | |
context, DefaultRenderersFactory(context), DefaultTrackSelector(), | |
DefaultLoadControl() | |
) | |
player.playWhenReady = true | |
player.repeatMode = Player.REPEAT_MODE_ALL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface PlayerStateCallback { | |
/** | |
* Callback to when the [PlayerView] has fetched the duration of video | |
**/ | |
fun onVideoDurationRetrieved(duration: Long, player: Player) | |
fun onVideoBuffering(player: Player) | |
fun onStartedPlaying(player: Player) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<layout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto"> | |
<data> | |
<variable | |
name="url" | |
type="String"/> | |
<variable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//... | |
//Extend NetworkSensingBaseActivity class to override default behaviour of this activity | |
class MainActivity : NetworkSensingBaseActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
//... | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//.. | |
/** | |
* Extend this activity whenever you want the activity to react to network status changes | |
*/ | |
@SuppressLint("Registered") | |
open class NetworkSensingBaseActivity : AppCompatActivity(), ConnectionStateMonitor.OnNetworkAvailableCallbacks { | |
var snackbar: CustomSnackbar? = null | |
private var connectionStateMonitor: ConnectionStateMonitor? = null |
NewerOlder