mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-19 04:05:36 +00:00
new input for protest time (start and duration)
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/protest_duration"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="24dp"
|
||||
android:inputType="number" />
|
||||
</FrameLayout>
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
@@ -10,22 +10,57 @@
|
||||
android:id="@+id/protest_time_races_list"
|
||||
android:layout_width="400dp"
|
||||
android:layout_height="match_parent"
|
||||
android:verticalSpacing="2dp"/>
|
||||
android:verticalSpacing="2dp" />
|
||||
|
||||
<RelativeLayout
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleX="@integer/picker_scale"
|
||||
android:scaleY="@integer/picker_scale"
|
||||
android:layout_marginLeft="@dimen/default_margin_twice"
|
||||
android:paddingRight="@dimen/default_padding"
|
||||
android:paddingLeft="@dimen/default_padding">
|
||||
android:orientation="vertical">
|
||||
|
||||
<include
|
||||
android:id="@+id/protest_time_time_picker"
|
||||
layout="@layout/time_picker"
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"/>
|
||||
</RelativeLayout>
|
||||
android:layout_marginLeft="@dimen/default_margin_twice"
|
||||
android:paddingLeft="@dimen/default_padding"
|
||||
android:paddingRight="@dimen/default_padding"
|
||||
android:scaleX="@integer/picker_scale"
|
||||
android:scaleY="@integer/picker_scale">
|
||||
|
||||
<include
|
||||
android:id="@+id/protest_time_time_picker"
|
||||
layout="@layout/time_picker"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/protest_duration"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:textAppearance="?attr/textXSmall"
|
||||
tools:text="@string/protest_duration" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/change_duration"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:src="?attr/create" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/protest_end"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?attr/textXSmall"
|
||||
tools:text="@string/protest_end_time" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
@@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
@@ -27,7 +26,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:src="?attr/chevron_left_24dp"/>
|
||||
android:src="?attr/chevron_left_24dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/header_caption"
|
||||
@@ -35,7 +34,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/protest_dialog_title"
|
||||
android:textAppearance="?attr/textHeader"/>
|
||||
android:textAppearance="?attr/textHeader" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
@@ -43,7 +42,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/header_line"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="?attr/black"/>
|
||||
android:background="?attr/black" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
@@ -60,7 +59,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/thin_line"
|
||||
android:layout_alignParentTop="true"
|
||||
android:background="?attr/sap_gray"/>
|
||||
android:background="?attr/sap_gray" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/choose"
|
||||
@@ -71,7 +70,7 @@
|
||||
android:layout_marginBottom="@dimen/default_margin_half"
|
||||
android:layout_marginTop="@dimen/default_margin_half"
|
||||
android:text="@string/choose"
|
||||
android:textSize="@dimen/textSize_18"/>
|
||||
android:textSize="@dimen/textSize_18" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
@@ -93,7 +92,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="?attr/button_prev"/>
|
||||
android:src="?attr/button_prev" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/nav_next"
|
||||
@@ -101,7 +100,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="?attr/button_next"/>
|
||||
android:src="?attr/button_next" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
@@ -114,13 +113,13 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="5dp"
|
||||
tools:src="@drawable/ic_dot"/>
|
||||
tools:src="@drawable/ic_dot" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/dot_2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:src="@drawable/ic_dot"/>
|
||||
tools:src="@drawable/ic_dot" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
@@ -138,26 +137,71 @@
|
||||
android:layout_height="match_parent"
|
||||
android:verticalSpacing="2dp"
|
||||
android:visibility="gone"
|
||||
tools:visibility="gone"/>
|
||||
tools:visibility="gone" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/protest_time_time_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleX="@integer/picker_scale"
|
||||
android:scaleY="@integer/picker_scale"
|
||||
android:visibility="gone"
|
||||
tools:visibility="gone">
|
||||
tools:visibility="visible">
|
||||
|
||||
<include
|
||||
android:id="@+id/protest_time_time_picker"
|
||||
layout="@layout/time_picker"
|
||||
<RelativeLayout
|
||||
android:id="@+id/time_picker"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_gravity="center"
|
||||
android:paddingLeft="@dimen/default_padding"
|
||||
android:paddingRight="@dimen/default_padding"/>
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_centerHorizontal="true">
|
||||
|
||||
<include
|
||||
android:id="@+id/protest_time_time_picker"
|
||||
layout="@layout/time_picker"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:paddingLeft="@dimen/default_padding"
|
||||
android:paddingRight="@dimen/default_padding"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/protest_time_time_picker"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/protest_duration"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:textAppearance="?attr/textXSmall"
|
||||
tools:text="@string/protest_duration" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/change_duration"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:src="?attr/create" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/protest_end"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?attr/textXSmall"
|
||||
tools:text="@string/protest_end_time" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
</FrameLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
@@ -66,6 +66,9 @@
|
||||
<string name="protest_dialog_title">Beginn der Protestzeit</string>
|
||||
<string name="finished_dialog_title">Rennende setzen</string>
|
||||
<string name="protest_start_time">Protestzeit beginnt: %s</string>
|
||||
<string name="protest_duration">Protestdauer: %d Min</string>
|
||||
<string name="protest_end_time">Protestzeit endet: %s</string>
|
||||
<string name="protest_duration_dialog_title">Dauer in Minuten</string>
|
||||
<string name="no_pathfinder_selected">Kein Pathfinder gesetzt</string>
|
||||
<string name="set_line_opening_time">Gate Launch</string>
|
||||
<string name="no_line_opening_time_selected">Keine Zeit gesetzt</string>
|
||||
|
||||
@@ -81,6 +81,9 @@
|
||||
<string name="protest_dialog_title">Protest start time</string>
|
||||
<string name="finished_dialog_title">Set the time when the race finished</string>
|
||||
<string name="protest_start_time">Protest start time: %s</string>
|
||||
<string name="protest_duration">Protest duration: %d min</string>
|
||||
<string name="protest_end_time">Protest end time: %s</string>
|
||||
<string name="protest_duration_dialog_title">Duration in Minutes</string>
|
||||
<string name="no_pathfinder_selected">No Pathfinder selected</string>
|
||||
<string name="set_line_opening_time">Gate Launch</string>
|
||||
<string name="no_line_opening_time_selected">No time selected</string>
|
||||
|
||||
+4
@@ -479,6 +479,10 @@ public class AppPreferences {
|
||||
.getInteger(R.integer.preference_protest_time_duration_default));
|
||||
}
|
||||
|
||||
public void setProtestTimeDuration(int value) {
|
||||
helper.getEditor().putInt(context.getString(R.string.preference_protest_time_duration_key), value).commit();
|
||||
}
|
||||
|
||||
public String getTheme() {
|
||||
return helper.getString(context.getString(R.string.preference_theme_key), context.getResources().getString(R.string.preference_theme_default));
|
||||
}
|
||||
|
||||
+91
-23
@@ -5,28 +5,10 @@ import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.android.shared.util.BitmapHelper;
|
||||
import com.sap.sailing.android.shared.util.BroadcastManager;
|
||||
import com.sap.sailing.android.shared.util.ScreenHelper;
|
||||
import com.sap.sailing.android.shared.util.ViewHelper;
|
||||
import com.sap.sailing.domain.abstractlog.race.analyzing.impl.FinishedTimeFinder;
|
||||
import com.sap.sailing.domain.base.racegroup.RaceGroupSeriesFleet;
|
||||
import com.sap.sailing.domain.common.racelog.RaceLogRaceStatus;
|
||||
import com.sap.sailing.racecommittee.app.AppConstants;
|
||||
import com.sap.sailing.racecommittee.app.R;
|
||||
import com.sap.sailing.racecommittee.app.data.DataManager;
|
||||
import com.sap.sailing.racecommittee.app.data.ReadonlyDataManager;
|
||||
import com.sap.sailing.racecommittee.app.domain.ManagedRace;
|
||||
import com.sap.sailing.racecommittee.app.utils.ThemeHelper;
|
||||
import com.sap.sailing.racecommittee.app.utils.TimeUtils;
|
||||
import com.sap.sse.common.Duration;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.TimeRange;
|
||||
import com.sap.sse.common.impl.MillisecondsTimePoint;
|
||||
import com.sap.sse.common.impl.TimeRangeImpl;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.content.ContextWrapper;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
@@ -38,10 +20,34 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.TimePicker;
|
||||
|
||||
import com.sap.sailing.android.shared.util.BitmapHelper;
|
||||
import com.sap.sailing.android.shared.util.BroadcastManager;
|
||||
import com.sap.sailing.android.shared.util.ScreenHelper;
|
||||
import com.sap.sailing.android.shared.util.ViewHelper;
|
||||
import com.sap.sailing.domain.abstractlog.race.analyzing.impl.FinishedTimeFinder;
|
||||
import com.sap.sailing.domain.base.racegroup.RaceGroupSeriesFleet;
|
||||
import com.sap.sailing.domain.common.racelog.RaceLogRaceStatus;
|
||||
import com.sap.sailing.racecommittee.app.AppConstants;
|
||||
import com.sap.sailing.racecommittee.app.AppPreferences;
|
||||
import com.sap.sailing.racecommittee.app.R;
|
||||
import com.sap.sailing.racecommittee.app.data.DataManager;
|
||||
import com.sap.sailing.racecommittee.app.data.ReadonlyDataManager;
|
||||
import com.sap.sailing.racecommittee.app.domain.ManagedRace;
|
||||
import com.sap.sailing.racecommittee.app.utils.ThemeHelper;
|
||||
import com.sap.sailing.racecommittee.app.utils.TimeUtils;
|
||||
import com.sap.sse.common.Duration;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.TimeRange;
|
||||
import com.sap.sse.common.impl.MillisecondsTimePoint;
|
||||
import com.sap.sse.common.impl.TimeRangeImpl;
|
||||
|
||||
public class ProtestTimeDialogFragment extends AttachedDialogFragment implements View.OnClickListener {
|
||||
|
||||
protected final static int MOVE_DOWN = -1;
|
||||
@@ -54,9 +60,12 @@ public class ProtestTimeDialogFragment extends AttachedDialogFragment implements
|
||||
private List<ManagedRace> races;
|
||||
private ListView mRacesList;
|
||||
private TimePicker mTimePicker;
|
||||
private TextView mProtestDuration;
|
||||
private TextView mProtestEndTime;
|
||||
private View customView;
|
||||
private View mHome;
|
||||
private Button mChoose;
|
||||
private AppPreferences mPreferences;
|
||||
|
||||
public ProtestTimeDialogFragment() {
|
||||
races = new ArrayList<>();
|
||||
@@ -91,6 +100,7 @@ public class ProtestTimeDialogFragment extends AttachedDialogFragment implements
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
mPreferences = AppPreferences.on(getActivity());
|
||||
View layout = super.onCreateView(inflater, container, savedInstanceState);
|
||||
if (customView == null) {
|
||||
layout = inflater.inflate(R.layout.protest_time_fragment, container, false);
|
||||
@@ -149,6 +159,14 @@ public class ProtestTimeDialogFragment extends AttachedDialogFragment implements
|
||||
});
|
||||
}
|
||||
|
||||
mProtestDuration = ViewHelper.get(layout, R.id.protest_duration);
|
||||
mProtestEndTime = ViewHelper.get(layout, R.id.protest_end);
|
||||
View changeDuration = ViewHelper.get(layout, R.id.change_duration);
|
||||
if (changeDuration != null) {
|
||||
changeDuration.setOnClickListener(new DurationChangeListener());
|
||||
}
|
||||
updateProtestRange();
|
||||
|
||||
viewPanel(MOVE_NONE);
|
||||
}
|
||||
return layout;
|
||||
@@ -192,12 +210,20 @@ public class ProtestTimeDialogFragment extends AttachedDialogFragment implements
|
||||
}
|
||||
|
||||
private View setupView() {
|
||||
mPreferences = AppPreferences.on(getActivity());
|
||||
LayoutInflater inflater = LayoutInflater.from(getActivity());
|
||||
View view = inflater.inflate(R.layout.protest_time_dialog, null);
|
||||
mRacesList = (ListView) view.findViewById(R.id.protest_time_races_list);
|
||||
setupRacesList(mRacesList);
|
||||
mTimePicker = (TimePicker) view.findViewById(R.id.protest_time_time_picker);
|
||||
setupTimePicker(mTimePicker);
|
||||
mProtestDuration = (TextView) view.findViewById(R.id.protest_duration);
|
||||
mProtestEndTime = (TextView) view.findViewById(R.id.protest_end);
|
||||
View changeDuration = view.findViewById(R.id.change_duration);
|
||||
if (changeDuration != null) {
|
||||
changeDuration.setOnClickListener(new DurationChangeListener());
|
||||
}
|
||||
updateProtestRange();
|
||||
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
|
||||
// TODO: @Samuel -> please check, why we did this, because I can't remember
|
||||
@@ -252,6 +278,13 @@ public class ProtestTimeDialogFragment extends AttachedDialogFragment implements
|
||||
timePicker.setCurrentHour(hours);
|
||||
timePicker.setCurrentMinute(minutes);
|
||||
|
||||
timePicker.setOnTimeChangedListener(new TimePicker.OnTimeChangedListener() {
|
||||
@Override
|
||||
public void onTimeChanged(TimePicker view, int hourOfDay, int minute) {
|
||||
updateProtestRange();
|
||||
}
|
||||
});
|
||||
|
||||
ThemeHelper.setPickerColor(getActivity(), timePicker, ThemeHelper.getColor(getActivity(), R.attr.white), ThemeHelper
|
||||
.getColor(getActivity(), R.attr.sap_yellow_1));
|
||||
}
|
||||
@@ -276,7 +309,7 @@ public class ProtestTimeDialogFragment extends AttachedDialogFragment implements
|
||||
TimePoint startTime = TimeUtils.getTime(mTimePicker);
|
||||
TimePoint now = MillisecondsTimePoint.now();
|
||||
for (ManagedRace race : selectedRaces) {
|
||||
Duration duration = Duration.ONE_MINUTE.times(90);
|
||||
Duration duration = Duration.ONE_MINUTE.times(AppPreferences.on(getActivity()).getProtestTimeDuration());
|
||||
TimeRange protestTime = new TimeRangeImpl(startTime, startTime.plus(duration));
|
||||
race.getState().setProtestTime(now, protestTime);
|
||||
}
|
||||
@@ -311,7 +344,6 @@ public class ProtestTimeDialogFragment extends AttachedDialogFragment implements
|
||||
viewPanel(MOVE_UP);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void viewPanel(int direction) {
|
||||
@@ -358,6 +390,18 @@ public class ProtestTimeDialogFragment extends AttachedDialogFragment implements
|
||||
}
|
||||
}
|
||||
|
||||
private void updateProtestRange() {
|
||||
int duration = mPreferences.getProtestTimeDuration();
|
||||
if (mProtestDuration != null) {
|
||||
mProtestDuration.setText(getString(R.string.protest_duration, duration));
|
||||
}
|
||||
if (mProtestEndTime != null) {
|
||||
TimePoint startTime = TimeUtils.getTime(mTimePicker);
|
||||
TimePoint endTime = startTime.plus(Duration.ONE_MINUTE.times(duration));
|
||||
mProtestEndTime.setText(getString(R.string.protest_end_time, TimeUtils.formatTime(endTime)));
|
||||
}
|
||||
}
|
||||
|
||||
private static class ProtestTimeAdapter extends ArrayAdapter<ManagedRaceItem> {
|
||||
|
||||
public ProtestTimeAdapter(Context context, List<ManagedRace> objects) {
|
||||
@@ -365,7 +409,7 @@ public class ProtestTimeDialogFragment extends AttachedDialogFragment implements
|
||||
}
|
||||
|
||||
private static List<ManagedRaceItem> wrap(List<ManagedRace> races) {
|
||||
List<ManagedRaceItem> wrapped = new ArrayList<ManagedRaceItem>();
|
||||
List<ManagedRaceItem> wrapped = new ArrayList<>();
|
||||
for (ManagedRace race : races) {
|
||||
wrapped.add(new ManagedRaceItem(race));
|
||||
}
|
||||
@@ -389,4 +433,28 @@ public class ProtestTimeDialogFragment extends AttachedDialogFragment implements
|
||||
return String.format("%s - %s", group.getDisplayName(true), race.getRaceColumnName());
|
||||
}
|
||||
}
|
||||
|
||||
private class DurationChangeListener implements View.OnClickListener {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
FrameLayout layout = (FrameLayout) LayoutInflater.from(v.getContext()).inflate(R.layout.protest_duration, null);
|
||||
final EditText duration = (EditText) layout.findViewById(R.id.protest_duration);
|
||||
duration.setText(String.valueOf(mPreferences.getProtestTimeDuration()));
|
||||
duration.setSelection(duration.length());
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(new ContextWrapper(v.getContext()), R.style.AppTheme_AlertDialog);
|
||||
builder.setTitle(v.getContext().getString(R.string.protest_duration_dialog_title));
|
||||
builder.setView(layout);
|
||||
builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
int value = Integer.parseInt(duration.getText().toString());
|
||||
mPreferences.setProtestTimeDuration(value);
|
||||
updateProtestRange();
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(android.R.string.cancel, null);
|
||||
builder.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user