public void showDetails(Equipment equipment) {
    equip = equipment;
    View view;
    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
      view = getActivity().findViewById(R.id.detail_frag);
    } else {
      view = getActivity().findViewById(R.id.main_frame);
      Button button = (Button) view.findViewById(R.id.closeButton);
      button.setVisibility(View.VISIBLE);
    }

    TextView textIt_no = (TextView) view.findViewById(R.id.it_no2);
    TextView textType = (TextView) view.findViewById(R.id.type2);
    TextView textBrand = (TextView) view.findViewById(R.id.brand2);
    TextView textModel = (TextView) view.findViewById(R.id.model2);
    TextView textE_id = (TextView) view.findViewById(R.id.e_id);
    TextView textDescription = (TextView) view.findViewById(R.id.description);
    TextView textAquired = (TextView) view.findViewById(R.id.aquired);

    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
      textIt_no.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSizeLandscape);
      textType.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSizeLandscape);
      textBrand.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSizeLandscape);
      textAquired.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSizeLandscape);
      textModel.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSizeLandscape);
      textDescription.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSizeLandscape);
      textE_id.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSizeLandscape);
    } else {
      textIt_no.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSizePortrait);
      textType.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSizePortrait);
      textBrand.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSizePortrait);
      textAquired.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSizePortrait);
      textModel.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSizePortrait);
      textDescription.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSizePortrait);
      textE_id.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSizePortrait);
    }
    textIt_no.setText("Item nr: \t\t\t\t" + equipment.getIt_no());
    textType.setText("Type: \t\t\t\t\t" + equipment.getType());
    textBrand.setText("Brand: \t\t\t\t" + equipment.getBrand());
    textModel.setText("Model: \t\t\t\t" + equipment.getModel());
    textE_id.setText("Equipment ID: \t" + equipment.getE_id());
    textDescription.setText("Description: \t" + equipment.getDescription());
    textAquired.setText("Aquired: \t\t\t" + equipment.getAquired());

    downloadImageThread();

    ImageView image = (ImageView) view.findViewById(R.id.equipment_image);
    image.setImageBitmap(bitmap);
  }
Beispiel #2
0
        private void processResult(LoadResult result) {
          // Cache the new drawable
          final String filePath = (result.fso);
          mAppIcons.put(filePath, result.result);

          // find the request for it
          for (Map.Entry<ImageView, String> entry : mRequests.entrySet()) {
            final ImageView imageView = entry.getKey();
            final String fso = entry.getValue();
            if (fso == result.fso) {
              imageView.setImageBitmap(result.result);
              mRequests.remove(imageView);
              break;
            }
          }
        }
Beispiel #3
0
  /**
   * Method that returns a drawable reference of a FileSystemObject.
   *
   * @param iconView View to load the drawable into
   * @param fso The FileSystemObject reference
   * @param defaultIcon Drawable to be used in case no specific one could be found
   * @return Drawable The drawable reference
   */
  public void loadDrawable(ImageView iconView, final String fso, Drawable defaultIcon) {
    if (!mUseThumbs) {
      return;
    }

    // Is cached?
    final String filePath = fso;
    if (this.mAppIcons.containsKey(filePath)) {
      iconView.setImageBitmap(this.mAppIcons.get(filePath));
      return;
    }
    mRequests.put(iconView, fso);
    new Thread(
            new Runnable() {
              @Override
              public void run() {

                mHandler.removeMessages(MSG_DESTROY);
                if (mWorkerThread == null || mWorkerHandler == null) {
                  mWorkerThread = new HandlerThread("IconHolderLoader");
                  mWorkerThread.start();
                  mWorkerHandler = new WorkerHandler(mWorkerThread.getLooper());
                }
                Message msg = mWorkerHandler.obtainMessage(MSG_LOAD, fso);
                msg.sendToTarget();
              }
            })
        .start();
  }
  public void onCreateContextMenu(ContextMenu menu) {
    super.onCreateContextMenu(menu);

    menu.setHeaderTitle("MyImage Menu");
    menu.add(0, 100, 0, "이미지 회전");
    menu.add(0, 101, 0, "크기 변경");
  }
Beispiel #5
0
        @Override
        public void onTick(long millisUntilFinished) {
          switch (iconCount) {
            case 0:
              drawable = getResources().getDrawable(R.drawable.loading);
              break;
            case 1:
              drawable = getResources().getDrawable(R.drawable.loading_1);
              break;
            case 2:
              drawable = getResources().getDrawable(R.drawable.loading_2);
              break;
            case 3:
              drawable = getResources().getDrawable(R.drawable.loading_3);
              break;
            case 4:
              drawable = getResources().getDrawable(R.drawable.loading_4);
              break;
            case 5:
              drawable = getResources().getDrawable(R.drawable.loading_5);
              break;
            case 6:
              drawable = getResources().getDrawable(R.drawable.loading_6);
              break;
          }
          iconCount++;

          loadingIconLayout.setImageDrawable(drawable);
        }
