Skip to content

Instantly share code, notes, and snippets.

View Zulqurnain's full-sized avatar
🤓
I'm Human Seriously

Zulqurnain Haider Zulqurnain

🤓
I'm Human Seriously
View GitHub Profile
@rommansabbir
rommansabbir / Failure.kt
Created March 22, 2022 04:02
Sealed Class that return HTTP Failure (4xx, 5xx)
sealed class Failure {
/*Network Error*/
class NetworkConnection(var additionalData: Any? = null) : Failure()
/*Exception*/
class Exception(var additionalData: Any? = null) : Failure()
/**
* Although the HTTP standard specifies "unauthorized",
* semantically this response means "unauthenticated".
@Kashif-E
Kashif-E / proguard_rules.pro
Last active July 13, 2024 14:13
This gist contains almost all the pro guard rules that you will ever need for R8
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
@TinasheMzondiwa
TinasheMzondiwa / RxFirebase.java
Created October 14, 2016 09:56
RxFirebase implementation. Fork from https://gist.github.com/gsoltis/86210e3259dcc6998801 with my improvements.
import com.google.android.gms.tasks.Task;
import com.google.firebase.database.ChildEventListener;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.Query;
import com.google.firebase.database.ValueEventListener;
import rx.Observable;
import rx.Subscriber;
@Mariovc
Mariovc / PhonecallReceiver.java
Last active August 21, 2019 00:28 — 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 {
@lopspower
lopspower / README.md
Last active July 26, 2024 10:57
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@piruin
piruin / AnimateMarkerFragment.java
Last active May 20, 2020 16:56
android marker drop in animation on google maps
protected Marker addMarker(LatLng position, @ColorRes int color, boolean draggable) {
MarkerOptions markerOptions = new MarkerOptions();
markerOptions.draggable(draggable);
markerOptions.icon(MapUtils.getIconBitmapDescriptor(getActivity(), color));
markerOptions.position(position);
Marker pinnedMarker = googleMap.addMarker(markerOptions);
startDropMarkerAnimation(pinnedMarker);
return pinnedMarker;
}
@chathudan
chathudan / RecordingActivity.java
Last active January 21, 2024 09:53
Android Audio recording, MediaRecorder example
/**
* @author Chathura Wijesinghe <cdanasiri@gmail.com> on 9/9/15.
*/
public class RecordingActivity extends AppCompatActivity implements View.OnClickListener {
private TextView mTimerTextView;
private Button mCancelButton;
private Button mStopButton;
private MediaRecorder mRecorder;
@ftvs
ftvs / PhonecallReceiver.java
Last active October 11, 2023 10:05
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: Gabe Sechan 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 {
@Dogesmith
Dogesmith / Code.java
Last active January 31, 2022 12:35
Android Multi-line EditText which prevents newline characters from being added
mContent = (EditText) v.findViewById(R.id.dialog_item_content_EditText);
mContent.setText(mContentInit);
mContent.setRawInputType(InputType.TYPE_CLASS_TEXT);
mContent.setImeActionLabel(getResources().getString(R.string.done), EditorInfo.IME_ACTION_DONE);
mContent.setImeOptions(EditorInfo.IME_ACTION_DONE);
mContent.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (event == null) {
/*
MIT License
Copyright (c) 2015 Adel Nizamutdinov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is