Skip to content

Instantly share code, notes, and snippets.

View chydee's full-sized avatar
:octocat:

Desmond Ngwuta Chidiebere chydee

:octocat:
View GitHub Profile
@chydee
chydee / ConnectivityMonitor.kt
Created May 19, 2020 07:36 — forked from iRYO400/ConnectivityMonitor.kt
Check Internet Connection [API21+][API29+ supported] Lifecycle aware
import android.content.Context
import android.content.Context.CONNECTIVITY_SERVICE
import android.net.ConnectivityManager
import android.net.Network
import android.net.NetworkCapabilities
import android.net.NetworkRequest
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleObserver
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.OnLifecycleEvent
@chydee
chydee / PULL_REQUEST_TEMPLATE
Created March 28, 2020 10:38 — forked from riggaroo/PULL_REQUEST_TEMPLATE
Pull request template format. Add this file to your .github folder
<!--- Provide a general summary of your changes in the Title above -->
<!--- If there is no changelog entry, label this PR as trivial to bypass the Danger warning -->
## Description
<!--- Describe your changes in detail -->
## Motivation and Context
<!--- Why is this change required? What problem does it solve? -->
command usage
git init Creates an empty Git repository in the specified directory.
git clone <repository name> Clones a repository located at <repository name> onto your local machine.
git add <directory> Stages only the specified changes for the next commit. Replace <directory> with a <file> to change a specific file.
git add . Stages new files and modifications without deletions
git add -A Stages all changes
git add -all Equivalent to git add -A
git add -u Stages modifications and deletions without adding new files
git add --update Equivalent to git add -u
git commit -m ”<message>” Commits the staged snapshot. replace <message> with the commit message.
@chydee
chydee / Code for releaseMediaPlayer from NumbersActivity.java Copy over the releaseMediaPlayer() helper method from the NumbersActivity into the NumbersFragment.
/**
* Clean up the media player by releasing its resources.
*/
private void releaseMediaPlayer() {
// If the media player is not null, then it may be currently playing a sound.
if (mMediaPlayer != null) {
// Regardless of the current state of the media player, release its resources
// because we no longer need it.
mMediaPlayer.release();