Skip to content

Instantly share code, notes, and snippets.

View zeeshanrasool91's full-sized avatar
💭
Feeling progamming :)

Zeeshan rasool zeeshanrasool91

💭
Feeling progamming :)
View GitHub Profile
@zeeshanrasool91
zeeshanrasool91 / CompoundDrawableClickListener.java
Created January 21, 2025 09:56 — forked from amaksoft/CompoundDrawableClickListener.java
Handling TextView compound drawables touch and click events
/*
* Copyright 2017, Andrey Makeev
*
* 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
package productmeister.com.productmeister.view;
import android.annotation.TargetApi;
import android.os.Build;
import android.support.design.widget.AppBarLayout;
import android.support.v4.view.ViewCompat;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
@zeeshanrasool91
zeeshanrasool91 / DotsLoaders.kt
Created May 21, 2024 08:19 — forked from EugeneTheDev/DotsLoaders.kt
Dots loading animations with Jetpack Compose
import androidx.compose.animation.core.*
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
@zeeshanrasool91
zeeshanrasool91 / AndroidManifest.xml
Created October 25, 2023 11:04 — forked from rmkrishna/ AndroidManifest.xml
To get the Recent Apps in Android
// We should have this 2 permissions to get the recent app
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" />
// we should register our service in manifest file
@zeeshanrasool91
zeeshanrasool91 / addBlankSpaceAfterLastItem.java
Created May 23, 2023 12:42 — forked from rodrigoborgesdeoliveira/addBlankSpaceAfterLastItem.java
This shows or hides a floating action button when the recycler view is scrolled. It also adds a blank space after the list's last item to make sure that if the list is too short to be scrolled, it'll still be scrollable to hide the floating action button that is sitting on top of the last item.
// This code is inside the recycler view adapter class
@Override
public void onBindViewHolder(final ViewHolder holder, int position) {
if (position + 1 == getItemCount()) {
// It is the last item of the list
// Set bottom margin to 72dp
setBottomMargin(holder.itemView, (int) (72 * Resources.getSystem().getDisplayMetrics().density));
} else {
// Reset bottom margin back to zero
@zeeshanrasool91
zeeshanrasool91 / getChromeURL.java
Created April 6, 2023 06:18 — forked from mrvivacious/getChromeURL.java
Get the URL of the current page in the Google Chrome browser on Android
// For Android
// Get the URL of the current page in the Google Chrome browser
// Needs to be in a class that extends AccessibilityService
// A version of this code is used in PorNo!, a porn-blocker I wrote
// https://github.com/mrvivacious/PorNo-_Porn_Blocker/
//
// Have fun ~
String TAG = "Get Chrome URL: ";
@zeeshanrasool91
zeeshanrasool91 / DelegatedPreferences.kt
Created February 23, 2023 14:42 — forked from hardik-trivedi/DelegatedPreferences.kt
Kotlin : SharedPreferences using delegated property
import android.annotation.SuppressLint
import android.content.Context
import android.content.SharedPreferences
import com.hardiktrivedi.gdg_pune_kotlin_workshop.R
import kotlin.reflect.KProperty
class PreferenceExtension<T>(val context: Context, val key: String, val defaultValue: T) {
val prefs: SharedPreferences by lazy { context.getSharedPreferences(context.getString(R.string.app_name), Context.MODE_PRIVATE) }
operator fun getValue(thisRef: Any?, property: KProperty<*>): T {
@zeeshanrasool91
zeeshanrasool91 / AndroidManifest.xml
Created February 23, 2023 14:42 — forked from JakeSteam/AndroidManifest.xml
"Generic SharedPreferences Utility Class" for blog.jakelee.co.uk
<application
android:allowBackup="true"
android:fullBackupContent="@xml/backup_rules"
@zeeshanrasool91
zeeshanrasool91 / 1 ViewBindingDelegates.kt
Created February 13, 2023 09:00 — forked from gmk57/1 ViewBindingDelegates.kt
Kotlin delegates for Android View Binding with usage examples
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.Fragment
import androidx.lifecycle.DefaultLifecycleObserver
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleOwner
import androidx.viewbinding.ViewBinding
@zeeshanrasool91
zeeshanrasool91 / TextViewDrawableSize.java
Created September 8, 2022 12:22 — forked from hector6872/TextViewDrawableSize.java
TextViewDrawableSize - CompoundDrawable size
public class TextViewDrawableSize extends TextView {
private static final int DEFAULT_COMPOUND_DRAWABLE_SIZE = -1;
private int compoundDrawableWidth;
private int compoundDrawableHeight;
public TextViewDrawableSize(Context context) {
this(context, null);
}
public TextViewDrawableSize(Context context, AttributeSet attrs) {