Skip to content

Instantly share code, notes, and snippets.

View Angels-group's full-sized avatar

Denis Voronov Angels-group

View GitHub Profile
@Angels-group
Angels-group / MainActivity.java
Created November 30, 2017 11:19 — forked from gabrielemariotti/MainActivity.java
How to obtain a CardView (support library) with a Image and rounded corners for API<21
ImageView imageView = (ImageView) findViewById(R.id.card_thumbnail_image);
Bitmap mBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.rose);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
//Default
imageView.setBackgroundResource(R.drawable.rose);
} else {
//RoundCorners
RoundCornersDrawable round = new RoundCornersDrawable(mBitmap,
getResources().getDimension(R.dimen.cardview_default_radius), 0); //or your custom radius
@Angels-group
Angels-group / ScreenBrightness.java
Created January 15, 2018 20:18 — forked from melihmucuk/ScreenBrightness.java
Programmatically changing screen brightness on Android
boolean ScreenBrightness(int level, Context context) {
try {
android.provider.Settings.System.putInt(
context.getContentResolver(),
android.provider.Settings.System.SCREEN_BRIGHTNESS, level);
android.provider.Settings.System.putInt(context.getContentResolver(),
android.provider.Settings.System.SCREEN_BRIGHTNESS_MODE,
package com.spadoba.common.view;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.widget.FrameLayout;
import com.spadoba.common.R;
public class SquareFrameLayout extends FrameLayout {
@Angels-group
Angels-group / FullscreenFragment.java
Created February 17, 2018 18:26 — forked from gelldur/FullscreenFragment.java
FullscreenFragment - simple android fragment that will make fullscreen for you. Remember to: "You must manually call onKeyDown and onWindowFocusChanged."
package com.dexode.fragment;
import android.annotation.TargetApi;
import android.app.Activity;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.Fragment;
import android.view.KeyEvent;
@Angels-group
Angels-group / AudioManager
Created February 18, 2018 15:35
is music playing now
AudioManager manager = (AudioManager)this.getSystemService(Context.AUDIO_SERVICE);
if(manager.isMusicActive())
{
// do something - or do it not
}
@Angels-group
Angels-group / tokens.md
Created May 24, 2018 07:42 — forked from zmts/tokens.md
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication(JWT)

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication(JWT)

Preconditions:

В данной заметке рассматривается работа JWT с симметичным алгоритмом шифрования (HS256/HS384/HS512)

Основы:

Аутентификация(authentication, от греч. αὐθεντικός [authentikos] – реальный, подлинный; от αὐθέντης [authentes] – автор) - это процесс проверки учётных данных пользователя (логин/пароль). Проверка подлинности пользователя путём сравнения введённого им логина/пароля с логином/паролем, сохранённым в базе данных пользователей.

Авторизация(authorization — разрешение, уполномочивание) - это проверка прав пользователя на доступ к определенным ресурсам.

@Angels-group
Angels-group / gist:b164f365e3a8501375b47e5a48d44487
Created January 6, 2019 20:06 — forked from pedrovgs/gist:c424fe754a74f326e997
Configure your Activity to be opened when the user taps home button with a long press action.
<activity android:name="AwesomeActivity">
<intent-filter>
<action android:name="android.intent.action.ASSIST"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
<meta-data
android:name="com.android.systemui.action_assist_icon"
android:resource="@drawable/app_icon"/>
</activity>
@Angels-group
Angels-group / README.md
Created April 1, 2025 17:18 — forked from afmiguez/README.md
Signal Installation Steps

Signal Server Installation Guide

Author: Aqnouch Mohammed aqnouch.mohammed@gmail.com

Abstract

This paper is a quickstart for anyone aims to setup a working Signal Server.

What Is Signal

Signal is an encrypted instant messaging and voice calling application for Android. It uses the Internet to send one-to-one and group messages, which can include images and video messages, and make one-to-one voice calls. Signal uses standard phone numbers as identifiers and end-to-end encryption to secure all communications to other Signal users.