Best JavaScript code snippet using appium-android-driver
LuoBoMainScene.js
Source:LuoBoMainScene.js
...17 this.addChild(settingBtn, 20);18 settingBtn.addTouchEventListener(this.settingBtnFunc, this);19 20 var helpBtn = ccui.Button.create("btn_help_normal.png","btn_help_pressed.png","",ccui.Widget.PLIST_TEXTURE);21 helpBtn.setPosition(cc.p(this.getSize().width - 200, 225));22 this.addChild(helpBtn, 20);23 helpBtn.addTouchEventListener(this.helpBtnFunc, this);24 25 var adventureBtn = ccui.Button.create("btn_adventure_normal_CN.png","btn_adventure_pressed_CN.png","",ccui.Widget.PLIST_TEXTURE);26 adventureBtn.setPosition(cc.p(adventureBtn.width/2+30, 80));27 this.addChild(adventureBtn, 20);28 adventureBtn.addTouchEventListener(this.adventureBtnFunc, this);29 30 {31 var bossModuleBtn = ccui.Button.create("btn_boss_normal_CN.png","btn_boss_pressed_CN.png","",ccui.Widget.PLIST_TEXTURE);32 bossModuleBtn.setPosition(cc.p(this.getSize().width/2, 80));33 this.addChild(bossModuleBtn, 20);34 bossModuleBtn.addTouchEventListener(this.bossModuleBtnFunc, this);35 var lockImage = ccui.ImageView.create("locked.png",ccui.Widget.PLIST_TEXTURE);36 lockImage.setPosition(cc.p(bossModuleBtn.x+bossModuleBtn.width/2-20,bossModuleBtn.y-20));37 this.addChild(lockImage, 20);38 }39 40 {41 var monsterBtn = ccui.Button.create("btn_nest_normal_CN.png","btn_nest_pressed_CN.png","",ccui.Widget.PLIST_TEXTURE);42 monsterBtn.setPosition(cc.p(this.getSize().width - monsterBtn.width/2 - 30, 80));43 this.addChild(monsterBtn, 20);44 monsterBtn.addTouchEventListener(this.monsterBtnFunc, this);45 var lockImage = ccui.ImageView.create("locked.png",ccui.Widget.PLIST_TEXTURE);46 lockImage.setPosition(cc.p(monsterBtn.x+monsterBtn.width/2-20,monsterBtn.y-20));47 this.addChild(lockImage, 20);48 49 }50 51 },52 //monster module scene53 monsterBtnFunc:function(target, state)54 {55 if(state == ccui.Widget.TOUCH_ENDED)56 {57 var monsterLock = new LuoBoLockLayout("monsterHome");58 this.addChild(monsterLock, 100);59 }60 },61 //boss module scene62 bossModuleBtnFunc:function(target, state)63 {64 if(state == ccui.Widget.TOUCH_ENDED)65 {66 var bossLock = new LuoBoLockLayout("boss");67 this.addChild(bossLock, 100);68 }69 },70 //adventure scene71 adventureBtnFunc:function(target, state)72 {73 if(state == ccui.Widget.TOUCH_ENDED)74 {75 var themes = LuoBoThemesScene.createScene();76 cc.director.runScene(cc.TransitionFade.create(changeSceneTime, themes));77 }78 },79 //setting scene80 settingBtnFunc:function(target, state)81 {82 if(state == ccui.Widget.TOUCH_ENDED)83 {84 var set = LuoBoSettingScene.createScene();85 cc.director.runScene(cc.TransitionSlideInB.create(changeSceneTime, set));86 }87 },88 //help scene89 helpBtnFunc:function(target, state)90 {91 if(state == ccui.Widget.TOUCH_ENDED)92 {93 var help = LuoBoHelpScene.createScene();94 cc.director.runScene(cc.TransitionSlideInT.create(changeSceneTime, help));95 }96 },97 //init scene98 zinit:function()99 {100 this.setSize(Default.windowSize());101 cc.spriteFrameCache.addSpriteFrames("res/Themes/scene/mainscene1-hd.plist");102 {103 var bird = cc.Sprite.createWithSpriteFrameName("bird.png");104 bird.setPosition(cc.p(200, this.getSize().height - 150));105 this.addChild(bird, 10);106 //top to down effect107 var move = cc.MoveBy.create(1, cc.p(0, 20));108 var move_ease_inout1 = move.clone().easing(cc.easeInOut(2.0));109 var move_ease_inout_back1 = move_ease_inout1.reverse();110 var delay = cc.DelayTime.create(0.1);111 var seq1 = cc.Sequence.create(move_ease_inout1, delay, move_ease_inout_back1, delay.clone());112 bird.runAction(seq1.repeatForever());113 }114 115 var luobo = cc.Sprite.createWithSpriteFrameName("carrot.png");116 luobo.setAnchorPoint(0.5, 0);117 luobo.setPosition(cc.p(this.getSize().width/2, this.getSize().height/2 + luobo.height/4 -luobo.height/2));118 this.addChild(luobo, 10);119 120 var yunduo = cc.Sprite.createWithSpriteFrameName("cloud1.png");121 yunduo.setPosition(cc.p(this.getSize().width -100, this.getSize().height - 50));122 this.addChild(yunduo, 10);123 124 {125 var yezi = cc.Sprite.createWithSpriteFrameName("leaf-1.png");126 yezi.setAnchorPoint(0.5, 0);127 yezi.setPosition(cc.p(400, this.getSize().height - 150 - yezi.height/2));128 this.addChild(yezi, 5);129 var yezi1 = cc.Sprite.createWithSpriteFrameName("leaf-2.png");130 yezi1.setAnchorPoint(0.5, 0);131 yezi1.setPosition(cc.p(470, this.getSize().height - 130 - yezi1.height/2));132 this.addChild(yezi1, 5);133 var yezi2 = cc.Sprite.createWithSpriteFrameName("leaf-3.png");134 yezi2.setAnchorPoint(0.5, 0);135 yezi2.setPosition(cc.p(550, this.getSize().height - 140 - yezi2.height/2));136 this.addChild(yezi2, 4);137 //rotate effect138 this.schedule(function()139 {140 var rotate = cc.RotateBy.create(0.1, 10, 10);141 var rotater = rotate.reverse();142 var sequence = cc.sequence(rotate, rotater);143 yezi1.runAction(sequence.repeat(3));144 this.scheduleOnce(function()145 {146 var rotate = cc.RotateBy.create(0.1, 10, 10);147 var rotater = rotate.reverse();148 var sequence = cc.sequence(rotate, rotater);149 yezi2.runAction(sequence.repeat(3));150 }, 2);151 }, 6);152 }153 154 {155 luobo.scale = yezi.scale = yezi1.scale = yezi2.scale = 0;156 var scaleTo = cc.ScaleTo.create(0.25, 1.2, 1.2);157 var scaleBy = cc.ScaleBy.create(0.1, 1, 1);158 var sequence = cc.sequence(scaleTo, scaleBy);159 luobo.runAction(sequence);160 yezi.runAction(sequence.clone());161 yezi1.runAction(sequence.clone());162 yezi2.runAction(sequence.clone());163 }164 165 var background = cc.Sprite.createWithSpriteFrameName("mainbg.png");166 background.setPosition(cc.p(this.getSize().width/2, this.getSize().height/2));167 this.addChild(background, 0);168 169 var protectedLuobo = cc.Sprite.createWithSpriteFrameName("mainbg_CN.png");170 protectedLuobo.setPosition(cc.p(this.getSize().width/2, this.getSize().height/2));171 this.addChild(protectedLuobo, 10);172 173 cc.log(this.getSize().width+" "+this.getSize().height);174 }175});176LuoBoMainScene.createScene = function()177{178 var mains = new LuoBoMainScene();179 var scene = new BaseScene();180 scene.addChild(mains);181 return scene;...
AList.js
Source:AList.js
...20 }21 return index;22};23Alist.prototype.addStart = function(digit) {24 for (let index = this.getSize(); index > 0; index--) {25 this.arr[index] = this.arr[index - 1];26 }27 this.arr[0] = digit;28 return this.arr;29};30Alist.prototype.addEnd = function(digit) {31 this.arr[this.getSize()] = digit;32 return this.arr;33};34Alist.prototype.delStart = function() {35 let delstar=this.arr[0];36 for (let i = 0; i < this.getSize() - 1; i++) {37 this.tempar[i] = this.arr[i + 1];38 }39 this.arr = this.tempar;40 this.tempar = [];41 //return this.arr;42 return delstar;43};44Alist.prototype.delEnd = function() {45let delend=this.arr[this.getSize()-1];46 for (let i = 0; i < this.getSize() - 1; i++) {47 this.tempar[i] = this.arr[i];48 }49 this.arr = this.tempar;50 this.tempar = [];51 return delend;52};53Alist.prototype.delPos = function(index) {54 let delpos=this.arr[index];55 if (index == 0) {56 return this.delStart();57 } else if (index == this.getSize() - 1) {58 return this.delEnd();59 } else if (index > this.getSize() - 1) {60 console.log("Thiss Index not array");61 return "Thiss Index not array";62 } else {63 for (let n = 0; n < index; n++) {64 this.tempar1[n] = this.arr[n];65 }66 for (let d = index; d < this.getSize() - 1; d++) {67 this.tempar1[d] = this.arr[d + 1];68 }69 this.arr = this.tempar1;70 this.tempar1 = [];71 return delpos;72 }73};74Alist.prototype.getIndex = function(index) {75 for (let i = 0; i < this.getSize(); i++) {76 if (i == index) {77 return this.arr[index];78 }79 }80 return undefined;81};82Alist.prototype.setIndex = function(index, value) {83 //let temp = [];84 if (index <= this.getSize() - 1) {85 86 87 for (let i= this.getSize(); i > index; i--) {88 this.arr[i]=this.arr[i-1];89 90 }91 this.arr[index]=value;92 93 } else {94 // // еÑли запиÑÑ Ð² болÑÑÑÑ Ð´Ð»Ð¸Ð½Ð½Ñ95 // for (let i = 0; i < index + 1; i++) {96 // if (i < this.getSize()) {97 // temp[i] = this.arr[i];98 // } else temp[i] = 0;99 // }100 // temp[index] = value;101 // this.arr = temp;102 return 'error index ';103 }104 return this.arr;105};106Alist.prototype.myToString = function() {107 let mystring = this.arr[0] + "";108 for (let index = 1; index < this.getSize(); index++) {109 mystring += +"" + this.arr[index] + "";110 }111 return mystring;112};113// к Ð·Ð°Ð´Ð°Ð½Ð¸Ñ Ð½Ðµ оÑноÑиÑÑÑ114// Alist.prototype.getClear = function() {115// let element = this.defaultArray[0] + " ";116// for (let i = 1; typeof this.defaultArray[i]=='number'; i++) {117// element += +" " + this.defaultArray[i] + " ";118// }119// return element;120// };121Alist.prototype.Clear=function(){122 this.arr=[];123 this.arr = this.defaultArray;124 return this.arr;125}126Alist.prototype.getMin = function() {127 let min = this.arr[0];128 for (let i = 1; i < this.getSize(); i++) {129 if (this.arr[i] < min) {130 min = this.arr[i];131 }132 }133 return min;134};135Alist.prototype.getMax = function() {136 let max = this.arr[0];137 for (let i = 1; i < this.getSize(); i++) {138 if (this.arr[i] > max) {139 max = this.arr[i];140 }141 }142 return max;143};144Alist.prototype.sort = function() {145 for (let i = 0; i < this.getSize() - 1; i++) {146 for (let j = i + 1; j < this.getSize(); j++) {147 if (this.arr[i] > this.arr[j]) {148 let temp = this.arr[i];149 this.arr[i] = this.arr[j];150 this.arr[j] = temp;151 }152 }153 }154 return this.arr;155};156Alist.prototype.getMinIndex = function() {157 let min = this.arr[0];158 let index = 0;159 for (let i = 1; i < this.getSize(); i++) {160 if (this.arr[i] < min) {161 min = this.arr[i];162 index = i;163 }164 }165 return index;166};167Alist.prototype.getMaxIndex = function() {168 let max = this.arr[0];169 let index = 0;170 for (let i = 1; i < this.getSize(); i++) {171 if (this.arr[i] > max) {172 max = this.arr[i];173 index = i;174 }175 }176 return index;177};178Alist.prototype.getRevers = function() {179 for (let index = 0; index < parseInt(this.getSize() / 2); index++) {180 let temp = this.arr[index];181 this.arr[index] = this.arr[this.getSize() - index - 1];182 this.arr[this.getSize() - index - 1] = temp;183 }184 return this.arr;185};186Alist.prototype.getHalfRevers = function() {187 for (let i = 0; i < parseInt(this.getSize() / 4); i++) {188 const temp = this.arr[i];189 this.arr[i] = this.arr[parseInt(this.getSize() / 2 - i - 1)];190 this.arr[parseInt(this.getSize() / 2 - i - 1)] = temp;191 }192 let count = 0;193 for (194 let i1 = parseInt(this.getSize() / 2);195 i1 < parseInt(this.getSize() / 2) + parseInt(this.getSize() / 4);196 i1++197 ) {198 if (this.getSize() % 2 == 0) {199 const element = this.arr[i1];200 this.arr[i1] = this.arr[this.getSize() - count - 1];201 this.arr[this.getSize() - count - 1] = element;202 count++;203 } else {204 const element = this.arr[i1 + 1];205 this.arr[i1 + 1] = this.arr[this.getSize() - count - 1];206 this.arr[this.getSize() - count - 1] = element;207 count++;208 }209 }210 return this.arr;211};...
InputDialog.js
Source:InputDialog.js
...42 this.textInput.blur();43 super.dismiss(callback);44 }45 renderContent() {46 return <View style={{width: this.mScreenWidth, backgroundColor: '#f8f8f8', marginBottom: this.getSize(0)}}>47 <View style={{48 width: this.mScreenWidth, height: this.getSize(50),49 flexDirection: 'row', paddingLeft: this.getSize(10),50 justifyContent: 'center', alignItems: 'center'51 }}>52 <TouchableOpacity53 onPress={() => this.dismiss(this.props.onCoverPress)}54 style={{55 position: 'absolute', left: this.getSize(10),56 height: this.getSize(40), flexDirection: 'row',57 justifyContent: 'center', alignItems: 'center', marginLeft: this.getSize(5)58 }}>59 <Text style={{60 fontSize: this.props.cancelSize,61 color: this.props.cancelColor,62 marginLeft: this.getSize(5)63 }}>{this.props.cancelText}</Text>64 </TouchableOpacity>65 <Text style={{66 position: 'absolute',67 fontSize: this.props.titleSize,68 color: this.props.titleColor,69 fontWeight: '600'70 }}>{this.props.title}</Text>71 </View>72 <TextInput ref={ref => this.textInput = ref}73 style={{74 width: this.getSize(345),75 marginLeft: this.getSize(15),76 height: this.getSize(100),77 color: '#333333',78 fontSize: this.getSize(14),79 borderWidth: 1,80 borderColor: '#E8EEF0',81 backgroundColor: '#ffffff',82 borderRadius: this.getSize(4),83 paddingLeft: this.getSize(15),84 paddingRight: this.getSize(15),85 paddingTop: this.getSize(10),86 }}87 numberOfLines={4}88 multiline={true}89 value={this.state.text}90 underlineColorAndroid={'transparent'}91 placeholder={this.props.placeholder}92 placeholderTextColor='#999999'93 onChangeText={(text) => {94 this.inputText = text;95 this.setState({96 inputText: text,97 });98 }}/>99 <View style={{100 flexDirection: 'row',101 width: this.mScreenWidth,102 height: this.getSize(48),103 paddingRight: this.getSize(15),104 paddingLeft: this.getSize(15),105 marginBottom: this.getSize(30),106 justifyContent: 'space-between',107 alignItems: 'center'108 }}>109 <Text style={{110 color: this.state.inputText.length > this.props.maxSize ? 'red' : '#999999',111 fontSize: 14112 }}>{this.state.inputText.length}/{this.props.maxSize}{this.state.inputText.length > this.props.maxSize ? ' æå¤è¾å
¥' + this.props.maxSize + '个å符' : ''}</Text>113 <TouchableOpacity114 onPress={() => this.state.inputText.length <= this.props.maxSize && this.dismiss(() => {115 this.props.onSubmit && this.props.onSubmit(this.inputText);116 })}117 style={{118 width: this.getSize(60), height: this.getSize(28),119 justifyContent: 'center', alignItems: 'center',120 backgroundColor: this.props.btnBgColor, borderRadius: this.getSize(4)121 }}>122 <Text style={{123 fontSize: this.props.btnTextSize,124 color: this.props.btnTextColor125 }}>{this.props.btnText}</Text>126 </TouchableOpacity>127 </View>128 <KeyboardSpacer/>129 </View>130 }131}...
canvas.js
Source:canvas.js
...23 this.canvas.style.position = "absolute";24 this.ctx = this.canvas.getContext("2d");25 switch (this.options.direction) {26 case 'left':27 this.canvas.style.top = `${this.getSize().top + (this.getSize().height / 2) - (this.canvas.height / 2)}px`;28 this.canvas.style.left = `${this.getSize().left - this.canvas.width}px`;29 this.emitterX = this.canvas.width - 20;30 this.emitterY = this.canvas.height / 2;31 break;32 case 'right':33 this.canvas.style.top = `${this.getSize().top + (this.getSize().height / 2) - (this.canvas.height / 2)}px`;34 this.canvas.style.left = `${this.getSize().left + this.getSize().width}px`;35 this.emitterX = 0;36 this.emitterY = this.canvas.height / 2;37 break;38 case 'top':39 default:40 this.canvas.style.top = `${this.getSize().top - this.canvas.height}px`;41 this.canvas.style.left = `${this.getSize().left + (this.getSize().width / 2) - (this.canvas.width / 2)}px`;42 this.emitterX = this.canvas.width / 2;43 this.emitterY = this.canvas.height - 20;44 }45 this.maxLifeTime = Math.min(5000, (this.canvas.height / (1.5 * 60) * 1000));46 this.minSpawnTime = this.options.minSpawnTime;47 this.onResize = (e) => {48 self.resize(e);49 }50 window.addEventListener('resize', debounce(this.onResize, 200), true);51 document.body.appendChild(this.canvas);52 }53 getCanvas() {54 this.canvas;55 }56 spawn() {57 if (this.options.timeout && (new Date().getTime() > this.startTime + this.options.timeout)) {58 if (!this.parts.length) {59 this.destroy();60 }61 return;62 }63 if (new Date().getTime() > this.lastTime + this.minSpawnTime) {64 this.lastTime = new Date().getTime();65 this.parts.push(new Smoke(this.emitterX, this.emitterY, this.maxLifeTime, this.options.direction));66 }67 }68 render() {69 let self = this;70 var len = this.parts.length;71 this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);72 while (len--) {73 if (this.parts[len].y < 0 || this.parts[len].lifeTime > this.maxLifeTime) {74 this.parts.splice(len, 1);75 } else {76 this.parts[len].update();77 this.ctx.save();78 var offsetX = -this.parts[len].size / 2,79 offsetY = -this.parts[len].size / 2;80 this.ctx.translate(this.parts[len].x - offsetX, this.parts[len].y - offsetY);81 this.ctx.rotate(this.parts[len].angle / 180 * Math.PI);82 this.ctx.globalAlpha = this.parts[len].alpha;83 this.ctx.drawImage(this.image, offsetX, offsetY, this.parts[len].size, this.parts[len].size);84 this.ctx.restore();85 }86 }87 this.spawn();88 if (len) {89 requestAnimationFrame(() => {90 self.render();91 });92 }93 }94 getSize() {95 return {96 top: this.element.getBoundingClientRect().top + window.scrollY,97 left: this.element.getBoundingClientRect().left + window.scrollX,98 height: this.element.offsetHeight,99 width: this.element.offsetWidth100 }101 }102 resize() {103 console.log('resizing', this.getSize());104 switch (this.options.direction) {105 case 'left':106 this.canvas.style.top = `${this.getSize().top + (this.getSize().height / 2) - (this.canvas.height / 2)}px`;107 this.canvas.style.left = `${this.getSize().left - this.canvas.width}px`;108 break;109 case 'right':110 this.canvas.style.top = `${this.getSize().top + (this.getSize().height / 2) - (this.canvas.height / 2)}px`;111 this.canvas.style.left = `${this.getSize().left + this.getSize().width}px`;112 break;113 case 'top':114 default:115 this.canvas.style.top = `${this.getSize().top - this.canvas.height}px`;116 this.canvas.style.left = `${this.getSize().left + (this.getSize().width / 2) - (this.canvas.width / 2)}px`;117 }118 }119 destroy() {120 document.body.removeChild(this.canvas);121 window.removeEventListener('resize', this.onResize);122 }...
DownloadDialog.js
Source:DownloadDialog.js
...36 }37 renderContent() {38 return <Animated.View39 style={{40 width: this.getSize(307),41 backgroundColor: '#ffffff', borderRadius: this.getSize(5),42 marginBottom: this.getSize(30),43 }}>44 <Text style={{45 marginTop: this.getSize(15), marginLeft: this.getSize(15),46 color: this.props.titleColor, fontSize: this.props.titleSize47 }}>{this.props.title}</Text>48 <View style={{49 justifyContent: 'center',50 alignItems: 'center', marginTop: this.getSize(25)51 }}>52 <View style={{ width: this.getSize(280), height: 4, borderRadius: 2, backgroundColor: '#d3d3d3' }} />53 <Animated.View style={{54 width: this.process.interpolate({55 inputRange: [0, 1],56 outputRange: [0, this.getSize(280)]57 }), height: 4, borderRadius: 2,58 backgroundColor: '#1097D5',59 position: 'absolute', left: this.getSize((307 - 280) / 2)60 }} />61 </View>62 <Text style={{63 paddingRight: this.getSize(12), textAlign: 'right', width: this.getSize(307),64 marginTop: this.getSize(5), marginBottom: this.getSize(15),65 color: this.props.totalTextColor, height: this.props.totalTextSize,66 fontSize: this.props.totalTextSize, lineHeight: this.props.totalTextSize67 }}>68 {this.state.total}69 </Text>70 <View style={{ width: this.getSize(307), height: this.mOnePixel, backgroundColor: '#e6e6e6' }} />71 <View style={{72 width: this.getSize(307), height: this.getSize(40),73 justifyContent: 'center', alignItems: 'center',74 flexDirection: 'row',75 }}>76 <TouchableOpacity77 onPress={() => {78 if (this.props.active) {79 this.dismiss(() => {80 this.process.setValue(0);81 this.props.active = false;82 this.props.onAction && this.props.onAction()83 });84 }85 }}86 style={{87 width: this.getSize(307), height: this.getSize(40),88 alignItems: 'center', justifyContent: 'center',89 }}>90 <Text style={{ color: '#1097D5', fontSize: this.getSize(16), opacity: this.props.active ? 1 : 0.5 }}>{this.props.actionText}</Text>91 </TouchableOpacity>92 </View>93 </Animated.View >94 }95}...
SimpleChooseDialog.js
Source:SimpleChooseDialog.js
...38 this.setState({ seleted: index })39 }}40 key={this.key ? item[this.key] : item}41 style={{42 paddingLeft: this.getSize(20), paddingRight: this.getSize(20),43 width: this.getSize(307), height: this.getSize(49),44 justifyContent: 'flex-start', alignItems: 'center', flexDirection: 'row'45 }}>46 <View style={{47 width: this.props.pointSize, height: this.props.pointSize,48 justifyContent: 'center', alignItems: 'center', marginRight: this.getSize(20),49 borderRadius: this.props.pointBorderRadius, borderWidth: 1,50 borderColor: this.state.seleted == index ? this.props.selectColor : this.props.normalColor,51 }}>52 {this.state.seleted == index ? <View style={{53 width: this.props.pointSize * 0.6, height: this.props.pointSize * 0.6,54 borderRadius: this.props.pointBorderRadius * 0.6,55 backgroundColor: this.props.selectColor56 }} /> : null}57 </View>58 <Text style={[this.props.itemStyle, this.state.seleted == index ? { color: this.props.selectColor } : {}]}>{typeof item == 'string' ? item : item[this.props.itemKey]}</Text>59 </TouchableOpacity>60 })61 }62 _getContentPosition() {63 return { justifyContent: 'center', alignItems: 'center' }64 }65 renderContent() {66 return <View style={{ width: this.getSize(307), backgroundColor: '#ffffff', borderRadius: this.getSize(5), alignItems: 'center', paddingTop: this.getSize(10) }}>67 {this.renderItems()}68 <TouchableOpacity69 onPress={() => {70 this.dismiss(() => {71 if (this.props.onPress) {72 this.props.onPress(this.state.seleted != null ? this.state.seleted : -1);73 }74 });75 }}76 style={{77 width: this.getSize(200), height: this.getSize(44),78 backgroundColor: this.props.confirmBtnColor, borderRadius: this.getSize(5),79 justifyContent: 'center', alignItems: 'center', marginTop: this.getSize(13), marginBottom: this.getSize(20)80 }}>81 <Text style={{ color: this.props.confirmTextColor, fontSize: this.getSize(16), fontWeight: '400' }}>{this.props.confirmText}</Text>82 </TouchableOpacity>83 </View >84 }85}...
AlertDialog.js
Source:AlertDialog.js
...25 return { justifyContent: 'center', alignItems: 'center' }26 }27 renderContent() {28 return <View style={{29 height: this.getSize(150), width: this.getSize(307),30 backgroundColor: '#ffffff', borderRadius: this.getSize(6)31 }}>32 <View style={{33 width: this.getSize(307), flex: 1, paddingLeft: this.getSize(15), paddingRight: this.getSize(15),34 justifyContent: 'center', alignItems: 'center'35 }}>36 <Text style={{37 fontSize: this.props.messageTextSize, fontWeight: '100', color: this.props.messageTextColor,38 lineHeight: this.getSize(20), textAlign: 'center',39 }}>{this.props.messageText}</Text>40 </View>41 <View style={{ width: this.getSize(307), height: 0.5, backgroundColor: '#e6e6e6' }} />42 <View style={{43 height: this.getSize(45),44 width: this.getSize(307),45 justifyContent: 'center',46 alignItems: 'center',47 flexDirection: 'row',48 }}>49 <TouchableOpacity50 onPress={() => {51 this.dismiss(() => {52 if (this.props.onPress) {53 this.props.onPress(true);54 }55 });56 }}57 style={{58 flex: 1, height: this.getSize(45),59 alignItems: 'center', justifyContent: 'center'60 }}>61 <Text style={{ color: this.props.positiveColor, fontSize: this.props.positiveSize }}>62 {this.props.positiveText}63 </Text>64 </TouchableOpacity>65 <View style={{66 height: this.getSize(28), width: this.mOnePixel, backgroundColor: '#e6e6e6'67 }} />68 <TouchableOpacity69 onPress={() => {70 this.dismiss(() => {71 if (this.props.onPress) {72 this.props.onPress(false);73 }74 });75 }}76 style={{77 flex: 1, height: this.getSize(45),78 alignItems: 'center', justifyContent: 'center'79 }}>80 <Text style={{ color: this.props.negativeColor, fontSize: this.props.negativeSize }}>{this.props.negativeText}</Text>81 </TouchableOpacity>82 </View>83 </View >84 }85}...
Array.js
Source:Array.js
...11 toString() { return this._data; }12 getSize() { return this._data.length; }13 isEmpty() { return !!this._data.length; }14 addFirst(elm) { return this.add(0, elm); }15 addLast(elm) { return this.add(this.getSize(), elm); }16 add(index, elm) {17 const size = this.getSize() + 1;18 if( index < 0 || index >= size ) throw this.error('Add failed. Require index >=0 and index <= size.');19 this._data.splice(index, 0, elm);20 }21 getFirst() { return this.get(0); }22 getLast(){ return this.get(this.getSize() - 1); }23 get(index) {24 const size = this.getSize();25 if( index < 0 || index >= size ) throw this.error('Get failed. Index is illegal.');26 return this._data[index];27 }28 29 set(index, elm) {30 const size = this.getSize();31 if( index < 0 || index >= size ) throw this.error('Set failed. Index is illegal.');32 this._data[index] = elm;33 }34 find(elm) {35 const size = this.getSize();36 for( let i = 0; i < size; i++ ) {37 if( this._data[i] === elm ) return i;38 }39 return -1;40 }41 contains(elm) {42 const size = this.getSize();43 for( let i = 0; i < size; i++ ) {44 if( this._data[i] === elm ) return true;45 }46 return false;47 }48 removeFirst() { return this.remove(0); }49 removeLast() { return this.remove(this.getSize()-1); }50 remove(index) {51 const size = this.getSize();52 if( index < 0 || index >= size ) throw this.error('Remove failed. Index is illegal.');53 return this._data.splice(index, 1);54 }55 removeElement(elm) {56 const index = this.find(elm);57 if( index === -1 ) return false;58 this.remove(index);59 return true;60 }61 swap(i, j) {62 const tmp = this._data[i];63 this._data[i] = this._data[j];64 this._data[j] = tmp;65 }...
Using AI Code Generation
1var webdriver = require('selenium-webdriver'),2 until = webdriver.until;3var driver = new webdriver.Builder()4 .forBrowser('chrome')5 .build();6driver.findElement(By.name('q')).sendKeys('webdriver');7driver.findElement(By.name('btnG')).click();8driver.wait(until.titleIs('webdriver - Google Search'), 1000);9driver.quit();10var AndroidDriver = function() {11 this.getSize = function() {12 return {13 };14 }15}16module.exports = AndroidDriver;17var webdriver = require('selenium-webdriver'),18 until = webdriver.until;19var driver = new webdriver.Builder()20 .forBrowser('chrome')21 .build();22driver.findElement(By.name('q')).sendKeys('webdriver');23driver.findElement(By.name('btnG')).click();24driver.wait(until.titleIs('webdriver - Google Search'), 1000);25require('./android-driver.js');26console.log(driver.getSize());27driver.quit();28{ width: 100, height: 100 }
Using AI Code Generation
1var driver = new wd.Builder()2 .withCapabilities({3 })4 .build();5 .init()6 .then(function() {7 return driver.getSize();8 })9 .then(function(size) {10 console.log("height: " + size.height);11 console.log("width: " + size.width);12 })13 .fin(function() { return driver.quit(); })14 .done();
Using AI Code Generation
1var driver = new webdriver.Builder()2 .withCapabilities({3 })4 .build();5driver.getSize().then(function(size) {6 console.log(size);7});8driver.quit();9{ width: 480, height: 800 }
Using AI Code Generation
1var wd = require('wd');2var driver = wd.promiseChainRemote("localhost", 4723);3driver.init({4}).then(function() {5 return driver.getSize();6}).then(function(size) {7 return driver.quit().then(function() {8 return size;9 });10}).done(function(size) {11 console.log('Size of the screen is ' + size);12});13Your name to display (optional):14Your name to display (optional):15var wd = require('wd');16var driver = wd.promiseChainRemote("localhost", 4723);17driver.init({18}).then(function() {19 return driver.getSize();20}).then(function(size) {21 return driver.quit().then(function() {22 return size;23 });24}).done(function(size) {25 console.log('Size of the screen is ' + size);26});27Your name to display (optional):
Using AI Code Generation
1var size = driver.getSize();2var size = driver.getSize();3driver.quit();4var size = driver.getSize();5driver.quit();6var size = driver.getSize();7driver.quit();8var size = driver.getSize();9driver.quit();10var size = driver.getSize();11driver.quit();12var size = driver.getSize();13driver.quit();14var size = driver.getSize();15driver.quit();16var size = driver.getSize();17driver.quit();18var size = driver.getSize();19driver.quit();20var size = driver.getSize();21driver.quit();22var size = driver.getSize();23driver.quit();24var size = driver.getSize();25driver.quit();26var size = driver.getSize();27driver.quit();28var size = driver.getSize();29driver.quit();30var size = driver.getSize();31var size = driver.getSize();32driver.quit();33var size = driver.getSize();34driver.quit();35var size = driver.getSize();36driver.quit();37var size = driver.getSize();38driver.quit();39var size = driver.getSize();40driver.quit();41var size = driver.getSize();42driver.quit();43var size = driver.getSize();44driver.quit();
Using AI Code Generation
1var AndroidHybrid = require('appium-android-driver/lib/android-hybrid.js');2var AndroidHybrid = new AndroidHybrid();3AndroidHybrid.getSize();4var AndroidHybrid = require('appium-android-driver/lib/android-hybrid.js');5var AndroidHybrid = new AndroidHybrid();6AndroidHybrid.getSize();7var AndroidHybrid = require('appium-android-driver/lib/android-hybrid.js');8var AndroidHybrid = new AndroidHybrid();9AndroidHybrid.getSize();10var AndroidHybrid = require('appium-android-driver/lib/android-hybrid.js');11var AndroidHybrid = new AndroidHybrid();12AndroidHybrid.getSize();13var AndroidHybrid = require('appium-android-driver/lib/android-hybrid.js');14var AndroidHybrid = new AndroidHybrid();15AndroidHybrid.getSize();16var AndroidHybrid = require('appium-android-driver/lib/android-hybrid.js');17var AndroidHybrid = new AndroidHybrid();18AndroidHybrid.getSize();19var AndroidHybrid = require('appium-android-driver/lib/android-hybrid.js');20var AndroidHybrid = new AndroidHybrid();21AndroidHybrid.getSize();
Using AI Code Generation
1driver.getSize(function(err, size) {2 console.log(size);3});4{ width: 1080, height: 1920 }5Related Posts: Appium Android Driver getSize() method6Appium Android Driver getOrientation() method7Appium Android Driver getNetworkConnection() method8Appium Android Driver getDeviceTime() method9Appium Android Driver getGeoLocation() method10Appium Android Driver getClipboard() method11Appium Android Driver getLog() method12Appium Android Driver getLogTypes() method13Appium Android Driver getSettings() method14Appium Android Driver getSessions() method15Appium Android Driver getStrings() method16Appium Android Driver getSupportedPerformanceDataTypes() method17Appium Android Driver getPerformanceData() method
Using AI Code Generation
1var AppiumAndroidDriver = require('appium-android-driver');2var driver = new AppiumAndroidDriver();3driver.getSize().then(function(size) {4 console.log(size);5});6Appium Android Driver getAttribute()7Appium Android Driver getAttribute() Appium Android Driver getText()8Appium Android Driver getText() Appium Android Driver getTagName()9Appium Android Driver getTagName() Appium Android Driver getCssValue()10Appium Android Driver getCssValue() Appium Android Driver getRect()11Appium Android Driver getRect() Appium Android Driver getOrientation()12Appium Android Driver getOrientation() Appium Android Driver getGeoLocation()13Appium Android Driver getGeoLocation() Appium Android Driver getElementRect()14Appium Android Driver getElementRect() Appium Android Driver getComputedLabel()15Appium Android Driver getComputedLabel() Appium Android Driver getComputedRole()16Appium Android Driver getComputedRole() Appium Android Driver getComputedName()17Appium Android Driver getComputedName() Appium Android Driver getComputedText()18Appium Android Driver getComputedText() Appium Android Driver getComputedSize()19Appium Android Driver getComputedSize() Appium Android Driver getComputedLocation()20Appium Android Driver getComputedLocation() Appium Android Driver getComputedStyle()21Appium Android Driver getComputedStyle() Appium Android Driver getComputedAccessibleName()22Appium Android Driver getComputedAccessibleName() Appium Android Driver getComputedAccessibleDescription()23Appium Android Driver getComputedAccessibleDescription() Appium Android Driver getComputedAccessibleValue()24Appium Android Driver getComputedAccessibleValue() Appium Android Driver getComputedAccessibleState()25Appium Android Driver getComputedAccessibleState() Appium Android Driver getComputedAccessibleActions()26Appium Android Driver getComputedAccessibleActions() Appium Android Driver getComputedAccessibleActionDescription()27Appium Android Driver getComputedAccessibleActionDescription() Appium Android Driver getComputedAccessibleActionKeyBinding()28Appium Android Driver getComputedAccessibleActionKeyBinding() Appium Android Driver getComputedAccessibleActionLabel()29Appium Android Driver getComputedAccessibleActionLabel() Appium Android Driver getComputedAccessibleActionName()
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!