Beispiel #6
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Intent intent = getIntent();
    final String ID = intent.getStringExtra("ID");
    final String name = intent.getStringExtra("Name");
    final ActionBar actionBar = getSupportActionBar();

    setContentView(R.layout.individual_colour_change_layout);

    SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
    ColH = settings.getInt("houCol" + ID, getResources().getColor(R.color.clokH));
    ColM = settings.getInt("minCol" + ID, getResources().getColor(R.color.clokM));
    ColS = settings.getInt("secCol" + ID, getResources().getColor(R.color.clokS));
    String currentTitle = name + ": " + getString(R.string.chsColour);
    if (actionBar != null) {
      actionBar.setTitle(currentTitle);
      actionBar.setDisplayUseLogoEnabled(false);
    }

    draw();

    Button reset = (Button) findViewById(R.id.reset);
    reset.setOnClickListener(
        v -> {
          Editor editor = settings.edit();
          ColH = IndividualColourChange.this.getResources().getColor(R.color.clokH);
          ColM = IndividualColourChange.this.getResources().getColor(R.color.clokM);
          ColS = IndividualColourChange.this.getResources().getColor(R.color.clokS);
          editor.putInt("houCol" + ID, ColH);
          editor.putInt("minCol" + ID, ColM);
          editor.putInt("secCol" + ID, ColS);
          editor.apply();
          IndividualColourChange.this.draw();
        });

    ImageView colPickH = (ImageView) findViewById(R.id.colorHou);
    colPickH.setClickable(true);
    colPickH.setOnClickListener(
        v -> {
          ColorSelectorDialog dlg =
              new ColorSelectorDialog(
                  context,
                  color -> {
                    ColH = color;
                    Editor editor = settings.edit();
                    editor.putInt("houCol" + ID, ColH);
                    editor.apply();
                    draw();
                  },
                  ColH);
          dlg.setTitle(IndividualColourChange.this.getString(R.string.hHandCol));
          dlg.show();
        });

    ImageView colPickM = (ImageView) findViewById(R.id.colorMin);
    colPickM.setClickable(true);
    colPickM.setOnClickListener(
        v -> {
          ColorSelectorDialog dlg =
              new ColorSelectorDialog(
                  context,
                  color -> {
                    ColM = color;
                    Editor editor = settings.edit();
                    editor.putInt("minCol" + ID, ColM);
                    editor.apply();
                    draw();
                  },
                  ColM);
          dlg.setTitle(IndividualColourChange.this.getString(R.string.mHandCol));
          dlg.show();
        });

    ImageView colPickS = (ImageView) findViewById(R.id.colorSec);
    colPickS.setClickable(true);
    colPickS.setOnClickListener(
        v -> {
          ColorSelectorDialog dlg =
              new ColorSelectorDialog(
                  context,
                  color -> {
                    ColS = color;
                    Editor editor = settings.edit();
                    editor.putInt("minCol" + ID, ColS);
                    editor.apply();
                    draw();
                  },
                  ColS);
          dlg.setTitle(IndividualColourChange.this.getString(R.string.sHandCol));
          dlg.show();
        });
  }
Beispiel #7
0
  public void draw() {
    Bitmap bitmap = Bitmap.createBitmap(200, 200, Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);

    RectF rect = new RectF(8, 8, 192, 192);

    Paint p = new Paint();
    p.setAntiAlias(true);
    p.setStyle(Paint.Style.STROKE);
    p.setColor(ColS);
    p.setStrokeWidth(16);

    int S = 162;
    int H = 300;

    // S
    canvas.drawArc(rect, -90, S, false, p);

    p.setStyle(Paint.Style.FILL);
    p.setColor(ColM);

    H -= 90;
    canvas.drawCircle(100, 100, 72, p);

    p.setColor(ColH);
    p.setStrokeWidth(2);

    float sx, sy;
    sx = (float) (72 * Math.cos(Math.PI * H / 180));
    sy = (float) (72 * Math.sin(Math.PI * H / 180));

    canvas.drawLine(100, 100, sx + 100, sy + 100, p);

    ImageView clokImg;

    clokImg = (ImageView) findViewById(R.id.clokImage);
    clokImg.setImageBitmap(bitmap);

    // Hour picker
    Bitmap ColPickBmp = Bitmap.createBitmap(80, 50, Bitmap.Config.ARGB_8888);
    Canvas ColPickCanvas = new Canvas(ColPickBmp);
    ImageView colPickImg = (ImageView) findViewById(R.id.colorHou);

    rect = new RectF(0, 0, 80, 50);

    p = new Paint();
    p.setAntiAlias(true);
    p.setStyle(Paint.Style.FILL);
    p.setColor(ColH);
    ColPickCanvas.drawRect(rect, p);

    colPickImg.setImageBitmap(ColPickBmp);

    // Minute picker
    ColPickBmp = Bitmap.createBitmap(80, 50, Bitmap.Config.ARGB_8888);
    ColPickCanvas = new Canvas(ColPickBmp);
    colPickImg = (ImageView) findViewById(R.id.colorMin);

    rect = new RectF(0, 0, 80, 50);

    p = new Paint();
    p.setAntiAlias(true);
    p.setStyle(Paint.Style.FILL);
    p.setColor(ColM);
    ColPickCanvas.drawRect(rect, p);

    colPickImg.setImageBitmap(ColPickBmp);

    // Second picker
    ColPickBmp = Bitmap.createBitmap(80, 50, Bitmap.Config.ARGB_8888);
    ColPickCanvas = new Canvas(ColPickBmp);
    colPickImg = (ImageView) findViewById(R.id.colorSec);

    rect = new RectF(0, 0, 80, 50);

    p = new Paint();
    p.setAntiAlias(true);
    p.setStyle(Paint.Style.FILL);
    p.setColor(ColS);
    ColPickCanvas.drawRect(rect, p);

    colPickImg.setImageBitmap(ColPickBmp);
  }
