| @@ -0,0 +1,25 @@ | |||
| var NO_PROXY = ""; | |||
| function FindProxyForURL(url, host) { | |||
| if( url.substring(0,5) == "http:" ) { | |||
| if( NO_PROXY.length > 0 && url.indexOf("?") == -1 ) { | |||
| var extPos = url.lastIndexOf("."); | |||
| if( extPos != -1 ) { | |||
| if( NO_PROXY.indexOf("|"+url.substring(extPos+1).toLowerCase()+"|") != -1 ) { | |||
| return "DIRECT"; | |||
| } | |||
| } | |||
| } | |||
| return "PROXY localhost:2267; DIRECT"; | |||
| } | |||
| if( url.substring(0,6) == "https:" ) { | |||
| return "DIRECT"; | |||
| } | |||
| if( url.substring(0,4) == "ftp:" ) { | |||
| return "DIRECT"; | |||
| } | |||
| if( url.substring(0,7) == "gopher:" ) { | |||
| return "DIRECT"; | |||
| } | |||
| return "DIRECT"; | |||
| } | |||
| @@ -0,0 +1,243 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC.resultlist; | |||
| import java.util.List; | |||
| import android.app.Activity; | |||
| import android.content.Context; | |||
| import android.util.DisplayMetrics; | |||
| import android.view.Gravity; | |||
| import android.view.View; | |||
| import android.view.ViewGroup; | |||
| import android.widget.BaseAdapter; | |||
| import android.widget.ImageView; | |||
| import android.widget.LinearLayout; | |||
| import android.widget.TextView; | |||
| import android.widget.LinearLayout.LayoutParams; | |||
| import ch.spherIC.R; | |||
| /** | |||
| * Exposure adapter view class. | |||
| */ | |||
| class ExposureAdapterView extends LinearLayout { | |||
| private static DisplayMetrics metrics; | |||
| /** | |||
| * Creates a new ExposureAdapterView object. | |||
| * | |||
| * @param context DOCUMENT ME! | |||
| * @param weather DOCUMENT ME! | |||
| */ | |||
| public ExposureAdapterView(Context context, Exposure exposure) { | |||
| super(context); | |||
| this.setOrientation(HORIZONTAL); | |||
| // Nbr | |||
| TextView nbrControl = new TextView(context); | |||
| LinearLayout.LayoutParams nbrParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| nbrParams.setMargins(3, 1, 1, 1); | |||
| nbrControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| nbrControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| nbrControl.setText(Integer.toString(exposure.getNbr())); | |||
| addView(nbrControl, nbrParams); | |||
| // Aperture | |||
| TextView apertureControl = new TextView(context); | |||
| LinearLayout.LayoutParams apertureParams = new LinearLayout.LayoutParams(100, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| apertureParams.setMargins(1, 1, 1, 1); | |||
| apertureControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| apertureControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| apertureControl.setText(exposure.getAperture()); | |||
| addView(apertureControl, apertureParams); | |||
| // Shutter speed | |||
| TextView shutterControl = new TextView(context); | |||
| LinearLayout.LayoutParams shutterParams = new LinearLayout.LayoutParams(170, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| shutterParams.setMargins(1, 1, 1, 1); | |||
| shutterControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| shutterControl.setTextAppearance(context, R.style.ResultExposureTextSpecial); | |||
| shutterControl.setText(exposure.getShutterSpeed()); | |||
| addView(shutterControl, shutterParams); | |||
| // EV Step | |||
| TextView evStepControl = new TextView(context); | |||
| LinearLayout.LayoutParams evStepParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| evStepParams.setMargins(1, 1, 1, 1); | |||
| evStepControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| evStepControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| evStepControl.setText(exposure.getEvStepAsString()); | |||
| addView(evStepControl, evStepParams); | |||
| // Icon | |||
| ImageView expIconControl = new ImageView(context); | |||
| LinearLayout.LayoutParams expIconParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| expIconParams.setMargins(1, 1, 1, 1); | |||
| expIconControl.setImageBitmap(exposure.getEvStepBtmp()); | |||
| addView(expIconControl, expIconParams); | |||
| } | |||
| } | |||
| /** | |||
| * Exposure results adapter. | |||
| */ | |||
| public class ExposureAdapter extends BaseAdapter { | |||
| private static DisplayMetrics metrics; | |||
| private Context context; | |||
| private List<Exposure> exposureList; | |||
| /** | |||
| * Creates a new ExposureAdapter object. | |||
| */ | |||
| public ExposureAdapter(Context context, List<Exposure> expList) { | |||
| this.context = context; | |||
| this.exposureList = expList; | |||
| } | |||
| /** | |||
| * Retrieves list size. | |||
| * | |||
| * @return list size | |||
| */ | |||
| @Override | |||
| public int getCount() { | |||
| return this.exposureList.size(); | |||
| } | |||
| /** | |||
| * Retrieves the exposure at index <code>position</code>. | |||
| * | |||
| * @param position Index in list | |||
| * | |||
| * @return Exposure at index <code>position</code> | |||
| */ | |||
| @Override | |||
| public Object getItem(int position) { | |||
| return this.exposureList.get(position); | |||
| } | |||
| /** | |||
| * Retrieves the number of the exposure at index <code>position</code>. | |||
| * | |||
| * @param position Index in list | |||
| * | |||
| * @return the number of the exposure at index <code>position</code> | |||
| */ | |||
| @Override | |||
| public long getItemId(int position) { | |||
| //return this.exposureList.get(position).getNbr(); | |||
| return position; | |||
| } | |||
| /** | |||
| * Retrieves a view representing a single result row. | |||
| * | |||
| * @param position Index in list | |||
| * @param convertView view | |||
| * @param parent parent | |||
| * | |||
| * @return {@link ExposureAdapterView} | |||
| */ | |||
| @Override | |||
| public View getView(int position, View convertView, ViewGroup parent) { | |||
| Exposure exposure = this.exposureList.get(position); | |||
| return new ExposureAdapterView(this.context, exposure); | |||
| } | |||
| /** | |||
| * Retrieves the value of | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| public static View getHeaderView(Context context, LinearLayout headerLL) { | |||
| int black = headerLL.getResources().getColor(R.color.black); | |||
| int width = getMetrics(context).widthPixels; | |||
| // Nbr | |||
| TextView nbrControl = new TextView(context); | |||
| LinearLayout.LayoutParams nbrParams = new LinearLayout.LayoutParams(Math.round(0.14583f * width), | |||
| LayoutParams.WRAP_CONTENT, 0.2f); | |||
| nbrParams.setMargins(3, 1, 1, 1); | |||
| nbrControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| nbrControl.setTextSize(13f); | |||
| nbrControl.setTextColor(black); | |||
| nbrControl.setText(R.string.expNbrLbl); | |||
| headerLL.addView(nbrControl, nbrParams); | |||
| // Aperture | |||
| TextView apertureControl = new TextView(context); | |||
| LinearLayout.LayoutParams apertureParams = new LinearLayout.LayoutParams(Math.round(0.20833f * width), | |||
| LayoutParams.WRAP_CONTENT, 0.2f); | |||
| apertureParams.setMargins(1, 1, 1, 1); | |||
| apertureControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| apertureControl.setTextSize(13f); | |||
| apertureControl.setTextColor(black); | |||
| apertureControl.setText(R.string.aperture); | |||
| headerLL.addView(apertureControl, apertureParams); | |||
| // Shutter speed | |||
| TextView shutterControl = new TextView(context); | |||
| LinearLayout.LayoutParams shutterParams = new LinearLayout.LayoutParams(Math.round(0.35417f * width), LayoutParams.WRAP_CONTENT, 0.2f); | |||
| shutterParams.setMargins(1, 1, 1, 1); | |||
| shutterControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| shutterControl.setTextSize(13f); | |||
| shutterControl.setTextColor(black); | |||
| shutterControl.setText(R.string.shutter_speed); | |||
| headerLL.addView(shutterControl, shutterParams); | |||
| // EV Step | |||
| TextView evStepControl = new TextView(context); | |||
| LinearLayout.LayoutParams evStepParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| evStepParams.setMargins(1, 1, 1, 1); | |||
| evStepControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| evStepControl.setTextSize(13f); | |||
| evStepControl.setTextColor(black); | |||
| evStepControl.setText(R.string.expEVStep); | |||
| headerLL.addView(evStepControl, evStepParams); | |||
| // Icon | |||
| ImageView expIconControl = new ImageView(context); | |||
| LinearLayout.LayoutParams expIconParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| expIconParams.setMargins(1, 1, 1, 1); | |||
| headerLL.addView(expIconControl, expIconParams); | |||
| return headerLL; | |||
| } | |||
| /** | |||
| * Retrieves the value of | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| private static DisplayMetrics getMetrics(Context context) { | |||
| if (metrics == null) { | |||
| metrics = new DisplayMetrics(); | |||
| ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(metrics); | |||
| } | |||
| return metrics; | |||
| } | |||
| } | |||
| @@ -0,0 +1,51 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <LinearLayout | |||
| xmlns:android="http://schemas.android.com/apk/res/android" | |||
| android:background="@drawable/bg_about" | |||
| android:padding="10dp" | |||
| android:layout_height="fill_parent" | |||
| android:layout_width="fill_parent" | |||
| android:orientation="vertical"> | |||
| <LinearLayout | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:orientation="horizontal" | |||
| android:id="@+id/layout_ugVersion"> | |||
| <ImageView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginRight="20dip" | |||
| android:id="@+id/ug_imageAppIcon" | |||
| android:layout_gravity="center_vertical" /> | |||
| <TextView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:textColor="#FF000000" | |||
| android:text="iii" | |||
| android:id="@+id/ug_TextVersion" | |||
| android:textStyle="bold" | |||
| android:layout_gravity="center_vertical" | |||
| android:gravity="center_vertical" /> | |||
| </LinearLayout> | |||
| <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical"> | |||
| <TextView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" android:id="@+id/ug_Text" android:ellipsize="none" android:text="@string/AppVersion"> | |||
| </TextView> | |||
| </LinearLayout> | |||
| <Button | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:background="@drawable/btn_fs" | |||
| android:id="@+id/btn_ugClose" | |||
| android:text="Close" | |||
| android:textColor="@color/white" | |||
| android:layout_gravity="center_horizontal"> | |||
| </Button> | |||
| </LinearLayout> | |||
| @@ -0,0 +1,90 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <LinearLayout | |||
| xmlns:android="http://schemas.android.com/apk/res/android" | |||
| android:background="@drawable/bg_about" | |||
| android:padding="10dp" | |||
| android:layout_height="fill_parent" | |||
| android:layout_width="fill_parent" | |||
| android:orientation="vertical"> | |||
| <LinearLayout | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:orientation="horizontal" | |||
| android:id="@+id/layout_ugVersion"> | |||
| <ImageView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginRight="20dip" | |||
| android:id="@+id/ug_imageAppIcon" | |||
| android:layout_gravity="center_vertical" /> | |||
| <TextView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:textColor="#FF000000" | |||
| android:text="iii" | |||
| android:id="@+id/ug_TextVersion" | |||
| android:textStyle="bold" | |||
| android:layout_gravity="center_vertical" | |||
| android:gravity="center_vertical" /> | |||
| </LinearLayout> | |||
| <ScrollView | |||
| android:id="@+id/ug_ScrollView" | |||
| android:layout_width="wrap_content" | |||
| android:addStatesFromChildren="true" | |||
| android:layout_height="250dp"> | |||
| <LinearLayout | |||
| android:orientation="vertical" | |||
| android:layout_height="wrap_content" | |||
| android:layout_width="wrap_content"> | |||
| <TextView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:id="@+id/ug_hdr_GenPourpose" | |||
| android:textColor="@color/black" | |||
| android:textStyle="bold" | |||
| android:layout_marginBottom="5dp" | |||
| android:layout_marginTop="5dp" | |||
| android:text="@string/header_GeneralPurpose"></TextView> | |||
| <TextView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:id="@+id/ug_txt_GenPourpose" | |||
| android:textColor="@color/black" | |||
| android:text="@string/text_GeneralPurpose" | |||
| android:paddingRight="3dp" android:textSize="12dp"> | |||
| </TextView> | |||
| <TextView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:id="@+id/ug_hdr_HowTo" | |||
| android:textColor="@color/black" | |||
| android:textStyle="bold" | |||
| android:layout_marginBottom="5dp" | |||
| android:layout_marginTop="5dp" | |||
| android:text="@string/header_HowTo"></TextView> | |||
| <TextView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:id="@+id/ug_txt_HowTo" | |||
| android:textColor="@color/black" | |||
| android:text="@string/text_HowTo" android:lineSpacingExtra="1dp" android:textSize="12dp"></TextView> | |||
| </LinearLayout> | |||
| </ScrollView> | |||
| <Button | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:background="@drawable/btn_fs" | |||
| android:id="@+id/btn_ugClose" | |||
| android:textColor="@color/white" | |||
| android:layout_gravity="center_horizontal" | |||
| android:layout_marginTop="20dp" android:text="@string/BtnClose"> | |||
| </Button> | |||
| </LinearLayout> | |||
| @@ -0,0 +1,59 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <LinearLayout | |||
| xmlns:android="http://schemas.android.com/apk/res/android" | |||
| android:layout_width="fill_parent" | |||
| android:padding="10dp" | |||
| android:layout_height="fill_parent" | |||
| android:background="@drawable/bg_about" | |||
| android:orientation="vertical" | |||
| android:id="@+id/layout_AboutRoot"> | |||
| <LinearLayout | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:orientation="horizontal" | |||
| android:id="@+id/layout_aboutVersion"> | |||
| <ImageView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginRight="20dip" | |||
| android:id="@+id/about_imageAppIcon" /> | |||
| <LinearLayout | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:id="@+id/layout_aboutVersionText" | |||
| android:orientation="vertical"> | |||
| <TextView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:textColor="#FF000000" | |||
| android:text="iii" | |||
| android:id="@+id/about_TextDescription" /> | |||
| <TextView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:textColor="#FF000000" | |||
| android:text="iii" | |||
| android:id="@+id/about_TextVersion" | |||
| android:textStyle="bold" /> | |||
| </LinearLayout> | |||
| </LinearLayout> | |||
| <TextView | |||
| android:text="@+id/TextView01" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:id="@+id/about_TextAutor" | |||
| android:textColor="@color/black" | |||
| android:paddingBottom="20dip" | |||
| android:paddingTop="20dip"></TextView> | |||
| <Button | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:background="@drawable/btn_fs" | |||
| android:id="@+id/btn_AboutClose" | |||
| android:text="@+id/BtnClose" | |||
| android:textColor="@color/white" | |||
| android:layout_gravity="center_horizontal"></Button> | |||
| </LinearLayout> | |||
| @@ -0,0 +1,199 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC.resultlist; | |||
| import java.text.DecimalFormat; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import android.app.Activity; | |||
| import android.content.Context; | |||
| import android.content.res.Resources; | |||
| import android.graphics.Bitmap; | |||
| import android.graphics.BitmapFactory; | |||
| import android.graphics.Canvas; | |||
| import android.graphics.Color; | |||
| import android.graphics.Paint; | |||
| import android.graphics.PorterDuff; | |||
| import android.graphics.PorterDuffXfermode; | |||
| import android.graphics.Bitmap.Config; | |||
| import android.graphics.Paint.Style; | |||
| import android.util.DisplayMetrics; | |||
| import ch.spherIC.EVFormula; | |||
| import ch.spherIC.EasyBracketMain; | |||
| import ch.spherIC.R; | |||
| /** | |||
| * Factory that creates the exposure icons according to the EV range and values. | |||
| */ | |||
| public class ExposureFactory { | |||
| public static final DecimalFormat evDF = new DecimalFormat("0.######"); | |||
| /** | |||
| * DOCUMENT ME! | |||
| * | |||
| * @param context DOCUMENT ME! | |||
| * @param dpEV DOCUMENT ME! | |||
| * @param bpEv DOCUMENT ME! | |||
| * @param calcPrmAperture DOCUMENT ME! | |||
| * @param calcPrmEvStep DOCUMENT ME! | |||
| * @param fixBP DOCUMENT ME! | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| public static List<Exposure> calculateExposures(Context context, double dpEV, double bpEv, double calcPrmAperture, | |||
| double calcPrmEvStep, boolean fixBP, List<Double> allowedShutters) { | |||
| Exposure exp; | |||
| List<Exposure> exposures = new ArrayList<Exposure>(); | |||
| double deltaEV = bpEv - dpEV; | |||
| long nbrExposures = Math.round(deltaEV / calcPrmEvStep) + 1; | |||
| // correct the deltaEV | |||
| deltaEV = calcPrmEvStep * (nbrExposures - 1); | |||
| double baseEVStep = -deltaEV / 2; | |||
| for (int i = 0; i < nbrExposures; i++) { | |||
| boolean found = false; | |||
| String shutterSpeed = ""; | |||
| double shutter; | |||
| double evValue = 0; | |||
| double evStep = baseEVStep + i * calcPrmEvStep; | |||
| if (fixBP) { | |||
| evValue = bpEv - (nbrExposures - 1 - i) * calcPrmEvStep; | |||
| } else { | |||
| evValue = dpEV + i * calcPrmEvStep; | |||
| } | |||
| shutter = Double.valueOf(evDF.format((EVFormula.calcShutterSpeed(calcPrmAperture, evValue)))); | |||
| for (int j = 1; j < allowedShutters.size(); j++) { | |||
| double v1 = allowedShutters.get(j - 1); | |||
| double v2 = allowedShutters.get(j); | |||
| if ((v1 <= shutter && shutter <= v2) || (v2 <= shutter && shutter <= v1)) { | |||
| if (Math.abs(shutter - v1) <= Math.abs(shutter - v2)) { | |||
| shutterSpeed = (v1 < 1) ? "1/" + evDF.format((1 / v1)) | |||
| : "" + EasyBracketMain.DF.format(v1) + "''"; | |||
| } else { | |||
| shutterSpeed = (v2 < 1) ? "1/" + evDF.format((1 / v2)) | |||
| : "" + EasyBracketMain.DF.format(v2) + "''"; | |||
| } | |||
| found = true; | |||
| break; | |||
| } | |||
| } | |||
| if (!found) { | |||
| shutterSpeed = (shutter < 1) ? "1/" + Math.round(1 / shutter) | |||
| : "" + EasyBracketMain.DF.format(shutter) + "''"; | |||
| } | |||
| exp = new Exposure(i + 1, "f/" + EasyBracketMain.DF.format(calcPrmAperture), shutterSpeed, evStep, deltaEV, | |||
| getExpIcon(context, i + 1, (int) nbrExposures)); | |||
| exposures.add(exp); | |||
| } | |||
| return exposures; | |||
| } | |||
| /** | |||
| * Retrieves Icon. | |||
| * | |||
| * @param context Context | |||
| * @param exp {@link Exposure} object | |||
| * | |||
| * @return Color stepped icon | |||
| */ | |||
| private static Bitmap getExpIcon(Context context, int expNbr, int nbrExposures) { | |||
| Bitmap mIcon; | |||
| Bitmap mIconBG; | |||
| Bitmap mIconSymbol; | |||
| Bitmap mIconSymbol_bl; | |||
| Canvas canvas; | |||
| Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); | |||
| final Resources res = context.getResources(); | |||
| final int twentyPercentGray = Math.round(255f * 0.8f); | |||
| int deltaRGB = twentyPercentGray; | |||
| int iSize; | |||
| int iSize_r; | |||
| int iStart; | |||
| DisplayMetrics metrics = new DisplayMetrics(); | |||
| ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(metrics); | |||
| switch (metrics.densityDpi) { | |||
| case DisplayMetrics.DENSITY_LOW: | |||
| iSize = 18; | |||
| iSize_r = 17; | |||
| iStart = 1; | |||
| break; | |||
| case DisplayMetrics.DENSITY_MEDIUM: | |||
| iSize = 24; | |||
| iSize_r = 22; | |||
| iStart = 2; | |||
| break; | |||
| default: | |||
| iSize = 36; | |||
| iSize_r = 33; | |||
| iStart = 2; | |||
| break; | |||
| } | |||
| if (expNbr > 1 || nbrExposures > 1) { | |||
| deltaRGB = twentyPercentGray / (nbrExposures - 1) * (expNbr - 1); | |||
| } | |||
| // The background | |||
| mIconBG = Bitmap.createBitmap(36, 36, Config.ARGB_8888); | |||
| mIconBG.eraseColor(0x00000000); | |||
| canvas = new Canvas(mIconBG); | |||
| mPaint.setStyle(Style.FILL); | |||
| mPaint.setColor(Color.argb(255, deltaRGB, deltaRGB, deltaRGB)); | |||
| canvas.drawRect(2, 2, 33, 33, mPaint); | |||
| // Let's retrieve all icon pieces as Bitmaps. | |||
| mIcon = BitmapFactory.decodeResource(res, R.drawable.exposureicon_frame); | |||
| mIconSymbol = BitmapFactory.decodeResource(res, R.drawable.exposureicon_symb_white); | |||
| mIconSymbol_bl = BitmapFactory.decodeResource(res, R.drawable.exposureicon_symb_black); | |||
| // Prepares the paint that will be used to draw our icon mask. Using | |||
| // PorterDuff.Mode.SRC_OVER means the image that will be drawn will | |||
| // mask the already drawn image. | |||
| mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER)); | |||
| // We're now ready to drawn our Android-like icon :) | |||
| if (deltaRGB > twentyPercentGray / 2) { | |||
| canvas.drawBitmap(mIconSymbol_bl, 0, 0, mPaint); | |||
| } else { | |||
| canvas.drawBitmap(mIconSymbol, 0, 0, mPaint); | |||
| } | |||
| canvas.drawBitmap(mIcon, 0, 0, mPaint); | |||
| return mIconBG; | |||
| } | |||
| } | |||
| @@ -0,0 +1,242 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC.resultlist; | |||
| import java.util.List; | |||
| import android.app.Activity; | |||
| import android.content.Context; | |||
| import android.util.DisplayMetrics; | |||
| import android.view.Gravity; | |||
| import android.view.View; | |||
| import android.view.ViewGroup; | |||
| import android.widget.BaseAdapter; | |||
| import android.widget.ImageView; | |||
| import android.widget.LinearLayout; | |||
| import android.widget.TextView; | |||
| import android.widget.LinearLayout.LayoutParams; | |||
| import ch.spherIC.R; | |||
| /** | |||
| * Exposure adapter view class. | |||
| */ | |||
| class ExposureAdapterView extends LinearLayout { | |||
| private static DisplayMetrics metrics; | |||
| /** | |||
| * Creates a new ExposureAdapterView object. | |||
| * | |||
| * @param context DOCUMENT ME! | |||
| * @param weather DOCUMENT ME! | |||
| */ | |||
| public ExposureAdapterView(Context context, Exposure exposure, int nbrExposures) { | |||
| super(context); | |||
| this.setOrientation(HORIZONTAL); | |||
| ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(metrics); | |||
| // Nbr | |||
| TextView nbrControl = new TextView(context); | |||
| LinearLayout.LayoutParams nbrParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| nbrParams.setMargins(3, 1, 1, 1); | |||
| nbrControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| nbrControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| nbrControl.setText(Integer.toString(exposure.getNbr())); | |||
| addView(nbrControl, nbrParams); | |||
| // Aperture | |||
| TextView apertureControl = new TextView(context); | |||
| LinearLayout.LayoutParams apertureParams = new LinearLayout.LayoutParams(100, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| apertureParams.setMargins(1, 1, 1, 1); | |||
| apertureControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| apertureControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| apertureControl.setText(exposure.getAperture()); | |||
| addView(apertureControl, apertureParams); | |||
| // Shutter speed | |||
| TextView shutterControl = new TextView(context); | |||
| LinearLayout.LayoutParams shutterParams = new LinearLayout.LayoutParams(170, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| shutterParams.setMargins(1, 1, 1, 1); | |||
| shutterControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| shutterControl.setTextAppearance(context, R.style.ResultExposureTextSpecial); | |||
| shutterControl.setText(exposure.getShutterSpeed()); | |||
| addView(shutterControl, shutterParams); | |||
| // EV Step | |||
| TextView evStepControl = new TextView(context); | |||
| LinearLayout.LayoutParams evStepParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| evStepParams.setMargins(1, 1, 1, 1); | |||
| evStepControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| evStepControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| evStepControl.setText(exposure.getEvStepAsString()); | |||
| addView(evStepControl, evStepParams); | |||
| // Icon | |||
| ImageView expIconControl = new ImageView(context); | |||
| LinearLayout.LayoutParams expIconParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| expIconParams.setMargins(1, 1, 1, 1); | |||
| expIconControl.setImageBitmap(exposure.getEvStepBtmp()); | |||
| addView(expIconControl, expIconParams); | |||
| } | |||
| } | |||
| /** | |||
| * Exposure results adapter. | |||
| */ | |||
| public class ExposureAdapter extends BaseAdapter { | |||
| private static DisplayMetrics metrics; | |||
| private Context context; | |||
| private List<Exposure> exposureList; | |||
| /** | |||
| * Creates a new ExposureAdapter object. | |||
| */ | |||
| public ExposureAdapter(Context context, List<Exposure> expList) { | |||
| this.context = context; | |||
| this.exposureList = expList; | |||
| } | |||
| /** | |||
| * Retrieves list size. | |||
| * | |||
| * @return list size | |||
| */ | |||
| @Override | |||
| public int getCount() { | |||
| return this.exposureList.size(); | |||
| } | |||
| /** | |||
| * Retrieves the exposure at index <code>position</code>. | |||
| * | |||
| * @param position Index in list | |||
| * | |||
| * @return Exposure at index <code>position</code> | |||
| */ | |||
| @Override | |||
| public Object getItem(int position) { | |||
| return this.exposureList.get(position); | |||
| } | |||
| /** | |||
| * Retrieves the number of the exposure at index <code>position</code>. | |||
| * | |||
| * @param position Index in list | |||
| * | |||
| * @return the number of the exposure at index <code>position</code> | |||
| */ | |||
| @Override | |||
| public long getItemId(int position) { | |||
| //return this.exposureList.get(position).getNbr(); | |||
| return position; | |||
| } | |||
| /** | |||
| * Retrieves a view representing a single result row. | |||
| * | |||
| * @param position Index in list | |||
| * @param convertView view | |||
| * @param parent parent | |||
| * | |||
| * @return {@link ExposureAdapterView} | |||
| */ | |||
| @Override | |||
| public View getView(int position, View convertView, ViewGroup parent) { | |||
| Exposure exposure = this.exposureList.get(position); | |||
| return new ExposureAdapterView(this.context, exposure, this.exposureList.size()); | |||
| } | |||
| /** | |||
| * Retrieves the value of | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| public static View getHeaderView(Context context, LinearLayout headerLL) { | |||
| int black = headerLL.getResources().getColor(R.color.black); | |||
| // Nbr | |||
| TextView nbrControl = new TextView(context); | |||
| LinearLayout.LayoutParams nbrParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| nbrParams.setMargins(3, 1, 1, 1); | |||
| nbrControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| nbrControl.setTextSize(13f); | |||
| nbrControl.setTextColor(black); | |||
| nbrControl.setText(R.string.expNbrLbl); | |||
| headerLL.addView(nbrControl, nbrParams); | |||
| // Aperture | |||
| TextView apertureControl = new TextView(context); | |||
| LinearLayout.LayoutParams apertureParams = new LinearLayout.LayoutParams(100, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| apertureParams.setMargins(1, 1, 1, 1); | |||
| apertureControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| apertureControl.setTextSize(13f); | |||
| apertureControl.setTextColor(black); | |||
| apertureControl.setText(R.string.aperture); | |||
| headerLL.addView(apertureControl, apertureParams); | |||
| // Shutter speed | |||
| TextView shutterControl = new TextView(context); | |||
| LinearLayout.LayoutParams shutterParams = new LinearLayout.LayoutParams(170, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| shutterParams.setMargins(1, 1, 1, 1); | |||
| shutterControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| shutterControl.setTextSize(13f); | |||
| shutterControl.setTextColor(black); | |||
| shutterControl.setText(R.string.shutter_speed); | |||
| headerLL.addView(shutterControl, shutterParams); | |||
| // EV Step | |||
| TextView evStepControl = new TextView(context); | |||
| LinearLayout.LayoutParams evStepParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| evStepParams.setMargins(1, 1, 1, 1); | |||
| evStepControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| evStepControl.setTextSize(13f); | |||
| evStepControl.setTextColor(black); | |||
| evStepControl.setText(R.string.expEVStep); | |||
| headerLL.addView(evStepControl, evStepParams); | |||
| // Icon | |||
| ImageView expIconControl = new ImageView(context); | |||
| LinearLayout.LayoutParams expIconParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| expIconParams.setMargins(1, 1, 1, 1); | |||
| headerLL.addView(expIconControl, expIconParams); | |||
| return headerLL; | |||
| } | |||
| /** | |||
| * Retrieves the value of | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| private static DisplayMetrics getMetrics() { | |||
| if (metrics == null) { | |||
| metrics = new DisplayMetrics(); | |||
| } | |||
| return metrics; | |||
| } | |||
| } | |||
| @@ -0,0 +1,244 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC.resultlist; | |||
| import java.util.List; | |||
| import android.app.Activity; | |||
| import android.content.Context; | |||
| import android.util.DisplayMetrics; | |||
| import android.view.Gravity; | |||
| import android.view.View; | |||
| import android.view.ViewGroup; | |||
| import android.widget.BaseAdapter; | |||
| import android.widget.ImageView; | |||
| import android.widget.LinearLayout; | |||
| import android.widget.TextView; | |||
| import android.widget.LinearLayout.LayoutParams; | |||
| import ch.spherIC.R; | |||
| /** | |||
| * Exposure adapter view class. | |||
| */ | |||
| class ExposureAdapterView extends LinearLayout { | |||
| private static DisplayMetrics metrics; | |||
| /** | |||
| * Creates a new ExposureAdapterView object. | |||
| * | |||
| * @param context DOCUMENT ME! | |||
| * @param weather DOCUMENT ME! | |||
| */ | |||
| public ExposureAdapterView(Context context, Exposure exposure) { | |||
| super(context); | |||
| this.setOrientation(HORIZONTAL); | |||
| // Nbr | |||
| TextView nbrControl = new TextView(context); | |||
| LinearLayout.LayoutParams nbrParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| nbrParams.setMargins(3, 1, 1, 1); | |||
| nbrControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| nbrControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| nbrControl.setText(Integer.toString(exposure.getNbr())); | |||
| addView(nbrControl, nbrParams); | |||
| // Aperture | |||
| TextView apertureControl = new TextView(context); | |||
| LinearLayout.LayoutParams apertureParams = new LinearLayout.LayoutParams(100, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| apertureParams.setMargins(1, 1, 1, 1); | |||
| apertureControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| apertureControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| apertureControl.setText(exposure.getAperture()); | |||
| addView(apertureControl, apertureParams); | |||
| // Shutter speed | |||
| TextView shutterControl = new TextView(context); | |||
| LinearLayout.LayoutParams shutterParams = new LinearLayout.LayoutParams(170, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| shutterParams.setMargins(1, 1, 1, 1); | |||
| shutterControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| shutterControl.setTextAppearance(context, R.style.ResultExposureTextSpecial); | |||
| shutterControl.setText(exposure.getShutterSpeed()); | |||
| addView(shutterControl, shutterParams); | |||
| // EV Step | |||
| TextView evStepControl = new TextView(context); | |||
| LinearLayout.LayoutParams evStepParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| evStepParams.setMargins(1, 1, 1, 1); | |||
| evStepControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| evStepControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| evStepControl.setText(exposure.getEvStepAsString()); | |||
| addView(evStepControl, evStepParams); | |||
| // Icon | |||
| ImageView expIconControl = new ImageView(context); | |||
| LinearLayout.LayoutParams expIconParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| expIconParams.setMargins(1, 1, 1, 1); | |||
| expIconControl.setImageBitmap(exposure.getEvStepBtmp()); | |||
| addView(expIconControl, expIconParams); | |||
| } | |||
| } | |||
| /** | |||
| * Exposure results adapter. | |||
| */ | |||
| public class ExposureAdapter extends BaseAdapter { | |||
| private static DisplayMetrics metrics; | |||
| private Context context; | |||
| private List<Exposure> exposureList; | |||
| /** | |||
| * Creates a new ExposureAdapter object. | |||
| */ | |||
| public ExposureAdapter(Context context, List<Exposure> expList) { | |||
| this.context = context; | |||
| this.exposureList = expList; | |||
| } | |||
| /** | |||
| * Retrieves list size. | |||
| * | |||
| * @return list size | |||
| */ | |||
| @Override | |||
| public int getCount() { | |||
| return this.exposureList.size(); | |||
| } | |||
| /** | |||
| * Retrieves the exposure at index <code>position</code>. | |||
| * | |||
| * @param position Index in list | |||
| * | |||
| * @return Exposure at index <code>position</code> | |||
| */ | |||
| @Override | |||
| public Object getItem(int position) { | |||
| return this.exposureList.get(position); | |||
| } | |||
| /** | |||
| * Retrieves the number of the exposure at index <code>position</code>. | |||
| * | |||
| * @param position Index in list | |||
| * | |||
| * @return the number of the exposure at index <code>position</code> | |||
| */ | |||
| @Override | |||
| public long getItemId(int position) { | |||
| //return this.exposureList.get(position).getNbr(); | |||
| return position; | |||
| } | |||
| /** | |||
| * Retrieves a view representing a single result row. | |||
| * | |||
| * @param position Index in list | |||
| * @param convertView view | |||
| * @param parent parent | |||
| * | |||
| * @return {@link ExposureAdapterView} | |||
| */ | |||
| @Override | |||
| public View getView(int position, View convertView, ViewGroup parent) { | |||
| Exposure exposure = this.exposureList.get(position); | |||
| return new ExposureAdapterView(this.context, exposure); | |||
| } | |||
| /** | |||
| * Retrieves the value of | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| public static View getHeaderView(Context context, LinearLayout headerLL) { | |||
| int black = headerLL.getResources().getColor(R.color.black); | |||
| int width = getMetrics(context).widthPixels; | |||
| // Nbr | |||
| TextView nbrControl = new TextView(context); | |||
| LinearLayout.LayoutParams nbrParams = new LinearLayout.LayoutParams(Math.round(0.14583f * width), | |||
| LayoutParams.WRAP_CONTENT, 0.2f); | |||
| nbrParams.setMargins(3, 1, 1, 1); | |||
| nbrControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| nbrControl.setTextSize(13f); | |||
| nbrControl.setTextColor(black); | |||
| nbrControl.setText(R.string.expNbrLbl); | |||
| headerLL.addView(nbrControl, nbrParams); | |||
| // Aperture | |||
| TextView apertureControl = new TextView(context); | |||
| LinearLayout.LayoutParams apertureParams = new LinearLayout.LayoutParams(Math.round(0.20833f * width), | |||
| LayoutParams.WRAP_CONTENT, 0.2f); | |||
| apertureParams.setMargins(1, 1, 1, 1); | |||
| apertureControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| apertureControl.setTextSize(13f); | |||
| apertureControl.setTextColor(black); | |||
| apertureControl.setText(R.string.aperture); | |||
| headerLL.addView(apertureControl, apertureParams); | |||
| // Shutter speed | |||
| TextView shutterControl = new TextView(context); | |||
| LinearLayout.LayoutParams shutterParams = new LinearLayout.LayoutParams(Math.round(0.35417f * width), | |||
| LayoutParams.WRAP_CONTENT, 0.2f); | |||
| shutterParams.setMargins(1, 1, 1, 1); | |||
| shutterControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| shutterControl.setTextSize(13f); | |||
| shutterControl.setTextColor(black); | |||
| shutterControl.setText(R.string.shutter_speed); | |||
| headerLL.addView(shutterControl, shutterParams); | |||
| // EV Step | |||
| TextView evStepControl = new TextView(context); | |||
| LinearLayout.LayoutParams evStepParams = new LinearLayout.LayoutParams(Math.round(0.14583f * width), LayoutParams.WRAP_CONTENT, 0.2f); | |||
| evStepParams.setMargins(1, 1, 1, 1); | |||
| evStepControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| evStepControl.setTextSize(13f); | |||
| evStepControl.setTextColor(black); | |||
| evStepControl.setText(R.string.expEVStep); | |||
| headerLL.addView(evStepControl, evStepParams); | |||
| // Icon | |||
| ImageView expIconControl = new ImageView(context); | |||
| LinearLayout.LayoutParams expIconParams = new LinearLayout.LayoutParams(Math.round(0.14583f * width), LayoutParams.WRAP_CONTENT, 0.2f); | |||
| expIconParams.setMargins(1, 1, 1, 1); | |||
| headerLL.addView(expIconControl, expIconParams); | |||
| return headerLL; | |||
| } | |||
| /** | |||
| * Retrieves the value of | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| private static DisplayMetrics getMetrics(Context context) { | |||
| if (metrics == null) { | |||
| metrics = new DisplayMetrics(); | |||
| ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(metrics); | |||
| } | |||
| return metrics; | |||
| } | |||
| } | |||
| @@ -0,0 +1,83 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <resources> | |||
| <string | |||
| name="app_name">Easy Bracketing</string> | |||
| <string | |||
| name="dynamic_range">Dynamikbereich</string> | |||
| <string | |||
| name="shutter_speed">Belichtungszeit</string> | |||
| <string | |||
| name="aperture">Blende</string> | |||
| <string | |||
| name="ev">LW</string> | |||
| <string | |||
| name="dark_point">Werte Dunkelpunkt</string> | |||
| <string | |||
| name="bright_point">Werte Hellpunkt</string> | |||
| <string | |||
| name="calcParams">Berechnungsparameter</string> | |||
| <string | |||
| name="delta_EV">Δ LW</string> | |||
| <string | |||
| name="expEVStep">LW-Schritt</string> | |||
| <string | |||
| name="calculate">Berechnen</string> | |||
| <string | |||
| name="reset">Zurücksetzen</string> | |||
| <string | |||
| name="bracketingRes">Bracketing Belichtungswerte</string> | |||
| <string | |||
| name="expNbrLbl"># Bel.</string> | |||
| <string | |||
| name="toastWarningDP_BP">Das Delta zwischen dem LW des Dunkelpunkt und dem LW des Hellpunkt ist kleiner oder gleich 0. | |||
| \nBitte korrigieren Sie die Eingaben.</string> | |||
| <string | |||
| name="menuUserGuide">Benutzeranleitung</string> | |||
| <string | |||
| name="menuSettings">Einstellungen...</string> | |||
| <string | |||
| name="menuAbout">Info</string> | |||
| <string | |||
| name="about_Description"> | |||
| EasyBracketing dient zur schnellen und einfachen Berechnung einer Belichtungsserie ausgehend | |||
| von den Belichtungswerten eines Dunkelpunktes und eines Hellpunktes. | |||
| </string> | |||
| <string | |||
| name="AppVersionLabel">Version:</string> | |||
| <string | |||
| name="about_DevelopedBy">Entwickelt von spherIC (F. Smilari)\nMail an: | |||
| merlin868@hotmail.com\n\nÜbersetzt von spherIC (F. Smilari)</string> | |||
| <string | |||
| name="Percent18Correction">18%-Grauwertkorrektur</string> | |||
| <string | |||
| name="Percent18CorrectionBP">Hellpunktkorrektur (LW)</string> | |||
| <string | |||
| name="Percent18CorrectionDP">Dunkelpunktkorrektur (LW)</string> | |||
| <string | |||
| name="FixRangePoint">Ausgangspunkt für Belichtungsserie</string> | |||
| <string | |||
| name="FixRangePointBP">Von Hellpunktwerten ausgehen</string> | |||
| <string | |||
| name="FixRangePointDP">Von Dunkelpunktwerten ausgehen</string> | |||
| <string | |||
| name="BtnSave">Speichern</string> | |||
| <string | |||
| name="BtnCancel">Abbrechen</string> | |||
| <string | |||
| name="BtnClose">Schliessen</string> | |||
| <string | |||
| name="header_GeneralPurpose">1. Allgm. Verwendungszweck</string> | |||
| <string | |||
| name="text_GeneralPurpose"> | |||
| Beim Erstellen einer Belichtungsreihe für ein späteres HDR-Bild, stellt sich oftmals das Problem, | |||
| dass der Kontrastumfang zu gross ist um von der typischen \"+2LW/0LW/-2LW\"-Vorgehensweise abgedeckt zu werden.\n | |||
| Hier kommt \"EasyBracketing\" zum Zug.\n | |||
| Ausgehend von gemessenen Werten für den hellsten Punkt resp. den dunkelsten Punkt | |||
| werden über definierbare Parameter alle notwendigen Belichtungen einer Belichtungsreihe berechnet. Diese können dann | |||
| an der Kamera sukzessive eingestellt und die Aufnahme ausgelöst werden. | |||
| </string> | |||
| <string | |||
| name="header_HowTo">2. Vorgehensweise</string> | |||
| <string | |||
| name="text_HowTo">Text here</string> | |||
| </resources> | |||
| @@ -0,0 +1,177 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC.resultlist; | |||
| import java.text.DecimalFormat; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import android.app.Activity; | |||
| import android.content.Context; | |||
| import android.content.res.Resources; | |||
| import android.graphics.Bitmap; | |||
| import android.graphics.BitmapFactory; | |||
| import android.graphics.Canvas; | |||
| import android.graphics.Color; | |||
| import android.graphics.Paint; | |||
| import android.graphics.PorterDuff; | |||
| import android.graphics.PorterDuffXfermode; | |||
| import android.graphics.Bitmap.Config; | |||
| import android.graphics.Paint.Style; | |||
| import android.util.DisplayMetrics; | |||
| import ch.spherIC.EVFormula; | |||
| import ch.spherIC.EasyBracketMain; | |||
| import ch.spherIC.R; | |||
| /** | |||
| * Factory that creates the exposure icons according to the EV range and values. | |||
| */ | |||
| public class ExposureFactory { | |||
| public static final DecimalFormat evDF = new DecimalFormat("0.######"); | |||
| /** | |||
| * DOCUMENT ME! | |||
| * | |||
| * @param context DOCUMENT ME! | |||
| * @param dpEV DOCUMENT ME! | |||
| * @param bpEv DOCUMENT ME! | |||
| * @param calcPrmAperture DOCUMENT ME! | |||
| * @param calcPrmEvStep DOCUMENT ME! | |||
| * @param fixBP DOCUMENT ME! | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| public static List<Exposure> calculateExposures(Context context, double dpEV, double bpEv, double calcPrmAperture, | |||
| double calcPrmEvStep, boolean fixBP, List<Double> allowedShutters) { | |||
| Exposure exp; | |||
| List<Exposure> exposures = new ArrayList<Exposure>(); | |||
| double deltaEV = bpEv - dpEV; | |||
| long nbrExposures = Math.round(deltaEV / calcPrmEvStep) + 1; | |||
| // correct the deltaEV | |||
| deltaEV = calcPrmEvStep * (nbrExposures - 1); | |||
| double baseEVStep = -deltaEV / 2; | |||
| for (int i = 0; i < nbrExposures; i++) { | |||
| boolean found = false; | |||
| String shutterSpeed = ""; | |||
| double shutter; | |||
| double evValue = 0; | |||
| double evStep = baseEVStep + i * calcPrmEvStep; | |||
| if (fixBP) { | |||
| evValue = bpEv - (nbrExposures - 1 - i) * calcPrmEvStep; | |||
| } else { | |||
| evValue = dpEV + i * calcPrmEvStep; | |||
| } | |||
| shutter = Double.valueOf(evDF.format((EVFormula.calcShutterSpeed(calcPrmAperture, evValue)))); | |||
| for (int j = 1; j < allowedShutters.size(); j++) { | |||
| double v1 = allowedShutters.get(j - 1); | |||
| double v2 = allowedShutters.get(j); | |||
| if ((v1 <= shutter && shutter <= v2) || (v2 <= shutter && shutter <= v1)) { | |||
| if (Math.abs(shutter - v1) <= Math.abs(shutter - v2)) { | |||
| shutterSpeed = (v1 < 1) ? "1/" + evDF.format((1 / v1)) | |||
| : "" + EasyBracketMain.DF.format(v1) + "''"; | |||
| } else { | |||
| shutterSpeed = (v2 < 1) ? "1/" + evDF.format((1 / v2)) | |||
| : "" + EasyBracketMain.DF.format(v2) + "''"; | |||
| } | |||
| found = true; | |||
| break; | |||
| } | |||
| } | |||
| if (!found) { | |||
| shutterSpeed = (shutter < 1) ? "1/" + Math.round(1 / shutter) | |||
| : "" + EasyBracketMain.DF.format(shutter) + "''"; | |||
| } | |||
| exp = new Exposure(i + 1, "f/" + EasyBracketMain.DF.format(calcPrmAperture), shutterSpeed, evStep, deltaEV, | |||
| getExpIcon(context, i + 1, (int) nbrExposures)); | |||
| exposures.add(exp); | |||
| } | |||
| return exposures; | |||
| } | |||
| /** | |||
| * Retrieves Icon. | |||
| * | |||
| * @param context Context | |||
| * @param exp {@link Exposure} object | |||
| * | |||
| * @return Color stepped icon | |||
| */ | |||
| private static Bitmap getExpIcon(Context context, int expNbr, int nbrExposures) { | |||
| Bitmap mIcon; | |||
| Bitmap mIconBG; | |||
| Bitmap mIconSymbol; | |||
| Bitmap mIconSymbol_bl; | |||
| Canvas canvas; | |||
| Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); | |||
| final Resources res = context.getResources(); | |||
| final int twentyPercentGray = Math.round(255f * 0.8f); | |||
| int deltaRGB = twentyPercentGray; | |||
| int iSize; | |||
| int iSize_r; | |||
| int iStart; | |||
| DisplayMetrics metrics = new DisplayMetrics(); | |||
| ((Activity) context).getApplicationContext().getDefaultDisplay().getMetrics(metrics); | |||
| if (expNbr > 1 || nbrExposures > 1) { | |||
| deltaRGB = twentyPercentGray / (nbrExposures - 1) * (expNbr - 1); | |||
| } | |||
| // The background | |||
| mIconBG = Bitmap.createBitmap(36, 36, Config.ARGB_8888); | |||
| mIconBG.eraseColor(0x00000000); | |||
| canvas = new Canvas(mIconBG); | |||
| mPaint.setStyle(Style.FILL); | |||
| mPaint.setColor(Color.argb(255, deltaRGB, deltaRGB, deltaRGB)); | |||
| canvas.drawRect(2, 2, 33, 33, mPaint); | |||
| // Let's retrieve all icon pieces as Bitmaps. | |||
| mIcon = BitmapFactory.decodeResource(res, R.drawable.exposureicon_frame); | |||
| mIconSymbol = BitmapFactory.decodeResource(res, R.drawable.exposureicon_symb_white); | |||
| mIconSymbol_bl = BitmapFactory.decodeResource(res, R.drawable.exposureicon_symb_black); | |||
| // Prepares the paint that will be used to draw our icon mask. Using | |||
| // PorterDuff.Mode.SRC_OVER means the image that will be drawn will | |||
| // mask the already drawn image. | |||
| mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER)); | |||
| // We're now ready to drawn our Android-like icon :) | |||
| if (deltaRGB > twentyPercentGray / 2) { | |||
| canvas.drawBitmap(mIconSymbol_bl, 0, 0, mPaint); | |||
| } else { | |||
| canvas.drawBitmap(mIconSymbol, 0, 0, mPaint); | |||
| } | |||
| canvas.drawBitmap(mIcon, 0, 0, mPaint); | |||
| return mIconBG; | |||
| } | |||
| } | |||
| @@ -0,0 +1,198 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC.resultlist; | |||
| import java.text.DecimalFormat; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import android.app.Activity; | |||
| import android.content.Context; | |||
| import android.content.res.Resources; | |||
| import android.graphics.Bitmap; | |||
| import android.graphics.BitmapFactory; | |||
| import android.graphics.Canvas; | |||
| import android.graphics.Color; | |||
| import android.graphics.Paint; | |||
| import android.graphics.PorterDuff; | |||
| import android.graphics.PorterDuffXfermode; | |||
| import android.graphics.Bitmap.Config; | |||
| import android.graphics.Paint.Style; | |||
| import android.util.DisplayMetrics; | |||
| import ch.spherIC.EVFormula; | |||
| import ch.spherIC.EasyBracketMain; | |||
| import ch.spherIC.R; | |||
| /** | |||
| * Factory that creates the exposure icons according to the EV range and values. | |||
| */ | |||
| public class ExposureFactory { | |||
| public static final DecimalFormat evDF = new DecimalFormat("0.######"); | |||
| /** | |||
| * DOCUMENT ME! | |||
| * | |||
| * @param context DOCUMENT ME! | |||
| * @param dpEV DOCUMENT ME! | |||
| * @param bpEv DOCUMENT ME! | |||
| * @param calcPrmAperture DOCUMENT ME! | |||
| * @param calcPrmEvStep DOCUMENT ME! | |||
| * @param fixBP DOCUMENT ME! | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| public static List<Exposure> calculateExposures(Context context, double dpEV, double bpEv, double calcPrmAperture, | |||
| double calcPrmEvStep, boolean fixBP, List<Double> allowedShutters) { | |||
| Exposure exp; | |||
| List<Exposure> exposures = new ArrayList<Exposure>(); | |||
| double deltaEV = bpEv - dpEV; | |||
| long nbrExposures = Math.round(deltaEV / calcPrmEvStep) + 1; | |||
| // correct the deltaEV | |||
| deltaEV = calcPrmEvStep * (nbrExposures - 1); | |||
| double baseEVStep = -deltaEV / 2; | |||
| for (int i = 0; i < nbrExposures; i++) { | |||
| boolean found = false; | |||
| String shutterSpeed = ""; | |||
| double shutter; | |||
| double evValue = 0; | |||
| double evStep = baseEVStep + i * calcPrmEvStep; | |||
| if (fixBP) { | |||
| evValue = bpEv - (nbrExposures - 1 - i) * calcPrmEvStep; | |||
| } else { | |||
| evValue = dpEV + i * calcPrmEvStep; | |||
| } | |||
| shutter = Double.valueOf(evDF.format((EVFormula.calcShutterSpeed(calcPrmAperture, evValue)))); | |||
| for (int j = 1; j < allowedShutters.size(); j++) { | |||
| double v1 = allowedShutters.get(j - 1); | |||
| double v2 = allowedShutters.get(j); | |||
| if ((v1 <= shutter && shutter <= v2) || (v2 <= shutter && shutter <= v1)) { | |||
| if (Math.abs(shutter - v1) <= Math.abs(shutter - v2)) { | |||
| shutterSpeed = (v1 < 1) ? "1/" + evDF.format((1 / v1)) | |||
| : "" + EasyBracketMain.DF.format(v1) + "''"; | |||
| } else { | |||
| shutterSpeed = (v2 < 1) ? "1/" + evDF.format((1 / v2)) | |||
| : "" + EasyBracketMain.DF.format(v2) + "''"; | |||
| } | |||
| found = true; | |||
| break; | |||
| } | |||
| } | |||
| if (!found) { | |||
| shutterSpeed = (shutter < 1) ? "1/" + Math.round(1 / shutter) | |||
| : "" + EasyBracketMain.DF.format(shutter) + "''"; | |||
| } | |||
| exp = new Exposure(i + 1, "f/" + EasyBracketMain.DF.format(calcPrmAperture), shutterSpeed, evStep, deltaEV, | |||
| getExpIcon(context, i + 1, (int) nbrExposures)); | |||
| exposures.add(exp); | |||
| } | |||
| return exposures; | |||
| } | |||
| /** | |||
| * Retrieves Icon. | |||
| * | |||
| * @param context Context | |||
| * @param exp {@link Exposure} object | |||
| * | |||
| * @return Color stepped icon | |||
| */ | |||
| private static Bitmap getExpIcon(Context context, int expNbr, int nbrExposures) { | |||
| Bitmap mIcon; | |||
| Bitmap mIconBG; | |||
| Bitmap mIconSymbol; | |||
| Bitmap mIconSymbol_bl; | |||
| Canvas canvas; | |||
| Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); | |||
| final Resources res = context.getResources(); | |||
| final int twentyPercentGray = Math.round(255f * 0.8f); | |||
| int deltaRGB = twentyPercentGray; | |||
| int iSize; | |||
| int iSize_r; | |||
| int iStart; | |||
| DisplayMetrics metrics = new DisplayMetrics(); | |||
| ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(metrics); | |||
| switch (metrics.densityDpi) { | |||
| case DisplayMetrics.DENSITY_LOW: | |||
| iSize = 18; | |||
| iSize_r = 17; | |||
| iStart = 1; | |||
| break; | |||
| case DisplayMetrics.DENSITY_MEDIUM: | |||
| iSize = 24; | |||
| iSize_r = 22; | |||
| iStart = 2; | |||
| break; | |||
| default: | |||
| iSize = 36; | |||
| iSize_r = 33; | |||
| iStart = 2; | |||
| break; | |||
| } | |||
| if (expNbr > 1 || nbrExposures > 1) { | |||
| deltaRGB = twentyPercentGray / (nbrExposures - 1) * (expNbr - 1); | |||
| } | |||
| // The background | |||
| mIconBG = Bitmap.createBitmap(iSize, iSize, Config.ARGB_8888); | |||
| mIconBG.eraseColor(0x00000000); | |||
| canvas = new Canvas(mIconBG); | |||
| mPaint.setStyle(Style.FILL); | |||
| mPaint.setColor(Color.argb(255, deltaRGB, deltaRGB, deltaRGB)); | |||
| canvas.drawRect(iStart, iStart, iSize_r, iSize_r, mPaint); | |||
| // Let's retrieve all icon pieces as Bitmaps. | |||
| mIcon = BitmapFactory.decodeResource(res, R.drawable.exposureicon_frame); | |||
| mIconSymbol = BitmapFactory.decodeResource(res, R.drawable.exposureicon_symb_white); | |||
| mIconSymbol_bl = BitmapFactory.decodeResource(res, R.drawable.exposureicon_symb_black); | |||
| // Prepares the paint that will be used to draw our icon mask. Using | |||
| // PorterDuff.Mode.SRC_OVER means the image that will be drawn will | |||
| // mask the already drawn image. | |||
| mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER)); | |||
| // We're now ready to drawn our Android-like icon :) | |||
| if (deltaRGB > twentyPercentGray / 2) { | |||
| canvas.drawBitmap(mIconSymbol_bl, 0, 0, mPaint); | |||
| } else { | |||
| canvas.drawBitmap(mIconSymbol, 0, 0, mPaint); | |||
| } | |||
| canvas.drawBitmap(mIcon, 0, 0, mPaint); | |||
| return mIconBG; | |||
| } | |||
| } | |||
| @@ -0,0 +1,56 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <LinearLayout | |||
| xmlns:android="http://schemas.android.com/apk/res/android" | |||
| android:background="@drawable/bg_about" | |||
| android:padding="10dp" | |||
| android:layout_height="fill_parent" | |||
| android:layout_width="fill_parent" | |||
| android:orientation="vertical"> | |||
| <LinearLayout | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:orientation="horizontal" | |||
| android:id="@+id/layout_ugVersion"> | |||
| <ImageView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginRight="20dip" | |||
| android:id="@+id/ug_imageAppIcon" | |||
| android:layout_gravity="center_vertical" /> | |||
| <TextView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:textColor="#FF000000" | |||
| android:text="iii" | |||
| android:id="@+id/ug_TextVersion" | |||
| android:textStyle="bold" | |||
| android:layout_gravity="center_vertical" | |||
| android:gravity="center_vertical" /> | |||
| </LinearLayout> | |||
| <LinearLayout | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:orientation="vertical" android:scrollbars="vertical"> | |||
| <TextView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:id="@+id/ug_Text" | |||
| android:ellipsize="none" android:text="@string/userGuidePourpose" android:textColor="@color/black"> | |||
| </TextView> | |||
| </LinearLayout> | |||
| <Button | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:background="@drawable/btn_fs" | |||
| android:id="@+id/btn_ugClose" | |||
| android:text="Close" | |||
| android:textColor="@color/white" | |||
| android:layout_gravity="center_horizontal"> | |||
| </Button> | |||
| </LinearLayout> | |||
| @@ -0,0 +1,43 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <LinearLayout | |||
| xmlns:android="http://schemas.android.com/apk/res/android" | |||
| android:background="@drawable/bg_about" | |||
| android:padding="10dp" | |||
| android:layout_height="fill_parent" | |||
| android:layout_width="fill_parent" | |||
| android:orientation="vertical"> | |||
| <LinearLayout | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:orientation="horizontal" | |||
| android:id="@+id/layout_ugVersion"> | |||
| <ImageView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginRight="20dip" | |||
| android:id="@+id/ug_imageAppIcon" | |||
| android:layout_gravity="center_vertical" /> | |||
| <TextView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:textColor="#FF000000" | |||
| android:text="iii" | |||
| android:id="@+id/ug_TextVersion" | |||
| android:textStyle="bold" | |||
| android:layout_gravity="center_vertical" | |||
| android:gravity="center_vertical" /> | |||
| </LinearLayout> | |||
| <ScrollView android:layout_height="fill_parent" android:layout_width="fill_parent" android:fillViewport="true" android:id="@+id/ug_ScrollView"><LinearLayout android:orientation="vertical" android:layout_height="fill_parent" android:layout_width="fill_parent"> | |||
| <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/ug_Text" android:text="@string/userGuidePourpose" android:textColor="@color/black"> | |||
| </TextView></LinearLayout></ScrollView><Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/btn_fs" android:id="@+id/btn_ugClose" android:text="Close" android:textColor="@color/white" android:layout_gravity="center_horizontal"> | |||
| </Button> | |||
| </LinearLayout> | |||
| @@ -0,0 +1,83 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <resources> | |||
| <string | |||
| name="app_name">Easy Bracketing</string> | |||
| <string | |||
| name="dynamic_range">Dynamikbereich</string> | |||
| <string | |||
| name="shutter_speed">Belichtungszeit</string> | |||
| <string | |||
| name="aperture">Blende</string> | |||
| <string | |||
| name="ev">LW</string> | |||
| <string | |||
| name="dark_point">Werte Dunkelpunkt</string> | |||
| <string | |||
| name="bright_point">Werte Hellpunkt</string> | |||
| <string | |||
| name="calcParams">Berechnungsparameter</string> | |||
| <string | |||
| name="delta_EV">Δ LW</string> | |||
| <string | |||
| name="expEVStep">LW-Schritt</string> | |||
| <string | |||
| name="calculate">Berechnen</string> | |||
| <string | |||
| name="reset">Zurücksetzen</string> | |||
| <string | |||
| name="bracketingRes">Bracketing Belichtungswerte</string> | |||
| <string | |||
| name="expNbrLbl"># Bel.</string> | |||
| <string | |||
| name="toastWarningDP_BP">Das Delta zwischen dem LW des Dunkelpunkt und dem LW des Hellpunkt ist kleiner oder gleich 0. | |||
| \nBitte korrigieren Sie die Eingaben.</string> | |||
| <string | |||
| name="menuUserGuide">Benutzeranleitung</string> | |||
| <string | |||
| name="menuSettings">Einstellungen...</string> | |||
| <string | |||
| name="menuAbout">Info</string> | |||
| <string | |||
| name="about_Description"> | |||
| EasyBracketing dient zur schnellen und einfachen Berechnung einer Belichtungsserie ausgehend | |||
| von den Belichtungswerten eines Dunkelpunktes und eines Hellpunktes. | |||
| </string> | |||
| <string | |||
| name="AppVersionLabel">Version:</string> | |||
| <string | |||
| name="about_DevelopedBy">Entwickelt von spherIC (F. Smilari)\nMail an: | |||
| merlin868@hotmail.com\n\nÜbersetzt von spherIC (F. Smilari)</string> | |||
| <string | |||
| name="Percent18Correction">18%-Grauwertkorrektur</string> | |||
| <string | |||
| name="Percent18CorrectionBP">Hellpunktkorrektur (LW)</string> | |||
| <string | |||
| name="Percent18CorrectionDP">Dunkelpunktkorrektur (LW)</string> | |||
| <string | |||
| name="FixRangePoint">Ausgangspunkt für Belichtungsserie</string> | |||
| <string | |||
| name="FixRangePointBP">Von Hellpunktwerten ausgehen</string> | |||
| <string | |||
| name="FixRangePointDP">Von Dunkelpunktwerten ausgehen</string> | |||
| <string | |||
| name="BtnSave">Speichern</string> | |||
| <string | |||
| name="BtnCancel">Abbrechen</string> | |||
| <string | |||
| name="BtnClose">Schliessen</string> | |||
| <string | |||
| name="header_GeneralPurpose">1. Allgm. Verwendungszweck</string> | |||
| <string | |||
| name="text_GeneralPurpose"> | |||
| Beim Erstellen einer Belichtungsreihe für ein späteres HDR-Bild, stellt sich oftmals das Problem, | |||
| dass der Kontrastumfang zu gross ist um von der typischen "+2LW/0LW/-2LW"-Vorgehensweise abgedeckt zu werden. | |||
| Hier kommt EasyBracketing zum Zug. Ausgehend von gemessenen Werten für den hellsten Punkt resp. den dunkelsten Punkt | |||
| werden über definierbare Parameter alle notwendigen Belichtungen einer Belichtreihe berechnet. Diese können dann | |||
| an der Kamera sukzessive eingstellt und die Aufnahme ausgelöst werden. | |||
| </string> | |||
| <string | |||
| name="header_HowTo">2. Vorgehensweise</string> | |||
| <string | |||
| name="text_HowTo">Text here</string> | |||
| </resources> | |||
| @@ -0,0 +1,315 @@ | |||
| package ch.spherIC; | |||
| import java.text.DecimalFormat; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import android.app.Activity; | |||
| import android.app.Dialog; | |||
| import android.content.Context; | |||
| import android.content.SharedPreferences; | |||
| import android.os.Bundle; | |||
| import android.util.DisplayMetrics; | |||
| import android.view.Gravity; | |||
| import android.view.Menu; | |||
| import android.view.MenuInflater; | |||
| import android.view.MenuItem; | |||
| import android.view.View; | |||
| import android.view.View.OnClickListener; | |||
| import android.widget.AdapterView; | |||
| import android.widget.Button; | |||
| import android.widget.LinearLayout; | |||
| import android.widget.ListView; | |||
| import android.widget.TextView; | |||
| import android.widget.Toast; | |||
| import android.widget.AdapterView.OnItemSelectedListener; | |||
| import ch.spherIC.components.ApertureSpinner; | |||
| import ch.spherIC.components.ShutterSpeedSpinner; | |||
| import ch.spherIC.components.XSpinner; | |||
| import ch.spherIC.resultlist.Exposure; | |||
| import ch.spherIC.resultlist.ExposureAdapter; | |||
| import ch.spherIC.resultlist.ExposureFactory; | |||
| import ch.spherIC.settings.SettingsDlg; | |||
| /** | |||
| * Main class EasyBracketing | |||
| */ | |||
| public class EasyBracketMain extends Activity { | |||
| public static final int ABOUT_DLG = 0; | |||
| public static final int SETTINGS_DLG = 1; | |||
| public static final int USERGUIDE_DLG = 2; | |||
| private static String DEF_SHUTTER_SPEED = "1/125"; | |||
| private static String DEF_APERTURE = "f/8"; | |||
| private static String DEF_EVSTEP = "2.0"; | |||
| private ShutterSpeedSpinner spnDPShutterSpeed; | |||
| private ApertureSpinner spnDPAperture; | |||
| private ShutterSpeedSpinner spnBPShutterSpeed; | |||
| private ApertureSpinner spnBPAperture; | |||
| private TextView txtDPEVValue; | |||
| private TextView txtBPEVValue; | |||
| private TextView txtCalcPDeltaEV; | |||
| private ApertureSpinner spnCalcPAperture; | |||
| private XSpinner spnCalcPEVStep; | |||
| private Button resetBtn; | |||
| private Button calculateBtn; | |||
| private ListView resultList; | |||
| private LinearLayout resultsHeader; | |||
| private double bpCorrection; | |||
| private double dpCorrection; | |||
| private boolean fixBP; | |||
| private double dpEV; | |||
| private double bpEV; | |||
| public static final DecimalFormat DF = new DecimalFormat("0.##"); | |||
| /** | |||
| * Called when the activity is first created. | |||
| */ | |||
| @Override | |||
| public void onCreate(Bundle savedInstanceState) { | |||
| super.onCreate(savedInstanceState); | |||
| setContentView(R.layout.main); | |||
| initComponents(); | |||
| setDefaults(); | |||
| loadSettings(); | |||
| } | |||
| /** | |||
| * Loads and stores the settings | |||
| */ | |||
| public void loadSettings() { | |||
| // Load settings | |||
| SharedPreferences settings = getSharedPreferences(SettingsDlg.PREFS_NAME, Context.MODE_PRIVATE); | |||
| this.fixBP = settings.getBoolean("fixBrightPoint", true); | |||
| this.bpCorrection = settings.getFloat("brightPointCorrection", 0f); | |||
| this.dpCorrection = settings.getFloat("darkPointCorrection", 0f); | |||
| } | |||
| /** | |||
| * {@inheritDoc} | |||
| */ | |||
| @Override | |||
| public boolean onCreateOptionsMenu(Menu menu) { | |||
| super.onCreateOptionsMenu(menu); | |||
| MenuInflater inflater = getMenuInflater(); | |||
| inflater.inflate(R.menu.mainmenu, menu); | |||
| return true; | |||
| } | |||
| /** | |||
| * @see android.app.Activity#onOptionsItemSelected(android.view.MenuItem) | |||
| */ | |||
| @Override | |||
| public boolean onOptionsItemSelected(MenuItem item) { | |||
| // Handle item selection | |||
| switch (item.getItemId()) { | |||
| case R.id.itemAbout: | |||
| showDialog(ABOUT_DLG); | |||
| return true; | |||
| case R.id.itemSettings: | |||
| showDialog(SETTINGS_DLG); | |||
| return true; | |||
| case R.id.itemUserGuide: | |||
| showDialog(USERGUIDE_DLG); | |||
| return true; | |||
| default: | |||
| return super.onOptionsItemSelected(item); | |||
| } | |||
| } | |||
| /** | |||
| * Initialization method | |||
| */ | |||
| private void initComponents() { | |||
| // initialize dropdowns | |||
| OnItemSelectedListener evRangeItemSelListener = new OnItemSelectedListener() { | |||
| @Override | |||
| public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { | |||
| EasyBracketMain.this.dpEV = EVFormula.calcEV(EasyBracketMain.this.spnDPAperture.getSelectedAperture(), | |||
| EasyBracketMain.this.spnDPShutterSpeed | |||
| .getSelectedShutterSpeed()); | |||
| EasyBracketMain.this.bpEV = EVFormula.calcEV(EasyBracketMain.this.spnBPAperture.getSelectedAperture(), | |||
| EasyBracketMain.this.spnBPShutterSpeed | |||
| .getSelectedShutterSpeed()); | |||
| EasyBracketMain.this.txtDPEVValue.setText(EasyBracketMain.DF.format(EasyBracketMain.this.dpEV)); | |||
| EasyBracketMain.this.txtBPEVValue.setText(EasyBracketMain.DF.format(EasyBracketMain.this.bpEV)); | |||
| EasyBracketMain.this.txtCalcPDeltaEV.setText(EasyBracketMain.DF.format((EasyBracketMain.this.bpEV | |||
| + EasyBracketMain.this.bpCorrection) | |||
| - (EasyBracketMain.this.dpEV | |||
| - EasyBracketMain.this.dpCorrection))); | |||
| EasyBracketMain.this.calculateBtn.setEnabled(EasyBracketMain.this.bpEV > EasyBracketMain.this.dpEV); | |||
| EasyBracketMain.this.resultsHeader.setVisibility(View.INVISIBLE); | |||
| findViewById(R.id.View_ResHeader_Understroke).setVisibility(View.INVISIBLE); | |||
| EasyBracketMain.this.resultList.setAdapter(null); | |||
| if (EasyBracketMain.this.bpEV < EasyBracketMain.this.dpEV) { | |||
| Toast toast = Toast.makeText(EasyBracketMain.this, R.string.toastWarningDP_BP, Toast.LENGTH_LONG); | |||
| toast.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL, 0, 0); | |||
| toast.show(); | |||
| } | |||
| } | |||
| @Override | |||
| public void onNothingSelected(AdapterView<?> parent) { | |||
| } | |||
| }; | |||
| OnItemSelectedListener calcPItemSelListener = new OnItemSelectedListener() { | |||
| @Override | |||
| public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { | |||
| toggleResultsList(false); | |||
| } | |||
| @Override | |||
| public void onNothingSelected(AdapterView<?> parent) { | |||
| } | |||
| }; | |||
| this.spnDPShutterSpeed = (ShutterSpeedSpinner) findViewById(R.id.Spinner_DP_Shutter); | |||
| this.spnDPAperture = (ApertureSpinner) findViewById(R.id.Spinner_DP_Aperture); | |||
| this.spnBPShutterSpeed = (ShutterSpeedSpinner) findViewById(R.id.Spinner_BP_Shutter); | |||
| this.spnBPAperture = (ApertureSpinner) findViewById(R.id.Spinner_BP_Aperture); | |||
| this.spnCalcPAperture = (ApertureSpinner) findViewById(R.id.Spinner_calcP_Aperture); | |||
| this.spnCalcPEVStep = (XSpinner) findViewById(R.id.Spinner_calcP_EVStep); | |||
| this.txtDPEVValue = (TextView) findViewById(R.id.Text_EVVal_DP); | |||
| this.txtBPEVValue = (TextView) findViewById(R.id.Text_EVVal_BP); | |||
| this.txtCalcPDeltaEV = (TextView) findViewById(R.id.label_deltaEV_Val); | |||
| this.resultsHeader = (LinearLayout) ExposureAdapter.getHeaderView(this, | |||
| (LinearLayout) | |||
| findViewById(R.id.LinearLayout_ResultsHeader)); | |||
| this.resultsHeader.setVisibility(View.INVISIBLE); | |||
| findViewById(R.id.View_ResHeader_Understroke).setVisibility(View.INVISIBLE); | |||
| this.resultList = (ListView) findViewById(R.id.ListView_ExpResults); | |||
| this.resultList.setAdapter(null); | |||
| this.resetBtn = (Button) findViewById(R.id.Btn_Reset); | |||
| this.calculateBtn = (Button) findViewById(R.id.Btn_Calculate); | |||
| this.calculateBtn.setEnabled(false); | |||
| this.spnDPShutterSpeed.setOnItemSelectedListener(evRangeItemSelListener); | |||
| this.spnDPAperture.setOnItemSelectedListener(evRangeItemSelListener); | |||
| this.spnBPShutterSpeed.setOnItemSelectedListener(evRangeItemSelListener); | |||
| this.spnBPAperture.setOnItemSelectedListener(evRangeItemSelListener); | |||
| this.resetBtn.setOnClickListener(new OnClickListener() { | |||
| @Override | |||
| public void onClick(View v) { | |||
| setDefaults(); | |||
| toggleResultsList(false); | |||
| } | |||
| }); | |||
| this.calculateBtn.setOnClickListener(new OnClickListener() { | |||
| @Override | |||
| public void onClick(View v) { | |||
| toggleResultsList(true); | |||
| calculateExposures(); | |||
| } | |||
| }); | |||
| this.spnCalcPAperture.setOnItemSelectedListener(calcPItemSelListener); | |||
| this.spnCalcPEVStep.setOnItemSelectedListener(calcPItemSelListener); | |||
| } | |||
| /** | |||
| * Clears the results list. | |||
| */ | |||
| private void toggleResultsList(boolean visible) { | |||
| if (visible) { | |||
| EasyBracketMain.this.resultsHeader.setVisibility(View.VISIBLE); | |||
| findViewById(R.id.View_ResHeader_Understroke).setVisibility(View.VISIBLE); | |||
| } else { | |||
| EasyBracketMain.this.resultsHeader.setVisibility(View.INVISIBLE); | |||
| findViewById(R.id.View_ResHeader_Understroke).setVisibility(View.INVISIBLE); | |||
| EasyBracketMain.this.resultList.setAdapter(null); | |||
| } | |||
| } | |||
| /** | |||
| * Sets the default values. | |||
| */ | |||
| public void setDefaults() { | |||
| this.spnDPShutterSpeed.setSelectionByVal(DEF_SHUTTER_SPEED); | |||
| this.spnDPAperture.setSelectionByVal(DEF_APERTURE); | |||
| this.spnBPShutterSpeed.setSelectionByVal(DEF_SHUTTER_SPEED); | |||
| this.spnBPAperture.setSelectionByVal(DEF_APERTURE); | |||
| this.spnCalcPAperture.setSelectionByVal(DEF_APERTURE); | |||
| this.spnCalcPEVStep.setSelectionByVal(DEF_EVSTEP); | |||
| this.txtDPEVValue.setText(DF.format(EVFormula.calcEV(this.spnDPAperture.getSelectedAperture(), | |||
| this.spnDPShutterSpeed.getSelectedShutterSpeed()))); | |||
| this.txtBPEVValue.setText(DF.format(EVFormula.calcEV(this.spnBPAperture.getSelectedAperture(), | |||
| this.spnBPShutterSpeed.getSelectedShutterSpeed()))); | |||
| this.txtCalcPDeltaEV.setText(DF.format(this.bpEV + this.bpCorrection - (this.dpEV - this.dpCorrection))); | |||
| } | |||
| /** | |||
| * Initiates the calculation of the exposure values according to the input parameters. | |||
| */ | |||
| private void calculateExposures() { | |||
| List<Exposure> exposureList; | |||
| double calcPrmAperture = this.spnCalcPAperture.getSelectedAperture(); | |||
| double calcPrmEvStep = Double.valueOf(this.spnCalcPEVStep.getSelectedItem().toString()); | |||
| List<Double> allowedShutters = getShutterSpeeds(); | |||
| exposureList = ExposureFactory.calculateExposures(this, this.dpEV - this.dpCorrection, this.bpEV + this.bpCorrection, | |||
| calcPrmAperture, calcPrmEvStep, this.fixBP, allowedShutters); | |||
| this.resultList.setAdapter(new ExposureAdapter(this, exposureList)); | |||
| DisplayMetrics metrics = new DisplayMetrics(); | |||
| getApplicationContext().getDefaultDisplay().getMetrics(metrics); | |||
| } | |||
| /** | |||
| * Retrieves the list of all shutter speeds in drop down list as Double's. | |||
| * | |||
| * @return list of all shutter speeds in drop down list as Double's | |||
| */ | |||
| private List<Double> getShutterSpeeds() { | |||
| List<Double> shutterSpeeds = new ArrayList<Double>(); | |||
| for (int i = 0; i < this.spnBPShutterSpeed.getCount(); i++) { | |||
| shutterSpeeds.add(this.spnBPShutterSpeed.getShutterSpeedAt(i)); | |||
| } | |||
| return shutterSpeeds; | |||
| } | |||
| /** | |||
| * {@inheritDoc} | |||
| */ | |||
| @Override | |||
| protected Dialog onCreateDialog(int id) { | |||
| return DialogFactory.createDialog(id, this); | |||
| } | |||
| } | |||
| @@ -0,0 +1,83 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <resources> | |||
| <string | |||
| name="app_name">Easy Bracketing</string> | |||
| <string | |||
| name="dynamic_range">Dynamikbereich</string> | |||
| <string | |||
| name="shutter_speed">Belichtungszeit</string> | |||
| <string | |||
| name="aperture">Blende</string> | |||
| <string | |||
| name="ev">LW</string> | |||
| <string | |||
| name="dark_point">Werte Dunkelpunkt</string> | |||
| <string | |||
| name="bright_point">Werte Hellpunkt</string> | |||
| <string | |||
| name="calcParams">Berechnungsparameter</string> | |||
| <string | |||
| name="delta_EV">Δ LW</string> | |||
| <string | |||
| name="expEVStep">LW-Schritt</string> | |||
| <string | |||
| name="calculate">Berechnen</string> | |||
| <string | |||
| name="reset">Zurücksetzen</string> | |||
| <string | |||
| name="bracketingRes">Bracketing Belichtungswerte</string> | |||
| <string | |||
| name="expNbrLbl"># Bel.</string> | |||
| <string | |||
| name="toastWarningDP_BP">Das Delta zwischen dem LW des Dunkelpunkt und dem LW des Hellpunkt ist kleiner oder gleich 0. | |||
| \nBitte korrigieren Sie die Eingaben.</string> | |||
| <string | |||
| name="menuUserGuide">Benutzeranleitung</string> | |||
| <string | |||
| name="menuSettings">Einstellungen...</string> | |||
| <string | |||
| name="menuAbout">Info</string> | |||
| <string | |||
| name="about_Description"> | |||
| EasyBracketing dient zur schnellen und einfachen Berechnung einer Belichtungsserie ausgehend | |||
| von den Belichtungswerten eines Dunkelpunktes und eines Hellpunktes. | |||
| </string> | |||
| <string | |||
| name="AppVersionLabel">Version:</string> | |||
| <string | |||
| name="about_DevelopedBy">Entwickelt von spherIC (F. Smilari)\nMail an: | |||
| merlin868@hotmail.com\n\nÜbersetzt von spherIC (F. Smilari)</string> | |||
| <string | |||
| name="Percent18Correction">18%-Grauwertkorrektur</string> | |||
| <string | |||
| name="Percent18CorrectionBP">Hellpunktkorrektur (LW)</string> | |||
| <string | |||
| name="Percent18CorrectionDP">Dunkelpunktkorrektur (LW)</string> | |||
| <string | |||
| name="FixRangePoint">Ausgangspunkt für Belichtungsserie</string> | |||
| <string | |||
| name="FixRangePointBP">Von Hellpunktwerten ausgehen</string> | |||
| <string | |||
| name="FixRangePointDP">Von Dunkelpunktwerten ausgehen</string> | |||
| <string | |||
| name="BtnSave">Speichern</string> | |||
| <string | |||
| name="BtnCancel">Abbrechen</string> | |||
| <string | |||
| name="BtnClose">Schliessen</string> | |||
| <string | |||
| name="header_GeneralPurpose">1. Allgm. Verwendungszweck</string> | |||
| <string | |||
| name="text_GeneralPurpose"> | |||
| Beim Erstellen einer Belichtungsreihe für ein späteres HDR-Bild, stellt sich oftmals das Problem, | |||
| dass der Kontrastumfang zu gross ist um von der typischen \"+2LW/0LW/-2LW\"-Vorgehensweise abgedeckt zu werden.\n | |||
| Hier kommt \"EasyBracketing\" zum Zug.\n\r | |||
| Ausgehend von gemessenen Werten für den hellsten Punkt resp. den dunkelsten Punkt | |||
| werden über definierbare Parameter alle notwendigen Belichtungen einer Belichtungsreihe berechnet. Diese können dann | |||
| an der Kamera sukzessive eingestellt und die Aufnahme ausgelöst werden. | |||
| </string> | |||
| <string | |||
| name="header_HowTo">2. Vorgehensweise</string> | |||
| <string | |||
| name="text_HowTo">Text here</string> | |||
| </resources> | |||
| @@ -0,0 +1,312 @@ | |||
| package ch.spherIC; | |||
| import java.text.DecimalFormat; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import android.app.Activity; | |||
| import android.app.Dialog; | |||
| import android.content.Context; | |||
| import android.content.SharedPreferences; | |||
| import android.os.Bundle; | |||
| import android.util.DisplayMetrics; | |||
| import android.view.Gravity; | |||
| import android.view.Menu; | |||
| import android.view.MenuInflater; | |||
| import android.view.MenuItem; | |||
| import android.view.View; | |||
| import android.view.View.OnClickListener; | |||
| import android.widget.AdapterView; | |||
| import android.widget.Button; | |||
| import android.widget.LinearLayout; | |||
| import android.widget.ListView; | |||
| import android.widget.TextView; | |||
| import android.widget.Toast; | |||
| import android.widget.AdapterView.OnItemSelectedListener; | |||
| import ch.spherIC.components.ApertureSpinner; | |||
| import ch.spherIC.components.ShutterSpeedSpinner; | |||
| import ch.spherIC.components.XSpinner; | |||
| import ch.spherIC.resultlist.Exposure; | |||
| import ch.spherIC.resultlist.ExposureAdapter; | |||
| import ch.spherIC.resultlist.ExposureFactory; | |||
| import ch.spherIC.settings.SettingsDlg; | |||
| /** | |||
| * Main class EasyBracketing | |||
| */ | |||
| public class EasyBracketMain extends Activity { | |||
| public static final int ABOUT_DLG = 0; | |||
| public static final int SETTINGS_DLG = 1; | |||
| public static final int USERGUIDE_DLG = 2; | |||
| private static String DEF_SHUTTER_SPEED = "1/125"; | |||
| private static String DEF_APERTURE = "f/8"; | |||
| private static String DEF_EVSTEP = "2.0"; | |||
| private ShutterSpeedSpinner spnDPShutterSpeed; | |||
| private ApertureSpinner spnDPAperture; | |||
| private ShutterSpeedSpinner spnBPShutterSpeed; | |||
| private ApertureSpinner spnBPAperture; | |||
| private TextView txtDPEVValue; | |||
| private TextView txtBPEVValue; | |||
| private TextView txtCalcPDeltaEV; | |||
| private ApertureSpinner spnCalcPAperture; | |||
| private XSpinner spnCalcPEVStep; | |||
| private Button resetBtn; | |||
| private Button calculateBtn; | |||
| private ListView resultList; | |||
| private LinearLayout resultsHeader; | |||
| private double bpCorrection; | |||
| private double dpCorrection; | |||
| private boolean fixBP; | |||
| private double dpEV; | |||
| private double bpEV; | |||
| public static final DecimalFormat DF = new DecimalFormat("0.##"); | |||
| /** | |||
| * Called when the activity is first created. | |||
| */ | |||
| @Override | |||
| public void onCreate(Bundle savedInstanceState) { | |||
| super.onCreate(savedInstanceState); | |||
| setContentView(R.layout.main); | |||
| initComponents(); | |||
| setDefaults(); | |||
| loadSettings(); | |||
| } | |||
| /** | |||
| * Loads and stores the settings | |||
| */ | |||
| public void loadSettings() { | |||
| // Load settings | |||
| SharedPreferences settings = getSharedPreferences(SettingsDlg.PREFS_NAME, Context.MODE_PRIVATE); | |||
| this.fixBP = settings.getBoolean("fixBrightPoint", true); | |||
| this.bpCorrection = settings.getFloat("brightPointCorrection", 0f); | |||
| this.dpCorrection = settings.getFloat("darkPointCorrection", 0f); | |||
| } | |||
| /** | |||
| * {@inheritDoc} | |||
| */ | |||
| @Override | |||
| public boolean onCreateOptionsMenu(Menu menu) { | |||
| super.onCreateOptionsMenu(menu); | |||
| MenuInflater inflater = getMenuInflater(); | |||
| inflater.inflate(R.menu.mainmenu, menu); | |||
| return true; | |||
| } | |||
| /** | |||
| * @see android.app.Activity#onOptionsItemSelected(android.view.MenuItem) | |||
| */ | |||
| @Override | |||
| public boolean onOptionsItemSelected(MenuItem item) { | |||
| // Handle item selection | |||
| switch (item.getItemId()) { | |||
| case R.id.itemAbout: | |||
| showDialog(ABOUT_DLG); | |||
| return true; | |||
| case R.id.itemSettings: | |||
| showDialog(SETTINGS_DLG); | |||
| return true; | |||
| case R.id.itemUserGuide: | |||
| showDialog(USERGUIDE_DLG); | |||
| return true; | |||
| default: | |||
| return super.onOptionsItemSelected(item); | |||
| } | |||
| } | |||
| /** | |||
| * Initialization method | |||
| */ | |||
| private void initComponents() { | |||
| // initialize dropdowns | |||
| OnItemSelectedListener evRangeItemSelListener = new OnItemSelectedListener() { | |||
| @Override | |||
| public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { | |||
| EasyBracketMain.this.dpEV = EVFormula.calcEV(EasyBracketMain.this.spnDPAperture.getSelectedAperture(), | |||
| EasyBracketMain.this.spnDPShutterSpeed | |||
| .getSelectedShutterSpeed()); | |||
| EasyBracketMain.this.bpEV = EVFormula.calcEV(EasyBracketMain.this.spnBPAperture.getSelectedAperture(), | |||
| EasyBracketMain.this.spnBPShutterSpeed | |||
| .getSelectedShutterSpeed()); | |||
| EasyBracketMain.this.txtDPEVValue.setText(EasyBracketMain.DF.format(EasyBracketMain.this.dpEV)); | |||
| EasyBracketMain.this.txtBPEVValue.setText(EasyBracketMain.DF.format(EasyBracketMain.this.bpEV)); | |||
| EasyBracketMain.this.txtCalcPDeltaEV.setText(EasyBracketMain.DF.format((EasyBracketMain.this.bpEV | |||
| + EasyBracketMain.this.bpCorrection) | |||
| - (EasyBracketMain.this.dpEV | |||
| - EasyBracketMain.this.dpCorrection))); | |||
| EasyBracketMain.this.calculateBtn.setEnabled(EasyBracketMain.this.bpEV > EasyBracketMain.this.dpEV); | |||
| EasyBracketMain.this.resultsHeader.setVisibility(View.INVISIBLE); | |||
| findViewById(R.id.View_ResHeader_Understroke).setVisibility(View.INVISIBLE); | |||
| EasyBracketMain.this.resultList.setAdapter(null); | |||
| if (EasyBracketMain.this.bpEV < EasyBracketMain.this.dpEV) { | |||
| Toast toast = Toast.makeText(EasyBracketMain.this, R.string.toastWarningDP_BP, Toast.LENGTH_LONG); | |||
| toast.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL, 0, 0); | |||
| toast.show(); | |||
| } | |||
| } | |||
| @Override | |||
| public void onNothingSelected(AdapterView<?> parent) { | |||
| } | |||
| }; | |||
| OnItemSelectedListener calcPItemSelListener = new OnItemSelectedListener() { | |||
| @Override | |||
| public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { | |||
| toggleResultsList(false); | |||
| } | |||
| @Override | |||
| public void onNothingSelected(AdapterView<?> parent) { | |||
| } | |||
| }; | |||
| this.spnDPShutterSpeed = (ShutterSpeedSpinner) findViewById(R.id.Spinner_DP_Shutter); | |||
| this.spnDPAperture = (ApertureSpinner) findViewById(R.id.Spinner_DP_Aperture); | |||
| this.spnBPShutterSpeed = (ShutterSpeedSpinner) findViewById(R.id.Spinner_BP_Shutter); | |||
| this.spnBPAperture = (ApertureSpinner) findViewById(R.id.Spinner_BP_Aperture); | |||
| this.spnCalcPAperture = (ApertureSpinner) findViewById(R.id.Spinner_calcP_Aperture); | |||
| this.spnCalcPEVStep = (XSpinner) findViewById(R.id.Spinner_calcP_EVStep); | |||
| this.txtDPEVValue = (TextView) findViewById(R.id.Text_EVVal_DP); | |||
| this.txtBPEVValue = (TextView) findViewById(R.id.Text_EVVal_BP); | |||
| this.txtCalcPDeltaEV = (TextView) findViewById(R.id.label_deltaEV_Val); | |||
| this.resultsHeader = (LinearLayout) ExposureAdapter.getHeaderView(this, | |||
| (LinearLayout) | |||
| findViewById(R.id.LinearLayout_ResultsHeader)); | |||
| this.resultsHeader.setVisibility(View.INVISIBLE); | |||
| findViewById(R.id.View_ResHeader_Understroke).setVisibility(View.INVISIBLE); | |||
| this.resultList = (ListView) findViewById(R.id.ListView_ExpResults); | |||
| this.resultList.setAdapter(null); | |||
| this.resetBtn = (Button) findViewById(R.id.Btn_Reset); | |||
| this.calculateBtn = (Button) findViewById(R.id.Btn_Calculate); | |||
| this.calculateBtn.setEnabled(false); | |||
| this.spnDPShutterSpeed.setOnItemSelectedListener(evRangeItemSelListener); | |||
| this.spnDPAperture.setOnItemSelectedListener(evRangeItemSelListener); | |||
| this.spnBPShutterSpeed.setOnItemSelectedListener(evRangeItemSelListener); | |||
| this.spnBPAperture.setOnItemSelectedListener(evRangeItemSelListener); | |||
| this.resetBtn.setOnClickListener(new OnClickListener() { | |||
| @Override | |||
| public void onClick(View v) { | |||
| setDefaults(); | |||
| toggleResultsList(false); | |||
| } | |||
| }); | |||
| this.calculateBtn.setOnClickListener(new OnClickListener() { | |||
| @Override | |||
| public void onClick(View v) { | |||
| toggleResultsList(true); | |||
| calculateExposures(); | |||
| } | |||
| }); | |||
| this.spnCalcPAperture.setOnItemSelectedListener(calcPItemSelListener); | |||
| this.spnCalcPEVStep.setOnItemSelectedListener(calcPItemSelListener); | |||
| } | |||
| /** | |||
| * Clears the results list. | |||
| */ | |||
| private void toggleResultsList(boolean visible) { | |||
| if (visible) { | |||
| EasyBracketMain.this.resultsHeader.setVisibility(View.VISIBLE); | |||
| findViewById(R.id.View_ResHeader_Understroke).setVisibility(View.VISIBLE); | |||
| } else { | |||
| EasyBracketMain.this.resultsHeader.setVisibility(View.INVISIBLE); | |||
| findViewById(R.id.View_ResHeader_Understroke).setVisibility(View.INVISIBLE); | |||
| EasyBracketMain.this.resultList.setAdapter(null); | |||
| } | |||
| } | |||
| /** | |||
| * Sets the default values. | |||
| */ | |||
| public void setDefaults() { | |||
| this.spnDPShutterSpeed.setSelectionByVal(DEF_SHUTTER_SPEED); | |||
| this.spnDPAperture.setSelectionByVal(DEF_APERTURE); | |||
| this.spnBPShutterSpeed.setSelectionByVal(DEF_SHUTTER_SPEED); | |||
| this.spnBPAperture.setSelectionByVal(DEF_APERTURE); | |||
| this.spnCalcPAperture.setSelectionByVal(DEF_APERTURE); | |||
| this.spnCalcPEVStep.setSelectionByVal(DEF_EVSTEP); | |||
| this.txtDPEVValue.setText(DF.format(EVFormula.calcEV(this.spnDPAperture.getSelectedAperture(), | |||
| this.spnDPShutterSpeed.getSelectedShutterSpeed()))); | |||
| this.txtBPEVValue.setText(DF.format(EVFormula.calcEV(this.spnBPAperture.getSelectedAperture(), | |||
| this.spnBPShutterSpeed.getSelectedShutterSpeed()))); | |||
| this.txtCalcPDeltaEV.setText(DF.format(this.bpEV + this.bpCorrection - (this.dpEV - this.dpCorrection))); | |||
| } | |||
| /** | |||
| * Initiates the calculation of the exposure values according to the input parameters. | |||
| */ | |||
| private void calculateExposures() { | |||
| List<Exposure> exposureList; | |||
| double calcPrmAperture = this.spnCalcPAperture.getSelectedAperture(); | |||
| double calcPrmEvStep = Double.valueOf(this.spnCalcPEVStep.getSelectedItem().toString()); | |||
| List<Double> allowedShutters = getShutterSpeeds(); | |||
| exposureList = ExposureFactory.calculateExposures(this, this.dpEV - this.dpCorrection, | |||
| this.bpEV + this.bpCorrection, calcPrmAperture, calcPrmEvStep, | |||
| this.fixBP, allowedShutters); | |||
| this.resultList.setAdapter(new ExposureAdapter(this, exposureList)); | |||
| } | |||
| /** | |||
| * Retrieves the list of all shutter speeds in drop down list as Double's. | |||
| * | |||
| * @return list of all shutter speeds in drop down list as Double's | |||
| */ | |||
| private List<Double> getShutterSpeeds() { | |||
| List<Double> shutterSpeeds = new ArrayList<Double>(); | |||
| for (int i = 0; i < this.spnBPShutterSpeed.getCount(); i++) { | |||
| shutterSpeeds.add(this.spnBPShutterSpeed.getShutterSpeedAt(i)); | |||
| } | |||
| return shutterSpeeds; | |||
| } | |||
| /** | |||
| * {@inheritDoc} | |||
| */ | |||
| @Override | |||
| protected Dialog onCreateDialog(int id) { | |||
| return DialogFactory.createDialog(id, this); | |||
| } | |||
| } | |||
| @@ -0,0 +1,66 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <resources> | |||
| <string | |||
| name="app_name">Easy Bracketing</string> | |||
| <string | |||
| name="dynamic_range">Dynamic Range</string> | |||
| <string | |||
| name="shutter_speed">Shutter Speed</string> | |||
| <string | |||
| name="aperture">Aperture</string> | |||
| <string | |||
| name="ev">EV</string> | |||
| <string | |||
| name="dark_point">Dark Point Values</string> | |||
| <string | |||
| name="bright_point">Bright Point Values</string> | |||
| <string | |||
| name="calcParams">Calculation Parameters</string> | |||
| <string | |||
| name="delta_EV">Δ EV</string> | |||
| <string | |||
| name="expEVStep">EV Step</string> | |||
| <string | |||
| name="calculate">Calculate</string> | |||
| <string | |||
| name="reset">Reset</string> | |||
| <string | |||
| name="bracketingRes">Bracketing Exposures Values</string> | |||
| <string | |||
| name="expNbrLbl"># Exp.</string> | |||
| <string | |||
| name="toastWarningDP_BP">The delta between dark point EV and bright point EV is less or | |||
| equal to 0. Please correct the inputs.</string> | |||
| <string | |||
| name="menuUserGuide">User Guide</string> | |||
| <string | |||
| name="menuSettings">Settings...</string> | |||
| <string | |||
| name="menuAbout">About</string> | |||
| <string | |||
| name="about_Description">EasyBracketing allows you to easy calculate a serie of exposure | |||
| values according to initial dark and bright point values.</string> | |||
| <string | |||
| name="AppVersionLabel">Version:</string> | |||
| <string | |||
| name="about_DevelopedBy">Developed by spherIC (F. Smilari)\nMail to: | |||
| merlin868@hotmail.com\n\nTranslated by spherIC (F. Smilari)</string> | |||
| <string | |||
| name="Percent18Correction">18%-Gray Correction</string> | |||
| <string | |||
| name="Percent18CorrectionBP">Bright Pt. Value Correction (EV)</string> | |||
| <string | |||
| name="Percent18CorrectionDP">Dark Pt. Value Correction (EV)</string> | |||
| <string | |||
| name="FixRangePoint">Fixed EV Range Value</string> | |||
| <string | |||
| name="FixRangePointBP">Keep Bright Point Values fixed</string> | |||
| <string | |||
| name="FixRangePointDP">Keep Dark Point Value fixed</string> | |||
| <string | |||
| name="BtnSave">Save</string> | |||
| <string | |||
| name="BtnCancel">Cancel</string> | |||
| <string | |||
| name="userGuidePourpose">text alsdklsk lkds las laskd laskd laskd aksdl askd laksdlasklsakdlaskdlakdl alasdk laksdlaskd laskdlaskd lakdskkskdk las lskdlaskdls ldklas lsakdlakdlaskd alsdklaksd alksdlakd laskdlasdk.</string> | |||
| </resources> | |||
| @@ -0,0 +1,242 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC.resultlist; | |||
| import java.util.List; | |||
| import android.app.Activity; | |||
| import android.content.Context; | |||
| import android.util.DisplayMetrics; | |||
| import android.view.Gravity; | |||
| import android.view.View; | |||
| import android.view.ViewGroup; | |||
| import android.widget.BaseAdapter; | |||
| import android.widget.ImageView; | |||
| import android.widget.LinearLayout; | |||
| import android.widget.TextView; | |||
| import android.widget.LinearLayout.LayoutParams; | |||
| import ch.spherIC.R; | |||
| /** | |||
| * Exposure adapter view class. | |||
| */ | |||
| class ExposureAdapterView extends LinearLayout { | |||
| private static DisplayMetrics metrics; | |||
| /** | |||
| * Creates a new ExposureAdapterView object. | |||
| * | |||
| * @param context DOCUMENT ME! | |||
| * @param weather DOCUMENT ME! | |||
| */ | |||
| public ExposureAdapterView(Context context, Exposure exposure) { | |||
| super(context); | |||
| this.setOrientation(HORIZONTAL); | |||
| // Nbr | |||
| TextView nbrControl = new TextView(context); | |||
| LinearLayout.LayoutParams nbrParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| nbrParams.setMargins(3, 1, 1, 1); | |||
| nbrControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| nbrControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| nbrControl.setText(Integer.toString(exposure.getNbr())); | |||
| addView(nbrControl, nbrParams); | |||
| // Aperture | |||
| TextView apertureControl = new TextView(context); | |||
| LinearLayout.LayoutParams apertureParams = new LinearLayout.LayoutParams(100, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| apertureParams.setMargins(1, 1, 1, 1); | |||
| apertureControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| apertureControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| apertureControl.setText(exposure.getAperture()); | |||
| addView(apertureControl, apertureParams); | |||
| // Shutter speed | |||
| TextView shutterControl = new TextView(context); | |||
| LinearLayout.LayoutParams shutterParams = new LinearLayout.LayoutParams(170, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| shutterParams.setMargins(1, 1, 1, 1); | |||
| shutterControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| shutterControl.setTextAppearance(context, R.style.ResultExposureTextSpecial); | |||
| shutterControl.setText(exposure.getShutterSpeed()); | |||
| addView(shutterControl, shutterParams); | |||
| // EV Step | |||
| TextView evStepControl = new TextView(context); | |||
| LinearLayout.LayoutParams evStepParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| evStepParams.setMargins(1, 1, 1, 1); | |||
| evStepControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| evStepControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| evStepControl.setText(exposure.getEvStepAsString()); | |||
| addView(evStepControl, evStepParams); | |||
| // Icon | |||
| ImageView expIconControl = new ImageView(context); | |||
| LinearLayout.LayoutParams expIconParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| expIconParams.setMargins(1, 1, 1, 1); | |||
| expIconControl.setImageBitmap(exposure.getEvStepBtmp()); | |||
| addView(expIconControl, expIconParams); | |||
| } | |||
| } | |||
| /** | |||
| * Exposure results adapter. | |||
| */ | |||
| public class ExposureAdapter extends BaseAdapter { | |||
| private static DisplayMetrics metrics; | |||
| private Context context; | |||
| private List<Exposure> exposureList; | |||
| /** | |||
| * Creates a new ExposureAdapter object. | |||
| */ | |||
| public ExposureAdapter(Context context, List<Exposure> expList) { | |||
| this.context = context; | |||
| this.exposureList = expList; | |||
| } | |||
| /** | |||
| * Retrieves list size. | |||
| * | |||
| * @return list size | |||
| */ | |||
| @Override | |||
| public int getCount() { | |||
| return this.exposureList.size(); | |||
| } | |||
| /** | |||
| * Retrieves the exposure at index <code>position</code>. | |||
| * | |||
| * @param position Index in list | |||
| * | |||
| * @return Exposure at index <code>position</code> | |||
| */ | |||
| @Override | |||
| public Object getItem(int position) { | |||
| return this.exposureList.get(position); | |||
| } | |||
| /** | |||
| * Retrieves the number of the exposure at index <code>position</code>. | |||
| * | |||
| * @param position Index in list | |||
| * | |||
| * @return the number of the exposure at index <code>position</code> | |||
| */ | |||
| @Override | |||
| public long getItemId(int position) { | |||
| //return this.exposureList.get(position).getNbr(); | |||
| return position; | |||
| } | |||
| /** | |||
| * Retrieves a view representing a single result row. | |||
| * | |||
| * @param position Index in list | |||
| * @param convertView view | |||
| * @param parent parent | |||
| * | |||
| * @return {@link ExposureAdapterView} | |||
| */ | |||
| @Override | |||
| public View getView(int position, View convertView, ViewGroup parent) { | |||
| Exposure exposure = this.exposureList.get(position); | |||
| return new ExposureAdapterView(this.context, exposure); | |||
| } | |||
| /** | |||
| * Retrieves the value of | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| public static View getHeaderView(Context context, LinearLayout headerLL) { | |||
| int black = headerLL.getResources().getColor(R.color.black); | |||
| int width = getMetrics(context).widthPixels; | |||
| // Nbr | |||
| TextView nbrControl = new TextView(context); | |||
| LinearLayout.LayoutParams nbrParams = new LinearLayout.LayoutParams(Math.round(0.14583f * width), | |||
| LayoutParams.WRAP_CONTENT, 0.2f); | |||
| nbrParams.setMargins(3, 1, 1, 1); | |||
| nbrControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| nbrControl.setTextSize(13f); | |||
| nbrControl.setTextColor(black); | |||
| nbrControl.setText(R.string.expNbrLbl); | |||
| headerLL.addView(nbrControl, nbrParams); | |||
| // Aperture | |||
| TextView apertureControl = new TextView(context); | |||
| LinearLayout.LayoutParams apertureParams = new LinearLayout.LayoutParams(Math.round(0.20833f * width), | |||
| LayoutParams.WRAP_CONTENT, 0.2f); | |||
| apertureParams.setMargins(1, 1, 1, 1); | |||
| apertureControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| apertureControl.setTextSize(13f); | |||
| apertureControl.setTextColor(black); | |||
| apertureControl.setText(R.string.aperture); | |||
| headerLL.addView(apertureControl, apertureParams); | |||
| // Shutter speed | |||
| TextView shutterControl = new TextView(context); | |||
| LinearLayout.LayoutParams shutterParams = new LinearLayout.LayoutParams(170, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| shutterParams.setMargins(1, 1, 1, 1); | |||
| shutterControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| shutterControl.setTextSize(13f); | |||
| shutterControl.setTextColor(black); | |||
| shutterControl.setText(R.string.shutter_speed); | |||
| headerLL.addView(shutterControl, shutterParams); | |||
| // EV Step | |||
| TextView evStepControl = new TextView(context); | |||
| LinearLayout.LayoutParams evStepParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| evStepParams.setMargins(1, 1, 1, 1); | |||
| evStepControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| evStepControl.setTextSize(13f); | |||
| evStepControl.setTextColor(black); | |||
| evStepControl.setText(R.string.expEVStep); | |||
| headerLL.addView(evStepControl, evStepParams); | |||
| // Icon | |||
| ImageView expIconControl = new ImageView(context); | |||
| LinearLayout.LayoutParams expIconParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| expIconParams.setMargins(1, 1, 1, 1); | |||
| headerLL.addView(expIconControl, expIconParams); | |||
| return headerLL; | |||
| } | |||
| /** | |||
| * Retrieves the value of | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| private static DisplayMetrics getMetrics(Context context) { | |||
| if (metrics == null) { | |||
| metrics = new DisplayMetrics(); | |||
| ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(metrics); | |||
| } | |||
| return metrics; | |||
| } | |||
| } | |||
| @@ -0,0 +1,243 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC.resultlist; | |||
| import java.util.List; | |||
| import android.app.Activity; | |||
| import android.content.Context; | |||
| import android.util.DisplayMetrics; | |||
| import android.view.Gravity; | |||
| import android.view.View; | |||
| import android.view.ViewGroup; | |||
| import android.widget.BaseAdapter; | |||
| import android.widget.ImageView; | |||
| import android.widget.LinearLayout; | |||
| import android.widget.TextView; | |||
| import android.widget.LinearLayout.LayoutParams; | |||
| import ch.spherIC.R; | |||
| /** | |||
| * Exposure adapter view class. | |||
| */ | |||
| class ExposureAdapterView extends LinearLayout { | |||
| private static DisplayMetrics metrics; | |||
| /** | |||
| * Creates a new ExposureAdapterView object. | |||
| * | |||
| * @param context DOCUMENT ME! | |||
| * @param weather DOCUMENT ME! | |||
| */ | |||
| public ExposureAdapterView(Context context, Exposure exposure) { | |||
| super(context); | |||
| this.setOrientation(HORIZONTAL); | |||
| // Nbr | |||
| TextView nbrControl = new TextView(context); | |||
| LinearLayout.LayoutParams nbrParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| nbrParams.setMargins(3, 1, 1, 1); | |||
| nbrControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| nbrControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| nbrControl.setText(Integer.toString(exposure.getNbr())); | |||
| addView(nbrControl, nbrParams); | |||
| // Aperture | |||
| TextView apertureControl = new TextView(context); | |||
| LinearLayout.LayoutParams apertureParams = new LinearLayout.LayoutParams(100, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| apertureParams.setMargins(1, 1, 1, 1); | |||
| apertureControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| apertureControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| apertureControl.setText(exposure.getAperture()); | |||
| addView(apertureControl, apertureParams); | |||
| // Shutter speed | |||
| TextView shutterControl = new TextView(context); | |||
| LinearLayout.LayoutParams shutterParams = new LinearLayout.LayoutParams(170, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| shutterParams.setMargins(1, 1, 1, 1); | |||
| shutterControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| shutterControl.setTextAppearance(context, R.style.ResultExposureTextSpecial); | |||
| shutterControl.setText(exposure.getShutterSpeed()); | |||
| addView(shutterControl, shutterParams); | |||
| // EV Step | |||
| TextView evStepControl = new TextView(context); | |||
| LinearLayout.LayoutParams evStepParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| evStepParams.setMargins(1, 1, 1, 1); | |||
| evStepControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| evStepControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| evStepControl.setText(exposure.getEvStepAsString()); | |||
| addView(evStepControl, evStepParams); | |||
| // Icon | |||
| ImageView expIconControl = new ImageView(context); | |||
| LinearLayout.LayoutParams expIconParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| expIconParams.setMargins(1, 1, 1, 1); | |||
| expIconControl.setImageBitmap(exposure.getEvStepBtmp()); | |||
| addView(expIconControl, expIconParams); | |||
| } | |||
| } | |||
| /** | |||
| * Exposure results adapter. | |||
| */ | |||
| public class ExposureAdapter extends BaseAdapter { | |||
| private static DisplayMetrics metrics; | |||
| private Context context; | |||
| private List<Exposure> exposureList; | |||
| /** | |||
| * Creates a new ExposureAdapter object. | |||
| */ | |||
| public ExposureAdapter(Context context, List<Exposure> expList) { | |||
| this.context = context; | |||
| this.exposureList = expList; | |||
| } | |||
| /** | |||
| * Retrieves list size. | |||
| * | |||
| * @return list size | |||
| */ | |||
| @Override | |||
| public int getCount() { | |||
| return this.exposureList.size(); | |||
| } | |||
| /** | |||
| * Retrieves the exposure at index <code>position</code>. | |||
| * | |||
| * @param position Index in list | |||
| * | |||
| * @return Exposure at index <code>position</code> | |||
| */ | |||
| @Override | |||
| public Object getItem(int position) { | |||
| return this.exposureList.get(position); | |||
| } | |||
| /** | |||
| * Retrieves the number of the exposure at index <code>position</code>. | |||
| * | |||
| * @param position Index in list | |||
| * | |||
| * @return the number of the exposure at index <code>position</code> | |||
| */ | |||
| @Override | |||
| public long getItemId(int position) { | |||
| //return this.exposureList.get(position).getNbr(); | |||
| return position; | |||
| } | |||
| /** | |||
| * Retrieves a view representing a single result row. | |||
| * | |||
| * @param position Index in list | |||
| * @param convertView view | |||
| * @param parent parent | |||
| * | |||
| * @return {@link ExposureAdapterView} | |||
| */ | |||
| @Override | |||
| public View getView(int position, View convertView, ViewGroup parent) { | |||
| Exposure exposure = this.exposureList.get(position); | |||
| return new ExposureAdapterView(this.context, exposure); | |||
| } | |||
| /** | |||
| * Retrieves the value of | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| public static View getHeaderView(Context context, LinearLayout headerLL) { | |||
| int black = headerLL.getResources().getColor(R.color.black); | |||
| int width = getMetrics(context).widthPixels; | |||
| // Nbr | |||
| TextView nbrControl = new TextView(context); | |||
| LinearLayout.LayoutParams nbrParams = new LinearLayout.LayoutParams(Math.round(0.14583f * width), | |||
| LayoutParams.WRAP_CONTENT, 0.2f); | |||
| nbrParams.setMargins(3, 1, 1, 1); | |||
| nbrControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| nbrControl.setTextSize(13f); | |||
| nbrControl.setTextColor(black); | |||
| nbrControl.setText(R.string.expNbrLbl); | |||
| headerLL.addView(nbrControl, nbrParams); | |||
| // Aperture | |||
| TextView apertureControl = new TextView(context); | |||
| LinearLayout.LayoutParams apertureParams = new LinearLayout.LayoutParams(Math.round(0.20833f * width), | |||
| LayoutParams.WRAP_CONTENT, 0.2f); | |||
| apertureParams.setMargins(1, 1, 1, 1); | |||
| apertureControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| apertureControl.setTextSize(13f); | |||
| apertureControl.setTextColor(black); | |||
| apertureControl.setText(R.string.aperture); | |||
| headerLL.addView(apertureControl, apertureParams); | |||
| // Shutter speed | |||
| TextView shutterControl = new TextView(context); | |||
| LinearLayout.LayoutParams shutterParams = new LinearLayout.LayoutParams(170, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| shutterParams.setMargins(1, 1, 1, 1); | |||
| shutterControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| shutterControl.setTextSize(13f); | |||
| shutterControl.setTextColor(black); | |||
| shutterControl.setText(R.string.shutter_speed); | |||
| headerLL.addView(shutterControl, shutterParams); | |||
| // EV Step | |||
| TextView evStepControl = new TextView(context); | |||
| LinearLayout.LayoutParams evStepParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| evStepParams.setMargins(1, 1, 1, 1); | |||
| evStepControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| evStepControl.setTextSize(13f); | |||
| evStepControl.setTextColor(black); | |||
| evStepControl.setText(R.string.expEVStep); | |||
| headerLL.addView(evStepControl, evStepParams); | |||
| // Icon | |||
| ImageView expIconControl = new ImageView(context); | |||
| LinearLayout.LayoutParams expIconParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| expIconParams.setMargins(1, 1, 1, 1); | |||
| headerLL.addView(expIconControl, expIconParams); | |||
| return headerLL; | |||
| } | |||
| /** | |||
| * Retrieves the value of | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| private static DisplayMetrics getMetrics(Context context) { | |||
| if (metrics == null) { | |||
| metrics = new DisplayMetrics(); | |||
| ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(metrics); | |||
| } | |||
| return metrics; | |||
| } | |||
| } | |||
| @@ -0,0 +1,155 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC; | |||
| import android.app.Activity; | |||
| import android.app.Dialog; | |||
| import android.content.pm.PackageInfo; | |||
| import android.content.pm.PackageManager; | |||
| import android.content.pm.PackageManager.NameNotFoundException; | |||
| import android.view.View; | |||
| import android.view.View.OnClickListener; | |||
| import android.widget.Button; | |||
| import android.widget.ImageView; | |||
| import android.widget.TextView; | |||
| import ch.spherIC.settings.SettingsDlg; | |||
| /** | |||
| * Dialog factory class. | |||
| */ | |||
| public final class DialogFactory { | |||
| /** | |||
| * Static main method to initialize classes | |||
| * | |||
| * @param dlgCode Code of dialog to instantiate. See {@link EasyBracketMain} | |||
| * @param parent Parent {@link Activity} | |||
| * | |||
| * @return Instantiated dialog | |||
| */ | |||
| public static Dialog createDialog(int dlgCode, Activity parent) { | |||
| Dialog dlg; | |||
| switch (dlgCode) { | |||
| case EasyBracketMain.ABOUT_DLG: | |||
| dlg = createAboutDialog(parent); | |||
| break; | |||
| case EasyBracketMain.SETTINGS_DLG: | |||
| dlg = createSettingsDialog(parent); | |||
| break; | |||
| case EasyBracketMain.USERGUIDE_DLG: | |||
| dlg = createUserGuideDialog(parent); | |||
| break; | |||
| default: | |||
| dlg = null; | |||
| break; | |||
| } | |||
| return dlg; | |||
| } | |||
| /** | |||
| * Creates the About Dialog | |||
| */ | |||
| private static Dialog createAboutDialog(Activity parent) { | |||
| final Dialog dialog = new Dialog(parent); | |||
| dialog.setContentView(R.layout.about_dialog); | |||
| parent.getResources().getText(R.string.menuAbout); | |||
| dialog.setTitle(parent.getResources().getText(R.string.menuAbout) + " EasyBracketing..."); | |||
| ImageView image = (ImageView) dialog.findViewById(R.id.about_imageAppIcon); | |||
| image.setImageResource(R.drawable.icon); | |||
| TextView text = (TextView) dialog.findViewById(R.id.about_TextDescription); | |||
| text.setText(parent.getResources().getText(R.string.about_Description)); | |||
| text = (TextView) dialog.findViewById(R.id.about_TextVersion); | |||
| text.setText(parent.getResources().getText(R.string.AppVersionLabel).toString() | |||
| + " " + parent.getResources().getText(R.string.AppVersion).toString()); | |||
| text = (TextView) dialog.findViewById(R.id.about_TextAutor); | |||
| text.setText(parent.getResources().getText(R.string.about_DevelopedBy).toString()); | |||
| ((Button) dialog.findViewById(R.id.btn_AboutClose)).setOnClickListener(new OnClickListener() { | |||
| @Override | |||
| public void onClick(View v) { | |||
| dialog.dismiss(); | |||
| } | |||
| }); | |||
| return dialog; | |||
| } | |||
| /** | |||
| * Creates the Settings Dialog | |||
| */ | |||
| private static Dialog createSettingsDialog(Activity parent) { | |||
| final Dialog dialog = new SettingsDlg(parent); | |||
| return dialog; | |||
| } | |||
| /** | |||
| * Creates the User Guide Dialog | |||
| */ | |||
| private static Dialog createUserGuideDialog(Activity parent) { | |||
| String versionName = ""; | |||
| final Dialog dialog = new Dialog(parent); | |||
| dialog.setContentView(R.layout.userguide_dialog); | |||
| parent.getResources().getText(R.string.menuUserGuide); | |||
| dialog.setTitle(parent.getResources().getText(R.string.menuUserGuide)); | |||
| ImageView image = (ImageView) dialog.findViewById(R.id.ug_imageAppIcon); | |||
| image.setImageResource(R.drawable.icon); | |||
| try { | |||
| versionName = parent.getPackageManager().getPackageInfo("ch.spherIC", PackageManager.GET_CONFIGURATIONS) | |||
| .versionName; | |||
| } catch (NameNotFoundException e) { | |||
| versionName = "-"; | |||
| } | |||
| TextView text = (TextView) dialog.findViewById(R.id.ug_TextVersion); | |||
| text.setText(parent.getResources().getText(R.string.AppVersionLabel).toString() | |||
| + " " | |||
| + parent.getPackageManager().getPackageInfo("ch.spherIC", PackageManager.GET_CONFIGURATIONS).versionName); | |||
| ((Button) dialog.findViewById(R.id.btn_ugClose)).setOnClickListener(new OnClickListener() { | |||
| @Override | |||
| public void onClick(View v) { | |||
| dialog.dismiss(); | |||
| } | |||
| }); | |||
| return dialog; | |||
| } | |||
| } | |||
| @@ -0,0 +1,66 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <resources> | |||
| <string | |||
| name="app_name">Easy Bracketing</string> | |||
| <string | |||
| name="dynamic_range">Dynamic Range</string> | |||
| <string | |||
| name="shutter_speed">Shutter Speed</string> | |||
| <string | |||
| name="aperture">Aperture</string> | |||
| <string | |||
| name="ev">EV</string> | |||
| <string | |||
| name="dark_point">Dark Point Values</string> | |||
| <string | |||
| name="bright_point">Bright Point Values</string> | |||
| <string | |||
| name="calcParams">Calculation Parameters</string> | |||
| <string | |||
| name="delta_EV">Δ EV</string> | |||
| <string | |||
| name="expEVStep">EV Step</string> | |||
| <string | |||
| name="calculate">Calculate</string> | |||
| <string | |||
| name="reset">Reset</string> | |||
| <string | |||
| name="bracketingRes">Bracketing Exposures Values</string> | |||
| <string | |||
| name="expNbrLbl"># Exp.</string> | |||
| <string | |||
| name="toastWarningDP_BP">The delta between dark point EV and bright point EV is less or | |||
| equal to 0. Please correct the inputs.</string> | |||
| <string | |||
| name="menuUserGuide">User Guide</string> | |||
| <string | |||
| name="menuSettings">Settings...</string> | |||
| <string | |||
| name="menuAbout">About</string> | |||
| <string | |||
| name="about_Description">EasyBracketing allows you to easy calculate a serie of exposure | |||
| values according to initial dark and bright point values.</string> | |||
| <string | |||
| name="AppVersionLabel">Version:</string> | |||
| <string | |||
| name="about_DevelopedBy">Developed by spherIC (F. Smilari)\nMail to: | |||
| merlin868@hotmail.com\n\nTranslated by spherIC (F. Smilari)</string> | |||
| <string | |||
| name="Percent18Correction">18%-Gray Correction</string> | |||
| <string | |||
| name="Percent18CorrectionBP">Bright Pt. Value Correction (EV)</string> | |||
| <string | |||
| name="Percent18CorrectionDP">Dark Pt. Value Correction (EV)</string> | |||
| <string | |||
| name="FixRangePoint">Fixed EV Range Value</string> | |||
| <string | |||
| name="FixRangePointBP">Keep Bright Point Values fixed</string> | |||
| <string | |||
| name="FixRangePointDP">Keep Dark Point Value fixed</string> | |||
| <string | |||
| name="BtnSave">Save</string> | |||
| <string | |||
| name="BtnCancel">Cancel</string> | |||
| <string | |||
| name="userGuidePourpose">text alsdklsk lkds las laskd laskd laskd. aksdl askd laksdlasklsakdlaskdlakdl alasdk laksdlaskd laskdlaskd lakdskkskdk las lskdlaskdls ldklas lsakdlakdlaskd alsdklaksd alksdlakd laskdlasdk. aksdl askd laksdlasklsakdlaskdlakdl alasdk laksdlaskd laskdlaskd lakdskkskdk las lskdlaskdls ldklas lsakdlakdlaskd alsdklaksd alksdlakd laskdlasdk. aksdl askd laksdlasklsakdlaskdlakdl alasdk laksdlaskd laskdlaskd lakdskkskdk las lskdlaskdls ldklas lsakdlakdlaskd alsdklaksd alksdlakd laskdlasdk.</string> | |||
| </resources> | |||
| @@ -0,0 +1,315 @@ | |||
| package ch.spherIC; | |||
| import java.text.DecimalFormat; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import android.app.Activity; | |||
| import android.app.Dialog; | |||
| import android.content.Context; | |||
| import android.content.SharedPreferences; | |||
| import android.os.Bundle; | |||
| import android.util.DisplayMetrics; | |||
| import android.view.Gravity; | |||
| import android.view.Menu; | |||
| import android.view.MenuInflater; | |||
| import android.view.MenuItem; | |||
| import android.view.View; | |||
| import android.view.View.OnClickListener; | |||
| import android.widget.AdapterView; | |||
| import android.widget.Button; | |||
| import android.widget.LinearLayout; | |||
| import android.widget.ListView; | |||
| import android.widget.TextView; | |||
| import android.widget.Toast; | |||
| import android.widget.AdapterView.OnItemSelectedListener; | |||
| import ch.spherIC.components.ApertureSpinner; | |||
| import ch.spherIC.components.ShutterSpeedSpinner; | |||
| import ch.spherIC.components.XSpinner; | |||
| import ch.spherIC.resultlist.Exposure; | |||
| import ch.spherIC.resultlist.ExposureAdapter; | |||
| import ch.spherIC.resultlist.ExposureFactory; | |||
| import ch.spherIC.settings.SettingsDlg; | |||
| /** | |||
| * Main class EasyBracketing | |||
| */ | |||
| public class EasyBracketMain extends Activity { | |||
| public static final int ABOUT_DLG = 0; | |||
| public static final int SETTINGS_DLG = 1; | |||
| public static final int USERGUIDE_DLG = 2; | |||
| private static String DEF_SHUTTER_SPEED = "1/125"; | |||
| private static String DEF_APERTURE = "f/8"; | |||
| private static String DEF_EVSTEP = "2.0"; | |||
| private ShutterSpeedSpinner spnDPShutterSpeed; | |||
| private ApertureSpinner spnDPAperture; | |||
| private ShutterSpeedSpinner spnBPShutterSpeed; | |||
| private ApertureSpinner spnBPAperture; | |||
| private TextView txtDPEVValue; | |||
| private TextView txtBPEVValue; | |||
| private TextView txtCalcPDeltaEV; | |||
| private ApertureSpinner spnCalcPAperture; | |||
| private XSpinner spnCalcPEVStep; | |||
| private Button resetBtn; | |||
| private Button calculateBtn; | |||
| private ListView resultList; | |||
| private LinearLayout resultsHeader; | |||
| private double bpCorrection; | |||
| private double dpCorrection; | |||
| private boolean fixBP; | |||
| private double dpEV; | |||
| private double bpEV; | |||
| public static final DecimalFormat DF = new DecimalFormat("0.##"); | |||
| /** | |||
| * Called when the activity is first created. | |||
| */ | |||
| @Override | |||
| public void onCreate(Bundle savedInstanceState) { | |||
| super.onCreate(savedInstanceState); | |||
| setContentView(R.layout.main); | |||
| initComponents(); | |||
| setDefaults(); | |||
| loadSettings(); | |||
| } | |||
| /** | |||
| * Loads and stores the settings | |||
| */ | |||
| public void loadSettings() { | |||
| // Load settings | |||
| SharedPreferences settings = getSharedPreferences(SettingsDlg.PREFS_NAME, Context.MODE_PRIVATE); | |||
| this.fixBP = settings.getBoolean("fixBrightPoint", true); | |||
| this.bpCorrection = settings.getFloat("brightPointCorrection", 0f); | |||
| this.dpCorrection = settings.getFloat("darkPointCorrection", 0f); | |||
| } | |||
| /** | |||
| * {@inheritDoc} | |||
| */ | |||
| @Override | |||
| public boolean onCreateOptionsMenu(Menu menu) { | |||
| super.onCreateOptionsMenu(menu); | |||
| MenuInflater inflater = getMenuInflater(); | |||
| inflater.inflate(R.menu.mainmenu, menu); | |||
| return true; | |||
| } | |||
| /** | |||
| * @see android.app.Activity#onOptionsItemSelected(android.view.MenuItem) | |||
| */ | |||
| @Override | |||
| public boolean onOptionsItemSelected(MenuItem item) { | |||
| // Handle item selection | |||
| switch (item.getItemId()) { | |||
| case R.id.itemAbout: | |||
| showDialog(ABOUT_DLG); | |||
| return true; | |||
| case R.id.itemSettings: | |||
| showDialog(SETTINGS_DLG); | |||
| return true; | |||
| case R.id.itemUserGuide: | |||
| showDialog(USERGUIDE_DLG); | |||
| return true; | |||
| default: | |||
| return super.onOptionsItemSelected(item); | |||
| } | |||
| } | |||
| /** | |||
| * Initialization method | |||
| */ | |||
| private void initComponents() { | |||
| // initialize dropdowns | |||
| OnItemSelectedListener evRangeItemSelListener = new OnItemSelectedListener() { | |||
| @Override | |||
| public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { | |||
| EasyBracketMain.this.dpEV = EVFormula.calcEV(EasyBracketMain.this.spnDPAperture.getSelectedAperture(), | |||
| EasyBracketMain.this.spnDPShutterSpeed | |||
| .getSelectedShutterSpeed()); | |||
| EasyBracketMain.this.bpEV = EVFormula.calcEV(EasyBracketMain.this.spnBPAperture.getSelectedAperture(), | |||
| EasyBracketMain.this.spnBPShutterSpeed | |||
| .getSelectedShutterSpeed()); | |||
| EasyBracketMain.this.txtDPEVValue.setText(EasyBracketMain.DF.format(EasyBracketMain.this.dpEV)); | |||
| EasyBracketMain.this.txtBPEVValue.setText(EasyBracketMain.DF.format(EasyBracketMain.this.bpEV)); | |||
| EasyBracketMain.this.txtCalcPDeltaEV.setText(EasyBracketMain.DF.format((EasyBracketMain.this.bpEV | |||
| + EasyBracketMain.this.bpCorrection) | |||
| - (EasyBracketMain.this.dpEV | |||
| - EasyBracketMain.this.dpCorrection))); | |||
| EasyBracketMain.this.calculateBtn.setEnabled(EasyBracketMain.this.bpEV > EasyBracketMain.this.dpEV); | |||
| EasyBracketMain.this.resultsHeader.setVisibility(View.INVISIBLE); | |||
| findViewById(R.id.View_ResHeader_Understroke).setVisibility(View.INVISIBLE); | |||
| EasyBracketMain.this.resultList.setAdapter(null); | |||
| if (EasyBracketMain.this.bpEV < EasyBracketMain.this.dpEV) { | |||
| Toast toast = Toast.makeText(EasyBracketMain.this, R.string.toastWarningDP_BP, Toast.LENGTH_LONG); | |||
| toast.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL, 0, 0); | |||
| toast.show(); | |||
| } | |||
| } | |||
| @Override | |||
| public void onNothingSelected(AdapterView<?> parent) { | |||
| } | |||
| }; | |||
| OnItemSelectedListener calcPItemSelListener = new OnItemSelectedListener() { | |||
| @Override | |||
| public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { | |||
| toggleResultsList(false); | |||
| } | |||
| @Override | |||
| public void onNothingSelected(AdapterView<?> parent) { | |||
| } | |||
| }; | |||
| this.spnDPShutterSpeed = (ShutterSpeedSpinner) findViewById(R.id.Spinner_DP_Shutter); | |||
| this.spnDPAperture = (ApertureSpinner) findViewById(R.id.Spinner_DP_Aperture); | |||
| this.spnBPShutterSpeed = (ShutterSpeedSpinner) findViewById(R.id.Spinner_BP_Shutter); | |||
| this.spnBPAperture = (ApertureSpinner) findViewById(R.id.Spinner_BP_Aperture); | |||
| this.spnCalcPAperture = (ApertureSpinner) findViewById(R.id.Spinner_calcP_Aperture); | |||
| this.spnCalcPEVStep = (XSpinner) findViewById(R.id.Spinner_calcP_EVStep); | |||
| this.txtDPEVValue = (TextView) findViewById(R.id.Text_EVVal_DP); | |||
| this.txtBPEVValue = (TextView) findViewById(R.id.Text_EVVal_BP); | |||
| this.txtCalcPDeltaEV = (TextView) findViewById(R.id.label_deltaEV_Val); | |||
| this.resultsHeader = (LinearLayout) ExposureAdapter.getHeaderView(this, | |||
| (LinearLayout) | |||
| findViewById(R.id.LinearLayout_ResultsHeader)); | |||
| this.resultsHeader.setVisibility(View.INVISIBLE); | |||
| findViewById(R.id.View_ResHeader_Understroke).setVisibility(View.INVISIBLE); | |||
| this.resultList = (ListView) findViewById(R.id.ListView_ExpResults); | |||
| this.resultList.setAdapter(null); | |||
| this.resetBtn = (Button) findViewById(R.id.Btn_Reset); | |||
| this.calculateBtn = (Button) findViewById(R.id.Btn_Calculate); | |||
| this.calculateBtn.setEnabled(false); | |||
| this.spnDPShutterSpeed.setOnItemSelectedListener(evRangeItemSelListener); | |||
| this.spnDPAperture.setOnItemSelectedListener(evRangeItemSelListener); | |||
| this.spnBPShutterSpeed.setOnItemSelectedListener(evRangeItemSelListener); | |||
| this.spnBPAperture.setOnItemSelectedListener(evRangeItemSelListener); | |||
| this.resetBtn.setOnClickListener(new OnClickListener() { | |||
| @Override | |||
| public void onClick(View v) { | |||
| setDefaults(); | |||
| toggleResultsList(false); | |||
| } | |||
| }); | |||
| this.calculateBtn.setOnClickListener(new OnClickListener() { | |||
| @Override | |||
| public void onClick(View v) { | |||
| toggleResultsList(true); | |||
| calculateExposures(); | |||
| } | |||
| }); | |||
| this.spnCalcPAperture.setOnItemSelectedListener(calcPItemSelListener); | |||
| this.spnCalcPEVStep.setOnItemSelectedListener(calcPItemSelListener); | |||
| } | |||
| /** | |||
| * Clears the results list. | |||
| */ | |||
| private void toggleResultsList(boolean visible) { | |||
| if (visible) { | |||
| EasyBracketMain.this.resultsHeader.setVisibility(View.VISIBLE); | |||
| findViewById(R.id.View_ResHeader_Understroke).setVisibility(View.VISIBLE); | |||
| } else { | |||
| EasyBracketMain.this.resultsHeader.setVisibility(View.INVISIBLE); | |||
| findViewById(R.id.View_ResHeader_Understroke).setVisibility(View.INVISIBLE); | |||
| EasyBracketMain.this.resultList.setAdapter(null); | |||
| } | |||
| } | |||
| /** | |||
| * Sets the default values. | |||
| */ | |||
| public void setDefaults() { | |||
| this.spnDPShutterSpeed.setSelectionByVal(DEF_SHUTTER_SPEED); | |||
| this.spnDPAperture.setSelectionByVal(DEF_APERTURE); | |||
| this.spnBPShutterSpeed.setSelectionByVal(DEF_SHUTTER_SPEED); | |||
| this.spnBPAperture.setSelectionByVal(DEF_APERTURE); | |||
| this.spnCalcPAperture.setSelectionByVal(DEF_APERTURE); | |||
| this.spnCalcPEVStep.setSelectionByVal(DEF_EVSTEP); | |||
| this.txtDPEVValue.setText(DF.format(EVFormula.calcEV(this.spnDPAperture.getSelectedAperture(), | |||
| this.spnDPShutterSpeed.getSelectedShutterSpeed()))); | |||
| this.txtBPEVValue.setText(DF.format(EVFormula.calcEV(this.spnBPAperture.getSelectedAperture(), | |||
| this.spnBPShutterSpeed.getSelectedShutterSpeed()))); | |||
| this.txtCalcPDeltaEV.setText(DF.format(this.bpEV + this.bpCorrection - (this.dpEV - this.dpCorrection))); | |||
| } | |||
| /** | |||
| * Initiates the calculation of the exposure values according to the input parameters. | |||
| */ | |||
| private void calculateExposures() { | |||
| List<Exposure> exposureList; | |||
| double calcPrmAperture = this.spnCalcPAperture.getSelectedAperture(); | |||
| double calcPrmEvStep = Double.valueOf(this.spnCalcPEVStep.getSelectedItem().toString()); | |||
| List<Double> allowedShutters = getShutterSpeeds(); | |||
| exposureList = ExposureFactory.calculateExposures(this, this.dpEV - this.dpCorrection, | |||
| this.bpEV + this.bpCorrection, calcPrmAperture, calcPrmEvStep, | |||
| this.fixBP, allowedShutters); | |||
| this.resultList.setAdapter(new ExposureAdapter(this, exposureList)); | |||
| DisplayMetrics metrics = new DisplayMetrics(); | |||
| getApplicationContext().getDefaultDisplay().getMetrics(metrics); | |||
| } | |||
| /** | |||
| * Retrieves the list of all shutter speeds in drop down list as Double's. | |||
| * | |||
| * @return list of all shutter speeds in drop down list as Double's | |||
| */ | |||
| private List<Double> getShutterSpeeds() { | |||
| List<Double> shutterSpeeds = new ArrayList<Double>(); | |||
| for (int i = 0; i < this.spnBPShutterSpeed.getCount(); i++) { | |||
| shutterSpeeds.add(this.spnBPShutterSpeed.getShutterSpeedAt(i)); | |||
| } | |||
| return shutterSpeeds; | |||
| } | |||
| /** | |||
| * {@inheritDoc} | |||
| */ | |||
| @Override | |||
| protected Dialog onCreateDialog(int id) { | |||
| return DialogFactory.createDialog(id, this); | |||
| } | |||
| } | |||
| @@ -0,0 +1,20 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <selector xmlns:android="http://schemas.android.com/apk/res/android"> | |||
| <item android:state_window_focused="false" | |||
| android:drawable="@color/transparent" /> | |||
| <item android:state_focused="true" android:state_enabled="false" | |||
| android:state_pressed="true" | |||
| android:drawable="@color/lightgrey" /> | |||
| <item android:state_focused="true" android:state_enabled="false" | |||
| android:drawable="@color/lightgrey" /> | |||
| <item android:state_focused="true" android:state_pressed="true" | |||
| android:drawable="@drawable/z_selector_background_transition" /> | |||
| <item android:state_focused="false" android:state_pressed="true" | |||
| android:drawable="@drawable/z_selector_background_transition" /> | |||
| <item android:state_focused="true" | |||
| android:drawable="@color/green" /> | |||
| </selector> | |||
| @@ -0,0 +1,190 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC.resultlist; | |||
| import java.text.DecimalFormat; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import android.app.Activity; | |||
| import android.content.Context; | |||
| import android.content.res.Resources; | |||
| import android.graphics.Bitmap; | |||
| import android.graphics.BitmapFactory; | |||
| import android.graphics.Canvas; | |||
| import android.graphics.Color; | |||
| import android.graphics.Paint; | |||
| import android.graphics.PorterDuff; | |||
| import android.graphics.PorterDuffXfermode; | |||
| import android.graphics.Bitmap.Config; | |||
| import android.graphics.Paint.Style; | |||
| import android.util.DisplayMetrics; | |||
| import ch.spherIC.EVFormula; | |||
| import ch.spherIC.EasyBracketMain; | |||
| import ch.spherIC.R; | |||
| /** | |||
| * Factory that creates the exposure icons according to the EV range and values. | |||
| */ | |||
| public class ExposureFactory { | |||
| public static final DecimalFormat evDF = new DecimalFormat("0.######"); | |||
| /** | |||
| * DOCUMENT ME! | |||
| * | |||
| * @param context DOCUMENT ME! | |||
| * @param dpEV DOCUMENT ME! | |||
| * @param bpEv DOCUMENT ME! | |||
| * @param calcPrmAperture DOCUMENT ME! | |||
| * @param calcPrmEvStep DOCUMENT ME! | |||
| * @param fixBP DOCUMENT ME! | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| public static List<Exposure> calculateExposures(Context context, double dpEV, double bpEv, double calcPrmAperture, | |||
| double calcPrmEvStep, boolean fixBP, List<Double> allowedShutters) { | |||
| Exposure exp; | |||
| List<Exposure> exposures = new ArrayList<Exposure>(); | |||
| double deltaEV = bpEv - dpEV; | |||
| long nbrExposures = Math.round(deltaEV / calcPrmEvStep) + 1; | |||
| // correct the deltaEV | |||
| deltaEV = calcPrmEvStep * (nbrExposures - 1); | |||
| double baseEVStep = -deltaEV / 2; | |||
| for (int i = 0; i < nbrExposures; i++) { | |||
| boolean found = false; | |||
| String shutterSpeed = ""; | |||
| double shutter; | |||
| double evValue = 0; | |||
| double evStep = baseEVStep + i * calcPrmEvStep; | |||
| if (fixBP) { | |||
| evValue = bpEv - (nbrExposures - 1 - i) * calcPrmEvStep; | |||
| } else { | |||
| evValue = dpEV + i * calcPrmEvStep; | |||
| } | |||
| shutter = Double.valueOf(evDF.format((EVFormula.calcShutterSpeed(calcPrmAperture, evValue)))); | |||
| for (int j = 1; j < allowedShutters.size(); j++) { | |||
| double v1 = allowedShutters.get(j - 1); | |||
| double v2 = allowedShutters.get(j); | |||
| if ((v1 <= shutter && shutter <= v2) || (v2 <= shutter && shutter <= v1)) { | |||
| if (Math.abs(shutter - v1) <= Math.abs(shutter - v2)) { | |||
| shutterSpeed = (v1 < 1) ? "1/" + evDF.format((1 / v1)) | |||
| : "" + EasyBracketMain.DF.format(v1) + "''"; | |||
| } else { | |||
| shutterSpeed = (v2 < 1) ? "1/" + evDF.format((1 / v2)) | |||
| : "" + EasyBracketMain.DF.format(v2) + "''"; | |||
| } | |||
| found = true; | |||
| break; | |||
| } | |||
| } | |||
| if (!found) { | |||
| shutterSpeed = (shutter < 1) ? "1/" + Math.round(1 / shutter) | |||
| : "" + EasyBracketMain.DF.format(shutter) + "''"; | |||
| } | |||
| exp = new Exposure(i + 1, "f/" + EasyBracketMain.DF.format(calcPrmAperture), shutterSpeed, evStep, deltaEV, | |||
| getExpIcon(context, i + 1, (int) nbrExposures)); | |||
| exposures.add(exp); | |||
| } | |||
| return exposures; | |||
| } | |||
| /** | |||
| * Retrieves Icon. | |||
| * | |||
| * @param context Context | |||
| * @param exp {@link Exposure} object | |||
| * | |||
| * @return Color stepped icon | |||
| */ | |||
| private static Bitmap getExpIcon(Context context, int expNbr, int nbrExposures) { | |||
| Bitmap mIcon; | |||
| Bitmap mIconBG; | |||
| Bitmap mIconSymbol; | |||
| Bitmap mIconSymbol_bl; | |||
| Canvas canvas; | |||
| Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); | |||
| final Resources res = context.getResources(); | |||
| final int twentyPercentGray = Math.round(255f * 0.8f); | |||
| int deltaRGB = twentyPercentGray; | |||
| int iSize; | |||
| int iSize_r; | |||
| int iStart; | |||
| DisplayMetrics metrics = new DisplayMetrics(); | |||
| ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(metrics); | |||
| switch (metrics.densityDpi) { | |||
| case DisplayMetrics.DENSITY_LOW: | |||
| iSize = 18; | |||
| iSize_r = 17; | |||
| iStart = 1; | |||
| break; | |||
| default: | |||
| break; | |||
| } | |||
| if (expNbr > 1 || nbrExposures > 1) { | |||
| deltaRGB = twentyPercentGray / (nbrExposures - 1) * (expNbr - 1); | |||
| } | |||
| // The background | |||
| mIconBG = Bitmap.createBitmap(36, 36, Config.ARGB_8888); | |||
| mIconBG.eraseColor(0x00000000); | |||
| canvas = new Canvas(mIconBG); | |||
| mPaint.setStyle(Style.FILL); | |||
| mPaint.setColor(Color.argb(255, deltaRGB, deltaRGB, deltaRGB)); | |||
| canvas.drawRect(2, 2, 33, 33, mPaint); | |||
| // Let's retrieve all icon pieces as Bitmaps. | |||
| mIcon = BitmapFactory.decodeResource(res, R.drawable.exposureicon_frame); | |||
| mIconSymbol = BitmapFactory.decodeResource(res, R.drawable.exposureicon_symb_white); | |||
| mIconSymbol_bl = BitmapFactory.decodeResource(res, R.drawable.exposureicon_symb_black); | |||
| // Prepares the paint that will be used to draw our icon mask. Using | |||
| // PorterDuff.Mode.SRC_OVER means the image that will be drawn will | |||
| // mask the already drawn image. | |||
| mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER)); | |||
| // We're now ready to drawn our Android-like icon :) | |||
| if (deltaRGB > twentyPercentGray / 2) { | |||
| canvas.drawBitmap(mIconSymbol_bl, 0, 0, mPaint); | |||
| } else { | |||
| canvas.drawBitmap(mIconSymbol, 0, 0, mPaint); | |||
| } | |||
| canvas.drawBitmap(mIcon, 0, 0, mPaint); | |||
| return mIconBG; | |||
| } | |||
| } | |||
| @@ -0,0 +1,189 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC.resultlist; | |||
| import java.text.DecimalFormat; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import android.app.Activity; | |||
| import android.content.Context; | |||
| import android.content.res.Resources; | |||
| import android.graphics.Bitmap; | |||
| import android.graphics.BitmapFactory; | |||
| import android.graphics.Canvas; | |||
| import android.graphics.Color; | |||
| import android.graphics.Paint; | |||
| import android.graphics.PorterDuff; | |||
| import android.graphics.PorterDuffXfermode; | |||
| import android.graphics.Bitmap.Config; | |||
| import android.graphics.Paint.Style; | |||
| import android.util.DisplayMetrics; | |||
| import ch.spherIC.EVFormula; | |||
| import ch.spherIC.EasyBracketMain; | |||
| import ch.spherIC.R; | |||
| /** | |||
| * Factory that creates the exposure icons according to the EV range and values. | |||
| */ | |||
| public class ExposureFactory { | |||
| public static final DecimalFormat evDF = new DecimalFormat("0.######"); | |||
| /** | |||
| * DOCUMENT ME! | |||
| * | |||
| * @param context DOCUMENT ME! | |||
| * @param dpEV DOCUMENT ME! | |||
| * @param bpEv DOCUMENT ME! | |||
| * @param calcPrmAperture DOCUMENT ME! | |||
| * @param calcPrmEvStep DOCUMENT ME! | |||
| * @param fixBP DOCUMENT ME! | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| public static List<Exposure> calculateExposures(Context context, double dpEV, double bpEv, double calcPrmAperture, | |||
| double calcPrmEvStep, boolean fixBP, List<Double> allowedShutters) { | |||
| Exposure exp; | |||
| List<Exposure> exposures = new ArrayList<Exposure>(); | |||
| double deltaEV = bpEv - dpEV; | |||
| long nbrExposures = Math.round(deltaEV / calcPrmEvStep) + 1; | |||
| // correct the deltaEV | |||
| deltaEV = calcPrmEvStep * (nbrExposures - 1); | |||
| double baseEVStep = -deltaEV / 2; | |||
| for (int i = 0; i < nbrExposures; i++) { | |||
| boolean found = false; | |||
| String shutterSpeed = ""; | |||
| double shutter; | |||
| double evValue = 0; | |||
| double evStep = baseEVStep + i * calcPrmEvStep; | |||
| if (fixBP) { | |||
| evValue = bpEv - (nbrExposures - 1 - i) * calcPrmEvStep; | |||
| } else { | |||
| evValue = dpEV + i * calcPrmEvStep; | |||
| } | |||
| shutter = Double.valueOf(evDF.format((EVFormula.calcShutterSpeed(calcPrmAperture, evValue)))); | |||
| for (int j = 1; j < allowedShutters.size(); j++) { | |||
| double v1 = allowedShutters.get(j - 1); | |||
| double v2 = allowedShutters.get(j); | |||
| if ((v1 <= shutter && shutter <= v2) || (v2 <= shutter && shutter <= v1)) { | |||
| if (Math.abs(shutter - v1) <= Math.abs(shutter - v2)) { | |||
| shutterSpeed = (v1 < 1) ? "1/" + evDF.format((1 / v1)) | |||
| : "" + EasyBracketMain.DF.format(v1) + "''"; | |||
| } else { | |||
| shutterSpeed = (v2 < 1) ? "1/" + evDF.format((1 / v2)) | |||
| : "" + EasyBracketMain.DF.format(v2) + "''"; | |||
| } | |||
| found = true; | |||
| break; | |||
| } | |||
| } | |||
| if (!found) { | |||
| shutterSpeed = (shutter < 1) ? "1/" + Math.round(1 / shutter) | |||
| : "" + EasyBracketMain.DF.format(shutter) + "''"; | |||
| } | |||
| exp = new Exposure(i + 1, "f/" + EasyBracketMain.DF.format(calcPrmAperture), shutterSpeed, evStep, deltaEV, | |||
| getExpIcon(context, i + 1, (int) nbrExposures)); | |||
| exposures.add(exp); | |||
| } | |||
| return exposures; | |||
| } | |||
| /** | |||
| * Retrieves Icon. | |||
| * | |||
| * @param context Context | |||
| * @param exp {@link Exposure} object | |||
| * | |||
| * @return Color stepped icon | |||
| */ | |||
| private static Bitmap getExpIcon(Context context, int expNbr, int nbrExposures) { | |||
| Bitmap mIcon; | |||
| Bitmap mIconBG; | |||
| Bitmap mIconSymbol; | |||
| Bitmap mIconSymbol_bl; | |||
| Canvas canvas; | |||
| Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); | |||
| final Resources res = context.getResources(); | |||
| final int twentyPercentGray = Math.round(255f * 0.8f); | |||
| int deltaRGB = twentyPercentGray; | |||
| int iSize; | |||
| int iSize_r; | |||
| int iStart; | |||
| DisplayMetrics metrics = new DisplayMetrics(); | |||
| ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(metrics); | |||
| switch (metrics.density) { | |||
| case DisplayMetrics.DENSITY_LOW: | |||
| iSize = 18; | |||
| iSize_r = 17; | |||
| iStart = 1; | |||
| break; | |||
| default: | |||
| break; | |||
| } | |||
| if (expNbr > 1 || nbrExposures > 1) { | |||
| deltaRGB = twentyPercentGray / (nbrExposures - 1) * (expNbr - 1); | |||
| } | |||
| // The background | |||
| mIconBG = Bitmap.createBitmap(36, 36, Config.ARGB_8888); | |||
| mIconBG.eraseColor(0x00000000); | |||
| canvas = new Canvas(mIconBG); | |||
| mPaint.setStyle(Style.FILL); | |||
| mPaint.setColor(Color.argb(255, deltaRGB, deltaRGB, deltaRGB)); | |||
| canvas.drawRect(2, 2, 33, 33, mPaint); | |||
| // Let's retrieve all icon pieces as Bitmaps. | |||
| mIcon = BitmapFactory.decodeResource(res, R.drawable.exposureicon_frame); | |||
| mIconSymbol = BitmapFactory.decodeResource(res, R.drawable.exposureicon_symb_white); | |||
| mIconSymbol_bl = BitmapFactory.decodeResource(res, R.drawable.exposureicon_symb_black); | |||
| // Prepares the paint that will be used to draw our icon mask. Using | |||
| // PorterDuff.Mode.SRC_OVER means the image that will be drawn will | |||
| // mask the already drawn image. | |||
| mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER)); | |||
| // We're now ready to drawn our Android-like icon :) | |||
| if (deltaRGB > twentyPercentGray / 2) { | |||
| canvas.drawBitmap(mIconSymbol_bl, 0, 0, mPaint); | |||
| } else { | |||
| canvas.drawBitmap(mIconSymbol, 0, 0, mPaint); | |||
| } | |||
| canvas.drawBitmap(mIcon, 0, 0, mPaint); | |||
| return mIconBG; | |||
| } | |||
| } | |||
| @@ -0,0 +1,168 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC.resultlist; | |||
| import java.text.DecimalFormat; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import android.content.Context; | |||
| import android.content.res.Resources; | |||
| import android.graphics.Bitmap; | |||
| import android.graphics.BitmapFactory; | |||
| import android.graphics.Canvas; | |||
| import android.graphics.Color; | |||
| import android.graphics.Paint; | |||
| import android.graphics.PorterDuff; | |||
| import android.graphics.PorterDuffXfermode; | |||
| import android.graphics.Bitmap.Config; | |||
| import android.graphics.Paint.Style; | |||
| import ch.spherIC.EVFormula; | |||
| import ch.spherIC.EasyBracketMain; | |||
| import ch.spherIC.R; | |||
| /** | |||
| * Factory that creates the exposure icons according to the EV range and values. | |||
| */ | |||
| public class ExposureFactory { | |||
| public static final DecimalFormat evDF = new DecimalFormat("0.######"); | |||
| /** | |||
| * DOCUMENT ME! | |||
| * | |||
| * @param context DOCUMENT ME! | |||
| * @param dpEV DOCUMENT ME! | |||
| * @param bpEv DOCUMENT ME! | |||
| * @param calcPrmAperture DOCUMENT ME! | |||
| * @param calcPrmEvStep DOCUMENT ME! | |||
| * @param fixBP DOCUMENT ME! | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| public static List<Exposure> calculateExposures(Context context, double dpEV, double bpEv, double calcPrmAperture, | |||
| double calcPrmEvStep, boolean fixBP, List<Double> allowedShutters) { | |||
| Exposure exp; | |||
| List<Exposure> exposures = new ArrayList<Exposure>(); | |||
| double deltaEV = bpEv - dpEV; | |||
| long nbrExposures = Math.round(deltaEV / calcPrmEvStep) + 1; | |||
| // correct the deltaEV | |||
| deltaEV = calcPrmEvStep * (nbrExposures - 1); | |||
| double baseEVStep = -deltaEV / 2; | |||
| for (int i = 0; i < nbrExposures; i++) { | |||
| boolean found = false; | |||
| String shutterSpeed = ""; | |||
| double shutter; | |||
| double evValue = 0; | |||
| double evStep = baseEVStep + i * calcPrmEvStep; | |||
| if (fixBP) { | |||
| evValue = bpEv - (nbrExposures - 1 - i) * calcPrmEvStep; | |||
| } else { | |||
| evValue = dpEV + i * calcPrmEvStep; | |||
| } | |||
| shutter = Double.valueOf(evDF.format((EVFormula.calcShutterSpeed(calcPrmAperture, evValue)))); | |||
| for (int j = 1; j < allowedShutters.size(); j++) { | |||
| double v1 = allowedShutters.get(j - 1); | |||
| double v2 = allowedShutters.get(j); | |||
| if ((v1 <= shutter && shutter <= v2) || (v2 <= shutter && shutter <= v1)) { | |||
| if (Math.abs(shutter - v1) <= Math.abs(shutter - v2)) { | |||
| shutterSpeed = (v1 < 1) ? "1/" + evDF.format((1 / v1)) | |||
| : "" + EasyBracketMain.DF.format(v1) + "''"; | |||
| } else { | |||
| shutterSpeed = (v2 < 1) ? "1/" + evDF.format((1 / v2)) | |||
| : "" + EasyBracketMain.DF.format(v2) + "''"; | |||
| } | |||
| found = true; | |||
| break; | |||
| } | |||
| } | |||
| if (!found) { | |||
| shutterSpeed = (shutter < 1) ? "1/" + Math.round(1 / shutter) | |||
| : "" + EasyBracketMain.DF.format(shutter) + "''"; | |||
| } | |||
| exp = new Exposure(i + 1, "f/" + EasyBracketMain.DF.format(calcPrmAperture), shutterSpeed, evStep, deltaEV, | |||
| getExpIcon(context, i + 1, (int) nbrExposures)); | |||
| exposures.add(exp); | |||
| } | |||
| return exposures; | |||
| } | |||
| /** | |||
| * Retrieves Icon. | |||
| * | |||
| * @param context Context | |||
| * @param exp {@link Exposure} object | |||
| * | |||
| * @return Color stepped icon | |||
| */ | |||
| private static Bitmap getExpIcon(Context context, int expNbr, int nbrExposures) { | |||
| int deltaRGB = twentyPercentGray; | |||
| final int twentyPercentGray = Math.round(255f * 0.8f); | |||
| if (expNbr > 1 || nbrExposures > 1) { | |||
| deltaRGB = twentyPercentGray / (nbrExposures - 1) * (expNbr - 1); | |||
| } | |||
| Bitmap mIcon; | |||
| Bitmap mIconBG; | |||
| Bitmap mIconSymbol; | |||
| Bitmap mIconSymbol_bl; | |||
| Canvas canvas; | |||
| Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); | |||
| final Resources res = context.getResources(); | |||
| // The background | |||
| mIconBG = Bitmap.createBitmap(36, 36, Config.ARGB_8888); | |||
| mIconBG.eraseColor(0x00000000); | |||
| canvas = new Canvas(mIconBG); | |||
| mPaint.setStyle(Style.FILL); | |||
| mPaint.setColor(Color.argb(255, deltaRGB, deltaRGB, deltaRGB)); | |||
| canvas.drawRect(2, 2, 33, 33, mPaint); | |||
| // Let's retrieve all icon pieces as Bitmaps. | |||
| mIcon = BitmapFactory.decodeResource(res, R.drawable.exposureicon_frame); | |||
| mIconSymbol = BitmapFactory.decodeResource(res, R.drawable.exposureicon_symb_white); | |||
| mIconSymbol_bl = BitmapFactory.decodeResource(res, R.drawable.exposureicon_symb_black); | |||
| // Prepares the paint that will be used to draw our icon mask. Using | |||
| // PorterDuff.Mode.SRC_OVER means the image that will be drawn will | |||
| // mask the already drawn image. | |||
| mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER)); | |||
| // We're now ready to drawn our Android-like icon :) | |||
| if (deltaRGB > twentyPercentGray / 2) { | |||
| canvas.drawBitmap(mIconSymbol_bl, 0, 0, mPaint); | |||
| } else { | |||
| canvas.drawBitmap(mIconSymbol, 0, 0, mPaint); | |||
| } | |||
| canvas.drawBitmap(mIcon, 0, 0, mPaint); | |||
| return mIconBG; | |||
| } | |||
| } | |||
| @@ -0,0 +1,74 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <resources> | |||
| <string | |||
| name="app_name">Easy Bracketing</string> | |||
| <string | |||
| name="dynamic_range">Dynamikbereich</string> | |||
| <string | |||
| name="shutter_speed">Belichtungszeit</string> | |||
| <string | |||
| name="aperture">Blende</string> | |||
| <string | |||
| name="ev">LW</string> | |||
| <string | |||
| name="dark_point">Werte Dunkelpunkt</string> | |||
| <string | |||
| name="bright_point">Werte Hellpunkt</string> | |||
| <string | |||
| name="calcParams">Berechnungsparameter</string> | |||
| <string | |||
| name="delta_EV">Δ LW</string> | |||
| <string | |||
| name="expEVStep">LW-Schritt</string> | |||
| <string | |||
| name="calculate">Berechnen</string> | |||
| <string | |||
| name="reset">Zurücksetzen</string> | |||
| <string | |||
| name="bracketingRes">Bracketing Belichtungswerte</string> | |||
| <string | |||
| name="expNbrLbl"># Bel.</string> | |||
| <string | |||
| name="toastWarningDP_BP">Das Delta zwischen dem LW des Dunkelpunkt und dem LW des Hellpunkt ist kleiner oder glleich 0. | |||
| \nBitte korrigieren Sie die Eingaben.</string> | |||
| <string | |||
| name="menuUserGuide">Benutzeranleitung</string> | |||
| <string | |||
| name="menuSettings">Einstellungen...</string> | |||
| <string | |||
| name="menuAbout">Info</string> | |||
| <string | |||
| name="about_Description"> | |||
| EasyBracketing dient zur schnellen und einfachen Berechnung einer Belichtungsserie ausgehend | |||
| von den Belichtungswerten eines Dunkelpunktes und eines Hellpunktes. | |||
| </string> | |||
| <string | |||
| name="AppVersionLabel">Version:</string> | |||
| <string | |||
| name="about_DevelopedBy">Developed by spherIC (F. Smilari)\nMail to: | |||
| merlin868@hotmail.com\n\nTranslated by spherIC (F. Smilari)</string> | |||
| <string | |||
| name="Percent18Correction">18%-Gray Correction</string> | |||
| <string | |||
| name="Percent18CorrectionBP">Bright Pt. Value Correction (EV)</string> | |||
| <string | |||
| name="Percent18CorrectionDP">Dark Pt. Value Correction (EV)</string> | |||
| <string | |||
| name="FixRangePoint">Fixed EV Range Value</string> | |||
| <string | |||
| name="FixRangePointBP">Keep Bright Point Values fixed</string> | |||
| <string | |||
| name="FixRangePointDP">Keep Dark Point Value fixed</string> | |||
| <string | |||
| name="BtnSave">Save</string> | |||
| <string | |||
| name="BtnCancel">Cancel</string> | |||
| <string | |||
| name="header_GeneralPurpose">1. General Purpose</string> | |||
| <string | |||
| name="text_GeneralPurpose">Text here</string> | |||
| <string | |||
| name="header_HowTo">2. How to use</string> | |||
| <string | |||
| name="text_HowTo">Text here</string> | |||
| </resources> | |||
| @@ -0,0 +1,242 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC.resultlist; | |||
| import java.util.List; | |||
| import android.app.Activity; | |||
| import android.content.Context; | |||
| import android.util.DisplayMetrics; | |||
| import android.view.Gravity; | |||
| import android.view.View; | |||
| import android.view.ViewGroup; | |||
| import android.widget.BaseAdapter; | |||
| import android.widget.ImageView; | |||
| import android.widget.LinearLayout; | |||
| import android.widget.TextView; | |||
| import android.widget.LinearLayout.LayoutParams; | |||
| import ch.spherIC.R; | |||
| /** | |||
| * Exposure adapter view class. | |||
| */ | |||
| class ExposureAdapterView extends LinearLayout { | |||
| private static DisplayMetrics metrics; | |||
| /** | |||
| * Creates a new ExposureAdapterView object. | |||
| * | |||
| * @param context DOCUMENT ME! | |||
| * @param weather DOCUMENT ME! | |||
| */ | |||
| public ExposureAdapterView(Context context, Exposure exposure, int nbrExposures) { | |||
| super(context); | |||
| this.setOrientation(HORIZONTAL); | |||
| ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(metrics); | |||
| // Nbr | |||
| TextView nbrControl = new TextView(context); | |||
| LinearLayout.LayoutParams nbrParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| nbrParams.setMargins(3, 1, 1, 1); | |||
| nbrControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| nbrControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| nbrControl.setText(Integer.toString(exposure.getNbr())); | |||
| addView(nbrControl, nbrParams); | |||
| // Aperture | |||
| TextView apertureControl = new TextView(context); | |||
| LinearLayout.LayoutParams apertureParams = new LinearLayout.LayoutParams(100, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| apertureParams.setMargins(1, 1, 1, 1); | |||
| apertureControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| apertureControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| apertureControl.setText(exposure.getAperture()); | |||
| addView(apertureControl, apertureParams); | |||
| // Shutter speed | |||
| TextView shutterControl = new TextView(context); | |||
| LinearLayout.LayoutParams shutterParams = new LinearLayout.LayoutParams(170, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| shutterParams.setMargins(1, 1, 1, 1); | |||
| shutterControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| shutterControl.setTextAppearance(context, R.style.ResultExposureTextSpecial); | |||
| shutterControl.setText(exposure.getShutterSpeed()); | |||
| addView(shutterControl, shutterParams); | |||
| // EV Step | |||
| TextView evStepControl = new TextView(context); | |||
| LinearLayout.LayoutParams evStepParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| evStepParams.setMargins(1, 1, 1, 1); | |||
| evStepControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| evStepControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| evStepControl.setText(exposure.getEvStepAsString()); | |||
| addView(evStepControl, evStepParams); | |||
| // Icon | |||
| ImageView expIconControl = new ImageView(context); | |||
| LinearLayout.LayoutParams expIconParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| expIconParams.setMargins(1, 1, 1, 1); | |||
| expIconControl.setImageBitmap(exposure.getEvStepBtmp()); | |||
| addView(expIconControl, expIconParams); | |||
| } | |||
| } | |||
| /** | |||
| * Exposure results adapter. | |||
| */ | |||
| public class ExposureAdapter extends BaseAdapter { | |||
| private static DisplayMetrics metrics; | |||
| private Context context; | |||
| private List<Exposure> exposureList; | |||
| /** | |||
| * Creates a new ExposureAdapter object. | |||
| */ | |||
| public ExposureAdapter(Context context, List<Exposure> expList) { | |||
| this.context = context; | |||
| this.exposureList = expList; | |||
| } | |||
| /** | |||
| * Retrieves list size. | |||
| * | |||
| * @return list size | |||
| */ | |||
| @Override | |||
| public int getCount() { | |||
| return this.exposureList.size(); | |||
| } | |||
| /** | |||
| * Retrieves the exposure at index <code>position</code>. | |||
| * | |||
| * @param position Index in list | |||
| * | |||
| * @return Exposure at index <code>position</code> | |||
| */ | |||
| @Override | |||
| public Object getItem(int position) { | |||
| return this.exposureList.get(position); | |||
| } | |||
| /** | |||
| * Retrieves the number of the exposure at index <code>position</code>. | |||
| * | |||
| * @param position Index in list | |||
| * | |||
| * @return the number of the exposure at index <code>position</code> | |||
| */ | |||
| @Override | |||
| public long getItemId(int position) { | |||
| //return this.exposureList.get(position).getNbr(); | |||
| return position; | |||
| } | |||
| /** | |||
| * Retrieves a view representing a single result row. | |||
| * | |||
| * @param position Index in list | |||
| * @param convertView view | |||
| * @param parent parent | |||
| * | |||
| * @return {@link ExposureAdapterView} | |||
| */ | |||
| @Override | |||
| public View getView(int position, View convertView, ViewGroup parent) { | |||
| Exposure exposure = this.exposureList.get(position); | |||
| return new ExposureAdapterView(this.context, exposure, this.exposureList.size()); | |||
| } | |||
| /** | |||
| * Retrieves the value of | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| public static View getHeaderView(Context context, LinearLayout headerLL) { | |||
| int black = headerLL.getResources().getColor(R.color.black); | |||
| // Nbr | |||
| TextView nbrControl = new TextView(context); | |||
| LinearLayout.LayoutParams nbrParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| nbrParams.setMargins(3, 1, 1, 1); | |||
| nbrControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| nbrControl.setTextSize(13f); | |||
| nbrControl.setTextColor(black); | |||
| nbrControl.setText(R.string.expNbrLbl); | |||
| headerLL.addView(nbrControl, nbrParams); | |||
| // Aperture | |||
| TextView apertureControl = new TextView(context); | |||
| LinearLayout.LayoutParams apertureParams = new LinearLayout.LayoutParams(100, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| apertureParams.setMargins(1, 1, 1, 1); | |||
| apertureControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| apertureControl.setTextSize(13f); | |||
| apertureControl.setTextColor(black); | |||
| apertureControl.setText(R.string.aperture); | |||
| headerLL.addView(apertureControl, apertureParams); | |||
| // Shutter speed | |||
| TextView shutterControl = new TextView(context); | |||
| LinearLayout.LayoutParams shutterParams = new LinearLayout.LayoutParams(170, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| shutterParams.setMargins(1, 1, 1, 1); | |||
| shutterControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| shutterControl.setTextSize(13f); | |||
| shutterControl.setTextColor(black); | |||
| shutterControl.setText(R.string.shutter_speed); | |||
| headerLL.addView(shutterControl, shutterParams); | |||
| // EV Step | |||
| TextView evStepControl = new TextView(context); | |||
| LinearLayout.LayoutParams evStepParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| evStepParams.setMargins(1, 1, 1, 1); | |||
| evStepControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| evStepControl.setTextSize(13f); | |||
| evStepControl.setTextColor(black); | |||
| evStepControl.setText(R.string.expEVStep); | |||
| headerLL.addView(evStepControl, evStepParams); | |||
| // Icon | |||
| ImageView expIconControl = new ImageView(context); | |||
| LinearLayout.LayoutParams expIconParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| expIconParams.setMargins(1, 1, 1, 1); | |||
| headerLL.addView(expIconControl, expIconParams); | |||
| return headerLL; | |||
| } | |||
| /** | |||
| * Retrieves the value of | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| private static DisplayMetrics getMetrics() { | |||
| if (metrics == null) { | |||
| metrics = new DisplayMetrics(); | |||
| } | |||
| return metrics; | |||
| } | |||
| } | |||
| @@ -0,0 +1,78 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <resources> | |||
| <string | |||
| name="app_name">Easy Bracketing</string> | |||
| <string | |||
| name="dynamic_range">Dynamic Range</string> | |||
| <string | |||
| name="shutter_speed">Shutter Speed</string> | |||
| <string | |||
| name="aperture">Aperture</string> | |||
| <string | |||
| name="ev">EV</string> | |||
| <string | |||
| name="dark_point">Dark Point Values</string> | |||
| <string | |||
| name="bright_point">Bright Point Values</string> | |||
| <string | |||
| name="calcParams">Calculation Parameters</string> | |||
| <string | |||
| name="delta_EV">Δ EV</string> | |||
| <string | |||
| name="expEVStep">EV Step</string> | |||
| <string | |||
| name="calculate">Calculate</string> | |||
| <string | |||
| name="reset">Reset</string> | |||
| <string | |||
| name="bracketingRes">Bracketing Exposures Values</string> | |||
| <string | |||
| name="expNbrLbl"># Exp.</string> | |||
| <string | |||
| name="toastWarningDP_BP">The delta between dark point EV and bright point EV is less or | |||
| equal to 0. Please correct the inputs.</string> | |||
| <string | |||
| name="menuUserGuide">User Guide</string> | |||
| <string | |||
| name="menuSettings">Settings...</string> | |||
| <string | |||
| name="menuAbout">About</string> | |||
| <string | |||
| name="about_Description">EasyBracketing allows you to easy calculate a serie of exposure | |||
| values according to initial dark and bright point values.</string> | |||
| <string | |||
| name="AppVersionLabel">Version:</string> | |||
| <string | |||
| name="about_DevelopedBy">Developed by spherIC (F. Smilari)\nMail to: | |||
| merlin868@hotmail.com\n\nTranslated by spherIC (F. Smilari)</string> | |||
| <string | |||
| name="Percent18Correction">18%-Gray Correction</string> | |||
| <string | |||
| name="Percent18CorrectionBP">Bright Pt. Value Correction (EV)</string> | |||
| <string | |||
| name="Percent18CorrectionDP">Dark Pt. Value Correction (EV)</string> | |||
| <string | |||
| name="FixRangePoint">Fixed EV Range Value</string> | |||
| <string | |||
| name="FixRangePointBP">Keep Bright Point Values fixed</string> | |||
| <string | |||
| name="FixRangePointDP">Keep Dark Point Value fixed</string> | |||
| <string | |||
| name="BtnSave">Save</string> | |||
| <string | |||
| name="BtnCancel">Cancel</string> | |||
| <string | |||
| name="BtnClose">Close</string> | |||
| <string | |||
| name="header_GeneralPurpose">1. General Purpose</string> | |||
| <string | |||
| name="text_GeneralPurpose">When doing a bracketing for a later HDR image, often a problem araises. The dynamic range of the | |||
| composition is too large to fit the classic \"+2EV/0EVB/-2EV\" approach. This is the moment when \"EasyBracketing\" comes to its own. | |||
| Starting with camera-measured values for the brightest and darkest point and according to some configarable calculation parameters | |||
| you can calculate all the exposure values for the bracketing. | |||
| </string> | |||
| <string | |||
| name="header_HowTo">2. How to use</string> | |||
| <string | |||
| name="text_HowTo">Text here</string> | |||
| </resources> | |||
| @@ -0,0 +1,22 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC.userguide; | |||
| import android.app.Dialog; | |||
| public class UserGuideDialog extends Dialog { | |||
| } | |||
| @@ -0,0 +1,109 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC.components; | |||
| import android.content.Context; | |||
| import android.content.res.TypedArray; | |||
| import android.graphics.Canvas; | |||
| import android.graphics.Paint; | |||
| import android.graphics.Rect; | |||
| import android.util.AttributeSet; | |||
| import android.widget.TextView; | |||
| import ch.spherIC.R; | |||
| /** | |||
| * DOCUMENT ME! | |||
| * | |||
| * @author $author$ | |||
| * @version $Revision$, $Date$ | |||
| */ | |||
| public class XTextView extends TextView { | |||
| private boolean drawborder; | |||
| private int drawborderColor; | |||
| private int drawborderWidth; | |||
| /** | |||
| * Creates a new XTextView object. | |||
| * | |||
| * @param context DOCUMENT ME! | |||
| */ | |||
| public XTextView(Context context) { | |||
| super(context); | |||
| } | |||
| /** | |||
| * Creates a new $class.name$ object. | |||
| * | |||
| * @param context DOCUMENT ME! | |||
| * @param attrs DOCUMENT ME! | |||
| * @param defStyle DOCUMENT ME! | |||
| */ | |||
| public XTextView(Context context, AttributeSet attrs, int defStyle) { | |||
| super(context, attrs, defStyle); | |||
| init(attrs); | |||
| } | |||
| /** | |||
| * Creates a new $class.name$ object. | |||
| * | |||
| * @param context DOCUMENT ME! | |||
| * @param attrs DOCUMENT ME! | |||
| */ | |||
| public XTextView(Context context, AttributeSet attrs) { | |||
| super(context, attrs); | |||
| init(attrs); | |||
| } | |||
| /** | |||
| * DOCUMENT ME! | |||
| * | |||
| * @param attrs DOCUMENT ME! | |||
| */ | |||
| private void init(AttributeSet attrs) { | |||
| TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.XTextView); | |||
| this.drawborder = a.getBoolean(R.styleable.XTextView_drawBorder, false); | |||
| this.drawborderColor = a.getColor(R.styleable.XTextView_drawBorderColor, 0xffff0000); | |||
| this.drawborderWidth = a.getDimensionPixelSize(R.styleable.XTextView_drawBorderWidth, 1); | |||
| } | |||
| /** | |||
| * @see android.widget.TextView#onDraw(android.graphics.Canvas) | |||
| */ | |||
| @Override | |||
| protected void onDraw(Canvas canvas) { | |||
| super.onDraw(canvas); | |||
| Rect rect = new Rect(); | |||
| Paint paint = new Paint(); | |||
| paint.setStyle(Paint.Style.STROKE); | |||
| paint.setColor(this.drawborderColor); | |||
| //paint.setStrokeWidth(this.drawborderWidth); | |||
| paint.setStrokeWidth(5); | |||
| getLocalVisibleRect(rect); | |||
| //rect.inset(this.drawborderWidth, this.drawborderWidth); | |||
| rect.inset(1, 1); | |||
| canvas.drawRect(rect, paint); | |||
| } | |||
| } | |||
| @@ -0,0 +1,74 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <resources> | |||
| <string | |||
| name="app_name">Easy Bracketing</string> | |||
| <string | |||
| name="dynamic_range">Dynamikbereich</string> | |||
| <string | |||
| name="shutter_speed">Belichtungszeit</string> | |||
| <string | |||
| name="aperture">Blende</string> | |||
| <string | |||
| name="ev">LW</string> | |||
| <string | |||
| name="dark_point">Werte Dunkelpunkt</string> | |||
| <string | |||
| name="bright_point">Werte Hellpunkt</string> | |||
| <string | |||
| name="calcParams">Berechnungsparameter</string> | |||
| <string | |||
| name="delta_EV">Δ LW</string> | |||
| <string | |||
| name="expEVStep">LW-Schritt</string> | |||
| <string | |||
| name="calculate">Berechnen</string> | |||
| <string | |||
| name="reset">Zurücksetzen</string> | |||
| <string | |||
| name="bracketingRes">Bracketing Belichtungswerte</string> | |||
| <string | |||
| name="expNbrLbl"># Bel.</string> | |||
| <string | |||
| name="toastWarningDP_BP">Das Delta zwischen dem LW des Dunkelpunkt und dem LW des Hellpunkt ist kleiner oder glleich 0. | |||
| \nBitte korrigieren Sie die Eingaben.</string> | |||
| <string | |||
| name="menuUserGuide">Benutzeranleitung</string> | |||
| <string | |||
| name="menuSettings">Einstellungen...</string> | |||
| <string | |||
| name="menuAbout">Info</string> | |||
| <string | |||
| name="about_Description"> | |||
| EasyBracketing dient zur schnellen und einfachen Berechnung einer Belichtungsserie ausgehend | |||
| von den Belichtungswerten eines Dunkelpunktes und eines Hellpunktes. | |||
| </string> | |||
| <string | |||
| name="AppVersionLabel">Version:</string> | |||
| <string | |||
| name="about_DevelopedBy">Entwickelt von spherIC (F. Smilari)\nMail an: | |||
| merlin868@hotmail.com\n\nÜbersetzt von spherIC (F. Smilari)</string> | |||
| <string | |||
| name="Percent18Correction">18%-Gray Correction</string> | |||
| <string | |||
| name="Percent18CorrectionBP">Bright Pt. Value Correction (EV)</string> | |||
| <string | |||
| name="Percent18CorrectionDP">Dark Pt. Value Correction (EV)</string> | |||
| <string | |||
| name="FixRangePoint">Fixed EV Range Value</string> | |||
| <string | |||
| name="FixRangePointBP">Keep Bright Point Values fixed</string> | |||
| <string | |||
| name="FixRangePointDP">Keep Dark Point Value fixed</string> | |||
| <string | |||
| name="BtnSave">Save</string> | |||
| <string | |||
| name="BtnCancel">Cancel</string> | |||
| <string | |||
| name="header_GeneralPurpose">1. General Purpose</string> | |||
| <string | |||
| name="text_GeneralPurpose">Text here</string> | |||
| <string | |||
| name="header_HowTo">2. How to use</string> | |||
| <string | |||
| name="text_HowTo">Text here</string> | |||
| </resources> | |||
| @@ -0,0 +1,106 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC.components; | |||
| import android.content.Context; | |||
| import android.content.res.TypedArray; | |||
| import android.graphics.Canvas; | |||
| import android.graphics.Paint; | |||
| import android.graphics.Rect; | |||
| import android.util.AttributeSet; | |||
| import android.widget.TextView; | |||
| import ch.spherIC.R; | |||
| /** | |||
| * DOCUMENT ME! | |||
| * | |||
| * @author $author$ | |||
| * @version $Revision$, $Date$ | |||
| */ | |||
| public class XTextView extends TextView { | |||
| private boolean drawborder; | |||
| private int drawborderColor; | |||
| private int drawborderWidth; | |||
| /** | |||
| * Creates a new XTextView object. | |||
| * | |||
| * @param context DOCUMENT ME! | |||
| */ | |||
| public XTextView(Context context) { | |||
| super(context); | |||
| } | |||
| /** | |||
| * Creates a new $class.name$ object. | |||
| * | |||
| * @param context DOCUMENT ME! | |||
| * @param attrs DOCUMENT ME! | |||
| * @param defStyle DOCUMENT ME! | |||
| */ | |||
| public XTextView(Context context, AttributeSet attrs, int defStyle) { | |||
| super(context, attrs, defStyle); | |||
| init(attrs); | |||
| } | |||
| /** | |||
| * Creates a new $class.name$ object. | |||
| * | |||
| * @param context DOCUMENT ME! | |||
| * @param attrs DOCUMENT ME! | |||
| */ | |||
| public XTextView(Context context, AttributeSet attrs) { | |||
| super(context, attrs); | |||
| init(attrs); | |||
| } | |||
| /** | |||
| * DOCUMENT ME! | |||
| * | |||
| * @param attrs DOCUMENT ME! | |||
| */ | |||
| private void init(AttributeSet attrs) { | |||
| TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.XTextView); | |||
| this.drawborder = a.getBoolean(R.styleable.XTextView_drawBorder, false); | |||
| this.drawborderColor = a.getColor(R.styleable.XTextView_drawBorderColor, 0xffff0000); | |||
| this.drawborderWidth = a.getDimensionPixelSize(R.styleable.XTextView_drawBorderWidth, 1); | |||
| } | |||
| /** | |||
| * @see android.widget.TextView#onDraw(android.graphics.Canvas) | |||
| */ | |||
| @Override | |||
| protected void onDraw(Canvas canvas) { | |||
| super.onDraw(canvas); | |||
| Rect rect = new Rect(); | |||
| Paint paint = new Paint(); | |||
| paint.setStyle(Paint.Style.STROKE); | |||
| paint.setColor(this.drawborderColor); | |||
| paint.setStrokeWidth(this.drawborderWidth); | |||
| getLocalVisibleRect(rect); | |||
| //rect.inset(-this.drawborderWidth, -this.drawborderWidth); | |||
| canvas.drawRect(rect, paint); | |||
| } | |||
| } | |||
| @@ -0,0 +1,102 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <resources> | |||
| <string | |||
| name="app_name">Easy Bracketing</string> | |||
| <string | |||
| name="dynamic_range">Dynamikbereich</string> | |||
| <string | |||
| name="shutter_speed">Belichtungszeit</string> | |||
| <string | |||
| name="aperture">Blende</string> | |||
| <string | |||
| name="ev">LW</string> | |||
| <string | |||
| name="dark_point">Werte Dunkelpunkt</string> | |||
| <string | |||
| name="bright_point">Werte Hellpunkt</string> | |||
| <string | |||
| name="calcParams">Berechnungsparameter</string> | |||
| <string | |||
| name="delta_EV">Δ LW</string> | |||
| <string | |||
| name="expEVStep">LW-Schritt</string> | |||
| <string | |||
| name="calculate">Berechnen</string> | |||
| <string | |||
| name="reset">Zurücksetzen</string> | |||
| <string | |||
| name="bracketingRes">Bracketing Belichtungswerte</string> | |||
| <string | |||
| name="expNbrLbl"># Bel.</string> | |||
| <string | |||
| name="toastWarningDP_BP">Das Delta zwischen dem LW des Dunkelpunkt und dem LW des Hellpunkt ist kleiner oder gleich 0. | |||
| \nBitte korrigieren Sie die Eingaben.</string> | |||
| <string | |||
| name="menuUserGuide">Benutzeranleitung</string> | |||
| <string | |||
| name="menuSettings">Einstellungen...</string> | |||
| <string | |||
| name="menuAbout">Info</string> | |||
| <string | |||
| name="about_Description"> | |||
| EasyBracketing dient zur schnellen und einfachen Berechnung einer Belichtungsserie ausgehend | |||
| von den Belichtungswerten eines Dunkelpunktes und eines Hellpunktes. | |||
| </string> | |||
| <string | |||
| name="AppVersionLabel">Version:</string> | |||
| <string | |||
| name="about_DevelopedBy">Entwickelt von spherIC (F. Smilari)\nMail an: | |||
| merlin868@hotmail.com\n\nÜbersetzt von spherIC (F. Smilari)</string> | |||
| <string | |||
| name="Percent18Correction">18%-Grauwertkorrektur</string> | |||
| <string | |||
| name="Percent18CorrectionBP">Hellpunktkorrektur (LW)</string> | |||
| <string | |||
| name="Percent18CorrectionDP">Dunkelpunktkorrektur (LW)</string> | |||
| <string | |||
| name="FixRangePoint">Ausgangspunkt für Belichtungsserie</string> | |||
| <string | |||
| name="FixRangePointBP">Von Hellpunktwerten ausgehen</string> | |||
| <string | |||
| name="FixRangePointDP">Von Dunkelpunktwerten ausgehen</string> | |||
| <string | |||
| name="BtnSave">Speichern</string> | |||
| <string | |||
| name="BtnCancel">Abbrechen</string> | |||
| <string | |||
| name="BtnClose">Schliessen</string> | |||
| <string | |||
| name="header_GeneralPurpose">1. Allgm. Verwendungszweck</string> | |||
| <string | |||
| name="text_GeneralPurpose"> | |||
| Beim Erstellen einer Belichtungsreihe für ein späteres HDR-Bild, stellt sich oftmals das Problem, | |||
| dass der Kontrastumfang zu gross ist um von der typischen \"+2LW/0LW/-2LW\"-Vorgehensweise abgedeckt zu werden.\nHier | |||
| kommt \"EasyBracketing\" zum Zug.\nAusgehend von gemessenen Werten für den hellsten Punkt resp. den dunkelsten Punkt | |||
| werden über definierbare Parameter alle notwendigen Belichtungen einer Belichtungsreihe berechnet. Diese können dann | |||
| an der Kamera sukzessive eingestellt und die Aufnahme ausgelöst werden. | |||
| </string> | |||
| <string | |||
| name="header_HowTo">2. Vorgehensweise</string> | |||
| <string | |||
| name="text_HowTo"> | |||
| 1. Stellen Sie die Kamera auf Spotbelichtungsmessung. | |||
| \n2. Wählen Sie eine geeignete Blende. | |||
| \n3. Messen Sie mit der Kamera die Belichtungswerte für den dunkelsten Punkt ihres Bildausschnitts. | |||
| \n4. Messen Sie mit der Kamera die Belichtungswerte für den hellsten Punkt ihres Bildausschnitts. | |||
| \n5. Stellen Sie die gemessenen Werte im Bereich \"Dynamikbereich\" von EasyBracketing ein. | |||
| \n6. Verändern Sie, falls gewünscht die Berechnungsparamter nach Ihren Vorstellungen. | |||
| \n7. Klicken Sie auf \"Berechnen\" um die Belichtungsreihe zu berechnen. | |||
| \n | |||
| \nEinstellungen: | |||
| \n | |||
| \n18-Grauwertkorrektur: | |||
| \nDie meisten Kameras versuchen bei der Belichtungsmessung auf ein sogenanntes 18%-Grau gleichmässig zu belichten. | |||
| Dies ist für Belichtungsreihen eher unerwünscht. Mit dieser Einstellung können Sie dem entgegenwirken. Den einzustellenden | |||
| Wert muss man über Belichtungsversuche empirisch ermitteln, da die Sensoren bei jedem Hersteller anders sind. | |||
| \n | |||
| \nAusgangspukt der Belichtungsreihe: | |||
| \nIn den meisten Fällen, wird der Dynamikumfang (Delta LW) einen gebrochenen Wert aufweisen, der in der Berechnung aufgerundet | |||
| wird. Dies führt dazu, dass der Dynamikumfang der Berechnung grösser ist als der Gemessene. Mit dieser Einstellung bestimmen Sie | |||
| von welchem Ende des Dynamikumfangs (Anker) die Berechnung der Belichtungsreihe starten soll. | |||
| </string> | |||
| </resources> | |||
| @@ -0,0 +1,169 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC.resultlist; | |||
| import java.text.DecimalFormat; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import android.content.Context; | |||
| import android.content.res.Resources; | |||
| import android.graphics.Bitmap; | |||
| import android.graphics.BitmapFactory; | |||
| import android.graphics.Canvas; | |||
| import android.graphics.Color; | |||
| import android.graphics.Paint; | |||
| import android.graphics.PorterDuff; | |||
| import android.graphics.PorterDuffXfermode; | |||
| import android.graphics.Bitmap.Config; | |||
| import android.graphics.Paint.Style; | |||
| import ch.spherIC.EVFormula; | |||
| import ch.spherIC.EasyBracketMain; | |||
| import ch.spherIC.R; | |||
| /** | |||
| * Factory that creates the exposure icons according to the EV range and values. | |||
| */ | |||
| public class ExposureFactory { | |||
| public static final DecimalFormat evDF = new DecimalFormat("0.######"); | |||
| /** | |||
| * DOCUMENT ME! | |||
| * | |||
| * @param context DOCUMENT ME! | |||
| * @param dpEV DOCUMENT ME! | |||
| * @param bpEv DOCUMENT ME! | |||
| * @param calcPrmAperture DOCUMENT ME! | |||
| * @param calcPrmEvStep DOCUMENT ME! | |||
| * @param fixBP DOCUMENT ME! | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| public static List<Exposure> calculateExposures(Context context, double dpEV, double bpEv, double calcPrmAperture, | |||
| double calcPrmEvStep, boolean fixBP, List<Double> allowedShutters) { | |||
| Exposure exp; | |||
| List<Exposure> exposures = new ArrayList<Exposure>(); | |||
| double deltaEV = bpEv - dpEV; | |||
| long nbrExposures = Math.round(deltaEV / calcPrmEvStep) + 1; | |||
| // correct the deltaEV | |||
| deltaEV = calcPrmEvStep * (nbrExposures - 1); | |||
| double baseEVStep = -deltaEV / 2; | |||
| for (int i = 0; i < nbrExposures; i++) { | |||
| boolean found = false; | |||
| String shutterSpeed = ""; | |||
| double shutter; | |||
| double evValue = 0; | |||
| double evStep = baseEVStep + i * calcPrmEvStep; | |||
| if (fixBP) { | |||
| evValue = bpEv - (nbrExposures - 1 - i) * calcPrmEvStep; | |||
| } else { | |||
| evValue = dpEV + i * calcPrmEvStep; | |||
| } | |||
| shutter = Double.valueOf(evDF.format((EVFormula.calcShutterSpeed(calcPrmAperture, evValue)))); | |||
| for (int j = 1; j < allowedShutters.size(); j++) { | |||
| double v1 = allowedShutters.get(j - 1); | |||
| double v2 = allowedShutters.get(j); | |||
| if ((v1 <= shutter && shutter <= v2) || (v2 <= shutter && shutter <= v1)) { | |||
| if (Math.abs(shutter - v1) <= Math.abs(shutter - v2)) { | |||
| shutterSpeed = (v1 < 1) ? "1/" + evDF.format((1 / v1)) | |||
| : "" + EasyBracketMain.DF.format(v1) + "''"; | |||
| } else { | |||
| shutterSpeed = (v2 < 1) ? "1/" + evDF.format((1 / v2)) | |||
| : "" + EasyBracketMain.DF.format(v2) + "''"; | |||
| } | |||
| found = true; | |||
| break; | |||
| } | |||
| } | |||
| if (!found) { | |||
| shutterSpeed = (shutter < 1) ? "1/" + Math.round(1 / shutter) | |||
| : "" + EasyBracketMain.DF.format(shutter) + "''"; | |||
| } | |||
| exp = new Exposure(i + 1, "f/" + EasyBracketMain.DF.format(calcPrmAperture), shutterSpeed, evStep, deltaEV, | |||
| getExpIcon(context, i + 1, (int) nbrExposures)); | |||
| exposures.add(exp); | |||
| } | |||
| return exposures; | |||
| } | |||
| /** | |||
| * Retrieves Icon. | |||
| * | |||
| * @param context Context | |||
| * @param exp {@link Exposure} object | |||
| * | |||
| * @return Color stepped icon | |||
| */ | |||
| private static Bitmap getExpIcon(Context context, int expNbr, int nbrExposures) { | |||
| Bitmap mIcon; | |||
| Bitmap mIconBG; | |||
| Bitmap mIconSymbol; | |||
| Bitmap mIconSymbol_bl; | |||
| Canvas canvas; | |||
| Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); | |||
| final Resources res = context.getResources(); | |||
| final int twentyPercentGray = Math.round(255f * 0.8f); | |||
| int deltaRGB = twentyPercentGray; | |||
| if (expNbr > 1 || nbrExposures > 1) { | |||
| deltaRGB = twentyPercentGray / (nbrExposures - 1) * (expNbr - 1); | |||
| } | |||
| // The background | |||
| mIconBG = Bitmap.createBitmap(36, 36, Config.ARGB_8888); | |||
| mIconBG.eraseColor(0x00000000); | |||
| canvas = new Canvas(mIconBG); | |||
| mPaint.setStyle(Style.FILL); | |||
| mPaint.setColor(Color.argb(255, deltaRGB, deltaRGB, deltaRGB)); | |||
| canvas.drawRect(2, 2, 33, 33, mPaint); | |||
| // Let's retrieve all icon pieces as Bitmaps. | |||
| mIcon = BitmapFactory.decodeResource(res, R.drawable.exposureicon_frame); | |||
| mIconSymbol = BitmapFactory.decodeResource(res, R.drawable.exposureicon_symb_white); | |||
| mIconSymbol_bl = BitmapFactory.decodeResource(res, R.drawable.exposureicon_symb_black); | |||
| // Prepares the paint that will be used to draw our icon mask. Using | |||
| // PorterDuff.Mode.SRC_OVER means the image that will be drawn will | |||
| // mask the already drawn image. | |||
| mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER)); | |||
| // We're now ready to drawn our Android-like icon :) | |||
| if (deltaRGB > twentyPercentGray / 2) { | |||
| canvas.drawBitmap(mIconSymbol_bl, 0, 0, mPaint); | |||
| } else { | |||
| canvas.drawBitmap(mIconSymbol, 0, 0, mPaint); | |||
| } | |||
| canvas.drawBitmap(mIcon, 0, 0, mPaint); | |||
| return mIconBG; | |||
| } | |||
| } | |||
| @@ -0,0 +1,157 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC; | |||
| import android.app.Activity; | |||
| import android.app.Dialog; | |||
| import android.content.pm.PackageInfo; | |||
| import android.content.pm.PackageManager; | |||
| import android.content.pm.PackageManager.NameNotFoundException; | |||
| import android.view.View; | |||
| import android.view.View.OnClickListener; | |||
| import android.widget.Button; | |||
| import android.widget.ImageView; | |||
| import android.widget.TextView; | |||
| import ch.spherIC.settings.SettingsDlg; | |||
| /** | |||
| * Dialog factory class. | |||
| */ | |||
| public final class DialogFactory { | |||
| /** | |||
| * Static main method to initialize classes | |||
| * | |||
| * @param dlgCode Code of dialog to instantiate. See {@link EasyBracketMain} | |||
| * @param parent Parent {@link Activity} | |||
| * | |||
| * @return Instantiated dialog | |||
| */ | |||
| public static Dialog createDialog(int dlgCode, Activity parent) { | |||
| Dialog dlg; | |||
| switch (dlgCode) { | |||
| case EasyBracketMain.ABOUT_DLG: | |||
| dlg = createAboutDialog(parent); | |||
| break; | |||
| case EasyBracketMain.SETTINGS_DLG: | |||
| dlg = createSettingsDialog(parent); | |||
| break; | |||
| case EasyBracketMain.USERGUIDE_DLG: | |||
| dlg = createUserGuideDialog(parent); | |||
| break; | |||
| default: | |||
| dlg = null; | |||
| break; | |||
| } | |||
| return dlg; | |||
| } | |||
| /** | |||
| * Creates the About Dialog | |||
| */ | |||
| private static Dialog createAboutDialog(Activity parent) { | |||
| final Dialog dialog = new Dialog(parent); | |||
| dialog.setContentView(R.layout.about_dialog); | |||
| parent.getResources().getText(R.string.menuAbout); | |||
| dialog.setTitle(parent.getResources().getText(R.string.menuAbout) + " EasyBracketing..."); | |||
| ImageView image = (ImageView) dialog.findViewById(R.id.about_imageAppIcon); | |||
| image.setImageResource(R.drawable.icon); | |||
| TextView text = (TextView) dialog.findViewById(R.id.about_TextDescription); | |||
| text.setText(parent.getResources().getText(R.string.about_Description)); | |||
| text = (TextView) dialog.findViewById(R.id.about_TextVersion); | |||
| text.setText(parent.getResources().getText(R.string.AppVersionLabel).toString() | |||
| + " " + parent.getResources().getText(R.string.AppVersion).toString()); | |||
| text = (TextView) dialog.findViewById(R.id.about_TextAutor); | |||
| text.setText(parent.getResources().getText(R.string.about_DevelopedBy).toString()); | |||
| ((Button) dialog.findViewById(R.id.btn_AboutClose)).setOnClickListener(new OnClickListener() { | |||
| @Override | |||
| public void onClick(View v) { | |||
| dialog.dismiss(); | |||
| } | |||
| }); | |||
| return dialog; | |||
| } | |||
| /** | |||
| * Creates the Settings Dialog | |||
| */ | |||
| private static Dialog createSettingsDialog(Activity parent) { | |||
| final Dialog dialog = new SettingsDlg(parent); | |||
| return dialog; | |||
| } | |||
| /** | |||
| * Creates the User Guide Dialog | |||
| */ | |||
| private static Dialog createUserGuideDialog(Activity parent) { | |||
| String versionName = ""; | |||
| final Dialog dialog = new Dialog(parent); | |||
| dialog.setContentView(R.layout.userguide_dialog); | |||
| parent.getResources().getText(R.string.menuUserGuide); | |||
| dialog.setTitle(parent.getResources().getText(R.string.menuUserGuide)); | |||
| ImageView image = (ImageView) dialog.findViewById(R.id.ug_imageAppIcon); | |||
| image.setImageResource(R.drawable.icon); | |||
| try { | |||
| PackageInfo ai = parent.getPackageManager().getPackageInfo("ch.spherIC", PackageManager.GET_CONFIGURATIONS); | |||
| System.out.println(ai.versionName); | |||
| } catch (NameNotFoundException e) { | |||
| // TODO Auto-generated catch block | |||
| e.printStackTrace(); | |||
| } | |||
| TextView text = (TextView) dialog.findViewById(R.id.ug_TextVersion); | |||
| text.setText(parent.getResources().getText(R.string.AppVersionLabel).toString() | |||
| + " " | |||
| + parent.getPackageManager().getPackageInfo("ch.spherIC", PackageManager.GET_CONFIGURATIONS).versionName); | |||
| ((Button) dialog.findViewById(R.id.btn_ugClose)).setOnClickListener(new OnClickListener() { | |||
| @Override | |||
| public void onClick(View v) { | |||
| dialog.dismiss(); | |||
| } | |||
| }); | |||
| return dialog; | |||
| } | |||
| } | |||
| @@ -0,0 +1,242 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC.resultlist; | |||
| import java.util.List; | |||
| import android.app.Activity; | |||
| import android.content.Context; | |||
| import android.util.DisplayMetrics; | |||
| import android.view.Gravity; | |||
| import android.view.View; | |||
| import android.view.ViewGroup; | |||
| import android.widget.BaseAdapter; | |||
| import android.widget.ImageView; | |||
| import android.widget.LinearLayout; | |||
| import android.widget.TextView; | |||
| import android.widget.LinearLayout.LayoutParams; | |||
| import ch.spherIC.R; | |||
| /** | |||
| * Exposure adapter view class. | |||
| */ | |||
| class ExposureAdapterView extends LinearLayout { | |||
| private static DisplayMetrics metrics; | |||
| /** | |||
| * Creates a new ExposureAdapterView object. | |||
| * | |||
| * @param context DOCUMENT ME! | |||
| * @param weather DOCUMENT ME! | |||
| */ | |||
| public ExposureAdapterView(Context context, Exposure exposure, int nbrExposures) { | |||
| super(context); | |||
| this.setOrientation(HORIZONTAL); | |||
| ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(metrics); | |||
| // Nbr | |||
| TextView nbrControl = new TextView(context); | |||
| LinearLayout.LayoutParams nbrParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| nbrParams.setMargins(3, 1, 1, 1); | |||
| nbrControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| nbrControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| nbrControl.setText(Integer.toString(exposure.getNbr())); | |||
| addView(nbrControl, nbrParams); | |||
| // Aperture | |||
| TextView apertureControl = new TextView(context); | |||
| LinearLayout.LayoutParams apertureParams = new LinearLayout.LayoutParams(100, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| apertureParams.setMargins(1, 1, 1, 1); | |||
| apertureControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| apertureControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| apertureControl.setText(exposure.getAperture()); | |||
| addView(apertureControl, apertureParams); | |||
| // Shutter speed | |||
| TextView shutterControl = new TextView(context); | |||
| LinearLayout.LayoutParams shutterParams = new LinearLayout.LayoutParams(170, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| shutterParams.setMargins(1, 1, 1, 1); | |||
| shutterControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| shutterControl.setTextAppearance(context, R.style.ResultExposureTextSpecial); | |||
| shutterControl.setText(exposure.getShutterSpeed()); | |||
| addView(shutterControl, shutterParams); | |||
| // EV Step | |||
| TextView evStepControl = new TextView(context); | |||
| LinearLayout.LayoutParams evStepParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| evStepParams.setMargins(1, 1, 1, 1); | |||
| evStepControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| evStepControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| evStepControl.setText(exposure.getEvStepAsString()); | |||
| addView(evStepControl, evStepParams); | |||
| // Icon | |||
| ImageView expIconControl = new ImageView(context); | |||
| LinearLayout.LayoutParams expIconParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| expIconParams.setMargins(1, 1, 1, 1); | |||
| expIconControl.setImageBitmap(exposure.getEvStepBtmp()); | |||
| addView(expIconControl, expIconParams); | |||
| } | |||
| } | |||
| /** | |||
| * Exposure results adapter. | |||
| */ | |||
| public class ExposureAdapter extends BaseAdapter { | |||
| private static Object metrics; | |||
| private Context context; | |||
| private List<Exposure> exposureList; | |||
| /** | |||
| * Creates a new ExposureAdapter object. | |||
| */ | |||
| public ExposureAdapter(Context context, List<Exposure> expList) { | |||
| this.context = context; | |||
| this.exposureList = expList; | |||
| } | |||
| /** | |||
| * Retrieves list size. | |||
| * | |||
| * @return list size | |||
| */ | |||
| @Override | |||
| public int getCount() { | |||
| return this.exposureList.size(); | |||
| } | |||
| /** | |||
| * Retrieves the exposure at index <code>position</code>. | |||
| * | |||
| * @param position Index in list | |||
| * | |||
| * @return Exposure at index <code>position</code> | |||
| */ | |||
| @Override | |||
| public Object getItem(int position) { | |||
| return this.exposureList.get(position); | |||
| } | |||
| /** | |||
| * Retrieves the number of the exposure at index <code>position</code>. | |||
| * | |||
| * @param position Index in list | |||
| * | |||
| * @return the number of the exposure at index <code>position</code> | |||
| */ | |||
| @Override | |||
| public long getItemId(int position) { | |||
| //return this.exposureList.get(position).getNbr(); | |||
| return position; | |||
| } | |||
| /** | |||
| * Retrieves a view representing a single result row. | |||
| * | |||
| * @param position Index in list | |||
| * @param convertView view | |||
| * @param parent parent | |||
| * | |||
| * @return {@link ExposureAdapterView} | |||
| */ | |||
| @Override | |||
| public View getView(int position, View convertView, ViewGroup parent) { | |||
| Exposure exposure = this.exposureList.get(position); | |||
| return new ExposureAdapterView(this.context, exposure, this.exposureList.size()); | |||
| } | |||
| /** | |||
| * Retrieves the value of | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| public static View getHeaderView(Context context, LinearLayout headerLL) { | |||
| int black = headerLL.getResources().getColor(R.color.black); | |||
| // Nbr | |||
| TextView nbrControl = new TextView(context); | |||
| LinearLayout.LayoutParams nbrParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| nbrParams.setMargins(3, 1, 1, 1); | |||
| nbrControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| nbrControl.setTextSize(13f); | |||
| nbrControl.setTextColor(black); | |||
| nbrControl.setText(R.string.expNbrLbl); | |||
| headerLL.addView(nbrControl, nbrParams); | |||
| // Aperture | |||
| TextView apertureControl = new TextView(context); | |||
| LinearLayout.LayoutParams apertureParams = new LinearLayout.LayoutParams(100, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| apertureParams.setMargins(1, 1, 1, 1); | |||
| apertureControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| apertureControl.setTextSize(13f); | |||
| apertureControl.setTextColor(black); | |||
| apertureControl.setText(R.string.aperture); | |||
| headerLL.addView(apertureControl, apertureParams); | |||
| // Shutter speed | |||
| TextView shutterControl = new TextView(context); | |||
| LinearLayout.LayoutParams shutterParams = new LinearLayout.LayoutParams(170, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| shutterParams.setMargins(1, 1, 1, 1); | |||
| shutterControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| shutterControl.setTextSize(13f); | |||
| shutterControl.setTextColor(black); | |||
| shutterControl.setText(R.string.shutter_speed); | |||
| headerLL.addView(shutterControl, shutterParams); | |||
| // EV Step | |||
| TextView evStepControl = new TextView(context); | |||
| LinearLayout.LayoutParams evStepParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| evStepParams.setMargins(1, 1, 1, 1); | |||
| evStepControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| evStepControl.setTextSize(13f); | |||
| evStepControl.setTextColor(black); | |||
| evStepControl.setText(R.string.expEVStep); | |||
| headerLL.addView(evStepControl, evStepParams); | |||
| // Icon | |||
| ImageView expIconControl = new ImageView(context); | |||
| LinearLayout.LayoutParams expIconParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| expIconParams.setMargins(1, 1, 1, 1); | |||
| headerLL.addView(expIconControl, expIconParams); | |||
| return headerLL; | |||
| } | |||
| /** | |||
| * Retrieves the value of | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| private static DisplayMetrics getMetrics() { | |||
| if (metrics == null) { | |||
| metrics = new DisplayMetrics(); | |||
| } | |||
| return metrics; | |||
| } | |||
| } | |||
| @@ -0,0 +1,59 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <LinearLayout | |||
| xmlns:android="http://schemas.android.com/apk/res/android" | |||
| android:layout_width="fill_parent" | |||
| android:padding="10dp" | |||
| android:layout_height="fill_parent" | |||
| android:background="@drawable/bg_about" | |||
| android:orientation="vertical" | |||
| android:id="@+id/layout_AboutRoot"> | |||
| <LinearLayout | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:orientation="horizontal" | |||
| android:id="@+id/layout_aboutVersion"> | |||
| <ImageView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginRight="20dip" | |||
| android:id="@+id/about_imageAppIcon" /> | |||
| <LinearLayout | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:id="@+id/layout_aboutVersionText" | |||
| android:orientation="vertical"> | |||
| <TextView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:textColor="#FF000000" | |||
| android:text="iii" | |||
| android:id="@+id/about_TextDescription" /> | |||
| <TextView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:textColor="#FF000000" | |||
| android:text="iii" | |||
| android:id="@+id/about_TextVersion" | |||
| android:textStyle="bold" /> | |||
| </LinearLayout> | |||
| </LinearLayout> | |||
| <TextView | |||
| android:text="@+id/TextView01" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:id="@+id/about_TextAutor" | |||
| android:textColor="@color/black" | |||
| android:paddingBottom="20dip" | |||
| android:paddingTop="20dip"></TextView> | |||
| <Button | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:background="@drawable/btn_fs" | |||
| android:id="@+id/btn_AboutClose" | |||
| android:textColor="@color/white" | |||
| android:layout_gravity="center_horizontal" | |||
| android:text="@string/BtnClose"></Button> | |||
| </LinearLayout> | |||
| @@ -0,0 +1,247 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC.resultlist; | |||
| import java.util.List; | |||
| import android.app.Activity; | |||
| import android.content.Context; | |||
| import android.util.DisplayMetrics; | |||
| import android.view.Gravity; | |||
| import android.view.View; | |||
| import android.view.ViewGroup; | |||
| import android.widget.BaseAdapter; | |||
| import android.widget.ImageView; | |||
| import android.widget.LinearLayout; | |||
| import android.widget.TextView; | |||
| import android.widget.LinearLayout.LayoutParams; | |||
| import ch.spherIC.R; | |||
| /** | |||
| * Exposure adapter view class. | |||
| */ | |||
| class ExposureAdapterView extends LinearLayout { | |||
| DisplayMetrics metrics = new DisplayMetrics(); | |||
| ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(metrics); | |||
| /** | |||
| * Creates a new ExposureAdapterView object. | |||
| * | |||
| * @param context DOCUMENT ME! | |||
| * @param weather DOCUMENT ME! | |||
| */ | |||
| public ExposureAdapterView(Context context, Exposure exposure) { | |||
| super(context); | |||
| this.setOrientation(HORIZONTAL); | |||
| // Nbr | |||
| TextView nbrControl = new TextView(context); | |||
| LinearLayout.LayoutParams nbrParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| nbrParams.setMargins(3, 1, 1, 1); | |||
| nbrControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| nbrControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| nbrControl.setText(Integer.toString(exposure.getNbr())); | |||
| addView(nbrControl, nbrParams); | |||
| // Aperture | |||
| TextView apertureControl = new TextView(context); | |||
| LinearLayout.LayoutParams apertureParams = new LinearLayout.LayoutParams(100, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| apertureParams.setMargins(1, 1, 1, 1); | |||
| apertureControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| apertureControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| apertureControl.setText(exposure.getAperture()); | |||
| addView(apertureControl, apertureParams); | |||
| // Shutter speed | |||
| TextView shutterControl = new TextView(context); | |||
| LinearLayout.LayoutParams shutterParams = new LinearLayout.LayoutParams(170, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| shutterParams.setMargins(1, 1, 1, 1); | |||
| shutterControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| shutterControl.setTextAppearance(context, R.style.ResultExposureTextSpecial); | |||
| shutterControl.setText(exposure.getShutterSpeed()); | |||
| addView(shutterControl, shutterParams); | |||
| // EV Step | |||
| TextView evStepControl = new TextView(context); | |||
| LinearLayout.LayoutParams evStepParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| evStepParams.setMargins(1, 1, 1, 1); | |||
| evStepControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| evStepControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| evStepControl.setText(exposure.getEvStepAsString()); | |||
| addView(evStepControl, evStepParams); | |||
| // Icon | |||
| ImageView expIconControl = new ImageView(context); | |||
| LinearLayout.LayoutParams expIconParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| expIconParams.setMargins(1, 1, 1, 1); | |||
| expIconControl.setImageBitmap(exposure.getEvStepBtmp()); | |||
| addView(expIconControl, expIconParams); | |||
| } | |||
| } | |||
| /** | |||
| * Exposure results adapter. | |||
| */ | |||
| public class ExposureAdapter extends BaseAdapter { | |||
| private static DisplayMetrics metrics; | |||
| private Context context; | |||
| private List<Exposure> exposureList; | |||
| /** | |||
| * Creates a new ExposureAdapter object. | |||
| */ | |||
| public ExposureAdapter(Context context, List<Exposure> expList) { | |||
| this.context = context; | |||
| this.exposureList = expList; | |||
| } | |||
| /** | |||
| * Retrieves list size. | |||
| * | |||
| * @return list size | |||
| */ | |||
| @Override | |||
| public int getCount() { | |||
| return this.exposureList.size(); | |||
| } | |||
| /** | |||
| * Retrieves the exposure at index <code>position</code>. | |||
| * | |||
| * @param position Index in list | |||
| * | |||
| * @return Exposure at index <code>position</code> | |||
| */ | |||
| @Override | |||
| public Object getItem(int position) { | |||
| return this.exposureList.get(position); | |||
| } | |||
| /** | |||
| * Retrieves the number of the exposure at index <code>position</code>. | |||
| * | |||
| * @param position Index in list | |||
| * | |||
| * @return the number of the exposure at index <code>position</code> | |||
| */ | |||
| @Override | |||
| public long getItemId(int position) { | |||
| //return this.exposureList.get(position).getNbr(); | |||
| return position; | |||
| } | |||
| /** | |||
| * Retrieves a view representing a single result row. | |||
| * | |||
| * @param position Index in list | |||
| * @param convertView view | |||
| * @param parent parent | |||
| * | |||
| * @return {@link ExposureAdapterView} | |||
| */ | |||
| @Override | |||
| public View getView(int position, View convertView, ViewGroup parent) { | |||
| Exposure exposure = this.exposureList.get(position); | |||
| return new ExposureAdapterView(this.context, exposure); | |||
| } | |||
| /** | |||
| * Retrieves the value of | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| public static View getHeaderView(Context context, LinearLayout headerLL) { | |||
| int black = headerLL.getResources().getColor(R.color.black); | |||
| int width = getMetrics(context).widthPixels; | |||
| // Nbr | |||
| TextView nbrControl = new TextView(context); | |||
| LinearLayout.LayoutParams nbrParams = new LinearLayout.LayoutParams(Math.round(0.14583f * width), | |||
| LayoutParams.WRAP_CONTENT, 0.2f); | |||
| nbrParams.setMargins(3, 1, 1, 1); | |||
| nbrControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| nbrControl.setTextSize(13f); | |||
| nbrControl.setTextColor(black); | |||
| nbrControl.setText(R.string.expNbrLbl); | |||
| headerLL.addView(nbrControl, nbrParams); | |||
| // Aperture | |||
| TextView apertureControl = new TextView(context); | |||
| LinearLayout.LayoutParams apertureParams = new LinearLayout.LayoutParams(Math.round(0.20833f * width), | |||
| LayoutParams.WRAP_CONTENT, 0.2f); | |||
| apertureParams.setMargins(1, 1, 1, 1); | |||
| apertureControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| apertureControl.setTextSize(13f); | |||
| apertureControl.setTextColor(black); | |||
| apertureControl.setText(R.string.aperture); | |||
| headerLL.addView(apertureControl, apertureParams); | |||
| // Shutter speed | |||
| TextView shutterControl = new TextView(context); | |||
| LinearLayout.LayoutParams shutterParams = new LinearLayout.LayoutParams(Math.round(0.35417f * width), | |||
| LayoutParams.WRAP_CONTENT, 0.2f); | |||
| shutterParams.setMargins(1, 1, 1, 1); | |||
| shutterControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| shutterControl.setTextSize(13f); | |||
| shutterControl.setTextColor(black); | |||
| shutterControl.setText(R.string.shutter_speed); | |||
| headerLL.addView(shutterControl, shutterParams); | |||
| // EV Step | |||
| TextView evStepControl = new TextView(context); | |||
| LinearLayout.LayoutParams evStepParams = new LinearLayout.LayoutParams(Math.round(0.14583f * width), | |||
| LayoutParams.WRAP_CONTENT, 0.2f); | |||
| evStepParams.setMargins(1, 1, 1, 1); | |||
| evStepControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| evStepControl.setTextSize(13f); | |||
| evStepControl.setTextColor(black); | |||
| evStepControl.setText(R.string.expEVStep); | |||
| headerLL.addView(evStepControl, evStepParams); | |||
| // Icon | |||
| ImageView expIconControl = new ImageView(context); | |||
| LinearLayout.LayoutParams expIconParams = new LinearLayout.LayoutParams(Math.round(0.14583f * width), | |||
| LayoutParams.WRAP_CONTENT, 0.2f); | |||
| expIconParams.setMargins(1, 1, 1, 1); | |||
| headerLL.addView(expIconControl, expIconParams); | |||
| return headerLL; | |||
| } | |||
| /** | |||
| * Retrieves the value of | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| private static DisplayMetrics getMetrics(Context context) { | |||
| if (metrics == null) { | |||
| metrics = new DisplayMetrics(); | |||
| ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(metrics); | |||
| } | |||
| return metrics; | |||
| } | |||
| } | |||
| @@ -0,0 +1,89 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <LinearLayout | |||
| xmlns:android="http://schemas.android.com/apk/res/android" | |||
| android:background="@drawable/bg_about" | |||
| android:padding="10dp" | |||
| android:layout_height="fill_parent" | |||
| android:layout_width="fill_parent" | |||
| android:orientation="vertical"> | |||
| <LinearLayout | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:orientation="horizontal" | |||
| android:id="@+id/layout_ugVersion"> | |||
| <ImageView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginRight="20dip" | |||
| android:id="@+id/ug_imageAppIcon" | |||
| android:layout_gravity="center_vertical" /> | |||
| <TextView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:textColor="#FF000000" | |||
| android:text="iii" | |||
| android:id="@+id/ug_TextVersion" | |||
| android:textStyle="bold" | |||
| android:layout_gravity="center_vertical" | |||
| android:gravity="center_vertical" /> | |||
| </LinearLayout> | |||
| <ScrollView | |||
| android:id="@+id/ug_ScrollView" | |||
| android:layout_width="wrap_content" | |||
| android:addStatesFromChildren="true" | |||
| android:layout_height="250dp"> | |||
| <LinearLayout | |||
| android:orientation="vertical" | |||
| android:layout_height="wrap_content" | |||
| android:layout_width="wrap_content"> | |||
| <TextView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:id="@+id/ug_hdr_GenPourpose" | |||
| android:textColor="@color/black" | |||
| android:textStyle="bold" | |||
| android:layout_marginBottom="5dp" | |||
| android:layout_marginTop="5dp" | |||
| android:text="@string/header_GeneralPurpose"></TextView> | |||
| <TextView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:id="@+id/ug_txt_GenPourpose" | |||
| android:textColor="@color/black" | |||
| android:text="@string/text_GeneralPurpose"> | |||
| </TextView> | |||
| <TextView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:id="@+id/ug_hdr_HowTo" | |||
| android:textColor="@color/black" | |||
| android:textStyle="bold" | |||
| android:layout_marginBottom="5dp" | |||
| android:layout_marginTop="5dp" | |||
| android:text="@string/header_HowTo"></TextView> | |||
| <TextView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:id="@+id/ug_txt_HowTo" | |||
| android:textColor="@color/black" | |||
| android:text="@string/text_HowTo"></TextView> | |||
| </LinearLayout> | |||
| </ScrollView> | |||
| <Button | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:background="@drawable/btn_fs" | |||
| android:id="@+id/btn_ugClose" | |||
| android:textColor="@color/white" | |||
| android:layout_gravity="center_horizontal" | |||
| android:layout_marginTop="20dp" android:text="@string/BtnClose"> | |||
| </Button> | |||
| </LinearLayout> | |||
| @@ -0,0 +1,147 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC; | |||
| import android.app.Activity; | |||
| import android.app.Dialog; | |||
| import android.content.pm.ApplicationInfo; | |||
| import android.content.pm.PackageManager; | |||
| import android.view.View; | |||
| import android.view.View.OnClickListener; | |||
| import android.widget.Button; | |||
| import android.widget.ImageView; | |||
| import android.widget.TextView; | |||
| import ch.spherIC.settings.SettingsDlg; | |||
| /** | |||
| * Dialog factory class. | |||
| */ | |||
| public final class DialogFactory { | |||
| /** | |||
| * Static main method to initialize classes | |||
| * | |||
| * @param dlgCode Code of dialog to instantiate. See {@link EasyBracketMain} | |||
| * @param parent Parent {@link Activity} | |||
| * | |||
| * @return Instantiated dialog | |||
| */ | |||
| public static Dialog createDialog(int dlgCode, Activity parent) { | |||
| Dialog dlg; | |||
| switch (dlgCode) { | |||
| case EasyBracketMain.ABOUT_DLG: | |||
| dlg = createAboutDialog(parent); | |||
| break; | |||
| case EasyBracketMain.SETTINGS_DLG: | |||
| dlg = createSettingsDialog(parent); | |||
| break; | |||
| case EasyBracketMain.USERGUIDE_DLG: | |||
| dlg = createUserGuideDialog(parent); | |||
| break; | |||
| default: | |||
| dlg = null; | |||
| break; | |||
| } | |||
| return dlg; | |||
| } | |||
| /** | |||
| * Creates the About Dialog | |||
| */ | |||
| private static Dialog createAboutDialog(Activity parent) { | |||
| final Dialog dialog = new Dialog(parent); | |||
| dialog.setContentView(R.layout.about_dialog); | |||
| parent.getResources().getText(R.string.menuAbout); | |||
| dialog.setTitle(parent.getResources().getText(R.string.menuAbout) + " EasyBracketing..."); | |||
| ImageView image = (ImageView) dialog.findViewById(R.id.about_imageAppIcon); | |||
| image.setImageResource(R.drawable.icon); | |||
| TextView text = (TextView) dialog.findViewById(R.id.about_TextDescription); | |||
| text.setText(parent.getResources().getText(R.string.about_Description)); | |||
| text = (TextView) dialog.findViewById(R.id.about_TextVersion); | |||
| text.setText(parent.getResources().getText(R.string.AppVersionLabel).toString() | |||
| + " " + parent.getResources().getText(R.string.AppVersion).toString()); | |||
| text = (TextView) dialog.findViewById(R.id.about_TextAutor); | |||
| text.setText(parent.getResources().getText(R.string.about_DevelopedBy).toString()); | |||
| ((Button) dialog.findViewById(R.id.btn_AboutClose)).setOnClickListener(new OnClickListener() { | |||
| @Override | |||
| public void onClick(View v) { | |||
| dialog.dismiss(); | |||
| } | |||
| }); | |||
| return dialog; | |||
| } | |||
| /** | |||
| * Creates the Settings Dialog | |||
| */ | |||
| private static Dialog createSettingsDialog(Activity parent) { | |||
| final Dialog dialog = new SettingsDlg(parent); | |||
| return dialog; | |||
| } | |||
| /** | |||
| * Creates the User Guide Dialog | |||
| */ | |||
| private static Dialog createUserGuideDialog(Activity parent) { | |||
| final Dialog dialog = new Dialog(parent); | |||
| dialog.setContentView(R.layout.userguide_dialog); | |||
| parent.getResources().getText(R.string.menuUserGuide); | |||
| dialog.setTitle(parent.getResources().getText(R.string.menuUserGuide)); | |||
| ImageView image = (ImageView) dialog.findViewById(R.id.ug_imageAppIcon); | |||
| image.setImageResource(R.drawable.icon); | |||
| ApplicationInfo ai = parent.getPackageManager().getApplicationInfo("ch.spherIC", PackageManager.GET_META_DATA) | |||
| TextView text = (TextView) dialog.findViewById(R.id.ug_TextVersion); | |||
| text.setText(parent.getResources().getText(R.string.AppVersionLabel).toString() | |||
| + " " + parent.getResources().getString(R.attr.).toString()); | |||
| ((Button) dialog.findViewById(R.id.btn_ugClose)).setOnClickListener(new OnClickListener() { | |||
| @Override | |||
| public void onClick(View v) { | |||
| dialog.dismiss(); | |||
| } | |||
| }); | |||
| return dialog; | |||
| } | |||
| } | |||
| @@ -0,0 +1,51 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <LinearLayout | |||
| xmlns:android="http://schemas.android.com/apk/res/android" | |||
| android:background="@drawable/bg_about" | |||
| android:padding="10dp" | |||
| android:layout_height="fill_parent" | |||
| android:layout_width="fill_parent" | |||
| android:orientation="vertical"> | |||
| <LinearLayout | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:orientation="horizontal" | |||
| android:id="@+id/layout_ugVersion"> | |||
| <ImageView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginRight="20dip" | |||
| android:id="@+id/ug_imageAppIcon" | |||
| android:layout_gravity="center_vertical" /> | |||
| <TextView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:textColor="#FF000000" | |||
| android:text="iii" | |||
| android:id="@+id/ug_TextVersion" | |||
| android:textStyle="bold" | |||
| android:layout_gravity="center_vertical" | |||
| android:gravity="center_vertical" /> | |||
| </LinearLayout> | |||
| <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content"> | |||
| <TextView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" android:id="@+id/ug_Text" android:ellipsize="none" android:text="@string/AppVersion"> | |||
| </TextView> | |||
| </LinearLayout> | |||
| <Button | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:background="@drawable/btn_fs" | |||
| android:id="@+id/btn_ugClose" | |||
| android:text="Close" | |||
| android:textColor="@color/white" | |||
| android:layout_gravity="center_horizontal"> | |||
| </Button> | |||
| </LinearLayout> | |||
| @@ -0,0 +1,74 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <resources> | |||
| <string | |||
| name="app_name">Easy Bracketing</string> | |||
| <string | |||
| name="dynamic_range">Dynamikbereich</string> | |||
| <string | |||
| name="shutter_speed">Belichtungszeit</string> | |||
| <string | |||
| name="aperture">Blende</string> | |||
| <string | |||
| name="ev">LW</string> | |||
| <string | |||
| name="dark_point">Werte Dunkelpunkt</string> | |||
| <string | |||
| name="bright_point">Werte Hellpunkt</string> | |||
| <string | |||
| name="calcParams">Berechnungsparameter</string> | |||
| <string | |||
| name="delta_EV">Δ LW</string> | |||
| <string | |||
| name="expEVStep">LW-Schritt</string> | |||
| <string | |||
| name="calculate">Berechnen</string> | |||
| <string | |||
| name="reset">Zurücksetzen</string> | |||
| <string | |||
| name="bracketingRes">Bracketing Belichtungswerte</string> | |||
| <string | |||
| name="expNbrLbl"># Bel.</string> | |||
| <string | |||
| name="toastWarningDP_BP">Das Delta zwischen dem LW des Dunkelpunkt und dem LW des Hellpunkt ist kleiner oder glleich 0. | |||
| \nBitte korrigieren Sie die Eingaben.</string> | |||
| <string | |||
| name="menuUserGuide">Benutzeranleitung</string> | |||
| <string | |||
| name="menuSettings">Einstellungen...</string> | |||
| <string | |||
| name="menuAbout">Info</string> | |||
| <string | |||
| name="about_Description"> | |||
| EasyBracketing dient zur schnellen und einfachen Berechnung einer Belichtungsserie ausgehend | |||
| von den Belichtungswerten eines Dunkelpunktes und eines Hellpunktes. | |||
| </string> | |||
| <string | |||
| name="AppVersionLabel">Version:</string> | |||
| <string | |||
| name="about_DevelopedBy">Entwickelt von spherIC (F. Smilari)\nMail an: | |||
| merlin868@hotmail.com\n\nÜbersetzt von spherIC (F. Smilari)</string> | |||
| <string | |||
| name="Percent18Correction">18%-Grauwertkorrektur</string> | |||
| <string | |||
| name="Percent18CorrectionBP">Hellpunktkorrektur (LW)</string> | |||
| <string | |||
| name="Percent18CorrectionDP">Dunkelpunktkorrektur (LW)</string> | |||
| <string | |||
| name="FixRangePoint">Ausgangspunkt für Belichtungsserie</string> | |||
| <string | |||
| name="FixRangePointBP">Von Hellpunktwerten ausgehen</string> | |||
| <string | |||
| name="FixRangePointDP">Von Dunkelpunktwerten ausgehen</string> | |||
| <string | |||
| name="BtnSave">Speichern</string> | |||
| <string | |||
| name="BtnCancel">Abbrechen</string> | |||
| <string | |||
| name="header_GeneralPurpose">1. Allgm. Verwendungszweck</string> | |||
| <string | |||
| name="text_GeneralPurpose">Text here</string> | |||
| <string | |||
| name="header_HowTo">2. Vorgehensweise</string> | |||
| <string | |||
| name="text_HowTo">Text here</string> | |||
| </resources> | |||
| @@ -0,0 +1,155 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC; | |||
| import android.app.Activity; | |||
| import android.app.Dialog; | |||
| import android.content.pm.PackageInfo; | |||
| import android.content.pm.PackageManager; | |||
| import android.content.pm.PackageManager.NameNotFoundException; | |||
| import android.view.View; | |||
| import android.view.View.OnClickListener; | |||
| import android.widget.Button; | |||
| import android.widget.ImageView; | |||
| import android.widget.TextView; | |||
| import ch.spherIC.settings.SettingsDlg; | |||
| /** | |||
| * Dialog factory class. | |||
| */ | |||
| public final class DialogFactory { | |||
| /** | |||
| * Static main method to initialize classes | |||
| * | |||
| * @param dlgCode Code of dialog to instantiate. See {@link EasyBracketMain} | |||
| * @param parent Parent {@link Activity} | |||
| * | |||
| * @return Instantiated dialog | |||
| */ | |||
| public static Dialog createDialog(int dlgCode, Activity parent) { | |||
| Dialog dlg; | |||
| switch (dlgCode) { | |||
| case EasyBracketMain.ABOUT_DLG: | |||
| dlg = createAboutDialog(parent); | |||
| break; | |||
| case EasyBracketMain.SETTINGS_DLG: | |||
| dlg = createSettingsDialog(parent); | |||
| break; | |||
| case EasyBracketMain.USERGUIDE_DLG: | |||
| dlg = createUserGuideDialog(parent); | |||
| break; | |||
| default: | |||
| dlg = null; | |||
| break; | |||
| } | |||
| return dlg; | |||
| } | |||
| /** | |||
| * Creates the About Dialog | |||
| */ | |||
| private static Dialog createAboutDialog(Activity parent) { | |||
| final Dialog dialog = new Dialog(parent); | |||
| dialog.setContentView(R.layout.about_dialog); | |||
| parent.getResources().getText(R.string.menuAbout); | |||
| dialog.setTitle(parent.getResources().getText(R.string.menuAbout) + " EasyBracketing..."); | |||
| ImageView image = (ImageView) dialog.findViewById(R.id.about_imageAppIcon); | |||
| image.setImageResource(R.drawable.icon); | |||
| TextView text = (TextView) dialog.findViewById(R.id.about_TextDescription); | |||
| text.setText(parent.getResources().getText(R.string.about_Description)); | |||
| text = (TextView) dialog.findViewById(R.id.about_TextVersion); | |||
| text.setText(parent.getResources().getText(R.string.AppVersionLabel).toString() | |||
| + " " + parent.getResources().getText(R.string.AppVersion).toString()); | |||
| text = (TextView) dialog.findViewById(R.id.about_TextAutor); | |||
| text.setText(parent.getResources().getText(R.string.about_DevelopedBy).toString()); | |||
| ((Button) dialog.findViewById(R.id.btn_AboutClose)).setOnClickListener(new OnClickListener() { | |||
| @Override | |||
| public void onClick(View v) { | |||
| dialog.dismiss(); | |||
| } | |||
| }); | |||
| return dialog; | |||
| } | |||
| /** | |||
| * Creates the Settings Dialog | |||
| */ | |||
| private static Dialog createSettingsDialog(Activity parent) { | |||
| final Dialog dialog = new SettingsDlg(parent); | |||
| return dialog; | |||
| } | |||
| /** | |||
| * Creates the User Guide Dialog | |||
| */ | |||
| private static Dialog createUserGuideDialog(Activity parent) { | |||
| final Dialog dialog = new Dialog(parent); | |||
| dialog.setContentView(R.layout.userguide_dialog); | |||
| parent.getResources().getText(R.string.menuUserGuide); | |||
| dialog.setTitle(parent.getResources().getText(R.string.menuUserGuide)); | |||
| ImageView image = (ImageView) dialog.findViewById(R.id.ug_imageAppIcon); | |||
| image.setImageResource(R.drawable.icon); | |||
| try { | |||
| PackageInfo ai = parent.getPackageManager().getPackageInfo("ch.spherIC", PackageManager.GET_META_DATA); | |||
| System.out.println(ai); | |||
| } catch (NameNotFoundException e) { | |||
| // TODO Auto-generated catch block | |||
| e.printStackTrace(); | |||
| } | |||
| TextView text = (TextView) dialog.findViewById(R.id.ug_TextVersion); | |||
| text.setText(parent.getResources().getText(R.string.AppVersionLabel).toString() | |||
| + " " + parent.getResources().getString(R.string.AppVersion).toString()); | |||
| ((Button) dialog.findViewById(R.id.btn_ugClose)).setOnClickListener(new OnClickListener() { | |||
| @Override | |||
| public void onClick(View v) { | |||
| dialog.dismiss(); | |||
| } | |||
| }); | |||
| return dialog; | |||
| } | |||
| } | |||
| @@ -0,0 +1,94 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <resources> | |||
| <string | |||
| name="app_name">Easy Bracketing</string> | |||
| <string | |||
| name="dynamic_range">Dynamic Range</string> | |||
| <string | |||
| name="shutter_speed">Shutter Speed</string> | |||
| <string | |||
| name="aperture">Aperture</string> | |||
| <string | |||
| name="ev">EV</string> | |||
| <string | |||
| name="dark_point">Dark Point Values</string> | |||
| <string | |||
| name="bright_point">Bright Point Values</string> | |||
| <string | |||
| name="calcParams">Calculation Parameters</string> | |||
| <string | |||
| name="delta_EV">Δ EV</string> | |||
| <string | |||
| name="expEVStep">EV Step</string> | |||
| <string | |||
| name="calculate">Calculate</string> | |||
| <string | |||
| name="reset">Reset</string> | |||
| <string | |||
| name="bracketingRes">Bracketing Exposures Values</string> | |||
| <string | |||
| name="expNbrLbl"># Exp.</string> | |||
| <string | |||
| name="toastWarningDP_BP">The delta between dark point EV and bright point EV is less or | |||
| equal to 0. Please correct the inputs.</string> | |||
| <string | |||
| name="menuUserGuide">User Guide</string> | |||
| <string | |||
| name="menuSettings">Settings...</string> | |||
| <string | |||
| name="menuAbout">About</string> | |||
| <string name="about_Description">EasyBracketing allows you to easy calculate a serie of exposure | |||
| values according to initial dark and bright point values.</string> | |||
| <string | |||
| name="AppVersionLabel">Version:</string> | |||
| <string name="about_DevelopedBy">Developed by spherIC (F. Smilari)\nMail to: | |||
| merlin868@hotmail.com\n\nTranslated by spherIC (F. Smilari)</string> | |||
| <string | |||
| name="Percent18Correction">18%-Gray Correction</string> | |||
| <string | |||
| name="Percent18CorrectionBP">Bright Pt. Value Correction (EV)</string> | |||
| <string | |||
| name="Percent18CorrectionDP">Dark Pt. Value Correction (EV)</string> | |||
| <string | |||
| name="FixRangePoint">Fixed EV Range Value</string> | |||
| <string | |||
| name="FixRangePointBP">Keep Bright Point Values fixed</string> | |||
| <string | |||
| name="FixRangePointDP">Keep Dark Point Value fixed</string> | |||
| <string | |||
| name="BtnSave">Save</string> | |||
| <string | |||
| name="BtnCancel">Cancel</string> | |||
| <string | |||
| name="BtnClose">Close</string> | |||
| <string | |||
| name="header_GeneralPurpose">1. General Purpose</string> | |||
| <string | |||
| name="text_GeneralPurpose">When doing a bracketing for a later HDR image, often a problem araises: The dynamic range of the | |||
| composition is too large to fit the classic \"+2EV/0EV/-2EV\" approach. | |||
| \nThis is the moment when \"EasyBracketing\" comes to its own. | |||
| \nStarting with camera-measured values for the brightest and darkest point and according to some configurable calculation parameters | |||
| you can calculate all the exposure values for the bracketing and do the shots. | |||
| </string> | |||
| <string | |||
| name="header_HowTo">2. How to use</string> | |||
| <string name="text_HowTo">1. Set your camera to spot measuring. | |||
| \n2. Choose a suitable aperture. | |||
| \n3. With your camera measure the exposure values for the darkest point of your composition. | |||
| \n4. With your camera measure the exposure values for the brightest point of your composition. | |||
| \n5. Set these values in the area \"Dynamic Range\" of EasyBracketing. | |||
| \n6. Modify the calculation parameters to your needs if necessary. | |||
| \n7. Click on \"Calculate\" to start the computing of the exposure values of the bracketing. | |||
| \n | |||
| \nSettings: | |||
| \n | |||
| \n18%%-Gray Correction: | |||
| \nMost cameras try to achieve a so called 18%-Gray exposure value on measuring. This is not exactly what we want when doing bracketing. | |||
| This setting helps to counteract this behavior. Beacuse each sensor, depending on the manufacturer, has a little bit different behavior, | |||
| the exact values have to be determined by experimental trials. | |||
| \n | |||
| \nFixed EV Range Value: | |||
| \nIn most cases, the resulting delta EV from the measuring is a floating value which is rounded to the next integer value on calculation. | |||
| This means that the calculation value is always bigger than the measured. With this setting you can determine on which edge of the dynamic | |||
| range (anchor) the bracketing calculation should start.</string> | |||
| </resources> | |||
| @@ -0,0 +1,155 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC; | |||
| import android.app.Activity; | |||
| import android.app.Dialog; | |||
| import android.content.pm.PackageInfo; | |||
| import android.content.pm.PackageManager; | |||
| import android.content.pm.PackageManager.NameNotFoundException; | |||
| import android.view.View; | |||
| import android.view.View.OnClickListener; | |||
| import android.widget.Button; | |||
| import android.widget.ImageView; | |||
| import android.widget.TextView; | |||
| import ch.spherIC.settings.SettingsDlg; | |||
| /** | |||
| * Dialog factory class. | |||
| */ | |||
| public final class DialogFactory { | |||
| /** | |||
| * Static main method to initialize classes | |||
| * | |||
| * @param dlgCode Code of dialog to instantiate. See {@link EasyBracketMain} | |||
| * @param parent Parent {@link Activity} | |||
| * | |||
| * @return Instantiated dialog | |||
| */ | |||
| public static Dialog createDialog(int dlgCode, Activity parent) { | |||
| Dialog dlg; | |||
| switch (dlgCode) { | |||
| case EasyBracketMain.ABOUT_DLG: | |||
| dlg = createAboutDialog(parent); | |||
| break; | |||
| case EasyBracketMain.SETTINGS_DLG: | |||
| dlg = createSettingsDialog(parent); | |||
| break; | |||
| case EasyBracketMain.USERGUIDE_DLG: | |||
| dlg = createUserGuideDialog(parent); | |||
| break; | |||
| default: | |||
| dlg = null; | |||
| break; | |||
| } | |||
| return dlg; | |||
| } | |||
| /** | |||
| * Creates the About Dialog | |||
| */ | |||
| private static Dialog createAboutDialog(Activity parent) { | |||
| final Dialog dialog = new Dialog(parent); | |||
| dialog.setContentView(R.layout.about_dialog); | |||
| parent.getResources().getText(R.string.menuAbout); | |||
| dialog.setTitle(parent.getResources().getText(R.string.menuAbout) + " EasyBracketing..."); | |||
| ImageView image = (ImageView) dialog.findViewById(R.id.about_imageAppIcon); | |||
| image.setImageResource(R.drawable.icon); | |||
| TextView text = (TextView) dialog.findViewById(R.id.about_TextDescription); | |||
| text.setText(parent.getResources().getText(R.string.about_Description)); | |||
| text = (TextView) dialog.findViewById(R.id.about_TextVersion); | |||
| text.setText(parent.getResources().getText(R.string.AppVersionLabel).toString() | |||
| + " " + parent.getResources().getText(R.string.AppVersion).toString()); | |||
| text = (TextView) dialog.findViewById(R.id.about_TextAutor); | |||
| text.setText(parent.getResources().getText(R.string.about_DevelopedBy).toString()); | |||
| ((Button) dialog.findViewById(R.id.btn_AboutClose)).setOnClickListener(new OnClickListener() { | |||
| @Override | |||
| public void onClick(View v) { | |||
| dialog.dismiss(); | |||
| } | |||
| }); | |||
| return dialog; | |||
| } | |||
| /** | |||
| * Creates the Settings Dialog | |||
| */ | |||
| private static Dialog createSettingsDialog(Activity parent) { | |||
| final Dialog dialog = new SettingsDlg(parent); | |||
| return dialog; | |||
| } | |||
| /** | |||
| * Creates the User Guide Dialog | |||
| */ | |||
| private static Dialog createUserGuideDialog(Activity parent) { | |||
| final Dialog dialog = new Dialog(parent); | |||
| dialog.setContentView(R.layout.userguide_dialog); | |||
| parent.getResources().getText(R.string.menuUserGuide); | |||
| dialog.setTitle(parent.getResources().getText(R.string.menuUserGuide)); | |||
| ImageView image = (ImageView) dialog.findViewById(R.id.ug_imageAppIcon); | |||
| image.setImageResource(R.drawable.icon); | |||
| try { | |||
| PackageInfo ai = parent.getPackageManager().getPackageInfo("ch.spherIC", PackageManager.GET_CONFIGURATIONS); | |||
| System.out.println(ai); | |||
| } catch (NameNotFoundException e) { | |||
| // TODO Auto-generated catch block | |||
| e.printStackTrace(); | |||
| } | |||
| TextView text = (TextView) dialog.findViewById(R.id.ug_TextVersion); | |||
| text.setText(parent.getResources().getText(R.string.AppVersionLabel).toString() | |||
| + " " + parent.getResources().getString(R.string.AppVersion).toString()); | |||
| ((Button) dialog.findViewById(R.id.btn_ugClose)).setOnClickListener(new OnClickListener() { | |||
| @Override | |||
| public void onClick(View v) { | |||
| dialog.dismiss(); | |||
| } | |||
| }); | |||
| return dialog; | |||
| } | |||
| } | |||
| @@ -0,0 +1,68 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <resources> | |||
| <string | |||
| name="app_name">Easy Bracketing</string> | |||
| <string | |||
| name="dynamic_range">Dynamic Range</string> | |||
| <string | |||
| name="shutter_speed">Shutter Speed</string> | |||
| <string | |||
| name="aperture">Aperture</string> | |||
| <string | |||
| name="ev">EV</string> | |||
| <string | |||
| name="dark_point">Dark Point Values</string> | |||
| <string | |||
| name="bright_point">Bright Point Values</string> | |||
| <string | |||
| name="calcParams">Calculation Parameters</string> | |||
| <string | |||
| name="delta_EV">Δ EV</string> | |||
| <string | |||
| name="expEVStep">EV Step</string> | |||
| <string | |||
| name="calculate">Calculate</string> | |||
| <string | |||
| name="reset">Reset</string> | |||
| <string | |||
| name="bracketingRes">Bracketing Exposures Values</string> | |||
| <string | |||
| name="expNbrLbl"># Exp.</string> | |||
| <string | |||
| name="toastWarningDP_BP">The delta between dark point EV and bright point EV is less or | |||
| equal to 0. Please correct the inputs.</string> | |||
| <string | |||
| name="menuUserGuide">User Guide</string> | |||
| <string | |||
| name="menuSettings">Settings...</string> | |||
| <string | |||
| name="menuAbout">About</string> | |||
| <string | |||
| name="about_Description">EasyBracketing allows you to easy calculate a serie of exposure | |||
| values according to initial dark and bright point values.</string> | |||
| <string | |||
| name="AppVersionLabel">Version:</string> | |||
| <string | |||
| name="about_DevelopedBy">Developed by spherIC (F. Smilari)\nMail to: | |||
| merlin868@hotmail.com\n\nTranslated by spherIC (F. Smilari)</string> | |||
| <string | |||
| name="Percent18Correction">18%-Gray Correction</string> | |||
| <string | |||
| name="Percent18CorrectionBP">Bright Pt. Value Correction (EV)</string> | |||
| <string | |||
| name="Percent18CorrectionDP">Dark Pt. Value Correction (EV)</string> | |||
| <string | |||
| name="FixRangePoint">Fixed EV Range Value</string> | |||
| <string | |||
| name="FixRangePointBP">Keep Bright Point Values fixed</string> | |||
| <string | |||
| name="FixRangePointDP">Keep Dark Point Value fixed</string> | |||
| <string | |||
| name="BtnSave">Save</string> | |||
| <string | |||
| name="BtnCancel">Cancel</string> | |||
| <string | |||
| name="userGuidePourpose">Text | |||
| </string> | |||
| <string name="header_GeneralPurpose"></string> | |||
| </resources> | |||
| @@ -0,0 +1,41 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <LinearLayout | |||
| xmlns:android="http://schemas.android.com/apk/res/android" | |||
| android:background="@drawable/bg_about" | |||
| android:padding="10dp" | |||
| android:layout_height="fill_parent" | |||
| android:layout_width="fill_parent" | |||
| android:orientation="vertical"> | |||
| <LinearLayout | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:orientation="horizontal" | |||
| android:id="@+id/layout_ugVersion"> | |||
| <ImageView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginRight="20dip" | |||
| android:id="@+id/ug_imageAppIcon" | |||
| android:layout_gravity="center_vertical" /> | |||
| <TextView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:textColor="#FF000000" | |||
| android:text="iii" | |||
| android:id="@+id/ug_TextVersion" | |||
| android:textStyle="bold" | |||
| android:layout_gravity="center_vertical" | |||
| android:gravity="center_vertical" /> | |||
| </LinearLayout> | |||
| <ScrollView android:id="@+id/ug_ScrollView" android:layout_width="wrap_content" android:addStatesFromChildren="true" android:layout_height="300dp"><LinearLayout android:orientation="vertical" android:layout_height="wrap_content" android:layout_width="wrap_content"> | |||
| <TextView android:layout_width="wrap_content" android:id="@+id/ug_Text" android:text="@string/userGuidePourpose" android:textColor="@color/black" android:layout_height="wrap_content"> | |||
| </TextView></LinearLayout></ScrollView><Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/btn_fs" android:id="@+id/btn_ugClose" android:text="Close" android:textColor="@color/white" android:layout_gravity="center_horizontal" android:layout_marginTop="20dp"> | |||
| </Button> | |||
| </LinearLayout> | |||
| @@ -0,0 +1,240 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC.resultlist; | |||
| import java.util.List; | |||
| import android.app.Activity; | |||
| import android.content.Context; | |||
| import android.util.DisplayMetrics; | |||
| import android.view.Gravity; | |||
| import android.view.View; | |||
| import android.view.ViewGroup; | |||
| import android.widget.BaseAdapter; | |||
| import android.widget.ImageView; | |||
| import android.widget.LinearLayout; | |||
| import android.widget.TextView; | |||
| import android.widget.LinearLayout.LayoutParams; | |||
| import ch.spherIC.R; | |||
| /** | |||
| * Exposure adapter view class. | |||
| */ | |||
| class ExposureAdapterView extends LinearLayout { | |||
| private static DisplayMetrics metrics; | |||
| /** | |||
| * Creates a new ExposureAdapterView object. | |||
| * | |||
| * @param context DOCUMENT ME! | |||
| * @param weather DOCUMENT ME! | |||
| */ | |||
| public ExposureAdapterView(Context context, Exposure exposure) { | |||
| super(context); | |||
| this.setOrientation(HORIZONTAL); | |||
| // Nbr | |||
| TextView nbrControl = new TextView(context); | |||
| LinearLayout.LayoutParams nbrParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| nbrParams.setMargins(3, 1, 1, 1); | |||
| nbrControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| nbrControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| nbrControl.setText(Integer.toString(exposure.getNbr())); | |||
| addView(nbrControl, nbrParams); | |||
| // Aperture | |||
| TextView apertureControl = new TextView(context); | |||
| LinearLayout.LayoutParams apertureParams = new LinearLayout.LayoutParams(100, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| apertureParams.setMargins(1, 1, 1, 1); | |||
| apertureControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| apertureControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| apertureControl.setText(exposure.getAperture()); | |||
| addView(apertureControl, apertureParams); | |||
| // Shutter speed | |||
| TextView shutterControl = new TextView(context); | |||
| LinearLayout.LayoutParams shutterParams = new LinearLayout.LayoutParams(170, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| shutterParams.setMargins(1, 1, 1, 1); | |||
| shutterControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| shutterControl.setTextAppearance(context, R.style.ResultExposureTextSpecial); | |||
| shutterControl.setText(exposure.getShutterSpeed()); | |||
| addView(shutterControl, shutterParams); | |||
| // EV Step | |||
| TextView evStepControl = new TextView(context); | |||
| LinearLayout.LayoutParams evStepParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| evStepParams.setMargins(1, 1, 1, 1); | |||
| evStepControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| evStepControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| evStepControl.setText(exposure.getEvStepAsString()); | |||
| addView(evStepControl, evStepParams); | |||
| // Icon | |||
| ImageView expIconControl = new ImageView(context); | |||
| LinearLayout.LayoutParams expIconParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| expIconParams.setMargins(1, 1, 1, 1); | |||
| expIconControl.setImageBitmap(exposure.getEvStepBtmp()); | |||
| addView(expIconControl, expIconParams); | |||
| } | |||
| } | |||
| /** | |||
| * Exposure results adapter. | |||
| */ | |||
| public class ExposureAdapter extends BaseAdapter { | |||
| private static DisplayMetrics metrics; | |||
| private Context context; | |||
| private List<Exposure> exposureList; | |||
| /** | |||
| * Creates a new ExposureAdapter object. | |||
| */ | |||
| public ExposureAdapter(Context context, List<Exposure> expList) { | |||
| this.context = context; | |||
| this.exposureList = expList; | |||
| } | |||
| /** | |||
| * Retrieves list size. | |||
| * | |||
| * @return list size | |||
| */ | |||
| @Override | |||
| public int getCount() { | |||
| return this.exposureList.size(); | |||
| } | |||
| /** | |||
| * Retrieves the exposure at index <code>position</code>. | |||
| * | |||
| * @param position Index in list | |||
| * | |||
| * @return Exposure at index <code>position</code> | |||
| */ | |||
| @Override | |||
| public Object getItem(int position) { | |||
| return this.exposureList.get(position); | |||
| } | |||
| /** | |||
| * Retrieves the number of the exposure at index <code>position</code>. | |||
| * | |||
| * @param position Index in list | |||
| * | |||
| * @return the number of the exposure at index <code>position</code> | |||
| */ | |||
| @Override | |||
| public long getItemId(int position) { | |||
| //return this.exposureList.get(position).getNbr(); | |||
| return position; | |||
| } | |||
| /** | |||
| * Retrieves a view representing a single result row. | |||
| * | |||
| * @param position Index in list | |||
| * @param convertView view | |||
| * @param parent parent | |||
| * | |||
| * @return {@link ExposureAdapterView} | |||
| */ | |||
| @Override | |||
| public View getView(int position, View convertView, ViewGroup parent) { | |||
| Exposure exposure = this.exposureList.get(position); | |||
| return new ExposureAdapterView(this.context, exposure, this.exposureList.size()); | |||
| } | |||
| /** | |||
| * Retrieves the value of | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| public static View getHeaderView(Context context, LinearLayout headerLL) { | |||
| int black = headerLL.getResources().getColor(R.color.black); | |||
| // Nbr | |||
| TextView nbrControl = new TextView(context); | |||
| LinearLayout.LayoutParams nbrParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| nbrParams.setMargins(3, 1, 1, 1); | |||
| nbrControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| nbrControl.setTextSize(13f); | |||
| nbrControl.setTextColor(black); | |||
| nbrControl.setText(R.string.expNbrLbl); | |||
| headerLL.addView(nbrControl, nbrParams); | |||
| // Aperture | |||
| TextView apertureControl = new TextView(context); | |||
| LinearLayout.LayoutParams apertureParams = new LinearLayout.LayoutParams(100, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| apertureParams.setMargins(1, 1, 1, 1); | |||
| apertureControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| apertureControl.setTextSize(13f); | |||
| apertureControl.setTextColor(black); | |||
| apertureControl.setText(R.string.aperture); | |||
| headerLL.addView(apertureControl, apertureParams); | |||
| // Shutter speed | |||
| TextView shutterControl = new TextView(context); | |||
| LinearLayout.LayoutParams shutterParams = new LinearLayout.LayoutParams(170, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| shutterParams.setMargins(1, 1, 1, 1); | |||
| shutterControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| shutterControl.setTextSize(13f); | |||
| shutterControl.setTextColor(black); | |||
| shutterControl.setText(R.string.shutter_speed); | |||
| headerLL.addView(shutterControl, shutterParams); | |||
| // EV Step | |||
| TextView evStepControl = new TextView(context); | |||
| LinearLayout.LayoutParams evStepParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| evStepParams.setMargins(1, 1, 1, 1); | |||
| evStepControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| evStepControl.setTextSize(13f); | |||
| evStepControl.setTextColor(black); | |||
| evStepControl.setText(R.string.expEVStep); | |||
| headerLL.addView(evStepControl, evStepParams); | |||
| // Icon | |||
| ImageView expIconControl = new ImageView(context); | |||
| LinearLayout.LayoutParams expIconParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| expIconParams.setMargins(1, 1, 1, 1); | |||
| headerLL.addView(expIconControl, expIconParams); | |||
| return headerLL; | |||
| } | |||
| /** | |||
| * Retrieves the value of | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| private static DisplayMetrics getMetrics(Context context) { | |||
| if (metrics == null) { | |||
| metrics = new DisplayMetrics(); | |||
| ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(metrics); | |||
| } | |||
| return metrics; | |||
| } | |||
| } | |||
| @@ -0,0 +1,43 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <LinearLayout | |||
| xmlns:android="http://schemas.android.com/apk/res/android" | |||
| android:background="@drawable/bg_about" | |||
| android:padding="10dp" | |||
| android:layout_height="fill_parent" | |||
| android:layout_width="fill_parent" | |||
| android:orientation="vertical"> | |||
| <LinearLayout | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:orientation="horizontal" | |||
| android:id="@+id/layout_ugVersion"> | |||
| <ImageView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginRight="20dip" | |||
| android:id="@+id/ug_imageAppIcon" | |||
| android:layout_gravity="center_vertical" /> | |||
| <TextView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:textColor="#FF000000" | |||
| android:text="iii" | |||
| android:id="@+id/ug_TextVersion" | |||
| android:textStyle="bold" | |||
| android:layout_gravity="center_vertical" | |||
| android:gravity="center_vertical" /> | |||
| </LinearLayout> | |||
| <ScrollView android:id="@+id/ug_ScrollView" android:layout_width="wrap_content" android:addStatesFromChildren="true" android:layout_height="300dp"><LinearLayout android:orientation="vertical" android:layout_height="wrap_content" android:layout_width="wrap_content"> | |||
| <TextView android:layout_width="wrap_content" android:id="@+id/ug_Text" android:text="@string/userGuidePourpose" android:textColor="@color/black" android:layout_height="wrap_content"> | |||
| </TextView></LinearLayout></ScrollView><Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/btn_fs" android:id="@+id/btn_ugClose" android:text="Close" android:textColor="@color/white" android:layout_gravity="center_horizontal" android:layout_marginTop="20dp"> | |||
| </Button> | |||
| </LinearLayout> | |||
| @@ -0,0 +1,72 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <resources> | |||
| <string | |||
| name="app_name">Easy Bracketing</string> | |||
| <string | |||
| name="dynamic_range">Dynamic Range</string> | |||
| <string | |||
| name="shutter_speed">Shutter Speed</string> | |||
| <string | |||
| name="aperture">Aperture</string> | |||
| <string | |||
| name="ev">EV</string> | |||
| <string | |||
| name="dark_point">Dark Point Values</string> | |||
| <string | |||
| name="bright_point">Bright Point Values</string> | |||
| <string | |||
| name="calcParams">Calculation Parameters</string> | |||
| <string | |||
| name="delta_EV">Δ EV</string> | |||
| <string | |||
| name="expEVStep">EV Step</string> | |||
| <string | |||
| name="calculate">Calculate</string> | |||
| <string | |||
| name="reset">Reset</string> | |||
| <string | |||
| name="bracketingRes">Bracketing Exposures Values</string> | |||
| <string | |||
| name="expNbrLbl"># Exp.</string> | |||
| <string | |||
| name="toastWarningDP_BP">The delta between dark point EV and bright point EV is less or | |||
| equal to 0. Please correct the inputs.</string> | |||
| <string | |||
| name="menuUserGuide">User Guide</string> | |||
| <string | |||
| name="menuSettings">Settings...</string> | |||
| <string | |||
| name="menuAbout">About</string> | |||
| <string | |||
| name="about_Description">EasyBracketing allows you to easy calculate a serie of exposure | |||
| values according to initial dark and bright point values.</string> | |||
| <string | |||
| name="AppVersionLabel">Version:</string> | |||
| <string | |||
| name="about_DevelopedBy">Developed by spherIC (F. Smilari)\nMail to: | |||
| merlin868@hotmail.com\n\nTranslated by spherIC (F. Smilari)</string> | |||
| <string | |||
| name="Percent18Correction">18%-Gray Correction</string> | |||
| <string | |||
| name="Percent18CorrectionBP">Bright Pt. Value Correction (EV)</string> | |||
| <string | |||
| name="Percent18CorrectionDP">Dark Pt. Value Correction (EV)</string> | |||
| <string | |||
| name="FixRangePoint">Fixed EV Range Value</string> | |||
| <string | |||
| name="FixRangePointBP">Keep Bright Point Values fixed</string> | |||
| <string | |||
| name="FixRangePointDP">Keep Dark Point Value fixed</string> | |||
| <string | |||
| name="BtnSave">Save</string> | |||
| <string | |||
| name="BtnCancel">Cancel</string> | |||
| <string | |||
| name="header_GeneralPurpose">1. General Purpose</string> | |||
| <string | |||
| name="text_GeneralPurpose">Text here</string> | |||
| <string | |||
| name="header_HowTo">2. How to use</string> | |||
| <string | |||
| name="text_HowTo">Text here</string> | |||
| </resources> | |||
| @@ -0,0 +1,168 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC.resultlist; | |||
| import java.text.DecimalFormat; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import android.content.Context; | |||
| import android.content.res.Resources; | |||
| import android.graphics.Bitmap; | |||
| import android.graphics.BitmapFactory; | |||
| import android.graphics.Canvas; | |||
| import android.graphics.Color; | |||
| import android.graphics.Paint; | |||
| import android.graphics.PorterDuff; | |||
| import android.graphics.PorterDuffXfermode; | |||
| import android.graphics.Bitmap.Config; | |||
| import android.graphics.Paint.Style; | |||
| import ch.spherIC.EVFormula; | |||
| import ch.spherIC.EasyBracketMain; | |||
| import ch.spherIC.R; | |||
| /** | |||
| * Factory that creates the exposure icons according to the EV range and values. | |||
| */ | |||
| public class ExposureFactory { | |||
| public static final DecimalFormat evDF = new DecimalFormat("0.######"); | |||
| /** | |||
| * DOCUMENT ME! | |||
| * | |||
| * @param context DOCUMENT ME! | |||
| * @param dpEV DOCUMENT ME! | |||
| * @param bpEv DOCUMENT ME! | |||
| * @param calcPrmAperture DOCUMENT ME! | |||
| * @param calcPrmEvStep DOCUMENT ME! | |||
| * @param fixBP DOCUMENT ME! | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| public static List<Exposure> calculateExposures(Context context, double dpEV, double bpEv, double calcPrmAperture, | |||
| double calcPrmEvStep, boolean fixBP, List<Double> allowedShutters) { | |||
| Exposure exp; | |||
| List<Exposure> exposures = new ArrayList<Exposure>(); | |||
| double deltaEV = bpEv - dpEV; | |||
| long nbrExposures = Math.round(deltaEV / calcPrmEvStep) + 1; | |||
| // correct the deltaEV | |||
| deltaEV = calcPrmEvStep * (nbrExposures - 1); | |||
| double baseEVStep = -deltaEV / 2; | |||
| for (int i = 0; i < nbrExposures; i++) { | |||
| boolean found = false; | |||
| String shutterSpeed = ""; | |||
| double shutter; | |||
| double evValue = 0; | |||
| double evStep = baseEVStep + i * calcPrmEvStep; | |||
| if (fixBP) { | |||
| evValue = bpEv - (nbrExposures - 1 - i) * calcPrmEvStep; | |||
| } else { | |||
| evValue = dpEV + i * calcPrmEvStep; | |||
| } | |||
| shutter = Double.valueOf(evDF.format((EVFormula.calcShutterSpeed(calcPrmAperture, evValue)))); | |||
| for (int j = 1; j < allowedShutters.size(); j++) { | |||
| double v1 = allowedShutters.get(j - 1); | |||
| double v2 = allowedShutters.get(j); | |||
| if ((v1 <= shutter && shutter <= v2) || (v2 <= shutter && shutter <= v1)) { | |||
| if (Math.abs(shutter - v1) <= Math.abs(shutter - v2)) { | |||
| shutterSpeed = (v1 < 1) ? "1/" + evDF.format((1 / v1)) | |||
| : "" + EasyBracketMain.DF.format(v1) + "''"; | |||
| } else { | |||
| shutterSpeed = (v2 < 1) ? "1/" + evDF.format((1 / v2)) | |||
| : "" + EasyBracketMain.DF.format(v2) + "''"; | |||
| } | |||
| found = true; | |||
| break; | |||
| } | |||
| } | |||
| if (!found) { | |||
| shutterSpeed = (shutter < 1) ? "1/" + Math.round(1 / shutter) | |||
| : "" + EasyBracketMain.DF.format(shutter) + "''"; | |||
| } | |||
| exp = new Exposure(i + 1, "f/" + EasyBracketMain.DF.format(calcPrmAperture), shutterSpeed, evStep, deltaEV, | |||
| getExpIcon(context, i + 1, (int) nbrExposures)); | |||
| exposures.add(exp); | |||
| } | |||
| return exposures; | |||
| } | |||
| /** | |||
| * Retrieves Icon. | |||
| * | |||
| * @param context Context | |||
| * @param exp {@link Exposure} object | |||
| * | |||
| * @return Color stepped icon | |||
| */ | |||
| private static Bitmap getExpIcon(Context context, int expNbr, int nbrExposures) { | |||
| final int twentyPercentGray = Math.round(255f * 0.8f); | |||
| int deltaRGB = twentyPercentGray; | |||
| if (expNbr > 1 || nbrExposures > 1) { | |||
| deltaRGB = twentyPercentGray / (nbrExposures - 1) * (expNbr - 1); | |||
| } | |||
| Bitmap mIcon; | |||
| Bitmap mIconBG; | |||
| Bitmap mIconSymbol; | |||
| Bitmap mIconSymbol_bl; | |||
| Canvas canvas; | |||
| Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); | |||
| final Resources res = context.getResources(); | |||
| // The background | |||
| mIconBG = Bitmap.createBitmap(36, 36, Config.ARGB_8888); | |||
| mIconBG.eraseColor(0x00000000); | |||
| canvas = new Canvas(mIconBG); | |||
| mPaint.setStyle(Style.FILL); | |||
| mPaint.setColor(Color.argb(255, deltaRGB, deltaRGB, deltaRGB)); | |||
| canvas.drawRect(2, 2, 33, 33, mPaint); | |||
| // Let's retrieve all icon pieces as Bitmaps. | |||
| mIcon = BitmapFactory.decodeResource(res, R.drawable.exposureicon_frame); | |||
| mIconSymbol = BitmapFactory.decodeResource(res, R.drawable.exposureicon_symb_white); | |||
| mIconSymbol_bl = BitmapFactory.decodeResource(res, R.drawable.exposureicon_symb_black); | |||
| // Prepares the paint that will be used to draw our icon mask. Using | |||
| // PorterDuff.Mode.SRC_OVER means the image that will be drawn will | |||
| // mask the already drawn image. | |||
| mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER)); | |||
| // We're now ready to drawn our Android-like icon :) | |||
| if (deltaRGB > twentyPercentGray / 2) { | |||
| canvas.drawBitmap(mIconSymbol_bl, 0, 0, mPaint); | |||
| } else { | |||
| canvas.drawBitmap(mIconSymbol, 0, 0, mPaint); | |||
| } | |||
| canvas.drawBitmap(mIcon, 0, 0, mPaint); | |||
| return mIconBG; | |||
| } | |||
| } | |||
| @@ -0,0 +1,83 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <resources> | |||
| <string | |||
| name="app_name">Easy Bracketing</string> | |||
| <string | |||
| name="dynamic_range">Dynamikbereich</string> | |||
| <string | |||
| name="shutter_speed">Belichtungszeit</string> | |||
| <string | |||
| name="aperture">Blende</string> | |||
| <string | |||
| name="ev">LW</string> | |||
| <string | |||
| name="dark_point">Werte Dunkelpunkt</string> | |||
| <string | |||
| name="bright_point">Werte Hellpunkt</string> | |||
| <string | |||
| name="calcParams">Berechnungsparameter</string> | |||
| <string | |||
| name="delta_EV">Δ LW</string> | |||
| <string | |||
| name="expEVStep">LW-Schritt</string> | |||
| <string | |||
| name="calculate">Berechnen</string> | |||
| <string | |||
| name="reset">Zurücksetzen</string> | |||
| <string | |||
| name="bracketingRes">Bracketing Belichtungswerte</string> | |||
| <string | |||
| name="expNbrLbl"># Bel.</string> | |||
| <string | |||
| name="toastWarningDP_BP">Das Delta zwischen dem LW des Dunkelpunkt und dem LW des Hellpunkt ist kleiner oder gleich 0. | |||
| \nBitte korrigieren Sie die Eingaben.</string> | |||
| <string | |||
| name="menuUserGuide">Benutzeranleitung</string> | |||
| <string | |||
| name="menuSettings">Einstellungen...</string> | |||
| <string | |||
| name="menuAbout">Info</string> | |||
| <string | |||
| name="about_Description"> | |||
| EasyBracketing dient zur schnellen und einfachen Berechnung einer Belichtungsserie ausgehend | |||
| von den Belichtungswerten eines Dunkelpunktes und eines Hellpunktes. | |||
| </string> | |||
| <string | |||
| name="AppVersionLabel">Version:</string> | |||
| <string | |||
| name="about_DevelopedBy">Entwickelt von spherIC (F. Smilari)\nMail an: | |||
| merlin868@hotmail.com\n\nÜbersetzt von spherIC (F. Smilari)</string> | |||
| <string | |||
| name="Percent18Correction">18%-Grauwertkorrektur</string> | |||
| <string | |||
| name="Percent18CorrectionBP">Hellpunktkorrektur (LW)</string> | |||
| <string | |||
| name="Percent18CorrectionDP">Dunkelpunktkorrektur (LW)</string> | |||
| <string | |||
| name="FixRangePoint">Ausgangspunkt für Belichtungsserie</string> | |||
| <string | |||
| name="FixRangePointBP">Von Hellpunktwerten ausgehen</string> | |||
| <string | |||
| name="FixRangePointDP">Von Dunkelpunktwerten ausgehen</string> | |||
| <string | |||
| name="BtnSave">Speichern</string> | |||
| <string | |||
| name="BtnCancel">Abbrechen</string> | |||
| <string | |||
| name="BtnClose">Schliessen</string> | |||
| <string | |||
| name="header_GeneralPurpose">1. Allgm. Verwendungszweck</string> | |||
| <string | |||
| name="text_GeneralPurpose"> | |||
| "Beim Erstellen einer Belichtungsreihe für ein späteres HDR-Bild, stellt sich oftmals das Problem, | |||
| dass der Kontrastumfang zu gross ist um von der typischen \"+2LW/0LW/-2LW\"-Vorgehensweise abgedeckt zu werden.\n | |||
| Hier kommt \"EasyBracketing\" zum Zug.\r | |||
| Ausgehend von gemessenen Werten für den hellsten Punkt resp. den dunkelsten Punkt | |||
| werden über definierbare Parameter alle notwendigen Belichtungen einer Belichtungsreihe berechnet. Diese können dann | |||
| an der Kamera sukzessive eingestellt und die Aufnahme ausgelöst werden." | |||
| </string> | |||
| <string | |||
| name="header_HowTo">2. Vorgehensweise</string> | |||
| <string | |||
| name="text_HowTo">Text here</string> | |||
| </resources> | |||
| @@ -0,0 +1,91 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <resources> | |||
| <string | |||
| name="app_name">Easy Bracketing</string> | |||
| <string | |||
| name="dynamic_range">Dynamikbereich</string> | |||
| <string | |||
| name="shutter_speed">Belichtungszeit</string> | |||
| <string | |||
| name="aperture">Blende</string> | |||
| <string | |||
| name="ev">LW</string> | |||
| <string | |||
| name="dark_point">Werte Dunkelpunkt</string> | |||
| <string | |||
| name="bright_point">Werte Hellpunkt</string> | |||
| <string | |||
| name="calcParams">Berechnungsparameter</string> | |||
| <string | |||
| name="delta_EV">Δ LW</string> | |||
| <string | |||
| name="expEVStep">LW-Schritt</string> | |||
| <string | |||
| name="calculate">Berechnen</string> | |||
| <string | |||
| name="reset">Zurücksetzen</string> | |||
| <string | |||
| name="bracketingRes">Bracketing Belichtungswerte</string> | |||
| <string | |||
| name="expNbrLbl"># Bel.</string> | |||
| <string | |||
| name="toastWarningDP_BP">Das Delta zwischen dem LW des Dunkelpunkt und dem LW des Hellpunkt ist kleiner oder gleich 0. | |||
| \nBitte korrigieren Sie die Eingaben.</string> | |||
| <string | |||
| name="menuUserGuide">Benutzeranleitung</string> | |||
| <string | |||
| name="menuSettings">Einstellungen...</string> | |||
| <string | |||
| name="menuAbout">Info</string> | |||
| <string | |||
| name="about_Description"> | |||
| EasyBracketing dient zur schnellen und einfachen Berechnung einer Belichtungsserie ausgehend | |||
| von den Belichtungswerten eines Dunkelpunktes und eines Hellpunktes. | |||
| </string> | |||
| <string | |||
| name="AppVersionLabel">Version:</string> | |||
| <string | |||
| name="about_DevelopedBy">Entwickelt von spherIC (F. Smilari)\nMail an: | |||
| merlin868@hotmail.com\n\nÜbersetzt von spherIC (F. Smilari)</string> | |||
| <string | |||
| name="Percent18Correction">18%-Grauwertkorrektur</string> | |||
| <string | |||
| name="Percent18CorrectionBP">Hellpunktkorrektur (LW)</string> | |||
| <string | |||
| name="Percent18CorrectionDP">Dunkelpunktkorrektur (LW)</string> | |||
| <string | |||
| name="FixRangePoint">Ausgangspunkt für Belichtungsserie</string> | |||
| <string | |||
| name="FixRangePointBP">Von Hellpunktwerten ausgehen</string> | |||
| <string | |||
| name="FixRangePointDP">Von Dunkelpunktwerten ausgehen</string> | |||
| <string | |||
| name="BtnSave">Speichern</string> | |||
| <string | |||
| name="BtnCancel">Abbrechen</string> | |||
| <string | |||
| name="BtnClose">Schliessen</string> | |||
| <string | |||
| name="header_GeneralPurpose">1. Allgm. Verwendungszweck</string> | |||
| <string | |||
| name="text_GeneralPurpose"> | |||
| Beim Erstellen einer Belichtungsreihe für ein späteres HDR-Bild, stellt sich oftmals das Problem, | |||
| dass der Kontrastumfang zu gross ist um von der typischen \"+2LW/0LW/-2LW\"-Vorgehensweise abgedeckt zu werden.\nHier | |||
| kommt \"EasyBracketing\" zum Zug.\nAusgehend von gemessenen Werten für den hellsten Punkt resp. den dunkelsten Punkt | |||
| werden über definierbare Parameter alle notwendigen Belichtungen einer Belichtungsreihe berechnet. Diese können dann | |||
| an der Kamera sukzessive eingestellt und die Aufnahme ausgelöst werden. | |||
| </string> | |||
| <string | |||
| name="header_HowTo">2. Vorgehensweise</string> | |||
| <string | |||
| name="text_HowTo"> | |||
| 1. Stellen Sie die Kamera auf Spotbelichtungsmessung. | |||
| \n2. Wählen Sie eine geeignete Blende.\n | |||
| \n3. Messen Sie mit der Kamera die Belichtungswerte für den dunkelsten Punkt ihres Bildausschnitts.\n | |||
| \n4. Messen Sie mit der Kamera die Belichtungswerte für den hellsten Punkt ihres Bildausschnitts.\n | |||
| \n5. Stellen Sie die gemessenen Werte im Bereich \"Dynamikbereich\" von EasyBracketing ein.\n | |||
| \n6. Verändern Sie, falls gewünscht die Berechnungsparamter nach Ihren Vorstellungen.\n | |||
| \n7. Klicken Sie auf \"Berechnen\" um die Belichtungsreihe zu berechnen.\n | |||
| </string> | |||
| </resources> | |||
| @@ -0,0 +1,153 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC; | |||
| import android.app.Activity; | |||
| import android.app.Dialog; | |||
| import android.content.pm.ApplicationInfo; | |||
| import android.content.pm.PackageManager; | |||
| import android.content.pm.PackageManager.NameNotFoundException; | |||
| import android.view.View; | |||
| import android.view.View.OnClickListener; | |||
| import android.widget.Button; | |||
| import android.widget.ImageView; | |||
| import android.widget.TextView; | |||
| import ch.spherIC.settings.SettingsDlg; | |||
| /** | |||
| * Dialog factory class. | |||
| */ | |||
| public final class DialogFactory { | |||
| /** | |||
| * Static main method to initialize classes | |||
| * | |||
| * @param dlgCode Code of dialog to instantiate. See {@link EasyBracketMain} | |||
| * @param parent Parent {@link Activity} | |||
| * | |||
| * @return Instantiated dialog | |||
| */ | |||
| public static Dialog createDialog(int dlgCode, Activity parent) { | |||
| Dialog dlg; | |||
| switch (dlgCode) { | |||
| case EasyBracketMain.ABOUT_DLG: | |||
| dlg = createAboutDialog(parent); | |||
| break; | |||
| case EasyBracketMain.SETTINGS_DLG: | |||
| dlg = createSettingsDialog(parent); | |||
| break; | |||
| case EasyBracketMain.USERGUIDE_DLG: | |||
| dlg = createUserGuideDialog(parent); | |||
| break; | |||
| default: | |||
| dlg = null; | |||
| break; | |||
| } | |||
| return dlg; | |||
| } | |||
| /** | |||
| * Creates the About Dialog | |||
| */ | |||
| private static Dialog createAboutDialog(Activity parent) { | |||
| final Dialog dialog = new Dialog(parent); | |||
| dialog.setContentView(R.layout.about_dialog); | |||
| parent.getResources().getText(R.string.menuAbout); | |||
| dialog.setTitle(parent.getResources().getText(R.string.menuAbout) + " EasyBracketing..."); | |||
| ImageView image = (ImageView) dialog.findViewById(R.id.about_imageAppIcon); | |||
| image.setImageResource(R.drawable.icon); | |||
| TextView text = (TextView) dialog.findViewById(R.id.about_TextDescription); | |||
| text.setText(parent.getResources().getText(R.string.about_Description)); | |||
| text = (TextView) dialog.findViewById(R.id.about_TextVersion); | |||
| text.setText(parent.getResources().getText(R.string.AppVersionLabel).toString() | |||
| + " " + parent.getResources().getText(R.string.AppVersion).toString()); | |||
| text = (TextView) dialog.findViewById(R.id.about_TextAutor); | |||
| text.setText(parent.getResources().getText(R.string.about_DevelopedBy).toString()); | |||
| ((Button) dialog.findViewById(R.id.btn_AboutClose)).setOnClickListener(new OnClickListener() { | |||
| @Override | |||
| public void onClick(View v) { | |||
| dialog.dismiss(); | |||
| } | |||
| }); | |||
| return dialog; | |||
| } | |||
| /** | |||
| * Creates the Settings Dialog | |||
| */ | |||
| private static Dialog createSettingsDialog(Activity parent) { | |||
| final Dialog dialog = new SettingsDlg(parent); | |||
| return dialog; | |||
| } | |||
| /** | |||
| * Creates the User Guide Dialog | |||
| */ | |||
| private static Dialog createUserGuideDialog(Activity parent) { | |||
| final Dialog dialog = new Dialog(parent); | |||
| dialog.setContentView(R.layout.userguide_dialog); | |||
| parent.getResources().getText(R.string.menuUserGuide); | |||
| dialog.setTitle(parent.getResources().getText(R.string.menuUserGuide)); | |||
| ImageView image = (ImageView) dialog.findViewById(R.id.ug_imageAppIcon); | |||
| image.setImageResource(R.drawable.icon); | |||
| try { | |||
| ApplicationInfo ai = parent.getPackageManager().getApplicationInfo("ch.spherIC", PackageManager.GET_META_DATA); | |||
| } catch (NameNotFoundException e) { | |||
| // TODO Auto-generated catch block | |||
| e.printStackTrace(); | |||
| } | |||
| TextView text = (TextView) dialog.findViewById(R.id.ug_TextVersion); | |||
| text.setText(parent.getResources().getText(R.string.AppVersionLabel).toString() | |||
| + " " + parent.getResources().getString(R.string.AppVersion).toString()); | |||
| ((Button) dialog.findViewById(R.id.btn_ugClose)).setOnClickListener(new OnClickListener() { | |||
| @Override | |||
| public void onClick(View v) { | |||
| dialog.dismiss(); | |||
| } | |||
| }); | |||
| return dialog; | |||
| } | |||
| } | |||
| @@ -0,0 +1,178 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC.resultlist; | |||
| import java.text.DecimalFormat; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import android.app.Activity; | |||
| import android.content.Context; | |||
| import android.content.res.Resources; | |||
| import android.graphics.Bitmap; | |||
| import android.graphics.BitmapFactory; | |||
| import android.graphics.Canvas; | |||
| import android.graphics.Color; | |||
| import android.graphics.Paint; | |||
| import android.graphics.PorterDuff; | |||
| import android.graphics.PorterDuffXfermode; | |||
| import android.graphics.Bitmap.Config; | |||
| import android.graphics.Paint.Style; | |||
| import android.util.DisplayMetrics; | |||
| import ch.spherIC.EVFormula; | |||
| import ch.spherIC.EasyBracketMain; | |||
| import ch.spherIC.R; | |||
| /** | |||
| * Factory that creates the exposure icons according to the EV range and values. | |||
| */ | |||
| public class ExposureFactory { | |||
| public static final DecimalFormat evDF = new DecimalFormat("0.######"); | |||
| /** | |||
| * DOCUMENT ME! | |||
| * | |||
| * @param context DOCUMENT ME! | |||
| * @param dpEV DOCUMENT ME! | |||
| * @param bpEv DOCUMENT ME! | |||
| * @param calcPrmAperture DOCUMENT ME! | |||
| * @param calcPrmEvStep DOCUMENT ME! | |||
| * @param fixBP DOCUMENT ME! | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| public static List<Exposure> calculateExposures(Context context, double dpEV, double bpEv, double calcPrmAperture, | |||
| double calcPrmEvStep, boolean fixBP, List<Double> allowedShutters) { | |||
| Exposure exp; | |||
| List<Exposure> exposures = new ArrayList<Exposure>(); | |||
| double deltaEV = bpEv - dpEV; | |||
| long nbrExposures = Math.round(deltaEV / calcPrmEvStep) + 1; | |||
| // correct the deltaEV | |||
| deltaEV = calcPrmEvStep * (nbrExposures - 1); | |||
| double baseEVStep = -deltaEV / 2; | |||
| for (int i = 0; i < nbrExposures; i++) { | |||
| boolean found = false; | |||
| String shutterSpeed = ""; | |||
| double shutter; | |||
| double evValue = 0; | |||
| double evStep = baseEVStep + i * calcPrmEvStep; | |||
| if (fixBP) { | |||
| evValue = bpEv - (nbrExposures - 1 - i) * calcPrmEvStep; | |||
| } else { | |||
| evValue = dpEV + i * calcPrmEvStep; | |||
| } | |||
| shutter = Double.valueOf(evDF.format((EVFormula.calcShutterSpeed(calcPrmAperture, evValue)))); | |||
| for (int j = 1; j < allowedShutters.size(); j++) { | |||
| double v1 = allowedShutters.get(j - 1); | |||
| double v2 = allowedShutters.get(j); | |||
| if ((v1 <= shutter && shutter <= v2) || (v2 <= shutter && shutter <= v1)) { | |||
| if (Math.abs(shutter - v1) <= Math.abs(shutter - v2)) { | |||
| shutterSpeed = (v1 < 1) ? "1/" + evDF.format((1 / v1)) | |||
| : "" + EasyBracketMain.DF.format(v1) + "''"; | |||
| } else { | |||
| shutterSpeed = (v2 < 1) ? "1/" + evDF.format((1 / v2)) | |||
| : "" + EasyBracketMain.DF.format(v2) + "''"; | |||
| } | |||
| found = true; | |||
| break; | |||
| } | |||
| } | |||
| if (!found) { | |||
| shutterSpeed = (shutter < 1) ? "1/" + Math.round(1 / shutter) | |||
| : "" + EasyBracketMain.DF.format(shutter) + "''"; | |||
| } | |||
| exp = new Exposure(i + 1, "f/" + EasyBracketMain.DF.format(calcPrmAperture), shutterSpeed, evStep, deltaEV, | |||
| getExpIcon(context, i + 1, (int) nbrExposures)); | |||
| exposures.add(exp); | |||
| } | |||
| return exposures; | |||
| } | |||
| /** | |||
| * Retrieves Icon. | |||
| * | |||
| * @param context Context | |||
| * @param exp {@link Exposure} object | |||
| * | |||
| * @return Color stepped icon | |||
| */ | |||
| private static Bitmap getExpIcon(Context context, int expNbr, int nbrExposures) { | |||
| Bitmap mIcon; | |||
| Bitmap mIconBG; | |||
| Bitmap mIconSymbol; | |||
| Bitmap mIconSymbol_bl; | |||
| Canvas canvas; | |||
| Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); | |||
| final Resources res = context.getResources(); | |||
| final int twentyPercentGray = Math.round(255f * 0.8f); | |||
| int deltaRGB = twentyPercentGray; | |||
| int iSize; | |||
| int iSize_r; | |||
| int iStart; | |||
| DisplayMetrics metrics = new DisplayMetrics(); | |||
| ((Activity)context).getWindowManager().getDefaultDisplay().getMetrics(metrics); | |||
| if (expNbr > 1 || nbrExposures > 1) { | |||
| deltaRGB = twentyPercentGray / (nbrExposures - 1) * (expNbr - 1); | |||
| } | |||
| // The background | |||
| mIconBG = Bitmap.createBitmap(36, 36, Config.ARGB_8888); | |||
| mIconBG.eraseColor(0x00000000); | |||
| canvas = new Canvas(mIconBG); | |||
| mPaint.setStyle(Style.FILL); | |||
| mPaint.setColor(Color.argb(255, deltaRGB, deltaRGB, deltaRGB)); | |||
| canvas.drawRect(2, 2, 33, 33, mPaint); | |||
| // Let's retrieve all icon pieces as Bitmaps. | |||
| mIcon = BitmapFactory.decodeResource(res, R.drawable.exposureicon_frame); | |||
| mIconSymbol = BitmapFactory.decodeResource(res, R.drawable.exposureicon_symb_white); | |||
| mIconSymbol_bl = BitmapFactory.decodeResource(res, R.drawable.exposureicon_symb_black); | |||
| // Prepares the paint that will be used to draw our icon mask. Using | |||
| // PorterDuff.Mode.SRC_OVER means the image that will be drawn will | |||
| // mask the already drawn image. | |||
| mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER)); | |||
| // We're now ready to drawn our Android-like icon :) | |||
| if (deltaRGB > twentyPercentGray / 2) { | |||
| canvas.drawBitmap(mIconSymbol_bl, 0, 0, mPaint); | |||
| } else { | |||
| canvas.drawBitmap(mIconSymbol, 0, 0, mPaint); | |||
| } | |||
| canvas.drawBitmap(mIcon, 0, 0, mPaint); | |||
| return mIconBG; | |||
| } | |||
| } | |||
| @@ -0,0 +1,169 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC.resultlist; | |||
| import java.text.DecimalFormat; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import android.content.Context; | |||
| import android.content.res.Resources; | |||
| import android.graphics.Bitmap; | |||
| import android.graphics.BitmapFactory; | |||
| import android.graphics.Canvas; | |||
| import android.graphics.Color; | |||
| import android.graphics.Paint; | |||
| import android.graphics.PorterDuff; | |||
| import android.graphics.PorterDuffXfermode; | |||
| import android.graphics.Bitmap.Config; | |||
| import android.graphics.Paint.Style; | |||
| import ch.spherIC.EVFormula; | |||
| import ch.spherIC.EasyBracketMain; | |||
| import ch.spherIC.R; | |||
| /** | |||
| * Factory that creates the exposure icons according to the EV range and values. | |||
| */ | |||
| public class ExposureFactory { | |||
| public static final DecimalFormat evDF = new DecimalFormat("0.######"); | |||
| /** | |||
| * DOCUMENT ME! | |||
| * | |||
| * @param context DOCUMENT ME! | |||
| * @param dpEV DOCUMENT ME! | |||
| * @param bpEv DOCUMENT ME! | |||
| * @param calcPrmAperture DOCUMENT ME! | |||
| * @param calcPrmEvStep DOCUMENT ME! | |||
| * @param fixBP DOCUMENT ME! | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| public static List<Exposure> calculateExposures(Context context, double dpEV, double bpEv, double calcPrmAperture, | |||
| double calcPrmEvStep, boolean fixBP, List<Double> allowedShutters) { | |||
| Exposure exp; | |||
| List<Exposure> exposures = new ArrayList<Exposure>(); | |||
| double deltaEV = bpEv - dpEV; | |||
| long nbrExposures = Math.round(deltaEV / calcPrmEvStep) + 1; | |||
| // correct the deltaEV | |||
| deltaEV = calcPrmEvStep * (nbrExposures - 1); | |||
| double baseEVStep = -deltaEV / 2; | |||
| for (int i = 0; i < nbrExposures; i++) { | |||
| boolean found = false; | |||
| String shutterSpeed = ""; | |||
| double shutter; | |||
| double evValue = 0; | |||
| double evStep = baseEVStep + i * calcPrmEvStep; | |||
| if (fixBP) { | |||
| evValue = bpEv - (nbrExposures - 1 - i) * calcPrmEvStep; | |||
| } else { | |||
| evValue = dpEV + i * calcPrmEvStep; | |||
| } | |||
| shutter = Double.valueOf(evDF.format((EVFormula.calcShutterSpeed(calcPrmAperture, evValue)))); | |||
| for (int j = 1; j < allowedShutters.size(); j++) { | |||
| double v1 = allowedShutters.get(j - 1); | |||
| double v2 = allowedShutters.get(j); | |||
| if ((v1 <= shutter && shutter <= v2) || (v2 <= shutter && shutter <= v1)) { | |||
| if (Math.abs(shutter - v1) <= Math.abs(shutter - v2)) { | |||
| shutterSpeed = (v1 < 1) ? "1/" + evDF.format((1 / v1)) | |||
| : "" + EasyBracketMain.DF.format(v1) + "''"; | |||
| } else { | |||
| shutterSpeed = (v2 < 1) ? "1/" + evDF.format((1 / v2)) | |||
| : "" + EasyBracketMain.DF.format(v2) + "''"; | |||
| } | |||
| found = true; | |||
| break; | |||
| } | |||
| } | |||
| if (!found) { | |||
| shutterSpeed = (shutter < 1) ? "1/" + Math.round(1 / shutter) | |||
| : "" + EasyBracketMain.DF.format(shutter) + "''"; | |||
| } | |||
| exp = new Exposure(i + 1, "f/" + EasyBracketMain.DF.format(calcPrmAperture), shutterSpeed, evStep, deltaEV, | |||
| getExpIcon(context, i + 1, (int) nbrExposures)); | |||
| exposures.add(exp); | |||
| } | |||
| return exposures; | |||
| } | |||
| /** | |||
| * Retrieves Icon. | |||
| * | |||
| * @param context Context | |||
| * @param exp {@link Exposure} object | |||
| * | |||
| * @return Color stepped icon | |||
| */ | |||
| private static Bitmap getExpIcon(Context context, int expNbr, int nbrExposures) { | |||
| final int twentyPercentGray = Math.round(255f * 0.8f); | |||
| int deltaRGB = twentyPercentGray; | |||
| if (expNbr > 1 || nbrExposures > 1) { | |||
| deltaRGB = twentyPercentGray / (nbrExposures - 1) * (expNbr - 1); | |||
| } | |||
| Bitmap mIcon; | |||
| Bitmap mIconBG; | |||
| Bitmap mIconSymbol; | |||
| Bitmap mIconSymbol_bl; | |||
| Canvas canvas; | |||
| Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); | |||
| final Resources res = context.getResources(); | |||
| // The background | |||
| mIconBG = Bitmap.createBitmap(36, 36, Config.ARGB_8888); | |||
| mIconBG.eraseColor(0x00000000); | |||
| canvas = new Canvas(mIconBG); | |||
| mPaint.setStyle(Style.FILL); | |||
| mPaint.setColor(Color.argb(255, deltaRGB, deltaRGB, deltaRGB)); | |||
| canvas.drawRect(2, 2, 33, 33, mPaint); | |||
| // Let's retrieve all icon pieces as Bitmaps. | |||
| mIcon = BitmapFactory.decodeResource(res, R.drawable.exposureicon_frame); | |||
| mIconSymbol = BitmapFactory.decodeResource(res, R.drawable.exposureicon_symb_white); | |||
| mIconSymbol_bl = BitmapFactory.decodeResource(res, R.drawable.exposureicon_symb_black); | |||
| // Prepares the paint that will be used to draw our icon mask. Using | |||
| // PorterDuff.Mode.SRC_OVER means the image that will be drawn will | |||
| // mask the already drawn image. | |||
| mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER)); | |||
| // We're now ready to drawn our Android-like icon :) | |||
| if (deltaRGB > twentyPercentGray / 2) { | |||
| canvas.drawBitmap(mIconSymbol_bl, 0, 0, mPaint); | |||
| } else { | |||
| canvas.drawBitmap(mIconSymbol, 0, 0, mPaint); | |||
| } | |||
| canvas.drawBitmap(mIcon, 0, 0, mPaint); | |||
| return mIconBG; | |||
| } | |||
| } | |||
| @@ -0,0 +1,79 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <resources> | |||
| <string | |||
| name="app_name">Easy Bracketing</string> | |||
| <string | |||
| name="dynamic_range">Dynamic Range</string> | |||
| <string | |||
| name="shutter_speed">Shutter Speed</string> | |||
| <string | |||
| name="aperture">Aperture</string> | |||
| <string | |||
| name="ev">EV</string> | |||
| <string | |||
| name="dark_point">Dark Point Values</string> | |||
| <string | |||
| name="bright_point">Bright Point Values</string> | |||
| <string | |||
| name="calcParams">Calculation Parameters</string> | |||
| <string | |||
| name="delta_EV">Δ EV</string> | |||
| <string | |||
| name="expEVStep">EV Step</string> | |||
| <string | |||
| name="calculate">Calculate</string> | |||
| <string | |||
| name="reset">Reset</string> | |||
| <string | |||
| name="bracketingRes">Bracketing Exposures Values</string> | |||
| <string | |||
| name="expNbrLbl"># Exp.</string> | |||
| <string | |||
| name="toastWarningDP_BP">The delta between dark point EV and bright point EV is less or | |||
| equal to 0. Please correct the inputs.</string> | |||
| <string | |||
| name="menuUserGuide">User Guide</string> | |||
| <string | |||
| name="menuSettings">Settings...</string> | |||
| <string | |||
| name="menuAbout">About</string> | |||
| <string | |||
| name="about_Description">EasyBracketing allows you to easy calculate a serie of exposure | |||
| values according to initial dark and bright point values.</string> | |||
| <string | |||
| name="AppVersionLabel">Version:</string> | |||
| <string | |||
| name="about_DevelopedBy">Developed by spherIC (F. Smilari)\nMail to: | |||
| merlin868@hotmail.com\n\nTranslated by spherIC (F. Smilari)</string> | |||
| <string | |||
| name="Percent18Correction">18%-Gray Correction</string> | |||
| <string | |||
| name="Percent18CorrectionBP">Bright Pt. Value Correction (EV)</string> | |||
| <string | |||
| name="Percent18CorrectionDP">Dark Pt. Value Correction (EV)</string> | |||
| <string | |||
| name="FixRangePoint">Fixed EV Range Value</string> | |||
| <string | |||
| name="FixRangePointBP">Keep Bright Point Values fixed</string> | |||
| <string | |||
| name="FixRangePointDP">Keep Dark Point Value fixed</string> | |||
| <string | |||
| name="BtnSave">Save</string> | |||
| <string | |||
| name="BtnCancel">Cancel</string> | |||
| <string | |||
| name="BtnClose">Close</string> | |||
| <string | |||
| name="header_GeneralPurpose">1. General Purpose</string> | |||
| <string | |||
| name="text_GeneralPurpose">When doing a bracketing for a later HDR image, often a problem araises. The dynamic range of the | |||
| composition is too large to fit the classic \"+2EV/0EVB/-2EV\" approach. | |||
| \nThis is the moment when \"EasyBracketing\" comes to its own. | |||
| \nStarting with camera-measured values for the brightest and darkest point and according to some configarable calculation parameters | |||
| you can calculate all the exposure values for the bracketing. | |||
| </string> | |||
| <string | |||
| name="header_HowTo">2. How to use</string> | |||
| <string | |||
| name="text_HowTo">Text here</string> | |||
| </resources> | |||
| @@ -0,0 +1,63 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <LinearLayout | |||
| xmlns:android="http://schemas.android.com/apk/res/android" | |||
| android:background="@drawable/bg_about" | |||
| android:padding="10dp" | |||
| android:layout_height="fill_parent" | |||
| android:layout_width="fill_parent" | |||
| android:orientation="vertical"> | |||
| <LinearLayout | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:orientation="horizontal" | |||
| android:id="@+id/layout_ugVersion"> | |||
| <ImageView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginRight="20dip" | |||
| android:id="@+id/ug_imageAppIcon" | |||
| android:layout_gravity="center_vertical" /> | |||
| <TextView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:textColor="#FF000000" | |||
| android:text="iii" | |||
| android:id="@+id/ug_TextVersion" | |||
| android:textStyle="bold" | |||
| android:layout_gravity="center_vertical" | |||
| android:gravity="center_vertical" /> | |||
| </LinearLayout> | |||
| <ScrollView | |||
| android:id="@+id/ug_ScrollView" | |||
| android:layout_width="wrap_content" | |||
| android:addStatesFromChildren="true" android:layout_height="250dp"> | |||
| <LinearLayout | |||
| android:orientation="vertical" | |||
| android:layout_height="wrap_content" | |||
| android:layout_width="wrap_content"> | |||
| <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/ug_hdr_GenPourpose" android:textColor="@color/black" android:textStyle="bold" android:layout_marginBottom="5dp" android:layout_marginTop="5dp" android:text="@string/header_GeneralPurpose"></TextView><TextView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" android:id="@+id/ug_txt_GenPourpose" android:textColor="@color/black" android:text="@string/text_GeneralPurpose"> | |||
| </TextView> | |||
| <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/ug_hdr_HowTo" android:textColor="@color/black" android:textStyle="bold" android:layout_marginBottom="5dp" android:layout_marginTop="5dp" android:text="@string/header_HowTo"></TextView><TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/ug_txt_HowTo" android:textColor="@color/black" android:text="@string/text_HowTo"></TextView> | |||
| </LinearLayout> | |||
| </ScrollView> | |||
| <Button | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:background="@drawable/btn_fs" | |||
| android:id="@+id/btn_ugClose" | |||
| android:text="Close" | |||
| android:textColor="@color/white" | |||
| android:layout_gravity="center_horizontal" | |||
| android:layout_marginTop="20dp"> | |||
| </Button> | |||
| </LinearLayout> | |||
| @@ -0,0 +1,99 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <resources> | |||
| <string | |||
| name="app_name">Easy Bracketing</string> | |||
| <string | |||
| name="dynamic_range">Dynamic Range</string> | |||
| <string | |||
| name="shutter_speed">Shutter Speed</string> | |||
| <string | |||
| name="aperture">Aperture</string> | |||
| <string | |||
| name="ev">EV</string> | |||
| <string | |||
| name="dark_point">Dark Point Values</string> | |||
| <string | |||
| name="bright_point">Bright Point Values</string> | |||
| <string | |||
| name="calcParams">Calculation Parameters</string> | |||
| <string | |||
| name="delta_EV">Δ EV</string> | |||
| <string | |||
| name="expEVStep">EV Step</string> | |||
| <string | |||
| name="calculate">Calculate</string> | |||
| <string | |||
| name="reset">Reset</string> | |||
| <string | |||
| name="bracketingRes">Bracketing Exposures Values</string> | |||
| <string | |||
| name="expNbrLbl"># Exp.</string> | |||
| <string | |||
| name="toastWarningDP_BP">The delta between dark point EV and bright point EV is less or | |||
| equal to 0. Please correct the inputs.</string> | |||
| <string | |||
| name="menuUserGuide">User Guide</string> | |||
| <string | |||
| name="menuSettings">Settings...</string> | |||
| <string | |||
| name="menuAbout">About</string> | |||
| <string | |||
| name="about_Description">EasyBracketing allows you to easy calculate a serie of exposure | |||
| values according to initial dark and bright point values.</string> | |||
| <string | |||
| name="AppVersionLabel">Version:</string> | |||
| <string | |||
| name="about_DevelopedBy">Developed by spherIC (F. Smilari)\nMail to: | |||
| merlin868@hotmail.com\n\nTranslated by spherIC (F. Smilari)</string> | |||
| <string | |||
| name="Percent18Correction">18%-Gray Correction</string> | |||
| <string | |||
| name="Percent18CorrectionBP">Bright Pt. Value Correction (EV)</string> | |||
| <string | |||
| name="Percent18CorrectionDP">Dark Pt. Value Correction (EV)</string> | |||
| <string | |||
| name="FixRangePoint">Fixed EV Range Value</string> | |||
| <string | |||
| name="FixRangePointBP">Keep Bright Point Values fixed</string> | |||
| <string | |||
| name="FixRangePointDP">Keep Dark Point Value fixed</string> | |||
| <string | |||
| name="BtnSave">Save</string> | |||
| <string | |||
| name="BtnCancel">Cancel</string> | |||
| <string | |||
| name="BtnClose">Close</string> | |||
| <string | |||
| name="header_GeneralPurpose">1. General Purpose</string> | |||
| <string | |||
| name="text_GeneralPurpose">When doing a bracketing for a later HDR image, often a problem araises: The dynamic range of the | |||
| composition is too large to fit the classic \"+2EV/0EVB/-2EV\" approach. | |||
| \nThis is the moment when \"EasyBracketing\" comes to its own. | |||
| \nStarting with camera-measured values for the brightest and darkest point and according to some configurable calculation parameters | |||
| you can calculate all the exposure values for the bracketing and do the shots. | |||
| </string> | |||
| <string | |||
| name="header_HowTo">2. How to use</string> | |||
| <string | |||
| name="text_HowTo"> | |||
| 1. Set your camera to spot measuring. | |||
| \n2. Choose a suitable aperture. | |||
| \n3. With your camera measure the exposure values for the darkest point of your composition. | |||
| \n4. With your camera measure the exposure values for the brightest point of your composition. | |||
| \n5. Set these values in the area \"Dynamic Range\" of EasyBracketing. | |||
| \n6. Modify the calculation parameters to your needs if necessary. | |||
| \n7. Click on \"Calculate\" to start the computing of the exposure values of the bracketing. | |||
| \n | |||
| \nSettings: | |||
| \n | |||
| \n18%-Gray Correction: | |||
| \nMost cameras try to achieve a so called 18%-Gray exposure value on measuring. This is not exactly what we want when doing bracketing. | |||
| This setting helps to counteract this behavior. Beacuse each sensor, depending on the manufacturer, has a little bit different behavior, | |||
| the exact values have to be determined by experimental trials. | |||
| \n | |||
| \nFixed EV Range Value: | |||
| \nIn most cases, the resulting delta EV from the measuring is a floating value which is rounded to the next integer value on calculation. | |||
| This means that the calculation value is always bigger than the measured. With this setting you can determine on which edge of the dynamic | |||
| range (anchor) the bracketing calculation should start. | |||
| </string> | |||
| </resources> | |||
| @@ -0,0 +1,102 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <resources> | |||
| <string | |||
| name="app_name">Easy Bracketing</string> | |||
| <string | |||
| name="dynamic_range">Dynamikbereich</string> | |||
| <string | |||
| name="shutter_speed">Belichtungszeit</string> | |||
| <string | |||
| name="aperture">Blende</string> | |||
| <string | |||
| name="ev">LW</string> | |||
| <string | |||
| name="dark_point">Werte Dunkelpunkt</string> | |||
| <string | |||
| name="bright_point">Werte Hellpunkt</string> | |||
| <string | |||
| name="calcParams">Berechnungsparameter</string> | |||
| <string | |||
| name="delta_EV">Δ LW</string> | |||
| <string | |||
| name="expEVStep">LW-Schritt</string> | |||
| <string | |||
| name="calculate">Berechnen</string> | |||
| <string | |||
| name="reset">Zurücksetzen</string> | |||
| <string | |||
| name="bracketingRes">Bracketing Belichtungswerte</string> | |||
| <string | |||
| name="expNbrLbl"># Bel.</string> | |||
| <string | |||
| name="toastWarningDP_BP">Das Delta zwischen dem LW des Dunkelpunkt und dem LW des Hellpunkt ist kleiner oder gleich 0. | |||
| \nBitte korrigieren Sie die Eingaben.</string> | |||
| <string | |||
| name="menuUserGuide">Benutzeranleitung</string> | |||
| <string | |||
| name="menuSettings">Einstellungen...</string> | |||
| <string | |||
| name="menuAbout">Info</string> | |||
| <string | |||
| name="about_Description"> | |||
| EasyBracketing dient zur schnellen und einfachen Berechnung einer Belichtungsserie ausgehend | |||
| von den Belichtungswerten eines Dunkelpunktes und eines Hellpunktes. | |||
| </string> | |||
| <string | |||
| name="AppVersionLabel">Version:</string> | |||
| <string | |||
| name="about_DevelopedBy">Entwickelt von spherIC (F. Smilari)\nMail an: | |||
| merlin868@hotmail.com\n\nÜbersetzt von spherIC (F. Smilari)</string> | |||
| <string | |||
| name="Percent18Correction">18%-Grauwertkorrektur</string> | |||
| <string | |||
| name="Percent18CorrectionBP">Hellpunktkorrektur (LW)</string> | |||
| <string | |||
| name="Percent18CorrectionDP">Dunkelpunktkorrektur (LW)</string> | |||
| <string | |||
| name="FixRangePoint">Ausgangspunkt für Belichtungsserie</string> | |||
| <string | |||
| name="FixRangePointBP">Von Hellpunktwerten ausgehen</string> | |||
| <string | |||
| name="FixRangePointDP">Von Dunkelpunktwerten ausgehen</string> | |||
| <string | |||
| name="BtnSave">Speichern</string> | |||
| <string | |||
| name="BtnCancel">Abbrechen</string> | |||
| <string | |||
| name="BtnClose">Schliessen</string> | |||
| <string | |||
| name="header_GeneralPurpose">1. Allgm. Verwendungszweck</string> | |||
| <string | |||
| name="text_GeneralPurpose"> | |||
| Beim Erstellen einer Belichtungsreihe für ein späteres HDR-Bild, stellt sich oftmals das Problem, | |||
| dass der Kontrastumfang zu gross ist um von der typischen \"+2LW/0LW/-2LW\"-Vorgehensweise abgedeckt zu werden.\nHier | |||
| kommt \"EasyBracketing\" zum Zug.\nAusgehend von gemessenen Werten für den hellsten Punkt resp. den dunkelsten Punkt | |||
| werden über definierbare Parameter alle notwendigen Belichtungen einer Belichtungsreihe berechnet. Diese können dann | |||
| an der Kamera sukzessive eingestellt und die Aufnahme ausgelöst werden. | |||
| </string> | |||
| <string | |||
| name="header_HowTo">2. Vorgehensweise</string> | |||
| <string | |||
| name="text_HowTo"> | |||
| 1. Stellen Sie die Kamera auf Spotbelichtungsmessung. | |||
| \n2. Wählen Sie eine geeignete Blende. | |||
| \n3. Messen Sie mit der Kamera die Belichtungswerte für den dunkelsten Punkt ihres Bildausschnitts. | |||
| \n4. Messen Sie mit der Kamera die Belichtungswerte für den hellsten Punkt ihres Bildausschnitts. | |||
| \n5. Stellen Sie die gemessenen Werte im Bereich \"Dynamikbereich\" von EasyBracketing ein. | |||
| \n6. Verändern Sie, falls gewünscht die Berechnungsparamter nach Ihren Vorstellungen. | |||
| \n7. Klicken Sie auf \"Berechnen\" um die Belichtungsreihe zu berechnen. | |||
| \n | |||
| \nEinstellungen: | |||
| \n | |||
| \n18%-Grauwertkorrektur: | |||
| \nDie meisten Kameras versuchen bei der Belichtungsmessung auf ein sogenanntes 18%-Grau gleichmässig zu belichten. | |||
| Dies ist für Belichtungsreihen eher unerwünscht. Mit dieser Einstellung können Sie dem entgegenwirken. Den einzustellenden | |||
| Wert muss man über Belichtungsversuche empirisch ermitteln, da die Sensoren bei jedem Hersteller anders sind. | |||
| \n | |||
| \nAusgangspukt der Belichtungsreihe: | |||
| \nIn den meisten Fällen, wird der Dynamikumfang (Delta LW) einen gebrochenen Wert aufweisen, der in der Berechnung aufgerundet | |||
| wird. Dies führt dazu, dass der Dynamikumfang der Berechnung grösser ist als der Gemessene. Mit dieser Einstellung bestimmen Sie | |||
| von welchem Ende des Dynamikumfangs (Anker) die Berechnung der Belichtungsreihe starten soll. | |||
| </string> | |||
| </resources> | |||
| @@ -0,0 +1,240 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC.resultlist; | |||
| import java.util.List; | |||
| import android.app.Activity; | |||
| import android.content.Context; | |||
| import android.util.DisplayMetrics; | |||
| import android.view.Gravity; | |||
| import android.view.View; | |||
| import android.view.ViewGroup; | |||
| import android.widget.BaseAdapter; | |||
| import android.widget.ImageView; | |||
| import android.widget.LinearLayout; | |||
| import android.widget.TextView; | |||
| import android.widget.LinearLayout.LayoutParams; | |||
| import ch.spherIC.R; | |||
| /** | |||
| * Exposure adapter view class. | |||
| */ | |||
| class ExposureAdapterView extends LinearLayout { | |||
| private static DisplayMetrics metrics; | |||
| /** | |||
| * Creates a new ExposureAdapterView object. | |||
| * | |||
| * @param context DOCUMENT ME! | |||
| * @param weather DOCUMENT ME! | |||
| */ | |||
| public ExposureAdapterView(Context context, Exposure exposure, int nbrExposures) { | |||
| super(context); | |||
| this.setOrientation(HORIZONTAL); | |||
| ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(metrics); | |||
| // Nbr | |||
| TextView nbrControl = new TextView(context); | |||
| LinearLayout.LayoutParams nbrParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| nbrParams.setMargins(3, 1, 1, 1); | |||
| nbrControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| nbrControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| nbrControl.setText(Integer.toString(exposure.getNbr())); | |||
| addView(nbrControl, nbrParams); | |||
| // Aperture | |||
| TextView apertureControl = new TextView(context); | |||
| LinearLayout.LayoutParams apertureParams = new LinearLayout.LayoutParams(100, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| apertureParams.setMargins(1, 1, 1, 1); | |||
| apertureControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| apertureControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| apertureControl.setText(exposure.getAperture()); | |||
| addView(apertureControl, apertureParams); | |||
| // Shutter speed | |||
| TextView shutterControl = new TextView(context); | |||
| LinearLayout.LayoutParams shutterParams = new LinearLayout.LayoutParams(170, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| shutterParams.setMargins(1, 1, 1, 1); | |||
| shutterControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| shutterControl.setTextAppearance(context, R.style.ResultExposureTextSpecial); | |||
| shutterControl.setText(exposure.getShutterSpeed()); | |||
| addView(shutterControl, shutterParams); | |||
| // EV Step | |||
| TextView evStepControl = new TextView(context); | |||
| LinearLayout.LayoutParams evStepParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| evStepParams.setMargins(1, 1, 1, 1); | |||
| evStepControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| evStepControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| evStepControl.setText(exposure.getEvStepAsString()); | |||
| addView(evStepControl, evStepParams); | |||
| // Icon | |||
| ImageView expIconControl = new ImageView(context); | |||
| LinearLayout.LayoutParams expIconParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| expIconParams.setMargins(1, 1, 1, 1); | |||
| expIconControl.setImageBitmap(exposure.getEvStepBtmp()); | |||
| addView(expIconControl, expIconParams); | |||
| } | |||
| } | |||
| /** | |||
| * Exposure results adapter. | |||
| */ | |||
| public class ExposureAdapter extends BaseAdapter { | |||
| private Context context; | |||
| private List<Exposure> exposureList; | |||
| /** | |||
| * Creates a new ExposureAdapter object. | |||
| */ | |||
| public ExposureAdapter(Context context, List<Exposure> expList) { | |||
| this.context = context; | |||
| this.exposureList = expList; | |||
| } | |||
| /** | |||
| * Retrieves list size. | |||
| * | |||
| * @return list size | |||
| */ | |||
| @Override | |||
| public int getCount() { | |||
| return this.exposureList.size(); | |||
| } | |||
| /** | |||
| * Retrieves the exposure at index <code>position</code>. | |||
| * | |||
| * @param position Index in list | |||
| * | |||
| * @return Exposure at index <code>position</code> | |||
| */ | |||
| @Override | |||
| public Object getItem(int position) { | |||
| return this.exposureList.get(position); | |||
| } | |||
| /** | |||
| * Retrieves the number of the exposure at index <code>position</code>. | |||
| * | |||
| * @param position Index in list | |||
| * | |||
| * @return the number of the exposure at index <code>position</code> | |||
| */ | |||
| @Override | |||
| public long getItemId(int position) { | |||
| //return this.exposureList.get(position).getNbr(); | |||
| return position; | |||
| } | |||
| /** | |||
| * Retrieves a view representing a single result row. | |||
| * | |||
| * @param position Index in list | |||
| * @param convertView view | |||
| * @param parent parent | |||
| * | |||
| * @return {@link ExposureAdapterView} | |||
| */ | |||
| @Override | |||
| public View getView(int position, View convertView, ViewGroup parent) { | |||
| Exposure exposure = this.exposureList.get(position); | |||
| return new ExposureAdapterView(this.context, exposure, this.exposureList.size()); | |||
| } | |||
| /** | |||
| * Retrieves the value of | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| public static View getHeaderView(Context context, LinearLayout headerLL) { | |||
| int black = headerLL.getResources().getColor(R.color.black); | |||
| // Nbr | |||
| TextView nbrControl = new TextView(context); | |||
| LinearLayout.LayoutParams nbrParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| nbrParams.setMargins(3, 1, 1, 1); | |||
| nbrControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| nbrControl.setTextSize(13f); | |||
| nbrControl.setTextColor(black); | |||
| nbrControl.setText(R.string.expNbrLbl); | |||
| headerLL.addView(nbrControl, nbrParams); | |||
| // Aperture | |||
| TextView apertureControl = new TextView(context); | |||
| LinearLayout.LayoutParams apertureParams = new LinearLayout.LayoutParams(100, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| apertureParams.setMargins(1, 1, 1, 1); | |||
| apertureControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| apertureControl.setTextSize(13f); | |||
| apertureControl.setTextColor(black); | |||
| apertureControl.setText(R.string.aperture); | |||
| headerLL.addView(apertureControl, apertureParams); | |||
| // Shutter speed | |||
| TextView shutterControl = new TextView(context); | |||
| LinearLayout.LayoutParams shutterParams = new LinearLayout.LayoutParams(170, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| shutterParams.setMargins(1, 1, 1, 1); | |||
| shutterControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| shutterControl.setTextSize(13f); | |||
| shutterControl.setTextColor(black); | |||
| shutterControl.setText(R.string.shutter_speed); | |||
| headerLL.addView(shutterControl, shutterParams); | |||
| // EV Step | |||
| TextView evStepControl = new TextView(context); | |||
| LinearLayout.LayoutParams evStepParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| evStepParams.setMargins(1, 1, 1, 1); | |||
| evStepControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| evStepControl.setTextSize(13f); | |||
| evStepControl.setTextColor(black); | |||
| evStepControl.setText(R.string.expEVStep); | |||
| headerLL.addView(evStepControl, evStepParams); | |||
| // Icon | |||
| ImageView expIconControl = new ImageView(context); | |||
| LinearLayout.LayoutParams expIconParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| expIconParams.setMargins(1, 1, 1, 1); | |||
| headerLL.addView(expIconControl, expIconParams); | |||
| return headerLL; | |||
| } | |||
| /** | |||
| * Retrieves the value of | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| private static DisplayMetrics getMetrics() { | |||
| if (metrics == null) { | |||
| metrics = new DisplayMetrics(); | |||
| } | |||
| return metrics; | |||
| } | |||
| } | |||
| @@ -0,0 +1,248 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC.resultlist; | |||
| import java.util.List; | |||
| import android.app.Activity; | |||
| import android.content.Context; | |||
| import android.util.DisplayMetrics; | |||
| import android.view.Gravity; | |||
| import android.view.View; | |||
| import android.view.ViewGroup; | |||
| import android.widget.BaseAdapter; | |||
| import android.widget.ImageView; | |||
| import android.widget.LinearLayout; | |||
| import android.widget.TextView; | |||
| import android.widget.LinearLayout.LayoutParams; | |||
| import ch.spherIC.R; | |||
| /** | |||
| * Exposure adapter view class. | |||
| */ | |||
| class ExposureAdapterView extends LinearLayout { | |||
| /** | |||
| * Creates a new ExposureAdapterView object. | |||
| * | |||
| * @param context DOCUMENT ME! | |||
| * @param weather DOCUMENT ME! | |||
| */ | |||
| public ExposureAdapterView(Context context, Exposure exposure) { | |||
| super(context); | |||
| this.setOrientation(HORIZONTAL); | |||
| DisplayMetrics metrics = new DisplayMetrics(); | |||
| ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(metrics); | |||
| // Nbr | |||
| TextView nbrControl = new TextView(context); | |||
| LinearLayout.LayoutParams nbrParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| nbrParams.setMargins(3, 1, 1, 1); | |||
| nbrControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| nbrControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| nbrControl.setText(Integer.toString(exposure.getNbr())); | |||
| addView(nbrControl, nbrParams); | |||
| // Aperture | |||
| TextView apertureControl = new TextView(context); | |||
| LinearLayout.LayoutParams apertureParams = new LinearLayout.LayoutParams(100, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| apertureParams.setMargins(1, 1, 1, 1); | |||
| apertureControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| apertureControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| apertureControl.setText(exposure.getAperture()); | |||
| addView(apertureControl, apertureParams); | |||
| // Shutter speed | |||
| TextView shutterControl = new TextView(context); | |||
| LinearLayout.LayoutParams shutterParams = new LinearLayout.LayoutParams(170, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| shutterParams.setMargins(1, 1, 1, 1); | |||
| shutterControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| shutterControl.setTextAppearance(context, R.style.ResultExposureTextSpecial); | |||
| shutterControl.setText(exposure.getShutterSpeed()); | |||
| addView(shutterControl, shutterParams); | |||
| // EV Step | |||
| TextView evStepControl = new TextView(context); | |||
| LinearLayout.LayoutParams evStepParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| evStepParams.setMargins(1, 1, 1, 1); | |||
| evStepControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| evStepControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| evStepControl.setText(exposure.getEvStepAsString()); | |||
| addView(evStepControl, evStepParams); | |||
| // Icon | |||
| ImageView expIconControl = new ImageView(context); | |||
| LinearLayout.LayoutParams expIconParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| expIconParams.setMargins(1, 1, 1, 1); | |||
| expIconControl.setImageBitmap(exposure.getEvStepBtmp()); | |||
| addView(expIconControl, expIconParams); | |||
| } | |||
| } | |||
| /** | |||
| * Exposure results adapter. | |||
| */ | |||
| public class ExposureAdapter extends BaseAdapter { | |||
| private static DisplayMetrics metrics; | |||
| private Context context; | |||
| private List<Exposure> exposureList; | |||
| /** | |||
| * Creates a new ExposureAdapter object. | |||
| */ | |||
| public ExposureAdapter(Context context, List<Exposure> expList) { | |||
| this.context = context; | |||
| this.exposureList = expList; | |||
| } | |||
| /** | |||
| * Retrieves list size. | |||
| * | |||
| * @return list size | |||
| */ | |||
| @Override | |||
| public int getCount() { | |||
| return this.exposureList.size(); | |||
| } | |||
| /** | |||
| * Retrieves the exposure at index <code>position</code>. | |||
| * | |||
| * @param position Index in list | |||
| * | |||
| * @return Exposure at index <code>position</code> | |||
| */ | |||
| @Override | |||
| public Object getItem(int position) { | |||
| return this.exposureList.get(position); | |||
| } | |||
| /** | |||
| * Retrieves the number of the exposure at index <code>position</code>. | |||
| * | |||
| * @param position Index in list | |||
| * | |||
| * @return the number of the exposure at index <code>position</code> | |||
| */ | |||
| @Override | |||
| public long getItemId(int position) { | |||
| //return this.exposureList.get(position).getNbr(); | |||
| return position; | |||
| } | |||
| /** | |||
| * Retrieves a view representing a single result row. | |||
| * | |||
| * @param position Index in list | |||
| * @param convertView view | |||
| * @param parent parent | |||
| * | |||
| * @return {@link ExposureAdapterView} | |||
| */ | |||
| @Override | |||
| public View getView(int position, View convertView, ViewGroup parent) { | |||
| Exposure exposure = this.exposureList.get(position); | |||
| return new ExposureAdapterView(this.context, exposure); | |||
| } | |||
| /** | |||
| * Retrieves the value of | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| public static View getHeaderView(Context context, LinearLayout headerLL) { | |||
| int black = headerLL.getResources().getColor(R.color.black); | |||
| int width = getMetrics(context).widthPixels; | |||
| // Nbr | |||
| TextView nbrControl = new TextView(context); | |||
| LinearLayout.LayoutParams nbrParams = new LinearLayout.LayoutParams(Math.round(0.14583f * width), | |||
| LayoutParams.WRAP_CONTENT, 0.2f); | |||
| nbrParams.setMargins(3, 1, 1, 1); | |||
| nbrControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| nbrControl.setTextSize(13f); | |||
| nbrControl.setTextColor(black); | |||
| nbrControl.setText(R.string.expNbrLbl); | |||
| headerLL.addView(nbrControl, nbrParams); | |||
| // Aperture | |||
| TextView apertureControl = new TextView(context); | |||
| LinearLayout.LayoutParams apertureParams = new LinearLayout.LayoutParams(Math.round(0.20833f * width), | |||
| LayoutParams.WRAP_CONTENT, 0.2f); | |||
| apertureParams.setMargins(1, 1, 1, 1); | |||
| apertureControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| apertureControl.setTextSize(13f); | |||
| apertureControl.setTextColor(black); | |||
| apertureControl.setText(R.string.aperture); | |||
| headerLL.addView(apertureControl, apertureParams); | |||
| // Shutter speed | |||
| TextView shutterControl = new TextView(context); | |||
| LinearLayout.LayoutParams shutterParams = new LinearLayout.LayoutParams(Math.round(0.35417f * width), | |||
| LayoutParams.WRAP_CONTENT, 0.2f); | |||
| shutterParams.setMargins(1, 1, 1, 1); | |||
| shutterControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| shutterControl.setTextSize(13f); | |||
| shutterControl.setTextColor(black); | |||
| shutterControl.setText(R.string.shutter_speed); | |||
| headerLL.addView(shutterControl, shutterParams); | |||
| // EV Step | |||
| TextView evStepControl = new TextView(context); | |||
| LinearLayout.LayoutParams evStepParams = new LinearLayout.LayoutParams(Math.round(0.14583f * width), | |||
| LayoutParams.WRAP_CONTENT, 0.2f); | |||
| evStepParams.setMargins(1, 1, 1, 1); | |||
| evStepControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| evStepControl.setTextSize(13f); | |||
| evStepControl.setTextColor(black); | |||
| evStepControl.setText(R.string.expEVStep); | |||
| headerLL.addView(evStepControl, evStepParams); | |||
| // Icon | |||
| ImageView expIconControl = new ImageView(context); | |||
| LinearLayout.LayoutParams expIconParams = new LinearLayout.LayoutParams(Math.round(0.14583f * width), | |||
| LayoutParams.WRAP_CONTENT, 0.2f); | |||
| expIconParams.setMargins(1, 1, 1, 1); | |||
| headerLL.addView(expIconControl, expIconParams); | |||
| return headerLL; | |||
| } | |||
| /** | |||
| * Retrieves the value of | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| private static DisplayMetrics getMetrics(Context context) { | |||
| if (metrics == null) { | |||
| metrics = new DisplayMetrics(); | |||
| ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(metrics); | |||
| } | |||
| return metrics; | |||
| } | |||
| } | |||
| @@ -0,0 +1,83 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <resources> | |||
| <string | |||
| name="app_name">Easy Bracketing</string> | |||
| <string | |||
| name="dynamic_range">Dynamikbereich</string> | |||
| <string | |||
| name="shutter_speed">Belichtungszeit</string> | |||
| <string | |||
| name="aperture">Blende</string> | |||
| <string | |||
| name="ev">LW</string> | |||
| <string | |||
| name="dark_point">Werte Dunkelpunkt</string> | |||
| <string | |||
| name="bright_point">Werte Hellpunkt</string> | |||
| <string | |||
| name="calcParams">Berechnungsparameter</string> | |||
| <string | |||
| name="delta_EV">Δ LW</string> | |||
| <string | |||
| name="expEVStep">LW-Schritt</string> | |||
| <string | |||
| name="calculate">Berechnen</string> | |||
| <string | |||
| name="reset">Zurücksetzen</string> | |||
| <string | |||
| name="bracketingRes">Bracketing Belichtungswerte</string> | |||
| <string | |||
| name="expNbrLbl"># Bel.</string> | |||
| <string | |||
| name="toastWarningDP_BP">Das Delta zwischen dem LW des Dunkelpunkt und dem LW des Hellpunkt ist kleiner oder gleich 0. | |||
| \nBitte korrigieren Sie die Eingaben.</string> | |||
| <string | |||
| name="menuUserGuide">Benutzeranleitung</string> | |||
| <string | |||
| name="menuSettings">Einstellungen...</string> | |||
| <string | |||
| name="menuAbout">Info</string> | |||
| <string | |||
| name="about_Description"> | |||
| EasyBracketing dient zur schnellen und einfachen Berechnung einer Belichtungsserie ausgehend | |||
| von den Belichtungswerten eines Dunkelpunktes und eines Hellpunktes. | |||
| </string> | |||
| <string | |||
| name="AppVersionLabel">Version:</string> | |||
| <string | |||
| name="about_DevelopedBy">Entwickelt von spherIC (F. Smilari)\nMail an: | |||
| merlin868@hotmail.com\n\nÜbersetzt von spherIC (F. Smilari)</string> | |||
| <string | |||
| name="Percent18Correction">18%-Grauwertkorrektur</string> | |||
| <string | |||
| name="Percent18CorrectionBP">Hellpunktkorrektur (LW)</string> | |||
| <string | |||
| name="Percent18CorrectionDP">Dunkelpunktkorrektur (LW)</string> | |||
| <string | |||
| name="FixRangePoint">Ausgangspunkt für Belichtungsserie</string> | |||
| <string | |||
| name="FixRangePointBP">Von Hellpunktwerten ausgehen</string> | |||
| <string | |||
| name="FixRangePointDP">Von Dunkelpunktwerten ausgehen</string> | |||
| <string | |||
| name="BtnSave">Speichern</string> | |||
| <string | |||
| name="BtnCancel">Abbrechen</string> | |||
| <string | |||
| name="BtnClose">Schliessen</string> | |||
| <string | |||
| name="header_GeneralPurpose">1. Allgm. Verwendungszweck</string> | |||
| <string | |||
| name="text_GeneralPurpose"> | |||
| Beim Erstellen einer Belichtungsreihe für ein späteres HDR-Bild, stellt sich oftmals das Problem, | |||
| dass der Kontrastumfang zu gross ist um von der typischen \"+2LW/0LW/-2LW\"-Vorgehensweise abgedeckt zu werden.\n | |||
| Hier kommt \"EasyBracketing\" zum Zug.\n\r | |||
| Ausgehend von gemessenen Werten für den hellsten Punkt resp. den dunkelsten Punkt | |||
| werden über definierbare Parameter alle notwendigen Belichtungen einer Belichtungsreihe berechnet. Diese können dann | |||
| an der Kamera sukzessive eingestellt und die Aufnahme ausgelöst werden. | |||
| </string> | |||
| <string | |||
| name="header_HowTo">2. Vorgehensweise</string> | |||
| <string | |||
| name="text_HowTo">Text here</string> | |||
| </resources> | |||
| @@ -0,0 +1,136 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC.settings; | |||
| import android.app.Dialog; | |||
| import android.content.Context; | |||
| import android.content.SharedPreferences; | |||
| import android.os.Bundle; | |||
| import android.view.View; | |||
| import android.widget.Button; | |||
| import android.widget.RadioButton; | |||
| import android.widget.Spinner; | |||
| import ch.spherIC.EasyBracketMain; | |||
| import ch.spherIC.R; | |||
| /** | |||
| * Settings / Preferences Dialog | |||
| */ | |||
| public class SettingsDlg extends Dialog { | |||
| public static final String PREFS_NAME = "SettingsFile"; | |||
| private Context prnt; | |||
| /** | |||
| * Creates a new SettingsDlg object. | |||
| */ | |||
| public SettingsDlg(Context context) { | |||
| super(context, R.style.GlassThemeDialog); | |||
| this.prnt = context; | |||
| } | |||
| /** | |||
| * Called when the activity is first created. | |||
| */ | |||
| @Override | |||
| public void onCreate(Bundle savedInstanceState) { | |||
| super.onCreate(savedInstanceState); | |||
| setContentView(R.layout.settings); | |||
| setTitle(prnt.getResources().getText(R.string.menuSettings)); | |||
| ((Button) findViewById(R.id.btn_Stg_Save)).setOnClickListener(new View.OnClickListener() { | |||
| @Override | |||
| public void onClick(View v) { | |||
| saveSettings(); | |||
| SettingsDlg.this.dismiss(); | |||
| ((EasyBracketMain) SettingsDlg.this.prnt).loadSettings(); | |||
| ((EasyBracketMain) SettingsDlg.this.prnt).setDefaults(); | |||
| } | |||
| }); | |||
| ((Button) findViewById(R.id.btn_Stg_Cancel)).setOnClickListener(new View.OnClickListener() { | |||
| @Override | |||
| public void onClick(View v) { | |||
| SettingsDlg.this.dismiss(); | |||
| } | |||
| }); | |||
| } | |||
| /** | |||
| * {@inheritDoc} | |||
| */ | |||
| @Override | |||
| protected void onStart() { | |||
| super.onStart(); | |||
| applySettings(); | |||
| } | |||
| /** | |||
| * {@inheritDoc} | |||
| */ | |||
| @Override | |||
| protected void onStop() { | |||
| super.onStop(); | |||
| } | |||
| /** | |||
| * Reads and applies the settings. | |||
| */ | |||
| private void applySettings() { | |||
| boolean fixBP; | |||
| float bpCorrection; | |||
| float dpCorrection; | |||
| // Restore settings | |||
| SharedPreferences settings = getContext().getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE); | |||
| fixBP = settings.getBoolean("fixBrightPoint", true); | |||
| ((RadioButton) findViewById(R.id.rdbtn_KeepBP)).setChecked(fixBP); | |||
| ((RadioButton) findViewById(R.id.rdbtn_KeepDP)).setChecked(!fixBP); | |||
| bpCorrection = settings.getFloat("brightPointCorrection", 0f); | |||
| dpCorrection = settings.getFloat("darkPointCorrection", 0f); | |||
| ((Spinner) findViewById(R.id.spn_BP_Corr)).setSelection((int) bpCorrection); | |||
| ((Spinner) findViewById(R.id.spn_DP_Corr)).setSelection((int) dpCorrection); | |||
| } | |||
| /** | |||
| * Saves the settings | |||
| */ | |||
| private void saveSettings() { | |||
| // Save settings | |||
| SharedPreferences settings = getContext().getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE); | |||
| SharedPreferences.Editor editor = settings.edit(); | |||
| editor.putBoolean("fixBrightPoint", ((RadioButton) findViewById(R.id.rdbtn_KeepBP)).isChecked()); | |||
| editor.putFloat("brightPointCorrection", ((Spinner) findViewById(R.id.spn_BP_Corr)).getSelectedItemPosition()); | |||
| editor.putFloat("darkPointCorrection", ((Spinner) findViewById(R.id.spn_DP_Corr)).getSelectedItemPosition()); | |||
| // Commit the edits! | |||
| editor.commit(); | |||
| } | |||
| } | |||
| @@ -0,0 +1,175 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC.resultlist; | |||
| import java.text.DecimalFormat; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import android.content.Context; | |||
| import android.content.res.Resources; | |||
| import android.graphics.Bitmap; | |||
| import android.graphics.BitmapFactory; | |||
| import android.graphics.Canvas; | |||
| import android.graphics.Color; | |||
| import android.graphics.Paint; | |||
| import android.graphics.PorterDuff; | |||
| import android.graphics.PorterDuffXfermode; | |||
| import android.graphics.Bitmap.Config; | |||
| import android.graphics.Paint.Style; | |||
| import android.util.DisplayMetrics; | |||
| import ch.spherIC.EVFormula; | |||
| import ch.spherIC.EasyBracketMain; | |||
| import ch.spherIC.R; | |||
| /** | |||
| * Factory that creates the exposure icons according to the EV range and values. | |||
| */ | |||
| public class ExposureFactory { | |||
| public static final DecimalFormat evDF = new DecimalFormat("0.######"); | |||
| /** | |||
| * DOCUMENT ME! | |||
| * | |||
| * @param context DOCUMENT ME! | |||
| * @param dpEV DOCUMENT ME! | |||
| * @param bpEv DOCUMENT ME! | |||
| * @param calcPrmAperture DOCUMENT ME! | |||
| * @param calcPrmEvStep DOCUMENT ME! | |||
| * @param fixBP DOCUMENT ME! | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| public static List<Exposure> calculateExposures(Context context, double dpEV, double bpEv, double calcPrmAperture, | |||
| double calcPrmEvStep, boolean fixBP, List<Double> allowedShutters) { | |||
| Exposure exp; | |||
| List<Exposure> exposures = new ArrayList<Exposure>(); | |||
| double deltaEV = bpEv - dpEV; | |||
| long nbrExposures = Math.round(deltaEV / calcPrmEvStep) + 1; | |||
| // correct the deltaEV | |||
| deltaEV = calcPrmEvStep * (nbrExposures - 1); | |||
| double baseEVStep = -deltaEV / 2; | |||
| for (int i = 0; i < nbrExposures; i++) { | |||
| boolean found = false; | |||
| String shutterSpeed = ""; | |||
| double shutter; | |||
| double evValue = 0; | |||
| double evStep = baseEVStep + i * calcPrmEvStep; | |||
| if (fixBP) { | |||
| evValue = bpEv - (nbrExposures - 1 - i) * calcPrmEvStep; | |||
| } else { | |||
| evValue = dpEV + i * calcPrmEvStep; | |||
| } | |||
| shutter = Double.valueOf(evDF.format((EVFormula.calcShutterSpeed(calcPrmAperture, evValue)))); | |||
| for (int j = 1; j < allowedShutters.size(); j++) { | |||
| double v1 = allowedShutters.get(j - 1); | |||
| double v2 = allowedShutters.get(j); | |||
| if ((v1 <= shutter && shutter <= v2) || (v2 <= shutter && shutter <= v1)) { | |||
| if (Math.abs(shutter - v1) <= Math.abs(shutter - v2)) { | |||
| shutterSpeed = (v1 < 1) ? "1/" + evDF.format((1 / v1)) | |||
| : "" + EasyBracketMain.DF.format(v1) + "''"; | |||
| } else { | |||
| shutterSpeed = (v2 < 1) ? "1/" + evDF.format((1 / v2)) | |||
| : "" + EasyBracketMain.DF.format(v2) + "''"; | |||
| } | |||
| found = true; | |||
| break; | |||
| } | |||
| } | |||
| if (!found) { | |||
| shutterSpeed = (shutter < 1) ? "1/" + Math.round(1 / shutter) | |||
| : "" + EasyBracketMain.DF.format(shutter) + "''"; | |||
| } | |||
| exp = new Exposure(i + 1, "f/" + EasyBracketMain.DF.format(calcPrmAperture), shutterSpeed, evStep, deltaEV, | |||
| getExpIcon(context, i + 1, (int) nbrExposures)); | |||
| exposures.add(exp); | |||
| } | |||
| return exposures; | |||
| } | |||
| /** | |||
| * Retrieves Icon. | |||
| * | |||
| * @param context Context | |||
| * @param exp {@link Exposure} object | |||
| * | |||
| * @return Color stepped icon | |||
| */ | |||
| private static Bitmap getExpIcon(Context context, int expNbr, int nbrExposures) { | |||
| Bitmap mIcon; | |||
| Bitmap mIconBG; | |||
| Bitmap mIconSymbol; | |||
| Bitmap mIconSymbol_bl; | |||
| Canvas canvas; | |||
| Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); | |||
| final Resources res = context.getResources(); | |||
| final int twentyPercentGray = Math.round(255f * 0.8f); | |||
| int deltaRGB = twentyPercentGray; | |||
| int iSize; | |||
| int iSize_r; | |||
| int iStart; | |||
| DisplayMetrics metrics = new DisplayMetrics(); | |||
| getWindowManager().getDefaultDisplay().getMetrics(metrics); | |||
| if (expNbr > 1 || nbrExposures > 1) { | |||
| deltaRGB = twentyPercentGray / (nbrExposures - 1) * (expNbr - 1); | |||
| } | |||
| // The background | |||
| mIconBG = Bitmap.createBitmap(36, 36, Config.ARGB_8888); | |||
| mIconBG.eraseColor(0x00000000); | |||
| canvas = new Canvas(mIconBG); | |||
| mPaint.setStyle(Style.FILL); | |||
| mPaint.setColor(Color.argb(255, deltaRGB, deltaRGB, deltaRGB)); | |||
| canvas.drawRect(2, 2, 33, 33, mPaint); | |||
| // Let's retrieve all icon pieces as Bitmaps. | |||
| mIcon = BitmapFactory.decodeResource(res, R.drawable.exposureicon_frame); | |||
| mIconSymbol = BitmapFactory.decodeResource(res, R.drawable.exposureicon_symb_white); | |||
| mIconSymbol_bl = BitmapFactory.decodeResource(res, R.drawable.exposureicon_symb_black); | |||
| // Prepares the paint that will be used to draw our icon mask. Using | |||
| // PorterDuff.Mode.SRC_OVER means the image that will be drawn will | |||
| // mask the already drawn image. | |||
| mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER)); | |||
| // We're now ready to drawn our Android-like icon :) | |||
| if (deltaRGB > twentyPercentGray / 2) { | |||
| canvas.drawBitmap(mIconSymbol_bl, 0, 0, mPaint); | |||
| } else { | |||
| canvas.drawBitmap(mIconSymbol, 0, 0, mPaint); | |||
| } | |||
| canvas.drawBitmap(mIcon, 0, 0, mPaint); | |||
| return mIconBG; | |||
| } | |||
| } | |||
| @@ -0,0 +1,102 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <resources> | |||
| <string | |||
| name="app_name">Easy Bracketing</string> | |||
| <string | |||
| name="dynamic_range">Dynamikbereich</string> | |||
| <string | |||
| name="shutter_speed">Belichtungszeit</string> | |||
| <string | |||
| name="aperture">Blende</string> | |||
| <string | |||
| name="ev">LW</string> | |||
| <string | |||
| name="dark_point">Werte Dunkelpunkt</string> | |||
| <string | |||
| name="bright_point">Werte Hellpunkt</string> | |||
| <string | |||
| name="calcParams">Berechnungsparameter</string> | |||
| <string | |||
| name="delta_EV">Δ LW</string> | |||
| <string | |||
| name="expEVStep">LW-Schritt</string> | |||
| <string | |||
| name="calculate">Berechnen</string> | |||
| <string | |||
| name="reset">Zurücksetzen</string> | |||
| <string | |||
| name="bracketingRes">Bracketing Belichtungswerte</string> | |||
| <string | |||
| name="expNbrLbl"># Bel.</string> | |||
| <string | |||
| name="toastWarningDP_BP">Das Delta zwischen dem LW des Dunkelpunkt und dem LW des Hellpunkt ist kleiner oder gleich 0. | |||
| \nBitte korrigieren Sie die Eingaben.</string> | |||
| <string | |||
| name="menuUserGuide">Benutzeranleitung</string> | |||
| <string | |||
| name="menuSettings">Einstellungen...</string> | |||
| <string | |||
| name="menuAbout">Info</string> | |||
| <string | |||
| name="about_Description"> | |||
| EasyBracketing dient zur schnellen und einfachen Berechnung einer Belichtungsserie ausgehend | |||
| von den Belichtungswerten eines Dunkelpunktes und eines Hellpunktes. | |||
| </string> | |||
| <string | |||
| name="AppVersionLabel">Version:</string> | |||
| <string | |||
| name="about_DevelopedBy">Entwickelt von spherIC (F. Smilari)\nMail an: | |||
| merlin868@hotmail.com\n\nÜbersetzt von spherIC (F. Smilari)</string> | |||
| <string | |||
| name="Percent18Correction">18%-Grauwertkorrektur</string> | |||
| <string | |||
| name="Percent18CorrectionBP">Hellpunktkorrektur (LW)</string> | |||
| <string | |||
| name="Percent18CorrectionDP">Dunkelpunktkorrektur (LW)</string> | |||
| <string | |||
| name="FixRangePoint">Ausgangspunkt für Belichtungsserie</string> | |||
| <string | |||
| name="FixRangePointBP">Von Hellpunktwerten ausgehen</string> | |||
| <string | |||
| name="FixRangePointDP">Von Dunkelpunktwerten ausgehen</string> | |||
| <string | |||
| name="BtnSave">Speichern</string> | |||
| <string | |||
| name="BtnCancel">Abbrechen</string> | |||
| <string | |||
| name="BtnClose">Schliessen</string> | |||
| <string | |||
| name="header_GeneralPurpose">1. Allgm. Verwendungszweck</string> | |||
| <string | |||
| name="text_GeneralPurpose"> | |||
| Beim Erstellen einer Belichtungsreihe für ein späteres HDR-Bild, stellt sich oftmals das Problem, | |||
| dass der Kontrastumfang zu gross ist um von der typischen \"+2LW/0LW/-2LW\"-Vorgehensweise abgedeckt zu werden.\nHier | |||
| kommt \"EasyBracketing\" zum Zug.\nAusgehend von gemessenen Werten für den hellsten Punkt resp. den dunkelsten Punkt | |||
| werden über definierbare Parameter alle notwendigen Belichtungen einer Belichtungsreihe berechnet. Diese können dann | |||
| an der Kamera sukzessive eingestellt und die Aufnahme ausgelöst werden. | |||
| </string> | |||
| <string | |||
| name="header_HowTo">2. Vorgehensweise</string> | |||
| <string | |||
| name="text_HowTo"> | |||
| 1. Stellen Sie die Kamera auf Spotbelichtungsmessung. | |||
| \n2. Wählen Sie eine geeignete Blende. | |||
| \n3. Messen Sie mit der Kamera die Belichtungswerte für den dunkelsten Punkt ihres Bildausschnitts. | |||
| \n4. Messen Sie mit der Kamera die Belichtungswerte für den hellsten Punkt ihres Bildausschnitts. | |||
| \n5. Stellen Sie die gemessenen Werte im Bereich \"Dynamikbereich\" von EasyBracketing ein. | |||
| \n6. Verändern Sie, falls gewünscht die Berechnungsparamter nach Ihren Vorstellungen. | |||
| \n7. Klicken Sie auf \"Berechnen\" um die Belichtungsreihe zu berechnen. | |||
| \n | |||
| \nEinstellungen: | |||
| \n | |||
| \n18%%-Grauwertkorrektur: | |||
| \nDie meisten Kameras versuchen bei der Belichtungsmessung auf ein sogenanntes 18%-Grau gleichmässig zu belichten. | |||
| Dies ist für Belichtungsreihen eher unerwünscht. Mit dieser Einstellung können Sie dem entgegenwirken. Den einzustellenden | |||
| Wert muss man über Belichtungsversuche empirisch ermitteln, da die Sensoren bei jedem Hersteller anders sind. | |||
| \n | |||
| \nAusgangspukt der Belichtungsreihe: | |||
| \nIn den meisten Fällen, wird der Dynamikumfang (Delta LW) einen gebrochenen Wert aufweisen, der in der Berechnung aufgerundet | |||
| wird. Dies führt dazu, dass der Dynamikumfang der Berechnung grösser ist als der Gemessene. Mit dieser Einstellung bestimmen Sie | |||
| von welchem Ende des Dynamikumfangs (Anker) die Berechnung der Belichtungsreihe starten soll. | |||
| </string> | |||
| </resources> | |||
| @@ -0,0 +1,51 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <LinearLayout | |||
| xmlns:android="http://schemas.android.com/apk/res/android" | |||
| android:background="@drawable/bg_about" | |||
| android:padding="10dp" | |||
| android:layout_height="fill_parent" | |||
| android:layout_width="fill_parent" | |||
| android:orientation="vertical"> | |||
| <LinearLayout | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:orientation="horizontal" | |||
| android:id="@+id/layout_ugVersion"> | |||
| <ImageView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginRight="20dip" | |||
| android:id="@+id/ug_imageAppIcon" | |||
| android:layout_gravity="center_vertical" /> | |||
| <TextView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:textColor="#FF000000" | |||
| android:text="iii" | |||
| android:id="@+id/ug_TextVersion" | |||
| android:textStyle="bold" | |||
| android:layout_gravity="center_vertical" | |||
| android:gravity="center_vertical" /> | |||
| </LinearLayout> | |||
| <LinearLayout | |||
| android:orientation="vertical" android:layout_height="fill_parent" android:layout_width="fill_parent"> | |||
| <ScrollView android:layout_height="fill_parent" android:layout_width="fill_parent" android:fillViewport="true" android:id="@+id/ug_ScrollView"><TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/ug_Text" android:text="@string/userGuidePourpose" android:textColor="@color/black"> | |||
| </TextView></ScrollView> | |||
| </LinearLayout> | |||
| <Button | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:background="@drawable/btn_fs" | |||
| android:id="@+id/btn_ugClose" | |||
| android:text="Close" | |||
| android:textColor="@color/white" | |||
| android:layout_gravity="center_horizontal"> | |||
| </Button> | |||
| </LinearLayout> | |||
| @@ -0,0 +1,82 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <resources> | |||
| <string | |||
| name="app_name">Easy Bracketing</string> | |||
| <string | |||
| name="dynamic_range">Dynamikbereich</string> | |||
| <string | |||
| name="shutter_speed">Belichtungszeit</string> | |||
| <string | |||
| name="aperture">Blende</string> | |||
| <string | |||
| name="ev">LW</string> | |||
| <string | |||
| name="dark_point">Werte Dunkelpunkt</string> | |||
| <string | |||
| name="bright_point">Werte Hellpunkt</string> | |||
| <string | |||
| name="calcParams">Berechnungsparameter</string> | |||
| <string | |||
| name="delta_EV">Δ LW</string> | |||
| <string | |||
| name="expEVStep">LW-Schritt</string> | |||
| <string | |||
| name="calculate">Berechnen</string> | |||
| <string | |||
| name="reset">Zurücksetzen</string> | |||
| <string | |||
| name="bracketingRes">Bracketing Belichtungswerte</string> | |||
| <string | |||
| name="expNbrLbl"># Bel.</string> | |||
| <string | |||
| name="toastWarningDP_BP">Das Delta zwischen dem LW des Dunkelpunkt und dem LW des Hellpunkt ist kleiner oder gleich 0. | |||
| \nBitte korrigieren Sie die Eingaben.</string> | |||
| <string | |||
| name="menuUserGuide">Benutzeranleitung</string> | |||
| <string | |||
| name="menuSettings">Einstellungen...</string> | |||
| <string | |||
| name="menuAbout">Info</string> | |||
| <string | |||
| name="about_Description"> | |||
| EasyBracketing dient zur schnellen und einfachen Berechnung einer Belichtungsserie ausgehend | |||
| von den Belichtungswerten eines Dunkelpunktes und eines Hellpunktes. | |||
| </string> | |||
| <string | |||
| name="AppVersionLabel">Version:</string> | |||
| <string | |||
| name="about_DevelopedBy">Entwickelt von spherIC (F. Smilari)\nMail an: | |||
| merlin868@hotmail.com\n\nÜbersetzt von spherIC (F. Smilari)</string> | |||
| <string | |||
| name="Percent18Correction">18%-Grauwertkorrektur</string> | |||
| <string | |||
| name="Percent18CorrectionBP">Hellpunktkorrektur (LW)</string> | |||
| <string | |||
| name="Percent18CorrectionDP">Dunkelpunktkorrektur (LW)</string> | |||
| <string | |||
| name="FixRangePoint">Ausgangspunkt für Belichtungsserie</string> | |||
| <string | |||
| name="FixRangePointBP">Von Hellpunktwerten ausgehen</string> | |||
| <string | |||
| name="FixRangePointDP">Von Dunkelpunktwerten ausgehen</string> | |||
| <string | |||
| name="BtnSave">Speichern</string> | |||
| <string | |||
| name="BtnCancel">Abbrechen</string> | |||
| <string | |||
| name="BtnClose">Schliessen</string> | |||
| <string | |||
| name="header_GeneralPurpose">1. Allgm. Verwendungszweck</string> | |||
| <string | |||
| name="text_GeneralPurpose"> | |||
| Beim Erstellen einer Belichtungsreihe für ein späteres HDR-Bild, stellt sich oftmals das Problem, | |||
| dass der Kontrastumfang zu gross ist um von der typischen \"+2LW/0LW/-2LW\"-Vorgehensweise abgedeckt zu werden.\nHier kommt \"EasyBracketing\" zum Zug.\n | |||
| Ausgehend von gemessenen Werten für den hellsten Punkt resp. den dunkelsten Punkt | |||
| werden über definierbare Parameter alle notwendigen Belichtungen einer Belichtungsreihe berechnet. Diese können dann | |||
| an der Kamera sukzessive eingestellt und die Aufnahme ausgelöst werden. | |||
| </string> | |||
| <string | |||
| name="header_HowTo">2. Vorgehensweise</string> | |||
| <string | |||
| name="text_HowTo">Text here</string> | |||
| </resources> | |||
| @@ -0,0 +1,74 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <resources> | |||
| <string | |||
| name="app_name">Easy Bracketing</string> | |||
| <string | |||
| name="dynamic_range">Dynamikbereich</string> | |||
| <string | |||
| name="shutter_speed">Belichtungszeit</string> | |||
| <string | |||
| name="aperture">Blende</string> | |||
| <string | |||
| name="ev">LW</string> | |||
| <string | |||
| name="dark_point">Werte Dunkelpunkt</string> | |||
| <string | |||
| name="bright_point">Werte Hellpunkt</string> | |||
| <string | |||
| name="calcParams">Berechnungsparameter</string> | |||
| <string | |||
| name="delta_EV">Δ LW</string> | |||
| <string | |||
| name="expEVStep">LW-Schritt</string> | |||
| <string | |||
| name="calculate">Berechnen</string> | |||
| <string | |||
| name="reset">Zurücksetzen</string> | |||
| <string | |||
| name="bracketingRes">Bracketing Belichtungswerte</string> | |||
| <string | |||
| name="expNbrLbl"># Bel.</string> | |||
| <string | |||
| name="toastWarningDP_BP">Das Delta zwischen dem LW des Dunkelpunkt und dem LW des Hellpunkt ist kleiner oder glleich 0. | |||
| \nBitte korrigieren Sie die Eingaben.</string> | |||
| <string | |||
| name="menuUserGuide">Benutzeranleitung</string> | |||
| <string | |||
| name="menuSettings">Einstellungen...</string> | |||
| <string | |||
| name="menuAbout">Info</string> | |||
| <string | |||
| name="about_Description"> | |||
| EasyBracketing dient zur schnellen und einfachen Berechnung einer Belichtungsserie ausgehend | |||
| von den Belichtungswerten eines Dunkelpunktes und eines Hellpunktes. | |||
| </string> | |||
| <string | |||
| name="AppVersionLabel">Version:</string> | |||
| <string | |||
| name="about_DevelopedBy">Entwickelt von spherIC (F. Smilari)\nMail an: | |||
| merlin868@hotmail.com\n\nÜbersetzt von spherIC (F. Smilari)</string> | |||
| <string | |||
| name="Percent18Correction">18%-Grauwertkorrektur</string> | |||
| <string | |||
| name="Percent18CorrectionBP">Hellpunktkorrektur (LW)</string> | |||
| <string | |||
| name="Percent18CorrectionDP">Dunkelpunktkorrektur (LW)</string> | |||
| <string | |||
| name="FixRangePoint">Fester LW Bereichswert</string> | |||
| <string | |||
| name="FixRangePointBP">Von Hellpunktwerten ausgehen</string> | |||
| <string | |||
| name="FixRangePointDP">Von Dunkelpunktwerten ausgehen</string> | |||
| <string | |||
| name="BtnSave">Speichern</string> | |||
| <string | |||
| name="BtnCancel">Abbrechen</string> | |||
| <string | |||
| name="header_GeneralPurpose">1. General Purpose</string> | |||
| <string | |||
| name="text_GeneralPurpose">Text here</string> | |||
| <string | |||
| name="header_HowTo">2. How to use</string> | |||
| <string | |||
| name="text_HowTo">Text here</string> | |||
| </resources> | |||
| @@ -0,0 +1,247 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC.resultlist; | |||
| import java.util.List; | |||
| import android.app.Activity; | |||
| import android.content.Context; | |||
| import android.util.DisplayMetrics; | |||
| import android.view.Gravity; | |||
| import android.view.View; | |||
| import android.view.ViewGroup; | |||
| import android.widget.BaseAdapter; | |||
| import android.widget.ImageView; | |||
| import android.widget.LinearLayout; | |||
| import android.widget.TextView; | |||
| import android.widget.LinearLayout.LayoutParams; | |||
| import ch.spherIC.R; | |||
| /** | |||
| * Exposure adapter view class. | |||
| */ | |||
| class ExposureAdapterView extends LinearLayout { | |||
| DisplayMetrics metrics = new DisplayMetrics(); | |||
| ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(metrics); | |||
| /** | |||
| * Creates a new ExposureAdapterView object. | |||
| * | |||
| * @param context DOCUMENT ME! | |||
| * @param weather DOCUMENT ME! | |||
| */ | |||
| public ExposureAdapterView(Context context, Exposure exposure) { | |||
| super(context); | |||
| this.setOrientation(HORIZONTAL); | |||
| // Nbr | |||
| TextView nbrControl = new TextView(context); | |||
| LinearLayout.LayoutParams nbrParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| nbrParams.setMargins(3, 1, 1, 1); | |||
| nbrControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| nbrControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| nbrControl.setText(Integer.toString(exposure.getNbr())); | |||
| addView(nbrControl, nbrParams); | |||
| // Aperture | |||
| TextView apertureControl = new TextView(context); | |||
| LinearLayout.LayoutParams apertureParams = new LinearLayout.LayoutParams(100, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| apertureParams.setMargins(1, 1, 1, 1); | |||
| apertureControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| apertureControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| apertureControl.setText(exposure.getAperture()); | |||
| addView(apertureControl, apertureParams); | |||
| // Shutter speed | |||
| TextView shutterControl = new TextView(context); | |||
| LinearLayout.LayoutParams shutterParams = new LinearLayout.LayoutParams(170, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| shutterParams.setMargins(1, 1, 1, 1); | |||
| shutterControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| shutterControl.setTextAppearance(context, R.style.ResultExposureTextSpecial); | |||
| shutterControl.setText(exposure.getShutterSpeed()); | |||
| addView(shutterControl, shutterParams); | |||
| // EV Step | |||
| TextView evStepControl = new TextView(context); | |||
| LinearLayout.LayoutParams evStepParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| evStepParams.setMargins(1, 1, 1, 1); | |||
| evStepControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| evStepControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| evStepControl.setText(exposure.getEvStepAsString()); | |||
| addView(evStepControl, evStepParams); | |||
| // Icon | |||
| ImageView expIconControl = new ImageView(context); | |||
| LinearLayout.LayoutParams expIconParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| expIconParams.setMargins(1, 1, 1, 1); | |||
| expIconControl.setImageBitmap(exposure.getEvStepBtmp()); | |||
| addView(expIconControl, expIconParams); | |||
| } | |||
| } | |||
| /** | |||
| * Exposure results adapter. | |||
| */ | |||
| public class ExposureAdapter extends BaseAdapter { | |||
| private static DisplayMetrics metrics; | |||
| private Context context; | |||
| private List<Exposure> exposureList; | |||
| /** | |||
| * Creates a new ExposureAdapter object. | |||
| */ | |||
| public ExposureAdapter(Context context, List<Exposure> expList) { | |||
| this.context = context; | |||
| this.exposureList = expList; | |||
| } | |||
| /** | |||
| * Retrieves list size. | |||
| * | |||
| * @return list size | |||
| */ | |||
| @Override | |||
| public int getCount() { | |||
| return this.exposureList.size(); | |||
| } | |||
| /** | |||
| * Retrieves the exposure at index <code>position</code>. | |||
| * | |||
| * @param position Index in list | |||
| * | |||
| * @return Exposure at index <code>position</code> | |||
| */ | |||
| @Override | |||
| public Object getItem(int position) { | |||
| return this.exposureList.get(position); | |||
| } | |||
| /** | |||
| * Retrieves the number of the exposure at index <code>position</code>. | |||
| * | |||
| * @param position Index in list | |||
| * | |||
| * @return the number of the exposure at index <code>position</code> | |||
| */ | |||
| @Override | |||
| public long getItemId(int position) { | |||
| //return this.exposureList.get(position).getNbr(); | |||
| return position; | |||
| } | |||
| /** | |||
| * Retrieves a view representing a single result row. | |||
| * | |||
| * @param position Index in list | |||
| * @param convertView view | |||
| * @param parent parent | |||
| * | |||
| * @return {@link ExposureAdapterView} | |||
| */ | |||
| @Override | |||
| public View getView(int position, View convertView, ViewGroup parent) { | |||
| Exposure exposure = this.exposureList.get(position); | |||
| return new ExposureAdapterView(this.context, exposure); | |||
| } | |||
| /** | |||
| * Retrieves the value of | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| public static View getHeaderView(Context context, LinearLayout headerLL) { | |||
| int black = headerLL.getResources().getColor(R.color.black); | |||
| int width = getMetrics(context).widthPixels; | |||
| // Nbr | |||
| TextView nbrControl = new TextView(context); | |||
| LinearLayout.LayoutParams nbrParams = new LinearLayout.LayoutParams(Math.round(0.14583f * width), | |||
| LayoutParams.WRAP_CONTENT, 0.2f); | |||
| nbrParams.setMargins(3, 1, 1, 1); | |||
| nbrControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| nbrControl.setTextSize(13f); | |||
| nbrControl.setTextColor(black); | |||
| nbrControl.setText(R.string.expNbrLbl); | |||
| headerLL.addView(nbrControl, nbrParams); | |||
| // Aperture | |||
| TextView apertureControl = new TextView(context); | |||
| LinearLayout.LayoutParams apertureParams = new LinearLayout.LayoutParams(Math.round(0.20833f * width), | |||
| LayoutParams.WRAP_CONTENT, 0.2f); | |||
| apertureParams.setMargins(1, 1, 1, 1); | |||
| apertureControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| apertureControl.setTextSize(13f); | |||
| apertureControl.setTextColor(black); | |||
| apertureControl.setText(R.string.aperture); | |||
| headerLL.addView(apertureControl, apertureParams); | |||
| // Shutter speed | |||
| TextView shutterControl = new TextView(context); | |||
| LinearLayout.LayoutParams shutterParams = new LinearLayout.LayoutParams(Math.round(0.35417f * width), | |||
| LayoutParams.WRAP_CONTENT, 0.2f); | |||
| shutterParams.setMargins(1, 1, 1, 1); | |||
| shutterControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| shutterControl.setTextSize(13f); | |||
| shutterControl.setTextColor(black); | |||
| shutterControl.setText(R.string.shutter_speed); | |||
| headerLL.addView(shutterControl, shutterParams); | |||
| // EV Step | |||
| TextView evStepControl = new TextView(context); | |||
| LinearLayout.LayoutParams evStepParams = new LinearLayout.LayoutParams(Math.round(0.14583f * width), | |||
| LayoutParams.WRAP_CONTENT, 0.2f); | |||
| evStepParams.setMargins(1, 1, 1, 1); | |||
| evStepControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| evStepControl.setTextSize(13f); | |||
| evStepControl.setTextColor(black); | |||
| evStepControl.setText(R.string.expEVStep); | |||
| headerLL.addView(evStepControl, evStepParams); | |||
| // Icon | |||
| ImageView expIconControl = new ImageView(context); | |||
| LinearLayout.LayoutParams expIconParams = new LinearLayout.LayoutParams(Math.round(0.14583f * width), | |||
| LayoutParams.WRAP_CONTENT, 0.2f); | |||
| expIconParams.setMargins(1, 1, 1, 1); | |||
| headerLL.addView(expIconControl, expIconParams); | |||
| return headerLL; | |||
| } | |||
| /** | |||
| * Retrieves the value of | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| private static DisplayMetrics getMetrics(Context context) { | |||
| if (metrics == null) { | |||
| metrics = new DisplayMetrics(); | |||
| ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(metrics); | |||
| } | |||
| return metrics; | |||
| } | |||
| } | |||
| @@ -0,0 +1,169 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC.resultlist; | |||
| import java.text.DecimalFormat; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import android.content.Context; | |||
| import android.content.res.Resources; | |||
| import android.graphics.Bitmap; | |||
| import android.graphics.BitmapFactory; | |||
| import android.graphics.Canvas; | |||
| import android.graphics.Color; | |||
| import android.graphics.Paint; | |||
| import android.graphics.PorterDuff; | |||
| import android.graphics.PorterDuffXfermode; | |||
| import android.graphics.Bitmap.Config; | |||
| import android.graphics.Paint.Style; | |||
| import ch.spherIC.EVFormula; | |||
| import ch.spherIC.EasyBracketMain; | |||
| import ch.spherIC.R; | |||
| /** | |||
| * Factory that creates the exposure icons according to the EV range and values. | |||
| */ | |||
| public class ExposureFactory { | |||
| public static final DecimalFormat evDF = new DecimalFormat("0.######"); | |||
| /** | |||
| * DOCUMENT ME! | |||
| * | |||
| * @param context DOCUMENT ME! | |||
| * @param dpEV DOCUMENT ME! | |||
| * @param bpEv DOCUMENT ME! | |||
| * @param calcPrmAperture DOCUMENT ME! | |||
| * @param calcPrmEvStep DOCUMENT ME! | |||
| * @param fixBP DOCUMENT ME! | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| public static List<Exposure> calculateExposures(Context context, double dpEV, double bpEv, double calcPrmAperture, | |||
| double calcPrmEvStep, boolean fixBP, List<Double> allowedShutters) { | |||
| Exposure exp; | |||
| List<Exposure> exposures = new ArrayList<Exposure>(); | |||
| double deltaEV = bpEv - dpEV; | |||
| long nbrExposures = Math.round(deltaEV / calcPrmEvStep) + 1; | |||
| // correct the deltaEV | |||
| deltaEV = calcPrmEvStep * (nbrExposures - 1); | |||
| double baseEVStep = -deltaEV / 2; | |||
| for (int i = 0; i < nbrExposures; i++) { | |||
| boolean found = false; | |||
| String shutterSpeed = ""; | |||
| double shutter; | |||
| double evValue = 0; | |||
| double evStep = baseEVStep + i * calcPrmEvStep; | |||
| if (fixBP) { | |||
| evValue = bpEv - (nbrExposures - 1 - i) * calcPrmEvStep; | |||
| } else { | |||
| evValue = dpEV + i * calcPrmEvStep; | |||
| } | |||
| shutter = Double.valueOf(evDF.format((EVFormula.calcShutterSpeed(calcPrmAperture, evValue)))); | |||
| for (int j = 1; j < allowedShutters.size(); j++) { | |||
| double v1 = allowedShutters.get(j - 1); | |||
| double v2 = allowedShutters.get(j); | |||
| if ((v1 <= shutter && shutter <= v2) || (v2 <= shutter && shutter <= v1)) { | |||
| if (Math.abs(shutter - v1) <= Math.abs(shutter - v2)) { | |||
| shutterSpeed = (v1 < 1) ? "1/" + evDF.format((1 / v1)) | |||
| : "" + EasyBracketMain.DF.format(v1) + "''"; | |||
| } else { | |||
| shutterSpeed = (v2 < 1) ? "1/" + evDF.format((1 / v2)) | |||
| : "" + EasyBracketMain.DF.format(v2) + "''"; | |||
| } | |||
| found = true; | |||
| break; | |||
| } | |||
| } | |||
| if (!found) { | |||
| shutterSpeed = (shutter < 1) ? "1/" + Math.round(1 / shutter) | |||
| : "" + EasyBracketMain.DF.format(shutter) + "''"; | |||
| } | |||
| exp = new Exposure(i + 1, "f/" + EasyBracketMain.DF.format(calcPrmAperture), shutterSpeed, evStep, deltaEV, | |||
| getExpIcon(context, i + 1, (int) nbrExposures)); | |||
| exposures.add(exp); | |||
| } | |||
| return exposures; | |||
| } | |||
| /** | |||
| * Retrieves Icon. | |||
| * | |||
| * @param context Context | |||
| * @param exp {@link Exposure} object | |||
| * | |||
| * @return Color stepped icon | |||
| */ | |||
| private static Bitmap getExpIcon(Context context, int expNbr, int nbrExposures) { | |||
| int deltaRGB = twentyPercentGray; | |||
| final int twentyPercentGray = Math.round(255f * 0.8f); | |||
| if (expNbr > 1 || nbrExposures > 1) { | |||
| deltaRGB = twentyPercentGray / (nbrExposures - 1) * (expNbr - 1); | |||
| } | |||
| Bitmap mIcon; | |||
| Bitmap mIconBG; | |||
| Bitmap mIconSymbol; | |||
| Bitmap mIconSymbol_bl; | |||
| Canvas canvas; | |||
| Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); | |||
| final Resources res = context.getResources(); | |||
| // The background | |||
| mIconBG = Bitmap.createBitmap(36, 36, Config.ARGB_8888); | |||
| mIconBG.eraseColor(0x00000000); | |||
| canvas = new Canvas(mIconBG); | |||
| mPaint.setStyle(Style.FILL); | |||
| mPaint.setColor(Color.argb(255, deltaRGB, deltaRGB, deltaRGB)); | |||
| canvas.drawRect(2, 2, 33, 33, mPaint); | |||
| // Let's retrieve all icon pieces as Bitmaps. | |||
| mIcon = BitmapFactory.decodeResource(res, R.drawable.exposureicon_frame); | |||
| mIconSymbol = BitmapFactory.decodeResource(res, R.drawable.exposureicon_symb_white); | |||
| mIconSymbol_bl = BitmapFactory.decodeResource(res, R.drawable.exposureicon_symb_black); | |||
| // Prepares the paint that will be used to draw our icon mask. Using | |||
| // PorterDuff.Mode.SRC_OVER means the image that will be drawn will | |||
| // mask the already drawn image. | |||
| mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER)); | |||
| // We're now ready to drawn our Android-like icon :) | |||
| if (deltaRGB > twentyPercentGray / 2) { | |||
| canvas.drawBitmap(mIconSymbol_bl, 0, 0, mPaint); | |||
| } else { | |||
| canvas.drawBitmap(mIconSymbol, 0, 0, mPaint); | |||
| } | |||
| canvas.drawBitmap(mIcon, 0, 0, mPaint); | |||
| return mIconBG; | |||
| } | |||
| } | |||
| @@ -0,0 +1,199 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC.resultlist; | |||
| import java.text.DecimalFormat; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import android.app.Activity; | |||
| import android.content.Context; | |||
| import android.content.res.Resources; | |||
| import android.graphics.Bitmap; | |||
| import android.graphics.BitmapFactory; | |||
| import android.graphics.Canvas; | |||
| import android.graphics.Color; | |||
| import android.graphics.Paint; | |||
| import android.graphics.PorterDuff; | |||
| import android.graphics.PorterDuffXfermode; | |||
| import android.graphics.Bitmap.Config; | |||
| import android.graphics.Paint.Style; | |||
| import android.util.DisplayMetrics; | |||
| import ch.spherIC.EVFormula; | |||
| import ch.spherIC.EasyBracketMain; | |||
| import ch.spherIC.R; | |||
| /** | |||
| * Factory that creates the exposure icons according to the EV range and values. | |||
| */ | |||
| public class ExposureFactory { | |||
| public static final DecimalFormat evDF = new DecimalFormat("0.######"); | |||
| /** | |||
| * DOCUMENT ME! | |||
| * | |||
| * @param context DOCUMENT ME! | |||
| * @param dpEV DOCUMENT ME! | |||
| * @param bpEv DOCUMENT ME! | |||
| * @param calcPrmAperture DOCUMENT ME! | |||
| * @param calcPrmEvStep DOCUMENT ME! | |||
| * @param fixBP DOCUMENT ME! | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| public static List<Exposure> calculateExposures(Context context, double dpEV, double bpEv, double calcPrmAperture, | |||
| double calcPrmEvStep, boolean fixBP, List<Double> allowedShutters) { | |||
| Exposure exp; | |||
| List<Exposure> exposures = new ArrayList<Exposure>(); | |||
| double deltaEV = bpEv - dpEV; | |||
| long nbrExposures = Math.round(deltaEV / calcPrmEvStep) + 1; | |||
| // correct the deltaEV | |||
| deltaEV = calcPrmEvStep * (nbrExposures - 1); | |||
| double baseEVStep = -deltaEV / 2; | |||
| for (int i = 0; i < nbrExposures; i++) { | |||
| boolean found = false; | |||
| String shutterSpeed = ""; | |||
| double shutter; | |||
| double evValue = 0; | |||
| double evStep = baseEVStep + i * calcPrmEvStep; | |||
| if (fixBP) { | |||
| evValue = bpEv - (nbrExposures - 1 - i) * calcPrmEvStep; | |||
| } else { | |||
| evValue = dpEV + i * calcPrmEvStep; | |||
| } | |||
| shutter = Double.valueOf(evDF.format((EVFormula.calcShutterSpeed(calcPrmAperture, evValue)))); | |||
| for (int j = 1; j < allowedShutters.size(); j++) { | |||
| double v1 = allowedShutters.get(j - 1); | |||
| double v2 = allowedShutters.get(j); | |||
| if ((v1 <= shutter && shutter <= v2) || (v2 <= shutter && shutter <= v1)) { | |||
| if (Math.abs(shutter - v1) <= Math.abs(shutter - v2)) { | |||
| shutterSpeed = (v1 < 1) ? "1/" + evDF.format((1 / v1)) | |||
| : "" + EasyBracketMain.DF.format(v1) + "''"; | |||
| } else { | |||
| shutterSpeed = (v2 < 1) ? "1/" + evDF.format((1 / v2)) | |||
| : "" + EasyBracketMain.DF.format(v2) + "''"; | |||
| } | |||
| found = true; | |||
| break; | |||
| } | |||
| } | |||
| if (!found) { | |||
| shutterSpeed = (shutter < 1) ? "1/" + Math.round(1 / shutter) | |||
| : "" + EasyBracketMain.DF.format(shutter) + "''"; | |||
| } | |||
| exp = new Exposure(i + 1, "f/" + EasyBracketMain.DF.format(calcPrmAperture), shutterSpeed, evStep, deltaEV, | |||
| getExpIcon(context, i + 1, (int) nbrExposures)); | |||
| exposures.add(exp); | |||
| } | |||
| return exposures; | |||
| } | |||
| /** | |||
| * Retrieves Icon. | |||
| * | |||
| * @param context Context | |||
| * @param exp {@link Exposure} object | |||
| * | |||
| * @return Color stepped icon | |||
| */ | |||
| private static Bitmap getExpIcon(Context context, int expNbr, int nbrExposures) { | |||
| Bitmap mIcon; | |||
| Bitmap mIconBG; | |||
| Bitmap mIconSymbol; | |||
| Bitmap mIconSymbol_bl; | |||
| Canvas canvas; | |||
| Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); | |||
| final Resources res = context.getResources(); | |||
| final int twentyPercentGray = Math.round(255f * 0.8f); | |||
| int deltaRGB = twentyPercentGray; | |||
| int iSize; | |||
| int iSize_r; | |||
| int iStart; | |||
| DisplayMetrics metrics = new DisplayMetrics(); | |||
| ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(metrics); | |||
| switch (metrics.densityDpi) { | |||
| case DisplayMetrics.DENSITY_LOW: | |||
| iSize = 18; | |||
| iSize_r = 17; | |||
| iStart = 1; | |||
| break; | |||
| case DisplayMetrics.DENSITY_MEDIUM: | |||
| iSize = 24; | |||
| iSize_r = 22; | |||
| iStart = 2; | |||
| break; | |||
| default: | |||
| iSize = 36; | |||
| iSize_r = 33; | |||
| iStart = 2; | |||
| break; | |||
| } | |||
| if (expNbr > 1 || nbrExposures > 1) { | |||
| deltaRGB = twentyPercentGray / (nbrExposures - 1) * (expNbr - 1); | |||
| } | |||
| // The background | |||
| mIconBG = Bitmap.createBitmap(iSize, iSize, Config.ARGB_8888); | |||
| mIconBG.eraseColor(0x00000000); | |||
| canvas = new Canvas(mIconBG); | |||
| mPaint.setStyle(Style.FILL); | |||
| mPaint.setColor(Color.argb(255, deltaRGB, deltaRGB, deltaRGB)); | |||
| canvas.drawRect(iStart, iStart, iSize_r, iSize_r, mPaint); | |||
| // Let's retrieve all icon pieces as Bitmaps. | |||
| mIcon = BitmapFactory.decodeResource(res, R.drawable.exposureicon_frame); | |||
| mIconSymbol = BitmapFactory.decodeResource(res, R.drawable.exposureicon_symb_white); | |||
| mIconSymbol_bl = BitmapFactory.decodeResource(res, R.drawable.exposureicon_symb_black); | |||
| // Prepares the paint that will be used to draw our icon mask. Using | |||
| // PorterDuff.Mode.SRC_OVER means the image that will be drawn will | |||
| // mask the already drawn image. | |||
| mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER)); | |||
| // We're now ready to drawn our Android-like icon :) | |||
| if (deltaRGB > twentyPercentGray / 2) { | |||
| canvas.drawBitmap(mIconSymbol_bl, 0, 0, mPaint); | |||
| } else { | |||
| canvas.drawBitmap(mIconSymbol, 0, 0, mPaint); | |||
| } | |||
| canvas.drawBitmap(mIcon, 0, 0, mPaint); | |||
| return mIconBG; | |||
| } | |||
| } | |||
| @@ -0,0 +1,156 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC; | |||
| import android.app.Activity; | |||
| import android.app.Dialog; | |||
| import android.content.pm.PackageInfo; | |||
| import android.content.pm.PackageManager; | |||
| import android.content.pm.PackageManager.NameNotFoundException; | |||
| import android.view.View; | |||
| import android.view.View.OnClickListener; | |||
| import android.widget.Button; | |||
| import android.widget.ImageView; | |||
| import android.widget.TextView; | |||
| import ch.spherIC.settings.SettingsDlg; | |||
| /** | |||
| * Dialog factory class. | |||
| */ | |||
| public final class DialogFactory { | |||
| /** | |||
| * Static main method to initialize classes | |||
| * | |||
| * @param dlgCode Code of dialog to instantiate. See {@link EasyBracketMain} | |||
| * @param parent Parent {@link Activity} | |||
| * | |||
| * @return Instantiated dialog | |||
| */ | |||
| public static Dialog createDialog(int dlgCode, Activity parent) { | |||
| Dialog dlg; | |||
| switch (dlgCode) { | |||
| case EasyBracketMain.ABOUT_DLG: | |||
| dlg = createAboutDialog(parent); | |||
| break; | |||
| case EasyBracketMain.SETTINGS_DLG: | |||
| dlg = createSettingsDialog(parent); | |||
| break; | |||
| case EasyBracketMain.USERGUIDE_DLG: | |||
| dlg = createUserGuideDialog(parent); | |||
| break; | |||
| default: | |||
| dlg = null; | |||
| break; | |||
| } | |||
| return dlg; | |||
| } | |||
| /** | |||
| * Creates the About Dialog | |||
| */ | |||
| private static Dialog createAboutDialog(Activity parent) { | |||
| final Dialog dialog = new Dialog(parent); | |||
| dialog.setContentView(R.layout.about_dialog); | |||
| parent.getResources().getText(R.string.menuAbout); | |||
| dialog.setTitle(parent.getResources().getText(R.string.menuAbout) + " EasyBracketing..."); | |||
| ImageView image = (ImageView) dialog.findViewById(R.id.about_imageAppIcon); | |||
| image.setImageResource(R.drawable.icon); | |||
| TextView text = (TextView) dialog.findViewById(R.id.about_TextDescription); | |||
| text.setText(parent.getResources().getText(R.string.about_Description)); | |||
| text = (TextView) dialog.findViewById(R.id.about_TextVersion); | |||
| text.setText(parent.getResources().getText(R.string.AppVersionLabel).toString() | |||
| + " " + parent.getResources().getText(R.string.AppVersion).toString()); | |||
| text = (TextView) dialog.findViewById(R.id.about_TextAutor); | |||
| text.setText(parent.getResources().getText(R.string.about_DevelopedBy).toString()); | |||
| ((Button) dialog.findViewById(R.id.btn_AboutClose)).setOnClickListener(new OnClickListener() { | |||
| @Override | |||
| public void onClick(View v) { | |||
| dialog.dismiss(); | |||
| } | |||
| }); | |||
| return dialog; | |||
| } | |||
| /** | |||
| * Creates the Settings Dialog | |||
| */ | |||
| private static Dialog createSettingsDialog(Activity parent) { | |||
| final Dialog dialog = new SettingsDlg(parent); | |||
| return dialog; | |||
| } | |||
| /** | |||
| * Creates the User Guide Dialog | |||
| */ | |||
| private static Dialog createUserGuideDialog(Activity parent) { | |||
| String versionName =""; | |||
| final Dialog dialog = new Dialog(parent); | |||
| dialog.setContentView(R.layout.userguide_dialog); | |||
| parent.getResources().getText(R.string.menuUserGuide); | |||
| dialog.setTitle(parent.getResources().getText(R.string.menuUserGuide)); | |||
| ImageView image = (ImageView) dialog.findViewById(R.id.ug_imageAppIcon); | |||
| image.setImageResource(R.drawable.icon); | |||
| try { | |||
| PackageInfo ai = parent.getPackageManager().getPackageInfo("ch.spherIC", PackageManager.GET_CONFIGURATIONS); | |||
| System.out.println(ai.versionName); | |||
| } catch (NameNotFoundException e) { | |||
| // TODO Auto-generated catch block | |||
| e.printStackTrace(); | |||
| } | |||
| TextView text = (TextView) dialog.findViewById(R.id.ug_TextVersion); | |||
| text.setText(parent.getResources().getText(R.string.AppVersionLabel).toString() | |||
| + " " + parent.getPackageManager().getPackageInfo("ch.spherIC", PackageManager.GET_CONFIGURATIONS).versionName); | |||
| ((Button) dialog.findViewById(R.id.btn_ugClose)).setOnClickListener(new OnClickListener() { | |||
| @Override | |||
| public void onClick(View v) { | |||
| dialog.dismiss(); | |||
| } | |||
| }); | |||
| return dialog; | |||
| } | |||
| } | |||
| @@ -0,0 +1,105 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC.components; | |||
| import android.content.Context; | |||
| import android.content.res.TypedArray; | |||
| import android.graphics.Canvas; | |||
| import android.graphics.Paint; | |||
| import android.graphics.Rect; | |||
| import android.util.AttributeSet; | |||
| import android.widget.TextView; | |||
| import ch.spherIC.R; | |||
| /** | |||
| * DOCUMENT ME! | |||
| * | |||
| * @author $author$ | |||
| * @version $Revision$, $Date$ | |||
| */ | |||
| public class XTextView extends TextView { | |||
| private boolean drawborder; | |||
| private int drawborderColor; | |||
| private int drawborderWidth; | |||
| /** | |||
| * Creates a new XTextView object. | |||
| * | |||
| * @param context DOCUMENT ME! | |||
| */ | |||
| public XTextView(Context context) { | |||
| super(context); | |||
| } | |||
| /** | |||
| * Creates a new $class.name$ object. | |||
| * | |||
| * @param context DOCUMENT ME! | |||
| * @param attrs DOCUMENT ME! | |||
| * @param defStyle DOCUMENT ME! | |||
| */ | |||
| public XTextView(Context context, AttributeSet attrs, int defStyle) { | |||
| super(context, attrs, defStyle); | |||
| init(attrs); | |||
| } | |||
| /** | |||
| * Creates a new $class.name$ object. | |||
| * | |||
| * @param context DOCUMENT ME! | |||
| * @param attrs DOCUMENT ME! | |||
| */ | |||
| public XTextView(Context context, AttributeSet attrs) { | |||
| super(context, attrs); | |||
| init(attrs); | |||
| } | |||
| /** | |||
| * DOCUMENT ME! | |||
| * | |||
| * @param attrs DOCUMENT ME! | |||
| */ | |||
| private void init(AttributeSet attrs) { | |||
| TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.XTextView); | |||
| this.drawborder = a.getBoolean(R.styleable.XTextView_drawBorder, false); | |||
| this.drawborderColor = a.getColor(R.styleable.XTextView_drawBorderColor, 0xffff0000); | |||
| this.drawborderWidth = a.getDimensionPixelSize(R.styleable.XTextView_drawBorderWidth, 1); | |||
| } | |||
| /** | |||
| * @see android.widget.TextView#onDraw(android.graphics.Canvas) | |||
| */ | |||
| @Override | |||
| protected void onDraw(Canvas canvas) { | |||
| super.onDraw(canvas); | |||
| Rect rect = new Rect(); | |||
| Paint paint = new Paint(); | |||
| paint.setStyle(Paint.Style.STROKE); | |||
| paint.setColor(this.drawborderColor); | |||
| paint.setStrokeWidth(this.drawborderWidth); | |||
| getLocalVisibleRect(rect); | |||
| rect.inset(-this.drawborderWidth, -this.drawborderWidth); | |||
| canvas.drawRect(rect, paint); | |||
| } | |||
| } | |||
| @@ -0,0 +1,79 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <resources> | |||
| <string | |||
| name="app_name">Easy Bracketing</string> | |||
| <string | |||
| name="dynamic_range">Dynamic Range</string> | |||
| <string | |||
| name="shutter_speed">Shutter Speed</string> | |||
| <string | |||
| name="aperture">Aperture</string> | |||
| <string | |||
| name="ev">EV</string> | |||
| <string | |||
| name="dark_point">Dark Point Values</string> | |||
| <string | |||
| name="bright_point">Bright Point Values</string> | |||
| <string | |||
| name="calcParams">Calculation Parameters</string> | |||
| <string | |||
| name="delta_EV">Δ EV</string> | |||
| <string | |||
| name="expEVStep">EV Step</string> | |||
| <string | |||
| name="calculate">Calculate</string> | |||
| <string | |||
| name="reset">Reset</string> | |||
| <string | |||
| name="bracketingRes">Bracketing Exposures Values</string> | |||
| <string | |||
| name="expNbrLbl"># Exp.</string> | |||
| <string | |||
| name="toastWarningDP_BP">The delta between dark point EV and bright point EV is less or | |||
| equal to 0. Please correct the inputs.</string> | |||
| <string | |||
| name="menuUserGuide">User Guide</string> | |||
| <string | |||
| name="menuSettings">Settings...</string> | |||
| <string | |||
| name="menuAbout">About</string> | |||
| <string | |||
| name="about_Description">EasyBracketing allows you to easy calculate a serie of exposure | |||
| values according to initial dark and bright point values.</string> | |||
| <string | |||
| name="AppVersionLabel">Version:</string> | |||
| <string | |||
| name="about_DevelopedBy">Developed by spherIC (F. Smilari)\nMail to: | |||
| merlin868@hotmail.com\n\nTranslated by spherIC (F. Smilari)</string> | |||
| <string | |||
| name="Percent18Correction">18%-Gray Correction</string> | |||
| <string | |||
| name="Percent18CorrectionBP">Bright Pt. Value Correction (EV)</string> | |||
| <string | |||
| name="Percent18CorrectionDP">Dark Pt. Value Correction (EV)</string> | |||
| <string | |||
| name="FixRangePoint">Fixed EV Range Value</string> | |||
| <string | |||
| name="FixRangePointBP">Keep Bright Point Values fixed</string> | |||
| <string | |||
| name="FixRangePointDP">Keep Dark Point Value fixed</string> | |||
| <string | |||
| name="BtnSave">Save</string> | |||
| <string | |||
| name="BtnCancel">Cancel</string> | |||
| <string | |||
| name="userGuidePourpose">Text | |||
| </string> | |||
| <string | |||
| name="header_GeneralPurpose">1. General Purpose | |||
| </string> | |||
| <string | |||
| name="text_GeneralPurpose">1. General Purpose | |||
| </string> | |||
| <string | |||
| name="header_HowTo">2. How to use | |||
| </string> | |||
| <string | |||
| name="header_GeneralPurpose">1. General Purpose | |||
| </string> | |||
| </resources> | |||
| @@ -0,0 +1,82 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <resources> | |||
| <string | |||
| name="app_name">Easy Bracketing</string> | |||
| <string | |||
| name="dynamic_range">Dynamikbereich</string> | |||
| <string | |||
| name="shutter_speed">Belichtungszeit</string> | |||
| <string | |||
| name="aperture">Blende</string> | |||
| <string | |||
| name="ev">LW</string> | |||
| <string | |||
| name="dark_point">Werte Dunkelpunkt</string> | |||
| <string | |||
| name="bright_point">Werte Hellpunkt</string> | |||
| <string | |||
| name="calcParams">Berechnungsparameter</string> | |||
| <string | |||
| name="delta_EV">Δ LW</string> | |||
| <string | |||
| name="expEVStep">LW-Schritt</string> | |||
| <string | |||
| name="calculate">Berechnen</string> | |||
| <string | |||
| name="reset">Zurücksetzen</string> | |||
| <string | |||
| name="bracketingRes">Bracketing Belichtungswerte</string> | |||
| <string | |||
| name="expNbrLbl"># Bel.</string> | |||
| <string | |||
| name="toastWarningDP_BP">Das Delta zwischen dem LW des Dunkelpunkt und dem LW des Hellpunkt ist kleiner oder gleich 0. | |||
| \nBitte korrigieren Sie die Eingaben.</string> | |||
| <string | |||
| name="menuUserGuide">Benutzeranleitung</string> | |||
| <string | |||
| name="menuSettings">Einstellungen...</string> | |||
| <string | |||
| name="menuAbout">Info</string> | |||
| <string | |||
| name="about_Description"> | |||
| EasyBracketing dient zur schnellen und einfachen Berechnung einer Belichtungsserie ausgehend | |||
| von den Belichtungswerten eines Dunkelpunktes und eines Hellpunktes. | |||
| </string> | |||
| <string | |||
| name="AppVersionLabel">Version:</string> | |||
| <string | |||
| name="about_DevelopedBy">Entwickelt von spherIC (F. Smilari)\nMail an: | |||
| merlin868@hotmail.com\n\nÜbersetzt von spherIC (F. Smilari)</string> | |||
| <string | |||
| name="Percent18Correction">18%-Grauwertkorrektur</string> | |||
| <string | |||
| name="Percent18CorrectionBP">Hellpunktkorrektur (LW)</string> | |||
| <string | |||
| name="Percent18CorrectionDP">Dunkelpunktkorrektur (LW)</string> | |||
| <string | |||
| name="FixRangePoint">Ausgangspunkt für Belichtungsserie</string> | |||
| <string | |||
| name="FixRangePointBP">Von Hellpunktwerten ausgehen</string> | |||
| <string | |||
| name="FixRangePointDP">Von Dunkelpunktwerten ausgehen</string> | |||
| <string | |||
| name="BtnSave">Speichern</string> | |||
| <string | |||
| name="BtnCancel">Abbrechen</string> | |||
| <string | |||
| name="BtnClose">Schliessen</string> | |||
| <string | |||
| name="header_GeneralPurpose">1. Allgm. Verwendungszweck</string> | |||
| <string | |||
| name="text_GeneralPurpose"> | |||
| Beim Erstellen einer Belichtungsreihe für ein späteres HDR-Bild, stellt sich oftmals das Problem, | |||
| dass der Kontrastumfang zu gross ist um von der typischen "+2LW/0LW/-2LW"-Vorgehensweise abgedeckt zu werden. | |||
| Hier kommt EasyBracketing zum Zug. Ausgehend von gemessenen Werten für den hellsten Punkt resp. den dunkelsten Punkt | |||
| werden über definierbare Parameter alle notwendigen Belichtungen einer Belichtungsreihe berechnet. Diese können dann | |||
| an der Kamera sukzessive eingestellt und die Aufnahme ausgelöst werden. | |||
| </string> | |||
| <string | |||
| name="header_HowTo">2. Vorgehensweise</string> | |||
| <string | |||
| name="text_HowTo">Text here</string> | |||
| </resources> | |||
| @@ -0,0 +1,43 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <LinearLayout | |||
| xmlns:android="http://schemas.android.com/apk/res/android" | |||
| android:background="@drawable/bg_about" | |||
| android:padding="10dp" | |||
| android:layout_height="fill_parent" | |||
| android:layout_width="fill_parent" | |||
| android:orientation="vertical"> | |||
| <LinearLayout | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:orientation="horizontal" | |||
| android:id="@+id/layout_ugVersion"> | |||
| <ImageView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginRight="20dip" | |||
| android:id="@+id/ug_imageAppIcon" | |||
| android:layout_gravity="center_vertical" /> | |||
| <TextView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:textColor="#FF000000" | |||
| android:text="iii" | |||
| android:id="@+id/ug_TextVersion" | |||
| android:textStyle="bold" | |||
| android:layout_gravity="center_vertical" | |||
| android:gravity="center_vertical" /> | |||
| </LinearLayout> | |||
| <ScrollView android:id="@+id/ug_ScrollView" android:layout_height="wrap_content" android:layout_width="wrap_content"><LinearLayout android:orientation="vertical" android:layout_height="wrap_content" android:layout_width="wrap_content"> | |||
| <TextView android:layout_width="wrap_content" android:id="@+id/ug_Text" android:text="@string/userGuidePourpose" android:textColor="@color/black" android:layout_height="wrap_content"> | |||
| </TextView></LinearLayout></ScrollView><Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/btn_fs" android:id="@+id/btn_ugClose" android:text="Close" android:textColor="@color/white" android:layout_gravity="center_horizontal"> | |||
| </Button> | |||
| </LinearLayout> | |||
| @@ -0,0 +1,161 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC; | |||
| import android.app.Activity; | |||
| import android.app.Dialog; | |||
| import android.content.pm.PackageManager; | |||
| import android.content.pm.PackageManager.NameNotFoundException; | |||
| import android.view.View; | |||
| import android.view.View.OnClickListener; | |||
| import android.widget.Button; | |||
| import android.widget.ImageView; | |||
| import android.widget.TextView; | |||
| import ch.spherIC.settings.SettingsDlg; | |||
| /** | |||
| * Dialog factory class. | |||
| */ | |||
| public final class DialogFactory { | |||
| /** | |||
| * Static main method to initialize classes | |||
| * | |||
| * @param dlgCode Code of dialog to instantiate. See {@link EasyBracketMain} | |||
| * @param parent Parent {@link Activity} | |||
| * | |||
| * @return Instantiated dialog | |||
| */ | |||
| public static Dialog createDialog(int dlgCode, Activity parent) { | |||
| Dialog dlg; | |||
| switch (dlgCode) { | |||
| case EasyBracketMain.ABOUT_DLG: | |||
| dlg = createAboutDialog(parent); | |||
| break; | |||
| case EasyBracketMain.SETTINGS_DLG: | |||
| dlg = createSettingsDialog(parent); | |||
| break; | |||
| case EasyBracketMain.USERGUIDE_DLG: | |||
| dlg = createUserGuideDialog(parent); | |||
| break; | |||
| default: | |||
| dlg = null; | |||
| break; | |||
| } | |||
| return dlg; | |||
| } | |||
| /** | |||
| * Creates the About Dialog | |||
| */ | |||
| private static Dialog createAboutDialog(Activity parent) { | |||
| String versionName = ""; | |||
| final Dialog dialog = new Dialog(parent); | |||
| dialog.setContentView(R.layout.about_dialog); | |||
| parent.getResources().getText(R.string.menuAbout); | |||
| dialog.setTitle(parent.getResources().getText(R.string.menuAbout) + " EasyBracketing..."); | |||
| try { | |||
| versionName = parent.getPackageManager().getPackageInfo("ch.spherIC", PackageManager.GET_CONFIGURATIONS) | |||
| .versionName; | |||
| } catch (NameNotFoundException e) { | |||
| versionName = "-"; | |||
| } | |||
| ImageView image = (ImageView) dialog.findViewById(R.id.about_imageAppIcon); | |||
| image.setImageResource(R.drawable.icon); | |||
| TextView text = (TextView) dialog.findViewById(R.id.about_TextDescription); | |||
| text.setText(parent.getResources().getText(R.string.about_Description)); | |||
| text = (TextView) dialog.findViewById(R.id.about_TextVersion); | |||
| text.setText(parent.getResources().getText(R.string.AppVersionLabel).toString() | |||
| + " " + parent.getResources().getText(R.string.AppVersion).toString()); | |||
| text = (TextView) dialog.findViewById(R.id.about_TextAutor); | |||
| text.setText(parent.getResources().getText(R.string.about_DevelopedBy).toString()); | |||
| ((Button) dialog.findViewById(R.id.btn_AboutClose)).setOnClickListener(new OnClickListener() { | |||
| @Override | |||
| public void onClick(View v) { | |||
| dialog.dismiss(); | |||
| } | |||
| }); | |||
| return dialog; | |||
| } | |||
| /** | |||
| * Creates the Settings Dialog | |||
| */ | |||
| private static Dialog createSettingsDialog(Activity parent) { | |||
| final Dialog dialog = new SettingsDlg(parent); | |||
| return dialog; | |||
| } | |||
| /** | |||
| * Creates the User Guide Dialog | |||
| */ | |||
| private static Dialog createUserGuideDialog(Activity parent) { | |||
| String versionName = ""; | |||
| final Dialog dialog = new Dialog(parent); | |||
| dialog.setContentView(R.layout.userguide_dialog); | |||
| parent.getResources().getText(R.string.menuUserGuide); | |||
| dialog.setTitle(parent.getResources().getText(R.string.menuUserGuide)); | |||
| try { | |||
| versionName = parent.getPackageManager().getPackageInfo("ch.spherIC", PackageManager.GET_CONFIGURATIONS) | |||
| .versionName; | |||
| } catch (NameNotFoundException e) { | |||
| versionName = "-"; | |||
| } | |||
| ImageView image = (ImageView) dialog.findViewById(R.id.ug_imageAppIcon); | |||
| image.setImageResource(R.drawable.icon); | |||
| TextView text = (TextView) dialog.findViewById(R.id.ug_TextVersion); | |||
| text.setText(parent.getResources().getText(R.string.AppVersionLabel).toString() + " " + versionName); | |||
| ((Button) dialog.findViewById(R.id.btn_ugClose)).setOnClickListener(new OnClickListener() { | |||
| @Override | |||
| public void onClick(View v) { | |||
| dialog.dismiss(); | |||
| } | |||
| }); | |||
| return dialog; | |||
| } | |||
| } | |||
| @@ -0,0 +1,152 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC; | |||
| import android.app.Activity; | |||
| import android.app.Dialog; | |||
| import android.content.pm.PackageManager; | |||
| import android.content.pm.PackageManager.NameNotFoundException; | |||
| import android.view.View; | |||
| import android.view.View.OnClickListener; | |||
| import android.widget.Button; | |||
| import android.widget.ImageView; | |||
| import android.widget.TextView; | |||
| import ch.spherIC.settings.SettingsDlg; | |||
| /** | |||
| * Dialog factory class. | |||
| */ | |||
| public final class DialogFactory { | |||
| /** | |||
| * Static main method to initialize classes | |||
| * | |||
| * @param dlgCode Code of dialog to instantiate. See {@link EasyBracketMain} | |||
| * @param parent Parent {@link Activity} | |||
| * | |||
| * @return Instantiated dialog | |||
| */ | |||
| public static Dialog createDialog(int dlgCode, Activity parent) { | |||
| Dialog dlg; | |||
| switch (dlgCode) { | |||
| case EasyBracketMain.ABOUT_DLG: | |||
| dlg = createAboutDialog(parent); | |||
| break; | |||
| case EasyBracketMain.SETTINGS_DLG: | |||
| dlg = createSettingsDialog(parent); | |||
| break; | |||
| case EasyBracketMain.USERGUIDE_DLG: | |||
| dlg = createUserGuideDialog(parent); | |||
| break; | |||
| default: | |||
| dlg = null; | |||
| break; | |||
| } | |||
| return dlg; | |||
| } | |||
| /** | |||
| * Creates the About Dialog | |||
| */ | |||
| private static Dialog createAboutDialog(Activity parent) { | |||
| final Dialog dialog = new Dialog(parent); | |||
| dialog.setContentView(R.layout.about_dialog); | |||
| parent.getResources().getText(R.string.menuAbout); | |||
| dialog.setTitle(parent.getResources().getText(R.string.menuAbout) + " EasyBracketing..."); | |||
| ImageView image = (ImageView) dialog.findViewById(R.id.about_imageAppIcon); | |||
| image.setImageResource(R.drawable.icon); | |||
| TextView text = (TextView) dialog.findViewById(R.id.about_TextDescription); | |||
| text.setText(parent.getResources().getText(R.string.about_Description)); | |||
| text = (TextView) dialog.findViewById(R.id.about_TextVersion); | |||
| text.setText(parent.getResources().getText(R.string.AppVersionLabel).toString() | |||
| + " " + parent.getResources().getText(R.string.AppVersion).toString()); | |||
| text = (TextView) dialog.findViewById(R.id.about_TextAutor); | |||
| text.setText(parent.getResources().getText(R.string.about_DevelopedBy).toString()); | |||
| ((Button) dialog.findViewById(R.id.btn_AboutClose)).setOnClickListener(new OnClickListener() { | |||
| @Override | |||
| public void onClick(View v) { | |||
| dialog.dismiss(); | |||
| } | |||
| }); | |||
| return dialog; | |||
| } | |||
| /** | |||
| * Creates the Settings Dialog | |||
| */ | |||
| private static Dialog createSettingsDialog(Activity parent) { | |||
| final Dialog dialog = new SettingsDlg(parent); | |||
| return dialog; | |||
| } | |||
| /** | |||
| * Creates the User Guide Dialog | |||
| */ | |||
| private static Dialog createUserGuideDialog(Activity parent) { | |||
| String versionName = ""; | |||
| final Dialog dialog = new Dialog(parent); | |||
| dialog.setContentView(R.layout.userguide_dialog); | |||
| parent.getResources().getText(R.string.menuUserGuide); | |||
| dialog.setTitle(parent.getResources().getText(R.string.menuUserGuide)); | |||
| ImageView image = (ImageView) dialog.findViewById(R.id.ug_imageAppIcon); | |||
| image.setImageResource(R.drawable.icon); | |||
| try { | |||
| versionName = parent.getPackageManager().getPackageInfo("ch.spherIC", PackageManager.GET_CONFIGURATIONS) | |||
| .versionName; | |||
| } catch (NameNotFoundException e) { | |||
| versionName = "-"; | |||
| } | |||
| TextView text = (TextView) dialog.findViewById(R.id.ug_TextVersion); | |||
| text.setText(parent.getResources().getText(R.string.AppVersionLabel).toString()+ " " + versionName); | |||
| ((Button) dialog.findViewById(R.id.btn_ugClose)).setOnClickListener(new OnClickListener() { | |||
| @Override | |||
| public void onClick(View v) { | |||
| dialog.dismiss(); | |||
| } | |||
| }); | |||
| return dialog; | |||
| } | |||
| } | |||
| @@ -0,0 +1,82 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <LinearLayout | |||
| xmlns:android="http://schemas.android.com/apk/res/android" | |||
| android:background="@drawable/bg_about" | |||
| android:padding="10dp" | |||
| android:layout_height="fill_parent" | |||
| android:layout_width="fill_parent" | |||
| android:orientation="vertical"> | |||
| <LinearLayout | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:orientation="horizontal" | |||
| android:id="@+id/layout_ugVersion"> | |||
| <ImageView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginRight="20dip" | |||
| android:id="@+id/ug_imageAppIcon" | |||
| android:layout_gravity="center_vertical" /> | |||
| <TextView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:textColor="#FF000000" | |||
| android:text="iii" | |||
| android:id="@+id/ug_TextVersion" | |||
| android:textStyle="bold" | |||
| android:layout_gravity="center_vertical" | |||
| android:gravity="center_vertical" /> | |||
| </LinearLayout> | |||
| <ScrollView | |||
| android:id="@+id/ug_ScrollView" | |||
| android:layout_width="wrap_content" | |||
| android:addStatesFromChildren="true" | |||
| android:layout_height="250dp"> | |||
| <LinearLayout | |||
| android:orientation="vertical" | |||
| android:layout_height="wrap_content" | |||
| android:layout_width="wrap_content"> | |||
| <TextView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:id="@+id/ug_hdr_GenPourpose" | |||
| android:textColor="@color/black" | |||
| android:textStyle="bold" | |||
| android:layout_marginBottom="5dp" | |||
| android:layout_marginTop="5dp" | |||
| android:text="@string/header_GeneralPurpose"></TextView> | |||
| <TextView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:id="@+id/ug_txt_GenPourpose" | |||
| android:textColor="@color/black" | |||
| android:text="@string/text_GeneralPurpose"> | |||
| </TextView> | |||
| <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/ug_hdr_HowTo" android:textColor="@color/black" android:textStyle="bold" android:layout_marginBottom="5dp" android:layout_marginTop="5dp" android:text="@string/header_HowTo"></TextView> | |||
| <TextView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:id="@+id/ug_txt_HowTo" | |||
| android:textColor="@color/black" | |||
| android:text="@string/text_HowTo"></TextView> | |||
| </LinearLayout> | |||
| </ScrollView> | |||
| <Button | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:background="@drawable/btn_fs" | |||
| android:id="@+id/btn_ugClose" | |||
| android:text="Close" | |||
| android:textColor="@color/white" | |||
| android:layout_gravity="center_horizontal" | |||
| android:layout_marginTop="20dp"> | |||
| </Button> | |||
| </LinearLayout> | |||
| @@ -0,0 +1,247 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC.resultlist; | |||
| import java.util.List; | |||
| import android.app.Activity; | |||
| import android.content.Context; | |||
| import android.util.DisplayMetrics; | |||
| import android.view.Gravity; | |||
| import android.view.View; | |||
| import android.view.ViewGroup; | |||
| import android.widget.BaseAdapter; | |||
| import android.widget.ImageView; | |||
| import android.widget.LinearLayout; | |||
| import android.widget.TextView; | |||
| import android.widget.LinearLayout.LayoutParams; | |||
| import ch.spherIC.R; | |||
| /** | |||
| * Exposure adapter view class. | |||
| */ | |||
| class ExposureAdapterView extends LinearLayout { | |||
| /** | |||
| * Creates a new ExposureAdapterView object. | |||
| * | |||
| * @param context DOCUMENT ME! | |||
| * @param weather DOCUMENT ME! | |||
| */ | |||
| public ExposureAdapterView(Context context, Exposure exposure) { | |||
| super(context); | |||
| this.setOrientation(HORIZONTAL); | |||
| DisplayMetrics metrics = new DisplayMetrics(); | |||
| ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(metrics); | |||
| // Nbr | |||
| TextView nbrControl = new TextView(context); | |||
| LinearLayout.LayoutParams nbrParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| nbrParams.setMargins(3, 1, 1, 1); | |||
| nbrControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| nbrControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| nbrControl.setText(Integer.toString(exposure.getNbr())); | |||
| addView(nbrControl, nbrParams); | |||
| // Aperture | |||
| TextView apertureControl = new TextView(context); | |||
| LinearLayout.LayoutParams apertureParams = new LinearLayout.LayoutParams(100, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| apertureParams.setMargins(1, 1, 1, 1); | |||
| apertureControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| apertureControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| apertureControl.setText(exposure.getAperture()); | |||
| addView(apertureControl, apertureParams); | |||
| // Shutter speed | |||
| TextView shutterControl = new TextView(context); | |||
| LinearLayout.LayoutParams shutterParams = new LinearLayout.LayoutParams(170, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| shutterParams.setMargins(1, 1, 1, 1); | |||
| shutterControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| shutterControl.setTextAppearance(context, R.style.ResultExposureTextSpecial); | |||
| shutterControl.setText(exposure.getShutterSpeed()); | |||
| addView(shutterControl, shutterParams); | |||
| // EV Step | |||
| TextView evStepControl = new TextView(context); | |||
| LinearLayout.LayoutParams evStepParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| evStepParams.setMargins(1, 1, 1, 1); | |||
| evStepControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| evStepControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| evStepControl.setText(exposure.getEvStepAsString()); | |||
| addView(evStepControl, evStepParams); | |||
| // Icon | |||
| ImageView expIconControl = new ImageView(context); | |||
| LinearLayout.LayoutParams expIconParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| expIconParams.setMargins(1, 1, 1, 1); | |||
| expIconControl.setImageBitmap(exposure.getEvStepBtmp()); | |||
| addView(expIconControl, expIconParams); | |||
| } | |||
| } | |||
| /** | |||
| * Exposure results adapter. | |||
| */ | |||
| public class ExposureAdapter extends BaseAdapter { | |||
| private static DisplayMetrics metrics; | |||
| private Context context; | |||
| private List<Exposure> exposureList; | |||
| /** | |||
| * Creates a new ExposureAdapter object. | |||
| */ | |||
| public ExposureAdapter(Context context, List<Exposure> expList) { | |||
| this.context = context; | |||
| this.exposureList = expList; | |||
| } | |||
| /** | |||
| * Retrieves list size. | |||
| * | |||
| * @return list size | |||
| */ | |||
| @Override | |||
| public int getCount() { | |||
| return this.exposureList.size(); | |||
| } | |||
| /** | |||
| * Retrieves the exposure at index <code>position</code>. | |||
| * | |||
| * @param position Index in list | |||
| * | |||
| * @return Exposure at index <code>position</code> | |||
| */ | |||
| @Override | |||
| public Object getItem(int position) { | |||
| return this.exposureList.get(position); | |||
| } | |||
| /** | |||
| * Retrieves the number of the exposure at index <code>position</code>. | |||
| * | |||
| * @param position Index in list | |||
| * | |||
| * @return the number of the exposure at index <code>position</code> | |||
| */ | |||
| @Override | |||
| public long getItemId(int position) { | |||
| //return this.exposureList.get(position).getNbr(); | |||
| return position; | |||
| } | |||
| /** | |||
| * Retrieves a view representing a single result row. | |||
| * | |||
| * @param position Index in list | |||
| * @param convertView view | |||
| * @param parent parent | |||
| * | |||
| * @return {@link ExposureAdapterView} | |||
| */ | |||
| @Override | |||
| public View getView(int position, View convertView, ViewGroup parent) { | |||
| Exposure exposure = this.exposureList.get(position); | |||
| return new ExposureAdapterView(this.context, exposure); | |||
| } | |||
| /** | |||
| * Retrieves the value of | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| public static View getHeaderView(Context context, LinearLayout headerLL) { | |||
| int black = headerLL.getResources().getColor(R.color.black); | |||
| int width = getMetrics(context).widthPixels; | |||
| // Nbr | |||
| TextView nbrControl = new TextView(context); | |||
| LinearLayout.LayoutParams nbrParams = new LinearLayout.LayoutParams(Math.round(0.14583f * width), | |||
| LayoutParams.WRAP_CONTENT, 0.2f); | |||
| nbrParams.setMargins(3, 1, 1, 1); | |||
| nbrControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| nbrControl.setTextSize(13f); | |||
| nbrControl.setTextColor(black); | |||
| nbrControl.setText(R.string.expNbrLbl); | |||
| headerLL.addView(nbrControl, nbrParams); | |||
| // Aperture | |||
| TextView apertureControl = new TextView(context); | |||
| LinearLayout.LayoutParams apertureParams = new LinearLayout.LayoutParams(Math.round(0.20833f * width), | |||
| LayoutParams.WRAP_CONTENT, 0.2f); | |||
| apertureParams.setMargins(1, 1, 1, 1); | |||
| apertureControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| apertureControl.setTextSize(13f); | |||
| apertureControl.setTextColor(black); | |||
| apertureControl.setText(R.string.aperture); | |||
| headerLL.addView(apertureControl, apertureParams); | |||
| // Shutter speed | |||
| TextView shutterControl = new TextView(context); | |||
| LinearLayout.LayoutParams shutterParams = new LinearLayout.LayoutParams(Math.round(0.35417f * width), | |||
| LayoutParams.WRAP_CONTENT, 0.2f); | |||
| shutterParams.setMargins(1, 1, 1, 1); | |||
| shutterControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| shutterControl.setTextSize(13f); | |||
| shutterControl.setTextColor(black); | |||
| shutterControl.setText(R.string.shutter_speed); | |||
| headerLL.addView(shutterControl, shutterParams); | |||
| // EV Step | |||
| TextView evStepControl = new TextView(context); | |||
| LinearLayout.LayoutParams evStepParams = new LinearLayout.LayoutParams(Math.round(0.14583f * width), | |||
| LayoutParams.WRAP_CONTENT, 0.2f); | |||
| evStepParams.setMargins(1, 1, 1, 1); | |||
| evStepControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| evStepControl.setTextSize(13f); | |||
| evStepControl.setTextColor(black); | |||
| evStepControl.setText(R.string.expEVStep); | |||
| headerLL.addView(evStepControl, evStepParams); | |||
| // Icon | |||
| ImageView expIconControl = new ImageView(context); | |||
| LinearLayout.LayoutParams expIconParams = new LinearLayout.LayoutParams(Math.round(0.14583f * width), | |||
| LayoutParams.WRAP_CONTENT, 0.2f); | |||
| expIconParams.setMargins(1, 1, 1, 1); | |||
| headerLL.addView(expIconControl, expIconParams); | |||
| return headerLL; | |||
| } | |||
| /** | |||
| * Retrieves the value of | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| private static DisplayMetrics getMetrics(Context context) { | |||
| if (metrics == null) { | |||
| metrics = new DisplayMetrics(); | |||
| ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(metrics); | |||
| } | |||
| return metrics; | |||
| } | |||
| } | |||
| @@ -0,0 +1,83 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <resources> | |||
| <string | |||
| name="app_name">Easy Bracketing</string> | |||
| <string | |||
| name="dynamic_range">Dynamikbereich</string> | |||
| <string | |||
| name="shutter_speed">Belichtungszeit</string> | |||
| <string | |||
| name="aperture">Blende</string> | |||
| <string | |||
| name="ev">LW</string> | |||
| <string | |||
| name="dark_point">Werte Dunkelpunkt</string> | |||
| <string | |||
| name="bright_point">Werte Hellpunkt</string> | |||
| <string | |||
| name="calcParams">Berechnungsparameter</string> | |||
| <string | |||
| name="delta_EV">Δ LW</string> | |||
| <string | |||
| name="expEVStep">LW-Schritt</string> | |||
| <string | |||
| name="calculate">Berechnen</string> | |||
| <string | |||
| name="reset">Zurücksetzen</string> | |||
| <string | |||
| name="bracketingRes">Bracketing Belichtungswerte</string> | |||
| <string | |||
| name="expNbrLbl"># Bel.</string> | |||
| <string | |||
| name="toastWarningDP_BP">Das Delta zwischen dem LW des Dunkelpunkt und dem LW des Hellpunkt ist kleiner oder gleich 0. | |||
| \nBitte korrigieren Sie die Eingaben.</string> | |||
| <string | |||
| name="menuUserGuide">Benutzeranleitung</string> | |||
| <string | |||
| name="menuSettings">Einstellungen...</string> | |||
| <string | |||
| name="menuAbout">Info</string> | |||
| <string | |||
| name="about_Description"> | |||
| EasyBracketing dient zur schnellen und einfachen Berechnung einer Belichtungsserie ausgehend | |||
| von den Belichtungswerten eines Dunkelpunktes und eines Hellpunktes. | |||
| </string> | |||
| <string | |||
| name="AppVersionLabel">Version:</string> | |||
| <string | |||
| name="about_DevelopedBy">Entwickelt von spherIC (F. Smilari)\nMail an: | |||
| merlin868@hotmail.com\n\nÜbersetzt von spherIC (F. Smilari)</string> | |||
| <string | |||
| name="Percent18Correction">18%-Grauwertkorrektur</string> | |||
| <string | |||
| name="Percent18CorrectionBP">Hellpunktkorrektur (LW)</string> | |||
| <string | |||
| name="Percent18CorrectionDP">Dunkelpunktkorrektur (LW)</string> | |||
| <string | |||
| name="FixRangePoint">Ausgangspunkt für Belichtungsserie</string> | |||
| <string | |||
| name="FixRangePointBP">Von Hellpunktwerten ausgehen</string> | |||
| <string | |||
| name="FixRangePointDP">Von Dunkelpunktwerten ausgehen</string> | |||
| <string | |||
| name="BtnSave">Speichern</string> | |||
| <string | |||
| name="BtnCancel">Abbrechen</string> | |||
| <string | |||
| name="BtnClose">Schliessen</string> | |||
| <string | |||
| name="header_GeneralPurpose">1. Allgm. Verwendungszweck</string> | |||
| <string | |||
| name="text_GeneralPurpose"> | |||
| Beim Erstellen einer Belichtungsreihe für ein späteres HDR-Bild, stellt sich oftmals das Problem, | |||
| dass der Kontrastumfang zu gross ist um von der typischen \"+2LW/0LW/-2LW\"-Vorgehensweise abgedeckt zu werden.\n | |||
| Hier kommt EasyBracketing zum Zug.\n\r | |||
| Ausgehend von gemessenen Werten für den hellsten Punkt resp. den dunkelsten Punkt | |||
| werden über definierbare Parameter alle notwendigen Belichtungen einer Belichtungsreihe berechnet. Diese können dann | |||
| an der Kamera sukzessive eingestellt und die Aufnahme ausgelöst werden. | |||
| </string> | |||
| <string | |||
| name="header_HowTo">2. Vorgehensweise</string> | |||
| <string | |||
| name="text_HowTo">Text here</string> | |||
| </resources> | |||
| @@ -0,0 +1,240 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC.resultlist; | |||
| import java.util.List; | |||
| import android.app.Activity; | |||
| import android.content.Context; | |||
| import android.util.DisplayMetrics; | |||
| import android.view.Gravity; | |||
| import android.view.View; | |||
| import android.view.ViewGroup; | |||
| import android.widget.BaseAdapter; | |||
| import android.widget.ImageView; | |||
| import android.widget.LinearLayout; | |||
| import android.widget.TextView; | |||
| import android.widget.LinearLayout.LayoutParams; | |||
| import ch.spherIC.R; | |||
| /** | |||
| * Exposure adapter view class. | |||
| */ | |||
| class ExposureAdapterView extends LinearLayout { | |||
| private static DisplayMetrics metrics; | |||
| /** | |||
| * Creates a new ExposureAdapterView object. | |||
| * | |||
| * @param context DOCUMENT ME! | |||
| * @param weather DOCUMENT ME! | |||
| */ | |||
| public ExposureAdapterView(Context context, Exposure exposure, int nbrExposures) { | |||
| super(context); | |||
| this.setOrientation(HORIZONTAL); | |||
| // Nbr | |||
| TextView nbrControl = new TextView(context); | |||
| LinearLayout.LayoutParams nbrParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| nbrParams.setMargins(3, 1, 1, 1); | |||
| nbrControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| nbrControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| nbrControl.setText(Integer.toString(exposure.getNbr())); | |||
| addView(nbrControl, nbrParams); | |||
| // Aperture | |||
| TextView apertureControl = new TextView(context); | |||
| LinearLayout.LayoutParams apertureParams = new LinearLayout.LayoutParams(100, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| apertureParams.setMargins(1, 1, 1, 1); | |||
| apertureControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| apertureControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| apertureControl.setText(exposure.getAperture()); | |||
| addView(apertureControl, apertureParams); | |||
| // Shutter speed | |||
| TextView shutterControl = new TextView(context); | |||
| LinearLayout.LayoutParams shutterParams = new LinearLayout.LayoutParams(170, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| shutterParams.setMargins(1, 1, 1, 1); | |||
| shutterControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| shutterControl.setTextAppearance(context, R.style.ResultExposureTextSpecial); | |||
| shutterControl.setText(exposure.getShutterSpeed()); | |||
| addView(shutterControl, shutterParams); | |||
| // EV Step | |||
| TextView evStepControl = new TextView(context); | |||
| LinearLayout.LayoutParams evStepParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| evStepParams.setMargins(1, 1, 1, 1); | |||
| evStepControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| evStepControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| evStepControl.setText(exposure.getEvStepAsString()); | |||
| addView(evStepControl, evStepParams); | |||
| // Icon | |||
| ImageView expIconControl = new ImageView(context); | |||
| LinearLayout.LayoutParams expIconParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| expIconParams.setMargins(1, 1, 1, 1); | |||
| expIconControl.setImageBitmap(exposure.getEvStepBtmp()); | |||
| addView(expIconControl, expIconParams); | |||
| } | |||
| } | |||
| /** | |||
| * Exposure results adapter. | |||
| */ | |||
| public class ExposureAdapter extends BaseAdapter { | |||
| private static DisplayMetrics metrics; | |||
| private Context context; | |||
| private List<Exposure> exposureList; | |||
| /** | |||
| * Creates a new ExposureAdapter object. | |||
| */ | |||
| public ExposureAdapter(Context context, List<Exposure> expList) { | |||
| this.context = context; | |||
| this.exposureList = expList; | |||
| } | |||
| /** | |||
| * Retrieves list size. | |||
| * | |||
| * @return list size | |||
| */ | |||
| @Override | |||
| public int getCount() { | |||
| return this.exposureList.size(); | |||
| } | |||
| /** | |||
| * Retrieves the exposure at index <code>position</code>. | |||
| * | |||
| * @param position Index in list | |||
| * | |||
| * @return Exposure at index <code>position</code> | |||
| */ | |||
| @Override | |||
| public Object getItem(int position) { | |||
| return this.exposureList.get(position); | |||
| } | |||
| /** | |||
| * Retrieves the number of the exposure at index <code>position</code>. | |||
| * | |||
| * @param position Index in list | |||
| * | |||
| * @return the number of the exposure at index <code>position</code> | |||
| */ | |||
| @Override | |||
| public long getItemId(int position) { | |||
| //return this.exposureList.get(position).getNbr(); | |||
| return position; | |||
| } | |||
| /** | |||
| * Retrieves a view representing a single result row. | |||
| * | |||
| * @param position Index in list | |||
| * @param convertView view | |||
| * @param parent parent | |||
| * | |||
| * @return {@link ExposureAdapterView} | |||
| */ | |||
| @Override | |||
| public View getView(int position, View convertView, ViewGroup parent) { | |||
| Exposure exposure = this.exposureList.get(position); | |||
| return new ExposureAdapterView(this.context, exposure, this.exposureList.size()); | |||
| } | |||
| /** | |||
| * Retrieves the value of | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| public static View getHeaderView(Context context, LinearLayout headerLL) { | |||
| int black = headerLL.getResources().getColor(R.color.black); | |||
| // Nbr | |||
| TextView nbrControl = new TextView(context); | |||
| LinearLayout.LayoutParams nbrParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| nbrParams.setMargins(3, 1, 1, 1); | |||
| nbrControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| nbrControl.setTextSize(13f); | |||
| nbrControl.setTextColor(black); | |||
| nbrControl.setText(R.string.expNbrLbl); | |||
| headerLL.addView(nbrControl, nbrParams); | |||
| // Aperture | |||
| TextView apertureControl = new TextView(context); | |||
| LinearLayout.LayoutParams apertureParams = new LinearLayout.LayoutParams(100, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| apertureParams.setMargins(1, 1, 1, 1); | |||
| apertureControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| apertureControl.setTextSize(13f); | |||
| apertureControl.setTextColor(black); | |||
| apertureControl.setText(R.string.aperture); | |||
| headerLL.addView(apertureControl, apertureParams); | |||
| // Shutter speed | |||
| TextView shutterControl = new TextView(context); | |||
| LinearLayout.LayoutParams shutterParams = new LinearLayout.LayoutParams(170, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| shutterParams.setMargins(1, 1, 1, 1); | |||
| shutterControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| shutterControl.setTextSize(13f); | |||
| shutterControl.setTextColor(black); | |||
| shutterControl.setText(R.string.shutter_speed); | |||
| headerLL.addView(shutterControl, shutterParams); | |||
| // EV Step | |||
| TextView evStepControl = new TextView(context); | |||
| LinearLayout.LayoutParams evStepParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| evStepParams.setMargins(1, 1, 1, 1); | |||
| evStepControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| evStepControl.setTextSize(13f); | |||
| evStepControl.setTextColor(black); | |||
| evStepControl.setText(R.string.expEVStep); | |||
| headerLL.addView(evStepControl, evStepParams); | |||
| // Icon | |||
| ImageView expIconControl = new ImageView(context); | |||
| LinearLayout.LayoutParams expIconParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| expIconParams.setMargins(1, 1, 1, 1); | |||
| headerLL.addView(expIconControl, expIconParams); | |||
| return headerLL; | |||
| } | |||
| /** | |||
| * Retrieves the value of | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| private static DisplayMetrics getMetrics() { | |||
| if (metrics == null) { | |||
| metrics = new DisplayMetrics(); | |||
| } | |||
| return metrics; | |||
| } | |||
| } | |||
| @@ -0,0 +1,52 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <LinearLayout | |||
| xmlns:android="http://schemas.android.com/apk/res/android" | |||
| android:background="@drawable/bg_about" | |||
| android:padding="10dp" | |||
| android:layout_height="fill_parent" | |||
| android:layout_width="fill_parent" | |||
| android:orientation="vertical"> | |||
| <LinearLayout | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:orientation="horizontal" | |||
| android:id="@+id/layout_ugVersion"> | |||
| <ImageView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginRight="20dip" | |||
| android:id="@+id/ug_imageAppIcon" | |||
| android:layout_gravity="center_vertical" /> | |||
| <TextView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:textColor="#FF000000" | |||
| android:text="iii" | |||
| android:id="@+id/ug_TextVersion" | |||
| android:textStyle="bold" | |||
| android:layout_gravity="center_vertical" | |||
| android:gravity="center_vertical" /> | |||
| </LinearLayout> | |||
| <LinearLayout> | |||
| <TextView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" android:id="@+id/ug_Text" android:ellipsize="none" android:text="@string/AppVersion"> | |||
| </TextView> | |||
| </LinearLayout> | |||
| <Button | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:background="@drawable/btn_fs" | |||
| android:id="@+id/btn_ugClose" | |||
| android:text="Close" | |||
| android:textColor="@color/white" | |||
| android:layout_gravity="center_horizontal"> | |||
| </Button> | |||
| </LinearLayout> | |||
| @@ -0,0 +1,152 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC; | |||
| import android.app.Activity; | |||
| import android.app.Dialog; | |||
| import android.content.pm.PackageManager; | |||
| import android.content.pm.PackageManager.NameNotFoundException; | |||
| import android.view.View; | |||
| import android.view.View.OnClickListener; | |||
| import android.widget.Button; | |||
| import android.widget.ImageView; | |||
| import android.widget.TextView; | |||
| import ch.spherIC.settings.SettingsDlg; | |||
| /** | |||
| * Dialog factory class. | |||
| */ | |||
| public final class DialogFactory { | |||
| /** | |||
| * Static main method to initialize classes | |||
| * | |||
| * @param dlgCode Code of dialog to instantiate. See {@link EasyBracketMain} | |||
| * @param parent Parent {@link Activity} | |||
| * | |||
| * @return Instantiated dialog | |||
| */ | |||
| public static Dialog createDialog(int dlgCode, Activity parent) { | |||
| Dialog dlg; | |||
| switch (dlgCode) { | |||
| case EasyBracketMain.ABOUT_DLG: | |||
| dlg = createAboutDialog(parent); | |||
| break; | |||
| case EasyBracketMain.SETTINGS_DLG: | |||
| dlg = createSettingsDialog(parent); | |||
| break; | |||
| case EasyBracketMain.USERGUIDE_DLG: | |||
| dlg = createUserGuideDialog(parent); | |||
| break; | |||
| default: | |||
| dlg = null; | |||
| break; | |||
| } | |||
| return dlg; | |||
| } | |||
| /** | |||
| * Creates the About Dialog | |||
| */ | |||
| private static Dialog createAboutDialog(Activity parent) { | |||
| final Dialog dialog = new Dialog(parent); | |||
| dialog.setContentView(R.layout.about_dialog); | |||
| parent.getResources().getText(R.string.menuAbout); | |||
| dialog.setTitle(parent.getResources().getText(R.string.menuAbout) + " EasyBracketing..."); | |||
| ImageView image = (ImageView) dialog.findViewById(R.id.about_imageAppIcon); | |||
| image.setImageResource(R.drawable.icon); | |||
| TextView text = (TextView) dialog.findViewById(R.id.about_TextDescription); | |||
| text.setText(parent.getResources().getText(R.string.about_Description)); | |||
| text = (TextView) dialog.findViewById(R.id.about_TextVersion); | |||
| text.setText(parent.getResources().getText(R.string.AppVersionLabel).toString() | |||
| + " " + parent.getResources().getText(R.string.AppVersion).toString()); | |||
| text = (TextView) dialog.findViewById(R.id.about_TextAutor); | |||
| text.setText(parent.getResources().getText(R.string.about_DevelopedBy).toString()); | |||
| ((Button) dialog.findViewById(R.id.btn_AboutClose)).setOnClickListener(new OnClickListener() { | |||
| @Override | |||
| public void onClick(View v) { | |||
| dialog.dismiss(); | |||
| } | |||
| }); | |||
| return dialog; | |||
| } | |||
| /** | |||
| * Creates the Settings Dialog | |||
| */ | |||
| private static Dialog createSettingsDialog(Activity parent) { | |||
| final Dialog dialog = new SettingsDlg(parent); | |||
| return dialog; | |||
| } | |||
| /** | |||
| * Creates the User Guide Dialog | |||
| */ | |||
| private static Dialog createUserGuideDialog(Activity parent) { | |||
| String versionName = ""; | |||
| final Dialog dialog = new Dialog(parent); | |||
| dialog.setContentView(R.layout.userguide_dialog); | |||
| parent.getResources().getText(R.string.menuUserGuide); | |||
| dialog.setTitle(parent.getResources().getText(R.string.menuUserGuide)); | |||
| ImageView image = (ImageView) dialog.findViewById(R.id.ug_imageAppIcon); | |||
| image.setImageResource(R.drawable.icon); | |||
| try { | |||
| versionName = parent.getPackageManager().getPackageInfo("ch.spherIC", PackageManager.GET_CONFIGURATIONS) | |||
| .versionName; | |||
| } catch (NameNotFoundException e) { | |||
| versionName = "-"; | |||
| } | |||
| TextView text = (TextView) dialog.findViewById(R.id.ug_TextVersion); | |||
| text.setText(parent.getResources().getText(R.string.AppVersionLabel).toString() + " " + versionName); | |||
| ((Button) dialog.findViewById(R.id.btn_ugClose)).setOnClickListener(new OnClickListener() { | |||
| @Override | |||
| public void onClick(View v) { | |||
| dialog.dismiss(); | |||
| } | |||
| }); | |||
| return dialog; | |||
| } | |||
| } | |||
| @@ -0,0 +1,54 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <LinearLayout | |||
| xmlns:android="http://schemas.android.com/apk/res/android" | |||
| android:background="@drawable/bg_about" | |||
| android:padding="10dp" | |||
| android:layout_height="fill_parent" | |||
| android:layout_width="fill_parent" | |||
| android:orientation="vertical"> | |||
| <LinearLayout | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:orientation="horizontal" | |||
| android:id="@+id/layout_ugVersion"> | |||
| <ImageView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginRight="20dip" | |||
| android:id="@+id/ug_imageAppIcon" | |||
| android:layout_gravity="center_vertical" /> | |||
| <TextView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:textColor="#FF000000" | |||
| android:text="iii" | |||
| android:id="@+id/ug_TextVersion" | |||
| android:textStyle="bold" | |||
| android:layout_gravity="center_vertical" | |||
| android:gravity="center_vertical" /> | |||
| </LinearLayout> | |||
| <LinearLayout | |||
| android:orientation="vertical" android:scrollbars="vertical" android:layout_height="fill_parent" android:layout_width="fill_parent"> | |||
| <TextView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:id="@+id/ug_Text" | |||
| android:text="@string/userGuidePourpose" android:textColor="@color/black" android:minLines="10" android:maxLines="20"> | |||
| </TextView> | |||
| </LinearLayout> | |||
| <Button | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:background="@drawable/btn_fs" | |||
| android:id="@+id/btn_ugClose" | |||
| android:text="Close" | |||
| android:textColor="@color/white" | |||
| android:layout_gravity="center_horizontal"> | |||
| </Button> | |||
| </LinearLayout> | |||
| @@ -0,0 +1,241 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC.resultlist; | |||
| import java.util.List; | |||
| import android.app.Activity; | |||
| import android.content.Context; | |||
| import android.util.DisplayMetrics; | |||
| import android.view.Gravity; | |||
| import android.view.View; | |||
| import android.view.ViewGroup; | |||
| import android.widget.BaseAdapter; | |||
| import android.widget.ImageView; | |||
| import android.widget.LinearLayout; | |||
| import android.widget.TextView; | |||
| import android.widget.LinearLayout.LayoutParams; | |||
| import ch.spherIC.R; | |||
| /** | |||
| * Exposure adapter view class. | |||
| */ | |||
| class ExposureAdapterView extends LinearLayout { | |||
| private static DisplayMetrics metrics; | |||
| /** | |||
| * Creates a new ExposureAdapterView object. | |||
| * | |||
| * @param context DOCUMENT ME! | |||
| * @param weather DOCUMENT ME! | |||
| */ | |||
| public ExposureAdapterView(Context context, Exposure exposure, int nbrExposures) { | |||
| super(context); | |||
| this.setOrientation(HORIZONTAL); | |||
| ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(metrics); | |||
| // Nbr | |||
| TextView nbrControl = new TextView(context); | |||
| LinearLayout.LayoutParams nbrParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| nbrParams.setMargins(3, 1, 1, 1); | |||
| nbrControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| nbrControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| nbrControl.setText(Integer.toString(exposure.getNbr())); | |||
| addView(nbrControl, nbrParams); | |||
| // Aperture | |||
| TextView apertureControl = new TextView(context); | |||
| LinearLayout.LayoutParams apertureParams = new LinearLayout.LayoutParams(100, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| apertureParams.setMargins(1, 1, 1, 1); | |||
| apertureControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| apertureControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| apertureControl.setText(exposure.getAperture()); | |||
| addView(apertureControl, apertureParams); | |||
| // Shutter speed | |||
| TextView shutterControl = new TextView(context); | |||
| LinearLayout.LayoutParams shutterParams = new LinearLayout.LayoutParams(170, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| shutterParams.setMargins(1, 1, 1, 1); | |||
| shutterControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| shutterControl.setTextAppearance(context, R.style.ResultExposureTextSpecial); | |||
| shutterControl.setText(exposure.getShutterSpeed()); | |||
| addView(shutterControl, shutterParams); | |||
| // EV Step | |||
| TextView evStepControl = new TextView(context); | |||
| LinearLayout.LayoutParams evStepParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| evStepParams.setMargins(1, 1, 1, 1); | |||
| evStepControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| evStepControl.setTextAppearance(context, R.style.ResultExposureText); | |||
| evStepControl.setText(exposure.getEvStepAsString()); | |||
| addView(evStepControl, evStepParams); | |||
| // Icon | |||
| ImageView expIconControl = new ImageView(context); | |||
| LinearLayout.LayoutParams expIconParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| expIconParams.setMargins(1, 1, 1, 1); | |||
| expIconControl.setImageBitmap(exposure.getEvStepBtmp()); | |||
| addView(expIconControl, expIconParams); | |||
| } | |||
| } | |||
| /** | |||
| * Exposure results adapter. | |||
| */ | |||
| public class ExposureAdapter extends BaseAdapter { | |||
| private Context context; | |||
| private List<Exposure> exposureList; | |||
| /** | |||
| * Creates a new ExposureAdapter object. | |||
| */ | |||
| public ExposureAdapter(Context context, List<Exposure> expList) { | |||
| this.context = context; | |||
| this.exposureList = expList; | |||
| } | |||
| /** | |||
| * Retrieves list size. | |||
| * | |||
| * @return list size | |||
| */ | |||
| @Override | |||
| public int getCount() { | |||
| return this.exposureList.size(); | |||
| } | |||
| /** | |||
| * Retrieves the exposure at index <code>position</code>. | |||
| * | |||
| * @param position Index in list | |||
| * | |||
| * @return Exposure at index <code>position</code> | |||
| */ | |||
| @Override | |||
| public Object getItem(int position) { | |||
| return this.exposureList.get(position); | |||
| } | |||
| /** | |||
| * Retrieves the number of the exposure at index <code>position</code>. | |||
| * | |||
| * @param position Index in list | |||
| * | |||
| * @return the number of the exposure at index <code>position</code> | |||
| */ | |||
| @Override | |||
| public long getItemId(int position) { | |||
| //return this.exposureList.get(position).getNbr(); | |||
| return position; | |||
| } | |||
| /** | |||
| * Retrieves a view representing a single result row. | |||
| * | |||
| * @param position Index in list | |||
| * @param convertView view | |||
| * @param parent parent | |||
| * | |||
| * @return {@link ExposureAdapterView} | |||
| */ | |||
| @Override | |||
| public View getView(int position, View convertView, ViewGroup parent) { | |||
| Exposure exposure = this.exposureList.get(position); | |||
| return new ExposureAdapterView(this.context, exposure, this.exposureList.size()); | |||
| } | |||
| /** | |||
| * Retrieves the value of | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| public static View getHeaderView(Context context, LinearLayout headerLL) { | |||
| int black = headerLL.getResources().getColor(R.color.black); | |||
| // Nbr | |||
| TextView nbrControl = new TextView(context); | |||
| LinearLayout.LayoutParams nbrParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| nbrParams.setMargins(3, 1, 1, 1); | |||
| nbrControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| nbrControl.setTextSize(13f); | |||
| nbrControl.setTextColor(black); | |||
| nbrControl.setText(R.string.expNbrLbl); | |||
| headerLL.addView(nbrControl, nbrParams); | |||
| // Aperture | |||
| TextView apertureControl = new TextView(context); | |||
| LinearLayout.LayoutParams apertureParams = new LinearLayout.LayoutParams(100, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| apertureParams.setMargins(1, 1, 1, 1); | |||
| apertureControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| apertureControl.setTextSize(13f); | |||
| apertureControl.setTextColor(black); | |||
| apertureControl.setText(R.string.aperture); | |||
| headerLL.addView(apertureControl, apertureParams); | |||
| // Shutter speed | |||
| TextView shutterControl = new TextView(context); | |||
| LinearLayout.LayoutParams shutterParams = new LinearLayout.LayoutParams(170, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| shutterParams.setMargins(1, 1, 1, 1); | |||
| shutterControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| shutterControl.setTextSize(13f); | |||
| shutterControl.setTextColor(black); | |||
| shutterControl.setText(R.string.shutter_speed); | |||
| headerLL.addView(shutterControl, shutterParams); | |||
| // EV Step | |||
| TextView evStepControl = new TextView(context); | |||
| LinearLayout.LayoutParams evStepParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| evStepParams.setMargins(1, 1, 1, 1); | |||
| evStepControl.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); | |||
| evStepControl.setTextSize(13f); | |||
| evStepControl.setTextColor(black); | |||
| evStepControl.setText(R.string.expEVStep); | |||
| headerLL.addView(evStepControl, evStepParams); | |||
| // Icon | |||
| ImageView expIconControl = new ImageView(context); | |||
| LinearLayout.LayoutParams expIconParams = new LinearLayout.LayoutParams(70, LayoutParams.WRAP_CONTENT, 0.2f); | |||
| expIconParams.setMargins(1, 1, 1, 1); | |||
| headerLL.addView(expIconControl, expIconParams); | |||
| return headerLL; | |||
| } | |||
| /** | |||
| * Retrieves the value of | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| private static DisplayMetrics getMetrics() { | |||
| if (metrics == null) { | |||
| metrics = new DisplayMetrics(); | |||
| } | |||
| return metrics; | |||
| } | |||
| } | |||
| @@ -0,0 +1,189 @@ | |||
| /* | |||
| * $URL$ | |||
| * $Revision$ | |||
| * $LastChangedBy$ | |||
| * $LastChangedDate$ | |||
| * | |||
| * Copyright (c) 2005 syseca AG, Switzerland | |||
| * All rights reserved. | |||
| * | |||
| * This software is the confidential and proprietary information | |||
| * of syseca AG. ("Confidential Information"). You shall not | |||
| * disclose such Confidential Information and shall use it only | |||
| * in accordance with the terms of the license agreement you | |||
| * entered into with syseca AG. | |||
| */ | |||
| package ch.spherIC.resultlist; | |||
| import java.text.DecimalFormat; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import android.app.Activity; | |||
| import android.content.Context; | |||
| import android.content.res.Resources; | |||
| import android.graphics.Bitmap; | |||
| import android.graphics.BitmapFactory; | |||
| import android.graphics.Canvas; | |||
| import android.graphics.Color; | |||
| import android.graphics.Paint; | |||
| import android.graphics.PorterDuff; | |||
| import android.graphics.PorterDuffXfermode; | |||
| import android.graphics.Bitmap.Config; | |||
| import android.graphics.Paint.Style; | |||
| import android.util.DisplayMetrics; | |||
| import ch.spherIC.EVFormula; | |||
| import ch.spherIC.EasyBracketMain; | |||
| import ch.spherIC.R; | |||
| /** | |||
| * Factory that creates the exposure icons according to the EV range and values. | |||
| */ | |||
| public class ExposureFactory { | |||
| public static final DecimalFormat evDF = new DecimalFormat("0.######"); | |||
| /** | |||
| * DOCUMENT ME! | |||
| * | |||
| * @param context DOCUMENT ME! | |||
| * @param dpEV DOCUMENT ME! | |||
| * @param bpEv DOCUMENT ME! | |||
| * @param calcPrmAperture DOCUMENT ME! | |||
| * @param calcPrmEvStep DOCUMENT ME! | |||
| * @param fixBP DOCUMENT ME! | |||
| * | |||
| * @return DOCUMENT ME! | |||
| */ | |||
| public static List<Exposure> calculateExposures(Context context, double dpEV, double bpEv, double calcPrmAperture, | |||
| double calcPrmEvStep, boolean fixBP, List<Double> allowedShutters) { | |||
| Exposure exp; | |||
| List<Exposure> exposures = new ArrayList<Exposure>(); | |||
| double deltaEV = bpEv - dpEV; | |||
| long nbrExposures = Math.round(deltaEV / calcPrmEvStep) + 1; | |||
| // correct the deltaEV | |||
| deltaEV = calcPrmEvStep * (nbrExposures - 1); | |||
| double baseEVStep = -deltaEV / 2; | |||
| for (int i = 0; i < nbrExposures; i++) { | |||
| boolean found = false; | |||
| String shutterSpeed = ""; | |||
| double shutter; | |||
| double evValue = 0; | |||
| double evStep = baseEVStep + i * calcPrmEvStep; | |||
| if (fixBP) { | |||
| evValue = bpEv - (nbrExposures - 1 - i) * calcPrmEvStep; | |||
| } else { | |||
| evValue = dpEV + i * calcPrmEvStep; | |||
| } | |||
| shutter = Double.valueOf(evDF.format((EVFormula.calcShutterSpeed(calcPrmAperture, evValue)))); | |||
| for (int j = 1; j < allowedShutters.size(); j++) { | |||
| double v1 = allowedShutters.get(j - 1); | |||
| double v2 = allowedShutters.get(j); | |||
| if ((v1 <= shutter && shutter <= v2) || (v2 <= shutter && shutter <= v1)) { | |||
| if (Math.abs(shutter - v1) <= Math.abs(shutter - v2)) { | |||
| shutterSpeed = (v1 < 1) ? "1/" + evDF.format((1 / v1)) | |||
| : "" + EasyBracketMain.DF.format(v1) + "''"; | |||
| } else { | |||
| shutterSpeed = (v2 < 1) ? "1/" + evDF.format((1 / v2)) | |||
| : "" + EasyBracketMain.DF.format(v2) + "''"; | |||
| } | |||
| found = true; | |||
| break; | |||
| } | |||
| } | |||
| if (!found) { | |||
| shutterSpeed = (shutter < 1) ? "1/" + Math.round(1 / shutter) | |||
| : "" + EasyBracketMain.DF.format(shutter) + "''"; | |||
| } | |||
| exp = new Exposure(i + 1, "f/" + EasyBracketMain.DF.format(calcPrmAperture), shutterSpeed, evStep, deltaEV, | |||
| getExpIcon(context, i + 1, (int) nbrExposures)); | |||
| exposures.add(exp); | |||
| } | |||
| return exposures; | |||
| } | |||
| /** | |||
| * Retrieves Icon. | |||
| * | |||
| * @param context Context | |||
| * @param exp {@link Exposure} object | |||
| * | |||
| * @return Color stepped icon | |||
| */ | |||
| private static Bitmap getExpIcon(Context context, int expNbr, int nbrExposures) { | |||
| Bitmap mIcon; | |||
| Bitmap mIconBG; | |||
| Bitmap mIconSymbol; | |||
| Bitmap mIconSymbol_bl; | |||
| Canvas canvas; | |||
| Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); | |||
| final Resources res = context.getResources(); | |||
| final int twentyPercentGray = Math.round(255f * 0.8f); | |||
| int deltaRGB = twentyPercentGray; | |||
| int iSize; | |||
| int iSize_r; | |||
| int iStart; | |||
| DisplayMetrics metrics = new DisplayMetrics(); | |||
| ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(metrics); | |||
| switch (metrics.density) { | |||
| case DisplayMetrics.DENSITY_LOW: | |||
| iSize = 18; | |||
| iSize_r = 17; | |||
| iStart = 1; | |||
| break; | |||
| default: | |||
| break; | |||
| } | |||
| if (expNbr > 1 || nbrExposures > 1) { | |||
| deltaRGB = twentyPercentGray / (nbrExposures - 1) * (expNbr - 1); | |||
| } | |||
| // The background | |||
| mIconBG = Bitmap.createBitmap(36, 36, Config.ARGB_8888); | |||
| mIconBG.eraseColor(0x00000000); | |||
| canvas = new Canvas(mIconBG); | |||
| mPaint.setStyle(Style.FILL); | |||
| mPaint.setColor(Color.argb(255, deltaRGB, deltaRGB, deltaRGB)); | |||
| canvas.drawRect(2, 2, 33, 33, mPaint); | |||
| // Let's retrieve all icon pieces as Bitmaps. | |||
| mIcon = BitmapFactory.decodeResource(res, R.drawable.exposureicon_frame); | |||
| mIconSymbol = BitmapFactory.decodeResource(res, R.drawable.exposureicon_symb_white); | |||
| mIconSymbol_bl = BitmapFactory.decodeResource(res, R.drawable.exposureicon_symb_black); | |||
| // Prepares the paint that will be used to draw our icon mask. Using | |||
| // PorterDuff.Mode.SRC_OVER means the image that will be drawn will | |||
| // mask the already drawn image. | |||
| mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER)); | |||
| // We're now ready to drawn our Android-like icon :) | |||
| if (deltaRGB > twentyPercentGray / 2) { | |||
| canvas.drawBitmap(mIconSymbol_bl, 0, 0, mPaint); | |||
| } else { | |||
| canvas.drawBitmap(mIconSymbol, 0, 0, mPaint); | |||
| } | |||
| canvas.drawBitmap(mIcon, 0, 0, mPaint); | |||
| return mIconBG; | |||
| } | |||
| } | |||