Skip to content

Commit

Permalink
Merge pull request #58 from Crazy-Marvin/development
Browse files Browse the repository at this point in the history
Release 1.6
  • Loading branch information
CrazyMarvin committed Mar 23, 2021
2 parents 952bd0c + 45dfba0 commit 4def954
Show file tree
Hide file tree
Showing 809 changed files with 2,121 additions and 21 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: "CodeQL"

on:
push:
branches: [development, master]
pull_request:
# The branches below must be a subset of the branches above
branches: [development]
schedule:
- cron: '0 12 * * 0'

jobs:
analyse:
name: Analyse
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2

# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
# Override language selection by uncommenting this and choosing your languages
# with:
# languages: go, javascript, csharp, python, cpp, java

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
1 change: 1 addition & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![Last commit](https://img.shields.io/github/last-commit/Crazy-Marvin/Morse.svg?style=flat)](https://github.com/Crazy-Marvin/Morse/commits)
[![Releases](https://img.shields.io/github/downloads/Crazy-Marvin/Morse/total.svg?style=flat)](https://github.com/Crazy-Marvin/Morse/releases)
[![Latest tag](https://img.shields.io/github/tag/Crazy-Marvin/Morse.svg?style=flat)](https://github.com/Crazy-Marvin/Morse/tags)
[![Issues](https://img.shields.io/github/issues/Crazy-Marvin/MetadataRemover.svg?style=flat)](https://github.com/Crazy-Marvin/Morse/issues)
[![Issues](https://img.shields.io/github/issues/Crazy-Marvin/Morse.svg?style=flat)](https://github.com/Crazy-Marvin/Morse/issues)
[![Pull requests](https://img.shields.io/github/issues-pr/Crazy-Marvin/Morse.svg?style=flat)](https://github.com/Crazy-Marvin/Morse/pulls)
[![Codacy](https://api.codacy.com/project/badge/Grade/49d72132eca54aa9b68056d3dce5c019)](https://www.codacy.com/app/CrazyMarvin/Morse?utm_source=github.com&utm_medium=referral&utm_content=Crazy-Marvin/Morse&utm_campaign=Badge_Grade)
[![codecov](https://codecov.io/gh/Crazy-Marvin/Morse/branch/master/graph/badge.svg)](https://codecov.io/gh/Crazy-Marvin/Morse)
Expand Down
14 changes: 7 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 29
compileSdkVersion 30
defaultConfig {
applicationId "rocks.poopjournal.morse"
minSdkVersion 19
targetSdkVersion 29
versionCode 5
versionName "1.5"
targetSdkVersion 30
versionCode 7
versionName "1.6"
}

buildTypes {
Expand All @@ -29,7 +29,7 @@ android {
}

dependencies {
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.google.android.material:material:1.3.0'
}
60 changes: 60 additions & 0 deletions app/src/main/java/rocks/poopjournal/morse/LoopMediaPlayer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package rocks.poopjournal.morse;

import android.content.Context;
import android.media.MediaPlayer;
import android.util.Log;

public class LoopMediaPlayer {

public static final String TAG = LoopMediaPlayer.class.getSimpleName();

private Context mContext = null;
private int mResId = 0;
private int mCounter = 1;

private MediaPlayer mCurrentPlayer = null;
private MediaPlayer mNextPlayer = null;

public static LoopMediaPlayer create(Context context, int resId) {
return new LoopMediaPlayer(context, resId);
}

private LoopMediaPlayer(Context context, int resId) {
mContext = context;
mResId = resId;

mCurrentPlayer = MediaPlayer.create(mContext, mResId);
mCurrentPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mediaPlayer) {
mCurrentPlayer.start();
}
});

createNextMediaPlayer();
}

private void createNextMediaPlayer() {
mNextPlayer = MediaPlayer.create(mContext, mResId);
mCurrentPlayer.setNextMediaPlayer(mNextPlayer);
mCurrentPlayer.setOnCompletionListener(onCompletionListener);
}

private MediaPlayer.OnCompletionListener onCompletionListener = new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mediaPlayer) {
mediaPlayer.release();
mCurrentPlayer = mNextPlayer;

createNextMediaPlayer();

Log.d(TAG, String.format("Loop #%d", ++mCounter));
}
};

public void stopPlayers(){
if (mCurrentPlayer.isPlaying()){
mCurrentPlayer.stop();
}
}
}
Loading

0 comments on commit 4def954

Please sign in to comment.