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
import com.nhaarman.mockito_kotlin.mock | |
import com.nhaarman.mockito_kotlin.verify | |
import org.junit.Test | |
class Tests { | |
@Test | |
fun testname_callsfunctionname() { | |
//Instantiate Presenter | |
val presenter = MyPresenter() |
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
//JSON Load from file to object | |
public JSONObject loadJSONFromAsset() { | |
String json = null; | |
try { | |
//Points towards top level assets folder | |
InputStream is = getApplicationContext().getAssets().open("filename.json"); | |
int size = is.available(); | |
byte[] buffer = new byte[size]; | |
is.read(buffer); | |
is.close(); |
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
//JSON Load from file to object | |
private fun loadJSONFromAsset(): JSONObject? { | |
var json: JSONObject? | |
try { | |
val inputStream = applicationContext.assets.open("currencies.json") | |
val inputString = inputStream.bufferedReader().use{it.readText()} | |
json = JSONObject(inputString) | |
} catch (ex: IOException) { | |
ex.printStackTrace() | |
return null |
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
var win = Ti.UI.createWindow({ | |
fullscreen: true, | |
backgroundColor: 'blue', | |
}); | |
setInterval(function(){ | |
var backColor = win.backgroundColor; | |
if(backColor == 'blue'){ | |
win.animate({backgroundColor: 'purple', duration: 1500}); | |
win.backgroundColor = 'purple'; |
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
var screenHeight = Ti.Platform.displayCaps.platformHeight; | |
var screenWidth = Ti.Platform.displayCaps.platformWidth; | |
var win = Ti.UI.createWindow({ | |
fullscreen: true, | |
height: screenHeight, | |
width: screenWidth, | |
backgroundColor: 'white' | |
}); |
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
//"THE BEER-WARE LICENSE": As long as you retain this notice you can do whatever you want with this stuff. | |
//If we meet some day, and you think this stuff is worth it, you can buy me a beer in return Jamie Buckley | |
var screenWidth = Ti.Platform.displayCaps.platformWidth; | |
var screenHeight = Ti.Platform.displayCaps.platformHeight; | |
var win = Ti.UI.createWindow({ | |
fullscreen: true, | |
width: screenWidth, | |
height: screenHeight, |
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
//"THE BEER-WARE LICENSE": As long as you retain this notice you can do whatever you want with this stuff. | |
//If we meet some day, and you think this stuff is worth it, you can buy me a beer in return Jamie Buckley | |
var win = Ti.UI.createWindow({ | |
backgroundColor: 'black', | |
fullscreen: true, | |
width: Ti.Platform.displayCaps.platformWidth, | |
height: Ti.Platform.displayCaps.platformHeight | |
}); |
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
var win1 = Titanium.UI.createWindow({ | |
backgroundColor:'black', | |
layout: 'vertical', | |
fullscreen: true, | |
width: Ti.Platform.displayCaps.platformWidth, | |
height: Ti.Platform.displayCaps.platformHeight | |
}); | |
//Create window that will contain the picker | |
var pickerView = Ti.UI.createView({ |
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
var win = Ti.UI.createWindow({ | |
fullscreen: true, | |
backgroundColor: 'gray', | |
layout: 'vertical' | |
}); | |
//This function is used to create our pages | |
function newPage(pageColor, leftPos){ | |
v = Ti.UI.createView({backgroundColor: pageColor, left: leftPos, height: Ti.Platform.displayCaps.platformHeight * 0.9, width: Ti.Platform.displayCaps.platformWidth}); | |
return v; |