summaryrefslogtreecommitdiffstats
path: root/fmapp2/src/com
diff options
context:
space:
mode:
authorDanesh M <daneshm90@gmail.com>2014-11-14 11:05:18 -0800
committerMatt Wagantall <mwagantall@cyngn.com>2016-02-19 14:07:43 -0800
commit8a566c1980473693dd216b52f29a0836c0f0420a (patch)
tree0eafc3bc4e9c04e2df0b08cc26faf2c63c263527 /fmapp2/src/com
parentd26b556581de0221f81add0d3ef074b9c6e872cb (diff)
downloadandroid_hardware_qcom_fm-8a566c1980473693dd216b52f29a0836c0f0420a.tar.gz
android_hardware_qcom_fm-8a566c1980473693dd216b52f29a0836c0f0420a.tar.bz2
android_hardware_qcom_fm-8a566c1980473693dd216b52f29a0836c0f0420a.zip
FMRadio : Re-vamp UI
Change-Id: Ib9cb3d5663f9eec92922a3eea7d605a2bf3b538c
Diffstat (limited to 'fmapp2/src/com')
-rw-r--r--fmapp2/src/com/caf/fmradio/FMRadio.java45
-rw-r--r--fmapp2/src/com/caf/fmradio/HorizontalNumberPicker.java67
2 files changed, 70 insertions, 42 deletions
diff --git a/fmapp2/src/com/caf/fmradio/FMRadio.java b/fmapp2/src/com/caf/fmradio/FMRadio.java
index 7de7562..181195f 100644
--- a/fmapp2/src/com/caf/fmradio/FMRadio.java
+++ b/fmapp2/src/com/caf/fmradio/FMRadio.java
@@ -28,6 +28,7 @@
package com.caf.fmradio;
+import android.app.ActionBar;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
@@ -85,9 +86,9 @@ import java.util.ArrayList;
import com.caf.utils.FrequencyPicker;
import com.caf.utils.FrequencyPickerDialog;
+
import android.content.ServiceConnection;
import android.media.MediaRecorder;
-
import qcom.fmradio.FmConfig;
import android.os.ServiceManager;
@@ -97,6 +98,7 @@ import com.caf.fmradio.HorizontalNumberPicker.Scale;
import android.content.SharedPreferences;
import android.graphics.Color;
+import android.graphics.drawable.ColorDrawable;
public class FMRadio extends Activity
{
@@ -287,6 +289,17 @@ public class FMRadio extends Activity
mCommandActive = CMD_NONE;
mCommandFailed = CMD_NONE;
+ getWindow().setBackgroundDrawableResource(R.color.background_color);
+
+ // Set up your ActionBar
+ final ActionBar actionBar = getActionBar();
+ actionBar.setDisplayShowHomeEnabled(false);
+ actionBar.setDisplayShowTitleEnabled(false);
+ actionBar.setDisplayShowCustomEnabled(true);
+ actionBar.setCustomView(R.layout.action_bar);
+
+ ((TextView) findViewById(R.id.title)).setText(R.string.app_name);
+
Log.d(LOGTAG, "onCreate - Height : "+ getWindowManager().getDefaultDisplay().getHeight()
+ " - Width : "+ getWindowManager().getDefaultDisplay().getWidth());
@@ -1482,7 +1495,7 @@ public class FMRadio extends Activity
showDialog(DIALOG_PRESET_OPTIONS);
}else {
addToPresets();
- view.startAnimation(mAnimation);
+ //view.startAnimation(mAnimation);
}
return true;
}
@@ -1809,7 +1822,7 @@ public class FMRadio extends Activity
int durationInMins = FmSharedPreferences.getRecordDuration();
Log.e(LOGTAG, " Fected duration:" + durationInMins );
initiateRecordDurationTimer( durationInMins );
- setRecordingStopImage();
+ //setRecordingStopImage();
invalidateOptionsMenu();
}
@@ -1821,7 +1834,7 @@ public class FMRadio extends Activity
}
if(null != mRecordingMsgTV) {
mRecordingMsgTV.setText("");
- setRecordingStartImage();
+ //setRecordingStartImage();
}
if (mService != null) {
try {
@@ -1931,9 +1944,9 @@ public class FMRadio extends Activity
mRecordingMsgTV.setText("");
}
if(isRecording()) {
- setRecordingStopImage();
+ //setRecordingStopImage();
}else {
- setRecordingStartImage();
+ //setRecordingStartImage();
}
for (int nButton = 0; nButton < MAX_PRESETS_PER_PAGE; nButton++) {
if (mPresetButtons[nButton] != null) {
@@ -1954,12 +1967,12 @@ public class FMRadio extends Activity
}
}
if (mForwardButton != null) {
- mForwardButton.setVisibility(((bEnable == true) ? View.VISIBLE
- : View.INVISIBLE));
+ //mForwardButton.setVisibility(((bEnable == true) ? View.VISIBLE
+ // : View.INVISIBLE));
}
if (mBackButton != null) {
- mBackButton.setVisibility(((bEnable == true) ? View.VISIBLE
- : View.INVISIBLE));
+ //mBackButton.setVisibility(((bEnable == true) ? View.VISIBLE
+ // : View.INVISIBLE));
}
if (mTuneStationFrequencyTV != null) {
mTuneStationFrequencyTV.setVisibility(((bEnable == true) ? View.VISIBLE
@@ -1991,11 +2004,11 @@ public class FMRadio extends Activity
}
if(mERadioTextTV != null) {
mERadioTextTV.setVisibility(((bEnable == true) ? View.VISIBLE
- : View.INVISIBLE));
+ : View.GONE));
}
if (mProgramServiceTV != null) {
- mProgramServiceTV.setVisibility(((bEnable == true) ? View.VISIBLE
- : View.INVISIBLE));
+// mProgramServiceTV.setVisibility(((bEnable == true) ? View.VISIBLE
+// : View.INVISIBLE));
}
if (!isAntennaAvailable()) {
@@ -2034,8 +2047,8 @@ public class FMRadio extends Activity
}
if (mStereoTV != null) {
- mStereoTV.setVisibility(((bEnable == true) ? View.VISIBLE
- : View.INVISIBLE));
+ //mStereoTV.setVisibility(((bEnable == true) ? View.VISIBLE
+ // : View.INVISIBLE));
}
for (int nButton = 0; nButton < MAX_PRESETS_PER_PAGE; nButton++) {
if (mPresetButtons[nButton] != null) {
@@ -2132,7 +2145,7 @@ public class FMRadio extends Activity
private void updateStationInfoToUI() {
double frequency = mTunedStation.getFrequency() / 1000.0;
- mTuneStationFrequencyTV.setText("" + frequency + "MHz");
+ mTuneStationFrequencyTV.setText("" + frequency);
if ((mPicker != null) && mUpdatePickerValue) {
mPicker.setValue(((mTunedStation.getFrequency() - mPrefs.getLowerLimit())
/ mPrefs.getFrequencyStepSize()));
diff --git a/fmapp2/src/com/caf/fmradio/HorizontalNumberPicker.java b/fmapp2/src/com/caf/fmradio/HorizontalNumberPicker.java
index 505097f..53ff9ce 100644
--- a/fmapp2/src/com/caf/fmradio/HorizontalNumberPicker.java
+++ b/fmapp2/src/com/caf/fmradio/HorizontalNumberPicker.java
@@ -30,6 +30,7 @@ import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
+import android.graphics.Typeface;
import android.graphics.Paint.Align;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
@@ -92,7 +93,7 @@ public class HorizontalNumberPicker extends LinearLayout {
/**
* The coefficient by which to adjust (divide) the max fling velocity.
*/
- private static final int SELECTOR_MAX_FLING_VELOCITY_ADJUSTMENT = 8;
+ private static final int SELECTOR_MAX_FLING_VELOCITY_ADJUSTMENT = 4;
/**
* The the duration for adjusting the selector wheel.
@@ -247,7 +248,7 @@ public class HorizontalNumberPicker extends LinearLayout {
/**
* The height of the text.
*/
- private int mTextSize = 20;
+ private int mTextSize = 60;
/**
* The height of the gap between text elements if the selector wheel.
*/
@@ -346,7 +347,7 @@ public class HorizontalNumberPicker extends LinearLayout {
/**
* The colors alpha of selector text.
*/
- private static final int SELECTOR_TEXT_ALPHA_TRANSPARENT_NONE = 255;
+ private static final int SELECTOR_TEXT_ALPHA_TRANSPARENT_NONE = 76;
private static float mDensity = 1.0f;
private static final float LDPI = 0.75f;
@@ -354,9 +355,9 @@ public class HorizontalNumberPicker extends LinearLayout {
private static final float HDPI = 1.5f;
private static final float XHDPI = 2.0f;
- private float mScaleWidth = 2;
+ private float mScaleWidth = 5;
private float mScaleLengthShort = 10;
- private float mScaleLengthLong = 20;
+ private float mScaleLengthLong = 40;
private float mGapBetweenNumAndScale = 18;
private float mHdpiPositionAdjust = 18;
@@ -899,19 +900,19 @@ public class HorizontalNumberPicker extends LinearLayout {
setSelectorWheelState(SELECTOR_WHEEL_STATE_SMALL);
return true;
}
-// VelocityTracker velocityTracker = mVelocityTracker;
-// velocityTracker.computeCurrentVelocity(1000, mMaximumFlingVelocity);
-// int initialVelocity=0;
-// if(!mHorizontal){
-// initialVelocity = (int) velocityTracker.getYVelocity();
-// }else{
-// initialVelocity = (int)velocityTracker.getXVelocity();
-// }
-// if (Math.abs(initialVelocity) > mMinimumFlingVelocity) {
-// // fling after up
-// fling(initialVelocity);
-// onScrollStateChange(OnScrollListener.SCROLL_STATE_FLING);
-// } else {
+ VelocityTracker velocityTracker = mVelocityTracker;
+ velocityTracker.computeCurrentVelocity(1000, mMaximumFlingVelocity);
+ int initialVelocity=0;
+ if(!mHorizontal){
+ initialVelocity = (int) velocityTracker.getYVelocity();
+ }else{
+ initialVelocity = (int)velocityTracker.getXVelocity();
+ }
+ if (Math.abs(initialVelocity) > mMinimumFlingVelocity) {
+ // fling after up
+ fling(initialVelocity);
+ onScrollStateChange(OnScrollListener.SCROLL_STATE_FLING);
+ } else {
if (mAdjustScrollerOnUpEvent) {
if (mFlingScroller.isFinished()
&& mAdjustScroller.isFinished()) {
@@ -920,7 +921,7 @@ public class HorizontalNumberPicker extends LinearLayout {
} else {
postAdjustScrollerCommand(SHOW_INPUT_CONTROLS_DELAY_MILLIS);
}
-// }
+ }
mVelocityTracker.recycle();
mVelocityTracker = null;
break;
@@ -1492,13 +1493,13 @@ public class HorizontalNumberPicker extends LinearLayout {
.get(selectorIndex);
if(i - mSelectorMiddleItemIndex > 0 ){
mSelectorWheelPaint.setColor(Color.WHITE);
- mSelectorWheelPaint.setAlpha((2*mSelectorMiddleItemIndex - i) * SELECTOR_TEXT_ALPHA_TRANSPARENT_NONE / mSelectorMiddleItemIndex);
+ mSelectorWheelPaint.setAlpha(SELECTOR_TEXT_ALPHA_TRANSPARENT_NONE);
}else if(i - mSelectorMiddleItemIndex < 0 ){
mSelectorWheelPaint.setColor(Color.WHITE);
- mSelectorWheelPaint.setAlpha(i * SELECTOR_TEXT_ALPHA_TRANSPARENT_NONE / mSelectorMiddleItemIndex);
- }else{
- mSelectorWheelPaint.setColor(Color.RED);
mSelectorWheelPaint.setAlpha(SELECTOR_TEXT_ALPHA_TRANSPARENT_NONE);
+ }else{
+ mSelectorWheelPaint.setColor(Color.WHITE);
+ mSelectorWheelPaint.setAlpha(0);
}
try {
fNumber = Float.valueOf(scrollSelectorValue).floatValue();
@@ -1516,13 +1517,27 @@ public class HorizontalNumberPicker extends LinearLayout {
bShowNumber = true;
fScaleLength = mScaleLengthLong * mDensity;
}
+ } else {
+ fWidthOfScale-=2;
}
if(bShowNumber){
- canvas.drawText(scrollSelectorValue, x, y, mSelectorWheelPaint);
+ float originalWidth = mSelectorWheelPaint.getStrokeWidth();
+ int originalAlpha = mSelectorWheelPaint.getAlpha();
+ mSelectorWheelPaint.setTypeface(Typeface.DEFAULT_BOLD);
+ mSelectorWheelPaint.setStrokeWidth(2);
+ mSelectorWheelPaint.setStyle(Paint.Style.FILL_AND_STROKE);
+ mSelectorWheelPaint.setAlpha(SELECTOR_TEXT_ALPHA_TRANSPARENT_NONE);
+ canvas.drawText(scrollSelectorValue, x, mTextSize * 2, mSelectorWheelPaint);
+ mSelectorWheelPaint.setStyle(Paint.Style.FILL);
+ mSelectorWheelPaint.setStrokeWidth(originalWidth);
+ mSelectorWheelPaint.setAlpha(originalAlpha);
}
- canvas.drawRect(x, y+fGapBetweenNumAndScale, x+fWidthOfScale, y + fGapBetweenNumAndScale + fScaleLength , mSelectorWheelPaint);
-// }
+ float left = x;
+ float top = (mBottom - mTop) - fGapBetweenNumAndScale - fScaleLength;
+ float right = x+fWidthOfScale;
+ float bottom = (mBottom - mTop);
+ canvas.drawRect(left, top, right, bottom, mSelectorWheelPaint);
if (mHorizontal) {
x += mSelectorElementWidth;
} else {