summaryrefslogtreecommitdiff
path: root/client/.metadata/.plugins/org.eclipse.core.resources
diff options
context:
space:
mode:
Diffstat (limited to 'client/.metadata/.plugins/org.eclipse.core.resources')
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/0/b08b1b0b560d00131719b896d543f08c45
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/1/907f38e9220d00131a9bb9bc5a5e61714
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/1/e0fccb09380d00131249f322b63acde896
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/1/f02df33e860d00131719b896d543f08c31
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/12/201d72d3760d00131719b896d543f08c178
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/13/6046c8d2670d00131719b896d543f08c91
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/15/80676cae330d00131249f322b63acde857
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/16/30f189812c0d00131249f322b63acde833
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/16/c03b1eb7550d00131719b896d543f08c68
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/17/8029226c800d00131719b896d543f08c15
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/17/b039f5b4330d00131249f322b63acde859
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/18/00a5e084260d00131a9bb9bc5a5e617168
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/19/b01e7ce6220d00131a9bb9bc5a5e61710
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/19/b06a41ee310d00131249f322b63acde881
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/1b/1001f39b220d00131a9bb9bc5a5e617117
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/1b/e052bedc670d00131719b896d543f08c91
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/1c/0084ccf2240d00131a9bb9bc5a5e61718
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/1c/c097adfa670d00131719b896d543f08c91
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/1f/305dce064c0d00131719b896d543f08c103
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/2/c0e1f0e53a0d00131524a793807f338e85
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/22/20302442660d00131719b896d543f08c82
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/22/b0553560360d00131249f322b63acde872
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/24/40a1e7d3340d00131249f322b63acde863
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/24/602725f7320d00131249f322b63acde89
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/25/60c3225c250d00131a9bb9bc5a5e617190
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/25/703b1352250d00131a9bb9bc5a5e617190
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/25/e0a3222e250d00131a9bb9bc5a5e617191
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/26/10fa1d9f550d00131719b896d543f08c241
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/26/60c51154370d00131249f322b63acde870
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/27/20fe519b7a0d00131719b896d543f08c196
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/27/8062fc9c690d00131719b896d543f08c115
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/27/b0ff1ddf650d00131719b896d543f08c66
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/28/005bf7374c0d00131719b896d543f08c103
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/28/a00c947d310d00131249f322b63acde8133
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/28/e0fe6e7a310d00131249f322b63acde876
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/2b/90dd627f4f0d00131719b896d543f08c42
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/2b/e0b1b2b86a0d00131719b896d543f08c137
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/2d/10589e1d530d00131719b896d543f08c33
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/2d/b0547e04360d00131249f322b63acde870
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/2d/d03e1c612c0d00131249f322b63acde830
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/2e/80cdc91d560d00131719b896d543f08c45
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/3/b0bdfe23320d00131249f322b63acde881
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/30/909951c6530d00131719b896d543f08c42
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/31/50f2612d2d0d00131249f322b63acde835
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/32/00f713722c0d00131249f322b63acde832
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/33/00c793445a0d00131719b896d543f08c104
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/34/b0a7c7dc250d00131a9bb9bc5a5e617164
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/34/c0f6cc4a530d00131719b896d543f08c37
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/35/4093eb606b0d00131719b896d543f08c149
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/36/90c1e030690d00131719b896d543f08c110
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/36/d038f44e800d00131719b896d543f08c89
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/38/003d32e92d0d00131249f322b63acde874
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/3a/50c1a310570d00131719b896d543f08c49
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/3a/70725e2b330d00131249f322b63acde884
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/3a/c06b1bbd810d00131719b896d543f08c23
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/3b/908be6833c0d00131524a793807f338e90
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/3c/e05994772c0d00131249f322b63acde832
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/3e/00def6177b0d00131719b896d543f08c196
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/3e/1089ba593d0d00131524a793807f338e35
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/3e/70b085c6280d00131249f322b63acde869
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/3f/20d16da8790d00131719b896d543f08c191
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/4/208b4473550d00131719b896d543f08c69
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/4/d06a2613260d00131a9bb9bc5a5e617171
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/40/d0cd94022e0d00131249f322b63acde876
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/41/c042e3c3810d00131719b896d543f08c23
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/42/202de8244f0d00131719b896d543f08c42
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/43/d08732c36a0d00131719b896d543f08c137
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/43/e05e9ddd800d00131719b896d543f08c22
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/44/00604d29230d00131a9bb9bc5a5e61716
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/44/50b1dc18530d00131719b896d543f08c23
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/44/b0ce412f550d00131719b896d543f08c241
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/48/f02ec265260d00131a9bb9bc5a5e617171
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/49/10547e20330d00131249f322b63acde883
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/49/d0e63f99550d00131719b896d543f08c241
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/4a/2006f95e2b0d00131249f322b63acde814
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/4b/60e6bdcd310d00131249f322b63acde834
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/4c/10fd771f320d00131249f322b63acde881
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/4c/2088d09b260d00131a9bb9bc5a5e617122
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/4c/30e8770c260d00131a9bb9bc5a5e617171
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/4c/d04b30d8520d00131719b896d543f08c62
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/4e/40eb8393390d00131524a793807f338e85
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/4e/5025c807320d00131249f322b63acde882
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/4e/60e7a753340d00131249f322b63acde858
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/4e/709e4dd5770d00131719b896d543f08c193
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/4e/d078d3c5670d00131719b896d543f08c87
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/4f/20629bba350d00131249f322b63acde866
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/5/c09802f4810d00131719b896d543f08c28
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/51/1058bc287a0d00131719b896d543f08c195
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/51/d01e0d2c7c0d00131719b896d543f08c202
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/51/e043216f2c0d00131249f322b63acde831
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/52/80fa1082370d00131249f322b63acde880
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/52/908340203a0d00131524a793807f338e101
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/52/b0f7e5f4300d00131249f322b63acde8133
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/53/20300883550d00131719b896d543f08c67
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/53/a06c6384500d00131719b896d543f08c92
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/53/b0d150cf4d0d00131719b896d543f08c149
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/54/105bdc86800d00131719b896d543f08c19
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/55/c0697f702b0d00131249f322b63acde815
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/56/70ea45fe4b0d00131719b896d543f08c102
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/56/e0d3f982370d00131249f322b63acde896
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/58/c0259769680d00131719b896d543f08c92
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/59/604165f5520d00131719b896d543f08c62
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/59/b0dfede04f0d00131719b896d543f08c21
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/5a/1067b967520d00131719b896d543f08c62
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/5a/20289dc1250d00131a9bb9bc5a5e617162
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/5b/a01d01234f0d00131719b896d543f08c42
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/5b/b09b88be520d00131719b896d543f08c62
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/5c/40ac8a2a760d00131719b896d543f08c174
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/5c/a0a26974330d00131249f322b63acde853
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/5d/10ddd0bd550d00131719b896d543f08c68
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/5d/b06ac273760d00131719b896d543f08c174
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/5e/5026feaa340d00131249f322b63acde861
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/5f/40817ce9810d00131719b896d543f08c28
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/6/509d88ee670d00131719b896d543f08c91
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/60/c0fbac51760d00131719b896d543f08c173
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/61/503835816a0d00131719b896d543f08c116
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/62/f050f6cd300d00131249f322b63acde8132
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/65/10afe9c2560d00131719b896d543f08c68
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/65/7015966a370d00131249f322b63acde883
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/65/c008735d330d00131249f322b63acde8134
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/66/108b1d6a2c0d00131249f322b63acde872
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/67/7089926a2b0d00131249f322b63acde813
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/67/80e1a600230d00131a9bb9bc5a5e61715
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/6b/40af41ee250d00131a9bb9bc5a5e617169
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/6b/50c980702b0d00131249f322b63acde815
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/6c/e0cb25df390d00131524a793807f338e99
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/6d/30ed916a2b0d00131249f322b63acde813
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/6e/a03ae288270d00131050e648e11def2a28
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/6f/0020dd3c560d00131719b896d543f08c47
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/7/102ad2cb800d00131719b896d543f08c20
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/7/10a4d736550d00131719b896d543f08c241
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/7/806200684f0d00131719b896d543f08c42
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/7/b00ff61a380d00131249f322b63acde897
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/7/f0c8a1b1330d00131249f322b63acde858
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/7/f0e31801750d00131719b896d543f08c160
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/70/501f63f7750d00131719b896d543f08c168
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/70/803f3d632b0d00131249f322b63acde816
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/70/c00737b35b0d00131719b896d543f08c53
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/70/e041e862500d00131719b896d543f08c92
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/71/3084ff9b220d00131a9bb9bc5a5e61713
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/71/b0d73212550d00131719b896d543f08c67
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/72/40aa3d7d680d00131719b896d543f08c109
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/72/7046908d340d00131249f322b63acde861
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/72/b0a7a169550d00131719b896d543f08c240
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/73/006fa23d5a0d00131719b896d543f08c104
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/73/c01d2030760d00131719b896d543f08c173
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/73/c08e77fb780d00131719b896d543f08c192
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/74/40c025d4770d00131719b896d543f08c182
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/74/80e6f54e800d00131719b896d543f08c106
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/74/901b4f2c550d00131719b896d543f08c241
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/75/601f31e7390d00131524a793807f338e99
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/75/b047617e310d00131249f322b63acde8132
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/76/207ce70b330d00131249f322b63acde882
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/76/608e011f4f0d00131719b896d543f08c42
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/77/e09023cf310d00131249f322b63acde835
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/77/f09da14b290d00131249f322b63acde830
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/78/d014d7fc220d00131a9bb9bc5a5e61710
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/79/2065267c2c0d00131249f322b63acde833
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/79/90c475984b0d00131719b896d543f08c63
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/7a/906f6f46800d00131719b896d543f08c9
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/7b/5015928e500d00131719b896d543f08c42
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/7b/b0d770546b0d00131719b896d543f08c151
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/7c/f0024b04260d00131a9bb9bc5a5e617171
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/7c/f0272c32560d00131719b896d543f08c46
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/7d/10fd3cab810d00131719b896d543f08c23
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/7d/e021b37a330d00131249f322b63acde854
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/7e/00390e21280d00131249f322b63acde829
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/7e/a0c4a019530d00131719b896d543f08c33
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/7f/5045a039260d00131a9bb9bc5a5e617171
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/8/208ac81c560d00131719b896d543f08c45
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/8/40515524760d00131719b896d543f08c173
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/8/c064fb4e800d00131719b896d543f08c8
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/80/706d105f250d00131a9bb9bc5a5e617190
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/80/9080b2de4d0d00131719b896d543f08c107
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/81/10091b6d2b0d00131249f322b63acde818
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/81/60af4207370d00131249f322b63acde863
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/81/d0e51ef7320d00131249f322b63acde831
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/82/70f000a8770d00131719b896d543f08c178
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/82/909cd18d310d00131249f322b63acde8133
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/84/30d53cf3280d00131249f322b63acde869
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/84/700a3adf290d00131249f322b63acde831
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/84/901e3ac8250d00131a9bb9bc5a5e617164
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/84/c01bf7ee550d00131719b896d543f08c67
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/84/c080c339520d00131719b896d543f08c241
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/86/90090791270d00131050e648e11def2a22
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/86/b0ac05a2810d00131719b896d543f08c23
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/87/201980b5760d00131719b896d543f08c176
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/87/5019e3b3260d00131a9bb9bc5a5e617128
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/87/50ba72af3b0d00131524a793807f338e7
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/87/d0e225b3310d00131249f322b63acde880
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/88/50d41de3290d00131249f322b63acde830
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/88/a0228599540d00131719b896d543f08c87
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/88/a0b797df250d00131a9bb9bc5a5e617169
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/89/0029672d5a0d00131719b896d543f08c34
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/8a/c0860fa32d0d00131249f322b63acde872
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/8b/908f0c6a360d00131249f322b63acde872
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/8b/d056c37d2d0d00131249f322b63acde836
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/8c/10eb0b46390d00131524a793807f338e84
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/8c/e09a6d15560d00131719b896d543f08c45
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/8d/10e89b06370d00131249f322b63acde863
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/8d/80e1dd33540d00131719b896d543f08c85
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/8d/a08e799e530d00131719b896d543f08c37
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/8d/a0b8e0b1310d00131249f322b63acde878
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/8d/b05c6824790d00131719b896d543f08c192
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/8e/b08854886b0d00131719b896d543f08c149
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/8f/e0acc70a360d00131249f322b63acde872
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/8f/f0503e632b0d00131249f322b63acde816
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/9/80eaba674e0d00131719b896d543f08c10
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/9/d0125955810d00131719b896d543f08c23
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/90/00e09e727b0d00131719b896d543f08c198
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/90/2028ee04230d00131a9bb9bc5a5e617110
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/90/d01af94e800d00131719b896d543f08c205
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/92/90d0196d2b0d00131249f322b63acde818
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/95/6090f2e14d0d00131719b896d543f08c29
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/95/d0e2b9652c0d00131249f322b63acde830
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/96/00f46dd44f0d00131719b896d543f08c19
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/96/7099eaee250d00131a9bb9bc5a5e617171
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/96/d045188a780d00131719b896d543f08c191
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/97/b0d85224540d00131719b896d543f08c42
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/97/b0e93a1f560d00131719b896d543f08c46
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/98/90d9c0a3260d00131a9bb9bc5a5e617128
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/98/c0bccf492c0d00131249f322b63acde85
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/98/d01ce77a780d00131719b896d543f08c192
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/99/502b88e7810d00131719b896d543f08c28
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/99/603b4d34230d00131a9bb9bc5a5e617110
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/99/70ce9093370d00131249f322b63acde896
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/9b/90a9ae62770d00131719b896d543f08c181
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/9c/606048dc370d00131249f322b63acde896
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/9d/1036ff9b220d00131a9bb9bc5a5e61712
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/9d/3091338f6b0d00131719b896d543f08c156
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/9e/80db2574360d00131249f322b63acde872
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/9f/90356481800d00131719b896d543f08c15
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/9f/a064e6d0330d00131249f322b63acde858
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/9f/f04144582b0d00131249f322b63acde816
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/a/40b9ebd22d0d00131249f322b63acde873
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/a0/70559b0a250d00131a9bb9bc5a5e617116
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/a0/90d4db88800d00131719b896d543f08c19
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/a0/e0b88562370d00131249f322b63acde871
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/a2/308cf16f2c0d00131249f322b63acde832
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/a2/50ad9b0a560d00131719b896d543f08c43
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/a3/f02825fc2d0d00131249f322b63acde874
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/a6/a016c8c14f0d00131719b896d543f08c20
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/a7/a0893aae550d00131719b896d543f08c68
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/a8/20fcf44e800d00131719b896d543f08c32
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/a8/80a9829d690d00131719b896d543f08c116
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/a9/100cbe75540d00131719b896d543f08c86
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/a9/409f33a52d0d00131249f322b63acde872
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/a9/e083aa57340d00131249f322b63acde860
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/aa/1010278f550d00131719b896d543f08c241
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/aa/a0a35aa1550d00131719b896d543f08c242
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/ab/608c6879260d00131a9bb9bc5a5e617169
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/ac/00248cbd360d00131249f322b63acde871
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/ae/30296b52560d00131719b896d543f08c47
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/ae/c0defd575a0d00131719b896d543f08c68
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/af/30d4b2674e0d00131719b896d543f08c35
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/b0/7084ef6a550d00131719b896d543f08c241
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/b0/c09fb905760d00131719b896d543f08c171
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/b0/d04f2b58380d00131249f322b63acde899
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/b2/00a1a652550d00131719b896d543f08c240
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/b2/00b0df34260d00131a9bb9bc5a5e617171
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/b2/806ea1b54f0d00131719b896d543f08c19
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/b2/a0011e00530d00131719b896d543f08c22
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/b3/005ecbdb800d00131719b896d543f08c20
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/b5/d054deff370d00131249f322b63acde896
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/b5/e0f38c9f260d00131a9bb9bc5a5e617127
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/b5/f0db4c2f390d00131524a793807f338e84
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/b6/907c20d0330d00131249f322b63acde858
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/b7/00d0ee3f5a0d00131719b896d543f08c104
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/b7/7017f2e32d0d00131249f322b63acde874
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/b9/002a6f89770d00131719b896d543f08c178
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/bd/90228f69800d00131719b896d543f08c8
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/bf/a0e7485e390d00131524a793807f338e84
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/bf/b07e9999380d00131249f322b63acde834
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/bf/c0281dde290d00131249f322b63acde831
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/c/20533453360d00131249f322b63acde872
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/c/c0b909df780d00131719b896d543f08c62
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/c1/70c31bc4770d00131719b896d543f08c180
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/c1/90049d68370d00131249f322b63acde884
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/c2/305132042e0d00131249f322b63acde877
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/c2/905743582b0d00131249f322b63acde816
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/c3/c02b54e56a0d00131719b896d543f08c137
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/c3/e083ea64370d00131249f322b63acde885
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/c4/80454f67500d00131719b896d543f08c92
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/c4/a02a68e4550d00131719b896d543f08c66
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/c5/b0f3fcc27c0d00131719b896d543f08c204
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/c8/b082216a2c0d00131249f322b63acde831
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/c9/406dedec4e0d00131719b896d543f08c41
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/ca/20f3b0b5340d00131249f322b63acde862
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/ca/90266484690d00131719b896d543f08c114
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/ca/a02a83fc310d00131249f322b63acde880
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/ca/d0283431550d00131719b896d543f08c241
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/cb/30fcab3d6b0d00131719b896d543f08c137
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/cc/30d547d6300d00131249f322b63acde8132
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/cc/40540cea780d00131719b896d543f08c65
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/cc/a06019c6550d00131719b896d543f08c66
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/cc/b0cf5a29320d00131249f322b63acde881
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/cc/e0b44c18280d00131249f322b63acde829
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/ce/400f0022790d00131719b896d543f08c65
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/cf/509df39b220d00131a9bb9bc5a5e61715
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/cf/80bdfc51360d00131249f322b63acde872
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/cf/80e32f683a0d00131524a793807f338e85
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/cf/b0399970330d00131249f322b63acde848
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/d1/e0493fd6550d00131719b896d543f08c64
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/d2/80c7346a770d00131719b896d543f08c181
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/d3/d07246a16a0d00131719b896d543f08c128
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/d4/b08e74497f0d00131719b896d543f08c7
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/d6/70651b8c4f0d00131719b896d543f08c42
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/d7/50a452ea310d00131249f322b63acde880
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/d7/50d6caf2240d00131a9bb9bc5a5e617127
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/d8/90a207514b0d00131719b896d543f08c101
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/d8/f0ae11884d0d00131719b896d543f08c16
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/d9/b0831880280d00131249f322b63acde869
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/d9/c0cdd6df780d00131719b896d543f08c64
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/da/b0c3a5433d0d00131524a793807f338e35
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/db/50df9b974b0d00131719b896d543f08c63
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/dd/600b7a0f780d00131719b896d543f08c192
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/dd/c0b636965b0d00131719b896d543f08c106
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/de/20eb032c3c0d00131524a793807f338e100
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/de/a03d00d2760d00131719b896d543f08c177
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/de/f01bbbba310d00131249f322b63acde879
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/df/406bf637390d00131524a793807f338e84
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/e/d06a5fb7520d00131719b896d543f08c241
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/e0/40e5bce9370d00131249f322b63acde898
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/e1/306f6f46360d00131249f322b63acde872
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/e1/9017fa5e2b0d00131249f322b63acde814
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/e1/b01fa77a4e0d00131719b896d543f08c16
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/e4/005a5d292d0d00131249f322b63acde833
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/e4/4039c9d3330d00131249f322b63acde858
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/e4/d0880974550d00131719b896d543f08c68
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/e6/20fcf772310d00131249f322b63acde8133
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/e7/00e5c3933a0d00131524a793807f338e22
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/e9/201bd58e370d00131249f322b63acde895
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/eb/0041c861520d00131719b896d543f08c64
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/eb/50149cac330d00131249f322b63acde854
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/eb/50fcb17a260d00131a9bb9bc5a5e617169
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/ed/d0b50c637c0d00131719b896d543f08c203
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/ee/800bef37290d00131249f322b63acde873
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/ee/8094037e770d00131719b896d543f08c181
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/ee/e062b6d0520d00131719b896d543f08c62
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/f/702f615d280d00131249f322b63acde868
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/f/c043e2232c0d00131249f322b63acde829
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/f0/a000529a350d00131249f322b63acde863
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/f1/00249bf3370d00131249f322b63acde898
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/f1/e068ac2a250d00131a9bb9bc5a5e617190
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/f1/e0f0dd782c0d00131249f322b63acde831
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/f2/101fed70800d00131719b896d543f08c15
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/f4/a087fd4e800d00131719b896d543f08c8
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/f4/a0da18d74d0d00131719b896d543f08c133
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/f6/50b3bf00680d00131719b896d543f08c91
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/f6/c0432fca650d00131719b896d543f08c56
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/f6/f009dded390d00131524a793807f338e100
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/f6/f0f9d74b5a0d00131719b896d543f08c51
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/f7/404fa93a860d00131719b896d543f08c30
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/f8/10ed0356660d00131719b896d543f08c86
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/f8/60faee49750d00131719b896d543f08c159
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/f9/40812ada6a0d00131719b896d543f08c137
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/f9/e06a5470670d00131719b896d543f08c86
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/fa/f0caef03230d00131a9bb9bc5a5e61715
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/fb/10233142530d00131719b896d543f08c33
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/fb/10a53b2a7a0d00131719b896d543f08c197
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/fb/901006312c0d00131249f322b63acde80
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/fb/d0859c9d370d00131249f322b63acde896
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/fb/d0f7938e550d00131719b896d543f08c240
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/fb/e0d4eed4300d00131249f322b63acde8133
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/fc/f05e84f54e0d00131719b896d543f08c42
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/fd/50c48d3c520d00131719b896d543f08c64
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/fd/7081acc66c0d00131719b896d543f08c154
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/fd/90b04d264f0d00131719b896d543f08c42
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/fe/4015f3cd330d00131249f322b63acde858
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.history/fe/c09a68a94b0d00131719b896d543f08c63
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/a0/5f/properties.indexbin430 -> 0 bytes
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/a0/62/properties.indexbin639 -> 0 bytes
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/a0/66/properties.indexbin167 -> 0 bytes
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/a0/cd/properties.indexbin162 -> 0 bytes
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/a0/d6/history.indexbin631 -> 0 bytes
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/a0/d6/properties.indexbin1953 -> 0 bytes
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/a0/de/history.indexbin224 -> 0 bytes
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/a0/de/properties.indexbin410 -> 0 bytes
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/a0/eb/properties.indexbin158 -> 0 bytes
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/a0/ee/properties.indexbin158 -> 0 bytes
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/af/history.indexbin94 -> 0 bytes
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/e4/81/32/ea/history.indexbin8568 -> 0 bytes
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/e4/history.indexbin76 -> 0 bytes
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/history.indexbin413 -> 0 bytes
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/properties.indexbin1048 -> 0 bytes
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.markersbin3779 -> 0 bytes
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.markers.snapbin42350 -> 0 bytes
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.syncinfo.snapbin688 -> 0 bytes
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/history.version1
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.indexbin234 -> 0 bytes
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.version1
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.root/.markers.snapbin715 -> 0 bytes
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.root/7.treebin9558 -> 0 bytes
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resourcesbin18176 -> 0 bytes
-rw-r--r--client/.metadata/.plugins/org.eclipse.core.resources/.snapbin32995 -> 0 bytes
395 files changed, 0 insertions, 29518 deletions
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/0/b08b1b0b560d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/0/b08b1b0b560d00131719b896d543f08c
deleted file mode 100644
index 02e3800..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/0/b08b1b0b560d00131719b896d543f08c
+++ /dev/null
@@ -1,45 +0,0 @@
-package com.macaroon.piztor;
-
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-
-public class Main extends PiztorAct {
-
- ActMgr actMgr;
-
- Handler handler = new Handler() {
- @Override
- public void handleMessage(Message m) {
- Location l = (Location) m.objl
- ReqUpdate r = new ReqUpdate(UserInfo.token, , longitude, time, alive)
- AppMgr.transam.send();
- }
- };
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/1/907f38e9220d00131a9bb9bc5a5e6171 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/1/907f38e9220d00131a9bb9bc5a5e6171
deleted file mode 100644
index 44f93d4..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/1/907f38e9220d00131a9bb9bc5a5e6171
+++ /dev/null
@@ -1,4 +0,0 @@
-
-class Exception {
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/1/e0fccb09380d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/1/e0fccb09380d00131249f322b63acde8
deleted file mode 100644
index 633f742..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/1/e0fccb09380d00131249f322b63acde8
+++ /dev/null
@@ -1,96 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
-
-
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- int loginButtonClick = 1, retryButtonClick = 2, loginFailed = 3;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- } else if (m.what == 101) {
- actMgr.trigger(loginFailed);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
- }
-
- class LoginStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- String user = edtUser.getText().toString();
- String pass = edtPass.getText().toString();
- long nowtime = System.currentTimeMillis();
- AppMgr.transam.send(new ReqLogin(user, pass, nowtime, 1000));
- }
-
- @Override
- void leave(int e) {
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- ActStatus[] r = new ActStatus[2];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- //AppMgr.transam.send(new ReqLogin(u, p, time, alive))
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/1/f02df33e860d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/1/f02df33e860d00131719b896d543f08c
deleted file mode 100644
index 0c5fcbc..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/1/f02df33e860d00131719b896d543f08c
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.macaroon.piztor;
-
-import android.annotation.SuppressLint;
-import java.util.HashMap;
-import java.util.Vector;
-
-public class Infomation {
- static String ip = "69.85.86.42";
- static int port = 9990;
- static int token = -1;
- static int myId = -1;
- static int myGroup = -1;
- class UserInfo {
- int id;
- double lat, lot;
- }
-
- class Group {
- int id;
- Vector<UserInfo> v;
- }
-
- static HashMap<Integer, Group> mp;
-
- @SuppressLint("UseSparseArrays")
- static void init() {
- mp = new HashMap<Integer, Group>();
- mp = new Spa
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/12/201d72d3760d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/12/201d72d3760d00131719b896d543f08c
deleted file mode 100644
index 4406dc1..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/12/201d72d3760d00131719b896d543f08c
+++ /dev/null
@@ -1,178 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.Vector;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- @SuppressLint("HandlerLeak")
- Handler fromGPS = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- Handler fromTransam = new Handler() {
- @Override
- public void handleMessage(Message m) {
- switch (m.what) {
- case 3:
- ResLocation location = (ResLocation) m.obj;
- for (int i = 0; i < location.n; i++) {
- System.out.println(location.l.get(i).lat + " " + location.l.get(i).lot);
- }
- actMgr.trigger(SuccessFetch);
- break;
- case 2:
- ResUpdate update = (ResUpdate) m.obj;
- if (update.t == 0) System.out.println("update success");
- else System.out.println("update failed");
- break;
- default:
- break;
- }
-
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "Search Button Press";
- case FetchButtonPress:
- return "Fetch Button Press";
- case FocuseButtonPress:
- return "Focuse Button Press";
- case SuccessFetch:
- return "Success Fetch";
- case FailedFetch:
- return "Failed Fetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- if (e == SuccessFetch) {
-
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter Fetch status!!!!");
- if (e == FetchButtonPress) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1,
- System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave fetch status!!!! because" + cause(e));
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter focus status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave focus status!!!! because" + cause(e));
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(fromGPS);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
- btnFetch.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(FetchButtonPress);
- }
- });
- btnFocus.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- actMgr.trigger(FocuseButtonPress);
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/13/6046c8d2670d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/13/6046c8d2670d00131719b896d543f08c
deleted file mode 100644
index c3a9bbe..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/13/6046c8d2670d00131719b896d543f08c
+++ /dev/null
@@ -1,91 +0,0 @@
-package com.macaroon.piztor;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
-
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- @SuppressLint("HandlerLeak")
- Handler handler = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- if (l == null)
- System.out.println("fuck!!!");
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- void leave(int e) {
- // TODO Auto-generated method stub
-
- }
-
- }
-
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(handler);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/15/80676cae330d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/15/80676cae330d00131249f322b63acde8
deleted file mode 100644
index a3b8c65..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/15/80676cae330d00131249f322b63acde8
+++ /dev/null
@@ -1,57 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- Handler hand = new Handler() {
- @Override
- boolean sendMessage(Message m) {
-
- }
- };
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/16/30f189812c0d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/16/30f189812c0d00131249f322b63acde8
deleted file mode 100644
index 5d2cc7c..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/16/30f189812c0d00131249f322b63acde8
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.app.Activity;
-import android.view.Menu;
-
-public class InitAct extends PiztorAct {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "initAct";
- super.onCreate(savedInstanceState);
- AppMgr.init();
- setContentView(R.layout.activity_init);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- if (UserInfo.token != -1)
- AppMgr.trigger(AppMgr.noToken);
- else {
- //TODO
- }
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- getMenuInflater().inflate(R.menu.init, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/16/c03b1eb7550d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/16/c03b1eb7550d00131719b896d543f08c
deleted file mode 100644
index b653442..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/16/c03b1eb7550d00131719b896d543f08c
+++ /dev/null
@@ -1,68 +0,0 @@
-package com.macaroon.piztor;
-
-import android.content.Context;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import android.location.Location;
-import android.content.Context;
-import android.os.Handler;
-import android.os.Message;
-import android.util.Log;
-import android.os.SystemClock;
-
-
-public class Tracker implements Runnable {
-
- private static final long TIME_DELTA = 1000 * 3; // 3 second
- public Timer timer;
- private final Context mContext;
- GPSTracker myTracker;
- Handler mHandler;
- Message message;
-
- public Tracker(Context context, Handler yHandler) {
- timer = new Timer();
- mContext = context;
- myTracker = new GPSTracker(mContext);
- mHandler = yHandler;
- }
-
- void setHandler(Handler hand) {
- mHandler = hand;
- }
-
-
- public void run() {
- GPSTask myTask = new GPSTask();
- timer.schedule(myTask, 0, TIME_DELTA);
- }
-
- class GPSTask extends TimerTask {
- @Override
- public void run() {
- message = new Message();
- message.what = 0;
- myTracker.getLocation();
- Log.d("Location", "Fetching location.....");
- if (myTracker.canGetLocation()) {
- double latitude = myTracker.getLatitude();
- double longitude = myTracker.getLongitude();
-
- Log.d("TTTTTTTTTTTTTTTTTTTTTTTime","TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTime");
- System.out.println("GPSTIME" + myTracker.location.getTime());
- System.out.println("SYSTIME" + SystemClock.elapsedRealtime());
-
- if(myTracker.isGPSFix()) {
- message.what = 1;
- } else {
- message.what = 2;
- }
- mHandler.sendMessage(message);
- } else {
- message.what = 0;
- mHandler.sendMessage(message);
- }
- }
- }
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/17/8029226c800d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/17/8029226c800d00131719b896d543f08c
deleted file mode 100644
index 16bf50d..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/17/8029226c800d00131719b896d543f08c
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.macaroon.piztor;
-
-public class Infomation {
- static String ip = "69.85.86.42";
- static int port = 9990;
- static int token = -1;
-
- static class UserInfo {
- double lat, lon;
- }
-
- static class Group {
-
- }
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/17/b039f5b4330d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/17/b039f5b4330d00131249f322b63acde8
deleted file mode 100644
index 3058eb2..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/17/b039f5b4330d00131249f322b63acde8
+++ /dev/null
@@ -1,59 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- Handler hand = new Handler() {
- @Override
- public
- boolean sendMessage(Message m) {
-
- }
- };
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/18/00a5e084260d00131a9bb9bc5a5e6171 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/18/00a5e084260d00131a9bb9bc5a5e6171
deleted file mode 100644
index 270ce20..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/18/00a5e084260d00131a9bb9bc5a5e6171
+++ /dev/null
@@ -1,68 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
-
- //Event
-
- final static int hasToken = 1;
-
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
-
- Intent i = new Intent();
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- addStatus(InitAct.class);
- addStatus(Login.class);
- addTransition(InitAct.class, hasToken, Login.class);
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/19/b01e7ce6220d00131a9bb9bc5a5e6171 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/19/b01e7ce6220d00131a9bb9bc5a5e6171
deleted file mode 100644
index e69de29..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/19/b01e7ce6220d00131a9bb9bc5a5e6171
+++ /dev/null
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/19/b06a41ee310d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/19/b06a41ee310d00131249f322b63acde8
deleted file mode 100644
index 6c0b0eb..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/19/b06a41ee310d00131249f322b63acde8
+++ /dev/null
@@ -1,81 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-import android.os.Handler;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
- //TODO fix
- static Handler fromTransam, fromGPS;
- //Event
-
- final static int noToken = 101;
-
-
- static Transam transam = null;
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
- Intent i = new Intent();
- System.out.println(nowAct.id + " : " + event);
- if (mp.get(nowAct.getClass()) == null)
- System.out.println("first");
- else if (mp.get(nowAct.getClass()) == null)
- System.out.println("second");
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- fromTransam = new Handler();
- transam = new Transam(UserInfo.ip, UserInfo.port, fromTransam);
- fromGPS = new Handler();
-
- new Thread(transam).run();
- addStatus(InitAct.class);
- addStatus(Login.class);
- addTransition(InitAct.class, noToken, Login.class);
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/1b/1001f39b220d00131a9bb9bc5a5e6171 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/1b/1001f39b220d00131a9bb9bc5a5e6171
deleted file mode 100644
index ae72ba5..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/1b/1001f39b220d00131a9bb9bc5a5e6171
+++ /dev/null
@@ -1,17 +0,0 @@
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.macaroon.piztor"
- android:versionCode="1"
- android:versionName="1.0" >
-
- <uses-sdk
- android:minSdkVersion="8"
- android:targetSdkVersion="17" />
-
- <application
- android:allowBackup="true"
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name"
- android:theme="@style/AppTheme" >
- </application>
-
-</manifest>
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/1b/e052bedc670d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/1b/e052bedc670d00131719b896d543f08c
deleted file mode 100644
index c3a9bbe..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/1b/e052bedc670d00131719b896d543f08c
+++ /dev/null
@@ -1,91 +0,0 @@
-package com.macaroon.piztor;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
-
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- @SuppressLint("HandlerLeak")
- Handler handler = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- if (l == null)
- System.out.println("fuck!!!");
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- void leave(int e) {
- // TODO Auto-generated method stub
-
- }
-
- }
-
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(handler);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/1c/0084ccf2240d00131a9bb9bc5a5e6171 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/1c/0084ccf2240d00131a9bb9bc5a5e6171
deleted file mode 100644
index a88b749..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/1c/0084ccf2240d00131a9bb9bc5a5e6171
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
-
- <string name="app_name">Piztor</string>
- <string name="action_settings">Settings</string>
- <string name="hello_world">Hello world!</string>
-
-</resources>
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/1c/c097adfa670d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/1c/c097adfa670d00131719b896d543f08c
deleted file mode 100644
index 6966e0f..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/1c/c097adfa670d00131719b896d543f08c
+++ /dev/null
@@ -1,91 +0,0 @@
-package com.macaroon.piztor;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
-
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- @SuppressLint("HandlerLeak")
- Handler handler = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- if (l == null)
- System.out.println("fuck!!!");
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- void leave(int e) {
- // TODO Auto-generated method stub
-
- }
-
- }
-
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(handler);
- EmptyStatus[] r = new EmptyStatus[2];
- r[0] = new StartStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/1f/305dce064c0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/1f/305dce064c0d00131719b896d543f08c
deleted file mode 100644
index 4f16d24..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/1f/305dce064c0d00131719b896d543f08c
+++ /dev/null
@@ -1,103 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
-
-
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- int loginButtonClick = 1, retryButtonClick = 2, loginFailed = 3;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- cout.println(m.what);
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- } else if (m.what == 101) {
- actMgr.trigger(loginFailed);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
- }
-
- class LoginStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- String user = edtUser.getText().toString();
- String pass = edtPass.getText().toString();
- long nowtime = System.currentTimeMillis();
- System.out.println(user + " : " + pass + "\n");
- AppMgr.transam.send(new ReqLogin(user, pass, nowtime, 1000));
- }
-
- @Override
- void leave(int e) {
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- ActStatus[] r = new ActStatus[2];
- r[0] = new StartStatus();
- r[1] = new LoginStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], loginButtonClick, r[1]);
- actMgr.add(r[1], loginFailed, r[0]);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(loginButtonClick);
- }
- });
- }
-
- @Override
- protected void onResume() {
- super.onResume();
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/2/c0e1f0e53a0d00131524a793807f338e b/client/.metadata/.plugins/org.eclipse.core.resources/.history/2/c0e1f0e53a0d00131524a793807f338e
deleted file mode 100644
index 71415fe..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/2/c0e1f0e53a0d00131524a793807f338e
+++ /dev/null
@@ -1,85 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-import android.os.Handler;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
- //TODO fix
- static Handler fromTransam, fromGPS;
- static Transam transam = null;
- static Thread tTransam, tGPS;
- //Event
-
- final static int noToken = 101;
- final static int loginSuccess = 102;
-
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
- Intent i = new Intent();
- System.out.println(nowAct.id + " : " + event);
- if (mp.get(nowAct.getClass()) == null)
- System.out.println("first");
- else if (mp.get(nowAct.getClass()) == null)
- System.out.println("second");
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- fromTransam = new Handler();
- transam = new Transam(UserInfo.ip, UserInfo.port, fromTransam);
- //fromGPS = new Handler();
- tTransam = new Thread(transam);
- tTransam.run();
- System.out.println("!!!!!!");
- addStatus(InitAct.class);
- addStatus(Login.class);
- addStatus(Main.class);
- addTransition(InitAct.class, noToken, Login.class);
- addTransition(Login.class, loginSuccess, Main.class);
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/22/20302442660d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/22/20302442660d00131719b896d543f08c
deleted file mode 100644
index 5dd8ba4..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/22/20302442660d00131719b896d543f08c
+++ /dev/null
@@ -1,82 +0,0 @@
-package com.macaroon.piztor;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-
-public class Main extends PiztorAct {
-
- ActMgr actMgr;
-
- @SuppressLint("HandlerLeak")
- Handler handler = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- if (l == null)
- System.out.println("fuck!!!");
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- void leave(int e) {
- // TODO Auto-generated method stub
-
- }
-
- }
-
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(handler);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/22/b0553560360d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/22/b0553560360d00131249f322b63acde8
deleted file mode 100644
index 12a937e..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/22/b0553560360d00131249f322b63acde8
+++ /dev/null
@@ -1,72 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
-
-
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- int loginButtonClick = 1, retryButtonClick = 2, loginFailed = 3;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- } else (m.what == 101) {
- actMgr.trigger(loginFailed);
- }
- }
- };
-
-
-
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- //AppMgr.transam.send(new ReqLogin(u, p, time, alive))
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/24/40a1e7d3340d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/24/40a1e7d3340d00131249f322b63acde8
deleted file mode 100644
index c8f52ad..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/24/40a1e7d3340d00131249f322b63acde8
+++ /dev/null
@@ -1,63 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- }
- }
- };
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
-
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/24/602725f7320d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/24/602725f7320d00131249f322b63acde8
deleted file mode 100644
index 0b8f112..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/24/602725f7320d00131249f322b63acde8
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
-
- <string name="app_name">Piztor</string>
- <string name="action_settings">Settings</string>
- <string name="hello_world">Hello world!</string>
- <string name="title_activity_login">Login</string>
-
-</resources>
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/25/60c3225c250d00131a9bb9bc5a5e6171 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/25/60c3225c250d00131a9bb9bc5a5e6171
deleted file mode 100644
index e0a3278..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/25/60c3225c250d00131a9bb9bc5a5e6171
+++ /dev/null
@@ -1,90 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="fill_parent"
- android:background="@android:color/black"
- android:orientation="vertical">
-
-<LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:background="@android:color/black"
- android:gravity="center_horizontal"
- android:orientation="vertical" >
-
- <ImageView
- android:id="@+id/main_headbar_img"
- android:layout_width="180dp"
- android:layout_height="240dp"
- android:layout_gravity="center_horizontal"
- android:src="@drawable/title_logo" />
-
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:layout_gravity="center">
-
- <TableLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <TableRow
- android:layout_marginBottom="15dp"
- android:layout_marginTop="15dp">
- <TextView
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="0.25"
- android:gravity="right"
- android:id="@+id/user_id_text"
- android:text="User ID"
- android:textColor="@android:color/white"
- />
-
- <EditText
- android:layout_width="0dp"
- android:layout_weight="0.75"
- android:id="@+id/user_id"
- android:singleLine="true"/>
- <requestFocus/>
- </TableRow>
-
- <TableRow>
- <TextView
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="0.25"
- android:gravity="right"
- android:id="@+id/user_pass_text"
- android:text="Password"
- android:textColor="@android:color/white"
- />
-
- <EditText
- android:layout_width="0dp"
- android:layout_weight="0.75"
- android:id="@+id/user_pass"
- android:password="true"
- android:singleLine="true"/>
- </TableRow>
- </TableLayout>
- </LinearLayout>
-
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:orientation="vertical"
- >
- <Button
- android:id="@+id/login_btn_login"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:text="Login"
- android:textColor="@android:color/white" />
- </LinearLayout>
-
-</LinearLayout>
-</RelativeLayout>
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/25/703b1352250d00131a9bb9bc5a5e6171 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/25/703b1352250d00131a9bb9bc5a5e6171
deleted file mode 100644
index 629f1c1..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/25/703b1352250d00131a9bb9bc5a5e6171
+++ /dev/null
@@ -1,90 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="fill_parent"
- android:background="@android:color/black"
- android:orientation="vertical">
-
-<LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:background="@android:color/black"
- android:gravity="center_horizontal"
- android:orientation="vertical" >
-
- <ImageView
- android:id="@+id/main_headbar_img"
- android:layout_width="180dp"
- android:layout_height="240dp"
- android:layout_gravity="center_horizontal"
- android:src="@drawable/title_logo" />
-
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:layout_gravity="center">
-
- <TableLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <TableRow
- android:layout_marginBottom="15dp"
- android:layout_marginTop="15dp">
- <TextView
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="0.25"
- android:gravity="right"
- android:id="@+id/user_id_text"
- android:text="User ID"
- android:textColor="@android:color/white"
- />
-
- <EditText
- android:layout_width="0dp"
- android:layout_weight="0.75"
- android:id="@+id/user_id"
- android:singleLine="true">
- <requestFocus/>
- </TableRow>
-
- <TableRow>
- <TextView
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="0.25"
- android:gravity="right"
- android:id="@+id/user_pass_text"
- android:text="Password"
- android:textColor="@android:color/white"
- />
-
- <EditText
- android:layout_width="0dp"
- android:layout_weight="0.75"
- android:id="@+id/user_pass"
- android:password="true"
- android:singleLine="true"/>
- </TableRow>
- </TableLayout>
- </LinearLayout>
-
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:orientation="vertical"
- >
- <Button
- android:id="@+id/login_btn_login"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:text="Login"
- android:textColor="@android:color/white" />
- </LinearLayout>
-
-</LinearLayout>
-</RelativeLayout>
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/25/e0a3222e250d00131a9bb9bc5a5e6171 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/25/e0a3222e250d00131a9bb9bc5a5e6171
deleted file mode 100644
index 809994b..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/25/e0a3222e250d00131a9bb9bc5a5e6171
+++ /dev/null
@@ -1,91 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="fill_parent"
- android:background="@android:color/black"
- android:orientation="vertical">
-
-<LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:background="@android:color/black"
- android:gravity="center_horizontal"
- android:orientation="vertical" >
-
- <ImageView
- android:id="@+id/main_headbar_img"
- android:layout_width="180dp"
- android:layout_height="240dp"
- android:layout_gravity="center_horizontal"
- android:src="@drawable/title_logo" />
-
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:layout_gravity="center">
-
- <TableLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <TableRow
- android:layout_marginBottom="15dp"
- android:layout_marginTop="15dp">
- <TextView
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="0.25"
- android:gravity="right"
- android:id="@+id/user_id_text"
- android:text="User ID"
- android:textColor="@android:color/white"
- />
-
- <EditText
- android:layout_width="0dp"
- android:layout_weight="0.75"
- android:id="@+id/user_id"
- android:singleLine="true">
- <requestFocus/>
- />
- </TableRow>
-
- <TableRow>
- <TextView
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="0.25"
- android:gravity="right"
- android:id="@+id/user_pass_text"
- android:text="Password"
- android:textColor="@android:color/white"
- />
-
- <EditText
- android:layout_width="0dp"
- android:layout_weight="0.75"
- android:id="@+id/user_pass"
- android:password="true"
- android:singleLine="true"/>
- </TableRow>
- </TableLayout>
- </LinearLayout>
-
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:orientation="vertical"
- >
- <Button
- android:id="@+id/login_btn_login"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:text="Login"
- android:textColor="@android:color/white" />
- </LinearLayout>
-
-</LinearLayout>
-</RelativeLayout>
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/26/10fa1d9f550d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/26/10fa1d9f550d00131719b896d543f08c
deleted file mode 100644
index 742b99a..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/26/10fa1d9f550d00131719b896d543f08c
+++ /dev/null
@@ -1,241 +0,0 @@
-package com.macaroon.piztor;
-
-import android.app.AlertDialog;
-import android.app.Service;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.location.Location;
-import android.location.LocationListener;
-import android.location.LocationManager;
-import android.location.GpsStatus;
-import android.os.Bundle;
-import android.os.IBinder;
-import android.os.SystemClock;
-import android.provider.Settings;
-import android.util.Log;
-
-public class GPSTracker extends Service implements LocationListener, GpsStatus.Listener {
-
- private final Context mContext;
-
- // flag for GPS status
- boolean isGPSEnabled = false;
-
- // flag for network status
- boolean isNetworkEnabled = false;
-
- // flag for GPS status
- boolean canGetLocation = false;
-
- Location location; // location
- double latitude; // latitude
- double longitude; // longitude
-
- // The minimum distance to change Updates in meters
- private static final long MIN_DISTANCE_CHANGE_FOR_UPDATES = 10; // 10 meters
-
- // The minimum time between updates in milliseconds
- private static final long MIN_TIME_BW_UPDATES = 1000 * 3; // 10 seconds
-
- // Declaring a Location Manager
- protected LocationManager locationManager;
-
- // for GPS satellite status listener
- Location mLastLocation;
- long mLastLocationMillis;
- boolean isGPSFix;
-
-
- public GPSTracker(Context context) {
- this.mContext = context;
- isGPSFix = false;
- getLocation();
- }
-
- public Location getLocation() {
- try {
- Log.d("getLocation", "Start getting location......");
-
- locationManager = (LocationManager) mContext
- .getSystemService(LOCATION_SERVICE);
-
- // getting GPS status
- isGPSEnabled = locationManager
- .isProviderEnabled(LocationManager.GPS_PROVIDER);
-
- // getting network status
- isNetworkEnabled = locationManager
- .isProviderEnabled(LocationManager.NETWORK_PROVIDER);
-
- if (!isGPSEnabled) {
- // no network provider is enabled
- } else {
- this.canGetLocation = true;
- if (isNetworkEnabled) {
- locationManager.requestLocationUpdates(
- LocationManager.NETWORK_PROVIDER,
- MIN_TIME_BW_UPDATES,
- MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
-
- Log.d("Network", "Network Updated");
-
- if (locationManager != null) {
- location = locationManager
- .getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
- if (location != null) {
- latitude = location.getLatitude();
- longitude = location.getLongitude();
-
- Log.d("Network", "Received Network Data");
- System.out.println("***From Network: "+latitude + " " + longitude);
- }
- }
- }// end of network section
- // if GPS Enabled get lat/long using GPS Services
- if (isGPSEnabled) {
- if (true) {
- locationManager.requestLocationUpdates(
- LocationManager.GPS_PROVIDER,
- MIN_TIME_BW_UPDATES,
- MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
- Log.d("GPS", "GPS Updated");
- if (locationManager != null) {
- location = locationManager
- .getLastKnownLocation(LocationManager.GPS_PROVIDER);
- if (location != null) {
- latitude = location.getLatitude();
- longitude = location.getLongitude();
-
- Log.d("GPS", "Received GPS Data");
- System.out.println("***From GPS: "+latitude + " " + longitude);
-
- }
- }
- }
- }// end of GPS section
- }// end of fetching data
- } catch (Exception e) {
- e.printStackTrace();
- return null;
- }
- return location;
- }
-
- /**
- * Stop using GPS listener Calling this function will stop using GPS in your
- * app
- * */
- public void stopUsingGPS() {
- if (locationManager != null) {
- locationManager.removeUpdates(GPSTracker.this);
- }
- }
-
- /**
- * Function to get latitude
- * */
- public double getLatitude() {
- if (location != null) {
- latitude = location.getLatitude();
- }
- return latitude;
- }
-
- /**
- * Function to get longitude
- * */
- public double getLongitude() {
- if (location != null) {
- longitude = location.getLongitude();
- }
- return longitude;
- }
-
- /**
- * Function to check GPS/wifi enabled
- *
- * @return boolean
- * */
- public boolean canGetLocation() {
- return this.canGetLocation;
- }
-
- public boolean isGPSFix() {
- return (this.isGPSFix && location != null);
- }
-
- /**
- * Function to show settings alert dialog On pressing Settings button will
- * lauch Settings Options
- * */
- public void showSettingsAlert() {
- AlertDialog.Builder alertDialog = new AlertDialog.Builder(mContext);
-
- // Setting Dialog Title
- alertDialog.setTitle("GPS is settings");
-
- // Setting Dialog Message
- alertDialog
- .setMessage("GPS is not enabled. Do you want to go to settings menu?");
-
- // On pressing Settings button
- alertDialog.setPositiveButton("Settings",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- Intent intent = new Intent(
- Settings.ACTION_LOCATION_SOURCE_SETTINGS);
- mContext.startActivity(intent);
- }
- });
-
- // on pressing cancel button
- alertDialog.setNegativeButton("Cancel",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- dialog.cancel();
- }
- });
-
- // Showing Alert Message
- alertDialog.show();
- }
-
- @Override
- public void onLocationChanged(Location location) {
- if (location == null) return;
- mLastLocationMillis = SystemClock.elapsedRealtime();
- mLastLocation = location;
- }
-
- @Override
- public void onProviderDisabled(String provider) {
- }
-
- @Override
- public void onProviderEnabled(String provider) {
- }
-
- @Override
- public void onStatusChanged(String provider, int status, Bundle extras) {
- }
-
- @Override
- public IBinder onBind(Intent arg0) {
- return null;
- }
-
- @Override
- public void onGpsStatusChanged(int event) {
- switch (event) {
- case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
- if(mLastLocation != null)
- isGPSFix = (SystemClock.elapsedRealtime() - mLastLocationMillis) < 3000;
- break;
-
- case GpsStatus.GPS_EVENT_FIRST_FIX:
- isGPSFix = true;
- break;
- }
- }
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/26/60c51154370d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/26/60c51154370d00131249f322b63acde8
deleted file mode 100644
index aa5d479..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/26/60c51154370d00131249f322b63acde8
+++ /dev/null
@@ -1,70 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
-
-
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- int loginButtonClick = 1, retryButtonClick = 2, loginFailed = 3;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- } else if (m.what == 101) {
- actMgr.trigger(loginFailed);
- }
- }
- };
-
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- //AppMgr.transam.send(new ReqLogin(u, p, time, alive))
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/27/20fe519b7a0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/27/20fe519b7a0d00131719b896d543f08c
deleted file mode 100644
index c43caef..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/27/20fe519b7a0d00131719b896d543f08c
+++ /dev/null
@@ -1,196 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.Vector;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- Timer autodate;
- @SuppressLint("HandlerLeak")
- Handler fromGPS = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- Handler fromTransam = new Handler() {
- @Override
- public void handleMessage(Message m) {
- switch (m.what) {
- case 3:
- ResLocation location = (ResLocation) m.obj;
- for (int i = 0; i < location.n; i++) {
- System.out.println(location.l.get(i).lat + " "
- + location.l.get(i).lot);
- }
- actMgr.trigger(SuccessFetch);
- break;
- case 2:
- ResUpdate update = (ResUpdate) m.obj;
- if (update.t == 0)
- System.out.println("update success");
- else
- System.out.println("update failed");
- break;
- default:
- break;
- }
-
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "Search Button Press";
- case FetchButtonPress:
- return "Fetch Button Press";
- case FocuseButtonPress:
- return "Focuse Button Press";
- case SuccessFetch:
- return "Success Fetch";
- case FailedFetch:
- return "Failed Fetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- if (e == TimerFlush) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1, System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter Fetch status!!!!");
- if (e == FetchButtonPress) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1,
- System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave fetch status!!!! because" + cause(e));
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter focus status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave focus status!!!! because" + cause(e));
-
- }
-
- }
-
- class AutoUpdate extends TimerTask {
-
- @Override
- public void run() {
- actMgr.trigger(Main.TimerFlush);
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(fromGPS);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- actMgr.add(r[2], TimerFlush, r[2]);
- autodate = new Timer();
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
- btnFetch.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(FetchButtonPress);
- }
- });
- btnFocus.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- actMgr.trigger(FocuseButtonPress);
- }
- });
- autodate.schedule(new AutoUpdate(), 5000);
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/27/8062fc9c690d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/27/8062fc9c690d00131719b896d543f08c
deleted file mode 100644
index 3245db9..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/27/8062fc9c690d00131719b896d543f08c
+++ /dev/null
@@ -1,115 +0,0 @@
-package com.macaroon.piztor;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- @SuppressLint("HandlerLeak")
- Handler handler = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- if (l == null)
- System.out.println("fuck!!!");
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- void leave(int e) {
- // TODO Auto-generated method stub
-
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- void leave(int e) {
- // TODO Auto-generated method stub
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(handler);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/27/b0ff1ddf650d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/27/b0ff1ddf650d00131719b896d543f08c
deleted file mode 100644
index 10ab5c9..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/27/b0ff1ddf650d00131719b896d543f08c
+++ /dev/null
@@ -1,66 +0,0 @@
-package com.macaroon.piztor;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-
-public class Main extends PiztorAct {
-
- ActMgr actMgr;
-
- @SuppressLint("HandlerLeak")
- Handler handler = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- if (l == null)
- System.out.println("fuck!!!");
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
-
- }
-
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(handler);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/28/005bf7374c0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/28/005bf7374c0d00131719b896d543f08c
deleted file mode 100644
index a976666..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/28/005bf7374c0d00131719b896d543f08c
+++ /dev/null
@@ -1,103 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
-
-
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- int loginButtonClick = 1, retryButtonClick = 2, loginFailed = 3;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- System.out.println(m.what);
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- } else if (m.what == 101) {
- actMgr.trigger(loginFailed);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
- }
-
- class LoginStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- String user = edtUser.getText().toString();
- String pass = edtPass.getText().toString();
- long nowtime = System.currentTimeMillis();
- System.out.println(user + " : " + pass + "\n");
- AppMgr.transam.send(new ReqLogin(user, pass, nowtime, 1000));
- }
-
- @Override
- void leave(int e) {
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- ActStatus[] r = new ActStatus[2];
- r[0] = new StartStatus();
- r[1] = new LoginStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], loginButtonClick, r[1]);
- actMgr.add(r[1], loginFailed, r[0]);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(loginButtonClick);
- }
- });
- }
-
- @Override
- protected void onResume() {
- super.onResume();
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/28/a00c947d310d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/28/a00c947d310d00131249f322b63acde8
deleted file mode 100644
index 3ca0dfe..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/28/a00c947d310d00131249f322b63acde8
+++ /dev/null
@@ -1,133 +0,0 @@
-package com.macaroon.piztor;
-
-import java.io.IOException;
-import java.net.UnknownHostException;
-import java.util.LinkedList;
-import java.util.Queue;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import android.annotation.SuppressLint;
-import android.os.Handler;
-import android.os.Message;
-
-public class Transam implements Runnable {
-
- public Timer timer;
- public Timer mtimer;
- public boolean running = false;
- public boolean flag = true;
- public int cnt = 4;
- Res res;
- Req req;
- public int p; //port
- public String i; //ip
- Thread thread;
- Handler core;
- Handler recall; //recall
- Queue<Req> reqtask ; //request task
-
- Transam(String ip, int port,Handler Recall) {
- p = port;
- i = ip;
- recall = Recall;
- reqtask = new LinkedList<Req>();
- }
-
- public void send(Req r){
- reqtask.offer(r);
-
- }
-
- public void run() { //start the main timer
- //TimerTask tmain = new Timertk();
- //mtimer = new Timer();
- //mtimer.schedule(tmain, 100, 100); //check the queue for every 100 msec
-
- while(true){
- if(running == false){
-
- if(!reqtask.isEmpty()){ //poll the head request
- req = reqtask.poll();
- if(req.time + req.alive < System.currentTimeMillis()){ //time out!
- Message ret = new Message();
- ret.obj = "Time out!";
- ret.what = 100;
- recall.sendMessage(ret);
- }
- else{ //run the request
- final thd t = new thd();
- flag = false;
- thread = new Thread(t);
- cnt = 4;
- running = true;
- thread.start();
- timer = new Timer();
- TimerTask task = new Timertk();
- timer.schedule(task, 2000, 2000);
- }
- }
- }
- }
- }
-
- class tmain extends TimerTask {
- public void run() {
-
- }
- };
-
- class thd implements Runnable {
- public void run() {
- try {
- SocketClient client = new SocketClient(i,p);
- client.sendMsg(req,recall);
- Message msg = new Message();
- msg.what = 1;
- handler.sendMessage(msg);
- client.closeSocket();
- } catch (UnknownHostException e) {
- e.printStackTrace();
- System.out.println("UnknownHostException");
- } catch (IOException e) {
- e.printStackTrace();
- System.out.println("IOException");
- }
-
- }
- }
-
- @SuppressLint("HandlerLeak")
- Handler handler = new Handler() {
- public void handleMessage(Message msg) {
- switch (msg.what) {
- case 1:
- flag = true;
- break;
- case 2:
- final thd t = new thd();
- thread = new Thread(t);
- thread.start();
- break;
- }
- super.handleMessage(msg);
- }
- };
-
- class Timertk extends TimerTask {
- public void run() {
- if (flag == false && cnt > 0) {
- cnt--;
- } else if (cnt == 0) {
- Message msg = new Message();
- msg.obj = "connecting failed";
- msg.what = 101;
- recall.sendMessage(msg);
- timer.cancel();
- } else if (flag == true) {
- timer.cancel();
- running = false;
- }
- }
- };
-} \ No newline at end of file
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/28/e0fe6e7a310d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/28/e0fe6e7a310d00131249f322b63acde8
deleted file mode 100644
index 043638e..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/28/e0fe6e7a310d00131249f322b63acde8
+++ /dev/null
@@ -1,76 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-import android.os.Handler;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
- //TODO fix
- static Handler fromTransam, fromGPS;
- //Event
-
- final static int noToken = 101;
-
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
- Intent i = new Intent();
- System.out.println(nowAct.id + " : " + event);
- if (mp.get(nowAct.getClass()) == null)
- System.out.println("first");
- else if (mp.get(nowAct.getClass()) == null)
- System.out.println("second");
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- fromTransam = new Handler();
- fromGPS = new Handler();
- addStatus(InitAct.class);
- addStatus(Login.class);
- addTransition(InitAct.class, noToken, Login.class);
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/2b/90dd627f4f0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/2b/90dd627f4f0d00131719b896d543f08c
deleted file mode 100644
index 75c5057..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/2b/90dd627f4f0d00131719b896d543f08c
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.macaroon.piztor"
- android:versionCode="1"
- android:versionName="1.0" >
-
- <uses-sdk
- android:minSdkVersion="8"
- android:targetSdkVersion="17" />
-
- <application
- android:allowBackup="true"
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name"
- android:theme="@android:style/Theme.NoTitleBar" >
- <activity
- android:name="com.macaroon.piztor.InitAct"
- android:label="@string/app_name" >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
-
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- <activity
- android:name="com.macaroon.piztor.Login"
- android:label="@string/title_activity_login" >
- </activity>
- <activity
- android:name="com.macaroon.piztor.Main"
- android:label="@string/title_activity_main" >
- </activity>
- <activity
- android:name="com.macaroon.piztor.Setting"
- android:label="@string/title_activity_setting" >
- </activity>
- </application>
-
- <uses-permission android:name="android.permission.INTERNET" />
- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
-
-</manifest>
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/2b/e0b1b2b86a0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/2b/e0b1b2b86a0d00131719b896d543f08c
deleted file mode 100644
index 6add4a7..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/2b/e0b1b2b86a0d00131719b896d543f08c
+++ /dev/null
@@ -1,137 +0,0 @@
-package com.macaroon.piztor;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- @SuppressLint("HandlerLeak")
- Handler handler = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- if (l == null)
- System.out.println("fuck!!!");
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "SearchButtonPress";
- case FetchButtonPress:
- return "FetchButtonPress";
- case FocuseButtonPress:
- return "FocuseButtonPress";
- case SuccessFetch:
- return "SuccessFetch";
- case FailedFetch:
- return "FailedFetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!!");
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- void leave(int e) {
- // TODO Auto-generated method stub
-
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- void leave(int e) {
- // TODO Auto-generated method stub
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(handler);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/2d/10589e1d530d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/2d/10589e1d530d00131719b896d543f08c
deleted file mode 100644
index f15cf6b..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/2d/10589e1d530d00131719b896d543f08c
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.app.Activity;
-import android.view.Menu;
-
-public class Main extends PiztorAct {
-
- Handler handler = new Handler() {
-
- };
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/2d/b0547e04360d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/2d/b0547e04360d00131249f322b63acde8
deleted file mode 100644
index 296d940..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/2d/b0547e04360d00131249f322b63acde8
+++ /dev/null
@@ -1,70 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
-
-
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- int loginButtonClick = 1, retryButtonClick = 2;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- }
- }
- };
-
-
-
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- //AppMgr.transam.send(new ReqLogin(u, p, time, alive))
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/2d/d03e1c612c0d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/2d/d03e1c612c0d00131249f322b63acde8
deleted file mode 100644
index 4a9b5cd..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/2d/d03e1c612c0d00131249f322b63acde8
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.app.Activity;
-import android.view.Menu;
-
-public class InitAct extends PiztorAct {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "initAct";
- super.onCreate(savedInstanceState);
- AppMgr.init();
- setContentView(R.layout.activity_init);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- //if (U)
- AppMgr.trigger(AppMgr.hasToken);
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- getMenuInflater().inflate(R.menu.init, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/2e/80cdc91d560d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/2e/80cdc91d560d00131719b896d543f08c
deleted file mode 100644
index b7b4329..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/2e/80cdc91d560d00131719b896d543f08c
+++ /dev/null
@@ -1,45 +0,0 @@
-package com.macaroon.piztor;
-
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-
-public class Main extends PiztorAct {
-
- ActMgr actMgr;
-
- Handler handler = new Handler() {
- @Override
- public void handleMessage(Message m) {
- Location l = (Location) m.obj;
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(), l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send();
- }
- };
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/3/b0bdfe23320d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/3/b0bdfe23320d00131249f322b63acde8
deleted file mode 100644
index 1d030dd..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/3/b0bdfe23320d00131249f322b63acde8
+++ /dev/null
@@ -1,81 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-import android.os.Handler;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
- //TODO fix
- static Handler fromTransam, fromGPS;
- static Transam transam = null;
- static Thread tTransam, tGPS;
- //Event
-
- final static int noToken = 101;
-
-
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
- Intent i = new Intent();
- System.out.println(nowAct.id + " : " + event);
- if (mp.get(nowAct.getClass()) == null)
- System.out.println("first");
- else if (mp.get(nowAct.getClass()) == null)
- System.out.println("second");
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- fromTransam = new Handler();
- transam = new Transam(UserInfo.ip, UserInfo.port, fromTransam);
- fromGPS = new Handler();
- new Thread(transam).run();
- addStatus(InitAct.class);
- addStatus(Login.class);
- addTransition(InitAct.class, noToken, Login.class);
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/30/909951c6530d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/30/909951c6530d00131719b896d543f08c
deleted file mode 100644
index a60b62b..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/30/909951c6530d00131719b896d543f08c
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-
-public class Main extends PiztorAct {
-
- ActMgr actMgr;
-
- Handler handler = new Handler() {
- @Override
- public void handleMessage(Message m) {
-
- }
- };
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/31/50f2612d2d0d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/31/50f2612d2d0d00131249f322b63acde8
deleted file mode 100644
index d08b6e2..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/31/50f2612d2d0d00131249f322b63acde8
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.macaroon.piztor;
-
-import android.content.Intent;
-import android.os.Bundle;
-import android.view.Menu;
-
-public class InitAct extends PiztorAct {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "initAct";
- super.onCreate(savedInstanceState);
- Intent i = new Intent();
- i.putExtra("haha", new Handler());
- AppMgr.init();
- setContentView(R.layout.activity_init);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- if (UserInfo.token != -1)
- AppMgr.trigger(AppMgr.noToken);
- else {
- //TODO jump to main
- }
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- getMenuInflater().inflate(R.menu.init, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/32/00f713722c0d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/32/00f713722c0d00131249f322b63acde8
deleted file mode 100644
index 055a218..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/32/00f713722c0d00131249f322b63acde8
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.app.Activity;
-import android.view.Menu;
-
-public class InitAct extends PiztorAct {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "initAct";
- super.onCreate(savedInstanceState);
- AppMgr.init();
- setContentView(R.layout.activity_init);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- if (UserInfo.token != -1)
- AppMgr.trigger(AppMgr.noToken);
-
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- getMenuInflater().inflate(R.menu.init, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/33/00c793445a0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/33/00c793445a0d00131719b896d543f08c
deleted file mode 100644
index a931dae..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/33/00c793445a0d00131719b896d543f08c
+++ /dev/null
@@ -1,104 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
-
-
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- int loginButtonClick = 1, retryButtonClick = 2, loginFailed = 3;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- System.out.println(m.what);
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- } else if (m.what == 101) {
- actMgr.trigger(loginFailed);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
- }
-
- class LoginStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- String user = edtUser.getText().toString();
- String pass = edtPass.getText().toString();
- long nowtime = System.currentTimeMillis();
- System.out.println(user + " : " + pass + "\n");
- AppMgr.transam.send(new ReqLogin(user, pass, nowtime, 1000));
- }
-
- @Override
- void leave(int e) {
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- ActStatus[] r = new ActStatus[2];
- AppMgr.transam.setHandler(hand);
- r[0] = new StartStatus();
- r[1] = new LoginStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], loginButtonClick, r[1]);
- actMgr.add(r[1], loginFailed, r[0]);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(loginButtonClick);
- }
- });
- }
-
- @Override
- protected void onResume() {
- super.onResume();
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/34/b0a7c7dc250d00131a9bb9bc5a5e6171 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/34/b0a7c7dc250d00131a9bb9bc5a5e6171
deleted file mode 100644
index 7b0bee0..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/34/b0a7c7dc250d00131a9bb9bc5a5e6171
+++ /dev/null
@@ -1,64 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
-
- Intent i = new Intent();
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- addStatus(InitAct.class);
- addStatus(Login.class);
-
-
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/34/c0f6cc4a530d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/34/c0f6cc4a530d00131719b896d543f08c
deleted file mode 100644
index d68704e..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/34/c0f6cc4a530d00131719b896d543f08c
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-
-public class Main extends PiztorAct {
-
- Handler handler = new Handler() {
- @Override
- public void handleMessage(Message m) {
-
- }
- };
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/35/4093eb606b0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/35/4093eb606b0d00131719b896d543f08c
deleted file mode 100644
index c417882..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/35/4093eb606b0d00131719b896d543f08c
+++ /dev/null
@@ -1,149 +0,0 @@
-package com.macaroon.piztor;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- @SuppressLint("HandlerLeak")
- Handler handler = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- if (l == null)
- System.out.println("fuck!!!");
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "Search Button Press";
- case FetchButtonPress:
- return "Fetch Button Press";
- case FocuseButtonPress:
- return "Focuse Button Press";
- case SuccessFetch:
- return "Success Fetch";
- case FailedFetch:
- return "Failed Fetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter Fetch status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave fetch status!!!! because" + cause(e));
-
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter focus status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave focus status!!!! because" + cause(e));
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(handler);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
- btnFetch.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(FetchButtonPress);
- }
- });
- btnFocus.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- actMgr.trigger(FocuseButtonPress);
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/36/90c1e030690d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/36/90c1e030690d00131719b896d543f08c
deleted file mode 100644
index 8797872..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/36/90c1e030690d00131719b896d543f08c
+++ /dev/null
@@ -1,110 +0,0 @@
-package com.macaroon.piztor;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
-
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- @SuppressLint("HandlerLeak")
- Handler handler = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- if (l == null)
- System.out.println("fuck!!!");
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- void leave(int e) {
- // TODO Auto-generated method stub
-
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- void leave(int e) {
- // TODO Auto-generated method stub
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(handler);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[1]);
- actMgr.add
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/36/d038f44e800d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/36/d038f44e800d00131719b896d543f08c
deleted file mode 100644
index 2e5e2b3..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/36/d038f44e800d00131719b896d543f08c
+++ /dev/null
@@ -1,89 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-import android.os.Handler;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
- //TODO fix
- static Handler fromTransam, fromGPS;
- static Transam transam = null;
- static Tracker tracker = null;
- static Thread tTransam, tGPS;
- //Event
-
- final static int noToken = 101;
- final static int loginSuccess = 102;
-
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
- Intent i = new Intent();
- System.out.println(nowAct.id + " : " + event);
- if (mp.get(nowAct.getClass()) == null)
- System.out.println("first");
- else if (mp.get(nowAct.getClass()) == null)
- System.out.println("second");
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- fromTransam = new Handler();
- transam = new Transam(UserInfo.ip, UserInfo.port, fromTransam);
- fromGPS = new Handler();
- tracker = new Tracker(nowAct.getApplicationContext(), fromGPS);
- tTransam = new Thread(transam);
- tTransam.start();
- tGPS = new Thread(tracker);
- tGPS.start();
- System.out.println("!!!!!!");
- addStatus(InitAct.class);
- addStatus(Login.class);
- addStatus(Main.class);
- addTransition(InitAct.class, noToken, Login.class);
- addTransition(Login.class, loginSuccess, Main.class);
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/38/003d32e92d0d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/38/003d32e92d0d00131249f322b63acde8
deleted file mode 100644
index 32d14fa..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/38/003d32e92d0d00131249f322b63acde8
+++ /dev/null
@@ -1,74 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-import android.os.Handler;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
- //TODO fix
- static Handler fromTransam;
- //Event
-
- final static int noToken = 101;
-
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
- Intent i = new Intent();
- System.out.println(nowAct.id + " : " + event);
- if (mp.get(nowAct.getClass()) == null)
- System.out.println("first");
- else if (mp.get(nowAct.getClass()) == null)
- System.out.println("second");
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- addStatus(InitAct.class);
- addStatus(Login.class);
- addTransition(InitAct.class, noToken, Login.class);
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/3a/50c1a310570d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/3a/50c1a310570d00131719b896d543f08c
deleted file mode 100644
index 479c8fb..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/3a/50c1a310570d00131719b896d543f08c
+++ /dev/null
@@ -1,49 +0,0 @@
-package com.macaroon.piztor;
-
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-
-public class Main extends PiztorAct {
-
- ActMgr actMgr;
-
- Handler handler = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(handler);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/3a/70725e2b330d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/3a/70725e2b330d00131249f322b63acde8
deleted file mode 100644
index e0cd3be..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/3a/70725e2b330d00131249f322b63acde8
+++ /dev/null
@@ -1,84 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-import android.os.Handler;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
- //TODO fix
- static Handler fromTransam, fromGPS;
- static Transam transam = null;
- static Thread tTransam, tGPS;
- //Event
-
- final static int noToken = 101;
-
-
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
- Intent i = new Intent();
- System.out.println(nowAct.id + " : " + event);
- if (mp.get(nowAct.getClass()) == null)
- System.out.println("first");
- else if (mp.get(nowAct.getClass()) == null)
- System.out.println("second");
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- fromTransam = new Handler();
- transam = new Transam(UserInfo.ip, UserInfo.port, fromTransam);
- fromGPS = new Handler();
- tTransam = new Thread(transam);
- tTransam.run();
- addStatus(InitAct.class);
- addStatus(Login.class);
- addStatus(Main.class);
- addTransition(InitAct.class, noToken, Login.class);
- addTransition(Login.class, loginSuccess, Main.class);
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/3a/c06b1bbd810d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/3a/c06b1bbd810d00131719b896d543f08c
deleted file mode 100644
index c3fe034..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/3a/c06b1bbd810d00131719b896d543f08c
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-import java.util.Vector;
-
-public class Infomation {
- static String ip = "69.85.86.42";
- static int port = 9990;
- static int token = -1;
- static int myId = -1;
- static int myGroup = -1;
- class UserInfo {
- int id;
- double lat, lot;
- }
-
- class Group {
- int id;
- Vector<UserInfo> v;
- }
-
- static HashMap<Integer, Group> mp;
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/3b/908be6833c0d00131524a793807f338e b/client/.metadata/.plugins/org.eclipse.core.resources/.history/3b/908be6833c0d00131524a793807f338e
deleted file mode 100644
index e0a3278..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/3b/908be6833c0d00131524a793807f338e
+++ /dev/null
@@ -1,90 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="fill_parent"
- android:background="@android:color/black"
- android:orientation="vertical">
-
-<LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:background="@android:color/black"
- android:gravity="center_horizontal"
- android:orientation="vertical" >
-
- <ImageView
- android:id="@+id/main_headbar_img"
- android:layout_width="180dp"
- android:layout_height="240dp"
- android:layout_gravity="center_horizontal"
- android:src="@drawable/title_logo" />
-
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:layout_gravity="center">
-
- <TableLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <TableRow
- android:layout_marginBottom="15dp"
- android:layout_marginTop="15dp">
- <TextView
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="0.25"
- android:gravity="right"
- android:id="@+id/user_id_text"
- android:text="User ID"
- android:textColor="@android:color/white"
- />
-
- <EditText
- android:layout_width="0dp"
- android:layout_weight="0.75"
- android:id="@+id/user_id"
- android:singleLine="true"/>
- <requestFocus/>
- </TableRow>
-
- <TableRow>
- <TextView
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="0.25"
- android:gravity="right"
- android:id="@+id/user_pass_text"
- android:text="Password"
- android:textColor="@android:color/white"
- />
-
- <EditText
- android:layout_width="0dp"
- android:layout_weight="0.75"
- android:id="@+id/user_pass"
- android:password="true"
- android:singleLine="true"/>
- </TableRow>
- </TableLayout>
- </LinearLayout>
-
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:orientation="vertical"
- >
- <Button
- android:id="@+id/login_btn_login"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:text="Login"
- android:textColor="@android:color/white" />
- </LinearLayout>
-
-</LinearLayout>
-</RelativeLayout>
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/3c/e05994772c0d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/3c/e05994772c0d00131249f322b63acde8
deleted file mode 100644
index 1f9d9b0..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/3c/e05994772c0d00131249f322b63acde8
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.app.Activity;
-import android.view.Menu;
-
-public class InitAct extends PiztorAct {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "initAct";
- super.onCreate(savedInstanceState);
- AppMgr.init();
- setContentView(R.layout.activity_init);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- if (UserInfo.token != -1)
- AppMgr.trigger(AppMgr.noToken);
-
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- getMenuInflater().inflate(R.menu.init, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/3e/00def6177b0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/3e/00def6177b0d00131719b896d543f08c
deleted file mode 100644
index 4fb4aa7..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/3e/00def6177b0d00131719b896d543f08c
+++ /dev/null
@@ -1,196 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.Vector;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- Timer autodate;
- @SuppressLint("HandlerLeak")
- Handler fromGPS = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- Handler fromTransam = new Handler() {
- @Override
- public void handleMessage(Message m) {
- switch (m.what) {
- case 3:
- ResLocation location = (ResLocation) m.obj;
- for (int i = 0; i < location.n; i++) {
- System.out.println(location.l.get(i).lat + " "
- + location.l.get(i).lot);
- }
- actMgr.trigger(SuccessFetch);
- break;
- case 2:
- ResUpdate update = (ResUpdate) m.obj;
- if (update.t == 0)
- System.out.println("update success");
- else
- System.out.println("update failed");
- break;
- default:
- break;
- }
-
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "Search Button Press";
- case FetchButtonPress:
- return "Fetch Button Press";
- case FocuseButtonPress:
- return "Focuse Button Press";
- case SuccessFetch:
- return "Success Fetch";
- case FailedFetch:
- return "Failed Fetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- if (e == TimerFlush) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1, System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter Fetch status!!!!");
- if (e == FetchButtonPress) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1,
- System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave fetch status!!!! because" + cause(e));
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter focus status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave focus status!!!! because" + cause(e));
-
- }
-
- }
-
- class AutoUpdate extends TimerTask {
-
- @Override
- public void run() {
- actMgr.trigger(Main.TimerFlush);
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(fromGPS);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- actMgr.add(r[2], TimerFlush, r[2]);
- autodate = new Timer();
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
- btnFetch.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(FetchButtonPress);
- }
- });
- btnFocus.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- actMgr.trigger(FocuseButtonPress);
- }
- });
- autodate.schedule(new AutoUpdate(), 0, 5000);
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/3e/1089ba593d0d00131524a793807f338e b/client/.metadata/.plugins/org.eclipse.core.resources/.history/3e/1089ba593d0d00131524a793807f338e
deleted file mode 100644
index 06c1791..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/3e/1089ba593d0d00131524a793807f338e
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.macaroon.piztor"
- android:versionCode="1"
- android:versionName="1.0" >
-
- <uses-sdk
- android:minSdkVersion="8"
- android:targetSdkVersion="17" />
-
- <application
- android:allowBackup="true"
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name"
- android:theme="@style/AppTheme" >
- <activity
- android:name="com.macaroon.piztor.InitAct"
- android:label="@string/app_name" >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
-
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- <activity
- android:name="com.macaroon.piztor.Login"
- android:label="@string/title_activity_login" >
- </activity>
- <activity
- android:name="com.macaroon.piztor.Main"
- android:label="@string/title_activity_main" >
- </activity>
- </application>
-
-</manifest>
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/3e/70b085c6280d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/3e/70b085c6280d00131249f322b63acde8
deleted file mode 100644
index 54242d5..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/3e/70b085c6280d00131249f322b63acde8
+++ /dev/null
@@ -1,69 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
-
- //Event
-
- final static int hasToken = 101;
-
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
-
- Intent i = new Intent();
- System.out.println(nowAct.id + " : " + event);
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- addStatus(InitAct.class);
- addStatus(Login.class);
- addTransition(InitAct.class, hasToken, Login.class);
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/3f/20d16da8790d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/3f/20d16da8790d00131719b896d543f08c
deleted file mode 100644
index cc0021f..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/3f/20d16da8790d00131719b896d543f08c
+++ /dev/null
@@ -1,191 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.Vector;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- Timer autodate;
- @SuppressLint("HandlerLeak")
- Handler fromGPS = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- Handler fromTransam = new Handler() {
- @Override
- public void handleMessage(Message m) {
- switch (m.what) {
- case 3:
- ResLocation location = (ResLocation) m.obj;
- for (int i = 0; i < location.n; i++) {
- System.out.println(location.l.get(i).lat + " "
- + location.l.get(i).lot);
- }
- actMgr.trigger(SuccessFetch);
- break;
- case 2:
- ResUpdate update = (ResUpdate) m.obj;
- if (update.t == 0)
- System.out.println("update success");
- else
- System.out.println("update failed");
- break;
- default:
- break;
- }
-
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "Search Button Press";
- case FetchButtonPress:
- return "Fetch Button Press";
- case FocuseButtonPress:
- return "Focuse Button Press";
- case SuccessFetch:
- return "Success Fetch";
- case FailedFetch:
- return "Failed Fetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter Fetch status!!!!");
- if (e == FetchButtonPress) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1,
- System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave fetch status!!!! because" + cause(e));
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter focus status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave focus status!!!! because" + cause(e));
-
- }
-
- }
-
- class AutoUpdate extends TimerTask {
-
- @Override
- public void run() {
- actMgr.trigger(Main.TimerFlush);
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(fromGPS);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- actMgr.add(r[2], TimerFlush, r[2]);
- autodate = new Timer();
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
- btnFetch.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(FetchButtonPress);
- }
- });
- btnFocus.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- actMgr.trigger(FocuseButtonPress);
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/4/208b4473550d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/4/208b4473550d00131719b896d543f08c
deleted file mode 100644
index da24dd6..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/4/208b4473550d00131719b896d543f08c
+++ /dev/null
@@ -1,69 +0,0 @@
-package com.macaroon.piztor;
-
-import android.content.Context;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import android.content.Context;
-import android.os.Handler;
-import android.os.Message;
-import android.util.Log;
-import android.os.SystemClock;
-
-
-public class Tracker implements Runnable {
-
- private static final long TIME_DELTA = 1000 * 3; // 3 second
- public Timer timer;
- private final Context mContext;
- GPSTracker myTracker;
- Handler mHandler;
- Message message;
-
- public Tracker(Context context, Handler yHandler) {
- timer = new Timer();
- mContext = context;
- myTracker = new GPSTracker(mContext);
- mHandler = yHandler;
- }
-
- void setHandler(Handler hand) {
- mHandler = hand;
- }
-
-
- public void run() {
- GPSTask myTask = new GPSTask();
- timer.schedule(myTask, 0, TIME_DELTA);
- }
-
- class GPSTask extends TimerTask {
- @Override
- public void run() {
- message = new Message();
- message.what = 0;
- myTracker.getLocation();
- Log.d("Location", "Fetching location.....");
- if (myTracker.canGetLocation()) {
- double latitude = myTracker.getLatitude();
- double longitude = myTracker.getLongitude();
-
-
-
- Log.d("TTTTTTTTTTTTTTTTTTTTTTTime","TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTime");
- System.out.println("GPSTIME" + myTracker.location.getTime());
- System.out.println("SYSTIME" + SystemClock.elapsedRealtime());
-
- if(myTracker.isGPSFix()) {
- message.what = 1;
- } else {
- message.what = 2;
- }
- mHandler.sendMessage(message);
- } else {
- message.what = 0;
- mHandler.sendMessage(message);
- }
- }
- }
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/4/d06a2613260d00131a9bb9bc5a5e6171 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/4/d06a2613260d00131a9bb9bc5a5e6171
deleted file mode 100644
index 8ef1739..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/4/d06a2613260d00131a9bb9bc5a5e6171
+++ /dev/null
@@ -1,71 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
-
- //Event
-
- public enum Event {
- hasToken
- }
-
-
- static HashMap<Class<?>, HashMap<Event, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
-
- Intent i = new Intent();
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Event event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Event, Class<?>> h = new HashMap<Event, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, Event i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Event, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Event, Class<?>> h = new HashMap<Event, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Event, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Event, Class<?>>>();
- addStatus(InitAct.class);
- addStatus(Login.class);
-
-
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/40/d0cd94022e0d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/40/d0cd94022e0d00131249f322b63acde8
deleted file mode 100644
index e2f6ef1..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/40/d0cd94022e0d00131249f322b63acde8
+++ /dev/null
@@ -1,76 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-import android.os.Handler;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
- //TODO fix
- static Handler fromTransam, fromeGPS;
- //Event
-
- final static int noToken = 101;
-
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
- Intent i = new Intent();
- System.out.println(nowAct.id + " : " + event);
- if (mp.get(nowAct.getClass()) == null)
- System.out.println("first");
- else if (mp.get(nowAct.getClass()) == null)
- System.out.println("second");
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- fromTransam = new Handler();
- fromGPS = new Handler();
- addStatus(InitAct.class);
- addStatus(Login.class);
- addTransition(InitAct.class, noToken, Login.class);
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/41/c042e3c3810d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/41/c042e3c3810d00131719b896d543f08c
deleted file mode 100644
index c3fe034..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/41/c042e3c3810d00131719b896d543f08c
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-import java.util.Vector;
-
-public class Infomation {
- static String ip = "69.85.86.42";
- static int port = 9990;
- static int token = -1;
- static int myId = -1;
- static int myGroup = -1;
- class UserInfo {
- int id;
- double lat, lot;
- }
-
- class Group {
- int id;
- Vector<UserInfo> v;
- }
-
- static HashMap<Integer, Group> mp;
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/42/202de8244f0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/42/202de8244f0d00131719b896d543f08c
deleted file mode 100644
index 8ce1e90..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/42/202de8244f0d00131719b896d543f08c
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.macaroon.piztor"
- android:versionCode="1"
- android:versionName="1.0" >
-
- <uses-sdk
- android:minSdkVersion="8"
- android:targetSdkVersion="17" />
-
- <application
- android:allowBackup="true"
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name"
- android:theme="@android:style/Theme.NoTitleBar" >
- <activity
- android:name="com.macaroon.piztor.InitAct"
- android:label="@string/app_name" >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
-
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- <activity
- android:name="com.macaroon.piztor.Login"
- android:label="@string/activity_login" >
- </activity>
- <activity
- android:name="com.macaroon.piztor.Main"
- android:label="@string/activity_main" >
- </activity>
- <activity
- android:name="com.macaroon.piztor.Setting"
- android:label="@string/title_activity_setting" >
- </activity>
- </application>
-
- <uses-permission android:name="android.permission.INTERNET" />
- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
-
-</manifest>
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/43/d08732c36a0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/43/d08732c36a0d00131719b896d543f08c
deleted file mode 100644
index 00f4f6a..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/43/d08732c36a0d00131719b896d543f08c
+++ /dev/null
@@ -1,137 +0,0 @@
-package com.macaroon.piztor;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- @SuppressLint("HandlerLeak")
- Handler handler = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- if (l == null)
- System.out.println("fuck!!!");
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "SearchButtonPress";
- case FetchButtonPress:
- return "FetchButtonPress";
- case FocuseButtonPress:
- return "FocuseButtonPress";
- case SuccessFetch:
- return "SuccessFetch";
- case FailedFetch:
- return "FailedFetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- void leave(int e) {
- // TODO Auto-generated method stub
-
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- void leave(int e) {
- // TODO Auto-generated method stub
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(handler);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/43/e05e9ddd800d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/43/e05e9ddd800d00131719b896d543f08c
deleted file mode 100644
index 6173bd0..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/43/e05e9ddd800d00131719b896d543f08c
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.Vector;
-
-public class Infomation {
- static String ip = "69.85.86.42";
- static int port = 9990;
- static int token = -1;
- static int myId = -1;
-
- class UserInfo {
- int id;
- double lat, lot;
- }
-
- class Group {
- int id;
- Vector<UserInfo> v;
- }
-
- static HashMap<Integer, Group> mp;
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/44/00604d29230d00131a9bb9bc5a5e6171 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/44/00604d29230d00131a9bb9bc5a5e6171
deleted file mode 100644
index c33f70a..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/44/00604d29230d00131a9bb9bc5a5e6171
+++ /dev/null
@@ -1,6 +0,0 @@
-package com.macaroon.piztor;
-
-public class PiztorExcepiton extends Exception{
- private static final long serialVersionUID = -7147530695009854988L;
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/44/50b1dc18530d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/44/50b1dc18530d00131719b896d543f08c
deleted file mode 100644
index 2fdaba1..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/44/50b1dc18530d00131719b896d543f08c
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.app.Activity;
-import android.view.Menu;
-
-public class Main extends PiztorAct {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/44/b0ce412f550d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/44/b0ce412f550d00131719b896d543f08c
deleted file mode 100644
index ad82cc8..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/44/b0ce412f550d00131719b896d543f08c
+++ /dev/null
@@ -1,241 +0,0 @@
-package com.macaroon.piztor;
-
-import android.app.AlertDialog;
-import android.app.Service;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.location.Location;
-import android.location.LocationListener;
-import android.location.LocationManager;
-import android.location.GpsStatus;
-import android.os.Bundle;
-import android.os.IBinder;
-import android.os.SystemClock;
-import android.provider.Settings;
-import android.util.Log;
-
-public class GPSTracker extends Service implements LocationListener, GpsStatus.Listener {
-
- private final Context mContext;
-
- // flag for GPS status
- boolean isGPSEnabled = false;
-
- // flag for network status
- boolean isNetworkEnabled = false;
-
- // flag for GPS status
- boolean canGetLocation = false;
-
- Location location; // location
- double latitude; // latitude
- double longitude; // longitude
-
- // The minimum distance to change Updates in meters
- private static final long MIN_DISTANCE_CHANGE_FOR_UPDATES = 10; // 10 meters
-
- // The minimum time between updates in milliseconds
- private static final long MIN_TIME_BW_UPDATES = 1000 * 3; // 10 seconds
-
- // Declaring a Location Manager
- protected LocationManager locationManager;
-
- // for GPS satellite status listener
- Location mLastLocation;
- long mLastLocationMillis;
- boolean isGPSFix;
-
-
- public GPSTracker(Context context) {
- this.mContext = context;
- isGPSFix = false;
- getLocation();
- }
-
- public location getLocation() {
- try {
-
- Log.d("getLocation", "Start getting location......");
-
- locationManager = (LocationManager) mContext
- .getSystemService(LOCATION_SERVICE);
-
- // getting GPS status
- isGPSEnabled = locationManager
- .isProviderEnabled(LocationManager.GPS_PROVIDER);
-
- // getting network status
- isNetworkEnabled = locationManager
- .isProviderEnabled(LocationManager.NETWORK_PROVIDER);
-
- if (!isGPSEnabled) {
- // no network provider is enabled
- } else {
- this.canGetLocation = true;
- if (isNetworkEnabled) {
- locationManager.requestLocationUpdates(
- LocationManager.NETWORK_PROVIDER,
- MIN_TIME_BW_UPDATES,
- MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
-
- Log.d("Network", "Network Updated");
-
- if (locationManager != null) {
- location = locationManager
- .getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
- if (location != null) {
- latitude = location.getLatitude();
- longitude = location.getLongitude();
-
- Log.d("Network", "Received Network Data");
- System.out.println("***From Network: "+latitude + " " + longitude);
- }
- }
- }// end of network section
- // if GPS Enabled get lat/long using GPS Services
- if (isGPSEnabled) {
- if (true) {
- locationManager.requestLocationUpdates(
- LocationManager.GPS_PROVIDER,
- MIN_TIME_BW_UPDATES,
- MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
- Log.d("GPS", "GPS Updated");
- if (locationManager != null) {
- location = locationManager
- .getLastKnownLocation(LocationManager.GPS_PROVIDER);
- if (location != null) {
- latitude = location.getLatitude();
- longitude = location.getLongitude();
-
- Log.d("GPS", "Received GPS Data");
- System.out.println("***From GPS: "+latitude + " " + longitude);
-
- }
- }
- }
- }// end of GPS section
- }// end of fetching data
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Stop using GPS listener Calling this function will stop using GPS in your
- * app
- * */
- public void stopUsingGPS() {
- if (locationManager != null) {
- locationManager.removeUpdates(GPSTracker.this);
- }
- }
-
- /**
- * Function to get latitude
- * */
- public double getLatitude() {
- if (location != null) {
- latitude = location.getLatitude();
- }
- return latitude;
- }
-
- /**
- * Function to get longitude
- * */
- public double getLongitude() {
- if (location != null) {
- longitude = location.getLongitude();
- }
- return longitude;
- }
-
- /**
- * Function to check GPS/wifi enabled
- *
- * @return boolean
- * */
- public boolean canGetLocation() {
- return this.canGetLocation;
- }
-
- public boolean isGPSFix() {
- return (this.isGPSFix && location != null);
- }
-
- /**
- * Function to show settings alert dialog On pressing Settings button will
- * lauch Settings Options
- * */
- public void showSettingsAlert() {
- AlertDialog.Builder alertDialog = new AlertDialog.Builder(mContext);
-
- // Setting Dialog Title
- alertDialog.setTitle("GPS is settings");
-
- // Setting Dialog Message
- alertDialog
- .setMessage("GPS is not enabled. Do you want to go to settings menu?");
-
- // On pressing Settings button
- alertDialog.setPositiveButton("Settings",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- Intent intent = new Intent(
- Settings.ACTION_LOCATION_SOURCE_SETTINGS);
- mContext.startActivity(intent);
- }
- });
-
- // on pressing cancel button
- alertDialog.setNegativeButton("Cancel",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- dialog.cancel();
- }
- });
-
- // Showing Alert Message
- alertDialog.show();
- }
-
- @Override
- public void onLocationChanged(Location location) {
- if (location == null) return;
- mLastLocationMillis = SystemClock.elapsedRealtime();
- mLastLocation = location;
- }
-
- @Override
- public void onProviderDisabled(String provider) {
- }
-
- @Override
- public void onProviderEnabled(String provider) {
- }
-
- @Override
- public void onStatusChanged(String provider, int status, Bundle extras) {
- }
-
- @Override
- public IBinder onBind(Intent arg0) {
- return null;
- }
-
- @Override
- public void onGpsStatusChanged(int event) {
- switch (event) {
- case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
- if(mLastLocation != null)
- isGPSFix = (SystemClock.elapsedRealtime() - mLastLocationMillis) < 3000;
- break;
-
- case GpsStatus.GPS_EVENT_FIRST_FIX:
- isGPSFix = true;
- break;
- }
- }
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/48/f02ec265260d00131a9bb9bc5a5e6171 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/48/f02ec265260d00131a9bb9bc5a5e6171
deleted file mode 100644
index c75989c..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/48/f02ec265260d00131a9bb9bc5a5e6171
+++ /dev/null
@@ -1,71 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
-
- //Event
-
- public enum Event {
- hasToken
- }
-
-
- static HashMap<Class<?>, HashMap<Event, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(Event event) {
-
- Intent i = new Intent();
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Event event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Event, Class<?>> h = new HashMap<Event, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, Event i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Event, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Event, Class<?>> h = new HashMap<Event, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Event, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Event, Class<?>>>();
- addStatus(InitAct.class);
- addStatus(Login.class);
- addTransition(InitAct.class, Event.hasToken, Login.class);
-
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/49/10547e20330d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/49/10547e20330d00131249f322b63acde8
deleted file mode 100644
index 6b756f2..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/49/10547e20330d00131249f322b63acde8
+++ /dev/null
@@ -1,83 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-import android.os.Handler;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
- //TODO fix
- static Handler fromTransam, fromGPS;
- static Transam transam = null;
- static Thread tTransam, tGPS;
- //Event
-
- final static int noToken = 101;
-
-
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
- Intent i = new Intent();
- System.out.println(nowAct.id + " : " + event);
- if (mp.get(nowAct.getClass()) == null)
- System.out.println("first");
- else if (mp.get(nowAct.getClass()) == null)
- System.out.println("second");
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- fromTransam = new Handler();
- transam = new Transam(UserInfo.ip, UserInfo.port, fromTransam);
- fromGPS = new Handler();
- tTransam = new Thread(transam);
- tTransam.run();
- addStatus(InitAct.class);
- addStatus(Login.class);
- addStatus(Main.class);
- addTransition(InitAct.class, noToken, Login.class);
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/49/d0e63f99550d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/49/d0e63f99550d00131719b896d543f08c
deleted file mode 100644
index 34a8b04..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/49/d0e63f99550d00131719b896d543f08c
+++ /dev/null
@@ -1,241 +0,0 @@
-package com.macaroon.piztor;
-
-import android.app.AlertDialog;
-import android.app.Service;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.location.Location;
-import android.location.LocationListener;
-import android.location.LocationManager;
-import android.location.GpsStatus;
-import android.os.Bundle;
-import android.os.IBinder;
-import android.os.SystemClock;
-import android.provider.Settings;
-import android.util.Log;
-
-public class GPSTracker extends Service implements LocationListener, GpsStatus.Listener {
-
- private final Context mContext;
-
- // flag for GPS status
- boolean isGPSEnabled = false;
-
- // flag for network status
- boolean isNetworkEnabled = false;
-
- // flag for GPS status
- boolean canGetLocation = false;
-
- Location location; // location
- double latitude; // latitude
- double longitude; // longitude
-
- // The minimum distance to change Updates in meters
- private static final long MIN_DISTANCE_CHANGE_FOR_UPDATES = 10; // 10 meters
-
- // The minimum time between updates in milliseconds
- private static final long MIN_TIME_BW_UPDATES = 1000 * 3; // 10 seconds
-
- // Declaring a Location Manager
- protected LocationManager locationManager;
-
- // for GPS satellite status listener
- Location mLastLocation;
- long mLastLocationMillis;
- boolean isGPSFix;
-
-
- public GPSTracker(Context context) {
- this.mContext = context;
- isGPSFix = false;
- getLocation();
- }
-
- public Location getLocation() {
- try {
- Log.d("getLocation", "Start getting location......");
-
- locationManager = (LocationManager) mContext
- .getSystemService(LOCATION_SERVICE);
-
- // getting GPS status
- isGPSEnabled = locationManager
- .isProviderEnabled(LocationManager.GPS_PROVIDER);
-
- // getting network status
- isNetworkEnabled = locationManager
- .isProviderEnabled(LocationManager.NETWORK_PROVIDER);
-
- if (!isGPSEnabled) {
- // no network provider is enabled
- } else {
- this.canGetLocation = true;
- if (isNetworkEnabled) {
- locationManager.requestLocationUpdates(
- LocationManager.NETWORK_PROVIDER,
- MIN_TIME_BW_UPDATES,
- MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
-
- Log.d("Network", "Network Updated");
-
- if (locationManager != null) {
- location = locationManager
- .getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
- if (location != null) {
- latitude = location.getLatitude();
- longitude = location.getLongitude();
-
- Log.d("Network", "Received Network Data");
- System.out.println("***From Network: "+latitude + " " + longitude);
- }
- }
- }// end of network section
- // if GPS Enabled get lat/long using GPS Services
- if (isGPSEnabled) {
- if (true) {
- locationManager.requestLocationUpdates(
- LocationManager.GPS_PROVIDER,
- MIN_TIME_BW_UPDATES,
- MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
- Log.d("GPS", "GPS Updated");
- if (locationManager != null) {
- location = locationManager
- .getLastKnownLocation(LocationManager.GPS_PROVIDER);
- if (location != null) {
- latitude = location.getLatitude();
- longitude = location.getLongitude();
-
- Log.d("GPS", "Received GPS Data");
- System.out.println("***From GPS: "+latitude + " " + longitude);
-
- }
- }
- }
- }// end of GPS section
- }// end of fetching data
- return location;
- } catch (Exception e) {
- e.printStackTrace();
- }
- return location;
- }
-
- /**
- * Stop using GPS listener Calling this function will stop using GPS in your
- * app
- * */
- public void stopUsingGPS() {
- if (locationManager != null) {
- locationManager.removeUpdates(GPSTracker.this);
- }
- }
-
- /**
- * Function to get latitude
- * */
- public double getLatitude() {
- if (location != null) {
- latitude = location.getLatitude();
- }
- return latitude;
- }
-
- /**
- * Function to get longitude
- * */
- public double getLongitude() {
- if (location != null) {
- longitude = location.getLongitude();
- }
- return longitude;
- }
-
- /**
- * Function to check GPS/wifi enabled
- *
- * @return boolean
- * */
- public boolean canGetLocation() {
- return this.canGetLocation;
- }
-
- public boolean isGPSFix() {
- return (this.isGPSFix && location != null);
- }
-
- /**
- * Function to show settings alert dialog On pressing Settings button will
- * lauch Settings Options
- * */
- public void showSettingsAlert() {
- AlertDialog.Builder alertDialog = new AlertDialog.Builder(mContext);
-
- // Setting Dialog Title
- alertDialog.setTitle("GPS is settings");
-
- // Setting Dialog Message
- alertDialog
- .setMessage("GPS is not enabled. Do you want to go to settings menu?");
-
- // On pressing Settings button
- alertDialog.setPositiveButton("Settings",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- Intent intent = new Intent(
- Settings.ACTION_LOCATION_SOURCE_SETTINGS);
- mContext.startActivity(intent);
- }
- });
-
- // on pressing cancel button
- alertDialog.setNegativeButton("Cancel",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- dialog.cancel();
- }
- });
-
- // Showing Alert Message
- alertDialog.show();
- }
-
- @Override
- public void onLocationChanged(Location location) {
- if (location == null) return;
- mLastLocationMillis = SystemClock.elapsedRealtime();
- mLastLocation = location;
- }
-
- @Override
- public void onProviderDisabled(String provider) {
- }
-
- @Override
- public void onProviderEnabled(String provider) {
- }
-
- @Override
- public void onStatusChanged(String provider, int status, Bundle extras) {
- }
-
- @Override
- public IBinder onBind(Intent arg0) {
- return null;
- }
-
- @Override
- public void onGpsStatusChanged(int event) {
- switch (event) {
- case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
- if(mLastLocation != null)
- isGPSFix = (SystemClock.elapsedRealtime() - mLastLocationMillis) < 3000;
- break;
-
- case GpsStatus.GPS_EVENT_FIRST_FIX:
- isGPSFix = true;
- break;
- }
- }
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/4a/2006f95e2b0d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/4a/2006f95e2b0d00131249f322b63acde8
deleted file mode 100644
index 000f373..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/4a/2006f95e2b0d00131249f322b63acde8
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.macaroon.piztor;
-
-//--------------------------------------//
-// Ask Location //
-//--------------------------------------//
-
-public class ReqLocation extends Req{
- int gid; //group id;
-
- ReqLocation(int token,int groupid,long time,long alive){
- super(3,token,time,alive); //for type 3
- gid = groupid;
- }
-} \ No newline at end of file
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/4b/60e6bdcd310d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/4b/60e6bdcd310d00131249f322b63acde8
deleted file mode 100644
index 401f985..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/4b/60e6bdcd310d00131249f322b63acde8
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.macaroon.piztor;
-
-import android.content.Intent;
-import android.os.Bundle;
-import android.os.Handler;
-import android.view.Menu;
-
-public class InitAct extends PiztorAct {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "initAct";
- super.onCreate(savedInstanceState);
- AppMgr.init();
- setContentView(R.layout.activity_init);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- if (UserInfo.token != -1)
- AppMgr.trigger(AppMgr.noToken);
- else {
- //TODO jump to main
- }
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- getMenuInflater().inflate(R.menu.init, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/4c/10fd771f320d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/4c/10fd771f320d00131249f322b63acde8
deleted file mode 100644
index 9db1a78..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/4c/10fd771f320d00131249f322b63acde8
+++ /dev/null
@@ -1,81 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-import android.os.Handler;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
- //TODO fix
- static Handler fromTransam, fromGPS;
- static Transam transam = null;
-
- //Event
-
- final static int noToken = 101;
-
-
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
- Intent i = new Intent();
- System.out.println(nowAct.id + " : " + event);
- if (mp.get(nowAct.getClass()) == null)
- System.out.println("first");
- else if (mp.get(nowAct.getClass()) == null)
- System.out.println("second");
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- fromTransam = new Handler();
- transam = new Transam(UserInfo.ip, UserInfo.port, fromTransam);
- fromGPS = new Handler();
- new Thread(transam).run();
- addStatus(InitAct.class);
- addStatus(Login.class);
- addTransition(InitAct.class, noToken, Login.class);
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/4c/2088d09b260d00131a9bb9bc5a5e6171 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/4c/2088d09b260d00131a9bb9bc5a5e6171
deleted file mode 100644
index 1ce492c..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/4c/2088d09b260d00131a9bb9bc5a5e6171
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.app.Activity;
-import android.view.Menu;
-
-public class InitAct extends Activity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_init);
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.init, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/4c/30e8770c260d00131a9bb9bc5a5e6171 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/4c/30e8770c260d00131a9bb9bc5a5e6171
deleted file mode 100644
index 3a65842..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/4c/30e8770c260d00131a9bb9bc5a5e6171
+++ /dev/null
@@ -1,71 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
-
- //Event
-
- public enum Event {
- hasToken
- }
-
-
- static HashMap<Class<?>, HashMap<Event, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
-
- Intent i = new Intent();
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Event event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Event, Class<?>> h = new HashMap<Event, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Event, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Event, Class<?>> h = new HashMap<Event, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Event, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Event, Class<?>>>();
- addStatus(InitAct.class);
- addStatus(Login.class);
-
-
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/4c/d04b30d8520d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/4c/d04b30d8520d00131719b896d543f08c
deleted file mode 100644
index 6623a65..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/4c/d04b30d8520d00131719b896d543f08c
+++ /dev/null
@@ -1,62 +0,0 @@
-package com.macaroon.piztor;
-
-import android.content.Context;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import android.content.Context;
-import android.os.Handler;
-import android.os.Message;
-import android.util.Log;
-import android.os.SystemClock;
-
-
-public class Tracker implements Runnable {
-
- private static final long TIME_DELTA = 1000 * 3; // 3 second
- public Timer timer;
- private final Context mContext;
- GPSTracker myTracker;
- Handler mHandler;
- Message message;
-
- public Tracker(Context context, Handler yHandler) {
- timer = new Timer();
- mContext = context;
- myTracker = new GPSTracker(mContext);
- mHandler = yHandler;
- }
-
- public void run() {
- GPSTask myTask = new GPSTask();
- timer.schedule(myTask, 0, TIME_DELTA);
- }
-
- class GPSTask extends TimerTask {
- @Override
- public void run() {
- message = new Message();
- message.what = 0;
- myTracker.getLocation();
- Log.d("Location", "Fetching location.....");
- if (myTracker.canGetLocation()) {
- double latitude = myTracker.getLatitude();
- double longitude = myTracker.getLongitude();
-
- Log.d("TTTTTTTTTTTTTTTTTTTTTTTime","TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTime");
- System.out.println("GPSTIME" + myTracker.location.getTime());
- System.out.println("SYSTIME" + SystemClock.elapsedRealtime());
-
- if(myTracker.isGPSFix()) {
- message.what = 1;
- } else {
- message.what = 2;
- }
- mHandler.snedMessage(message);
- } else {
- message.what = 0;
- mHandler.sendMessage(message);
- }
- }
- }
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/4e/40eb8393390d00131524a793807f338e b/client/.metadata/.plugins/org.eclipse.core.resources/.history/4e/40eb8393390d00131524a793807f338e
deleted file mode 100644
index 71415fe..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/4e/40eb8393390d00131524a793807f338e
+++ /dev/null
@@ -1,85 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-import android.os.Handler;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
- //TODO fix
- static Handler fromTransam, fromGPS;
- static Transam transam = null;
- static Thread tTransam, tGPS;
- //Event
-
- final static int noToken = 101;
- final static int loginSuccess = 102;
-
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
- Intent i = new Intent();
- System.out.println(nowAct.id + " : " + event);
- if (mp.get(nowAct.getClass()) == null)
- System.out.println("first");
- else if (mp.get(nowAct.getClass()) == null)
- System.out.println("second");
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- fromTransam = new Handler();
- transam = new Transam(UserInfo.ip, UserInfo.port, fromTransam);
- //fromGPS = new Handler();
- tTransam = new Thread(transam);
- tTransam.run();
- System.out.println("!!!!!!");
- addStatus(InitAct.class);
- addStatus(Login.class);
- addStatus(Main.class);
- addTransition(InitAct.class, noToken, Login.class);
- addTransition(Login.class, loginSuccess, Main.class);
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/4e/5025c807320d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/4e/5025c807320d00131249f322b63acde8
deleted file mode 100644
index a06c885..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/4e/5025c807320d00131249f322b63acde8
+++ /dev/null
@@ -1,82 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-import android.os.Handler;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
-
- static ActivityStatus status;
-
- static PiztorAct nowAct;
- //TODO fix
- static Handler fromTransam, fromGPS;
- //Event
-
- final static int noToken = 101;
-
-
- static Transam transam = null;
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
- Intent i = new Intent();
- System.out.println(nowAct.id + " : " + event);
- if (mp.get(nowAct.getClass()) == null)
- System.out.println("first");
- else if (mp.get(nowAct.getClass()) == null)
- System.out.println("second");
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- fromTransam = new Handler();
- transam = new Transam(UserInfo.ip, UserInfo.port, fromTransam);
- fromGPS = new Handler();
- new Thread(transam).run();
- addStatus(InitAct.class);
- addStatus(Login.class);
- addTransition(InitAct.class, noToken, Login.class);
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/4e/60e7a753340d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/4e/60e7a753340d00131249f322b63acde8
deleted file mode 100644
index bfd9398..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/4e/60e7a753340d00131249f322b63acde8
+++ /dev/null
@@ -1,58 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
-
- }
- };
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/4e/709e4dd5770d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/4e/709e4dd5770d00131719b896d543f08c
deleted file mode 100644
index 4e44cb4..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/4e/709e4dd5770d00131719b896d543f08c
+++ /dev/null
@@ -1,193 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.Vector;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- Timer autodate;
- @SuppressLint("HandlerLeak")
- Handler fromGPS = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- Handler fromTransam = new Handler() {
- @Override
- public void handleMessage(Message m) {
- switch (m.what) {
- case 3:
- ResLocation location = (ResLocation) m.obj;
- for (int i = 0; i < location.n; i++) {
- System.out.println(location.l.get(i).lat + " "
- + location.l.get(i).lot);
- }
- actMgr.trigger(SuccessFetch);
- break;
- case 2:
- ResUpdate update = (ResUpdate) m.obj;
- if (update.t == 0)
- System.out.println("update success");
- else
- System.out.println("update failed");
- break;
- default:
- break;
- }
-
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "Search Button Press";
- case FetchButtonPress:
- return "Fetch Button Press";
- case FocuseButtonPress:
- return "Focuse Button Press";
- case SuccessFetch:
- return "Success Fetch";
- case FailedFetch:
- return "Failed Fetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter Fetch status!!!!");
- if (e == FetchButtonPress) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1,
- System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave fetch status!!!! because" + cause(e));
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter focus status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave focus status!!!! because" + cause(e));
-
- }
-
- }
-
- class AutoUpdate extends TimerTask {
-
- @Override
- public void run() {
- // TODO Auto-generated method stub
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(fromGPS);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- autodate = new Timer();
-
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
- btnFetch.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(FetchButtonPress);
- }
- });
- btnFocus.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- actMgr.trigger(FocuseButtonPress);
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/4e/d078d3c5670d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/4e/d078d3c5670d00131719b896d543f08c
deleted file mode 100644
index 051eaf6..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/4e/d078d3c5670d00131719b896d543f08c
+++ /dev/null
@@ -1,87 +0,0 @@
-package com.macaroon.piztor;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
-
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- @SuppressLint("HandlerLeak")
- Handler handler = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- if (l == null)
- System.out.println("fuck!!!");
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- void leave(int e) {
- // TODO Auto-generated method stub
-
- }
-
- }
-
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(handler);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/4f/20629bba350d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/4f/20629bba350d00131249f322b63acde8
deleted file mode 100644
index 1bb7e9a..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/4f/20629bba350d00131249f322b63acde8
+++ /dev/null
@@ -1,66 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- }
- }
- };
-
-
-
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- //AppMgr.transam.send(new ReqLogin(u, p, time, alive))
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/5/c09802f4810d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/5/c09802f4810d00131719b896d543f08c
deleted file mode 100644
index c1827b4..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/5/c09802f4810d00131719b896d543f08c
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-import java.util.Vector;
-
-public class Infomation {
- static String ip = "69.85.86.42";
- static int port = 9990;
- static int token = -1;
- static int myId = -1;
- static int myGroup = -1;
- class UserInfo {
- int id;
- double lat, lot;
- }
-
- class Group {
- int id;
- Vector<UserInfo> v;
- }
-
- static HashMap<Integer, Group> mp;
-
- static void init() {
- mp = new HashMap<Integer, Group>();
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/51/1058bc287a0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/51/1058bc287a0d00131719b896d543f08c
deleted file mode 100644
index 7df8334..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/51/1058bc287a0d00131719b896d543f08c
+++ /dev/null
@@ -1,195 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.Vector;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- Timer autodate;
- @SuppressLint("HandlerLeak")
- Handler fromGPS = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- Handler fromTransam = new Handler() {
- @Override
- public void handleMessage(Message m) {
- switch (m.what) {
- case 3:
- ResLocation location = (ResLocation) m.obj;
- for (int i = 0; i < location.n; i++) {
- System.out.println(location.l.get(i).lat + " "
- + location.l.get(i).lot);
- }
- actMgr.trigger(SuccessFetch);
- break;
- case 2:
- ResUpdate update = (ResUpdate) m.obj;
- if (update.t == 0)
- System.out.println("update success");
- else
- System.out.println("update failed");
- break;
- default:
- break;
- }
-
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "Search Button Press";
- case FetchButtonPress:
- return "Fetch Button Press";
- case FocuseButtonPress:
- return "Focuse Button Press";
- case SuccessFetch:
- return "Success Fetch";
- case FailedFetch:
- return "Failed Fetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- if (e == TimerFlush) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1, System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter Fetch status!!!!");
- if (e == FetchButtonPress) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1,
- System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave fetch status!!!! because" + cause(e));
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter focus status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave focus status!!!! because" + cause(e));
-
- }
-
- }
-
- class AutoUpdate extends TimerTask {
-
- @Override
- public void run() {
- actMgr.trigger(Main.TimerFlush);
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(fromGPS);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- actMgr.add(r[2], TimerFlush, r[2]);
- autodate = new Timer();
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
- btnFetch.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(FetchButtonPress);
- }
- });
- btnFocus.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- actMgr.trigger(FocuseButtonPress);
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/51/d01e0d2c7c0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/51/d01e0d2c7c0d00131719b896d543f08c
deleted file mode 100644
index 5315060..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/51/d01e0d2c7c0d00131719b896d543f08c
+++ /dev/null
@@ -1,202 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.Vector;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- Timer autodate;
- @SuppressLint("HandlerLeak")
- Handler fromGPS = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- if (l == null)
- System.out.println("fuck!!!");
- else {
- ReqUpdate r = new ReqUpdate(UserInfo.token,
- l.getLatitude(), l.getLongitude(),
- System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- }
- };
-
- Handler fromTransam = new Handler() {
- @Override
- public void handleMessage(Message m) {
- switch (m.what) {
- case 3:
- ResLocation location = (ResLocation) m.obj;
- for (int i = 0; i < location.n; i++) {
- System.out.println(location.l.get(i).lat + " "
- + location.l.get(i).lot);
- }
- actMgr.trigger(SuccessFetch);
- break;
- case 2:
- ResUpdate update = (ResUpdate) m.obj;
- if (update.t == 0)
- System.out.println("update success");
- else
- System.out.println("update failed");
- break;
- default:
- break;
- }
-
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "Search Button Press";
- case FetchButtonPress:
- return "Fetch Button Press";
- case FocuseButtonPress:
- return "Focuse Button Press";
- case SuccessFetch:
- return "Success Fetch";
- case FailedFetch:
- return "Failed Fetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- if (e == TimerFlush) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1,
- System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter Fetch status!!!!");
- if (e == FetchButtonPress) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1,
- System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave fetch status!!!! because" + cause(e));
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter focus status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave focus status!!!! because" + cause(e));
-
- }
-
- }
-
- class AutoUpdate extends TimerTask {
-
- @Override
- public void run() {
- actMgr.trigger(Main.TimerFlush);
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(fromGPS);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- actMgr.add(r[2], TimerFlush, r[2]);
- autodate = new Timer();
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
- btnFetch.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(FetchButtonPress);
- }
- });
- btnFocus.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- actMgr.trigger(FocuseButtonPress);
- }
- });
- autodate.schedule(new AutoUpdate(), 0, 5000);
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/51/e043216f2c0d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/51/e043216f2c0d00131249f322b63acde8
deleted file mode 100644
index 2771596..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/51/e043216f2c0d00131249f322b63acde8
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.app.Activity;
-import android.view.Menu;
-
-public class InitAct extends PiztorAct {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "initAct";
- super.onCreate(savedInstanceState);
- AppMgr.init();
- setContentView(R.layout.activity_init);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- if (UserInfo.token != -1)
- AppMgr.trigger(AppMgr.noToken);
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- getMenuInflater().inflate(R.menu.init, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/52/80fa1082370d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/52/80fa1082370d00131249f322b63acde8
deleted file mode 100644
index 5b68421..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/52/80fa1082370d00131249f322b63acde8
+++ /dev/null
@@ -1,80 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
-
-
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- int loginButtonClick = 1, retryButtonClick = 2, loginFailed = 3;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- } else if (m.what == 101) {
- actMgr.trigger(loginFailed);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- //AppMgr.transam.send(new ReqLogin(u, p, time, alive))
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/52/908340203a0d00131524a793807f338e b/client/.metadata/.plugins/org.eclipse.core.resources/.history/52/908340203a0d00131524a793807f338e
deleted file mode 100644
index 08d6230..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/52/908340203a0d00131524a793807f338e
+++ /dev/null
@@ -1,101 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
-
-
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- int loginButtonClick = 1, retryButtonClick = 2, loginFailed = 3;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- } else if (m.what == 101) {
- actMgr.trigger(loginFailed);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
- }
-
- class LoginStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- String user = edtUser.getText().toString();
- String pass = edtPass.getText().toString();
- long nowtime = System.currentTimeMillis();
- AppMgr.transam.send(new ReqLogin(user, pass, nowtime, 1000));
- }
-
- @Override
- void leave(int e) {
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- ActStatus[] r = new ActStatus[2];
- r[0] = new StartStatus();
- r[1] = new LoginStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], loginButtonClick, r[1]);
- actMgr.add(r[1], loginFailed, r[0]);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(loginButtonClick);
- }
- });
- }
-
- @Override
- protected void onResume() {
- super.onResume();
-
- }
-
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/52/b0f7e5f4300d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/52/b0f7e5f4300d00131249f322b63acde8
deleted file mode 100644
index 3ca0dfe..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/52/b0f7e5f4300d00131249f322b63acde8
+++ /dev/null
@@ -1,133 +0,0 @@
-package com.macaroon.piztor;
-
-import java.io.IOException;
-import java.net.UnknownHostException;
-import java.util.LinkedList;
-import java.util.Queue;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import android.annotation.SuppressLint;
-import android.os.Handler;
-import android.os.Message;
-
-public class Transam implements Runnable {
-
- public Timer timer;
- public Timer mtimer;
- public boolean running = false;
- public boolean flag = true;
- public int cnt = 4;
- Res res;
- Req req;
- public int p; //port
- public String i; //ip
- Thread thread;
- Handler core;
- Handler recall; //recall
- Queue<Req> reqtask ; //request task
-
- Transam(String ip, int port,Handler Recall) {
- p = port;
- i = ip;
- recall = Recall;
- reqtask = new LinkedList<Req>();
- }
-
- public void send(Req r){
- reqtask.offer(r);
-
- }
-
- public void run() { //start the main timer
- //TimerTask tmain = new Timertk();
- //mtimer = new Timer();
- //mtimer.schedule(tmain, 100, 100); //check the queue for every 100 msec
-
- while(true){
- if(running == false){
-
- if(!reqtask.isEmpty()){ //poll the head request
- req = reqtask.poll();
- if(req.time + req.alive < System.currentTimeMillis()){ //time out!
- Message ret = new Message();
- ret.obj = "Time out!";
- ret.what = 100;
- recall.sendMessage(ret);
- }
- else{ //run the request
- final thd t = new thd();
- flag = false;
- thread = new Thread(t);
- cnt = 4;
- running = true;
- thread.start();
- timer = new Timer();
- TimerTask task = new Timertk();
- timer.schedule(task, 2000, 2000);
- }
- }
- }
- }
- }
-
- class tmain extends TimerTask {
- public void run() {
-
- }
- };
-
- class thd implements Runnable {
- public void run() {
- try {
- SocketClient client = new SocketClient(i,p);
- client.sendMsg(req,recall);
- Message msg = new Message();
- msg.what = 1;
- handler.sendMessage(msg);
- client.closeSocket();
- } catch (UnknownHostException e) {
- e.printStackTrace();
- System.out.println("UnknownHostException");
- } catch (IOException e) {
- e.printStackTrace();
- System.out.println("IOException");
- }
-
- }
- }
-
- @SuppressLint("HandlerLeak")
- Handler handler = new Handler() {
- public void handleMessage(Message msg) {
- switch (msg.what) {
- case 1:
- flag = true;
- break;
- case 2:
- final thd t = new thd();
- thread = new Thread(t);
- thread.start();
- break;
- }
- super.handleMessage(msg);
- }
- };
-
- class Timertk extends TimerTask {
- public void run() {
- if (flag == false && cnt > 0) {
- cnt--;
- } else if (cnt == 0) {
- Message msg = new Message();
- msg.obj = "connecting failed";
- msg.what = 101;
- recall.sendMessage(msg);
- timer.cancel();
- } else if (flag == true) {
- timer.cancel();
- running = false;
- }
- }
- };
-} \ No newline at end of file
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/53/20300883550d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/53/20300883550d00131719b896d543f08c
deleted file mode 100644
index c808aa2..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/53/20300883550d00131719b896d543f08c
+++ /dev/null
@@ -1,67 +0,0 @@
-package com.macaroon.piztor;
-
-import android.content.Context;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import android.content.Context;
-import android.os.Handler;
-import android.os.Message;
-import android.util.Log;
-import android.os.SystemClock;
-
-
-public class Tracker implements Runnable {
-
- private static final long TIME_DELTA = 1000 * 3; // 3 second
- public Timer timer;
- private final Context mContext;
- GPSTracker myTracker;
- Handler mHandler;
- Message message;
-
- public Tracker(Context context, Handler yHandler) {
- timer = new Timer();
- mContext = context;
- myTracker = new GPSTracker(mContext);
- mHandler = yHandler;
- }
-
- void setHandler(Handler hand) {
- mHandler = hand;
- }
-
-
- public void run() {
- GPSTask myTask = new GPSTask();
- timer.schedule(myTask, 0, TIME_DELTA);
- }
-
- class GPSTask extends TimerTask {
- @Override
- public void run() {
- message = new Message();
- message.what = 0;
- myTracker.getLocation();
- Log.d("Location", "Fetching location.....");
- if (myTracker.canGetLocation()) {
- double latitude = myTracker.getLatitude();
- double longitude = myTracker.getLongitude();
-
- Log.d("TTTTTTTTTTTTTTTTTTTTTTTime","TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTime");
- System.out.println("GPSTIME" + myTracker.location.getTime());
- System.out.println("SYSTIME" + SystemClock.elapsedRealtime());
-
- if(myTracker.isGPSFix()) {
- message.what = 1;
- } else {
- message.what = 2;
- }
- mHandler.sendMessage(message);
- } else {
- message.what = 0;
- mHandler.sendMessage(message);
- }
- }
- }
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/53/a06c6384500d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/53/a06c6384500d00131719b896d543f08c
deleted file mode 100644
index dd6b5ed..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/53/a06c6384500d00131719b896d543f08c
+++ /dev/null
@@ -1,92 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="fill_parent"
- android:background="@android:color/black"
- android:orientation="vertical">
-
-<LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:background="@android:color/black"
- android:gravity="center_horizontal"
- android:orientation="vertical" >
-
- <ImageView
- android:id="@+id/main_headbar_img"
- android:layout_width="180dp"
- android:layout_height="240dp"
- android:layout_gravity="center_horizontal"
- android:src="@drawable/title_logo" />
-
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:layout_gravity="center">
-
- <TableLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <TableRow
- android:layout_marginBottom="15dp"
- android:layout_marginTop="15dp">
- <TextView
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="0.25"
- android:gravity="right"
- android:id="@+id/user_id_text"
- android:text="User ID"
- android:textColor="@android:color/white"
- />
-
- <EditText
- android:layout_width="0dp"
- android:layout_weight="0.75"
- android:id="@+id/user_id"
- android:textColor="@android:color/black"
- android:singleLine="true"/>
- <requestFocus/>
- </TableRow>
-
- <TableRow>
- <TextView
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="0.25"
- android:gravity="right"
- android:id="@+id/user_pass_text"
- android:text="Password"
- android:textColor="@android:color/black"
- />
-
- <EditText
- android:layout_width="0dp"
- android:layout_weight="0.75"
- android:id="@+id/user_pass"
- android:password="true"
- android:textColor="@android:color/white"
- android:singleLine="true"/>
- </TableRow>
- </TableLayout>
- </LinearLayout>
-
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:orientation="vertical"
- >
- <Button
- android:id="@+id/login_btn_login"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:text="Login"
- android:textColor="@android:color/white" />
- </LinearLayout>
-
-</LinearLayout>
-</RelativeLayout>
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/53/b0d150cf4d0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/53/b0d150cf4d0d00131719b896d543f08c
deleted file mode 100644
index 8ce051f..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/53/b0d150cf4d0d00131719b896d543f08c
+++ /dev/null
@@ -1,149 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:background="@drawable/topbar_background"
- android:orientation="horizontal" >
-
- <RelativeLayout
- android:id="@+id/settings_headbar_layout"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentTop="true" >
-
- <include layout="@layout/settings_headbar" />
- </RelativeLayout>
-
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="match_parent"
- android:layout_marginTop="48dip"
- android:orientation="vertical" >
-
- <TextView
- android:id="@+id/settings_GPSrefreshrate_text"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="GPS refresh rate"
- android:layout_gravity="center"
- android:layout_marginTop="10dip"
- android:textSize="20dip"
- android:textColor="@android:color/white" />
-
- <SeekBar
- android:id="@+id/settings_GPSrefreshrate"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" />
-
-
- <!-- LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- -->
- <!-- TextView
- android:id="@+id/GPS_min_text"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentLeft="true"
- android:layout_marginLeft="10dip"
- android:text="1s"
- android:textSize="10dip"
- android:textColor="@android:color/white"/-->
-
- <!--TextView
- android:id="@+id/GPS_max_text"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentRight="true"
- android:text="30s"
- android:textColor="@android:color/white"
- android:textSize="10dip" /-->
-
- <!-- /LinearLayout --> <!-- end of gps text -->
-
- <ImageView
- android:id="@+id/settings_seperator1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:src="@drawable/horizontal_line" />
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:id="@+id/settings_sex_layout"
- android:layout_marginTop="10dip">
-
- <TextView
- android:id="@+id/settings_sex_text"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginLeft="10dip"
- android:textSize="20dip"
- android:textColor="@android:color/white"
- android:text="@string/show_sex" />
-
- <CheckBox
- android:id="@+id/settings_show_male"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/male"
- android:textColor="@android:color/white"/>
-
-
- <CheckBox
- android:id="@+id/settings_show_female"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/female"
- android:textColor="@android:color/white"/>
-
- </LinearLayout>
-
- <ImageView
- android:id="@+id/settings_seperator2"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:src="@drawable/horizontal_line" />
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:id="@+id/settings_team_layout"
- android:layout_marginTop="10dip">
-
- <TextView
- android:id="@+id/settings_team_text"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginLeft="10dip"
- android:textSize="20dip"
- android:textColor="@android:color/white"
- android:text="@string/show_team" />
-
- <RadioButton
- android:id="@+id/settings_team_mine"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/mine"
- android:textSize="20dip"
- android:textColor="@android:color/white"/>
-
- <RadioButton
- android:id="@+id/settings_team_all"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/all"
- android:textSize="20dip"
- android:textColor="@android:color/white"/>
-
- </LinearLayout>
-
- <ImageView
- android:id="@+id/settings_seperator3"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:src="@drawable/horizontal_line" />
-
- </LinearLayout>
- </RelativeLayout>
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/54/105bdc86800d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/54/105bdc86800d00131719b896d543f08c
deleted file mode 100644
index 02ab321..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/54/105bdc86800d00131719b896d543f08c
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.Vector;
-
-public class Infomation {
- static String ip = "69.85.86.42";
- static int port = 9990;
- static int token = -1;
-
- static class UserInfo {
- int id;
- double lat, lot;
- }
-
- static class Group {
- int id;
- Vector<UserInfo> v;
- }
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/55/c0697f702b0d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/55/c0697f702b0d00131249f322b63acde8
deleted file mode 100644
index 5b597a4..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/55/c0697f702b0d00131249f322b63acde8
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.macaroon.piztor;
-
-
-//--------------------------------------//
-// Respond to login //
-//--------------------------------------//
-
-public class ResLogin extends Res{
- int t; //user token
-
- ResLogin(int token,int status){
- super(0,status); //for type 0
- t = token;
- }
-} \ No newline at end of file
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/56/70ea45fe4b0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/56/70ea45fe4b0d00131719b896d543f08c
deleted file mode 100644
index cc59885..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/56/70ea45fe4b0d00131719b896d543f08c
+++ /dev/null
@@ -1,102 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
-
-
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- int loginButtonClick = 1, retryButtonClick = 2, loginFailed = 3;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- } else if (m.what == 101) {
- actMgr.trigger(loginFailed);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
- }
-
- class LoginStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- String user = edtUser.getText().toString();
- String pass = edtPass.getText().toString();
- long nowtime = System.currentTimeMillis();
- System.out.println(user + " : " + pass + "\n");
- AppMgr.transam.send(new ReqLogin(user, pass, nowtime, 1000));
- }
-
- @Override
- void leave(int e) {
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- ActStatus[] r = new ActStatus[2];
- r[0] = new StartStatus();
- r[1] = new LoginStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], loginButtonClick, r[1]);
- actMgr.add(r[1], loginFailed, r[0]);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(loginButtonClick);
- }
- });
- }
-
- @Override
- protected void onResume() {
- super.onResume();
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/56/e0d3f982370d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/56/e0d3f982370d00131249f322b63acde8
deleted file mode 100644
index 270e26b..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/56/e0d3f982370d00131249f322b63acde8
+++ /dev/null
@@ -1,96 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
-
-
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- int loginButtonClick = 1, retryButtonClick = 2, loginFailed = 3;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- } else if (m.what == 101) {
- actMgr.trigger(loginFailed);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
- }
-
- class LoginStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- void leave(int e) {
- // TODO Auto-generated method stub
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- //AppMgr.transam.send(new ReqLogin(u, p, time, alive))
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/58/c0259769680d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/58/c0259769680d00131719b896d543f08c
deleted file mode 100644
index 217c86a..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/58/c0259769680d00131719b896d543f08c
+++ /dev/null
@@ -1,92 +0,0 @@
-package com.macaroon.piztor;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
-
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- @SuppressLint("HandlerLeak")
- Handler handler = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- if (l == null)
- System.out.println("fuck!!!");
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- void leave(int e) {
- // TODO Auto-generated method stub
-
- }
-
- }
-
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(handler);
- ActStatus[] r = new ActStatus[2];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/59/604165f5520d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/59/604165f5520d00131719b896d543f08c
deleted file mode 100644
index de79560..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/59/604165f5520d00131719b896d543f08c
+++ /dev/null
@@ -1,62 +0,0 @@
-package com.macaroon.piztor;
-
-import android.content.Context;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import android.content.Context;
-import android.os.Handler;
-import android.os.Message;
-import android.util.Log;
-import android.os.SystemClock;
-
-
-public class Tracker implements Runnable {
-
- private static final long TIME_DELTA = 1000 * 3; // 3 second
- public Timer timer;
- private final Context mContext;
- GPSTracker myTracker;
- Handler mHandler;
- Message message;
-
- public Tracker(Context context, Handler yHandler) {
- timer = new Timer();
- mContext = context;
- myTracker = new GPSTracker(mContext);
- mHandler = yHandler;
- }
-
- public void run() {
- GPSTask myTask = new GPSTask();
- timer.schedule(myTask, 0, TIME_DELTA);
- }
-
- class GPSTask extends TimerTask {
- @Override
- public void run() {
- message = new Message();
- message.what = 0;
- myTracker.getLocation();
- Log.d("Location", "Fetching location.....");
- if (myTracker.canGetLocation()) {
- double latitude = myTracker.getLatitude();
- double longitude = myTracker.getLongitude();
-
- Log.d("TTTTTTTTTTTTTTTTTTTTTTTime","TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTime");
- System.out.println("GPSTIME" + myTracker.location.getTime());
- System.out.println("SYSTIME" + SystemClock.elapsedRealtime());
-
- if(myTracker.isGPSFix()) {
- message.what = 1;
- } else {
- message.what = 2;
- }
- mHandler.sendMessage(message);
- } else {
- message.what = 0;
- mHandler.sendMessage(message);
- }
- }
- }
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/59/b0dfede04f0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/59/b0dfede04f0d00131719b896d543f08c
deleted file mode 100644
index 3ba7c18..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/59/b0dfede04f0d00131719b896d543f08c
+++ /dev/null
@@ -1,21 +0,0 @@
-<resources>
-
- <string name="app_name">piztor</string>
- <string name="action_settings">Settings</string>
- <string name="hello_world">Hello world!</string>
- <string name="settings">Settings</string>
- <string name="search">Search</string>
- <string name="fetch">Fetch</string>
- <string name="checkin">Checkin</string>
- <string name="focus">Focus</string>
- <string name="show_sex">Show sex: </string>
- <string name="male">Male</string>
- <string name="female">Female</string>
- <string name="show_team">Show team: </string>
- <string name="all">All</string>
- <string name="mine">Mine</string>
- <string name="title_activity_login">Login</string>
- <string name="title_activity_main">Main</string>
-
-
-</resources>
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/5a/1067b967520d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/5a/1067b967520d00131719b896d543f08c
deleted file mode 100644
index bd67eb4..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/5a/1067b967520d00131719b896d543f08c
+++ /dev/null
@@ -1,62 +0,0 @@
-package com.macaroon.piztor;
-
-import android.content.Context;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import android.content.Context;
-import android.os.Handler;
-import android.os.Message;
-import android.util.Log;
-import android.os.SystemClock;
-
-
-public class Tracker implements Runnable {
-
- private static final long TIME_DELTA = 1000 * 1; // 1 second
- public Timer timer;
- private final Context mContext;
- GPSTracker myTracker;
- Handler mHandler;
- Message message;
-
- public Tracker(Controller newController, Context context, Handler yHandler) {
- timer = new Timer();
- mContext = context;
- myTracker = new GPSTracker(mContext);
- mHandler = yHandler;
- }
-
- public void run() {
- GPSTask myTask = new GPSTask();
- timer.schedule(myTask, 0, TIME_DELTA);
- }
-
- class GPSTask extends TimerTask {
- @Override
- public void run() {
- message = new Message();
- message.what = 0;
- myTracker.getLocation();
- Log.d("Location", "Fetching location.....");
- if (myTracker.canGetLocation()) {
- double latitude = myTracker.getLatitude();
- double longitude = myTracker.getLongitude();
-
- Log.d("TTTTTTTTTTTTTTTTTTTTTTTime","TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTime");
- System.out.println("GPSTIME" + myTracker.location.getTime());
- System.out.println("SYSTIME" + SystemClock.elapsedRealtime());
-
- if(myTracker.isGPSFix()) {
- message.what = 1;
- } else {
- message.what = 2;
- }
- mHandler.sendMessage(message);
- } else {
- message.what = 0;
- mHandler.sendMessage(message);
- }
- }
- }
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/5a/20289dc1250d00131a9bb9bc5a5e6171 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/5a/20289dc1250d00131a9bb9bc5a5e6171
deleted file mode 100644
index 9259786..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/5a/20289dc1250d00131a9bb9bc5a5e6171
+++ /dev/null
@@ -1,62 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
-
- Intent i = new Intent();
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- addStatus(InitAct.class);
-
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/5b/a01d01234f0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/5b/a01d01234f0d00131719b896d543f08c
deleted file mode 100644
index 5ef6d3d..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/5b/a01d01234f0d00131719b896d543f08c
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.macaroon.piztor"
- android:versionCode="1"
- android:versionName="1.0" >
-
- <uses-sdk
- android:minSdkVersion="8"
- android:targetSdkVersion="17" />
-
- <application
- android:allowBackup="true"
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name"
- android:theme="@android:style/Theme.NoTitleBar" >
- <activity
- android:name="com.macaroon.piztor.InitAct"
- android:label="@string/app_name" >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
-
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- <activity
- android:name="com.macaroon.piztor.Login"
- android:label="@string/activity_login" >
- </activity>
- <activity
- android:name="com.macaroon.piztor.Main"
- android:label="@string/title_activity_main" >
- </activity>
- <activity
- android:name="com.macaroon.piztor.Setting"
- android:label="@string/title_activity_setting" >
- </activity>
- </application>
-
- <uses-permission android:name="android.permission.INTERNET" />
- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
-
-</manifest>
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/5b/b09b88be520d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/5b/b09b88be520d00131719b896d543f08c
deleted file mode 100644
index 5c0e0de..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/5b/b09b88be520d00131719b896d543f08c
+++ /dev/null
@@ -1,62 +0,0 @@
-package com.macaroon.piztor;
-
-import android.content.Context;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import android.content.Context;
-import android.os.Handler;
-import android.os.Message;
-import android.util.Log;
-import android.os.SystemClock;
-
-
-public class Tracker implements Runnable {
-
- private static final long TIME_DELTA = 1000 * 1; // 1 second
- public Timer timer;
- private final Context mContext;
- GPSTracker myTracker;
- Handler mHandler;
- Message message;
-
- public Tracker(Context context, Handler yHandler) {
- timer = new Timer();
- mContext = context;
- myTracker = new GPSTracker(mContext);
- mHandler = yHandler;
- }
-
- public void run() {
- GPSTask myTask = new GPSTask();
- timer.schedule(myTask, 0, TIME_DELTA);
- }
-
- class GPSTask extends TimerTask {
- @Override
- public void run() {
- message = new Message();
- message.what = 0;
- myTracker.getLocation();
- Log.d("Location", "Fetching location.....");
- if (myTracker.canGetLocation()) {
- double latitude = myTracker.getLatitude();
- double longitude = myTracker.getLongitude();
-
- Log.d("TTTTTTTTTTTTTTTTTTTTTTTime","TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTime");
- System.out.println("GPSTIME" + myTracker.location.getTime());
- System.out.println("SYSTIME" + SystemClock.elapsedRealtime());
-
- if(myTracker.isGPSFix()) {
- message.what = 1;
- } else {
- message.what = 2;
- }
- mHandler.sendMessage(message);
- } else {
- message.what = 0;
- mHandler.sendMessage(message);
- }
- }
- }
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/5c/40ac8a2a760d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/5c/40ac8a2a760d00131719b896d543f08c
deleted file mode 100644
index b542348..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/5c/40ac8a2a760d00131719b896d543f08c
+++ /dev/null
@@ -1,174 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.Vector;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- @SuppressLint("HandlerLeak")
- Handler fromGPS = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- Handler fromTransam = new Handler() {
- @Override
- public void handleMessage(Message m) {
- switch (m.what) {
- case 3:
- ResLocation r = (ResLocation) m.obj;
- Vector<Rlocation> l = r.l;
- for (int i = 0; i < n; i++) {
- System.out.println(l.get(i).lat + " " + l.get(i).lot);
- }
- break;
-
- default:
- break;
- }
-
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "Search Button Press";
- case FetchButtonPress:
- return "Fetch Button Press";
- case FocuseButtonPress:
- return "Focuse Button Press";
- case SuccessFetch:
- return "Success Fetch";
- case FailedFetch:
- return "Failed Fetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- if (e == SuccessFetch) {
-
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter Fetch status!!!!");
- if (e == FetchButtonPress) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1,
- System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave fetch status!!!! because" + cause(e));
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter focus status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave focus status!!!! because" + cause(e));
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(fromGPS);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
- btnFetch.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(FetchButtonPress);
- }
- });
- btnFocus.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- actMgr.trigger(FocuseButtonPress);
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/5c/a0a26974330d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/5c/a0a26974330d00131249f322b63acde8
deleted file mode 100644
index 0b0b39c..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/5c/a0a26974330d00131249f322b63acde8
+++ /dev/null
@@ -1,53 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- Handler hand = new Handler() {
-
- };
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/5d/10ddd0bd550d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/5d/10ddd0bd550d00131719b896d543f08c
deleted file mode 100644
index 5356063..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/5d/10ddd0bd550d00131719b896d543f08c
+++ /dev/null
@@ -1,68 +0,0 @@
-package com.macaroon.piztor;
-
-import android.content.Context;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import android.location.Location;
-import android.content.Context;
-import android.os.Handler;
-import android.os.Message;
-import android.util.Log;
-import android.os.SystemClock;
-
-
-public class Tracker implements Runnable {
-
- private static final long TIME_DELTA = 1000 * 3; // 3 second
- public Timer timer;
- private final Context mContext;
- GPSTracker myTracker;
- Handler mHandler;
- Message message;
-
- public Tracker(Context context, Handler yHandler) {
- timer = new Timer();
- mContext = context;
- myTracker = new GPSTracker(mContext);
- mHandler = yHandler;
- }
-
- void setHandler(Handler hand) {
- mHandler = hand;
- }
-
-
- public void run() {
- GPSTask myTask = new GPSTask();
- timer.schedule(myTask, 0, TIME_DELTA);
- }
-
- class GPSTask extends TimerTask {
- @Override
- public void run() {
- message = new Message();
- message.what = 0;
- Location location = myTracker.getLocation();
- Log.d("Location", "Fetching location.....");
- if (myTracker.canGetLocation()) {
- double latitude = myTracker.getLatitude();
- double longitude = myTracker.getLongitude();
-
- Log.d("TTTTTTTTTTTTTTTTTTTTTTTime","TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTime");
- System.out.println("GPSTIME" + myTracker.location.getTime());
- System.out.println("SYSTIME" + SystemClock.elapsedRealtime());
-
- if(myTracker.isGPSFix()) {
- message.what = 1;
- } else {
- message.what = 2;
- }
- mHandler.sendMessage(message);
- } else {
- message.what = 0;
- mHandler.sendMessage(message);
- }
- }
- }
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/5d/b06ac273760d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/5d/b06ac273760d00131719b896d543f08c
deleted file mode 100644
index 70fe77c..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/5d/b06ac273760d00131719b896d543f08c
+++ /dev/null
@@ -1,174 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.Vector;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- @SuppressLint("HandlerLeak")
- Handler fromGPS = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- Handler fromTransam = new Handler() {
- @Override
- public void handleMessage(Message m) {
- switch (m.what) {
- case 3:
- ResLocation r = (ResLocation) m.obj;
- for (int i = 0; i < r.n; i++) {
- System.out.println(r.l.get(i).lat + " " + r.l.get(i).lot);
- }
- actMgr.trigger(SuccessFetch);
- break;
-
- default:
- break;
- }
-
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "Search Button Press";
- case FetchButtonPress:
- return "Fetch Button Press";
- case FocuseButtonPress:
- return "Focuse Button Press";
- case SuccessFetch:
- return "Success Fetch";
- case FailedFetch:
- return "Failed Fetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- if (e == SuccessFetch) {
-
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter Fetch status!!!!");
- if (e == FetchButtonPress) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1,
- System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave fetch status!!!! because" + cause(e));
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter focus status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave focus status!!!! because" + cause(e));
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(fromGPS);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
- btnFetch.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(FetchButtonPress);
- }
- });
- btnFocus.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- actMgr.trigger(FocuseButtonPress);
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/5e/5026feaa340d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/5e/5026feaa340d00131249f322b63acde8
deleted file mode 100644
index 4aaa9a5..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/5e/5026feaa340d00131249f322b63acde8
+++ /dev/null
@@ -1,61 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- actMgr.trigger(AppMgr.loginSuccess);
- }
- }
- };
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/5f/40817ce9810d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/5f/40817ce9810d00131719b896d543f08c
deleted file mode 100644
index 18e7b2b..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/5f/40817ce9810d00131719b896d543f08c
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-import java.util.Vector;
-
-public class Infomation {
- static String ip = "69.85.86.42";
- static int port = 9990;
- static int token = -1;
- static int myId = -1;
- static int myGroup = -1;
- class UserInfo {
- int id;
- double lat, lot;
- }
-
- class Group {
- int id;
- Vector<UserInfo> v;
- }
-
- static HashMap<Integer, Group> mp;
-
- static void init() {
- mp = new HashMap<Integer, Group>;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/6/509d88ee670d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/6/509d88ee670d00131719b896d543f08c
deleted file mode 100644
index 7630c2a..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/6/509d88ee670d00131719b896d543f08c
+++ /dev/null
@@ -1,91 +0,0 @@
-package com.macaroon.piztor;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
-
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- @SuppressLint("HandlerLeak")
- Handler handler = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- if (l == null)
- System.out.println("fuck!!!");
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- void leave(int e) {
- // TODO Auto-generated method stub
-
- }
-
- }
-
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(handler);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/60/c0fbac51760d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/60/c0fbac51760d00131719b896d543f08c
deleted file mode 100644
index 460b7e4..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/60/c0fbac51760d00131719b896d543f08c
+++ /dev/null
@@ -1,173 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.Vector;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- @SuppressLint("HandlerLeak")
- Handler fromGPS = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- Handler fromTransam = new Handler() {
- @Override
- public void handleMessage(Message m) {
- switch (m.what) {
- case 3:
- ResLocation r = (ResLocation) m.obj;
- for (int i = 0; i < r.n; i++) {
- System.out.println(r.l.get(i).lat + " " + r.l.get(i).lot);
- }
- break;
-
- default:
- break;
- }
-
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "Search Button Press";
- case FetchButtonPress:
- return "Fetch Button Press";
- case FocuseButtonPress:
- return "Focuse Button Press";
- case SuccessFetch:
- return "Success Fetch";
- case FailedFetch:
- return "Failed Fetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- if (e == SuccessFetch) {
-
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter Fetch status!!!!");
- if (e == FetchButtonPress) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1,
- System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave fetch status!!!! because" + cause(e));
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter focus status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave focus status!!!! because" + cause(e));
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(fromGPS);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
- btnFetch.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(FetchButtonPress);
- }
- });
- btnFocus.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- actMgr.trigger(FocuseButtonPress);
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/61/503835816a0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/61/503835816a0d00131719b896d543f08c
deleted file mode 100644
index 1ebf61c..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/61/503835816a0d00131719b896d543f08c
+++ /dev/null
@@ -1,116 +0,0 @@
-package com.macaroon.piztor;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- @SuppressLint("HandlerLeak")
- Handler handler = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- if (l == null)
- System.out.println("fuck!!!");
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- void leave(int e) {
- // TODO Auto-generated method stub
-
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- void leave(int e) {
- // TODO Auto-generated method stub
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(handler);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/62/f050f6cd300d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/62/f050f6cd300d00131249f322b63acde8
deleted file mode 100644
index c31924d..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/62/f050f6cd300d00131249f322b63acde8
+++ /dev/null
@@ -1,132 +0,0 @@
-package com.macaroon.piztor;
-
-import java.io.IOException;
-import java.net.UnknownHostException;
-import java.util.LinkedList;
-import java.util.Queue;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import android.annotation.SuppressLint;
-import android.os.Handler;
-import android.os.Message;
-
-public class Transam implements Runnable {
- public Timer timer;
- public Timer mtimer;
- public boolean running = false;
- public boolean flag = true;
- public int cnt = 4;
- Res res;
- Req req;
- public int p; //port
- public String i; //ip
- Thread thread;
- Handler core;
- Handler recall; //recall
- Queue<Req> reqtask ; //request task
-
- Transam(String ip, int port,Handler Recall) {
- p = port;
- i = ip;
- recall = Recall;
- reqtask = new LinkedList<Req>();
- }
-
- public void send(Req r){
- reqtask.offer(r);
-
- }
-
- public void run() { //start the main timer
- //TimerTask tmain = new Timertk();
- //mtimer = new Timer();
- //mtimer.schedule(tmain, 100, 100); //check the queue for every 100 msec
-
- while(true){
- if(running == false){
-
- if(!reqtask.isEmpty()){ //poll the head request
- req = reqtask.poll();
- if(req.time + req.alive < System.currentTimeMillis()){ //time out!
- Message ret = new Message();
- ret.obj = "Time out!";
- ret.what = 100;
- recall.sendMessage(ret);
- }
- else{ //run the request
- final thd t = new thd();
- flag = false;
- thread = new Thread(t);
- cnt = 4;
- running = true;
- thread.start();
- timer = new Timer();
- TimerTask task = new Timertk();
- timer.schedule(task, 2000, 2000);
- }
- }
- }
- }
- }
-
- class tmain extends TimerTask {
- public void run() {
-
- }
- };
-
- class thd implements Runnable {
- public void run() {
- try {
- SocketClient client = new SocketClient(i,p);
- client.sendMsg(req,recall);
- Message msg = new Message();
- msg.what = 1;
- handler.sendMessage(msg);
- client.closeSocket();
- } catch (UnknownHostException e) {
- e.printStackTrace();
- System.out.println("UnknownHostException");
- } catch (IOException e) {
- e.printStackTrace();
- System.out.println("IOException");
- }
-
- }
- }
-
- @SuppressLint("HandlerLeak")
- Handler handler = new Handler() {
- public void handleMessage(Message msg) {
- switch (msg.what) {
- case 1:
- flag = true;
- break;
- case 2:
- final thd t = new thd();
- thread = new Thread(t);
- thread.start();
- break;
- }
- super.handleMessage(msg);
- }
- };
-
- class Timertk extends TimerTask {
- public void run() {
- if (flag == false && cnt > 0) {
- cnt--;
- } else if (cnt == 0) {
- Message msg = new Message();
- msg.obj = "connecting failed";
- msg.what = 101;
- recall.sendMessage(msg);
- timer.cancel();
- } else if (flag == true) {
- timer.cancel();
- running = false;
- }
- }
- };
-} \ No newline at end of file
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/65/10afe9c2560d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/65/10afe9c2560d00131719b896d543f08c
deleted file mode 100644
index d2c7c5f..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/65/10afe9c2560d00131719b896d543f08c
+++ /dev/null
@@ -1,68 +0,0 @@
-package com.macaroon.piztor;
-
-import android.content.Context;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import android.location.Location;
-import android.content.Context;
-import android.os.Handler;
-import android.os.Message;
-import android.util.Log;
-import android.os.SystemClock;
-
-
-public class Tracker implements Runnable {
-
- private static final long TIME_DELTA = 1000 * 3; // 3 second
- public Timer timer;
- private final Context mContext;
- GPSTracker myTracker;
- Handler mHandler;
- Message message;
-
- public Tracker(Context context, Handler yHandler) {
- timer = new Timer();
- mContext = context;
- myTracker = new GPSTracker(mContext);
- mHandler = yHandler;
- }
-
- void setHandler(Handler hand) {
- mHandler = hand;
- }
-
-
- public void run() {
- GPSTask myTask = new GPSTask();
- timer.schedule(myTask, 0, TIME_DELTA);
- }
-
- class GPSTask extends TimerTask {
- @Override
- public void run() {
- Location location = myTracker.getLocation();
- Log.d("Location", "Fetching location.....");
- if (myTracker.canGetLocation()) {
-
- Log.d("TTTTTTTTTTTTTTTTTTTTTTTime","TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTime");
- System.out.println("GPSTIME" + myTracker.location.getTime());
- System.out.println("SYSTIME" + SystemClock.elapsedRealtime());
-
- message = new Message();
- message.what = 0;
- message.obj = location;
- if(myTracker.isGPSFix()) {
- message.what = 1;
- } else {
- message.what = 2;
- }
- mHandler.sendMessage(message);
- } else {
- message = new Message();
- message.what = 0;
- mHandler.sendMessage(message);
- }
- }
- }
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/65/7015966a370d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/65/7015966a370d00131249f322b63acde8
deleted file mode 100644
index 5254e91..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/65/7015966a370d00131249f322b63acde8
+++ /dev/null
@@ -1,83 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
-
-
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- int loginButtonClick = 1, retryButtonClick = 2, loginFailed = 3;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- } else if (m.what == 101) {
- actMgr.trigger(loginFailed);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- // TODO Auto-generated method stub
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- //AppMgr.transam.send(new ReqLogin(u, p, time, alive))
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/65/c008735d330d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/65/c008735d330d00131249f322b63acde8
deleted file mode 100644
index 4660356..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/65/c008735d330d00131249f322b63acde8
+++ /dev/null
@@ -1,134 +0,0 @@
-package com.macaroon.piztor;
-
-import java.io.IOException;
-import java.net.UnknownHostException;
-import java.util.LinkedList;
-import java.util.Queue;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import android.annotation.SuppressLint;
-import android.os.Handler;
-import android.os.Message;
-
-public class Transam implements Runnable {
-
- public Timer timer;
- public Timer mtimer;
- public boolean running = false;
- public boolean flag = true;
- public int cnt = 4;
- Res res;
- Req req;
- public int p; // port
- public String i; // ip
- Thread thread;
- Handler core;
- Handler recall; // recall
- Queue<Req> reqtask; // request task
-
- Transam(String ip, int port, Handler Recall) {
- p = port;
- i = ip;
- recall = Recall;
- reqtask = new LinkedList<Req>();
- }
-
- public void send(Req r) {
- reqtask.offer(r);
-
- }
-
- public void run() { // start the main timer
- // TimerTask tmain = new Timertk();
- // mtimer = new Timer();
- // mtimer.schedule(tmain, 100, 100); //check the queue for every 100
- // msec
-
- while (true) {
- if (running == false) {
-
- if (!reqtask.isEmpty()) { // poll the head request
- req = reqtask.poll();
- if (req.time + req.alive < System.currentTimeMillis()) { // time
- // out!
- Message ret = new Message();
- ret.obj = "Time out!";
- ret.what = 100;
- recall.sendMessage(ret);
- } else { // run the request
- final thd t = new thd();
- flag = false;
- thread = new Thread(t);
- cnt = 4;
- running = true;
- thread.start();
- timer = new Timer();
- TimerTask task = new Timertk();
- timer.schedule(task, 2000, 2000);
- }
- }
- }
- }
- }
-
- class tmain extends TimerTask {
- public void run() {
-
- }
- };
-
- class thd implements Runnable {
- public void run() {
- try {
- SocketClient client = new SocketClient(i, p);
- client.sendMsg(req, recall);
- Message msg = new Message();
- msg.what = 1;
- handler.sendMessage(msg);
- client.closeSocket();
- } catch (UnknownHostException e) {
- e.printStackTrace();
- System.out.println("UnknownHostException");
- } catch (IOException e) {
- e.printStackTrace();
- System.out.println("IOException");
- }
-
- }
- }
-
- @SuppressLint("HandlerLeak")
- Handler handler = new Handler() {
- public void handleMessage(Message msg) {
- switch (msg.what) {
- case 1:
- flag = true;
- break;
- case 2:
- final thd t = new thd();
- thread = new Thread(t);
- thread.start();
- break;
- }
- super.handleMessage(msg);
- }
- };
-
- class Timertk extends TimerTask {
- public void run() {
- if (flag == false && cnt > 0) {
- cnt--;
- } else if (cnt == 0) {
- Message msg = new Message();
- msg.obj = "connecting failed";
- msg.what = 101;
- recall.sendMessage(msg);
- timer.cancel();
- } else if (flag == true) {
- timer.cancel();
- running = false;
- }
- }
- };
-} \ No newline at end of file
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/66/108b1d6a2c0d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/66/108b1d6a2c0d00131249f322b63acde8
deleted file mode 100644
index 0547f4f..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/66/108b1d6a2c0d00131249f322b63acde8
+++ /dev/null
@@ -1,72 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
-
- //Event
-
- final static int hasToken = 101;
-
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
- Intent i = new Intent();
- System.out.println(nowAct.id + " : " + event);
- if (mp.get(nowAct.getClass()) == null)
- System.out.println("first");
- else if (mp.get(nowAct.getClass()) == null)
- System.out.println("second");
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- addStatus(InitAct.class);
- addStatus(Login.class);
- addTransition(InitAct.class, hasToken, Login.class);
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/67/7089926a2b0d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/67/7089926a2b0d00131249f322b63acde8
deleted file mode 100644
index 727eaa3..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/67/7089926a2b0d00131249f322b63acde8
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.macaroon.piztor;
-
-
-//--------------------------------------//
-// Respond to update location //
-//--------------------------------------//
-
-public class ResUpdate extends Res{
-
- ResUpdate(int status){
- super(2,status); //for type 2
- }
-} \ No newline at end of file
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/67/80e1a600230d00131a9bb9bc5a5e6171 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/67/80e1a600230d00131a9bb9bc5a5e6171
deleted file mode 100644
index c846594..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/67/80e1a600230d00131a9bb9bc5a5e6171
+++ /dev/null
@@ -1,5 +0,0 @@
-package com.macaroon.piztor;
-
-public class PiztorExcepiton {
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/6b/40af41ee250d00131a9bb9bc5a5e6171 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/6b/40af41ee250d00131a9bb9bc5a5e6171
deleted file mode 100644
index bab59bd..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/6b/40af41ee250d00131a9bb9bc5a5e6171
+++ /dev/null
@@ -1,69 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
-
- //Event
-
- final static int hasToken = 1;
-
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
-
- Intent i = new Intent();
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- addStatus(InitAct.class);
- addStatus(Login.class);
-
-
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/6b/50c980702b0d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/6b/50c980702b0d00131249f322b63acde8
deleted file mode 100644
index 5b597a4..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/6b/50c980702b0d00131249f322b63acde8
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.macaroon.piztor;
-
-
-//--------------------------------------//
-// Respond to login //
-//--------------------------------------//
-
-public class ResLogin extends Res{
- int t; //user token
-
- ResLogin(int token,int status){
- super(0,status); //for type 0
- t = token;
- }
-} \ No newline at end of file
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/6c/e0cb25df390d00131524a793807f338e b/client/.metadata/.plugins/org.eclipse.core.resources/.history/6c/e0cb25df390d00131524a793807f338e
deleted file mode 100644
index a4cce6a..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/6c/e0cb25df390d00131524a793807f338e
+++ /dev/null
@@ -1,99 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
-
-
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- int loginButtonClick = 1, retryButtonClick = 2, loginFailed = 3;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- } else if (m.what == 101) {
- actMgr.trigger(loginFailed);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
- }
-
- class LoginStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- String user = edtUser.getText().toString();
- String pass = edtPass.getText().toString();
- long nowtime = System.currentTimeMillis();
- AppMgr.transam.send(new ReqLogin(user, pass, nowtime, 1000));
- }
-
- @Override
- void leave(int e) {
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- ActStatus[] r = new ActStatus[2];
- r[0] = new StartStatus();
- r[1] = new LoginStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], loginButtonClick, r[1]);
- actMgr.add(r[1], loginFailed, r[0]);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(loginButtonClick);
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/6d/30ed916a2b0d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/6d/30ed916a2b0d00131249f322b63acde8
deleted file mode 100644
index 727eaa3..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/6d/30ed916a2b0d00131249f322b63acde8
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.macaroon.piztor;
-
-
-//--------------------------------------//
-// Respond to update location //
-//--------------------------------------//
-
-public class ResUpdate extends Res{
-
- ResUpdate(int status){
- super(2,status); //for type 2
- }
-} \ No newline at end of file
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/6e/a03ae288270d00131050e648e11def2a b/client/.metadata/.plugins/org.eclipse.core.resources/.history/6e/a03ae288270d00131050e648e11def2a
deleted file mode 100644
index 3fdce81..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/6e/a03ae288270d00131050e648e11def2a
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.app.Activity;
-import android.view.Menu;
-
-public class InitAct extends PiztorAct {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_init);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- AppMgr.trigger(AppMgr.hasToken);
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.init, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/6f/0020dd3c560d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/6f/0020dd3c560d00131719b896d543f08c
deleted file mode 100644
index 3d9493d..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/6f/0020dd3c560d00131719b896d543f08c
+++ /dev/null
@@ -1,47 +0,0 @@
-package com.macaroon.piztor;
-
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-
-public class Main extends PiztorAct {
-
- ActMgr actMgr;
-
- Handler handler = new Handler() {
- @Override
- public void handleMessage(Message m) {
- Location l = (Location) m.obj;
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- };
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.setStatus(handler);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/7/102ad2cb800d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/7/102ad2cb800d00131719b896d543f08c
deleted file mode 100644
index 62f8ddf..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/7/102ad2cb800d00131719b896d543f08c
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.Vector;
-
-public class Infomation {
- static String ip = "69.85.86.42";
- static int port = 9990;
- static int token = -1;
- static int myId = -1;
-
- static class UserInfo {
- int id;
- double lat, lot;
- }
-
- static class Group {
- int id;
- Vector<UserInfo> v;
- }
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/7/10a4d736550d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/7/10a4d736550d00131719b896d543f08c
deleted file mode 100644
index 7f1f47e..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/7/10a4d736550d00131719b896d543f08c
+++ /dev/null
@@ -1,241 +0,0 @@
-package com.macaroon.piztor;
-
-import android.app.AlertDialog;
-import android.app.Service;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.location.Location;
-import android.location.LocationListener;
-import android.location.LocationManager;
-import android.location.GpsStatus;
-import android.os.Bundle;
-import android.os.IBinder;
-import android.os.SystemClock;
-import android.provider.Settings;
-import android.util.Log;
-
-public class GPSTracker extends Service implements LocationListener, GpsStatus.Listener {
-
- private final Context mContext;
-
- // flag for GPS status
- boolean isGPSEnabled = false;
-
- // flag for network status
- boolean isNetworkEnabled = false;
-
- // flag for GPS status
- boolean canGetLocation = false;
-
- Location location; // location
- double latitude; // latitude
- double longitude; // longitude
-
- // The minimum distance to change Updates in meters
- private static final long MIN_DISTANCE_CHANGE_FOR_UPDATES = 10; // 10 meters
-
- // The minimum time between updates in milliseconds
- private static final long MIN_TIME_BW_UPDATES = 1000 * 3; // 10 seconds
-
- // Declaring a Location Manager
- protected LocationManager locationManager;
-
- // for GPS satellite status listener
- Location mLastLocation;
- long mLastLocationMillis;
- boolean isGPSFix;
-
-
- public GPSTracker(Context context) {
- this.mContext = context;
- isGPSFix = false;
- getLocation();
- }
-
- public Location getLocation() {
- try {
-
- Log.d("getLocation", "Start getting location......");
-
- locationManager = (LocationManager) mContext
- .getSystemService(LOCATION_SERVICE);
-
- // getting GPS status
- isGPSEnabled = locationManager
- .isProviderEnabled(LocationManager.GPS_PROVIDER);
-
- // getting network status
- isNetworkEnabled = locationManager
- .isProviderEnabled(LocationManager.NETWORK_PROVIDER);
-
- if (!isGPSEnabled) {
- // no network provider is enabled
- } else {
- this.canGetLocation = true;
- if (isNetworkEnabled) {
- locationManager.requestLocationUpdates(
- LocationManager.NETWORK_PROVIDER,
- MIN_TIME_BW_UPDATES,
- MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
-
- Log.d("Network", "Network Updated");
-
- if (locationManager != null) {
- location = locationManager
- .getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
- if (location != null) {
- latitude = location.getLatitude();
- longitude = location.getLongitude();
-
- Log.d("Network", "Received Network Data");
- System.out.println("***From Network: "+latitude + " " + longitude);
- }
- }
- }// end of network section
- // if GPS Enabled get lat/long using GPS Services
- if (isGPSEnabled) {
- if (true) {
- locationManager.requestLocationUpdates(
- LocationManager.GPS_PROVIDER,
- MIN_TIME_BW_UPDATES,
- MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
- Log.d("GPS", "GPS Updated");
- if (locationManager != null) {
- location = locationManager
- .getLastKnownLocation(LocationManager.GPS_PROVIDER);
- if (location != null) {
- latitude = location.getLatitude();
- longitude = location.getLongitude();
-
- Log.d("GPS", "Received GPS Data");
- System.out.println("***From GPS: "+latitude + " " + longitude);
-
- }
- }
- }
- }// end of GPS section
- }// end of fetching data
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Stop using GPS listener Calling this function will stop using GPS in your
- * app
- * */
- public void stopUsingGPS() {
- if (locationManager != null) {
- locationManager.removeUpdates(GPSTracker.this);
- }
- }
-
- /**
- * Function to get latitude
- * */
- public double getLatitude() {
- if (location != null) {
- latitude = location.getLatitude();
- }
- return latitude;
- }
-
- /**
- * Function to get longitude
- * */
- public double getLongitude() {
- if (location != null) {
- longitude = location.getLongitude();
- }
- return longitude;
- }
-
- /**
- * Function to check GPS/wifi enabled
- *
- * @return boolean
- * */
- public boolean canGetLocation() {
- return this.canGetLocation;
- }
-
- public boolean isGPSFix() {
- return (this.isGPSFix && location != null);
- }
-
- /**
- * Function to show settings alert dialog On pressing Settings button will
- * lauch Settings Options
- * */
- public void showSettingsAlert() {
- AlertDialog.Builder alertDialog = new AlertDialog.Builder(mContext);
-
- // Setting Dialog Title
- alertDialog.setTitle("GPS is settings");
-
- // Setting Dialog Message
- alertDialog
- .setMessage("GPS is not enabled. Do you want to go to settings menu?");
-
- // On pressing Settings button
- alertDialog.setPositiveButton("Settings",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- Intent intent = new Intent(
- Settings.ACTION_LOCATION_SOURCE_SETTINGS);
- mContext.startActivity(intent);
- }
- });
-
- // on pressing cancel button
- alertDialog.setNegativeButton("Cancel",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- dialog.cancel();
- }
- });
-
- // Showing Alert Message
- alertDialog.show();
- }
-
- @Override
- public void onLocationChanged(Location location) {
- if (location == null) return;
- mLastLocationMillis = SystemClock.elapsedRealtime();
- mLastLocation = location;
- }
-
- @Override
- public void onProviderDisabled(String provider) {
- }
-
- @Override
- public void onProviderEnabled(String provider) {
- }
-
- @Override
- public void onStatusChanged(String provider, int status, Bundle extras) {
- }
-
- @Override
- public IBinder onBind(Intent arg0) {
- return null;
- }
-
- @Override
- public void onGpsStatusChanged(int event) {
- switch (event) {
- case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
- if(mLastLocation != null)
- isGPSFix = (SystemClock.elapsedRealtime() - mLastLocationMillis) < 3000;
- break;
-
- case GpsStatus.GPS_EVENT_FIRST_FIX:
- isGPSFix = true;
- break;
- }
- }
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/7/806200684f0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/7/806200684f0d00131719b896d543f08c
deleted file mode 100644
index 51b8a69..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/7/806200684f0d00131719b896d543f08c
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.macaroon.piztor"
- android:versionCode="1"
- android:versionName="1.0" >
-
- <uses-sdk
- android:minSdkVersion="8"
- android:targetSdkVersion="17" />
-
- <application
- android:allowBackup="true"
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name"
- android:theme="@android:style/Theme.NoTitleBar" >
- <activity
- android:name="com.macaroon.piztor.InitAct"
- android:label="@string/app_name" >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
-
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- <activity
- android:name="com.macaroon.piztor.Login"
- android:label="@string/activity_login" >
- </activity>
- <activity
- android:name="com.macaroon.piztor.Main"
- android:label="@string/activity_main" >
- </activity>
- <activity
- android:name="com.macaroon.piztor.Setting"
- android:label="@string/activity_settings" >
- </activity>
- </application>
-
- <uses-permission android:name="android.permission.INTERNET" />
- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
-
-</manifest>
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/7/b00ff61a380d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/7/b00ff61a380d00131249f322b63acde8
deleted file mode 100644
index 15022f6..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/7/b00ff61a380d00131249f322b63acde8
+++ /dev/null
@@ -1,97 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
-
-
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- int loginButtonClick = 1, retryButtonClick = 2, loginFailed = 3;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- } else if (m.what == 101) {
- actMgr.trigger(loginFailed);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
- }
-
- class LoginStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- String user = edtUser.getText().toString();
- String pass = edtPass.getText().toString();
- long nowtime = System.currentTimeMillis();
- AppMgr.transam.send(new ReqLogin(user, pass, nowtime, 1000));
- }
-
- @Override
- void leave(int e) {
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- ActStatus[] r = new ActStatus[2];
- r[0] = new StartStatus();
- r[1] = new LoginStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- //AppMgr.transam.send(new ReqLogin(u, p, time, alive))
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/7/f0c8a1b1330d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/7/f0c8a1b1330d00131249f322b63acde8
deleted file mode 100644
index 6c8a359..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/7/f0c8a1b1330d00131249f322b63acde8
+++ /dev/null
@@ -1,58 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- Handler hand = new Handler() {
- @Override
- boolean sendMessage(Message m) {
-
- }
- };
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/7/f0e31801750d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/7/f0e31801750d00131719b896d543f08c
deleted file mode 100644
index e67e5cf..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/7/f0e31801750d00131719b896d543f08c
+++ /dev/null
@@ -1,160 +0,0 @@
-package com.macaroon.piztor;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- @SuppressLint("HandlerLeak")
- Handler fromGPS = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- Handler fromTransam = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what > 100) {
-
- }
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "Search Button Press";
- case FetchButtonPress:
- return "Fetch Button Press";
- case FocuseButtonPress:
- return "Focuse Button Press";
- case SuccessFetch:
- return "Success Fetch";
- case FailedFetch:
- return "Failed Fetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter Fetch status!!!!");
- if (e == FetchButtonPress) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1,
- System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave fetch status!!!! because" + cause(e));
-
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter focus status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave focus status!!!! because" + cause(e));
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(fromGPS);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
- btnFetch.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(FetchButtonPress);
- }
- });
- btnFocus.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- actMgr.trigger(FocuseButtonPress);
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/70/501f63f7750d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/70/501f63f7750d00131719b896d543f08c
deleted file mode 100644
index 3d2621d..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/70/501f63f7750d00131719b896d543f08c
+++ /dev/null
@@ -1,168 +0,0 @@
-package com.macaroon.piztor;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- @SuppressLint("HandlerLeak")
- Handler fromGPS = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- Handler fromTransam = new Handler() {
- @Override
- public void handleMessage(Message m) {
- switch (m.what) {
- case value:
-
- break;
-
- default:
- break;
- }
-
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "Search Button Press";
- case FetchButtonPress:
- return "Fetch Button Press";
- case FocuseButtonPress:
- return "Focuse Button Press";
- case SuccessFetch:
- return "Success Fetch";
- case FailedFetch:
- return "Failed Fetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- if (e == SuccessFetch) {
-
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter Fetch status!!!!");
- if (e == FetchButtonPress) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1,
- System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave fetch status!!!! because" + cause(e));
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter focus status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave focus status!!!! because" + cause(e));
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(fromGPS);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
- btnFetch.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(FetchButtonPress);
- }
- });
- btnFocus.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- actMgr.trigger(FocuseButtonPress);
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/70/803f3d632b0d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/70/803f3d632b0d00131249f322b63acde8
deleted file mode 100644
index 294cae3..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/70/803f3d632b0d00131249f322b63acde8
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.macaroon.piztor;
-
-//--------------------------------------//
-// authentication //
-//--------------------------------------//
-
-public class ReqLogin extends Req{
- String user; //username
- String pass; //password
-
- ReqLogin(String u,String p,long time,long alive){
- super(0,0,time,alive); //for type 0
- user = u;
- pass = p;
- }
-} \ No newline at end of file
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/70/c00737b35b0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/70/c00737b35b0d00131719b896d543f08c
deleted file mode 100644
index 4556ca2..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/70/c00737b35b0d00131719b896d543f08c
+++ /dev/null
@@ -1,53 +0,0 @@
-package com.macaroon.piztor;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-
-public class Main extends PiztorAct {
-
- ActMgr actMgr;
-
- @SuppressLint("HandlerLeak")
- Handler handler = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- if (l == null)
- System.out.println("fuck!!!");
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(handler);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/70/e041e862500d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/70/e041e862500d00131719b896d543f08c
deleted file mode 100644
index 7b27646..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/70/e041e862500d00131719b896d543f08c
+++ /dev/null
@@ -1,92 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="fill_parent"
- android:background="@android:color/black"
- android:orientation="vertical">
-
-<LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:background="@android:color/black"
- android:gravity="center_horizontal"
- android:orientation="vertical" >
-
- <ImageView
- android:id="@+id/main_headbar_img"
- android:layout_width="180dp"
- android:layout_height="240dp"
- android:layout_gravity="center_horizontal"
- android:src="@drawable/title_logo" />
-
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:layout_gravity="center">
-
- <TableLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <TableRow
- android:layout_marginBottom="15dp"
- android:layout_marginTop="15dp">
- <TextView
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="0.25"
- android:gravity="right"
- android:id="@+id/user_id_text"
- android:text="User ID"
- android:textColor="@android:color/white"
- />
-
- <EditText
- android:layout_width="0dp"
- android:layout_weight="0.75"
- android:id="@+id/user_id"
- android:textColor="@android:color/white"
- android:singleLine="true"/>
- <requestFocus/>
- </TableRow>
-
- <TableRow>
- <TextView
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="0.25"
- android:gravity="right"
- android:id="@+id/user_pass_text"
- android:text="Password"
- android:textColor="@android:color/white"
- />
-
- <EditText
- android:layout_width="0dp"
- android:layout_weight="0.75"
- android:id="@+id/user_pass"
- android:password="true"
- android:textColor="@android:color/white"
- android:singleLine="true"/>
- </TableRow>
- </TableLayout>
- </LinearLayout>
-
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:orientation="vertical"
- >
- <Button
- android:id="@+id/login_btn_login"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:text="Login"
- android:textColor="@android:color/white" />
- </LinearLayout>
-
-</LinearLayout>
-</RelativeLayout>
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/71/3084ff9b220d00131a9bb9bc5a5e6171 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/71/3084ff9b220d00131a9bb9bc5a5e6171
deleted file mode 100644
index 548ca95..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/71/3084ff9b220d00131a9bb9bc5a5e6171
+++ /dev/null
@@ -1,3 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.compliance=1.6
-org.eclipse.jdt.core.compiler.source=1.6
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/71/b0d73212550d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/71/b0d73212550d00131719b896d543f08c
deleted file mode 100644
index 8f887e6..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/71/b0d73212550d00131719b896d543f08c
+++ /dev/null
@@ -1,67 +0,0 @@
-package com.macaroon.piztor;
-
-import android.content.Context;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import android.content.Context;
-import android.os.Handler;
-import android.os.Message;
-import android.util.Log;
-import android.os.SystemClock;
-
-
-public class Tracker implements Runnable {
-
- private static final long TIME_DELTA = 1000 * 3; // 3 second
- public Timer timer;
- private final Context mContext;
- GPSTracker myTracker;
- Handler mHandler;
- Message message;
-
- public Tracker(Context context, Handler yHandler) {
- timer = new Timer();
- mContext = context;
- myTracker = new GPSTracker(mContext);
- mHandler = yHandler;
- }
-
- void setHandler(Handler hand) {
- mHandler = hand;
- }
-
-
- public void run() {
- GPSTask myTask = new GPSTask();
- timer.schedule(myTask, 0, TIME_DELTA);
- }
-
- class GPSTask extends TimerTask {
- @Override
- public void run() {
- message = new Message();
- message.what = 0;
- myTracker.getLocation();
- Log.d("Location", "Fetching location.....");
- if (myTracker.canGetLocation()) {
- double latitude = myTracker.getLatitude();
- double longitude = myTracker.getLongitude();
-
- Log.d("TTTTTTTTTTTTTTTTTTTTTTTime","TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTime");
- System.out.println("GPSTIME" + myTracker.location.getTime());
- System.out.println("SYSTIME" + SystemClock.elapsedRealtime());
-
- if(myTracker.isGPSFix()) {
- message.what = 1;
- } else {
- message.what = 2;
- }
- mHandler.sendMessage(message);
- } else {
- message.what = 0;
- mHandler.sendMessage(message);
- }
- }
- }
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/72/40aa3d7d680d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/72/40aa3d7d680d00131719b896d543f08c
deleted file mode 100644
index 7d0869e..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/72/40aa3d7d680d00131719b896d543f08c
+++ /dev/null
@@ -1,109 +0,0 @@
-package com.macaroon.piztor;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
-
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- @SuppressLint("HandlerLeak")
- Handler handler = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- if (l == null)
- System.out.println("fuck!!!");
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- void leave(int e) {
- // TODO Auto-generated method stub
-
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- void leave(int e) {
- // TODO Auto-generated method stub
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(handler);
- ActStatus[] r = new ActStatus[2];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[1]);
-
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/72/7046908d340d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/72/7046908d340d00131249f322b63acde8
deleted file mode 100644
index bce14da..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/72/7046908d340d00131249f322b63acde8
+++ /dev/null
@@ -1,61 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
-
- }
- }
- };
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/72/b0a7a169550d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/72/b0a7a169550d00131719b896d543f08c
deleted file mode 100644
index d20c14a..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/72/b0a7a169550d00131719b896d543f08c
+++ /dev/null
@@ -1,240 +0,0 @@
-package com.macaroon.piztor;
-
-import android.app.AlertDialog;
-import android.app.Service;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.location.Location;
-import android.location.LocationListener;
-import android.location.LocationManager;
-import android.location.GpsStatus;
-import android.os.Bundle;
-import android.os.IBinder;
-import android.os.SystemClock;
-import android.provider.Settings;
-import android.util.Log;
-
-public class GPSTracker extends Service implements LocationListener, GpsStatus.Listener {
-
- private final Context mContext;
-
- // flag for GPS status
- boolean isGPSEnabled = false;
-
- // flag for network status
- boolean isNetworkEnabled = false;
-
- // flag for GPS status
- boolean canGetLocation = false;
-
- Location location; // location
- double latitude; // latitude
- double longitude; // longitude
-
- // The minimum distance to change Updates in meters
- private static final long MIN_DISTANCE_CHANGE_FOR_UPDATES = 10; // 10 meters
-
- // The minimum time between updates in milliseconds
- private static final long MIN_TIME_BW_UPDATES = 1000 * 3; // 10 seconds
-
- // Declaring a Location Manager
- protected LocationManager locationManager;
-
- // for GPS satellite status listener
- Location mLastLocation;
- long mLastLocationMillis;
- boolean isGPSFix;
-
-
- public GPSTracker(Context context) {
- this.mContext = context;
- isGPSFix = false;
- getLocation();
- }
-
- public Location getLocation() {
- try {
- Log.d("getLocation", "Start getting location......");
-
- locationManager = (LocationManager) mContext
- .getSystemService(LOCATION_SERVICE);
-
- // getting GPS status
- isGPSEnabled = locationManager
- .isProviderEnabled(LocationManager.GPS_PROVIDER);
-
- // getting network status
- isNetworkEnabled = locationManager
- .isProviderEnabled(LocationManager.NETWORK_PROVIDER);
-
- if (!isGPSEnabled) {
- // no network provider is enabled
- } else {
- this.canGetLocation = true;
- if (isNetworkEnabled) {
- locationManager.requestLocationUpdates(
- LocationManager.NETWORK_PROVIDER,
- MIN_TIME_BW_UPDATES,
- MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
-
- Log.d("Network", "Network Updated");
-
- if (locationManager != null) {
- location = locationManager
- .getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
- if (location != null) {
- latitude = location.getLatitude();
- longitude = location.getLongitude();
-
- Log.d("Network", "Received Network Data");
- System.out.println("***From Network: "+latitude + " " + longitude);
- }
- }
- }// end of network section
- // if GPS Enabled get lat/long using GPS Services
- if (isGPSEnabled) {
- if (true) {
- locationManager.requestLocationUpdates(
- LocationManager.GPS_PROVIDER,
- MIN_TIME_BW_UPDATES,
- MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
- Log.d("GPS", "GPS Updated");
- if (locationManager != null) {
- location = locationManager
- .getLastKnownLocation(LocationManager.GPS_PROVIDER);
- if (location != null) {
- latitude = location.getLatitude();
- longitude = location.getLongitude();
-
- Log.d("GPS", "Received GPS Data");
- System.out.println("***From GPS: "+latitude + " " + longitude);
-
- }
- }
- }
- }// end of GPS section
- }// end of fetching data
- return location;
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Stop using GPS listener Calling this function will stop using GPS in your
- * app
- * */
- public void stopUsingGPS() {
- if (locationManager != null) {
- locationManager.removeUpdates(GPSTracker.this);
- }
- }
-
- /**
- * Function to get latitude
- * */
- public double getLatitude() {
- if (location != null) {
- latitude = location.getLatitude();
- }
- return latitude;
- }
-
- /**
- * Function to get longitude
- * */
- public double getLongitude() {
- if (location != null) {
- longitude = location.getLongitude();
- }
- return longitude;
- }
-
- /**
- * Function to check GPS/wifi enabled
- *
- * @return boolean
- * */
- public boolean canGetLocation() {
- return this.canGetLocation;
- }
-
- public boolean isGPSFix() {
- return (this.isGPSFix && location != null);
- }
-
- /**
- * Function to show settings alert dialog On pressing Settings button will
- * lauch Settings Options
- * */
- public void showSettingsAlert() {
- AlertDialog.Builder alertDialog = new AlertDialog.Builder(mContext);
-
- // Setting Dialog Title
- alertDialog.setTitle("GPS is settings");
-
- // Setting Dialog Message
- alertDialog
- .setMessage("GPS is not enabled. Do you want to go to settings menu?");
-
- // On pressing Settings button
- alertDialog.setPositiveButton("Settings",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- Intent intent = new Intent(
- Settings.ACTION_LOCATION_SOURCE_SETTINGS);
- mContext.startActivity(intent);
- }
- });
-
- // on pressing cancel button
- alertDialog.setNegativeButton("Cancel",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- dialog.cancel();
- }
- });
-
- // Showing Alert Message
- alertDialog.show();
- }
-
- @Override
- public void onLocationChanged(Location location) {
- if (location == null) return;
- mLastLocationMillis = SystemClock.elapsedRealtime();
- mLastLocation = location;
- }
-
- @Override
- public void onProviderDisabled(String provider) {
- }
-
- @Override
- public void onProviderEnabled(String provider) {
- }
-
- @Override
- public void onStatusChanged(String provider, int status, Bundle extras) {
- }
-
- @Override
- public IBinder onBind(Intent arg0) {
- return null;
- }
-
- @Override
- public void onGpsStatusChanged(int event) {
- switch (event) {
- case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
- if(mLastLocation != null)
- isGPSFix = (SystemClock.elapsedRealtime() - mLastLocationMillis) < 3000;
- break;
-
- case GpsStatus.GPS_EVENT_FIRST_FIX:
- isGPSFix = true;
- break;
- }
- }
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/73/006fa23d5a0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/73/006fa23d5a0d00131719b896d543f08c
deleted file mode 100644
index a931dae..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/73/006fa23d5a0d00131719b896d543f08c
+++ /dev/null
@@ -1,104 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
-
-
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- int loginButtonClick = 1, retryButtonClick = 2, loginFailed = 3;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- System.out.println(m.what);
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- } else if (m.what == 101) {
- actMgr.trigger(loginFailed);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
- }
-
- class LoginStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- String user = edtUser.getText().toString();
- String pass = edtPass.getText().toString();
- long nowtime = System.currentTimeMillis();
- System.out.println(user + " : " + pass + "\n");
- AppMgr.transam.send(new ReqLogin(user, pass, nowtime, 1000));
- }
-
- @Override
- void leave(int e) {
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- ActStatus[] r = new ActStatus[2];
- AppMgr.transam.setHandler(hand);
- r[0] = new StartStatus();
- r[1] = new LoginStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], loginButtonClick, r[1]);
- actMgr.add(r[1], loginFailed, r[0]);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(loginButtonClick);
- }
- });
- }
-
- @Override
- protected void onResume() {
- super.onResume();
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/73/c01d2030760d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/73/c01d2030760d00131719b896d543f08c
deleted file mode 100644
index 166091d..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/73/c01d2030760d00131719b896d543f08c
+++ /dev/null
@@ -1,173 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.Vector;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- @SuppressLint("HandlerLeak")
- Handler fromGPS = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- Handler fromTransam = new Handler() {
- @Override
- public void handleMessage(Message m) {
- switch (m.what) {
- case 3:
- ResLocation r = (ResLocation) m.obj;
- for (int i = 0; i < n; i++) {
- System.out.println(r.l.get(i).lat + " " + r.l.get(i).lot);
- }
- break;
-
- default:
- break;
- }
-
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "Search Button Press";
- case FetchButtonPress:
- return "Fetch Button Press";
- case FocuseButtonPress:
- return "Focuse Button Press";
- case SuccessFetch:
- return "Success Fetch";
- case FailedFetch:
- return "Failed Fetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- if (e == SuccessFetch) {
-
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter Fetch status!!!!");
- if (e == FetchButtonPress) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1,
- System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave fetch status!!!! because" + cause(e));
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter focus status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave focus status!!!! because" + cause(e));
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(fromGPS);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
- btnFetch.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(FetchButtonPress);
- }
- });
- btnFocus.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- actMgr.trigger(FocuseButtonPress);
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/73/c08e77fb780d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/73/c08e77fb780d00131719b896d543f08c
deleted file mode 100644
index e90c2ff..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/73/c08e77fb780d00131719b896d543f08c
+++ /dev/null
@@ -1,192 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.Vector;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- Timer autodate;
- @SuppressLint("HandlerLeak")
- Handler fromGPS = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- Handler fromTransam = new Handler() {
- @Override
- public void handleMessage(Message m) {
- switch (m.what) {
- case 3:
- ResLocation location = (ResLocation) m.obj;
- for (int i = 0; i < location.n; i++) {
- System.out.println(location.l.get(i).lat + " "
- + location.l.get(i).lot);
- }
- actMgr.trigger(SuccessFetch);
- break;
- case 2:
- ResUpdate update = (ResUpdate) m.obj;
- if (update.t == 0)
- System.out.println("update success");
- else
- System.out.println("update failed");
- break;
- default:
- break;
- }
-
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "Search Button Press";
- case FetchButtonPress:
- return "Fetch Button Press";
- case FocuseButtonPress:
- return "Focuse Button Press";
- case SuccessFetch:
- return "Success Fetch";
- case FailedFetch:
- return "Failed Fetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter Fetch status!!!!");
- if (e == FetchButtonPress) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1,
- System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave fetch status!!!! because" + cause(e));
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter focus status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave focus status!!!! because" + cause(e));
-
- }
-
- }
-
- class AutoUpdate extends TimerTask {
-
- @Override
- public void run() {
- actMgr.trigger(Main.TimerFlush);
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(fromGPS);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- actMgr.add(r[2], TimerFlush, r[2]);
- autodate = new Timer();
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
- btnFetch.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(FetchButtonPress);
- }
- });
- btnFocus.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- actMgr.trigger(FocuseButtonPress);
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/74/40c025d4770d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/74/40c025d4770d00131719b896d543f08c
deleted file mode 100644
index 75db4de..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/74/40c025d4770d00131719b896d543f08c
+++ /dev/null
@@ -1,182 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.Timer;
-import java.util.Vector;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- Timer autodate;
- @SuppressLint("HandlerLeak")
- Handler fromGPS = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- Handler fromTransam = new Handler() {
- @Override
- public void handleMessage(Message m) {
- switch (m.what) {
- case 3:
- ResLocation location = (ResLocation) m.obj;
- for (int i = 0; i < location.n; i++) {
- System.out.println(location.l.get(i).lat + " "
- + location.l.get(i).lot);
- }
- actMgr.trigger(SuccessFetch);
- break;
- case 2:
- ResUpdate update = (ResUpdate) m.obj;
- if (update.t == 0)
- System.out.println("update success");
- else
- System.out.println("update failed");
- break;
- default:
- break;
- }
-
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "Search Button Press";
- case FetchButtonPress:
- return "Fetch Button Press";
- case FocuseButtonPress:
- return "Focuse Button Press";
- case SuccessFetch:
- return "Success Fetch";
- case FailedFetch:
- return "Failed Fetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter Fetch status!!!!");
- if (e == FetchButtonPress) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1,
- System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave fetch status!!!! because" + cause(e));
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter focus status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave focus status!!!! because" + cause(e));
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(fromGPS);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- autodate = new Timer();
-
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
- btnFetch.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(FetchButtonPress);
- }
- });
- btnFocus.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- actMgr.trigger(FocuseButtonPress);
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/74/80e6f54e800d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/74/80e6f54e800d00131719b896d543f08c
deleted file mode 100644
index ebce59c..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/74/80e6f54e800d00131719b896d543f08c
+++ /dev/null
@@ -1,106 +0,0 @@
-package com.macaroon.piztor;
-
-import android.annotation.SuppressLint;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
-
-
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- int loginButtonClick = 1, retryButtonClick = 2, loginFailed = 3;
-
- @SuppressLint("HandlerLeak")
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- System.out.println(m.what);
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- } else if (m.what == 101) {
- actMgr.trigger(loginFailed);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
- }
-
- class LoginStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- String user = edtUser.getText().toString();
- String pass = edtPass.getText().toString();
- long nowtime = System.currentTimeMillis();
- System.out.println(user + " : " + pass + "\n");
- AppMgr.transam.send(new ReqLogin(user, pass, nowtime, 1000));
- }
-
- @Override
- void leave(int e) {
- //TODO log out failed!
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- ActStatus[] r = new ActStatus[2];
- AppMgr.transam.setHandler(hand);
- r[0] = new StartStatus();
- r[1] = new LoginStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], loginButtonClick, r[1]);
- actMgr.add(r[1], loginFailed, r[0]);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(loginButtonClick);
- }
- });
- }
-
- @Override
- protected void onResume() {
- super.onResume();
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/74/901b4f2c550d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/74/901b4f2c550d00131719b896d543f08c
deleted file mode 100644
index 178f6b6..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/74/901b4f2c550d00131719b896d543f08c
+++ /dev/null
@@ -1,241 +0,0 @@
-package com.macaroon.piztor;
-
-import android.app.AlertDialog;
-import android.app.Service;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.location.Location;
-import android.location.LocationListener;
-import android.location.LocationManager;
-import android.location.GpsStatus;
-import android.os.Bundle;
-import android.os.IBinder;
-import android.os.SystemClock;
-import android.provider.Settings;
-import android.util.Log;
-
-public class GPSTracker extends Service implements LocationListener, GpsStatus.Listener {
-
- private final Context mContext;
-
- // flag for GPS status
- boolean isGPSEnabled = false;
-
- // flag for network status
- boolean isNetworkEnabled = false;
-
- // flag for GPS status
- boolean canGetLocation = false;
-
- Location location; // location
- double latitude; // latitude
- double longitude; // longitude
-
- // The minimum distance to change Updates in meters
- private static final long MIN_DISTANCE_CHANGE_FOR_UPDATES = 10; // 10 meters
-
- // The minimum time between updates in milliseconds
- private static final long MIN_TIME_BW_UPDATES = 1000 * 3; // 10 seconds
-
- // Declaring a Location Manager
- protected LocationManager locationManager;
-
- // for GPS satellite status listener
- Location mLastLocation;
- long mLastLocationMillis;
- boolean isGPSFix;
-
-
- public GPSTracker(Context context) {
- this.mContext = context;
- isGPSFix = false;
- getLocation();
- }
-
- public void getLocation() {
- try {
-
- Log.d("getLocation", "Start getting location......");
-
- locationManager = (LocationManager) mContext
- .getSystemService(LOCATION_SERVICE);
-
- // getting GPS status
- isGPSEnabled = locationManager
- .isProviderEnabled(LocationManager.GPS_PROVIDER);
-
- // getting network status
- isNetworkEnabled = locationManager
- .isProviderEnabled(LocationManager.NETWORK_PROVIDER);
-
- if (!isGPSEnabled) {
- // no network provider is enabled
- } else {
- this.canGetLocation = true;
- if (isNetworkEnabled) {
- locationManager.requestLocationUpdates(
- LocationManager.NETWORK_PROVIDER,
- MIN_TIME_BW_UPDATES,
- MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
-
- Log.d("Network", "Network Updated");
-
- if (locationManager != null) {
- location = locationManager
- .getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
- if (location != null) {
- latitude = location.getLatitude();
- longitude = location.getLongitude();
-
- Log.d("Network", "Received Network Data");
- System.out.println("***From Network: "+latitude + " " + longitude);
- }
- }
- }// end of network section
- // if GPS Enabled get lat/long using GPS Services
- if (isGPSEnabled) {
- if (true) {
- locationManager.requestLocationUpdates(
- LocationManager.GPS_PROVIDER,
- MIN_TIME_BW_UPDATES,
- MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
- Log.d("GPS", "GPS Updated");
- if (locationManager != null) {
- location = locationManager
- .getLastKnownLocation(LocationManager.GPS_PROVIDER);
- if (location != null) {
- latitude = location.getLatitude();
- longitude = location.getLongitude();
-
- Log.d("GPS", "Received GPS Data");
- System.out.println("***From GPS: "+latitude + " " + longitude);
-
- }
- }
- }
- }// end of GPS section
- }// end of fetching data
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Stop using GPS listener Calling this function will stop using GPS in your
- * app
- * */
- public void stopUsingGPS() {
- if (locationManager != null) {
- locationManager.removeUpdates(GPSTracker.this);
- }
- }
-
- /**
- * Function to get latitude
- * */
- public double getLatitude() {
- if (location != null) {
- latitude = location.getLatitude();
- }
- return latitude;
- }
-
- /**
- * Function to get longitude
- * */
- public double getLongitude() {
- if (location != null) {
- longitude = location.getLongitude();
- }
- return longitude;
- }
-
- /**
- * Function to check GPS/wifi enabled
- *
- * @return boolean
- * */
- public boolean canGetLocation() {
- return this.canGetLocation;
- }
-
- public boolean isGPSFix() {
- return (this.isGPSFix && location != null);
- }
-
- /**
- * Function to show settings alert dialog On pressing Settings button will
- * lauch Settings Options
- * */
- public void showSettingsAlert() {
- AlertDialog.Builder alertDialog = new AlertDialog.Builder(mContext);
-
- // Setting Dialog Title
- alertDialog.setTitle("GPS is settings");
-
- // Setting Dialog Message
- alertDialog
- .setMessage("GPS is not enabled. Do you want to go to settings menu?");
-
- // On pressing Settings button
- alertDialog.setPositiveButton("Settings",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- Intent intent = new Intent(
- Settings.ACTION_LOCATION_SOURCE_SETTINGS);
- mContext.startActivity(intent);
- }
- });
-
- // on pressing cancel button
- alertDialog.setNegativeButton("Cancel",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- dialog.cancel();
- }
- });
-
- // Showing Alert Message
- alertDialog.show();
- }
-
- @Override
- public void onLocationChanged(Location location) {
- if (location == null) return;
- mLastLocationMillis = SystemClock.elapsedRealtime();
- mLastLocation = location;
- }
-
- @Override
- public void onProviderDisabled(String provider) {
- }
-
- @Override
- public void onProviderEnabled(String provider) {
- }
-
- @Override
- public void onStatusChanged(String provider, int status, Bundle extras) {
- }
-
- @Override
- public IBinder onBind(Intent arg0) {
- return null;
- }
-
- @Override
- public void onGpsStatusChanged(int event) {
- switch (event) {
- case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
- if(mLastLocation != null)
- isGPSFix = (SystemClock.elapsedRealtime() - mLastLocationMillis) < 3000;
- break;
-
- case GpsStatus.GPS_EVENT_FIRST_FIX:
- isGPSFix = true;
- break;
- }
- }
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/75/601f31e7390d00131524a793807f338e b/client/.metadata/.plugins/org.eclipse.core.resources/.history/75/601f31e7390d00131524a793807f338e
deleted file mode 100644
index b982501..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/75/601f31e7390d00131524a793807f338e
+++ /dev/null
@@ -1,99 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
-
-
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- int loginButtonClick = 1, retryButtonClick = 2, loginFailed = 3;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- } else if (m.what == 101) {
- actMgr.trigger(loginFailed);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
- }
-
- class LoginStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- String user = edtUser.getText().toString();
- String pass = edtPass.getText().toString();
- long nowtime = System.currentTimeMillis();
- AppMgr.transam.send(new ReqLogin(user, pass, nowtime, 1000));
- }
-
- @Override
- void leave(int e) {
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- ActStatus[] r = new ActStatus[2];
- r[0] = new StartStatus();
- r[1] = new LoginStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], loginButtonClick, r[1]);
- actMgr.add(r[1], loginFailed, r[0]);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(loginButtonClick);
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/75/b047617e310d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/75/b047617e310d00131249f322b63acde8
deleted file mode 100644
index c31924d..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/75/b047617e310d00131249f322b63acde8
+++ /dev/null
@@ -1,132 +0,0 @@
-package com.macaroon.piztor;
-
-import java.io.IOException;
-import java.net.UnknownHostException;
-import java.util.LinkedList;
-import java.util.Queue;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import android.annotation.SuppressLint;
-import android.os.Handler;
-import android.os.Message;
-
-public class Transam implements Runnable {
- public Timer timer;
- public Timer mtimer;
- public boolean running = false;
- public boolean flag = true;
- public int cnt = 4;
- Res res;
- Req req;
- public int p; //port
- public String i; //ip
- Thread thread;
- Handler core;
- Handler recall; //recall
- Queue<Req> reqtask ; //request task
-
- Transam(String ip, int port,Handler Recall) {
- p = port;
- i = ip;
- recall = Recall;
- reqtask = new LinkedList<Req>();
- }
-
- public void send(Req r){
- reqtask.offer(r);
-
- }
-
- public void run() { //start the main timer
- //TimerTask tmain = new Timertk();
- //mtimer = new Timer();
- //mtimer.schedule(tmain, 100, 100); //check the queue for every 100 msec
-
- while(true){
- if(running == false){
-
- if(!reqtask.isEmpty()){ //poll the head request
- req = reqtask.poll();
- if(req.time + req.alive < System.currentTimeMillis()){ //time out!
- Message ret = new Message();
- ret.obj = "Time out!";
- ret.what = 100;
- recall.sendMessage(ret);
- }
- else{ //run the request
- final thd t = new thd();
- flag = false;
- thread = new Thread(t);
- cnt = 4;
- running = true;
- thread.start();
- timer = new Timer();
- TimerTask task = new Timertk();
- timer.schedule(task, 2000, 2000);
- }
- }
- }
- }
- }
-
- class tmain extends TimerTask {
- public void run() {
-
- }
- };
-
- class thd implements Runnable {
- public void run() {
- try {
- SocketClient client = new SocketClient(i,p);
- client.sendMsg(req,recall);
- Message msg = new Message();
- msg.what = 1;
- handler.sendMessage(msg);
- client.closeSocket();
- } catch (UnknownHostException e) {
- e.printStackTrace();
- System.out.println("UnknownHostException");
- } catch (IOException e) {
- e.printStackTrace();
- System.out.println("IOException");
- }
-
- }
- }
-
- @SuppressLint("HandlerLeak")
- Handler handler = new Handler() {
- public void handleMessage(Message msg) {
- switch (msg.what) {
- case 1:
- flag = true;
- break;
- case 2:
- final thd t = new thd();
- thread = new Thread(t);
- thread.start();
- break;
- }
- super.handleMessage(msg);
- }
- };
-
- class Timertk extends TimerTask {
- public void run() {
- if (flag == false && cnt > 0) {
- cnt--;
- } else if (cnt == 0) {
- Message msg = new Message();
- msg.obj = "connecting failed";
- msg.what = 101;
- recall.sendMessage(msg);
- timer.cancel();
- } else if (flag == true) {
- timer.cancel();
- running = false;
- }
- }
- };
-} \ No newline at end of file
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/76/207ce70b330d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/76/207ce70b330d00131249f322b63acde8
deleted file mode 100644
index 4a180d9..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/76/207ce70b330d00131249f322b63acde8
+++ /dev/null
@@ -1,82 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-import android.os.Handler;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
- //TODO fix
- static Handler fromTransam, fromGPS;
- static Transam transam = null;
- static Thread tTransam, tGPS;
- //Event
-
- final static int noToken = 101;
-
-
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
- Intent i = new Intent();
- System.out.println(nowAct.id + " : " + event);
- if (mp.get(nowAct.getClass()) == null)
- System.out.println("first");
- else if (mp.get(nowAct.getClass()) == null)
- System.out.println("second");
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- fromTransam = new Handler();
- transam = new Transam(UserInfo.ip, UserInfo.port, fromTransam);
- fromGPS = new Handler();
- tTransam = new Thread(transam);
- tTransam.run();
- addStatus(InitAct.class);
- addStatus(Login.class);
- addTransition(InitAct.class, noToken, Login.class);
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/76/608e011f4f0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/76/608e011f4f0d00131719b896d543f08c
deleted file mode 100644
index 75c5057..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/76/608e011f4f0d00131719b896d543f08c
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.macaroon.piztor"
- android:versionCode="1"
- android:versionName="1.0" >
-
- <uses-sdk
- android:minSdkVersion="8"
- android:targetSdkVersion="17" />
-
- <application
- android:allowBackup="true"
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name"
- android:theme="@android:style/Theme.NoTitleBar" >
- <activity
- android:name="com.macaroon.piztor.InitAct"
- android:label="@string/app_name" >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
-
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- <activity
- android:name="com.macaroon.piztor.Login"
- android:label="@string/title_activity_login" >
- </activity>
- <activity
- android:name="com.macaroon.piztor.Main"
- android:label="@string/title_activity_main" >
- </activity>
- <activity
- android:name="com.macaroon.piztor.Setting"
- android:label="@string/title_activity_setting" >
- </activity>
- </application>
-
- <uses-permission android:name="android.permission.INTERNET" />
- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
-
-</manifest>
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/77/e09023cf310d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/77/e09023cf310d00131249f322b63acde8
deleted file mode 100644
index 2b4cf6c..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/77/e09023cf310d00131249f322b63acde8
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.macaroon.piztor;
-
-import android.content.Intent;
-import android.os.Bundle;
-import android.os.Handler;
-import android.view.Menu;
-
-public class InitAct extends PiztorAct {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "initAct";
- super.onCreate(savedInstanceState);
- AppMgr.init();
- AppMgr.fromTransam
- setContentView(R.layout.activity_init);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- if (UserInfo.token != -1)
- AppMgr.trigger(AppMgr.noToken);
- else {
- //TODO jump to main
- }
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- getMenuInflater().inflate(R.menu.init, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/77/f09da14b290d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/77/f09da14b290d00131249f322b63acde8
deleted file mode 100644
index 2b15092..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/77/f09da14b290d00131249f322b63acde8
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.app.Activity;
-import android.view.Menu;
-
-public class InitAct extends PiztorAct {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- id = "initAct";
- setContentView(R.layout.activity_init);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
-
- AppMgr.trigger(AppMgr.hasToken);
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.init, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/78/d014d7fc220d00131a9bb9bc5a5e6171 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/78/d014d7fc220d00131a9bb9bc5a5e6171
deleted file mode 100644
index e69de29..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/78/d014d7fc220d00131a9bb9bc5a5e6171
+++ /dev/null
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/79/2065267c2c0d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/79/2065267c2c0d00131249f322b63acde8
deleted file mode 100644
index c78bc91..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/79/2065267c2c0d00131249f322b63acde8
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.app.Activity;
-import android.view.Menu;
-
-public class InitAct extends PiztorAct {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "initAct";
- super.onCreate(savedInstanceState);
- AppMgr.init();
- setContentView(R.layout.activity_init);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- if (UserInfo.token != -1)
- AppMgr.trigger(AppMgr.noToken);
- else {
-
- }
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- getMenuInflater().inflate(R.menu.init, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/79/90c475984b0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/79/90c475984b0d00131719b896d543f08c
deleted file mode 100644
index 5be3de8..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/79/90c475984b0d00131719b896d543f08c
+++ /dev/null
@@ -1,63 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.*;
-
-import android.annotation.SuppressLint;
-
-@SuppressLint("UseSparseArrays")
-public class ActMgr {
- // event
- PiztorAct act;
- ActStatus nowStatus;
- HashMap<ActStatus, HashMap<Integer, ActStatus>> mp;
-
- ActMgr(PiztorAct act, ActStatus nowStatus, ActStatus[] r) {
- this.act = act;
- this.nowStatus = nowStatus;
- mp = new HashMap<ActStatus, HashMap<Integer, ActStatus>>();
- for (int i = 0; i < r.length; i++) {
- mp.put(r[i], new HashMap<Integer, ActStatus>());
- }
- }
-
- void trigger(int event) {
- for (Integer i : mp.get(nowStatus).keySet())
- System.out.println(i);
- if (mp.get(nowStatus).containsKey(event)) {
- nowStatus.leave(event);
- nowStatus = mp.get(nowStatus).get(event);
- nowStatus.enter(event);
- } else if (AppMgr.mp.get(act.getClass()).containsKey(event)) {
- AppMgr.trigger(event);
- }
- }
-
- void add(ActStatus a, int event, ActStatus b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, ActStatus> h = mp.get(a);
- h.put(event, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, ActStatus> h = new HashMap<Integer, ActStatus>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-}
-
-abstract class ActStatus {
- abstract void enter(int e);
-
- abstract void leave(int e);
-}
-
-class EmptyStatus extends ActStatus {
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/7a/906f6f46800d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/7a/906f6f46800d00131719b896d543f08c
deleted file mode 100644
index cc44346..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/7a/906f6f46800d00131719b896d543f08c
+++ /dev/null
@@ -1,9 +0,0 @@
-package com.macaroon.piztor;
-
-public class UserInfo {
- static String ip = "69.85.86.42";
- static int port = 9990;
- static int token = -1;
-
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/7b/5015928e500d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/7b/5015928e500d00131719b896d543f08c
deleted file mode 100644
index 75c5057..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/7b/5015928e500d00131719b896d543f08c
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.macaroon.piztor"
- android:versionCode="1"
- android:versionName="1.0" >
-
- <uses-sdk
- android:minSdkVersion="8"
- android:targetSdkVersion="17" />
-
- <application
- android:allowBackup="true"
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name"
- android:theme="@android:style/Theme.NoTitleBar" >
- <activity
- android:name="com.macaroon.piztor.InitAct"
- android:label="@string/app_name" >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
-
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- <activity
- android:name="com.macaroon.piztor.Login"
- android:label="@string/title_activity_login" >
- </activity>
- <activity
- android:name="com.macaroon.piztor.Main"
- android:label="@string/title_activity_main" >
- </activity>
- <activity
- android:name="com.macaroon.piztor.Setting"
- android:label="@string/title_activity_setting" >
- </activity>
- </application>
-
- <uses-permission android:name="android.permission.INTERNET" />
- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
-
-</manifest>
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/7b/b0d770546b0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/7b/b0d770546b0d00131719b896d543f08c
deleted file mode 100644
index e888998..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/7b/b0d770546b0d00131719b896d543f08c
+++ /dev/null
@@ -1,151 +0,0 @@
-package com.macaroon.piztor;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- @SuppressLint("HandlerLeak")
- Handler handler = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- if (l == null)
- System.out.println("fuck!!!");
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "Search Button Press";
- case FetchButtonPress:
- return "Fetch Button Press";
- case FocuseButtonPress:
- return "Focuse Button Press";
- case SuccessFetch:
- return "Success Fetch";
- case FailedFetch:
- return "Failed Fetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter Fetch status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave fetch status!!!! because" + cause(e));
-
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter focus status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave focus status!!!! because" + cause(e));
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(handler);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
- btnFetch.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(FetchButtonPress);
- }
- });
- btnFocus.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- actMgr.trigger(FocuseButtonPress);
- }
- });
-
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/7c/f0024b04260d00131a9bb9bc5a5e6171 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/7c/f0024b04260d00131a9bb9bc5a5e6171
deleted file mode 100644
index 09e1dbc..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/7c/f0024b04260d00131a9bb9bc5a5e6171
+++ /dev/null
@@ -1,71 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
-
- //Event
-
- public enum Event {
- hasToken
- }
-
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
-
- Intent i = new Intent();
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- addStatus(InitAct.class);
- addStatus(Login.class);
-
-
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/7c/f0272c32560d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/7c/f0272c32560d00131719b896d543f08c
deleted file mode 100644
index 7a124ca..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/7c/f0272c32560d00131719b896d543f08c
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.macaroon.piztor;
-
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-
-public class Main extends PiztorAct {
-
- ActMgr actMgr;
-
- Handler handler = new Handler() {
- @Override
- public void handleMessage(Message m) {
- Location l = (Location) m.obj;
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- };
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/7d/10fd3cab810d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/7d/10fd3cab810d00131719b896d543f08c
deleted file mode 100644
index dad95a8..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/7d/10fd3cab810d00131719b896d543f08c
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-import java.util.Vector;
-
-public class Infomation {
- static String ip = "69.85.86.42";
- static int port = 9990;
- static int token = -1;
- static int myId = -1;
-
- class UserInfo {
- int id;
- double lat, lot;
- }
-
- class Group {
- int id;
- Vector<UserInfo> v;
- }
-
- static HashMap<Integer, Group> mp;
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/7d/e021b37a330d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/7d/e021b37a330d00131249f322b63acde8
deleted file mode 100644
index 4aa65b2..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/7d/e021b37a330d00131249f322b63acde8
+++ /dev/null
@@ -1,54 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- Handler hand = new Handler() {
-
- };
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/7e/00390e21280d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/7e/00390e21280d00131249f322b63acde8
deleted file mode 100644
index 422fa96..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/7e/00390e21280d00131249f322b63acde8
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.app.Activity;
-import android.view.Menu;
-
-public class InitAct extends PiztorAct {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- id = "initAct";
- setContentView(R.layout.activity_init);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- AppMgr.trigger(AppMgr.hasToken);
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.init, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/7e/a0c4a019530d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/7e/a0c4a019530d00131719b896d543f08c
deleted file mode 100644
index 52bb70a..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/7e/a0c4a019530d00131719b896d543f08c
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.app.Activity;
-import android.view.Menu;
-
-public class Main extends PiztorAct {
-
- Handler handler = new Handler() {
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/7f/5045a039260d00131a9bb9bc5a5e6171 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/7f/5045a039260d00131a9bb9bc5a5e6171
deleted file mode 100644
index b40257e..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/7f/5045a039260d00131a9bb9bc5a5e6171
+++ /dev/null
@@ -1,71 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
-
- //Event
-
- public enum Event {
- hasToken
- }
-
-
- static HashMap<Class<?>, HashMap<Event, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(Event event) {
-
- Intent i = new Intent();
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Event event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Event, Class<?>> h = new HashMap<Event, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, Event i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Event, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Event, Class<?>> h = new HashMap<Event, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Event, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Event, Class<?>>>();
- addStatus(InitAct.class);
- addStatus(Login.class);
- addTransition(InitAct.class, hasToken, Login.class);
-
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/8/208ac81c560d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/8/208ac81c560d00131719b896d543f08c
deleted file mode 100644
index 8af3bb7..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/8/208ac81c560d00131719b896d543f08c
+++ /dev/null
@@ -1,45 +0,0 @@
-package com.macaroon.piztor;
-
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-
-public class Main extends PiztorAct {
-
- ActMgr actMgr;
-
- Handler handler = new Handler() {
- @Override
- public void handleMessage(Message m) {
- Location l = (Location) m.obj;
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(), l.getLongitude(), time, alive)
- AppMgr.transam.send();
- }
- };
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/8/40515524760d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/8/40515524760d00131719b896d543f08c
deleted file mode 100644
index 9464802..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/8/40515524760d00131719b896d543f08c
+++ /dev/null
@@ -1,173 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.Vector;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- @SuppressLint("HandlerLeak")
- Handler fromGPS = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- Handler fromTransam = new Handler() {
- @Override
- public void handleMessage(Message m) {
- switch (m.what) {
- case 3:
- Vector<Rlocation> l =(Vector<Rlocation>) m.obj;
- for (int i = 0; i < n; i++) {
- System.out.println(l.get(i).lat + " " + l.get(i).lot);
- }
- break;
-
- default:
- break;
- }
-
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "Search Button Press";
- case FetchButtonPress:
- return "Fetch Button Press";
- case FocuseButtonPress:
- return "Focuse Button Press";
- case SuccessFetch:
- return "Success Fetch";
- case FailedFetch:
- return "Failed Fetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- if (e == SuccessFetch) {
-
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter Fetch status!!!!");
- if (e == FetchButtonPress) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1,
- System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave fetch status!!!! because" + cause(e));
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter focus status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave focus status!!!! because" + cause(e));
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(fromGPS);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
- btnFetch.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(FetchButtonPress);
- }
- });
- btnFocus.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- actMgr.trigger(FocuseButtonPress);
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/8/c064fb4e800d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/8/c064fb4e800d00131719b896d543f08c
deleted file mode 100644
index 929c0bb..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/8/c064fb4e800d00131719b896d543f08c
+++ /dev/null
@@ -1,8 +0,0 @@
-package com.macaroon.piztor;
-
-public class UserInfo {
- static String ip = "69.85.86.42";
- static int port = 9990;
- static int token = -1;
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/80/706d105f250d00131a9bb9bc5a5e6171 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/80/706d105f250d00131a9bb9bc5a5e6171
deleted file mode 100644
index 629f1c1..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/80/706d105f250d00131a9bb9bc5a5e6171
+++ /dev/null
@@ -1,90 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="fill_parent"
- android:background="@android:color/black"
- android:orientation="vertical">
-
-<LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:background="@android:color/black"
- android:gravity="center_horizontal"
- android:orientation="vertical" >
-
- <ImageView
- android:id="@+id/main_headbar_img"
- android:layout_width="180dp"
- android:layout_height="240dp"
- android:layout_gravity="center_horizontal"
- android:src="@drawable/title_logo" />
-
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:layout_gravity="center">
-
- <TableLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <TableRow
- android:layout_marginBottom="15dp"
- android:layout_marginTop="15dp">
- <TextView
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="0.25"
- android:gravity="right"
- android:id="@+id/user_id_text"
- android:text="User ID"
- android:textColor="@android:color/white"
- />
-
- <EditText
- android:layout_width="0dp"
- android:layout_weight="0.75"
- android:id="@+id/user_id"
- android:singleLine="true">
- <requestFocus/>
- </TableRow>
-
- <TableRow>
- <TextView
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="0.25"
- android:gravity="right"
- android:id="@+id/user_pass_text"
- android:text="Password"
- android:textColor="@android:color/white"
- />
-
- <EditText
- android:layout_width="0dp"
- android:layout_weight="0.75"
- android:id="@+id/user_pass"
- android:password="true"
- android:singleLine="true"/>
- </TableRow>
- </TableLayout>
- </LinearLayout>
-
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:orientation="vertical"
- >
- <Button
- android:id="@+id/login_btn_login"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:text="Login"
- android:textColor="@android:color/white" />
- </LinearLayout>
-
-</LinearLayout>
-</RelativeLayout>
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/80/9080b2de4d0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/80/9080b2de4d0d00131719b896d543f08c
deleted file mode 100644
index 69760c0..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/80/9080b2de4d0d00131719b896d543f08c
+++ /dev/null
@@ -1,107 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="48dip"
- android:orientation="horizontal"
- android:background="@drawable/footbar_background" >
-
- <LinearLayout
- android:id="@+id/footbar_btn_search_layout"
- android:layout_width="64dip"
- android:layout_height="match_parent"
- android:orientation="vertical"
- android:layout_marginTop="3dip"
- android:layout_gravity="center_vertical"
- android:layout_weight="1">
- <ImageButton
- android:id="@+id/footbar_btn_search"
- android:layout_width="30dip"
- android:layout_height="30dip"
- android:layout_gravity="center"
- android:background="@drawable/footbar_btn_search_style"/>
- <TextView
- android:id="@+id/footbar_btn_search"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:gravity="center_horizontal"
- android:textSize="10dip"
- android:textColor="@android:color/white"
- android:layout_gravity="center"
- android:text="@string/search"/>
- </LinearLayout>
-
- <LinearLayout
- android:id="@+id/footbar_btn_fetch_layout"
- android:layout_width="64dip"
- android:layout_height="match_parent"
- android:orientation="vertical"
- android:layout_marginTop="3dip"
- android:layout_gravity="center_vertical"
- android:layout_weight="1">
- <ImageButton
- android:id="@+id/footbar_btn_fetch"
- android:layout_width="30dip"
- android:layout_height="30dip"
- android:layout_gravity="center"
- android:background="@drawable/footbar_btn_fetch_style"/>
- <TextView
- android:id="@+id/footbar_btn_fetch_text"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:gravity="center_horizontal"
- android:textSize="10dip"
- android:textColor="@android:color/white"
- android:layout_gravity="center"
- android:text="@string/fetch"/>
- </LinearLayout>
-
- <LinearLayout
- android:id="@+id/footbar_btn_focus_layout"
- android:layout_width="64dip"
- android:layout_height="match_parent"
- android:orientation="vertical"
- android:layout_marginTop="3dip"
- android:layout_gravity="center_vertical"
- android:layout_weight="1">
- <ImageButton
- android:id="@+id/footbar_btn_focus"
- android:layout_width="30dip"
- android:layout_height="30dip"
- android:layout_gravity="center"
- android:background="@drawable/footbar_btn_focus_style"/>
- <TextView
- android:id="@+id/footbar_btn_focus_text"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:gravity="center_horizontal"
- android:textSize="10dip"
- android:textColor="@android:color/white"
- android:layout_gravity="center"
- android:text="@string/focus"/>
- </LinearLayout>
-
- <LinearLayout
- android:id="@+id/footbar_btn_settings_layout"
- android:layout_width="64dip"
- android:layout_height="match_parent"
- android:orientation="vertical"
- android:layout_marginTop="3dip"
- android:layout_gravity="center_vertical"
- android:layout_weight="1">
- <ImageButton
- android:id="@+id/footbar_btn_settings"
- android:layout_width="30dip"
- android:layout_height="30dip"
- android:layout_gravity="center"
- android:background="@drawable/footbar_btn_settings_style"/>
- <TextView
- android:id="@+id/footbar_btn_settings_text"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:textSize="10dip"
- android:textColor="@android:color/white"
- android:text="@string/settings"/>
- </LinearLayout>
-
-</LinearLayout>
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/81/10091b6d2b0d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/81/10091b6d2b0d00131249f322b63acde8
deleted file mode 100644
index eb90840..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/81/10091b6d2b0d00131249f322b63acde8
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.Vector;
-
-//--------------------------------------//
-// Location Info //
-//--------------------------------------//
-
-public class ResLocation extends Res{
- Vector<Rlocation> l; //vector for location info
- int n; //number of location info
-
- ResLocation(int num,Vector<Rlocation> locationvec){
- super(3,255); //for type 3
- l = locationvec;
- n = num;
- }
-} \ No newline at end of file
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/81/60af4207370d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/81/60af4207370d00131249f322b63acde8
deleted file mode 100644
index 7033236..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/81/60af4207370d00131249f322b63acde8
+++ /dev/null
@@ -1,63 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.*;
-
-import android.annotation.SuppressLint;
-
-@SuppressLint("UseSparseArrays")
-public class ActMgr {
- // event
- PiztorAct act;
- ActStatus nowStatus;
- HashMap<ActStatus, HashMap<Integer, ActStatus>> mp;
-
- ActMgr(PiztorAct act, ActStatus nowStatus, ActStatus[] r) {
- this.act = act;
- this.nowStatus = nowStatus;
- mp = new HashMap<ActStatus, HashMap<Integer, ActStatus>>();
- for (int i = 0; i < r.length; i++) {
- mp.put(r[i], new HashMap<Integer, ActStatus>());
- }
- }
-
- void trigger(int event) {
- //for (Integer i : mp.get(nowStatus).keySet())
- //System.out.println(i);
- if (mp.get(nowStatus).containsKey(event)) {
- nowStatus.leave(event);
- nowStatus = mp.get(nowStatus).get(event);
- nowStatus.enter(event);
- } else if (AppMgr.mp.get(act.getClass()).containsKey(event)) {
- AppMgr.trigger(event);
- }
- }
-
- void add(ActStatus a, int event, ActStatus b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, ActStatus> h = mp.get(a);
- h.put(event, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, ActStatus> h = new HashMap<Integer, ActStatus>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-}
-
-abstract class ActStatus {
- abstract void enter(int e);
-
- abstract void leave(int e);
-}
-
-class EmptyStatus extends ActStatus {
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/81/d0e51ef7320d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/81/d0e51ef7320d00131249f322b63acde8
deleted file mode 100644
index c2f876b..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/81/d0e51ef7320d00131249f322b63acde8
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.macaroon.piztor"
- android:versionCode="1"
- android:versionName="1.0" >
-
- <uses-sdk
- android:minSdkVersion="8"
- android:targetSdkVersion="17" />
-
- <application
- android:allowBackup="true"
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name"
- android:theme="@style/AppTheme" >
- <activity
- android:name="com.macaroon.piztor.InitAct"
- android:label="@string/app_name" >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
-
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- <activity
- android:name="com.macaroon.piztor.Login"
- android:label="@string/title_activity_login" >
- </activity>
- </application>
-
-</manifest>
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/82/70f000a8770d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/82/70f000a8770d00131719b896d543f08c
deleted file mode 100644
index 8991894..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/82/70f000a8770d00131719b896d543f08c
+++ /dev/null
@@ -1,178 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.Vector;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- @SuppressLint("HandlerLeak")
- Handler fromGPS = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- Handler fromTransam = new Handler() {
- @Override
- public void handleMessage(Message m) {
- switch (m.what) {
- case 3:
- ResLocation location = (ResLocation) m.obj;
- for (int i = 0; i < location.n; i++) {
- System.out.println(location.l.get(i).lat + " "
- + location.l.get(i).lot);
- }
- actMgr.trigger(SuccessFetch);
- break;
- case 2:
- ResUpdate update = (ResUpdate) m.obj;
- if (update.t == 0)
- System.out.println("update success");
- else
- System.out.println("update failed");
- break;
- default:
- break;
- }
-
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "Search Button Press";
- case FetchButtonPress:
- return "Fetch Button Press";
- case FocuseButtonPress:
- return "Focuse Button Press";
- case SuccessFetch:
- return "Success Fetch";
- case FailedFetch:
- return "Failed Fetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter Fetch status!!!!");
- if (e == FetchButtonPress) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1,
- System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave fetch status!!!! because" + cause(e));
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter focus status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave focus status!!!! because" + cause(e));
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(fromGPS);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
- btnFetch.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(FetchButtonPress);
- }
- });
- btnFocus.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- actMgr.trigger(FocuseButtonPress);
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/82/909cd18d310d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/82/909cd18d310d00131249f322b63acde8
deleted file mode 100644
index 9f6ec22..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/82/909cd18d310d00131249f322b63acde8
+++ /dev/null
@@ -1,133 +0,0 @@
-package com.macaroon.piztor;
-
-import java.io.IOException;
-import java.net.UnknownHostException;
-import java.util.LinkedList;
-import java.util.Queue;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import android.annotation.SuppressLint;
-import android.os.Handler;
-import android.os.Message;
-
-public class Transam implements Runnable {
- public Timer timer;
- public Timer mtimer;
- public boolean running = false;
- public boolean flag = true;
- public int cnt = 4;
- Res res;
- Req req;
- public int p; // port
- public String i; // ip
- Thread thread;
- Handler core;
- Handler recall; // recall
- Queue<Req> reqtask; // request task
-
- Transam(String ip, int port, Handler Recall) {
- p = port;
- i = ip;
- recall = Recall;
- reqtask = new LinkedList<Req>();
- }
-
- public void send(Req r) {
- reqtask.offer(r);
-
- }
-
- public void run() { // start the main timer
- // TimerTask tmain = new Timertk();
- // mtimer = new Timer();
- // mtimer.schedule(tmain, 100, 100); //check the queue for every 100
- // msec
-
- while (true) {
- if (running == false) {
-
- if (!reqtask.isEmpty()) { // poll the head request
- req = reqtask.poll();
- if (req.time + req.alive < System.currentTimeMillis()) { // time
- // out!
- Message ret = new Message();
- ret.obj = "Time out!";
- ret.what = 100;
- recall.sendMessage(ret);
- } else { // run the request
- final thd t = new thd();
- flag = false;
- thread = new Thread(t);
- cnt = 4;
- running = true;
- thread.start();
- timer = new Timer();
- TimerTask task = new Timertk();
- timer.schedule(task, 2000, 2000);
- }
- }
- }
- }
- }
-
- class tmain extends TimerTask {
- public void run() {
-
- }
- };
-
- class thd implements Runnable {
- public void run() {
- try {
- SocketClient client = new SocketClient(i, p);
- client.sendMsg(req, recall);
- Message msg = new Message();
- msg.what = 1;
- handler.sendMessage(msg);
- client.closeSocket();
- } catch (UnknownHostException e) {
- e.printStackTrace();
- System.out.println("UnknownHostException");
- } catch (IOException e) {
- e.printStackTrace();
- System.out.println("IOException");
- }
-
- }
- }
-
- @SuppressLint("HandlerLeak")
- Handler handler = new Handler() {
- public void handleMessage(Message msg) {
- switch (msg.what) {
- case 1:
- flag = true;
- break;
- case 2:
- final thd t = new thd();
- thread = new Thread(t);
- thread.start();
- break;
- }
- super.handleMessage(msg);
- }
- };
-
- class Timertk extends TimerTask {
- public void run() {
- if (flag == false && cnt > 0) {
- cnt--;
- } else if (cnt == 0) {
- Message msg = new Message();
- msg.obj = "connecting failed";
- msg.what = 101;
- recall.sendMessage(msg);
- timer.cancel();
- } else if (flag == true) {
- timer.cancel();
- running = false;
- }
- }
- };
-} \ No newline at end of file
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/84/30d53cf3280d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/84/30d53cf3280d00131249f322b63acde8
deleted file mode 100644
index 54242d5..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/84/30d53cf3280d00131249f322b63acde8
+++ /dev/null
@@ -1,69 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
-
- //Event
-
- final static int hasToken = 101;
-
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
-
- Intent i = new Intent();
- System.out.println(nowAct.id + " : " + event);
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- addStatus(InitAct.class);
- addStatus(Login.class);
- addTransition(InitAct.class, hasToken, Login.class);
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/84/700a3adf290d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/84/700a3adf290d00131249f322b63acde8
deleted file mode 100644
index 63770f2..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/84/700a3adf290d00131249f322b63acde8
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.app.Activity;
-import android.view.Menu;
-
-public class InitAct extends PiztorAct {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "initAct";
- super.onCreate(savedInstanceState);
- AppMgr.init();
- setContentView(R.layout.activity_init);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
-
- AppMgr.trigger(AppMgr.hasToken);
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.init, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/84/901e3ac8250d00131a9bb9bc5a5e6171 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/84/901e3ac8250d00131a9bb9bc5a5e6171
deleted file mode 100644
index 7b0bee0..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/84/901e3ac8250d00131a9bb9bc5a5e6171
+++ /dev/null
@@ -1,64 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
-
- Intent i = new Intent();
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- addStatus(InitAct.class);
- addStatus(Login.class);
-
-
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/84/c01bf7ee550d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/84/c01bf7ee550d00131719b896d543f08c
deleted file mode 100644
index 3019420..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/84/c01bf7ee550d00131719b896d543f08c
+++ /dev/null
@@ -1,67 +0,0 @@
-package com.macaroon.piztor;
-
-import android.content.Context;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import android.location.Location;
-import android.content.Context;
-import android.os.Handler;
-import android.os.Message;
-import android.util.Log;
-import android.os.SystemClock;
-
-
-public class Tracker implements Runnable {
-
- private static final long TIME_DELTA = 1000 * 3; // 3 second
- public Timer timer;
- private final Context mContext;
- GPSTracker myTracker;
- Handler mHandler;
- Message message;
-
- public Tracker(Context context, Handler yHandler) {
- timer = new Timer();
- mContext = context;
- myTracker = new GPSTracker(mContext);
- mHandler = yHandler;
- }
-
- void setHandler(Handler hand) {
- mHandler = hand;
- }
-
-
- public void run() {
- GPSTask myTask = new GPSTask();
- timer.schedule(myTask, 0, TIME_DELTA);
- }
-
- class GPSTask extends TimerTask {
- @Override
- public void run() {
- Location location = myTracker.getLocation();
- Log.d("Location", "Fetching location.....");
- if (myTracker.canGetLocation()) {
-
- Log.d("TTTTTTTTTTTTTTTTTTTTTTTime","TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTime");
- System.out.println("GPSTIME" + myTracker.location.getTime());
- System.out.println("SYSTIME" + SystemClock.elapsedRealtime());
-
- message = new Message();
- message.what = 0;
- message.obj = location;
- if(myTracker.isGPSFix()) {
- message.what = 1;
- } else {
- message.what = 2;
- }
- mHandler.sendMessage(message);
- } else {
- message.what = 0;
- mHandler.sendMessage(message);
- }
- }
- }
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/84/c080c339520d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/84/c080c339520d00131719b896d543f08c
deleted file mode 100644
index 38a6106..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/84/c080c339520d00131719b896d543f08c
+++ /dev/null
@@ -1,241 +0,0 @@
-package com.example.piztor;
-
-import android.app.AlertDialog;
-import android.app.Service;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.location.Location;
-import android.location.LocationListener;
-import android.location.LocationManager;
-import android.location.GpsStatus;
-import android.os.Bundle;
-import android.os.IBinder;
-import android.os.SystemClock;
-import android.provider.Settings;
-import android.util.Log;
-
-public class GPSTracker extends Service implements LocationListener, GpsStatus.Listener {
-
- private final Context mContext;
-
- // flag for GPS status
- boolean isGPSEnabled = false;
-
- // flag for network status
- boolean isNetworkEnabled = false;
-
- // flag for GPS status
- boolean canGetLocation = false;
-
- Location location; // location
- double latitude; // latitude
- double longitude; // longitude
-
- // The minimum distance to change Updates in meters
- private static final long MIN_DISTANCE_CHANGE_FOR_UPDATES = 10; // 10 meters
-
- // The minimum time between updates in milliseconds
- private static final long MIN_TIME_BW_UPDATES = 1000 * 1; // 10 seconds
-
- // Declaring a Location Manager
- protected LocationManager locationManager;
-
- // for GPS satellite status listener
- Location mLastLocation;
- long mLastLocationMillis;
- boolean isGPSFix;
-
-
- public GPSTracker(Context context) {
- this.mContext = context;
- isGPSFix = false;
- getLocation();
- }
-
- public void getLocation() {
- try {
-
- Log.d("getLocation", "Start getting location......");
-
- locationManager = (LocationManager) mContext
- .getSystemService(LOCATION_SERVICE);
-
- // getting GPS status
- isGPSEnabled = locationManager
- .isProviderEnabled(LocationManager.GPS_PROVIDER);
-
- // getting network status
- isNetworkEnabled = locationManager
- .isProviderEnabled(LocationManager.NETWORK_PROVIDER);
-
- if (!isGPSEnabled) {
- // no network provider is enabled
- } else {
- this.canGetLocation = true;
- if (isNetworkEnabled) {
- locationManager.requestLocationUpdates(
- LocationManager.NETWORK_PROVIDER,
- MIN_TIME_BW_UPDATES,
- MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
-
- Log.d("Network", "Network Updated");
-
- if (locationManager != null) {
- location = locationManager
- .getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
- if (location != null) {
- latitude = location.getLatitude();
- longitude = location.getLongitude();
-
- Log.d("Network", "Received Network Data");
- System.out.println("***From Network: "+latitude + " " + longitude);
- }
- }
- }// end of network section
- // if GPS Enabled get lat/long using GPS Services
- if (isGPSEnabled) {
- if (true) {
- locationManager.requestLocationUpdates(
- LocationManager.GPS_PROVIDER,
- MIN_TIME_BW_UPDATES,
- MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
- Log.d("GPS", "GPS Updated");
- if (locationManager != null) {
- location = locationManager
- .getLastKnownLocation(LocationManager.GPS_PROVIDER);
- if (location != null) {
- latitude = location.getLatitude();
- longitude = location.getLongitude();
-
- Log.d("GPS", "Received GPS Data");
- System.out.println("***From GPS: "+latitude + " " + longitude);
-
- }
- }
- }
- }// end of GPS section
- }// end of fetching data
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Stop using GPS listener Calling this function will stop using GPS in your
- * app
- * */
- public void stopUsingGPS() {
- if (locationManager != null) {
- locationManager.removeUpdates(GPSTracker.this);
- }
- }
-
- /**
- * Function to get latitude
- * */
- public double getLatitude() {
- if (location != null) {
- latitude = location.getLatitude();
- }
- return latitude;
- }
-
- /**
- * Function to get longitude
- * */
- public double getLongitude() {
- if (location != null) {
- longitude = location.getLongitude();
- }
- return longitude;
- }
-
- /**
- * Function to check GPS/wifi enabled
- *
- * @return boolean
- * */
- public boolean canGetLocation() {
- return this.canGetLocation;
- }
-
- public boolean isGPSFix() {
- return (this.isGPSFix && location != null);
- }
-
- /**
- * Function to show settings alert dialog On pressing Settings button will
- * lauch Settings Options
- * */
- public void showSettingsAlert() {
- AlertDialog.Builder alertDialog = new AlertDialog.Builder(mContext);
-
- // Setting Dialog Title
- alertDialog.setTitle("GPS is settings");
-
- // Setting Dialog Message
- alertDialog
- .setMessage("GPS is not enabled. Do you want to go to settings menu?");
-
- // On pressing Settings button
- alertDialog.setPositiveButton("Settings",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- Intent intent = new Intent(
- Settings.ACTION_LOCATION_SOURCE_SETTINGS);
- mContext.startActivity(intent);
- }
- });
-
- // on pressing cancel button
- alertDialog.setNegativeButton("Cancel",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- dialog.cancel();
- }
- });
-
- // Showing Alert Message
- alertDialog.show();
- }
-
- @Override
- public void onLocationChanged(Location location) {
- if (location == null) return;
- mLastLocationMillis = SystemClock.elapsedRealtime();
- mLastLocation = location;
- }
-
- @Override
- public void onProviderDisabled(String provider) {
- }
-
- @Override
- public void onProviderEnabled(String provider) {
- }
-
- @Override
- public void onStatusChanged(String provider, int status, Bundle extras) {
- }
-
- @Override
- public IBinder onBind(Intent arg0) {
- return null;
- }
-
- @Override
- public void onGpsStatusChanged(int event) {
- switch (event) {
- case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
- if(mLastLocation != null)
- isGPSFix = (SystemClock.elapsedRealtime() - mLastLocationMillis) < 3000;
- break;
-
- case GpsStatus.GPS_EVENT_FIRST_FIX:
- isGPSFix = true;
- break;
- }
- }
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/86/90090791270d00131050e648e11def2a b/client/.metadata/.plugins/org.eclipse.core.resources/.history/86/90090791270d00131050e648e11def2a
deleted file mode 100644
index c92af4b..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/86/90090791270d00131050e648e11def2a
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.app.Activity;
-import android.view.Menu;
-
-public class Login extends Activity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/86/b0ac05a2810d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/86/b0ac05a2810d00131719b896d543f08c
deleted file mode 100644
index 2b10d1b..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/86/b0ac05a2810d00131719b896d543f08c
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-import java.util.Vector;
-
-public class Infomation {
- static String ip = "69.85.86.42";
- static int port = 9990;
- static int token = -1;
- static int myId = -1;
-
- class UserInfo {
- int id;
- double lat, lot;
- }
-
- class Group {
- int id;
- Vector<UserInfo> v;
- }
-
-// static HashMap<Integer, Group> mp;
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/87/201980b5760d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/87/201980b5760d00131719b896d543f08c
deleted file mode 100644
index 90bee98..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/87/201980b5760d00131719b896d543f08c
+++ /dev/null
@@ -1,176 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.Vector;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- @SuppressLint("HandlerLeak")
- Handler fromGPS = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- Handler fromTransam = new Handler() {
- @Override
- public void handleMessage(Message m) {
- switch (m.what) {
- case 3:
- ResLocation r = (ResLocation) m.obj;
- for (int i = 0; i < r.n; i++) {
- System.out.println(r.l.get(i).lat + " " + r.l.get(i).lot);
- }
- actMgr.trigger(SuccessFetch);
- break;
- case 2:
- ResUpdate r = (ResUpdate) m.obj;
- break;
- default:
- break;
- }
-
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "Search Button Press";
- case FetchButtonPress:
- return "Fetch Button Press";
- case FocuseButtonPress:
- return "Focuse Button Press";
- case SuccessFetch:
- return "Success Fetch";
- case FailedFetch:
- return "Failed Fetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- if (e == SuccessFetch) {
-
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter Fetch status!!!!");
- if (e == FetchButtonPress) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1,
- System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave fetch status!!!! because" + cause(e));
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter focus status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave focus status!!!! because" + cause(e));
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(fromGPS);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
- btnFetch.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(FetchButtonPress);
- }
- });
- btnFocus.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- actMgr.trigger(FocuseButtonPress);
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/87/5019e3b3260d00131a9bb9bc5a5e6171 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/87/5019e3b3260d00131a9bb9bc5a5e6171
deleted file mode 100644
index 4df6b44..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/87/5019e3b3260d00131a9bb9bc5a5e6171
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.app.Activity;
-import android.view.Menu;
-
-public class InitAct extends PiztorAct {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_init);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.init, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/87/50ba72af3b0d00131524a793807f338e b/client/.metadata/.plugins/org.eclipse.core.resources/.history/87/50ba72af3b0d00131524a793807f338e
deleted file mode 100644
index f59c543..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/87/50ba72af3b0d00131524a793807f338e
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.macaroon.piztor;
-
-public class UserInfo {
- static String ip = "123.123.123.123";
- static int port = 9990;
- static int token = -1;
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/87/d0e225b3310d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/87/d0e225b3310d00131249f322b63acde8
deleted file mode 100644
index a93105a..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/87/d0e225b3310d00131249f322b63acde8
+++ /dev/null
@@ -1,80 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-import android.os.Handler;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
- //TODO fix
- static Handler fromTransam, fromGPS;
- //Event
-
- final static int noToken = 101;
-
-
- static Transam transam = null;
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
- Intent i = new Intent();
- System.out.println(nowAct.id + " : " + event);
- if (mp.get(nowAct.getClass()) == null)
- System.out.println("first");
- else if (mp.get(nowAct.getClass()) == null)
- System.out.println("second");
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- fromTransam = new Handler();
- fromGPS = new Handler();
- new Thread(transam).run();
-
- addStatus(InitAct.class);
- addStatus(Login.class);
- addTransition(InitAct.class, noToken, Login.class);
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/88/50d41de3290d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/88/50d41de3290d00131249f322b63acde8
deleted file mode 100644
index 6fbccda..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/88/50d41de3290d00131249f322b63acde8
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.app.Activity;
-import android.view.Menu;
-
-public class InitAct extends PiztorAct {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "initAct";
- super.onCreate(savedInstanceState);
- AppMgr.init();
- setContentView(R.layout.activity_init);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- AppMgr.trigger(AppMgr.hasToken);
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.init, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/88/a0228599540d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/88/a0228599540d00131719b896d543f08c
deleted file mode 100644
index 180c21c..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/88/a0228599540d00131719b896d543f08c
+++ /dev/null
@@ -1,87 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-import android.os.Handler;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
- //TODO fix
- static Handler fromTransam, fromGPS;
- static Transam transam = null;
- static Tracker tracker = null;
- static Thread tTransam, tGPS;
- //Event
-
- final static int noToken = 101;
- final static int loginSuccess = 102;
-
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
- Intent i = new Intent();
- System.out.println(nowAct.id + " : " + event);
- if (mp.get(nowAct.getClass()) == null)
- System.out.println("first");
- else if (mp.get(nowAct.getClass()) == null)
- System.out.println("second");
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- fromTransam = new Handler();
- transam = new Transam(UserInfo.ip, UserInfo.port, fromTransam);
- fromGPS = new Handler();
- tracker = new Tracker(nowAct.getApplicationContext(), fromGPS);
- tTransam = new Thread(transam);
- tTransam.start();
- System.out.println("!!!!!!");
- addStatus(InitAct.class);
- addStatus(Login.class);
- addStatus(Main.class);
- addTransition(InitAct.class, noToken, Login.class);
- addTransition(Login.class, loginSuccess, Main.class);
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/88/a0b797df250d00131a9bb9bc5a5e6171 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/88/a0b797df250d00131a9bb9bc5a5e6171
deleted file mode 100644
index bb16d98..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/88/a0b797df250d00131a9bb9bc5a5e6171
+++ /dev/null
@@ -1,69 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
-
- //Event
-
- final static int hasToken;
-
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
-
- Intent i = new Intent();
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- addStatus(InitAct.class);
- addStatus(Login.class);
-
-
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/89/0029672d5a0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/89/0029672d5a0d00131719b896d543f08c
deleted file mode 100644
index d5a6059..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/89/0029672d5a0d00131719b896d543f08c
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.macaroon.piztor;
-
-import android.content.Intent;
-import android.os.Bundle;
-import android.os.Handler;
-import android.view.Menu;
-
-public class InitAct extends PiztorAct {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "initAct";
- super.onCreate(savedInstanceState);
- AppMgr.init();
- setContentView(R.layout.activity_init);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- if (UserInfo.token == -1)
- AppMgr.trigger(AppMgr.noToken);
- else {
- //TODO jump to main
- }
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- getMenuInflater().inflate(R.menu.init, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/8a/c0860fa32d0d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/8a/c0860fa32d0d00131249f322b63acde8
deleted file mode 100644
index 4564070..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/8a/c0860fa32d0d00131249f322b63acde8
+++ /dev/null
@@ -1,72 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
-
- //Event
-
- final static int noToken = 101;
-
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
- Intent i = new Intent();
- System.out.println(nowAct.id + " : " + event);
- if (mp.get(nowAct.getClass()) == null)
- System.out.println("first");
- else if (mp.get(nowAct.getClass()) == null)
- System.out.println("second");
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- addStatus(InitAct.class);
- addStatus(Login.class);
- addTransition(InitAct.class, noToken, Login.class);
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/8b/908f0c6a360d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/8b/908f0c6a360d00131249f322b63acde8
deleted file mode 100644
index 0e5adb3..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/8b/908f0c6a360d00131249f322b63acde8
+++ /dev/null
@@ -1,72 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
-
-
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- int loginButtonClick = 1, retryButtonClick = 2, loginFailed = 3;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- } else if (m.what == 101) {
- actMgr.trigger(loginFailed);
- }
- }
- };
-
-
-
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- //AppMgr.transam.send(new ReqLogin(u, p, time, alive))
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/8b/d056c37d2d0d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/8b/d056c37d2d0d00131249f322b63acde8
deleted file mode 100644
index d870b73..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/8b/d056c37d2d0d00131249f322b63acde8
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.macaroon.piztor;
-
-import android.content.Intent;
-import android.os.Bundle;
-import android.os.Handler;
-import android.view.Menu;
-
-public class InitAct extends PiztorAct {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "initAct";
- super.onCreate(savedInstanceState);
- Intent i = new Intent();
- i.putExtra("haha", new Handler());
- AppMgr.init();
- setContentView(R.layout.activity_init);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- if (UserInfo.token != -1)
- AppMgr.trigger(AppMgr.noToken);
- else {
- //TODO jump to main
- }
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- getMenuInflater().inflate(R.menu.init, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/8c/10eb0b46390d00131524a793807f338e b/client/.metadata/.plugins/org.eclipse.core.resources/.history/8c/10eb0b46390d00131524a793807f338e
deleted file mode 100644
index 01b87ff..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/8c/10eb0b46390d00131524a793807f338e
+++ /dev/null
@@ -1,84 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-import android.os.Handler;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
- //TODO fix
- static Handler fromTransam, fromGPS;
- static Transam transam = null;
- static Thread tTransam, tGPS;
- //Event
-
- final static int noToken = 101;
- final static int loginSuccess = 102;
-
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
- Intent i = new Intent();
- System.out.println(nowAct.id + " : " + event);
- if (mp.get(nowAct.getClass()) == null)
- System.out.println("first");
- else if (mp.get(nowAct.getClass()) == null)
- System.out.println("second");
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- fromTransam = new Handler();
- transam = new Transam(UserInfo.ip, UserInfo.port, fromTransam);
- fromGPS = new Handler();
- tTransam = new Thread(transam);
- tTransam.run();
- addStatus(InitAct.class);
- addStatus(Login.class);
- addStatus(Main.class);
- addTransition(InitAct.class, noToken, Login.class);
- addTransition(Login.class, loginSuccess, Main.class);
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/8c/e09a6d15560d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/8c/e09a6d15560d00131719b896d543f08c
deleted file mode 100644
index 8839e04..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/8c/e09a6d15560d00131719b896d543f08c
+++ /dev/null
@@ -1,45 +0,0 @@
-package com.macaroon.piztor;
-
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-
-public class Main extends PiztorAct {
-
- ActMgr actMgr;
-
- Handler handler = new Handler() {
- @Override
- public void handleMessage(Message m) {
- Location l = (Location) m.obj;
- ReqUpdate r = new ReqUpdate(UserInfo.token, , longitude, time, alive)
- AppMgr.transam.send();
- }
- };
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/8d/10e89b06370d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/8d/10e89b06370d00131249f322b63acde8
deleted file mode 100644
index 81fa6f2..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/8d/10e89b06370d00131249f322b63acde8
+++ /dev/null
@@ -1,63 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.*;
-
-import android.annotation.SuppressLint;
-
-@SuppressLint("UseSparseArrays")
-public class ActMgr {
- // event
- PiztorAct act;
- ActStatus nowStatus;
- HashMap<ActStatus, HashMap<Integer, ActStatus>> mp;
-
- ActMgr(PiztorAct act, ActStatus nowStatus, ActStatus[] r) {
- this.act = act;
- this.nowStatus = nowStatus;
- mp = new HashMap<ActStatus, HashMap<Integer, ActStatus>>();
- for (int i = 0; i < r.length; i++) {
- mp.put(r[i], new HashMap<Integer, ActStatus>());
- }
- }
-
- void trigger(int event) {
- for (Integer i : mp.get(nowStatus).keySet())
- System.out.println(i);
- if (mp.get(nowStatus).containsKey(event)) {
- nowStatus.leave(event);
- nowStatus = mp.get(nowStatus).get(event);
- nowStatus.enter(event);
- } else if (AppMgr.mp.get(act.getClass()).containsKey(event)) {
- AppMgr.trigger(event);
- }
- }
-
- void add(ActStatus a, int event, ActStatus b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, ActStatus> h = mp.get(a);
- h.put(event, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, ActStatus> h = new HashMap<Integer, ActStatus>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-}
-
-abstract class ActStatus {
- abstract void enter(int e);
-
- abstract void leave(int e);
-}
-
-class EmptyStatus extends ActStatus {
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/8d/80e1dd33540d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/8d/80e1dd33540d00131719b896d543f08c
deleted file mode 100644
index b89f1ab..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/8d/80e1dd33540d00131719b896d543f08c
+++ /dev/null
@@ -1,85 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-import android.os.Handler;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
- //TODO fix
- static Handler fromTransam, fromGPS;
- static Transam transam = null;
- static Thread tTransam, tGPS;
- //Event
-
- final static int noToken = 101;
- final static int loginSuccess = 102;
-
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
- Intent i = new Intent();
- System.out.println(nowAct.id + " : " + event);
- if (mp.get(nowAct.getClass()) == null)
- System.out.println("first");
- else if (mp.get(nowAct.getClass()) == null)
- System.out.println("second");
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- fromTransam = new Handler();
- transam = new Transam(UserInfo.ip, UserInfo.port, fromTransam);
- //fromGPS = new Handler();
- tTransam = new Thread(transam);
- tTransam.start();
- System.out.println("!!!!!!");
- addStatus(InitAct.class);
- addStatus(Login.class);
- addStatus(Main.class);
- addTransition(InitAct.class, noToken, Login.class);
- addTransition(Login.class, loginSuccess, Main.class);
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/8d/a08e799e530d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/8d/a08e799e530d00131719b896d543f08c
deleted file mode 100644
index d68704e..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/8d/a08e799e530d00131719b896d543f08c
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-
-public class Main extends PiztorAct {
-
- Handler handler = new Handler() {
- @Override
- public void handleMessage(Message m) {
-
- }
- };
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/8d/a0b8e0b1310d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/8d/a0b8e0b1310d00131249f322b63acde8
deleted file mode 100644
index 4884d31..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/8d/a0b8e0b1310d00131249f322b63acde8
+++ /dev/null
@@ -1,78 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-import android.os.Handler;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
- //TODO fix
- static Handler fromTransam, fromGPS;
- //Event
-
- final static int noToken = 101;
-
-
- static Transam transam = null;
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
- Intent i = new Intent();
- System.out.println(nowAct.id + " : " + event);
- if (mp.get(nowAct.getClass()) == null)
- System.out.println("first");
- else if (mp.get(nowAct.getClass()) == null)
- System.out.println("second");
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- fromTransam = new Handler();
- fromGPS = new Handler();
- addStatus(InitAct.class);
- addStatus(Login.class);
- addTransition(InitAct.class, noToken, Login.class);
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/8d/b05c6824790d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/8d/b05c6824790d00131719b896d543f08c
deleted file mode 100644
index 7b562b8..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/8d/b05c6824790d00131719b896d543f08c
+++ /dev/null
@@ -1,192 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.Vector;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- final static int Create = 7;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- Timer autodate;
- @SuppressLint("HandlerLeak")
- Handler fromGPS = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- Handler fromTransam = new Handler() {
- @Override
- public void handleMessage(Message m) {
- switch (m.what) {
- case 3:
- ResLocation location = (ResLocation) m.obj;
- for (int i = 0; i < location.n; i++) {
- System.out.println(location.l.get(i).lat + " "
- + location.l.get(i).lot);
- }
- actMgr.trigger(SuccessFetch);
- break;
- case 2:
- ResUpdate update = (ResUpdate) m.obj;
- if (update.t == 0)
- System.out.println("update success");
- else
- System.out.println("update failed");
- break;
- default:
- break;
- }
-
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "Search Button Press";
- case FetchButtonPress:
- return "Fetch Button Press";
- case FocuseButtonPress:
- return "Focuse Button Press";
- case SuccessFetch:
- return "Success Fetch";
- case FailedFetch:
- return "Failed Fetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter Fetch status!!!!");
- if (e == FetchButtonPress) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1,
- System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave fetch status!!!! because" + cause(e));
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter focus status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave focus status!!!! because" + cause(e));
-
- }
-
- }
-
- class AutoUpdate extends TimerTask {
-
- @Override
- public void run() {
- actMgr.trigger(Main.TimerFlush);
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(fromGPS);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- actMgr.add(r[2], TimerFlush, r[2]);
- autodate = new Timer();
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
- btnFetch.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(FetchButtonPress);
- }
- });
- btnFocus.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- actMgr.trigger(FocuseButtonPress);
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/8e/b08854886b0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/8e/b08854886b0d00131719b896d543f08c
deleted file mode 100644
index b23f1b9..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/8e/b08854886b0d00131719b896d543f08c
+++ /dev/null
@@ -1,149 +0,0 @@
-package com.macaroon.piztor;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- @SuppressLint("HandlerLeak")
- Handler fromGPS = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- if (l == null)
- System.out.println("fuck!!!");
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "Search Button Press";
- case FetchButtonPress:
- return "Fetch Button Press";
- case FocuseButtonPress:
- return "Focuse Button Press";
- case SuccessFetch:
- return "Success Fetch";
- case FailedFetch:
- return "Failed Fetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter Fetch status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave fetch status!!!! because" + cause(e));
-
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter focus status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave focus status!!!! because" + cause(e));
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(fromGPS);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
- btnFetch.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(FetchButtonPress);
- }
- });
- btnFocus.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- actMgr.trigger(FocuseButtonPress);
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/8f/e0acc70a360d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/8f/e0acc70a360d00131249f322b63acde8
deleted file mode 100644
index 3a172b5..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/8f/e0acc70a360d00131249f322b63acde8
+++ /dev/null
@@ -1,72 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
-
-
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- int loginButtonClick = 1, retryButtonClick = 2;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- } else (m.what == 101) {
-
- }
- }
- };
-
-
-
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- //AppMgr.transam.send(new ReqLogin(u, p, time, alive))
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/8f/f0503e632b0d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/8f/f0503e632b0d00131249f322b63acde8
deleted file mode 100644
index 294cae3..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/8f/f0503e632b0d00131249f322b63acde8
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.macaroon.piztor;
-
-//--------------------------------------//
-// authentication //
-//--------------------------------------//
-
-public class ReqLogin extends Req{
- String user; //username
- String pass; //password
-
- ReqLogin(String u,String p,long time,long alive){
- super(0,0,time,alive); //for type 0
- user = u;
- pass = p;
- }
-} \ No newline at end of file
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/9/80eaba674e0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/9/80eaba674e0d00131719b896d543f08c
deleted file mode 100644
index b759a1c..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/9/80eaba674e0d00131719b896d543f08c
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
-
- <string name="app_name">Piztor</string>
- <string name="action_settings">Settings</string>
- <string name="hello_world">Hello world!</string>
- <string name="title_activity_login">Login</string>
- <string name="title_activity_main">Main</string>
-
-</resources>
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/9/d0125955810d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/9/d0125955810d00131719b896d543f08c
deleted file mode 100644
index dad95a8..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/9/d0125955810d00131719b896d543f08c
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-import java.util.Vector;
-
-public class Infomation {
- static String ip = "69.85.86.42";
- static int port = 9990;
- static int token = -1;
- static int myId = -1;
-
- class UserInfo {
- int id;
- double lat, lot;
- }
-
- class Group {
- int id;
- Vector<UserInfo> v;
- }
-
- static HashMap<Integer, Group> mp;
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/90/00e09e727b0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/90/00e09e727b0d00131719b896d543f08c
deleted file mode 100644
index fcbed8a..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/90/00e09e727b0d00131719b896d543f08c
+++ /dev/null
@@ -1,198 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.Vector;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- Timer autodate;
- @SuppressLint("HandlerLeak")
- Handler fromGPS = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- if (l == null)
- System.out.println("fuck!!!");
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- Handler fromTransam = new Handler() {
- @Override
- public void handleMessage(Message m) {
- switch (m.what) {
- case 3:
- ResLocation location = (ResLocation) m.obj;
- for (int i = 0; i < location.n; i++) {
- System.out.println(location.l.get(i).lat + " "
- + location.l.get(i).lot);
- }
- actMgr.trigger(SuccessFetch);
- break;
- case 2:
- ResUpdate update = (ResUpdate) m.obj;
- if (update.t == 0)
- System.out.println("update success");
- else
- System.out.println("update failed");
- break;
- default:
- break;
- }
-
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "Search Button Press";
- case FetchButtonPress:
- return "Fetch Button Press";
- case FocuseButtonPress:
- return "Focuse Button Press";
- case SuccessFetch:
- return "Success Fetch";
- case FailedFetch:
- return "Failed Fetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- if (e == TimerFlush) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1, System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter Fetch status!!!!");
- if (e == FetchButtonPress) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1,
- System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave fetch status!!!! because" + cause(e));
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter focus status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave focus status!!!! because" + cause(e));
-
- }
-
- }
-
- class AutoUpdate extends TimerTask {
-
- @Override
- public void run() {
- actMgr.trigger(Main.TimerFlush);
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(fromGPS);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- actMgr.add(r[2], TimerFlush, r[2]);
- autodate = new Timer();
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
- btnFetch.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(FetchButtonPress);
- }
- });
- btnFocus.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- actMgr.trigger(FocuseButtonPress);
- }
- });
- autodate.schedule(new AutoUpdate(), 0, 5000);
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/90/2028ee04230d00131a9bb9bc5a5e6171 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/90/2028ee04230d00131a9bb9bc5a5e6171
deleted file mode 100644
index ad93257..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/90/2028ee04230d00131a9bb9bc5a5e6171
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.macaroon.piztor;
-
-public class PiztorExcepiton extends Exception{
-
- /**
- *
- */
- private static final long serialVersionUID = -7147530695009854988L;
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/90/d01af94e800d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/90/d01af94e800d00131719b896d543f08c
deleted file mode 100644
index 9f83659..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/90/d01af94e800d00131719b896d543f08c
+++ /dev/null
@@ -1,205 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.Vector;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- Timer autodate;
- @SuppressLint("HandlerLeak")
- Handler fromGPS = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- if (l == null)
- System.out.println("fuck!!!");
- else {
- ReqUpdate r = new ReqUpdate(UserInfo.token,
- l.getLatitude(), l.getLongitude(),
- System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- }
- };
-
- Handler fromTransam = new Handler() {
- @Override
- public void handleMessage(Message m) {
- switch (m.what) {
- case 3:
- ResLocation location = (ResLocation) m.obj;
- for (int i = 0; i < location.n; i++) {
- System.out.println(location.l.get(i).lat + " "
- + location.l.get(i).lot);
- }
- actMgr.trigger(SuccessFetch);
- break;
- case 2:
- ResUpdate update = (ResUpdate) m.obj;
- if (update.t == 0)
- System.out.println("update success");
- else
- System.out.println("update failed");
- break;
- default:
- break;
- }
-
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "Search Button Press";
- case FetchButtonPress:
- return "Fetch Button Press";
- case FocuseButtonPress:
- return "Focuse Button Press";
- case SuccessFetch:
- return "Success Fetch";
- case FailedFetch:
- return "Failed Fetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- if (e == TimerFlush) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1,
- System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter Fetch status!!!!");
- if (e == FetchButtonPress) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1,
- System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave fetch status!!!! because" + cause(e));
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter focus status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave focus status!!!! because" + cause(e));
-
- }
-
- }
-
- class AutoUpdate extends TimerTask {
-
- @Override
- public void run() {
- actMgr.trigger(Main.TimerFlush);
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(fromGPS);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[0], SuccessFetch, r[0]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[1], SuccessFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- actMgr.add(r[2], TimerFlush, r[2]);
- autodate = new Timer();
- AppMgr.transam.setHandler(fromTransam);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
- btnFetch.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(FetchButtonPress);
- }
- });
- btnFocus.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- actMgr.trigger(FocuseButtonPress);
- }
- });
- autodate.schedule(new AutoUpdate(), 0, 5000);
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/92/90d0196d2b0d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/92/90d0196d2b0d00131249f322b63acde8
deleted file mode 100644
index eb90840..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/92/90d0196d2b0d00131249f322b63acde8
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.Vector;
-
-//--------------------------------------//
-// Location Info //
-//--------------------------------------//
-
-public class ResLocation extends Res{
- Vector<Rlocation> l; //vector for location info
- int n; //number of location info
-
- ResLocation(int num,Vector<Rlocation> locationvec){
- super(3,255); //for type 3
- l = locationvec;
- n = num;
- }
-} \ No newline at end of file
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/95/6090f2e14d0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/95/6090f2e14d0d00131719b896d543f08c
deleted file mode 100644
index 9065bdb..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/95/6090f2e14d0d00131719b896d543f08c
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="48dip"
- android:background="@drawable/topbar_background"
- android:id="@+id/settings_headbar_layout" >
-
- <ImageButton
- android:id="@+id/settings_btn_back"
- android:layout_width="40dip"
- android:layout_height="40dip"
- android:layout_marginLeft="5dip"
- android:layout_alignParentLeft="true"
- android:layout_centerVertical="true"
- android:background="@drawable/navigation_back"/>
-
- <TextView
- android:id="@+id/settings_headbar_text"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textSize="30dip"
- android:textColor="@android:color/white"
- android:layout_alignParentRight="true"
- android:layout_centerVertical="true"
- android:layout_marginRight="40dip"
- android:text="@string/settings"/>
-
-
-</RelativeLayout>
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/95/d0e2b9652c0d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/95/d0e2b9652c0d00131249f322b63acde8
deleted file mode 100644
index 2752afa..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/95/d0e2b9652c0d00131249f322b63acde8
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.app.Activity;
-import android.view.Menu;
-
-public class InitAct extends PiztorAct {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "initAct";
- super.onCreate(savedInstanceState);
- AppMgr.init();
- setContentView(R.layout.activity_init);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- if (UserInfo.token != -1)
- AppMgr.trigger(AppMgr.hasToken);
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- getMenuInflater().inflate(R.menu.init, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/96/00f46dd44f0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/96/00f46dd44f0d00131719b896d543f08c
deleted file mode 100644
index 46efee3..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/96/00f46dd44f0d00131719b896d543f08c
+++ /dev/null
@@ -1,19 +0,0 @@
-<resources>
-
- <string name="app_name">piztor</string>
- <string name="action_settings">Settings</string>
- <string name="hello_world">Hello world!</string>
- <string name="settings">Settings</string>
- <string name="search">Search</string>
- <string name="fetch">Fetch</string>
- <string name="checkin">Checkin</string>
- <string name="focus">Focus</string>
- <string name="show_sex">Show sex: </string>
- <string name="male">Male</string>
- <string name="female">Female</string>
- <string name="show_team">Show team: </string>
- <string name="all">All</string>
- <string name="mine">Mine</string>
- <string name="title_activity_login">Login</string>
-
-</resources>
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/96/7099eaee250d00131a9bb9bc5a5e6171 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/96/7099eaee250d00131a9bb9bc5a5e6171
deleted file mode 100644
index a935075..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/96/7099eaee250d00131a9bb9bc5a5e6171
+++ /dev/null
@@ -1,71 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
-
- //Event
-
- public enum Event {
- hasToken;
- }
-
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
-
- Intent i = new Intent();
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- addStatus(InitAct.class);
- addStatus(Login.class);
-
-
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/96/d045188a780d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/96/d045188a780d00131719b896d543f08c
deleted file mode 100644
index 630c035..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/96/d045188a780d00131719b896d543f08c
+++ /dev/null
@@ -1,191 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.Vector;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- Timer autodate;
- @SuppressLint("HandlerLeak")
- Handler fromGPS = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- Handler fromTransam = new Handler() {
- @Override
- public void handleMessage(Message m) {
- switch (m.what) {
- case 3:
- ResLocation location = (ResLocation) m.obj;
- for (int i = 0; i < location.n; i++) {
- System.out.println(location.l.get(i).lat + " "
- + location.l.get(i).lot);
- }
- actMgr.trigger(SuccessFetch);
- break;
- case 2:
- ResUpdate update = (ResUpdate) m.obj;
- if (update.t == 0)
- System.out.println("update success");
- else
- System.out.println("update failed");
- break;
- default:
- break;
- }
-
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "Search Button Press";
- case FetchButtonPress:
- return "Fetch Button Press";
- case FocuseButtonPress:
- return "Focuse Button Press";
- case SuccessFetch:
- return "Success Fetch";
- case FailedFetch:
- return "Failed Fetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter Fetch status!!!!");
- if (e == FetchButtonPress) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1,
- System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave fetch status!!!! because" + cause(e));
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter focus status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave focus status!!!! because" + cause(e));
-
- }
-
- }
-
- class AutoUpdate extends TimerTask {
-
- @Override
- public void run() {
- actMgr.trigger(Main.TimerFlush);
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(fromGPS);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- autodate = new Timer();
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
- btnFetch.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(FetchButtonPress);
- }
- });
- btnFocus.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- actMgr.trigger(FocuseButtonPress);
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/97/b0d85224540d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/97/b0d85224540d00131719b896d543f08c
deleted file mode 100644
index 0732a3f..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/97/b0d85224540d00131719b896d543f08c
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-
-public class Main extends PiztorAct {
-
- ActMgr actMgr;
-
- Handler handler = new Handler() {
- @Override
- public void handleMessage(Message m) {
- AppMgr.transam.send(new ReqLocation(UserInfo.token, 1, System.currentTimeMillis(), 1000));
- }
- };
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/97/b0e93a1f560d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/97/b0e93a1f560d00131719b896d543f08c
deleted file mode 100644
index cd9372f..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/97/b0e93a1f560d00131719b896d543f08c
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.macaroon.piztor;
-
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-
-public class Main extends PiztorAct {
-
- ActMgr actMgr;
-
- Handler handler = new Handler() {
- @Override
- public void handleMessage(Message m) {
- Location l = (Location) m.obj;
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send();
- }
- };
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/98/90d9c0a3260d00131a9bb9bc5a5e6171 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/98/90d9c0a3260d00131a9bb9bc5a5e6171
deleted file mode 100644
index 5df4638..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/98/90d9c0a3260d00131a9bb9bc5a5e6171
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.app.Activity;
-import android.view.Menu;
-
-public class InitAct extends Activity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_init);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.init, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/98/c0bccf492c0d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/98/c0bccf492c0d00131249f322b63acde8
deleted file mode 100644
index d0d8a48..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/98/c0bccf492c0d00131249f322b63acde8
+++ /dev/null
@@ -1,5 +0,0 @@
-package com.macaroon.piztor;
-
-public class UserInfo {
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/98/d01ce77a780d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/98/d01ce77a780d00131719b896d543f08c
deleted file mode 100644
index 9f6dfb4..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/98/d01ce77a780d00131719b896d543f08c
+++ /dev/null
@@ -1,192 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.Vector;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- Timer autodate;
- @SuppressLint("HandlerLeak")
- Handler fromGPS = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- Handler fromTransam = new Handler() {
- @Override
- public void handleMessage(Message m) {
- switch (m.what) {
- case 3:
- ResLocation location = (ResLocation) m.obj;
- for (int i = 0; i < location.n; i++) {
- System.out.println(location.l.get(i).lat + " "
- + location.l.get(i).lot);
- }
- actMgr.trigger(SuccessFetch);
- break;
- case 2:
- ResUpdate update = (ResUpdate) m.obj;
- if (update.t == 0)
- System.out.println("update success");
- else
- System.out.println("update failed");
- break;
- default:
- break;
- }
-
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "Search Button Press";
- case FetchButtonPress:
- return "Fetch Button Press";
- case FocuseButtonPress:
- return "Focuse Button Press";
- case SuccessFetch:
- return "Success Fetch";
- case FailedFetch:
- return "Failed Fetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter Fetch status!!!!");
- if (e == FetchButtonPress) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1,
- System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave fetch status!!!! because" + cause(e));
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter focus status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave focus status!!!! because" + cause(e));
-
- }
-
- }
-
- class AutoUpdate extends TimerTask {
-
- @Override
- public void run() {
- actMgr.trigger(Main.TimerFlush);
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(fromGPS);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- autodate = new Timer();
-
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
- btnFetch.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(FetchButtonPress);
- }
- });
- btnFocus.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- actMgr.trigger(FocuseButtonPress);
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/99/502b88e7810d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/99/502b88e7810d00131719b896d543f08c
deleted file mode 100644
index d3a498f..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/99/502b88e7810d00131719b896d543f08c
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-import java.util.Vector;
-
-public class Infomation {
- static String ip = "69.85.86.42";
- static int port = 9990;
- static int token = -1;
- static int myId = -1;
- static int myGroup = -1;
- class UserInfo {
- int id;
- double lat, lot;
- }
-
- class Group {
- int id;
- Vector<UserInfo> v;
- }
-
- static HashMap<Integer, Group> mp;
-
- static void init() {
-
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/99/603b4d34230d00131a9bb9bc5a5e6171 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/99/603b4d34230d00131a9bb9bc5a5e6171
deleted file mode 100644
index ff37673..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/99/603b4d34230d00131a9bb9bc5a5e6171
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.macaroon.piztor;
-
-class PiztorExcepiton extends Exception{
- private static final long serialVersionUID = -7147530695009854988L;
-
-}
-
-class ClassCannotFind extends PiztorExcepiton {
- private
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/99/70ce9093370d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/99/70ce9093370d00131249f322b63acde8
deleted file mode 100644
index 652a271..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/99/70ce9093370d00131249f322b63acde8
+++ /dev/null
@@ -1,96 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
-
-
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- int loginButtonClick = 1, retryButtonClick = 2, loginFailed = 3;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- } else if (m.what == 101) {
- actMgr.trigger(loginFailed);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
- }
-
- class LoginStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- String user = edtUser.getText();
-
- }
-
- @Override
- void leave(int e) {
- // TODO Auto-generated method stub
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- //AppMgr.transam.send(new ReqLogin(u, p, time, alive))
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/9b/90a9ae62770d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/9b/90a9ae62770d00131719b896d543f08c
deleted file mode 100644
index a5c36f7..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/9b/90a9ae62770d00131719b896d543f08c
+++ /dev/null
@@ -1,181 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.Vector;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- @SuppressLint("HandlerLeak")
- Handler fromGPS = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- Handler fromTransam = new Handler() {
- @Override
- public void handleMessage(Message m) {
- switch (m.what) {
- case 3:
- ResLocation location = (ResLocation) m.obj;
- for (int i = 0; i < location.n; i++) {
- System.out.println(location.l.get(i).lat + " "
- + location.l.get(i).lot);
- }
- actMgr.trigger(SuccessFetch);
- break;
- case 2:
- ResUpdate update = (ResUpdate) m.obj;
- if (update.t == 0)
- System.out.println("update success");
- else
- System.out.println("update failed");
- break;
- default:
- break;
- }
-
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "Search Button Press";
- case FetchButtonPress:
- return "Fetch Button Press";
- case FocuseButtonPress:
- return "Focuse Button Press";
- case SuccessFetch:
- return "Success Fetch";
- case FailedFetch:
- return "Failed Fetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- if (e == SuccessFetch) {
-
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter Fetch status!!!!");
- if (e == FetchButtonPress) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1,
- System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave fetch status!!!! because" + cause(e));
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter focus status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave focus status!!!! because" + cause(e));
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(fromGPS);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
- btnFetch.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(FetchButtonPress);
- }
- });
- btnFocus.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- actMgr.trigger(FocuseButtonPress);
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/9c/606048dc370d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/9c/606048dc370d00131249f322b63acde8
deleted file mode 100644
index 2c804a6..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/9c/606048dc370d00131249f322b63acde8
+++ /dev/null
@@ -1,96 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
-
-
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- int loginButtonClick = 1, retryButtonClick = 2, loginFailed = 3;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- } else if (m.what == 101) {
- actMgr.trigger(loginFailed);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
- }
-
- class LoginStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- String user = edtUser.getText().toString();
- String pass = edtPass.getText().toString();
- }
-
- @Override
- void leave(int e) {
- // TODO Auto-generated method stub
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- //AppMgr.transam.send(new ReqLogin(u, p, time, alive))
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/9d/1036ff9b220d00131a9bb9bc5a5e6171 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/9d/1036ff9b220d00131a9bb9bc5a5e6171
deleted file mode 100644
index d45dd56..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/9d/1036ff9b220d00131a9bb9bc5a5e6171
+++ /dev/null
@@ -1,2 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.compliance=1.6
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/9d/3091338f6b0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/9d/3091338f6b0d00131719b896d543f08c
deleted file mode 100644
index c44cd80..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/9d/3091338f6b0d00131719b896d543f08c
+++ /dev/null
@@ -1,156 +0,0 @@
-package com.macaroon.piztor;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- @SuppressLint("HandlerLeak")
- Handler fromGPS = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- if (l == null)
- System.out.println("fuck!!!");
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- Handler fromTransam = new Handler() {
- @Override
- public void handleMessage(Message m) {
-
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "Search Button Press";
- case FetchButtonPress:
- return "Fetch Button Press";
- case FocuseButtonPress:
- return "Focuse Button Press";
- case SuccessFetch:
- return "Success Fetch";
- case FailedFetch:
- return "Failed Fetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter Fetch status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave fetch status!!!! because" + cause(e));
-
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter focus status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave focus status!!!! because" + cause(e));
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(fromGPS);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
- btnFetch.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(FetchButtonPress);
- }
- });
- btnFocus.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- actMgr.trigger(FocuseButtonPress);
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/9e/80db2574360d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/9e/80db2574360d00131249f322b63acde8
deleted file mode 100644
index 0e5adb3..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/9e/80db2574360d00131249f322b63acde8
+++ /dev/null
@@ -1,72 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
-
-
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- int loginButtonClick = 1, retryButtonClick = 2, loginFailed = 3;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- } else if (m.what == 101) {
- actMgr.trigger(loginFailed);
- }
- }
- };
-
-
-
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- //AppMgr.transam.send(new ReqLogin(u, p, time, alive))
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/9f/90356481800d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/9f/90356481800d00131719b896d543f08c
deleted file mode 100644
index d0ca8a4..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/9f/90356481800d00131719b896d543f08c
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.macaroon.piztor;
-
-public class Infomation {
- static String ip = "69.85.86.42";
- static int port = 9990;
- static int token = -1;
-
- static class UserInfo {
- double lat, lot;
- }
-
- static class Group {
- int id;
- }
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/9f/a064e6d0330d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/9f/a064e6d0330d00131249f322b63acde8
deleted file mode 100644
index 25614b9..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/9f/a064e6d0330d00131249f322b63acde8
+++ /dev/null
@@ -1,58 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
-
- }
- };
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/9f/f04144582b0d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/9f/f04144582b0d00131249f322b63acde8
deleted file mode 100644
index e4b1497..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/9f/f04144582b0d00131249f322b63acde8
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.macaroon.piztor;
-
-//--------------------------------------//
-// Update Location //
-//--------------------------------------//
-
-public class ReqUpdate extends Req{
- double lat; //latitude
- double lot; //longitude
-
- ReqUpdate(int token,double latitude,double longitude,long time,long alive){
- super(2,token,time,alive); //for type 2
- lat = latitude;
- lot = longitude;
- }
-} \ No newline at end of file
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/a/40b9ebd22d0d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/a/40b9ebd22d0d00131249f322b63acde8
deleted file mode 100644
index 0a711af..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/a/40b9ebd22d0d00131249f322b63acde8
+++ /dev/null
@@ -1,73 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-import android.os.Handler;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
- static Handler handle;
- //Event
-
- final static int noToken = 101;
-
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
- Intent i = new Intent();
- System.out.println(nowAct.id + " : " + event);
- if (mp.get(nowAct.getClass()) == null)
- System.out.println("first");
- else if (mp.get(nowAct.getClass()) == null)
- System.out.println("second");
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- addStatus(InitAct.class);
- addStatus(Login.class);
- addTransition(InitAct.class, noToken, Login.class);
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/a0/70559b0a250d00131a9bb9bc5a5e6171 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/a0/70559b0a250d00131a9bb9bc5a5e6171
deleted file mode 100644
index 372bf97..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/a0/70559b0a250d00131a9bb9bc5a5e6171
+++ /dev/null
@@ -1,16 +0,0 @@
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:paddingBottom="@dimen/activity_vertical_margin"
- android:paddingLeft="@dimen/activity_horizontal_margin"
- android:paddingRight="@dimen/activity_horizontal_margin"
- android:paddingTop="@dimen/activity_vertical_margin"
- tools:context=".Login" >
-
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/hello_world" />
-
-</RelativeLayout>
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/a0/90d4db88800d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/a0/90d4db88800d00131719b896d543f08c
deleted file mode 100644
index 0713782..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/a0/90d4db88800d00131719b896d543f08c
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.Vector;
-
-public class Infomation {
- static String ip = "69.85.86.42";
- static int port = 9990;
- static int token = -1;
- static int myId = -1;
- static class UserInfo {
- int id;
- double lat, lot;
- }
-
- static class Group {
- int id;
- Vector<UserInfo> v;
- }
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/a0/e0b88562370d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/a0/e0b88562370d00131249f322b63acde8
deleted file mode 100644
index 9b160ad..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/a0/e0b88562370d00131249f322b63acde8
+++ /dev/null
@@ -1,71 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
-
-
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- int loginButtonClick = 1, retryButtonClick = 2, loginFailed = 3;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- } else if (m.what == 101) {
- actMgr.trigger(loginFailed);
- }
- }
- };
-
- //class StartStatus extends Piz
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- //AppMgr.transam.send(new ReqLogin(u, p, time, alive))
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/a2/308cf16f2c0d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/a2/308cf16f2c0d00131249f322b63acde8
deleted file mode 100644
index 3e73b92..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/a2/308cf16f2c0d00131249f322b63acde8
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.app.Activity;
-import android.view.Menu;
-
-public class InitAct extends PiztorAct {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "initAct";
- super.onCreate(savedInstanceState);
- AppMgr.init();
- setContentView(R.layout.activity_init);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- if (UserInfo.token != -1)
- AppMgr.trigger(AppMgr.noToken);
- else
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- getMenuInflater().inflate(R.menu.init, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/a2/50ad9b0a560d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/a2/50ad9b0a560d00131719b896d543f08c
deleted file mode 100644
index d4acdc9..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/a2/50ad9b0a560d00131719b896d543f08c
+++ /dev/null
@@ -1,43 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-
-public class Main extends PiztorAct {
-
- ActMgr actMgr;
-
- Handler handler = new Handler() {
- @Override
- public void handleMessage(Message m) {
-// ReqUpdate r = new ReqUpdate(UserInfo.token, AppMgr., longitude, time, alive)
- AppMgr.transam.send();
- }
- };
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/a3/f02825fc2d0d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/a3/f02825fc2d0d00131249f322b63acde8
deleted file mode 100644
index b6fb62c..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/a3/f02825fc2d0d00131249f322b63acde8
+++ /dev/null
@@ -1,74 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-import android.os.Handler;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
- //TODO fix
- static Handler fromTransam, fromeGPS;
- //Event
-
- final static int noToken = 101;
-
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
- Intent i = new Intent();
- System.out.println(nowAct.id + " : " + event);
- if (mp.get(nowAct.getClass()) == null)
- System.out.println("first");
- else if (mp.get(nowAct.getClass()) == null)
- System.out.println("second");
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- addStatus(InitAct.class);
- addStatus(Login.class);
- addTransition(InitAct.class, noToken, Login.class);
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/a6/a016c8c14f0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/a6/a016c8c14f0d00131719b896d543f08c
deleted file mode 100644
index c2d070c..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/a6/a016c8c14f0d00131719b896d543f08c
+++ /dev/null
@@ -1,20 +0,0 @@
-activity_loginactivity_loginactivity_loginactivity_loginactivity_loginactivity_loginactivity_loginactivity_loginactivity_login<?xml version="1.0" encoding="utf-8"?>
-<resources>
-
- <string name="app_name">piztor</string>
- <string name="action_settings">Settings</string>
- <string name="hello_world">Hello world!</string>
- <string name="settings">Settings</string>
- <string name="search">Search</string>
- <string name="fetch">Fetch</string>
- <string name="checkin">Checkin</string>
- <string name="focus">Focus</string>
- <string name="show_sex">Show sex: </string>
- <string name="male">Male</string>
- <string name="female">Female</string>
- <string name="show_team">Show team: </string>
- <string name="all">All</string>
- <string name="mine">Mine</string>
- <string name="title_activity_login">Login</string>
-
-</resources>
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/a7/a0893aae550d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/a7/a0893aae550d00131719b896d543f08c
deleted file mode 100644
index b653442..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/a7/a0893aae550d00131719b896d543f08c
+++ /dev/null
@@ -1,68 +0,0 @@
-package com.macaroon.piztor;
-
-import android.content.Context;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import android.location.Location;
-import android.content.Context;
-import android.os.Handler;
-import android.os.Message;
-import android.util.Log;
-import android.os.SystemClock;
-
-
-public class Tracker implements Runnable {
-
- private static final long TIME_DELTA = 1000 * 3; // 3 second
- public Timer timer;
- private final Context mContext;
- GPSTracker myTracker;
- Handler mHandler;
- Message message;
-
- public Tracker(Context context, Handler yHandler) {
- timer = new Timer();
- mContext = context;
- myTracker = new GPSTracker(mContext);
- mHandler = yHandler;
- }
-
- void setHandler(Handler hand) {
- mHandler = hand;
- }
-
-
- public void run() {
- GPSTask myTask = new GPSTask();
- timer.schedule(myTask, 0, TIME_DELTA);
- }
-
- class GPSTask extends TimerTask {
- @Override
- public void run() {
- message = new Message();
- message.what = 0;
- myTracker.getLocation();
- Log.d("Location", "Fetching location.....");
- if (myTracker.canGetLocation()) {
- double latitude = myTracker.getLatitude();
- double longitude = myTracker.getLongitude();
-
- Log.d("TTTTTTTTTTTTTTTTTTTTTTTime","TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTime");
- System.out.println("GPSTIME" + myTracker.location.getTime());
- System.out.println("SYSTIME" + SystemClock.elapsedRealtime());
-
- if(myTracker.isGPSFix()) {
- message.what = 1;
- } else {
- message.what = 2;
- }
- mHandler.sendMessage(message);
- } else {
- message.what = 0;
- mHandler.sendMessage(message);
- }
- }
- }
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/a8/20fcf44e800d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/a8/20fcf44e800d00131719b896d543f08c
deleted file mode 100644
index 59bb8b5..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/a8/20fcf44e800d00131719b896d543f08c
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.view.Menu;
-
-public class InitAct extends PiztorAct {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "initAct";
- super.onCreate(savedInstanceState);
- AppMgr.init();
- setContentView(R.layout.activity_init);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- if (UserInfo.token == -1)
- AppMgr.trigger(AppMgr.noToken);
- else {
- //TODO jump to main
- }
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- getMenuInflater().inflate(R.menu.init, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/a8/80a9829d690d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/a8/80a9829d690d00131719b896d543f08c
deleted file mode 100644
index bebf3ae..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/a8/80a9829d690d00131719b896d543f08c
+++ /dev/null
@@ -1,116 +0,0 @@
-package com.macaroon.piztor;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- @SuppressLint("HandlerLeak")
- Handler handler = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- if (l == null)
- System.out.println("fuck!!!");
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- void leave(int e) {
- // TODO Auto-generated method stub
-
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- void leave(int e) {
- // TODO Auto-generated method stub
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(handler);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);''
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/a9/100cbe75540d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/a9/100cbe75540d00131719b896d543f08c
deleted file mode 100644
index 8bb993a..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/a9/100cbe75540d00131719b896d543f08c
+++ /dev/null
@@ -1,86 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-import android.os.Handler;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
- //TODO fix
- static Handler fromTransam, fromGPS;
- static Transam transam = null;
- static Tracker tracker = null;
- static Thread tTransam, tGPS;
- //Event
-
- final static int noToken = 101;
- final static int loginSuccess = 102;
-
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
- Intent i = new Intent();
- System.out.println(nowAct.id + " : " + event);
- if (mp.get(nowAct.getClass()) == null)
- System.out.println("first");
- else if (mp.get(nowAct.getClass()) == null)
- System.out.println("second");
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- fromTransam = new Handler();
- transam = new Transam(UserInfo.ip, UserInfo.port, fromTransam);
- //fromGPS = new Handler();
- tTransam = new Thread(transam);
- tTransam.start();
- System.out.println("!!!!!!");
- addStatus(InitAct.class);
- addStatus(Login.class);
- addStatus(Main.class);
- addTransition(InitAct.class, noToken, Login.class);
- addTransition(Login.class, loginSuccess, Main.class);
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/a9/409f33a52d0d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/a9/409f33a52d0d00131249f322b63acde8
deleted file mode 100644
index 07b5812..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/a9/409f33a52d0d00131249f322b63acde8
+++ /dev/null
@@ -1,72 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
- static Handler handle;
- //Event
-
- final static int noToken = 101;
-
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
- Intent i = new Intent();
- System.out.println(nowAct.id + " : " + event);
- if (mp.get(nowAct.getClass()) == null)
- System.out.println("first");
- else if (mp.get(nowAct.getClass()) == null)
- System.out.println("second");
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- addStatus(InitAct.class);
- addStatus(Login.class);
- addTransition(InitAct.class, noToken, Login.class);
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/a9/e083aa57340d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/a9/e083aa57340d00131249f322b63acde8
deleted file mode 100644
index 070b1ab..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/a9/e083aa57340d00131249f322b63acde8
+++ /dev/null
@@ -1,60 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- }
- }
- };
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/aa/1010278f550d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/aa/1010278f550d00131719b896d543f08c
deleted file mode 100644
index d3fa0f2..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/aa/1010278f550d00131719b896d543f08c
+++ /dev/null
@@ -1,241 +0,0 @@
-package com.macaroon.piztor;
-
-import android.app.AlertDialog;
-import android.app.Service;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.location.Location;
-import android.location.LocationListener;
-import android.location.LocationManager;
-import android.location.GpsStatus;
-import android.os.Bundle;
-import android.os.IBinder;
-import android.os.SystemClock;
-import android.provider.Settings;
-import android.util.Log;
-
-public class GPSTracker extends Service implements LocationListener, GpsStatus.Listener {
-
- private final Context mContext;
-
- // flag for GPS status
- boolean isGPSEnabled = false;
-
- // flag for network status
- boolean isNetworkEnabled = false;
-
- // flag for GPS status
- boolean canGetLocation = false;
-
- Location location; // location
- double latitude; // latitude
- double longitude; // longitude
-
- // The minimum distance to change Updates in meters
- private static final long MIN_DISTANCE_CHANGE_FOR_UPDATES = 10; // 10 meters
-
- // The minimum time between updates in milliseconds
- private static final long MIN_TIME_BW_UPDATES = 1000 * 3; // 10 seconds
-
- // Declaring a Location Manager
- protected LocationManager locationManager;
-
- // for GPS satellite status listener
- Location mLastLocation;
- long mLastLocationMillis;
- boolean isGPSFix;
-
-
- public GPSTracker(Context context) {
- this.mContext = context;
- isGPSFix = false;
- getLocation();
- }
-
- public Location getLocation() {
- try {
- Log.d("getLocation", "Start getting location......");
-
- locationManager = (LocationManager) mContext
- .getSystemService(LOCATION_SERVICE);
-
- // getting GPS status
- isGPSEnabled = locationManager
- .isProviderEnabled(LocationManager.GPS_PROVIDER);
-
- // getting network status
- isNetworkEnabled = locationManager
- .isProviderEnabled(LocationManager.NETWORK_PROVIDER);
-
- if (!isGPSEnabled) {
- // no network provider is enabled
- } else {
- this.canGetLocation = true;
- if (isNetworkEnabled) {
- locationManager.requestLocationUpdates(
- LocationManager.NETWORK_PROVIDER,
- MIN_TIME_BW_UPDATES,
- MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
-
- Log.d("Network", "Network Updated");
-
- if (locationManager != null) {
- location = locationManager
- .getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
- if (location != null) {
- latitude = location.getLatitude();
- longitude = location.getLongitude();
-
- Log.d("Network", "Received Network Data");
- System.out.println("***From Network: "+latitude + " " + longitude);
- }
- }
- }// end of network section
- // if GPS Enabled get lat/long using GPS Services
- if (isGPSEnabled) {
- if (true) {
- locationManager.requestLocationUpdates(
- LocationManager.GPS_PROVIDER,
- MIN_TIME_BW_UPDATES,
- MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
- Log.d("GPS", "GPS Updated");
- if (locationManager != null) {
- location = locationManager
- .getLastKnownLocation(LocationManager.GPS_PROVIDER);
- if (location != null) {
- latitude = location.getLatitude();
- longitude = location.getLongitude();
-
- Log.d("GPS", "Received GPS Data");
- System.out.println("***From GPS: "+latitude + " " + longitude);
-
- }
- }
- }
- }// end of GPS section
- }// end of fetching data
- return location
- } catch (Exception e) {
- e.printStackTrace();
- }
- return location;
- }
-
- /**
- * Stop using GPS listener Calling this function will stop using GPS in your
- * app
- * */
- public void stopUsingGPS() {
- if (locationManager != null) {
- locationManager.removeUpdates(GPSTracker.this);
- }
- }
-
- /**
- * Function to get latitude
- * */
- public double getLatitude() {
- if (location != null) {
- latitude = location.getLatitude();
- }
- return latitude;
- }
-
- /**
- * Function to get longitude
- * */
- public double getLongitude() {
- if (location != null) {
- longitude = location.getLongitude();
- }
- return longitude;
- }
-
- /**
- * Function to check GPS/wifi enabled
- *
- * @return boolean
- * */
- public boolean canGetLocation() {
- return this.canGetLocation;
- }
-
- public boolean isGPSFix() {
- return (this.isGPSFix && location != null);
- }
-
- /**
- * Function to show settings alert dialog On pressing Settings button will
- * lauch Settings Options
- * */
- public void showSettingsAlert() {
- AlertDialog.Builder alertDialog = new AlertDialog.Builder(mContext);
-
- // Setting Dialog Title
- alertDialog.setTitle("GPS is settings");
-
- // Setting Dialog Message
- alertDialog
- .setMessage("GPS is not enabled. Do you want to go to settings menu?");
-
- // On pressing Settings button
- alertDialog.setPositiveButton("Settings",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- Intent intent = new Intent(
- Settings.ACTION_LOCATION_SOURCE_SETTINGS);
- mContext.startActivity(intent);
- }
- });
-
- // on pressing cancel button
- alertDialog.setNegativeButton("Cancel",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- dialog.cancel();
- }
- });
-
- // Showing Alert Message
- alertDialog.show();
- }
-
- @Override
- public void onLocationChanged(Location location) {
- if (location == null) return;
- mLastLocationMillis = SystemClock.elapsedRealtime();
- mLastLocation = location;
- }
-
- @Override
- public void onProviderDisabled(String provider) {
- }
-
- @Override
- public void onProviderEnabled(String provider) {
- }
-
- @Override
- public void onStatusChanged(String provider, int status, Bundle extras) {
- }
-
- @Override
- public IBinder onBind(Intent arg0) {
- return null;
- }
-
- @Override
- public void onGpsStatusChanged(int event) {
- switch (event) {
- case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
- if(mLastLocation != null)
- isGPSFix = (SystemClock.elapsedRealtime() - mLastLocationMillis) < 3000;
- break;
-
- case GpsStatus.GPS_EVENT_FIRST_FIX:
- isGPSFix = true;
- break;
- }
- }
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/aa/a0a35aa1550d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/aa/a0a35aa1550d00131719b896d543f08c
deleted file mode 100644
index d5590eb..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/aa/a0a35aa1550d00131719b896d543f08c
+++ /dev/null
@@ -1,242 +0,0 @@
-package com.macaroon.piztor;
-
-import android.app.AlertDialog;
-import android.app.Service;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.location.Location;
-import android.location.LocationListener;
-import android.location.LocationManager;
-import android.location.GpsStatus;
-import android.os.Bundle;
-import android.os.IBinder;
-import android.os.SystemClock;
-import android.provider.Settings;
-import android.util.Log;
-
-public class GPSTracker extends Service implements LocationListener, GpsStatus.Listener {
-
- private final Context mContext;
-
- // flag for GPS status
- boolean isGPSEnabled = false;
-
- // flag for network status
- boolean isNetworkEnabled = false;
-
- // flag for GPS status
- boolean canGetLocation = false;
-
- Location location; // location
- double latitude; // latitude
- double longitude; // longitude
-
- // The minimum distance to change Updates in meters
- private static final long MIN_DISTANCE_CHANGE_FOR_UPDATES = 10; // 10 meters
-
- // The minimum time between updates in milliseconds
- private static final long MIN_TIME_BW_UPDATES = 1000 * 3; // 10 seconds
-
- // Declaring a Location Manager
- protected LocationManager locationManager;
-
- // for GPS satellite status listener
- Location mLastLocation;
- long mLastLocationMillis;
- boolean isGPSFix;
-
-
- public GPSTracker(Context context) {
- this.mContext = context;
- isGPSFix = false;
- getLocation();
- }
-
- public Location getLocation() {
- try {
- Log.d("getLocation", "Start getting location......");
-
- locationManager = (LocationManager) mContext
- .getSystemService(LOCATION_SERVICE);
-
- // getting GPS status
- isGPSEnabled = locationManager
- .isProviderEnabled(LocationManager.GPS_PROVIDER);
-
- // getting network status
- isNetworkEnabled = locationManager
- .isProviderEnabled(LocationManager.NETWORK_PROVIDER);
-
- if (!isGPSEnabled) {
- // no network provider is enabled
- } else {
- this.canGetLocation = true;
- if (isNetworkEnabled) {
- locationManager.requestLocationUpdates(
- LocationManager.NETWORK_PROVIDER,
- MIN_TIME_BW_UPDATES,
- MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
-
- Log.d("Network", "Network Updated");
-
- if (locationManager != null) {
- location = locationManager
- .getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
- if (location != null) {
- latitude = location.getLatitude();
- longitude = location.getLongitude();
-
- Log.d("Network", "Received Network Data");
- System.out.println("***From Network: "+latitude + " " + longitude);
- }
- }
- }// end of network section
- // if GPS Enabled get lat/long using GPS Services
- if (isGPSEnabled) {
- if (true) {
- locationManager.requestLocationUpdates(
- LocationManager.GPS_PROVIDER,
- MIN_TIME_BW_UPDATES,
- MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
- Log.d("GPS", "GPS Updated");
- if (locationManager != null) {
- location = locationManager
- .getLastKnownLocation(LocationManager.GPS_PROVIDER);
- if (location != null) {
- latitude = location.getLatitude();
- longitude = location.getLongitude();
-
- Log.d("GPS", "Received GPS Data");
- System.out.println("***From GPS: "+latitude + " " + longitude);
-
- }
- }
- }
- }// end of GPS section
- }// end of fetching data
- return location;
- } catch (Exception e) {
- e.printStackTrace();
- return null;
- }
- return location;
- }
-
- /**
- * Stop using GPS listener Calling this function will stop using GPS in your
- * app
- * */
- public void stopUsingGPS() {
- if (locationManager != null) {
- locationManager.removeUpdates(GPSTracker.this);
- }
- }
-
- /**
- * Function to get latitude
- * */
- public double getLatitude() {
- if (location != null) {
- latitude = location.getLatitude();
- }
- return latitude;
- }
-
- /**
- * Function to get longitude
- * */
- public double getLongitude() {
- if (location != null) {
- longitude = location.getLongitude();
- }
- return longitude;
- }
-
- /**
- * Function to check GPS/wifi enabled
- *
- * @return boolean
- * */
- public boolean canGetLocation() {
- return this.canGetLocation;
- }
-
- public boolean isGPSFix() {
- return (this.isGPSFix && location != null);
- }
-
- /**
- * Function to show settings alert dialog On pressing Settings button will
- * lauch Settings Options
- * */
- public void showSettingsAlert() {
- AlertDialog.Builder alertDialog = new AlertDialog.Builder(mContext);
-
- // Setting Dialog Title
- alertDialog.setTitle("GPS is settings");
-
- // Setting Dialog Message
- alertDialog
- .setMessage("GPS is not enabled. Do you want to go to settings menu?");
-
- // On pressing Settings button
- alertDialog.setPositiveButton("Settings",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- Intent intent = new Intent(
- Settings.ACTION_LOCATION_SOURCE_SETTINGS);
- mContext.startActivity(intent);
- }
- });
-
- // on pressing cancel button
- alertDialog.setNegativeButton("Cancel",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- dialog.cancel();
- }
- });
-
- // Showing Alert Message
- alertDialog.show();
- }
-
- @Override
- public void onLocationChanged(Location location) {
- if (location == null) return;
- mLastLocationMillis = SystemClock.elapsedRealtime();
- mLastLocation = location;
- }
-
- @Override
- public void onProviderDisabled(String provider) {
- }
-
- @Override
- public void onProviderEnabled(String provider) {
- }
-
- @Override
- public void onStatusChanged(String provider, int status, Bundle extras) {
- }
-
- @Override
- public IBinder onBind(Intent arg0) {
- return null;
- }
-
- @Override
- public void onGpsStatusChanged(int event) {
- switch (event) {
- case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
- if(mLastLocation != null)
- isGPSFix = (SystemClock.elapsedRealtime() - mLastLocationMillis) < 3000;
- break;
-
- case GpsStatus.GPS_EVENT_FIRST_FIX:
- isGPSFix = true;
- break;
- }
- }
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/ab/608c6879260d00131a9bb9bc5a5e6171 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/ab/608c6879260d00131a9bb9bc5a5e6171
deleted file mode 100644
index bab59bd..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/ab/608c6879260d00131a9bb9bc5a5e6171
+++ /dev/null
@@ -1,69 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
-
- //Event
-
- final static int hasToken = 1;
-
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
-
- Intent i = new Intent();
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- addStatus(InitAct.class);
- addStatus(Login.class);
-
-
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/ac/00248cbd360d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/ac/00248cbd360d00131249f322b63acde8
deleted file mode 100644
index c7eaee7..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/ac/00248cbd360d00131249f322b63acde8
+++ /dev/null
@@ -1,71 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
-
-
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- int loginButtonClick = 1, retryButtonClick = 2, loginFailed = 3;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- } else if (m.what == 101) {
- actMgr.trigger(loginFailed);
- }
- }
- };
-
-
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- //AppMgr.transam.send(new ReqLogin(u, p, time, alive))
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/ae/30296b52560d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/ae/30296b52560d00131719b896d543f08c
deleted file mode 100644
index 8bb336e..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/ae/30296b52560d00131719b896d543f08c
+++ /dev/null
@@ -1,47 +0,0 @@
-package com.macaroon.piztor;
-
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-
-public class Main extends PiztorAct {
-
- ActMgr actMgr;
-
- Handler handler = new Handler() {
- @Override
- public void handleMessage(Message m) {
- Location l = (Location) m.obj;
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- };
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(handler);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/ae/c0defd575a0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/ae/c0defd575a0d00131719b896d543f08c
deleted file mode 100644
index 3c46136..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/ae/c0defd575a0d00131719b896d543f08c
+++ /dev/null
@@ -1,68 +0,0 @@
-package com.macaroon.piztor;
-
-import android.content.Context;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import android.location.Location;
-import android.content.Context;
-import android.os.Handler;
-import android.os.Message;
-import android.util.Log;
-import android.os.SystemClock;
-
-
-public class Tracker implements Runnable {
-
- private static final long TIME_DELTA = 1000 * 3; // 3 second
- public Timer timer;
- private final Context mContext;
- GPSTracker myTracker;
- Handler mHandler;
- Message message;
-
- public Tracker(Context context, Handler yHandler) {
- timer = new Timer();
- mContext = context;
- myTracker = new GPSTracker(mContext);
- mHandler = yHandler;
- }
-
- void setHandler(Handler hand) {
- mHandler = hand;
- }
-
-
- public void run() {
- GPSTask myTask = new GPSTask();
- timer.schedule(myTask, 0, TIME_DELTA);
- }
-
- class GPSTask extends TimerTask {
- @Override
- public void run() {
- Location location = myTracker.getLocation();
- Log.d("Location", "Fetching location.....");
- if (myTracker.canGetLocation()) {
-
-// Log.d("TTTTTTTTTTTTTTTTTTTTTTTime","TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTime");
-// System.out.println("GPSTIME" + myTracker.location.getTime());
-// System.out.println("SYSTIME" + SystemClock.elapsedRealtime());
-
- message = new Message();
- message.what = 0;
- message.obj = location;
- if(myTracker.isGPSFix()) {
- message.what = 1;
- } else {
- message.what = 2;
- }
- mHandler.sendMessage(message);
- } else {
- message = new Message();
- message.what = 0;
- mHandler.sendMessage(message);
- }
- }
- }
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/af/30d4b2674e0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/af/30d4b2674e0d00131719b896d543f08c
deleted file mode 100644
index 1f986ed..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/af/30d4b2674e0d00131719b896d543f08c
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.macaroon.piztor"
- android:versionCode="1"
- android:versionName="1.0" >
-
- <uses-sdk
- android:minSdkVersion="8"
- android:targetSdkVersion="17" />
-
- <application
- android:allowBackup="true"
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name"
- android:theme="@style/AppTheme" >
- <activity
- android:name="com.macaroon.piztor.InitAct"
- android:label="@string/app_name" >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
-
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- <activity
- android:name="com.macaroon.piztor.Login"
- android:label="@string/title_activity_login" >
- </activity>
- <activity
- android:name="com.macaroon.piztor.Main"
- android:label="@string/title_activity_main" >
- </activity>
- </application>
- <uses-permission android:name="android.permission.INTERNET"/>
-</manifest>
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/b0/7084ef6a550d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/b0/7084ef6a550d00131719b896d543f08c
deleted file mode 100644
index 064b504..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/b0/7084ef6a550d00131719b896d543f08c
+++ /dev/null
@@ -1,241 +0,0 @@
-package com.macaroon.piztor;
-
-import android.app.AlertDialog;
-import android.app.Service;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.location.Location;
-import android.location.LocationListener;
-import android.location.LocationManager;
-import android.location.GpsStatus;
-import android.os.Bundle;
-import android.os.IBinder;
-import android.os.SystemClock;
-import android.provider.Settings;
-import android.util.Log;
-
-public class GPSTracker extends Service implements LocationListener, GpsStatus.Listener {
-
- private final Context mContext;
-
- // flag for GPS status
- boolean isGPSEnabled = false;
-
- // flag for network status
- boolean isNetworkEnabled = false;
-
- // flag for GPS status
- boolean canGetLocation = false;
-
- Location location; // location
- double latitude; // latitude
- double longitude; // longitude
-
- // The minimum distance to change Updates in meters
- private static final long MIN_DISTANCE_CHANGE_FOR_UPDATES = 10; // 10 meters
-
- // The minimum time between updates in milliseconds
- private static final long MIN_TIME_BW_UPDATES = 1000 * 3; // 10 seconds
-
- // Declaring a Location Manager
- protected LocationManager locationManager;
-
- // for GPS satellite status listener
- Location mLastLocation;
- long mLastLocationMillis;
- boolean isGPSFix;
-
-
- public GPSTracker(Context context) {
- this.mContext = context;
- isGPSFix = false;
- getLocation();
- }
-
- public Location getLocation() {
- try {
- Log.d("getLocation", "Start getting location......");
-
- locationManager = (LocationManager) mContext
- .getSystemService(LOCATION_SERVICE);
-
- // getting GPS status
- isGPSEnabled = locationManager
- .isProviderEnabled(LocationManager.GPS_PROVIDER);
-
- // getting network status
- isNetworkEnabled = locationManager
- .isProviderEnabled(LocationManager.NETWORK_PROVIDER);
-
- if (!isGPSEnabled) {
- // no network provider is enabled
- } else {
- this.canGetLocation = true;
- if (isNetworkEnabled) {
- locationManager.requestLocationUpdates(
- LocationManager.NETWORK_PROVIDER,
- MIN_TIME_BW_UPDATES,
- MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
-
- Log.d("Network", "Network Updated");
-
- if (locationManager != null) {
- location = locationManager
- .getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
- if (location != null) {
- latitude = location.getLatitude();
- longitude = location.getLongitude();
-
- Log.d("Network", "Received Network Data");
- System.out.println("***From Network: "+latitude + " " + longitude);
- }
- }
- }// end of network section
- // if GPS Enabled get lat/long using GPS Services
- if (isGPSEnabled) {
- if (true) {
- locationManager.requestLocationUpdates(
- LocationManager.GPS_PROVIDER,
- MIN_TIME_BW_UPDATES,
- MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
- Log.d("GPS", "GPS Updated");
- if (locationManager != null) {
- location = locationManager
- .getLastKnownLocation(LocationManager.GPS_PROVIDER);
- if (location != null) {
- latitude = location.getLatitude();
- longitude = location.getLongitude();
-
- Log.d("GPS", "Received GPS Data");
- System.out.println("***From GPS: "+latitude + " " + longitude);
-
- }
- }
- }
- }// end of GPS section
- }// end of fetching data
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- return location;
- }
-
- /**
- * Stop using GPS listener Calling this function will stop using GPS in your
- * app
- * */
- public void stopUsingGPS() {
- if (locationManager != null) {
- locationManager.removeUpdates(GPSTracker.this);
- }
- }
-
- /**
- * Function to get latitude
- * */
- public double getLatitude() {
- if (location != null) {
- latitude = location.getLatitude();
- }
- return latitude;
- }
-
- /**
- * Function to get longitude
- * */
- public double getLongitude() {
- if (location != null) {
- longitude = location.getLongitude();
- }
- return longitude;
- }
-
- /**
- * Function to check GPS/wifi enabled
- *
- * @return boolean
- * */
- public boolean canGetLocation() {
- return this.canGetLocation;
- }
-
- public boolean isGPSFix() {
- return (this.isGPSFix && location != null);
- }
-
- /**
- * Function to show settings alert dialog On pressing Settings button will
- * lauch Settings Options
- * */
- public void showSettingsAlert() {
- AlertDialog.Builder alertDialog = new AlertDialog.Builder(mContext);
-
- // Setting Dialog Title
- alertDialog.setTitle("GPS is settings");
-
- // Setting Dialog Message
- alertDialog
- .setMessage("GPS is not enabled. Do you want to go to settings menu?");
-
- // On pressing Settings button
- alertDialog.setPositiveButton("Settings",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- Intent intent = new Intent(
- Settings.ACTION_LOCATION_SOURCE_SETTINGS);
- mContext.startActivity(intent);
- }
- });
-
- // on pressing cancel button
- alertDialog.setNegativeButton("Cancel",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- dialog.cancel();
- }
- });
-
- // Showing Alert Message
- alertDialog.show();
- }
-
- @Override
- public void onLocationChanged(Location location) {
- if (location == null) return;
- mLastLocationMillis = SystemClock.elapsedRealtime();
- mLastLocation = location;
- }
-
- @Override
- public void onProviderDisabled(String provider) {
- }
-
- @Override
- public void onProviderEnabled(String provider) {
- }
-
- @Override
- public void onStatusChanged(String provider, int status, Bundle extras) {
- }
-
- @Override
- public IBinder onBind(Intent arg0) {
- return null;
- }
-
- @Override
- public void onGpsStatusChanged(int event) {
- switch (event) {
- case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
- if(mLastLocation != null)
- isGPSFix = (SystemClock.elapsedRealtime() - mLastLocationMillis) < 3000;
- break;
-
- case GpsStatus.GPS_EVENT_FIRST_FIX:
- isGPSFix = true;
- break;
- }
- }
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/b0/c09fb905760d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/b0/c09fb905760d00131719b896d543f08c
deleted file mode 100644
index c50b159..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/b0/c09fb905760d00131719b896d543f08c
+++ /dev/null
@@ -1,171 +0,0 @@
-package com.macaroon.piztor;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- @SuppressLint("HandlerLeak")
- Handler fromGPS = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- Handler fromTransam = new Handler() {
- @Override
- public void handleMessage(Message m) {
- switch (m.what) {
- case 3:
- Vector<Rlocation> l =(Vector<Rlocation>) m.obj;
- for (int i = 0; i < n; i++) {
- System.out.println()
- }
- break;
-
- default:
- break;
- }
-
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "Search Button Press";
- case FetchButtonPress:
- return "Fetch Button Press";
- case FocuseButtonPress:
- return "Focuse Button Press";
- case SuccessFetch:
- return "Success Fetch";
- case FailedFetch:
- return "Failed Fetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- if (e == SuccessFetch) {
-
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter Fetch status!!!!");
- if (e == FetchButtonPress) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1,
- System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave fetch status!!!! because" + cause(e));
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter focus status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave focus status!!!! because" + cause(e));
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(fromGPS);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
- btnFetch.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(FetchButtonPress);
- }
- });
- btnFocus.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- actMgr.trigger(FocuseButtonPress);
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/b0/d04f2b58380d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/b0/d04f2b58380d00131249f322b63acde8
deleted file mode 100644
index a649f02..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/b0/d04f2b58380d00131249f322b63acde8
+++ /dev/null
@@ -1,99 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
-
-
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- int loginButtonClick = 1, retryButtonClick = 2, loginFailed = 3;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- } else if (m.what == 101) {
- actMgr.trigger(loginFailed);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
- }
-
- class LoginStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- String user = edtUser.getText().toString();
- String pass = edtPass.getText().toString();
- long nowtime = System.currentTimeMillis();
- AppMgr.transam.send(new ReqLogin(user, pass, nowtime, 1000));
- }
-
- @Override
- void leave(int e) {
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- ActStatus[] r = new ActStatus[2];
- r[0] = new StartStatus();
- r[1] = new LoginStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], loginButtonClick, r[1]);
- actMgr.add(r[1], loginFailed, r[0]);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- //AppMgr.transam.send(new ReqLogin(u, p, time, alive))
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/b2/00a1a652550d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/b2/00a1a652550d00131719b896d543f08c
deleted file mode 100644
index 18bdeae..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/b2/00a1a652550d00131719b896d543f08c
+++ /dev/null
@@ -1,240 +0,0 @@
-package com.macaroon.piztor;
-
-import android.app.AlertDialog;
-import android.app.Service;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.location.Location;
-import android.location.LocationListener;
-import android.location.LocationManager;
-import android.location.GpsStatus;
-import android.os.Bundle;
-import android.os.IBinder;
-import android.os.SystemClock;
-import android.provider.Settings;
-import android.util.Log;
-
-public class GPSTracker extends Service implements LocationListener, GpsStatus.Listener {
-
- private final Context mContext;
-
- // flag for GPS status
- boolean isGPSEnabled = false;
-
- // flag for network status
- boolean isNetworkEnabled = false;
-
- // flag for GPS status
- boolean canGetLocation = false;
-
- Location location; // location
- double latitude; // latitude
- double longitude; // longitude
-
- // The minimum distance to change Updates in meters
- private static final long MIN_DISTANCE_CHANGE_FOR_UPDATES = 10; // 10 meters
-
- // The minimum time between updates in milliseconds
- private static final long MIN_TIME_BW_UPDATES = 1000 * 3; // 10 seconds
-
- // Declaring a Location Manager
- protected LocationManager locationManager;
-
- // for GPS satellite status listener
- Location mLastLocation;
- long mLastLocationMillis;
- boolean isGPSFix;
-
-
- public GPSTracker(Context context) {
- this.mContext = context;
- isGPSFix = false;
- getLocation();
- }
-
- public Location getLocation() {
- try {
- Log.d("getLocation", "Start getting location......");
-
- locationManager = (LocationManager) mContext
- .getSystemService(LOCATION_SERVICE);
-
- // getting GPS status
- isGPSEnabled = locationManager
- .isProviderEnabled(LocationManager.GPS_PROVIDER);
-
- // getting network status
- isNetworkEnabled = locationManager
- .isProviderEnabled(LocationManager.NETWORK_PROVIDER);
-
- if (!isGPSEnabled) {
- // no network provider is enabled
- } else {
- this.canGetLocation = true;
- if (isNetworkEnabled) {
- locationManager.requestLocationUpdates(
- LocationManager.NETWORK_PROVIDER,
- MIN_TIME_BW_UPDATES,
- MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
-
- Log.d("Network", "Network Updated");
-
- if (locationManager != null) {
- location = locationManager
- .getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
- if (location != null) {
- latitude = location.getLatitude();
- longitude = location.getLongitude();
-
- Log.d("Network", "Received Network Data");
- System.out.println("***From Network: "+latitude + " " + longitude);
- }
- }
- }// end of network section
- // if GPS Enabled get lat/long using GPS Services
- if (isGPSEnabled) {
- if (true) {
- locationManager.requestLocationUpdates(
- LocationManager.GPS_PROVIDER,
- MIN_TIME_BW_UPDATES,
- MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
- Log.d("GPS", "GPS Updated");
- if (locationManager != null) {
- location = locationManager
- .getLastKnownLocation(LocationManager.GPS_PROVIDER);
- if (location != null) {
- latitude = location.getLatitude();
- longitude = location.getLongitude();
-
- Log.d("GPS", "Received GPS Data");
- System.out.println("***From GPS: "+latitude + " " + longitude);
-
- }
- }
- }
- }// end of GPS section
- }// end of fetching data
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Stop using GPS listener Calling this function will stop using GPS in your
- * app
- * */
- public void stopUsingGPS() {
- if (locationManager != null) {
- locationManager.removeUpdates(GPSTracker.this);
- }
- }
-
- /**
- * Function to get latitude
- * */
- public double getLatitude() {
- if (location != null) {
- latitude = location.getLatitude();
- }
- return latitude;
- }
-
- /**
- * Function to get longitude
- * */
- public double getLongitude() {
- if (location != null) {
- longitude = location.getLongitude();
- }
- return longitude;
- }
-
- /**
- * Function to check GPS/wifi enabled
- *
- * @return boolean
- * */
- public boolean canGetLocation() {
- return this.canGetLocation;
- }
-
- public boolean isGPSFix() {
- return (this.isGPSFix && location != null);
- }
-
- /**
- * Function to show settings alert dialog On pressing Settings button will
- * lauch Settings Options
- * */
- public void showSettingsAlert() {
- AlertDialog.Builder alertDialog = new AlertDialog.Builder(mContext);
-
- // Setting Dialog Title
- alertDialog.setTitle("GPS is settings");
-
- // Setting Dialog Message
- alertDialog
- .setMessage("GPS is not enabled. Do you want to go to settings menu?");
-
- // On pressing Settings button
- alertDialog.setPositiveButton("Settings",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- Intent intent = new Intent(
- Settings.ACTION_LOCATION_SOURCE_SETTINGS);
- mContext.startActivity(intent);
- }
- });
-
- // on pressing cancel button
- alertDialog.setNegativeButton("Cancel",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- dialog.cancel();
- }
- });
-
- // Showing Alert Message
- alertDialog.show();
- }
-
- @Override
- public void onLocationChanged(Location location) {
- if (location == null) return;
- mLastLocationMillis = SystemClock.elapsedRealtime();
- mLastLocation = location;
- }
-
- @Override
- public void onProviderDisabled(String provider) {
- }
-
- @Override
- public void onProviderEnabled(String provider) {
- }
-
- @Override
- public void onStatusChanged(String provider, int status, Bundle extras) {
- }
-
- @Override
- public IBinder onBind(Intent arg0) {
- return null;
- }
-
- @Override
- public void onGpsStatusChanged(int event) {
- switch (event) {
- case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
- if(mLastLocation != null)
- isGPSFix = (SystemClock.elapsedRealtime() - mLastLocationMillis) < 3000;
- break;
-
- case GpsStatus.GPS_EVENT_FIRST_FIX:
- isGPSFix = true;
- break;
- }
- }
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/b2/00b0df34260d00131a9bb9bc5a5e6171 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/b2/00b0df34260d00131a9bb9bc5a5e6171
deleted file mode 100644
index 5803683..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/b2/00b0df34260d00131a9bb9bc5a5e6171
+++ /dev/null
@@ -1,71 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
-
- //Event
-
- public enum Event {
- hasToken
- }
-
-
- static HashMap<Class<?>, HashMap<Event, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(Event event) {
-
- Intent i = new Intent();
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Event event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Event, Class<?>> h = new HashMap<Event, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, Event i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Event, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Event, Class<?>> h = new HashMap<Event, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Event, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Event, Class<?>>>();
- addStatus(InitAct.class);
- addStatus(Login.class);
-
-
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/b2/806ea1b54f0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/b2/806ea1b54f0d00131719b896d543f08c
deleted file mode 100644
index 7587807..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/b2/806ea1b54f0d00131719b896d543f08c
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
-
- <string name="app_name">piztor</string>
- <string name="action_settings">Settings</string>
- <string name="hello_world">Hello world!</string>
- <string name="settings">Settings</string>
- <string name="search">Search</string>
- <string name="fetch">Fetch</string>
- <string name="checkin">Checkin</string>
- <string name="focus">Focus</string>
- <string name="show_sex">Show sex: </string>
- <string name="male">Male</string>
- <string name="female">Female</string>
- <string name="show_team">Show team: </string>
- <string name="all">All</string>
- <string name="mine">Mine</string>
-
-</resources>
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/b2/a0011e00530d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/b2/a0011e00530d00131719b896d543f08c
deleted file mode 100644
index 8adf71f..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/b2/a0011e00530d00131719b896d543f08c
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.app.Activity;
-import android.view.Menu;
-
-public class Main extends PiztorAct {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/b3/005ecbdb800d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/b3/005ecbdb800d00131719b896d543f08c
deleted file mode 100644
index b4bddc4..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/b3/005ecbdb800d00131719b896d543f08c
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.Vector;
-
-public class Infomation {
- static String ip = "69.85.86.42";
- static int port = 9990;
- static int token = -1;
- static int myId = -1;
-
- class UserInfo {
- int id;
- double lat, lot;
- }
-
- class Group {
- int id;
- Vector<UserInfo> v;
- }
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/b5/d054deff370d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/b5/d054deff370d00131249f322b63acde8
deleted file mode 100644
index a79cbad..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/b5/d054deff370d00131249f322b63acde8
+++ /dev/null
@@ -1,96 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
-
-
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- int loginButtonClick = 1, retryButtonClick = 2, loginFailed = 3;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- } else if (m.what == 101) {
- actMgr.trigger(loginFailed);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
- }
-
- class LoginStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- String user = edtUser.getText().toString();
- String pass = edtPass.getText().toString();
- long nowtime = System.currentTimeMillis();
- AppMgr.transam.send(new ReqLogin(user, pass, nowtime, 1000));
- }
-
- @Override
- void leave(int e) {
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- //AppMgr.transam.send(new ReqLogin(u, p, time, alive))
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/b5/e0f38c9f260d00131a9bb9bc5a5e6171 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/b5/e0f38c9f260d00131a9bb9bc5a5e6171
deleted file mode 100644
index 33636d9..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/b5/e0f38c9f260d00131a9bb9bc5a5e6171
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.app.Activity;
-import android.view.Menu;
-
-public class InitAct extends Activity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_init);
- }
-
- @Override
- protected void onStart() {
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.init, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/b5/f0db4c2f390d00131524a793807f338e b/client/.metadata/.plugins/org.eclipse.core.resources/.history/b5/f0db4c2f390d00131524a793807f338e
deleted file mode 100644
index 01b87ff..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/b5/f0db4c2f390d00131524a793807f338e
+++ /dev/null
@@ -1,84 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-import android.os.Handler;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
- //TODO fix
- static Handler fromTransam, fromGPS;
- static Transam transam = null;
- static Thread tTransam, tGPS;
- //Event
-
- final static int noToken = 101;
- final static int loginSuccess = 102;
-
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
- Intent i = new Intent();
- System.out.println(nowAct.id + " : " + event);
- if (mp.get(nowAct.getClass()) == null)
- System.out.println("first");
- else if (mp.get(nowAct.getClass()) == null)
- System.out.println("second");
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- fromTransam = new Handler();
- transam = new Transam(UserInfo.ip, UserInfo.port, fromTransam);
- fromGPS = new Handler();
- tTransam = new Thread(transam);
- tTransam.run();
- addStatus(InitAct.class);
- addStatus(Login.class);
- addStatus(Main.class);
- addTransition(InitAct.class, noToken, Login.class);
- addTransition(Login.class, loginSuccess, Main.class);
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/b6/907c20d0330d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/b6/907c20d0330d00131249f322b63acde8
deleted file mode 100644
index 2821a56..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/b6/907c20d0330d00131249f322b63acde8
+++ /dev/null
@@ -1,58 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- Handler hand = new Handler() {
- @Override
- public boolean handleMessage(Message m) {
-
- }
- };
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/b7/00d0ee3f5a0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/b7/00d0ee3f5a0d00131719b896d543f08c
deleted file mode 100644
index 9e3ea68..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/b7/00d0ee3f5a0d00131719b896d543f08c
+++ /dev/null
@@ -1,104 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
-
-
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- int loginButtonClick = 1, retryButtonClick = 2, loginFailed = 3;
-
- static Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- System.out.println(m.what);
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- } else if (m.what == 101) {
- actMgr.trigger(loginFailed);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
- }
-
- class LoginStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- String user = edtUser.getText().toString();
- String pass = edtPass.getText().toString();
- long nowtime = System.currentTimeMillis();
- System.out.println(user + " : " + pass + "\n");
- AppMgr.transam.send(new ReqLogin(user, pass, nowtime, 1000));
- }
-
- @Override
- void leave(int e) {
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- ActStatus[] r = new ActStatus[2];
- AppMgr.transam.setHandler(hand);
- r[0] = new StartStatus();
- r[1] = new LoginStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], loginButtonClick, r[1]);
- actMgr.add(r[1], loginFailed, r[0]);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(loginButtonClick);
- }
- });
- }
-
- @Override
- protected void onResume() {
- super.onResume();
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/b7/7017f2e32d0d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/b7/7017f2e32d0d00131249f322b63acde8
deleted file mode 100644
index 74de717..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/b7/7017f2e32d0d00131249f322b63acde8
+++ /dev/null
@@ -1,74 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-import android.os.Handler;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
- //TODO fix
- static Handler callBack;
- //Event
-
- final static int noToken = 101;
-
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
- Intent i = new Intent();
- System.out.println(nowAct.id + " : " + event);
- if (mp.get(nowAct.getClass()) == null)
- System.out.println("first");
- else if (mp.get(nowAct.getClass()) == null)
- System.out.println("second");
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- addStatus(InitAct.class);
- addStatus(Login.class);
- addTransition(InitAct.class, noToken, Login.class);
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/b9/002a6f89770d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/b9/002a6f89770d00131719b896d543f08c
deleted file mode 100644
index e634232..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/b9/002a6f89770d00131719b896d543f08c
+++ /dev/null
@@ -1,178 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.Vector;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- @SuppressLint("HandlerLeak")
- Handler fromGPS = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- Handler fromTransam = new Handler() {
- @Override
- public void handleMessage(Message m) {
- switch (m.what) {
- case 3:
- ResLocation location = (ResLocation) m.obj;
- for (int i = 0; i < location.n; i++) {
- System.out.println(location.l.get(i).lat + " "
- + location.l.get(i).lot);
- }
- actMgr.trigger(SuccessFetch);
- break;
- case 2:
- ResUpdate update = (ResUpdate) m.obj;
- if (update.t == 0)
- System.out.println("update success");
- else
- System.out.println("update failed");
- break;
- default:
- actMgr.trigger(FailedFetch);
- }
-
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "Search Button Press";
- case FetchButtonPress:
- return "Fetch Button Press";
- case FocuseButtonPress:
- return "Focuse Button Press";
- case SuccessFetch:
- return "Success Fetch";
- case FailedFetch:
- return "Failed Fetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter Fetch status!!!!");
- if (e == FetchButtonPress) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1,
- System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave fetch status!!!! because" + cause(e));
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter focus status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave focus status!!!! because" + cause(e));
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(fromGPS);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
- btnFetch.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(FetchButtonPress);
- }
- });
- btnFocus.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- actMgr.trigger(FocuseButtonPress);
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/bd/90228f69800d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/bd/90228f69800d00131719b896d543f08c
deleted file mode 100644
index 631fe8e..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/bd/90228f69800d00131719b896d543f08c
+++ /dev/null
@@ -1,8 +0,0 @@
-package com.macaroon.piztor;
-
-public class Infomation {
- static String ip = "69.85.86.42";
- static int port = 9990;
- static int token = -1;
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/bf/a0e7485e390d00131524a793807f338e b/client/.metadata/.plugins/org.eclipse.core.resources/.history/bf/a0e7485e390d00131524a793807f338e
deleted file mode 100644
index 49e6552..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/bf/a0e7485e390d00131524a793807f338e
+++ /dev/null
@@ -1,84 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-import android.os.Handler;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
- //TODO fix
- static Handler fromTransam, fromGPS;
- static Transam transam = null;
- static Thread tTransam, tGPS;
- //Event
-
- final static int noToken = 101;
- final static int loginSuccess = 102;
-
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
- Intent i = new Intent();
- System.out.println(nowAct.id + " : " + event);
- if (mp.get(nowAct.getClass()) == null)
- System.out.println("first");
- else if (mp.get(nowAct.getClass()) == null)
- System.out.println("second");
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- fromTransam = new Handler();
- transam = new Transam(UserInfo.ip, UserInfo.port, fromTransam);
- //fromGPS = new Handler();
- tTransam = new Thread(transam);
- tTransam.run();
- addStatus(InitAct.class);
- addStatus(Login.class);
- addStatus(Main.class);
- addTransition(InitAct.class, noToken, Login.class);
- addTransition(Login.class, loginSuccess, Main.class);
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/bf/b07e9999380d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/bf/b07e9999380d00131249f322b63acde8
deleted file mode 100644
index 401f985..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/bf/b07e9999380d00131249f322b63acde8
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.macaroon.piztor;
-
-import android.content.Intent;
-import android.os.Bundle;
-import android.os.Handler;
-import android.view.Menu;
-
-public class InitAct extends PiztorAct {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "initAct";
- super.onCreate(savedInstanceState);
- AppMgr.init();
- setContentView(R.layout.activity_init);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- if (UserInfo.token != -1)
- AppMgr.trigger(AppMgr.noToken);
- else {
- //TODO jump to main
- }
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- getMenuInflater().inflate(R.menu.init, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/bf/c0281dde290d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/bf/c0281dde290d00131249f322b63acde8
deleted file mode 100644
index 6177eaf..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/bf/c0281dde290d00131249f322b63acde8
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.app.Activity;
-import android.view.Menu;
-
-public class InitAct extends PiztorAct {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- id = "initAct";
- AppMgr.init();
- setContentView(R.layout.activity_init);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
-
- AppMgr.trigger(AppMgr.hasToken);
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.init, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/c/20533453360d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/c/20533453360d00131249f322b63acde8
deleted file mode 100644
index 1308a5e..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/c/20533453360d00131249f322b63acde8
+++ /dev/null
@@ -1,72 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
-
-
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- int loginButtonClick = 1, retryButtonClick = 2, loginFailed = 3;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- } ;else (m.what == 101) {
- actMgr.trigger(loginFailed);
- }
- }
- };
-
-
-
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- //AppMgr.transam.send(new ReqLogin(u, p, time, alive))
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/c/c0b909df780d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/c/c0b909df780d00131719b896d543f08c
deleted file mode 100644
index 4df6bae..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/c/c0b909df780d00131719b896d543f08c
+++ /dev/null
@@ -1,62 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.*;
-
-import android.annotation.SuppressLint;
-
-@SuppressLint("UseSparseArrays")
-public class ActMgr {
- // event
- PiztorAct act;
- ActStatus nowStatus;
- HashMap<ActStatus, HashMap<Integer, ActStatus>> mp;
-
- ActMgr(PiztorAct act, ActStatus nowStatus, ActStatus[] r) {
- this.act = act;
- this.nowStatus = nowStatus;
- mp = new HashMap<ActStatus, HashMap<Integer, ActStatus>>();
- for (int i = 0; i < r.length; i++) {
- mp.put(r[i], new HashMap<Integer, ActStatus>());
- }
- }
-
- void trigger(int event) {
- System.out.println(act.id + " : " + event);
- if (mp.get(nowStatus).containsKey(event)) {
- nowStatus.leave(event);
- nowStatus = mp.get(nowStatus).get(event);
- nowStatus.enter(event);
- } else if (AppMgr.mp.get(act.getClass()).containsKey(event)) {
- AppMgr.trigger(event);
- }
- }
-
- void add(ActStatus a, int event, ActStatus b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, ActStatus> h = mp.get(a);
- h.put(event, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, ActStatus> h = new HashMap<Integer, ActStatus>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-}
-
-abstract class ActStatus {
- abstract void enter(int e);
-
- abstract void leave(int e);
-}
-
-class EmptyStatus extends ActStatus {
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/c1/70c31bc4770d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/c1/70c31bc4770d00131719b896d543f08c
deleted file mode 100644
index 94737ae..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/c1/70c31bc4770d00131719b896d543f08c
+++ /dev/null
@@ -1,180 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.Timer;
-import java.util.Vector;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- Timer autodate;
- @SuppressLint("HandlerLeak")
- Handler fromGPS = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- Handler fromTransam = new Handler() {
- @Override
- public void handleMessage(Message m) {
- switch (m.what) {
- case 3:
- ResLocation location = (ResLocation) m.obj;
- for (int i = 0; i < location.n; i++) {
- System.out.println(location.l.get(i).lat + " "
- + location.l.get(i).lot);
- }
- actMgr.trigger(SuccessFetch);
- break;
- case 2:
- ResUpdate update = (ResUpdate) m.obj;
- if (update.t == 0)
- System.out.println("update success");
- else
- System.out.println("update failed");
- break;
- default:
- break;
- }
-
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "Search Button Press";
- case FetchButtonPress:
- return "Fetch Button Press";
- case FocuseButtonPress:
- return "Focuse Button Press";
- case SuccessFetch:
- return "Success Fetch";
- case FailedFetch:
- return "Failed Fetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter Fetch status!!!!");
- if (e == FetchButtonPress) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1,
- System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave fetch status!!!! because" + cause(e));
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter focus status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave focus status!!!! because" + cause(e));
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(fromGPS);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
- btnFetch.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(FetchButtonPress);
- }
- });
- btnFocus.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- actMgr.trigger(FocuseButtonPress);
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/c1/90049d68370d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/c1/90049d68370d00131249f322b63acde8
deleted file mode 100644
index 27c94bf..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/c1/90049d68370d00131249f322b63acde8
+++ /dev/null
@@ -1,84 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
-
-
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- int loginButtonClick = 1, retryButtonClick = 2, loginFailed = 3;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- } else if (m.what == 101) {
- actMgr.trigger(loginFailed);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
-
- }
-
- @Override
- void leave(int e) {
- // TODO Auto-generated method stub
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- //AppMgr.transam.send(new ReqLogin(u, p, time, alive))
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/c2/305132042e0d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/c2/305132042e0d00131249f322b63acde8
deleted file mode 100644
index 1b7a948..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/c2/305132042e0d00131249f322b63acde8
+++ /dev/null
@@ -1,77 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-import android.os.Handler;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
- //TODO fix
- static Handler fromTransam, fromGPS;
- //Event
-
- final static int noToken = 101;
-
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
- Intent i = new Intent();
- System.out.println(nowAct.id + " : " + event);
- if (mp.get(nowAct.getClass()) == null)
- System.out.println("first");
- else if (mp.get(nowAct.getClass()) == null)
- System.out.println("second");
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- fromTransam = new Handler();
-
- fromGPS = new Handler();
- addStatus(InitAct.class);
- addStatus(Login.class);
- addTransition(InitAct.class, noToken, Login.class);
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/c2/905743582b0d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/c2/905743582b0d00131249f322b63acde8
deleted file mode 100644
index e4b1497..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/c2/905743582b0d00131249f322b63acde8
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.macaroon.piztor;
-
-//--------------------------------------//
-// Update Location //
-//--------------------------------------//
-
-public class ReqUpdate extends Req{
- double lat; //latitude
- double lot; //longitude
-
- ReqUpdate(int token,double latitude,double longitude,long time,long alive){
- super(2,token,time,alive); //for type 2
- lat = latitude;
- lot = longitude;
- }
-} \ No newline at end of file
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/c3/c02b54e56a0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/c3/c02b54e56a0d00131719b896d543f08c
deleted file mode 100644
index 5083cb4..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/c3/c02b54e56a0d00131719b896d543f08c
+++ /dev/null
@@ -1,137 +0,0 @@
-package com.macaroon.piztor;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- @SuppressLint("HandlerLeak")
- Handler handler = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- if (l == null)
- System.out.println("fuck!!!");
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "SearchButtonPress";
- case FetchButtonPress:
- return "FetchButtonPress";
- case FocuseButtonPress:
- return "FocuseButtonPress";
- case SuccessFetch:
- return "SuccessFetch";
- case FailedFetch:
- return "FailedFetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter Fetch status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave fetch status!!!! because" + cause(e));
-
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter focus status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave focus status!!!! because" + cause(e));
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(handler);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/c3/e083ea64370d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/c3/e083ea64370d00131249f322b63acde8
deleted file mode 100644
index a69306e..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/c3/e083ea64370d00131249f322b63acde8
+++ /dev/null
@@ -1,85 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
-
-
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- int loginButtonClick = 1, retryButtonClick = 2, loginFailed = 3;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- } else if (m.what == 101) {
- actMgr.trigger(loginFailed);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- void leave(int e) {
- // TODO Auto-generated method stub
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- //AppMgr.transam.send(new ReqLogin(u, p, time, alive))
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/c4/80454f67500d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/c4/80454f67500d00131719b896d543f08c
deleted file mode 100644
index 37e55a7..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/c4/80454f67500d00131719b896d543f08c
+++ /dev/null
@@ -1,92 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="fill_parent"
- android:background="@android:color/black"
- android:orientation="vertical">
-
-<LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:background="@android:color/black"
- android:gravity="center_horizontal"
- android:orientation="vertical" >
-
- <ImageView
- android:id="@+id/main_headbar_img"
- android:layout_width="180dp"
- android:layout_height="240dp"
- android:layout_gravity="center_horizontal"
- android:src="@drawable/title_logo" />
-
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:layout_gravity="center">
-
- <TableLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <TableRow
- android:layout_marginBottom="15dp"
- android:layout_marginTop="15dp">
- <TextView
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="0.25"
- android:gravity="right"
- android:id="@+id/user_id_text"
- android:text="User ID"
- android:textColor="@android:color/white"
- />
-
- <EditText
- android:layout_width="0dp"
- android:layout_weight="0.75"
- android:id="@+id/user_id"
- android:textColor="@android:color/black"
- android:singleLine="true"/>
- <requestFocus/>
- </TableRow>
-
- <TableRow>
- <TextView
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="0.25"
- android:gravity="right"
- android:id="@+id/user_pass_text"
- android:text="Password"
- android:textColor="@android:color/white"
- />
-
- <EditText
- android:layout_width="0dp"
- android:layout_weight="0.75"
- android:id="@+id/user_pass"
- android:password="true"
- android:textColor="@android:color/white"
- android:singleLine="true"/>
- </TableRow>
- </TableLayout>
- </LinearLayout>
-
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:orientation="vertical"
- >
- <Button
- android:id="@+id/login_btn_login"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:text="Login"
- android:textColor="@android:color/white" />
- </LinearLayout>
-
-</LinearLayout>
-</RelativeLayout>
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/c4/a02a68e4550d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/c4/a02a68e4550d00131719b896d543f08c
deleted file mode 100644
index 49b0b38..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/c4/a02a68e4550d00131719b896d543f08c
+++ /dev/null
@@ -1,66 +0,0 @@
-package com.macaroon.piztor;
-
-import android.content.Context;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import android.location.Location;
-import android.content.Context;
-import android.os.Handler;
-import android.os.Message;
-import android.util.Log;
-import android.os.SystemClock;
-
-
-public class Tracker implements Runnable {
-
- private static final long TIME_DELTA = 1000 * 3; // 3 second
- public Timer timer;
- private final Context mContext;
- GPSTracker myTracker;
- Handler mHandler;
- Message message;
-
- public Tracker(Context context, Handler yHandler) {
- timer = new Timer();
- mContext = context;
- myTracker = new GPSTracker(mContext);
- mHandler = yHandler;
- }
-
- void setHandler(Handler hand) {
- mHandler = hand;
- }
-
-
- public void run() {
- GPSTask myTask = new GPSTask();
- timer.schedule(myTask, 0, TIME_DELTA);
- }
-
- class GPSTask extends TimerTask {
- @Override
- public void run() {
- Location location = myTracker.getLocation();
- Log.d("Location", "Fetching location.....");
- if (myTracker.canGetLocation()) {
-
- Log.d("TTTTTTTTTTTTTTTTTTTTTTTime","TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTime");
- System.out.println("GPSTIME" + myTracker.location.getTime());
- System.out.println("SYSTIME" + SystemClock.elapsedRealtime());
-
- message = new Message();
- message.obj = location;
- if(myTracker.isGPSFix()) {
- message.what = 1;
- } else {
- message.what = 2;
- }
- mHandler.sendMessage(message);
- } else {
- message.what = 0;
- mHandler.sendMessage(message);
- }
- }
- }
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/c5/b0f3fcc27c0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/c5/b0f3fcc27c0d00131719b896d543f08c
deleted file mode 100644
index 94c1e0d..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/c5/b0f3fcc27c0d00131719b896d543f08c
+++ /dev/null
@@ -1,204 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.Vector;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- Timer autodate;
- @SuppressLint("HandlerLeak")
- Handler fromGPS = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- if (l == null)
- System.out.println("fuck!!!");
- else {
- ReqUpdate r = new ReqUpdate(UserInfo.token,
- l.getLatitude(), l.getLongitude(),
- System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- }
- };
-
- Handler fromTransam = new Handler() {
- @Override
- public void handleMessage(Message m) {
- switch (m.what) {
- case 3:
- ResLocation location = (ResLocation) m.obj;
- for (int i = 0; i < location.n; i++) {
- System.out.println(location.l.get(i).lat + " "
- + location.l.get(i).lot);
- }
- actMgr.trigger(SuccessFetch);
- break;
- case 2:
- ResUpdate update = (ResUpdate) m.obj;
- if (update.t == 0)
- System.out.println("update success");
- else
- System.out.println("update failed");
- break;
- default:
- break;
- }
-
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "Search Button Press";
- case FetchButtonPress:
- return "Fetch Button Press";
- case FocuseButtonPress:
- return "Focuse Button Press";
- case SuccessFetch:
- return "Success Fetch";
- case FailedFetch:
- return "Failed Fetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- if (e == TimerFlush) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1,
- System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter Fetch status!!!!");
- if (e == FetchButtonPress) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1,
- System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave fetch status!!!! because" + cause(e));
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter focus status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave focus status!!!! because" + cause(e));
-
- }
-
- }
-
- class AutoUpdate extends TimerTask {
-
- @Override
- public void run() {
- actMgr.trigger(Main.TimerFlush);
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(fromGPS);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[1], SuccessFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- actMgr.add(r[2], TimerFlush, r[2]);
- autodate = new Timer();
- AppMgr.transam.setHandler(fromTransam);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
- btnFetch.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(FetchButtonPress);
- }
- });
- btnFocus.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- actMgr.trigger(FocuseButtonPress);
- }
- });
- autodate.schedule(new AutoUpdate(), 0, 5000);
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/c8/b082216a2c0d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/c8/b082216a2c0d00131249f322b63acde8
deleted file mode 100644
index 2769127..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/c8/b082216a2c0d00131249f322b63acde8
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.app.Activity;
-import android.view.Menu;
-
-public class InitAct extends PiztorAct {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "initAct";
- super.onCreate(savedInstanceState);
- AppMgr.init();
- setContentView(R.layout.activity_init);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- if (UserInfo.token != -1)
- AppMgr.trigger(AppMgr.hasToken);
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- getMenuInflater().inflate(R.menu.init, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/c9/406dedec4e0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/c9/406dedec4e0d00131719b896d543f08c
deleted file mode 100644
index ebd1331..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/c9/406dedec4e0d00131719b896d543f08c
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.macaroon.piztor"
- android:versionCode="1"
- android:versionName="1.0" >
-
- <uses-sdk
- android:minSdkVersion="8"
- android:targetSdkVersion="17" />
-
- <application
- android:allowBackup="true"
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name"
- android:theme="@style/AppTheme" >
- <activity
- android:name="com.macaroon.piztor.InitAct"
- android:label="@string/app_name" >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
-
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- <activity
- android:name="com.macaroon.piztor.Login"
- android:label="@string/title_activity_login" >
- </activity>
- <activity
- android:name="com.macaroon.piztor.Main"
- android:label="@string/title_activity_main" >
- </activity>
- <activity
- android:name="com.macaroon.piztor.Setting"
- android:label="@string/title_activity_setting" >
- </activity>
- </application>
-
- <uses-permission android:name="android.permission.INTERNET" />
-
-</manifest>
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/ca/20f3b0b5340d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/ca/20f3b0b5340d00131249f322b63acde8
deleted file mode 100644
index bc3f8c2..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/ca/20f3b0b5340d00131249f322b63acde8
+++ /dev/null
@@ -1,62 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- }
- }
- };
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/ca/90266484690d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/ca/90266484690d00131719b896d543f08c
deleted file mode 100644
index 4689c27..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/ca/90266484690d00131719b896d543f08c
+++ /dev/null
@@ -1,114 +0,0 @@
-package com.macaroon.piztor;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- @SuppressLint("HandlerLeak")
- Handler handler = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- if (l == null)
- System.out.println("fuck!!!");
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- void leave(int e) {
- // TODO Auto-generated method stub
-
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- void leave(int e) {
- // TODO Auto-generated method stub
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(handler);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/ca/a02a83fc310d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/ca/a02a83fc310d00131249f322b63acde8
deleted file mode 100644
index 6250eae..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/ca/a02a83fc310d00131249f322b63acde8
+++ /dev/null
@@ -1,80 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-import android.os.Handler;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
- //TODO fix
- static Handler fromTransam, fromGPS;
- //Event
-
- final static int noToken = 101;
-
-
- static Transam transam = null;
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
- Intent i = new Intent();
- System.out.println(nowAct.id + " : " + event);
- if (mp.get(nowAct.getClass()) == null)
- System.out.println("first");
- else if (mp.get(nowAct.getClass()) == null)
- System.out.println("second");
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- fromTransam = new Handler();
- transam = new Transam(UserInfo.ip, UserInfo.port, fromTransam);
- fromGPS = new Handler();
- new Thread(transam).run();
- addStatus(InitAct.class);
- addStatus(Login.class);
- addTransition(InitAct.class, noToken, Login.class);
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/ca/d0283431550d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/ca/d0283431550d00131719b896d543f08c
deleted file mode 100644
index ff69271..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/ca/d0283431550d00131719b896d543f08c
+++ /dev/null
@@ -1,241 +0,0 @@
-package com.macaroon.piztor;
-
-import android.app.AlertDialog;
-import android.app.Service;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.location.Location;
-import android.location.LocationListener;
-import android.location.LocationManager;
-import android.location.GpsStatus;
-import android.os.Bundle;
-import android.os.IBinder;
-import android.os.SystemClock;
-import android.provider.Settings;
-import android.util.Log;
-
-public class GPSTracker extends Service implements LocationListener, GpsStatus.Listener {
-
- private final Context mContext;
-
- // flag for GPS status
- boolean isGPSEnabled = false;
-
- // flag for network status
- boolean isNetworkEnabled = false;
-
- // flag for GPS status
- boolean canGetLocation = false;
-
- Location location; // location
- double latitude; // latitude
- double longitude; // longitude
-
- // The minimum distance to change Updates in meters
- private static final long MIN_DISTANCE_CHANGE_FOR_UPDATES = 10; // 10 meters
-
- // The minimum time between updates in milliseconds
- private static final long MIN_TIME_BW_UPDATES = 1000 * 3; // 10 seconds
-
- // Declaring a Location Manager
- protected LocationManager locationManager;
-
- // for GPS satellite status listener
- Location mLastLocation;
- long mLastLocationMillis;
- boolean isGPSFix;
-
-
- public GPSTracker(Context context) {
- this.mContext = context;
- isGPSFix = false;
- getLocation();
- }
-
- public Locatio getLocation() {
- try {
-
- Log.d("getLocation",n "Start getting location......");
-
- locationManager = (LocationManager) mContext
- .getSystemService(LOCATION_SERVICE);
-
- // getting GPS status
- isGPSEnabled = locationManager
- .isProviderEnabled(LocationManager.GPS_PROVIDER);
-
- // getting network status
- isNetworkEnabled = locationManager
- .isProviderEnabled(LocationManager.NETWORK_PROVIDER);
-
- if (!isGPSEnabled) {
- // no network provider is enabled
- } else {
- this.canGetLocation = true;
- if (isNetworkEnabled) {
- locationManager.requestLocationUpdates(
- LocationManager.NETWORK_PROVIDER,
- MIN_TIME_BW_UPDATES,
- MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
-
- Log.d("Network", "Network Updated");
-
- if (locationManager != null) {
- location = locationManager
- .getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
- if (location != null) {
- latitude = location.getLatitude();
- longitude = location.getLongitude();
-
- Log.d("Network", "Received Network Data");
- System.out.println("***From Network: "+latitude + " " + longitude);
- }
- }
- }// end of network section
- // if GPS Enabled get lat/long using GPS Services
- if (isGPSEnabled) {
- if (true) {
- locationManager.requestLocationUpdates(
- LocationManager.GPS_PROVIDER,
- MIN_TIME_BW_UPDATES,
- MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
- Log.d("GPS", "GPS Updated");
- if (locationManager != null) {
- location = locationManager
- .getLastKnownLocation(LocationManager.GPS_PROVIDER);
- if (location != null) {
- latitude = location.getLatitude();
- longitude = location.getLongitude();
-
- Log.d("GPS", "Received GPS Data");
- System.out.println("***From GPS: "+latitude + " " + longitude);
-
- }
- }
- }
- }// end of GPS section
- }// end of fetching data
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Stop using GPS listener Calling this function will stop using GPS in your
- * app
- * */
- public void stopUsingGPS() {
- if (locationManager != null) {
- locationManager.removeUpdates(GPSTracker.this);
- }
- }
-
- /**
- * Function to get latitude
- * */
- public double getLatitude() {
- if (location != null) {
- latitude = location.getLatitude();
- }
- return latitude;
- }
-
- /**
- * Function to get longitude
- * */
- public double getLongitude() {
- if (location != null) {
- longitude = location.getLongitude();
- }
- return longitude;
- }
-
- /**
- * Function to check GPS/wifi enabled
- *
- * @return boolean
- * */
- public boolean canGetLocation() {
- return this.canGetLocation;
- }
-
- public boolean isGPSFix() {
- return (this.isGPSFix && location != null);
- }
-
- /**
- * Function to show settings alert dialog On pressing Settings button will
- * lauch Settings Options
- * */
- public void showSettingsAlert() {
- AlertDialog.Builder alertDialog = new AlertDialog.Builder(mContext);
-
- // Setting Dialog Title
- alertDialog.setTitle("GPS is settings");
-
- // Setting Dialog Message
- alertDialog
- .setMessage("GPS is not enabled. Do you want to go to settings menu?");
-
- // On pressing Settings button
- alertDialog.setPositiveButton("Settings",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- Intent intent = new Intent(
- Settings.ACTION_LOCATION_SOURCE_SETTINGS);
- mContext.startActivity(intent);
- }
- });
-
- // on pressing cancel button
- alertDialog.setNegativeButton("Cancel",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- dialog.cancel();
- }
- });
-
- // Showing Alert Message
- alertDialog.show();
- }
-
- @Override
- public void onLocationChanged(Location location) {
- if (location == null) return;
- mLastLocationMillis = SystemClock.elapsedRealtime();
- mLastLocation = location;
- }
-
- @Override
- public void onProviderDisabled(String provider) {
- }
-
- @Override
- public void onProviderEnabled(String provider) {
- }
-
- @Override
- public void onStatusChanged(String provider, int status, Bundle extras) {
- }
-
- @Override
- public IBinder onBind(Intent arg0) {
- return null;
- }
-
- @Override
- public void onGpsStatusChanged(int event) {
- switch (event) {
- case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
- if(mLastLocation != null)
- isGPSFix = (SystemClock.elapsedRealtime() - mLastLocationMillis) < 3000;
- break;
-
- case GpsStatus.GPS_EVENT_FIRST_FIX:
- isGPSFix = true;
- break;
- }
- }
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/cb/30fcab3d6b0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/cb/30fcab3d6b0d00131719b896d543f08c
deleted file mode 100644
index 8740d07..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/cb/30fcab3d6b0d00131719b896d543f08c
+++ /dev/null
@@ -1,137 +0,0 @@
-package com.macaroon.piztor;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- @SuppressLint("HandlerLeak")
- Handler handler = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- if (l == null)
- System.out.println("fuck!!!");
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "Search Button Press";
- case FetchButtonPress:
- return "Fetch Button Press";
- case FocuseButtonPress:
- return "Focuse Button Press";
- case SuccessFetch:
- return "Success Fetch";
- case FailedFetch:
- return "Failed Fetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter Fetch status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave fetch status!!!! because" + cause(e));
-
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter focus status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave focus status!!!! because" + cause(e));
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(handler);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/cc/30d547d6300d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/cc/30d547d6300d00131249f322b63acde8
deleted file mode 100644
index c31924d..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/cc/30d547d6300d00131249f322b63acde8
+++ /dev/null
@@ -1,132 +0,0 @@
-package com.macaroon.piztor;
-
-import java.io.IOException;
-import java.net.UnknownHostException;
-import java.util.LinkedList;
-import java.util.Queue;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import android.annotation.SuppressLint;
-import android.os.Handler;
-import android.os.Message;
-
-public class Transam implements Runnable {
- public Timer timer;
- public Timer mtimer;
- public boolean running = false;
- public boolean flag = true;
- public int cnt = 4;
- Res res;
- Req req;
- public int p; //port
- public String i; //ip
- Thread thread;
- Handler core;
- Handler recall; //recall
- Queue<Req> reqtask ; //request task
-
- Transam(String ip, int port,Handler Recall) {
- p = port;
- i = ip;
- recall = Recall;
- reqtask = new LinkedList<Req>();
- }
-
- public void send(Req r){
- reqtask.offer(r);
-
- }
-
- public void run() { //start the main timer
- //TimerTask tmain = new Timertk();
- //mtimer = new Timer();
- //mtimer.schedule(tmain, 100, 100); //check the queue for every 100 msec
-
- while(true){
- if(running == false){
-
- if(!reqtask.isEmpty()){ //poll the head request
- req = reqtask.poll();
- if(req.time + req.alive < System.currentTimeMillis()){ //time out!
- Message ret = new Message();
- ret.obj = "Time out!";
- ret.what = 100;
- recall.sendMessage(ret);
- }
- else{ //run the request
- final thd t = new thd();
- flag = false;
- thread = new Thread(t);
- cnt = 4;
- running = true;
- thread.start();
- timer = new Timer();
- TimerTask task = new Timertk();
- timer.schedule(task, 2000, 2000);
- }
- }
- }
- }
- }
-
- class tmain extends TimerTask {
- public void run() {
-
- }
- };
-
- class thd implements Runnable {
- public void run() {
- try {
- SocketClient client = new SocketClient(i,p);
- client.sendMsg(req,recall);
- Message msg = new Message();
- msg.what = 1;
- handler.sendMessage(msg);
- client.closeSocket();
- } catch (UnknownHostException e) {
- e.printStackTrace();
- System.out.println("UnknownHostException");
- } catch (IOException e) {
- e.printStackTrace();
- System.out.println("IOException");
- }
-
- }
- }
-
- @SuppressLint("HandlerLeak")
- Handler handler = new Handler() {
- public void handleMessage(Message msg) {
- switch (msg.what) {
- case 1:
- flag = true;
- break;
- case 2:
- final thd t = new thd();
- thread = new Thread(t);
- thread.start();
- break;
- }
- super.handleMessage(msg);
- }
- };
-
- class Timertk extends TimerTask {
- public void run() {
- if (flag == false && cnt > 0) {
- cnt--;
- } else if (cnt == 0) {
- Message msg = new Message();
- msg.obj = "connecting failed";
- msg.what = 101;
- recall.sendMessage(msg);
- timer.cancel();
- } else if (flag == true) {
- timer.cancel();
- running = false;
- }
- }
- };
-} \ No newline at end of file
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/cc/40540cea780d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/cc/40540cea780d00131719b896d543f08c
deleted file mode 100644
index 0df0ca4..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/cc/40540cea780d00131719b896d543f08c
+++ /dev/null
@@ -1,65 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.*;
-
-import android.annotation.SuppressLint;
-
-@SuppressLint("UseSparseArrays")
-public class ActMgr {
- // event
- PiztorAct act;
- ActStatus nowStatus;
- HashMap<ActStatus, HashMap<Integer, ActStatus>> mp;
-
- ActMgr(PiztorAct act, ActStatus nowStatus, ActStatus[] r) {
- this.act = act;
- this.nowStatus = nowStatus;
- mp = new HashMap<ActStatus, HashMap<Integer, ActStatus>>();
- for (int i = 0; i < r.length; i++) {
- mp.put(r[i], new HashMap<Integer, ActStatus>());
- }
- }
-
- void trigger(int event) {
- System.out.println(act.id + " : " + event);
- if (mp.get(nowStatus).containsKey(event)) {
- nowStatus.leave(event);
- nowStatus = mp.get(nowStatus).get(event);
- nowStatus.enter(event);
- } else if (AppMgr.mp.get(act.getClass()).containsKey(event)) {
- AppMgr.trigger(event);
- } else {
- System.out.println("can not trigger the event at " + act.id + " : "
- + event);
- }
- }
-
- void add(ActStatus a, int event, ActStatus b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, ActStatus> h = mp.get(a);
- h.put(event, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, ActStatus> h = new HashMap<Integer, ActStatus>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-}
-
-abstract class ActStatus {
- abstract void enter(int e);
-
- abstract void leave(int e);
-}
-
-class EmptyStatus extends ActStatus {
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/cc/a06019c6550d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/cc/a06019c6550d00131719b896d543f08c
deleted file mode 100644
index 3676f6b..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/cc/a06019c6550d00131719b896d543f08c
+++ /dev/null
@@ -1,66 +0,0 @@
-package com.macaroon.piztor;
-
-import android.content.Context;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import android.location.Location;
-import android.content.Context;
-import android.os.Handler;
-import android.os.Message;
-import android.util.Log;
-import android.os.SystemClock;
-
-
-public class Tracker implements Runnable {
-
- private static final long TIME_DELTA = 1000 * 3; // 3 second
- public Timer timer;
- private final Context mContext;
- GPSTracker myTracker;
- Handler mHandler;
- Message message;
-
- public Tracker(Context context, Handler yHandler) {
- timer = new Timer();
- mContext = context;
- myTracker = new GPSTracker(mContext);
- mHandler = yHandler;
- }
-
- void setHandler(Handler hand) {
- mHandler = hand;
- }
-
-
- public void run() {
- GPSTask myTask = new GPSTask();
- timer.schedule(myTask, 0, TIME_DELTA);
- }
-
- class GPSTask extends TimerTask {
- @Override
- public void run() {
- message = new Message();
- message.what = 0;
- Location location = myTracker.getLocation();
- Log.d("Location", "Fetching location.....");
- if (myTracker.canGetLocation()) {
-
- Log.d("TTTTTTTTTTTTTTTTTTTTTTTime","TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTime");
- System.out.println("GPSTIME" + myTracker.location.getTime());
- System.out.println("SYSTIME" + SystemClock.elapsedRealtime());
-
- if(myTracker.isGPSFix()) {
- message.what = 1;
- } else {
- message.what = 2;
- }
- mHandler.sendMessage(message);
- } else {
- message.what = 0;
- mHandler.sendMessage(message);
- }
- }
- }
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/cc/b0cf5a29320d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/cc/b0cf5a29320d00131249f322b63acde8
deleted file mode 100644
index f30d9b3..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/cc/b0cf5a29320d00131249f322b63acde8
+++ /dev/null
@@ -1,81 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-import android.os.Handler;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
- //TODO fix
- static Handler fromTransam, fromGPS;
- static Transam transam = null;
- static Thread tTransam, tGPS;
- //Event
-
- final static int noToken = 101;
-
-
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
- Intent i = new Intent();
- System.out.println(nowAct.id + " : " + event);
- if (mp.get(nowAct.getClass()) == null)
- System.out.println("first");
- else if (mp.get(nowAct.getClass()) == null)
- System.out.println("second");
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- fromTransam = new Handler();
- transam = new Transam(UserInfo.ip, UserInfo.port, fromTransam);
- fromGPS = new Handler();
- tTransam = new Thread(transam).run();
- addStatus(InitAct.class);
- addStatus(Login.class);
- addTransition(InitAct.class, noToken, Login.class);
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/cc/e0b44c18280d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/cc/e0b44c18280d00131249f322b63acde8
deleted file mode 100644
index b298e0c..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/cc/e0b44c18280d00131249f322b63acde8
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.app.Activity;
-import android.view.Menu;
-
-public class InitAct extends PiztorAct {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "initAct";
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_init);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- AppMgr.trigger(AppMgr.hasToken);
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.init, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/ce/400f0022790d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/ce/400f0022790d00131719b896d543f08c
deleted file mode 100644
index 0df0ca4..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/ce/400f0022790d00131719b896d543f08c
+++ /dev/null
@@ -1,65 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.*;
-
-import android.annotation.SuppressLint;
-
-@SuppressLint("UseSparseArrays")
-public class ActMgr {
- // event
- PiztorAct act;
- ActStatus nowStatus;
- HashMap<ActStatus, HashMap<Integer, ActStatus>> mp;
-
- ActMgr(PiztorAct act, ActStatus nowStatus, ActStatus[] r) {
- this.act = act;
- this.nowStatus = nowStatus;
- mp = new HashMap<ActStatus, HashMap<Integer, ActStatus>>();
- for (int i = 0; i < r.length; i++) {
- mp.put(r[i], new HashMap<Integer, ActStatus>());
- }
- }
-
- void trigger(int event) {
- System.out.println(act.id + " : " + event);
- if (mp.get(nowStatus).containsKey(event)) {
- nowStatus.leave(event);
- nowStatus = mp.get(nowStatus).get(event);
- nowStatus.enter(event);
- } else if (AppMgr.mp.get(act.getClass()).containsKey(event)) {
- AppMgr.trigger(event);
- } else {
- System.out.println("can not trigger the event at " + act.id + " : "
- + event);
- }
- }
-
- void add(ActStatus a, int event, ActStatus b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, ActStatus> h = mp.get(a);
- h.put(event, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, ActStatus> h = new HashMap<Integer, ActStatus>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-}
-
-abstract class ActStatus {
- abstract void enter(int e);
-
- abstract void leave(int e);
-}
-
-class EmptyStatus extends ActStatus {
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/cf/509df39b220d00131a9bb9bc5a5e6171 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/cf/509df39b220d00131a9bb9bc5a5e6171
deleted file mode 100644
index 0725982..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/cf/509df39b220d00131a9bb9bc5a5e6171
+++ /dev/null
@@ -1,5 +0,0 @@
-<resources>
-
- <string name="app_name">Piztor</string>
-
-</resources>
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/cf/80bdfc51360d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/cf/80bdfc51360d00131249f322b63acde8
deleted file mode 100644
index 12a937e..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/cf/80bdfc51360d00131249f322b63acde8
+++ /dev/null
@@ -1,72 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
-
-
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- int loginButtonClick = 1, retryButtonClick = 2, loginFailed = 3;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- } else (m.what == 101) {
- actMgr.trigger(loginFailed);
- }
- }
- };
-
-
-
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- //AppMgr.transam.send(new ReqLogin(u, p, time, alive))
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/cf/80e32f683a0d00131524a793807f338e b/client/.metadata/.plugins/org.eclipse.core.resources/.history/cf/80e32f683a0d00131524a793807f338e
deleted file mode 100644
index ef561b6..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/cf/80e32f683a0d00131524a793807f338e
+++ /dev/null
@@ -1,85 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-import android.os.Handler;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
- //TODO fix
- static Handler fromTransam, fromGPS;
- static Transam transam = null;
- static Thread tTransam, tGPS;
- //Event
-
- final static int noToken = 101;
- final static int loginSuccess = 102;
-
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
- Intent i = new Intent();
- System.out.println(nowAct.id + " : " + event);
- if (mp.get(nowAct.getClass()) == null)
- System.out.println("first");
- else if (mp.get(nowAct.getClass()) == null)
- System.out.println("second");
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- fromTransam = new Handler();
- transam = new Transam(UserInfo.ip, UserInfo.port, fromTransam);
- //fromGPS = new Handler();
- tTransam = new Thread(transam);
-// tTransam.run();
- System.out.println("!!!!!!");
- addStatus(InitAct.class);
- addStatus(Login.class);
- addStatus(Main.class);
- addTransition(InitAct.class, noToken, Login.class);
- addTransition(Login.class, loginSuccess, Main.class);
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/cf/b0399970330d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/cf/b0399970330d00131249f322b63acde8
deleted file mode 100644
index d6b9c4f..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/cf/b0399970330d00131249f322b63acde8
+++ /dev/null
@@ -1,48 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/d1/e0493fd6550d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/d1/e0493fd6550d00131719b896d543f08c
deleted file mode 100644
index 96a9ed1..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/d1/e0493fd6550d00131719b896d543f08c
+++ /dev/null
@@ -1,64 +0,0 @@
-package com.macaroon.piztor;
-
-import android.content.Context;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import android.location.Location;
-import android.content.Context;
-import android.os.Handler;
-import android.os.Message;
-import android.util.Log;
-import android.os.SystemClock;
-
-
-public class Tracker implements Runnable {
-
- private static final long TIME_DELTA = 1000 * 3; // 3 second
- public Timer timer;
- private final Context mContext;
- GPSTracker myTracker;
- Handler mHandler;
- Message message;
-
- public Tracker(Context context, Handler yHandler) {
- timer = new Timer();
- mContext = context;
- myTracker = new GPSTracker(mContext);
- mHandler = yHandler;
- }
-
- void setHandler(Handler hand) {
- mHandler = hand;
- }
-
-
- public void run() {
- GPSTask myTask = new GPSTask();
- timer.schedule(myTask, 0, TIME_DELTA);
- }
-
- class GPSTask extends TimerTask {
- @Override
- public void run() {
- Location location = myTracker.getLocation();
- Log.d("Location", "Fetching location.....");
- if (myTracker.canGetLocation()) {
-
- Log.d("TTTTTTTTTTTTTTTTTTTTTTTime","TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTime");
- System.out.println("GPSTIME" + myTracker.location.getTime());
- System.out.println("SYSTIME" + SystemClock.elapsedRealtime());
-
- if(myTracker.isGPSFix()) {
- message.what = 1;
- } else {
- message.what = 2;
- }
- mHandler.sendMessage(message);
- } else {
- message.what = 0;
- mHandler.sendMessage(message);
- }
- }
- }
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/d2/80c7346a770d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/d2/80c7346a770d00131719b896d543f08c
deleted file mode 100644
index 10cf824..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/d2/80c7346a770d00131719b896d543f08c
+++ /dev/null
@@ -1,181 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.Vector;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- @SuppressLint("HandlerLeak")
- Handler fromGPS = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- Handler fromTransam = new Handler() {
- @Override
- public void handleMessage(Message m) {
- switch (m.what) {
- case 3:
- ResLocation location = (ResLocation) m.obj;
- for (int i = 0; i < location.n; i++) {
- System.out.println(location.l.get(i).lat + " "
- + location.l.get(i).lot);
- }
- actMgr.trigger(SuccessFetch);
- break;
- case 2:
- ResUpdate update = (ResUpdate) m.obj;
- if (update.t == 0)
- System.out.println("update success");
- else
- System.out.println("update failed");
- break;
- default:
- actMgr.trigger(FailedFetch);
- }
-
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "Search Button Press";
- case FetchButtonPress:
- return "Fetch Button Press";
- case FocuseButtonPress:
- return "Focuse Button Press";
- case SuccessFetch:
- return "Success Fetch";
- case FailedFetch:
- return "Failed Fetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- if (e == SuccessFetch) {
-
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter Fetch status!!!!");
- if (e == FetchButtonPress) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1,
- System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave fetch status!!!! because" + cause(e));
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter focus status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave focus status!!!! because" + cause(e));
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(fromGPS);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
- btnFetch.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(FetchButtonPress);
- }
- });
- btnFocus.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- actMgr.trigger(FocuseButtonPress);
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/d3/d07246a16a0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/d3/d07246a16a0d00131719b896d543f08c
deleted file mode 100644
index ef0ed17..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/d3/d07246a16a0d00131719b896d543f08c
+++ /dev/null
@@ -1,128 +0,0 @@
-package com.macaroon.piztor;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- @SuppressLint("HandlerLeak")
- Handler handler = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- if (l == null)
- System.out.println("fuck!!!");
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "SearchButtonPress";
-
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!!");
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- void leave(int e) {
- // TODO Auto-generated method stub
-
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- void leave(int e) {
- // TODO Auto-generated method stub
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(handler);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/d4/b08e74497f0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/d4/b08e74497f0d00131719b896d543f08c
deleted file mode 100644
index 04be578..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/d4/b08e74497f0d00131719b896d543f08c
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.macaroon.piztor;
-
-public class UserInfo {
- static String ip = "69.85.86.42";
- static int port = 9990;
- static int token = -1;
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/d6/70651b8c4f0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/d6/70651b8c4f0d00131719b896d543f08c
deleted file mode 100644
index e5faf14..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/d6/70651b8c4f0d00131719b896d543f08c
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.macaroon.piztor"
- android:versionCode="1"
- android:versionName="1.0" >
-
- <uses-sdk
- android:minSdkVersion="8"
- android:targetSdkVersion="17" />
-
- <application
- android:allowBackup="true"
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name"
- android:theme="@style/AppTheme" >
- <activity
- android:name="com.macaroon.piztor.InitAct"
- android:label="@string/app_name" >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
-
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- <activity
- android:name="com.macaroon.piztor.Login"
- android:label="@string/title_activity_login" >
- </activity>
- <activity
- android:name="com.macaroon.piztor.Main"
- android:label="@string/title_activity_main" >
- </activity>
- <activity
- android:name="com.macaroon.piztor.Setting"
- android:label="@string/title_activity_setting" >
- </activity>
- </application>
-
- <uses-permission android:name="android.permission.INTERNET" />
- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
-
-</manifest>
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/d7/50a452ea310d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/d7/50a452ea310d00131249f322b63acde8
deleted file mode 100644
index d2eb5bd..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/d7/50a452ea310d00131249f322b63acde8
+++ /dev/null
@@ -1,80 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-import android.os.Handler;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
- //TODO fix
- static Handler fromTransam, fromGPS;
- //Event
-
- final static int noToken = 101;
-
-
- static Transam transam = null;
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
- Intent i = new Intent();
- System.out.println(nowAct.id + " : " + event);
- if (mp.get(nowAct.getClass()) == null)
- System.out.println("first");
- else if (mp.get(nowAct.getClass()) == null)
- System.out.println("second");
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- fromTransam = new Handler();
- fromGPS = new Handler();
-
- new Thread(transam).run();
- addStatus(InitAct.class);
- addStatus(Login.class);
- addTransition(InitAct.class, noToken, Login.class);
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/d7/50d6caf2240d00131a9bb9bc5a5e6171 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/d7/50d6caf2240d00131a9bb9bc5a5e6171
deleted file mode 100644
index 379817d..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/d7/50d6caf2240d00131a9bb9bc5a5e6171
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.macaroon.piztor"
- android:versionCode="1"
- android:versionName="1.0" >
-
- <uses-sdk
- android:minSdkVersion="8"
- android:targetSdkVersion="17" />
-
- <application
- android:allowBackup="true"
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name"
- android:theme="@style/AppTheme" >
- <activity
- android:name="com.macaroon.piztor.InitAct"
- android:label="@string/app_name" >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
-
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- </application>
-
-</manifest>
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/d8/90a207514b0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/d8/90a207514b0d00131719b896d543f08c
deleted file mode 100644
index 5742d39..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/d8/90a207514b0d00131719b896d543f08c
+++ /dev/null
@@ -1,101 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
-
-
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- int loginButtonClick = 1, retryButtonClick = 2, loginFailed = 3;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- } else if (m.what == 101) {
- actMgr.trigger(loginFailed);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
- }
-
- class LoginStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- String user = edtUser.getText().toString();
- String pass = edtPass.getText().toString();
- long nowtime = System.currentTimeMillis();
- System.out.println(user + " : " + pass + "\n");
- AppMgr.transam.send(new ReqLogin(user, pass, nowtime, 1000));
- }
-
- @Override
- void leave(int e) {
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- ActStatus[] r = new ActStatus[2];
- r[0] = new StartStatus();
- r[1] = new LoginStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], loginButtonClick, r[1]);
- actMgr.add(r[1], loginFailed, r[0]);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(loginButtonClick);
- }
- });
- }
-
- @Override
- protected void onResume() {
- super.onResume();
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/d8/f0ae11884d0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/d8/f0ae11884d0d00131719b896d543f08c
deleted file mode 100644
index 23a210b..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/d8/f0ae11884d0d00131719b896d543f08c
+++ /dev/null
@@ -1,16 +0,0 @@
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:paddingBottom="@dimen/activity_vertical_margin"
- android:paddingLeft="@dimen/activity_horizontal_margin"
- android:paddingRight="@dimen/activity_horizontal_margin"
- android:paddingTop="@dimen/activity_vertical_margin"
- tools:context=".Main" >
-
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/hello_world" />
-
-</RelativeLayout>
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/d9/b0831880280d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/d9/b0831880280d00131249f322b63acde8
deleted file mode 100644
index 997217f..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/d9/b0831880280d00131249f322b63acde8
+++ /dev/null
@@ -1,69 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
-
- //Event
-
- final static int hasToken = 101;
-
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
-
- Intent i = new Intent();
- System.out.println(event);
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- addStatus(InitAct.class);
- addStatus(Login.class);
- addTransition(InitAct.class, hasToken, Login.class);
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/d9/c0cdd6df780d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/d9/c0cdd6df780d00131719b896d543f08c
deleted file mode 100644
index 6b1c62a..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/d9/c0cdd6df780d00131719b896d543f08c
+++ /dev/null
@@ -1,64 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.*;
-
-import android.annotation.SuppressLint;
-
-@SuppressLint("UseSparseArrays")
-public class ActMgr {
- // event
- PiztorAct act;
- ActStatus nowStatus;
- HashMap<ActStatus, HashMap<Integer, ActStatus>> mp;
-
- ActMgr(PiztorAct act, ActStatus nowStatus, ActStatus[] r) {
- this.act = act;
- this.nowStatus = nowStatus;
- mp = new HashMap<ActStatus, HashMap<Integer, ActStatus>>();
- for (int i = 0; i < r.length; i++) {
- mp.put(r[i], new HashMap<Integer, ActStatus>());
- }
- }
-
- void trigger(int event) {
- System.out.println(act.id + " : " + event);
- if (mp.get(nowStatus).containsKey(event)) {
- nowStatus.leave(event);
- nowStatus = mp.get(nowStatus).get(event);
- nowStatus.enter(event);
- } else if (AppMgr.mp.get(act.getClass()).containsKey(event)) {
- AppMgr.trigger(event);
- } else {
- System.out.println("can not trigger the event at " + act.id + " : " + event);
- }
- }
-
- void add(ActStatus a, int event, ActStatus b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, ActStatus> h = mp.get(a);
- h.put(event, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, ActStatus> h = new HashMap<Integer, ActStatus>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-}
-
-abstract class ActStatus {
- abstract void enter(int e);
-
- abstract void leave(int e);
-}
-
-class EmptyStatus extends ActStatus {
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/da/b0c3a5433d0d00131524a793807f338e b/client/.metadata/.plugins/org.eclipse.core.resources/.history/da/b0c3a5433d0d00131524a793807f338e
deleted file mode 100644
index edb3968..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/da/b0c3a5433d0d00131524a793807f338e
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.macaroon.piztor"
- android:versionCode="1"
- android:versionName="1.0" >
-
- <uses-sdk
- android:minSdkVersion="8"
- android:targetSdkVersion="17" />
-
- <application
- android:allowBackup="true"
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name"
- android:theme="@style/AppTheme" >
- <activity
- android:name="com.macaroon.piztor.InitAct"
- android:label="@string/app_name" >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
-
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- <activity
- android:name="com.macaroon.piztor.Login"
- android:label="@string/title_activity_login" >
- </activity>
- <activity
- android:name="com.macaroon.piztor.Main"
- android:label="@string/title_activity_main" >
- </activity>
- </application>
-
-</manifest>
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/db/50df9b974b0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/db/50df9b974b0d00131719b896d543f08c
deleted file mode 100644
index e007692..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/db/50df9b974b0d00131719b896d543f08c
+++ /dev/null
@@ -1,63 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.*;
-
-import android.annotation.SuppressLint;
-
-@SuppressLint("UseSparseArrays")
-public class ActMgr {
- // event
- PiztorAct act;
- ActStatus nowStatus;
- HashMap<ActStatus, HashMap<Integer, ActStatus>> mp;
-
- ActMgr(PiztorAct act, ActStatus nowStatus, ActStatus[] r) {
- this.act = act;
- this.nowStatus = nowStatus;
- mp = new HashMap<ActStatus, HashMap<Integer, ActStatus>>();
- for (int i = 0; i < r.length; i++) {
- mp.put(r[i], new HashMap<Integer, ActStatus>());
- }
- }
-
- void trigger(int event) {
- // for (Integer i : mp.get(nowStatus).keySet())
- // System.out.println(i);
- if (mp.get(nowStatus).containsKey(event)) {
- nowStatus.leave(event);
- nowStatus = mp.get(nowStatus).get(event);
- nowStatus.enter(event);
- } else if (AppMgr.mp.get(act.getClass()).containsKey(event)) {
- AppMgr.trigger(event);
- }
- }
-
- void add(ActStatus a, int event, ActStatus b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, ActStatus> h = mp.get(a);
- h.put(event, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, ActStatus> h = new HashMap<Integer, ActStatus>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-}
-
-abstract class ActStatus {
- abstract void enter(int e);
-
- abstract void leave(int e);
-}
-
-class EmptyStatus extends ActStatus {
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/dd/600b7a0f780d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/dd/600b7a0f780d00131719b896d543f08c
deleted file mode 100644
index aec589a..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/dd/600b7a0f780d00131719b896d543f08c
+++ /dev/null
@@ -1,192 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.Vector;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- Timer autodate;
- @SuppressLint("HandlerLeak")
- Handler fromGPS = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- Handler fromTransam = new Handler() {
- @Override
- public void handleMessage(Message m) {
- switch (m.what) {
- case 3:
- ResLocation location = (ResLocation) m.obj;
- for (int i = 0; i < location.n; i++) {
- System.out.println(location.l.get(i).lat + " "
- + location.l.get(i).lot);
- }
- actMgr.trigger(SuccessFetch);
- break;
- case 2:
- ResUpdate update = (ResUpdate) m.obj;
- if (update.t == 0)
- System.out.println("update success");
- else
- System.out.println("update failed");
- break;
- default:
- break;
- }
-
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "Search Button Press";
- case FetchButtonPress:
- return "Fetch Button Press";
- case FocuseButtonPress:
- return "Focuse Button Press";
- case SuccessFetch:
- return "Success Fetch";
- case FailedFetch:
- return "Failed Fetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter Fetch status!!!!");
- if (e == FetchButtonPress) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1,
- System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave fetch status!!!! because" + cause(e));
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter focus status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave focus status!!!! because" + cause(e));
-
- }
-
- }
-
- class AutoUpdate extends TimerTask {
-
- @Override
- public void run() {
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(fromGPS);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- autodate = new Timer();
-
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
- btnFetch.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(FetchButtonPress);
- }
- });
- btnFocus.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- actMgr.trigger(FocuseButtonPress);
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/dd/c0b636965b0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/dd/c0b636965b0d00131719b896d543f08c
deleted file mode 100644
index 0e48f46..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/dd/c0b636965b0d00131719b896d543f08c
+++ /dev/null
@@ -1,106 +0,0 @@
-package com.macaroon.piztor;
-
-import android.annotation.SuppressLint;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
-
-
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- int loginButtonClick = 1, retryButtonClick = 2, loginFailed = 3;
-
- @SuppressLint("HandlerLeak")
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- System.out.println(m.what);
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- } else if (m.what == 101) {
- actMgr.trigger(loginFailed);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
- }
-
- class LoginStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- String user = edtUser.getText().toString();
- String pass = edtPass.getText().toString();
- long nowtime = System.currentTimeMillis();
- System.out.println(user + " : " + pass + "\n");
- AppMgr.transam.send(new ReqLogin(user, pass, nowtime, 1000));
- }
-
- @Override
- void leave(int e) {
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- ActStatus[] r = new ActStatus[2];
- AppMgr.transam.setHandler(hand);
- r[0] = new StartStatus();
- r[1] = new LoginStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], loginButtonClick, r[1]);
- actMgr.add(r[1], loginFailed, r[0]);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(loginButtonClick);
- }
- });
- }
-
- @Override
- protected void onResume() {
- super.onResume();
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/de/20eb032c3c0d00131524a793807f338e b/client/.metadata/.plugins/org.eclipse.core.resources/.history/de/20eb032c3c0d00131524a793807f338e
deleted file mode 100644
index 005b0e7..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/de/20eb032c3c0d00131524a793807f338e
+++ /dev/null
@@ -1,100 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
-
-
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- int loginButtonClick = 1, retryButtonClick = 2, loginFailed = 3;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- } else if (m.what == 101) {
- actMgr.trigger(loginFailed);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
- }
-
- class LoginStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- String user = edtUser.getText().toString();
- String pass = edtPass.getText().toString();
- long nowtime = System.currentTimeMillis();
- AppMgr.transam.send(new ReqLogin(user, pass, nowtime, 1000));
- }
-
- @Override
- void leave(int e) {
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- ActStatus[] r = new ActStatus[2];
- r[0] = new StartStatus();
- r[1] = new LoginStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], loginButtonClick, r[1]);
- actMgr.add(r[1], loginFailed, r[0]);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(loginButtonClick);
- }
- });
- }
-
- @Override
- protected void onResume() {
- super.onResume();
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/de/a03d00d2760d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/de/a03d00d2760d00131719b896d543f08c
deleted file mode 100644
index be5fc0f..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/de/a03d00d2760d00131719b896d543f08c
+++ /dev/null
@@ -1,177 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.Vector;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- @SuppressLint("HandlerLeak")
- Handler fromGPS = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- Handler fromTransam = new Handler() {
- @Override
- public void handleMessage(Message m) {
- switch (m.what) {
- case 3:
- ResLocation location = (ResLocation) m.obj;
- for (int i = 0; i < location.n; i++) {
- System.out.println(location.l.get(i).lat + " " + location.l.get(i).lot);
- }
- actMgr.trigger(SuccessFetch);
- break;
- case 2:
- ResUpdate update = (ResUpdate) m.obj;
- if (update.t == 0) System.out.println();
- break;
- default:
- break;
- }
-
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "Search Button Press";
- case FetchButtonPress:
- return "Fetch Button Press";
- case FocuseButtonPress:
- return "Focuse Button Press";
- case SuccessFetch:
- return "Success Fetch";
- case FailedFetch:
- return "Failed Fetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- if (e == SuccessFetch) {
-
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter Fetch status!!!!");
- if (e == FetchButtonPress) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1,
- System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave fetch status!!!! because" + cause(e));
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter focus status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave focus status!!!! because" + cause(e));
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(fromGPS);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
- btnFetch.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(FetchButtonPress);
- }
- });
- btnFocus.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- actMgr.trigger(FocuseButtonPress);
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/de/f01bbbba310d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/de/f01bbbba310d00131249f322b63acde8
deleted file mode 100644
index 76e7505..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/de/f01bbbba310d00131249f322b63acde8
+++ /dev/null
@@ -1,79 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-import android.os.Handler;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
- //TODO fix
- static Handler fromTransam, fromGPS;
- //Event
-
- final static int noToken = 101;
-
-
- static Transam transam = null;
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
- Intent i = new Intent();
- System.out.println(nowAct.id + " : " + event);
- if (mp.get(nowAct.getClass()) == null)
- System.out.println("first");
- else if (mp.get(nowAct.getClass()) == null)
- System.out.println("second");
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- fromTransam = new Handler();
- fromGPS = new Handler();
- new Thread(transam).run();
- addStatus(InitAct.class);
- addStatus(Login.class);
- addTransition(InitAct.class, noToken, Login.class);
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/df/406bf637390d00131524a793807f338e b/client/.metadata/.plugins/org.eclipse.core.resources/.history/df/406bf637390d00131524a793807f338e
deleted file mode 100644
index 4563127..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/df/406bf637390d00131524a793807f338e
+++ /dev/null
@@ -1,84 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-import android.os.Handler;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
- //TODO fix
- static Handler fromTransam, fromGPS;
- static Transam transam = null;
- static Thread tTransam, tGPS;
- //Event
-
- final static int noToken = 101;
- final static int loginSuccess = 102;
-
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
- Intent i = new Intent();
- System.out.println(nowAct.id + " : " + event);
- if (mp.get(nowAct.getClass()) == null)
- System.out.println("first");
- else if (mp.get(nowAct.getClass()) == null)
- System.out.println("second");
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
-// fromTransam = new Handler();
- transam = new Transam(UserInfo.ip, UserInfo.port, fromTransam);
- //fromGPS = new Handler();
-// tTransam = new Thread(transam);
-// tTransam.run();
- addStatus(InitAct.class);
- addStatus(Login.class);
- addStatus(Main.class);
- addTransition(InitAct.class, noToken, Login.class);
- addTransition(Login.class, loginSuccess, Main.class);
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/e/d06a5fb7520d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/e/d06a5fb7520d00131719b896d543f08c
deleted file mode 100644
index 62c7a40..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/e/d06a5fb7520d00131719b896d543f08c
+++ /dev/null
@@ -1,241 +0,0 @@
-package com.macaroon.piztor;
-
-import android.app.AlertDialog;
-import android.app.Service;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.location.Location;
-import android.location.LocationListener;
-import android.location.LocationManager;
-import android.location.GpsStatus;
-import android.os.Bundle;
-import android.os.IBinder;
-import android.os.SystemClock;
-import android.provider.Settings;
-import android.util.Log;
-
-public class GPSTracker extends Service implements LocationListener, GpsStatus.Listener {
-
- private final Context mContext;
-
- // flag for GPS status
- boolean isGPSEnabled = false;
-
- // flag for network status
- boolean isNetworkEnabled = false;
-
- // flag for GPS status
- boolean canGetLocation = false;
-
- Location location; // location
- double latitude; // latitude
- double longitude; // longitude
-
- // The minimum distance to change Updates in meters
- private static final long MIN_DISTANCE_CHANGE_FOR_UPDATES = 10; // 10 meters
-
- // The minimum time between updates in milliseconds
- private static final long MIN_TIME_BW_UPDATES = 1000 * 1; // 10 seconds
-
- // Declaring a Location Manager
- protected LocationManager locationManager;
-
- // for GPS satellite status listener
- Location mLastLocation;
- long mLastLocationMillis;
- boolean isGPSFix;
-
-
- public GPSTracker(Context context) {
- this.mContext = context;
- isGPSFix = false;
- getLocation();
- }
-
- public void getLocation() {
- try {
-
- Log.d("getLocation", "Start getting location......");
-
- locationManager = (LocationManager) mContext
- .getSystemService(LOCATION_SERVICE);
-
- // getting GPS status
- isGPSEnabled = locationManager
- .isProviderEnabled(LocationManager.GPS_PROVIDER);
-
- // getting network status
- isNetworkEnabled = locationManager
- .isProviderEnabled(LocationManager.NETWORK_PROVIDER);
-
- if (!isGPSEnabled) {
- // no network provider is enabled
- } else {
- this.canGetLocation = true;
- if (isNetworkEnabled) {
- locationManager.requestLocationUpdates(
- LocationManager.NETWORK_PROVIDER,
- MIN_TIME_BW_UPDATES,
- MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
-
- Log.d("Network", "Network Updated");
-
- if (locationManager != null) {
- location = locationManager
- .getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
- if (location != null) {
- latitude = location.getLatitude();
- longitude = location.getLongitude();
-
- Log.d("Network", "Received Network Data");
- System.out.println("***From Network: "+latitude + " " + longitude);
- }
- }
- }// end of network section
- // if GPS Enabled get lat/long using GPS Services
- if (isGPSEnabled) {
- if (true) {
- locationManager.requestLocationUpdates(
- LocationManager.GPS_PROVIDER,
- MIN_TIME_BW_UPDATES,
- MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
- Log.d("GPS", "GPS Updated");
- if (locationManager != null) {
- location = locationManager
- .getLastKnownLocation(LocationManager.GPS_PROVIDER);
- if (location != null) {
- latitude = location.getLatitude();
- longitude = location.getLongitude();
-
- Log.d("GPS", "Received GPS Data");
- System.out.println("***From GPS: "+latitude + " " + longitude);
-
- }
- }
- }
- }// end of GPS section
- }// end of fetching data
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Stop using GPS listener Calling this function will stop using GPS in your
- * app
- * */
- public void stopUsingGPS() {
- if (locationManager != null) {
- locationManager.removeUpdates(GPSTracker.this);
- }
- }
-
- /**
- * Function to get latitude
- * */
- public double getLatitude() {
- if (location != null) {
- latitude = location.getLatitude();
- }
- return latitude;
- }
-
- /**
- * Function to get longitude
- * */
- public double getLongitude() {
- if (location != null) {
- longitude = location.getLongitude();
- }
- return longitude;
- }
-
- /**
- * Function to check GPS/wifi enabled
- *
- * @return boolean
- * */
- public boolean canGetLocation() {
- return this.canGetLocation;
- }
-
- public boolean isGPSFix() {
- return (this.isGPSFix && location != null);
- }
-
- /**
- * Function to show settings alert dialog On pressing Settings button will
- * lauch Settings Options
- * */
- public void showSettingsAlert() {
- AlertDialog.Builder alertDialog = new AlertDialog.Builder(mContext);
-
- // Setting Dialog Title
- alertDialog.setTitle("GPS is settings");
-
- // Setting Dialog Message
- alertDialog
- .setMessage("GPS is not enabled. Do you want to go to settings menu?");
-
- // On pressing Settings button
- alertDialog.setPositiveButton("Settings",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- Intent intent = new Intent(
- Settings.ACTION_LOCATION_SOURCE_SETTINGS);
- mContext.startActivity(intent);
- }
- });
-
- // on pressing cancel button
- alertDialog.setNegativeButton("Cancel",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- dialog.cancel();
- }
- });
-
- // Showing Alert Message
- alertDialog.show();
- }
-
- @Override
- public void onLocationChanged(Location location) {
- if (location == null) return;
- mLastLocationMillis = SystemClock.elapsedRealtime();
- mLastLocation = location;
- }
-
- @Override
- public void onProviderDisabled(String provider) {
- }
-
- @Override
- public void onProviderEnabled(String provider) {
- }
-
- @Override
- public void onStatusChanged(String provider, int status, Bundle extras) {
- }
-
- @Override
- public IBinder onBind(Intent arg0) {
- return null;
- }
-
- @Override
- public void onGpsStatusChanged(int event) {
- switch (event) {
- case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
- if(mLastLocation != null)
- isGPSFix = (SystemClock.elapsedRealtime() - mLastLocationMillis) < 3000;
- break;
-
- case GpsStatus.GPS_EVENT_FIRST_FIX:
- isGPSFix = true;
- break;
- }
- }
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/e0/40e5bce9370d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/e0/40e5bce9370d00131249f322b63acde8
deleted file mode 100644
index b520b66..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/e0/40e5bce9370d00131249f322b63acde8
+++ /dev/null
@@ -1,98 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
-
-
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- int loginButtonClick = 1, retryButtonClick = 2, loginFailed = 3;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- } else if (m.what == 101) {
- actMgr.trigger(loginFailed);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
- }
-
- class LoginStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- String user = edtUser.getText().toString();
- String pass = edtPass.getText().toString();
- long nowtime = System.currentTimeMillis();
- AppMgr.transam.send(new ReqLogin(user, pass, ));
- }
-
- @Override
- void leave(int e) {
- // TODO Auto-generated method stub
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- //AppMgr.transam.send(new ReqLogin(u, p, time, alive))
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/e1/306f6f46360d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/e1/306f6f46360d00131249f322b63acde8
deleted file mode 100644
index 3a172b5..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/e1/306f6f46360d00131249f322b63acde8
+++ /dev/null
@@ -1,72 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
-
-
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- int loginButtonClick = 1, retryButtonClick = 2;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- } else (m.what == 101) {
-
- }
- }
- };
-
-
-
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- //AppMgr.transam.send(new ReqLogin(u, p, time, alive))
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/e1/9017fa5e2b0d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/e1/9017fa5e2b0d00131249f322b63acde8
deleted file mode 100644
index 000f373..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/e1/9017fa5e2b0d00131249f322b63acde8
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.macaroon.piztor;
-
-//--------------------------------------//
-// Ask Location //
-//--------------------------------------//
-
-public class ReqLocation extends Req{
- int gid; //group id;
-
- ReqLocation(int token,int groupid,long time,long alive){
- super(3,token,time,alive); //for type 3
- gid = groupid;
- }
-} \ No newline at end of file
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/e1/b01fa77a4e0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/e1/b01fa77a4e0d00131719b896d543f08c
deleted file mode 100644
index 94cfac8..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/e1/b01fa77a4e0d00131719b896d543f08c
+++ /dev/null
@@ -1,16 +0,0 @@
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:paddingBottom="@dimen/activity_vertical_margin"
- android:paddingLeft="@dimen/activity_horizontal_margin"
- android:paddingRight="@dimen/activity_horizontal_margin"
- android:paddingTop="@dimen/activity_vertical_margin"
- tools:context=".Setting" >
-
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/hello_world" />
-
-</RelativeLayout>
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/e4/005a5d292d0d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/e4/005a5d292d0d00131249f322b63acde8
deleted file mode 100644
index bd0b952..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/e4/005a5d292d0d00131249f322b63acde8
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.app.Activity;
-import android.view.Menu;
-
-public class InitAct extends PiztorAct {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "initAct";
- super.onCreate(savedInstanceState);
- AppMgr.init();
- setContentView(R.layout.activity_init);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- if (UserInfo.token != -1)
- AppMgr.trigger(AppMgr.noToken);
- else {
- //TODO jump to main
- }
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- getMenuInflater().inflate(R.menu.init, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/e4/4039c9d3330d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/e4/4039c9d3330d00131249f322b63acde8
deleted file mode 100644
index 831f4d7..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/e4/4039c9d3330d00131249f322b63acde8
+++ /dev/null
@@ -1,58 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
-
- }
- };
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/e4/d0880974550d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/e4/d0880974550d00131719b896d543f08c
deleted file mode 100644
index 55eb215..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/e4/d0880974550d00131719b896d543f08c
+++ /dev/null
@@ -1,68 +0,0 @@
-package com.macaroon.piztor;
-
-import android.content.Context;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import android.content.Context;
-import android.os.Handler;
-import android.os.Message;
-import android.util.Log;
-import android.os.SystemClock;
-
-
-public class Tracker implements Runnable {
-
- private static final long TIME_DELTA = 1000 * 3; // 3 second
- public Timer timer;
- private final Context mContext;
- GPSTracker myTracker;
- Handler mHandler;
- Message message;
-
- public Tracker(Context context, Handler yHandler) {
- timer = new Timer();
- mContext = context;
- myTracker = new GPSTracker(mContext);
- mHandler = yHandler;
- }
-
- void setHandler(Handler hand) {
- mHandler = hand;
- }
-
-
- public void run() {
- GPSTask myTask = new GPSTask();
- timer.schedule(myTask, 0, TIME_DELTA);
- }
-
- class GPSTask extends TimerTask {
- @Override
- public void run() {
- message = new Message();
- message.what = 0;
- myTracker.getLocation();
- Log.d("Location", "Fetching location.....");
- if (myTracker.canGetLocation()) {
- double latitude = myTracker.getLatitude();
- double longitude = myTracker.getLongitude();
-
-
- Log.d("TTTTTTTTTTTTTTTTTTTTTTTime","TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTime");
- System.out.println("GPSTIME" + myTracker.location.getTime());
- System.out.println("SYSTIME" + SystemClock.elapsedRealtime());
-
- if(myTracker.isGPSFix()) {
- message.what = 1;
- } else {
- message.what = 2;
- }
- mHandler.sendMessage(message);
- } else {
- message.what = 0;
- mHandler.sendMessage(message);
- }
- }
- }
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/e6/20fcf772310d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/e6/20fcf772310d00131249f322b63acde8
deleted file mode 100644
index 71c3ad0..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/e6/20fcf772310d00131249f322b63acde8
+++ /dev/null
@@ -1,133 +0,0 @@
-package com.macaroon.piztor;
-
-import java.io.IOException;
-import java.net.UnknownHostException;
-import java.util.LinkedList;
-import java.util.Queue;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import android.annotation.SuppressLint;
-import android.os.Handler;
-import android.os.Message;
-
-public class Transam implements Runnable {
- static Transam transam = null;
- public Timer timer;
- public Timer mtimer;
- public boolean running = false;
- public boolean flag = true;
- public int cnt = 4;
- Res res;
- Req req;
- public int p; //port
- public String i; //ip
- Thread thread;
- Handler core;
- Handler recall; //recall
- Queue<Req> reqtask ; //request task
-
- Transam(String ip, int port,Handler Recall) {
- p = port;
- i = ip;
- recall = Recall;
- reqtask = new LinkedList<Req>();
- }
-
- public void send(Req r){
- reqtask.offer(r);
-
- }
-
- public void run() { //start the main timer
- //TimerTask tmain = new Timertk();
- //mtimer = new Timer();
- //mtimer.schedule(tmain, 100, 100); //check the queue for every 100 msec
-
- while(true){
- if(running == false){
-
- if(!reqtask.isEmpty()){ //poll the head request
- req = reqtask.poll();
- if(req.time + req.alive < System.currentTimeMillis()){ //time out!
- Message ret = new Message();
- ret.obj = "Time out!";
- ret.what = 100;
- recall.sendMessage(ret);
- }
- else{ //run the request
- final thd t = new thd();
- flag = false;
- thread = new Thread(t);
- cnt = 4;
- running = true;
- thread.start();
- timer = new Timer();
- TimerTask task = new Timertk();
- timer.schedule(task, 2000, 2000);
- }
- }
- }
- }
- }
-
- class tmain extends TimerTask {
- public void run() {
-
- }
- };
-
- class thd implements Runnable {
- public void run() {
- try {
- SocketClient client = new SocketClient(i,p);
- client.sendMsg(req,recall);
- Message msg = new Message();
- msg.what = 1;
- handler.sendMessage(msg);
- client.closeSocket();
- } catch (UnknownHostException e) {
- e.printStackTrace();
- System.out.println("UnknownHostException");
- } catch (IOException e) {
- e.printStackTrace();
- System.out.println("IOException");
- }
-
- }
- }
-
- @SuppressLint("HandlerLeak")
- Handler handler = new Handler() {
- public void handleMessage(Message msg) {
- switch (msg.what) {
- case 1:
- flag = true;
- break;
- case 2:
- final thd t = new thd();
- thread = new Thread(t);
- thread.start();
- break;
- }
- super.handleMessage(msg);
- }
- };
-
- class Timertk extends TimerTask {
- public void run() {
- if (flag == false && cnt > 0) {
- cnt--;
- } else if (cnt == 0) {
- Message msg = new Message();
- msg.obj = "connecting failed";
- msg.what = 101;
- recall.sendMessage(msg);
- timer.cancel();
- } else if (flag == true) {
- timer.cancel();
- running = false;
- }
- }
- };
-} \ No newline at end of file
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/e7/00e5c3933a0d00131524a793807f338e b/client/.metadata/.plugins/org.eclipse.core.resources/.history/e7/00e5c3933a0d00131524a793807f338e
deleted file mode 100644
index e9712ce..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/e7/00e5c3933a0d00131524a793807f338e
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.app.Activity;
-import android.view.Menu;
-
-public class Main extends Activity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/e9/201bd58e370d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/e9/201bd58e370d00131249f322b63acde8
deleted file mode 100644
index 7ab3c03..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/e9/201bd58e370d00131249f322b63acde8
+++ /dev/null
@@ -1,95 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
-
-
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- int loginButtonClick = 1, retryButtonClick = 2, loginFailed = 3;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- } else if (m.what == 101) {
- actMgr.trigger(loginFailed);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
- }
-
- class LoginStatus extends ActStatus {
-
- @Override
- void enter(int e) {
-
- }
-
- @Override
- void leave(int e) {
- // TODO Auto-generated method stub
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- //AppMgr.transam.send(new ReqLogin(u, p, time, alive))
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/eb/0041c861520d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/eb/0041c861520d00131719b896d543f08c
deleted file mode 100644
index af1543b..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/eb/0041c861520d00131719b896d543f08c
+++ /dev/null
@@ -1,64 +0,0 @@
-package com.macaroon.piztor;
-
-import android.content.Context;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import android.content.Context;
-import android.os.Handler;
-import android.os.Message;
-import android.util.Log;
-import android.os.SystemClock;
-
-
-public class Tracker implements Runnable {
-
- private static final long TIME_DELTA = 1000 * 1; // 1 second
- public Timer timer;
- private final Context mContext;
- Controller controller;
- GPSTracker myTracker;
- Handler mHandler;
- Message message;
-
- public Tracker(Controller newController, Context context, Handler yHandler) {
- timer = new Timer();
- mContext = context;
- controller = newController;
- myTracker = new GPSTracker(mContext);
- mHandler = yHandler;
- }
-
- public void run() {
- GPSTask myTask = new GPSTask();
- timer.schedule(myTask, 0, TIME_DELTA);
- }
-
- class GPSTask extends TimerTask {
- @Override
- public void run() {
- message = new Message();
- message.what = 0;
- myTracker.getLocation();
- Log.d("Location", "Fetching location.....");
- if (myTracker.canGetLocation()) {
- double latitude = myTracker.getLatitude();
- double longitude = myTracker.getLongitude();
-
- Log.d("TTTTTTTTTTTTTTTTTTTTTTTime","TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTime");
- System.out.println("GPSTIME" + myTracker.location.getTime());
- System.out.println("SYSTIME" + SystemClock.elapsedRealtime());
-
- if(myTracker.isGPSFix()) {
- message.what = 1;
- } else {
- message.what = 2;
- }
- mHandler.sendMessage(message);
- } else {
- message.what = 0;
- mHandler.sendMessage(message);
- }
- }
- }
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/eb/50149cac330d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/eb/50149cac330d00131249f322b63acde8
deleted file mode 100644
index 4aa65b2..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/eb/50149cac330d00131249f322b63acde8
+++ /dev/null
@@ -1,54 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- Handler hand = new Handler() {
-
- };
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/eb/50fcb17a260d00131a9bb9bc5a5e6171 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/eb/50fcb17a260d00131a9bb9bc5a5e6171
deleted file mode 100644
index b652549..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/eb/50fcb17a260d00131a9bb9bc5a5e6171
+++ /dev/null
@@ -1,69 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
-
- //Event
-
- final static int hasToken = 1;
-
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
-
- Intent i = new Intent();
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- addStatus(InitAct.class);
- addStatus(Login.class);
- addTransition(InitAct.class, hasToken, Login.class);
-
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/ed/d0b50c637c0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/ed/d0b50c637c0d00131719b896d543f08c
deleted file mode 100644
index 1abca7b..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/ed/d0b50c637c0d00131719b896d543f08c
+++ /dev/null
@@ -1,203 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.Vector;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- Timer autodate;
- @SuppressLint("HandlerLeak")
- Handler fromGPS = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- if (l == null)
- System.out.println("fuck!!!");
- else {
- ReqUpdate r = new ReqUpdate(UserInfo.token,
- l.getLatitude(), l.getLongitude(),
- System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- }
- };
-
- Handler fromTransam = new Handler() {
- @Override
- public void handleMessage(Message m) {
- switch (m.what) {
- case 3:
- ResLocation location = (ResLocation) m.obj;
- for (int i = 0; i < location.n; i++) {
- System.out.println(location.l.get(i).lat + " "
- + location.l.get(i).lot);
- }
- actMgr.trigger(SuccessFetch);
- break;
- case 2:
- ResUpdate update = (ResUpdate) m.obj;
- if (update.t == 0)
- System.out.println("update success");
- else
- System.out.println("update failed");
- break;
- default:
- break;
- }
-
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "Search Button Press";
- case FetchButtonPress:
- return "Fetch Button Press";
- case FocuseButtonPress:
- return "Focuse Button Press";
- case SuccessFetch:
- return "Success Fetch";
- case FailedFetch:
- return "Failed Fetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- if (e == TimerFlush) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1,
- System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter Fetch status!!!!");
- if (e == FetchButtonPress) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1,
- System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave fetch status!!!! because" + cause(e));
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter focus status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave focus status!!!! because" + cause(e));
-
- }
-
- }
-
- class AutoUpdate extends TimerTask {
-
- @Override
- public void run() {
- actMgr.trigger(Main.TimerFlush);
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(fromGPS);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- actMgr.add(r[2], TimerFlush, r[2]);
- autodate = new Timer();
- AppMgr.transam.setHandler(fromTransam);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
- btnFetch.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(FetchButtonPress);
- }
- });
- btnFocus.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- actMgr.trigger(FocuseButtonPress);
- }
- });
- autodate.schedule(new AutoUpdate(), 0, 5000);
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/ee/800bef37290d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/ee/800bef37290d00131249f322b63acde8
deleted file mode 100644
index 4f58257..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/ee/800bef37290d00131249f322b63acde8
+++ /dev/null
@@ -1,73 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
-
- //Event
-
- final static int hasToken = 101;
-
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
-
- Intent i = new Intent();
- System.out.println(nowAct.id + " : " + event);
- if (mp.get(nowAct.getClass()) == null)
- System.out.println("first");
- else if (mp.get(nowAct.getClass()) == null)
- System.out.println("second");
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- addStatus(InitAct.class);
- addStatus(Login.class);
- addTransition(InitAct.class, hasToken, Login.class);
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/ee/8094037e770d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/ee/8094037e770d00131719b896d543f08c
deleted file mode 100644
index f0e8c6b..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/ee/8094037e770d00131719b896d543f08c
+++ /dev/null
@@ -1,181 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.Vector;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- @SuppressLint("HandlerLeak")
- Handler fromGPS = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- Handler fromTransam = new Handler() {
- @Override
- public void handleMessage(Message m) {
- switch (m.what) {
- case 3:
- ResLocation location = (ResLocation) m.obj;
- for (int i = 0; i < location.n; i++) {
- System.out.println(location.l.get(i).lat + " "
- + location.l.get(i).lot);
- }
- actMgr.trigger(SuccessFetch);
- break;
- case 2:
- ResUpdate update = (ResUpdate) m.obj;
- if (update.t == 0)
- System.out.println("update success");
- else
- System.out.println("update failed");
- break;
- default:
- actMgr.trigger(FailedFetch);
- }
-
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "Search Button Press";
- case FetchButtonPress:
- return "Fetch Button Press";
- case FocuseButtonPress:
- return "Focuse Button Press";
- case SuccessFetch:
- return "Success Fetch";
- case FailedFetch:
- return "Failed Fetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- if (e == SuccessFetch) {
-
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter Fetch status!!!!");
- if (e == FetchButtonPress) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1,
- System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave fetch status!!!! because" + cause(e));
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter focus status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave focus status!!!! because" + cause(e));
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(fromGPS);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
- btnFetch.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(FetchButtonPress);
- }
- });
- btnFocus.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- actMgr.trigger(FocuseButtonPress);
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/ee/e062b6d0520d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/ee/e062b6d0520d00131719b896d543f08c
deleted file mode 100644
index de79560..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/ee/e062b6d0520d00131719b896d543f08c
+++ /dev/null
@@ -1,62 +0,0 @@
-package com.macaroon.piztor;
-
-import android.content.Context;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import android.content.Context;
-import android.os.Handler;
-import android.os.Message;
-import android.util.Log;
-import android.os.SystemClock;
-
-
-public class Tracker implements Runnable {
-
- private static final long TIME_DELTA = 1000 * 3; // 3 second
- public Timer timer;
- private final Context mContext;
- GPSTracker myTracker;
- Handler mHandler;
- Message message;
-
- public Tracker(Context context, Handler yHandler) {
- timer = new Timer();
- mContext = context;
- myTracker = new GPSTracker(mContext);
- mHandler = yHandler;
- }
-
- public void run() {
- GPSTask myTask = new GPSTask();
- timer.schedule(myTask, 0, TIME_DELTA);
- }
-
- class GPSTask extends TimerTask {
- @Override
- public void run() {
- message = new Message();
- message.what = 0;
- myTracker.getLocation();
- Log.d("Location", "Fetching location.....");
- if (myTracker.canGetLocation()) {
- double latitude = myTracker.getLatitude();
- double longitude = myTracker.getLongitude();
-
- Log.d("TTTTTTTTTTTTTTTTTTTTTTTime","TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTime");
- System.out.println("GPSTIME" + myTracker.location.getTime());
- System.out.println("SYSTIME" + SystemClock.elapsedRealtime());
-
- if(myTracker.isGPSFix()) {
- message.what = 1;
- } else {
- message.what = 2;
- }
- mHandler.sendMessage(message);
- } else {
- message.what = 0;
- mHandler.sendMessage(message);
- }
- }
- }
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/f/702f615d280d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/f/702f615d280d00131249f322b63acde8
deleted file mode 100644
index fd21453..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/f/702f615d280d00131249f322b63acde8
+++ /dev/null
@@ -1,68 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.HashMap;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-
-@SuppressLint("UseSparseArrays")
-public class AppMgr {
- // Status
- public enum ActivityStatus{
- create, start, resume, restart, stop, pause, destroy
- }
- static ActivityStatus status;
- static PiztorAct nowAct;
-
- //Event
-
- final static int hasToken = 101;
-
-
- static HashMap<Class<?>, HashMap<Integer, Class<?>>> mp;
-
- static void setStatus(ActivityStatus st) {
- status = st;
- }
-
- static void trigger(int event) {
-
- Intent i = new Intent();
- i.setClass(nowAct, mp.get(nowAct.getClass()).get(event));
- nowAct.startActivity(i);
- }
-
- static void add(Class<?> a, Integer event, Class<?> b) {
- if (mp.containsKey(a))
- mp.get(a).put(event, b);
- else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-
- static void addTransition(Class<?> a, int i, Class<?> b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, Class<?>> h = mp.get(a);
- h.put(i, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, Class<?>> h = new HashMap<Integer, Class<?>>();
- h.put(i, b);
- mp.put(a, h);
- }
- }
-
- static void addStatus(Class<?> a) {
- mp.put(a, new HashMap<Integer, Class<?>>());
- }
-
- static void init() {
- mp = new HashMap<Class<?>, HashMap<Integer, Class<?>>>();
- addStatus(InitAct.class);
- addStatus(Login.class);
- addTransition(InitAct.class, hasToken, Login.class);
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/f/c043e2232c0d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/f/c043e2232c0d00131249f322b63acde8
deleted file mode 100644
index f607c1f..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/f/c043e2232c0d00131249f322b63acde8
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.app.Activity;
-import android.view.Menu;
-
-public class InitAct extends PiztorAct {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "initAct";
- super.onCreate(savedInstanceState);
- AppMgr.init();
- setContentView(R.layout.activity_init);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- AppMgr.trigger(AppMgr.hasToken);
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- getMenuInflater().inflate(R.menu.init, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/f0/a000529a350d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/f0/a000529a350d00131249f322b63acde8
deleted file mode 100644
index b3c9c89..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/f0/a000529a350d00131249f322b63acde8
+++ /dev/null
@@ -1,63 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- }
- }
- };
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- //AppMgr.transam.send(new ReqLogin(u, p, time, alive))
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/f1/00249bf3370d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/f1/00249bf3370d00131249f322b63acde8
deleted file mode 100644
index db5a3d8..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/f1/00249bf3370d00131249f322b63acde8
+++ /dev/null
@@ -1,98 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
-
-
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- int loginButtonClick = 1, retryButtonClick = 2, loginFailed = 3;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- } else if (m.what == 101) {
- actMgr.trigger(loginFailed);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
- }
-
- class LoginStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- String user = edtUser.getText().toString();
- String pass = edtPass.getText().toString();
- long nowtime = System.currentTimeMillis();
- AppMgr.transam.send(new ReqLogin(user, pass, nowtime, 1000));
- }
-
- @Override
- void leave(int e) {
- // TODO Auto-generated method stub
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- //AppMgr.transam.send(new ReqLogin(u, p, time, alive))
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/f1/e068ac2a250d00131a9bb9bc5a5e6171 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/f1/e068ac2a250d00131a9bb9bc5a5e6171
deleted file mode 100644
index 629f1c1..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/f1/e068ac2a250d00131a9bb9bc5a5e6171
+++ /dev/null
@@ -1,90 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="fill_parent"
- android:background="@android:color/black"
- android:orientation="vertical">
-
-<LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:background="@android:color/black"
- android:gravity="center_horizontal"
- android:orientation="vertical" >
-
- <ImageView
- android:id="@+id/main_headbar_img"
- android:layout_width="180dp"
- android:layout_height="240dp"
- android:layout_gravity="center_horizontal"
- android:src="@drawable/title_logo" />
-
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:layout_gravity="center">
-
- <TableLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <TableRow
- android:layout_marginBottom="15dp"
- android:layout_marginTop="15dp">
- <TextView
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="0.25"
- android:gravity="right"
- android:id="@+id/user_id_text"
- android:text="User ID"
- android:textColor="@android:color/white"
- />
-
- <EditText
- android:layout_width="0dp"
- android:layout_weight="0.75"
- android:id="@+id/user_id"
- android:singleLine="true">
- <requestFocus/>
- </TableRow>
-
- <TableRow>
- <TextView
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="0.25"
- android:gravity="right"
- android:id="@+id/user_pass_text"
- android:text="Password"
- android:textColor="@android:color/white"
- />
-
- <EditText
- android:layout_width="0dp"
- android:layout_weight="0.75"
- android:id="@+id/user_pass"
- android:password="true"
- android:singleLine="true"/>
- </TableRow>
- </TableLayout>
- </LinearLayout>
-
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:orientation="vertical"
- >
- <Button
- android:id="@+id/login_btn_login"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:text="Login"
- android:textColor="@android:color/white" />
- </LinearLayout>
-
-</LinearLayout>
-</RelativeLayout>
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/f1/e0f0dd782c0d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/f1/e0f0dd782c0d00131249f322b63acde8
deleted file mode 100644
index 1623576..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/f1/e0f0dd782c0d00131249f322b63acde8
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.app.Activity;
-import android.view.Menu;
-
-public class InitAct extends PiztorAct {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "initAct";
- super.onCreate(savedInstanceState);
- AppMgr.init();
- setContentView(R.layout.activity_init);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- if (UserInfo.token != -1)
- AppMgr.trigger(AppMgr.noToken);
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- getMenuInflater().inflate(R.menu.init, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/f2/101fed70800d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/f2/101fed70800d00131719b896d543f08c
deleted file mode 100644
index f0a2e0d..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/f2/101fed70800d00131719b896d543f08c
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.macaroon.piztor;
-
-public class Infomation {
- static String ip = "69.85.86.42";
- static int port = 9990;
- static int token = -1;
-
- static class UserInfo {
- double lat, lot;
- }
-
- static class Group {
-
- }
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/f4/a087fd4e800d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/f4/a087fd4e800d00131719b896d543f08c
deleted file mode 100644
index 929c0bb..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/f4/a087fd4e800d00131719b896d543f08c
+++ /dev/null
@@ -1,8 +0,0 @@
-package com.macaroon.piztor;
-
-public class UserInfo {
- static String ip = "69.85.86.42";
- static int port = 9990;
- static int token = -1;
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/f4/a0da18d74d0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/f4/a0da18d74d0d00131719b896d543f08c
deleted file mode 100644
index e573032..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/f4/a0da18d74d0d00131719b896d543f08c
+++ /dev/null
@@ -1,133 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="48dip"
- android:orientation="horizontal"
- android:background="@drawable/footbar_background" >
-
- <LinearLayout
- android:id="@+id/footbar_btn_search_layout"
- android:layout_width="64dip"
- android:layout_height="match_parent"
- android:orientation="vertical"
- android:layout_marginTop="3dip"
- android:layout_gravity="center_vertical"
- android:layout_weight="1">
- <ImageButton
- android:id="@+id/footbar_btn_search"
- android:layout_width="30dip"
- android:layout_height="30dip"
- android:layout_gravity="center"
- android:background="@drawable/footbar_btn_search_style"/>
- <TextView
- android:id="@+id/footbar_btn_search_text"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:gravity="center_horizontal"
- android:textSize="10dip"
- android:textColor="@android:color/white"
- android:layout_gravity="center"
- android:text="@string/search"/>
- </LinearLayout>
-
- <LinearLayout
- android:id="@+id/footbar_btn_fetch_layout"
- android:layout_width="64dip"
- android:layout_height="match_parent"
- android:orientation="vertical"
- android:layout_marginTop="3dip"
- android:layout_gravity="center_vertical"
- android:layout_weight="1">
- <ImageButton
- android:id="@+id/footbar_btn_fetch"
- android:layout_width="30dip"
- android:layout_height="30dip"
- android:layout_gravity="center"
- android:background="@drawable/footbar_btn_fetch_style"/>
- <TextView
- android:id="@+id/footbar_btn_fetch_text"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:gravity="center_horizontal"
- android:textSize="10dip"
- android:textColor="@android:color/white"
- android:layout_gravity="center"
- android:text="@string/fetch"/>
- </LinearLayout>
-
- <LinearLayout
- android:id="@+id/footbar_btn_checkin_layout"
- android:layout_width="64dip"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:layout_marginTop="3dip"
- android:layout_gravity="center_vertical"
- android:orientation="vertical">
- <ImageButton
- android:id="@+id/footbar_btn_checkin"
- android:layout_width="30dip"
- android:layout_height="30dip"
- android:layout_gravity="center"
- android:background="@drawable/footbar_btn_checkin_style"
- />
- <TextView
- android:id="@+id/footbar_btn_checkin_text"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:gravity="center_horizontal"
- android:textSize="10dip"
- android:textColor="@android:color/white"
- android:layout_gravity="center"
- android:text="@string/checkin"/>
- </LinearLayout>
-
- <LinearLayout
- android:id="@+id/footbar_btn_focus_layout"
- android:layout_width="64dip"
- android:layout_height="match_parent"
- android:orientation="vertical"
- android:layout_marginTop="3dip"
- android:layout_gravity="center_vertical"
- android:layout_weight="1">
- <ImageButton
- android:id="@+id/footbar_btn_focus"
- android:layout_width="30dip"
- android:layout_height="30dip"
- android:layout_gravity="center"
- android:background="@drawable/footbar_btn_focus_style"/>
- <TextView
- android:id="@+id/footbar_btn_focus_text"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:gravity="center_horizontal"
- android:textSize="10dip"
- android:textColor="@android:color/white"
- android:layout_gravity="center"
- android:text="@string/focus"/>
- </LinearLayout>
-
- <LinearLayout
- android:id="@+id/footbar_btn_settings_layout"
- android:layout_width="64dip"
- android:layout_height="match_parent"
- android:orientation="vertical"
- android:layout_marginTop="3dip"
- android:layout_gravity="center_vertical"
- android:layout_weight="1">
- <ImageButton
- android:id="@+id/footbar_btn_settings"
- android:layout_width="30dip"
- android:layout_height="30dip"
- android:layout_gravity="center"
- android:background="@drawable/footbar_btn_settings_style"/>
- <TextView
- android:id="@+id/footbar_btn_settings"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:textSize="10dip"
- android:textColor="@android:color/white"
- android:text="@string/settings"/>
- </LinearLayout>
-
-</LinearLayout>
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/f6/50b3bf00680d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/f6/50b3bf00680d00131719b896d543f08c
deleted file mode 100644
index 7bb08ae..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/f6/50b3bf00680d00131719b896d543f08c
+++ /dev/null
@@ -1,91 +0,0 @@
-package com.macaroon.piztor;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
-
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- @SuppressLint("HandlerLeak")
- Handler handler = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- if (l == null)
- System.out.println("fuck!!!");
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- void leave(int e) {
- // TODO Auto-generated method stub
-
- }
-
- }
-
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(handler);
- ActStatus[] r = new ActStatus[2];
- r[0] = new StartStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/f6/c0432fca650d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/f6/c0432fca650d00131719b896d543f08c
deleted file mode 100644
index 407ba24..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/f6/c0432fca650d00131719b896d543f08c
+++ /dev/null
@@ -1,56 +0,0 @@
-package com.macaroon.piztor;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-
-public class Main extends PiztorAct {
-
- ActMgr actMgr;
-
- @SuppressLint("HandlerLeak")
- Handler handler = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- if (l == null)
- System.out.println("fuck!!!");
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
-
-
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(handler);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/f6/f009dded390d00131524a793807f338e b/client/.metadata/.plugins/org.eclipse.core.resources/.history/f6/f009dded390d00131524a793807f338e
deleted file mode 100644
index df74c99..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/f6/f009dded390d00131524a793807f338e
+++ /dev/null
@@ -1,100 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
-
-
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- int loginButtonClick = 1, retryButtonClick = 2, loginFailed = 3;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- } else if (m.what == 101) {
- actMgr.trigger(loginFailed);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
- }
-
- class LoginStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- String user = edtUser.getText().toString();
- String pass = edtPass.getText().toString();
- long nowtime = System.currentTimeMillis();
- AppMgr.transam.send(new ReqLogin(user, pass, nowtime, 1000));
- }
-
- @Override
- void leave(int e) {
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- ActStatus[] r = new ActStatus[2];
- r[0] = new StartStatus();
- r[1] = new LoginStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], loginButtonClick, r[1]);
- actMgr.add(r[1], loginFailed, r[0]);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(loginButtonClick);
- }
- });
- }
- }
-
- @Override
- protected void onResume() {
- super.onResume();
-
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/f6/f0f9d74b5a0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/f6/f0f9d74b5a0d00131719b896d543f08c
deleted file mode 100644
index 0b24abd..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/f6/f0f9d74b5a0d00131719b896d543f08c
+++ /dev/null
@@ -1,51 +0,0 @@
-package com.macaroon.piztor;
-
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-
-public class Main extends PiztorAct {
-
- ActMgr actMgr;
-
- Handler handler = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- if (l == null)
- System.out.println("fuck!!!");
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(handler);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/f7/404fa93a860d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/f7/404fa93a860d00131719b896d543f08c
deleted file mode 100644
index d989280..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/f7/404fa93a860d00131719b896d543f08c
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.macaroon.piztor;
-
-import android.annotation.SuppressLint;
-import java.util.HashMap;
-import java.util.Vector;
-
-public class Infomation {
- static String ip = "69.85.86.42";
- static int port = 9990;
- static int token = -1;
- static int myId = -1;
- static int myGroup = -1;
- class UserInfo {
- int id;
- double lat, lot;
- }
-
- class Group {
- int id;
- Vector<UserInfo> v;
- }
-
- static HashMap<Integer, Group> mp;
-
- @SuppressLint("UseSparseArrays")
- static void init() {
- mp = new HashMap<Integer, Group>();
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/f8/10ed0356660d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/f8/10ed0356660d00131719b896d543f08c
deleted file mode 100644
index e530ef2..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/f8/10ed0356660d00131719b896d543f08c
+++ /dev/null
@@ -1,86 +0,0 @@
-package com.macaroon.piztor;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
-
- ActMgr actMgr;
-
- @SuppressLint("HandlerLeak")
- Handler handler = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- if (l == null)
- System.out.println("fuck!!!");
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- void leave(int e) {
- // TODO Auto-generated method stub
-
- }
-
- }
-
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(handler);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/f8/60faee49750d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/f8/60faee49750d00131719b896d543f08c
deleted file mode 100644
index c9f6043..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/f8/60faee49750d00131719b896d543f08c
+++ /dev/null
@@ -1,159 +0,0 @@
-package com.macaroon.piztor;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- @SuppressLint("HandlerLeak")
- Handler fromGPS = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- Handler fromTransam = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what > 100) {
-
- }
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "Search Button Press";
- case FetchButtonPress:
- return "Fetch Button Press";
- case FocuseButtonPress:
- return "Focuse Button Press";
- case SuccessFetch:
- return "Success Fetch";
- case FailedFetch:
- return "Failed Fetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter Fetch status!!!!");
- if (e == FetchButtonPress) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1,
- System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave fetch status!!!! because" + cause(e));
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter focus status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave focus status!!!! because" + cause(e));
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(fromGPS);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
- btnFetch.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(FetchButtonPress);
- }
- });
- btnFocus.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- actMgr.trigger(FocuseButtonPress);
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/f9/40812ada6a0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/f9/40812ada6a0d00131719b896d543f08c
deleted file mode 100644
index 3778249..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/f9/40812ada6a0d00131719b896d543f08c
+++ /dev/null
@@ -1,137 +0,0 @@
-package com.macaroon.piztor;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- @SuppressLint("HandlerLeak")
- Handler handler = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- if (l == null)
- System.out.println("fuck!!!");
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "SearchButtonPress";
- case FetchButtonPress:
- return "FetchButtonPress";
- case FocuseButtonPress:
- return "FocuseButtonPress";
- case SuccessFetch:
- return "SuccessFetch";
- case FailedFetch:
- return "FailedFetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter Fetch status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- // TODO Auto-generated method stub
-
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter focus status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- // TODO Auto-generated method stub
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(handler);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/f9/e06a5470670d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/f9/e06a5470670d00131719b896d543f08c
deleted file mode 100644
index c220c02..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/f9/e06a5470670d00131719b896d543f08c
+++ /dev/null
@@ -1,86 +0,0 @@
-package com.macaroon.piztor;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
-
- ActMgr actMgr;
-
- @SuppressLint("HandlerLeak")
- Handler handler = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- if (l == null)
- System.out.println("fuck!!!");
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- void leave(int e) {
- // TODO Auto-generated method stub
-
- }
-
- }
-
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(handler);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/fa/f0caef03230d00131a9bb9bc5a5e6171 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/fa/f0caef03230d00131a9bb9bc5a5e6171
deleted file mode 100644
index c760a59..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/fa/f0caef03230d00131a9bb9bc5a5e6171
+++ /dev/null
@@ -1,5 +0,0 @@
-package com.macaroon.piztor;
-
-public class PiztorExcepiton extends Exception{
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/fb/10233142530d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/fb/10233142530d00131719b896d543f08c
deleted file mode 100644
index ec8f8bd..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/fb/10233142530d00131719b896d543f08c
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.view.Menu;
-
-public class Main extends PiztorAct {
-
- Handler handler = new Handler() {
-
- };
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/fb/10a53b2a7a0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/fb/10a53b2a7a0d00131719b896d543f08c
deleted file mode 100644
index a38e5a3..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/fb/10a53b2a7a0d00131719b896d543f08c
+++ /dev/null
@@ -1,197 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.Vector;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- Timer autodate;
- @SuppressLint("HandlerLeak")
- Handler fromGPS = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- Handler fromTransam = new Handler() {
- @Override
- public void handleMessage(Message m) {
- switch (m.what) {
- case 3:
- ResLocation location = (ResLocation) m.obj;
- for (int i = 0; i < location.n; i++) {
- System.out.println(location.l.get(i).lat + " "
- + location.l.get(i).lot);
- }
- actMgr.trigger(SuccessFetch);
- break;
- case 2:
- ResUpdate update = (ResUpdate) m.obj;
- if (update.t == 0)
- System.out.println("update success");
- else
- System.out.println("update failed");
- break;
- default:
- break;
- }
-
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "Search Button Press";
- case FetchButtonPress:
- return "Fetch Button Press";
- case FocuseButtonPress:
- return "Focuse Button Press";
- case SuccessFetch:
- return "Success Fetch";
- case FailedFetch:
- return "Failed Fetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- if (e == TimerFlush) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1, System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter Fetch status!!!!");
- if (e == FetchButtonPress) {
- ReqLocation r = new ReqLocation(UserInfo.token, 1,
- System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave fetch status!!!! because" + cause(e));
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter focus status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave focus status!!!! because" + cause(e));
-
- }
-
- }
-
- class AutoUpdate extends TimerTask {
-
- @Override
- public void run() {
- actMgr.trigger(Main.TimerFlush);
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(fromGPS);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- actMgr.add(r[2], TimerFlush, r[2]);
- autodate = new Timer();
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
- btnFetch.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(FetchButtonPress);
- }
- });
- btnFocus.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- actMgr.trigger(FocuseButtonPress);
- }
- });
-
- autodate.schedule(new AutoUpdate(), 5000);
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/fb/901006312c0d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/fb/901006312c0d00131249f322b63acde8
deleted file mode 100644
index e69de29..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/fb/901006312c0d00131249f322b63acde8
+++ /dev/null
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/fb/d0859c9d370d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/fb/d0859c9d370d00131249f322b63acde8
deleted file mode 100644
index d0ef95b..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/fb/d0859c9d370d00131249f322b63acde8
+++ /dev/null
@@ -1,96 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
-
-
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- int loginButtonClick = 1, retryButtonClick = 2, loginFailed = 3;
-
- Handler hand = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what == 0) {
- ResLogin res = (ResLogin) m.obj;
- UserInfo.token = res.t;
- actMgr.trigger(AppMgr.loginSuccess);
- } else if (m.what == 101) {
- actMgr.trigger(loginFailed);
- }
- }
- };
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
- }
-
- class LoginStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- String user = edtUser.getText().toString();
-
- }
-
- @Override
- void leave(int e) {
- // TODO Auto-generated method stub
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- //AppMgr.transam.send(new ReqLogin(u, p, time, alive))
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/fb/d0f7938e550d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/fb/d0f7938e550d00131719b896d543f08c
deleted file mode 100644
index 82962d2..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/fb/d0f7938e550d00131719b896d543f08c
+++ /dev/null
@@ -1,240 +0,0 @@
-package com.macaroon.piztor;
-
-import android.app.AlertDialog;
-import android.app.Service;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.location.Location;
-import android.location.LocationListener;
-import android.location.LocationManager;
-import android.location.GpsStatus;
-import android.os.Bundle;
-import android.os.IBinder;
-import android.os.SystemClock;
-import android.provider.Settings;
-import android.util.Log;
-
-public class GPSTracker extends Service implements LocationListener, GpsStatus.Listener {
-
- private final Context mContext;
-
- // flag for GPS status
- boolean isGPSEnabled = false;
-
- // flag for network status
- boolean isNetworkEnabled = false;
-
- // flag for GPS status
- boolean canGetLocation = false;
-
- Location location; // location
- double latitude; // latitude
- double longitude; // longitude
-
- // The minimum distance to change Updates in meters
- private static final long MIN_DISTANCE_CHANGE_FOR_UPDATES = 10; // 10 meters
-
- // The minimum time between updates in milliseconds
- private static final long MIN_TIME_BW_UPDATES = 1000 * 3; // 10 seconds
-
- // Declaring a Location Manager
- protected LocationManager locationManager;
-
- // for GPS satellite status listener
- Location mLastLocation;
- long mLastLocationMillis;
- boolean isGPSFix;
-
-
- public GPSTracker(Context context) {
- this.mContext = context;
- isGPSFix = false;
- getLocation();
- }
-
- public Location getLocation() {
- try {
- Log.d("getLocation", "Start getting location......");
-
- locationManager = (LocationManager) mContext
- .getSystemService(LOCATION_SERVICE);
-
- // getting GPS status
- isGPSEnabled = locationManager
- .isProviderEnabled(LocationManager.GPS_PROVIDER);
-
- // getting network status
- isNetworkEnabled = locationManager
- .isProviderEnabled(LocationManager.NETWORK_PROVIDER);
-
- if (!isGPSEnabled) {
- // no network provider is enabled
- } else {
- this.canGetLocation = true;
- if (isNetworkEnabled) {
- locationManager.requestLocationUpdates(
- LocationManager.NETWORK_PROVIDER,
- MIN_TIME_BW_UPDATES,
- MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
-
- Log.d("Network", "Network Updated");
-
- if (locationManager != null) {
- location = locationManager
- .getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
- if (location != null) {
- latitude = location.getLatitude();
- longitude = location.getLongitude();
-
- Log.d("Network", "Received Network Data");
- System.out.println("***From Network: "+latitude + " " + longitude);
- }
- }
- }// end of network section
- // if GPS Enabled get lat/long using GPS Services
- if (isGPSEnabled) {
- if (true) {
- locationManager.requestLocationUpdates(
- LocationManager.GPS_PROVIDER,
- MIN_TIME_BW_UPDATES,
- MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
- Log.d("GPS", "GPS Updated");
- if (locationManager != null) {
- location = locationManager
- .getLastKnownLocation(LocationManager.GPS_PROVIDER);
- if (location != null) {
- latitude = location.getLatitude();
- longitude = location.getLongitude();
-
- Log.d("GPS", "Received GPS Data");
- System.out.println("***From GPS: "+latitude + " " + longitude);
-
- }
- }
- }
- }// end of GPS section
- }// end of fetching data
- } catch (Exception e) {
- e.printStackTrace();
- }
- return location;
- }
-
- /**
- * Stop using GPS listener Calling this function will stop using GPS in your
- * app
- * */
- public void stopUsingGPS() {
- if (locationManager != null) {
- locationManager.removeUpdates(GPSTracker.this);
- }
- }
-
- /**
- * Function to get latitude
- * */
- public double getLatitude() {
- if (location != null) {
- latitude = location.getLatitude();
- }
- return latitude;
- }
-
- /**
- * Function to get longitude
- * */
- public double getLongitude() {
- if (location != null) {
- longitude = location.getLongitude();
- }
- return longitude;
- }
-
- /**
- * Function to check GPS/wifi enabled
- *
- * @return boolean
- * */
- public boolean canGetLocation() {
- return this.canGetLocation;
- }
-
- public boolean isGPSFix() {
- return (this.isGPSFix && location != null);
- }
-
- /**
- * Function to show settings alert dialog On pressing Settings button will
- * lauch Settings Options
- * */
- public void showSettingsAlert() {
- AlertDialog.Builder alertDialog = new AlertDialog.Builder(mContext);
-
- // Setting Dialog Title
- alertDialog.setTitle("GPS is settings");
-
- // Setting Dialog Message
- alertDialog
- .setMessage("GPS is not enabled. Do you want to go to settings menu?");
-
- // On pressing Settings button
- alertDialog.setPositiveButton("Settings",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- Intent intent = new Intent(
- Settings.ACTION_LOCATION_SOURCE_SETTINGS);
- mContext.startActivity(intent);
- }
- });
-
- // on pressing cancel button
- alertDialog.setNegativeButton("Cancel",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- dialog.cancel();
- }
- });
-
- // Showing Alert Message
- alertDialog.show();
- }
-
- @Override
- public void onLocationChanged(Location location) {
- if (location == null) return;
- mLastLocationMillis = SystemClock.elapsedRealtime();
- mLastLocation = location;
- }
-
- @Override
- public void onProviderDisabled(String provider) {
- }
-
- @Override
- public void onProviderEnabled(String provider) {
- }
-
- @Override
- public void onStatusChanged(String provider, int status, Bundle extras) {
- }
-
- @Override
- public IBinder onBind(Intent arg0) {
- return null;
- }
-
- @Override
- public void onGpsStatusChanged(int event) {
- switch (event) {
- case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
- if(mLastLocation != null)
- isGPSFix = (SystemClock.elapsedRealtime() - mLastLocationMillis) < 3000;
- break;
-
- case GpsStatus.GPS_EVENT_FIRST_FIX:
- isGPSFix = true;
- break;
- }
- }
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/fb/e0d4eed4300d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/fb/e0d4eed4300d00131249f322b63acde8
deleted file mode 100644
index 3ca0dfe..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/fb/e0d4eed4300d00131249f322b63acde8
+++ /dev/null
@@ -1,133 +0,0 @@
-package com.macaroon.piztor;
-
-import java.io.IOException;
-import java.net.UnknownHostException;
-import java.util.LinkedList;
-import java.util.Queue;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import android.annotation.SuppressLint;
-import android.os.Handler;
-import android.os.Message;
-
-public class Transam implements Runnable {
-
- public Timer timer;
- public Timer mtimer;
- public boolean running = false;
- public boolean flag = true;
- public int cnt = 4;
- Res res;
- Req req;
- public int p; //port
- public String i; //ip
- Thread thread;
- Handler core;
- Handler recall; //recall
- Queue<Req> reqtask ; //request task
-
- Transam(String ip, int port,Handler Recall) {
- p = port;
- i = ip;
- recall = Recall;
- reqtask = new LinkedList<Req>();
- }
-
- public void send(Req r){
- reqtask.offer(r);
-
- }
-
- public void run() { //start the main timer
- //TimerTask tmain = new Timertk();
- //mtimer = new Timer();
- //mtimer.schedule(tmain, 100, 100); //check the queue for every 100 msec
-
- while(true){
- if(running == false){
-
- if(!reqtask.isEmpty()){ //poll the head request
- req = reqtask.poll();
- if(req.time + req.alive < System.currentTimeMillis()){ //time out!
- Message ret = new Message();
- ret.obj = "Time out!";
- ret.what = 100;
- recall.sendMessage(ret);
- }
- else{ //run the request
- final thd t = new thd();
- flag = false;
- thread = new Thread(t);
- cnt = 4;
- running = true;
- thread.start();
- timer = new Timer();
- TimerTask task = new Timertk();
- timer.schedule(task, 2000, 2000);
- }
- }
- }
- }
- }
-
- class tmain extends TimerTask {
- public void run() {
-
- }
- };
-
- class thd implements Runnable {
- public void run() {
- try {
- SocketClient client = new SocketClient(i,p);
- client.sendMsg(req,recall);
- Message msg = new Message();
- msg.what = 1;
- handler.sendMessage(msg);
- client.closeSocket();
- } catch (UnknownHostException e) {
- e.printStackTrace();
- System.out.println("UnknownHostException");
- } catch (IOException e) {
- e.printStackTrace();
- System.out.println("IOException");
- }
-
- }
- }
-
- @SuppressLint("HandlerLeak")
- Handler handler = new Handler() {
- public void handleMessage(Message msg) {
- switch (msg.what) {
- case 1:
- flag = true;
- break;
- case 2:
- final thd t = new thd();
- thread = new Thread(t);
- thread.start();
- break;
- }
- super.handleMessage(msg);
- }
- };
-
- class Timertk extends TimerTask {
- public void run() {
- if (flag == false && cnt > 0) {
- cnt--;
- } else if (cnt == 0) {
- Message msg = new Message();
- msg.obj = "connecting failed";
- msg.what = 101;
- recall.sendMessage(msg);
- timer.cancel();
- } else if (flag == true) {
- timer.cancel();
- running = false;
- }
- }
- };
-} \ No newline at end of file
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/fc/f05e84f54e0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/fc/f05e84f54e0d00131719b896d543f08c
deleted file mode 100644
index e5faf14..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/fc/f05e84f54e0d00131719b896d543f08c
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.macaroon.piztor"
- android:versionCode="1"
- android:versionName="1.0" >
-
- <uses-sdk
- android:minSdkVersion="8"
- android:targetSdkVersion="17" />
-
- <application
- android:allowBackup="true"
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name"
- android:theme="@style/AppTheme" >
- <activity
- android:name="com.macaroon.piztor.InitAct"
- android:label="@string/app_name" >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
-
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- <activity
- android:name="com.macaroon.piztor.Login"
- android:label="@string/title_activity_login" >
- </activity>
- <activity
- android:name="com.macaroon.piztor.Main"
- android:label="@string/title_activity_main" >
- </activity>
- <activity
- android:name="com.macaroon.piztor.Setting"
- android:label="@string/title_activity_setting" >
- </activity>
- </application>
-
- <uses-permission android:name="android.permission.INTERNET" />
- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
-
-</manifest>
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/fd/50c48d3c520d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/fd/50c48d3c520d00131719b896d543f08c
deleted file mode 100644
index e4aa2b1..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/fd/50c48d3c520d00131719b896d543f08c
+++ /dev/null
@@ -1,64 +0,0 @@
-package com.example.piztor;
-
-import android.content.Context;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import android.content.Context;
-import android.os.Handler;
-import android.os.Message;
-import android.util.Log;
-import android.os.SystemClock;
-
-
-public class Tracker implements Runnable {
-
- private static final long TIME_DELTA = 1000 * 1; // 1 second
- public Timer timer;
- private final Context mContext;
- Controller controller;
- GPSTracker myTracker;
- Handler mHandler;
- Message message;
-
- public Tracker(Controller newController, Context context, Handler yHandler) {
- timer = new Timer();
- mContext = context;
- controller = newController;
- myTracker = new GPSTracker(mContext);
- mHandler = yHandler;
- }
-
- public void run() {
- GPSTask myTask = new GPSTask();
- timer.schedule(myTask, 0, TIME_DELTA);
- }
-
- class GPSTask extends TimerTask {
- @Override
- public void run() {
- message = new Message();
- message.what = 0;
- myTracker.getLocation();
- Log.d("Location", "Fetching location.....");
- if (myTracker.canGetLocation()) {
- double latitude = myTracker.getLatitude();
- double longitude = myTracker.getLongitude();
-
- Log.d("TTTTTTTTTTTTTTTTTTTTTTTime","TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTime");
- System.out.println("GPSTIME" + myTracker.location.getTime());
- System.out.println("SYSTIME" + SystemClock.elapsedRealtime());
-
- if(myTracker.isGPSFix()) {
- message.what = 1;
- } else {
- message.what = 2;
- }
- mHandler.sendMessage(message);
- } else {
- message.what = 0;
- mHandler.sendMessage(message);
- }
- }
- }
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/fd/7081acc66c0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/fd/7081acc66c0d00131719b896d543f08c
deleted file mode 100644
index 4d75ae6..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/fd/7081acc66c0d00131719b896d543f08c
+++ /dev/null
@@ -1,154 +0,0 @@
-package com.macaroon.piztor;
-
-import android.annotation.SuppressLint;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.ImageButton;
-
-public class Main extends PiztorAct {
-
- final static int SearchButtonPress = 1;
- final static int FetchButtonPress = 2;
- final static int FocuseButtonPress = 3;
- final static int SuccessFetch = 4;
- final static int FailedFetch = 5;
- final static int TimerFlush = 6;
- ActMgr actMgr;
- ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- @SuppressLint("HandlerLeak")
- Handler fromGPS = new Handler() {
- @Override
- public void handleMessage(Message m) {
- if (m.what != 0) {
- Location l = (Location) m.obj;
- ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
- l.getLongitude(), System.currentTimeMillis(), 1000);
- AppMgr.transam.send(r);
- }
- }
- };
-
- Handler fromTransam = new Handler() {
- @Override
- public void handleMessage(Message m) {
-
- }
- };
-
- String cause(int t) {
- switch (t) {
- case SearchButtonPress:
- return "Search Button Press";
- case FetchButtonPress:
- return "Fetch Button Press";
- case FocuseButtonPress:
- return "Focuse Button Press";
- case SuccessFetch:
- return "Success Fetch";
- case FailedFetch:
- return "Failed Fetch";
- case TimerFlush:
- return "TimerFlush";
- default:
- return "Fuck!!!";
- }
- }
-
- class StartStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter start status!!!!");
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave start status!!!! because" + cause(e));
- }
-
- }
-
- class FetchStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter Fetch status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave fetch status!!!! because" + cause(e));
-
- }
-
- }
-
- class FocusStatus extends ActStatus {
-
- @Override
- void enter(int e) {
- System.out.println("enter focus status!!!!");
-
- }
-
- @Override
- void leave(int e) {
- System.out.println("leave focus status!!!! because" + cause(e));
-
- }
-
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "Main";
- super.onCreate(savedInstanceState);
- AppMgr.tracker.setHandler(fromGPS);
- ActStatus[] r = new ActStatus[3];
- r[0] = new StartStatus();
- r[1] = new FetchStatus();
- r[2] = new FocusStatus();
- actMgr = new ActMgr(this, r[0], r);
- actMgr.add(r[0], FocuseButtonPress, r[2]);
- actMgr.add(r[0], FetchButtonPress, r[1]);
- actMgr.add(r[1], FetchButtonPress, r[0]);
- actMgr.add(r[1], FailedFetch, r[0]);
- actMgr.add(r[2], FocuseButtonPress, r[0]);
- actMgr.add(r[0], TimerFlush, r[0]);
- setContentView(R.layout.activity_main);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- btnFetch = (ImageButton) findViewById(R.id.footbar_btn_fetch);
- btnFocus = (ImageButton) findViewById(R.id.footbar_btn_focus);
- btnSearch = (ImageButton) findViewById(R.id.footbar_btn_search);
- btnSettings = (ImageButton) findViewById(R.id.footbar_btn_settings);
- btnFetch.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- actMgr.trigger(FetchButtonPress);
- }
- });
- btnFocus.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- actMgr.trigger(FocuseButtonPress);
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/fd/90b04d264f0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/fd/90b04d264f0d00131719b896d543f08c
deleted file mode 100644
index eea1611..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/fd/90b04d264f0d00131719b896d543f08c
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.macaroon.piztor"
- android:versionCode="1"
- android:versionName="1.0" >
-
- <uses-sdk
- android:minSdkVersion="8"
- android:targetSdkVersion="17" />
-
- <application
- android:allowBackup="true"
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name"
- android:theme="@android:style/Theme.NoTitleBar" >
- <activity
- android:name="com.macaroon.piztor.InitAct"
- android:label="@string/app_name" >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
-
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- <activity
- android:name="com.macaroon.piztor.Login"
- android:label="@string/activity_login" >
- </activity>
- <activity
- android:name="com.macaroon.piztor.Main"
- android:label="@string/activity_main" >
- </activity>
- <activity
- android:name="com.macaroon.piztor.Setting"
- android:label="@string/activity_setting" >
- </activity>
- </application>
-
- <uses-permission android:name="android.permission.INTERNET" />
- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
-
-</manifest>
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/fe/4015f3cd330d00131249f322b63acde8 b/client/.metadata/.plugins/org.eclipse.core.resources/.history/fe/4015f3cd330d00131249f322b63acde8
deleted file mode 100644
index 9886d46..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/fe/4015f3cd330d00131249f322b63acde8
+++ /dev/null
@@ -1,58 +0,0 @@
-package com.macaroon.piztor;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Menu;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Login extends PiztorAct {
- ActMgr actMgr;
- Button btnLogin;
- EditText edtUser, edtPass;
-
- Handler hand = new Handler() {
- @Override
- public boolean sendMessage(Message m) {
-
- }
- };
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- id = "login";
- super.onCreate(savedInstanceState);
- btnLogin = (Button) findViewById(R.id.login_btn_login);
- edtUser = (EditText) findViewById(R.id.user_id);
- edtPass = (EditText) findViewById(R.id.user_pass);
- EmptyStatus[] r = new EmptyStatus[1];
- r[0] = new EmptyStatus();
- actMgr = new ActMgr(this, r[0], r);
- setContentView(R.layout.activity_login);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- btnLogin.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.login, menu);
- return true;
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.history/fe/c09a68a94b0d00131719b896d543f08c b/client/.metadata/.plugins/org.eclipse.core.resources/.history/fe/c09a68a94b0d00131719b896d543f08c
deleted file mode 100644
index 81fa6f2..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.history/fe/c09a68a94b0d00131719b896d543f08c
+++ /dev/null
@@ -1,63 +0,0 @@
-package com.macaroon.piztor;
-
-import java.util.*;
-
-import android.annotation.SuppressLint;
-
-@SuppressLint("UseSparseArrays")
-public class ActMgr {
- // event
- PiztorAct act;
- ActStatus nowStatus;
- HashMap<ActStatus, HashMap<Integer, ActStatus>> mp;
-
- ActMgr(PiztorAct act, ActStatus nowStatus, ActStatus[] r) {
- this.act = act;
- this.nowStatus = nowStatus;
- mp = new HashMap<ActStatus, HashMap<Integer, ActStatus>>();
- for (int i = 0; i < r.length; i++) {
- mp.put(r[i], new HashMap<Integer, ActStatus>());
- }
- }
-
- void trigger(int event) {
- for (Integer i : mp.get(nowStatus).keySet())
- System.out.println(i);
- if (mp.get(nowStatus).containsKey(event)) {
- nowStatus.leave(event);
- nowStatus = mp.get(nowStatus).get(event);
- nowStatus.enter(event);
- } else if (AppMgr.mp.get(act.getClass()).containsKey(event)) {
- AppMgr.trigger(event);
- }
- }
-
- void add(ActStatus a, int event, ActStatus b) {
- if (mp.containsKey(a)) {
- HashMap<Integer, ActStatus> h = mp.get(a);
- h.put(event, b);
- mp.put(a, h);
- } else {
- HashMap<Integer, ActStatus> h = new HashMap<Integer, ActStatus>();
- h.put(event, b);
- mp.put(a, h);
- }
- }
-}
-
-abstract class ActStatus {
- abstract void enter(int e);
-
- abstract void leave(int e);
-}
-
-class EmptyStatus extends ActStatus {
- @Override
- void enter(int e) {
- }
-
- @Override
- void leave(int e) {
- }
-
-}
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/a0/5f/properties.index b/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/a0/5f/properties.index
deleted file mode 100644
index e7671ef..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/a0/5f/properties.index
+++ /dev/null
Binary files differ
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/a0/62/properties.index b/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/a0/62/properties.index
deleted file mode 100644
index 1e11659..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/a0/62/properties.index
+++ /dev/null
Binary files differ
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/a0/66/properties.index b/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/a0/66/properties.index
deleted file mode 100644
index 57d84c4..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/a0/66/properties.index
+++ /dev/null
Binary files differ
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/a0/cd/properties.index b/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/a0/cd/properties.index
deleted file mode 100644
index 3efb4ac..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/a0/cd/properties.index
+++ /dev/null
Binary files differ
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/a0/d6/history.index b/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/a0/d6/history.index
deleted file mode 100644
index c8e5f63..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/a0/d6/history.index
+++ /dev/null
Binary files differ
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/a0/d6/properties.index b/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/a0/d6/properties.index
deleted file mode 100644
index 7344135..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/a0/d6/properties.index
+++ /dev/null
Binary files differ
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/a0/de/history.index b/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/a0/de/history.index
deleted file mode 100644
index 1949e88..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/a0/de/history.index
+++ /dev/null
Binary files differ
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/a0/de/properties.index b/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/a0/de/properties.index
deleted file mode 100644
index e1d4fc9..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/a0/de/properties.index
+++ /dev/null
Binary files differ
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/a0/eb/properties.index b/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/a0/eb/properties.index
deleted file mode 100644
index 99b3382..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/a0/eb/properties.index
+++ /dev/null
Binary files differ
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/a0/ee/properties.index b/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/a0/ee/properties.index
deleted file mode 100644
index e123a38..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/a0/ee/properties.index
+++ /dev/null
Binary files differ
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/af/history.index b/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/af/history.index
deleted file mode 100644
index 23cfed3..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/af/history.index
+++ /dev/null
Binary files differ
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/e4/81/32/ea/history.index b/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/e4/81/32/ea/history.index
deleted file mode 100644
index d864ea3..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/e4/81/32/ea/history.index
+++ /dev/null
Binary files differ
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/e4/history.index b/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/e4/history.index
deleted file mode 100644
index 9d98849..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/e4/history.index
+++ /dev/null
Binary files differ
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/history.index b/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/history.index
deleted file mode 100644
index 9a6bfd9..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/history.index
+++ /dev/null
Binary files differ
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/properties.index b/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/properties.index
deleted file mode 100644
index 1005094..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.indexes/properties.index
+++ /dev/null
Binary files differ
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.markers b/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.markers
deleted file mode 100644
index 9d6ddfa..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.markers
+++ /dev/null
Binary files differ
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.markers.snap b/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.markers.snap
deleted file mode 100644
index 2a8bb67..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.markers.snap
+++ /dev/null
Binary files differ
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.syncinfo.snap b/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.syncinfo.snap
deleted file mode 100644
index 5213c44..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.projects/Piztor/.syncinfo.snap
+++ /dev/null
Binary files differ
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/history.version b/client/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/history.version
deleted file mode 100644
index 25cb955..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/history.version
+++ /dev/null
@@ -1 +0,0 @@
- \ No newline at end of file
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.index b/client/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.index
deleted file mode 100644
index a25bfee..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.index
+++ /dev/null
Binary files differ
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.version b/client/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.version
deleted file mode 100644
index 6b2aaa7..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.version
+++ /dev/null
@@ -1 +0,0 @@
- \ No newline at end of file
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.root/.markers.snap b/client/.metadata/.plugins/org.eclipse.core.resources/.root/.markers.snap
deleted file mode 100644
index 79a81b5..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.root/.markers.snap
+++ /dev/null
Binary files differ
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.root/7.tree b/client/.metadata/.plugins/org.eclipse.core.resources/.root/7.tree
deleted file mode 100644
index d5bd564..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.root/7.tree
+++ /dev/null
Binary files differ
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources b/client/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources
deleted file mode 100644
index b497eb3..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources
+++ /dev/null
Binary files differ
diff --git a/client/.metadata/.plugins/org.eclipse.core.resources/.snap b/client/.metadata/.plugins/org.eclipse.core.resources/.snap
deleted file mode 100644
index 369021a..0000000
--- a/client/.metadata/.plugins/org.eclipse.core.resources/.snap
+++ /dev/null
Binary files differ