Loading res/layout/filtershow_info_panel.xml +55 −104 Original line number Diff line number Diff line Loading @@ -16,50 +16,10 @@ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:minWidth="340dp" android:layout_height="match_parent" android:orientation="vertical" android:background="#3a4e56"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:background="#222"> <ImageButton android:id="@+id/cancelInfo" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_gravity="left|center_vertical" android:background="@android:color/transparent" android:layout_weight=".1" android:gravity="left" android:src="@drawable/ic_menu_cancel_holo_light" android:textSize="18dip"/> <ImageView android:layout_width="2dp" android:layout_height="fill_parent" android:src="@drawable/filtershow_vertical_bar"/> <TextView style="?android:textAppearanceLarge" android:textStyle="bold" android:textColor="#fff" android:layout_weight="1" android:layout_gravity="left|center_vertical" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="8dip" android:text="@string/filtershow_show_info_panel"/> </LinearLayout> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:background="#3a4e56" android:background="@color/background_main_toolbar" android:padding="16dp"> <ScrollView Loading @@ -74,37 +34,19 @@ <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical"> <TextView style="?android:textAppearanceLarge" android:textStyle="bold" android:textColor="#fff" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/filtershow_show_info_panel_name"/> android:orientation="horizontal" > <TextView android:id="@+id/imageName" style="?android:textAppearanceSmall" android:textStyle="bold" android:textColor="#80ffffff" android:layout_width="match_parent" android:layout_height="wrap_content"/> <TextView style="?android:textAppearanceLarge" android:textStyle="bold" android:textColor="#fff" android:layout_width="match_parent" android:layout_gravity="start" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/filtershow_show_info_panel_size"/> android:layout_weight="1" android:gravity="start"/> <TextView android:id="@+id/imageSize" Loading @@ -112,49 +54,58 @@ android:textAllCaps="true" android:textColor="#80ffffff" android:textStyle="bold" android:lineSpacingMultiplier="1.2" android:layout_width="match_parent" android:layout_height="wrap_content"/> android:layout_gravity="end" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="end"/> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="16dp" > <ImageView android:id="@+id/imageThumbnail" android:layout_width="200dp" android:layout_height="200dp" android:scaleType="centerInside" android:layout_weight="0.3" android:layout_width="0dp" android:layout_height="196dp" android:scaleType="centerCrop" android:layout_marginRight="16dp" android:background="@null" android:layout_weight="1" /> </LinearLayout> <TextView style="?android:textAppearanceLarge" android:textStyle="bold" android:textColor="#fff" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/filtershow_show_info_panel_histogram"/> /> <com.android.gallery3d.filtershow.info.HistogramView android:id="@+id/histogramView" android:layout_width="match_parent" android:layout_height="250dp" android:layout_margin="16dp"/> android:layout_weight="0.7" android:layout_width="0dp" android:layout_height="196dp" android:layout_margin="0dp"/> </LinearLayout> <TextView style="?android:textAppearanceLarge" android:id="@+id/exifLabel" android:textStyle="bold" android:textColor="#fff" android:layout_width="match_parent" android:layout_marginTop="16dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="start" android:text="@string/filtershow_show_info_panel_exif"/> <TextView android:id="@+id/exifData" android:layout_width="match_parent" android:layout_height="wrap_content"/> android:layout_height="wrap_content" android:layout_marginTop="16dp" android:layout_gravity="start" /> </LinearLayout> </ScrollView> </LinearLayout> </LinearLayout> No newline at end of file src/com/android/gallery3d/filtershow/FilterShowActivity.java +1 −29 Original line number Diff line number Diff line Loading @@ -147,7 +147,6 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL private boolean mShowingTinyPlanet = false; private boolean mShowingImageStatePanel = false; private boolean mShowingVersionsPanel = false; private boolean mShowingInformationPanel = false; private final Vector<ImageShow> mImageViews = new Vector<ImageShow>(); Loading Loading @@ -331,35 +330,12 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL } } public void hideInformationPanel() { FrameLayout infoLayout = (FrameLayout) findViewById(R.id.central_panel_container); infoLayout.setVisibility(View.GONE); Fragment fragment = getSupportFragmentManager().findFragmentByTag(InfoPanel.FRAGMENT_TAG); if (fragment != null) { FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.remove(fragment); transaction.commit(); } mShowingInformationPanel = false; } public void toggleInformationPanel() { mShowingInformationPanel = !mShowingInformationPanel; if (!mShowingInformationPanel) { hideInformationPanel(); showDefaultImageView(); return; } FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.setCustomAnimations(R.anim.slide_in_right, R.anim.slide_out_left); FrameLayout infoLayout = (FrameLayout) findViewById(R.id.central_panel_container); infoLayout.setVisibility(View.VISIBLE); mEditorPlaceHolder.hide(); mImageShow.setVisibility(View.GONE); InfoPanel panel = new InfoPanel(); transaction.replace(R.id.central_panel_container, panel, InfoPanel.FRAGMENT_TAG); transaction.commit(); panel.show(transaction, InfoPanel.FRAGMENT_TAG); } private void loadXML() { Loading Loading @@ -681,7 +657,6 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL } mCurrentEditor = mEditorPlaceHolder.showEditor(representation.getEditorId()); loadEditorPanel(representation, mCurrentEditor); hideInformationPanel(); } public Editor getEditor(int editorID) { Loading Loading @@ -1206,8 +1181,6 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL fillCategories(); loadMainPanel(); mShowingInformationPanel = false; // mLoadBitmapTask==null implies you have looked at the intent if (!mShowingTinyPlanet && (mLoadBitmapTask == null)) { mCategoryFiltersAdapter.removeTinyPlanet(); Loading Loading @@ -1244,7 +1217,6 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL } public void showDefaultImageView() { hideInformationPanel(); mEditorPlaceHolder.hide(); mImageShow.setVisibility(View.VISIBLE); MasterImage.getImage().setCurrentFilter(null); Loading src/com/android/gallery3d/filtershow/info/HistogramView.java +33 −32 Original line number Diff line number Diff line Loading @@ -27,15 +27,15 @@ import android.graphics.PorterDuffXfermode; import android.os.AsyncTask; import android.util.AttributeSet; import android.view.View; import com.android.gallery3d.filtershow.imageshow.Spline; public class HistogramView extends View { private Bitmap mBitmap; int[] redHistogram = new int[256]; int[] greenHistogram = new int[256]; int[] blueHistogram = new int[256]; Path gHistoPath = new Path(); private Paint mPaint = new Paint(); private int[] redHistogram = new int[256]; private int[] greenHistogram = new int[256]; private int[] blueHistogram = new int[256]; private Path mHistoPath = new Path(); class ComputeHistogramTask extends AsyncTask<Bitmap, Void, int[]> { @Override Loading Loading @@ -85,28 +85,29 @@ public class HistogramView extends View { max = histogram[i]; } } float w = getWidth() - Spline.curveHandleSize(); float h = getHeight() - Spline.curveHandleSize() / 2.0f; float dx = Spline.curveHandleSize() / 2.0f; float w = getWidth(); // - Spline.curveHandleSize(); float h = getHeight(); // - Spline.curveHandleSize() / 2.0f; float dx = 0; // Spline.curveHandleSize() / 2.0f; float wl = w / histogram.length; float wh = h / max; Paint paint = new Paint(); paint.setARGB(100, 255, 255, 255); paint.setStrokeWidth((int) Math.ceil(wl)); mPaint.reset(); mPaint.setAntiAlias(true); mPaint.setARGB(100, 255, 255, 255); mPaint.setStrokeWidth((int) Math.ceil(wl)); // Draw grid paint.setStyle(Paint.Style.STROKE); canvas.drawRect(dx, 0, dx + w, h, paint); canvas.drawLine(dx + w / 3, 0, dx + w / 3, h, paint); canvas.drawLine(dx + 2 * w / 3, 0, dx + 2 * w / 3, h, paint); paint.setStyle(Paint.Style.FILL_AND_STROKE); mPaint.setStyle(Paint.Style.STROKE); canvas.drawRect(dx, 0, dx + w, h, mPaint); canvas.drawLine(dx + w / 3, 0, dx + w / 3, h, mPaint); canvas.drawLine(dx + 2 * w / 3, 0, dx + 2 * w / 3, h, mPaint); Paint paint2 = new Paint(); paint2.setColor(color); paint2.setStrokeWidth(6); paint2.setXfermode(new PorterDuffXfermode(mode)); gHistoPath.reset(); gHistoPath.moveTo(dx, h); mPaint.setStyle(Paint.Style.FILL); mPaint.setColor(color); mPaint.setStrokeWidth(6); mPaint.setXfermode(new PorterDuffXfermode(mode)); mHistoPath.reset(); mHistoPath.moveTo(dx, h); boolean firstPointEncountered = false; float prev = 0; float last = 0; Loading @@ -116,22 +117,22 @@ public class HistogramView extends View { if (l != 0) { float v = h - (l + prev) / 2.0f; if (!firstPointEncountered) { gHistoPath.lineTo(x, h); mHistoPath.lineTo(x, h); firstPointEncountered = true; } gHistoPath.lineTo(x, v); mHistoPath.lineTo(x, v); prev = l; last = x; } } gHistoPath.lineTo(last, h); gHistoPath.lineTo(w, h); gHistoPath.close(); canvas.drawPath(gHistoPath, paint2); paint2.setStrokeWidth(2); paint2.setStyle(Paint.Style.STROKE); paint2.setARGB(255, 200, 200, 200); canvas.drawPath(gHistoPath, paint2); mHistoPath.lineTo(last, h); mHistoPath.lineTo(w, h); mHistoPath.close(); canvas.drawPath(mHistoPath, mPaint); mPaint.setStrokeWidth(2); mPaint.setStyle(Paint.Style.STROKE); mPaint.setARGB(255, 200, 200, 200); canvas.drawPath(mHistoPath, mPaint); } public void onDraw(Canvas canvas) { Loading src/com/android/gallery3d/filtershow/info/InfoPanel.java +15 −14 Original line number Diff line number Diff line Loading @@ -20,11 +20,12 @@ import android.graphics.Bitmap; import android.graphics.Rect; import android.net.Uri; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.DialogFragment; import android.text.Html; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.LinearLayout; Loading @@ -32,13 +33,12 @@ import android.widget.TextView; import com.android.gallery3d.R; import com.android.gallery3d.exif.ExifInterface; import com.android.gallery3d.exif.ExifTag; import com.android.gallery3d.filtershow.FilterShowActivity; import com.android.gallery3d.filtershow.cache.ImageLoader; import com.android.gallery3d.filtershow.imageshow.MasterImage; import java.util.List; public class InfoPanel extends Fragment { public class InfoPanel extends DialogFragment { public static final String FRAGMENT_TAG = "InfoPanel"; private static final String LOGTAG = FRAGMENT_TAG; private LinearLayout mMainView; Loading @@ -46,7 +46,6 @@ public class InfoPanel extends Fragment { private TextView mImageName; private TextView mImageSize; private TextView mExifData; private ImageButton mHideButton; private String createStringFromIfFound(ExifTag exifTag, int tag, int str) { String exifString = ""; Loading @@ -63,6 +62,9 @@ public class InfoPanel extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (getDialog() != null) { getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE); } mMainView = (LinearLayout) inflater.inflate( R.layout.filtershow_info_panel, null, false); Loading @@ -74,19 +76,11 @@ public class InfoPanel extends Fragment { mImageName = (TextView) mMainView.findViewById(R.id.imageName); mImageSize = (TextView) mMainView.findViewById(R.id.imageSize); mExifData = (TextView) mMainView.findViewById(R.id.exifData); mHideButton =(ImageButton) mMainView.findViewById(R.id.cancelInfo); TextView exifLabel = (TextView) mMainView.findViewById(R.id.exifLabel); HistogramView histogramView = (HistogramView) mMainView.findViewById(R.id.histogramView); histogramView.setBitmap(bitmap); mHideButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { FilterShowActivity activity = (FilterShowActivity)getActivity(); activity.toggleInformationPanel(); } }); Uri uri = MasterImage.getImage().getUri(); String path = ImageLoader.getLocalPathFromUri(getActivity(), uri); Uri localUri = null; Loading @@ -102,6 +96,7 @@ public class InfoPanel extends Fragment { List<ExifTag> exif = MasterImage.getImage().getEXIF(); String exifString = ""; boolean hasExifData = false; if (exif != null) { for (ExifTag tag : exif) { exifString += createStringFromIfFound(tag, Loading Loading @@ -131,9 +126,15 @@ public class InfoPanel extends Fragment { exifString += createStringFromIfFound(tag, ExifInterface.TAG_COPYRIGHT, R.string.filtershow_exif_copyright); hasExifData = true; } } if (hasExifData) { exifLabel.setVisibility(View.VISIBLE); mExifData.setText(Html.fromHtml(exifString)); } else { exifLabel.setVisibility(View.GONE); } return mMainView; } } Loading
res/layout/filtershow_info_panel.xml +55 −104 Original line number Diff line number Diff line Loading @@ -16,50 +16,10 @@ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:minWidth="340dp" android:layout_height="match_parent" android:orientation="vertical" android:background="#3a4e56"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:background="#222"> <ImageButton android:id="@+id/cancelInfo" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_gravity="left|center_vertical" android:background="@android:color/transparent" android:layout_weight=".1" android:gravity="left" android:src="@drawable/ic_menu_cancel_holo_light" android:textSize="18dip"/> <ImageView android:layout_width="2dp" android:layout_height="fill_parent" android:src="@drawable/filtershow_vertical_bar"/> <TextView style="?android:textAppearanceLarge" android:textStyle="bold" android:textColor="#fff" android:layout_weight="1" android:layout_gravity="left|center_vertical" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="8dip" android:text="@string/filtershow_show_info_panel"/> </LinearLayout> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:background="#3a4e56" android:background="@color/background_main_toolbar" android:padding="16dp"> <ScrollView Loading @@ -74,37 +34,19 @@ <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical"> <TextView style="?android:textAppearanceLarge" android:textStyle="bold" android:textColor="#fff" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/filtershow_show_info_panel_name"/> android:orientation="horizontal" > <TextView android:id="@+id/imageName" style="?android:textAppearanceSmall" android:textStyle="bold" android:textColor="#80ffffff" android:layout_width="match_parent" android:layout_height="wrap_content"/> <TextView style="?android:textAppearanceLarge" android:textStyle="bold" android:textColor="#fff" android:layout_width="match_parent" android:layout_gravity="start" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/filtershow_show_info_panel_size"/> android:layout_weight="1" android:gravity="start"/> <TextView android:id="@+id/imageSize" Loading @@ -112,49 +54,58 @@ android:textAllCaps="true" android:textColor="#80ffffff" android:textStyle="bold" android:lineSpacingMultiplier="1.2" android:layout_width="match_parent" android:layout_height="wrap_content"/> android:layout_gravity="end" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="end"/> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="16dp" > <ImageView android:id="@+id/imageThumbnail" android:layout_width="200dp" android:layout_height="200dp" android:scaleType="centerInside" android:layout_weight="0.3" android:layout_width="0dp" android:layout_height="196dp" android:scaleType="centerCrop" android:layout_marginRight="16dp" android:background="@null" android:layout_weight="1" /> </LinearLayout> <TextView style="?android:textAppearanceLarge" android:textStyle="bold" android:textColor="#fff" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/filtershow_show_info_panel_histogram"/> /> <com.android.gallery3d.filtershow.info.HistogramView android:id="@+id/histogramView" android:layout_width="match_parent" android:layout_height="250dp" android:layout_margin="16dp"/> android:layout_weight="0.7" android:layout_width="0dp" android:layout_height="196dp" android:layout_margin="0dp"/> </LinearLayout> <TextView style="?android:textAppearanceLarge" android:id="@+id/exifLabel" android:textStyle="bold" android:textColor="#fff" android:layout_width="match_parent" android:layout_marginTop="16dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="start" android:text="@string/filtershow_show_info_panel_exif"/> <TextView android:id="@+id/exifData" android:layout_width="match_parent" android:layout_height="wrap_content"/> android:layout_height="wrap_content" android:layout_marginTop="16dp" android:layout_gravity="start" /> </LinearLayout> </ScrollView> </LinearLayout> </LinearLayout> No newline at end of file
src/com/android/gallery3d/filtershow/FilterShowActivity.java +1 −29 Original line number Diff line number Diff line Loading @@ -147,7 +147,6 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL private boolean mShowingTinyPlanet = false; private boolean mShowingImageStatePanel = false; private boolean mShowingVersionsPanel = false; private boolean mShowingInformationPanel = false; private final Vector<ImageShow> mImageViews = new Vector<ImageShow>(); Loading Loading @@ -331,35 +330,12 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL } } public void hideInformationPanel() { FrameLayout infoLayout = (FrameLayout) findViewById(R.id.central_panel_container); infoLayout.setVisibility(View.GONE); Fragment fragment = getSupportFragmentManager().findFragmentByTag(InfoPanel.FRAGMENT_TAG); if (fragment != null) { FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.remove(fragment); transaction.commit(); } mShowingInformationPanel = false; } public void toggleInformationPanel() { mShowingInformationPanel = !mShowingInformationPanel; if (!mShowingInformationPanel) { hideInformationPanel(); showDefaultImageView(); return; } FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.setCustomAnimations(R.anim.slide_in_right, R.anim.slide_out_left); FrameLayout infoLayout = (FrameLayout) findViewById(R.id.central_panel_container); infoLayout.setVisibility(View.VISIBLE); mEditorPlaceHolder.hide(); mImageShow.setVisibility(View.GONE); InfoPanel panel = new InfoPanel(); transaction.replace(R.id.central_panel_container, panel, InfoPanel.FRAGMENT_TAG); transaction.commit(); panel.show(transaction, InfoPanel.FRAGMENT_TAG); } private void loadXML() { Loading Loading @@ -681,7 +657,6 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL } mCurrentEditor = mEditorPlaceHolder.showEditor(representation.getEditorId()); loadEditorPanel(representation, mCurrentEditor); hideInformationPanel(); } public Editor getEditor(int editorID) { Loading Loading @@ -1206,8 +1181,6 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL fillCategories(); loadMainPanel(); mShowingInformationPanel = false; // mLoadBitmapTask==null implies you have looked at the intent if (!mShowingTinyPlanet && (mLoadBitmapTask == null)) { mCategoryFiltersAdapter.removeTinyPlanet(); Loading Loading @@ -1244,7 +1217,6 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL } public void showDefaultImageView() { hideInformationPanel(); mEditorPlaceHolder.hide(); mImageShow.setVisibility(View.VISIBLE); MasterImage.getImage().setCurrentFilter(null); Loading
src/com/android/gallery3d/filtershow/info/HistogramView.java +33 −32 Original line number Diff line number Diff line Loading @@ -27,15 +27,15 @@ import android.graphics.PorterDuffXfermode; import android.os.AsyncTask; import android.util.AttributeSet; import android.view.View; import com.android.gallery3d.filtershow.imageshow.Spline; public class HistogramView extends View { private Bitmap mBitmap; int[] redHistogram = new int[256]; int[] greenHistogram = new int[256]; int[] blueHistogram = new int[256]; Path gHistoPath = new Path(); private Paint mPaint = new Paint(); private int[] redHistogram = new int[256]; private int[] greenHistogram = new int[256]; private int[] blueHistogram = new int[256]; private Path mHistoPath = new Path(); class ComputeHistogramTask extends AsyncTask<Bitmap, Void, int[]> { @Override Loading Loading @@ -85,28 +85,29 @@ public class HistogramView extends View { max = histogram[i]; } } float w = getWidth() - Spline.curveHandleSize(); float h = getHeight() - Spline.curveHandleSize() / 2.0f; float dx = Spline.curveHandleSize() / 2.0f; float w = getWidth(); // - Spline.curveHandleSize(); float h = getHeight(); // - Spline.curveHandleSize() / 2.0f; float dx = 0; // Spline.curveHandleSize() / 2.0f; float wl = w / histogram.length; float wh = h / max; Paint paint = new Paint(); paint.setARGB(100, 255, 255, 255); paint.setStrokeWidth((int) Math.ceil(wl)); mPaint.reset(); mPaint.setAntiAlias(true); mPaint.setARGB(100, 255, 255, 255); mPaint.setStrokeWidth((int) Math.ceil(wl)); // Draw grid paint.setStyle(Paint.Style.STROKE); canvas.drawRect(dx, 0, dx + w, h, paint); canvas.drawLine(dx + w / 3, 0, dx + w / 3, h, paint); canvas.drawLine(dx + 2 * w / 3, 0, dx + 2 * w / 3, h, paint); paint.setStyle(Paint.Style.FILL_AND_STROKE); mPaint.setStyle(Paint.Style.STROKE); canvas.drawRect(dx, 0, dx + w, h, mPaint); canvas.drawLine(dx + w / 3, 0, dx + w / 3, h, mPaint); canvas.drawLine(dx + 2 * w / 3, 0, dx + 2 * w / 3, h, mPaint); Paint paint2 = new Paint(); paint2.setColor(color); paint2.setStrokeWidth(6); paint2.setXfermode(new PorterDuffXfermode(mode)); gHistoPath.reset(); gHistoPath.moveTo(dx, h); mPaint.setStyle(Paint.Style.FILL); mPaint.setColor(color); mPaint.setStrokeWidth(6); mPaint.setXfermode(new PorterDuffXfermode(mode)); mHistoPath.reset(); mHistoPath.moveTo(dx, h); boolean firstPointEncountered = false; float prev = 0; float last = 0; Loading @@ -116,22 +117,22 @@ public class HistogramView extends View { if (l != 0) { float v = h - (l + prev) / 2.0f; if (!firstPointEncountered) { gHistoPath.lineTo(x, h); mHistoPath.lineTo(x, h); firstPointEncountered = true; } gHistoPath.lineTo(x, v); mHistoPath.lineTo(x, v); prev = l; last = x; } } gHistoPath.lineTo(last, h); gHistoPath.lineTo(w, h); gHistoPath.close(); canvas.drawPath(gHistoPath, paint2); paint2.setStrokeWidth(2); paint2.setStyle(Paint.Style.STROKE); paint2.setARGB(255, 200, 200, 200); canvas.drawPath(gHistoPath, paint2); mHistoPath.lineTo(last, h); mHistoPath.lineTo(w, h); mHistoPath.close(); canvas.drawPath(mHistoPath, mPaint); mPaint.setStrokeWidth(2); mPaint.setStyle(Paint.Style.STROKE); mPaint.setARGB(255, 200, 200, 200); canvas.drawPath(mHistoPath, mPaint); } public void onDraw(Canvas canvas) { Loading
src/com/android/gallery3d/filtershow/info/InfoPanel.java +15 −14 Original line number Diff line number Diff line Loading @@ -20,11 +20,12 @@ import android.graphics.Bitmap; import android.graphics.Rect; import android.net.Uri; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.DialogFragment; import android.text.Html; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.LinearLayout; Loading @@ -32,13 +33,12 @@ import android.widget.TextView; import com.android.gallery3d.R; import com.android.gallery3d.exif.ExifInterface; import com.android.gallery3d.exif.ExifTag; import com.android.gallery3d.filtershow.FilterShowActivity; import com.android.gallery3d.filtershow.cache.ImageLoader; import com.android.gallery3d.filtershow.imageshow.MasterImage; import java.util.List; public class InfoPanel extends Fragment { public class InfoPanel extends DialogFragment { public static final String FRAGMENT_TAG = "InfoPanel"; private static final String LOGTAG = FRAGMENT_TAG; private LinearLayout mMainView; Loading @@ -46,7 +46,6 @@ public class InfoPanel extends Fragment { private TextView mImageName; private TextView mImageSize; private TextView mExifData; private ImageButton mHideButton; private String createStringFromIfFound(ExifTag exifTag, int tag, int str) { String exifString = ""; Loading @@ -63,6 +62,9 @@ public class InfoPanel extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (getDialog() != null) { getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE); } mMainView = (LinearLayout) inflater.inflate( R.layout.filtershow_info_panel, null, false); Loading @@ -74,19 +76,11 @@ public class InfoPanel extends Fragment { mImageName = (TextView) mMainView.findViewById(R.id.imageName); mImageSize = (TextView) mMainView.findViewById(R.id.imageSize); mExifData = (TextView) mMainView.findViewById(R.id.exifData); mHideButton =(ImageButton) mMainView.findViewById(R.id.cancelInfo); TextView exifLabel = (TextView) mMainView.findViewById(R.id.exifLabel); HistogramView histogramView = (HistogramView) mMainView.findViewById(R.id.histogramView); histogramView.setBitmap(bitmap); mHideButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { FilterShowActivity activity = (FilterShowActivity)getActivity(); activity.toggleInformationPanel(); } }); Uri uri = MasterImage.getImage().getUri(); String path = ImageLoader.getLocalPathFromUri(getActivity(), uri); Uri localUri = null; Loading @@ -102,6 +96,7 @@ public class InfoPanel extends Fragment { List<ExifTag> exif = MasterImage.getImage().getEXIF(); String exifString = ""; boolean hasExifData = false; if (exif != null) { for (ExifTag tag : exif) { exifString += createStringFromIfFound(tag, Loading Loading @@ -131,9 +126,15 @@ public class InfoPanel extends Fragment { exifString += createStringFromIfFound(tag, ExifInterface.TAG_COPYRIGHT, R.string.filtershow_exif_copyright); hasExifData = true; } } if (hasExifData) { exifLabel.setVisibility(View.VISIBLE); mExifData.setText(Html.fromHtml(exifString)); } else { exifLabel.setVisibility(View.GONE); } return mMainView; } }