Cleaned up some code

This commit is contained in:
2012-07-21 22:55:36 -04:00
parent c708c3dc00
commit 19b5c13206
4 changed files with 17 additions and 10 deletions

View File

@@ -2,8 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.TwentyCodes.android.LocationRinger"
android:installLocation="internalOnly"
android:versionCode="64"
android:versionName="ec647d5" >
android:versionCode="65"
android:versionName="c708c3d" >
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="16"/>

View File

@@ -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.

View File

@@ -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();
}
}

View File

@@ -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);