From e3cf91132f5d34dc2412bd09c3b1bf69a3cc058b Mon Sep 17 00:00:00 2001 From: Victor Date: Wed, 14 Nov 2018 15:57:31 +0200 Subject: [PATCH] 7.0 --- nbproject/build-impl.xml | 269 ++--- nbproject/genfiles.properties | 6 +- nbproject/private/private.properties | 13 +- nbproject/private/private.xml | 1 + nbproject/project.properties | 34 +- src/1.swf | Bin 3922 -> 0 bytes src/Canv.java | 1039 ------------------- src/Capuchin.java | 34 - src/Engine1.java | 195 ---- src/FindLyrics.java | 142 --- src/FindText.java | 41 - src/Info.java | 68 -- src/Lang.java | 85 -- src/Options.java | 102 -- src/Rate.java | 14 - src/RateImpl.java | 149 --- src/SEPS.java | 50 - src/Skin.java | 53 - src/accel/AccelData.java | 126 +++ src/accel/NoData.java | 24 + src/accel/SensorData.java | 22 + src/com/annimon/GraphicsUtil.java | 201 ++++ src/{ => com/annimon}/StringEncoder.java | 21 +- src/com/annimon/Util.java | 63 ++ src/fx/AnimatedImage.java | 51 + src/fx/BlindsFx.java | 36 + src/fx/ImageFx.java | 119 +++ src/fx/PuzzleFx.java | 71 ++ src/fx/Slide2Fx.java | 43 + src/fx/SlideFx.java | 67 ++ src/fx/WaveFx.java | 60 ++ src/fx/WipeFx.java | 46 + src/icon.png | Bin 857 -> 0 bytes src/lastfm/HTTPUtil.java | 264 +++++ src/lastfm/LastFMScrobbler.java | 345 ++++++ src/{mobscrob/scrobbler => lastfm}/MD5.java | 170 +-- src/mobscrob/scrobbler/AudioScrobbler.java | 276 ----- src/mobscrob/scrobbler/ByteUtil.java | 79 -- src/mobscrob/scrobbler/HTTPUtil.java | 192 ---- src/msapi/J2MEPlayer.java | 57 + src/msapi/MSPlayer.java | 156 +++ src/msapi/SPlayer.java | 37 + src/msapi/Track.java | 79 ++ src/newfile | 2 - src/res/1.swf | Bin 0 -> 4930 bytes src/{ => res}/2.swf | Bin src/{ => res}/3.swf | Bin src/{ => res}/4.swf | Bin src/res/5.swf | Bin 0 -> 6974 bytes src/res/6.swf | Bin 0 -> 8410 bytes src/{ => res}/about | 19 +- src/res/album.png | Bin 751 -> 0 bytes src/res/album.xid | Bin 0 -> 753 bytes src/res/artist.png | Bin 587 -> 0 bytes src/res/artist.xid | Bin 0 -> 589 bytes src/res/exit.png | Bin 548 -> 0 bytes src/res/exit.xid | 3 + src/res/icon.png | Bin 0 -> 1087 bytes src/res/pal.png | Bin 1152 -> 0 bytes src/res/pal.xid | Bin 0 -> 1154 bytes src/res/pound.png | Bin 930 -> 0 bytes src/res/pound.xid | Bin 0 -> 932 bytes src/res/sb.png | Bin 100 -> 0 bytes src/res/sb.xid | Bin 0 -> 102 bytes src/res/sbl.png | Bin 231 -> 0 bytes src/res/sbl.xid | Bin 0 -> 233 bytes src/res/slp.xid | Bin 0 -> 977 bytes src/res/star.png | Bin 185 -> 0 bytes src/res/star.xid | Bin 0 -> 187 bytes src/res/t.png | Bin 132 -> 0 bytes src/res/t.xid | Bin 0 -> 134 bytes src/res/tl.png | Bin 252 -> 0 bytes src/res/tl.xid | Bin 0 -> 254 bytes src/res/track.png | Bin 803 -> 0 bytes src/res/track.xid | Bin 0 -> 805 bytes src/res/zero.png | Bin 504 -> 0 bytes src/res/zero.xid | Bin 0 -> 506 bytes src/seps/Canv.java | 692 ++++++++++++ src/{ => seps}/Effects.java | 22 +- src/{ => seps}/FWCashe.java | 2 + src/seps/FirstStartForm.java | 49 + src/{ => seps}/Images.java | 44 +- src/seps/Info.java | 208 ++++ src/seps/Lang.java | 82 ++ src/{ => seps}/Lyrics.java | 71 +- src/seps/Main.java | 51 + src/seps/OptionsForm.java | 102 ++ src/{ => seps}/Rms.java | 145 ++- src/{ => seps}/SetSleepMode.java | 28 +- src/seps/Skin.java | 60 ++ src/seps/TestScrobbler.java | 52 + src/visual/Capuchin.java | 30 + src/visual/Plasma.java | 86 ++ src/visual/Stars.java | 196 ++++ src/visual/Visual.java | 70 ++ src/{Engine2.java => visual/VisualME.java} | 169 ++- 96 files changed, 3905 insertions(+), 3178 deletions(-) delete mode 100644 src/1.swf delete mode 100644 src/Canv.java delete mode 100644 src/Capuchin.java delete mode 100644 src/Engine1.java delete mode 100644 src/FindLyrics.java delete mode 100644 src/FindText.java delete mode 100644 src/Info.java delete mode 100644 src/Lang.java delete mode 100644 src/Options.java delete mode 100644 src/Rate.java delete mode 100644 src/RateImpl.java delete mode 100644 src/SEPS.java delete mode 100644 src/Skin.java create mode 100644 src/accel/AccelData.java create mode 100644 src/accel/NoData.java create mode 100644 src/accel/SensorData.java create mode 100644 src/com/annimon/GraphicsUtil.java rename src/{ => com/annimon}/StringEncoder.java (75%) create mode 100644 src/com/annimon/Util.java create mode 100644 src/fx/AnimatedImage.java create mode 100644 src/fx/BlindsFx.java create mode 100644 src/fx/ImageFx.java create mode 100644 src/fx/PuzzleFx.java create mode 100644 src/fx/Slide2Fx.java create mode 100644 src/fx/SlideFx.java create mode 100644 src/fx/WaveFx.java create mode 100644 src/fx/WipeFx.java delete mode 100644 src/icon.png create mode 100644 src/lastfm/HTTPUtil.java create mode 100644 src/lastfm/LastFMScrobbler.java rename src/{mobscrob/scrobbler => lastfm}/MD5.java (76%) delete mode 100644 src/mobscrob/scrobbler/AudioScrobbler.java delete mode 100644 src/mobscrob/scrobbler/ByteUtil.java delete mode 100644 src/mobscrob/scrobbler/HTTPUtil.java create mode 100644 src/msapi/J2MEPlayer.java create mode 100644 src/msapi/MSPlayer.java create mode 100644 src/msapi/SPlayer.java create mode 100644 src/msapi/Track.java delete mode 100644 src/newfile create mode 100644 src/res/1.swf rename src/{ => res}/2.swf (100%) rename src/{ => res}/3.swf (100%) rename src/{ => res}/4.swf (100%) create mode 100644 src/res/5.swf create mode 100644 src/res/6.swf rename src/{ => res}/about (85%) delete mode 100644 src/res/album.png create mode 100644 src/res/album.xid delete mode 100644 src/res/artist.png create mode 100644 src/res/artist.xid delete mode 100644 src/res/exit.png create mode 100644 src/res/exit.xid create mode 100644 src/res/icon.png delete mode 100644 src/res/pal.png create mode 100644 src/res/pal.xid delete mode 100644 src/res/pound.png create mode 100644 src/res/pound.xid delete mode 100644 src/res/sb.png create mode 100644 src/res/sb.xid delete mode 100644 src/res/sbl.png create mode 100644 src/res/sbl.xid create mode 100644 src/res/slp.xid delete mode 100644 src/res/star.png create mode 100644 src/res/star.xid delete mode 100644 src/res/t.png create mode 100644 src/res/t.xid delete mode 100644 src/res/tl.png create mode 100644 src/res/tl.xid delete mode 100644 src/res/track.png create mode 100644 src/res/track.xid delete mode 100644 src/res/zero.png create mode 100644 src/res/zero.xid create mode 100644 src/seps/Canv.java rename src/{ => seps}/Effects.java (92%) rename src/{ => seps}/FWCashe.java (98%) create mode 100644 src/seps/FirstStartForm.java rename src/{ => seps}/Images.java (65%) create mode 100644 src/seps/Info.java create mode 100644 src/seps/Lang.java rename src/{ => seps}/Lyrics.java (60%) create mode 100644 src/seps/Main.java create mode 100644 src/seps/OptionsForm.java rename src/{ => seps}/Rms.java (52%) rename src/{ => seps}/SetSleepMode.java (65%) create mode 100644 src/seps/Skin.java create mode 100644 src/seps/TestScrobbler.java create mode 100644 src/visual/Capuchin.java create mode 100644 src/visual/Plasma.java create mode 100644 src/visual/Stars.java create mode 100644 src/visual/Visual.java rename src/{Engine2.java => visual/VisualME.java} (57%) diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml index ef3127b..d69ab84 100644 --- a/nbproject/build-impl.xml +++ b/nbproject/build-impl.xml @@ -96,6 +96,15 @@ + + + + + + + + + @@ -164,47 +173,13 @@ - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -285,6 +260,13 @@ + + + + + + + @@ -312,22 +294,10 @@ - - - - - - - - - - - - - + @@ -559,9 +529,10 @@ - + + - + @@ -640,14 +611,6 @@ - - - - - - - - @@ -660,78 +623,8 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -766,7 +659,7 @@ - + @@ -888,19 +781,6 @@ - - - - - - - - - - - - - @@ -951,6 +831,15 @@ + + + + + + + + + @@ -962,17 +851,14 @@ - - - - - - - - + + + + + @@ -1001,8 +887,8 @@ - - + + @@ -1013,28 +899,6 @@ - - - - - - - - - - - - - - - - - - - - - - @@ -1085,6 +949,21 @@ + + + + + + + + + + + + + + + @@ -1099,8 +978,10 @@ - - + + + + @@ -1123,19 +1004,15 @@ - - - - - + - + @@ -1152,6 +1029,11 @@ + + + + + Starting emulator with port number ${active.debug.port} @@ -1216,12 +1098,6 @@ - - - - - - @@ -1245,6 +1121,9 @@ + + + @@ -1297,7 +1176,7 @@ - + diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties index 48224f5..ca0c69f 100644 --- a/nbproject/genfiles.properties +++ b/nbproject/genfiles.properties @@ -2,7 +2,7 @@ # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. build.xml.data.CRC32=d5ed72e0 build.xml.script.CRC32=4c4ce240 -build.xml.stylesheet.CRC32=03eab09b +build.xml.stylesheet.CRC32=9c6a911d nbproject/build-impl.xml.data.CRC32=d5ed72e0 -nbproject/build-impl.xml.script.CRC32=c6fa47a7 -nbproject/build-impl.xml.stylesheet.CRC32=a4fc63f1 +nbproject/build-impl.xml.script.CRC32=cdca5f14 +nbproject/build-impl.xml.stylesheet.CRC32=e46c2d22 diff --git a/nbproject/private/private.properties b/nbproject/private/private.properties index 286945a..125cffe 100644 --- a/nbproject/private/private.properties +++ b/nbproject/private/private.properties @@ -1,7 +1,8 @@ -#Wed May 05 19:16:46 EEST 2010 -netbeans.user=C:\\Users\\aNNiMON\\.netbeans\\6.9m1 -javadoc.preview=true -config.active= -deployment.counter=160 +#Mon, 25 Apr 2011 16:20:49 +0300 app-version.autoincrement=true -deployment.number=0.1.59 +config.active= +deployment.counter=37 +deployment.number=0.0.36 +file.reference.MultimediaServices_API.jar=E\:\\MOBILE\\Programming\\Java\\Libraries_n_API\\API\\MultimediaServices_API.jar +javadoc.preview=true +netbeans.user=C:\\Users\\aNNiMON\\.netbeans\\7.1 diff --git a/nbproject/private/private.xml b/nbproject/private/private.xml index c1f155a..8505fc1 100644 --- a/nbproject/private/private.xml +++ b/nbproject/private/private.xml @@ -1,4 +1,5 @@ + diff --git a/nbproject/project.properties b/nbproject/project.properties index 3cdfc48..33f7035 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -1,5 +1,5 @@ abilities=MMAPI=1.1,SATSAJCRMI=1.0,SATSACRYPTO=1.0,JSR82=1.1,NOKIAUI=1.0,JSR226=1.0,MIDP=2.1,JSR229=1.1.0,SATSAAPDU=1.0,CLDC=1.1,JSR177=1.0,JSR179=1.0.1,J2MEWS=1.0,VSCL=2.1,WMA=2.0,JSR172=1.0,SEMC_EXT_JP8=1.0,ColorScreen,OBEX=1.0,NokiaUI=1.0,JSR238=1.0,JSR239=1.0,JSR211=1.0,JSR234=1.0,ScreenWidth=240,lib/semc_ext_jp8.jar=1.0,MascotV3=1.0,JSR75=1.0,JSR184=1.1,SATSAPKI=1.0,ScreenHeight=321,ScreenColorDepth=8,JSR180=1.0.1,J2MEXMLRPC=1.0, -all.configurations=\ +all.configurations=\ ,EmulatorTest application.args= application.description= application.description.detail= @@ -9,21 +9,30 @@ build.classes.dir=${build.dir}/compiled build.classes.excludes=**/*.java,**/*.form,**/*.class,**/.nbintdb,**/*.mvd,**/*.wsclient,**/*.vmd build.dir=build/${config.active} build.root.dir=build +configs.EmulatorTest.extra.classpath= +configs.EmulatorTest.filter.exclude.tests=false +configs.EmulatorTest.filter.excludes=newfile +configs.EmulatorTest.filter.more.excludes=**/overview.html,**/package.html +configs.EmulatorTest.filter.use.standard=true +configs.EmulatorTest.libs.classpath=${file.reference.MultimediaServices_API.jar} +configs.EmulatorTest.manifest.midlets=MIDlet-2: TestScrobbler,/res/icon.png,seps.TestScrobbler\nMIDlet-1: SEPlayerService, /res/icon.png,seps.Main\n +configs.EmulatorTest.obfuscation.custom= +configs.EmulatorTest.obfuscation.level=0 debug.level=debug +debugger.timeout= deployment.copy.target=deploy deployment.instance=default deployment.jarurl=${dist.jar} deployment.method=NONE deployment.override.jarurl=false dist.dir=dist/${config.active} -dist.jad=SEPlayerService.jad -dist.jar=SEPlayerService.jar +dist.jad=SEPlayerService_v7.0.jad +dist.jar=SEPlayerService_v7.0.jar dist.javadoc.dir=${dist.dir}/doc dist.root.dir=dist extra.classpath=${file.reference.MultimediaServices_API.jar} -file.reference.MultimediaServices_API.jar=../../NetBeans Libraries/MultimediaServices_API.jar filter.exclude.tests=false -filter.excludes=newfile +filter.excludes=seps/TestScrobbler.java filter.more.excludes=**/overview.html,**/package.html filter.use.standard=true jar.compress=true @@ -48,10 +57,11 @@ main.class= main.class.class=applet manifest.apipermissions= manifest.file=manifest.mf +manifest.is.liblet=false manifest.jad= manifest.manifest= -manifest.midlets=MIDlet-1: SEPS,/icon.png,SEPS\n -manifest.others=MIDlet-Vendor: aNNiMON\nMIDlet-Name: SEPlayerService\nMIDlet-Version: 5.3\n +manifest.midlets=MIDlet-1: SEPlayerService, /res/icon.png,seps.Main\n +manifest.others=MIDlet-Vendor: aNNiMON\nMIDlet-Name: SEPlayerService\nMIDlet-Version: 7.0\n manifest.pushregistry= name=SEPlayerService no.dependencies=false @@ -62,13 +72,13 @@ nsicom.application.runverbose= nsicom.remoteapp.location=\\My Documents\\NetBeans Applications nsicom.remotevm.location=\\Windows\\creme\\bin\\CrEme.exe obfuscated.classes.dir=${build.dir}/obfuscated -obfuscation.custom= -obfuscation.level=9 +obfuscation.custom=@E:\\SETUPS\\Disk\\Programming\\Java\\annimon.pro +obfuscation.level=1 obfuscator.destjar=${build.dir}/obfuscated.jar obfuscator.srcjar=${build.dir}/before-obfuscation.jar -platform.active=Sony_Ericsson_SDK_2_5_0_4_for_the_Java_TM__ME_Platform_Emulator_ -platform.active.description=Sony Ericsson SDK 2.5.0.4 for the Java(TM) ME Platform(Emulator) -platform.apis=JSR234-1.0,SATSA-APDU-1.0,capuchin-1.0,JSR211-1.0,JSR75-1.0,J2ME-WS-1.0,J2ME-XMLRPC-1.0,JSR82-1.1,SATSA-JCRMI-1.0,SATSA-CRYPTO-1.0,JSR239-1.0,JSR179-1.0.1,MascotV3-1.0,JSR184-1.1,JSR238-1.0,MMAPI-1.1,JSR256-1.1,NokiaUI-1.0,JSR229-1.1.0,SATSA-PKI-1.0,JSR180-1.0.1,JSR226-1.0,JSR177-1.0,SEMC_EXT_JP8-1.0,VSCL-2.0,VSCL-2.1,WMA-2.0 +platform.active=Sony_Ericsson_SDK_2_5_0_6_for_the_Java_TM__ME_Platform_Emulator_ +platform.active.description=Sony Ericsson SDK 2.5.0.6 for the Java(TM) ME Platform(Emulator) +platform.apis=JSR234-1.0,SATSA-APDU-1.0,capuchin-1.0,J2ME-WS-1.0,J2ME-XMLRPC-1.0,SATSA-JCRMI-1.0,SATSA-CRYPTO-1.0,JSR239-1.0,MascotV3-1.0,JSR238-1.0,MMAPI-1.1,JSR256-1.1,NokiaUI-1.0,JSR229-1.1.0,SATSA-PKI-1.0,JSR180-1.0.1,JSR226-1.0,SEMC_EXT_JP8-1.0,VSCL-2.0,VSCL-2.1,JSR75-1.0,JSR184-1.1,WMA-2.0,JSR211-1.0,JSR82-1.1,JSR177-1.0,JSR179-1.0.1 platform.bootclasspath=${platform.home}/lib/mascotv3.jar:${platform.home}/lib/jsr226.jar:${platform.home}/lib/jsr256.jar:${platform.home}/lib/satsa-crypto.jar:${platform.home}/lib/jsr229.jar:${platform.home}/lib/jsr238.jar:${platform.home}/lib/j2me-xmlrpc.jar:${platform.home}/lib/jsr211.jar:${platform.home}/lib/vscl21.jar:${platform.home}/lib/satsa-jcrmi.jar:${platform.home}/lib/jsr082.jar:${platform.home}/lib/satsa-apdu.jar:${platform.home}/lib/jsr184.jar:${platform.home}/lib/nokiaext.jar:${platform.home}/lib/capuchin.jar:${platform.home}/lib/jsr239.jar:${platform.home}/lib/jsr75.jar:${platform.home}/lib/satsa-pki.jar:${platform.home}/lib/jsr179.jar:${platform.home}/lib/jsr180.jar:${platform.home}/lib/vscl.jar:${platform.home}/lib/mmapi.jar:${platform.home}/lib/j2me-ws.jar:${platform.home}/lib/wma20.jar:${platform.home}/lib/jsr234.jar:${platform.home}/lib/semc_ext_jp8.jar:${platform.home}/lib/cldcapi11.jar:${platform.home}/lib/midpapi20.jar platform.configuration=CLDC-1.1 platform.device=SonyEricsson_JP8_240x320_Emu diff --git a/src/1.swf b/src/1.swf deleted file mode 100644 index 053818ccca41a6d9297f5556b05bad60849990dd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3922 zcmV-Y53TS+S5pU}D*ym^ob8%vTohN<#&07ui%4K3ksvV*B#28QuX{wtl0^{#0fC^R zHb{^~St24Zs09+lC5l@{BVq%_ki;lPd|ePzt(5V)fr&<=B%%m$VF<=`0?0I+y0_=n zbmBYjmzfXh2Y>!KRek%`InQ(MDUy*TkI*TEUQ!@Wqt4FGuTi1`Aq7g-{eVZO%z7go zw5~d`FtuT(vL@LG>Hc(fq1>t?sjFT7*JcM|+4UwlE3h@pzA`by3RJ((wr<_Zuu-E% z8DeoV*7g5R9cSWxkJ;PXGmPUngUrRng<->n4eMfE|Du?f806&Sq_FK;bPOH{u-lum9CYEf>DMB6|HywDmSb-lDDu+R`m8p zo#xiMJN3}rwENz=-Q&9U&%DY6A!D>0tyfwpbU&_&GO9)>4sq690qc~#6sT&){_$!+ zwgmk+_lN-K4GC#`t?ZQ#Xf#2C-y0ka$cLaQ?@SpDD1xB)m*Z^#B@>i?C;v7eo}f>~ zPpbiKBIxAylZAkG64aQ|m<;HUghV5k?B0OR5@fR>9|Ni*NcF5>8K72z+~T*4=tc^% z6XN(QJDLHJoe-ybd|C|1m7v*s_Pz^U;l~ULDU+8oQ-@0p7}y};9=iA5S32Q z&?LWYLN}UE&={A1m2hD+K@+Y8ra@FVL6ZxDA>|Z-1O-hB34$mug2Fq(#&gUQ!s?3f zx8OoIf@0%l*h3Uaa-6J+khai)pv9MFJ%T7}f|jkB(*RM%1g-FhtnFSs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f>{r=Rz)Kg-DHNEl3+LuUs^Io?-m{qNo% z$$PAB2p=sooVdX=rm)QsPDzQ7rcu;gG7im7WHSe6KT|K`nRX1X@{WR8+CRN3UL9Q` zFo}sj{x+t9XVMp!z8ZUyV}0X`Iq{d_LVD)fzia*-o~aI8*__zM))1~9nqmo2`ZHI? zLTS#VKXVC-q!R!g`~9d~JOM7G53SKZV;aZG|KB$LB^uU6dx=L^mq^1ds`bxQ%krt3 zNRzE$ni%OgL5K3DVVb*=uG67>&&=YaK$)(;w7vL2Ih8f(^|4TrZY|gFTTbnA4RA=l}o! diff --git a/src/Canv.java b/src/Canv.java deleted file mode 100644 index db8f84d..0000000 --- a/src/Canv.java +++ /dev/null @@ -1,1039 +0,0 @@ -import com.nokia.mid.ui.DeviceControl; -import com.sonyericsson.multimedia.*; -import com.sonyericsson.multimedia.control.*; -import java.io.IOException; -import java.util.*; -import javax.microedition.io.Connector; -import javax.microedition.lcdui.*; -import javax.microedition.sensor.*; -import mobscrob.scrobbler.AudioScrobbler; - -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ - -/** - * - * @author aNNiMON - */ -public class Canv extends Canvas implements Runnable, MediaControlListener { - - public static int softUp1, softUp2, softDn1, softDn2, background, line, text, valuet, inf; - private boolean rspressed; - - //Меню - private String[] m = new String[] {SEPS.midlet.lang.sleepmode, - SEPS.midlet.lang.findtext, SEPS.midlet.lang.visual, SEPS.midlet.lang.skin, SEPS.midlet.lang.options, SEPS.midlet.lang.about, - SEPS.midlet.lang.minimise, SEPS.midlet.lang.exit}; - private int menuwidth, menuheight, mcur, menuy, menuup; - private boolean menu, skin, vis; - private int volumeplus, volumeminus; //визуализация изменения громкости - private boolean fastF, fastR; //быстрая перемотка - private int cx, cy, thisskin;//выбор скина - private int chngx, chngmode;//переключение mode (all, visual) - private int accelPrevDelta = 0; - - //Скролллинг текста (исп, трек, альб, текст) - private int[] scrollPos = {0,0,0,0}; - private int[] sleepPos = {0,0,0,0}; - private boolean[] scrolldirection = {false, false, false, false}; - private int textWidth, lyricWidth; - - private Image old; - - private int w,h; - private int mode; - - private Lyrics lrc; - public RateImpl ri; - private Engine1 e1, tmpe1; - private Engine2 e2, tmpe2; - private Object tmpswf; - private Images im; - private FWCashe mfwc; - - private byte repeat;//функция повтора - private int a,b; - - public Object swf; - - private boolean updateAlbum; - private Image I, album; - private Graphics G; - private Thread thr; - private final Font medFont = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_MEDIUM); - private final Font smallFont_b = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_SMALL); - - private MultimediaService service = null; - private MediaControl mediaControl = null; - public Media media = null; - - private int[] channels = new int[3]; - private String[] channelNames = new String[3]; - private SensorConnection sensor; - private String URL; - - public Canv(Images im) { - setFullScreenMode(true); - w = getWidth(); - volumeminus = h = getHeight(); - I = Image.createImage(w, h); - G = I.getGraphics(); - this.im = im; - thr = new Thread(this); - thr.start(); - lyricWidth = w/(smallFont_b.charWidth('a')+1); - textWidth = lyricWidth - 3; - mfwc = FWCashe.getCache(medFont); - menuwidth = mfwc.stringWidth(m[0]); - menuheight = m.length * (medFont.getHeight()+2); - for(int i=1; imenuwidth) menuwidth = mfwc.stringWidth(m[i]); - } - menuwidth+=6; - menuy = 2*im.statusBarHeight-menuheight; - updateAlbum = menu = rspressed = false; - volumeplus = menuup = mcur = chngx = repeat = 0; - mode = 0; //Режим плейера - getInfo(); - service = MultimediaServiceManager.getMultimediaService("MediaPlayer"); - mediaControl = (MediaControl)service.getControl("MediaControl"); - mediaControl.addMediaControlListener(this); - cx = w/2; - cy = 4*im.statusBarHeight+im.pal.getHeight()/2; - if(Rms.visid>=6) Rms.visid = 1; - if(Rms.visid>1) swf = new Capuchin(Rms.visid); - if(Rms.stat) { - ri = new RateImpl(); - ri.open(); - } - if(Rms.startPlayer) playTrack(); - } - - protected void sizeChanged(int w, int h) { - w = getWidth(); - h = getHeight(); - volumeminus = h = getHeight(); - I = Image.createImage(w, h); - G = I.getGraphics(); - lyricWidth = w/(smallFont_b.charWidth('a')+1); - textWidth = lyricWidth - 3; - cx = w/2; - super.sizeChanged(w, h); - } - - protected void paint(Graphics g) { - setFullScreenMode(true); - //Выбор визуализации - if(vis) {choiceVisual(g, Rms.visid); return;} - if(skin) {choiceSkin(g, cx, cy); return;} - //Переключение режимов (all, visual) - if(chngx>0) { - if(old==null) { - old = Image.createImage(I.getWidth(), I.getHeight()); - old.getGraphics().drawImage(I, 0, 0, 20); - if(mode==0) drawPlayerCanvas(G); - else if(mode==1) drawVisual(G); - if(chngmode<3) chngx = h; - else chngx = w; - } - switch(chngmode) { - case 0: - g.drawImage(I, 0, -chngx, 20); - g.drawImage(old, 0, h-chngx, 20); - break; - case 1: - g.drawImage(I, 0, chngx, 20); - g.drawImage(old, 0, chngx-h, 20); - break; - case 2: - g.drawImage(old, 0, 0, 20); - g.drawRegion(I, 0, 0, w, h/2, 0, 0, -chngx/2, 20); - g.drawRegion(I, 0, h/2, w, h/2, 0, 0, h/2+chngx/2, 20); - break; - case 3: - g.drawImage(I, 0, 0, 20); - g.drawRegion(old, 0, 0, w, h/2, 0, 0, chngx/2-h/2, 20); - g.drawRegion(old, 0, h/2, w, h/2, 0, 0, -chngx/2+h, 20); - break; - case 4: - g.drawImage(I, -chngx, 0, 20); - g.drawImage(old, w-chngx, 0, 20); - break; - case 5: - g.drawImage(I, chngx, 0, 20); - g.drawImage(old, chngx-w, 0, 20); - break; - case 6: - g.drawImage(old, 0, 0, 20); - g.drawRegion(I, 0, 0, w/2, h, 0, -chngx/2, 0, 20); - g.drawRegion(I, w/2, 0, w/2, h, 0, w/2+chngx/2, 0, 20); - break; - default: - g.drawImage(I, 0, 0, 20); - g.drawRegion(old, 0, 0, w/2, h, 0, chngx/2-w/2, 0, 20); - g.drawRegion(old, w/2, 0, w/2, h, 0, -chngx/2+w, 0, 20); - break; - } - chngx-=4; - repaint(); - }else{ - if(mode==0) drawPlayerCanvas(G); - else if(mode==1) drawVisual(G); - g.drawImage(I, 0, 0, 20); - //Меню - if(menuup!=0) { - if(menuup>0) { - menuy-=25; - if(menuy<=2*im.statusBarHeight-menuheight) {menu = false; menuup=0;} - } else { - menuy+=25; - if(menuy>=2*im.statusBarHeight) {menu = true; menuup=0;} - } - drawMenu(g, mcur, menuy); - }else if(menu) drawMenu(g, mcur, menuy); - //Визуализации изменения громкости - if(volumeplus>0) { - drawRect(g, 0x33000000, 0xAA000000, 0, volumeplus-20, w, 20); - drawRect(g, 0xAA000000, 0x33000000, 0, volumeplus, w, 20); - volumeplus-=10; - } - if(volumeminusih) album = Effects.Resize(album, ih*album.getWidth()/album.getHeight(), ih); - g.drawImage(album, w/2, h/2, 3); - }else if(Rms.vis){ - if(Rms.visid==0) { - if(e2==null) { - e2 = new Engine2(w, ih); - e2.setRun(true); - } - g.drawImage(e2.MainCanvas(), w/2, h/2, 3); - } else if(Rms.visid==1) { - if(e1==null) { - e1 = new Engine1(w, ih); - e1.setRun(true); - } - g.drawImage(e1.MainCanvas(), w/2, h/2, 3); - } else{ - ((Capuchin) swf).drawFlash(g, 3, h/2-(ih/2), w-6, ih); - } - } - if(Rms.isLyric && lrc!=null) { - try { - drawCenter(g, lrc.get5Lines(media.getMediaTime())); - } catch (Exception e) {} - } - } - } - drawSoft(g); - } - - private String getValue(MetaData metaData, String md) { - String data = metaData.getValue(md); - StringBuffer sb = new StringBuffer(); - for(int i=0; iih) album = Effects.Resize(album, ih*album.getWidth()/album.getHeight(), ih); - g.drawImage(album, w/2, py+15, 17); - }else if(Rms.vis){ - int ih = h-fh-2-py-20; - if(Rms.visid==0) { - if(e2==null) { - e2 = new Engine2(ih, ih); - e2.setRun(true); - } - g.drawImage(e2.MainCanvas(), w/2, py+15, 17); - } else if(Rms.visid==1) { - if(e1==null) { - e1 = new Engine1(ih, ih); - e1.setRun(true); - } - g.drawImage(e1.MainCanvas(), w/2, py+15, 17); - }else{ - ((Capuchin) swf).drawFlash(g, w/2-ih/2, py+15, ih, ih); - } - } - g.setColor(inf); - if(Rms.slpmode) g.drawString("S", 2, py+15+3*(smallFont_b.getHeight()+2), 20); - drawSoft(g); - } - - public void keyPressed(int key) { - if(key==-6 && !menu) { - menuup = menu?1:-1; - } - if((menuup!=0 || menu) && !vis && !skin) { - if(key==-6) { - menuup = menu?1:-1; - } - int ga=getGameAction(key); - switch (ga) { - case UP: - mcur--; - if(mcur<0) mcur=m.length-1; - break; - case DOWN: - mcur++; - if(mcur>=m.length) mcur=0; - break; - case FIRE: - menuAction(mcur); - break; - } - }else if(vis) { - int ga=getGameAction(key); - switch (ga) { - case UP: - case LEFT: - Rms.visid--; - if(Rms.visid<0) Rms.visid=5; - tmpswf=null; - break; - case DOWN: - case RIGHT: - Rms.visid++; - if(Rms.visid>=6) Rms.visid=0; - tmpswf=null; - break; - } - if(ga==FIRE || key==-6) { - tmpe2=null; tmpe1=null; tmpswf=null; - if(Rms.visid>1) swf = new Capuchin(Rms.visid); - vis = false; - } - }else if(skin) { - int ga=getGameAction(key); - if(ga==UP) {cy--;if(cy<4*im.statusBarHeight) cy=4*im.statusBarHeight+im.pal.getHeight()-1;} - else if(ga==DOWN) {cy++;if(cy>=4*im.statusBarHeight+im.pal.getHeight()) cy=4*im.statusBarHeight+1;} - else if(ga==LEFT) {cx--;if(cx=w/2+im.pal.getWidth()/2) cx=w/2-im.pal.getWidth()/2;} - else if(ga==FIRE || key==-6) { - Rms.skinid = thisskin; - new Skin(Rms.skinid); - skin = false; - } - }else{ - if(key==-7) rspressed = true; - else if(key==KEY_POUND) Rms.accel=!Rms.accel; - else if(key==KEY_STAR) Rms.vis=!Rms.vis; - else if(key==KEY_NUM0) Rms.isLyric=!Rms.isLyric; - else if(key== -36) volumeplus = h;//vol+; - else if(key== -37) volumeminus = 0;//vol-; - } - repaint(); - } - - public void keyReleased(int key) { - if(menuup!=0 || menu) return; - int ga=getGameAction(key); - if(key==-7) { - rspressed = false; - if(Rms.closePlayer) pauseTrack(); - SEPS.midlet.destroyApp(true); - }else if(key==KEY_NUM9) new SetSleepMode(); - if(key==KEY_NUM4) rewind(); - else if(key==KEY_NUM6) fastForward(); - if(ga==LEFT && key!=KEY_NUM4) prevTrack(); - else if(ga==RIGHT && key!=KEY_NUM6) nextTrack(); - if(key==KEY_NUM3) ABRepeat(); - else if(key==KEY_NUM1) { - String art="",tit=""; - try{ - MetaData metaData = SEPS.midlet.cnv.media.getMetaData(); - tit = getValue(metaData, MetaData.TITLE_KEY); - art = getValue(metaData, MetaData.ARTIST_KEY); - }catch(Exception ex){} - FindLyrics fl = new FindLyrics(); - fl.find(art, tit);//SEPS.midlet.dsp.setCurrent(SEPS.midlet.cnv); - } - switch(ga) { - case UP: - upMode(); - break; - case DOWN: - upMode(); - break; - case FIRE: - try { - if (mediaControl.getState() == mediaControl.STATE_PLAY) pauseTrack(); - else playTrack(); - } catch (Exception e) { - } - break; - } - repaint(); - } - - public void keyRepeated(int key) { - if(key==KEY_NUM4) { - try { - if(!fastR) { - mediaControl.rewind(); - fastR = true; - } - } catch (ControlException ex) { - ex.printStackTrace(); - } - }else if(key==KEY_NUM6) { - try { - if(!fastF) { - mediaControl.fastForward(); - fastF = true; - } - } catch (ControlException ex) { - ex.printStackTrace(); - } - - }else keyPressed(key); - } - - public int getDelta(int channel, int threshold) { - int delta = 0; - try { - Data[] data = sensor.getData(1, -1, false, false, false); - int drx = 0; - - for (int i = 0; i < data.length; i++) { - if (data[i].getChannelInfo().getName().equals(channelNames[channel])) { - drx = data[i].getIntValues()[0]; - } - } - - delta = channels[channel] - drx; - channels[channel] = drx; - - if (Math.abs(delta) < threshold) { - delta = 0; - } - } catch (Throwable t) { - } - - return delta; - } - - public void run() { - while (true) { - try { - if(Rms.light) DeviceControl.setLights(0, 100); - final int delta = getDelta(0, Rms.sensetivity); - if (delta != 0) { - if (accelPrevDelta != 0 && (delta * accelPrevDelta) < 0) { - accelPrevDelta = 0; - } else { - accelPrevDelta = delta; - - Runnable runnable = new Runnable() { - - public void run() { - if (delta > 0 && Rms.accel) { - nextTrack(); - } else if (delta < 0 && Rms.accel) { - if(Rms.listfw) nextTrack(); - else prevTrack(); - } - } - }; - (new Thread(runnable)).start(); - } - } - if(!Rms.vis) Thread.sleep(100); - if(Rms.slpmode) { - if(checkTime()) { - pauseTrack(); - SEPS.midlet.destroyApp(true); - } - } - if(repeat==2) { - try { - int mgt = media.getMediaTime(); - int sk = Math.abs(b-a); - if(mgt>=b) mediaControl.skip(-sk); - } catch (ControlException ex) { - ex.printStackTrace(); - } - } - if((Rms.stat || Rms.urlstat || Rms.actmenu) && media!=null) { - MetaData metaData = media.getMetaData(); - Object data = getValue(metaData, MetaData.ARTIST_KEY); - String thisSong = (String) data; - data = getValue(metaData, MetaData.TITLE_KEY); - thisSong = thisSong+" - "+ (String) data; - if(!thisSong.equalsIgnoreCase(Rms.lastSong)) { - int thisTime = media.getMediaTime(); - int allTime = media.getDuration()*50/*% проиграно*//100; - if(thisTime>allTime) { - int cn = 1; - - try { - //GetPass - String username = "aNMCore"; //[0] - String password = "abcdcba"; //[1] - String md5pass = ""; //[2] - if (md5pass.equals("")) { - md5pass = AudioScrobbler.GetPasswordMD5(password); - } - //if (audioscrobbler == null) - AudioScrobbler audioscrobbler = new AudioScrobbler("tst", "1.0", username, md5pass); - audioscrobbler.connect(); - Thread.sleep(3000); - audioscrobbler.Submit( - (String) getValue(metaData, MetaData.ARTIST_KEY), - (String) getValue(metaData, MetaData.TITLE_KEY), - (String) getValue(metaData, MetaData.ALBUM_KEY), - "1", media.getDuration() - ); - - /*MobScrobblerImpl ms = new MobScrobblerImpl(); - ms.scrobble( - (String) getValue(metaData, MetaData.ARTIST_KEY), - (String) getValue(metaData, MetaData.TITLE_KEY), - (String) getValue(metaData, MetaData.ALBUM_KEY), - media.getDuration(), - thisTime - );*/ - }catch(Exception ex) { - SEPS.midlet.dsp.setCurrent(new Alert("Ahtung", ex.getMessage(), null, AlertType.INFO)); - } - - if(Rms.stat) { - Rms.lastSong = thisSong; - cn = ri.update(thisSong); - } - if(Rms.urlstat) { - FindLyrics fl = new FindLyrics(); - fl.scrob(thisSong); - Rms.lastSong = thisSong; - } - if(Rms.actmenu) { - try { - Image icon = Image.createImage("/icon.png"); - StringBuffer sb = new StringBuffer();//String desc = ""; - if(Rms.stat) { sb.append(cn); sb.append(" |");} - allTime = media.getDuration(); - int hh = 0, m=0, s = 0; - if(allTime<60) s=allTime; - else { - if(allTime<3600) { - m = allTime/60; - s = allTime - m*60; - }else{ - m = allTime/60; - hh = m/60; m=m-hh*60; - } - } - if(hh>0) {sb.append(hh); sb.append(" :");} - if(m>0) {if(m>10) sb.append(0); sb.append(m); sb.append(" :");} - if(s>10) sb.append(0); - sb.append(s); - com.sonyericsson.ui.UIActivityMenu.getInstance(SEPS.midlet).addEvent(thisSong, sb.toString(), icon, null); - } catch (IOException ex) { - ex.printStackTrace(); - } - } - } - } - } - if (service != null) { - repaint(); - } - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - } - - /** - * Переключение трека - */ - private void newTrack() { - a=b=0; repeat = 0; - SEPS.midlet.dsp.vibrate(Rms.vibrlen); - if (Rms.flash) { - DeviceControl.setLights(0, 0); - DeviceControl.setLights(0, 100); - } - } - - private void getInfo() { - SensorInfo[] info = SensorManager.findSensors("acceleration", null); - for (int i = 0; i < info.length; i++) { - SensorInfo s = info[i]; - URL = s.getUrl(); - ChannelInfo[] ci = s.getChannelInfos(); - for (int r = 0; r < ci.length; r++) { - ChannelInfo c = ci[r]; - channelNames[r] = c.getName(); - } - } - try { - sensor = (SensorConnection) Connector.open(URL); - } catch (IOException ex) { - ex.printStackTrace(); - } - } - - private void initLyric(Media med) { - if (med == null) {return;} - lrc = null; - String at = ""; - String fl = ""; - MetaData metaData = med.getMetaData(); - if (metaData != null) { - Object data = getValue(metaData, MetaData.ARTIST_KEY); - if (data != null) at=at +(String)(data) + " - "; - - data = getValue(metaData, MetaData.TITLE_KEY); - if (data != null) at+=(String) data; - - data = getValue(metaData, MetaData.FILE_URI_KEY); - if (data != null) {fl=(String) data;fl=fl.substring(fl.lastIndexOf('/')+1, fl.lastIndexOf('.'));} - - if(Lyrics.isExists(at)) lrc = new Lyrics(at); - else if(Lyrics.isExists(fl)) lrc = new Lyrics(fl); - } - } - - private void nextTrack() { - try { - newTrack(); - mediaControl.next(); - } catch (ControlException ex) { - ex.printStackTrace(); - } - } - - private void prevTrack() { - try { - newTrack(); - mediaControl.prev(); - } catch (ControlException ex) { - ex.printStackTrace(); - } - } - - public void pauseTrack() { - try { - mediaControl.pause(); - } catch (ControlException ex) { - ex.printStackTrace(); - } - } - - private void playTrack() { - try { - mediaControl.play(); - } catch (ControlException ex) { - ex.printStackTrace(); - } - } - - private void fastForward() { - try { - if(fastF) { - fastF = false; - mediaControl.play(); - } - else mediaControl.skip(10); - } catch (ControlException ex) { - ex.printStackTrace(); - } - } - - private void rewind() { - try { - if(fastR) { - fastR = false; - mediaControl.play(); - } - else mediaControl.skip(-10); - } catch (ControlException ex) { - ex.printStackTrace(); - } - } - - public void mediaControlUpdate(int eventId, ControlEvent event) { - try { - switch (eventId) { - case MediaControlListener.PLAY: - case MediaControlListener.PAUSE: - case MediaControlListener.STOP: - case MediaControlListener.ENDPLAY: - case MediaControlListener.FASTFORWARD: - case MediaControlListener.REWIND: - this.media = (Media) event.getData(); - break; - case MediaControlListener.ERROR: - //errorString = (String) event.getData(); - //canvas.removeCommand(pauseCommand); - //canvas.addCommand(playCommand); - break; - default: - break; - } - MetaData data = this.media.getMetaData(); - if (data != null) { - byte[] alb = data.getAlbumArt(); - if (alb != null) album = Image.createImage(alb, 0, alb.length); - else album = null; - } - a = b = 0; repeat = 0; - if(Rms.isLyric) initLyric(this.media); - } catch (Throwable t) { - t.printStackTrace(); - } - - } - - private void upMode() { - old = null; - chngmode = random(0,8); - chngx = 2; - mode = 1-mode; - e2=null; - e1=null; - if(album!=null) updateAlbum = true; - } - - private void menuAction(int i) { - if(m[i].equals(SEPS.midlet.lang.sleepmode)) SEPS.midlet.dsp.setCurrent(new SetSleepMode()); - else if(m[i].equals(SEPS.midlet.lang.findtext)) { - MetaData metaData = this.media.getMetaData(); - String all = getValue(metaData, MetaData.ARTIST_KEY) + " - " + getValue(metaData, MetaData.TITLE_KEY); - SEPS.midlet.dsp.setCurrent(new FindText(all)); - } - else if(m[i].equals(SEPS.midlet.lang.options)) SEPS.midlet.dsp.setCurrent(new Options()); - else if(m[i].equals(SEPS.midlet.lang.about)) SEPS.midlet.dsp.setCurrent(new Info()); - else if(m[i].equals(SEPS.midlet.lang.minimise)) SEPS.midlet.dsp.setCurrent(null); - else if(m[i].equals(SEPS.midlet.lang.exit)) SEPS.midlet.destroyApp(true); - else if(m[i].equals(SEPS.midlet.lang.skin)) skin = true; - else if(m[i].equals(SEPS.midlet.lang.visual)) vis = true; - } - - //GUI - GRAPHICAL USER INTERFACE - - private int drawText(Graphics g, String value, int y, int id) { - g.setColor(line); - g.drawLine(3, y-1, w-3, y-1); - g.setColor(valuet); - g.setFont(smallFont_b); - g.drawString(value, (id!=3?im.track.getWidth()+4:w/2), y, (id!=3?20:17)); - return y+(smallFont_b.getHeight()+2); - } - - private void drawMenu(Graphics g, int cur, int y) { - ACLS(g,180,0x00); - int fh = medFont.getHeight()+2; - int x = w/2-menuwidth/2; - for(int i=0; i(h-2*im.statusBarHeight)) ww = h-2*im.statusBarHeight; - if(cur==0) { - if(tmpe2==null) tmpe2 = new Engine2(ww, ww); - kdr = tmpe2.MainCanvas(); - }else if(cur==1) { - if(tmpe1==null) tmpe1 = new Engine1(ww, ww); - kdr = tmpe1.MainCanvas(); - }else { - if(tmpswf==null) tmpswf = new Capuchin(Rms.visid); - kdr = ((Capuchin)tmpswf).getImage(ww, ww); - } - g.drawImage(Effects.reflection(kdr, 0.5D), w/2, 2*im.statusBarHeight, 17); - drawTitle(g, getTime()); - } - - private void choiceSkin(Graphics g, int cx, int cy) { - g.setColor(0); - int x = w/2-im.pal.getWidth()/2; - g.fillRect(0, 0, w, h); - g.drawImage(im.pal, x, 4*im.statusBarHeight, 20); - //cursor - g.setColor(0x00); - int dcur = 4; - g.drawLine(cx + 1, cy, cx + dcur, cy); - g.drawLine(cx - dcur, cy, cx - 1, cy); - g.drawLine(cx, cy - dcur, cx, cy - 1); - g.drawLine(cx, cy + 1, cx, cy + dcur); - // - thisskin=Effects.get(im.pal, cx-x, cy-4*im.statusBarHeight); - drawTitle(g, Integer.toHexString(thisskin)); - } - - private void drawSoft(Graphics g) { - int fh = medFont.getHeight()+2; - int wsoft = 26; - int msoft = (w-wsoft*2)/3; - g.setFont(medFont); - //Линия - g.setColor(0); - g.drawLine(0, h-fh-1, w, h-fh-1); - //Меню - drawRect(g, (menuup!=0 || menu)?softUp1:softDn1, (menuup!=0 || menu)?softUp2:softDn2, 0, h-fh, wsoft, fh); - g.setColor(valuet); - g.fillTriangle(wsoft/2, h-5, 3, h-fh+7, wsoft-3, h-fh+7); - //Выход - drawRect(g, rspressed?softUp1:softDn1, rspressed?softUp2:softDn2, w-wsoft, h-fh, wsoft, fh); - g.drawImage(im.exit, w-2, h-fh, 24); - //* - Визуализация - drawRect(g, Rms.vis?softUp1:softDn1, Rms.vis?softUp2:softDn2, wsoft, h-fh, msoft, fh); - g.drawChar('*', wsoft+msoft/6, h-fh+2, 20); - g.drawImage(im.star, wsoft+msoft-msoft/6, h-fh+fh/2, 10); - //0 - Тексты Песен - drawRect(g, Rms.isLyric?softUp1:softDn1, Rms.isLyric?softUp2:softDn2, wsoft+msoft, h-fh, w-2*(wsoft+msoft), fh); - g.drawChar('0', w/2-msoft/4, h-fh+2, 17); - g.drawImage(im.zero, w/2+msoft/4, h-fh+fh/2, 3); - // - Акселерометр - drawRect(g, Rms.accel?softUp1:softDn1, Rms.accel?softUp2:softDn2, w-wsoft-msoft, h-fh, msoft, fh); - g.drawChar('#', w-wsoft-msoft+msoft/6, h-fh+2, 20); - g.drawImage(im.pound, w-wsoft-msoft/6, h-fh+fh/2, 10); - } - - private void drawTitle(Graphics g, String text) { - g.setColor(valuet); - g.setFont(medFont); - int k = im.titleleft.getWidth(); - for(int i=k; i> 24) & 0xff; - int r1 = (color1 >> 16) & 0xff; - int g1 = (color1 >> 8) & 0xff; - int b1 = color1 & 0xff; - int a2 = (color2 >> 24) & 0xff; - int r2 = (color2 >> 16) & 0xff; - int g2 = (color2 >> 8) & 0xff; - int b2 = color2 & 0xff; - int beforecolor = g.getColor(); - int crd1, crd2; - int count = h/3; - if (count < 0) count = -count; - if (count < 8) count = 8; - boolean lite = false; - if(a1==0xff && a2==0xff) lite = true; - for (int i=count-1; i>=0; i--) { - crd1 = i*h/count+y1; - crd2 = (i+1)*h/count+y1; - if (crd1 == crd2) continue; - if(lite) { - g.setColor(i * (r2 - r1) / (count - 1) + r1, i * (g2 - g1) / (count - 1) + g1, i * (b2 - b1) / (count - 1) + b1); - g.fillRect(x1, crd1, w, crd2 - crd1); - }else{ - int[] pixelArray = new int[w * (crd2 - crd1)]; - for(int zi = 0; zi < pixelArray.length; zi++) - pixelArray[zi] = (int) ((i * (a2 - a1) / (count - 1) + a1) << 24) | - ((i * (r2 - r1) / (count - 1) + r1) << 16) | - ((i * (g2 - g1) / (count - 1) + g1) << 8) | (i * (b2 - b1) / (count - 1) + b1); - g.drawRGB(pixelArray, 0, w, x1, crd1, w, crd2 - crd1, true); - } - } - g.setColor(beforecolor); - } - - private void ACLS(Graphics g, int a1, int color) { - int[] pixelArray = new int[g.getClipWidth() * g.getClipHeight()]; - for(int i = 0; i < pixelArray.length; i++) - pixelArray[i] = (int) (a1 << 24| color & 0x00ffffff); - g.drawRGB(pixelArray, 0, g.getClipWidth(), 0, 0, g.getClipWidth(), g.getClipHeight(), true); - } - - //Methods - - private boolean checkTime() { - Calendar cal = Calendar.getInstance (); - int ch = cal.get(Calendar.HOUR_OF_DAY); - int cm = cal.get(Calendar.MINUTE); - if(ch!=Rms.dh) return false; - else return (cm>=Rms.dm); - } - - private String getTime() { - StringBuffer sb = new StringBuffer(); - Calendar cal = Calendar.getInstance(); - int tmp; - tmp = cal.get(Calendar.HOUR_OF_DAY); - if(tmp<=9) sb.append('0'); sb.append(tmp); - sb.append(':'); - //Минута - tmp = cal.get(Calendar.MINUTE); - if(tmp<=9) sb.append('0'); sb.append(tmp); - return sb.toString(); - } - - private int random(int min, int max) { - return min + ((new Random().nextInt() >>> 1)%(max-min)); - } - - private void ABRepeat() { - try { - repeat++; - switch (repeat) { - case 1: // ставим A - a = media.getMediaTime(); - break; - case 2: // ставим B - b = media.getMediaTime(); - if(a>b) { - int t = b; b=a; a=t; - } - break; - case 3: // конец повтора - a = b = 0; - repeat = 0; - break; - } - } catch (Exception e) { - } - } - - private String scrollText(String text, int id) { - int count; - if(id==3) count = lyricWidth; - else count = textWidth; - String tmp = text; - int lent = text.length(); - int scr = lent - count; - try { - if (lent > count) { - tmp = text.substring(scrollPos[id], scrollPos[id] + count); - if(sleepPos[id] scr) { - scrollPos[id]--; - scrolldirection[id] = !scrolldirection[id]; - } else if (scrollPos[id] < 0) { - scrollPos[id] = 0; - scrolldirection[id] = !scrolldirection[id]; - } - sleepPos[id] = 0; - } - } - }catch(Exception ex) {tmp = text;} - return tmp; - } -} \ No newline at end of file diff --git a/src/Capuchin.java b/src/Capuchin.java deleted file mode 100644 index 007c457..0000000 --- a/src/Capuchin.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -import com.sonyericsson.capuchin.*; -import javax.microedition.lcdui.*; - -/** - * @author aNNiMON - */ -public class Capuchin { - - public FlashImage flashImage; - - public Capuchin(int i) { - flashImage = null; - try - { - flashImage = FlashImage.createImage(getClass().getResourceAsStream("/"+String.valueOf(i-1)+".swf"), null); - } - catch(Exception ex) {} - } - - public void drawFlash(Graphics g, int x, int y, int w, int h) { - if(flashImage!=null) flashImage.render(g, x, y, w, h); - } - - public Image getImage(int w, int h) { - Image img = Image.createImage(w, h); - Graphics g = img.getGraphics(); - if(flashImage!=null) flashImage.render(g, 0, 0, w, h); - return img; - } -} \ No newline at end of file diff --git a/src/Engine1.java b/src/Engine1.java deleted file mode 100644 index 6a401d3..0000000 --- a/src/Engine1.java +++ /dev/null @@ -1,195 +0,0 @@ -import java.util.Random; -import javax.microedition.lcdui.*; - -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ - -/** - * - * @author aNNiMON - */ -public class Engine1 implements Runnable{ - - public Image db; - private Graphics G; - private int w,h; - private int K,i,mode; - private int max, spd, cf; - private int[] starx,stary,starz; - private long time, dt; - private boolean up,dn; - private Random rnd; - private Thread thr; - public boolean run; - - public Engine1(int w, int h) { - this.w=w; - this.h=h; - db = Image.createImage(w, h); - G=db.getGraphics(); - rnd = new Random(); - max = 300; spd = 200; K=60; - mode = (rnd.nextInt() >>> 1) % 4; - init(max); - time = System.currentTimeMillis(); - thr = new Thread(this); - thr.start(); - } - - public void run() { - while (run) { - if(up) { - while(cf!=0) { - spd++; cf--; - try { Thread.sleep(25L);} catch (InterruptedException ex) {ex.printStackTrace();} - } - up=false; - } - if(dn) { - while(cf!=0) { - spd--; cf--; - try { Thread.sleep(25L);} catch (InterruptedException ex) {ex.printStackTrace();} - } - dn=false; - } - int r = (rnd.nextInt() >>> 1) % 20; - switch(r) { - case 5: up=true; cf=100; break; - case 15: up=true; cf=400; break; - case 8: dn=true; cf=100; break; - case 18: dn=true; cf=400; break; - case 3: if(max>11) max-=10; break; - case 13: if(max<1000) init(max+=100); break; - case 4: if(K<84) K+=15; break; - case 14: if(K>16) K-=15; break; - case 6: mode = (rnd.nextInt() >>> 1) % 4; break; - } - try { - if(spd<25 && spd>-25) Thread.sleep(500L); - else Thread.sleep(2000L); - } catch (InterruptedException ex) { - ex.printStackTrace(); - } - } - } - - public void setRun(boolean run) { - this.run=run; - } - - public Image MainCanvas() { - dt = System.currentTimeMillis() - time; - time = System.currentTimeMillis(); - if(K>=3) ACLS(G); - else CLS(G); - for (i = 1; i0) { - if (starz[i] <= -200) { - starx[i] = (rnd.nextInt()>>>1)%(w * 4) - w * 2; - stary[i] = (rnd.nextInt()>>>1)%(h * 4) - h * 2; - starz[i] = (rnd.nextInt()>>>1)%1900; - } - SetPix((255 - 255 * (starz[i] + 200) / 2100)); - }else{ - if (starz[i] > 2000) { - starx[i] = (rnd.nextInt()>>>1)%(w * 4) - w * 2; - stary[i] = (rnd.nextInt()>>>1)%(h * 4) - h * 2; - starz[i] = (rnd.nextInt()>>>1)%1900; - } - SetPix((255-255 * (starz[i]%2100) / 2100)); - } - } - return db; - } - - private void CLS(Graphics g) { - g.setColor(0); - g.fillRect(0, 0, w, h); - } - - private void ACLS(Graphics g) { - int[] pixelArray = new int[w * h]; - for (int io = 0; io < pixelArray.length; io++) { - pixelArray[io] = (int) ((100-K) << 24) | 0; - } - g.drawRGB(pixelArray, 0, w, 0, 0, w, h, true); - } - - private void SetPix(int c) { - int sx, sy, sx1 = 0, sy1 = 0; - sx = (w / 2 + starx[i] * 200 / (starz[i] + 200)); - sy = (h / 2 - stary[i] * 200 / (starz[i] + 200)); - if(c>255) c=255; if(c<0) c=0; - switch(mode) { - case 0: - G.setColor(c, c, c); - if(i!=22) G.drawLine(sx, sy, sx, sy); - else try{G.fillRoundRect(sx, sy, starz[i]/(255-c), starz[i]/(255-c), i, i);}catch(Exception ex) {}; - break; - case 1: - G.setColor(c, c, c); - int u=starz[i]==0?1:starz[i]; - G.fillArc(sx, sy, c/u, c/u, 0, 360); - break; - case 2: - u=(rnd.nextInt()>>>1)%6; - switch(u) { - case 0: G.setColor(255-c, c, c); break; - case 1: G.setColor(c, 255-c, c); break; - case 2: G.setColor(c, c, 255-c); break; - case 3: G.setColor(255-c, 255-c, c); break; - case 4: G.setColor(255-c, c, 255-c); break; - case 5: G.setColor(c, 255-c, 255-c); break; - case 6: G.setColor(255-c, 255-c, 255-c); break; - } - if(i!=22) G.drawLine(sx, sy, sx, sy); - else try{G.fillRoundRect(sx, sy, starz[i]/(255-c), starz[i]/(255-c), i, i);}catch(Exception ex) {}; break; - case 3: - u=rnd.nextInt()%6; - switch(u) { - case 0: G.setColor(255-c, c, c); break; - case 1: G.setColor(c, 255-c, c); break; - case 2: G.setColor(c, c, 255-c); break; - case 3: G.setColor(255-c, 255-c, c); break; - case 4: G.setColor(255-c, c, 255-c); break; - case 5: G.setColor(c, 255-c, 255-c); break; - case 6: G.setColor(255-c, 255-c, 255-c); break; - } - u=starz[i]==0?1:starz[i]; - G.fillArc(sx, sy, c/u, c/u, 0, 360); - break; - case 4: - u=rnd.nextInt()%6; - switch(u) { - case 0: G.setColor(255-c, c, c); break; - case 1: G.setColor(c, 255-c, c); break; - case 2: G.setColor(c, c, 255-c); break; - case 3: G.setColor(255-c, 255-c, c); break; - case 4: G.setColor(255-c, c, 255-c); break; - case 5: G.setColor(c, 255-c, 255-c); break; - case 6: G.setColor(255-c, 255-c, 255-c); break; - } - if(i>1) { - sx1 = (w / 2 + starx[i-1] * 200 / (starz[i-1] + 200)); - sy1 = (h / 2 - stary[i-1] * 200 / (starz[i-1] + 200)); - } - G.drawLine(sx1, sy1, sx, sy); break; - } - - } - - - - private void init(int max) { - starx = new int[max];stary = new int[max];starz = new int[max]; - for (i = 0; i>>1)%(w * 4) - w * 2; - stary[i] = (rnd.nextInt()>>>1)%(h * 4) - h * 2; - starz[i] = (rnd.nextInt()>>>1)%1900; - } - CLS(G); - } -} diff --git a/src/FindLyrics.java b/src/FindLyrics.java deleted file mode 100644 index 8c824c3..0000000 --- a/src/FindLyrics.java +++ /dev/null @@ -1,142 +0,0 @@ - -import java.io.*; -import javax.microedition.io.*; -import javax.microedition.io.file.FileConnection; - -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ - -/** - * - * @author aNNiMON - */ -public class FindLyrics { - - String MSG; - - public FindLyrics() { - - } - public boolean find(String artist, String title) { - MSG = ""; - String url = "http://www.lyricsplugin.com/winamp03/plugin/?artist="+urlName(artist)+"&title="+urlName(title); - try { - byte[] res = send(url); - int lr1 = MSG.indexOf("
"); - int lr2 = MSG.indexOf("
", lr1); - if((lr2-lr1)>30) { - FileConnection fc; - fc = (FileConnection) Connector.open("file:///" + Rms.lrcpath+artist+" - "+title+".html"); - if(fc.exists()) fc.delete(); - fc.create(); - OutputStream os = fc.openOutputStream(); - os.write(res); - os.flush(); - os.close(); - fc.close(); - return true; - } - } catch (Exception e) { - } - return false; - } - - public void scrob(String song) { - String artist = song.substring(0, song.lastIndexOf('-')).trim(); - String title = song.substring(song.lastIndexOf('-')+1).trim(); - MSG = ""; - String url = "http://annimon.com/seps/seps.php?id="+Rms.id+"&a="+urlName(artist)+"&t="+urlName(title); - try { - send(url); - } catch (Exception e) { - } - } - - private byte[] send(String url) throws Exception { - HttpConnection hc = null; - InputStream is = null; - byte[] res = null; - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - try { - hc = (HttpConnection) Connector.open(url); - int ch; - is = hc.openInputStream(); - StringBuffer sb = new StringBuffer(); - while ((ch = is.read()) != -1) { - sb.append(StringEncoder.decodeCharCP1251((byte)ch)); - bos.write(ch); - } - MSG = sb.toString(); - res = bos.toByteArray(); - } catch (Exception e) { - e.printStackTrace(); - } finally { - try { - if (bos != null) bos.close(); - if (is != null) is.close(); - if (hc != null) hc.close(); - } catch (Exception e2) { - e2.printStackTrace(); - } - } - return res; - } - - private String urlName(String url) { - if (url == null) return null; - StringBuffer sb = new StringBuffer(); - for (int i = 0; i < url.length(); i++) { - char ch = url.charAt(i); - switch (ch) { - default: - if (ch < '\200') { - sb.append(ch); - break; - } - if (ch > '\177' && ch < '\u0800') { - sb.append('%'); - sb.append(Integer.toHexString((ch >> 6 | 0xc0) + 256).substring(1)); - sb.append('%'); - sb.append(Integer.toHexString((ch & 0x3f | 0x80) + 256).substring(1)); - break; - } - if (ch > '\u07FF' && ch < '\0') { - sb.append('%'); - sb.append(Integer.toHexString((ch >> 12 | 0xe0) + 256).substring(1)); - sb.append('%'); - sb.append(Integer.toHexString((ch >> 6 & 0x3f | 0x80) + 256).substring(1)); - sb.append('%'); - sb.append(Integer.toHexString((ch & 0x3f | 0x80) + 256).substring(1)); - } - break; - case 0: //'\0' - case 32: sb.append("%20"); break;// ' ' - case 61: sb.append("%3d"); break;// '=' - case 43: sb.append("%2b"); break;// '+' - case 39: sb.append("%27"); break;// '\'' - case 46: sb.append("%2E"); break;// '.' - case 60: sb.append("%3c"); break;// '<' - case 62: sb.append("%3e"); break;// '>' - case 35: sb.append("%23"); break;// '#' - case 37: sb.append("%25"); break;// '%' - case 38: sb.append("%26"); break;// '&' - case 123:sb.append("%7b"); break;// '{' - case 125:sb.append("%7d"); break;// '}' - case 92: sb.append("%5c"); break;// '\\' - case 94: sb.append("%5e"); break;// '^' - case 126:sb.append("%73"); break;// '~' - case 91: sb.append("%5b"); break;// '[' - case 93: sb.append("%5d"); break;// ']' - case 58: sb.append("%3A"); break;// ':' - case 47: sb.append("%2F"); break;// '/' - case 63: sb.append("%3F"); break;// '?' - case 45: sb.append("%2D"); break;// '-' - case 33: sb.append("%21"); break;// '!' - case 59: sb.append("%3B"); break;// ';' - } - } - return sb.toString(); - } -} diff --git a/src/FindText.java b/src/FindText.java deleted file mode 100644 index 0105e55..0000000 --- a/src/FindText.java +++ /dev/null @@ -1,41 +0,0 @@ -import javax.microedition.lcdui.*; - -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -/** - * - * @author aNNiMON - */ -public class FindText extends Form implements CommandListener { - - private Command back, ok; - public TextField all_tb; - - public FindText(String all) { - super(SEPS.midlet.lang.findtext); - back = new Command(SEPS.midlet.lang.back, Command.BACK, 2); - ok = new Command(SEPS.midlet.lang.ok, Command.OK, 1); - all_tb = new TextField(SEPS.midlet.lang.artist, all, 512, TextField.ANY); - append(all_tb); - addCommand(ok); - addCommand(back); - setCommandListener(this); - SEPS.midlet.dsp.setCurrent(this); - } - - public void commandAction(Command c, Displayable d) { - if (c == back) SEPS.midlet.dsp.setCurrent(SEPS.midlet.cnv); - - if (c == ok) { - try { - FindLyrics fl = new FindLyrics(); - int id = all_tb.getString().indexOf(" - "); - boolean check = fl.find(all_tb.getString().substring(0, id), all_tb.getString().substring(id+3)); - if(check) append(SEPS.midlet.lang.textsaving); - else append(SEPS.midlet.lang.nofound); - }catch(Exception ex){} - } - } -} diff --git a/src/Info.java b/src/Info.java deleted file mode 100644 index 0bf29e2..0000000 --- a/src/Info.java +++ /dev/null @@ -1,68 +0,0 @@ -import java.io.DataInputStream; -import javax.microedition.io.ConnectionNotFoundException; -import javax.microedition.lcdui.*; - -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ - -/** - * - * @author aNNiMON - */ -public class Info extends Form implements CommandListener { - private Command back = new Command(SEPS.midlet.lang.back, Command.BACK, 1); - private StringItem Text; - private Command site = new Command(SEPS.midlet.lang.site, Command.HELP, 2); - private Command scrob = new Command(SEPS.midlet.lang.scrobdb, Command.HELP, 3); - - - public Info() { - super(SEPS.midlet.lang.about); - String str = getText("/about"); - Text = new StringItem(null, str); - append(Text); - addCommand(site); - addCommand(back); - if(Rms.urlstat) { - addCommand(scrob); - append("ID="+Rms.id); - } - setCommandListener(this); - } - - public void commandAction(Command c, Displayable d) { - if(c==back) SEPS.midlet.dsp.setCurrent(SEPS.midlet.cnv); - if(c==site) { - try { - String url = "http://annimon.com/"; - if(url.length()!=19) return; - SEPS.midlet.platformRequest(url); - } catch (ConnectionNotFoundException ex) { - SEPS.midlet.dsp.setCurrent(SEPS.midlet.cnv); - } - } - if(c==scrob) { - try { - String url = "http://annimon.com/seps/seps.php?id="+String.valueOf(Rms.id); - SEPS.midlet.platformRequest(url); - } catch (ConnectionNotFoundException ex) { - SEPS.midlet.dsp.setCurrent(SEPS.midlet.cnv); - } - } - } - - private String getText(String path) { - DataInputStream dis = new DataInputStream(getClass().getResourceAsStream(path)); - StringBuffer strBuff = new StringBuffer(); - int ch = 0; - try { - while ((ch = dis.read()) != -1) { - strBuff.append(StringEncoder.decodeCharCP1251((byte)ch)); - } - dis.close(); - } catch (Exception e) {e.printStackTrace();} - return strBuff.toString(); - } -} diff --git a/src/Lang.java b/src/Lang.java deleted file mode 100644 index 5669a1a..0000000 --- a/src/Lang.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ - -/** - * - * @author aNNiMON - */ -public class Lang { - - String menu, back, exit, ok, findtext, artist, textsaving, nofound; - String site, scrobdb, about, sreturn, sleepmode, options, minimise; - String sensetivity, textfolder, vibro, skin, visual, elements, - light, start, stop, flashlight, tooff, - statlocal, scrobbling, uiactivity, listforward; - - public Lang(int id) { - if(id==0) { - menu = "Menu"; - back = "Back"; - exit = "Exit"; - ok = "Ok"; - findtext = "Text Search"; - artist = "Artist - Title"; - textsaving = "Text saved\n"; - nofound = "Not found\n"; - site = "Site"; - scrobdb = "Scrobbling info"; - about = "About"; - sreturn = "Return"; - sleepmode = "Sleep Mode"; - options = "Options"; - minimise = "Minimise"; - sensetivity = "Sensetivity to switch:"; - textfolder = "Folder with the text:"; - vibro = "Vibration switch (in ms):"; - skin = "Skin"; - visual = "Visualization"; - light = "Backlight"; - start = "Launch player when program start"; - stop = "Close player when program exit"; - flashlight = "Flash backlight"; - statlocal = "Statistics (need to restart app)"; - scrobbling = "Scrobbling (annimon.com)"; - elements = "Elements: "; - tooff = "Time to turn off (in minutes):"; - uiactivity = "Sync. with ActivityMenu"; - listforward = "List Forward"; - }else{ - menu = "Меню"; - back = "Назад"; - exit = "Выход"; - ok = "Ok"; - findtext = "Поиск текстов"; - artist = "Исполнитель - Заголовок"; - textsaving = "Текст сохранен\n"; - nofound = "Не найдено\n"; - site = "На сайт"; - scrobdb = "Данные скробблинга"; - about = "О программе"; - sreturn = "Вернуться"; - sleepmode = "Спящий режим"; - options = "Настройки"; - minimise = "Свернуть"; - sensetivity = "Чувствительность к переключению:"; - textfolder = "Папка с текстами:"; - vibro = "Вибрация при переключении (в мс):"; - skin = "Скин"; - visual = "Визуализации"; - light = "Постоянная подсветка"; - start = "Запускать плейер при старте программы"; - stop = "Закрывать плейер при выходе из программы"; - flashlight = "Мигание подсветкой"; - statlocal = "Вести статистику (необходим перезапуск)"; - scrobbling = "Скробблинг"; - elements = "Всего элементов: "; - tooff = "Врямя до выключения (в минутах):"; - uiactivity = "Синхр. с Меню Событий"; - listforward = "Листать вперед"; - } - } - - -} diff --git a/src/Options.java b/src/Options.java deleted file mode 100644 index f901dd9..0000000 --- a/src/Options.java +++ /dev/null @@ -1,102 +0,0 @@ -import java.util.Random; -import javax.microedition.lcdui.*; - -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ - -/** - * - * @author aNNiMON - */ -public class Options extends Form implements CommandListener { - - private Command back,ok; - private TextField zw, az, un; - private ChoiceGroup cRC, lang; - - - public Options() { - super(SEPS.midlet.lang.options); - back = new Command(SEPS.midlet.lang.back, Command.BACK, 3); - ok = new Command(SEPS.midlet.lang.ok, Command.OK, 1); - zw = new TextField(SEPS.midlet.lang.sensetivity, String.valueOf(Rms.sensetivity), 4, TextField.NUMERIC); - az = new TextField(SEPS.midlet.lang.textfolder, Rms.lrcpath, 256, TextField.ANY); - un = new TextField(SEPS.midlet.lang.vibro, String.valueOf(Rms.vibrlen), 4, TextField.NUMERIC); -// cc = new TextField(L.str[L.cch]+":", "000000", 6, TextField.ANY); -// hp = new TextField(L.str[L.ach], String.valueOf(P.heap), 2, TextField.ANY); - lang = new ChoiceGroup ("Language / Язык", ChoiceGroup.EXCLUSIVE); - cRC = new ChoiceGroup ("", ChoiceGroup.MULTIPLE); - appendSkin(); - StrokeStyle(); - } - - public void commandAction(Command c, Displayable d) { - if (c==back) SEPS.midlet.dsp.setCurrent(SEPS.midlet.cnv); - - if ((c==ok || c==List.SELECT_COMMAND)) { - SEPS.midlet.lang = new Lang(Rms.lngid = lang.getSelectedIndex()); - Rms.sensetivity=Integer.parseInt(zw.getString()); - Rms.vibrlen=Integer.parseInt(un.getString()); - Rms.lrcpath=az.getString(); -// P.az=Integer.parseInt(az.getString()); -// P.curcolor = getHexValue(cc.getString()); -// P.heap = Integer.parseInt(hp.getString()); - Rms.light = cRC.isSelected(0); - Rms.startPlayer = cRC.isSelected(1); - Rms.closePlayer = cRC.isSelected(2); - Rms.flash = cRC.isSelected(3); - Rms.statGo = cRC.isSelected(4); if(!Rms.statGo) Rms.stat=Rms.statGo; - Rms.urlstat = cRC.isSelected(5); - Rms.actmenu = cRC.isSelected(6); - Rms.listfw = cRC.isSelected(7); - if(Rms.urlstat && Rms.id==0) { - Random rnd = new Random(); - Rms.id = (rnd.nextInt() >>> 1) % 10000000; - } -// P.undo=Integer.parseInt(un.getString()); -// Editor.isteps = new Image[P.undo]; -// Editor.ist=0; - SEPS.midlet.dsp.setCurrent(SEPS.midlet.cnv); - } - } - - private void StrokeStyle() { - append(lang); - append(zw); - append(az); - append(un); -// append(hp); - append(cRC); - addCommand(ok); - addCommand(back); - setCommandListener(this); - SEPS.midlet.dsp.setCurrent(this); - } - - private void appendSkin() { - lang.append("English", null); - lang.append("Русский", null); - lang.setSelectedIndex(Rms.lngid, true); - - cRC.append(SEPS.midlet.lang.light, null); - cRC.append(SEPS.midlet.lang.start, null); - cRC.append(SEPS.midlet.lang.stop, null); - cRC.append(SEPS.midlet.lang.flashlight, null); - cRC.append(SEPS.midlet.lang.statlocal, null); - cRC.append(SEPS.midlet.lang.scrobbling, null); - cRC.append(SEPS.midlet.lang.uiactivity, null); - cRC.append(SEPS.midlet.lang.listforward, null); -// cRC.append(L.str[120], null); -// cRC.append(L.str[123], null); - cRC.setSelectedIndex(0, Rms.light); - cRC.setSelectedIndex(1, Rms.startPlayer); - cRC.setSelectedIndex(2, Rms.closePlayer); - cRC.setSelectedIndex(3, Rms.flash); - cRC.setSelectedIndex(4, Rms.stat); - cRC.setSelectedIndex(5, Rms.urlstat); - cRC.setSelectedIndex(6, Rms.actmenu); - cRC.setSelectedIndex(7, Rms.listfw); - } -} diff --git a/src/Rate.java b/src/Rate.java deleted file mode 100644 index 71ffbef..0000000 --- a/src/Rate.java +++ /dev/null @@ -1,14 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ - -/** - * - * @author aNNiMON - */ -public class Rate { - - String song; - int rate; -} diff --git a/src/RateImpl.java b/src/RateImpl.java deleted file mode 100644 index d66d9d6..0000000 --- a/src/RateImpl.java +++ /dev/null @@ -1,149 +0,0 @@ -import java.io.*; -import java.util.Vector; -import javax.microedition.io.*; -import javax.microedition.io.file.FileConnection; - -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ - -/** - * - * @author aNNiMON - */ -public class RateImpl { - - public int numRates; //кол-во - public Vector rates; - private String[] path = {"c:/other", "e:/other", "c:/usb/other", "c:/music"}; - - public int update(String song) { - int s = rates.size(); - if(s!=0) - for(int i=0; i 0) - { - try { - Rate r = new Rate(); - r.rate = Integer.parseInt(s2.substring(0, s2.lastIndexOf('|')).trim()); - r.song = s2.substring(s2.lastIndexOf('|') + 1).trim(); - rates.addElement(r); - } catch (Exception ex) { - } - s2 = ""; - } - }else s2 = s2 + String.valueOf((char)i); - } - if(s2.length() > 0) { - try { - Rate r = new Rate(); - r.rate = Integer.parseInt(s2.substring(0, s2.lastIndexOf('|')).trim()); - r.song = s2.substring(s2.lastIndexOf('|') + 1).trim(); - rates.addElement(r); - } catch (Exception exc) { - } - } - } - - public void save() { - FileConnection fc; - int i; - try { - for(i=0; i>> 1) % 10000000; - } - new Skin(Rms.skinid); - cnv = new Canv(im); - dsp = Display.getDisplay(this); - dsp.setCurrent(cnv); - } - - public void pauseApp() { - } - - public void destroyApp(boolean unco) { - if(Rms.firstStart) Rms.firstStart=false; - if(Rms.stat) cnv.ri.save(); - if(Rms.statGo) Rms.stat=true; - Rms.saveOptions(); - if(Rms.closePlayer) cnv.pauseTrack(); - notifyDestroyed(); - } -} diff --git a/src/Skin.java b/src/Skin.java deleted file mode 100644 index 8cfdcab..0000000 --- a/src/Skin.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ - -/** - * - * @author aNNiMON - */ -public class Skin { - - public Skin(int skin) { - if(skin==1) skin = Rms.skinid = 0xFF3477d5; - else if(skin==2) skin = Rms.skinid = 0xFF181818; - else if(skin==3) skin = Rms.skinid = 0xFFCE6BA6; - else if(skin==4) skin = Rms.skinid = 0; - else if(skin==5) skin = Rms.skinid = 0xFFFFFF99; - Canv.background = 0xFF2F8400; - Canv.valuet = 0xFFFFFFFF; - if(skin!=0) { - Canv.softUp1 = Effects.changeHSV(Canv.background, 2, 0.4352941f); - Canv.softUp2 = Effects.changeHSV(Canv.background, 2, 0.19215685f); - Canv.softDn1 = Effects.changeHSV(Canv.background, 2, -0.007843137f); - Canv.softDn2 = Effects.changeHSV(Canv.background, 2, -0.16862747f); - Canv.line = Effects.changeHSV(Canv.background, 0, 22); - Canv.line = Effects.changeHSV(Canv.line, 2, 0.21568626f); - Canv.text = Effects.changeHSV(Canv.background, 0, 22); - Canv.text = Effects.changeHSV(Canv.text, 2, 0.082352936f); - Canv.inf = Effects.changeHSV(Canv.background, 2, -0.16078433f); - for(int i=0; i<=2; i++) { - float delta = Effects.getHSV(skin, i) - Effects.getHSV(Canv.background, i); - if(delta>-0.05 && delta<0.05) continue; - Canv.softUp1 = Effects.changeHSV(Canv.softUp1, i, delta); - Canv.softUp2 = Effects.changeHSV(Canv.softUp2, i, delta); - Canv.softDn1 = Effects.changeHSV(Canv.softDn1, i, delta); - Canv.softDn2 = Effects.changeHSV(Canv.softDn2, i, delta); - Canv.line = Effects.changeHSV(Canv.line, i, delta); - Canv.text = Effects.changeHSV(Canv.text, i, delta); - Canv.inf = Effects.changeHSV(Canv.inf, i, delta); - } - Canv.background = skin; - }else{ - Canv.softUp1 = 0xFF57f300; - Canv.softUp2 = 0xFF41b500; - Canv.softDn1 = 0xFF2e8200; - Canv.softDn2 = 0xFF205900; - Canv.line = 0x00BB00; - Canv.text = 0x009900; - Canv.inf = 0x215B00; - } - - } -} diff --git a/src/accel/AccelData.java b/src/accel/AccelData.java new file mode 100644 index 0000000..641a09e --- /dev/null +++ b/src/accel/AccelData.java @@ -0,0 +1,126 @@ +/* + * aNNiMON 2011 + * For more info visit http://annimon.com/ + */ +package accel; + +import java.io.IOException; +import javax.microedition.io.Connector; +import javax.microedition.sensor.ChannelInfo; +import javax.microedition.sensor.Data; +import javax.microedition.sensor.MeasurementRange; +import javax.microedition.sensor.SensorConnection; +import javax.microedition.sensor.SensorInfo; +import javax.microedition.sensor.SensorManager; + +/** + * Подключение сенсора. Измерение отклонения. + * @author aNNiMON + */ +public class AccelData implements SensorData { + + private int[] channels; + private String[] channelNames; + private SensorConnection sensor; + private String URL; //URL для коннекта + private int numChannels; //количество каналов + private int dataType; //тип приёма данных + private double + minValue, //минимальное значение + maxValue; //максимальное значение + + /** + * Конструктор + */ + public AccelData() { + getInfo(); + } + + public int getDelta(int channel, int sensetivity) { + int delta = 0; + try { + Data[] data = sensor.getData(1, -1, false, false, false); + int drx = 0; + + for (int i = 0; i < data.length; i++) { + if (data[i].getChannelInfo().getName().equals(channelNames[channel])) { + drx = getValue(data[i]); + } + } + + delta = channels[channel] - drx; + channels[channel] = drx; + + if (Math.abs(delta) < sensetivity) { + delta = 0; + } + } catch (Throwable t) { + } + + return delta; + } + + /** + * Подключение к акселерометру + */ + private void getInfo() { + //Получаем список ВСЕХ сенсоров + SensorInfo[] info = SensorManager.findSensors(null, null); + if (info == null || info.length == 0) { + return; //ничего не нашли, выходим + } //Сканируем найденные сенсоры + for (int i = 0; i < info.length; i++) { + //Узнаём тип устройства + String quantity = info[i].getQuantity().toLowerCase(); + //Нам нужен acceleration + if (quantity.startsWith("accel")) { + //Нашли девайс + SensorInfo s = info[i]; + //Получаем URL для коннекта с ним + URL = s.getUrl(); + //Получаем каналы приёма данных + ChannelInfo[] ci = s.getChannelInfos(); + //Получаем количество каналов + numChannels = ci.length; + //Инициализируем переменные + channels = new int[numChannels]; + channelNames = new String[numChannels]; + //Получаем тип приёма данных (TYPE_DOUBLE = 1, TYPE_INT = 2, TYPE_OBJECT = 4) + dataType = ci[0].getDataType(); + MeasurementRange mr = ci[0].getMeasurementRanges()[0]; + //Получаем минимальное значение + minValue = mr.getSmallestValue(); + //Получаем максимальное значение + maxValue = mr.getLargestValue(); + //Получаем названия каналов (axis_x, axis_y, axis_z) + for (int j = 0; j < numChannels; j++) { + channelNames[j] = ci[j].getName(); + } + } + } + //Для того, чтобы подключить DataListener, нужно соединение + try { + //Открываем соединение, по раннее полученному URL + sensor = (SensorConnection) Connector.open(URL); + } catch (IOException ex) { + ex.printStackTrace(); + } + } + + /** + * Преобразование в int [-1024...+1024] + */ + private int getValue(Object o) { + int value = 0; + double doublevalue = 0; + if(dataType == ChannelInfo.TYPE_INT) { + doublevalue = ((Data) o).getIntValues()[0]; + }else if(dataType == ChannelInfo.TYPE_DOUBLE) { + doublevalue = ((Data) o).getDoubleValues()[0]; + } + if(doublevalue>=0) value = (int) (doublevalue * 1024 / maxValue); + else value = (int) (doublevalue * (-1024) / minValue); + + return value; + } +} diff --git a/src/accel/NoData.java b/src/accel/NoData.java new file mode 100644 index 0000000..0e8bcc2 --- /dev/null +++ b/src/accel/NoData.java @@ -0,0 +1,24 @@ +/* + * aNNiMON 2011 + * For more info visit http://annimon.com/ + */ + +package accel; + +/** + * Не подключен к сенсору - нет данных. + * @author aNNiMON + */ +public class NoData implements SensorData { + + /** + * Получение отклонения + * @param channel - канал X, Y, Z + * @param sensetivity - чувствительность + * @return int нулевое отклонение + */ + public int getDelta(int channel, int sensetivity) { + return 0; + } + +} diff --git a/src/accel/SensorData.java b/src/accel/SensorData.java new file mode 100644 index 0000000..ea45236 --- /dev/null +++ b/src/accel/SensorData.java @@ -0,0 +1,22 @@ +/* + * aNNiMON 2011 + * For more info visit http://annimon.com/ + */ + +package accel; + +/** + * Интерфейс получения данных от сенсоров. + * @author aNNiMON + */ +public interface SensorData { + + /** + * Получение отклонения + * @param channel - канал X, Y, Z + * @param sensetivity - чувствительность + * @return int отклонение + */ + public abstract int getDelta(int channel, int sensetivity); + +} diff --git a/src/com/annimon/GraphicsUtil.java b/src/com/annimon/GraphicsUtil.java new file mode 100644 index 0000000..70925b8 --- /dev/null +++ b/src/com/annimon/GraphicsUtil.java @@ -0,0 +1,201 @@ +/* + * aNNiMON 2011 + * For more info visit http://annimon.com/ + */ + +package com.annimon; + +import javax.microedition.lcdui.Font; +import javax.microedition.lcdui.Graphics; +import seps.Images; +import seps.Skin; + +/** + * Класс графических функций + * @author aNNiMON + */ +public class GraphicsUtil { + + //Поля константы + private static final Font smallPlainFont = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_SMALL); + private static final Font smallBoldFont = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_SMALL); + private static final Font mediumBoldFont = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_MEDIUM); + + public static final byte + SMALL_PLAIN_FONT = 0, + SMALL_BOLD_FONT = 1, + MEDIUM_BOLD_FONT = 2; + + private static final int IMAGE_TRACK_WIDTH = 19; + + + /** + * Очистка экрана чёрным + * @param g Graphics + */ + public static void CLS(Graphics g) { + g.setColor(0); + g.fillRect(0, 0, g.getClipWidth(), g.getClipHeight()); + } + + /** + * Плавная очистка экрана + * @param g Graphics + * @param opacity int прозрачность + */ + public static void ACLS(Graphics g, int opacity) { + ACLS(g, opacity, 0); + } + + /** + * Плавная очистка экрана выбранным цветом + * @param g Graphics + * @param alpha int прозрачность + * @param color int цвет + */ + public static void ACLS(Graphics g, int alpha, int color) { + int w = g.getClipWidth(); + int h = g.getClipHeight(); + int[] pixelArray = new int[w * h]; + for(int i = 0; i < pixelArray.length; i++) + pixelArray[i] = (alpha << 24) | (color & 0x00ffffff); + g.drawRGB(pixelArray, 0, w, 0, 0, w, h, true); + } + + /** + * Отрисовка градиента + * @param g Graphics + * @param color1 первый цвет градиента + * @param color2 второй цвет градиента + * @param x1 начальная координата x + * @param y1 начальная координата y + * @param w ширина + * @param h высота + */ + public static void drawRect(Graphics g, int color1, int color2, int x1, int y1, int w, int h) { + int a1 = (color1 >> 24) & 0xff; + int r1 = (color1 >> 16) & 0xff; + int g1 = (color1 >> 8) & 0xff; + int b1 = color1 & 0xff; + int a2 = (color2 >> 24) & 0xff; + int r2 = (color2 >> 16) & 0xff; + int g2 = (color2 >> 8) & 0xff; + int b2 = color2 & 0xff; + int beforecolor = g.getColor(); + int crd1, crd2; + int count = h/3; + if (count < 0) count = -count; + if (count < 8) count = 8; + boolean lite = false; + if(a1==0xff && a2==0xff) lite = true; + for (int i=count-1; i>=0; i--) { + crd1 = i*h/count+y1; + crd2 = (i+1)*h/count+y1; + if (crd1 == crd2) continue; + if(lite) { + g.setColor(i * (r2 - r1) / (count - 1) + r1, i * (g2 - g1) / (count - 1) + g1, i * (b2 - b1) / (count - 1) + b1); + g.fillRect(x1, crd1, w, crd2 - crd1); + }else{ + int[] pixelArray = new int[w * (crd2 - crd1)]; + for(int zi = 0; zi < pixelArray.length; zi++) + pixelArray[zi] = (int) ((i * (a2 - a1) / (count - 1) + a1) << 24) | + ((i * (r2 - r1) / (count - 1) + r1) << 16) | + ((i * (g2 - g1) / (count - 1) + g1) << 8) | (i * (b2 - b1) / (count - 1) + b1); + g.drawRGB(pixelArray, 0, w, x1, crd1, w, crd2 - crd1, true); + } + } + g.setColor(beforecolor); + } + + /** + * Отрисовка текстов песен по центру + * @param g Graphics + * @param lines String[] строки текста + */ + public static void drawCenter(Graphics g, String[] lines) { + if(lines==null) return; + int fh = smallPlainFont.getHeight()+2; + int w = g.getClipWidth(); + int h = g.getClipHeight(); + g.setFont(smallPlainFont); + String v; + drawRect(g, ((160<<24)| Skin.background & 0x00ffffff),((160<<24)| Skin.background & 0x00ffffff), 0, h/2-fh*2, w, fh*5); + for(int i=0; i 0 && ch < 128) - return (byte) ch; - else if (ch == 0x401) - return -88; // Ё - else if (ch == 0x404) - return -86; // Є - else if (ch == 0x407) - return -81; // Ї - else if (ch == 0x451) - return -72; // ё - else if (ch == 0x454) - return -70; // є - else if (ch == 0x457) - return -65; // ї - return (byte)((byte)(ch) + 176); - } public static char checkCP1251 (char ch) { diff --git a/src/com/annimon/Util.java b/src/com/annimon/Util.java new file mode 100644 index 0000000..0520131 --- /dev/null +++ b/src/com/annimon/Util.java @@ -0,0 +1,63 @@ +/* + * aNNiMON 2011 + * For more info visit http://annimon.com/ + */ +package com.annimon; + +import java.util.Calendar; +import java.util.Random; +import java.util.Vector; +import seps.Rms; + +/** + * + * @author aNNiMON + */ +public class Util { + + private static final Random rnd = new Random(); + + public static boolean checkTime() { + Calendar cal = Calendar.getInstance(); + int ch = cal.get(Calendar.HOUR_OF_DAY); + int cm = cal.get(Calendar.MINUTE); + if(ch!=Rms.dh) return false; + else return (cm>=Rms.dm); + } + + public static String getTime() { + StringBuffer sb = new StringBuffer(); + Calendar cal = Calendar.getInstance(); + int tmp; + tmp = cal.get(Calendar.HOUR_OF_DAY); + if(tmp<=9) sb.append('0'); sb.append(tmp); + sb.append(':'); + //Минута + tmp = cal.get(Calendar.MINUTE); + if(tmp<=9) sb.append('0'); sb.append(tmp); + return sb.toString(); + } + + public static int random(int min, int max) { + return min + rnd.nextInt(max+1-min); + } + + public static String[] splitString(String str, String delim) { + if (str.equals("") || delim == null || delim.length() == 0) return new String[]{str}; + String[] s; + Vector v = new Vector(); + int pos = 0; + int newpos = str.indexOf(delim, 0); + + while (newpos != -1) { + v.addElement(str.substring(pos, newpos)); + pos = newpos + delim.length(); + newpos = str.indexOf(delim, pos); + } + v.addElement(str.substring(pos)); + + s = new String[v.size()]; + v.copyInto(s); + return s; + } +} diff --git a/src/fx/AnimatedImage.java b/src/fx/AnimatedImage.java new file mode 100644 index 0000000..fb12d67 --- /dev/null +++ b/src/fx/AnimatedImage.java @@ -0,0 +1,51 @@ +package fx; + +import javax.microedition.lcdui.Graphics; +import javax.microedition.lcdui.Image; + +public class AnimatedImage { + + ImageFx fx; + Image image; + int imageWidth; + int imageHeight; + + public AnimatedImage(Image image) { + fx = null; + this.image = null; + imageWidth = 0; + imageHeight = 0; + this.image = image; + imageWidth = image.getWidth(); + imageHeight = image.getHeight(); + } + + public void setFx(ImageFx fx) { + this.fx = fx; + } + + public void start(long duration) { + fx.start(duration); + } + + public boolean isEnded() { + return fx.isEnded(); + } + + public void paint(Graphics g, int x, int y, int constraints) { + if (fx == null) { + g.drawImage(image, x, y, constraints); + } else { + int cx = g.getClipX(); + int cy = g.getClipY(); + int cw = g.getClipWidth(); + int ch = g.getClipHeight(); + int translateX = (constraints & 8) <= 0 ? (constraints & 1) <= 0 ? x : x - imageWidth / 2 : x - imageWidth; + int translateY = (constraints & 0x20) <= 0 ? (constraints & 2) <= 0 ? y : y - imageHeight / 2 : y - imageHeight; + g.translate(translateX, translateY); + fx.paint(g, image); + g.translate(-translateX, -translateY); + g.setClip(cx, cy, cw, ch); + } + } +} \ No newline at end of file diff --git a/src/fx/BlindsFx.java b/src/fx/BlindsFx.java new file mode 100644 index 0000000..b74b647 --- /dev/null +++ b/src/fx/BlindsFx.java @@ -0,0 +1,36 @@ +package fx; + +import javax.microedition.lcdui.Graphics; +import javax.microedition.lcdui.Image; + +public class BlindsFx extends ImageFx { + + int blinds; + + public BlindsFx(int blinds, int type, int orientation) { + this.blinds = blinds; + setOrientation(orientation); + setFxType(type); + assertNotOrientation(0); + assertNotFxType(0); + } + + protected void paintFx(Graphics g, Image image, long timeDiff) { + int perc = getPercentage(timeDiff); + int orientation = getOrientation(); + int imageSize = orientation != 2 ? image.getWidth() : image.getHeight(); + int pieceSize = imageSize / blinds; + int delta = imageSize - pieceSize * blinds; + int coord = 0; + for (int i = 0; i < blinds; i++) { + int size = ((pieceSize + (i >= delta ? 0 : 1)) * (100 - perc)) / 100; + if (orientation == 2) { + g.setClip(0, coord, image.getWidth(), size); + } else { + g.setClip(coord, 0, size, image.getHeight()); + } + g.drawImage(image, 0, 0, 20); + coord += pieceSize + (i >= delta ? 0 : 1); + } + } +} diff --git a/src/fx/ImageFx.java b/src/fx/ImageFx.java new file mode 100644 index 0000000..285021a --- /dev/null +++ b/src/fx/ImageFx.java @@ -0,0 +1,119 @@ +package fx; + +//~--- JDK imports ------------------------------------------------------------ +import javax.microedition.lcdui.Graphics; +import javax.microedition.lcdui.Image; + +public abstract class ImageFx { + + public static final int ORIENTATION_NONE = 0; + public static final int ORIENTATION_VERTICAL = 1; + public static final int ORIENTATION_HORIZONTAL = 2; + public static final int TYPE_NONE = 0; + public static final int TYPE_IN = 1; + public static final int TYPE_OUT = 2; + private int direction; + private long duration; + private boolean ended; + private int fxType; + private boolean looping; + private int orientation; + private boolean running; + private long startTime; + + public ImageFx() { + fxType = TYPE_NONE; + orientation = ORIENTATION_NONE; + direction = 2; + looping = false; + running = false; + ended = false; + duration = 0L; + startTime = 0L; + } + + public void start(long millisecs) { + duration = millisecs; + startTime = System.currentTimeMillis(); + ended = false; + running = true; + } + + public void setOrientation(int orientation) { + if ((orientation == ORIENTATION_HORIZONTAL) || (orientation == ORIENTATION_VERTICAL) + || (orientation == ORIENTATION_NONE)) { + this.orientation = orientation; + } + } + + public void setFxType(int fxType) { + if ((fxType == TYPE_IN) || (fxType == TYPE_OUT) || (fxType == TYPE_NONE)) { + this.fxType = fxType; + } + } + + public void setDirection(int direction) { + if ((direction == 1) || (direction == 5) || (direction == 6) || (direction == 2)) { + this.direction = direction; + } + } + + protected void assertNotFxType(int value) { + if (fxType != value) { + return; + } + } + + protected void assertNotOrientation(int value) { + if (orientation != value) { + return; + } + } + + public int getOrientation() { + return orientation; + } + + public int getDirection() { + return direction; + } + + public void paint(Graphics g, Image image) { + if (!running) { + + // if(mustNotPaint()) + // return; + // if(mustFullyPaint()) + g.drawImage(image, 0, 0, 20); + } else { + long timeDiff = System.currentTimeMillis() - startTime; + + if (timeDiff > duration) { + if (looping) { + timeDiff -= duration; + startTime += duration; + } else { + timeDiff = duration; + ended = true; + running = false; + } + } + + if (fxType == TYPE_IN) { + timeDiff = duration - timeDiff; + } + + paintFx(g, image, timeDiff); + } + } + + protected int getPercentage(long timeDiff) { + return (int) ((100L * timeDiff) / duration); + } + + public boolean isEnded() { + return ended; + } + + protected abstract void paintFx(Graphics g, Image image, long l); +} diff --git a/src/fx/PuzzleFx.java b/src/fx/PuzzleFx.java new file mode 100644 index 0000000..e58de69 --- /dev/null +++ b/src/fx/PuzzleFx.java @@ -0,0 +1,71 @@ +package fx; + +import java.util.Random; +import javax.microedition.lcdui.Graphics; +import javax.microedition.lcdui.Image; + +public class PuzzleFx extends ImageFx { + + int vPieces; + int hPieces; + int[] pieceOrder; + long pieceDelay; + long pieceDuration; + + public PuzzleFx(int hPieces, int vPieces, int type) { + this.vPieces = 4; + this.hPieces = 8; + pieceOrder = null; + pieceDelay = 0L; + pieceDuration = 0L; + int normalizedType = type != 1 ? type != 2 ? type : 1 : 2; + setFxType(normalizedType); + assertNotFxType(0); + this.hPieces = hPieces; + this.vPieces = vPieces; + Random rand = new Random(); + pieceOrder = new int[hPieces * vPieces]; + for (int i = 0; i < pieceOrder.length; i++) { + pieceOrder[i] = -1; + } + + for (int i = 0; i < pieceOrder.length; i++) { + int next; + for (next = rand.nextInt(pieceOrder.length); pieceOrder[next] != -1; next = (next + 1) % pieceOrder.length); + pieceOrder[next] = i; + } + + } + + public void start(long millisecs) { + super.start(millisecs); + pieceDuration = millisecs / 8L; + pieceDelay = (millisecs - pieceDuration) / (long) (hPieces * vPieces); + } + + protected void paintFx(Graphics g, Image image, long timeDiff) { + int imageWidth = image.getWidth(); + int imageHeight = image.getHeight(); + int pieceWidth = imageWidth / hPieces; + int pieceHeight = imageHeight / vPieces; + for (int i = 0; i < hPieces; i++) { + for (int j = 0; j < vPieces; j++) { + int index = i * vPieces + j; + int w = pieceWidth; + int h = pieceHeight; + long delta = timeDiff - (long) pieceOrder[index] * pieceDelay; + if (delta >= 0L) { + if (delta - pieceDuration < 0L) { + int perc = (int) ((delta * 100L) / pieceDuration); + w = (pieceWidth * perc) / 100; + h = (pieceHeight * perc) / 100; + } + g.setClip(i * pieceWidth + (pieceWidth - w) / 2, j * pieceHeight + (pieceHeight - h) / 2, w, h); + g.drawImage(image, 0, 0, 20); + } + } + + } + + } +} diff --git a/src/fx/Slide2Fx.java b/src/fx/Slide2Fx.java new file mode 100644 index 0000000..a5eca65 --- /dev/null +++ b/src/fx/Slide2Fx.java @@ -0,0 +1,43 @@ +package fx; + +import javax.microedition.lcdui.Graphics; +import javax.microedition.lcdui.Image; + +public class Slide2Fx extends ImageFx { + + public Slide2Fx(int direction, int fxType) { + setDirection(direction); + setFxType(fxType); + assertNotFxType(0); + } + + protected void paintFx(Graphics g, Image image, long timeDiff) { + int perc = getPercentage(timeDiff); + int x = 0; + int y = 0; + int w = image.getWidth(); + int h = image.getHeight(); + switch (getDirection()) { + case 1: // '\001' + h = (h * (100 - perc)) / 100; + y = image.getHeight() - h; + break; + + case 6: // '\006' + h = (h * (100 - perc)) / 100; + y = h - image.getHeight(); + break; + + case 5: // '\005' + w = (w * (100 - perc)) / 100; + x = image.getWidth() - w; + break; + + case 2: // '\002' + w = (w * (100 - perc)) / 100; + x = w - image.getWidth(); + break; + } + g.drawImage(image, x, y, 20); + } +} diff --git a/src/fx/SlideFx.java b/src/fx/SlideFx.java new file mode 100644 index 0000000..db4888f --- /dev/null +++ b/src/fx/SlideFx.java @@ -0,0 +1,67 @@ +package fx; + +import javax.microedition.lcdui.Graphics; +import javax.microedition.lcdui.Image; + +public class SlideFx extends ImageFx { + + int pieces; + long singleSlideDuration; + + public SlideFx(int pieces, int slideType, int direction) { + this.pieces = 4; + singleSlideDuration = 0L; + setDirection(direction); + setFxType(slideType); + assertNotFxType(0); + this.pieces = pieces; + } + + public void start(long millisecs) { + super.start(millisecs); + singleSlideDuration = millisecs / (long) pieces; + } + + protected void paintFx(Graphics g, Image image, long timeDiff) { + int cx = g.getClipX(); + int cy = g.getClipY(); + int cw = g.getClipWidth(); + int ch = g.getClipHeight(); + int imageHeight = image.getHeight(); + int imageWidth = image.getWidth(); + int direction = getDirection(); + int pieceEnd = 0; + int pieceCoord = 0; + int pieceSize = direction != 2 && direction != 5 ? imageWidth / pieces : imageHeight / pieces; + switch (direction) { + case 2: // '\002' + pieceEnd = cx - imageWidth; + break; + + case 5: // '\005' + pieceEnd = cx + cw; + break; + + case 1: // '\001' + pieceEnd = cy - imageHeight; + break; + + case 6: // '\006' + pieceEnd = cy + ch; + break; + } + for (int i = 0; i < pieces; i++) { + if (timeDiff <= (long) (i + 1) * singleSlideDuration) { + pieceCoord = (int) (timeDiff >= (long) i * singleSlideDuration ? ((long) pieceEnd * (timeDiff - (long) i * singleSlideDuration)) / singleSlideDuration : 0L); + if (direction == 2 || direction == 5) { + g.setClip(pieceCoord, i * pieceSize, imageWidth, pieceSize); + g.drawImage(image, pieceCoord, 0, 20); + } else { + g.setClip(i * pieceSize, pieceCoord, pieceSize, imageHeight); + g.drawImage(image, 0, pieceCoord, 20); + } + } + } + + } +} diff --git a/src/fx/WaveFx.java b/src/fx/WaveFx.java new file mode 100644 index 0000000..cb2da8c --- /dev/null +++ b/src/fx/WaveFx.java @@ -0,0 +1,60 @@ +package fx; + +import javax.microedition.lcdui.Graphics; +import javax.microedition.lcdui.Image; + +public class WaveFx extends ImageFx +{ + int pieces; + int maxShift; + long pieceDuration; + long pieceDelay; + + public WaveFx(int pieces, int maxShift, int orientation) + { + this.pieces = 0; + this.maxShift = 0; + pieceDuration = 0L; + pieceDelay = 0L; + setOrientation(orientation); + this.pieces = pieces; + this.maxShift = maxShift; + } + + public void start(long millisecs) + { + super.start(millisecs); + pieceDuration = millisecs / 2L; + pieceDelay = (millisecs - pieceDuration) / (long)pieces; + } + + protected void paintFx(Graphics g, Image image, long timeDiff) + { + int imageWidth = image.getWidth(); + int imageHeight = image.getHeight(); + int pieceSize = (getOrientation() != 2 ? image.getWidth() : image.getHeight()) / pieces; + int shift = 0; + for(int i = 0; i < pieces; i++) + { + long delta = (long)i * pieceDelay - timeDiff; + if(delta > 0L || delta + pieceDuration <= 0L) + { + shift = 0; + } else + { + long perc = (delta * 100L) / pieceDuration; + shift = (int)((double)maxShift * Math.sin(((double)(perc * 2L) * 3.1415926535897931D) / 100D)); + } + if(getOrientation() == 2) + { + g.setClip(0 + shift, i * pieceSize, imageWidth, pieceSize); + g.drawImage(image, 0 + shift, 0, 20); + } else + { + g.setClip(i * pieceSize, 0 + shift, pieceSize, imageHeight); + g.drawImage(image, 0, 0 + shift, 20); + } + } + + } +} diff --git a/src/fx/WipeFx.java b/src/fx/WipeFx.java new file mode 100644 index 0000000..8470f3d --- /dev/null +++ b/src/fx/WipeFx.java @@ -0,0 +1,46 @@ +package fx; + +import javax.microedition.lcdui.Graphics; +import javax.microedition.lcdui.Image; + +public class WipeFx extends ImageFx +{ + + public WipeFx(int direction, int fxType) + { + setDirection(direction); + setFxType(fxType); + assertNotFxType(0); + } + + protected void paintFx(Graphics g, Image image, long timeDiff) + { + int perc = getPercentage(timeDiff); + int x = 0; + int y = 0; + int w = image.getWidth(); + int h = image.getHeight(); + switch(getDirection()) + { + case 1: // '\001' + h = (h * (100 - perc)) / 100; + y = image.getHeight() - h; + break; + + case 6: // '\006' + h = (h * (100 - perc)) / 100; + break; + + case 5: // '\005' + w = (w * (100 - perc)) / 100; + x = image.getWidth() - w; + break; + + case 2: // '\002' + w = (w * (100 - perc)) / 100; + break; + } + g.setClip(x, y, w, h); + g.drawImage(image, 0, 0, 20); + } +} diff --git a/src/icon.png b/src/icon.png deleted file mode 100644 index b0e1f4ca241b3e7bc6ef99b874ed816874b85d6d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 857 zcmV-f1E&0mP)20009ZNkl0CmdPbV9k6o3jWMbzExZC8096Y;}VK!^VMaq8C-#0$hq@>VL4@U=MNiuevv4#!EP%Qx1sb~Z5=EwcAXB= z_Y_KV^(H7=Ag&|1uc*-XKOQT`4#e-K;I}ILwz&Ovpu}@ zuH%Hy+jhj7cBUux@MUi)0qdN@Gczx##-IkXgY=&uO^&u6QtBZ2M@X!Ngc>NXZenC) zM1lP^-Lby&8=0}(T2yvn&-mw^^_88N?_tdmc(WQ-9fpJ&OmyWxWbA9FwxP)j z$ZSr_9sTG2mZkJ#cuVVrrtY;8@%aP7P4`*+@!zOR?x8Ne%c5O(2-|*}ux+;}Jyh$3 z=GoIt3fhqrs-QU$U`+ndGa<3SLP(~Iko4=QQioA#ucAtpP$dnrAhDm_rekBaneWsp zsLr}Rl(qBTVRN)x*_2k#1WjH&3lh%BIV;EcB;B4I`1-hl7T9&Ug&mtH>fA`?srBw{ zr~2!Oei3q1AE8?)S9f8MyZWD26R)rFM6I=Xp~p`&D8OgEJJ`?`i>4`xxRX(CG(ucq zzG%l7@B(l6J{q@hIUiJep$>=pj}JJx+uk}poPU|_bS7EULjJ( zVuTxtle1d5$Fir?$?c&@U#U;Z4l@c{T7Um. + */ +package lastfm; + +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.util.Enumeration; +import java.util.Vector; + +import javax.microedition.io.Connector; +import javax.microedition.io.HttpConnection; + +/** + * @author Neill + * + */ +public class HTTPUtil { + + private static final String ENC_UTF8 = "UTF-8"; + + /** + * Returns a Vector of Strings representing the lines present in the byte + * array, separated by '\n' return feed. + * + * @param bytes + * @return + */ + public static Vector readLines(byte[] bytes) { + Vector lines = new Vector(); + if (bytes == null || bytes.length == 0) { + return lines; + } + StringBuffer line = new StringBuffer(); + for (int i = 0; i < bytes.length; i++) { + if (bytes[i] == '\n') { + lines.addElement(line.toString()); + line = new StringBuffer(); + } else { + // add to current line + line.append((char) bytes[i]); + } + } + + return lines; + } + + /** + * Encodes a parameter, also ensuring that it is UTF-8 + * + * @param s + * @return + * @throws UnsupportedEncodingException + */ + public static String encodeParam(String s) { + if (s == null) return null; + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < s.length(); i++) { + char ch = s.charAt(i); + switch (ch) { + default: + if (ch < '\200') { + sb.append(ch); + break; + } + if (ch > '\177' && ch < '\u0800') { + sb.append('%'); + sb.append(Integer.toHexString((ch >> 6 | 0xc0) + 256).substring(1)); + sb.append('%'); + sb.append(Integer.toHexString((ch & 0x3f | 0x80) + 256).substring(1)); + break; + } + if (ch > '\u07FF' && ch < '\0') { + sb.append('%'); + sb.append(Integer.toHexString((ch >> 12 | 0xe0) + 256).substring(1)); + sb.append('%'); + sb.append(Integer.toHexString((ch >> 6 & 0x3f | 0x80) + 256).substring(1)); + sb.append('%'); + sb.append(Integer.toHexString((ch & 0x3f | 0x80) + 256).substring(1)); + } + break; + case 0: //'\0' + case 32: sb.append("%20"); break;// ' ' + case 61: sb.append("%3d"); break;// '=' + case 43: sb.append("%2b"); break;// '+' + case 39: sb.append("%27"); break;// '\'' + case 46: sb.append("%2E"); break;// '.' + case 60: sb.append("%3c"); break;// '<' + case 62: sb.append("%3e"); break;// '>' + case 35: sb.append("%23"); break;// '#' + case 37: sb.append("%25"); break;// '%' + case 38: sb.append("%26"); break;// '&' + case 123:sb.append("%7b"); break;// '{' + case 125:sb.append("%7d"); break;// '}' + case 92: sb.append("%5c"); break;// '\\' + case 94: sb.append("%5e"); break;// '^' + case 126:sb.append("%73"); break;// '~' + case 91: sb.append("%5b"); break;// '[' + case 93: sb.append("%5d"); break;// ']' + case 58: sb.append("%3A"); break;// ':' + case 47: sb.append("%2F"); break;// '/' + case 63: sb.append("%3F"); break;// '?' + case 45: sb.append("%2D"); break;// '-' + case 33: sb.append("%21"); break;// '!' + case 59: sb.append("%3B"); break;// ';' + } + } + return sb.toString(); + /*if (s == null) { + return s; + } + + // encode as UTF-8 + String utf8Str; + try { + utf8Str = new String(s.getBytes(), ENC_UTF8); + } catch (UnsupportedEncodingException ex) { + utf8Str = s; + } + + StringBuffer sb = new StringBuffer(utf8Str.length() * 3); + char[] chars = utf8Str.toCharArray(); + int next; + + // encode the chars in the UTF-8 String + for (int i = 0; i < chars.length; i++) { + next = chars[i]; + + if ((next >= 0x30 && next <= 0x39) || // 0-9 + (next >= 0x41 && next <= 0x5A) || // A-Z + (next >= 0x61 && next <= 0x7A)) { // a-z + sb.append((char) next); + } else if ((next == 0xA0)) { // ' ' (whitespace) + sb.append('+'); + } else { // encode all other chars + sb.append("%"); + if (next <= 0xf) { + sb.append("0"); + } + sb.append(Integer.toHexString(next)); + } + } + return sb.toString();*/ + } + + /** + * Attempts to open a URL using the GET method over HTTP and read the + * response into a byte array. Any IOExceptions are simply thrown out of + * this method to be caught elsewhere. + * + * @param url + * @return + * @throws IOException + */ + public static byte[] getUrl(String url, String headerHostname) throws IOException { + HttpConnection conn = null; + try { + conn = (HttpConnection) Connector.open(url); + + // set the compulsory HTTP/1.1 Host: header, as GET + conn.setRequestMethod(HttpConnection.GET); + //if(!headerHostname.equals("")) + conn.setRequestProperty("Host", headerHostname); + + byte[] body = readHttpResponse(conn); + return body; + } finally { + closeHttpConnection(conn); + } + } + + /** + * Reads the response from the specified HTTP connection into a byte array. + * + * @param conn + * @return + * @throws IOException + */ + public static byte[] readHttpResponse(HttpConnection conn) throws IOException { + int rc = conn.getResponseCode(); + if (rc != HttpConnection.HTTP_OK) { + String msg = "HTTP response code not OK: " + rc; + throw new IOException(msg); + } + + // connect + int len = (int) conn.getLength(); + + InputStream is = null; + + try { + is = conn.openInputStream(); + + // read response + if (len > -1) { + byte[] body = new byte[len]; + int actual = 0; + int bytesread = 0; + + while ((bytesread != len) && (actual != -1)) { + actual = is.read(body, bytesread, len - bytesread); + bytesread += actual; + } + // do something + return body; + } else { + // read byte by byte...? + + Vector bytes = new Vector(); + Byte byteObj; + int next; + while ((next = is.read()) > -1) { + byteObj = new Byte((byte) next); + bytes.addElement(byteObj); + } + + byte[] body = new byte[bytes.size()]; + Enumeration e = bytes.elements(); + int i = 0; + while (e.hasMoreElements()) { + byteObj = (Byte) e.nextElement(); + body[i++] = byteObj.byteValue(); + } + + return body; + } + } finally { + if (is != null) { + try { + is.close(); + } catch (Exception e) { + } + } + } + } + + public static void closeHttpConnection(HttpConnection conn) { + if (conn != null) { + try { + conn.close(); + } catch (Exception e) {} + } + } +} diff --git a/src/lastfm/LastFMScrobbler.java b/src/lastfm/LastFMScrobbler.java new file mode 100644 index 0000000..d157842 --- /dev/null +++ b/src/lastfm/LastFMScrobbler.java @@ -0,0 +1,345 @@ +/** + * LastFMScrobbler.java + * + * This program is distributed under the terms of the GNU General Public + * License + * Copyright 2008 NJ Pearman + * + * This file is part of MobScrob. + * + * MobScrob is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * MobScrob is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with MobScrob. If not, see . + */ +package lastfm; + +import java.io.IOException; +import java.io.OutputStream; +import java.util.Vector; + +import javax.microedition.io.Connector; +import javax.microedition.io.HttpConnection; +import msapi.Track; + +/** + * Скробблинг LastFM + * @author Neill. Modding by aNNiMON + */ +public class LastFMScrobbler { + + /** Имя пользователя */ + private String login; + /** Кодированный пароль MD5 */ + private String passwordMD5; + /** ID клиента (tst) */ + private String clientId; + /** версия клиента (1.0) */ + private String clientVersion; + + /** Класс сессии*/ + private Session session; + /** Число ошибок*/ + private int failureCount; + /** Состояния (работа, завершение) */ + private boolean processing, shutdown; + + /** + * Конфигурация клиента отправителя + * @param clientId ID клиента (tst) + * @param clientVersion версия клиента (1.0) + * @param login имя пользователя + * @param passwordMD5 кодированный пароль MD5 + */ + public LastFMScrobbler(String clientId, String clientVersion, String login, String passwordMD5) { + this.clientId = clientId; + this.clientVersion = clientVersion; + this.login = login.toLowerCase(); + this.passwordMD5 = passwordMD5; + this.failureCount = 0; + } + + /** + * Кодирование строки в MD5-хэш + * @param string строка + * @return String хэшированная строка + */ + public static String md5(String string) { + return MD5.getHashString(string); + } + + /** + * "Рукопожатие". Используется для получение сессии. + * Используется протокол 1.2.1 + * @return true процесс завершен успешно + * @throws IOException + */ + public boolean handshake() throws Exception { + //Штамп времени + long timestamp = System.currentTimeMillis() / 1000; + //создаём ссылку handshake + StringBuffer urlSB = new StringBuffer(); + + urlSB.append("http://post.audioscrobbler.com/?hs=true&p=1.2.1&c=").append(clientId) + .append("&v=").append(clientVersion).append("&u=").append(login) + .append("&t=").append(timestamp).append("&a=").append( md5(passwordMD5 + timestamp) ); + String url = urlSB.toString(); + + //подключаемся по URL и получаем ответ + byte[] answer = HTTPUtil.getUrl(url, "post.audioscrobbler.com"); + //Считываем строки + Vector lines = HTTPUtil.readLines(answer); + //Первая строка - состояние (OK, BANNED, BADAUTH, BADTIME, FAILED) + String ok = (String) lines.elementAt(0); + if(ok.equals("OK")) { + //Получаем остальные строки + //ID сессии 17E61... + String sessionID = (String) lines.elementAt(1); + //Ссылка для nowPlaying http://post.audioscrobbler.com:80/np_1.2 + String nowPlayingUrl = (String) lines.elementAt(2); + //Ссылка для скробблинга трека http://post2.audioscrobbler.com:80/protocol_1.2 + String submitUrl = (String) lines.elementAt(3); + //Инициализируем сессию + session = new Session(sessionID, nowPlayingUrl, submitUrl); + }else throw new Exception(ok); + return true; + } + + /** + * Выполнить скробблинг + * @param track трек для скробблинга + * @param startTime время начала воспроизведения + */ + public void scrobble(Track track, long startTime) throws Exception { + HttpConnection http = null; + OutputStream os = null; + + try { + if (!validSession()) throw new Exception("Невозможно выполнить handshake"); + + processing = true; + //Получение данных трека для скробблинга + byte[] param = createSubmissionParams(track, startTime); + + //Получение ссылки для выполнения скробблинга + String submitUrl = session.submitUrl; + //Вырезка из ссылки хоста (без порта и http://) + String host = submitUrl.substring(7, submitUrl.lastIndexOf(':')); + //Подключение + http = (HttpConnection) Connector.open(session.submitUrl); + //Конфигурация подключения + http.setRequestMethod(HttpConnection.POST); + http.setRequestProperty("Host", host); + //http.setRequestProperty("User-Agent", "SEPlayerService"); + http.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); + http.setRequestProperty("Content-Length", String.valueOf(param.length)); + http.setRequestProperty("Accept", "*/*"); + http.setRequestProperty("Accept-Language", "en"); + + //Открытие потока для записи + os = http.openOutputStream(); + + //Запись данных + for (int i = 0; i < param.length; i++) { + os.write((int) param[i]); + } + + //Получение ответа от сервера + byte[] answer = HTTPUtil.readHttpResponse(http); + String responseStatus = new String(answer); + failureCount = 0; + //Неверная сессия + if (responseStatus.indexOf("BADSESSION") >= 0) { + session.invalidate(); + } + } catch (IOException ex) { + failureCount++; + String msg = "Ошибка скробблинга: " + ex.getMessage(); + if (failureCount > 2) { + session.invalidate(); + failureCount = 0; + } + throw new Exception(msg); + } finally { + if (os != null) { + try { + os.close(); + } catch (Exception e) {} + } + HTTPUtil.closeHttpConnection(http); + processing = false; + } + } + + /** + * Завершение работы скробблера + */ + public void shutdown() { + shutdown = true; + try { + while (processing) { + //Если выполняется скробблинг - ждём его завершения + Thread.sleep(5000); + } + } catch (InterruptedException e) {} + } + + /** + * Получение данных трека для скроббблинга + * @param track трек для скробблинга + * @param startTime время начала воспроизведения + * @return массив байт запроса + */ + private byte[] createSubmissionParams(Track track, long startTime) { + StringBuffer param = new StringBuffer(); + //ID сессии + param.append("s=").append(HTTPUtil.encodeParam(session.sessionID)).append('&'); + //Исполнитель + param.append("a%5b0%5d=").append(HTTPUtil.encodeParam(track.getArtist())).append('&'); + //Название трека + param.append("t%5b0%5d=").append(HTTPUtil.encodeParam(track.getTitle())).append('&'); + //Времени начала воспроизведения + param.append("i%5b0%5d=").append(startTime).append('&'); + //Ключ рекомендации + param.append("o%5b0%5d=P&"); + //Рейтинг + param.append("r%5b0%5d=&"); + //Длина трека в секундах + param.append("l%5b0%5d=").append((int)track.getDuration()).append('&'); + //Альбом + param.append("b%5b0%5d=").append(HTTPUtil.encodeParam(track.getAlbum())).append('&'); + //Номер трека + param.append("n%5b0%5d=&");//.append(track.getNumber()).append(""); + //MusicBrainz Track ID + param.append("m%5b0%5d="); + //Кодируем URL + String params = param.toString(); + byte[] paramBytes = params.getBytes(); + + return paramBytes; + } + + /** + * Проверка правильности сессии + * @return true - сессия валидна + */ + private boolean validSession() { + if (session == null || session.invalid()) { + while ((session == null || session.invalid()) && !shutdown) { + int retryTime = (session == null) ? 0 : session.getRetryWaitTime(); + //Ожидание до следующего handshake + //Ожидание 5 секунд при неуспешности + try { + Thread.sleep(retryTime); + } catch (Exception e) {} + + try { + if (handshake()) { + session.resetWaitTime(); + break; + } + } catch (Exception ex) { + if (session == null) { + session = new Session(); + } + session.increaseWaitTime(); + } + } + + if (session == null || session.invalid()) { + //Handshake не выполнен, невозможно заскробблить + return false; + } + } + //Сессия валидна + return true; + } + + /** + * Сессия подключения + * @author Neill + */ + private static class Session { + + private static final int ONE_MINUTE = 60 * 1000; + private static final int MAX_RETRY = 120 * ONE_MINUTE; + + private final String sessionID; + private final String nowPlayingUrl; + private final String submitUrl; + private int retryWaitTime; + private boolean invalid; + + /** + * Создаёт неправильную сессию с пустыми значениями + */ + public Session() { + this(null, null, null); + invalid = true; + } + + /** + * Создаёт сессию со значениями + * @param sessionID ID сессии + * @param nowPlayingUrl ссылка для nowPlaying + * @param submitUrl ссылка для скробблинга + */ + public Session(String sessionID, String nowPlayingUrl, String submitUrl) { + this.sessionID = sessionID; + this.nowPlayingUrl = nowPlayingUrl; + this.submitUrl = submitUrl; + this.retryWaitTime = 0; + invalid = false; + } + + /** + * Проверка валидности сессии + * @return true сессия неверная + */ + public boolean invalid() { + return invalid; + } + + /** + * Изменение состояния валидности + * сессии на неверную + */ + public void invalidate() { + invalid = true; + } + + /** + * Получение времени ожидания реконнекта + * @return время в миллисекундах + */ + public int getRetryWaitTime() { + return retryWaitTime; + } + + /** + * Увеличить время ожидания + */ + public void increaseWaitTime() { + if (retryWaitTime == 0) { + retryWaitTime = ONE_MINUTE; + } else if (retryWaitTime < MAX_RETRY) { + retryWaitTime *= 2; + } + } + + /** + * Сброс времени ожидания + */ + public void resetWaitTime() { + retryWaitTime = 0; + } + } +} \ No newline at end of file diff --git a/src/mobscrob/scrobbler/MD5.java b/src/lastfm/MD5.java similarity index 76% rename from src/mobscrob/scrobbler/MD5.java rename to src/lastfm/MD5.java index 398f80c..8c9cc5b 100644 --- a/src/mobscrob/scrobbler/MD5.java +++ b/src/lastfm/MD5.java @@ -22,7 +22,7 @@ * You should have received a copy of the GNU General Public License * along with MobScrob. If not, see . */ -package mobscrob.scrobbler; +package lastfm; import java.io.IOException; import java.io.InputStream; @@ -79,88 +79,6 @@ public class MD5 { return toHex(this.getHash()); } - /** - * Gets the MD5 hash of the given byte array. - * - * @param b byte array for which an MD5 hash is desired. - * @return Array of 16 bytes, the hash of all updated bytes. - * - * @since ostermillerutils 1.00.00 - */ - public static byte[] getHash(byte[] b) { - MD5 md5 = new MD5(); - md5.update(b); - return md5.getHash(); - } - - /** - * Gets the MD5 hash of the given byte array. - * - * @param b byte array for which an MD5 hash is desired. - * @return 32-character hex representation the data's MD5 hash. - * - * @since ostermillerutils 1.00.00 - */ - public static String getHashString(byte[] b) { - MD5 md5 = new MD5(); - md5.update(b); - return md5.getHashString(); - } - - /** - * Gets the MD5 hash the data on the given InputStream. - * - * @param in byte array for which an MD5 hash is desired. - * @return Array of 16 bytes, the hash of all updated bytes. - * @throws IOException if an I/O error occurs. - * - * @since ostermillerutils 1.00.00 - */ - public static byte[] getHash(InputStream in) throws IOException { - MD5 md5 = new MD5(); - byte[] buffer = new byte[1024]; - int read; - while ((read = in.read(buffer)) != -1) { - md5.update(buffer, read); - } - return md5.getHash(); - } - - /** - * Gets the MD5 hash the data on the given InputStream. - * - * @param in byte array for which an MD5 hash is desired. - * @return 32-character hex representation the data's MD5 hash. - * @throws IOException if an I/O error occurs. - * - * @since ostermillerutils 1.00.00 - */ - public static String getHashString(InputStream in) throws IOException { - MD5 md5 = new MD5(); - byte[] buffer = new byte[1024]; - int read; - while ((read = in.read(buffer)) != -1) { - md5.update(buffer, read); - } - return md5.getHashString(); - } - - /** - * Gets the MD5 hash of the given String. - * The string is converted to bytes using the current - * platform's default character encoding. - * - * @param s String for which an MD5 hash is desired. - * @return Array of 16 bytes, the hash of all updated bytes. - * - * @since ostermillerutils 1.00.00 - */ - public static byte[] getHash(String s) { - MD5 md5 = new MD5(); - md5.update(s); - return md5.getHash(); - } - /** * Gets the MD5 hash of the given String. * The string is converted to bytes using the current @@ -177,38 +95,6 @@ public class MD5 { return md5.getHashString(); } - /** - * Gets the MD5 hash of the given String. - * - * @param s String for which an MD5 hash is desired. - * @param enc The name of a supported character encoding. - * @return Array of 16 bytes, the hash of all updated bytes. - * @throws UnsupportedEncodingException If the named encoding is not supported. - * - * @since ostermillerutils 1.00.00 - */ - public static byte[] getHash(String s, String enc) throws UnsupportedEncodingException { - MD5 md5 = new MD5(); - md5.update(s, enc); - return md5.getHash(); - } - - /** - * Gets the MD5 hash of the given String. - * - * @param s String for which an MD5 hash is desired. - * @param enc The name of a supported character encoding. - * @return 32-character hex representation the data's MD5 hash. - * @throws UnsupportedEncodingException If the named encoding is not supported. - * - * @since ostermillerutils 1.00.00 - */ - public static String getHashString(String s, String enc) throws UnsupportedEncodingException { - MD5 md5 = new MD5(); - md5.update(s, enc); - return md5.getHashString(); - } - /** * Reset the MD5 sum to its initial state. * @@ -219,17 +105,6 @@ public class MD5 { finalState.valid = false; } - /** - * Returns 32-character hex representation of this hash. - * - * @return String representation of this object's hash. - * - * @since ostermillerutils 1.00.00 - */ - public String toString() { - return getHashString(); - } - /** * Update this hash with the given data. *

