Some simple codes of lockscreens(AS3) - Bada Software Development
hello guy, I'll provide some codes in AS3.
All codes exist in one example.
-
see video to add class of lockscreen for BADA
http://www.youtube.com/watch?v=T8ij-pWW4Yk
-
download class bada http://www.mediafire.com/?9igrlbfu7pcrxwu
to effects use greensock(the best class to tween, change color,.........) https://www.greensock.com/
1° CLOCK
Code:
var fl_TimerInstance:Timer = new Timer(500);
fl_TimerInstance.addEventListener(TimerEvent.TIMER, fl_TimerHandler);
fl_TimerInstance.start();
function fl_TimerHandler(event:TimerEvent):void
{
var dat:Date = new Date();// call date variable
var hour = dat.hours;// call hours
var minute = dat.minutes;//call minutes
if (hour < 9)
{
hour = "0" + hour;
}
if (minute < 9)
{
minute = "0" + minute;
}
clockText.text = hour + ":" + minute;//to display the time in a text
}
download exemple: http://www.mediafire.com/download.php?70lmt6bs50232c5
2° move straight
Code:
import flash.geom.Rectangle;
import flash.events.MouseEvent;
mov.addEventListener(MouseEvent.MOUSE_DOWN, move);
var area:Rectangle = new Rectangle(35,240,200,0);//area (x,y,width,height)
function move(e:MouseEvent)
{
mov.startDrag(true,area);
stage.addEventListener(MouseEvent.MOUSE_UP, stopdrag);
}
function stopdrag(e:MouseEvent)
{
mov.stopDrag();
}
download exemple: http://www.mediafire.com/download.php?rqb6kikqy34raag
3°Clock with numbers PNG
Code:
var fl_TimerInstance:Timer = new Timer(1000);
fl_TimerInstance.addEventListener(TimerEvent.TIMER, fl_TimerHandler);
fl_TimerInstance.start();
function fl_TimerHandler(event:TimerEvent):void
{
var dt:Date = new Date();
var Nhour = dt.hours;
var Nminute = dt.minutes;
if (Number(Nhour) < 10)
{
Nhour = "0" + Number(Nhour);
}// end if
if (Number(Nminute) < 10)
{
Nminute = "0" + Number(Nminute);
}// end if
var _loc5 = String(Nhour).charAt(0);
var _loc4 = String(Nhour).charAt(1);
var _loc7 = String(Nminute).charAt(0);
var _loc6 = String(Nminute).charAt(1);
h1.gotoAndStop(Number(_loc5) + 1);
h2.gotoAndStop(Number(_loc4) + 1);
m1.gotoAndStop(Number(_loc7) + 1);
m2.gotoAndStop(Number(_loc6) + 1);
}
var dt:Date = new Date();
var Nhour = dt.hours;
var Nminute = dt.minutes;
if (Number(Nhour) < 10)
{
Nhour = "0" + Number(Nhour);
}// end if
if (Number(Nminute) < 10)
{
Nminute = "0" + Number(Nminute);
}// end if
var _loc5 = String(Nhour).charAt(0);
var _loc4 = String(Nhour).charAt(1);
var _loc7 = String(Nminute).charAt(0);
var _loc6 = String(Nminute).charAt(1);
h1.gotoAndStop(Number(_loc5) + 1);
h2.gotoAndStop(Number(_loc4) + 1);
m1.gotoAndStop(Number(_loc7) + 1);
m2.gotoAndStop(Number(_loc6) + 1);
download exemple: http://www.mediafire.com/download.php?gt7j8qfd6jx45p0
4° first unlock
Code:
import flash.events.MouseEvent;
import flash.events.Event;
import com.osp.flashextension.LockScreen;
import com.osp.flashextension.CallLogService;
var lockscreen:LockScreen;
mov.addEventListener(MouseEvent.MOUSE_DOWN, mover)
function mover(e:MouseEvent)
{
mov.startDrag()
stage.addEventListener(MouseEvent.MOUSE_UP, soltar)
stage.addEventListener(Event.ENTER_FRAME, test)
}
function soltar(e:MouseEvent)
{
mov.stopDrag()
stage.removeEventListener(MouseEvent.MOUSE_UP, soltar)
stage.removeEventListener(Event.ENTER_FRAME, test)
}
function test(E:Event)
{
if(mov.hitTestObject(test_unlock))
{
trace("unlock")
lockscreen = new LockScreen();
lockscreen.launchCallLogApp("previous");
stage.removeEventListener(Event.ENTER_FRAME, test)
}
if(mov.hitTestObject(test_sms))
{
trace("sms")
lockscreen = new LockScreen();
lockscreen.launchCallLogApp(CallLogService.CALL_LOG_TYPE_MESSAGING);
stage.removeEventListener(Event.ENTER_FRAME, test)
}
if(mov.hitTestObject(test_call))
{
trace("call")
lockscreen = new LockScreen();
lockscreen.launchCallLogApp(CallLogService.CALL_LOG_TYPE_MISSED_CALL);
stage.removeEventListener(Event.ENTER_FRAME, test)
}
}
download exemple: http://www.mediafire.com/download.php?vyhmwjlkcnuyy39
soon more........
5° load wallpaper(defaut by user)
Code:
import com.osp.flashextension.LockScreen;
import flash.net.URLRequest;
import flash.display.Loader;
import flash.events.Event;
import flash.events.ProgressEvent;
BackgroundImagePath();
function BackgroundImagePath():void
{
var ls:LockScreen;
ls = new LockScreen();
var path:String = ls.getBackgroundImagePath();
var mediaThumbnailLoader:Loader;
var thumbnailUrl:URLRequest = new URLRequest(path);
mediaThumbnailLoader = new Loader ;
mediaThumbnailLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,handleThumbnailLoadComplete);
mediaThumbnailLoader.load(thumbnailUrl);
function handleThumbnailLoadComplete(e:Event):void
{
imagem.addChild(mediaThumbnailLoader.content);
imagem.width = stage.stageWidth;
imagem.height = stage.stageHeight;
}
}
download exemple: http://www.mediafire.com/?sog0613n605g4w9
6°Rotate with accelerometer(class bada)
Code:
import flash.events.Event;
import com.greensock.*;
import com.greensock.easing.*;
import com.osp.flashextension.LockScreen;
import com.osp.flashextension.PlatformExtension;
txtRotate.visible = false;
var lockScreenB:LockScreen;
var platformExtensionB:PlatformExtension;
lockScreenB = new LockScreen();
platformExtensionB = new PlatformExtension();
setDeviceOrientationB();
function setDeviceOrientationB():void
{
stage.addEventListener(Event.ENTER_FRAME, Evento);
function Evento(e:Event):void
{
var DeviceOrientation:int = lockScreenB.getSystemValue(PlatformExtension.SYSTEM_VALUE_DEVICE_ORIENTATION) as int;
txtRotate.text = DeviceOrientation + "";
if (txtRotate.text == "0")
{
o.x = 1;
}
if (txtRotate.text == "90")
{
o.x = 2;
}
if (txtRotate.text == "270")
{
o.x = 3;
}
}
}
stage.addEventListener(Event.ENTER_FRAME, actBtN);
function actBtN(e:Event):void
{
if (o.x == 1)
{
stage.removeEventListener(Event.ENTER_FRAME, actBtN);
fl_TimerInstance_3.start();
///////////////start 0°/////////////
TweenLite.to(rot, .9, {rotation:0});
}
if (o.x == 2)
{
stage.removeEventListener(Event.ENTER_FRAME, actBtN);
fl_TimerInstance_3.start();
///////////////start 90°/////////////
TweenLite.to(rot, .9, {rotation:90});
}
if (o.x == 3)
{
stage.removeEventListener(Event.ENTER_FRAME, actBtN);
fl_TimerInstance_3.start();
///////////////start -90°/////////////
TweenLite.to(rot, .9, {rotation:-90});
}
}
var fl_TimerInstance_3:Timer = new Timer(1000,1);
fl_TimerInstance_3.addEventListener(TimerEvent.TIMER, fl_TimerHandler_3);
function fl_TimerHandler_3(event:TimerEvent):void
{
stage.addEventListener(Event.ENTER_FRAME, actBtN);
}
download exemple: http://www.mediafire.com/?265od827s6jhui5
soon more......
new to rotate with accelerometer(now script is better and fast)
Code:
import com.osp.flashextension.*;
import com.greensock.*;
var fl_TimerInstance:Timer = new Timer(400);
fl_TimerInstance.addEventListener(TimerEvent.TIMER, fl_TimerHandler);
fl_TimerInstance.start();
var unlock:LockScreen;
unlock = new LockScreen ;
var platformExtension:PlatformExtension;
platformExtension = new PlatformExtension();
var f180:Boolean = true;
var f270:Boolean = true;
var f90:Boolean = true;
var f0:Boolean = true;
function fl_TimerHandler(event:TimerEvent):void
{
var jl:String = PlatformExtension.SYSTEM_VALUE_DEVICE_ORIENTATION;
var deviceOrientation = platformExtension.getSystemValue(jl);
trace(deviceOrientation);
tee.text = deviceOrientation.toString();
if (deviceOrientation == 0)
{
if (f0)
{
TweenMax.to(mc, 0.5, {delay:.5,alpha:1,rotation:0});
TweenLite.to(mc, .5, {delay:0, alpha:0});
fl_TimerInstance.stop();
fl_TimerInstance_2.start();
}
f180 = true;
f270 = true;
f90 = true;
f0 = false;
}
if (deviceOrientation == 90)
{
if (f90)
{
fl_TimerInstance.stop();
fl_TimerInstance_2.start();
TweenMax.to(mc, 0.5, {delay:.5,alpha:1,rotation:90});
TweenLite.to(mc, .5, {delay:0, alpha:0});
}
f180 = true;
f270 = true;
f90 = false;
f0 = true;
}
if (deviceOrientation == 270)
{
if (f270)
{
fl_TimerInstance.stop();
fl_TimerInstance_2.start();
TweenMax.to(mc, 0.5, {delay:.5,alpha:1,rotation:-90});
TweenLite.to(mc, .5, {delay:0, alpha:0});
}
f180 = true;
f270 = false;
f90 = true;
f0 = true;
}
if (deviceOrientation == 180)
{
if (f180)
{
TweenMax.to(mc, 0.5, {delay:.5,alpha:1,rotation:180});
fl_TimerInstance.stop();
fl_TimerInstance_2.start();
TweenLite.to(mc, .5, {delay:0, alpha:0});
}
f180 = false;
f270 = true;
f90 = true;
f0 = true;
}
}
var fl_TimerInstance_2:Timer = new Timer(1200,1);
fl_TimerInstance_2.addEventListener(TimerEvent.TIMER, fl_TimerHandler_2);
function fl_TimerHandler_2(event:TimerEvent):void
{
fl_TimerInstance.start();
}
to POWER SERVICE and % of battery
Code:
package
{
import flash.display.MovieClip;
import com.osp.flashextension.*;
public class carregar extends MovieClip
{
private var unlock:LockScreen;
private var platformExtension:PlatformExtension;
public function carregar()
{
unlock = new LockScreen ;
platformExtension = new PlatformExtension();
var powerMmService:com.osp.flashextension.PowerManagementService;
powerMmService = new PowerManagementService();
if (powerMmService != null)
{
powerMmService.addEventListener(com.osp.flashextension.PowerSourceEvent.UPDATE, orderChanged_);
orderChanged();
}
// constructor code
}
function orderChanged_(arg1:PowerSourceEvent):void
{
orderChanged();
}
function orderChanged():void
{
var deviceOrientation:String;
deviceOrientation = unlock.getSystemValue(PlatformExtension.SYSTEM_VALUE_DEVICE_ORIENTATION);
trace(deviceOrientation);
tee.text = deviceOrientation;
var batt = unlock.getSystemValue(com.osp.flashextension.PlatformExtension.SYSTEM_VALUE_BATTERY_LEVEL);
//trace(powerMmService);
var checar = unlock.getSystemValue(com.osp.flashextension.PlatformExtension.SYSTEM_VALUE_POWER_SOURCE);
if (checar == 1)
{
bateria.text = "Charging, " + batt;
}
else
{
bateria.text = "";
}
}
}
}
SIMPLE MUSIC PLAYER(with command and artist)
Code:
package
{
import flash.display.MovieClip;
import com.osp.flashextension.*;
import flash.events.MouseEvent;
import flash.geom.Rectangle;
public class musica extends MovieClip
{
var unlock:LockScreen;
var platformExtension:PlatformExtension;
var mediaPlayer:com.osp.flashextension.MediaPlayerService;
public function musica()
{
unlock = new LockScreen ;
platformExtension = new PlatformExtension();
tras.addEventListener(MouseEvent.MOUSE_UP, ts);
frente.addEventListener(MouseEvent.MOUSE_UP,fr);
pause.addEventListener(MouseEvent.MOUSE_UP,pausar);
mediaPlayer = new MediaPlayerService ;
if (mediaPlayer != null)
{
mediaPlayer.addEventListener(MediaPlaybackEvent.UPDATE, mediaPlayerEvent_);
vai();
}
// constructor code
}
function mediaPlayerEvent_(arg1:MediaPlaybackEvent)
{
vai();
}
function vai():void
{
var mediaPlaybackInfo:MediaPlaybackInfo = mediaPlayer.getPlaybackInfo();
artista.text = mediaPlaybackInfo.title + mediaPlaybackInfo.artist;
return;
}
function ts(e:MouseEvent)
{
mediaPlayer.executePlaybackCommand(MediaPlayerService.MEDIA_PLAYER_CMD_PREVIOUS);
}
function fr(e:MouseEvent)
{
mediaPlayer.executePlaybackCommand(MediaPlayerService.MEDIA_PLAYER_CMD_NEXT);
}
function pausar(e:MouseEvent)
{
var mediaPlaybackInfo:MediaPlaybackInfo = mediaPlayer.getPlaybackInfo();
if (mediaPlaybackInfo.playStatus == "play")
{
mediaPlayer.executePlaybackCommand(MediaPlayerService.MEDIA_PLAYER_CMD_PAUSE);
}
else
{
mediaPlayer.executePlaybackCommand(MediaPlayerService.MEDIA_PLAYER_CMD_PLAY);
}
}
}
}
This is coded with Java ???
frank151995 said:
This is coded with Java ???
Click to expand...
Click to collapse
only with flash.
i use CS5.5 and is so good and easy.
how i create lockscreen here:
http://goo.gl/kG8t8l
finally can get weather in lockscreen \o/
soon release script
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Code:
var xml:XML;
var urlloader:URLLoader = new URLLoader();
[B]urlloader.load(new URLRequest("file:///User/Mass/HsWeather/XML/WeatherInfo.xml"));[/B] //load in XML in you wave
//urlloader.load(new URLRequest("WeatherInfo.xml"));
urlloader.addEventListener(Event.COMPLETE, urlloaderComplete);
function urlloaderComplete(e:Event)
{
xml = XML(e.currentTarget.data);
loader.load(new URLRequest(xml.child(2)));
var cidade = xml.children()[1].toXMLString();
var clima = xml.children()[2].toXMLString();
var cl:XML;
cl = XML(clima)
var getTemp = cl.children()[3].toXMLString();
var getIcon = cl.children()[7].toXMLString();
var icone = getIcon;
icone = icone.split("http://www.accuweather.com").join("");
icone = icone.split("</weathericon>").join("");
icone = icone.split("<weathericon xmlns=").join("");
icone = icone.split(">").join("");
icone = icone.split('""').join("");
if (icone == "20" || "30")
{
}
else
{
icone = icone.split("0").join("");
}
weatherMc.gotoAndStop(icone);
///////////////////////////////////////////////
var temperatura = getTemp;
temperatura = temperatura.split("http://www.accuweather.com").join("");
temperatura = temperatura.split("</temperature>").join("");
temperatura = temperatura.split("<temperature xmlns=").join("");
temperatura = temperatura.split(">").join("");
temperatura = temperatura.split('""').join("");
tempF.text = temperatura + " °F";
var cty:XML;
cty = XML(cidade);
var city = cty.children()[0].toXMLString();
trace(city);
var getCity = city;
getCity = getCity.split("http://www.accuweather.com").join("");
getCity = getCity.split("</city>").join("");
getCity = getCity.split("<city xmlns=").join("");
getCity = getCity.split(">").join("");
getCity = getCity.split('""').join("");
trace(getCity);
cityText.text = getCity;
///////////////////////////////////////////////
for (var i:int = 0; i < 1; i++)
{
var fahrenheit:int = temperatura;
function fahrenheit2celsius(fahrenheit):Number
{
var celsius:int = fahrenheit;
celsius = fahrenheit - 32;
celsius = celsius / 1.8;
celsius = celsius * 10 ^ 2;
celsius = celsius + .5;
celsius = celsius / 10;
return (celsius);
}
tempC.text = fahrenheit2celsius(fahrenheit) + " °C";
}
}
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaderComplete);
function loaderComplete(e:Event)
{
addChildAt(loader,0);
}
I know I did an ugly hack, but it works perfectly
WILL SHOW ERROR 2044 WHY in you PC DONT have this path: file:///User/Mass/HsWeather/XML/WeatherInfo.xml but in you wave sure work.
download this FLA: http://goo.gl/FxjRcG
DATE(DEFAULT) when change linguage of wave will change text. so text work in all wave of world.
Code:
var fl_TimerInstance:Timer = new Timer(3000);
fl_TimerInstance.addEventListener(TimerEvent.TIMER, fl_TimerHandler);
fl_TimerInstance.start();
var unlock:LockScreen;
unlock = new LockScreen ;
import com.osp.flashextension.*;
function fl_TimerHandler(event:TimerEvent):void
{
var Data = unlock.getLocalDateTime() as com.osp.flashextension.LocalDateTimeInfo;
var Day:* = Data.curDay;
var Month:* = Data.monthText;
var Week:* = Data.weekText;
var Hour:* = Data.curHour;
var Minute:* = Data.curMinute;
var AmPm:* = Data.ampmText;
var Year:* = Data.curYear;
clock.text = Hour + ":" + Minute;
date.text = Week + ", " + Day + " " + Month + " " + Year;
textAmPm.text = AmPm;
}
var Data = unlock.getLocalDateTime() as com.osp.flashextension.LocalDateTimeInfo;
var Day:* = Data.curDay;
var Month:* = Data.monthText;
var Week:* = Data.weekText;
var Hour:* = Data.curHour;
var Minute:* = Data.curMinute;
var AmPm:* = Data.ampmText;
var Year:* = Data.curYear;
clock.text = Hour + ":" + Minute;
date.text = Week + ", " + Day + " " + Month + " " + Year;
textAmPm.text = AmPm;
soon script to add keyboard in lockscreen(qwert)
see about keyboad
soon also script to multiple touches
wave support max 5 touch simultaneously(but little screen, not so userful)
this i put script for 2 finger and this "open" like a window.
my screenShot not is very good why when clickig cant take screenshot
see:
and about keyboard soon, now is very good, made some improvements.
Related
connect to excalibur using C# and COM ports
Have no idea if you guys will know but firstly does the Excalibur support AT commands? secondly, how would I connect using VC# 2008 Express code follows Code: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.IO.Ports; namespace phoneBackup { public partial class Form1 : Form { SerialPort sp = new SerialPort(); public Form1() { InitializeComponent(); programStatus.Text = "Connecting..."; } private void Form1_Load(object sender, EventArgs e) { sp.Open(); if (sp.IsOpen == true) { programStatus.Text = "Connection: " + sp.IsOpen.ToString(); //status sp.ReadTimeout = 500; sp.WriteTimeout = 500; getStatus(); } else { programStatus.Text = "Not connected, relaunch"; } } private void button1_Click(object sender, EventArgs e) { try { textBox1.Text = ""; sp.WriteLine("AT+CGMM"); sp.Write("AT+CGMM"); getStatus(); } catch (System.Exception ex) { textBox1.Text = ex.Message.ToString(); } } private void button2_Click(object sender, EventArgs e) { try { textBox1.Text = ""; textBox1.Text = "Reading..." + Environment.NewLine; textBox1.Text += "Status: " + Environment.NewLine; getStatus(); } catch (Exception ex) { textBox1.Text = "error " + ex.Message.ToString(); } } private void getStatus() { textBox1.Text += "BaseStream: " + sp.BaseStream.ToString() + Environment.NewLine; textBox1.Text += "BaudRate: " + sp.BaudRate.ToString() + Environment.NewLine; textBox1.Text += "Bytes to read: " + sp.BytesToRead.ToString() + Environment.NewLine; textBox1.Text += "Bytes to write: " + sp.BytesToWrite.ToString() + Environment.NewLine; textBox1.Text += "ReadTimeout: " + sp.ReadTimeout.ToString() + Environment.NewLine; textBox1.Text += "Port Name: " + sp.PortName.ToString() + Environment.NewLine; textBox1.Text += "Handshake: " + sp.Handshake.ToString() + Environment.NewLine; textBox1.Text += "Data bits: " + sp.DataBits.ToString() + Environment.NewLine; } private void sp_DataReceived(object sender, SerialDataReceivedEventArgs e) { textBox1.Text += Environment.NewLine + sp.ReadExisting().ToString(); } private void button3_Click(object sender, EventArgs e) { textBox1.Text = ""; getStatus(); } } } Output is BaseStream: System.IO.Ports.SerialStream BaudRate: 9600 Bytes to read: 0 Bytes to write: 0 ReadTimeout: 500 Port Name: COM1 Handshake: None Data bits: 8 no matter which button is pressed
[APP] Randomized! (Updated 09/12/2009)
Here is a very simple application use for randomizing 5 option. I often go with my girl friend. And we always confuse where will we go, so i make this program to choose where we will go. Maybe some of u have the same problem? u can use this rather than head and tail coins.. lol I Updated the program so it can handle up to 20 option.. do you think 20 option is to little??
me too dude nice 1
dnetzone said: me too dude nice 1 Click to expand... Click to collapse lol.. i thought only me having that problem..
should come in handy...
haha.. i just causally made it.. lol~~
after seeing ur cool app at 1800pocketpc i tried to write one of my own having unlimited options...in dotnet...it is working well on pc but when i try it on my ppc if the records count is more than 10 it returns the 2nd record n if the records r more than 10 it returns the 1st record...its randomizing works with miliseconds...hmmm just wanted to ask u to help me a lil bit... here is my code: Code: if (textBox1.Text != null) { string inpt = textBox1.Text; int i = 1; foreach (char mychr in textBox1.Text.ToCharArray()) { if (mychr == ',') { i++; } } if (i != 1) { string[] arrinpt = textBox1.Text.Split(','); string rnd = DateTime.Now.Millisecond.ToString(); if (rnd.Substring(0, 1) == "0") { rnd = (Int32.Parse(rnd) + 1).ToString(); } try { if (i < 10) { int firstintrnd = Int32.Parse(rnd.Substring(0, 1)); if (firstintrnd > i) { int chcker = i; int cnt = firstintrnd; while (i < cnt) { cnt /= i; } label1.Text = arrinpt[cnt]; } else { label1.Text = arrinpt[firstintrnd]; } } else if (i > 9 && i < 100) { int secondintrnd = Int32.Parse(rnd.Substring(0, 2)); if (secondintrnd > i) { int cnt = secondintrnd; while (i < cnt) { cnt /= i; } label1.Text = arrinpt[cnt]; } else { label1.Text = arrinpt[secondintrnd]; } } } catch (Exception) { label1.Text = arrinpt[0]; } } else { label1.Text = textBox1.Text; } } else { MessageBox.Show("Enter your items.", "Error!"); }
Just download my new version.. lol
i wrote one with random class in dotnet but just wanted to know why this one isnt working well thx for ur idea n ur app anyway...
Help Decrypting assets
Hi, I really need help, i want to extract some .png and .jpg from the assets of the app 'Hyperdimension Neptunia The App' after 3 month of research i found out that the assets are probably "encrypted" i wanted the textures for the live2D model files, and wanted to replace the sounds with the English versions from the iOS app that i extracted. Audio was .caf in iOS but in Android it says its .mp3 This Line in a class says something about the audio: localEditor.putString("alarm_voice", bw.a(str, "caf", "mp3")); The .caf opens and runs fine so whats the problem and anyone help me decrypt it? :fingers-crossed: Full "AlarmActivity.class" Code: package jp.co.ideaf.neptune.nepkamijigenapp; import android.app.Activity; import android.app.AlarmManager; import android.app.AlertDialog; import android.app.AlertDialog.Builder; import android.app.Dialog; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.content.res.Resources; import android.os.Build.VERSION; import android.os.Bundle; import android.os.Handler; import android.view.Display; import android.view.View; import android.view.WindowManager; import android.widget.Button; import android.widget.CheckBox; import android.widget.FrameLayout; import android.widget.FrameLayout.LayoutParams; import android.widget.LinearLayout; import android.widget.LinearLayout.LayoutParams; import android.widget.NumberPicker; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.TextView; import android.widget.TimePicker; import java.util.Calendar; import java.util.Timer; import jp.co.ideaf.neptune.nepkamijigenapp.a.a; import jp.co.ideaf.neptune.nepkamijigenapp.a.d; import jp.co.ideaf.neptune.nepkamijigenapp.a.f; import jp.co.ideaf.neptune.nepkamijigenapp.a.h; import jp.co.ideaf.neptune.nepkamijigenapp.d.z; public class AlarmActivity extends Activity { private a a = null; private d b = null; private Timer c = null; private ee d = null; private eg e = null; private Handler f = new Handler(); private LinearLayout g = null; private static int a(Context paramContext, a parama, long paramLong) { h localh = KamijigenApplication.c(); z localz = localh.b(parama.c().f()); int i = localh.a(); String str = localz.g(); Object[] arrayOfObject = new Object[1]; arrayOfObject[0] = Long.valueOf(paramLong / 1000L); jp.co.ideaf.neptune.nepkamijigenapp.d.k.a(String.format("アラーム発生時間 : %d秒", arrayOfObject), new Object[0]); f localf = new f(paramLong + Calendar.getInstance().getTimeInMillis()); SharedPreferences.Editor localEditor = paramContext.getSharedPreferences(bw.a(paramContext, 2131034117), 0).edit(); localEditor.putString("alarm_voice", bw.a(str, "caf", "mp3")); localEditor.putBoolean("snooze", parama.b); localEditor.putInt("snooze_time", parama.c); localEditor.commit(); Intent localIntent = new Intent(paramContext, AlarmDialogActivity.class); localIntent.addFlags(268435456); PendingIntent localPendingIntent = PendingIntent.getActivity(paramContext, 0, localIntent, 0); ((AlarmManager)paramContext.getSystemService("alarm")).set(0, localf.b(), localPendingIntent); return i; } private void a() { TimePicker localTimePicker = (TimePicker)findViewById(2131165202); if (localTimePicker == null); while (true) { return; localTimePicker.setIs24HourView(Boolean.valueOf(true)); localTimePicker.setCurrentHour(Integer.valueOf(this.a.c().f())); localTimePicker.setCurrentMinute(Integer.valueOf(this.a.c().g())); } } private void a(int paramInt) { TextView localTextView = (TextView)findViewById(2131165196); if (localTextView != null) { localTextView.setText(Integer.toString(paramInt)); localTextView.append(bw.a(this, 2131034215)); } } private void a(int paramInt1, int paramInt2) { TextView localTextView1 = (TextView)findViewById(2131165194); if (localTextView1 != null) { localTextView1.setText(Integer.toString(paramInt1)); localTextView1.append(bw.a(this, 2131034211)); } TextView localTextView2 = (TextView)findViewById(2131165195); if (localTextView2 != null) { localTextView2.setText(Integer.toString(paramInt2)); localTextView2.append(bw.a(this, 2131034212)); } } public static void a(Context paramContext, a parama) { d locald = KamijigenApplication.a(); locald.b(paramContext, false); c(paramContext, parama); parama.a = true; locald.p().a(parama); locald.c(paramContext); } private void b() { CheckBox localCheckBox = (CheckBox)findViewById(2131165197); if (localCheckBox != null) { if (KamijigenApplication.a().p().a) break label38; localCheckBox.setEnabled(false); localCheckBox.setChecked(false); } while (true) { return; label38: localCheckBox.setChecked(true); } } private static void c(Context paramContext, a parama) { f localf1 = new f(Calendar.getInstance().getTimeInMillis()); int i = localf1.f(); int j = localf1.g(); int k; int m; int n; f localf2; long l; if ((i < parama.c().f()) || ((i == parama.c().f()) && (j < parama.c().g()))) { k = localf1.c(); m = localf1.d(); n = localf1.e(); localf2 = new f(k, m, n, parama.c().f(), parama.c().g(), 0); jp.co.ideaf.neptune.nepkamijigenapp.d.k.a("targetDate : " + localf2.toString(), new Object[0]); jp.co.ideaf.neptune.nepkamijigenapp.d.k.a("nowDate : " + localf1.toString(), new Object[0]); l = localf2.b() - localf1.b(); if (parama.c <= 0) break label300; } label300: for (parama.b = true; ; parama.b = false) { int i1 = a(paramContext, parama, l); parama.c().a(k); parama.c().b(m); parama.c().c(n); parama.d = i1; return; f localf3 = new f(86400000L + localf1.b()); k = localf3.c(); m = localf3.d(); n = localf3.e(); localf2 = new f(k, m, n, parama.c().f(), parama.c().g(), 0); break; } } public void onClickBackButton(View paramView) { finish(); } public void onClickDecideButton(View paramView) { CheckBox localCheckBox = (CheckBox)findViewById(2131165197); if (((RadioButton)findViewById(2131165199)).isChecked()) { findViewById(2131165201).setVisibility(8); findViewById(2131165203).setVisibility(0); findViewById(2131165201).setVisibility(0); findViewById(2131165203).setVisibility(8); if (localCheckBox != null) break label127; } while (true) { return; findViewById(2131165201).setVisibility(0); findViewById(2131165203).setVisibility(8); findViewById(2131165201).setVisibility(8); findViewById(2131165203).setVisibility(0); break; label127: d locald = KamijigenApplication.a(); if (!locald.p().a) showDialog(0); else if ((locald.p().a) && (localCheckBox.isChecked())) showDialog(2); else showDialog(3); } } public void onCreate(Bundle paramBundle) { super.onCreate(paramBundle); setRequestedOrientation(1); setContentView(2130903041); d locald = KamijigenApplication.a(); this.a = new a(); this.a.a(locald.p()); a(this.a.c().f(), this.a.c().g()); a(); b(); TimePicker localTimePicker = (TimePicker)findViewById(2131165202); if (localTimePicker != null) { localTimePicker.setVisibility(0); localTimePicker.setOnTimeChangedListener(new j(this)); } userNumberPicker localuserNumberPicker = (userNumberPicker)findViewById(2131165204); a(this.a.c); if ((Build.VERSION.SDK_INT < 11) && (localuserNumberPicker != null)) { localuserNumberPicker.a(0, 59); localuserNumberPicker.a(this.a.c); localuserNumberPicker.a(new l(this)); } if (Build.VERSION.SDK_INT >= 11) { FrameLayout localFrameLayout = (FrameLayout)findViewById(2131165203); localuserNumberPicker.setEnabled(false); localuserNumberPicker.setVisibility(8); this.g = new LinearLayout(this); this.g.setOrientation(0); NumberPicker localNumberPicker = new NumberPicker(this); localNumberPicker.setMinValue(0); localNumberPicker.setMaxValue(59); localNumberPicker.setValue(this.a.c); localNumberPicker.setOnValueChangedListener(new m(this)); this.g.addView(localNumberPicker, 0, new LinearLayout.LayoutParams(-2, -2, 1.0F)); localFrameLayout.addView(this.g, new FrameLayout.LayoutParams(-2, -2, 17)); } findViewById(2131165201).setVisibility(0); findViewById(2131165203).setVisibility(8); ((RadioGroup)findViewById(2131165198)).setOnCheckedChangeListener(new n(this)); this.b = KamijigenApplication.a(); String str = getResources().getText(2131034115).toString(); LinearLayout localLinearLayout = (LinearLayout)findViewById(2131165191); Button localButton = (Button)findViewById(2131165205); if (str.equals(this.b.d(this.b.k()))) { localLinearLayout.setBackgroundResource(2130837540); localButton.setBackgroundResource(2130837513); } while (true) { if (locald.p().a) showDialog(4); return; localLinearLayout.setBackgroundResource(2130837541); localButton.setBackgroundResource(2130837514); } } protected Dialog onCreateDialog(int paramInt) { AlertDialog localAlertDialog; if (paramInt == 0) localAlertDialog = new AlertDialog.Builder(this).setTitle(2131034216).setMessage(2131034217).setPositiveButton(2131034218, new q(this)).setNegativeButton(2131034219, null).create(); while (true) { return localAlertDialog; if (paramInt == 1) { localAlertDialog = new AlertDialog.Builder(this).setMessage(2131034220).setPositiveButton(2131034221, new r(this)).create(); } else if (paramInt == 2) { localAlertDialog = new AlertDialog.Builder(this).setTitle(2131034222).setMessage(2131034223).setPositiveButton(2131034224, new s(this)).setNegativeButton(2131034225, null).create(); } else if (paramInt == 3) { localAlertDialog = new AlertDialog.Builder(this).setTitle(2131034226).setMessage(2131034227).setPositiveButton(2131034228, new t(this)).setNegativeButton(2131034229, null).create(); } else { localAlertDialog = null; if (paramInt == 4) localAlertDialog = new AlertDialog.Builder(this).setMessage(2131034304).setPositiveButton(2131034228, new k(this)).setNegativeButton(2131034229, null).create(); } } } protected void onPause() { super.onPause(); if (this.d != null) this.d.b(); this.c.cancel(); this.c.purge(); } protected void onResume() { super.onResume(); this.d = new ee(this); this.d.a(); this.c = new Timer(true); this.c.scheduleAtFixedRate(new o(this), 100L, 100L); Display localDisplay = ((WindowManager)getSystemService("window")).getDefaultDisplay(); if (localDisplay.getWidth() > localDisplay.getHeight()); for (int i = localDisplay.getHeight(); ; i = localDisplay.getWidth()) { float f1 = i / 480.0F; LinearLayout localLinearLayout = (LinearLayout)findViewById(2131165193); getResources().getDrawable(2130837742); localLinearLayout.getLayoutParams().height = ((int)(90.0F * f1)); localLinearLayout.getLayoutParams().width = ((int)(f1 * 172.0F)); localLinearLayout.requestLayout(); this.e = new eg(this, 0); return; } } }
well if it is encrypted, what type ? and if it\s something like AES CBC how do you intend to get the cypher ?
That's the problem, im kinda new to this thing so im not sure how to get the cypher and i think its AES encrypted but not 100% certain. Sorry for being a noob.
Json html table parsing
Hi guys. I've been working today on an app that will show all my blogposts which are created by Wordpress. Now, people are using both lists and tables when they are creating new blogposts which TextView and android HTML parser don't really like. I found a workaround on the html lists (ul, ol, li) tags by kiutsi from stackoverflow (cant post outside urls) Now im trying to make the same code from the li, ul workaround and also implement td,tr which works out great! But there's one small problem. I have a json string that spits out (from logcat): Code: "content":"<table width=\"495\">\n<tbody>\n<tr>\n<td width=\"115\">GT-B2710<\/td>\n<td width=\"314\">Xcover 271<\/td>\n<td width=\"65\">15.2Q<\/td>\n<\/tr>\n This code is printing out three columns with text, in my app there's no spaces between these three columns and I can't for my life figure this one out.. Code: package com.X.X; import org.xml.sax.XMLReader; import android.text.Editable; import android.text.Html.TagHandler; public class TagHandler2 implements TagHandler { boolean first = true; String parent = null; int index = 1; public void handleTag(final boolean opening, final String tag, final Editable output, final XMLReader xmlReader) { if (tag.equals("ul")) { parent = "ul"; index = 1; } else if (tag.equals("ol")) { parent = "ol"; index = 1; } else if (tag.equals("tr")) { parent = "tr"; index = 1; } else if (tag.equals("td")) { parent = "tr"; index = 1; } if (tag.equals("li")) { char lastChar = 0; if (output.length() > 0) { lastChar = output.charAt(output.length() - 1); } if (parent.equals("ul")) { if (first) { if (lastChar == '\n') { output.append("\t• "); } else { output.append("\n\t• "); } first = false; } else { first = true; } } else { if (first) { if (lastChar == '\n') { output.append("\t" + index + ". "); } else { output.append("\n\t" + index + ". "); } first = false; index++; } else { first = true; } } } if (tag.equals("tr")) { char lastChar = 0; if (output.length() > 0) { lastChar = output.charAt(output.length() - 1); } if (parent.equals("tr")) { if (first) { if (lastChar == '\n') { output.append("\t• "); } else { output.append("\n\t• "); } first = false; } else { first = true; } } else { if (first) { if (lastChar == '\n') { output.append("\t" + index); } else { output.append("\n\t" + index); } first = false; index++; } else { first = true; } } } } } Code: If i try to swap out tr to td in this code, then there wont be any columns just new rows "\n" if (tag.equals("tr")) { char lastChar = 0; if (output.length() > 0) { lastChar = output.charAt(output.length() - 1); } I'm terribly sorry for this huge mess of a post that I have done but right now my mind is basically mush.
Well i find this way of working with the xmlreader looks quite complicated, if you dont mind about switching tools, try out Jsoup xml parser, there you can select a single table/list/etc object and just get all the element's children (which, in a table, are tr objects whose children are then td). It is far easier than doing it by hand --------------------------------- Phone : Nexus 4 OS : - KitKat 4.4.4 stock - Xposed: 58(app_process); 54(bridge) - SU: SuperSU - no custom recovery --------------------------------- 4d 61 73 72 65 70 75 73 20 66 74 77 Gesendet von Tapatalk
[Q] Button moves out of the screen? :(
Hello I'm trying to make a button, that change it's position on click. that far, that good. Everything works, but the button sometimes moves out of the screen. I thougt with the code below the height and length of the screen was set? Code: @Override public void onClick(View v) { Button b = (Button) findViewById(R.id.start_time); Random r = new Random(); View decorView = getWindow().getDecorView(); int screenWidth = decorView.getWidth(); int screenHeight = decorView.getHeight(); long startTime = SystemClock.elapsedRealtime(); i++; /* Random r = new Random(); int x = r.nextInt(R.id.wrap_content); int y = r.nextInt(R.id.wrap_content); b.setX(x); b.setY(y); */ if (i == 1 ) { start_time.setX(r.nextInt(screenWidth - start_time.getWidth())); start_time.setY(r.nextInt(screenHeight - start_time.getHeight())); } if (i == 2 ) { start_time.setX(r.nextInt(screenWidth - start_time.getWidth())); start_time.setY(r.nextInt(screenHeight - start_time.getHeight())); } if (i == 3 ) { start_time.setX(r.nextInt(screenWidth - start_time.getWidth())); start_time.setY(r.nextInt(screenHeight - start_time.getHeight())); } if (i == 4 ) { start_time.setX(r.nextInt(screenWidth - start_time.getWidth())); start_time.setY(r.nextInt(screenHeight - start_time.getHeight())); } if (i == 5 ) { start_time.setX(r.nextInt(screenWidth - start_time.getWidth())); start_time.setY(r.nextInt(screenHeight - start_time.getHeight())); } if (i == 6 ) { start_time.setX(r.nextInt(screenWidth - start_time.getWidth())); start_time.setY(r.nextInt(screenHeight - start_time.getHeight())); } else if (i == 7) { long difference = SystemClock.elapsedRealtime() - startTime; Intent intent = new Intent(Game.this, MainScreen.class); intent.putExtra("time",difference); // Toast.makeText(getApplicationContext(), getIntent().getStringExtra("time"), Toast.LENGTH_LONG).show(); textview1.setText(getIntent().getStringExtra("time")); finish(); } }