Skip to content

Instantly share code, notes, and snippets.

View mreram's full-sized avatar
🏠
Working from home

Mohammad Reza Eram mreram

🏠
Working from home
  • Austria
View GitHub Profile
@mreram
mreram / VideoPlayerWebChromeClient.kt
Last active February 7, 2023 08:42
Fixing full screen issue on webView android - jetpack compose
/**
* created by Mohammad Reza Eram
*/
class VideoPlayerWebChromeClient(private val activity: Activity) : WebChromeClient() {
private var mCustomView: View? = null
private var mCustomViewCallback: CustomViewCallback? = null
@Suppress("MagicNumber")
override fun getDefaultVideoPoster(): Bitmap? {
@mreram
mreram / PrintActivity.java
Last active February 7, 2023 08:41
An implementation of an activity for connecting to a Bixolon printer
package ir.eram.printexample;
import android.app.ProgressDialog;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothClass;
import android.bluetooth.BluetoothDevice;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.AsyncTask;
import android.os.Bundle;
@mreram
mreram / CViewPager.kt
Last active February 7, 2023 08:37
A custom View Pager with some gestures and animations
package eram.ir.camerapager
import android.animation.ValueAnimator
import android.app.Activity
import android.content.Context
import android.support.v4.app.FragmentActivity
import android.support.v4.view.ViewPager
import android.util.AttributeSet
import android.util.Log
import android.view.MotionEvent
@mreram
mreram / bypass_script.sh
Created March 27, 2021 19:32
by pass an ip through vpn in ubuntu
DEV=enp4s0
GW=$(ip route list | sed "s/.* via \([0-9.]*\) dev $DEV.*/\1/;t;d"|head -1)
route add -host git.mycompany.com gw $GW $DEV
Remap Super(left) to ctrl left:
remove mod4 = Super_L
add control = Super_L
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.consumeEach
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.broadcastIn
import kotlinx.coroutines.test.runBlockingTest
import org.junit.Test
class StateFlowBroadcastTest {
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.FlowPreview
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.launch
import kotlinx.coroutines.test.runBlockingTest
import org.junit.Test
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.BroadcastChannel
import kotlinx.coroutines.channels.consume
import kotlinx.coroutines.test.runBlockingTest
import org.junit.Test
class BroadcastChannelTest {
@ExperimentalCoroutinesApi
companion object {
@mreram
mreram / CameraFragment.kt
Created August 19, 2018 09:58
CameraFragment with some gestures and animations
package eram.ir.camerapager
import android.os.Bundle
import android.support.v4.app.Fragment
import kotlinx.android.synthetic.main.camera_fragment.*
import android.view.*
import android.widget.FrameLayout
import android.animation.ValueAnimator
import android.content.res.Resources
import android.view.animation.DecelerateInterpolator