Commit c0f267f8 authored by Trevor Slocum's avatar Trevor Slocum

Add timer position setting

Resolves #71
parent e179b93f
......@@ -3,6 +3,7 @@
- Add presets to tutorial
- Add session volume preview
- Add custom vibration patterns
- Add timer position setting
- Resolve possible crash when waking device
- Resolve duration not being preselected when editing
- Remove usage of Google Play Services (was previously used in releases on Google Play and Amazon)
......
......@@ -18,6 +18,7 @@ import android.os.Handler;
import android.os.Looper;
import android.text.InputType;
import android.util.Log;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
......@@ -354,10 +355,10 @@ public class MainActivity extends Activity implements OnShowcaseEventListener {
btnPreset3.setOnLongClickListener(presetListener);
updateVisibleViews(false);
if (getMeditationAssistant().getEditingDuration()) {
changeDuration(null);
}
updateMeditate(false, false);
if (getMeditationAssistant().getPrefs().getBoolean("pref_autosignin", false) && !getMeditationAssistant().getMediNETKey().equals("")) {
getMeditationAssistant().connectOnce();
......@@ -773,7 +774,7 @@ public class MainActivity extends Activity implements OnShowcaseEventListener {
public void updateVisibleViews(boolean fadeViews) {
RadioGroup radgMainTimerMode = findViewById(R.id.radgMainTimerMode);
RelativeLayout layLowerViews = findViewById(R.id.layLowerViews);
LinearLayout layLowerViews = findViewById(R.id.layLowerViews);
LinearLayout layLowerViewsEditing = findViewById(R.id.layLowerViewsEditing);
if (getMeditationAssistant().getEditingDuration()) {
......@@ -1628,6 +1629,20 @@ public class MainActivity extends Activity implements OnShowcaseEventListener {
usetimepicker = getMeditationAssistant().getPrefs().getBoolean("pref_usetimepicker", false);
TextView txtDurationSeconds = findViewById(R.id.txtDurationSeconds);
if (getMeditationAssistant().getPrefs().getBoolean("pref_display_seconds", true)) {
txtDurationSeconds.setVisibility(View.VISIBLE);
} else {
txtDurationSeconds.setVisibility(View.GONE);
}
LinearLayout layTimer = findViewById(R.id.layTimer);
if (getMeditationAssistant().getPrefs().getString("pref_timer_position", "").equals("center")) {
layTimer.setGravity(Gravity.CENTER_VERTICAL);
} else {
layTimer.setGravity(Gravity.TOP);
}
refreshAll();
if (getMeditationAssistant().asktorate) {
......
......@@ -163,7 +163,7 @@ public class SettingsActivity extends PreferenceActivity {
preference.setSummary(
index >= 0
? listPreference.getEntries()[index]
: (preference instanceof ListPreferenceSound ? "Gong" : getString(R.string.disabled))
: (preference instanceof ListPreferenceSound ? "Gong" : (preference.getKey().equals("pref_timer_position") ? getString(R.string.top) : getString(R.string.disabled)))
); // TODO: Don't hardcode sound names
if (listPreference.getKey().equals("pref_theme")) {
......@@ -688,6 +688,7 @@ public class SettingsActivity extends PreferenceActivity {
bindPreferenceSummaryToValue(preferenceFragment == null ? findPreference("pref_screencontrol") : preferenceFragment.findPreference("pref_screencontrol"));
bindPreferenceSummaryToValue(preferenceFragment == null ? findPreference("pref_full_screen") : preferenceFragment.findPreference("pref_full_screen"));
bindPreferenceSummaryToValue(preferenceFragment == null ? findPreference("pref_text_size") : preferenceFragment.findPreference("pref_text_size"));
bindPreferenceSummaryToValue(preferenceFragment == null ? findPreference("pref_timer_position") : preferenceFragment.findPreference("pref_timer_position"));
bindPreferenceSummaryToValue(preferenceFragment == null ? findPreference("pref_autosave") : preferenceFragment.findPreference("pref_autosave"));
}
if (pref_type.equals("all") || pref_type.equals("progress")) {
......
......@@ -11,6 +11,14 @@
<item>@string/sessionDeleteLocally</item>
<item>@string/sessionDeleteMediNET</item>
</string-array>
<string-array name="timer_positions_values">
<item></item>
<item>center</item>
</string-array>
<string-array name="timer_positions">
<item>@string/top</item>
<item>@string/center</item>
</string-array>
<string-array name="text_sizes_values">
<item>tiny</item>
<item>small</item>
......
......@@ -228,7 +228,10 @@
<string name="uploadsessions">Upload sessions</string>
<string name="uploadsessions_summary">Upload local sessions</string>
<string name="miscellaneous">Miscellaneous</string>
<string name="pref_text_size">Timer text size</string>
<string name="timerPosition">Timer position</string>
<string name="top">Top</string>
<string name="center">Center</string>
<string name="pref_text_size">Timer size</string>
<string name="tiny">Tiny</string>
<string name="small">Small</string>
<string name="normal">Normal</string>
......
......@@ -20,20 +20,20 @@
android:title="@string/pref_usetimepicker"/>
<ListPreference
android:defaultValue="dim"
android:dialogIcon="?attr/actionIconBrightnessLow"
android:entries="@array/screencontrol"
android:entryValues="@array/screencontrol_values"
android:key="pref_screencontrol"
android:title="@string/pref_screencontrol"/>
android:defaultValue=""
android:entries="@array/autosave_labels"
android:entryValues="@array/autosave_values"
android:key="pref_autosave"
android:summary=""
android:title="@string/pref_autosave"/>
<ListPreference
android:defaultValue=""
android:dialogIcon="?attr/actionIconFullScreen"
android:entries="@array/full_screen"
android:entryValues="@array/full_screen_values"
android:key="pref_full_screen"
android:title="@string/pref_full_screen"/>
android:entries="@array/timer_positions"
android:entryValues="@array/timer_positions_values"
android:key="pref_timer_position"
android:summary=""
android:title="@string/timerPosition"/>
<ListPreference
android:defaultValue="normal"
......@@ -43,12 +43,20 @@
android:summary=""
android:title="@string/pref_text_size"/>
<ListPreference
android:defaultValue="dim"
android:dialogIcon="?attr/actionIconBrightnessLow"
android:entries="@array/screencontrol"
android:entryValues="@array/screencontrol_values"
android:key="pref_screencontrol"
android:title="@string/pref_screencontrol"/>
<ListPreference
android:defaultValue=""
android:entries="@array/autosave_labels"
android:entryValues="@array/autosave_values"
android:key="pref_autosave"
android:summary=""
android:title="@string/pref_autosave"/>
android:dialogIcon="?attr/actionIconFullScreen"
android:entries="@array/full_screen"
android:entryValues="@array/full_screen_values"
android:key="pref_full_screen"
android:title="@string/pref_full_screen"/>
</PreferenceScreen>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment