-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedtfunction.js
44 lines (34 loc) · 875 Bytes
/
edtfunction.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//edt functions
function mkfileb_OnTouch()
{
mkfile()
}
//Called when a file is chosen.
function OnFileChoose( file )
{
fdlg.Dismiss();
choosen = file
app.ShowPopup( choosen + " loaded" );
txt = app.ReadFile( choosen );
edt.SetText( txt );
}
//Called when user touches save button.
function btnSave()
{
app.ShowPopup( choosen );
txt = edt.GetText();
app.WriteFile( choosen, txt );
}
function Convert(x) { // Convert function
var parsed = parseInt(x);
if (isNaN(parsed)) { return 0 }
return parsed;
}
function btn_OnTouch() // Apply button in settings
{
var tmp = wt.GetText(); //Gets and converts text
var fontsize = Convert(tmp);
app.WriteFile( "/sdcard/texted/settings.ini", fontsize ); //Writes font size
app.ShowPopup( fontsize );
edt.SetTextSize( parseInt(app.ReadFile( "/sdcard/texted/settings.ini" )) );
}