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
|
||||
android:name="android.hardware.usb.action.USB_DEVICE_DETACHED"
|
||||
android:resource="@xml/device_filter" />
|
||||
<!-- TODO: fix, implement, etc.
|
||||
<intent-filter>
|
||||
<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" />
|
||||
<data
|
||||
android:mimeType="application/octet-stream"
|
||||
android:host="*"
|
||||
android:pathPattern=".*\\.nsp"
|
||||
/>
|
||||
<data android:host="*"/>
|
||||
<data android:mimeType="*/*"/>
|
||||
<data android:pathPattern=".*\\.nsp"/>
|
||||
<data android:pathPattern=".*\\.nsz"/>
|
||||
<data android:pathPattern=".*\\.xci"/>
|
||||
<data android:pathPattern=".*\\.xcz"/>
|
||||
<data android:scheme="content"/>
|
||||
</intent-filter>
|
||||
-->
|
||||
</activity>
|
||||
|
||||
<receiver
|
||||
|
@ -80,4 +80,4 @@
|
|||
android:exported="false" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
</manifest>
|
||||
|
|
|
@ -256,6 +256,14 @@ public class MainActivity extends AppCompatActivity implements NsResultReciever.
|
|||
});
|
||||
// Upload to NS button
|
||||
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.
|
||||
|
@ -296,6 +304,10 @@ public class MainActivity extends AppCompatActivity implements NsResultReciever.
|
|||
if (requestCode != ADD_NSP_INTENT_CODE || data == null)
|
||||
return;
|
||||
|
||||
readFile(data);
|
||||
}
|
||||
|
||||
private void readFile(Intent data) {
|
||||
Uri uri = data.getData();
|
||||
|
||||
if (uri == null || uri.getScheme() == null || ! uri.getScheme().equals("content"))
|
||||
|
|
Loading…
Reference in a new issue