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()
|
||||
}
|
||||
|
||||
sos_btn.setOnClickListener {}
|
||||
|
||||
setupStroboscope()
|
||||
checkAppOnSDCard()
|
||||
}
|
||||
|
@ -58,9 +60,13 @@ class MainActivity : SimpleActivity() {
|
|||
mCameraImpl!!.handleCameraSetup()
|
||||
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)
|
||||
sos_btn.beVisibleIf(config.sos)
|
||||
sos_btn.setTextColor(contrastColor)
|
||||
stroboscope_btn.beVisibleIf(config.stroboscope)
|
||||
|
||||
if (!config.stroboscope) {
|
||||
mCameraImpl!!.stopStroboscope()
|
||||
stroboscope_bar.beInvisible()
|
||||
|
@ -68,7 +74,7 @@ class MainActivity : SimpleActivity() {
|
|||
|
||||
updateTextColors(main_holder)
|
||||
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
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
android:id="@+id/flashlight_btn"
|
||||
android:layout_width="@dimen/main_button_size"
|
||||
android:layout_height="@dimen/main_button_size"
|
||||
android:layout_marginBottom="@dimen/activity_margin"
|
||||
android:layout_marginTop="@dimen/activity_margin"
|
||||
android:layout_marginTop="@dimen/normal_margin"
|
||||
android:layout_marginBottom="@dimen/normal_margin"
|
||||
android:background="@drawable/circles_big"
|
||||
app:layout_constraintBottom_toTopOf="@+id/bright_display_btn"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
@ -29,36 +29,53 @@
|
|||
android:id="@+id/bright_display_btn"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/activity_margin"
|
||||
android:layout_marginTop="@dimen/buttons_margin"
|
||||
android:layout_marginTop="@dimen/normal_margin"
|
||||
android:layout_marginBottom="@dimen/normal_margin"
|
||||
android:background="@drawable/ic_bright_display"
|
||||
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_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
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
|
||||
android:id="@+id/stroboscope_btn"
|
||||
android:layout_width="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:padding="@dimen/activity_margin"
|
||||
app:layout_constraintBottom_toTopOf="@+id/stroboscope_bar"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
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
|
||||
android:id="@+id/stroboscope_bar"
|
||||
android:layout_width="@dimen/seekbar_width"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/activity_margin"
|
||||
android:paddingBottom="@dimen/medium_margin"
|
||||
android:paddingTop="@dimen/medium_margin"
|
||||
android:paddingBottom="@dimen/medium_margin"
|
||||
android:visibility="invisible"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
|
|
@ -144,29 +144,6 @@
|
|||
|
||||
</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
|
||||
android:id="@+id/settings_sos_holder"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -190,6 +167,29 @@
|
|||
|
||||
</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
|
||||
android:id="@+id/settings_force_portrait_holder"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<resources>
|
||||
<dimen name="buttons_margin">30dp</dimen>
|
||||
<dimen name="seekbar_width">250dp</dimen>
|
||||
<dimen name="main_button_size">150dp</dimen>
|
||||
|
||||
<dimen name="sos_text_size">26sp</dimen>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in New Issue