adding an SOS button at the main screen
This commit is contained in:
parent
ec05fd4ffd
commit
08156c4cd5
|
@ -49,6 +49,8 @@ class MainActivity : SimpleActivity() {
|
||||||
mCameraImpl!!.toggleFlashlight()
|
mCameraImpl!!.toggleFlashlight()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sos_btn.setOnClickListener {}
|
||||||
|
|
||||||
setupStroboscope()
|
setupStroboscope()
|
||||||
checkAppOnSDCard()
|
checkAppOnSDCard()
|
||||||
}
|
}
|
||||||
|
@ -58,9 +60,13 @@ class MainActivity : SimpleActivity() {
|
||||||
mCameraImpl!!.handleCameraSetup()
|
mCameraImpl!!.handleCameraSetup()
|
||||||
checkState(MyCameraImpl.isFlashlightOn)
|
checkState(MyCameraImpl.isFlashlightOn)
|
||||||
|
|
||||||
changeIconColor(config.backgroundColor.getContrastColor(), bright_display_btn)
|
val contrastColor = config.backgroundColor.getContrastColor()
|
||||||
|
changeIconColor(contrastColor, bright_display_btn)
|
||||||
bright_display_btn.beVisibleIf(config.brightDisplay)
|
bright_display_btn.beVisibleIf(config.brightDisplay)
|
||||||
|
sos_btn.beVisibleIf(config.sos)
|
||||||
|
sos_btn.setTextColor(contrastColor)
|
||||||
stroboscope_btn.beVisibleIf(config.stroboscope)
|
stroboscope_btn.beVisibleIf(config.stroboscope)
|
||||||
|
|
||||||
if (!config.stroboscope) {
|
if (!config.stroboscope) {
|
||||||
mCameraImpl!!.stopStroboscope()
|
mCameraImpl!!.stopStroboscope()
|
||||||
stroboscope_bar.beInvisible()
|
stroboscope_bar.beInvisible()
|
||||||
|
@ -68,7 +74,7 @@ class MainActivity : SimpleActivity() {
|
||||||
|
|
||||||
updateTextColors(main_holder)
|
updateTextColors(main_holder)
|
||||||
if (stroboscope_bar.isInvisible()) {
|
if (stroboscope_bar.isInvisible()) {
|
||||||
changeIconColor(config.backgroundColor.getContrastColor(), stroboscope_btn)
|
changeIconColor(contrastColor, stroboscope_btn)
|
||||||
}
|
}
|
||||||
|
|
||||||
requestedOrientation = if (config.forcePortraitMode) ActivityInfo.SCREEN_ORIENTATION_PORTRAIT else ActivityInfo.SCREEN_ORIENTATION_SENSOR
|
requestedOrientation = if (config.forcePortraitMode) ActivityInfo.SCREEN_ORIENTATION_PORTRAIT else ActivityInfo.SCREEN_ORIENTATION_SENSOR
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
android:id="@+id/flashlight_btn"
|
android:id="@+id/flashlight_btn"
|
||||||
android:layout_width="@dimen/main_button_size"
|
android:layout_width="@dimen/main_button_size"
|
||||||
android:layout_height="@dimen/main_button_size"
|
android:layout_height="@dimen/main_button_size"
|
||||||
android:layout_marginBottom="@dimen/activity_margin"
|
android:layout_marginTop="@dimen/normal_margin"
|
||||||
android:layout_marginTop="@dimen/activity_margin"
|
android:layout_marginBottom="@dimen/normal_margin"
|
||||||
android:background="@drawable/circles_big"
|
android:background="@drawable/circles_big"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/bright_display_btn"
|
app:layout_constraintBottom_toTopOf="@+id/bright_display_btn"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
@ -29,36 +29,53 @@
|
||||||
android:id="@+id/bright_display_btn"
|
android:id="@+id/bright_display_btn"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="@dimen/activity_margin"
|
android:layout_marginTop="@dimen/normal_margin"
|
||||||
android:layout_marginTop="@dimen/buttons_margin"
|
android:layout_marginBottom="@dimen/normal_margin"
|
||||||
android:background="@drawable/ic_bright_display"
|
android:background="@drawable/ic_bright_display"
|
||||||
android:padding="@dimen/activity_margin"
|
android:padding="@dimen/activity_margin"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/stroboscope_btn"
|
app:layout_constraintBottom_toTopOf="@+id/sos_btn"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintHorizontal_bias="0.5"
|
app:layout_constraintHorizontal_bias="0.5"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/flashlight_btn"/>
|
app:layout_constraintTop_toBottomOf="@+id/flashlight_btn"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/sos_btn"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/normal_margin"
|
||||||
|
android:layout_marginBottom="@dimen/normal_margin"
|
||||||
|
android:background="?attr/selectableItemBackgroundBorderless"
|
||||||
|
android:padding="@dimen/activity_margin"
|
||||||
|
android:text="SOS"
|
||||||
|
android:textSize="@dimen/sos_text_size"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/stroboscope_btn"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.5"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/bright_display_btn"/>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/stroboscope_btn"
|
android:id="@+id/stroboscope_btn"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="@dimen/buttons_margin"
|
android:layout_marginTop="@dimen/normal_margin"
|
||||||
android:background="@drawable/ic_stroboscope"
|
android:background="@drawable/ic_stroboscope"
|
||||||
android:padding="@dimen/activity_margin"
|
android:padding="@dimen/activity_margin"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/stroboscope_bar"
|
app:layout_constraintBottom_toTopOf="@+id/stroboscope_bar"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintHorizontal_bias="0.5"
|
app:layout_constraintHorizontal_bias="0.5"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/bright_display_btn"/>
|
app:layout_constraintTop_toBottomOf="@+id/sos_btn"/>
|
||||||
|
|
||||||
<com.simplemobiletools.commons.views.MySeekBar
|
<com.simplemobiletools.commons.views.MySeekBar
|
||||||
android:id="@+id/stroboscope_bar"
|
android:id="@+id/stroboscope_bar"
|
||||||
android:layout_width="@dimen/seekbar_width"
|
android:layout_width="@dimen/seekbar_width"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="@dimen/activity_margin"
|
android:layout_margin="@dimen/activity_margin"
|
||||||
android:paddingBottom="@dimen/medium_margin"
|
|
||||||
android:paddingTop="@dimen/medium_margin"
|
android:paddingTop="@dimen/medium_margin"
|
||||||
|
android:paddingBottom="@dimen/medium_margin"
|
||||||
android:visibility="invisible"
|
android:visibility="invisible"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
|
|
@ -144,29 +144,6 @@
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:id="@+id/settings_stroboscope_holder"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="@dimen/medium_margin"
|
|
||||||
android:background="?attr/selectableItemBackground"
|
|
||||||
android:paddingLeft="@dimen/normal_margin"
|
|
||||||
android:paddingTop="@dimen/activity_margin"
|
|
||||||
android:paddingRight="@dimen/normal_margin"
|
|
||||||
android:paddingBottom="@dimen/activity_margin">
|
|
||||||
|
|
||||||
<com.simplemobiletools.commons.views.MySwitchCompat
|
|
||||||
android:id="@+id/settings_stroboscope"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="@null"
|
|
||||||
android:clickable="false"
|
|
||||||
android:paddingStart="@dimen/medium_margin"
|
|
||||||
android:text="@string/show_stroboscope"
|
|
||||||
app:switchPadding="@dimen/medium_margin"/>
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/settings_sos_holder"
|
android:id="@+id/settings_sos_holder"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -190,6 +167,29 @@
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/settings_stroboscope_holder"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/medium_margin"
|
||||||
|
android:background="?attr/selectableItemBackground"
|
||||||
|
android:paddingLeft="@dimen/normal_margin"
|
||||||
|
android:paddingTop="@dimen/activity_margin"
|
||||||
|
android:paddingRight="@dimen/normal_margin"
|
||||||
|
android:paddingBottom="@dimen/activity_margin">
|
||||||
|
|
||||||
|
<com.simplemobiletools.commons.views.MySwitchCompat
|
||||||
|
android:id="@+id/settings_stroboscope"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@null"
|
||||||
|
android:clickable="false"
|
||||||
|
android:paddingStart="@dimen/medium_margin"
|
||||||
|
android:text="@string/show_stroboscope"
|
||||||
|
app:switchPadding="@dimen/medium_margin"/>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/settings_force_portrait_holder"
|
android:id="@+id/settings_force_portrait_holder"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<resources>
|
<resources>
|
||||||
<dimen name="buttons_margin">30dp</dimen>
|
|
||||||
<dimen name="seekbar_width">250dp</dimen>
|
<dimen name="seekbar_width">250dp</dimen>
|
||||||
<dimen name="main_button_size">150dp</dimen>
|
<dimen name="main_button_size">150dp</dimen>
|
||||||
|
|
||||||
|
<dimen name="sos_text_size">26sp</dimen>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in New Issue