Skip to content

Commit

Permalink
OPNMIDI Player v 1.4.3.1
Browse files Browse the repository at this point in the history
- Better file handling by intent
- Custom icon for debug builds
- Added similar description background like ADLMIDI Player has
  • Loading branch information
Wohlstand committed Feb 21, 2019
1 parent d59b370 commit fde6699
Show file tree
Hide file tree
Showing 20 changed files with 68 additions and 58 deletions.
4 changes: 2 additions & 2 deletions OPNMIDI-Player/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "ru.wohlsoft.opnmidiplayer"
minSdkVersion 14
targetSdkVersion 28
versionCode 1040300
versionName '1.4.3.0'
versionCode 1040301
versionName '1.4.3.1'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
Expand Down
Binary file added OPNMIDI-Player/icon/descr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OPNMIDI-Player/icon/descr.xcf
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
88 changes: 39 additions & 49 deletions OPNMIDI-Player/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,71 +18,61 @@
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.APP_MUSIC" />
</intent-filter>

<intent-filter>
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data android:scheme="file" />
<data android:scheme="content" />
<data android:host="*" />

<data android:mimeType="audio/mid" />
<data android:mimeType="audio/midi" />
<data android:mimeType="audio/x-mid" />
<data android:mimeType="audio/x-midi" />
<data android:mimeType="music/midi" />
<data android:mimeType="music/x-mid" />
<data android:mimeType="music/x-midi" />
<data android:mimeType="music/x-karaoke" />
<data android:mimeType="x-music/midi" />
<data android:mimeType="x-music/x-mid" />
<data android:mimeType="x-music/x-midi" />
<data android:mimeType="application/mid" />
<data android:mimeType="application/midi" />
<data android:mimeType="application/x-mid" />
<data android:mimeType="application/x-midi" />
<data android:mimeType="application/x-mid" />
<data android:mimeType="application/x-midi" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data android:scheme="file" />
<data android:scheme="content" />
<data android:host="*" />
<data android:mimeType="*/*" />

<data android:pathPattern=".*\\.mid" />
<data android:pathPattern=".*\\..*\\.mid" />
<data android:pathPattern=".*\\..*\\..*\\.mid" />
<data android:pathPattern=".*\\..*\\..*\\..*\\.mid" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.mid" />
<data android:pathPattern=".*\\.MID" />
<data android:pathPattern=".*\\..*\\.MID" />
<data android:pathPattern=".*\\..*\\..*\\.MID" />
<data android:pathPattern=".*\\..*\\..*\\..*\\.MID" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.MID" />
<data android:pathPattern=".*\\.midi" />
<data android:pathPattern=".*\\..*\\.midi" />
<data android:pathPattern=".*\\..*\\..*\\.midi" />
<data android:pathPattern=".*\\..*\\..*\\..*\\.midi" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.midi" />
<data android:pathPattern=".*\\.MIDI" />
<data android:pathPattern=".*\\..*\\.MIDI" />
<data android:pathPattern=".*\\..*\\..*\\.MIDI" />
<data android:pathPattern=".*\\..*\\..*\\..*\\.MIDI" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.MIDI" />
<data android:pathPattern=".*\\.rmi" />
<data android:pathPattern=".*\\..*\\.rmi" />
<data android:pathPattern=".*\\..*\\..*\\.rmi" />
<data android:pathPattern=".*\\..*\\..*\\..*\\.rmi" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.rmi" />
<data android:pathPattern=".*\\.RMI" />
<data android:pathPattern=".*\\..*\\.RMI" />
<data android:pathPattern=".*\\..*\\..*\\.RMI" />
<data android:pathPattern=".*\\..*\\..*\\..*\\.RMI" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.RMI" />
<data android:pathPattern=".*\\.kar" />
<data android:pathPattern=".*\\..*\\.kar" />
<data android:pathPattern=".*\\..*\\..*\\.kar" />
<data android:pathPattern=".*\\..*\\..*\\..*\\.kar" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.kar" />
<data android:pathPattern=".*\\.KAR" />
<data android:pathPattern=".*\\..*\\.KAR" />
<data android:pathPattern=".*\\..*\\..*\\.KAR" />
<data android:pathPattern=".*\\..*\\..*\\..*\\.KAR" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.KAR" />
<data android:pathPattern=".*\\.cmf" />
<data android:pathPattern=".*\\.CMF" />
<data android:pathPattern=".*\\.imf" />
<data android:pathPattern=".*\\.IMF" />
<data android:pathPattern=".*\\.mus" />
<data android:pathPattern=".*\\..*\\.mus" />
<data android:pathPattern=".*\\..*\\..*\\.mus" />
<data android:pathPattern=".*\\..*\\..*\\..*\\.mus" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.mus" />
<data android:pathPattern=".*\\.MUS" />
<data android:pathPattern=".*\\..*\\.MUS" />
<data android:pathPattern=".*\\..*\\..*\\.MUS" />
<data android:pathPattern=".*\\..*\\..*\\..*\\.MUS" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.MUS" />
<data android:pathPattern=".*\\.xmi" />
<data android:pathPattern=".*\\..*\\.xmi" />
<data android:pathPattern=".*\\..*\\..*\\.xmi" />
<data android:pathPattern=".*\\..*\\..*\\..*\\.xmi" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.xmi" />
<data android:pathPattern=".*\\.XMI" />
<data android:pathPattern=".*\\..*\\.XMI" />
<data android:pathPattern=".*\\..*\\..*\\.XMI" />
<data android:pathPattern=".*\\..*\\..*\\..*\\.XMI" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.XMI" />
</intent-filter>
</activity>

