Cleaned up some code
This commit is contained in:
@@ -2,8 +2,8 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.TwentyCodes.android.LocationRinger"
|
package="com.TwentyCodes.android.LocationRinger"
|
||||||
android:installLocation="internalOnly"
|
android:installLocation="internalOnly"
|
||||||
android:versionCode="64"
|
android:versionCode="65"
|
||||||
android:versionName="ec647d5" >
|
android:versionName="c708c3d" >
|
||||||
|
|
||||||
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="16"/>
|
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="16"/>
|
||||||
|
|
||||||
|
|||||||
@@ -26,9 +26,7 @@ import android.os.Bundle;
|
|||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
|
|
||||||
import com.TwentyCodes.android.LocationRinger.R;
|
import com.TwentyCodes.android.LocationRinger.R;
|
||||||
import com.TwentyCodes.android.LocationRinger.debug.Debug;
|
|
||||||
import com.TwentyCodes.android.LocationRinger.services.LocationService;
|
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.
|
* This Activity actually handles two stages of a launcher shortcut's life cycle.
|
||||||
|
|||||||
@@ -79,8 +79,10 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
|||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
*/
|
*/
|
||||||
private static void copyFile(final File src, final File dst) throws IOException {
|
private static void copyFile(final File src, final File dst) throws IOException {
|
||||||
final FileChannel inChannel = new FileInputStream(src).getChannel();
|
final FileInputStream in = new FileInputStream(src);
|
||||||
final FileChannel outChannel = new FileOutputStream(dst).getChannel();
|
final FileOutputStream out = new FileOutputStream(dst);
|
||||||
|
final FileChannel inChannel = in.getChannel();
|
||||||
|
final FileChannel outChannel = out.getChannel();
|
||||||
try {
|
try {
|
||||||
inChannel.transferTo(0, inChannel.size(), outChannel);
|
inChannel.transferTo(0, inChannel.size(), outChannel);
|
||||||
} finally {
|
} finally {
|
||||||
@@ -88,6 +90,11 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
|||||||
inChannel.close();
|
inChannel.close();
|
||||||
if (outChannel != null)
|
if (outChannel != null)
|
||||||
outChannel.close();
|
outChannel.close();
|
||||||
|
if(in != null)
|
||||||
|
in.close();
|
||||||
|
if(out != null)
|
||||||
|
out.close();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ public class TitlePageIndicator extends TextView implements PageIndicator, View.
|
|||||||
private int mCurrentOffset;
|
private int mCurrentOffset;
|
||||||
private final Paint mPaintText;
|
private final Paint mPaintText;
|
||||||
private final Paint mPaintSelected;
|
private final Paint mPaintSelected;
|
||||||
private Path mPath;
|
private final Path mPath;
|
||||||
private final Paint mPaintFooterLine;
|
private final Paint mPaintFooterLine;
|
||||||
private IndicatorStyle mFooterIndicatorStyle;
|
private IndicatorStyle mFooterIndicatorStyle;
|
||||||
private final Paint mPaintFooterIndicator;
|
private final Paint mPaintFooterIndicator;
|
||||||
@@ -95,6 +95,7 @@ public class TitlePageIndicator extends TextView implements PageIndicator, View.
|
|||||||
public TitlePageIndicator(Context context, AttributeSet attrs, int defStyle) {
|
public TitlePageIndicator(Context context, AttributeSet attrs, int defStyle) {
|
||||||
super(context, attrs, defStyle);
|
super(context, attrs, defStyle);
|
||||||
super.setOnTouchListener(this);
|
super.setOnTouchListener(this);
|
||||||
|
mPath = new Path();
|
||||||
|
|
||||||
//Load defaults from resources
|
//Load defaults from resources
|
||||||
final Resources res = getResources();
|
final Resources res = getResources();
|
||||||
@@ -326,15 +327,16 @@ public class TitlePageIndicator extends TextView implements PageIndicator, View.
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Draw the footer line
|
//Draw the footer line
|
||||||
mPath = new Path();
|
mPath.reset();
|
||||||
mPath.moveTo(0, height - mFooterLineHeight);
|
mPath.moveTo(0, height - mFooterLineHeight);
|
||||||
mPath.lineTo(width, height - mFooterLineHeight);
|
mPath.lineTo(width, height - mFooterLineHeight);
|
||||||
mPath.close();
|
mPath.close();
|
||||||
canvas.drawPath(mPath, mPaintFooterLine);
|
canvas.drawPath(mPath, mPaintFooterLine);
|
||||||
|
|
||||||
switch (mFooterIndicatorStyle) {
|
switch (mFooterIndicatorStyle) {
|
||||||
|
default:
|
||||||
case Triangle:
|
case Triangle:
|
||||||
mPath = new Path();
|
mPath.reset();
|
||||||
mPath.moveTo(halfWidth, height - mFooterLineHeight - mFooterIndicatorHeight);
|
mPath.moveTo(halfWidth, height - mFooterLineHeight - mFooterIndicatorHeight);
|
||||||
mPath.lineTo(halfWidth + mFooterIndicatorHeight, height - mFooterLineHeight);
|
mPath.lineTo(halfWidth + mFooterIndicatorHeight, height - mFooterLineHeight);
|
||||||
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);
|
Rect underlineBounds = bounds.get(page);
|
||||||
mPath = new Path();
|
mPath.reset();
|
||||||
mPath.moveTo(underlineBounds.left - mFooterIndicatorUnderlinePadding, height - mFooterLineHeight);
|
mPath.moveTo(underlineBounds.left - mFooterIndicatorUnderlinePadding, height - mFooterLineHeight);
|
||||||
mPath.lineTo(underlineBounds.right + mFooterIndicatorUnderlinePadding, height - mFooterLineHeight);
|
mPath.lineTo(underlineBounds.right + mFooterIndicatorUnderlinePadding, height - mFooterLineHeight);
|
||||||
mPath.lineTo(underlineBounds.right + mFooterIndicatorUnderlinePadding, height - mFooterLineHeight - mFooterIndicatorHeight);
|
mPath.lineTo(underlineBounds.right + mFooterIndicatorUnderlinePadding, height - mFooterLineHeight - mFooterIndicatorHeight);
|
||||||
|
|||||||
Reference in New Issue
Block a user