Skip to content

Instantly share code, notes, and snippets.

View mo7amd89's full-sized avatar

Mohammed Imam mo7amd89

View GitHub Profile
@mo7amd89
mo7amd89 / play-auth-proguard-rules.pro
Created October 14, 2024 10:11 — forked from ChanSek/play-auth-proguard-rules.pro
ProGuard rules for Google Play Services (Authentication)
-keepclassmembers class com.google.android.gms.dynamite.DynamiteModule {
** MODULE_ID;
** MODULE_VERSION;
** sClassLoader;
}
-keepclassmembers class com.google.android.gms.internal.in {
** mOrigin;
** mCreationTimestamp;
** mName;
** mValue;

TAKE A PHOTO WITH CAMERA IN KOTLIN

SETTING

Step-1

Create provider_paths.xml in res/xml folder and write below code in it.

<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
@mo7amd89
mo7amd89 / FlipCard.kt
Created April 21, 2024 13:04 — forked from ardakazanci/FlipCard.kt
Flip Card with Jetpack Compose
@Composable
fun FlipActionScreen() {
var flippedState by remember { mutableStateOf(false) }
val rotationY by animateFloatAsState(
targetValue = if (flippedState) 180f else 0f,
animationSpec = spring(
dampingRatio = Spring.DampingRatioHighBouncy,
stiffness = Spring.StiffnessVeryLow
)
)
@mo7amd89
mo7amd89 / ApolloRequestHandler.kt
Created January 8, 2024 06:18 — forked from sahalnazar/ApolloRequestHandler.kt
GraphQL request handler helper class for Apollo Client in Kotlin
import com.apollographql.apollo3.ApolloClient
import com.apollographql.apollo3.api.ApolloResponse
import com.apollographql.apollo3.api.Mutation
import com.apollographql.apollo3.api.Operation
import com.apollographql.apollo3.api.Query
import com.apollographql.apollo3.exception.ApolloException
import timber.log.Timber
/**
* This class handles the execution of GraphQL queries and mutations using the Apollo client.
@mo7amd89
mo7amd89 / UnsafeHttpClient.kt
Last active June 11, 2023 12:49 — forked from maiconhellmann/UnsafeOkHttpClient.kt
UnsafeHttpClient wrote in Kotlin
import okhttp3.OkHttpClient
import java.security.cert.CertificateException
import javax.net.ssl.SSLContext
import javax.net.ssl.TrustManager
import javax.net.ssl.X509TrustManager
class UnsafeOkHttpClient {
companion object {
fun getUnsafeOkHttpClient(): OkHttpClient.Builder {
try {
@mo7amd89
mo7amd89 / DownloadRequest.kt
Created February 25, 2023 12:43 — forked from PrashamTrivedi/DownloadRequest.kt
Download File with progress indicator, written in Kotlin with Co-routines
suspend fun downloadFile(url: String,
downloadFile: File,
downloadProgressFun: (bytesRead: Long, contentLength: Long, isDone: Boolean) -> Unit) {
async(CommonPool) {
val request = with(Request.Builder()) {
url(url)
}.build()
val client = with(OkHttpClient.Builder()) {
addNetworkInterceptor { chain ->
@mo7amd89
mo7amd89 / CountDownTimer.java
Created August 18, 2022 08:47 — forked from bverc/CountDownTimer.java
Drop-in alternative for the Android CountDownTimer class, but which you can cancel from within onTick. Modified to include pause and resume functionality.
/*
* Copyright (C) 2008 The Android Open Source Project
*
* 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
@mo7amd89
mo7amd89 / SendStringOverSocket.java
Created July 7, 2022 08:36 — forked from chatton/SendStringOverSocket.java
Example of sending a String through a Socket in Java.
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;
public class Client {
public static void main(String[] args) throws IOException {
// need host and port, we want to connect to the ServerSocket at port 7777
Socket socket = new Socket("localhost", 7777);
System.out.println("Connected!");
@mo7amd89
mo7amd89 / EmailValidator.java
Created March 21, 2022 10:22 — forked from Eldius/EmailValidator.java
Email validation with regex.
package net.eldiosantos.testes.controller;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class EmailValidator {
private final String emailValidationPattern = "[a-z0-9!#$%&\'*+/=?^_\'{|}~-]+(?:.[a-z0-9!#$%&\'*+/=?^_\'{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?";
public static void main(String[] args) {
@mo7amd89
mo7amd89 / ConnectivityListener.kt
Created March 8, 2022 08:40 — forked from andrewsafwatsamuel/ConnectivityListener.kt
Android connectivity listener
import android.annotation.TargetApi
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.net.*
import android.os.Build
import androidx.annotation.RequiresApi
import androidx.lifecycle.LiveData