Skip to content

Instantly share code, notes, and snippets.

View logickoder's full-sized avatar
😶‍🌫️
Doing what needs to be done

Jeffery Orazulike logickoder

😶‍🌫️
Doing what needs to be done
View GitHub Profile
@logickoder
logickoder / CustomTabsConnection.kt
Last active June 26, 2025 17:33
Detecting Chrome Custom Tab Closure in Android
import android.annotation.SuppressLint
import android.app.Activity
import android.app.ActivityManager
import android.content.ActivityNotFoundException
import android.content.ComponentName
import android.content.Intent
import android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP
import android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP
import android.content.pm.PackageManager
import android.content.pm.ResolveInfo
@logickoder
logickoder / distribute.yml
Created June 18, 2025 09:40
Download artifact from previous successful workflow of the same branch
name: Distribute Latest APK to Firebase
on:
workflow_dispatch:
permissions:
actions: read
contents: read
jobs:
@logickoder
logickoder / student_results_extractor.py
Created June 4, 2025 16:56
Student Results Extractor
import requests
import re
import pandas as pd
def fetch_student_result(matric_no):
url = "https://student-results-db.onrender.com/"
response = requests.post(url, data={"matric_no": matric_no})
if response.status_code == 200:
@logickoder
logickoder / ViewTreeAnalyser.kt
Created May 18, 2025 06:59
Unified View Tree Analyser for Android (Views and Compose)
import android.content.Context
import android.util.Log
import android.view.View
import android.view.ViewGroup
import androidx.compose.ui.semantics.SemanticsNode
import androidx.compose.ui.semantics.SemanticsOwner
import androidx.compose.ui.semantics.SemanticsProperties
import androidx.compose.ui.semantics.SemanticsPropertyKey
import androidx.compose.ui.semantics.SemanticsPropertyReceiver
import androidx.compose.ui.semantics.getOrNull
@logickoder
logickoder / message_controller.dart
Created April 1, 2025 16:02
Simple flutter websocket controller with riverpod
import 'dart:async';
import 'dart:convert';
import 'package:collection/collection.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:web_socket_channel/io.dart';
import 'package:web_socket_channel/web_socket_channel.dart';
import '../../../config/app_config.dart';
@logickoder
logickoder / ComposePdfExporter.kt
Created January 1, 2025 16:22
Export a scrollable composable to PDF
package dev.logickoder.printer
import android.app.Dialog
import android.content.Context
import android.graphics.Bitmap
import android.graphics.Canvas
import android.graphics.Rect
import android.graphics.pdf.PdfDocument
import android.view.View
import androidx.compose.foundation.gestures.scrollBy
@logickoder
logickoder / DeviceRestartChecker.kt
Created December 10, 2024 06:01
Check if an android device restarted without depending on BOOT_COMPLETED
object DeviceRestartChecker {
private const val PREFS_NAME = "device_restart_prefs"
private const val KEY_LAST_UPTIME = "last_uptime"
operator fun invoke(context: Context): Boolean {
val prefs = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)
val savedUptime = prefs.getLong(KEY_LAST_UPTIME, 0L)
val currentUptime = SystemClock.uptimeMillis()
return if (currentUptime < savedUptime) {
@logickoder
logickoder / build-production.yml
Last active November 19, 2024 13:56
My Flutter CI/CD Workflow
# From .github/workflows/build-production.yml
name: Build and upload android app to Google Play Store
on:
push:
branches:
- main
paths:
- 'android/**'
@logickoder
logickoder / multi_progress_indicator.dart
Created November 4, 2024 06:58
Multi Progress Indicator
import 'package:flutter/material.dart';
/// A progress indicator that is divided into sections, each section represents a part of the total progress
/// The current position of the progress indicator is represented by the [current] property
/// The [sections] property represents the sections of the progress indicator
/// The length of the [sections] list represents the total number of sections
class MultiProgressIndicator extends StatelessWidget {
/// The current position of the progress indicator in relation to the sections
final int current;
@logickoder
logickoder / ChatBubbleShape.kt
Created October 23, 2024 14:50
ChatBubbleShape
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.Surface
import androidx.compose.material3.Text