From 2c4d087fe7f48e31924ae1cc279adb8698eab59b Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Mon, 25 Nov 2013 22:46:13 +0100 Subject: case insensitive FS to the victory! --HG-- rename : src/de/blinkt/openvpn/fragments/SeekbarTicks.java => src/de/blinkt/openvpn/fragments/SeekBarTicks.java extra : rebase_source : 61d3c5552729bb0f68984584dc0dd53c9fcdbf9e --- src/de/blinkt/openvpn/fragments/SeekBarTicks.java | 69 ++++++++++++++++++++++ src/de/blinkt/openvpn/fragments/SeekbarTicks.java | 69 ---------------------- .../blinkt/openvpn/fragments/VPNProfileList.java | 4 ++ 3 files changed, 73 insertions(+), 69 deletions(-) create mode 100644 src/de/blinkt/openvpn/fragments/SeekBarTicks.java delete mode 100644 src/de/blinkt/openvpn/fragments/SeekbarTicks.java (limited to 'src/de/blinkt/openvpn/fragments') diff --git a/src/de/blinkt/openvpn/fragments/SeekBarTicks.java b/src/de/blinkt/openvpn/fragments/SeekBarTicks.java new file mode 100644 index 00000000..ec68e7e4 --- /dev/null +++ b/src/de/blinkt/openvpn/fragments/SeekBarTicks.java @@ -0,0 +1,69 @@ +package de.blinkt.openvpn.fragments; + +import android.content.Context; +import android.content.res.TypedArray; +import android.graphics.Canvas; +import android.graphics.Paint; +import android.graphics.drawable.Drawable; +import android.util.AttributeSet; +import android.util.TypedValue; +import android.view.ViewConfiguration; +import android.widget.SeekBar; + +public class SeekBarTicks extends SeekBar { + private Paint mTickPaint; + private float mTickHeight; + + private float tickHeightRatio = 0.6f; + + public SeekBarTicks(Context context, AttributeSet attrs) { + super (context, attrs); + + initTicks (context, attrs, android.R.attr.seekBarStyle); + } + + + public SeekBarTicks(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + + initTicks (context, attrs, defStyle); + + /*mTickHeight = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, + tickHeightDP, + ctx.getResources().getDisplayMetrics()); */ + } + + private void initTicks(Context context, AttributeSet attrs, int defStyle) { + TypedArray a = context.obtainStyledAttributes(attrs, + new int[] { android.R.attr.secondaryProgress }, defStyle, 0); + + + int tickColor = a.getColor(0, android.R.color.black); + mTickPaint = new Paint(); + mTickPaint.setColor( context.getResources().getColor(tickColor)); + a.recycle(); + } + + + @Override + protected synchronized void onDraw(Canvas canvas) { + drawTicks(canvas); + super.onDraw(canvas); + } + + private void drawTicks(Canvas canvas) { + + final int available = getWidth() - getPaddingLeft() - getPaddingRight(); + final int availableHeight = getHeight() - getPaddingBottom() - getPaddingTop(); + + int extrapadding = (int) ((availableHeight- (availableHeight * tickHeightRatio))/2); + + int tickSpacing = available / (getMax() ); + + for (int i = 1; i < getMax(); i++) { + final float x = getPaddingLeft() + i * tickSpacing; + + canvas.drawLine(x, getPaddingTop()+extrapadding, x, getHeight()-getPaddingBottom()-extrapadding, mTickPaint); + } + } +} diff --git a/src/de/blinkt/openvpn/fragments/SeekbarTicks.java b/src/de/blinkt/openvpn/fragments/SeekbarTicks.java deleted file mode 100644 index ec68e7e4..00000000 --- a/src/de/blinkt/openvpn/fragments/SeekbarTicks.java +++ /dev/null @@ -1,69 +0,0 @@ -package de.blinkt.openvpn.fragments; - -import android.content.Context; -import android.content.res.TypedArray; -import android.graphics.Canvas; -import android.graphics.Paint; -import android.graphics.drawable.Drawable; -import android.util.AttributeSet; -import android.util.TypedValue; -import android.view.ViewConfiguration; -import android.widget.SeekBar; - -public class SeekBarTicks extends SeekBar { - private Paint mTickPaint; - private float mTickHeight; - - private float tickHeightRatio = 0.6f; - - public SeekBarTicks(Context context, AttributeSet attrs) { - super (context, attrs); - - initTicks (context, attrs, android.R.attr.seekBarStyle); - } - - - public SeekBarTicks(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - - initTicks (context, attrs, defStyle); - - /*mTickHeight = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, - tickHeightDP, - ctx.getResources().getDisplayMetrics()); */ - } - - private void initTicks(Context context, AttributeSet attrs, int defStyle) { - TypedArray a = context.obtainStyledAttributes(attrs, - new int[] { android.R.attr.secondaryProgress }, defStyle, 0); - - - int tickColor = a.getColor(0, android.R.color.black); - mTickPaint = new Paint(); - mTickPaint.setColor( context.getResources().getColor(tickColor)); - a.recycle(); - } - - - @Override - protected synchronized void onDraw(Canvas canvas) { - drawTicks(canvas); - super.onDraw(canvas); - } - - private void drawTicks(Canvas canvas) { - - final int available = getWidth() - getPaddingLeft() - getPaddingRight(); - final int availableHeight = getHeight() - getPaddingBottom() - getPaddingTop(); - - int extrapadding = (int) ((availableHeight- (availableHeight * tickHeightRatio))/2); - - int tickSpacing = available / (getMax() ); - - for (int i = 1; i < getMax(); i++) { - final float x = getPaddingLeft() + i * tickSpacing; - - canvas.drawLine(x, getPaddingTop()+extrapadding, x, getHeight()-getPaddingBottom()-extrapadding, mTickPaint); - } - } -} diff --git a/src/de/blinkt/openvpn/fragments/VPNProfileList.java b/src/de/blinkt/openvpn/fragments/VPNProfileList.java index c1587ec0..76b1b5d5 100644 --- a/src/de/blinkt/openvpn/fragments/VPNProfileList.java +++ b/src/de/blinkt/openvpn/fragments/VPNProfileList.java @@ -28,6 +28,7 @@ import java.util.Collection; import java.util.Comparator; import java.util.Set; import java.util.TreeSet; +import java.util.prefs.Preferences; public class VPNProfileList extends ListFragment { @@ -219,6 +220,9 @@ public class VPNProfileList extends ListFragment { @TargetApi(Build.VERSION_CODES.KITKAT) private void startFilePicker() { + + + Intent i = new Intent(Intent.ACTION_OPEN_DOCUMENT); i.addCategory(Intent.CATEGORY_OPENABLE); i.setType("application/x-openvpn-profile"); -- cgit v1.2.3