Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
aquamarine5 committed Apr 8, 2022
1 parent 856ba35 commit 9e353f9
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 16 deletions.
3 changes: 3 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ android {
applicationId "com.aquaapps.readtorecite"
minSdkVersion 21
targetSdkVersion 31
versionCode 1
versionName "1.0"
versionCode 2
versionName "v1.0-alpha-2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand All @@ -20,15 +20,15 @@ android {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.google.android.material:material:1.4.0'
implementation "androidx.camera:camera-core:1.1.0-beta02"
implementation "androidx.camera:camera-video:1.1.0-beta02"
implementation "androidx.camera:camera-view:1.1.0-beta02"
implementation "androidx.camera:camera-lifecycle:1.1.0-beta02"
implementation "androidx.camera:camera-camera2:1.1.0-beta02"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
1 change: 0 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar"
android:exported="true">
<intent-filter>
Expand Down
20 changes: 16 additions & 4 deletions app/src/main/java/com/aquaapps/readtorecite/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package com.aquaapps.readtorecite;

import static androidx.camera.video.VideoRecordEvent.Finalize.*;

import android.Manifest;
import android.content.ClipData;
import android.content.ContentValues;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.provider.MediaStore;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
Expand Down Expand Up @@ -39,11 +39,14 @@
import java.util.concurrent.ExecutionException;

public class MainActivity extends AppCompatActivity {
public PreviewView previewView;
public ProcessCameraProvider cameraProvider;
public Recorder recorder;
public Recording recording=null;
public VideoCapture<Recorder> videoCapture;

public boolean isShowingPreview=true;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand Down Expand Up @@ -89,7 +92,7 @@ protected void onCreate(Bundle savedInstanceState) {
try{
cameraProvider=ProcessCameraProvider.getInstance(this).get();
Preview preview=new Preview.Builder().build();
PreviewView previewView=findViewById(R.id.previewView);
previewView=findViewById(R.id.previewView);
CameraSelector cameraSelector=new CameraSelector.Builder()
.requireLensFacing(CameraSelector.LENS_FACING_FRONT)
.build();
Expand All @@ -111,6 +114,7 @@ protected void onCreate(Bundle savedInstanceState) {
}
}


@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
Expand All @@ -126,7 +130,15 @@ public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();

//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
if (id == R.id.action_preview) {
if(isShowingPreview){
previewView.setVisibility(View.INVISIBLE);
item.setTitle(R.string.action_preview_enabled);
} else{
previewView.setVisibility(View.VISIBLE);
item.setTitle(R.string.action_preview_disabled);
}
isShowingPreview=!isShowingPreview;
return true;
}

Expand Down
18 changes: 17 additions & 1 deletion app/src/main/res/layout/content_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,26 @@
android:layout_width="match_parent"
android:layout_height="match_parent">

<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint="@string/detail_inputbox"
android:inputType="textLongMessage|textImeMultiLine"
android:saveEnabled="true"
android:textSize="30sp" />
</com.google.android.material.textfield.TextInputLayout>

<androidx.camera.view.PreviewView
android:id="@+id/previewView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
android:layout_height="match_parent"
android:visibility="visible">

</androidx.camera.view.PreviewView>

</FrameLayout>

Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/menu/menu_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.aquaapps.readtorecite.MainActivity">
<item
android:id="@+id/action_settings"
android:id="@+id/action_preview"
android:orderInCategory="100"
android:title="@string/action_settings"
android:title="@string/action_preview_disabled"
app:showAsAction="never" />
</menu>
4 changes: 3 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<resources>
<string name="app_name">ReadToRecite</string>
<string name="action_settings">Settings</string>
<string name="action_preview_disabled">关闭预览</string>
<string name="action_preview_enabled">显示预览</string>
<string name="description_record">录制</string>
<string name="detail_inputbox">在此输入背诵内容</string>
</resources>

0 comments on commit 9e353f9

Please sign in to comment.