Beispiel #8
0
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    adpt = new GalleryAdapter(this);
    pics = new Vector<Image>();

    previews = (Gallery) findViewById(R.id.gallery1);
    Main = (ImageView) findViewById(R.id.PictureView);
    hist = (Histogram) findViewById(R.id.histogram);
    saturation = (SeekBar) findViewById(R.id.saturation);
    contrast = (SeekBar) findViewById(R.id.contrast);
    exposure = (SeekBar) findViewById(R.id.exposure);
    saveButton = (Button) findViewById(R.id.save);

    contrast.setProgress(50);
    exposure.setProgress(50);
    saturation.setProgress(100);

    handler = new UIHandler(Main, hist);
    tm = new ThreadManager(handler);
    save = new Save();
    save.setContainer(Main);

    PinchyZoomy pz = new PinchyZoomy();

    Main.setOnTouchListener(pz);
    Main.setDrawingCacheEnabled(true);
    Main.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH);

    File folder = new File("/sdcard");

    for (int i = 0; i < folder.listFiles().length; i++) {
      String name = folder.listFiles()[i].getName();
      if (folder.listFiles()[i].isFile()) {
        String extension = name.substring(name.length() - 3);
        if (extension.equals("NEF") || extension.equals("dng")) {
          Image temp = new Image(folder.listFiles()[i].getAbsolutePath());
          pics.add(temp);
        }
      }
    }

    for (int i = 0; i < pics.size(); i++) {
      System.out.println("Pulling thumb for: " + pics.elementAt(i).path);
      adpt.addImage(pics.elementAt(i).getThumb());
    }

    previews.setAdapter(adpt);
    previews.setSpacing(3);

    previews.setOnItemClickListener(
        new OnItemClickListener() {

          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Main.setImageBitmap(adpt.getItemAt(position));
            Main.setAlpha(100);

            if (current != null) current.free();

            current = pics.elementAt(position);
            handler.setImage(current);
            tm.pic = current;
            save.setImage(current);

            contrast.setProgress(50);
            exposure.setProgress(50);
            saturation.setProgress(100);

            LoadImageThread t = new LoadImageThread(current, handler);
            t.start();
          }
        });

    saturation.setOnSeekBarChangeListener(
        new OnSeekBarChangeListener() {

          @Override
          public void onProgressChanged(SeekBar arg0, int arg1, boolean arg2) {

            if (current.colors != null) tm.setSaturation(saturation.getProgress());
          }

          @Override
          public void onStartTrackingTouch(SeekBar arg0) {}

          @Override
          public void onStopTrackingTouch(SeekBar arg0) {}
        });
    contrast.setOnSeekBarChangeListener(
        new OnSeekBarChangeListener() {

          @Override
          public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            if (current.colors != null) tm.setContrast(contrast.getProgress());
          }

          @Override
          public void onStartTrackingTouch(SeekBar seekBar) {
            // TODO Auto-generated method stub

          }

          @Override
          public void onStopTrackingTouch(SeekBar seekBar) {
            // TODO Auto-generated method stub

          }
        });
    exposure.setOnSeekBarChangeListener(
        new OnSeekBarChangeListener() {

          @Override
          public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            if (current.colors != null) tm.setExposure(exposure.getProgress());
          }

          @Override
          public void onStartTrackingTouch(SeekBar seekBar) {
            // TODO Auto-generated method stub

          }

          @Override
          public void onStopTrackingTouch(SeekBar seekBar) {
            // TODO Auto-generated method stub

          }
        });

    saveButton.setOnClickListener(save);
  }