예제 #1
0
        public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {

          click = true;

          // get the group header
          Brightness brightInfo = brightList.get(groupPosition);
          txt.setText("/" + brightInfo.getName());

          return false;
        }
예제 #2
0
        public boolean onChildClick(
            ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {

          click = true;

          // get the group header
          Brightness brightInfo = brightList.get(groupPosition);
          // get the child info
          Color colorInfo = brightInfo.getColorList().get(childPosition);

          txt.setText("/" + brightInfo.getName() + "/" + colorInfo.getName());
          int index =
              parent.getFlatListPosition(
                  ExpandableListView.getPackedPositionForChild(groupPosition, childPosition));
          parent.setItemChecked(index, true);

          return false;
        }
예제 #3
0
        public void afterTextChanged(Editable s) {
          String inputTxt = txt.getText().toString().toLowerCase();

          String brightString = inputTxt;
          String colorString = "";
          int groupPosition;
          int count = 0;
          int countB = 0;

          expandAll();

          // fel, kolla en bool typ, om checkText = true;
          System.out.println("click: " + click);
          if (click == true) {
            click = false;
            return;
          }

          // check if the text contains a /
          if (inputTxt.contains("/") && inputTxt.length() > 1) {
            String[] separated = inputTxt.split("/");

            if (inputTxt.startsWith("/")) {
              brightString = separated[1];
              colorString = "";

              if (separated.length > 2) {
                brightString = separated[1];
                colorString = separated[2];
              }
            } else {
              if (separated.length > 1) {
                brightString = separated[0];
                colorString = separated[1];
              } else {
                brightString = separated[0];
                colorString = "";
              }
            }
          }

          // System.out.println("brString: " + brightString);
          // System.out.println("colString: " + colorString);

          // check the header
          for (int i = 0; i < listAdapter.getGroupCount(); i++) {

            // get the group header
            Brightness headerInfo = brightList.get(i);

            if (headerInfo.getName().startsWith(brightString)) {

              groupPosition = brightList.indexOf(headerInfo);
              txt.setBackgroundColor(android.graphics.Color.WHITE);
              countB = 1;

              // loop through the children
              for (int j = 0; j < headerInfo.getColorList().size(); j++) {

                // get the child info
                Color childInfo = headerInfo.getColorList().get(j);

                if (childInfo.getName().startsWith(colorString) && colorString.length() > 0) {

                  // expand other groups
                  collapseAll(groupPosition);
                  count = 1;

                  // check if the whole word is typed
                  if (colorString.contains(childInfo.getName())) {

                    index =
                        myList.getFlatListPosition(
                            ExpandableListView.getPackedPositionForChild(i, j));
                    myList.setItemChecked(index, true);
                  }
                }
              }

              if (count == 0 && colorString.length() > 0) {
                txt.setBackgroundColor(android.graphics.Color.RED);
                myList.setItemChecked(index, false);
                return;
              }
            }
            if (countB == 0 && brightString.length() > 0) {
              if (brightString.startsWith("/"))
                txt.setBackgroundColor(android.graphics.Color.WHITE);
              else txt.setBackgroundColor(android.graphics.Color.RED);
            }
          }
        }
예제 #4
0
  public static void process(double test, BufferedImage image, String[] args) {
    // 2) Transform
    if (test == 1) {
      SmartConsole.Print("Running Grayscale");

      Grayscale.compute(image);
    }

    if (test == 2) {
      SmartConsole.Print("Running Inverse");

      Inverse.compute(image);
    }

    if (test == 3) {
      int brightness = Integer.parseInt(args[3]);

      SmartConsole.Print("Running Brightness: " + brightness);

      Brightness.compute(image, brightness);
    }

    if (test == 4) {
      int treshold = Integer.parseInt(args[3]);

      SmartConsole.Print("Running Treshold: " + treshold);

      Treshold.compute(image, treshold);
    }

    if (test == 5.1) {
      SmartConsole.Print("Running Histogram Expension ALL");

      HistogramExpension.compute_all(image);
    }
    if (test == 5.2) {
      SmartConsole.Print("Running Histogram Expension AVG");

      HistogramExpension.compute_avg(image);
    }

    // Convolution Filter

    if (test == 6.1) {
      SmartConsole.Print("Running HighPass Filter");

      HighPass.compute(image);
    }

    if (test == 6.2) {
      SmartConsole.Print("Running LowPass Filter");

      LowPass.compute(image);
    }
    if (test == 6.3) {
      SmartConsole.Print("Running Gaussian Filter");

      GaussianFilter.compute(image);
    }
    if (test == 6.4) {
      SmartConsole.Print("Running Sobel Filter");

      SobelFilter.compute(image);
    }

    if (test == 7) {
      SmartConsole.Print("Running Finding Pupil");

      Pupil.compute(image);
    }
    if (test == 8) {
      SmartConsole.Print("Running KMM");

      KMM.compute(image);
    }
    if (test == 9) {
      SmartConsole.Print("Running FeatureExtraction");

      FeatureExtraction.compute(image);
    }
  }