Skip to content

Instantly share code, notes, and snippets.

View zeero0's full-sized avatar

Fazal zeero0

View GitHub Profile
@zeero0
zeero0 / SeeMoreTextView.java
Last active December 5, 2018 09:56
Expandable/Collapsible TextView
package app.utils.customviews;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.TextUtils;
import android.text.style.ForegroundColorSpan;
@zeero0
zeero0 / LocaleManager.java
Last active November 4, 2020 05:41
Multilingual support for android application
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Build;
import android.preference.PreferenceManager;
import java.util.Locale;
public class LocaleManager {
@zeero0
zeero0 / CountDownTimer.java
Last active October 13, 2018 06:00
Sample code for count down timer.
String FORMAT = "dd/MM/yyyy";
private CountDownTimer mTimer;
public void startTimer() {
SimpleDateFormat sdfNew = new SimpleDateFormat(FORMAT);
String date = sdfNew.format(new Date());
String endingDate = "";
if (isBefore(date, "12/10/2018")) {
endingDate = "12/10/2018";
} else if (isBefore(date, "14/10/2018")) {
@zeero0
zeero0 / VideoActivity.java
Last active September 7, 2018 06:02
Play Youtube video in Full Screen and disable all interaction.
package app.com.my_app.activities;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Build;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
@zeero0
zeero0 / ShareImage.java
Last active September 7, 2018 06:02
Android share intent to share text and image.
void onClickShareButton() {
String url = "URL Of the image that you want to share.";
new BitmapAsyncTask().execute(url);
}
class BitmapAsyncTask extends AsyncTask<String, Void, Bitmap> {
@Override
protected void onPreExecute() {
super.onPreExecute();
@zeero0
zeero0 / MainActivity.java
Last active February 25, 2021 04:35
Check and Request multiple permissions easily on Android 6.0 (API level 23) and above
package com.zeeroapps.easy_permissions;
import android.Manifest;
import android.os.Build;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Toast;