This repository has been archived by the owner on Mar 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from jonathan-reisdorf/file-uploads
File uploads
- Loading branch information
Showing
11 changed files
with
95 additions
and
55 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
app/src/main/java/org/crossnode/bb10beol/BrowserUIClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.crossnode.bb10beol; | ||
|
||
import android.net.Uri; | ||
import android.webkit.ValueCallback; | ||
|
||
import org.xwalk.core.XWalkFileChooser; | ||
import org.xwalk.core.XWalkUIClient; | ||
import org.xwalk.core.XWalkView; | ||
|
||
public class BrowserUIClient extends XWalkUIClient { | ||
private MainActivity _activity; | ||
|
||
public BrowserUIClient(MainActivity activity, XWalkView view) { | ||
super(view); | ||
_activity = activity; | ||
} | ||
|
||
@Override | ||
public void openFileChooser(XWalkView view, ValueCallback<Uri> uploadFile, String acceptType, String capture) { | ||
if (_activity.fileChooser == null) { | ||
_activity.fileChooser = new XWalkFileChooser(_activity); | ||
} | ||
|
||
_activity.fileChooser.showFileChooser(uploadFile, acceptType, capture); | ||
} | ||
} |
31 changes: 23 additions & 8 deletions
31
app/src/main/java/org/crossnode/bb10beol/MainActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,42 @@ | ||
package org.crossnode.bb10beol; | ||
|
||
//import android.view.WindowManager; | ||
|
||
import android.app.Activity; | ||
import android.widget.LinearLayout; | ||
import android.os.Bundle; | ||
import android.content.Intent; | ||
|
||
import org.xwalk.core.XWalkActivity; | ||
import org.xwalk.core.XWalkFileChooser; | ||
|
||
public class MainActivity extends Activity { | ||
private Browser browser; | ||
public class MainActivity extends XWalkActivity { | ||
public Browser browser = null; | ||
public XWalkFileChooser fileChooser = null; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_main); | ||
LinearLayout mainLayout = (LinearLayout) this.findViewById(R.id.mainLayout); | ||
browser = new Browser(this, mainLayout); | ||
browser.initialize(null); | ||
//this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); | ||
} | ||
|
||
@Override | ||
protected void onResume() { | ||
super.onResume(); | ||
browser.onResume(); | ||
|
||
if (browser.isInitialized) { | ||
browser.onResume(); | ||
} | ||
} | ||
|
||
@Override | ||
protected void onXWalkReady() { | ||
browser.initialize(null); | ||
} | ||
|
||
@Override | ||
protected void onActivityResult(int requestCode, int resultCode, Intent data) { | ||
if (fileChooser != null) { | ||
fileChooser.onActivityResult(requestCode, resultCode, data); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 22 additions & 24 deletions
46
app/src/main/java/org/crossnode/bb10beol/NavigationJsInterface.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
app/src/main/java/org/crossnode/bb10beol/PageContextInterface.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
app/src/main/java/org/crossnode/bb10beol/TabsJsInterface.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters