How to build Web Browser in DroidScript

Web Browser





How to build Web Browser in DroidScript?

Web Browser build in Script Language of DroidScript 2.0 in very very Easy with short codes. I give you an example but completely different in various method. buy the way, codes are never used in any program or app before I send it to my web post.Theses Apps code are free for download and enjoy the dynamic Mobile friendly version.Note that some devices not supported of web View option in Mobile Linux Operating system of 10, 11 and 12th version of Android devices, but most of them are working in perfectly in this web View mode.

Thanks you for all Reader's.

Web Browser version 1.0

Coding Start here....



//Called when application is started.

function OnStart()

{

	//Create a layout with objects vertically centered.

	lay = app.CreateLayout( "Frame", "VCenter,FillXY" )

	//Create a web control.

	web = app.CreateWebView( 1, 0.9)

	web.SetMargins( 0.01, 0.06, 0.01, 0.01 )

	web.SetOnProgress( web_OnProgess )

	web.SetOnRequest(web_OnRequest)

//Img.SetOnLongTouch(Img_OnTouch)

	app.CreateScroller(1.0,0.9)

	lay.AddChild( web )

//image Grid Option on Drawer

//  imgs = app.CreateImageGrid( images,0.5,0.5, 3,5);

// lay.AddChild(imgs)

	//Create horizontal sub-layout for buttons.

	layHoriz = app.CreateLayout( "linear", "Horizontal" )	

		layBott = app.CreateLayout( "linear", "Bottom,Horizontal,FillY" )

		

	layDMenu = app.CreateLayout("Linear","VCenter,Wrap")

	layDMenu.SetBackground("/Sys/Img/BlueBack.jpg")

//Edit text

	txtDynamic = app.CreateTextEdit("www.google.com")

	lay.SetBackGradient("#33eedd","#ee36ee","#ff44ee","left-right")

	txtDynamic.SetBackColor("#3e334f")

//	txtDynamic.SetSelection( start,stop )

txtDynamic.SetOnEnter( web.GetUrl())

	txtDynamic.SetMargins( 0.02, 0.0058,0.01, 0.01 )

	txtDynamic.SetSize(0.8,0.06)

	txtDynamic.SetTextSize(16)

	layHoriz.AddChild( txtDynamic )

	//Create 'Local' button

	btnLocal = app.CreateButton( "[fa-search]",0.18,0.08,"fontAwesome")

	btnLocal.SetTextSize(20)

	btnLocal.SetStyle("#123456","#123456",1,"#00033e",2,1  )

	btnLocal.SetOnTouch( btnLocal_OnTouch )

	layHoriz.AddChild( btnLocal )

		//Back Button

	btnBack= app.CreateButton( "<<",0.15,0.08)

  btnBack.SetOnTouch( btnBack_OnTouch )

	layBott.AddChild( btnBack )

	//Forward Button

	btnForward= app.CreateButton( ">>",0.15 ,0.08)

  btnForward.SetOnTouch( btnForward_OnTouch )

	layBott.AddChild( btnForward)

	//Back Edittext2

		btnCapt= app.CreateButton( "Capture")

    btnCapt.SetOnTouch( btnCapt_OnTouch )

    layDMenu.AddChild( btnCapt)

    //imge search dload

    btnImg= app.CreateButton( "Download")

    btnImg.SetOnTouch( dloadBtn_OnTouch )

    layDMenu.AddChild( btnImg)

    	

	//zoom for webpage

	txtZoom = app.CreateText( "1x'''''''2x''''''''3x''''''''4x''''''''5x''''''''6x''''''''7x''''''''8x" )

layDMenu.AddChild( txtZoom )

//seekbar one

btnZoom = app.CreateSeekBar( 0.8,0.1)

btnZoom.SetRange(8)

btnZoom.SetOnTouch( btnZoom_OnTouch )

layDMenu.AddChild(btnZoom)

	//Add horizontal layout to main layout.

	lay.AddChild( layHoriz )

	//Add layout to app.	

	app.AddLayout( lay )

	app.AddDrawer( layDMenu,0.5,0.9,"left" )

	app.AddLayout( layBott )

	setInterval(detect);

}

function Img_OnTouch()

{

 web.Execute( Image,btnMenu_OnTouch)

 }

//Called when user touches 'Local' button.

//(We could use a url like "file:///sdcard/MyPage.htm")

function btnLocal_OnTouch()

{

	web.LoadUrl("https://"+txtDynamic.GetText())

}

//Show page load progress.

function web_OnProgess( progress )

{

	app.Debug( "progress = " + progress )

	if( progress==100 ) app.HideProgress()

}

function web_OnRequest ()

{

}

function On_Complete()

{

app.Alert( "download completed" ,"Powerfull downloader")

}

//button on Drawer

function btnForward_OnTouch ()

{

var SBack =web.Forward();

}

function btnBack_OnTouch ()

{

var SBack =web.Back();

}

//Downloader

function dloadBtn_OnTouch()

{

dwn =	app.CreateDownloader("Dark")

app.ShowTextDialog( "Download Address:", web.GetTitle(), DwnName )

dwn.SetOnDownload( dload_OnDownload )

dwn.SetOnError(dload_OnError)

}

//Handle download completion.

function dload_OnDownload( file )

{

	app.ShowPopup( "Downloaded: " + file )

}

//Handle download errors.

function dload_OnError( error )

{

	app.ShowPopup( "Download failed: " + error )

}

function DwnName( name )

{

dwn.Download(web.GetUrl(),"/sdcard/Download/",images)

  

}

function btnCapt_OnTouch ()

{
web.Capture("/sdcard/Download/file.png")

}

function btnZoom_OnTouch(value)

{

  web.SetTextZoom(value)

  web.SetZoom(Value)

}

Post a Comment

0 Comments