Example #1
0
  @SuppressWarnings("deprecation")

  /* This method is navigate between screens of exercise step
   * and videos and logview on basis of finger gesture */
  public boolean onTouch(View v, MotionEvent event) {
    switch (event.getAction()) {
      case MotionEvent.ACTION_DOWN:
        {
          // Here u can write code which is executed after the user
          // touch on the screen

          x = event.getX();
          break;
        }
      case MotionEvent.ACTION_UP:
        {
          currentx = event.getX();

          if (currentx < x) {
            if (count < 2) {

              count++;
              if (count == 1) {

                // setting default background for buttons

                VideoButton.setBackgroundResource(R.drawable.video);
                //   				Direction.setBackgroundResource(R.drawable.b);

                Direction.setBackgroundResource(R.drawable.directionpress);
                HomeButton.setBackgroundResource(R.drawable.home_l);

                flipper.setDisplayedChild(childId[1]);
              } else if (count == 2) {

                //        			 flipper.setDisplayedChild(2);
                flipper.setDisplayedChild(childId[2]);

                VideoButton.setBackgroundResource(R.drawable.videopress);
                //    				Direction.setBackgroundResource(R.drawable.b);

                Direction.setBackgroundResource(R.drawable.direction);
                HomeButton.setBackgroundResource(R.drawable.home_l);

              } else if (count == 0) {

                //        			 Direction.setBackgroundDrawable(getResources().
                //        					 getDrawable(android.R.drawable.btn_default));
                //        		   VideoButton.setBackgroundDrawable(getResources().
                //        				   getDrawable(android.R.drawable.btn_default));
                //        		   flipper.setDisplayedChild(0);

                VideoButton.setBackgroundResource(R.drawable.video);
                //     				Direction.setBackgroundResource(R.drawable.b);

                Direction.setBackgroundResource(R.drawable.direction);
                HomeButton.setBackgroundResource(R.drawable.homepress);

                flipper.setDisplayedChild(childId[0]);
              }

            } else {
              //					Toast.makeText(LogView.this,
              //							"There is no further view",
              //							Toast.LENGTH_LONG).show();

              ConditionClas.Toastmethod(LogView.this, "There is no further view");
            }
          } else if (currentx > x) {

            if (count >= 0) {

              //        		 flipper.showPrevious();
              count--;
              if (count == 1) {
                VideoButton.setBackgroundResource(R.drawable.video);
                //    				Direction.setBackgroundResource(R.drawable.b);

                Direction.setBackgroundResource(R.drawable.directionpress);
                HomeButton.setBackgroundResource(R.drawable.home_l);
                flipper.setDisplayedChild(childId[1]);
              } else if (count == 2) {

                VideoButton.setBackgroundResource(R.drawable.videopress);
                //     				Direction.setBackgroundResource(R.drawable.b);

                Direction.setBackgroundResource(R.drawable.direction);
                HomeButton.setBackgroundResource(R.drawable.home_l);
                flipper.setDisplayedChild(childId[2]);
              } else if (count == 0) {

                VideoButton.setBackgroundResource(R.drawable.video);
                //      				Direction.setBackgroundResource(R.drawable.b);

                Direction.setBackgroundResource(R.drawable.direction);
                HomeButton.setBackgroundResource(R.drawable.homepress);
                flipper.setDisplayedChild(childId[0]);
              }

            } else {
              //					Toast.makeText(LogView.this,
              //							"There is no view remaining",
              //							Toast.LENGTH_LONG).show();

              ConditionClas.Toastmethod(LogView.this, "There is no view remaining");
            }
          }

          // Here u can write code which is executed after the user release
          // the touch on the screen
          break;
        }
      case MotionEvent.ACTION_MOVE:
        {
          // Here u can write code which is executed when user move the
          // finger on the screen
          break;
        }
    }
    return true;
  }
Example #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub

    super.onCreate(savedInstanceState);

    requestWindowFeature(Window.FEATURE_NO_TITLE);

    setContentView(R.layout.logviewtable);

    oneValue = new String[1];

    twoValue = new String[1];

    thrValue = new String[1];

    jsonParser = new JSONParser();

    customDialogClass = new CustomDialogClass(LogView.this);

    Id = getIntent().getStringExtra("idval");
    exc_Name = getIntent().getStringExtra("name");

    childId = new int[3];
    display = getWindowManager().getDefaultDisplay();
    fromUser = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    myFormat = new SimpleDateFormat("yyyy-MM-dd");
    loader = ImageLoader.getInstance();

    LogView.this.loader.init(ImageLoaderConfiguration.createDefault(LogView.this));

    options =
        new DisplayImageOptions.Builder()
            .showImageOnLoading(R.drawable.noimage) // resource or drawable
            .showImageForEmptyUri(R.drawable.ic_empty) // resource or drawable
            .showImageOnFail(R.drawable.ic_error) // resource or drawable
            .resetViewBeforeLoading(false) // default
            .delayBeforeLoading(500)
            .cacheInMemory(true) // default
            .cacheOnDisc(true)
            .considerExifParams(false) // default
            .imageScaleType(ImageScaleType.IN_SAMPLE_POWER_OF_2) // default
            .bitmapConfig(Bitmap.Config.ARGB_8888) // default
            .displayer(new SimpleBitmapDisplayer()) // default
            .handler(new Handler()) // default
            .build();
    // this method is called to
    // Initialize the view used in this class

    setupView();

    // this method holds all the clicks of buttons of
    // LogView class

    AllOnClickListener();

    // this method holds all the clicks of lists of
    // LogView class

    AllOnItemClickListener();

    flipper.setOnTouchListener(this);

    if (ConditionClas.isNetworkAvailable(LogView.this)) {

      new SomeView_Async().execute("");
    } else {

      ConditionClas.Toastmethod(LogView.this, " There is no internet");
    }
  }
