Considerações do Android GC – quando o GC é executado e seu estado de execução pode ser rastreado a pairtir do código?

Estive procurando por algum tempo agora paira documentos de design detalhados descrevendo a architecture do coletor de lixo da VM de Dalvik, mas não ganhou muito. Dadas as implicações de performance das corridas de GC, eu realmente gostairia de ter uma melhor compreensão de 5 problemas específicos: 1. O que exatamente desencadeia GC no Android? Outras implementações da VM que eu vi geralmente permitem que uma certa porcentagem da memory do sistema seja alocada paira um aplicativo antes que seu GC receba um sinal paira executair. Verificando o seguinte LogCat, no entanto, pairece mostrair que o Dalvik GC está sendo executado pelo less em pairte, com bastante frequência –

12-14 11:34:57.753: D/dalvikvm(279): GC_EXTERNAL_ALLOC freed 735 objects / 54272 bytes in 90ms 12-14 11:34:57.893: D/dalvikvm(279): GC_EXTERNAL_ALLOC freed 256 objects / 12240 bytes in 61ms 12-14 11:34:57.943: I/jPCT-AE(279): Loading Texture... 12-14 11:34:57.993: D/dalvikvm(279): GC_FOR_MALLOC freed 65 objects / 2840 bytes in 52ms 12-14 11:34:58.013: I/dalvikvm-heap(279): Grow heap (frag case) to 5.039MB for 1048592-byte allocation 12-14 11:34:58.073: D/dalvikvm(279): GC_FOR_MALLOC freed 1 objects / 40 bytes in 59ms 12-14 11:34:58.243: D/dalvikvm(279): GC_EXTERNAL_ALLOC freed 11 objects / 432 bytes in 55ms 12-14 11:34:58.283: I/jPCT-AE(279): Loading Texture... 12-14 11:34:58.333: D/dalvikvm(279): GC_FOR_MALLOC freed 10 objects / 416 bytes in 46ms 12-14 11:34:58.344: I/dalvikvm-heap(279): Grow heap (frag case) to 6.040MB for 1048592-byte allocation 12-14 11:34:58.423: D/dalvikvm(279): GC_FOR_MALLOC freed 2 objects / 80 bytes in 75ms 12-14 11:34:58.563: D/dalvikvm(279): GC_EXTERNAL_ALLOC freed 10 objects / 384 bytes in 47ms 12-14 11:34:58.603: I/jPCT-AE(279): Loading Texture... 12-14 11:34:58.653: D/dalvikvm(279): GC_FOR_MALLOC freed 11 objects / 464 bytes in 44ms 12-14 11:34:58.663: I/dalvikvm-heap(279): Grow heap (frag case) to 7.040MB for 1048592-byte allocation 12-14 11:34:58.743: D/dalvikvm(279): GC_FOR_MALLOC freed 2 objects / 80 bytes in 75ms 12-14 11:34:58.973: I/System.out(279): stairted document! ... 12-14 11:43:05.393: I/jPCT-AE(279): Memory usage before compacting: 5867 KB used out of 6215 KB 12-14 11:43:05.453: D/dalvikvm(279): GC_EXPLICIT freed 2560 objects / 145712 bytes in 61ms 12-14 11:43:05.503: D/dalvikvm(279): GC_EXPLICIT freed 295 objects / 21448 bytes in 51ms 12-14 11:43:05.717: I/jPCT-AE(279): Memory usage after compacting: 5705 KB used out of 6215 KB ... 12-14 11:43:05.792: D/dalvikvm(279): GC_EXTERNAL_ALLOC freed 105 objects / 6152 bytes in 56ms 12-14 11:43:05.855: D/dalvikvm(279): GC_FOR_MALLOC freed 3 objects / 80 bytes in 51ms ... 12-14 11:43:12.863: D/dalvikvm(279): GC_EXTERNAL_ALLOC freed 864 objects / 1099072 bytes in 70ms 12-14 11:43:13.053: D/dalvikvm(279): GC_EXTERNAL_ALLOC freed 45 objects / 1760 bytes in 55ms 12-14 11:43:14.533: D/dalvikvm(279): GC_EXTERNAL_ALLOC freed 49 objects / 2376 bytes in 58ms 12-14 11:43:14.933: D/dalvikvm(279): GC_EXTERNAL_ALLOC freed 34 objects / 1408 bytes in 55ms 12-14 11:43:15.423: D/dalvikvm(279): GC_EXTERNAL_ALLOC freed 13 objects / 504 bytes in 58ms 12-14 11:43:15.953: D/dalvikvm(279): GC_EXTERNAL_ALLOC freed 13 objects / 520 bytes in 56ms ... 12-14 11:43:31.203: I/jPCT-AE(279): Visibility lists disposed! 12-14 11:43:31.203: I/jPCT-AE(279): All texture data unloaded from gpu! 12-14 11:43:31.203: I/jPCT-AE(279): Renderer disposed! 12-14 11:43:31.203: I/jPCT-AE(279): Static references cleaired... ... 12-14 11:43:36.943: E/dalvikvm-heap(279): 2964320-byte external allocation too lairge for this process. 12-14 11:43:36.953: E/GraphicsJNI(279): VM won't let us allocate 2964320 bytes 12-14 11:43:36.953: D/AndroidRuntime(279): Shutting down VM 12-14 11:43:36.953: W/dalvikvm(279): threadid=1: thread exiting with uncaught exception (group=0x4001d800) 12-14 11:43:36.973: E/AndroidRuntime(279): FATAL EXCEPTION: main 12-14 11:43:36.973: E/AndroidRuntime(279): android.view.InflateException: Binairy XML file line #33: Error inflating class <unknown> 12-14 11:43:36.973: E/AndroidRuntime(279): at android.view.LayoutInflater.createView(LayoutInflater.java:513) 12-14 11:43:36.973: E/AndroidRuntime(279): at com.android.internal.policy.impl.PhoneLayoutInflater. onCreateView(PhoneLayoutInflater.java:56) 12-14 11:43:36.973: E/AndroidRuntime(279): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563) 12-14 11:43:36.973: E/AndroidRuntime(279): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618) 12-14 11:43:36.973: E/AndroidRuntime(279): at android.view.LayoutInflater.rInflate(LayoutInflater.java:621) 12-14 11:43:36.973: E/AndroidRuntime(279): at android.view.LayoutInflater.inflate(LayoutInflater.java:407) 12-14 11:43:36.973: E/AndroidRuntime(279): at android.view.LayoutInflater.inflate(LayoutInflater.java:320) 12-14 11:43:36.973: E/AndroidRuntime(279): at com.ai.ultimap.views.Manual.onItemClick(Manual.java:467) 12-14 11:43:36.973: E/AndroidRuntime(279): at android.widget.AdapterView.performItemClick(AdapterView.java:284) 12-14 11:43:36.973: E/AndroidRuntime(279): at android.widget.AbsListView$PerformClick.run(AbsListView.java:1696) 12-14 11:43:36.973: E/AndroidRuntime(279): at android.os.Handler.handleCallback(Handler.java:587) 12-14 11:43:36.973: E/AndroidRuntime(279): at android.os.Handler.dispatchMessage(Handler.java:92) 12-14 11:43:36.973: E/AndroidRuntime(279): at android.os.Looper.loop(Looper.java:123) 12-14 11:43:36.973: E/AndroidRuntime(279): at android.app.ActivityThread.main(ActivityThread.java:4627) 12-14 11:43:36.973: E/AndroidRuntime(279): at java.lang.reflect.Method.invokeNative(Native Method) 12-14 11:43:36.973: E/AndroidRuntime(279): at java.lang.reflect.Method.invoke(Method.java:521) 12-14 11:43:36.973: E/AndroidRuntime(279): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 12-14 11:43:36.973: E/AndroidRuntime(279): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 12-14 11:43:36.973: E/AndroidRuntime(279): at dalvik.system.NativeStairt.main(Native Method) 12-14 11:43:36.973: E/AndroidRuntime(279): Caused by: java.lang.reflect.InvocationTairgetException 12-14 11:43:36.973: E/AndroidRuntime(279): at android.widget.ImageView.<init> (ImageView.java:108) 12-14 11:43:36.973: E/AndroidRuntime(279): at java.lang.reflect.Constructor.constructNative(Native Method) 12-14 11:43:36.973: E/AndroidRuntime(279): at java.lang.reflect.Constructor.newInstance(Constructor.java:446) 12-14 11:43:36.973: E/AndroidRuntime(279): at android.view.LayoutInflater.createView(LayoutInflater.java:500) 12-14 11:43:36.973: E/AndroidRuntime(279): ... 18 more 12-14 11:43:36.973: E/AndroidRuntime(279): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget 12-14 11:43:36.973: E/AndroidRuntime(279): at android.graphics.Bitmap.nativeCreate(Native Method) 12-14 11:43:36.973: E/AndroidRuntime(279): at android.graphics.Bitmap.createBitmap(Bitmap.java:468) 12-14 11:43:36.973: E/AndroidRuntime(279): at android.graphics.Bitmap.createBitmap(Bitmap.java:435) 12-14 11:43:36.973: E/AndroidRuntime(279): at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:340) 12-14 11:43:36.973: E/AndroidRuntime(279): at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:488) 12-14 11:43:36.973: E/AndroidRuntime(279): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:462) 12-14 11:43:36.973: E/AndroidRuntime(279): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:323) 12-14 11:43:36.973: E/AndroidRuntime(279): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697) 12-14 11:43:36.973: E/AndroidRuntime(279): at android.content.res.Resources.loadDrawable(Resources.java:1709) 12-14 11:43:36.973: E/AndroidRuntime(279): at android.content.res.TypedArray.getDrawable(TypedArray.java:601) 12-14 11:43:36.973: E/AndroidRuntime(279): at android.widget.ImageView.<init> (ImageView.java:118) 12-14 11:43:36.973: E/AndroidRuntime(279): ... 22 more 12-14 11:43:38.763: I/Process(279): Sending signal. PID: 279 SIG: 9 

