Skip to content

Instantly share code, notes, and snippets.

View yakivmospan's full-sized avatar

Yakiv Mospan yakivmospan

View GitHub Profile
Android Swipe Refresh
/*
* Copyright 2014 Chris Banes
*
* 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
/*
* Copyright (C) 2014 Chris Banes
*
* 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
TextView txt = (TextView) findViewById(R.id.custom_fonts);
txt.setTextSize(30);
Typeface font = Typeface.createFromAsset(getAssets(), "Akshar.ttf");
Typeface font2 = Typeface.createFromAsset(getAssets(), "bangla.ttf");
SpannableStringBuilder SS = new SpannableStringBuilder("আমারநல்வரவு");
SS.setSpan (new CustomTypefaceSpan("", font2), 0, 4,Spanned.SPAN_EXCLUSIVE_INCLUSIVE);
SS.setSpan (new CustomTypefaceSpan("", font), 4, 11,Spanned.SPAN_EXCLUSIVE_INCLUSIVE);
txt.setText(SS);
/**
* Created by Yakiv M. on 24.07.14.
*/
import android.content.Context;
import android.database.DataSetObservable;
import android.database.DataSetObserver;
import android.os.Build;
import android.util.AttributeSet;
@yakivmospan
yakivmospan / 1. Android Custom Actionbar Title.md
Last active August 29, 2015 14:11
Android Custom Actionbar Title

Android Custom Actionbar Title

Important:

  • Use R.layout.ben_toolbar_simple_title if you have menu items in layout, or doesn't have any buttons at all
  • Use R.layout.ben_toolbar_margin_title if you have only one button in left corner (it could be back button for e.g)

Android Adapters

@yakivmospan
yakivmospan / readme.md
Created January 17, 2017 23:54 — forked from coolaj86/how-to-publish-to-npm.md
How to publish packages to NPM

Getting Started with NPM (as a developer)

If you haven't already set your NPM author info, now you should:

npm set init.author.name "Your Name"
npm set init.author.email "you@example.com"
npm set init.author.url "http://yourblog.com"

npm adduser

if (BuildConfig.DEBUG) {
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectCustomSlowCalls()
.detectDiskReads()
.detectDiskWrites()
.detectNetwork()
.penaltyLog()
.build());
StrictMode.VmPolicy.Builder vmPolicy = new StrictMode.VmPolicy.Builder()
private val keyguardManager: KeyguardManager
init {
keyguardManager = context.getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager
}
fun isDeviceSecure(): Boolean = if (hasMarshmallow()) keyguardManager.isDeviceSecure else keyguardManager.isKeyguardSecure
// Used to block application if no lock screen is setup.
fun showDeviceSecurityAlert(): AlertDialog {