make progressbar disappear when only timeThen is given
This commit is contained in:
		| @@ -20,9 +20,12 @@ | ||||
| 		android:textColor="@android:color/white" android:text="@string/days" | ||||
| 		android:paddingTop="0dp" android:textSize="4pt" /> | ||||
|  | ||||
| 	<ProgressBar style="@android:style/Widget.ProgressBar.Horizontal" | ||||
| 		android:id="@+id/progress" android:layout_width="wrap_content" | ||||
| 		android:layout_height="10dp" android:paddingTop="6dp" /> | ||||
| 	<FrameLayout android:id="@+id/progressBarFrame" | ||||
| 		android:layout_width="wrap_content" android:layout_height="wrap_content"> | ||||
| 		<ProgressBar style="@android:style/Widget.ProgressBar.Horizontal" | ||||
| 			android:id="@+id/progress" android:layout_width="wrap_content" | ||||
| 			android:layout_height="10dp" android:paddingTop="6dp" /> | ||||
| 	</FrameLayout> | ||||
|  | ||||
| 	<TextView android:id="@+id/status" android:layout_width="fill_parent" | ||||
| 		android:layout_height="wrap_content" android:gravity="center" | ||||
|   | ||||
| @@ -19,6 +19,7 @@ import android.content.Intent; | ||||
| import android.content.SharedPreferences; | ||||
| import android.os.Bundle; | ||||
| import android.preference.PreferenceManager; | ||||
| import android.view.View; | ||||
| import android.widget.RemoteViews; | ||||
| import de.schatenseite.android.datepreference.DatePreference; | ||||
|  | ||||
| @@ -116,17 +117,18 @@ public class WaldemarWidget extends AppWidgetProvider { | ||||
| 	     | ||||
| 	    switch (mode) { | ||||
| 	    case 1: // only timeThen | ||||
| 			// TODO: switch off progressbar | ||||
| 			// doesn't work on progressbars: http://stackoverflow.com/questions/2415782/progressbar-in-an-appwidget | ||||
| 			//remoteViews.setViewVisibility(R.id.progress, View.GONE); | ||||
| 			remoteViews.setViewVisibility(R.id.progressBarFrame, View.GONE); | ||||
| 			break; | ||||
| 	    case 2: // timeStart and timeThen | ||||
| 			duration = (int)Math.round((double)(timeThen - timeStart) / MILLISECONDS_PER_DAY); | ||||
| 			remoteViews.setViewVisibility(R.id.progressBarFrame, View.VISIBLE); | ||||
| 			break; | ||||
| 	    case 3: // duration and timeThen | ||||
| 			remoteViews.setViewVisibility(R.id.progressBarFrame, View.VISIBLE); | ||||
| 			break; | ||||
| 	    case 4: // timeStart and duration | ||||
| 			timeThen = timeStart + duration * (long)MILLISECONDS_PER_DAY; | ||||
| 			remoteViews.setViewVisibility(R.id.progressBarFrame, View.VISIBLE); | ||||
| 			break; | ||||
| 	    } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user