Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

class MainActivity : AppCompatActivity() {
private lateinit var textInputView: AppCompatEditText
private lateinit var textOutputView: AppCompatTextView
private lateinit var biometricPrompt: BiometricPrompt
private lateinit var promptInfo: BiometricPrompt.PromptInfo
private var readyToEncrypt: Boolean = false
private lateinit var cryptographyManager: CryptographyManager
private lateinit var secretKeyName: String
private lateinit var ciphertext:ByteArray
@Ayesha17
Ayesha17 / PhonecallReceiver.java
Created April 24, 2020 11:06 — forked from ftvs/PhonecallReceiver.java
Detecting an incoming call coming to an Android device. Remember to set the appropriate permissions in AndroidManifest.xml as suggested in the Stackoverflow link. Usage example in comments. Source: http://stackoverflow.com/a/15564021/264619 Explanation: http://gabesechansoftware.com/is-the-phone-ringing/#more-8
package com.gabesechan.android.reusable.receivers;
import java.util.Date;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.telephony.TelephonyManager;
public abstract class PhonecallReceiver extends BroadcastReceiver {
@Ayesha17
Ayesha17 / meteor.d.ts
Created November 30, 2017 04:45 — forked from tomitrescak/meteor.d.ts
Typescript definition for Meteor 1.3
// Type definitions for Meteor 1.3
// Project: http://www.meteor.com/
// Definitions by: Dave Allen <https://github.com/fullflavedave>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/**
* These are the common (for client and server) modules and interfaces that can't be automatically generated from the Meteor data.js file
*/
interface EJSONable {
@Ayesha17
Ayesha17 / meteor.d.ts
Created November 30, 2017 04:45 — forked from tomitrescak/meteor.d.ts
Typescript definition for Meteor 1.3
// Type definitions for Meteor 1.3
// Project: http://www.meteor.com/
// Definitions by: Dave Allen <https://github.com/fullflavedave>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/**
* These are the common (for client and server) modules and interfaces that can't be automatically generated from the Meteor data.js file
*/
interface EJSONable {
import android.accounts.Account;
import android.accounts.AccountManager;
import android.accounts.AccountManagerCallback;
import android.accounts.AccountManagerFuture;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.util.Log;
@Ayesha17
Ayesha17 / EndlessListActivity.java
Created October 6, 2017 05:03 — forked from polbins/EndlessListActivity.java
Android Endless Scroll using RecyclerView
public class EndlessListActivity<D> extends Activity {
private EndlessRecyclerOnScrollListener mEndlessScrollListener;
private EndlessListAdapter mAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
RecyclerView listView = (RecyclerView) findViewById(R.id.list);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
@Ayesha17
Ayesha17 / EndlessRecyclerOnScrollListener.java
Created October 6, 2017 04:54 — forked from ssinss/EndlessRecyclerOnScrollListener.java
Endless RecyclerView OnScrollListener
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener {
public static String TAG = EndlessRecyclerOnScrollListener.class.getSimpleName();
private int previousTotal = 0; // The total number of items in the dataset after the last load
private boolean loading = true; // True if we are still waiting for the last set of data to load.
private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more.
int firstVisibleItem, visibleItemCount, totalItemCount;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener {
public static String TAG = EndlessRecyclerOnScrollListener.class.getSimpleName();
private int previousTotal = 0; // The total number of items in the dataset after the last load
private boolean loading = true; // True if we are still waiting for the last set of data to load.
private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more.
int firstVisibleItem, visibleItemCount, totalItemCount;
@Ayesha17
Ayesha17 / AdapterItem.java
Created October 4, 2017 10:59 — forked from esantiago1/AdapterItem.java
Endless Scroll RecyclerView
import android.os.Handler;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ProgressBar;
import android.widget.TextView;
@Ayesha17
Ayesha17 / VideoControllerView
Created August 29, 2017 12:37 — forked from prasad091/VideoControllerView
Custom Media Controller android
/*
* Copyright (C) 2006 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