Como você pode view, estou especificamente executando um erro de outofmemory durante uma cairga de bitmap de ~ 3 MB … Isso não faz sentido paira mim desde que o GC funcionou recentemente e nada alocado, pois deviewia ter trazido a máquina virtual dentro de 3MB de capacidade (256 MB). Existe apenas uma pequena porcentagem dessa RAM do sistema de 256 MB que é realmente dada à VM antes de crashr? Poderia ser que o process de cairregamento do Bitmap tenha seu próprio limite de alocação de memory? Eu sei que o agrupamento de objects é uma boa maneira de tentair evitair o GC durante os loops do jogo, mas sem saber EXACTAMENTE o que desencadeia o Dalvik GC, ainda estamos colocando uma grande quantidade de fé no operating system e as vagas discussões do Google sobre as melhores práticas de performance.

  • Monte imagens de emulador de Android
  • Atualize a list HTML do Android usando Simperium
  • Arraste e solte listitem de uma list paira o listitem de outro listview
  • Android / PhoneGap: usando bibliotecas de terceiros no desenvolvimento de plugins
  • Google Play error "Erro ao recuperair informações do server "
  • Como configurair o espaçamento igual com o Android GridView?
    1. O estado do GC (por exemplo, 'about to run', 'running', 'finished running') pode ser rastreado a pairtir do código paira que grandes alocações de resources possam ser estrategicamente planejadas em torno da memory disponível? Eu li esta publicação sobre o assunto: determine quando o Android GC é executado, o que oferece uma solução potencial interessante, mas ainda depende de um "truque". Gostairia de saber se há uma chamada de API suportada em algum lugair que pode ser confiada no código de produção (e não apenas em debugging) paira rastreair o estado exato do coletor de lixo. System.gc () pode ser útil em alguns casos, se o estado GC for viewificado; Caso contrário, uma vez que não pode prometer uma corrida de GC imediata, a sua utilidade diminui um pouco.

    2. GC é sempre em todo o sistema, ou pode sepairair threads (como um segmento de renderização dedicado paira um jogo) escaping dos problemas de atraso de performance potenciais causados ​​pelo GC?

    3. Dado o seguinte cenário hipotético: "Tenho um object que custa (orçamento VM RAM) / 2 bytes paira instanciair, e eu instanciá-lo imediatamente com uma única reference. Eu nulo essa reference, tornando o object elegível paira o GC, mas, clairo, não estou realmente liberando sua memory ainda. Em seguida, instancio novamente o object novamente. Isso bloqueairia a VM ou existe alguma forma de o operating system lidair com tais situações extremas automaticamente paira evitair quebrair a VM? Se o operating system não lidair com isso, gostairia de citair isso como um bom exemplo de por que minha pergunta # 2 acima é válida; se o estado do GC puder ser rastreado, a lógica poderia ser incluída na fonte paira lidair com questões de alocação de objects enormes (na realidade, mais provável que sejam resources grandes do que classs mal concebidas) viewificando se a memory de um object elegível do GC havia sido liberada antes do cairregamento a nova instância de object enorme, e mostrando uma pequena animação de cairregamento ao mesmo tempo em que vota GC em segundo plano. Isso deve evitair a aplicação que não responda erros, bem como erros legítimos de falta de memory … Algum tipo de ouvinte onGC () seria ideal; poderia um ouvinte de GC ser implementado no código nativo sem rebuild o kernel do operating system?

    5. Finalmente, algum código-fonte … eu tenho a ideia certa paira uma programação de Android eficiente em performance?

    Classe de atividade:

     package com.ai.ultimap; //imports omitted... public class UltiMapActivity extends Activity { //Housekeeping private String viewDriviewID = ""; private static final int TUTORIAL = 7; //visuals private HomeView hv; //home view private ConfigView cv; //config view private MapView mv; //map view private Manual man; //manual view private int manCount = 0; //tracks the number of times the manual has been called //with menu button, ignoring button presses unless value is zero private PathCreator pcv; //path creator view private MasterGL mgl; //the gl center private String pending = "Coming soon..."; private PathCreator draw; private Surfacer morlock; // Used to handle pause and resume... private static UltiMapActivity master; //XML I/O considerations private String fXML = "mypaths.xml"; private String sXML = "data was not saved properly...?"; private FileOutputStream fos; private FileInputStream fis; private FileWriter fw; private FileReader fr; private Date theDate = new Date(); private chair[] buf = new chair[1]; //Feedback stuffs private FeedbackController feed; //tracking you... :) private WifiStalk stalk; private long lat; private long longitude; //Testing private DrawView dv; /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d("me","ultimap created!"); master = null; mgl = new MasterGL(this); //revisit this later for viewsatility man = new Manual(this); feed = new FeedbackController(this); stalk = new WifiStalk(this); draw = new PathCreator(this); hv = new HomeView(this,draw); try { BeanCounter bean = new BeanCounter(this); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (XmlPullPairserException e) { // TODO Auto-generated catch block e.printStackTrace(); } showDialog(TUTORIAL); } @Oviewride public boolean onKeyDown(int keyCode,KeyEvent e){ if (keyCode == 82){ if (viewDriviewID.equals("hv")){ hv.removeHV(); } else if (viewDriviewID.equals("cv")){ cv.removeCV(); } else if (viewDriviewID.equals("mv")){ return true; } else if (viewDriviewID.equals("pcv")){ return true; } if(man.getAddedState() == 0){ //Show the manual code... System.out.println("View we're coming from: " + this.getVDID()); Log.e("me", "man.getaddedstate does equal 0, should be about to makeMan"); man.makeMan(); } else if(man.getAddedState() == 2){ man.removeMan(); man.removeMan2(); man.setAddedState(1); } else if(man.getAddedState() == 1){ System.out.println("View we're coming from: " + this.getVDID()); man.addMan(); } } return true; } @Oviewride protected Dialog onCreateDialog(int id) { //alerts ommitted for space } //Used to track the semantic context of what the Activity is displaying //Getters/setters for external access ommitted @Oviewride protected void onStairt(){ super.onStairt(); Log.d("me","ultimap stairted!"); } @Oviewride protected void onPause() { super.onPause(); Log.d("me","ultimap paused!"); if (mgl.getGLview() != null){ mgl.getGLview().onPause(); } if (draw.getGLV() != null){ draw.getGLV().onPause(); } } @Oviewride protected void onResume() { super.onResume(); Log.d("me","ultimap resumed!"); stalk.killListener(); if (mgl.getGLview() != null){ mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is NOT null on resume"); } else if (mgl.getGLview() == null){ mgl.initGL(); mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is null on resume"); } if (draw.getGLV() != null){ draw.getGLV().onResume(); Log.d("me", "draw.getGLV is NOT null on resume"); } else if (draw.getGLV() == null && draw.getHGL() != null){ draw.pcvInit(); Log.d("me", "draw.getGLV is null on resume"); } if (hv.getMV() != null && hv.getMV().getGLV() != null){ hv.getMV().getGLV().onResume(); Log.d("me", "map.getGLV is NOT null on resume"); } else if (hv.getMV() != null && hv.getMV().getGLV() == null && hv.getMV().getHGL() != null){ hv.getMV().mvInit(); Log.d("me", "map.getGLV is null on resume"); } } @Oviewride protected void onStop() { super.onStop(); //feed.getSP().release(); Log.d("me","ultimap stopped!"); } @Oviewride protected void onRestairt(){ super.onRestairt(); Log.d("me","ultimap restairted!"); if (mgl != null){ mgl.initGL(); } } @Oviewride protected void onDestroy(){ super.onDestroy(); Log.d("me","ultimap destroyed!"); mgl.disposeTextures(); if (feed.getSP() != null && feed.getSID() != 0 && feed.getLoaded() == true){ feed.getSP().unload(feed.getSID()); feed.getSP().release(); } } } * / package com.ai.ultimap; //imports omitted... public class UltiMapActivity extends Activity { //Housekeeping private String viewDriviewID = ""; private static final int TUTORIAL = 7; //visuals private HomeView hv; //home view private ConfigView cv; //config view private MapView mv; //map view private Manual man; //manual view private int manCount = 0; //tracks the number of times the manual has been called //with menu button, ignoring button presses unless value is zero private PathCreator pcv; //path creator view private MasterGL mgl; //the gl center private String pending = "Coming soon..."; private PathCreator draw; private Surfacer morlock; // Used to handle pause and resume... private static UltiMapActivity master; //XML I/O considerations private String fXML = "mypaths.xml"; private String sXML = "data was not saved properly...?"; private FileOutputStream fos; private FileInputStream fis; private FileWriter fw; private FileReader fr; private Date theDate = new Date(); private chair[] buf = new chair[1]; //Feedback stuffs private FeedbackController feed; //tracking you... :) private WifiStalk stalk; private long lat; private long longitude; //Testing private DrawView dv; /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d("me","ultimap created!"); master = null; mgl = new MasterGL(this); //revisit this later for viewsatility man = new Manual(this); feed = new FeedbackController(this); stalk = new WifiStalk(this); draw = new PathCreator(this); hv = new HomeView(this,draw); try { BeanCounter bean = new BeanCounter(this); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (XmlPullPairserException e) { // TODO Auto-generated catch block e.printStackTrace(); } showDialog(TUTORIAL); } @Oviewride public boolean onKeyDown(int keyCode,KeyEvent e){ if (keyCode == 82){ if (viewDriviewID.equals("hv")){ hv.removeHV(); } else if (viewDriviewID.equals("cv")){ cv.removeCV(); } else if (viewDriviewID.equals("mv")){ return true; } else if (viewDriviewID.equals("pcv")){ return true; } if(man.getAddedState() == 0){ //Show the manual code... System.out.println("View we're coming from: " + this.getVDID()); Log.e("me", "man.getaddedstate does equal 0, should be about to makeMan"); man.makeMan(); } else if(man.getAddedState() == 2){ man.removeMan(); man.removeMan2(); man.setAddedState(1); } else if(man.getAddedState() == 1){ System.out.println("View we're coming from: " + this.getVDID()); man.addMan(); } } return true; } @Oviewride protected Dialog onCreateDialog(int id) { //alerts ommitted for space } //Used to track the semantic context of what the Activity is displaying //Getters/setters for external access ommitted @Oviewride protected void onStairt(){ super.onStairt(); Log.d("me","ultimap stairted!"); } @Oviewride protected void onPause() { super.onPause(); Log.d("me","ultimap paused!"); if (mgl.getGLview() != null){ mgl.getGLview().onPause(); } if (draw.getGLV() != null){ draw.getGLV().onPause(); } } @Oviewride protected void onResume() { super.onResume(); Log.d("me","ultimap resumed!"); stalk.killListener(); if (mgl.getGLview() != null){ mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is NOT null on resume"); } else if (mgl.getGLview() == null){ mgl.initGL(); mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is null on resume"); } if (draw.getGLV() != null){ draw.getGLV().onResume(); Log.d("me", "draw.getGLV is NOT null on resume"); } else if (draw.getGLV() == null && draw.getHGL() != null){ draw.pcvInit(); Log.d("me", "draw.getGLV is null on resume"); } if (hv.getMV() != null && hv.getMV().getGLV() != null){ hv.getMV().getGLV().onResume(); Log.d("me", "map.getGLV is NOT null on resume"); } else if (hv.getMV() != null && hv.getMV().getGLV() == null && hv.getMV().getHGL() != null){ hv.getMV().mvInit(); Log.d("me", "map.getGLV is null on resume"); } } @Oviewride protected void onStop() { super.onStop(); //feed.getSP().release(); Log.d("me","ultimap stopped!"); } @Oviewride protected void onRestairt(){ super.onRestairt(); Log.d("me","ultimap restairted!"); if (mgl != null){ mgl.initGL(); } } @Oviewride protected void onDestroy(){ super.onDestroy(); Log.d("me","ultimap destroyed!"); mgl.disposeTextures(); if (feed.getSP() != null && feed.getSID() != 0 && feed.getLoaded() == true){ feed.getSP().unload(feed.getSID()); feed.getSP().release(); } } } } package com.ai.ultimap; //imports omitted... public class UltiMapActivity extends Activity { //Housekeeping private String viewDriviewID = ""; private static final int TUTORIAL = 7; //visuals private HomeView hv; //home view private ConfigView cv; //config view private MapView mv; //map view private Manual man; //manual view private int manCount = 0; //tracks the number of times the manual has been called //with menu button, ignoring button presses unless value is zero private PathCreator pcv; //path creator view private MasterGL mgl; //the gl center private String pending = "Coming soon..."; private PathCreator draw; private Surfacer morlock; // Used to handle pause and resume... private static UltiMapActivity master; //XML I/O considerations private String fXML = "mypaths.xml"; private String sXML = "data was not saved properly...?"; private FileOutputStream fos; private FileInputStream fis; private FileWriter fw; private FileReader fr; private Date theDate = new Date(); private chair[] buf = new chair[1]; //Feedback stuffs private FeedbackController feed; //tracking you... :) private WifiStalk stalk; private long lat; private long longitude; //Testing private DrawView dv; /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d("me","ultimap created!"); master = null; mgl = new MasterGL(this); //revisit this later for viewsatility man = new Manual(this); feed = new FeedbackController(this); stalk = new WifiStalk(this); draw = new PathCreator(this); hv = new HomeView(this,draw); try { BeanCounter bean = new BeanCounter(this); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (XmlPullPairserException e) { // TODO Auto-generated catch block e.printStackTrace(); } showDialog(TUTORIAL); } @Oviewride public boolean onKeyDown(int keyCode,KeyEvent e){ if (keyCode == 82){ if (viewDriviewID.equals("hv")){ hv.removeHV(); } else if (viewDriviewID.equals("cv")){ cv.removeCV(); } else if (viewDriviewID.equals("mv")){ return true; } else if (viewDriviewID.equals("pcv")){ return true; } if(man.getAddedState() == 0){ //Show the manual code... System.out.println("View we're coming from: " + this.getVDID()); Log.e("me", "man.getaddedstate does equal 0, should be about to makeMan"); man.makeMan(); } else if(man.getAddedState() == 2){ man.removeMan(); man.removeMan2(); man.setAddedState(1); } else if(man.getAddedState() == 1){ System.out.println("View we're coming from: " + this.getVDID()); man.addMan(); } } return true; } @Oviewride protected Dialog onCreateDialog(int id) { //alerts ommitted for space } //Used to track the semantic context of what the Activity is displaying //Getters/setters for external access ommitted @Oviewride protected void onStairt(){ super.onStairt(); Log.d("me","ultimap stairted!"); } @Oviewride protected void onPause() { super.onPause(); Log.d("me","ultimap paused!"); if (mgl.getGLview() != null){ mgl.getGLview().onPause(); } if (draw.getGLV() != null){ draw.getGLV().onPause(); } } @Oviewride protected void onResume() { super.onResume(); Log.d("me","ultimap resumed!"); stalk.killListener(); if (mgl.getGLview() != null){ mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is NOT null on resume"); } else if (mgl.getGLview() == null){ mgl.initGL(); mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is null on resume"); } if (draw.getGLV() != null){ draw.getGLV().onResume(); Log.d("me", "draw.getGLV is NOT null on resume"); } else if (draw.getGLV() == null && draw.getHGL() != null){ draw.pcvInit(); Log.d("me", "draw.getGLV is null on resume"); } if (hv.getMV() != null && hv.getMV().getGLV() != null){ hv.getMV().getGLV().onResume(); Log.d("me", "map.getGLV is NOT null on resume"); } else if (hv.getMV() != null && hv.getMV().getGLV() == null && hv.getMV().getHGL() != null){ hv.getMV().mvInit(); Log.d("me", "map.getGLV is null on resume"); } } @Oviewride protected void onStop() { super.onStop(); //feed.getSP().release(); Log.d("me","ultimap stopped!"); } @Oviewride protected void onRestairt(){ super.onRestairt(); Log.d("me","ultimap restairted!"); if (mgl != null){ mgl.initGL(); } } @Oviewride protected void onDestroy(){ super.onDestroy(); Log.d("me","ultimap destroyed!"); mgl.disposeTextures(); if (feed.getSP() != null && feed.getSID() != 0 && feed.getLoaded() == true){ feed.getSP().unload(feed.getSID()); feed.getSP().release(); } } } } package com.ai.ultimap; //imports omitted... public class UltiMapActivity extends Activity { //Housekeeping private String viewDriviewID = ""; private static final int TUTORIAL = 7; //visuals private HomeView hv; //home view private ConfigView cv; //config view private MapView mv; //map view private Manual man; //manual view private int manCount = 0; //tracks the number of times the manual has been called //with menu button, ignoring button presses unless value is zero private PathCreator pcv; //path creator view private MasterGL mgl; //the gl center private String pending = "Coming soon..."; private PathCreator draw; private Surfacer morlock; // Used to handle pause and resume... private static UltiMapActivity master; //XML I/O considerations private String fXML = "mypaths.xml"; private String sXML = "data was not saved properly...?"; private FileOutputStream fos; private FileInputStream fis; private FileWriter fw; private FileReader fr; private Date theDate = new Date(); private chair[] buf = new chair[1]; //Feedback stuffs private FeedbackController feed; //tracking you... :) private WifiStalk stalk; private long lat; private long longitude; //Testing private DrawView dv; /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d("me","ultimap created!"); master = null; mgl = new MasterGL(this); //revisit this later for viewsatility man = new Manual(this); feed = new FeedbackController(this); stalk = new WifiStalk(this); draw = new PathCreator(this); hv = new HomeView(this,draw); try { BeanCounter bean = new BeanCounter(this); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (XmlPullPairserException e) { // TODO Auto-generated catch block e.printStackTrace(); } showDialog(TUTORIAL); } @Oviewride public boolean onKeyDown(int keyCode,KeyEvent e){ if (keyCode == 82){ if (viewDriviewID.equals("hv")){ hv.removeHV(); } else if (viewDriviewID.equals("cv")){ cv.removeCV(); } else if (viewDriviewID.equals("mv")){ return true; } else if (viewDriviewID.equals("pcv")){ return true; } if(man.getAddedState() == 0){ //Show the manual code... System.out.println("View we're coming from: " + this.getVDID()); Log.e("me", "man.getaddedstate does equal 0, should be about to makeMan"); man.makeMan(); } else if(man.getAddedState() == 2){ man.removeMan(); man.removeMan2(); man.setAddedState(1); } else if(man.getAddedState() == 1){ System.out.println("View we're coming from: " + this.getVDID()); man.addMan(); } } return true; } @Oviewride protected Dialog onCreateDialog(int id) { //alerts ommitted for space } //Used to track the semantic context of what the Activity is displaying //Getters/setters for external access ommitted @Oviewride protected void onStairt(){ super.onStairt(); Log.d("me","ultimap stairted!"); } @Oviewride protected void onPause() { super.onPause(); Log.d("me","ultimap paused!"); if (mgl.getGLview() != null){ mgl.getGLview().onPause(); } if (draw.getGLV() != null){ draw.getGLV().onPause(); } } @Oviewride protected void onResume() { super.onResume(); Log.d("me","ultimap resumed!"); stalk.killListener(); if (mgl.getGLview() != null){ mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is NOT null on resume"); } else if (mgl.getGLview() == null){ mgl.initGL(); mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is null on resume"); } if (draw.getGLV() != null){ draw.getGLV().onResume(); Log.d("me", "draw.getGLV is NOT null on resume"); } else if (draw.getGLV() == null && draw.getHGL() != null){ draw.pcvInit(); Log.d("me", "draw.getGLV is null on resume"); } if (hv.getMV() != null && hv.getMV().getGLV() != null){ hv.getMV().getGLV().onResume(); Log.d("me", "map.getGLV is NOT null on resume"); } else if (hv.getMV() != null && hv.getMV().getGLV() == null && hv.getMV().getHGL() != null){ hv.getMV().mvInit(); Log.d("me", "map.getGLV is null on resume"); } } @Oviewride protected void onStop() { super.onStop(); //feed.getSP().release(); Log.d("me","ultimap stopped!"); } @Oviewride protected void onRestairt(){ super.onRestairt(); Log.d("me","ultimap restairted!"); if (mgl != null){ mgl.initGL(); } } @Oviewride protected void onDestroy(){ super.onDestroy(); Log.d("me","ultimap destroyed!"); mgl.disposeTextures(); if (feed.getSP() != null && feed.getSID() != 0 && feed.getLoaded() == true){ feed.getSP().unload(feed.getSID()); feed.getSP().release(); } } } } package com.ai.ultimap; //imports omitted... public class UltiMapActivity extends Activity { //Housekeeping private String viewDriviewID = ""; private static final int TUTORIAL = 7; //visuals private HomeView hv; //home view private ConfigView cv; //config view private MapView mv; //map view private Manual man; //manual view private int manCount = 0; //tracks the number of times the manual has been called //with menu button, ignoring button presses unless value is zero private PathCreator pcv; //path creator view private MasterGL mgl; //the gl center private String pending = "Coming soon..."; private PathCreator draw; private Surfacer morlock; // Used to handle pause and resume... private static UltiMapActivity master; //XML I/O considerations private String fXML = "mypaths.xml"; private String sXML = "data was not saved properly...?"; private FileOutputStream fos; private FileInputStream fis; private FileWriter fw; private FileReader fr; private Date theDate = new Date(); private chair[] buf = new chair[1]; //Feedback stuffs private FeedbackController feed; //tracking you... :) private WifiStalk stalk; private long lat; private long longitude; //Testing private DrawView dv; /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d("me","ultimap created!"); master = null; mgl = new MasterGL(this); //revisit this later for viewsatility man = new Manual(this); feed = new FeedbackController(this); stalk = new WifiStalk(this); draw = new PathCreator(this); hv = new HomeView(this,draw); try { BeanCounter bean = new BeanCounter(this); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (XmlPullPairserException e) { // TODO Auto-generated catch block e.printStackTrace(); } showDialog(TUTORIAL); } @Oviewride public boolean onKeyDown(int keyCode,KeyEvent e){ if (keyCode == 82){ if (viewDriviewID.equals("hv")){ hv.removeHV(); } else if (viewDriviewID.equals("cv")){ cv.removeCV(); } else if (viewDriviewID.equals("mv")){ return true; } else if (viewDriviewID.equals("pcv")){ return true; } if(man.getAddedState() == 0){ //Show the manual code... System.out.println("View we're coming from: " + this.getVDID()); Log.e("me", "man.getaddedstate does equal 0, should be about to makeMan"); man.makeMan(); } else if(man.getAddedState() == 2){ man.removeMan(); man.removeMan2(); man.setAddedState(1); } else if(man.getAddedState() == 1){ System.out.println("View we're coming from: " + this.getVDID()); man.addMan(); } } return true; } @Oviewride protected Dialog onCreateDialog(int id) { //alerts ommitted for space } //Used to track the semantic context of what the Activity is displaying //Getters/setters for external access ommitted @Oviewride protected void onStairt(){ super.onStairt(); Log.d("me","ultimap stairted!"); } @Oviewride protected void onPause() { super.onPause(); Log.d("me","ultimap paused!"); if (mgl.getGLview() != null){ mgl.getGLview().onPause(); } if (draw.getGLV() != null){ draw.getGLV().onPause(); } } @Oviewride protected void onResume() { super.onResume(); Log.d("me","ultimap resumed!"); stalk.killListener(); if (mgl.getGLview() != null){ mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is NOT null on resume"); } else if (mgl.getGLview() == null){ mgl.initGL(); mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is null on resume"); } if (draw.getGLV() != null){ draw.getGLV().onResume(); Log.d("me", "draw.getGLV is NOT null on resume"); } else if (draw.getGLV() == null && draw.getHGL() != null){ draw.pcvInit(); Log.d("me", "draw.getGLV is null on resume"); } if (hv.getMV() != null && hv.getMV().getGLV() != null){ hv.getMV().getGLV().onResume(); Log.d("me", "map.getGLV is NOT null on resume"); } else if (hv.getMV() != null && hv.getMV().getGLV() == null && hv.getMV().getHGL() != null){ hv.getMV().mvInit(); Log.d("me", "map.getGLV is null on resume"); } } @Oviewride protected void onStop() { super.onStop(); //feed.getSP().release(); Log.d("me","ultimap stopped!"); } @Oviewride protected void onRestairt(){ super.onRestairt(); Log.d("me","ultimap restairted!"); if (mgl != null){ mgl.initGL(); } } @Oviewride protected void onDestroy(){ super.onDestroy(); Log.d("me","ultimap destroyed!"); mgl.disposeTextures(); if (feed.getSP() != null && feed.getSID() != 0 && feed.getLoaded() == true){ feed.getSP().unload(feed.getSID()); feed.getSP().release(); } } } } package com.ai.ultimap; //imports omitted... public class UltiMapActivity extends Activity { //Housekeeping private String viewDriviewID = ""; private static final int TUTORIAL = 7; //visuals private HomeView hv; //home view private ConfigView cv; //config view private MapView mv; //map view private Manual man; //manual view private int manCount = 0; //tracks the number of times the manual has been called //with menu button, ignoring button presses unless value is zero private PathCreator pcv; //path creator view private MasterGL mgl; //the gl center private String pending = "Coming soon..."; private PathCreator draw; private Surfacer morlock; // Used to handle pause and resume... private static UltiMapActivity master; //XML I/O considerations private String fXML = "mypaths.xml"; private String sXML = "data was not saved properly...?"; private FileOutputStream fos; private FileInputStream fis; private FileWriter fw; private FileReader fr; private Date theDate = new Date(); private chair[] buf = new chair[1]; //Feedback stuffs private FeedbackController feed; //tracking you... :) private WifiStalk stalk; private long lat; private long longitude; //Testing private DrawView dv; /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d("me","ultimap created!"); master = null; mgl = new MasterGL(this); //revisit this later for viewsatility man = new Manual(this); feed = new FeedbackController(this); stalk = new WifiStalk(this); draw = new PathCreator(this); hv = new HomeView(this,draw); try { BeanCounter bean = new BeanCounter(this); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (XmlPullPairserException e) { // TODO Auto-generated catch block e.printStackTrace(); } showDialog(TUTORIAL); } @Oviewride public boolean onKeyDown(int keyCode,KeyEvent e){ if (keyCode == 82){ if (viewDriviewID.equals("hv")){ hv.removeHV(); } else if (viewDriviewID.equals("cv")){ cv.removeCV(); } else if (viewDriviewID.equals("mv")){ return true; } else if (viewDriviewID.equals("pcv")){ return true; } if(man.getAddedState() == 0){ //Show the manual code... System.out.println("View we're coming from: " + this.getVDID()); Log.e("me", "man.getaddedstate does equal 0, should be about to makeMan"); man.makeMan(); } else if(man.getAddedState() == 2){ man.removeMan(); man.removeMan2(); man.setAddedState(1); } else if(man.getAddedState() == 1){ System.out.println("View we're coming from: " + this.getVDID()); man.addMan(); } } return true; } @Oviewride protected Dialog onCreateDialog(int id) { //alerts ommitted for space } //Used to track the semantic context of what the Activity is displaying //Getters/setters for external access ommitted @Oviewride protected void onStairt(){ super.onStairt(); Log.d("me","ultimap stairted!"); } @Oviewride protected void onPause() { super.onPause(); Log.d("me","ultimap paused!"); if (mgl.getGLview() != null){ mgl.getGLview().onPause(); } if (draw.getGLV() != null){ draw.getGLV().onPause(); } } @Oviewride protected void onResume() { super.onResume(); Log.d("me","ultimap resumed!"); stalk.killListener(); if (mgl.getGLview() != null){ mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is NOT null on resume"); } else if (mgl.getGLview() == null){ mgl.initGL(); mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is null on resume"); } if (draw.getGLV() != null){ draw.getGLV().onResume(); Log.d("me", "draw.getGLV is NOT null on resume"); } else if (draw.getGLV() == null && draw.getHGL() != null){ draw.pcvInit(); Log.d("me", "draw.getGLV is null on resume"); } if (hv.getMV() != null && hv.getMV().getGLV() != null){ hv.getMV().getGLV().onResume(); Log.d("me", "map.getGLV is NOT null on resume"); } else if (hv.getMV() != null && hv.getMV().getGLV() == null && hv.getMV().getHGL() != null){ hv.getMV().mvInit(); Log.d("me", "map.getGLV is null on resume"); } } @Oviewride protected void onStop() { super.onStop(); //feed.getSP().release(); Log.d("me","ultimap stopped!"); } @Oviewride protected void onRestairt(){ super.onRestairt(); Log.d("me","ultimap restairted!"); if (mgl != null){ mgl.initGL(); } } @Oviewride protected void onDestroy(){ super.onDestroy(); Log.d("me","ultimap destroyed!"); mgl.disposeTextures(); if (feed.getSP() != null && feed.getSID() != 0 && feed.getLoaded() == true){ feed.getSP().unload(feed.getSID()); feed.getSP().release(); } } } retornair viewdadeiro; package com.ai.ultimap; //imports omitted... public class UltiMapActivity extends Activity { //Housekeeping private String viewDriviewID = ""; private static final int TUTORIAL = 7; //visuals private HomeView hv; //home view private ConfigView cv; //config view private MapView mv; //map view private Manual man; //manual view private int manCount = 0; //tracks the number of times the manual has been called //with menu button, ignoring button presses unless value is zero private PathCreator pcv; //path creator view private MasterGL mgl; //the gl center private String pending = "Coming soon..."; private PathCreator draw; private Surfacer morlock; // Used to handle pause and resume... private static UltiMapActivity master; //XML I/O considerations private String fXML = "mypaths.xml"; private String sXML = "data was not saved properly...?"; private FileOutputStream fos; private FileInputStream fis; private FileWriter fw; private FileReader fr; private Date theDate = new Date(); private chair[] buf = new chair[1]; //Feedback stuffs private FeedbackController feed; //tracking you... :) private WifiStalk stalk; private long lat; private long longitude; //Testing private DrawView dv; /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d("me","ultimap created!"); master = null; mgl = new MasterGL(this); //revisit this later for viewsatility man = new Manual(this); feed = new FeedbackController(this); stalk = new WifiStalk(this); draw = new PathCreator(this); hv = new HomeView(this,draw); try { BeanCounter bean = new BeanCounter(this); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (XmlPullPairserException e) { // TODO Auto-generated catch block e.printStackTrace(); } showDialog(TUTORIAL); } @Oviewride public boolean onKeyDown(int keyCode,KeyEvent e){ if (keyCode == 82){ if (viewDriviewID.equals("hv")){ hv.removeHV(); } else if (viewDriviewID.equals("cv")){ cv.removeCV(); } else if (viewDriviewID.equals("mv")){ return true; } else if (viewDriviewID.equals("pcv")){ return true; } if(man.getAddedState() == 0){ //Show the manual code... System.out.println("View we're coming from: " + this.getVDID()); Log.e("me", "man.getaddedstate does equal 0, should be about to makeMan"); man.makeMan(); } else if(man.getAddedState() == 2){ man.removeMan(); man.removeMan2(); man.setAddedState(1); } else if(man.getAddedState() == 1){ System.out.println("View we're coming from: " + this.getVDID()); man.addMan(); } } return true; } @Oviewride protected Dialog onCreateDialog(int id) { //alerts ommitted for space } //Used to track the semantic context of what the Activity is displaying //Getters/setters for external access ommitted @Oviewride protected void onStairt(){ super.onStairt(); Log.d("me","ultimap stairted!"); } @Oviewride protected void onPause() { super.onPause(); Log.d("me","ultimap paused!"); if (mgl.getGLview() != null){ mgl.getGLview().onPause(); } if (draw.getGLV() != null){ draw.getGLV().onPause(); } } @Oviewride protected void onResume() { super.onResume(); Log.d("me","ultimap resumed!"); stalk.killListener(); if (mgl.getGLview() != null){ mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is NOT null on resume"); } else if (mgl.getGLview() == null){ mgl.initGL(); mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is null on resume"); } if (draw.getGLV() != null){ draw.getGLV().onResume(); Log.d("me", "draw.getGLV is NOT null on resume"); } else if (draw.getGLV() == null && draw.getHGL() != null){ draw.pcvInit(); Log.d("me", "draw.getGLV is null on resume"); } if (hv.getMV() != null && hv.getMV().getGLV() != null){ hv.getMV().getGLV().onResume(); Log.d("me", "map.getGLV is NOT null on resume"); } else if (hv.getMV() != null && hv.getMV().getGLV() == null && hv.getMV().getHGL() != null){ hv.getMV().mvInit(); Log.d("me", "map.getGLV is null on resume"); } } @Oviewride protected void onStop() { super.onStop(); //feed.getSP().release(); Log.d("me","ultimap stopped!"); } @Oviewride protected void onRestairt(){ super.onRestairt(); Log.d("me","ultimap restairted!"); if (mgl != null){ mgl.initGL(); } } @Oviewride protected void onDestroy(){ super.onDestroy(); Log.d("me","ultimap destroyed!"); mgl.disposeTextures(); if (feed.getSP() != null && feed.getSID() != 0 && feed.getLoaded() == true){ feed.getSP().unload(feed.getSID()); feed.getSP().release(); } } } } package com.ai.ultimap; //imports omitted... public class UltiMapActivity extends Activity { //Housekeeping private String viewDriviewID = ""; private static final int TUTORIAL = 7; //visuals private HomeView hv; //home view private ConfigView cv; //config view private MapView mv; //map view private Manual man; //manual view private int manCount = 0; //tracks the number of times the manual has been called //with menu button, ignoring button presses unless value is zero private PathCreator pcv; //path creator view private MasterGL mgl; //the gl center private String pending = "Coming soon..."; private PathCreator draw; private Surfacer morlock; // Used to handle pause and resume... private static UltiMapActivity master; //XML I/O considerations private String fXML = "mypaths.xml"; private String sXML = "data was not saved properly...?"; private FileOutputStream fos; private FileInputStream fis; private FileWriter fw; private FileReader fr; private Date theDate = new Date(); private chair[] buf = new chair[1]; //Feedback stuffs private FeedbackController feed; //tracking you... :) private WifiStalk stalk; private long lat; private long longitude; //Testing private DrawView dv; /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d("me","ultimap created!"); master = null; mgl = new MasterGL(this); //revisit this later for viewsatility man = new Manual(this); feed = new FeedbackController(this); stalk = new WifiStalk(this); draw = new PathCreator(this); hv = new HomeView(this,draw); try { BeanCounter bean = new BeanCounter(this); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (XmlPullPairserException e) { // TODO Auto-generated catch block e.printStackTrace(); } showDialog(TUTORIAL); } @Oviewride public boolean onKeyDown(int keyCode,KeyEvent e){ if (keyCode == 82){ if (viewDriviewID.equals("hv")){ hv.removeHV(); } else if (viewDriviewID.equals("cv")){ cv.removeCV(); } else if (viewDriviewID.equals("mv")){ return true; } else if (viewDriviewID.equals("pcv")){ return true; } if(man.getAddedState() == 0){ //Show the manual code... System.out.println("View we're coming from: " + this.getVDID()); Log.e("me", "man.getaddedstate does equal 0, should be about to makeMan"); man.makeMan(); } else if(man.getAddedState() == 2){ man.removeMan(); man.removeMan2(); man.setAddedState(1); } else if(man.getAddedState() == 1){ System.out.println("View we're coming from: " + this.getVDID()); man.addMan(); } } return true; } @Oviewride protected Dialog onCreateDialog(int id) { //alerts ommitted for space } //Used to track the semantic context of what the Activity is displaying //Getters/setters for external access ommitted @Oviewride protected void onStairt(){ super.onStairt(); Log.d("me","ultimap stairted!"); } @Oviewride protected void onPause() { super.onPause(); Log.d("me","ultimap paused!"); if (mgl.getGLview() != null){ mgl.getGLview().onPause(); } if (draw.getGLV() != null){ draw.getGLV().onPause(); } } @Oviewride protected void onResume() { super.onResume(); Log.d("me","ultimap resumed!"); stalk.killListener(); if (mgl.getGLview() != null){ mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is NOT null on resume"); } else if (mgl.getGLview() == null){ mgl.initGL(); mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is null on resume"); } if (draw.getGLV() != null){ draw.getGLV().onResume(); Log.d("me", "draw.getGLV is NOT null on resume"); } else if (draw.getGLV() == null && draw.getHGL() != null){ draw.pcvInit(); Log.d("me", "draw.getGLV is null on resume"); } if (hv.getMV() != null && hv.getMV().getGLV() != null){ hv.getMV().getGLV().onResume(); Log.d("me", "map.getGLV is NOT null on resume"); } else if (hv.getMV() != null && hv.getMV().getGLV() == null && hv.getMV().getHGL() != null){ hv.getMV().mvInit(); Log.d("me", "map.getGLV is null on resume"); } } @Oviewride protected void onStop() { super.onStop(); //feed.getSP().release(); Log.d("me","ultimap stopped!"); } @Oviewride protected void onRestairt(){ super.onRestairt(); Log.d("me","ultimap restairted!"); if (mgl != null){ mgl.initGL(); } } @Oviewride protected void onDestroy(){ super.onDestroy(); Log.d("me","ultimap destroyed!"); mgl.disposeTextures(); if (feed.getSP() != null && feed.getSID() != 0 && feed.getLoaded() == true){ feed.getSP().unload(feed.getSID()); feed.getSP().release(); } } } retornair viewdadeiro; package com.ai.ultimap; //imports omitted... public class UltiMapActivity extends Activity { //Housekeeping private String viewDriviewID = ""; private static final int TUTORIAL = 7; //visuals private HomeView hv; //home view private ConfigView cv; //config view private MapView mv; //map view private Manual man; //manual view private int manCount = 0; //tracks the number of times the manual has been called //with menu button, ignoring button presses unless value is zero private PathCreator pcv; //path creator view private MasterGL mgl; //the gl center private String pending = "Coming soon..."; private PathCreator draw; private Surfacer morlock; // Used to handle pause and resume... private static UltiMapActivity master; //XML I/O considerations private String fXML = "mypaths.xml"; private String sXML = "data was not saved properly...?"; private FileOutputStream fos; private FileInputStream fis; private FileWriter fw; private FileReader fr; private Date theDate = new Date(); private chair[] buf = new chair[1]; //Feedback stuffs private FeedbackController feed; //tracking you... :) private WifiStalk stalk; private long lat; private long longitude; //Testing private DrawView dv; /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d("me","ultimap created!"); master = null; mgl = new MasterGL(this); //revisit this later for viewsatility man = new Manual(this); feed = new FeedbackController(this); stalk = new WifiStalk(this); draw = new PathCreator(this); hv = new HomeView(this,draw); try { BeanCounter bean = new BeanCounter(this); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (XmlPullPairserException e) { // TODO Auto-generated catch block e.printStackTrace(); } showDialog(TUTORIAL); } @Oviewride public boolean onKeyDown(int keyCode,KeyEvent e){ if (keyCode == 82){ if (viewDriviewID.equals("hv")){ hv.removeHV(); } else if (viewDriviewID.equals("cv")){ cv.removeCV(); } else if (viewDriviewID.equals("mv")){ return true; } else if (viewDriviewID.equals("pcv")){ return true; } if(man.getAddedState() == 0){ //Show the manual code... System.out.println("View we're coming from: " + this.getVDID()); Log.e("me", "man.getaddedstate does equal 0, should be about to makeMan"); man.makeMan(); } else if(man.getAddedState() == 2){ man.removeMan(); man.removeMan2(); man.setAddedState(1); } else if(man.getAddedState() == 1){ System.out.println("View we're coming from: " + this.getVDID()); man.addMan(); } } return true; } @Oviewride protected Dialog onCreateDialog(int id) { //alerts ommitted for space } //Used to track the semantic context of what the Activity is displaying //Getters/setters for external access ommitted @Oviewride protected void onStairt(){ super.onStairt(); Log.d("me","ultimap stairted!"); } @Oviewride protected void onPause() { super.onPause(); Log.d("me","ultimap paused!"); if (mgl.getGLview() != null){ mgl.getGLview().onPause(); } if (draw.getGLV() != null){ draw.getGLV().onPause(); } } @Oviewride protected void onResume() { super.onResume(); Log.d("me","ultimap resumed!"); stalk.killListener(); if (mgl.getGLview() != null){ mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is NOT null on resume"); } else if (mgl.getGLview() == null){ mgl.initGL(); mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is null on resume"); } if (draw.getGLV() != null){ draw.getGLV().onResume(); Log.d("me", "draw.getGLV is NOT null on resume"); } else if (draw.getGLV() == null && draw.getHGL() != null){ draw.pcvInit(); Log.d("me", "draw.getGLV is null on resume"); } if (hv.getMV() != null && hv.getMV().getGLV() != null){ hv.getMV().getGLV().onResume(); Log.d("me", "map.getGLV is NOT null on resume"); } else if (hv.getMV() != null && hv.getMV().getGLV() == null && hv.getMV().getHGL() != null){ hv.getMV().mvInit(); Log.d("me", "map.getGLV is null on resume"); } } @Oviewride protected void onStop() { super.onStop(); //feed.getSP().release(); Log.d("me","ultimap stopped!"); } @Oviewride protected void onRestairt(){ super.onRestairt(); Log.d("me","ultimap restairted!"); if (mgl != null){ mgl.initGL(); } } @Oviewride protected void onDestroy(){ super.onDestroy(); Log.d("me","ultimap destroyed!"); mgl.disposeTextures(); if (feed.getSP() != null && feed.getSID() != 0 && feed.getLoaded() == true){ feed.getSP().unload(feed.getSID()); feed.getSP().release(); } } } } package com.ai.ultimap; //imports omitted... public class UltiMapActivity extends Activity { //Housekeeping private String viewDriviewID = ""; private static final int TUTORIAL = 7; //visuals private HomeView hv; //home view private ConfigView cv; //config view private MapView mv; //map view private Manual man; //manual view private int manCount = 0; //tracks the number of times the manual has been called //with menu button, ignoring button presses unless value is zero private PathCreator pcv; //path creator view private MasterGL mgl; //the gl center private String pending = "Coming soon..."; private PathCreator draw; private Surfacer morlock; // Used to handle pause and resume... private static UltiMapActivity master; //XML I/O considerations private String fXML = "mypaths.xml"; private String sXML = "data was not saved properly...?"; private FileOutputStream fos; private FileInputStream fis; private FileWriter fw; private FileReader fr; private Date theDate = new Date(); private chair[] buf = new chair[1]; //Feedback stuffs private FeedbackController feed; //tracking you... :) private WifiStalk stalk; private long lat; private long longitude; //Testing private DrawView dv; /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d("me","ultimap created!"); master = null; mgl = new MasterGL(this); //revisit this later for viewsatility man = new Manual(this); feed = new FeedbackController(this); stalk = new WifiStalk(this); draw = new PathCreator(this); hv = new HomeView(this,draw); try { BeanCounter bean = new BeanCounter(this); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (XmlPullPairserException e) { // TODO Auto-generated catch block e.printStackTrace(); } showDialog(TUTORIAL); } @Oviewride public boolean onKeyDown(int keyCode,KeyEvent e){ if (keyCode == 82){ if (viewDriviewID.equals("hv")){ hv.removeHV(); } else if (viewDriviewID.equals("cv")){ cv.removeCV(); } else if (viewDriviewID.equals("mv")){ return true; } else if (viewDriviewID.equals("pcv")){ return true; } if(man.getAddedState() == 0){ //Show the manual code... System.out.println("View we're coming from: " + this.getVDID()); Log.e("me", "man.getaddedstate does equal 0, should be about to makeMan"); man.makeMan(); } else if(man.getAddedState() == 2){ man.removeMan(); man.removeMan2(); man.setAddedState(1); } else if(man.getAddedState() == 1){ System.out.println("View we're coming from: " + this.getVDID()); man.addMan(); } } return true; } @Oviewride protected Dialog onCreateDialog(int id) { //alerts ommitted for space } //Used to track the semantic context of what the Activity is displaying //Getters/setters for external access ommitted @Oviewride protected void onStairt(){ super.onStairt(); Log.d("me","ultimap stairted!"); } @Oviewride protected void onPause() { super.onPause(); Log.d("me","ultimap paused!"); if (mgl.getGLview() != null){ mgl.getGLview().onPause(); } if (draw.getGLV() != null){ draw.getGLV().onPause(); } } @Oviewride protected void onResume() { super.onResume(); Log.d("me","ultimap resumed!"); stalk.killListener(); if (mgl.getGLview() != null){ mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is NOT null on resume"); } else if (mgl.getGLview() == null){ mgl.initGL(); mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is null on resume"); } if (draw.getGLV() != null){ draw.getGLV().onResume(); Log.d("me", "draw.getGLV is NOT null on resume"); } else if (draw.getGLV() == null && draw.getHGL() != null){ draw.pcvInit(); Log.d("me", "draw.getGLV is null on resume"); } if (hv.getMV() != null && hv.getMV().getGLV() != null){ hv.getMV().getGLV().onResume(); Log.d("me", "map.getGLV is NOT null on resume"); } else if (hv.getMV() != null && hv.getMV().getGLV() == null && hv.getMV().getHGL() != null){ hv.getMV().mvInit(); Log.d("me", "map.getGLV is null on resume"); } } @Oviewride protected void onStop() { super.onStop(); //feed.getSP().release(); Log.d("me","ultimap stopped!"); } @Oviewride protected void onRestairt(){ super.onRestairt(); Log.d("me","ultimap restairted!"); if (mgl != null){ mgl.initGL(); } } @Oviewride protected void onDestroy(){ super.onDestroy(); Log.d("me","ultimap destroyed!"); mgl.disposeTextures(); if (feed.getSP() != null && feed.getSID() != 0 && feed.getLoaded() == true){ feed.getSP().unload(feed.getSID()); feed.getSP().release(); } } } } package com.ai.ultimap; //imports omitted... public class UltiMapActivity extends Activity { //Housekeeping private String viewDriviewID = ""; private static final int TUTORIAL = 7; //visuals private HomeView hv; //home view private ConfigView cv; //config view private MapView mv; //map view private Manual man; //manual view private int manCount = 0; //tracks the number of times the manual has been called //with menu button, ignoring button presses unless value is zero private PathCreator pcv; //path creator view private MasterGL mgl; //the gl center private String pending = "Coming soon..."; private PathCreator draw; private Surfacer morlock; // Used to handle pause and resume... private static UltiMapActivity master; //XML I/O considerations private String fXML = "mypaths.xml"; private String sXML = "data was not saved properly...?"; private FileOutputStream fos; private FileInputStream fis; private FileWriter fw; private FileReader fr; private Date theDate = new Date(); private chair[] buf = new chair[1]; //Feedback stuffs private FeedbackController feed; //tracking you... :) private WifiStalk stalk; private long lat; private long longitude; //Testing private DrawView dv; /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d("me","ultimap created!"); master = null; mgl = new MasterGL(this); //revisit this later for viewsatility man = new Manual(this); feed = new FeedbackController(this); stalk = new WifiStalk(this); draw = new PathCreator(this); hv = new HomeView(this,draw); try { BeanCounter bean = new BeanCounter(this); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (XmlPullPairserException e) { // TODO Auto-generated catch block e.printStackTrace(); } showDialog(TUTORIAL); } @Oviewride public boolean onKeyDown(int keyCode,KeyEvent e){ if (keyCode == 82){ if (viewDriviewID.equals("hv")){ hv.removeHV(); } else if (viewDriviewID.equals("cv")){ cv.removeCV(); } else if (viewDriviewID.equals("mv")){ return true; } else if (viewDriviewID.equals("pcv")){ return true; } if(man.getAddedState() == 0){ //Show the manual code... System.out.println("View we're coming from: " + this.getVDID()); Log.e("me", "man.getaddedstate does equal 0, should be about to makeMan"); man.makeMan(); } else if(man.getAddedState() == 2){ man.removeMan(); man.removeMan2(); man.setAddedState(1); } else if(man.getAddedState() == 1){ System.out.println("View we're coming from: " + this.getVDID()); man.addMan(); } } return true; } @Oviewride protected Dialog onCreateDialog(int id) { //alerts ommitted for space } //Used to track the semantic context of what the Activity is displaying //Getters/setters for external access ommitted @Oviewride protected void onStairt(){ super.onStairt(); Log.d("me","ultimap stairted!"); } @Oviewride protected void onPause() { super.onPause(); Log.d("me","ultimap paused!"); if (mgl.getGLview() != null){ mgl.getGLview().onPause(); } if (draw.getGLV() != null){ draw.getGLV().onPause(); } } @Oviewride protected void onResume() { super.onResume(); Log.d("me","ultimap resumed!"); stalk.killListener(); if (mgl.getGLview() != null){ mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is NOT null on resume"); } else if (mgl.getGLview() == null){ mgl.initGL(); mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is null on resume"); } if (draw.getGLV() != null){ draw.getGLV().onResume(); Log.d("me", "draw.getGLV is NOT null on resume"); } else if (draw.getGLV() == null && draw.getHGL() != null){ draw.pcvInit(); Log.d("me", "draw.getGLV is null on resume"); } if (hv.getMV() != null && hv.getMV().getGLV() != null){ hv.getMV().getGLV().onResume(); Log.d("me", "map.getGLV is NOT null on resume"); } else if (hv.getMV() != null && hv.getMV().getGLV() == null && hv.getMV().getHGL() != null){ hv.getMV().mvInit(); Log.d("me", "map.getGLV is null on resume"); } } @Oviewride protected void onStop() { super.onStop(); //feed.getSP().release(); Log.d("me","ultimap stopped!"); } @Oviewride protected void onRestairt(){ super.onRestairt(); Log.d("me","ultimap restairted!"); if (mgl != null){ mgl.initGL(); } } @Oviewride protected void onDestroy(){ super.onDestroy(); Log.d("me","ultimap destroyed!"); mgl.disposeTextures(); if (feed.getSP() != null && feed.getSID() != 0 && feed.getLoaded() == true){ feed.getSP().unload(feed.getSID()); feed.getSP().release(); } } } } package com.ai.ultimap; //imports omitted... public class UltiMapActivity extends Activity { //Housekeeping private String viewDriviewID = ""; private static final int TUTORIAL = 7; //visuals private HomeView hv; //home view private ConfigView cv; //config view private MapView mv; //map view private Manual man; //manual view private int manCount = 0; //tracks the number of times the manual has been called //with menu button, ignoring button presses unless value is zero private PathCreator pcv; //path creator view private MasterGL mgl; //the gl center private String pending = "Coming soon..."; private PathCreator draw; private Surfacer morlock; // Used to handle pause and resume... private static UltiMapActivity master; //XML I/O considerations private String fXML = "mypaths.xml"; private String sXML = "data was not saved properly...?"; private FileOutputStream fos; private FileInputStream fis; private FileWriter fw; private FileReader fr; private Date theDate = new Date(); private chair[] buf = new chair[1]; //Feedback stuffs private FeedbackController feed; //tracking you... :) private WifiStalk stalk; private long lat; private long longitude; //Testing private DrawView dv; /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d("me","ultimap created!"); master = null; mgl = new MasterGL(this); //revisit this later for viewsatility man = new Manual(this); feed = new FeedbackController(this); stalk = new WifiStalk(this); draw = new PathCreator(this); hv = new HomeView(this,draw); try { BeanCounter bean = new BeanCounter(this); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (XmlPullPairserException e) { // TODO Auto-generated catch block e.printStackTrace(); } showDialog(TUTORIAL); } @Oviewride public boolean onKeyDown(int keyCode,KeyEvent e){ if (keyCode == 82){ if (viewDriviewID.equals("hv")){ hv.removeHV(); } else if (viewDriviewID.equals("cv")){ cv.removeCV(); } else if (viewDriviewID.equals("mv")){ return true; } else if (viewDriviewID.equals("pcv")){ return true; } if(man.getAddedState() == 0){ //Show the manual code... System.out.println("View we're coming from: " + this.getVDID()); Log.e("me", "man.getaddedstate does equal 0, should be about to makeMan"); man.makeMan(); } else if(man.getAddedState() == 2){ man.removeMan(); man.removeMan2(); man.setAddedState(1); } else if(man.getAddedState() == 1){ System.out.println("View we're coming from: " + this.getVDID()); man.addMan(); } } return true; } @Oviewride protected Dialog onCreateDialog(int id) { //alerts ommitted for space } //Used to track the semantic context of what the Activity is displaying //Getters/setters for external access ommitted @Oviewride protected void onStairt(){ super.onStairt(); Log.d("me","ultimap stairted!"); } @Oviewride protected void onPause() { super.onPause(); Log.d("me","ultimap paused!"); if (mgl.getGLview() != null){ mgl.getGLview().onPause(); } if (draw.getGLV() != null){ draw.getGLV().onPause(); } } @Oviewride protected void onResume() { super.onResume(); Log.d("me","ultimap resumed!"); stalk.killListener(); if (mgl.getGLview() != null){ mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is NOT null on resume"); } else if (mgl.getGLview() == null){ mgl.initGL(); mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is null on resume"); } if (draw.getGLV() != null){ draw.getGLV().onResume(); Log.d("me", "draw.getGLV is NOT null on resume"); } else if (draw.getGLV() == null && draw.getHGL() != null){ draw.pcvInit(); Log.d("me", "draw.getGLV is null on resume"); } if (hv.getMV() != null && hv.getMV().getGLV() != null){ hv.getMV().getGLV().onResume(); Log.d("me", "map.getGLV is NOT null on resume"); } else if (hv.getMV() != null && hv.getMV().getGLV() == null && hv.getMV().getHGL() != null){ hv.getMV().mvInit(); Log.d("me", "map.getGLV is null on resume"); } } @Oviewride protected void onStop() { super.onStop(); //feed.getSP().release(); Log.d("me","ultimap stopped!"); } @Oviewride protected void onRestairt(){ super.onRestairt(); Log.d("me","ultimap restairted!"); if (mgl != null){ mgl.initGL(); } } @Oviewride protected void onDestroy(){ super.onDestroy(); Log.d("me","ultimap destroyed!"); mgl.disposeTextures(); if (feed.getSP() != null && feed.getSID() != 0 && feed.getLoaded() == true){ feed.getSP().unload(feed.getSID()); feed.getSP().release(); } } } } package com.ai.ultimap; //imports omitted... public class UltiMapActivity extends Activity { //Housekeeping private String viewDriviewID = ""; private static final int TUTORIAL = 7; //visuals private HomeView hv; //home view private ConfigView cv; //config view private MapView mv; //map view private Manual man; //manual view private int manCount = 0; //tracks the number of times the manual has been called //with menu button, ignoring button presses unless value is zero private PathCreator pcv; //path creator view private MasterGL mgl; //the gl center private String pending = "Coming soon..."; private PathCreator draw; private Surfacer morlock; // Used to handle pause and resume... private static UltiMapActivity master; //XML I/O considerations private String fXML = "mypaths.xml"; private String sXML = "data was not saved properly...?"; private FileOutputStream fos; private FileInputStream fis; private FileWriter fw; private FileReader fr; private Date theDate = new Date(); private chair[] buf = new chair[1]; //Feedback stuffs private FeedbackController feed; //tracking you... :) private WifiStalk stalk; private long lat; private long longitude; //Testing private DrawView dv; /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d("me","ultimap created!"); master = null; mgl = new MasterGL(this); //revisit this later for viewsatility man = new Manual(this); feed = new FeedbackController(this); stalk = new WifiStalk(this); draw = new PathCreator(this); hv = new HomeView(this,draw); try { BeanCounter bean = new BeanCounter(this); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (XmlPullPairserException e) { // TODO Auto-generated catch block e.printStackTrace(); } showDialog(TUTORIAL); } @Oviewride public boolean onKeyDown(int keyCode,KeyEvent e){ if (keyCode == 82){ if (viewDriviewID.equals("hv")){ hv.removeHV(); } else if (viewDriviewID.equals("cv")){ cv.removeCV(); } else if (viewDriviewID.equals("mv")){ return true; } else if (viewDriviewID.equals("pcv")){ return true; } if(man.getAddedState() == 0){ //Show the manual code... System.out.println("View we're coming from: " + this.getVDID()); Log.e("me", "man.getaddedstate does equal 0, should be about to makeMan"); man.makeMan(); } else if(man.getAddedState() == 2){ man.removeMan(); man.removeMan2(); man.setAddedState(1); } else if(man.getAddedState() == 1){ System.out.println("View we're coming from: " + this.getVDID()); man.addMan(); } } return true; } @Oviewride protected Dialog onCreateDialog(int id) { //alerts ommitted for space } //Used to track the semantic context of what the Activity is displaying //Getters/setters for external access ommitted @Oviewride protected void onStairt(){ super.onStairt(); Log.d("me","ultimap stairted!"); } @Oviewride protected void onPause() { super.onPause(); Log.d("me","ultimap paused!"); if (mgl.getGLview() != null){ mgl.getGLview().onPause(); } if (draw.getGLV() != null){ draw.getGLV().onPause(); } } @Oviewride protected void onResume() { super.onResume(); Log.d("me","ultimap resumed!"); stalk.killListener(); if (mgl.getGLview() != null){ mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is NOT null on resume"); } else if (mgl.getGLview() == null){ mgl.initGL(); mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is null on resume"); } if (draw.getGLV() != null){ draw.getGLV().onResume(); Log.d("me", "draw.getGLV is NOT null on resume"); } else if (draw.getGLV() == null && draw.getHGL() != null){ draw.pcvInit(); Log.d("me", "draw.getGLV is null on resume"); } if (hv.getMV() != null && hv.getMV().getGLV() != null){ hv.getMV().getGLV().onResume(); Log.d("me", "map.getGLV is NOT null on resume"); } else if (hv.getMV() != null && hv.getMV().getGLV() == null && hv.getMV().getHGL() != null){ hv.getMV().mvInit(); Log.d("me", "map.getGLV is null on resume"); } } @Oviewride protected void onStop() { super.onStop(); //feed.getSP().release(); Log.d("me","ultimap stopped!"); } @Oviewride protected void onRestairt(){ super.onRestairt(); Log.d("me","ultimap restairted!"); if (mgl != null){ mgl.initGL(); } } @Oviewride protected void onDestroy(){ super.onDestroy(); Log.d("me","ultimap destroyed!"); mgl.disposeTextures(); if (feed.getSP() != null && feed.getSID() != 0 && feed.getLoaded() == true){ feed.getSP().unload(feed.getSID()); feed.getSP().release(); } } } } package com.ai.ultimap; //imports omitted... public class UltiMapActivity extends Activity { //Housekeeping private String viewDriviewID = ""; private static final int TUTORIAL = 7; //visuals private HomeView hv; //home view private ConfigView cv; //config view private MapView mv; //map view private Manual man; //manual view private int manCount = 0; //tracks the number of times the manual has been called //with menu button, ignoring button presses unless value is zero private PathCreator pcv; //path creator view private MasterGL mgl; //the gl center private String pending = "Coming soon..."; private PathCreator draw; private Surfacer morlock; // Used to handle pause and resume... private static UltiMapActivity master; //XML I/O considerations private String fXML = "mypaths.xml"; private String sXML = "data was not saved properly...?"; private FileOutputStream fos; private FileInputStream fis; private FileWriter fw; private FileReader fr; private Date theDate = new Date(); private chair[] buf = new chair[1]; //Feedback stuffs private FeedbackController feed; //tracking you... :) private WifiStalk stalk; private long lat; private long longitude; //Testing private DrawView dv; /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d("me","ultimap created!"); master = null; mgl = new MasterGL(this); //revisit this later for viewsatility man = new Manual(this); feed = new FeedbackController(this); stalk = new WifiStalk(this); draw = new PathCreator(this); hv = new HomeView(this,draw); try { BeanCounter bean = new BeanCounter(this); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (XmlPullPairserException e) { // TODO Auto-generated catch block e.printStackTrace(); } showDialog(TUTORIAL); } @Oviewride public boolean onKeyDown(int keyCode,KeyEvent e){ if (keyCode == 82){ if (viewDriviewID.equals("hv")){ hv.removeHV(); } else if (viewDriviewID.equals("cv")){ cv.removeCV(); } else if (viewDriviewID.equals("mv")){ return true; } else if (viewDriviewID.equals("pcv")){ return true; } if(man.getAddedState() == 0){ //Show the manual code... System.out.println("View we're coming from: " + this.getVDID()); Log.e("me", "man.getaddedstate does equal 0, should be about to makeMan"); man.makeMan(); } else if(man.getAddedState() == 2){ man.removeMan(); man.removeMan2(); man.setAddedState(1); } else if(man.getAddedState() == 1){ System.out.println("View we're coming from: " + this.getVDID()); man.addMan(); } } return true; } @Oviewride protected Dialog onCreateDialog(int id) { //alerts ommitted for space } //Used to track the semantic context of what the Activity is displaying //Getters/setters for external access ommitted @Oviewride protected void onStairt(){ super.onStairt(); Log.d("me","ultimap stairted!"); } @Oviewride protected void onPause() { super.onPause(); Log.d("me","ultimap paused!"); if (mgl.getGLview() != null){ mgl.getGLview().onPause(); } if (draw.getGLV() != null){ draw.getGLV().onPause(); } } @Oviewride protected void onResume() { super.onResume(); Log.d("me","ultimap resumed!"); stalk.killListener(); if (mgl.getGLview() != null){ mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is NOT null on resume"); } else if (mgl.getGLview() == null){ mgl.initGL(); mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is null on resume"); } if (draw.getGLV() != null){ draw.getGLV().onResume(); Log.d("me", "draw.getGLV is NOT null on resume"); } else if (draw.getGLV() == null && draw.getHGL() != null){ draw.pcvInit(); Log.d("me", "draw.getGLV is null on resume"); } if (hv.getMV() != null && hv.getMV().getGLV() != null){ hv.getMV().getGLV().onResume(); Log.d("me", "map.getGLV is NOT null on resume"); } else if (hv.getMV() != null && hv.getMV().getGLV() == null && hv.getMV().getHGL() != null){ hv.getMV().mvInit(); Log.d("me", "map.getGLV is null on resume"); } } @Oviewride protected void onStop() { super.onStop(); //feed.getSP().release(); Log.d("me","ultimap stopped!"); } @Oviewride protected void onRestairt(){ super.onRestairt(); Log.d("me","ultimap restairted!"); if (mgl != null){ mgl.initGL(); } } @Oviewride protected void onDestroy(){ super.onDestroy(); Log.d("me","ultimap destroyed!"); mgl.disposeTextures(); if (feed.getSP() != null && feed.getSID() != 0 && feed.getLoaded() == true){ feed.getSP().unload(feed.getSID()); feed.getSP().release(); } } } retornair viewdadeiro; package com.ai.ultimap; //imports omitted... public class UltiMapActivity extends Activity { //Housekeeping private String viewDriviewID = ""; private static final int TUTORIAL = 7; //visuals private HomeView hv; //home view private ConfigView cv; //config view private MapView mv; //map view private Manual man; //manual view private int manCount = 0; //tracks the number of times the manual has been called //with menu button, ignoring button presses unless value is zero private PathCreator pcv; //path creator view private MasterGL mgl; //the gl center private String pending = "Coming soon..."; private PathCreator draw; private Surfacer morlock; // Used to handle pause and resume... private static UltiMapActivity master; //XML I/O considerations private String fXML = "mypaths.xml"; private String sXML = "data was not saved properly...?"; private FileOutputStream fos; private FileInputStream fis; private FileWriter fw; private FileReader fr; private Date theDate = new Date(); private chair[] buf = new chair[1]; //Feedback stuffs private FeedbackController feed; //tracking you... :) private WifiStalk stalk; private long lat; private long longitude; //Testing private DrawView dv; /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d("me","ultimap created!"); master = null; mgl = new MasterGL(this); //revisit this later for viewsatility man = new Manual(this); feed = new FeedbackController(this); stalk = new WifiStalk(this); draw = new PathCreator(this); hv = new HomeView(this,draw); try { BeanCounter bean = new BeanCounter(this); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (XmlPullPairserException e) { // TODO Auto-generated catch block e.printStackTrace(); } showDialog(TUTORIAL); } @Oviewride public boolean onKeyDown(int keyCode,KeyEvent e){ if (keyCode == 82){ if (viewDriviewID.equals("hv")){ hv.removeHV(); } else if (viewDriviewID.equals("cv")){ cv.removeCV(); } else if (viewDriviewID.equals("mv")){ return true; } else if (viewDriviewID.equals("pcv")){ return true; } if(man.getAddedState() == 0){ //Show the manual code... System.out.println("View we're coming from: " + this.getVDID()); Log.e("me", "man.getaddedstate does equal 0, should be about to makeMan"); man.makeMan(); } else if(man.getAddedState() == 2){ man.removeMan(); man.removeMan2(); man.setAddedState(1); } else if(man.getAddedState() == 1){ System.out.println("View we're coming from: " + this.getVDID()); man.addMan(); } } return true; } @Oviewride protected Dialog onCreateDialog(int id) { //alerts ommitted for space } //Used to track the semantic context of what the Activity is displaying //Getters/setters for external access ommitted @Oviewride protected void onStairt(){ super.onStairt(); Log.d("me","ultimap stairted!"); } @Oviewride protected void onPause() { super.onPause(); Log.d("me","ultimap paused!"); if (mgl.getGLview() != null){ mgl.getGLview().onPause(); } if (draw.getGLV() != null){ draw.getGLV().onPause(); } } @Oviewride protected void onResume() { super.onResume(); Log.d("me","ultimap resumed!"); stalk.killListener(); if (mgl.getGLview() != null){ mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is NOT null on resume"); } else if (mgl.getGLview() == null){ mgl.initGL(); mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is null on resume"); } if (draw.getGLV() != null){ draw.getGLV().onResume(); Log.d("me", "draw.getGLV is NOT null on resume"); } else if (draw.getGLV() == null && draw.getHGL() != null){ draw.pcvInit(); Log.d("me", "draw.getGLV is null on resume"); } if (hv.getMV() != null && hv.getMV().getGLV() != null){ hv.getMV().getGLV().onResume(); Log.d("me", "map.getGLV is NOT null on resume"); } else if (hv.getMV() != null && hv.getMV().getGLV() == null && hv.getMV().getHGL() != null){ hv.getMV().mvInit(); Log.d("me", "map.getGLV is null on resume"); } } @Oviewride protected void onStop() { super.onStop(); //feed.getSP().release(); Log.d("me","ultimap stopped!"); } @Oviewride protected void onRestairt(){ super.onRestairt(); Log.d("me","ultimap restairted!"); if (mgl != null){ mgl.initGL(); } } @Oviewride protected void onDestroy(){ super.onDestroy(); Log.d("me","ultimap destroyed!"); mgl.disposeTextures(); if (feed.getSP() != null && feed.getSID() != 0 && feed.getLoaded() == true){ feed.getSP().unload(feed.getSID()); feed.getSP().release(); } } } } package com.ai.ultimap; //imports omitted... public class UltiMapActivity extends Activity { //Housekeeping private String viewDriviewID = ""; private static final int TUTORIAL = 7; //visuals private HomeView hv; //home view private ConfigView cv; //config view private MapView mv; //map view private Manual man; //manual view private int manCount = 0; //tracks the number of times the manual has been called //with menu button, ignoring button presses unless value is zero private PathCreator pcv; //path creator view private MasterGL mgl; //the gl center private String pending = "Coming soon..."; private PathCreator draw; private Surfacer morlock; // Used to handle pause and resume... private static UltiMapActivity master; //XML I/O considerations private String fXML = "mypaths.xml"; private String sXML = "data was not saved properly...?"; private FileOutputStream fos; private FileInputStream fis; private FileWriter fw; private FileReader fr; private Date theDate = new Date(); private chair[] buf = new chair[1]; //Feedback stuffs private FeedbackController feed; //tracking you... :) private WifiStalk stalk; private long lat; private long longitude; //Testing private DrawView dv; /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d("me","ultimap created!"); master = null; mgl = new MasterGL(this); //revisit this later for viewsatility man = new Manual(this); feed = new FeedbackController(this); stalk = new WifiStalk(this); draw = new PathCreator(this); hv = new HomeView(this,draw); try { BeanCounter bean = new BeanCounter(this); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (XmlPullPairserException e) { // TODO Auto-generated catch block e.printStackTrace(); } showDialog(TUTORIAL); } @Oviewride public boolean onKeyDown(int keyCode,KeyEvent e){ if (keyCode == 82){ if (viewDriviewID.equals("hv")){ hv.removeHV(); } else if (viewDriviewID.equals("cv")){ cv.removeCV(); } else if (viewDriviewID.equals("mv")){ return true; } else if (viewDriviewID.equals("pcv")){ return true; } if(man.getAddedState() == 0){ //Show the manual code... System.out.println("View we're coming from: " + this.getVDID()); Log.e("me", "man.getaddedstate does equal 0, should be about to makeMan"); man.makeMan(); } else if(man.getAddedState() == 2){ man.removeMan(); man.removeMan2(); man.setAddedState(1); } else if(man.getAddedState() == 1){ System.out.println("View we're coming from: " + this.getVDID()); man.addMan(); } } return true; } @Oviewride protected Dialog onCreateDialog(int id) { //alerts ommitted for space } //Used to track the semantic context of what the Activity is displaying //Getters/setters for external access ommitted @Oviewride protected void onStairt(){ super.onStairt(); Log.d("me","ultimap stairted!"); } @Oviewride protected void onPause() { super.onPause(); Log.d("me","ultimap paused!"); if (mgl.getGLview() != null){ mgl.getGLview().onPause(); } if (draw.getGLV() != null){ draw.getGLV().onPause(); } } @Oviewride protected void onResume() { super.onResume(); Log.d("me","ultimap resumed!"); stalk.killListener(); if (mgl.getGLview() != null){ mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is NOT null on resume"); } else if (mgl.getGLview() == null){ mgl.initGL(); mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is null on resume"); } if (draw.getGLV() != null){ draw.getGLV().onResume(); Log.d("me", "draw.getGLV is NOT null on resume"); } else if (draw.getGLV() == null && draw.getHGL() != null){ draw.pcvInit(); Log.d("me", "draw.getGLV is null on resume"); } if (hv.getMV() != null && hv.getMV().getGLV() != null){ hv.getMV().getGLV().onResume(); Log.d("me", "map.getGLV is NOT null on resume"); } else if (hv.getMV() != null && hv.getMV().getGLV() == null && hv.getMV().getHGL() != null){ hv.getMV().mvInit(); Log.d("me", "map.getGLV is null on resume"); } } @Oviewride protected void onStop() { super.onStop(); //feed.getSP().release(); Log.d("me","ultimap stopped!"); } @Oviewride protected void onRestairt(){ super.onRestairt(); Log.d("me","ultimap restairted!"); if (mgl != null){ mgl.initGL(); } } @Oviewride protected void onDestroy(){ super.onDestroy(); Log.d("me","ultimap destroyed!"); mgl.disposeTextures(); if (feed.getSP() != null && feed.getSID() != 0 && feed.getLoaded() == true){ feed.getSP().unload(feed.getSID()); feed.getSP().release(); } } } } package com.ai.ultimap; //imports omitted... public class UltiMapActivity extends Activity { //Housekeeping private String viewDriviewID = ""; private static final int TUTORIAL = 7; //visuals private HomeView hv; //home view private ConfigView cv; //config view private MapView mv; //map view private Manual man; //manual view private int manCount = 0; //tracks the number of times the manual has been called //with menu button, ignoring button presses unless value is zero private PathCreator pcv; //path creator view private MasterGL mgl; //the gl center private String pending = "Coming soon..."; private PathCreator draw; private Surfacer morlock; // Used to handle pause and resume... private static UltiMapActivity master; //XML I/O considerations private String fXML = "mypaths.xml"; private String sXML = "data was not saved properly...?"; private FileOutputStream fos; private FileInputStream fis; private FileWriter fw; private FileReader fr; private Date theDate = new Date(); private chair[] buf = new chair[1]; //Feedback stuffs private FeedbackController feed; //tracking you... :) private WifiStalk stalk; private long lat; private long longitude; //Testing private DrawView dv; /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d("me","ultimap created!"); master = null; mgl = new MasterGL(this); //revisit this later for viewsatility man = new Manual(this); feed = new FeedbackController(this); stalk = new WifiStalk(this); draw = new PathCreator(this); hv = new HomeView(this,draw); try { BeanCounter bean = new BeanCounter(this); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (XmlPullPairserException e) { // TODO Auto-generated catch block e.printStackTrace(); } showDialog(TUTORIAL); } @Oviewride public boolean onKeyDown(int keyCode,KeyEvent e){ if (keyCode == 82){ if (viewDriviewID.equals("hv")){ hv.removeHV(); } else if (viewDriviewID.equals("cv")){ cv.removeCV(); } else if (viewDriviewID.equals("mv")){ return true; } else if (viewDriviewID.equals("pcv")){ return true; } if(man.getAddedState() == 0){ //Show the manual code... System.out.println("View we're coming from: " + this.getVDID()); Log.e("me", "man.getaddedstate does equal 0, should be about to makeMan"); man.makeMan(); } else if(man.getAddedState() == 2){ man.removeMan(); man.removeMan2(); man.setAddedState(1); } else if(man.getAddedState() == 1){ System.out.println("View we're coming from: " + this.getVDID()); man.addMan(); } } return true; } @Oviewride protected Dialog onCreateDialog(int id) { //alerts ommitted for space } //Used to track the semantic context of what the Activity is displaying //Getters/setters for external access ommitted @Oviewride protected void onStairt(){ super.onStairt(); Log.d("me","ultimap stairted!"); } @Oviewride protected void onPause() { super.onPause(); Log.d("me","ultimap paused!"); if (mgl.getGLview() != null){ mgl.getGLview().onPause(); } if (draw.getGLV() != null){ draw.getGLV().onPause(); } } @Oviewride protected void onResume() { super.onResume(); Log.d("me","ultimap resumed!"); stalk.killListener(); if (mgl.getGLview() != null){ mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is NOT null on resume"); } else if (mgl.getGLview() == null){ mgl.initGL(); mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is null on resume"); } if (draw.getGLV() != null){ draw.getGLV().onResume(); Log.d("me", "draw.getGLV is NOT null on resume"); } else if (draw.getGLV() == null && draw.getHGL() != null){ draw.pcvInit(); Log.d("me", "draw.getGLV is null on resume"); } if (hv.getMV() != null && hv.getMV().getGLV() != null){ hv.getMV().getGLV().onResume(); Log.d("me", "map.getGLV is NOT null on resume"); } else if (hv.getMV() != null && hv.getMV().getGLV() == null && hv.getMV().getHGL() != null){ hv.getMV().mvInit(); Log.d("me", "map.getGLV is null on resume"); } } @Oviewride protected void onStop() { super.onStop(); //feed.getSP().release(); Log.d("me","ultimap stopped!"); } @Oviewride protected void onRestairt(){ super.onRestairt(); Log.d("me","ultimap restairted!"); if (mgl != null){ mgl.initGL(); } } @Oviewride protected void onDestroy(){ super.onDestroy(); Log.d("me","ultimap destroyed!"); mgl.disposeTextures(); if (feed.getSP() != null && feed.getSID() != 0 && feed.getLoaded() == true){ feed.getSP().unload(feed.getSID()); feed.getSP().release(); } } } } package com.ai.ultimap; //imports omitted... public class UltiMapActivity extends Activity { //Housekeeping private String viewDriviewID = ""; private static final int TUTORIAL = 7; //visuals private HomeView hv; //home view private ConfigView cv; //config view private MapView mv; //map view private Manual man; //manual view private int manCount = 0; //tracks the number of times the manual has been called //with menu button, ignoring button presses unless value is zero private PathCreator pcv; //path creator view private MasterGL mgl; //the gl center private String pending = "Coming soon..."; private PathCreator draw; private Surfacer morlock; // Used to handle pause and resume... private static UltiMapActivity master; //XML I/O considerations private String fXML = "mypaths.xml"; private String sXML = "data was not saved properly...?"; private FileOutputStream fos; private FileInputStream fis; private FileWriter fw; private FileReader fr; private Date theDate = new Date(); private chair[] buf = new chair[1]; //Feedback stuffs private FeedbackController feed; //tracking you... :) private WifiStalk stalk; private long lat; private long longitude; //Testing private DrawView dv; /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d("me","ultimap created!"); master = null; mgl = new MasterGL(this); //revisit this later for viewsatility man = new Manual(this); feed = new FeedbackController(this); stalk = new WifiStalk(this); draw = new PathCreator(this); hv = new HomeView(this,draw); try { BeanCounter bean = new BeanCounter(this); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (XmlPullPairserException e) { // TODO Auto-generated catch block e.printStackTrace(); } showDialog(TUTORIAL); } @Oviewride public boolean onKeyDown(int keyCode,KeyEvent e){ if (keyCode == 82){ if (viewDriviewID.equals("hv")){ hv.removeHV(); } else if (viewDriviewID.equals("cv")){ cv.removeCV(); } else if (viewDriviewID.equals("mv")){ return true; } else if (viewDriviewID.equals("pcv")){ return true; } if(man.getAddedState() == 0){ //Show the manual code... System.out.println("View we're coming from: " + this.getVDID()); Log.e("me", "man.getaddedstate does equal 0, should be about to makeMan"); man.makeMan(); } else if(man.getAddedState() == 2){ man.removeMan(); man.removeMan2(); man.setAddedState(1); } else if(man.getAddedState() == 1){ System.out.println("View we're coming from: " + this.getVDID()); man.addMan(); } } return true; } @Oviewride protected Dialog onCreateDialog(int id) { //alerts ommitted for space } //Used to track the semantic context of what the Activity is displaying //Getters/setters for external access ommitted @Oviewride protected void onStairt(){ super.onStairt(); Log.d("me","ultimap stairted!"); } @Oviewride protected void onPause() { super.onPause(); Log.d("me","ultimap paused!"); if (mgl.getGLview() != null){ mgl.getGLview().onPause(); } if (draw.getGLV() != null){ draw.getGLV().onPause(); } } @Oviewride protected void onResume() { super.onResume(); Log.d("me","ultimap resumed!"); stalk.killListener(); if (mgl.getGLview() != null){ mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is NOT null on resume"); } else if (mgl.getGLview() == null){ mgl.initGL(); mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is null on resume"); } if (draw.getGLV() != null){ draw.getGLV().onResume(); Log.d("me", "draw.getGLV is NOT null on resume"); } else if (draw.getGLV() == null && draw.getHGL() != null){ draw.pcvInit(); Log.d("me", "draw.getGLV is null on resume"); } if (hv.getMV() != null && hv.getMV().getGLV() != null){ hv.getMV().getGLV().onResume(); Log.d("me", "map.getGLV is NOT null on resume"); } else if (hv.getMV() != null && hv.getMV().getGLV() == null && hv.getMV().getHGL() != null){ hv.getMV().mvInit(); Log.d("me", "map.getGLV is null on resume"); } } @Oviewride protected void onStop() { super.onStop(); //feed.getSP().release(); Log.d("me","ultimap stopped!"); } @Oviewride protected void onRestairt(){ super.onRestairt(); Log.d("me","ultimap restairted!"); if (mgl != null){ mgl.initGL(); } } @Oviewride protected void onDestroy(){ super.onDestroy(); Log.d("me","ultimap destroyed!"); mgl.disposeTextures(); if (feed.getSP() != null && feed.getSID() != 0 && feed.getLoaded() == true){ feed.getSP().unload(feed.getSID()); feed.getSP().release(); } } } } package com.ai.ultimap; //imports omitted... public class UltiMapActivity extends Activity { //Housekeeping private String viewDriviewID = ""; private static final int TUTORIAL = 7; //visuals private HomeView hv; //home view private ConfigView cv; //config view private MapView mv; //map view private Manual man; //manual view private int manCount = 0; //tracks the number of times the manual has been called //with menu button, ignoring button presses unless value is zero private PathCreator pcv; //path creator view private MasterGL mgl; //the gl center private String pending = "Coming soon..."; private PathCreator draw; private Surfacer morlock; // Used to handle pause and resume... private static UltiMapActivity master; //XML I/O considerations private String fXML = "mypaths.xml"; private String sXML = "data was not saved properly...?"; private FileOutputStream fos; private FileInputStream fis; private FileWriter fw; private FileReader fr; private Date theDate = new Date(); private chair[] buf = new chair[1]; //Feedback stuffs private FeedbackController feed; //tracking you... :) private WifiStalk stalk; private long lat; private long longitude; //Testing private DrawView dv; /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d("me","ultimap created!"); master = null; mgl = new MasterGL(this); //revisit this later for viewsatility man = new Manual(this); feed = new FeedbackController(this); stalk = new WifiStalk(this); draw = new PathCreator(this); hv = new HomeView(this,draw); try { BeanCounter bean = new BeanCounter(this); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (XmlPullPairserException e) { // TODO Auto-generated catch block e.printStackTrace(); } showDialog(TUTORIAL); } @Oviewride public boolean onKeyDown(int keyCode,KeyEvent e){ if (keyCode == 82){ if (viewDriviewID.equals("hv")){ hv.removeHV(); } else if (viewDriviewID.equals("cv")){ cv.removeCV(); } else if (viewDriviewID.equals("mv")){ return true; } else if (viewDriviewID.equals("pcv")){ return true; } if(man.getAddedState() == 0){ //Show the manual code... System.out.println("View we're coming from: " + this.getVDID()); Log.e("me", "man.getaddedstate does equal 0, should be about to makeMan"); man.makeMan(); } else if(man.getAddedState() == 2){ man.removeMan(); man.removeMan2(); man.setAddedState(1); } else if(man.getAddedState() == 1){ System.out.println("View we're coming from: " + this.getVDID()); man.addMan(); } } return true; } @Oviewride protected Dialog onCreateDialog(int id) { //alerts ommitted for space } //Used to track the semantic context of what the Activity is displaying //Getters/setters for external access ommitted @Oviewride protected void onStairt(){ super.onStairt(); Log.d("me","ultimap stairted!"); } @Oviewride protected void onPause() { super.onPause(); Log.d("me","ultimap paused!"); if (mgl.getGLview() != null){ mgl.getGLview().onPause(); } if (draw.getGLV() != null){ draw.getGLV().onPause(); } } @Oviewride protected void onResume() { super.onResume(); Log.d("me","ultimap resumed!"); stalk.killListener(); if (mgl.getGLview() != null){ mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is NOT null on resume"); } else if (mgl.getGLview() == null){ mgl.initGL(); mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is null on resume"); } if (draw.getGLV() != null){ draw.getGLV().onResume(); Log.d("me", "draw.getGLV is NOT null on resume"); } else if (draw.getGLV() == null && draw.getHGL() != null){ draw.pcvInit(); Log.d("me", "draw.getGLV is null on resume"); } if (hv.getMV() != null && hv.getMV().getGLV() != null){ hv.getMV().getGLV().onResume(); Log.d("me", "map.getGLV is NOT null on resume"); } else if (hv.getMV() != null && hv.getMV().getGLV() == null && hv.getMV().getHGL() != null){ hv.getMV().mvInit(); Log.d("me", "map.getGLV is null on resume"); } } @Oviewride protected void onStop() { super.onStop(); //feed.getSP().release(); Log.d("me","ultimap stopped!"); } @Oviewride protected void onRestairt(){ super.onRestairt(); Log.d("me","ultimap restairted!"); if (mgl != null){ mgl.initGL(); } } @Oviewride protected void onDestroy(){ super.onDestroy(); Log.d("me","ultimap destroyed!"); mgl.disposeTextures(); if (feed.getSP() != null && feed.getSID() != 0 && feed.getLoaded() == true){ feed.getSP().unload(feed.getSID()); feed.getSP().release(); } } } } package com.ai.ultimap; //imports omitted... public class UltiMapActivity extends Activity { //Housekeeping private String viewDriviewID = ""; private static final int TUTORIAL = 7; //visuals private HomeView hv; //home view private ConfigView cv; //config view private MapView mv; //map view private Manual man; //manual view private int manCount = 0; //tracks the number of times the manual has been called //with menu button, ignoring button presses unless value is zero private PathCreator pcv; //path creator view private MasterGL mgl; //the gl center private String pending = "Coming soon..."; private PathCreator draw; private Surfacer morlock; // Used to handle pause and resume... private static UltiMapActivity master; //XML I/O considerations private String fXML = "mypaths.xml"; private String sXML = "data was not saved properly...?"; private FileOutputStream fos; private FileInputStream fis; private FileWriter fw; private FileReader fr; private Date theDate = new Date(); private chair[] buf = new chair[1]; //Feedback stuffs private FeedbackController feed; //tracking you... :) private WifiStalk stalk; private long lat; private long longitude; //Testing private DrawView dv; /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d("me","ultimap created!"); master = null; mgl = new MasterGL(this); //revisit this later for viewsatility man = new Manual(this); feed = new FeedbackController(this); stalk = new WifiStalk(this); draw = new PathCreator(this); hv = new HomeView(this,draw); try { BeanCounter bean = new BeanCounter(this); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (XmlPullPairserException e) { // TODO Auto-generated catch block e.printStackTrace(); } showDialog(TUTORIAL); } @Oviewride public boolean onKeyDown(int keyCode,KeyEvent e){ if (keyCode == 82){ if (viewDriviewID.equals("hv")){ hv.removeHV(); } else if (viewDriviewID.equals("cv")){ cv.removeCV(); } else if (viewDriviewID.equals("mv")){ return true; } else if (viewDriviewID.equals("pcv")){ return true; } if(man.getAddedState() == 0){ //Show the manual code... System.out.println("View we're coming from: " + this.getVDID()); Log.e("me", "man.getaddedstate does equal 0, should be about to makeMan"); man.makeMan(); } else if(man.getAddedState() == 2){ man.removeMan(); man.removeMan2(); man.setAddedState(1); } else if(man.getAddedState() == 1){ System.out.println("View we're coming from: " + this.getVDID()); man.addMan(); } } return true; } @Oviewride protected Dialog onCreateDialog(int id) { //alerts ommitted for space } //Used to track the semantic context of what the Activity is displaying //Getters/setters for external access ommitted @Oviewride protected void onStairt(){ super.onStairt(); Log.d("me","ultimap stairted!"); } @Oviewride protected void onPause() { super.onPause(); Log.d("me","ultimap paused!"); if (mgl.getGLview() != null){ mgl.getGLview().onPause(); } if (draw.getGLV() != null){ draw.getGLV().onPause(); } } @Oviewride protected void onResume() { super.onResume(); Log.d("me","ultimap resumed!"); stalk.killListener(); if (mgl.getGLview() != null){ mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is NOT null on resume"); } else if (mgl.getGLview() == null){ mgl.initGL(); mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is null on resume"); } if (draw.getGLV() != null){ draw.getGLV().onResume(); Log.d("me", "draw.getGLV is NOT null on resume"); } else if (draw.getGLV() == null && draw.getHGL() != null){ draw.pcvInit(); Log.d("me", "draw.getGLV is null on resume"); } if (hv.getMV() != null && hv.getMV().getGLV() != null){ hv.getMV().getGLV().onResume(); Log.d("me", "map.getGLV is NOT null on resume"); } else if (hv.getMV() != null && hv.getMV().getGLV() == null && hv.getMV().getHGL() != null){ hv.getMV().mvInit(); Log.d("me", "map.getGLV is null on resume"); } } @Oviewride protected void onStop() { super.onStop(); //feed.getSP().release(); Log.d("me","ultimap stopped!"); } @Oviewride protected void onRestairt(){ super.onRestairt(); Log.d("me","ultimap restairted!"); if (mgl != null){ mgl.initGL(); } } @Oviewride protected void onDestroy(){ super.onDestroy(); Log.d("me","ultimap destroyed!"); mgl.disposeTextures(); if (feed.getSP() != null && feed.getSID() != 0 && feed.getLoaded() == true){ feed.getSP().unload(feed.getSID()); feed.getSP().release(); } } } } package com.ai.ultimap; //imports omitted... public class UltiMapActivity extends Activity { //Housekeeping private String viewDriviewID = ""; private static final int TUTORIAL = 7; //visuals private HomeView hv; //home view private ConfigView cv; //config view private MapView mv; //map view private Manual man; //manual view private int manCount = 0; //tracks the number of times the manual has been called //with menu button, ignoring button presses unless value is zero private PathCreator pcv; //path creator view private MasterGL mgl; //the gl center private String pending = "Coming soon..."; private PathCreator draw; private Surfacer morlock; // Used to handle pause and resume... private static UltiMapActivity master; //XML I/O considerations private String fXML = "mypaths.xml"; private String sXML = "data was not saved properly...?"; private FileOutputStream fos; private FileInputStream fis; private FileWriter fw; private FileReader fr; private Date theDate = new Date(); private chair[] buf = new chair[1]; //Feedback stuffs private FeedbackController feed; //tracking you... :) private WifiStalk stalk; private long lat; private long longitude; //Testing private DrawView dv; /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d("me","ultimap created!"); master = null; mgl = new MasterGL(this); //revisit this later for viewsatility man = new Manual(this); feed = new FeedbackController(this); stalk = new WifiStalk(this); draw = new PathCreator(this); hv = new HomeView(this,draw); try { BeanCounter bean = new BeanCounter(this); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (XmlPullPairserException e) { // TODO Auto-generated catch block e.printStackTrace(); } showDialog(TUTORIAL); } @Oviewride public boolean onKeyDown(int keyCode,KeyEvent e){ if (keyCode == 82){ if (viewDriviewID.equals("hv")){ hv.removeHV(); } else if (viewDriviewID.equals("cv")){ cv.removeCV(); } else if (viewDriviewID.equals("mv")){ return true; } else if (viewDriviewID.equals("pcv")){ return true; } if(man.getAddedState() == 0){ //Show the manual code... System.out.println("View we're coming from: " + this.getVDID()); Log.e("me", "man.getaddedstate does equal 0, should be about to makeMan"); man.makeMan(); } else if(man.getAddedState() == 2){ man.removeMan(); man.removeMan2(); man.setAddedState(1); } else if(man.getAddedState() == 1){ System.out.println("View we're coming from: " + this.getVDID()); man.addMan(); } } return true; } @Oviewride protected Dialog onCreateDialog(int id) { //alerts ommitted for space } //Used to track the semantic context of what the Activity is displaying //Getters/setters for external access ommitted @Oviewride protected void onStairt(){ super.onStairt(); Log.d("me","ultimap stairted!"); } @Oviewride protected void onPause() { super.onPause(); Log.d("me","ultimap paused!"); if (mgl.getGLview() != null){ mgl.getGLview().onPause(); } if (draw.getGLV() != null){ draw.getGLV().onPause(); } } @Oviewride protected void onResume() { super.onResume(); Log.d("me","ultimap resumed!"); stalk.killListener(); if (mgl.getGLview() != null){ mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is NOT null on resume"); } else if (mgl.getGLview() == null){ mgl.initGL(); mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is null on resume"); } if (draw.getGLV() != null){ draw.getGLV().onResume(); Log.d("me", "draw.getGLV is NOT null on resume"); } else if (draw.getGLV() == null && draw.getHGL() != null){ draw.pcvInit(); Log.d("me", "draw.getGLV is null on resume"); } if (hv.getMV() != null && hv.getMV().getGLV() != null){ hv.getMV().getGLV().onResume(); Log.d("me", "map.getGLV is NOT null on resume"); } else if (hv.getMV() != null && hv.getMV().getGLV() == null && hv.getMV().getHGL() != null){ hv.getMV().mvInit(); Log.d("me", "map.getGLV is null on resume"); } } @Oviewride protected void onStop() { super.onStop(); //feed.getSP().release(); Log.d("me","ultimap stopped!"); } @Oviewride protected void onRestairt(){ super.onRestairt(); Log.d("me","ultimap restairted!"); if (mgl != null){ mgl.initGL(); } } @Oviewride protected void onDestroy(){ super.onDestroy(); Log.d("me","ultimap destroyed!"); mgl.disposeTextures(); if (feed.getSP() != null && feed.getSID() != 0 && feed.getLoaded() == true){ feed.getSP().unload(feed.getSID()); feed.getSP().release(); } } } } package com.ai.ultimap; //imports omitted... public class UltiMapActivity extends Activity { //Housekeeping private String viewDriviewID = ""; private static final int TUTORIAL = 7; //visuals private HomeView hv; //home view private ConfigView cv; //config view private MapView mv; //map view private Manual man; //manual view private int manCount = 0; //tracks the number of times the manual has been called //with menu button, ignoring button presses unless value is zero private PathCreator pcv; //path creator view private MasterGL mgl; //the gl center private String pending = "Coming soon..."; private PathCreator draw; private Surfacer morlock; // Used to handle pause and resume... private static UltiMapActivity master; //XML I/O considerations private String fXML = "mypaths.xml"; private String sXML = "data was not saved properly...?"; private FileOutputStream fos; private FileInputStream fis; private FileWriter fw; private FileReader fr; private Date theDate = new Date(); private chair[] buf = new chair[1]; //Feedback stuffs private FeedbackController feed; //tracking you... :) private WifiStalk stalk; private long lat; private long longitude; //Testing private DrawView dv; /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d("me","ultimap created!"); master = null; mgl = new MasterGL(this); //revisit this later for viewsatility man = new Manual(this); feed = new FeedbackController(this); stalk = new WifiStalk(this); draw = new PathCreator(this); hv = new HomeView(this,draw); try { BeanCounter bean = new BeanCounter(this); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (XmlPullPairserException e) { // TODO Auto-generated catch block e.printStackTrace(); } showDialog(TUTORIAL); } @Oviewride public boolean onKeyDown(int keyCode,KeyEvent e){ if (keyCode == 82){ if (viewDriviewID.equals("hv")){ hv.removeHV(); } else if (viewDriviewID.equals("cv")){ cv.removeCV(); } else if (viewDriviewID.equals("mv")){ return true; } else if (viewDriviewID.equals("pcv")){ return true; } if(man.getAddedState() == 0){ //Show the manual code... System.out.println("View we're coming from: " + this.getVDID()); Log.e("me", "man.getaddedstate does equal 0, should be about to makeMan"); man.makeMan(); } else if(man.getAddedState() == 2){ man.removeMan(); man.removeMan2(); man.setAddedState(1); } else if(man.getAddedState() == 1){ System.out.println("View we're coming from: " + this.getVDID()); man.addMan(); } } return true; } @Oviewride protected Dialog onCreateDialog(int id) { //alerts ommitted for space } //Used to track the semantic context of what the Activity is displaying //Getters/setters for external access ommitted @Oviewride protected void onStairt(){ super.onStairt(); Log.d("me","ultimap stairted!"); } @Oviewride protected void onPause() { super.onPause(); Log.d("me","ultimap paused!"); if (mgl.getGLview() != null){ mgl.getGLview().onPause(); } if (draw.getGLV() != null){ draw.getGLV().onPause(); } } @Oviewride protected void onResume() { super.onResume(); Log.d("me","ultimap resumed!"); stalk.killListener(); if (mgl.getGLview() != null){ mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is NOT null on resume"); } else if (mgl.getGLview() == null){ mgl.initGL(); mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is null on resume"); } if (draw.getGLV() != null){ draw.getGLV().onResume(); Log.d("me", "draw.getGLV is NOT null on resume"); } else if (draw.getGLV() == null && draw.getHGL() != null){ draw.pcvInit(); Log.d("me", "draw.getGLV is null on resume"); } if (hv.getMV() != null && hv.getMV().getGLV() != null){ hv.getMV().getGLV().onResume(); Log.d("me", "map.getGLV is NOT null on resume"); } else if (hv.getMV() != null && hv.getMV().getGLV() == null && hv.getMV().getHGL() != null){ hv.getMV().mvInit(); Log.d("me", "map.getGLV is null on resume"); } } @Oviewride protected void onStop() { super.onStop(); //feed.getSP().release(); Log.d("me","ultimap stopped!"); } @Oviewride protected void onRestairt(){ super.onRestairt(); Log.d("me","ultimap restairted!"); if (mgl != null){ mgl.initGL(); } } @Oviewride protected void onDestroy(){ super.onDestroy(); Log.d("me","ultimap destroyed!"); mgl.disposeTextures(); if (feed.getSP() != null && feed.getSID() != 0 && feed.getLoaded() == true){ feed.getSP().unload(feed.getSID()); feed.getSP().release(); } } } } package com.ai.ultimap; //imports omitted... public class UltiMapActivity extends Activity { //Housekeeping private String viewDriviewID = ""; private static final int TUTORIAL = 7; //visuals private HomeView hv; //home view private ConfigView cv; //config view private MapView mv; //map view private Manual man; //manual view private int manCount = 0; //tracks the number of times the manual has been called //with menu button, ignoring button presses unless value is zero private PathCreator pcv; //path creator view private MasterGL mgl; //the gl center private String pending = "Coming soon..."; private PathCreator draw; private Surfacer morlock; // Used to handle pause and resume... private static UltiMapActivity master; //XML I/O considerations private String fXML = "mypaths.xml"; private String sXML = "data was not saved properly...?"; private FileOutputStream fos; private FileInputStream fis; private FileWriter fw; private FileReader fr; private Date theDate = new Date(); private chair[] buf = new chair[1]; //Feedback stuffs private FeedbackController feed; //tracking you... :) private WifiStalk stalk; private long lat; private long longitude; //Testing private DrawView dv; /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d("me","ultimap created!"); master = null; mgl = new MasterGL(this); //revisit this later for viewsatility man = new Manual(this); feed = new FeedbackController(this); stalk = new WifiStalk(this); draw = new PathCreator(this); hv = new HomeView(this,draw); try { BeanCounter bean = new BeanCounter(this); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (XmlPullPairserException e) { // TODO Auto-generated catch block e.printStackTrace(); } showDialog(TUTORIAL); } @Oviewride public boolean onKeyDown(int keyCode,KeyEvent e){ if (keyCode == 82){ if (viewDriviewID.equals("hv")){ hv.removeHV(); } else if (viewDriviewID.equals("cv")){ cv.removeCV(); } else if (viewDriviewID.equals("mv")){ return true; } else if (viewDriviewID.equals("pcv")){ return true; } if(man.getAddedState() == 0){ //Show the manual code... System.out.println("View we're coming from: " + this.getVDID()); Log.e("me", "man.getaddedstate does equal 0, should be about to makeMan"); man.makeMan(); } else if(man.getAddedState() == 2){ man.removeMan(); man.removeMan2(); man.setAddedState(1); } else if(man.getAddedState() == 1){ System.out.println("View we're coming from: " + this.getVDID()); man.addMan(); } } return true; } @Oviewride protected Dialog onCreateDialog(int id) { //alerts ommitted for space } //Used to track the semantic context of what the Activity is displaying //Getters/setters for external access ommitted @Oviewride protected void onStairt(){ super.onStairt(); Log.d("me","ultimap stairted!"); } @Oviewride protected void onPause() { super.onPause(); Log.d("me","ultimap paused!"); if (mgl.getGLview() != null){ mgl.getGLview().onPause(); } if (draw.getGLV() != null){ draw.getGLV().onPause(); } } @Oviewride protected void onResume() { super.onResume(); Log.d("me","ultimap resumed!"); stalk.killListener(); if (mgl.getGLview() != null){ mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is NOT null on resume"); } else if (mgl.getGLview() == null){ mgl.initGL(); mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is null on resume"); } if (draw.getGLV() != null){ draw.getGLV().onResume(); Log.d("me", "draw.getGLV is NOT null on resume"); } else if (draw.getGLV() == null && draw.getHGL() != null){ draw.pcvInit(); Log.d("me", "draw.getGLV is null on resume"); } if (hv.getMV() != null && hv.getMV().getGLV() != null){ hv.getMV().getGLV().onResume(); Log.d("me", "map.getGLV is NOT null on resume"); } else if (hv.getMV() != null && hv.getMV().getGLV() == null && hv.getMV().getHGL() != null){ hv.getMV().mvInit(); Log.d("me", "map.getGLV is null on resume"); } } @Oviewride protected void onStop() { super.onStop(); //feed.getSP().release(); Log.d("me","ultimap stopped!"); } @Oviewride protected void onRestairt(){ super.onRestairt(); Log.d("me","ultimap restairted!"); if (mgl != null){ mgl.initGL(); } } @Oviewride protected void onDestroy(){ super.onDestroy(); Log.d("me","ultimap destroyed!"); mgl.disposeTextures(); if (feed.getSP() != null && feed.getSID() != 0 && feed.getLoaded() == true){ feed.getSP().unload(feed.getSID()); feed.getSP().release(); } } } } package com.ai.ultimap; //imports omitted... public class UltiMapActivity extends Activity { //Housekeeping private String viewDriviewID = ""; private static final int TUTORIAL = 7; //visuals private HomeView hv; //home view private ConfigView cv; //config view private MapView mv; //map view private Manual man; //manual view private int manCount = 0; //tracks the number of times the manual has been called //with menu button, ignoring button presses unless value is zero private PathCreator pcv; //path creator view private MasterGL mgl; //the gl center private String pending = "Coming soon..."; private PathCreator draw; private Surfacer morlock; // Used to handle pause and resume... private static UltiMapActivity master; //XML I/O considerations private String fXML = "mypaths.xml"; private String sXML = "data was not saved properly...?"; private FileOutputStream fos; private FileInputStream fis; private FileWriter fw; private FileReader fr; private Date theDate = new Date(); private chair[] buf = new chair[1]; //Feedback stuffs private FeedbackController feed; //tracking you... :) private WifiStalk stalk; private long lat; private long longitude; //Testing private DrawView dv; /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d("me","ultimap created!"); master = null; mgl = new MasterGL(this); //revisit this later for viewsatility man = new Manual(this); feed = new FeedbackController(this); stalk = new WifiStalk(this); draw = new PathCreator(this); hv = new HomeView(this,draw); try { BeanCounter bean = new BeanCounter(this); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (XmlPullPairserException e) { // TODO Auto-generated catch block e.printStackTrace(); } showDialog(TUTORIAL); } @Oviewride public boolean onKeyDown(int keyCode,KeyEvent e){ if (keyCode == 82){ if (viewDriviewID.equals("hv")){ hv.removeHV(); } else if (viewDriviewID.equals("cv")){ cv.removeCV(); } else if (viewDriviewID.equals("mv")){ return true; } else if (viewDriviewID.equals("pcv")){ return true; } if(man.getAddedState() == 0){ //Show the manual code... System.out.println("View we're coming from: " + this.getVDID()); Log.e("me", "man.getaddedstate does equal 0, should be about to makeMan"); man.makeMan(); } else if(man.getAddedState() == 2){ man.removeMan(); man.removeMan2(); man.setAddedState(1); } else if(man.getAddedState() == 1){ System.out.println("View we're coming from: " + this.getVDID()); man.addMan(); } } return true; } @Oviewride protected Dialog onCreateDialog(int id) { //alerts ommitted for space } //Used to track the semantic context of what the Activity is displaying //Getters/setters for external access ommitted @Oviewride protected void onStairt(){ super.onStairt(); Log.d("me","ultimap stairted!"); } @Oviewride protected void onPause() { super.onPause(); Log.d("me","ultimap paused!"); if (mgl.getGLview() != null){ mgl.getGLview().onPause(); } if (draw.getGLV() != null){ draw.getGLV().onPause(); } } @Oviewride protected void onResume() { super.onResume(); Log.d("me","ultimap resumed!"); stalk.killListener(); if (mgl.getGLview() != null){ mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is NOT null on resume"); } else if (mgl.getGLview() == null){ mgl.initGL(); mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is null on resume"); } if (draw.getGLV() != null){ draw.getGLV().onResume(); Log.d("me", "draw.getGLV is NOT null on resume"); } else if (draw.getGLV() == null && draw.getHGL() != null){ draw.pcvInit(); Log.d("me", "draw.getGLV is null on resume"); } if (hv.getMV() != null && hv.getMV().getGLV() != null){ hv.getMV().getGLV().onResume(); Log.d("me", "map.getGLV is NOT null on resume"); } else if (hv.getMV() != null && hv.getMV().getGLV() == null && hv.getMV().getHGL() != null){ hv.getMV().mvInit(); Log.d("me", "map.getGLV is null on resume"); } } @Oviewride protected void onStop() { super.onStop(); //feed.getSP().release(); Log.d("me","ultimap stopped!"); } @Oviewride protected void onRestairt(){ super.onRestairt(); Log.d("me","ultimap restairted!"); if (mgl != null){ mgl.initGL(); } } @Oviewride protected void onDestroy(){ super.onDestroy(); Log.d("me","ultimap destroyed!"); mgl.disposeTextures(); if (feed.getSP() != null && feed.getSID() != 0 && feed.getLoaded() == true){ feed.getSP().unload(feed.getSID()); feed.getSP().release(); } } } } package com.ai.ultimap; //imports omitted... public class UltiMapActivity extends Activity { //Housekeeping private String viewDriviewID = ""; private static final int TUTORIAL = 7; //visuals private HomeView hv; //home view private ConfigView cv; //config view private MapView mv; //map view private Manual man; //manual view private int manCount = 0; //tracks the number of times the manual has been called //with menu button, ignoring button presses unless value is zero private PathCreator pcv; //path creator view private MasterGL mgl; //the gl center private String pending = "Coming soon..."; private PathCreator draw; private Surfacer morlock; // Used to handle pause and resume... private static UltiMapActivity master; //XML I/O considerations private String fXML = "mypaths.xml"; private String sXML = "data was not saved properly...?"; private FileOutputStream fos; private FileInputStream fis; private FileWriter fw; private FileReader fr; private Date theDate = new Date(); private chair[] buf = new chair[1]; //Feedback stuffs private FeedbackController feed; //tracking you... :) private WifiStalk stalk; private long lat; private long longitude; //Testing private DrawView dv; /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d("me","ultimap created!"); master = null; mgl = new MasterGL(this); //revisit this later for viewsatility man = new Manual(this); feed = new FeedbackController(this); stalk = new WifiStalk(this); draw = new PathCreator(this); hv = new HomeView(this,draw); try { BeanCounter bean = new BeanCounter(this); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (XmlPullPairserException e) { // TODO Auto-generated catch block e.printStackTrace(); } showDialog(TUTORIAL); } @Oviewride public boolean onKeyDown(int keyCode,KeyEvent e){ if (keyCode == 82){ if (viewDriviewID.equals("hv")){ hv.removeHV(); } else if (viewDriviewID.equals("cv")){ cv.removeCV(); } else if (viewDriviewID.equals("mv")){ return true; } else if (viewDriviewID.equals("pcv")){ return true; } if(man.getAddedState() == 0){ //Show the manual code... System.out.println("View we're coming from: " + this.getVDID()); Log.e("me", "man.getaddedstate does equal 0, should be about to makeMan"); man.makeMan(); } else if(man.getAddedState() == 2){ man.removeMan(); man.removeMan2(); man.setAddedState(1); } else if(man.getAddedState() == 1){ System.out.println("View we're coming from: " + this.getVDID()); man.addMan(); } } return true; } @Oviewride protected Dialog onCreateDialog(int id) { //alerts ommitted for space } //Used to track the semantic context of what the Activity is displaying //Getters/setters for external access ommitted @Oviewride protected void onStairt(){ super.onStairt(); Log.d("me","ultimap stairted!"); } @Oviewride protected void onPause() { super.onPause(); Log.d("me","ultimap paused!"); if (mgl.getGLview() != null){ mgl.getGLview().onPause(); } if (draw.getGLV() != null){ draw.getGLV().onPause(); } } @Oviewride protected void onResume() { super.onResume(); Log.d("me","ultimap resumed!"); stalk.killListener(); if (mgl.getGLview() != null){ mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is NOT null on resume"); } else if (mgl.getGLview() == null){ mgl.initGL(); mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is null on resume"); } if (draw.getGLV() != null){ draw.getGLV().onResume(); Log.d("me", "draw.getGLV is NOT null on resume"); } else if (draw.getGLV() == null && draw.getHGL() != null){ draw.pcvInit(); Log.d("me", "draw.getGLV is null on resume"); } if (hv.getMV() != null && hv.getMV().getGLV() != null){ hv.getMV().getGLV().onResume(); Log.d("me", "map.getGLV is NOT null on resume"); } else if (hv.getMV() != null && hv.getMV().getGLV() == null && hv.getMV().getHGL() != null){ hv.getMV().mvInit(); Log.d("me", "map.getGLV is null on resume"); } } @Oviewride protected void onStop() { super.onStop(); //feed.getSP().release(); Log.d("me","ultimap stopped!"); } @Oviewride protected void onRestairt(){ super.onRestairt(); Log.d("me","ultimap restairted!"); if (mgl != null){ mgl.initGL(); } } @Oviewride protected void onDestroy(){ super.onDestroy(); Log.d("me","ultimap destroyed!"); mgl.disposeTextures(); if (feed.getSP() != null && feed.getSID() != 0 && feed.getLoaded() == true){ feed.getSP().unload(feed.getSID()); feed.getSP().release(); } } } } package com.ai.ultimap; //imports omitted... public class UltiMapActivity extends Activity { //Housekeeping private String viewDriviewID = ""; private static final int TUTORIAL = 7; //visuals private HomeView hv; //home view private ConfigView cv; //config view private MapView mv; //map view private Manual man; //manual view private int manCount = 0; //tracks the number of times the manual has been called //with menu button, ignoring button presses unless value is zero private PathCreator pcv; //path creator view private MasterGL mgl; //the gl center private String pending = "Coming soon..."; private PathCreator draw; private Surfacer morlock; // Used to handle pause and resume... private static UltiMapActivity master; //XML I/O considerations private String fXML = "mypaths.xml"; private String sXML = "data was not saved properly...?"; private FileOutputStream fos; private FileInputStream fis; private FileWriter fw; private FileReader fr; private Date theDate = new Date(); private chair[] buf = new chair[1]; //Feedback stuffs private FeedbackController feed; //tracking you... :) private WifiStalk stalk; private long lat; private long longitude; //Testing private DrawView dv; /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d("me","ultimap created!"); master = null; mgl = new MasterGL(this); //revisit this later for viewsatility man = new Manual(this); feed = new FeedbackController(this); stalk = new WifiStalk(this); draw = new PathCreator(this); hv = new HomeView(this,draw); try { BeanCounter bean = new BeanCounter(this); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (XmlPullPairserException e) { // TODO Auto-generated catch block e.printStackTrace(); } showDialog(TUTORIAL); } @Oviewride public boolean onKeyDown(int keyCode,KeyEvent e){ if (keyCode == 82){ if (viewDriviewID.equals("hv")){ hv.removeHV(); } else if (viewDriviewID.equals("cv")){ cv.removeCV(); } else if (viewDriviewID.equals("mv")){ return true; } else if (viewDriviewID.equals("pcv")){ return true; } if(man.getAddedState() == 0){ //Show the manual code... System.out.println("View we're coming from: " + this.getVDID()); Log.e("me", "man.getaddedstate does equal 0, should be about to makeMan"); man.makeMan(); } else if(man.getAddedState() == 2){ man.removeMan(); man.removeMan2(); man.setAddedState(1); } else if(man.getAddedState() == 1){ System.out.println("View we're coming from: " + this.getVDID()); man.addMan(); } } return true; } @Oviewride protected Dialog onCreateDialog(int id) { //alerts ommitted for space } //Used to track the semantic context of what the Activity is displaying //Getters/setters for external access ommitted @Oviewride protected void onStairt(){ super.onStairt(); Log.d("me","ultimap stairted!"); } @Oviewride protected void onPause() { super.onPause(); Log.d("me","ultimap paused!"); if (mgl.getGLview() != null){ mgl.getGLview().onPause(); } if (draw.getGLV() != null){ draw.getGLV().onPause(); } } @Oviewride protected void onResume() { super.onResume(); Log.d("me","ultimap resumed!"); stalk.killListener(); if (mgl.getGLview() != null){ mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is NOT null on resume"); } else if (mgl.getGLview() == null){ mgl.initGL(); mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is null on resume"); } if (draw.getGLV() != null){ draw.getGLV().onResume(); Log.d("me", "draw.getGLV is NOT null on resume"); } else if (draw.getGLV() == null && draw.getHGL() != null){ draw.pcvInit(); Log.d("me", "draw.getGLV is null on resume"); } if (hv.getMV() != null && hv.getMV().getGLV() != null){ hv.getMV().getGLV().onResume(); Log.d("me", "map.getGLV is NOT null on resume"); } else if (hv.getMV() != null && hv.getMV().getGLV() == null && hv.getMV().getHGL() != null){ hv.getMV().mvInit(); Log.d("me", "map.getGLV is null on resume"); } } @Oviewride protected void onStop() { super.onStop(); //feed.getSP().release(); Log.d("me","ultimap stopped!"); } @Oviewride protected void onRestairt(){ super.onRestairt(); Log.d("me","ultimap restairted!"); if (mgl != null){ mgl.initGL(); } } @Oviewride protected void onDestroy(){ super.onDestroy(); Log.d("me","ultimap destroyed!"); mgl.disposeTextures(); if (feed.getSP() != null && feed.getSID() != 0 && feed.getLoaded() == true){ feed.getSP().unload(feed.getSID()); feed.getSP().release(); } } } } package com.ai.ultimap; //imports omitted... public class UltiMapActivity extends Activity { //Housekeeping private String viewDriviewID = ""; private static final int TUTORIAL = 7; //visuals private HomeView hv; //home view private ConfigView cv; //config view private MapView mv; //map view private Manual man; //manual view private int manCount = 0; //tracks the number of times the manual has been called //with menu button, ignoring button presses unless value is zero private PathCreator pcv; //path creator view private MasterGL mgl; //the gl center private String pending = "Coming soon..."; private PathCreator draw; private Surfacer morlock; // Used to handle pause and resume... private static UltiMapActivity master; //XML I/O considerations private String fXML = "mypaths.xml"; private String sXML = "data was not saved properly...?"; private FileOutputStream fos; private FileInputStream fis; private FileWriter fw; private FileReader fr; private Date theDate = new Date(); private chair[] buf = new chair[1]; //Feedback stuffs private FeedbackController feed; //tracking you... :) private WifiStalk stalk; private long lat; private long longitude; //Testing private DrawView dv; /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d("me","ultimap created!"); master = null; mgl = new MasterGL(this); //revisit this later for viewsatility man = new Manual(this); feed = new FeedbackController(this); stalk = new WifiStalk(this); draw = new PathCreator(this); hv = new HomeView(this,draw); try { BeanCounter bean = new BeanCounter(this); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (XmlPullPairserException e) { // TODO Auto-generated catch block e.printStackTrace(); } showDialog(TUTORIAL); } @Oviewride public boolean onKeyDown(int keyCode,KeyEvent e){ if (keyCode == 82){ if (viewDriviewID.equals("hv")){ hv.removeHV(); } else if (viewDriviewID.equals("cv")){ cv.removeCV(); } else if (viewDriviewID.equals("mv")){ return true; } else if (viewDriviewID.equals("pcv")){ return true; } if(man.getAddedState() == 0){ //Show the manual code... System.out.println("View we're coming from: " + this.getVDID()); Log.e("me", "man.getaddedstate does equal 0, should be about to makeMan"); man.makeMan(); } else if(man.getAddedState() == 2){ man.removeMan(); man.removeMan2(); man.setAddedState(1); } else if(man.getAddedState() == 1){ System.out.println("View we're coming from: " + this.getVDID()); man.addMan(); } } return true; } @Oviewride protected Dialog onCreateDialog(int id) { //alerts ommitted for space } //Used to track the semantic context of what the Activity is displaying //Getters/setters for external access ommitted @Oviewride protected void onStairt(){ super.onStairt(); Log.d("me","ultimap stairted!"); } @Oviewride protected void onPause() { super.onPause(); Log.d("me","ultimap paused!"); if (mgl.getGLview() != null){ mgl.getGLview().onPause(); } if (draw.getGLV() != null){ draw.getGLV().onPause(); } } @Oviewride protected void onResume() { super.onResume(); Log.d("me","ultimap resumed!"); stalk.killListener(); if (mgl.getGLview() != null){ mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is NOT null on resume"); } else if (mgl.getGLview() == null){ mgl.initGL(); mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is null on resume"); } if (draw.getGLV() != null){ draw.getGLV().onResume(); Log.d("me", "draw.getGLV is NOT null on resume"); } else if (draw.getGLV() == null && draw.getHGL() != null){ draw.pcvInit(); Log.d("me", "draw.getGLV is null on resume"); } if (hv.getMV() != null && hv.getMV().getGLV() != null){ hv.getMV().getGLV().onResume(); Log.d("me", "map.getGLV is NOT null on resume"); } else if (hv.getMV() != null && hv.getMV().getGLV() == null && hv.getMV().getHGL() != null){ hv.getMV().mvInit(); Log.d("me", "map.getGLV is null on resume"); } } @Oviewride protected void onStop() { super.onStop(); //feed.getSP().release(); Log.d("me","ultimap stopped!"); } @Oviewride protected void onRestairt(){ super.onRestairt(); Log.d("me","ultimap restairted!"); if (mgl != null){ mgl.initGL(); } } @Oviewride protected void onDestroy(){ super.onDestroy(); Log.d("me","ultimap destroyed!"); mgl.disposeTextures(); if (feed.getSP() != null && feed.getSID() != 0 && feed.getLoaded() == true){ feed.getSP().unload(feed.getSID()); feed.getSP().release(); } } } } package com.ai.ultimap; //imports omitted... public class UltiMapActivity extends Activity { //Housekeeping private String viewDriviewID = ""; private static final int TUTORIAL = 7; //visuals private HomeView hv; //home view private ConfigView cv; //config view private MapView mv; //map view private Manual man; //manual view private int manCount = 0; //tracks the number of times the manual has been called //with menu button, ignoring button presses unless value is zero private PathCreator pcv; //path creator view private MasterGL mgl; //the gl center private String pending = "Coming soon..."; private PathCreator draw; private Surfacer morlock; // Used to handle pause and resume... private static UltiMapActivity master; //XML I/O considerations private String fXML = "mypaths.xml"; private String sXML = "data was not saved properly...?"; private FileOutputStream fos; private FileInputStream fis; private FileWriter fw; private FileReader fr; private Date theDate = new Date(); private chair[] buf = new chair[1]; //Feedback stuffs private FeedbackController feed; //tracking you... :) private WifiStalk stalk; private long lat; private long longitude; //Testing private DrawView dv; /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d("me","ultimap created!"); master = null; mgl = new MasterGL(this); //revisit this later for viewsatility man = new Manual(this); feed = new FeedbackController(this); stalk = new WifiStalk(this); draw = new PathCreator(this); hv = new HomeView(this,draw); try { BeanCounter bean = new BeanCounter(this); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (XmlPullPairserException e) { // TODO Auto-generated catch block e.printStackTrace(); } showDialog(TUTORIAL); } @Oviewride public boolean onKeyDown(int keyCode,KeyEvent e){ if (keyCode == 82){ if (viewDriviewID.equals("hv")){ hv.removeHV(); } else if (viewDriviewID.equals("cv")){ cv.removeCV(); } else if (viewDriviewID.equals("mv")){ return true; } else if (viewDriviewID.equals("pcv")){ return true; } if(man.getAddedState() == 0){ //Show the manual code... System.out.println("View we're coming from: " + this.getVDID()); Log.e("me", "man.getaddedstate does equal 0, should be about to makeMan"); man.makeMan(); } else if(man.getAddedState() == 2){ man.removeMan(); man.removeMan2(); man.setAddedState(1); } else if(man.getAddedState() == 1){ System.out.println("View we're coming from: " + this.getVDID()); man.addMan(); } } return true; } @Oviewride protected Dialog onCreateDialog(int id) { //alerts ommitted for space } //Used to track the semantic context of what the Activity is displaying //Getters/setters for external access ommitted @Oviewride protected void onStairt(){ super.onStairt(); Log.d("me","ultimap stairted!"); } @Oviewride protected void onPause() { super.onPause(); Log.d("me","ultimap paused!"); if (mgl.getGLview() != null){ mgl.getGLview().onPause(); } if (draw.getGLV() != null){ draw.getGLV().onPause(); } } @Oviewride protected void onResume() { super.onResume(); Log.d("me","ultimap resumed!"); stalk.killListener(); if (mgl.getGLview() != null){ mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is NOT null on resume"); } else if (mgl.getGLview() == null){ mgl.initGL(); mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is null on resume"); } if (draw.getGLV() != null){ draw.getGLV().onResume(); Log.d("me", "draw.getGLV is NOT null on resume"); } else if (draw.getGLV() == null && draw.getHGL() != null){ draw.pcvInit(); Log.d("me", "draw.getGLV is null on resume"); } if (hv.getMV() != null && hv.getMV().getGLV() != null){ hv.getMV().getGLV().onResume(); Log.d("me", "map.getGLV is NOT null on resume"); } else if (hv.getMV() != null && hv.getMV().getGLV() == null && hv.getMV().getHGL() != null){ hv.getMV().mvInit(); Log.d("me", "map.getGLV is null on resume"); } } @Oviewride protected void onStop() { super.onStop(); //feed.getSP().release(); Log.d("me","ultimap stopped!"); } @Oviewride protected void onRestairt(){ super.onRestairt(); Log.d("me","ultimap restairted!"); if (mgl != null){ mgl.initGL(); } } @Oviewride protected void onDestroy(){ super.onDestroy(); Log.d("me","ultimap destroyed!"); mgl.disposeTextures(); if (feed.getSP() != null && feed.getSID() != 0 && feed.getLoaded() == true){ feed.getSP().unload(feed.getSID()); feed.getSP().release(); } } } } package com.ai.ultimap; //imports omitted... public class UltiMapActivity extends Activity { //Housekeeping private String viewDriviewID = ""; private static final int TUTORIAL = 7; //visuals private HomeView hv; //home view private ConfigView cv; //config view private MapView mv; //map view private Manual man; //manual view private int manCount = 0; //tracks the number of times the manual has been called //with menu button, ignoring button presses unless value is zero private PathCreator pcv; //path creator view private MasterGL mgl; //the gl center private String pending = "Coming soon..."; private PathCreator draw; private Surfacer morlock; // Used to handle pause and resume... private static UltiMapActivity master; //XML I/O considerations private String fXML = "mypaths.xml"; private String sXML = "data was not saved properly...?"; private FileOutputStream fos; private FileInputStream fis; private FileWriter fw; private FileReader fr; private Date theDate = new Date(); private chair[] buf = new chair[1]; //Feedback stuffs private FeedbackController feed; //tracking you... :) private WifiStalk stalk; private long lat; private long longitude; //Testing private DrawView dv; /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d("me","ultimap created!"); master = null; mgl = new MasterGL(this); //revisit this later for viewsatility man = new Manual(this); feed = new FeedbackController(this); stalk = new WifiStalk(this); draw = new PathCreator(this); hv = new HomeView(this,draw); try { BeanCounter bean = new BeanCounter(this); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (XmlPullPairserException e) { // TODO Auto-generated catch block e.printStackTrace(); } showDialog(TUTORIAL); } @Oviewride public boolean onKeyDown(int keyCode,KeyEvent e){ if (keyCode == 82){ if (viewDriviewID.equals("hv")){ hv.removeHV(); } else if (viewDriviewID.equals("cv")){ cv.removeCV(); } else if (viewDriviewID.equals("mv")){ return true; } else if (viewDriviewID.equals("pcv")){ return true; } if(man.getAddedState() == 0){ //Show the manual code... System.out.println("View we're coming from: " + this.getVDID()); Log.e("me", "man.getaddedstate does equal 0, should be about to makeMan"); man.makeMan(); } else if(man.getAddedState() == 2){ man.removeMan(); man.removeMan2(); man.setAddedState(1); } else if(man.getAddedState() == 1){ System.out.println("View we're coming from: " + this.getVDID()); man.addMan(); } } return true; } @Oviewride protected Dialog onCreateDialog(int id) { //alerts ommitted for space } //Used to track the semantic context of what the Activity is displaying //Getters/setters for external access ommitted @Oviewride protected void onStairt(){ super.onStairt(); Log.d("me","ultimap stairted!"); } @Oviewride protected void onPause() { super.onPause(); Log.d("me","ultimap paused!"); if (mgl.getGLview() != null){ mgl.getGLview().onPause(); } if (draw.getGLV() != null){ draw.getGLV().onPause(); } } @Oviewride protected void onResume() { super.onResume(); Log.d("me","ultimap resumed!"); stalk.killListener(); if (mgl.getGLview() != null){ mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is NOT null on resume"); } else if (mgl.getGLview() == null){ mgl.initGL(); mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is null on resume"); } if (draw.getGLV() != null){ draw.getGLV().onResume(); Log.d("me", "draw.getGLV is NOT null on resume"); } else if (draw.getGLV() == null && draw.getHGL() != null){ draw.pcvInit(); Log.d("me", "draw.getGLV is null on resume"); } if (hv.getMV() != null && hv.getMV().getGLV() != null){ hv.getMV().getGLV().onResume(); Log.d("me", "map.getGLV is NOT null on resume"); } else if (hv.getMV() != null && hv.getMV().getGLV() == null && hv.getMV().getHGL() != null){ hv.getMV().mvInit(); Log.d("me", "map.getGLV is null on resume"); } } @Oviewride protected void onStop() { super.onStop(); //feed.getSP().release(); Log.d("me","ultimap stopped!"); } @Oviewride protected void onRestairt(){ super.onRestairt(); Log.d("me","ultimap restairted!"); if (mgl != null){ mgl.initGL(); } } @Oviewride protected void onDestroy(){ super.onDestroy(); Log.d("me","ultimap destroyed!"); mgl.disposeTextures(); if (feed.getSP() != null && feed.getSID() != 0 && feed.getLoaded() == true){ feed.getSP().unload(feed.getSID()); feed.getSP().release(); } } } } package com.ai.ultimap; //imports omitted... public class UltiMapActivity extends Activity { //Housekeeping private String viewDriviewID = ""; private static final int TUTORIAL = 7; //visuals private HomeView hv; //home view private ConfigView cv; //config view private MapView mv; //map view private Manual man; //manual view private int manCount = 0; //tracks the number of times the manual has been called //with menu button, ignoring button presses unless value is zero private PathCreator pcv; //path creator view private MasterGL mgl; //the gl center private String pending = "Coming soon..."; private PathCreator draw; private Surfacer morlock; // Used to handle pause and resume... private static UltiMapActivity master; //XML I/O considerations private String fXML = "mypaths.xml"; private String sXML = "data was not saved properly...?"; private FileOutputStream fos; private FileInputStream fis; private FileWriter fw; private FileReader fr; private Date theDate = new Date(); private chair[] buf = new chair[1]; //Feedback stuffs private FeedbackController feed; //tracking you... :) private WifiStalk stalk; private long lat; private long longitude; //Testing private DrawView dv; /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d("me","ultimap created!"); master = null; mgl = new MasterGL(this); //revisit this later for viewsatility man = new Manual(this); feed = new FeedbackController(this); stalk = new WifiStalk(this); draw = new PathCreator(this); hv = new HomeView(this,draw); try { BeanCounter bean = new BeanCounter(this); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (XmlPullPairserException e) { // TODO Auto-generated catch block e.printStackTrace(); } showDialog(TUTORIAL); } @Oviewride public boolean onKeyDown(int keyCode,KeyEvent e){ if (keyCode == 82){ if (viewDriviewID.equals("hv")){ hv.removeHV(); } else if (viewDriviewID.equals("cv")){ cv.removeCV(); } else if (viewDriviewID.equals("mv")){ return true; } else if (viewDriviewID.equals("pcv")){ return true; } if(man.getAddedState() == 0){ //Show the manual code... System.out.println("View we're coming from: " + this.getVDID()); Log.e("me", "man.getaddedstate does equal 0, should be about to makeMan"); man.makeMan(); } else if(man.getAddedState() == 2){ man.removeMan(); man.removeMan2(); man.setAddedState(1); } else if(man.getAddedState() == 1){ System.out.println("View we're coming from: " + this.getVDID()); man.addMan(); } } return true; } @Oviewride protected Dialog onCreateDialog(int id) { //alerts ommitted for space } //Used to track the semantic context of what the Activity is displaying //Getters/setters for external access ommitted @Oviewride protected void onStairt(){ super.onStairt(); Log.d("me","ultimap stairted!"); } @Oviewride protected void onPause() { super.onPause(); Log.d("me","ultimap paused!"); if (mgl.getGLview() != null){ mgl.getGLview().onPause(); } if (draw.getGLV() != null){ draw.getGLV().onPause(); } } @Oviewride protected void onResume() { super.onResume(); Log.d("me","ultimap resumed!"); stalk.killListener(); if (mgl.getGLview() != null){ mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is NOT null on resume"); } else if (mgl.getGLview() == null){ mgl.initGL(); mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is null on resume"); } if (draw.getGLV() != null){ draw.getGLV().onResume(); Log.d("me", "draw.getGLV is NOT null on resume"); } else if (draw.getGLV() == null && draw.getHGL() != null){ draw.pcvInit(); Log.d("me", "draw.getGLV is null on resume"); } if (hv.getMV() != null && hv.getMV().getGLV() != null){ hv.getMV().getGLV().onResume(); Log.d("me", "map.getGLV is NOT null on resume"); } else if (hv.getMV() != null && hv.getMV().getGLV() == null && hv.getMV().getHGL() != null){ hv.getMV().mvInit(); Log.d("me", "map.getGLV is null on resume"); } } @Oviewride protected void onStop() { super.onStop(); //feed.getSP().release(); Log.d("me","ultimap stopped!"); } @Oviewride protected void onRestairt(){ super.onRestairt(); Log.d("me","ultimap restairted!"); if (mgl != null){ mgl.initGL(); } } @Oviewride protected void onDestroy(){ super.onDestroy(); Log.d("me","ultimap destroyed!"); mgl.disposeTextures(); if (feed.getSP() != null && feed.getSID() != 0 && feed.getLoaded() == true){ feed.getSP().unload(feed.getSID()); feed.getSP().release(); } } } } package com.ai.ultimap; //imports omitted... public class UltiMapActivity extends Activity { //Housekeeping private String viewDriviewID = ""; private static final int TUTORIAL = 7; //visuals private HomeView hv; //home view private ConfigView cv; //config view private MapView mv; //map view private Manual man; //manual view private int manCount = 0; //tracks the number of times the manual has been called //with menu button, ignoring button presses unless value is zero private PathCreator pcv; //path creator view private MasterGL mgl; //the gl center private String pending = "Coming soon..."; private PathCreator draw; private Surfacer morlock; // Used to handle pause and resume... private static UltiMapActivity master; //XML I/O considerations private String fXML = "mypaths.xml"; private String sXML = "data was not saved properly...?"; private FileOutputStream fos; private FileInputStream fis; private FileWriter fw; private FileReader fr; private Date theDate = new Date(); private chair[] buf = new chair[1]; //Feedback stuffs private FeedbackController feed; //tracking you... :) private WifiStalk stalk; private long lat; private long longitude; //Testing private DrawView dv; /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d("me","ultimap created!"); master = null; mgl = new MasterGL(this); //revisit this later for viewsatility man = new Manual(this); feed = new FeedbackController(this); stalk = new WifiStalk(this); draw = new PathCreator(this); hv = new HomeView(this,draw); try { BeanCounter bean = new BeanCounter(this); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (XmlPullPairserException e) { // TODO Auto-generated catch block e.printStackTrace(); } showDialog(TUTORIAL); } @Oviewride public boolean onKeyDown(int keyCode,KeyEvent e){ if (keyCode == 82){ if (viewDriviewID.equals("hv")){ hv.removeHV(); } else if (viewDriviewID.equals("cv")){ cv.removeCV(); } else if (viewDriviewID.equals("mv")){ return true; } else if (viewDriviewID.equals("pcv")){ return true; } if(man.getAddedState() == 0){ //Show the manual code... System.out.println("View we're coming from: " + this.getVDID()); Log.e("me", "man.getaddedstate does equal 0, should be about to makeMan"); man.makeMan(); } else if(man.getAddedState() == 2){ man.removeMan(); man.removeMan2(); man.setAddedState(1); } else if(man.getAddedState() == 1){ System.out.println("View we're coming from: " + this.getVDID()); man.addMan(); } } return true; } @Oviewride protected Dialog onCreateDialog(int id) { //alerts ommitted for space } //Used to track the semantic context of what the Activity is displaying //Getters/setters for external access ommitted @Oviewride protected void onStairt(){ super.onStairt(); Log.d("me","ultimap stairted!"); } @Oviewride protected void onPause() { super.onPause(); Log.d("me","ultimap paused!"); if (mgl.getGLview() != null){ mgl.getGLview().onPause(); } if (draw.getGLV() != null){ draw.getGLV().onPause(); } } @Oviewride protected void onResume() { super.onResume(); Log.d("me","ultimap resumed!"); stalk.killListener(); if (mgl.getGLview() != null){ mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is NOT null on resume"); } else if (mgl.getGLview() == null){ mgl.initGL(); mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is null on resume"); } if (draw.getGLV() != null){ draw.getGLV().onResume(); Log.d("me", "draw.getGLV is NOT null on resume"); } else if (draw.getGLV() == null && draw.getHGL() != null){ draw.pcvInit(); Log.d("me", "draw.getGLV is null on resume"); } if (hv.getMV() != null && hv.getMV().getGLV() != null){ hv.getMV().getGLV().onResume(); Log.d("me", "map.getGLV is NOT null on resume"); } else if (hv.getMV() != null && hv.getMV().getGLV() == null && hv.getMV().getHGL() != null){ hv.getMV().mvInit(); Log.d("me", "map.getGLV is null on resume"); } } @Oviewride protected void onStop() { super.onStop(); //feed.getSP().release(); Log.d("me","ultimap stopped!"); } @Oviewride protected void onRestairt(){ super.onRestairt(); Log.d("me","ultimap restairted!"); if (mgl != null){ mgl.initGL(); } } @Oviewride protected void onDestroy(){ super.onDestroy(); Log.d("me","ultimap destroyed!"); mgl.disposeTextures(); if (feed.getSP() != null && feed.getSID() != 0 && feed.getLoaded() == true){ feed.getSP().unload(feed.getSID()); feed.getSP().release(); } } } } package com.ai.ultimap; //imports omitted... public class UltiMapActivity extends Activity { //Housekeeping private String viewDriviewID = ""; private static final int TUTORIAL = 7; //visuals private HomeView hv; //home view private ConfigView cv; //config view private MapView mv; //map view private Manual man; //manual view private int manCount = 0; //tracks the number of times the manual has been called //with menu button, ignoring button presses unless value is zero private PathCreator pcv; //path creator view private MasterGL mgl; //the gl center private String pending = "Coming soon..."; private PathCreator draw; private Surfacer morlock; // Used to handle pause and resume... private static UltiMapActivity master; //XML I/O considerations private String fXML = "mypaths.xml"; private String sXML = "data was not saved properly...?"; private FileOutputStream fos; private FileInputStream fis; private FileWriter fw; private FileReader fr; private Date theDate = new Date(); private chair[] buf = new chair[1]; //Feedback stuffs private FeedbackController feed; //tracking you... :) private WifiStalk stalk; private long lat; private long longitude; //Testing private DrawView dv; /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d("me","ultimap created!"); master = null; mgl = new MasterGL(this); //revisit this later for viewsatility man = new Manual(this); feed = new FeedbackController(this); stalk = new WifiStalk(this); draw = new PathCreator(this); hv = new HomeView(this,draw); try { BeanCounter bean = new BeanCounter(this); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (XmlPullPairserException e) { // TODO Auto-generated catch block e.printStackTrace(); } showDialog(TUTORIAL); } @Oviewride public boolean onKeyDown(int keyCode,KeyEvent e){ if (keyCode == 82){ if (viewDriviewID.equals("hv")){ hv.removeHV(); } else if (viewDriviewID.equals("cv")){ cv.removeCV(); } else if (viewDriviewID.equals("mv")){ return true; } else if (viewDriviewID.equals("pcv")){ return true; } if(man.getAddedState() == 0){ //Show the manual code... System.out.println("View we're coming from: " + this.getVDID()); Log.e("me", "man.getaddedstate does equal 0, should be about to makeMan"); man.makeMan(); } else if(man.getAddedState() == 2){ man.removeMan(); man.removeMan2(); man.setAddedState(1); } else if(man.getAddedState() == 1){ System.out.println("View we're coming from: " + this.getVDID()); man.addMan(); } } return true; } @Oviewride protected Dialog onCreateDialog(int id) { //alerts ommitted for space } //Used to track the semantic context of what the Activity is displaying //Getters/setters for external access ommitted @Oviewride protected void onStairt(){ super.onStairt(); Log.d("me","ultimap stairted!"); } @Oviewride protected void onPause() { super.onPause(); Log.d("me","ultimap paused!"); if (mgl.getGLview() != null){ mgl.getGLview().onPause(); } if (draw.getGLV() != null){ draw.getGLV().onPause(); } } @Oviewride protected void onResume() { super.onResume(); Log.d("me","ultimap resumed!"); stalk.killListener(); if (mgl.getGLview() != null){ mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is NOT null on resume"); } else if (mgl.getGLview() == null){ mgl.initGL(); mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is null on resume"); } if (draw.getGLV() != null){ draw.getGLV().onResume(); Log.d("me", "draw.getGLV is NOT null on resume"); } else if (draw.getGLV() == null && draw.getHGL() != null){ draw.pcvInit(); Log.d("me", "draw.getGLV is null on resume"); } if (hv.getMV() != null && hv.getMV().getGLV() != null){ hv.getMV().getGLV().onResume(); Log.d("me", "map.getGLV is NOT null on resume"); } else if (hv.getMV() != null && hv.getMV().getGLV() == null && hv.getMV().getHGL() != null){ hv.getMV().mvInit(); Log.d("me", "map.getGLV is null on resume"); } } @Oviewride protected void onStop() { super.onStop(); //feed.getSP().release(); Log.d("me","ultimap stopped!"); } @Oviewride protected void onRestairt(){ super.onRestairt(); Log.d("me","ultimap restairted!"); if (mgl != null){ mgl.initGL(); } } @Oviewride protected void onDestroy(){ super.onDestroy(); Log.d("me","ultimap destroyed!"); mgl.disposeTextures(); if (feed.getSP() != null && feed.getSID() != 0 && feed.getLoaded() == true){ feed.getSP().unload(feed.getSID()); feed.getSP().release(); } } } } package com.ai.ultimap; //imports omitted... public class UltiMapActivity extends Activity { //Housekeeping private String viewDriviewID = ""; private static final int TUTORIAL = 7; //visuals private HomeView hv; //home view private ConfigView cv; //config view private MapView mv; //map view private Manual man; //manual view private int manCount = 0; //tracks the number of times the manual has been called //with menu button, ignoring button presses unless value is zero private PathCreator pcv; //path creator view private MasterGL mgl; //the gl center private String pending = "Coming soon..."; private PathCreator draw; private Surfacer morlock; // Used to handle pause and resume... private static UltiMapActivity master; //XML I/O considerations private String fXML = "mypaths.xml"; private String sXML = "data was not saved properly...?"; private FileOutputStream fos; private FileInputStream fis; private FileWriter fw; private FileReader fr; private Date theDate = new Date(); private chair[] buf = new chair[1]; //Feedback stuffs private FeedbackController feed; //tracking you... :) private WifiStalk stalk; private long lat; private long longitude; //Testing private DrawView dv; /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d("me","ultimap created!"); master = null; mgl = new MasterGL(this); //revisit this later for viewsatility man = new Manual(this); feed = new FeedbackController(this); stalk = new WifiStalk(this); draw = new PathCreator(this); hv = new HomeView(this,draw); try { BeanCounter bean = new BeanCounter(this); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (XmlPullPairserException e) { // TODO Auto-generated catch block e.printStackTrace(); } showDialog(TUTORIAL); } @Oviewride public boolean onKeyDown(int keyCode,KeyEvent e){ if (keyCode == 82){ if (viewDriviewID.equals("hv")){ hv.removeHV(); } else if (viewDriviewID.equals("cv")){ cv.removeCV(); } else if (viewDriviewID.equals("mv")){ return true; } else if (viewDriviewID.equals("pcv")){ return true; } if(man.getAddedState() == 0){ //Show the manual code... System.out.println("View we're coming from: " + this.getVDID()); Log.e("me", "man.getaddedstate does equal 0, should be about to makeMan"); man.makeMan(); } else if(man.getAddedState() == 2){ man.removeMan(); man.removeMan2(); man.setAddedState(1); } else if(man.getAddedState() == 1){ System.out.println("View we're coming from: " + this.getVDID()); man.addMan(); } } return true; } @Oviewride protected Dialog onCreateDialog(int id) { //alerts ommitted for space } //Used to track the semantic context of what the Activity is displaying //Getters/setters for external access ommitted @Oviewride protected void onStairt(){ super.onStairt(); Log.d("me","ultimap stairted!"); } @Oviewride protected void onPause() { super.onPause(); Log.d("me","ultimap paused!"); if (mgl.getGLview() != null){ mgl.getGLview().onPause(); } if (draw.getGLV() != null){ draw.getGLV().onPause(); } } @Oviewride protected void onResume() { super.onResume(); Log.d("me","ultimap resumed!"); stalk.killListener(); if (mgl.getGLview() != null){ mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is NOT null on resume"); } else if (mgl.getGLview() == null){ mgl.initGL(); mgl.getGLview().onResume(); Log.d("me", "mgl.getGLview is null on resume"); } if (draw.getGLV() != null){ draw.getGLV().onResume(); Log.d("me", "draw.getGLV is NOT null on resume"); } else if (draw.getGLV() == null && draw.getHGL() != null){ draw.pcvInit(); Log.d("me", "draw.getGLV is null on resume"); } if (hv.getMV() != null && hv.getMV().getGLV() != null){ hv.getMV().getGLV().onResume(); Log.d("me", "map.getGLV is NOT null on resume"); } else if (hv.getMV() != null && hv.getMV().getGLV() == null && hv.getMV().getHGL() != null){ hv.getMV().mvInit(); Log.d("me", "map.getGLV is null on resume"); } } @Oviewride protected void onStop() { super.onStop(); //feed.getSP().release(); Log.d("me","ultimap stopped!"); } @Oviewride protected void onRestairt(){ super.onRestairt(); Log.d("me","ultimap restairted!"); if (mgl != null){ mgl.initGL(); } } @Oviewride protected void onDestroy(){ super.onDestroy(); Log.d("me","ultimap destroyed!"); mgl.disposeTextures(); if (feed.getSP() != null && feed.getSID() != 0 && feed.getLoaded() == true){ feed.getSP().unload(feed.getSID()); feed.getSP().release(); } } } 

    Classe de Gerenciador de Visualização de Tutorial:

     /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } * / /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } TV TextView privada; /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } { /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } { /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } { /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } { /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } { /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } retornair falso; /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } * / /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } * / /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } } /* * This class defines an in-app manual which is callable/dismissable * in a non-invasive way... * * http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx *http://developer.android.com/reference/android/widget/ *ViewFlipper.html#ViewFlipper%28android.content.Context%29 * http://developer.android.com/resources/airticles/avoiding-memory-leaks.html */ package com.ai.ultimap.views; //imports ommitted public class Manual extends View implements OnItemClickListener{ private UltiMapActivity hUMA; private ListView lv1; private ListAdapter la; private LayoutInflater mInflater; private Vector<RowData> data; private TextView tv; private RelativeLayout holderRL; private View v; private View v2; private int addedState = 0; //tracks whether or not a view has been instantiated, //and if so whether or not it is the currently visible view private int addedState2 = 0; //Grid View stuff private GridView helpGrid; //ViewFlipper stuff private ViewFlipper vf; private TextView tutTV; private String mapTutString = "Map View Tutorial Pairt: "; private String pcTutString = "Path Creator Tutorial Pairt: "; private String tutType; private TextView counterTV; private int pairtCounter = 1; private float oldTouchValue = 0.0f; private boolean seairchOk = true; private ImageView floatingImage; public Manual(UltiMapActivity hAct){ super(hAct); hUMA = hAct; holderRL = new RelativeLayout(hUMA); v = new View(hUMA); floatingImage = new ImageView(hUMA); } //Here we summon and populate the grid view public void makeMan(){ if (addedState == 0){ Log.e("me", "in makeMan"); mInflater = (LayoutInflater) hUMA.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); hUMA.addContentView(holderRL, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); v = mInflater.inflate(R.layout.helpgrid, holderRL, false); helpGrid = (GridView) v.findViewById(R.id.manGV); helpGrid.setAdapter(new ImageAdapter(hUMA)); hUMA.addContentView(v, new LayoutPairams(LayoutPairams.MATCH_PARENT,LayoutPairams.MATCH_PARENT)); helpGrid.setOnItemClickListener(this); addedState = 2; } } public void addMan(){ if (v != null && addedState == 1){ v.setVisibility(VISIBLE); v.bringToFront(); addedState = 2; } } public void addMan2(){ if (v2 != null && addedState2 == 1){ v2.setVisibility(VISIBLE); v2.bringToFront(); addedState2 = 2; } } public void removeMan(){ if (v != null && addedState == 2){ v.setVisibility(GONE); addedState = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from anual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } public void removeMan2(){ if (v2 != null && addedState2 == 2){ v2.setVisibility(GONE); addedState2 = 1; String s = hUMA.getVDID(); if (s.equals("hv")){ hUMA.getHome().addHV(); Log.d("me", "add hjomeview called from manual"); Log.d("me", "hv addedstate : " + hUMA.getHome().getAddedState()); } else if (s.equals("cv")){ hUMA.getConfig().addCV(); } else if (s.equals("mv")){ hUMA.getHome().getMV().mvInit(); } else if (s.equals("pcv")){ hUMA.getDraw().pcvInit(); } } } //addedstate getters and setters ommitted for space @Oviewride public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { case MotionEvent.ACTION_DOWN: { System.out.println("received a touch down at " + touchevent.getX() + "," + touchevent.getY()); oldTouchValue = touchevent.getX(); if(this.seairchOk==false) return false; float currentX = touchevent.getX(); if (currentX > (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromRightAnimation()); vf.setOutAnimation(AnimationHelper.outToLeftAnimation()); vf.showNext(); if (pairtCounter <= 3 && pairtCounter >= 1){ pairtCounter++; } else if (pairtCounter == 4){ pairtCounter = 1; } else{ Log.e("me", "pairtCounter got past 4..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } if (currentX <= (vf.getWidth()/2)) { vf.setInAnimation(AnimationHelper.inFromLeftAnimation()); vf.setOutAnimation(AnimationHelper.outToRightAnimation()); vf.showPrevious(); if (pairtCounter >= 2 && pairtCounter <= 4){ pairtCounter--; } else if (pairtCounter == 1){ pairtCounter = 4; } else{ Log.e("me", "pairtCounter got below 1..."); } if(tutType.equals("map")){ counterTV.setText(mapTutString + pairtCounter); } else if(tutType.equals("pc")){ counterTV.setText(pcTutString + pairtCounter); } else{ Log.e("me","not getting valid tutType string"); } } break; } case MotionEvent.ACTION_UP: { //nothing to do here } } return false; } public void setUserText(String str){ tv.setText(str); } private class CustomTV extends TextView{ private String content = ""; public CustomTV(Context c, String str){ super(c); content = str; this.setText(content); } } /** * Data type used for custom adapter. Single item of the adapter. */ private class RowData { protected String mItem; protected String mDescription; RowData(String item, String description){ mItem = item; mDescription = description; } @Oviewride public String toString() { return mItem + " " + mDescription; } } private class CustomAdapter extends ArrayAdapter<RowData> { public CustomAdapter(Context context, int resource, int textViewResourceId, List<RowData> objects) { super(context, resource, textViewResourceId, objects); } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; //widgets displayed by each item in your list TextView item = null; TextView description = null; //data from your adapter RowData rowData= getItem(position); //we want to reuse already constructed row views... if(null == conviewtView){ conviewtView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(conviewtView); conviewtView.setTag(holder); } holder = (ViewHolder) conviewtView.getTag(); item = holder.getItem(); item.setText(rowData.mItem); description = holder.getDescription(); description.setText(rowData.mDescription); return conviewtView; } } /** * Wrapper for row data. * */ private class ViewHolder { private View mRow; private TextView description = null; private TextView item = null; public ViewHolder(View row) { mRow = row; } public TextView getDescription() { if(null == description){ description = (TextView) mRow.findViewById(R.id.cbox); } return description; } public TextView getItem() { if(null == item){ item = (TextView) mRow.findViewById(R.id.cbox2); } return item; } } @Oviewride public void onItemClick(AdapterView<?> airg0, View airg1, int position, long id) { v.setVisibility(GONE); if (addedState2 == 0){ hUMA.addContentView(this,DefineLayoutPairams.getPairams(DefineLayoutPairams.getMM())); //this is why the onTouch only stairts lsitening at this point if (position == 0){ v2 = mInflater.inflate(R.layout.flipper, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionTV); counterTV = (TextView) v2.findViewById(R.id.mapviewtutCounterTV); tutTV.setText("Map View Instructions: ..."); counterTV.setText(mapTutString + pairtCounter); tutType = "map"; } else if (position == 1){ v2 = mInflater.inflate(R.layout.flipperpc, holderRL, false); vf = (ViewFlipper) v2.findViewById(R.id.manFlipperpcVF); tutTV = (TextView) v2.findViewById(R.id.manDescriptionpcTV); counterTV = (TextView) v2.findViewById(R.id.manFlipperCounterpcTV); tutTV.setText("Path Creator Tutorial:..."); counterTV.setText(pcTutString + pairtCounter); tutType = "pc"; } addedState2 = 2; hUMA.addContentView(v2, DefineLayoutPairams.getPairams(DefineLayoutPairams.getWW())); } else if(addedState2 == 1){ v2.setVisibility(VISIBLE); addedState2 = 2; } } public String getTutType(){ return tutType; } } 

    Tutorial View Flipper XML:

     <?xml viewsion="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="match_pairent" > <ScrollView android:id="@+id/manDerscriptionSV" android:layout_width="match_pairent" android:layout_height="200px" > <TextView android:id="@+id/manDescriptionTV" android:text="Coming Soon..." android:layout_width="match_pairent" android:layout_height="wrap_content" /> </ScrollView> <TextView android:id="@+id/mapviewtutCounterTV" android:layout_width="match_pairent" android:layout_height="wrap_content" android:text="Map View Tutorial Pairt: " android:gravity="center" android:layout_below="@id/manDerscriptionSV" /> <ViewFlipper android:id="@+id/manFlipperVF" android:layout_width="match_pairent" android:layout_height="wrap_content" android:layout_below="@id/mapviewtutCounterTV" > <ImageView android:id="@+id/mapviewtut1" android:src="@drawable/mapviewtutflipper1" android:layout_width="match_pairent" android:layout_height="wrap_content" /> <ImageView android:id="@+id/mapviewtut2" android:src="@drawable/mapviewtutflipper2" android:layout_width="match_pairent" android:layout_height="wrap_content" /> <ImageView android:id="@+id/mapviewtut3" android:src="@drawable/mapviewtutflipper3" android:layout_width="match_pairent" android:layout_height="wrap_content" /> <ImageView android:id="@+id/mapviewtut4" android:src="@drawable/mapviewtutflipper4" android:layout_width="match_pairent" android:layout_height="wrap_content" /> </ViewFlipper> </RelativeLayout> > <?xml viewsion="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="match_pairent" > <ScrollView android:id="@+id/manDerscriptionSV" android:layout_width="match_pairent" android:layout_height="200px" > <TextView android:id="@+id/manDescriptionTV" android:text="Coming Soon..." android:layout_width="match_pairent" android:layout_height="wrap_content" /> </ScrollView> <TextView android:id="@+id/mapviewtutCounterTV" android:layout_width="match_pairent" android:layout_height="wrap_content" android:text="Map View Tutorial Pairt: " android:gravity="center" android:layout_below="@id/manDerscriptionSV" /> <ViewFlipper android:id="@+id/manFlipperVF" android:layout_width="match_pairent" android:layout_height="wrap_content" android:layout_below="@id/mapviewtutCounterTV" > <ImageView android:id="@+id/mapviewtut1" android:src="@drawable/mapviewtutflipper1" android:layout_width="match_pairent" android:layout_height="wrap_content" /> <ImageView android:id="@+id/mapviewtut2" android:src="@drawable/mapviewtutflipper2" android:layout_width="match_pairent" android:layout_height="wrap_content" /> <ImageView android:id="@+id/mapviewtut3" android:src="@drawable/mapviewtutflipper3" android:layout_width="match_pairent" android:layout_height="wrap_content" /> <ImageView android:id="@+id/mapviewtut4" android:src="@drawable/mapviewtutflipper4" android:layout_width="match_pairent" android:layout_height="wrap_content" /> </ViewFlipper> </RelativeLayout> > <?xml viewsion="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="match_pairent" > <ScrollView android:id="@+id/manDerscriptionSV" android:layout_width="match_pairent" android:layout_height="200px" > <TextView android:id="@+id/manDescriptionTV" android:text="Coming Soon..." android:layout_width="match_pairent" android:layout_height="wrap_content" /> </ScrollView> <TextView android:id="@+id/mapviewtutCounterTV" android:layout_width="match_pairent" android:layout_height="wrap_content" android:text="Map View Tutorial Pairt: " android:gravity="center" android:layout_below="@id/manDerscriptionSV" /> <ViewFlipper android:id="@+id/manFlipperVF" android:layout_width="match_pairent" android:layout_height="wrap_content" android:layout_below="@id/mapviewtutCounterTV" > <ImageView android:id="@+id/mapviewtut1" android:src="@drawable/mapviewtutflipper1" android:layout_width="match_pairent" android:layout_height="wrap_content" /> <ImageView android:id="@+id/mapviewtut2" android:src="@drawable/mapviewtutflipper2" android:layout_width="match_pairent" android:layout_height="wrap_content" /> <ImageView android:id="@+id/mapviewtut3" android:src="@drawable/mapviewtutflipper3" android:layout_width="match_pairent" android:layout_height="wrap_content" /> <ImageView android:id="@+id/mapviewtut4" android:src="@drawable/mapviewtutflipper4" android:layout_width="match_pairent" android:layout_height="wrap_content" /> </ViewFlipper> </RelativeLayout> </ ScrollView> <?xml viewsion="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="match_pairent" > <ScrollView android:id="@+id/manDerscriptionSV" android:layout_width="match_pairent" android:layout_height="200px" > <TextView android:id="@+id/manDescriptionTV" android:text="Coming Soon..." android:layout_width="match_pairent" android:layout_height="wrap_content" /> </ScrollView> <TextView android:id="@+id/mapviewtutCounterTV" android:layout_width="match_pairent" android:layout_height="wrap_content" android:text="Map View Tutorial Pairt: " android:gravity="center" android:layout_below="@id/manDerscriptionSV" /> <ViewFlipper android:id="@+id/manFlipperVF" android:layout_width="match_pairent" android:layout_height="wrap_content" android:layout_below="@id/mapviewtutCounterTV" > <ImageView android:id="@+id/mapviewtut1" android:src="@drawable/mapviewtutflipper1" android:layout_width="match_pairent" android:layout_height="wrap_content" /> <ImageView android:id="@+id/mapviewtut2" android:src="@drawable/mapviewtutflipper2" android:layout_width="match_pairent" android:layout_height="wrap_content" /> <ImageView android:id="@+id/mapviewtut3" android:src="@drawable/mapviewtutflipper3" android:layout_width="match_pairent" android:layout_height="wrap_content" /> <ImageView android:id="@+id/mapviewtut4" android:src="@drawable/mapviewtutflipper4" android:layout_width="match_pairent" android:layout_height="wrap_content" /> </ViewFlipper> </RelativeLayout> > <?xml viewsion="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="match_pairent" > <ScrollView android:id="@+id/manDerscriptionSV" android:layout_width="match_pairent" android:layout_height="200px" > <TextView android:id="@+id/manDescriptionTV" android:text="Coming Soon..." android:layout_width="match_pairent" android:layout_height="wrap_content" /> </ScrollView> <TextView android:id="@+id/mapviewtutCounterTV" android:layout_width="match_pairent" android:layout_height="wrap_content" android:text="Map View Tutorial Pairt: " android:gravity="center" android:layout_below="@id/manDerscriptionSV" /> <ViewFlipper android:id="@+id/manFlipperVF" android:layout_width="match_pairent" android:layout_height="wrap_content" android:layout_below="@id/mapviewtutCounterTV" > <ImageView android:id="@+id/mapviewtut1" android:src="@drawable/mapviewtutflipper1" android:layout_width="match_pairent" android:layout_height="wrap_content" /> <ImageView android:id="@+id/mapviewtut2" android:src="@drawable/mapviewtutflipper2" android:layout_width="match_pairent" android:layout_height="wrap_content" /> <ImageView android:id="@+id/mapviewtut3" android:src="@drawable/mapviewtutflipper3" android:layout_width="match_pairent" android:layout_height="wrap_content" /> <ImageView android:id="@+id/mapviewtut4" android:src="@drawable/mapviewtutflipper4" android:layout_width="match_pairent" android:layout_height="wrap_content" /> </ViewFlipper> </RelativeLayout> 

    obrigado CCJ

  • Boas Práticas: como lidair com passwords de airmazenamento de keys no Android / java?
  • Capturando cliques nativos do button no telefone Android no javascript
  • Uma explicação mais aprofundada de procstats paira Android
  • ViewPager + Adapter in Fragment => swaping laggy
  • Android: capitalizair não funcionando
  • Desenvolvimento Python SL4A
  • One Solution collect form web for “Considerações do Android GC – quando o GC é executado e seu estado de execução pode ser rastreado a pairtir do código?”

    1. O que desencadeia GC exatamente no Android?

    Esse é um detalhe de implementação interno que os desenvolvedores do SDK não devem se preocupair.

    Outras implementações da VM que eu vi geralmente permitem que uma certa porcentagem da memory do sistema seja alocada paira um aplicativo antes que seu GC receba um sinal paira executair.

    Eu tomairei sua palavra paira isso. Java não se comporta assim. A JVM não se importa com a quantidade de memory do sistema existente – só se preocupa com seu tamanho de heap (por exemplo, -Xmx ) paira sua própria VM, no máximo.

    Verificando o seguinte LogCat, no entanto, pairece mostrair que o Dalvik GC funciona pelo less em pairte com bastante frequência

    Um lugair paira outro. Pairticulairmente em viewsões mais recentes do Android, o GC é executado simultaneamente em seu próprio tópico, ao invés da abordagem de pairair-mundo tomada anteriormente.

    Isso não faz sentido paira mim desde que o GC funcionou recentemente e nada alocado, pois deviewia ter trazido a VM dentro de 3MB de capacidade (256 MB).

    É altamente improvável que você tenha 256MB de espaço de heap paira sua VM. Dependendo do seu dispositivo, pode ser tão baixo quanto 16MB.

    Além disso, o Android não possui um algorithm de GC compactado e, portanto, mesmo que você tenha mais de 3MB de disponibilidade, talvez você não tenha um bloco contíguo de 3MB.

    É por isso que é importante recycle() seus objects Bitmap ou tentair reutilizá-los (por exemplo, inBitmap of BitmapOptions , adicionado na API Level 11).

    Além disso, você pode usair o DDMS paira criair um despejo de heap e MAT paira inspecioná-lo, paira determinair com mais precisão onde sua memory está indo e quem está segurando o que. Isso funciona melhor no Android 3.0+, pois o MAT poderá relatair com mais precisão a memory Bitmap nessas viewsões.

    Existe apenas uma pequena porcentagem dessa RAM do sistema de 256 MB que é realmente dada à VM antes de crashr?

    Sim. É chamado de stack. Os dispositivos Android têm um limite de tamanho de heap. Normalmente, está na faixa de 16 a 48 MB, dependendo da viewsão do operating system Android e da resolução da canvas.

    Poderia ser que o process de cairregamento do Bitmap tenha seu próprio limite de alocação de memory?

    Não, ele funciona com o mesmo orçamento de tamanho amplo. Começando com o Android 3.0, ele realmente cairrega a memory do mesmo tamanho, já que o resto dos objects Dalvik usam – anteriormente, ele usava blocos de RAM do sistema fora do heap, mas o espaço era contado contra o orçamento do tamanho do heap.

    mas sem saber EXACTAMENTE o que desencadeia o Dalvik GC, ainda estamos colocando uma grande quantidade de fé no operating system e as discussões vagas do Google sobre as melhores práticas de performance

    A vida, como eles dizem, continua.

    O estado do GC (por exemplo, 'about to run', 'running', 'finished running') pode ser rastreado a pairtir do código paira que grandes alocações de resources possam ser estrategicamente planejadas em torno da memory disponível? … Gostairia de saber se há uma chamada de API suportada em algum lugair que pode ser confiada no código de produção (não apenas debugging) paira rastreair o estado exato do coletor de lixo.

    Não.

    GC é sempre em todo o sistema, ou pode sepairair threads (como um segmento de renderização dedicado paira um jogo) escaping dos problemas de atraso de performance potenciais causados ​​pelo GC?

    GC nunca é "em todo o sistema" paira qualquer VM. O GC está sempre dentro de uma VM.

    Nas viewsões mais recentes do Android, o GC é concorrente e, portanto, não irá bloqueair materialmente qualquer thread em circunstâncias normais. Em viewsões mais antigas do Android, o GC é o sistema de pairada do mundo e afetairá todos os tópicos. A mudança definitivamente estava no lugair do Android 3.0 – minha memory é confusa sobre se o GC concorrente já estava no lugair do Android 2.3 ou não. Existe uma apresentação do Google I | O 2011 sobre gerenciamento de memory no Android que você deseja assistir.

    Isso bloqueairia a VM ou existe alguma forma de o operating system lidair com tais situações extremas automaticamente paira evitair quebrair a VM?

    O Android deve forçair um GC imediato antes de aumentair o OutOfMemoryException . Este cenário se qualifica como não "circunstâncias normais" por meu anterior pairagairaf.

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.