From 19b5c132060f12038f401beb520acaf184a95290 Mon Sep 17 00:00:00 2001 From: Ricky Barrette Date: Sat, 21 Jul 2012 22:55:36 -0400 Subject: [PATCH] Cleaned up some code --- LocationRinger/AndroidManifest.xml | 4 ++-- .../LocationRinger/ui/CheckLocationShortcut.java | 2 -- .../android/LocationRinger/ui/SettingsActivity.java | 11 +++++++++-- .../viewpagerindicator/TitlePageIndicator.java | 10 ++++++---- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/LocationRinger/AndroidManifest.xml b/LocationRinger/AndroidManifest.xml index 74ebf72..8587c10 100644 --- a/LocationRinger/AndroidManifest.xml +++ b/LocationRinger/AndroidManifest.xml @@ -2,8 +2,8 @@ + android:versionCode="65" + android:versionName="c708c3d" > diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/CheckLocationShortcut.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/CheckLocationShortcut.java index b0530e9..44f70b9 100644 --- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/CheckLocationShortcut.java +++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/CheckLocationShortcut.java @@ -26,9 +26,7 @@ import android.os.Bundle; import android.os.Parcelable; import com.TwentyCodes.android.LocationRinger.R; -import com.TwentyCodes.android.LocationRinger.debug.Debug; import com.TwentyCodes.android.LocationRinger.services.LocationService; -import com.TwentyCodes.android.debug.LocationLibraryConstants; /** * This Activity actually handles two stages of a launcher shortcut's life cycle. diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/SettingsActivity.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/SettingsActivity.java index 308aecd..e8407e1 100644 --- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/SettingsActivity.java +++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/SettingsActivity.java @@ -79,8 +79,10 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference * @author ricky barrette */ private static void copyFile(final File src, final File dst) throws IOException { - final FileChannel inChannel = new FileInputStream(src).getChannel(); - final FileChannel outChannel = new FileOutputStream(dst).getChannel(); + final FileInputStream in = new FileInputStream(src); + final FileOutputStream out = new FileOutputStream(dst); + final FileChannel inChannel = in.getChannel(); + final FileChannel outChannel = out.getChannel(); try { inChannel.transferTo(0, inChannel.size(), outChannel); } finally { @@ -88,6 +90,11 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference inChannel.close(); if (outChannel != null) outChannel.close(); + if(in != null) + in.close(); + if(out != null) + out.close(); + } } diff --git a/LocationRinger/src/com/jakewharton/android/viewpagerindicator/TitlePageIndicator.java b/LocationRinger/src/com/jakewharton/android/viewpagerindicator/TitlePageIndicator.java index a37030f..b0657be 100644 --- a/LocationRinger/src/com/jakewharton/android/viewpagerindicator/TitlePageIndicator.java +++ b/LocationRinger/src/com/jakewharton/android/viewpagerindicator/TitlePageIndicator.java @@ -71,7 +71,7 @@ public class TitlePageIndicator extends TextView implements PageIndicator, View. private int mCurrentOffset; private final Paint mPaintText; private final Paint mPaintSelected; - private Path mPath; + private final Path mPath; private final Paint mPaintFooterLine; private IndicatorStyle mFooterIndicatorStyle; private final Paint mPaintFooterIndicator; @@ -95,6 +95,7 @@ public class TitlePageIndicator extends TextView implements PageIndicator, View. public TitlePageIndicator(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); super.setOnTouchListener(this); + mPath = new Path(); //Load defaults from resources final Resources res = getResources(); @@ -326,15 +327,16 @@ public class TitlePageIndicator extends TextView implements PageIndicator, View. } //Draw the footer line - mPath = new Path(); + mPath.reset(); mPath.moveTo(0, height - mFooterLineHeight); mPath.lineTo(width, height - mFooterLineHeight); mPath.close(); canvas.drawPath(mPath, mPaintFooterLine); switch (mFooterIndicatorStyle) { + default: case Triangle: - mPath = new Path(); + mPath.reset(); mPath.moveTo(halfWidth, height - mFooterLineHeight - mFooterIndicatorHeight); mPath.lineTo(halfWidth + mFooterIndicatorHeight, height - mFooterLineHeight); mPath.lineTo(halfWidth - mFooterIndicatorHeight, height - mFooterLineHeight); @@ -356,7 +358,7 @@ public class TitlePageIndicator extends TextView implements PageIndicator, View. } Rect underlineBounds = bounds.get(page); - mPath = new Path(); + mPath.reset(); mPath.moveTo(underlineBounds.left - mFooterIndicatorUnderlinePadding, height - mFooterLineHeight); mPath.lineTo(underlineBounds.right + mFooterIndicatorUnderlinePadding, height - mFooterLineHeight); mPath.lineTo(underlineBounds.right + mFooterIndicatorUnderlinePadding, height - mFooterLineHeight - mFooterIndicatorHeight);