Added button to launcher

This commit is contained in:
Solexid 2016-05-01 03:18:32 +03:00
parent 726eab44d9
commit 0cffe3afe9

View file

@ -64,8 +64,8 @@ public class LauncherActivity extends Activity {
tabHost.addTab(tabSpec);
Button selectFolder = ( Button ) findViewById( R.id.button_select );
if ( Build.VERSION.SDK_INT < 21 )
selectFolder.setVisibility( View.GONE );
// if ( Build.VERSION.SDK_INT < 21 )
// selectFolder.setVisibility( View.GONE );
mPref = getSharedPreferences("engine", 0);
cmdArgs = (EditText)findViewById(R.id.cmdArgs);
cmdArgs.setText(mPref.getString("argv","-dev 3 -log"));
@ -106,7 +106,9 @@ public class LauncherActivity extends Activity {
public void selectFolder(View view)
{
Intent intent = new Intent("android.intent.action.OPEN_DOCUMENT_TREE");
Intent intent = new Intent(this, in.celest.xash3d.FPicker.class);
//intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// Intent intent = new Intent("android.intent.action.OPEN_DOCUMENT_TREE");
startActivityForResult(intent, 42);
resPath.setEnabled(false);
}
@ -114,12 +116,16 @@ public class LauncherActivity extends Activity {
public void onActivityResult(int requestCode, int resultCode, Intent resultData) {
if (resultCode == RESULT_OK) {
try{
final List<String> paths = resultData.getData().getPathSegments();
String[] parts = paths.get(1).split(":");
String storagepath = Environment.getExternalStorageDirectory().getPath() + "/";
String path = storagepath + parts[1];
if( path != null)
resPath.setText( path );
resPath = ( EditText ) findViewById( R.id.cmdPath );
resPath.setText( resultData.getStringExtra("GetPath"));
// final List<String> paths = resultData.getData().getPathSegments();
// String[] parts = paths.get(1).split(":");
// String storagepath = Environment.getExternalStorageDirectory().getPath() + "/";
// String path = storagepath + parts[1];
// if( path != null)
// resPath.setText( path );
resPath.setEnabled(true);
}
catch(Exception e)