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