Merge pull request #10 from htynkn/feature/open-with-nsp-file-directly
open nsp/nsz/xci/xcz file with app
This commit is contained in:
commit
17460aa53f
2 changed files with 21 additions and 9 deletions
|
@ -50,18 +50,18 @@
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.hardware.usb.action.USB_DEVICE_DETACHED"
|
android:name="android.hardware.usb.action.USB_DEVICE_DETACHED"
|
||||||
android:resource="@xml/device_filter" />
|
android:resource="@xml/device_filter" />
|
||||||
<!-- TODO: fix, implement, etc.
|
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.VIEW" />
|
<action android:name="android.intent.action.VIEW" />
|
||||||
<action android:name="android.intent.action.EDIT" />
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
<data
|
<data android:host="*"/>
|
||||||
android:mimeType="application/octet-stream"
|
<data android:mimeType="*/*"/>
|
||||||
android:host="*"
|
<data android:pathPattern=".*\\.nsp"/>
|
||||||
android:pathPattern=".*\\.nsp"
|
<data android:pathPattern=".*\\.nsz"/>
|
||||||
/>
|
<data android:pathPattern=".*\\.xci"/>
|
||||||
|
<data android:pathPattern=".*\\.xcz"/>
|
||||||
|
<data android:scheme="content"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
-->
|
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<receiver
|
<receiver
|
||||||
|
|
|
@ -256,6 +256,14 @@ public class MainActivity extends AppCompatActivity implements NsResultReciever.
|
||||||
});
|
});
|
||||||
// Upload to NS button
|
// Upload to NS button
|
||||||
uploadToNsBtn = findViewById(R.id.buttonUpload);
|
uploadToNsBtn = findViewById(R.id.buttonUpload);
|
||||||
|
|
||||||
|
//check if it's from file selected
|
||||||
|
Intent intent = getIntent();
|
||||||
|
Uri uri = intent.getData();
|
||||||
|
|
||||||
|
if (savedInstanceState == null && uri != null) {
|
||||||
|
readFile(intent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateUploadBtnState(){ // TODO: this function is bad. It multiplies entropy and sorrow.
|
private void updateUploadBtnState(){ // TODO: this function is bad. It multiplies entropy and sorrow.
|
||||||
|
@ -296,6 +304,10 @@ public class MainActivity extends AppCompatActivity implements NsResultReciever.
|
||||||
if (requestCode != ADD_NSP_INTENT_CODE || data == null)
|
if (requestCode != ADD_NSP_INTENT_CODE || data == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
readFile(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void readFile(Intent data) {
|
||||||
Uri uri = data.getData();
|
Uri uri = data.getData();
|
||||||
|
|
||||||
if (uri == null || uri.getScheme() == null || ! uri.getScheme().equals("content"))
|
if (uri == null || uri.getScheme() == null || ! uri.getScheme().equals("content"))
|
||||||
|
|
Loading…
Reference in a new issue