2
2
3
3
import android .animation .Animator ;
4
4
import android .animation .AnimatorListenerAdapter ;
5
+ import android .animation .ObjectAnimator ;
5
6
import android .content .BroadcastReceiver ;
6
7
import android .content .ComponentName ;
7
8
import android .content .Context ;
@@ -114,6 +115,8 @@ public class DashboardFragment extends CarFragment {
114
115
//value displayed on graphlayout
115
116
private TextView mGraphValueLeft , mGraphValueCenter , mGraphValueRight ;
116
117
private View rootView ;
118
+ private View mDashboard_gaudes , mDashboard_consumption ;
119
+
117
120
private String androidClockFormat = "hh:mm a" ;
118
121
int dashboardNum =1 ;
119
122
private String googleGeocodeLocationStr = null ;
@@ -333,6 +336,9 @@ public void run() {
333
336
334
337
private void setupViews (View rootView ) {
335
338
//layouts/constrains:
339
+ mDashboard_gaudes = rootView .findViewById (R .id .include );
340
+ mDashboard_consumption = rootView .findViewById (R .id .include_consumption );
341
+
336
342
mConstraintClockLeft = rootView .findViewById (R .id .constraintClockLeft );
337
343
mConstraintClockCenter = rootView .findViewById (R .id .constraintClockCenter );
338
344
mConstraintClockRight = rootView .findViewById (R .id .constraintClockRight );
@@ -559,7 +565,6 @@ private void onPreferencesChangeHandler() {
559
565
mBtnNext .setVisibility (View .VISIBLE );
560
566
mBtnPrev .setVisibility (View .VISIBLE );
561
567
mtextTitleMain .setVisibility (View .VISIBLE );
562
- mtextTitleMain .setTextColor (Color .WHITE );
563
568
}
564
569
565
570
// Load this only on first run, then leave it alone
@@ -2276,9 +2281,9 @@ private void updateClock(String query, Speedometer clock, RaySpeedometer visray,
2276
2281
2277
2282
// get the speed from the clock and have the high-visibility rays move to this speed as well
2278
2283
2279
- boolean noNewData = clockValue == null ;
2284
+ boolean noNewData = clockValue == null ;
2280
2285
if (noNewData )
2281
- clockValue = oldValue ;
2286
+ clockValue = oldValue ;
2282
2287
2283
2288
2284
2289
//TODO: Updates with a non fixed period could lead to strange graphs
@@ -2289,7 +2294,7 @@ private void updateClock(String query, Speedometer clock, RaySpeedometer visray,
2289
2294
2290
2295
// don't update when there's nothing to update
2291
2296
// check if old value and new value (rounded to 1 decimal placed) are equal
2292
- if (noNewData || Math .round (clockValue * 10 ) == Math .round (oldValue * 10 )) {
2297
+ if (noNewData || Math .round (clockValue * 10 ) == Math .round (oldValue * 10 )) {
2293
2298
return ;
2294
2299
}
2295
2300
@@ -2376,39 +2381,57 @@ private void updateTitle() {
2376
2381
2377
2382
//mProximity = true;
2378
2383
if (mProximity != null && mProximity && proximityOn ) {
2384
+ ObjectAnimator animation ;
2385
+ if (dashboardNum <4 ) animation = ObjectAnimator .ofFloat (mDashboard_gaudes , "y" , 90 );
2386
+ else animation = ObjectAnimator .ofFloat (mDashboard_consumption , "y" , 90 );
2387
+
2388
+ animation .setDuration (200 );
2389
+ animation .start ();
2379
2390
mTitleClockLeft .setText (mLabelClockL );
2380
2391
mTitleClockCenter .setText (mLabelClockC );
2381
2392
mTitleClockRight .setText (mLabelClockR );
2382
2393
mBtnNext .setVisibility (View .VISIBLE );
2383
2394
mBtnPrev .setVisibility (View .VISIBLE );
2384
- // mtextTitleMain.setVisibility(View.VISIBLE);
2385
- mtextTitleMain .setTextColor (Color .WHITE );
2395
+ mtextTitleMain .setVisibility (View .VISIBLE );
2396
+ // mtextTitleMain.setTextColor(Color.WHITE);
2386
2397
mTitleConsumptionRight .setVisibility (View .VISIBLE );
2387
2398
mTitleConsumptionLeft .setVisibility (View .VISIBLE );
2388
2399
mTitleConsumptionCenter .setVisibility (View .VISIBLE );
2400
+
2401
+
2389
2402
} else if (!proximityOn ) {
2403
+ ObjectAnimator animation ;
2404
+ if (dashboardNum <4 ) animation = ObjectAnimator .ofFloat (mDashboard_gaudes , "y" , 90 );
2405
+ else animation = ObjectAnimator .ofFloat (mDashboard_consumption , "y" , 90 );
2406
+ animation .setDuration (200 );
2407
+ animation .start ();
2390
2408
mTitleClockLeft .setText ("" );
2391
2409
mTitleClockCenter .setText ("" );
2392
2410
mTitleClockRight .setText ("" );
2393
2411
mBtnNext .setVisibility (View .VISIBLE );
2394
2412
mBtnPrev .setVisibility (View .VISIBLE );
2395
- // mtextTitleMain.setVisibility(View.VISIBLE);
2396
- mtextTitleMain .setTextColor (Color .WHITE );
2413
+ mtextTitleMain .setVisibility (View .VISIBLE );
2414
+ // mtextTitleMain.setTextColor(Color.WHITE);
2397
2415
mTitleConsumptionRight .setVisibility (View .INVISIBLE );
2398
2416
mTitleConsumptionLeft .setVisibility (View .INVISIBLE );
2399
2417
mTitleConsumptionCenter .setVisibility (View .INVISIBLE );
2418
+
2400
2419
} else {
2401
2420
mTitleClockLeft .setText ("" );
2402
2421
mTitleClockCenter .setText ("" );
2403
2422
mTitleClockRight .setText ("" );
2404
2423
mBtnNext .setVisibility (View .INVISIBLE );
2405
2424
mBtnPrev .setVisibility (View .INVISIBLE );
2406
- // mtextTitleMain.setVisibility(View.VISIBLE );
2407
- mtextTitleMain .setTextColor (Color .DKGRAY );
2425
+ mtextTitleMain .setVisibility (View .INVISIBLE );
2426
+ // mtextTitleMain.setTextColor(Color.DKGRAY);
2408
2427
mTitleConsumptionRight .setVisibility (View .INVISIBLE );
2409
2428
mTitleConsumptionLeft .setVisibility (View .INVISIBLE );
2410
2429
mTitleConsumptionCenter .setVisibility (View .INVISIBLE );
2411
-
2430
+ ObjectAnimator animation ;
2431
+ if (dashboardNum <4 ) animation = ObjectAnimator .ofFloat (mDashboard_gaudes , "y" , 45 );
2432
+ else animation = ObjectAnimator .ofFloat (mDashboard_consumption , "y" , 45 );
2433
+ animation .setDuration (200 );
2434
+ animation .start ();
2412
2435
}
2413
2436
2414
2437
String currentTime = getTime ();
@@ -2420,7 +2443,6 @@ private void updateTitle() {
2420
2443
// Display location in left side of Title bar
2421
2444
if (showStreetName ) {
2422
2445
String leftTitle ="" ;
2423
- Log .v (TAG ,"SourceLocation: " +sourceLocation +"!!!" );
2424
2446
if (sourceLocation .equals ("Geocoding" )) {
2425
2447
leftTitle = googleGeocodeLocationStr ;
2426
2448
} else {
0 commit comments