This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Step by step tutorial on how to define and use AsyncTaskLoader. | |
************************************************************** | |
This class performs the same function as the AsyncTask, but a bit better. | |
It can handle Activity configuration changes more easily, and it behaves within the life cycles of Fragments and Activities. | |
STEP 1: Implement LoaderManager.LoaderCallbacks<String> on MainActivity then implement and override the following methods: | |
onCreateLoader, onLoadFinished and onLoaderReset | |
STEP 2: Inside onCreateLoader() return a new AsyncTaskLoader<String> as an anonymous inner class with this as the constructor's parameter and override loadInBackground & onStartLoadinginside anonymous inner class | |
STEP 3: In your MainActivity define two constant |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--- 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? --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Classes declaration | |
private Node sketchNode; | |
private Scene scene; | |
private SceneView sceneView; | |
private StorageReference modelRef; | |
private FirebaseStorage storage; | |
private RelativeLayout sceneContainer; | |
private ModelRenderable renderable; | |
//End of Classes declaration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val networkMonitor = NetworkMonitorUtil(requireContext()) | |
override fun onStart() { | |
super.onStart() | |
networkMonitor.register() | |
} | |
override fun onStop() { | |
super.onStop() | |
networkMonitor.unregister() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.BroadcastReceiver | |
import android.content.Context | |
import android.content.Intent | |
import com.chydee.notekeeper.data.DBHelper | |
import com.chydee.notekeeper.data.DBHelperImpl | |
import io.reactivex.android.schedulers.AndroidSchedulers | |
import io.reactivex.disposables.CompositeDisposable | |
import io.reactivex.schedulers.Schedulers | |
class AlarmReceiver : BroadcastReceiver() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private fun clearInputs() { | |
val colorStateList = ColorStateList.valueOf(Color.RED) | |
binding.apply { | |
otp1.text.clear() | |
otp2.text.clear() | |
otp3.text.clear() | |
otp4.text.clear() | |
otp5.text.clear() |