WebView web = (WebView)findViewById(R.id.WebPages); web.setWebViewClient(new WebViewClient());
最近會筆記些零碎的 android 問題。
WebView web = (WebView)findViewById(R.id.WebPages); web.setWebViewClient(new WebViewClient());
<html> <head> <link rel="stylesheet" href="./ui.css" type="text/css" media="all" /> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script src="./ui.js"></script> </head> <body> <div class="demo"> <img id="cover-art"></img> <div id="prev-button" class="button">Prev</div> <div id="next-button" class="button">Next</div> <div id="notify-button" class="button">notify</div> <div id="wins-button" class="button">get wins</div> <div id="min-button" class="button">minimize</div> <div id="file-uri"></div> </div> <ul id="windows-list"></ul> </body> </html>
Seed.include("./dbus-rhythmbox.js"); function sendNotification(summary, body, timeOut) { var notification = new Notify.Notification({summary:summary, body:body}); notification.set_timeout(timeOut); notification.show(); } function getWindows () { Wnck = imports.gi.Wnck; Gtk = imports.gi.Gtk Gtk.init(Seed.argv); var screen = Wnck.Screen.get_default(); while (Gtk.events_pending()) Gtk.main_iteration(); return screen.get_windows(); } $(document).ready(function(){ var shell = new RhythmboxShell(); var player = new RhythmboxPlayer(); Notify = imports.gi.Notify; $("#wins-button").click( function() { var wins = getWindows(); Seed.print (wins.length); for (var i = 0; i < wins.length; i++) { Seed.print (wins[i].get_name()); $("#windows-list").append("<li>" + wins[i].get_name() + "</li>"); } }); $("#min-button").click( function() { var wins = getWindows(); for (var i = 0; i < wins.length; i++) { wins[i].minimize(); } }); Notify.init("Webview"); $("#notify-button").click( function() { sendNotification("Raised from a WebView","Raised from a WebView", 500); Seed.print("clicked"); }); //playeplayer.getVolumeRemote(function (volume) {print("oi")}); $("#next-button").click(function(){ player.nextRemote(); }); $("#prev-button").click(function(){ player.previousRemote(); }); player.connect("playingUriChanged", function(emitter, uri){ //var song = shell.getSongPropertiesRemoteSync(uri); //print(song); }); player.connect("playingSongPropertyChanged", function(emitter, title, property_name, old_value, new_value){ if (property_name == "rb:coverArt-uri") $("#cover-art").attr('src', new_value); }); });
<html> <head> <link rel="stylesheet" href="./ui.css" type="text/css" media="all" /> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script src="./ui.js"></script> </head> <body> <div class="demo"> <img id="cover-art"></img> <div id="prev-button" class="button">Prev</div> <div id="next-button" class="button">Next</div> <div id="file-uri"></div> </div> </body> </html>
Seed.include("./dbus-rhythmbox.js"); $(document).ready(function(){ var shell = new RhythmboxShell(); var player = new RhythmboxPlayer(); //playeplayer.getVolumeRemote(function (volume) {print("oi")}); $("#next-button").click(function(){ player.nextRemote(); }); $("#prev-button").click(function(){ player.previousRemote(); }); player.connect("playingUriChanged", function(emitter, uri){ //var song = shell.getSongPropertiesRemoteSync(uri); //print(song); }); player.connect("playingSongPropertyChanged", function(emitter, title, property_name, old_value, new_value){ if (property_name == "rb:coverArt-uri") $("#cover-art").attr('src', new_value); }); });