@@ -300,21 +175,6 @@ public class MD5 { update(workingState, buffer, offset, length); } - /** - * Update this hash with the given data. - *

- * If length bytes are not available to be hashed, as many bytes as - * possible will be hashed. - * - * @param buffer Array of bytes to be hashed. - * @param length number of bytes to hash. - * - * @since ostermillerutils 1.00.00 - */ - public void update(byte buffer[], int length) { - update(buffer, 0, length); - } - /** * Update this hash with the given data. * @@ -326,19 +186,6 @@ public class MD5 { update(buffer, 0, buffer.length); } - /** - * Updates this hash with a single byte. - * - * @param b byte to be hashed. - * - * @since ostermillerutils 1.00.00 - */ - public void update(byte b) { - byte buffer[] = new byte[1]; - buffer[0] = b; - update(buffer, 1); - } - /** * Update this hash with a String. * The string is converted to bytes using the current @@ -351,19 +198,6 @@ public class MD5 { public void update(String s) { update(s.getBytes()); } - - /** - * Update this hash with a String. - * - * @param s String to be hashed. - * @param enc The name of a supported character encoding. - * @throws UnsupportedEncodingException If the named encoding is not supported. - * - * @since ostermillerutils 1.00.00 - */ - public void update(String s, String enc) throws UnsupportedEncodingException { - update(s.getBytes(enc)); - } /** * The current state from which the hash sum * can be computed or updated. @@ -399,7 +233,7 @@ public class MD5 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0,}; + 0, 0, 0, 0, 0, 0, 0, 0}; /** * Contains internal state of the MD5 class. diff --git a/src/mobscrob/scrobbler/AudioScrobbler.java b/src/mobscrob/scrobbler/AudioScrobbler.java deleted file mode 100644 index 385bd56..0000000 --- a/src/mobscrob/scrobbler/AudioScrobbler.java +++ /dev/null @@ -1,276 +0,0 @@ -/* - * aNNiMON 2011 - * For more info visit http://annimon.com/ - */ -package mobscrob.scrobbler; - -import java.io.OutputStream; -import java.util.Calendar; -import java.util.Vector; -import javax.microedition.io.Connector; -import javax.microedition.io.HttpConnection; -import javax.microedition.lcdui.Image; - -/** - * - * @author aNNiMON - */ -public class AudioScrobbler { - - private Image avatarBitmap; - private String challenge; - private String clientId; - private String clientVersion; - private boolean connected = false; - private String handshakeUrl; - private String md5Response; - private String passwordMD5; - private String submitUrl; - private String user; - private static final String DEFAULT_HOST = "";//"post.audioscrobbler.com"; - - /* - * private void SubmitTrack() - * { - * if (this.LastFM[2] == string.Empty) - * { - * this.LastFM[2] = Audioscrobbler.GetPasswordMD5(this.LastFM[1]); - * } - * if (this.audioscrobbler == null) - * { - * this.audioscrobbler = new Audioscrobbler("opa", "0.1", this.LastFM[0], this.LastFM[2]); - * this.audioscrobbler.ConnectionFailed += new EventHandler(audioscrobbler_ConnectionFailed); - * this.audioscrobbler.Submitted += new EventHandler(this.audioscrobbler_Submitted); - * this.audioscrobbler.ConnectionEstablished += new EventHandler(audioscrobbler_ConnectionEstablished); - * } - * this.audioscrobbler.Connect(); - * } - * - * ((Audioscrobbler)sender).Submit(frmMain.CurrentTrackInfo[1], frmMain.CurrentTrackInfo[3], frmMain.CurrentTrackInfo[2], - * "1", frmMain.CurrentTrackLength / 1000); - */ - - //"opa", "0.1", this.LastFM[0], this.LastFM[2] - public AudioScrobbler(String clientId, String clientVersion, String user, String passwordMD5) { - this.clientId = clientId; - this.clientVersion = clientVersion; - this.user = user; - this.passwordMD5 = passwordMD5; - this.handshakeUrl = "http://post.audioscrobbler.com/?hs=true&p=1.1&c=" + this.clientId + "&v=" + this.clientVersion + "&u=" + this.user; - } - - private void connectNow() { - try { - this.avatarBitmap = null; - - byte[] body = HTTPUtil.getUrl(this.handshakeUrl, DEFAULT_HOST); - Vector lines = ByteUtil.readLines(body); - - // check is OK - String str = (String) lines.elementAt(0); - if (str.equals("UPTODATE") || str.startsWith("UPDATE")) - { - this.challenge = (String) lines.elementAt(1); - this.submitUrl = (String) lines.elementAt(2); - String s = this.passwordMD5 + this.challenge; - this.md5Response = MD5.getHashString(s).replace('-', '\0').toLowerCase(); - this.connected = true; - //ConnectionEstablished(this, new EventArgs()); - } - } catch (Exception ex) { - //ConnectionFailed(this, new EventArgs()); - } - } - - public void connect() { - Thread thread = new Thread(new Runnable() { - - public void run() { - connectNow(); - } - }); - thread.start(); - } - - private void downloadAvatar() { - String str = MD5.getHashString(this.user).replace('-', '\0').toLowerCase(); - try { - byte[] img = HTTPUtil.getUrl("http://static.last.fm/avatar/" + str + ".jpg/", ""); - this.avatarBitmap = Image.createImage(img, 0, img.length); - } catch (Exception ex) { - } - } - - public static String GetPasswordMD5(String password) { - return MD5.getHashString(password).replace('-', '\0').toLowerCase(); - } - - public void Submit(String artist, String song, String album, String musicBrainzId, int length) { - if (this.connected) { - final Submittor submittor = new Submittor(this.submitUrl, this.user, this.md5Response, artist, song, album, musicBrainzId, length, 3); - - Thread thread = new Thread(new Runnable() { - - public void run() { - submittor.execute(); - } - }); - thread.start(); - } - } - - public Image AvatarBitmap() { - return this.avatarBitmap; - } - - private class Submittor { - - private String album; - private String artist; - private int length; - private String musicBrainzId; - private String response; - private int retry; - private String song; - private String url; - private String user; - - public Submittor(String url, String user, String response, String artist, String song, String album, String musicBrainzId, int length, int retry) { - this.url = url; - this.user = user; - this.response = response; - this.artist = (retry == 0) ? HTTPUtil.encodeParam(artist) : artist; - this.song = (retry == 0) ? HTTPUtil.encodeParam(song) : song; - this.album = (retry == 0) ? HTTPUtil.encodeParam(album) : album; - this.musicBrainzId = musicBrainzId; - this.length = length; - this.retry = retry; - } - - private String getTime() { - StringBuffer sb = new StringBuffer(); - Calendar cal = Calendar.getInstance(); - int tmp; - //Год 2009-06-15 20:45:30Z - tmp = cal.get(Calendar.YEAR); - if (tmp <= 9) { - sb.append('0'); - } - sb.append(tmp); - sb.append('-'); - //Месяц - tmp = cal.get(Calendar.MONTH) + 1; - if (tmp <= 9) { - sb.append('0'); - } - sb.append(tmp); - sb.append('-'); - //День - tmp = cal.get(Calendar.DAY_OF_MONTH); - if (tmp <= 9) { - sb.append('0'); - } - sb.append(tmp); - sb.append(' '); - //Час - tmp = cal.get(Calendar.HOUR_OF_DAY); - if (tmp <= 9) { - sb.append('0'); - } - sb.append(tmp); - sb.append(':'); - //Минута - tmp = cal.get(Calendar.MINUTE); - if (tmp <= 9) { - sb.append('0'); - } - sb.append(tmp); - sb.append(':'); - //Секунда - tmp = cal.get(Calendar.SECOND); - if (tmp <= 9) { - sb.append('0'); - } - sb.append(tmp); - return sb.toString(); - } - - public void execute() { - HttpConnection conn = null; - OutputStream os = null; - try { - StringBuffer sb = new StringBuffer(); - sb.append("u=").append(this.user); //User - sb.append("&s=").append(this.response); //Session - sb.append("&a[0]=").append(this.artist); //Artist - sb.append("&t[0]=").append(this.song); //Title - sb.append("&b[0]=").append(this.album); //Album - sb.append("&m[0]=").append(this.musicBrainzId); //MusicBrainzId - - sb.append("&l[0]=").append(this.length); //Length (Duration) - sb.append("&i[0]=").append(getTime()); //Current Time - - byte[] bytes = sb.toString().getBytes("UTF-8"); - - // set up HTTP connection - conn = (HttpConnection) Connector.open(this.url); - conn.setRequestMethod(HttpConnection.POST); - conn.setRequestProperty("User-Agent", "SEPlayerService"); - conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); - conn.setRequestProperty("Content-Length", String.valueOf(bytes.length)); - // try opening output stream first - os = conn.openOutputStream(); - // try writing byte by byte - try { - os.write(bytes, 0, bytes.length); - } finally { - os.close(); - } - /*for (int i = 0; i < paramBytes.length; i++) { - os.write((int) paramBytes[i]); - }*/ - byte[] resp = HTTPUtil.readHttpResponse(conn); - Vector lines = ByteUtil.readLines(resp); - - try { - String str2 = (String) lines.elementAt(0); - int interval = 0; - String str3 = (String) lines.elementAt(1); - if ((str3 != null) && str3.startsWith("INTERVAL")) { - try { - interval = Integer.parseInt(str3.substring("INTERVAL ".length())); - } catch (Exception ex) { - } - } - if (str2.startsWith("FAILED")) { - this.retry(interval); - } else if (str2.startsWith("BADAUTH")) { - throw new Exception(); - } - } finally { - conn.close(); - } - } catch (Exception ex) { - } - } - - private void retry(int interval) { - if (this.retry <= 3) { - this.retry++; - try { - Thread.sleep((int) ((interval * this.retry) * 0x3e8)); - } catch (InterruptedException ex) { - } - final AudioScrobbler.Submittor submittor = new AudioScrobbler.Submittor(this.url, this.user, this.response, this.artist, this.song, this.album, this.musicBrainzId, this.length, this.retry); - - Thread thread = new Thread(new Runnable() { - - public void run() { - submittor.execute(); - } - }); - thread.start(); - } - } - } -} diff --git a/src/mobscrob/scrobbler/ByteUtil.java b/src/mobscrob/scrobbler/ByteUtil.java deleted file mode 100644 index cc5d563..0000000 --- a/src/mobscrob/scrobbler/ByteUtil.java +++ /dev/null @@ -1,79 +0,0 @@ -/** - * ByteUtil.java - * @date 30 Sep 2008 - * - * This program is distributed under the terms of the GNU General Public - * License - * Copyright 2008 NJ Pearman - * - * This file is part of MobScrob. - * - * MobScrob is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * MobScrob is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with MobScrob. If not, see . - */ -package mobscrob.scrobbler; - -import java.util.Vector; - -/** - * - */ -/** - * @author Neill - * - */ -public class ByteUtil { - - /** - * Utility class so private constructor - */ - private ByteUtil() { - } - - /** - * Returns a Vector of Strings representing the lines present in the byte - * array, separated by '\n' return feed. - * - * @param bytes - * @return - */ - public static Vector readLines(byte[] bytes) { - //final String methodName = "1"; - Vector lines = new Vector(); - if (bytes == null || bytes.length == 0) { - return lines; - } - StringBuffer line = new StringBuffer(); - for (int i = 0; i < bytes.length; i++) { - if (bytes[i] == '\n') { - lines.addElement(line.toString()); - line = new StringBuffer(); - } else { - // add to current line - line.append((char) bytes[i]); - } - } - - return lines; - } - - public static void replaceSpaceWithPlus(byte[] bytes) { - if (bytes != null) { - for (int i = 0; i < bytes.length; i++) { - if (bytes[i] == ' ') { - bytes[i] = '+'; - } - } - } - } -} diff --git a/src/mobscrob/scrobbler/HTTPUtil.java b/src/mobscrob/scrobbler/HTTPUtil.java deleted file mode 100644 index dc6cf52..0000000 --- a/src/mobscrob/scrobbler/HTTPUtil.java +++ /dev/null @@ -1,192 +0,0 @@ -/** - * HTTPUtil.java - * - * This program is distributed under the terms of the GNU General Public - * License - * Copyright 2008 NJ Pearman - * - * This file is part of MobScrob. - * - * MobScrob is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * MobScrob is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with MobScrob. If not, see . - */ -package mobscrob.scrobbler; - -import java.io.IOException; -import java.io.InputStream; -import java.io.UnsupportedEncodingException; -import java.util.Enumeration; -import java.util.Vector; - -import javax.microedition.io.Connector; -import javax.microedition.io.HttpConnection; - - -/** - * @author Neill - * - */ -public class HTTPUtil { - - private static final String ENC_UTF8 = "UTF-8"; - - public static final String HEADER_HOST = "Host"; - - private HTTPUtil() {} - - /** - * Encodes a parameter, also ensuring that it is UTF-8 - * - * @param s - * @return - * @throws UnsupportedEncodingException - */ - public static String encodeParam(String s) { - if (s == null) { - return s; - } - - // encode as UTF-8 - String utf8Str; - try { - utf8Str = new String(s.getBytes(), ENC_UTF8); - } catch (UnsupportedEncodingException ex) { - utf8Str = s; - } - - StringBuffer sb = new StringBuffer(utf8Str.length() * 3); - char[] chars = utf8Str.toCharArray(); - int next; - - // encode the chars in the UTF-8 String - for (int i = 0; i < chars.length; i++) { - next = chars[i]; - - if ((next >= 0x30 && next <= 0x39) || // 0-9 - (next >= 0x41 && next <= 0x5A) || // A-Z - (next >= 0x61 && next <= 0x7A)) { // a-z - sb.append((char) next); - } else if ((next == 0xA0)) { // ' ' (whitespace) - sb.append('+'); - } else { // encode all other chars - sb.append("%"); - if (next <= 0xf) - sb.append("0"); - sb.append(Integer.toHexString(next)); - } - } - return sb.toString(); - } - - /** - * Attempts to open a URL using the GET method over HTTP and read the - * response into a byte array. Any IOExceptions are simply thrown out of - * this method to be caught elsewhere. - * - * @param url - * @return - * @throws IOException - */ - public static byte[] getUrl(String url, String headerHostname) throws IOException { - HttpConnection conn = null; - try { - conn = (HttpConnection) Connector.open(url); - - // set the compulsory HTTP/1.1 Host: header, as GET - conn.setRequestMethod(HttpConnection.GET); - //if(!headerHostname.equals("")) - // conn.setRequestProperty(HEADER_HOST, headerHostname); - - byte[] body = readHttpResponse(conn); - return body; - } finally { - closeHttpConnection(conn); - } - } - - /** - * Reads the response from the specified HTTP connection into a byte array. - * - * @param conn - * @return - * @throws IOException - */ - public static byte[] readHttpResponse(HttpConnection conn) throws IOException { - final String methodName = "6"; - int rc = conn.getResponseCode(); - if (rc != HttpConnection.HTTP_OK) { - String msg = "HTTP response code not OK: " + rc; - throw new IOException(msg); - } - - String connHeader = conn.getHeaderField("Connection"); - - // connect - int len = (int) conn.getLength(); - - InputStream is = null; - - try { - is = conn.openInputStream(); - - // read response - if (len > -1) { - byte[] body = new byte[len]; - int actual = 0; - int bytesread = 0; - - while ((bytesread != len) && (actual != -1)) { - actual = is.read(body, bytesread, len - bytesread); - bytesread += actual; - } - // do something - return body; - } else { - // read byte by byte...? - - Vector bytes = new Vector(); - Byte byteObj; - int next; - while ((next = is.read()) > -1) { - byteObj = new Byte((byte) next); - bytes.addElement(byteObj); - } - - byte[] body = new byte[bytes.size()]; - Enumeration e = bytes.elements(); - int i = 0; - while (e.hasMoreElements()) { - byteObj = (Byte) e.nextElement(); - body[i++] = byteObj.byteValue(); - } - - return body; - } - } finally { - if (is != null) { - try { - is.close(); - } catch (Exception e) { - } - } - } - } - - public static void closeHttpConnection(HttpConnection conn) { - final String methodName = "7"; - if (conn != null) { - try { conn.close(); } - catch (Exception e) { } //log.error(methodName, "Unable to close HTTP connecton: " + e.getMessage(), e); } - } - } -} diff --git a/src/msapi/J2MEPlayer.java b/src/msapi/J2MEPlayer.java new file mode 100644 index 0000000..082d129 --- /dev/null +++ b/src/msapi/J2MEPlayer.java @@ -0,0 +1,57 @@ +/* + * aNNiMON 2011 + * For more info visit http://annimon.com/ + */ + +package msapi; + +/** + * + * @author aNNiMON + */ +public class J2MEPlayer implements SPlayer { + + public void play() { + } + + public void pause() { + } + + public void nextTrack() { + } + + public void prevTrack() { + } + + public void fastForward() { + } + + public void rewind() { + } + + public void skip(int i) { + } + + public void seek(int i) { + } + + public void updateTrackInfo() { + } + + public long getCurrentTime() { + return 10; + } + + public void playPause() { + } + + public Track getTrack() { + Track temp = new Track(); + temp.setArtist("Unknown artist"); + temp.setAlbum("Unknown album"); + temp.setTitle("Unknown title"); + temp.setDuration(100); + return temp; + } + +} diff --git a/src/msapi/MSPlayer.java b/src/msapi/MSPlayer.java new file mode 100644 index 0000000..78f9165 --- /dev/null +++ b/src/msapi/MSPlayer.java @@ -0,0 +1,156 @@ +/* + * aNNiMON 2011 + * For more info visit http://annimon.com/ + */ + +package msapi; + +import com.annimon.StringEncoder; +import com.sonyericsson.multimedia.ControlEvent; +import com.sonyericsson.multimedia.ControlException; +import com.sonyericsson.multimedia.Media; +import com.sonyericsson.multimedia.MetaData; +import com.sonyericsson.multimedia.MultimediaService; +import com.sonyericsson.multimedia.MultimediaServiceManager; +import com.sonyericsson.multimedia.control.MediaControl; +import com.sonyericsson.multimedia.control.MediaControlListener; +import javax.microedition.lcdui.Image; + +/** + * Стандартный плеер Sony Ericsson. Используется Multimedia Services API. + * @author aNNiMON + */ +public class MSPlayer implements MediaControlListener, SPlayer { + + private MultimediaService service; + private MediaControl mediaControl; + private Media media; + private Track track; + + public MSPlayer() { + service = MultimediaServiceManager.getMultimediaService("MediaPlayer"); + mediaControl = (MediaControl)service.getControl("MediaControl"); + mediaControl.addMediaControlListener(MSPlayer.this); + } + + public void mediaControlUpdate(int eventId, ControlEvent event) { + try { + switch (eventId) { + case MediaControlListener.PLAY: + case MediaControlListener.PAUSE: + case MediaControlListener.STOP: + case MediaControlListener.ENDPLAY: + case MediaControlListener.FASTFORWARD: + case MediaControlListener.REWIND: + this.media = (Media) event.getData(); + updateTrackInfo(); + break; + + case MediaControlListener.ERROR: + break; + } + } catch (Throwable t) {} + } + + private String getValue(MetaData metaData, String md) { + String data = metaData.getValue(md); + StringBuffer sb = new StringBuffer(); + for(int i=0; i + public void play() { + try { + mediaControl.play(); + } catch (ControlException ex) {} + } + + public void pause() { + try { + mediaControl.pause(); + } catch (ControlException ex) {} + } + + public void nextTrack() { + try { + mediaControl.next(); + } catch (ControlException ex) {} + } + + public void prevTrack() { + try { + mediaControl.prev(); + } catch (ControlException ex) {} + } + + public void fastForward() { + try { + mediaControl.fastForward(); + } catch (ControlException ex) {} + } + + public void rewind() { + try { + mediaControl.rewind(); + } catch (ControlException ex) {} + } + + public void skip(int i) { + try { + mediaControl.skip(i); + } catch (ControlException ex) {} + } + + public void seek(int i) { + try { + mediaControl.seek(i); + } catch (ControlException ex) {} + } + + public void updateTrackInfo() { + try { + MetaData data = media.getMetaData(); + if (data != null) { + + if (track == null || !track.getTitle().equals((String) getValue(data, MetaData.TITLE_KEY))) { + if (track == null) track = new Track(); + track.setAlbum((String) getValue(data, MetaData.ALBUM_KEY)); + track.setArtist((String) getValue(data, MetaData.ARTIST_KEY)); + track.setTitle((String) getValue(data, MetaData.TITLE_KEY)); + track.setDuration(media.getDuration()); + + byte[] alb = data.getAlbumArt(); + if (alb != null) { + track.setCover(Image.createImage(alb, 0, alb.length)); + } else { + track.setCover(null); + } + } + } + } catch (Exception e) {} + } + + public Track getTrack() { + return track; + } + + public long getCurrentTime() { + return media.getMediaTime(); + } + + public void playPause() { + try { + if (mediaControl.getState() == mediaControl.STATE_PLAY) pause(); + else play(); + } catch (ControlException ex) { + play(); + } + } + // + + + +} diff --git a/src/msapi/SPlayer.java b/src/msapi/SPlayer.java new file mode 100644 index 0000000..f40f37b --- /dev/null +++ b/src/msapi/SPlayer.java @@ -0,0 +1,37 @@ +/* + * aNNiMON 2011 + * For more info visit http://annimon.com/ + */ + +package msapi; + +/** + * + * @author aNNiMON + */ +public interface SPlayer { + + public abstract void play(); + + public abstract void pause(); + + public abstract void nextTrack(); + + public abstract void prevTrack(); + + public abstract void fastForward(); + + public abstract void rewind(); + + public abstract void skip(int i); + + public abstract void seek(int i); + + public abstract void updateTrackInfo(); + + public abstract Track getTrack(); + + public abstract long getCurrentTime(); + + public abstract void playPause(); +} diff --git a/src/msapi/Track.java b/src/msapi/Track.java new file mode 100644 index 0000000..8d5bc78 --- /dev/null +++ b/src/msapi/Track.java @@ -0,0 +1,79 @@ +/* + * aNNiMON 2011 + * For more info visit http://annimon.com/ + */ + +package msapi; + +import javax.microedition.lcdui.Image; + +/** + * Трек + * @author aNNiMON + */ +public class Track { + + // + /** Название альбома */ + private String album; + + /** Исполнитель */ + private String artist; + + /** Картинка альбома */ + private Image cover; + + /** Длительность */ + private long duration; + + /** Заголовок */ + private String title; + // + + // + public String getAlbum() { + return album; + } + + public String getArtist() { + return artist; + } + + public Image getCover() { + return cover; + } + + public long getDuration() { + return duration; + } + + public String getTitle() { + return title; + } + + // + + // + public void setAlbum(String album) { + this.album = album; + } + + public void setArtist(String artist) { + this.artist = artist; + } + + public void setCover(Image cover) { + this.cover = cover; + } + + public void setDuration(long duration) { + this.duration = duration; + } + + public void setTitle(String title) { + this.title = title; + } + + // + +} diff --git a/src/newfile b/src/newfile deleted file mode 100644 index 2212995..0000000 --- a/src/newfile +++ /dev/null @@ -1,2 +0,0 @@ -визуализация смены громкости -Быстрая перемотка \ No newline at end of file diff --git a/src/res/1.swf b/src/res/1.swf new file mode 100644 index 0000000000000000000000000000000000000000..1e65547ef8add94d59bc674f75efb487a0fa7900 GIT binary patch literal 4930 zcmV-I6TR$1S5pT9F#rH~ob6f(TvNx^pCp8YeP3iza0SE#6c=y_AVtJ4^i2;<=X*$zam4#=rZQJ+R-OE#J4`Z(UsB!Wy4yMnlO-|*hewb4@**Yo(YJo{&b(>#<*)|mjSIao01t2?kCxKFvuDo;Wxt}8*TQ|QE>%zG z2N6?%Y&ZoY#P&WPb))BQb*(6lm;)SvR*n3hO>NtKK4^54ysElEH3c0I*El}9VQ4NE zva*kO_H$gpW6wM9MOUivGP3n*|0(bChRIjXR^HkyYod%=CB}EimaU%`A75SlV45i< zpE$g2!6_q=*{EHIH)ax3h=AUhAjaPCfLDAjH3zWDPdy3#`V|jd)2_{GjXRKX7}}i#?drlrSXzA0tp?V?;yK^1^j952 z|J3D+e^djjKXBlC%W|@e+4Gh*c7h(gXsFGC`YUvGb)gjC06Gg%IxxG4(jh1YL?2NM z)tHXf7*k`64vj$yK-;PC%7%kSbgkjjXc}|`ZX(Qk0Anmj5G5u;$pT$H8fH�NR|y z7dT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Km4$f%C$Bp|@B zKut~E-qIP!XzRk)_7bjCd$en?h+~p-AG51=oz$*8Gq^>&CPc8pg#nC;CkKI|6-7={ z{*@<7X$qdV@A8zbm!vg8tR@>IbIh$9!7P3@4=i2c(KmhHH+FuP=2D*OsvXKY3%>1$ zr8aH42hYUexCycKa_4fK7j$E`XvZ~?ea_pq6~+VSgTOK}wL|Q>ny(sX`A9d(9R~R& z*R?YnF=z9zLtQG86Xyh^@4SxpPp3cqgXq5#MdWj@bz&}Zwl`O&bk?LVC@4O>v&B%9 zhA(Jqv)w;s$sU-;q@J5myE_beZ+vuqI~Cion1Cp=jr8oE8h!3N5ECArbZZHv?UN%S zQn{+eACC=FYt6BQi)1n(FS~N3{TqGo^|-Sm#dN|N-GAn1R)fhsUpS?%W&JXc*oAqp zG&14vMi6=ngl-8Eqp8xelPZ5|tYxL=u{7v|q0>>1%aWsKx};wC@Y6{pU5aW3%&>45 zfHIMgP2T4LoNa3XO=^Hgp4wi)*WLY4>fy+>>34x6T@wE@k*K!`xvUx>AABENy1xdi z@)AC6uab`lQ literal 0 HcmV?d00001 diff --git a/src/res/artist.png b/src/res/artist.png deleted file mode 100644 index 4188fffc58bf03d3fcb99167ba9c88db3b1cb9a6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 587 zcmV-R0<`^!P)C$7 zQaxypWw{RT9^n3}kO#r7S}-_x^zU#IOlewZNMX!NA8?!{90dq9Z*6Ukl*?s5I0i@b zOg7phAE#MWtE$?S%VrlLkO8-xOd)41DT>-HimTP1X7?(lC`wPMSX_p{1$f|GTwj%z zA=U#iXQjfiiZR8T)DwRokODWHR8rTc8Ds6#Q-?iU6(mV+46dyWpQO_pPmd1;;v|#a zAR8vz=(J~UP>V7H1FIFbV{++F6H<_Q>bMBf|TI5}7v=iHxGG5I8ptfSyC) zaCnrx91)MXZ*O`?FLW>i0e?S&7|4Qq@Wi?2HZ|b)571#YXJ-|2L#!zp-TjS#B+tgW z?r0Eu(cN+Qw$LrHE3*;~zY>Yq3<6HU<2zzxJJS>KIpt-lf~^>O(WdM1c?z(UXfBn+ z7MLt|P>*dVNmnHn`#X++eUJksaLp-k+kQNDFhNy(l-ctDwzoI?^0~{|V%}J}${W5S z2hS?m4C8W^d@z8Yw#Vc3XwdJ5?k4E<`Fwq5$VPkQV?7#nf&zD>`}e~_4c`;K{j+qs Z{sV(;XUf0D?Ee4&002ovPDHLkV1jR}1?K<& diff --git a/src/res/artist.xid b/src/res/artist.xid new file mode 100644 index 0000000000000000000000000000000000000000..ed60172bd71dd5c6c4834bae21220f8bedd6bb45 GIT binary patch literal 589 zcmV-T0f=g0oF{Lv{9}G4Ggtx`(wq-KL^#=+NhL=4j zR6Zq2ALkOzd6;RJiQVULw%RR6PY;8b2W2}REgwG?yF6$I>r!iSe?k}<8u{bA5=c*R zFoQcmtyE~xE+X9Bt>U~9U{>dL!0S6!5L;gTty=xuqUaHTUD01XINmQS@wajhmn$nM z;^9`IbVd-;wZ{EMvh1T|2v_HIK)!S!JKzjG- zG?oVsp-v_vpc}l!70pnDLoWpMs7H3K73C43iW}Z2|Rl0Mm?sv^9FDWXX!e b1I>wa^coPo$g-P=cXxMpJ~BBo*)kZE?%V0LEwKN z;VF^u;z861F{oT6tf<`b2c&H8FMbwg#~E|Cffvj?&okfW`}~>-1paa5^ZA3ghzoWf z_}_~lF}%eb&X*IwGCGH&2;vGB#qL9Bz!_BT706ybfqqQm7Q#qk30d7+o9CFqT^#cZ zScjKb$4?A+1Wcg{!;W@Ot;`+lFdpJJKH&jsRF_n+LcpMg{21TlX3_9@XvGSCAY++1 z>Qc@O9py(bgq#+w#hINAVM{|k?#jL>Ls#8djO*P#9I(PTJ}SFw9&?+(dx^X1Y{l>4 z4<^uPg&mqZOFQNfFoG_Lc+}f;ebKaBwt^e#;T2B$?0^d6Q`d}nt@u?d=+PXEp|*^J z(BcS~b`JTS^;Sl}HfNWF-n9$VXapN-Xs4!I8$T*Z zeT7D~kU1T{D!-oV)$?+G=gR4X*o05wg92@7tMqyXa|I6TLux%QDBDeC{uQ(8^ioN` m1O>MLNE+8Q{B|_$73eQ39YC&)&6?8y0000?3%wwwcwwwbqwww1ў№Яwwvњ>36#­Тўёf­фР#хKЈЦт5Т,fурY)У№6—W–^懕6ЈFЯ+RЫЯ«…pУX a°nАц`»KёDЁђЊ‹н~s‰’„ЋфПя|hЏЁьWFЛІk№аd·EMрФ•}aІ™4·n#™bї)Iц ;”aµ?~.Є,мђпµ*k„|/ра/°8{s;Ц}ґщ8Ъ»j›Gi•@I–v#а#З5·Чс‹oЁ“¦‡І} WоNќ%№{j’0GулaЪІокz<4I™ЅЙ_4 Є.ыњЄIkЗµOI]Мiм· юМќІ–xQ§тjнL +т1ВзNjИ]Ийњў„ ђЅћуЇу8•фuЬѓ qryњ4JX_¬:‰bДќѓ%>ИsrБ€?m B‹CљbџX\j7Щъєн¤wwww>293Щ5х \ No newline at end of file diff --git a/src/res/icon.png b/src/res/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..67fbfe8101e4a523b65e5a588f5737bea5258e6e GIT binary patch literal 1087 zcmV-F1i<@=P)Xq68w z!AIf;zaVO2P>}@nlk$O}Z52xlAtkN$wQRS$o!vXnJLAlhU2RetPjY4^Gxz@Hoc}rZ z5UgOQFP^p6aS0L(1|bN7@6#;fY;9`gZnlRk_ww5_=bY+T2;p!T9;^%$MX|C*V-6Z> z*N_!~yL-F19nBpq7K>q3yasJAKMqD1E}tAlKp^0G9)u7$jswOROw&Xnks!+gcfPfc z+ur;rlVU*}{O~Y{$OFQS%p73slS|+@&Uf3keYY$Nnx-v*3gw4~lMk@hPQDF2tYiAC zaWuSiCwR%gmd&>!YfwLB59UQ!hI;17Ff}#h)YaAbP(OseqsJUO#6e3i$g9J+?bS^f z9{2%=p6S5)HFfxI&(}W0OZmU|vU@)pyLQ#7M9A?rdVcPQ91lPY2k_z(PvOVR2%1yd zP&GRY(FuTXOZ6{DT7i?rWQ8N|yzY46OVu*uDjC~a8sS93cy4XGzhE|Yw_gO$%QmTJ zao?f)@#hCa;2fc%>4ni>Z9$~29#I=|L_#nWfa)-0Xr{6`V8md{wjYtkQ9Sr*C+Ocf zS6>mSjyoW%3Sy-HyblyKHxaM=p6^-RiEvaxQCE>E=3p`d6B84DYk1Z4#1E4we%pHn zf!2q>t*ZxIs2mirxoay7!|>M$-o^7M4Psw>7vh09s_kn0@%tzuk%+HRO-;=b{Vuij z0c}9y`Hi4C1$-6nw~wl-;5^tj(Q{zB0bSSq50p~>qe|zIOeUAW-njBP)(>t+?f$!9 zP3I75h`N>FD|_6uHMEbn;ry1L5RXT2Vdxr!R6Rx>`(g>G<@*CrT?zQ{IcT#K=8OVR z%hh(V;vP_OwdYP8J3)#lK;k(>xgZwiEGX9(e8`tG7twsG6HUh-f&R-7*w_q;Sp`m3 z1yfwjOb7Oj4k#1~cy`C$#pbb03-!Z|5ZhI}yMGss419!J-fVSS!US=vZZr3oQMY&{ z3oLJdtcbr)#_0ugb#=VPdsGoa)1pnoYSO;G5Q zMVONmc80=IbgbQ(f^NFOSPpjI`y{%%yZ=3Up5^&GPtWqWuFPRNKZeix`ykJoFeWvy zsS>Oi14dp)QC86S!bb2#;s#*il??}QC3}@$c6_A|cX5IpVk|(>^mHv$rXi~pP*6*l z*Hq+7DvFv8bwS4_au05|8?aEy@<)5#w^tmn>2%tWBniAoptLB+NEyiaFdB0y1S|=* zJI}m!>+S6&|7&8G?O?jw;e=pi0C?>oa2ERB8@TDde*hWD;75z~Si=AS002ovPDHLk FV1i`n{VV_g literal 0 HcmV?d00001 diff --git a/src/res/pal.png b/src/res/pal.png deleted file mode 100644 index ac347c5e6896bd83b74cb9ec0fed52164c634e21..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1152 zcmV-`1b_R9P)Nkl8kdB8cAZCu3Qfk%#%6rY}2;kKLa!)?Huv%P(_3svPX_?Xel_+SWauGF~vG`k;F1 z)H%xzl;s1djCFfvNXD`>ORn-aRPs_&cD@G>l~v6vot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74*W1W4U$n}?dlZk(;5O6f%@N7Ieh z4V|M-ym{l2bl&>{3=u!E#X~&Vg+L>PB_sjKaCqV(x?Jk&lFH(4oUOah=!whUI2rXx z77AsoCX#^7`h&hN;SrPRC}MbAXkD4&3e%#}+od{^`p6C3NzMGUl|Se( z5Wg>=5xy3Uc(}pgx;lA_o=XA(fYKZYYO&j@D2N#0Ytd*Oy1bgrflB6xmj6m<8G_tIw>Zfq{D=LcG??PdTDPkYVYQ&3C7i(U;2WvsS%<1J&SBQ}$ z*kGV45^k63(1EJwbWqpJ8R&u{h=sK5(dJeF;sTJF42+41Ac3FoI_O;7Skb)ah}4+z zKqShY@|lhRv^e9UD2ROppM^jt^YHO2U3{$S-x@@U{6Adk;BQlQ$H@QiK0uG~7ssPf z^a%I1ST9Fbi!bRQ+wW%yTOtxVe@NpX5;}iK{cdHIHkLZwpU<=+tTS_BA@K!~oUjO4${?k8TGCtL$GS0-o&%iqaP(IMaDbGwk7~tBY zS(96t)6C>4y{RqB|67?U>(gLZ1I?t$D?25tBAhKc2G~5W5LB#F0&^-^sGy=PzqQ?YflV{y>XF79U!MRs9 zAVfUpGe8=$9p8T<2!C!~!e>(MK2vx9H}!6}&4R^b624b1Wq(9gwtpOEF$Y&Zns`9D z?>#3yz4K7(bHu!$NCJSXj*wVP!c;BccG&jYx*qX!-*Q+Pdr)0=dEbKIHhyLM@4fB4?Y-^2?Y-^2?Y-^24L2@`cemfK UZvn*z$ai;lcRn&XGubs4^@*BCyZ`_I literal 0 HcmV?d00001 diff --git a/src/res/pound.png b/src/res/pound.png deleted file mode 100644 index c06391cc6cf190e41484bd9a85876ada65afcf63..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 930 zcmV;T16}-yP)j zTD25MDNZe`xkQ)Ryyl$S-RF3r$W=B9o0F>$*z|wq`F~{7=x%;TEyRFgl2QhI`VD z)bxmQb7r7Fe{O_SDh?D+WmD9WdY-oE)w4oVYUB6eC|Q@=2|PQj;p^joZTL`L3};`- zYbp#@N)wg6JP>57-Ar9+Ja%YCFnERZVM_a-r@&s`tFvJ)x69&jgv>T0**z@12D*Xq zFI~N(U7VxJc2SIqR5twuy-=IDaw=LEve-@NjlBMZub#2~)BqUDVso+#zi(s>eMif; zFM&0-8`_Z*j^kxuuvL)U!_wj(w-bY0_z{t z_x{xSqlsSV#hSwhJ+&loG)nk-99X)Bq>}TG5|_a_9IeV?Gf~xTg?o5g(x@TgM8btr zrIAjf(mB{#0eh55*TY|!)8#<4S^wF@G71c?#2^t5jmciOKyRFo z@$$#v_qh$7cj7srL~=D1LnRKEUCda1<}p@U4q$>DLZ0s61~|s@Q{VD|?YD774=;aF z$)f9JQQnyiBsr}+9HS3 zE^d@PK)3`P45mt}L=*HF2lkYK-I=y#6%Pze_MhL-aZfm=S9voabVGf2n{Q+ZJh#l^ zi$N{&XUOJYkq$=(sY5R-)e3KYZ!}%n=o{(h@3MD{g|6Y{YU!<;7~Hz)-12$chWJBW zGBiBiX|)&HM|}F~eMbhQ`Bs~m931a^5qf$t2feSwhh%jE3_KM%CDMEKl6tjEAH)8))VK~W582CRA z#{Fhd;ao3aLT*&#uGHYQb3U2jCj$evr39^j`7clJFIT77`!d}0_5c6?07*qoM6N<$ Ef`;b6Jpcdz diff --git a/src/res/pound.xid b/src/res/pound.xid new file mode 100644 index 0000000000000000000000000000000000000000..acaf4a8edcfd00c04ace1f3f9d4ead4211d85ad8 GIT binary patch literal 932 zcmV;V16%x}1O6vDFnWD$eRp?vdOklhC3kmsVRv_TWq)yZcXudKSz32@bRIr4HX{$M z+T#pABqndS;A7)4KW8>)fiNTgA5qlcRxf5gCq5PRBQYl#VApnVABBg9FK&neEb#FltY$gzA_J$e0Gn40H7^vB{O^ zLLzF8&Uj3Ggq1y@aD0iNZ$M}C8NhrxIXPA2`c|CHJbb|sSSpJ+r@5A4#<53D{|oU9 zrTU|T{{;jQ*GLE%^CMk(V>l8dqvZ|h!JneUH6$IBfR6l=m8sCnt^B6WpphDjrJ#A2CM{@`DyVjOfs}DXHAV7Foc&l?L;>K~%0vTgq|G z_J&w0%G4_B)V%>F`~4$9igL;)?9T;VEnvm3I-mN>iSyX$#)+eMZ@m=+#e2vY6M70T zyueuYLcwgU=46vVdK<%~El2Zq(idtWjfIq`-cqWm$$y-FPZY-|Z3!sSBweNHYe;pR zXrq9Mqm9)5DW9_Kv~WtoQwKvmj}2=t&GFOag!pCPwoYr>y%j_zq8joH4=knMR+Tfg z@+8vcAgSfk7?xwEZZ-*Lb~B|;uPt^A<36CYDDR|_H^VN7uCqmbd)c#BW_bF(DZn=v z>*t1ru$F+%dg=g`PS!I8LSi&hdEhF$FA0%GAuV|q^=mchnU`@-v4te4h4z}j1~Pb9 z2qwPOoD!03bLm0ewE?=v*&bZ_vUyK`Ic^qimOl=`DmwZTjr9!vnZd1r#dRs6ZKDv& zJsXFunZwHW{|4P<-j!0|Ni%#X<)#Ot`SxLk=<4%Cqno(;fA#`76uq4$1yBAYpZcv; z@T6H8<4QNrb8CCiJ=`;7gKuzw9SX`og7z!9eDy^Svo{*Tu0Q>UUmXaNw+U#$u&7P};4y*Bx zG%7_yOR1B$&j4n*bsiqVV689F#xAvo9s=Fr z;o~;*M;=7-2Oi5O2jK@wUFAsZDGHsVsr&y&DdB48ug&-VQLzxWvf{>$3Wo97=7)W+cH>gTe~DWM4f^F<;% diff --git a/src/res/sb.xid b/src/res/sb.xid new file mode 100644 index 0000000000000000000000000000000000000000..923439fdabcfdb9497b95b90adb81fd3ec1c48df GIT binary patch literal 102 zcmYdc_@{1ZP*s~-TV7sXWoK`!3Z%<`xTd}kNS^#TVFr+ju`@PP=3gt)-`mo{@o`7T z%1(jzeSta^#_PZRPfu5?4=|mc%2<6sVnuI7xq3&I$IF)%8bEF3c1D)QH%-OA0s!BJ BESCTP literal 0 HcmV?d00001 diff --git a/src/res/sbl.png b/src/res/sbl.png deleted file mode 100644 index 8e50f2b5035f916ee323f30d479d13821a8ffac5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 231 zcmVMb#A hPhCH<>Gthg{{iLCk7`lSUp)W-002ovPDHLkV1fquZ|nd7 diff --git a/src/res/sbl.xid b/src/res/sbl.xid new file mode 100644 index 0000000000000000000000000000000000000000..03ee851609589d47089f8262eab4ffaf9d0b003b GIT binary patch literal 233 zcmV}mGvv;e_cjE#hZ2yxfmVuNU zi0DfS^B7BQgq6Cah#08Jdc>-ElR4DBaNPMS%nEW*)^KGLbC#W2 jMjSXQNX4FknkmqOQ$e8Pds8NV3<-1d41jPDh8pA1N9L64^{h?R#&qx0Q79z7X29z}?0CHk- zSPypme_EeaavCNltnWj^<+JCnQC8YgZu>q_x;v5Oju45APO##qN!$R0%gk_=VJQua zFD#(+>No* zX)cVG#F$`^ShyL5?T}kLx+2;6x!bDmD~EqDTB)Q3v&B64z^UpB%+j}zBNe)N62c*N?KMOKI0P&T3y=4huk6uh54NF*>yjr+#{x3aKkIDF#*@v zq%lY|XiNd0yN$A943s_DYoWa*)cw|){-NH!UmTkn{Cts}tUTd*c0K+zHX=s}r1Cw; zLl_afjDM{5*Fk442q;7L*ObD9?!t?x?6Nwm^D;zq+_((>2j|mHhW<0YUnRE+@g2T( zeigz|RabZHqd%7nKkqpUu(ICRSRpao)D3RPkvtsgT4{;jVa-^TWF;!6{Ch%Pw{DE)@46`hEY<^wCX zm@f$1I3aYzK@c?4Qt_$rP!jv}24FNb0{l#cpPf*ShFs8yU8@0icSnZ?SmB-8&}=iE z673f>4a{*hJ%=HR>&`R`kmy9NqP}=x8N7~2;fA$&JJbglcXxMpJ~BBo*)gK_@8`ih_b|Noz_Fvs$K^z_6F3@Ou7&wMPC4AI-oUmW?%CqFSJ>By_4i%##W z{qaej>(a97>HsY_>FG=T4sJ1QbuqlPLnl>8Oj^Ki;3h$9z*!3XE jW18Nf<$62s&lY5`+$-i`!7h0i=oSV~S3j3^P6+psF^vw!FN&%Ff z&%1K^^77)#UYz9M@9XI3coF{EZ-veSvE}8$4}^BNG3F^po~dBb>$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res/track.xid new file mode 100644 index 0000000000000000000000000000000000000000..26169e6b3d3a5dabab9320cc75e0258a38d7d5a0 GIT binary patch literal 805 zcmV+=1KRu}1O6vDFnWD$eRp?vdOklhC3kmsWOsLWWPfpYcXtIRLA!T%b)7ylHX{$M z`XekjZ8l>O0We|bs*+WgRiP#9!}>844LsYS!#*gA#>s)cqeBYU-Y+cd{W@*@p*$wH z5+<*z32=Em=WtL?Ohgd5noNYc{kP}F!NJiNeKjB9Q{CP9a|=i_4QOaK@KvXW@+BC+ zta=+tMqB^YUv5tq)M^W?Tu^YuSdIgcqn$7g4A49)J>^Tryog}c_tXnvFgFH52 z6M`O^HC-&Sm66CjlKh;_aL@PAC*u!WVJtRB)NDWhDW?|V=5jX8)fZ!ba>{@ThNMdrc!Mz_KGOGFzZY5ic;u!+>;Ui8Loj8ZnLtC2tj?!J0I?x;Yf)LhHDY1TUymfkaE4HM|6@LMPRIwJA^eD)PCJQ&SMv12#s5B{rfrQ_$t_#7#U(fEt;W0!TLG4 z=b}kpXp8N~+cgDSGGeAg-fC!Q7-Gm77?;a4?wkUwDTv3$cvEf#^ND}Opbil#X#owS z_lAHqmIOC^9!LX=+F6_Y-J~0t1=nN^O>^RE^nYK+$&)E&-M5{c9e|L34L?y+ir7;b j$9@#>ynw$)2k?ey32;q&B9`~;cXxMpJ~BBo*)0E literal 0 HcmV?d00001 diff --git a/src/res/zero.png b/src/res/zero.png deleted file mode 100644 index 39bbcf2455e96b43726e2310dee42b23cd5e641f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 504 zcmV72|P_QV(Z{ES4)@4Vh^ezQr5WW1^w0;m?aeVqj7#oB^@*uILM<@3#0pg`lwF?jR zcUG@Tim|8{Vq{2~i3n3zxZ(?6WI1#;C``+i0mC$Q3iZPD`>${B3m4KdOmpXk_|4x3 zOs9u|=@JbuIS5RjAo|c0FunZn^obxb5Fbth@uGv1x+|9^#h8@?!!&U+FigJ^PN&4k z|M>O&f5`%1n8x%0!}JT4(&?}7AM@wXDopiqc-XS02l>p~-PgYKz_k8F`+#W=NH5+u zr5A)jd}JCV2UEA~!1Re=@%>YJ7wnnPS-v1K%D4a+rty8QLLa`8m-jK!DKJcn=ENv7 zM0VQqzyI!HY-v*Rgeam4sEv*C4;7ZqGMI_Q5Sbfmyk8_VEc@ zDQRi9H$*4LU$Ypgw&|e~FwlcpausLFi?728XDJ2?jWcg-^EQQ7#?mlQfLV5x(kH@v zc!B^S*ggHm-(VFJKkfd1BrngEd?*u613_Oqyy14VLjiq)wS$b<7?^xurA0dgknxYY zsBk;b@b;c%dRR_>JLp%9r(;LTi-&{$S4L-OIdq2A^yJN4;8C*g;&ik_21Q3Z$YnXu zv%iRsf{F;fbr#3fVPi$>rdHMx|ayJN%Ke zUqmwjt%S&kg<_6MNCO7Q0nk%cgm0#7S%~KYmenuwidth) menuwidth = mfwc.stringWidth(m[i]); + } + menuwidth+=6; + } + + public void paint(Graphics g) { + //Выбор визуализации + if(vis) choiceVisual(g, Rms.visid); + else if(skin) choiceSkin(g, cx, cy); + //Переключение режимов (all, visual) + else if (animated != null && old != null) { + g.drawImage(old, w/2, h/2, Graphics.HCENTER | Graphics.VCENTER); + animated.paint(g, w/2, h/2, Graphics.HCENTER | Graphics.VCENTER); + if (animated.isEnded()) animated = null; + }else drawCanvas(g); + repaint(); + } + + public void drawCanvas(Graphics g) { + if(mode==PLAYER_MODE) drawPlayerCanvas(G); + else if(mode==VISUAL_MODE) drawVisual(G); + g.drawImage(I, 0, 0, 20); + //Меню + if(menuup!=0) { + if(menuup>0) { + menuy-=MENU_Y_STEP; + if(menuy<=2*im.statusBarHeight-menuheight) { + menu = false; + menuup=0; + } + } else { + menuy+=MENU_Y_STEP; + if(menuy>=2*im.statusBarHeight) { + menu = true; + menuup=0; + } + } + drawMenu(g, mcur, menuy); + }else if(menu) drawMenu(g, mcur, menuy); + //Визуализации изменения громкости + if(volumeplus>0) { + GraphicsUtil.drawRect(g, Skin.volumeUp, Skin.volumeDn, 0, volumeplus-20, w, 20); + GraphicsUtil.drawRect(g, Skin.volumeDn, Skin.volumeUp, 0, volumeplus, w, 20); + volumeplus-=VOLUME_Y_STEP; + } + if(volumeminusih) album = Effects.Resize(album, ih*album.getWidth()/album.getHeight(), ih); + g.drawImage(album, w/2, h/2, 3); + }else if(Rms.vis){ + visual.setDimension(w, ih); + g.drawImage(visual.getImage(), w/2, h/2, 3); + } + if(Rms.isLyric && lrc!=null) { + try { + GraphicsUtil.drawCenter(g, lrc.get5Lines((int) getPlayer().getCurrentTime())); + } catch (Exception e) {} + } + g.setColor(Skin.valuet); + g.drawString(current.getTitle(), 9, 2, 20); + //drawSoft(g); + } + + private void drawPlayerCanvas(Graphics g) { + g.setColor(Skin.background); + g.fillRect(0, 0, w, h); + GraphicsUtil.drawTitle(g, Util.getTime(), im, mode==PLAYER_MODE); + int fh = GraphicsUtil.getHeightFont(GraphicsUtil.SMALL_BOLD_FONT)+2; + int py = fh+fh/2; + g.setFont(GraphicsUtil.getFont(GraphicsUtil.MEDIUM_BOLD_FONT)); + //Данные о треке + Track current = getPlayer().getTrack(); + //Исполнитель + String data = current.getArtist(); + g.drawImage(im.artist, 2, py, 20); + if (data != null) py = GraphicsUtil.drawText(g, scrollText(data, 0), py, 0); + //Спящий режим + if(Rms.slpmode) g.drawImage(im.sleep, w-2, py+2, Graphics.RIGHT | Graphics.TOP);//g.drawString("S", 2, py+15+3*fh, 20); + //Заголовок + data = current.getTitle(); + g.drawImage(im.track, 1, py, 20); + if (data != null) py = GraphicsUtil.drawText(g, scrollText(data, 1), py, 1); + //Альбом + data = current.getAlbum(); + g.drawImage(im.album, 2, py, 20); + if (data != null) py = GraphicsUtil.drawText(g, scrollText(data, 2), py, 2); + + if(Rms.isLyric && lrc!=null) py = GraphicsUtil.drawText(g, scrollText(lrc.getLine((int) getPlayer().getCurrentTime()), 3), py, 3); + //Индикатор прогресса + float div = ((float)w - 10) / (float)current.getDuration(); + g.setColor(Skin.valuet); + int mgt = (int) getPlayer().getCurrentTime(); + int k = im.statusBarleftWidth+3; + GraphicsUtil.drawRect(g, Skin.softUp1, Skin.softUp2, 5, py, (int)(mgt * div), im.statusBarHeight); + for(int i=k; iih) album = Effects.Resize(album, ih*album.getWidth()/album.getHeight(), ih); + g.drawImage(album, w/2, py+15, 17); + }else if(Rms.vis){ + int ih = h-fh-2-py-20; + visual.setDimension(ih, ih); + g.drawImage(visual.getImage(), w/2, py+15, 17); + } + drawSoft(g); + } + + /** + * Отрисовка меню + * @param g + * @param cur + * @param y + */ + private void drawMenu(Graphics g, int cur, int y) { + GraphicsUtil.ACLS(g, 180, 0x00); + int fh = GraphicsUtil.getHeightFont(GraphicsUtil.MEDIUM_BOLD_FONT)+2; + int x = w/2-menuwidth/2; + for(int i=0; i=m.length) mcur=0; + break; + case FIRE: + menuAction(mcur); + break; + } + }else if(vis) { + switch (ga) { + case UP: + case LEFT: + Rms.visid--; + if(Rms.visid<0) Rms.visid=MAX_VISUALS; + initVisual(); + break; + case DOWN: + case RIGHT: + Rms.visid++; + if(Rms.visid>MAX_VISUALS) Rms.visid=0; + initVisual(); + break; + } + if(ga==FIRE || key==-6) vis = false; + }else if(skin) { + if(ga==UP) {cy--;if(cy<4*im.statusBarHeight) cy=4*im.statusBarHeight+im.pal.getHeight()-1;} + else if(ga==DOWN) {cy++;if(cy>=4*im.statusBarHeight+im.pal.getHeight()) cy=4*im.statusBarHeight+1;} + else if(ga==LEFT) {cx--;if(cx=w/2+im.pal.getWidth()/2) cx=w/2-im.pal.getWidth()/2;} + else if(key==KEY_NUM0) { + int x = w/2-im.pal.getWidth()/2; + Skin.valuet = Rms.valuet = Effects.get(im.pal, cx-x, cy-4*im.statusBarHeight); + } + else if(ga==FIRE || key==-6) { + Rms.skinid = thisskin; + Skin.initSkin(Rms.skinid); + skin = false; + } + else if(key==-7) skin = false; + }else{ + if(key==-7) rspressed = true; + else if(key==KEY_POUND) Rms.accel=!Rms.accel; + else if(key==KEY_STAR) Rms.vis=!Rms.vis; + else if(key==KEY_NUM0) Rms.isLyric=!Rms.isLyric; + else if(key== -36) volumeplus = h;//vol+; + else if(key== -37) volumeminus = 0;//vol-; + } + repaint(); + } + + protected void keyReleased(int key) { + if(menuup!=0 || menu) return; + int ga=getGameAction(key); + if(key==-7) { + rspressed = false; + if(Rms.closePlayer) getPlayer().pause(); + Main.midlet.destroyApp(true); + }else if(key==KEY_NUM9) Main.midlet.dsp.setCurrent(new SetSleepMode()); + if(key==KEY_NUM4) { + if(fastR) { + fastR = false; + getPlayer().play(); + }else getPlayer().skip(-10); + } + else if(key==KEY_NUM6) { + if(fastF) { + fastF = false; + getPlayer().play(); + }else getPlayer().skip(10); + } + if(ga==LEFT && key!=KEY_NUM4) newTrack(false); + else if(ga==RIGHT && key!=KEY_NUM6) newTrack(true); + if(key==KEY_NUM3) ABRepeat(); + switch(ga) { + case UP: + case DOWN: + upMode(); + break; + case FIRE: + getPlayer().playPause(); + break; + } + repaint(); + } + + protected void keyRepeated(int key) { + if(key==KEY_NUM4) { + if(!fastR) { + getPlayer().rewind(); + fastR = true; + } + }else if(key==KEY_NUM6) { + if(!fastF) { + getPlayer().fastForward(); + fastF = true; + } + }else keyPressed(key); + } + + public void run() { + while (true) { + try { + if(Rms.light) DeviceControl.setLights(0, 100); + final int delta = sensor.getDelta(0, Rms.sensetivity); + if (delta != 0) { + if (accelPrevDelta != 0 && (delta * accelPrevDelta) < 0) { + accelPrevDelta = 0; + } else { + accelPrevDelta = delta; + + Runnable runnable = new Runnable() { + + public void run() { + if (delta > 0 && Rms.accel) { + newTrack(true); + } else if (delta < 0 && Rms.accel) { + newTrack(Rms.listfw); + } + } + }; + (new Thread(runnable)).start(); + } + } + /*if(Rms.vis) { + try { + Thread.sleep(100); + } catch (InterruptedException ex) {} + }*/ + if(Rms.slpmode) { + if(Util.checkTime()) { + getPlayer().pause(); + Main.midlet.destroyApp(true); + } + } + if(repeat==2) { + int mgt = (int) getPlayer().getCurrentTime(); + int sk = Math.abs(b-a); + if(mgt>=b) getPlayer().skip(-sk); + } + + if(Rms.isLyric && getPlayer().getCurrentTime() < 3) { + lrc = null; + //Данные о треке + Track current = getPlayer().getTrack(); + String at = current.getArtist()+" - "+current.getTitle(); + if(Lyrics.isExists(at)) lrc = new Lyrics(at); + } + + if(Rms.lastFM) { + //Данные о треке + Track current = getPlayer().getTrack(); + String thisSong = current.getArtist()+" - "+current.getTitle(); + if(!thisSong.equalsIgnoreCase(Rms.lastSong)) { + int thisTime = (int) getPlayer().getCurrentTime(); + int allTime = (int) (current.getDuration()*50/*% проиграно*//100); + if(thisTime>allTime && (current.getDuration()>30) /*если трек больше 30 секунд*/) { + try { + if (Rms.md5pass.equals("")) { + Rms.md5pass = LastFMScrobbler.md5(Rms.password); + } + // //if (audioscrobbler == null) + // AudioScrobbler audioscrobbler = new AudioScrobbler("tst", "1.0", Rms.username, Rms.md5pass); + // audioscrobbler.connect(); + // Thread.sleep(3000); + // audioscrobbler.Submit( + // current.getArtist(), + // current.getTitle(), + // current.getAlbum(), + // "1", (int)current.getDuration() + // ); + long startTime = (System.currentTimeMillis()/1000)-thisTime; + LastFMScrobbler ms = new LastFMScrobbler("tst", "1.0", Rms.username, Rms.md5pass); + ms.handshake(); + ms.scrobble(current, startTime); + }catch(Exception ex) { + Main.midlet.dsp.setCurrent(new Alert("Ошибка", ex.getMessage(), null, AlertType.INFO)); + } + Rms.lastSong = thisSong; + } + } + } + }catch(Exception ex) { + ex.printStackTrace(); + repaint(); + } + } + } + + private void menuAction(int i) { + if(m[i].equals(lang.sleepmode)) Main.midlet.dsp.setCurrent(new SetSleepMode()); + else if(m[i].equals(Main.midlet.lang.options)) Main.midlet.dsp.setCurrent(new OptionsForm()); + else if(m[i].equals(Main.midlet.lang.about)) Main.midlet.dsp.setCurrent(new Info(im)); + else if(m[i].equals(Main.midlet.lang.minimise)) Main.midlet.dsp.setCurrent(null); + else if(m[i].equals(Main.midlet.lang.exit)) Main.midlet.destroyApp(true); + else if(m[i].equals(Main.midlet.lang.skin)) skin = true; + else if(m[i].equals(Main.midlet.lang.visual)) vis = true; + } + + public final SPlayer getPlayer() { + return player; + } + + private void upMode() { + mode = (byte) (1-mode); + initFx(); + } + + private void choiceVisual(Graphics g, int cur) { + g.setColor(0); + g.fillRect(0, 0, w, h); + Image kdr; + int ww = w-w/4; + visual.setDimension(ww, ww); + kdr = visual.getImage(); + g.drawImage(Effects.reflection(kdr, 0.5D), w/2, 2*im.statusBarHeight, 17); + GraphicsUtil.drawTitle(g, Integer.toString(cur), im, mode==PLAYER_MODE); + } + + private void choiceSkin(Graphics g, int cx, int cy) { + g.setColor(0); + int x = w/2-im.pal.getWidth()/2; + g.fillRect(0, 0, w, h); + g.drawImage(im.pal, x, 4*im.statusBarHeight, 20); + //cursor + g.setColor(0x00); + int dcur = 4; + g.drawLine(cx + 1, cy, cx + dcur, cy); + g.drawLine(cx - dcur, cy, cx - 1, cy); + g.drawLine(cx, cy - dcur, cx, cy - 1); + g.drawLine(cx, cy + 1, cx, cy + dcur); + // + thisskin=Effects.get(im.pal, cx-x, cy-4*im.statusBarHeight); + GraphicsUtil.drawTitle(g,Integer.toHexString(thisskin), im, false); + } + + /** + * Инициализация смен экранов + */ + private void initFx() { + old = Image.createImage(I.getWidth(), I.getHeight()); + old.getGraphics().drawImage(I, 0, 0, 20); + if(mode==PLAYER_MODE) drawPlayerCanvas(G); + else if(mode==VISUAL_MODE) drawVisual(G); + + int type = Util.random(0, 5); + animated = new AnimatedImage(I); + int direction = (new int[] {Canvas.UP, Canvas.DOWN, Canvas.LEFT, Canvas.RIGHT})[Util.random(0, 3)]; + switch(type) { + case 1: + imgfx = new BlindsFx(Util.random(4,15), 1, direction); + break; + case 2: + imgfx = new WaveFx(Util.random(6,30), Util.random(10,95), direction); + break; + case 3: + imgfx = new PuzzleFx(Util.random(4,20), Util.random(4,20), 1); + break; + case 4: + imgfx = new WipeFx(direction, 1); + break; + case 5: + imgfx = new Slide2Fx(direction, 1); + break; + default: + imgfx = new SlideFx(Util.random(4,15), 1, direction); + + } + animated.setFx(imgfx); + animated.start(1400); + } + + /** + * Инициализация визуализаций + */ + private void initVisual() { + if(Rms.visid<=5) visual = new Stars(w, h, Rms.visid-1); + else if(Rms.visid==6) visual = new VisualME(w, h); + else if(Rms.visid<=10) visual = new Plasma(w, h, Rms.visid-7); + else visual = new Capuchin(w, h, Rms.visid-10); + } + + private String scrollText(String text, int id) { + int count = (id==3) ? lyricWidth : textWidth; + String tmp = text; + int lent = text.length(); + int scr = lent - count; + try { + if (lent > count) { + tmp = text.substring(scrollPos[id], scrollPos[id] + count); + if(sleepPos[id] scr) { + scrollPos[id]--; + scrolldirection[id] = !scrolldirection[id]; + } else if (scrollPos[id] < 0) { + scrollPos[id] = 0; + scrolldirection[id] = !scrolldirection[id]; + } + sleepPos[id] = 0; + } + } + }catch(Exception ex) {tmp = text;} + return tmp; + } + + /** + * Переключение трека + */ + private void newTrack(boolean next) { + a=b=0; repeat = 0; + Main.midlet.dsp.vibrate(Rms.vibrlen); + if (Rms.flash) { + DeviceControl.setLights(0, 0); + DeviceControl.setLights(0, 100); + } + if(next) getPlayer().nextTrack(); + else getPlayer().prevTrack(); + } + + private void ABRepeat() { + try { + repeat++; + switch (repeat) { + case 1: // ставим A + a = (int) getPlayer().getCurrentTime(); + break; + case 2: // ставим B + b = (int) getPlayer().getCurrentTime(); + if(a>b) { + int t = b; b=a; a=t; + } + break; + case 3: // конец повтора + a = b = 0; + repeat = 0; + break; + } + } catch (Exception e) { + } + } + +} \ No newline at end of file diff --git a/src/Effects.java b/src/seps/Effects.java similarity index 92% rename from src/Effects.java rename to src/seps/Effects.java index 07ffd32..0c6b008 100644 --- a/src/Effects.java +++ b/src/seps/Effects.java @@ -1,3 +1,5 @@ +package seps; + import javax.microedition.lcdui.*; /** @@ -87,7 +89,7 @@ public class Effects { return temp2; } - public static Image HSV(Image img, float hh) { + /*public static Image HSV(Image img, float hh) { float[] hsb = new float[3]; int w = img.getWidth(); int h = img.getHeight(); @@ -101,12 +103,12 @@ public class Effects { hsb = Effects.RGBtoHSV(qr, qg, qb, hsb); hsb[0] += hh; while(hsb[0]>360) hsb[0]-=360; - /*if(c=='S' || c == 's') hsb[1] = hsb[1] + (float) (ch/256); - if(c=='B' || c == 'b') hsb[2] = hsb[2] + (float) (ch/256);*/ + //if(c=='S' || c == 's') hsb[1] = hsb[1] + (float) (ch/256); + //if(c=='B' || c == 'b') hsb[2] = hsb[2] + (float) (ch/256); pixel[io] = (qa << 24) | Effects.HSVtoRGB(hsb[0], hsb[1], hsb[2]); } return Image.createRGBImage(pixel, w, h, true); - } + }*/ public static float getHSV(int color, int c) {//0-h, 1-s, 2-v float[] hsb = new float[3]; @@ -133,7 +135,7 @@ public class Effects { return (qa << 24) | Effects.HSVtoRGB(hsb[0], hsb[1], hsb[2]); } - private static int HSVtoRGB(float h, float s, float v) { + public static int HSVtoRGB(float h, float s, float v) { float qr = 0, qg = 0, qb = 0; int r = 0, g = 0, b = 0; if(s==0.0 && h==-1.0) return ((int)v << 16) | ((int)v << 8) | (int)v; @@ -166,10 +168,12 @@ public class Effects { if (b < min) min = b; // hue if(v==min) h=0; - if(v==r && g>=b) h = 60 * ((g-b)/(v-min)); - if(v==r && g 0) { + g.drawString(strLines.elementAt(i).toString(), 1, fontHeight + 5 + y1, Graphics.LEFT | Graphics.TOP); + } + y1 = y1 + defHeight; + if (y1 > mh) { + break; + } + } + g.setClip(0, 0, w, h); + GraphicsUtil.drawTitle(g, Main.midlet.lang.about, im, false); + } + + protected void keyPressed(int key) { + int ga = getGameAction(key); + if(ga==UP) MoveUp(); + else if(ga==DOWN) MoveDown(); + else if(ga==LEFT) PageUp(); + else if(ga==RIGHT) PageDown(); + else if(ga==FIRE || key==-6 || key==-7) + Main.midlet.dsp.setCurrent(Main.midlet.cnv); + else if(key==-6) { + try { + String url = "http://annimon.com/"; + if(url.length()!=19) return; + Main.midlet.platformRequest(url); + } catch (ConnectionNotFoundException ex) { + Main.midlet.dsp.setCurrent(Main.midlet.cnv); + } + } + repaint(); + } + + protected void keyRepeated(int keyCode) { + keyPressed(keyCode); + } + + + protected void pointerPressed(int x, int y) { + int w3 = w/3; + int h3 = h/3; + if(y

w3 && x<(w-w3))) keyPressed(UP); + else if(y>(h-h3) && (x>w3 && x<(w-w3))) keyPressed(DOWN); + + if(xh3 && y<(h-h3))) keyPressed(LEFT); + else if(x>(w-w3) && (y>h3 && y<(h-h3))) keyPressed(RIGHT); + + else if(x(h-h3)) keyPressed(-6); + else if(x>(w-w3) && y>(h-h3)) keyPressed(-7); + else if( (x>w3 && x<(w-w3)) && (y>h3 && y<(h-h3)) ) keyPressed(FIRE); + } + + private void SetTextPar() { + //Разбиваем строку на массив строк + strLines = null; + strLines = new Vector(); + String[] arr = Util.splitString(str, "\n"); + for(int i=0; i w) {//Слово полностью не умещается в строке + space = i0; + while (jw > w) { + j = 0; + while (j < w) { + space++; + j = def.stringWidth(substr.substring(in, space)); + } + space = space - 1; + j = def.stringWidth(substr.substring(in, space)); + strLines.addElement(substr.substring(in, space)); + jw = jw - j; + i0 = space; + in = space; + } + jw = 0; + } else { + i0 = space; + } + } + } + strLines.addElement(substr.substring(in, imax)); + } + textheight = strLines.size() * defHeight; + } + + private String getText(String path) { + DataInputStream dis = new DataInputStream(getClass().getResourceAsStream(path)); + StringBuffer strBuff = new StringBuffer(); + int ch = 0; + try { + while ((ch = dis.read()) != -1) { + strBuff.append(StringEncoder.decodeCharCP1251((byte)ch)); + } + dis.close(); + } catch (Exception e) {e.printStackTrace();} + return strBuff.toString(); + } + + private void MoveDown() { + if (textheight > mh) { + y0 = y0 - dy; + if (mh - y0 > textheight) { + y0 = mh - textheight; + } + } + } + + private void MoveUp() { + if (textheight > mh) { + y0 = y0 + dy; + if (y0 > 0) { + y0 = 0; + } + } + + } + + private void PageUp() { + if (textheight > mh) { + y0 = y0 + mh; + if (y0 > 0) { + y0 = 0; + } + } + } + + private void PageDown() { + if (textheight > mh) { + y0 = y0 - mh; + if (mh - y0 > textheight) { + y0 = mh - textheight; + } + } + } +} diff --git a/src/seps/Lang.java b/src/seps/Lang.java new file mode 100644 index 0000000..3917d7e --- /dev/null +++ b/src/seps/Lang.java @@ -0,0 +1,82 @@ +package seps; + +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +/** + * + * @author aNNiMON + */ +public class Lang { + + String back, exit, ok, no; + String about, sleepmode, options, minimise; + String sensetivity, textfolder, vibro, skin, visual, + light, start, stop, flashlight, tooff, accel, msapi, + api, scrobbling, listforward, login, pass; + + public Lang(int id) { + // Общие + msapi = "MultimediaServices"; + api = " API"; + ok = "Ok"; + //English + if(id==0) { + back = "Back"; + no = "No"; + accel = "Accelerometer"; + //Menu + sleepmode = "Sleep Mode"; + visual = "Visualization"; + skin = "Skin"; + options = "Options"; + about = "About"; + minimise = "Minimize"; + exit = "Exit"; + //SleepMode + tooff = "Time to turn off (in minutes):"; + //Options + sensetivity = "Sensetivity to switch:"; + textfolder = "Folder with the text:"; + vibro = "Vibration switch (in ms):"; + light = "Backlight"; + start = "Launch player when program start"; + stop = "Close player when program exit"; + flashlight = "Flash backlight"; + listforward = "List Forward"; + scrobbling = "LastFM scrobbling"; + login = "Login LastFM"; + pass = "Password"; + + }else{ + back = "Назад"; + exit = "Выход"; + no = "Нет"; + + accel = "Акселерометр"; + + about = "О программе"; + sleepmode = "Спящий режим"; + options = "Настройки"; + minimise = "Свернуть"; + sensetivity = "Чувствительность к переключению:"; + textfolder = "Папка с текстами:"; + vibro = "Вибрация при переключении (в мс):"; + skin = "Скин"; + visual = "Визуализации"; + light = "Постоянная подсветка"; + start = "Запускать плеер при старте программы"; + stop = "Закрывать плеер при выходе из программы"; + flashlight = "Мигание подсветкой"; + scrobbling = "LastFM скробблинг"; + tooff = "Врямя до выключения (в минутах):"; + listforward = "Листать вперед"; + login = "Логин LastFM"; + pass = "Пароль"; + } + } + + +} diff --git a/src/Lyrics.java b/src/seps/Lyrics.java similarity index 60% rename from src/Lyrics.java rename to src/seps/Lyrics.java index f1dd213..b48545e 100644 --- a/src/Lyrics.java +++ b/src/seps/Lyrics.java @@ -1,4 +1,7 @@ +package seps; + +import com.annimon.StringEncoder; import java.io.*; import java.util.Vector; import javax.microedition.io.*; @@ -61,8 +64,8 @@ public class Lyrics { } return l5; } - - public static final boolean isExists(String lyricsname) { + + public static boolean isExists(String lyricsname) { boolean r = false; FileConnection fc; try { @@ -92,7 +95,6 @@ public class Lyrics { is.close(); fc.close(); } catch (Exception e) { - e.printStackTrace(); return null; } return sb.toString(); @@ -143,7 +145,7 @@ public class Lyrics { * @return */ private boolean isNumChar(char ch) { - return ch >= '0' && ch <= '9'; + return Character.isDigit(ch);//ch >= '0' && ch <= '9'; } /** @@ -170,65 +172,4 @@ public class Lyrics { //int ms = Integer.parseInt(in.substring(in.indexOf('.')+1, in.indexOf(']'))); return ss+(mm*60); } - - /** - * Преобразовывает все неинтернет ссылки в нормальные, например убирая пробелы или лишние символы. - * @param url - исходный адрес - * @return - правильный адрес на выходе - - private String urlName(String url) { - if (url == null) return null; - StringBuffer sb = new StringBuffer(); - for (int i = 0; i < url.length(); i++) { - char ch = url.charAt(i); - switch (ch) { - default: - if (ch < '\200') { - sb.append(ch); - break; - } - if (ch > '\177' && ch < '\u0800') { - sb.append('%'); - sb.append(Integer.toHexString((ch >> 6 | 0xc0) + 256).substring(1)); - sb.append('%'); - sb.append(Integer.toHexString((ch & 0x3f | 0x80) + 256).substring(1)); - break; - } - if (ch > '\u07FF' && ch < '\0') { - sb.append('%'); - sb.append(Integer.toHexString((ch >> 12 | 0xe0) + 256).substring(1)); - sb.append('%'); - sb.append(Integer.toHexString((ch >> 6 & 0x3f | 0x80) + 256).substring(1)); - sb.append('%'); - sb.append(Integer.toHexString((ch & 0x3f | 0x80) + 256).substring(1)); - } - break; - case 0: //'\0' - case 32: sb.append("%20"); break;// ' ' - case 61: sb.append("%3d"); break;// '=' - case 43: sb.append("%2b"); break;// '+' - case 39: sb.append("%27"); break;// '\'' - case 46: sb.append("%2E"); break;// '.' - case 60: sb.append("%3c"); break;// '<' - case 62: sb.append("%3e"); break;// '>' - case 35: sb.append("%23"); break;// '#' - case 37: sb.append("%25"); break;// '%' - case 38: sb.append("%26"); break;// '&' - case 123:sb.append("%7b"); break;// '{' - case 125:sb.append("%7d"); break;// '}' - case 92: sb.append("%5c"); break;// '\\' - case 94: sb.append("%5e"); break;// '^' - case 126:sb.append("%73"); break;// '~' - case 91: sb.append("%5b"); break;// '[' - case 93: sb.append("%5d"); break;// ']' - case 58: sb.append("%3A"); break;// ':' - case 47: sb.append("%2F"); break;// '/' - case 63: sb.append("%3F"); break;// '?' - case 45: sb.append("%2D"); break;// '-' - case 33: sb.append("%21"); break;// '!' - case 59: sb.append("%3B"); break;// ';' - } - } - return sb.toString(); - }*/ } diff --git a/src/seps/Main.java b/src/seps/Main.java new file mode 100644 index 0000000..61f13b3 --- /dev/null +++ b/src/seps/Main.java @@ -0,0 +1,51 @@ +package seps; + +/* + * aNNiMON 2011 + * For more info visit http://annimon.com/ + */ + +import javax.microedition.lcdui.*; +import javax.microedition.midlet.*; + +/** + * @author aNNiMON + */ +public class Main extends MIDlet { + + public Display dsp; + public Canv cnv; + public Lang lang; + public Images im; + public static Main midlet; + + public Main() { + midlet = Main.this; + dsp = Display.getDisplay(Main.this); + } + + public void startApp() { + Rms.restoreOptions(); + im = new Images(); + lang = new Lang(Rms.lngid); + Skin.initSkin(Rms.skinid); + Displayable object; + //При первом запуске отображаем настройки + if(Rms.firstStart) { + object = new FirstStartForm(lang); + }else{ + object = cnv = new Canv(im, lang); + } + dsp = Display.getDisplay(this); + dsp.setCurrent(object); + } + + public void pauseApp() { + } + + public void destroyApp(boolean ex) { + Rms.saveOptions(); + if(Rms.closePlayer) cnv.getPlayer().pause(); + notifyDestroyed(); + } +} diff --git a/src/seps/OptionsForm.java b/src/seps/OptionsForm.java new file mode 100644 index 0000000..1f474cd --- /dev/null +++ b/src/seps/OptionsForm.java @@ -0,0 +1,102 @@ +package seps; + +import javax.microedition.lcdui.*; + +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +/** + * Экран настроек + * @author aNNiMON + */ +public class OptionsForm extends Form implements CommandListener { + + private Command ok, back; + private TextField sensetivityTF, lyricFolderTF, vibroLenTF, loginTF, passTF; + private ChoiceGroup optionsCG, languageCG; + + public OptionsForm() { + super(Main.midlet.lang.options); + //Инициализция команд + ok = new Command(Main.midlet.lang.ok, Command.OK, 1); + back = new Command(Main.midlet.lang.back, Command.BACK, 2); + //Инициализация элементов + sensetivityTF = new TextField(Main.midlet.lang.sensetivity, String.valueOf(Rms.sensetivity), 4, TextField.NUMERIC); + lyricFolderTF = new TextField(Main.midlet.lang.textfolder, Rms.lrcpath, 256, TextField.ANY); + vibroLenTF = new TextField(Main.midlet.lang.vibro, String.valueOf(Rms.vibrlen), 4, TextField.NUMERIC); + loginTF = new TextField(Main.midlet.lang.login, Rms.username, 64, TextField.ANY); + passTF = new TextField(Main.midlet.lang.pass, Rms.password, 64, TextField.PASSWORD); + languageCG = new ChoiceGroup ("Language / Язык", ChoiceGroup.EXCLUSIVE); + optionsCG = new ChoiceGroup ("", ChoiceGroup.MULTIPLE); + //Инициализация ChoiceGroup + initCG(); + //Добавление всех элементов на форму + addAll(); + } + + /** + * Инициализация ChoiceGroup + */ + private void initCG() { + languageCG.append("English", null); + languageCG.append("Русский", null); + languageCG.setSelectedIndex(Rms.lngid, true); + + optionsCG.append(Main.midlet.lang.light, null); + optionsCG.append(Main.midlet.lang.start, null); + optionsCG.append(Main.midlet.lang.stop, null); + optionsCG.append(Main.midlet.lang.flashlight, null); + optionsCG.append(Main.midlet.lang.listforward, null); + optionsCG.append(Main.midlet.lang.scrobbling, null); + + optionsCG.setSelectedIndex(0, Rms.light); + optionsCG.setSelectedIndex(1, Rms.startPlayer); + optionsCG.setSelectedIndex(2, Rms.closePlayer); + optionsCG.setSelectedIndex(3, Rms.flash); + optionsCG.setSelectedIndex(4, Rms.listfw); + optionsCG.setSelectedIndex(5, Rms.lastFM); + } + + /** + * Добавление всех элементов на форму + */ + private void addAll() { + append(languageCG); + append(sensetivityTF); + append(lyricFolderTF); + append(vibroLenTF); + append(optionsCG); + append(loginTF); + append(passTF); + addCommand(ok); + addCommand(back); + setCommandListener(this); + Main.midlet.dsp.setCurrent(this); + } + + public void commandAction(Command c, Displayable d) { + if (c==back) Main.midlet.dsp.setCurrent(Main.midlet.cnv); + + if ((c==ok || c==List.SELECT_COMMAND)) { + Rms.lngid = languageCG.getSelectedIndex(); + Main.midlet.lang = new Lang(Rms.lngid); + Rms.sensetivity = Integer.parseInt(sensetivityTF.getString()); + Rms.vibrlen = Integer.parseInt(vibroLenTF.getString()); + Rms.lrcpath = lyricFolderTF.getString(); + Rms.light = optionsCG.isSelected(0); + Rms.startPlayer = optionsCG.isSelected(1); + Rms.closePlayer = optionsCG.isSelected(2); + Rms.flash = optionsCG.isSelected(3); + Rms.listfw = optionsCG.isSelected(4); + Rms.lastFM = optionsCG.isSelected(5); + Rms.username = loginTF.getString(); + Rms.password = passTF.getString(); + Rms.md5pass = ""; + Main.midlet.cnv.initMenu(Main.midlet.lang); + Main.midlet.dsp.setCurrent(Main.midlet.cnv); + } + } + +} diff --git a/src/Rms.java b/src/seps/Rms.java similarity index 52% rename from src/Rms.java rename to src/seps/Rms.java index 312bf5a..db0d98b 100644 --- a/src/Rms.java +++ b/src/seps/Rms.java @@ -1,3 +1,5 @@ +package seps; + import java.io.*; import javax.microedition.rms.*; @@ -8,33 +10,47 @@ import javax.microedition.rms.*; */ public class Rms { - private static final String rmsName = "SEPS"; + private static final String rmsName = "SEPlayerService"; private static RecordStore rmsStore; + public static boolean firstStart = true; // первый старт - public static int sensetivity = 800; - public static int skinid = 0;//x820000;//0; - public static boolean isLyric = true; - public static String lrcpath = "c:/music/Lyrics/"; - public static boolean light = false; - public static boolean startPlayer = true;//запускать плейер при старте программы - public static boolean closePlayer = true;//закрывать плейер при выходе из программы - public static int vibrlen = 200; - public static boolean flash = true;//мигание при переключении - public static int visid = 0; - public static boolean statGo = false; //переключатель статистики - public static boolean stat = false;//вести статистику - public static boolean urlstat = true; - public static boolean actmenu = false; - public static boolean listfw = false; - public static boolean vis = true; - public static boolean accel = true; - public static String lastSong = ""; - public static int id = 0; - public static int lngid = 0; - - - public static int dh,dm; - public static boolean slpmode = false; + + // -= Настройки API =- \\ + public static boolean api_accel = true; //акселерометр + public static boolean api_mserv = true; //multimedia services + + // -= Настройки запуска плеера =- \\ + public static boolean startPlayer = true;//при старте программы + public static boolean closePlayer = true;//при выходе из программы + + // -= Настройки режимов и опций =- \\ + public static boolean lastFM = false; //скробблинг Last.FM + public static String username = ""; //Логин + public static String password = ""; //Пароль + public static String md5pass = ""; //Пароль в MD5 + + public static boolean vis = true; //показ визуализации + public static boolean isLyric = true; //тексты песен + public static boolean accel = true; //акселерометр + + public static boolean flash = true; //мигание при переключении + public static boolean listfw = false; //листать вперёд + public static boolean light = false; //постоянная подсветка + + + public static int sensetivity = 800; //Чувствительность акселерометра + public static int vibrlen = 200; //Время вибрации переключения треков + public static int skinid = 0; //Скин + public static int valuet = 0xFFFFFFFF;//Цвет текста + public static int lngid = 0; //Язык + public static int visid = 0; //Тип визуализации + + public static String lrcpath = "c:/music/Lyrics/"; + public static String lastSong = ""; + + public static boolean slpmode = false; //Спящий режим + public static int dh,dm; //Время выключения при спящем режиме + /** * Сохранение настроек */ @@ -45,25 +61,33 @@ public class Rms { ByteArrayOutputStream baos = new ByteArrayOutputStream(); DataOutputStream dos = new DataOutputStream(baos); dos.writeBoolean(firstStart); - dos.writeInt(sensetivity); - dos.writeInt(skinid); - dos.writeBoolean(isLyric); - dos.writeUTF(lrcpath); - dos.writeBoolean(light); + dos.writeBoolean(api_accel); + dos.writeBoolean(api_mserv); dos.writeBoolean(startPlayer); dos.writeBoolean(closePlayer); - dos.writeInt(vibrlen); - dos.writeBoolean(flash); - dos.writeInt(visid); - dos.writeBoolean(stat); - dos.writeUTF(lastSong); - dos.writeInt(id); - dos.writeBoolean(urlstat); - dos.writeInt(lngid); - dos.writeBoolean(actmenu); - dos.writeBoolean(listfw); + //LastFM + dos.writeBoolean(lastFM); + dos.writeUTF(username); + dos.writeUTF(password); + dos.writeUTF(md5pass); + //Main modes dos.writeBoolean(vis); + dos.writeBoolean(isLyric); dos.writeBoolean(accel); + //Modes + dos.writeBoolean(flash); + dos.writeBoolean(listfw); + dos.writeBoolean(light); + //Values + dos.writeInt(sensetivity); + dos.writeInt(vibrlen); + dos.writeInt(skinid); + dos.writeInt(valuet); + dos.writeInt(lngid); + dos.writeInt(visid); + //Lyrics + dos.writeUTF(lrcpath); + dos.writeUTF(lastSong); dos.flush(); options = baos.toByteArray(); dos.close(); @@ -98,28 +122,35 @@ public class Rms { try { DataInputStream dis = new DataInputStream(new ByteArrayInputStream(rmsStore.getRecord(1))); firstStart = dis.readBoolean(); - sensetivity = dis.readInt(); - skinid = dis.readInt(); - isLyric = dis.readBoolean(); - lrcpath = dis.readUTF(); - light = dis.readBoolean(); + api_accel = dis.readBoolean(); + api_mserv = dis.readBoolean(); startPlayer = dis.readBoolean(); closePlayer = dis.readBoolean(); - vibrlen = dis.readInt(); - flash = dis.readBoolean(); - visid = dis.readInt(); - stat = dis.readBoolean(); - lastSong = dis.readUTF(); - id = dis.readInt(); - urlstat = dis.readBoolean(); - lngid = dis.readInt(); - actmenu = dis.readBoolean(); - listfw = dis.readBoolean(); + //LastFM + lastFM = dis.readBoolean(); + username = dis.readUTF(); + password = dis.readUTF(); + md5pass = dis.readUTF(); + //Main modes vis = dis.readBoolean(); + isLyric = dis.readBoolean(); accel = dis.readBoolean(); + //Modes + flash = dis.readBoolean(); + listfw = dis.readBoolean(); + light = dis.readBoolean(); + //Values + sensetivity = dis.readInt(); + vibrlen = dis.readInt(); + skinid = dis.readInt(); + valuet = dis.readInt(); + lngid = dis.readInt(); + visid = dis.readInt(); + //Lyrics + lrcpath = dis.readUTF(); + lastSong = dis.readUTF(); dis.close(); - } catch (Exception ex) { - } + } catch (Exception ex) {} } } } diff --git a/src/SetSleepMode.java b/src/seps/SetSleepMode.java similarity index 65% rename from src/SetSleepMode.java rename to src/seps/SetSleepMode.java index e2231d1..032703f 100644 --- a/src/SetSleepMode.java +++ b/src/seps/SetSleepMode.java @@ -1,3 +1,5 @@ +package seps; + import java.util.Calendar; import javax.microedition.lcdui.*; @@ -7,7 +9,7 @@ import javax.microedition.lcdui.*; * and open the template in the editor. */ /** - * + * Класс установки спящего режима * @author aNNiMON */ public class SetSleepMode extends Form implements CommandListener { @@ -16,23 +18,20 @@ public class SetSleepMode extends Form implements CommandListener { private TextField zw; public SetSleepMode() { - super(SEPS.midlet.lang.sleepmode); - back = new Command(SEPS.midlet.lang.back, Command.BACK, 2); - ok = new Command(SEPS.midlet.lang.ok, Command.OK, 1); - zw = new TextField(SEPS.midlet.lang.tooff, String.valueOf(10), 2, TextField.NUMERIC); + super(Main.midlet.lang.sleepmode); + ok = new Command(Main.midlet.lang.ok, Command.OK, 1); + back = new Command(Main.midlet.lang.back, Command.BACK, 2); + zw = new TextField(Main.midlet.lang.tooff, String.valueOf(10), 2, TextField.NUMERIC); append(zw); addCommand(ok); addCommand(back); - setCommandListener(this); - SEPS.midlet.dsp.setCurrent(this); + setCommandListener(SetSleepMode.this); + Main.midlet.dsp.setCurrent(SetSleepMode.this); } public void commandAction(Command c, Displayable d) { - if (c == back) { - SEPS.midlet.dsp.setCurrent(SEPS.midlet.cnv); - } - - if (c == ok) { + if (c == back) Main.midlet.dsp.setCurrent(Main.midlet.cnv); + else if (c == ok) { int time = Integer.parseInt(zw.getString()); if(time == 0) Rms.slpmode=false; else { @@ -48,9 +47,10 @@ public class SetSleepMode extends Form implements CommandListener { } if(dh>=24) dh=dh-24; Rms.slpmode=true; - Rms.dh=dh; Rms.dm=dm; + Rms.dh=dh; + Rms.dm=dm; } - SEPS.midlet.dsp.setCurrent(SEPS.midlet.cnv); + Main.midlet.dsp.setCurrent(Main.midlet.cnv); } } } diff --git a/src/seps/Skin.java b/src/seps/Skin.java new file mode 100644 index 0000000..015b511 --- /dev/null +++ b/src/seps/Skin.java @@ -0,0 +1,60 @@ +package seps; + +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +/** + * Скин + * @author aNNiMON + */ +public class Skin { + + public static int softUp1, softUp2, softDn1, softDn2, background, line, text, valuet, inf, + volumeUp, volumeDn; + + public static void initSkin(int skin) { + if(skin==1) skin = Rms.skinid = 0xFF3477d5; + else if(skin==2) skin = Rms.skinid = 0xFF181818; + else if(skin==3) skin = Rms.skinid = 0xFFCE6BA6; + else if(skin==4) skin = Rms.skinid = 0; + else if(skin==5) skin = Rms.skinid = 0xFFFFFF99; + background = 0xFF2F8400; + valuet = Rms.valuet; + if(skin!=0) { + softUp1 = Effects.changeHSV(background, 2, 0.4352941f); + softUp2 = Effects.changeHSV(background, 2, 0.19215685f); + softDn1 = Effects.changeHSV(background, 2, -0.007843137f); + softDn2 = Effects.changeHSV(background, 2, -0.16862747f); + line = Effects.changeHSV(background, 0, 22); + line = Effects.changeHSV(line, 2, 0.21568626f); + text = Effects.changeHSV(background, 0, 22); + text = Effects.changeHSV(text, 2, 0.082352936f); + inf = Effects.changeHSV(background, 2, -0.16078433f); + for(int i=0; i<=2; i++) { + float delta = Effects.getHSV(skin, i) - Effects.getHSV(background, i); + if(delta>-0.05 && delta<0.05) continue; + softUp1 = Effects.changeHSV(softUp1, i, delta); + softUp2 = Effects.changeHSV(softUp2, i, delta); + softDn1 = Effects.changeHSV(softDn1, i, delta); + softDn2 = Effects.changeHSV(softDn2, i, delta); + line = Effects.changeHSV(line, i, delta); + text = Effects.changeHSV(text, i, delta); + inf = Effects.changeHSV(inf, i, delta); + } + background = skin; + }else{ + softUp1 = 0xFF57f300; + softUp2 = 0xFF41b500; + softDn1 = 0xFF2e8200; + softDn2 = 0xFF205900; + line = 0x00BB00; + text = 0x009900; + inf = 0x215B00; + } + //Цвета громкостей + volumeUp = (0x33 << 24) | (softDn2 & 0x00FFFFFF); + volumeDn = (0xAA << 24) | (softDn2 & 0x00FFFFFF); + } +} diff --git a/src/seps/TestScrobbler.java b/src/seps/TestScrobbler.java new file mode 100644 index 0000000..552c5e9 --- /dev/null +++ b/src/seps/TestScrobbler.java @@ -0,0 +1,52 @@ +/* + * aNNiMON 2011 + * For more info visit http://annimon.com/ + */ +package seps; + +import javax.microedition.lcdui.*; +import javax.microedition.midlet.*; +import lastfm.LastFMScrobbler; +import msapi.Track; + +/** + * @author aNNiMON + */ +public class TestScrobbler extends MIDlet { + + public Display dsp; + public static TestScrobbler midlet; + + public TestScrobbler() { + midlet = TestScrobbler.this; + dsp = Display.getDisplay(TestScrobbler.this); + } + + public void startApp() { + try { + String user = "User"; + String pass = "Pass"; + String md5pass = LastFMScrobbler.md5(pass); + System.out.println(md5pass); + + Track test = new Track(); + test.setTitle("Blood Brothers"); + test.setArtist("Papa Roach"); + test.setAlbum("Infest"); + test.setDuration(274); + long startTime = (System.currentTimeMillis()/1000)-180; + LastFMScrobbler ms = new LastFMScrobbler("tst", "1.0", user, md5pass); + ms.handshake(); + ms.scrobble(test, startTime); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + + public void pauseApp() { + } + + public void destroyApp(boolean ex) { + notifyDestroyed(); + } +} diff --git a/src/visual/Capuchin.java b/src/visual/Capuchin.java new file mode 100644 index 0000000..dc12994 --- /dev/null +++ b/src/visual/Capuchin.java @@ -0,0 +1,30 @@ +package visual; + +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +import com.sonyericsson.capuchin.*; +import javax.microedition.lcdui.*; + +/** + * @author aNNiMON + */ +public class Capuchin extends Visual { + + private FlashImage flashImage; + + public Capuchin(int w, int h, int mode) { + super(w, h); + flashImage = null; + try { + flashImage = FlashImage.createImage(getClass().getResourceAsStream("/res/" + String.valueOf(mode) + ".swf"), null); + } catch (Exception ex) {} + } + + protected void paint(Graphics g) { + if (flashImage != null) { + flashImage.render(g, 0, 0, w, h); + } + } +} \ No newline at end of file diff --git a/src/visual/Plasma.java b/src/visual/Plasma.java new file mode 100644 index 0000000..5949d82 --- /dev/null +++ b/src/visual/Plasma.java @@ -0,0 +1,86 @@ +/* + * aNNiMON 2011 + * For more info visit http://annimon.com/ + */ + +package visual; + +import seps.Effects; +import java.util.Random; +import javax.microedition.lcdui.Graphics; +import javax.microedition.lcdui.Image; + +/** + * Визуализация "Плазма" + * @author aNNiMON + */ +public class Plasma extends Visual { + + private int mode; + + /** + * Инициализация плазмы + * @param w - ширина области + * @param h - высота области + */ + public Plasma(int w, int h, int mode) { + super(w, h); + this.mode = mode; + } + + protected void paint(Graphics g) { + //g.drawImage(db, 0, 0, 20); + db = Image.createRGBImage(visual(), w, h, false); + } + + private int[] visual() { + int[] pix = new int[w*h]; + int color = 0; + int paletteShift =(int) (System.currentTimeMillis() / 10); + double ddr = (2 * Math.PI / 255); + for (int x = 0; x < w; x+=5) { + for (int y = 0; y < h; y+=5) { + + switch(mode) { + case 0: + double xx = (x - w / 2D); + double yy = (y - h / 2D); + color = (int) (128 + (128 * Math.sin(Math.sqrt(xx*xx + yy*yy) / 8.0))); break; + case 1: color = (int) ((128 + (128 * Math.sin(x / 8D)) + 128 + (128 * Math.sin(y / 8D))) / 2); break; + case 2: + color = (int) (( + 128 + (128 * Math.sin(x / 16D)) + + 128 + (128 * Math.sin(y / 8D)) + + 128 + (128 * Math.sin((x + y) / 16D)) + + 128 + (128 * Math.sin(Math.sqrt((x * x + y * y)) / 8D)) + ) / 4); + break; + default: + color = (int) ( (64 * (1 + Math.sin(x * ddr))) + + 64 * (1 + Math.sin(y * ddr)) ); + break; + } + //grf.setColor((palette((color + paletteShift) % 360) )); + //grf.fillRect(x, y, 5, 5); + + try { + pix[y * w + x] = pix[y * w + x + 1] = pix[y * w + x + 2] = + pix[(y + 1) * w + x] = pix[(y + 1) * w + x + 1] = pix[(y + 1) * w + x + 2] = + pix[(y + 2) * w + x] = pix[(y + 2) * w + x + 1] = pix[(y + 2) * w + x + 2] = 0xFF000000 | (palette((color + paletteShift) % 360)); + } catch (Exception e) { + } + } + } + return pix; + } + + + private int palette(int color) { + /*return ( + (color << 16) |//((255-color) << 16) | + ((2*color) << 8) |//((((color*2) > 255) ? 255 : (color*2)) << 8) | + (255-color)//(((128+color) > 255) ? 255 : (128+color)) + );*/ + return Effects.HSVtoRGB(color, 1.0f, 1.0f); + } +} diff --git a/src/visual/Stars.java b/src/visual/Stars.java new file mode 100644 index 0000000..332675f --- /dev/null +++ b/src/visual/Stars.java @@ -0,0 +1,196 @@ +/* + * aNNiMON 2011 + * For more info visit http://annimon.com/ + */ + +package visual; + +import com.annimon.GraphicsUtil; +import java.util.Random; +import javax.microedition.lcdui.Graphics; + +/** + * Визуализация "Звёзды" + * @author aNNiMON + */ +public class Stars extends Visual { + + /** Массивы координат звёзд */ + private int[] starx, stary, starz; + + private int K,i,mode; + private int max, spd, cf; + private long time, dt; + private boolean up,dn, update; + + /** + * Инициализация звёзд + * @param w - ширина области + * @param h - высота области + */ + public Stars(int w, int h, int mode) { + super(w, h); + this.mode = mode; + update = (mode<0); + max = 300; + spd = 200; + K = 60; + rnd = new Random(); + init(max); + time = System.currentTimeMillis(); + } + + protected void paint(Graphics g) { + g.drawImage(db, 0, 0, 20); + paint(); + updateParams(); + } + + private void paint() { + dt = System.currentTimeMillis() - time; + time = System.currentTimeMillis(); + if(K>=3) GraphicsUtil.ACLS(G, 100-K); + else GraphicsUtil.CLS(G); + for (i = 1; i0) { + if (starz[i] <= -200) { + initStar(); + } + setPix((255 - 255 * (starz[i] + 200) / 2100)); + }else{ + if (starz[i] > 2000) { + initStar(); + } + setPix((255-255 * (starz[i]%2100) / 2100)); + } + } + } + + /** + * Инициализация текущей звезды + */ + private void initStar() { + starx[i] = rnd.nextInt(w * 4) - w * 2; + stary[i] = rnd.nextInt(h * 4) - h * 2; + starz[i] = rnd.nextInt(1900); + } + + /** + * Инициализация звёзд + * @param max максимальное количество звёзд + */ + private void init(int max) { + starx = new int[max]; + stary = new int[max]; + starz = new int[max]; + for (i = 0; i11) max-=10; break; + case 13: if(update) if(max<1000) init(max+=100); break; + case 4: if(K<84) K+=15; break; + case 14: if(K>16) K-=15; break; + case 6: if(update) mode = rnd.nextInt(4); break; + } + try { + if(spd<25 && spd>-25) Thread.sleep(10); + else Thread.sleep(40); + } catch (InterruptedException ex) {} + } + + /** + * Отрисовка точки (звезды) + * @param c - цвет + */ + private void setPix(int c) { + int sx, sy, sx1 = 0, sy1 = 0; + sx = (w / 2 + starx[i] * 200 / (starz[i] + 200)); + sy = (h / 2 - stary[i] * 200 / (starz[i] + 200)); + if(c>255) c=255; + else if(c<0) c=0; + switch(mode) { + case 1: + G.setColor(c, c, c); + int u = (starz[i]==0) ? 1 : starz[i]; + G.fillArc(sx, sy, c/u, c/u, 0, 360); + break; + case 2: + u=rnd.nextInt(6); + switch(u) { + case 0: G.setColor(255-c, c, c); break; + case 1: G.setColor(c, 255-c, c); break; + case 2: G.setColor(c, c, 255-c); break; + case 3: G.setColor(255-c, 255-c, c); break; + case 4: G.setColor(255-c, c, 255-c); break; + case 5: G.setColor(c, 255-c, 255-c); break; + case 6: G.setColor(255-c, 255-c, 255-c); break; + } + if(i!=22) G.drawLine(sx, sy, sx, sy); + else try{G.fillRoundRect(sx, sy, starz[i]/(255-c), starz[i]/(255-c), i, i);}catch(Exception ex) {}; break; + case 3: + u=rnd.nextInt(6); + switch(u) { + case 0: G.setColor(255-c, c, c); break; + case 1: G.setColor(c, 255-c, c); break; + case 2: G.setColor(c, c, 255-c); break; + case 3: G.setColor(255-c, 255-c, c); break; + case 4: G.setColor(255-c, c, 255-c); break; + case 5: G.setColor(c, 255-c, 255-c); break; + case 6: G.setColor(255-c, 255-c, 255-c); break; + } + u=starz[i]==0?1:starz[i]; + G.fillArc(sx, sy, c/u, c/u, 0, 360); + break; + case 4: + u=rnd.nextInt(6); + switch(u) { + case 0: G.setColor(255-c, c, c); break; + case 1: G.setColor(c, 255-c, c); break; + case 2: G.setColor(c, c, 255-c); break; + case 3: G.setColor(255-c, 255-c, c); break; + case 4: G.setColor(255-c, c, 255-c); break; + case 5: G.setColor(c, 255-c, 255-c); break; + case 6: G.setColor(255-c, 255-c, 255-c); break; + } + if(i>1) { + sx1 = (w / 2 + starx[i-1] * 200 / (starz[i-1] + 200)); + sy1 = (h / 2 - stary[i-1] * 200 / (starz[i-1] + 200)); + } + G.drawLine(sx1, sy1, sx, sy); + break; + default: + G.setColor(c, c, c); + if(i!=22) G.drawLine(sx, sy, sx, sy); + else try{G.fillRoundRect(sx, sy, starz[i]/(255-c), starz[i]/(255-c), i, i);}catch(Exception ex) {}; + break; + } + } + +} diff --git a/src/visual/Visual.java b/src/visual/Visual.java new file mode 100644 index 0000000..35b045e --- /dev/null +++ b/src/visual/Visual.java @@ -0,0 +1,70 @@ +/* + * aNNiMON 2011 + * For more info visit http://annimon.com/ + */ + +package visual; + +import java.util.Random; +import javax.microedition.lcdui.Graphics; +import javax.microedition.lcdui.Image; + +/** + * + * @author aNNiMON + */ +public abstract class Visual { + + /** Изображение хранит содержимое визуализации */ + Image db; + /** Графика изображения */ + Graphics G; + /** Размеры рисуемой области */ + int w, h; + /** Генератор псевдослучайных чисел */ + Random rnd; + + /** + * Инициализация визуализации + * @param w - ширина области + * @param h - высота области + */ + public Visual(int w, int h) { + this.w = w; + this.h = h; + db = Image.createImage(w, h); + G = db.getGraphics(); + } + + /** + * Отрисовка визуализации + * @param g Graphics + */ + protected abstract void paint(Graphics g); + + /** + * Получение изображения визуализации + * @return Image + */ + public Image getImage() { + paint(G); + return db; + } + + /** + * Изменение размера визуализации + * @param w - ширина области + * @param h - высота области + */ + public void setDimension(int w, int h) { + if(this.w != w && this.h != h) { + this.w = w; + this.h = h; + db = Image.createImage(w, h); + G = db.getGraphics(); + G.setColor(0); + G.fillRect(0, 0, w, h); + } + } + +} diff --git a/src/Engine2.java b/src/visual/VisualME.java similarity index 57% rename from src/Engine2.java rename to src/visual/VisualME.java index 0c02377..892f882 100644 --- a/src/Engine2.java +++ b/src/visual/VisualME.java @@ -1,74 +1,54 @@ +/* + * aNNiMON 2011 + * For more info visit http://annimon.com/ + */ -//import com.nokia.mid.ui.DeviceControl; -import javax.microedition.lcdui.*; +package visual; + +import com.annimon.GraphicsUtil; import java.util.Random; +import javax.microedition.lcdui.Graphics; -public class Engine2 implements Runnable { +/** + * Визуализация "Щупальца" + * @author aNNiMON + */ +public class VisualME extends Visual { - private Graphics G; - private Image db; private int S = 15;//ветви private int N = 20;//гибкость private int K = 60; - private float L = (float) 1/1; private int T = 0; //0-4 //line,time,rect private int U = 9; - private int w,h; - + private float L = (float) 1/1; + private boolean rb, gb, bb; private float x, y, tx, ty, k, d, len; private int rc, gc, bc, rgb, fr, ar; private float[] a = new float[40]; - private Random rnd; - private Thread thr; - public boolean run; - - public Engine2(int w, int h) { - this.w=w; - this.h=h; - db = Image.createImage(w, h); - G = db.getGraphics(); + + /** + * Инициализация щупалец + * @param w - ширина области + * @param h - высота области + */ + public VisualME(int w, int h) { + super(w, h); rnd = new Random(); rc = gc = bc = 0; - ar=(rnd.nextInt() >>> 1) % 14; - fr=((rnd.nextInt()>>>1)%6)+1; + ar=rnd.nextInt(14); + fr=rnd.nextInt(6)+1; rgb = 1; - thr = new Thread(this); - thr.start(); } - - public void run() { - while (run) { - int r = (rnd.nextInt() >>> 1) % 26; - switch(r) { - case 3: ar=(rnd.nextInt() >>> 1) % 14; break;//color - case 4: if(K<84) K+=15; break; - case 5: fr=((rnd.nextInt()>>>1)%6)+1; break;//formula - case 6: T = (rnd.nextInt() >>> 1) % 3; break;//фигуры - case 7: S += 4; break; - case 8: N += 5; if(N>=40) N=40; break; - case 9: N -= 5; if(N<5) N=5; break; - case 10: L = (float) 1/((rnd.nextInt() >>> 1)%8); break; - case 11: U=(rnd.nextInt() >>> 1) % 9; break; - case 14: if(K>16) K-=15; break; - } - try { - Thread.sleep(2000L); - } catch (InterruptedException ex) {} - } - } - - public void setRun(boolean run) { - this.run=run; - } - - public Image MainCanvas() { - rgb(G); + + protected void paint(Graphics g) { + g.drawImage(db, 0, 0, 20); + rgb(); visual(G); - return db; + updateParams(); } - - private void rgb(Graphics grf) { + + private void rgb() { switch(rgb) { case 1: rc++; @@ -114,7 +94,7 @@ public class Engine2 implements Runnable { break; } } - + private void visual(Graphics grf) { len = (float) (w>h?h:w) / L / N; k = (float) (Math.abs(rnd.nextFloat() * 360) * Math.PI / 180); @@ -131,36 +111,38 @@ public class Engine2 implements Runnable { for (int j = 0; j < S; j++) { x = (float) (0.5 * w); y = (float) (0.5 * h); + float temp1 = j * d + a[1]; for (int i = 1; i < N; i++) { + float temp2 = j * d + a[i]; grf.setColor(rc, gc, bc); if (fr == 1) { - tx = (float) (x + Math.cos(j * d + a[1]) * len); - ty = (float) (y + Math.sin(j * d + a[i]) * len); - x = x + (float) (Math.cos(j * d + a[i]) * len); + tx = (float) (x + Math.cos(temp1) * len); + ty = (float) (y + Math.sin(temp2) * len); + x = x + (float) (Math.cos(temp2) * len); }else if (fr == 2) { - tx = (float) (x + Math.sin(j * d + a[i]) * len); - ty = (float) (y + Math.cos(j * d + a[i]) * len); + tx = (float) (x + Math.sin(temp2) * len); + ty = (float) (y + Math.cos(temp2) * len); }else if (fr == 3) { - tx = (float) (x + Math.tan(j * d + a[1]) * len); - ty = (float) (y + Math.cos(j * d + a[i]) * len); - y = y - (float) (Math.sin(j * d + a[i]) * len); + tx = (float) (x + Math.tan(temp1) * len); + ty = (float) (y + Math.cos(temp2) * len); + y = y - (float) (Math.sin(temp2) * len); }else if (fr == 4) { - tx = (float) (x + Math.tan(j * d + a[1]) * len); - ty = (float) (y + Math.cos(j * d + a[i]) * len); - x = y - (float) (Math.sin(j * d + a[i]) * len); + tx = (float) (x + Math.tan(temp1) * len); + ty = (float) (y + Math.cos(temp2) * len); + x = y - (float) (Math.sin(temp2) * len); }else if (fr == 5) { - tx = (float) (x + Math.tan(j * d + a[1]) * len); - ty = (float) (y + Math.cos(j * d + a[i]) * len); - x = (float) (x * ty * d + a[i] - (float) (Math.sin(j * d + a[i]) * len)); + tx = (float) (x + Math.tan(temp1) * len); + ty = (float) (y + Math.cos(temp2) * len); + x = (float) (x * ty * d + a[i] - (float) (Math.sin(temp2) * len)); }else if (fr == 6) { - tx = (float) (x + Math.cos(j * d + a[1]) * len); - ty = (float) (y + Math.sin(j * d + a[1]) * len); - x = x + (float) (Math.sin(j * d + a[i]) * len); - y = y + (float) (Math.cos(j * d + a[i]) * len); - tx = (float) (x + Math.cos(j * d + a[1]) * len); - ty = (float) (y + Math.sin(j * d + a[1]) * len); - x = x + (float) (Math.sin(j * d + a[i]) * len); - y = y + (float) (Math.cos(j * d + a[i]) * len); + tx = (float) (x + Math.cos(temp1) * len); + ty = (float) (y + Math.sin(temp1) * len); + x = x + (float) (Math.sin(temp2) * len); + y = y + (float) (Math.cos(temp2) * len); + tx = (float) (x + Math.cos(temp1) * len); + ty = (float) (y + Math.sin(temp1) * len); + x = x + (float) (Math.sin(temp2) * len); + y = y + (float) (Math.cos(temp2) * len); } if (ar == 2) { grf.setColor(255, (255 - 255 * i / N), 0); @@ -196,20 +178,33 @@ public class Engine2 implements Runnable { y = ty; } } - if(K>=3) ACLS(grf); - else CLS(grf); + if(K>=3) GraphicsUtil.ACLS(grf, 100-K); + else GraphicsUtil.CLS(grf); } - private void CLS(Graphics g) { - g.setColor(Canv.background); - g.fillRect(0, 0, w, h); - } - - private void ACLS(Graphics g) { - int[] pixelArray = new int[w * h]; - for (int io = 0; io < pixelArray.length; io++) { - pixelArray[io] = (int)(100-K << 24) | Canv.background & 0x00ffffff; + + /** + * Обновление параметров + */ + private void updateParams() { + int r = rnd.nextInt(26); + switch(r) { + case 3: ar = rnd.nextInt(14); break;//color + case 4: if(K<84) K+=15; break; + case 5: fr = rnd.nextInt(6)+1; break;//formula + case 6: T = rnd.nextInt(3); break;//фигуры + case 7: S += 4; break; + case 8: N += 5; if(N>=40) N=40; break; + case 9: N -= 5; if(N<5) N=5; break; + case 10: L = (float) 1/rnd.nextInt(8); break; + case 11: U=rnd.nextInt(9); break; + case 14: if(K>16) K-=15; break; } - g.drawRGB(pixelArray, 0, w, 0, 0, w, h, true); + try { + Thread.sleep(25); + } catch (InterruptedException ex) {} } + + + }