Example #3
0
    @Override
    protected void onPostExecute(String result) {
      // TODO Auto-generated method stub
      super.onPostExecute(result);

      Ed1.setText("");

      Ed2.setText("");

      Ed3.setText("");

      Ed4.setText("");

      if (done_is == true) {

        ConditionClas.Toastmethod(LogView.this, " " + MessageDisplay_Submit);
      }
      if (Methodcall.equalsIgnoreCase("submit")) {

        ConditionClas.Toastmethod(LogView.this, " " + MessageDisplay);

      } else if (Methodcall.equalsIgnoreCase("show")) {

        System.out.println("inside showLog_reps " + SiteList.Log_reps);
        System.out.println("inside show Exc_Namel " + SiteList.Exc_Name);
        System.out.println("inside showLog_Date " + SiteList.Log_Date);
        System.out.println("inside show Log_Ints " + SiteList.Log_Ints);
        System.out.println("inside show Log_Sets " + SiteList.Log_Sets);
        System.out.println("inside show exc_Name " + method(exc_Name));
        Log_reps.clear();

        Exc_Namel.clear();

        Log_Date.clear();

        Log_Ints.clear();

        Log_Sets.clear();

        for (int i = 0; i < SiteList.Exc_Name.size(); i++) {

          //					if(SiteList.Exc_Name.get(i).toLowerCase().
          //							contains(method(exc_Name).toLowerCase()))
          if (SiteList.Exces_Id.get(i).toLowerCase().contains(Id.toLowerCase())) {

            Log_reps.add(SiteList.Log_reps.get(i));

            Exc_Namel.add(SiteList.Exc_Name.get(i));

            Log_Date.add(SiteList.Log_Date.get(i));

            Log_Ints.add(SiteList.Log_Ints.get(i));

            Log_Sets.add(SiteList.Log_Sets.get(i));
          }
        }
        System.out.println("inside show");

        System.out.println("inside showLog_reps " + Log_reps);
        System.out.println("inside show Exc_Namel " + Exc_Namel);
        System.out.println("inside showLog_Date " + Log_Date);
        System.out.println("inside show Log_Ints " + Log_Ints);
        System.out.println("inside show Log_Sets " + Log_Sets);

        System.out.println("StatusStatusStatus " + Status);
        System.out.println("MessageDisplay    " + MessageDisplay);
        //				if (Status.equalsIgnoreCase("success"))
        //
        //				{
        System.out.println("inside if  ");
        System.out.println("MessageDisplay    " + MessageDisplay);

        Excercise.setAdapter(new CustomListExcercise());

        //					VideoList.setAdapter()
        VideoList.setAdapter(new CustomListVideo());

        //				}
        //
        //				else
        //
        //				{
        //					System.out.println(" in side elese " +
        //							"MessageDisplay    "+MessageDisplay);
        //
        //					twoValue[0] = " Error";
        //					VideoList.setAdapter(new ArrayAdapter<String>(LogView.this,
        //							android.R.layout.simple_list_item_1 ,
        //							android.R.id.text1 ,twoValue ));
        //					ConditionClas.Toastmethod(LogView.this, MessageDisplay);
        //
        //					Excercise.setAdapter(new ArrayAdapter<String>(LogView.this,
        //							android.R.layout.simple_list_item_1 ,
        //							android.R.id.text1 ,twoValue ));
        //					ConditionClas.Toastmethod(LogView.this, MessageDisplay);
        //
        //
        //				}

        /* This part checks is the log link hit was successful
         *  so on basis of that it shall set an adapter */

        if (StatusLog.equalsIgnoreCase("success")) {
          System.out.println("inside if StatusLog   ");
          if (MesageList.length() > 0) {

            //						SelectList.setAdapter(new CustomList());
            updateTable();

          } else {

            //						SelectList.setAdapter(new ArrayAdapter<String>(LogView.this,
            //								android.R.layout.simple_list_item_1 ,
            //								android.R.id.text1 ,SiteList.Error ));
          }
        }
      }
      dialog.dismiss();
    }