Expand Down
34 changes: 27 additions & 7 deletions OPNMIDI-Player/src/main/java/ru/wohlsoft/opnmidiplayer/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.annotation.SuppressLint;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
Expand Down Expand Up @@ -49,6 +50,7 @@ public class Player extends AppCompatActivity

public static final int READ_PERMISSION_FOR_BANK = 1;
public static final int READ_PERMISSION_FOR_MUSIC = 2;
public static final int READ_PERMISSION_FOR_INTENT = 3;

private PlayerService m_service;
private volatile boolean m_bound = false;
Expand Down Expand Up @@ -585,6 +587,8 @@ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permis
openBankDialog();
} else if (requestCode == READ_PERMISSION_FOR_MUSIC) {
openMusicFileDialog();
} else if (requestCode == READ_PERMISSION_FOR_INTENT) {
handleFileIntent();
}
}
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
Expand Down Expand Up @@ -651,15 +655,31 @@ public void OnSelectedFile(String fileName, String lastPath) {

private void handleFileIntent()
{
Uri url = getIntent().getData();
if(url != null)
Intent intent = getIntent();
String scheme = intent.getScheme();
if(scheme != null)
{
String scheme = url.getScheme();
Log.d(LOG_TAG, "Got an URL: " + url + "; gonna check");
if(scheme != null && scheme.equals("file"))
if(checkFilePermissions(READ_PERMISSION_FOR_INTENT))
return;
if(scheme.equals(ContentResolver.SCHEME_FILE))
{
String fileName = url.getPath();
processMusicFile(fileName, m_lastPath);
Uri url = intent.getData();
if(url != null)
{
Log.d(LOG_TAG, "Got a file: " + url + ";");
String fileName = url.getPath();
processMusicFile(fileName, m_lastPath);
}
}
else if(scheme.equals(ContentResolver.SCHEME_CONTENT))
{
Uri url = intent.getData();
if(url != null)
{
Log.d(LOG_TAG, "Got a content: " + url + ";");
String fileName = url.getPath();
processMusicFile(fileName, m_lastPath);
}
}
}
}
Expand Down

0 comments on commit fde6699

Please sign in to comment.