use of de.baumann.browser.View.NinjaContextWrapper in project browser by scoute-dich.
the class HolderService method onStartCommand.
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
WebView.enableSlowWholeDocumentDraw();
NinjaWebView webView = new NinjaWebView(new NinjaContextWrapper(this));
webView.setBrowserController(this);
webView.setFlag(BrowserUnit.FLAG_NINJA);
webView.setAlbumCover(null);
webView.setAlbumTitle(getString(R.string.album_untitled));
ViewUnit.bound(this, webView);
webView.loadUrl(RecordUnit.getHolder().getURL());
webView.deactivate();
BrowserContainer.add(webView);
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
if (sp.getBoolean("sp_background", true)) {
updateNotification();
} else {
Intent toActivity = new Intent(HolderService.this, BrowserActivity.class);
startActivity(toActivity);
}
return START_STICKY;
}
use of de.baumann.browser.View.NinjaContextWrapper in project browser by scoute-dich.
the class HolderActivity method showHolderDialog.
private void showHolderDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(new NinjaContextWrapper(this));
builder.setCancelable(true);
@SuppressLint("InflateParams") NinjaRelativeLayout linearLayout = (NinjaRelativeLayout) getLayoutInflater().inflate(R.layout.main_home, null, false);
builder.setView(linearLayout);
String[] strings = getResources().getStringArray(R.array.holder_menu);
List<String> list = new ArrayList<>();
list.addAll(Arrays.asList(strings));
ListView listView = linearLayout.findViewById(R.id.home_list);
DialogAdapter adapter = new DialogAdapter(this, list);
listView.setAdapter(adapter);
adapter.notifyDataSetChanged();
final AlertDialog dialog = builder.create();
dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
HolderActivity.this.finish();
}
});
dialog.show();
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
switch(position) {
case 0:
Intent toActivity = new Intent(HolderActivity.this, BrowserActivity.class);
toActivity.putExtra(IntentUnit.OPEN, first.getURL());
startActivity(toActivity);
break;
case 1:
BrowserUnit.copyURL(HolderActivity.this, first.getURL());
break;
case 2:
IntentUnit.share(HolderActivity.this, first.getTitle(), first.getURL());
break;
default:
break;
}
dialog.hide();
dialog.dismiss();
finish();
}
});
}
Aggregations