Wibracje jako podpowiedz i fake odglos aparatu
This commit is contained in:
parent
5126db3a6e
commit
04e94226dc
Binary file not shown.
@ -8,12 +8,6 @@
|
||||
</compositeConfiguration>
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/app" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
|
@ -1,6 +0,0 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="AndroidDomInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
</profile>
|
||||
</component>
|
@ -1,40 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="NullableNotNullManager">
|
||||
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
|
||||
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
|
||||
<option name="myNullables">
|
||||
<value>
|
||||
<list size="10">
|
||||
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
|
||||
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
|
||||
<item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
|
||||
<item index="3" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
|
||||
<item index="4" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
|
||||
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.Nullable" />
|
||||
<item index="6" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNullable" />
|
||||
<item index="7" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.Nullable" />
|
||||
<item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableDecl" />
|
||||
<item index="9" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableType" />
|
||||
</list>
|
||||
</value>
|
||||
</option>
|
||||
<option name="myNotNulls">
|
||||
<value>
|
||||
<list size="9">
|
||||
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
|
||||
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
|
||||
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
|
||||
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
|
||||
<item index="4" class="java.lang.String" itemvalue="androidx.annotation.NonNull" />
|
||||
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNonNull" />
|
||||
<item index="6" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.NonNull" />
|
||||
<item index="7" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullDecl" />
|
||||
<item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullType" />
|
||||
</list>
|
||||
</value>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
|
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RenderSettings">
|
||||
<option name="showDecorations" value="true" />
|
||||
</component>
|
||||
</project>
|
BIN
app/debug/app.aab
Normal file
BIN
app/debug/app.aab
Normal file
Binary file not shown.
BIN
app/release/app.aab
Normal file
BIN
app/release/app.aab
Normal file
Binary file not shown.
@ -7,7 +7,7 @@ import android.support.test.runner.AndroidJUnit4;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
|
@ -9,6 +9,7 @@
|
||||
android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission
|
||||
android:name="android.permission.RECORD_AUDIO" />
|
||||
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
|
@ -1,27 +1,32 @@
|
||||
package com.example.se.catornot2;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.media.MediaPlayer;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.VibrationEffect;
|
||||
import android.speech.RecognizerIntent;
|
||||
import android.speech.tts.TextToSpeech;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import android.os.Vibrator;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
private static final int SPEECH_REQUEST_CODE = 0;
|
||||
TextToSpeech tts;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
initializeTextToSpeech();
|
||||
|
||||
|
||||
}
|
||||
|
||||
// This callback is invoked when the Speech Recognizer returns.
|
||||
@ -75,20 +80,46 @@ public class MainActivity extends AppCompatActivity {
|
||||
thread must sleep for some time (3000ms-4000ms)
|
||||
*/
|
||||
|
||||
//vibrate if answer is 'It is a cat'
|
||||
|
||||
if (answer.equals("It is a cat")){
|
||||
shakeItBaby();
|
||||
}
|
||||
|
||||
|
||||
// Says the result
|
||||
tts.speak(answer, TextToSpeech.QUEUE_FLUSH, null);
|
||||
try {
|
||||
Thread.sleep(4000);
|
||||
tts.speak(answer, TextToSpeech.QUEUE_FLUSH, null);
|
||||
}catch(Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
private void shakeItBaby() {
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
((Vibrator) getSystemService(VIBRATOR_SERVICE)).vibrate(VibrationEffect.createOneShot(500, VibrationEffect.DEFAULT_AMPLITUDE));
|
||||
} else {
|
||||
((Vibrator) getSystemService(VIBRATOR_SERVICE)).vibrate(500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Process voice command given by user
|
||||
private void processVoiceCommand(String spokenText) {
|
||||
if (spokenText.contains("photo") || spokenText.contains("foto")) {
|
||||
|
||||
// camera shutter sound (?); indication of app taking a photo
|
||||
|
||||
MediaPlayer mySound;
|
||||
mySound= MediaPlayer.create(MainActivity.this,R.raw.photosound);
|
||||
mySound.start();
|
||||
// Starting question
|
||||
String question = "Is it a cat or not?";
|
||||
tts.speak(question, TextToSpeech.QUEUE_FLUSH, null);
|
||||
|
||||
try {
|
||||
Thread.sleep(3000);
|
||||
String question = "Is it a cat or not?";
|
||||
tts.speak(question, TextToSpeech.QUEUE_FLUSH, null);
|
||||
}catch(Exception e) {
|
||||
}
|
||||
// Initiating randomizer method on 'answers'
|
||||
List<String> answers = Arrays.asList("It is a cat", "It is NOT a cat");
|
||||
randomizer(answers);
|
||||
|
BIN
app/src/main/res/raw/PhotoSound.mp3
Normal file
BIN
app/src/main/res/raw/PhotoSound.mp3
Normal file
Binary file not shown.
@ -2,7 +2,7 @@ package com.example.se.catornot2;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
|
Loading…
Reference in New Issue
Block a user