Skip to content

Instantly share code, notes, and snippets.

Avatar

< B@!uS /> BALUSANGEM

View GitHub Profile
View Sample.java
import java.util.*;
public class Sample{
public static void main(String[] args){
System.out.println("Hello world ");
}
}
View ConnectionDetector.java
//Give Your PackageName Ex:com.companyname.projectname;
package com.pgeek.sample;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
public class ConnectionDetector {
private Context _context;
View ViewPagerWithFragmentshavingGridView.java
public class MainActivity extends AppCompatActivity{
SectionsPagerAdapter mSectionsPagerAdapter;
static SessioManager session;
ViewPager mViewPager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
// Set up the ViewPager with the sections adapter.
mViewPager = (ViewPager) findViewById(R.id.pager);
@BALUSANGEM
BALUSANGEM / LollipopBitmapMemoryCacheParamsSupplier.java
Created Sep 5, 2017 — forked from sensen/LollipopBitmapMemoryCacheParamsSupplier.java
Fresco's custom BitmapMemoryCacheParamsSupplier for Lollipop devices
View LollipopBitmapMemoryCacheParamsSupplier.java
public class LollipopBitmapMemoryCacheParamsSupplier implements Supplier<MemoryCacheParams> {
private ActivityManager activityManager;
public LollipopBitmapMemoryCacheParamsSupplier(ActivityManager activityManager) {
this.activityManager = activityManager;
}
@Override
public MemoryCacheParams get() {
View Retrofit testing sample code
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.squareup.retrofit2:retrofit:2.0.2'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
public class ApiClient {
public static final String BASE_URL = "http://indianvedicschool.com/";
private static Retrofit retrofit = null;
public static Retrofit getClient() {
if (retrofit==null) {
View BLE
open class BaseGhattCallback : BluetoothGattCallback() {
var mIsDeviceConnected = false
internal var mCommandCharacteristic: BluetoothGattCharacteristic? = null
open val TAG = BaseGhattCallback::class.java.simpleName
private val SUBSCRIBE_CHARACTERISTIC: Int = 0
private val READ_CHARACTERISTIC: Int = 1
private val WRITE_CHARACTERISTIC: Int = 2
fun queueReadDataFromCharacteristic(gatt: BluetoothGatt, characteristic: BluetoothGattCharacteristic) {
View STACK_ACTIVITY
class LoginActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_login)
goto_main_screen_button.setOnClickListener {
gotoMainScreen()
}
}
private fun gotoMainScreen() {
View LauncherSecondActivity.java
public class AppsListActivity extends Activity {
private PackageManager manager;
private ArrayList<AppDetail> apps;
private ListView list;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_apps_list);
View ViewRenderer_draw().java
public void draw(float[] cameraView, float[] cameraPerspective) {
if (done || !prepared) {
return;
}
synchronized (this) {
if (frameAvailable) {
videoTexture.updateTexImage();
frameAvailable = false;
if (videoTexture != null) {
View VideoRenderer_update().java
public void update(float[] modelMatrix) {
float[] scaleMatrix = new float[16];
Matrix.setIdentityM(scaleMatrix, 0);
float SCALE_FACTOR = 1f;
scaleMatrix[0] = SCALE_FACTOR;
scaleMatrix[5] = SCALE_FACTOR;
scaleMatrix[10] = SCALE_FACTOR;
Matrix.multiplyMM(this.mModelMatrix, 0, modelMatrix, 0, scaleMatrix, 0);
}