Compare commits
No commits in common. 'main' and 'master' have entirely different histories.
@ -1,64 +0,0 @@
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:7.2.1'
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
repositories {
|
||||
jcenter()
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'androidx.appcompat:appcompat:1.0.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
||||
}
|
||||
|
||||
// The sample build uses multiple directories to
|
||||
// keep boilerplate and common code separate from
|
||||
// the main sample code.
|
||||
List<String> dirs = [
|
||||
'main', // main sample code; look here for the interesting stuff.
|
||||
'common', // components that are reused by multiple samples
|
||||
'template'] // boilerplate code that is generated by the sample template process
|
||||
|
||||
android {
|
||||
compileSdk 33
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 24
|
||||
//noinspection ExpiredTargetSdkVersion
|
||||
targetSdkVersion 27
|
||||
}
|
||||
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
dirs.each { dir ->
|
||||
java.srcDirs "src/${dir}/java"
|
||||
res.srcDirs "src/${dir}/res"
|
||||
}
|
||||
}
|
||||
androidTest.setRoot('tests')
|
||||
androidTest.java.srcDirs = ['tests/src']
|
||||
|
||||
}
|
||||
|
||||
ndkVersion '26.1.10909125'
|
||||
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<issues format="6" by="lint 7.2.1" type="baseline" client="gradle" dependencies="false" name="AGP (7.2.1)" variant="fatal" version="7.2.1">
|
||||
|
||||
<issue
|
||||
id="ExpiredTargetSdkVersion"
|
||||
message="Google Play requires that apps target API level 30 or higher.
"
|
||||
errorLine1=" targetSdkVersion 27"
|
||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
|
||||
<location
|
||||
file="build.gradle"
|
||||
line="40"
|
||||
column="9"/>
|
||||
</issue>
|
||||
|
||||
</issues>
|
@ -1,20 +0,0 @@
|
||||
{
|
||||
"version": 3,
|
||||
"artifactType": {
|
||||
"type": "APK",
|
||||
"kind": "Directory"
|
||||
},
|
||||
"applicationId": "com.xypower.mppreview",
|
||||
"variantName": "release",
|
||||
"elements": [
|
||||
{
|
||||
"type": "SINGLE",
|
||||
"filters": [],
|
||||
"attributes": [],
|
||||
"versionCode": 1,
|
||||
"versionName": "1.0",
|
||||
"outputFile": "Application-release.apk"
|
||||
}
|
||||
],
|
||||
"elementType": "File"
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.xypower.mppreview"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
<!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <!-- A camera with RAW capability is required to use this application -->
|
||||
<uses-feature android:name="android.hardware.camera" />
|
||||
<uses-feature android:name="android.hardware.camera.raw" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:requestLegacyExternalStorage="true"
|
||||
android:theme="@style/MaterialTheme">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:label="@string/app_name"
|
||||
android:screenOrientation="landscape" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".CameraActivity"
|
||||
android:label="@string/app_name"
|
||||
android:screenOrientation="landscape">
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Copyright 2015 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.xypower.mppreview;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
|
||||
/**
|
||||
* Activity displaying a fragment that implements RAW photo captures.
|
||||
*/
|
||||
public class CameraActivity extends Activity {
|
||||
|
||||
Handler mHandler;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
mHandler = new Handler();
|
||||
setContentView(R.layout.activity_camera);
|
||||
if (null == savedInstanceState) {
|
||||
getFragmentManager().beginTransaction()
|
||||
.replace(R.id.container, Camera2RawFragment.newInstance(false))
|
||||
.commit();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void reopenFragment(final boolean hdr) {
|
||||
mHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
getFragmentManager().beginTransaction()
|
||||
.replace(R.id.container, Camera2RawFragment.newInstance(hdr))
|
||||
.commit();
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
package com.xypower.mppreview;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.Switch;
|
||||
|
||||
public class MainActivity extends Activity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
((Button)findViewById(R.id.channel1)).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
takePhoto(1);
|
||||
}
|
||||
});
|
||||
((Button)findViewById(R.id.channel2)).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
takePhoto(2);
|
||||
}
|
||||
});
|
||||
((Button)findViewById(R.id.channel3)).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
takePhoto(3);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void takePhoto(int channel) {
|
||||
Switch hdrSwitch = (Switch) findViewById(R.id.hdr);
|
||||
takePhoto(channel, hdrSwitch.isChecked());
|
||||
}
|
||||
|
||||
protected void takePhoto(int channel, boolean hdr) {
|
||||
int cameraId = channel - 1;
|
||||
|
||||
Intent intent = new Intent(MainActivity.this, CameraActivity.class);
|
||||
intent.putExtra("cameraId", cameraId);
|
||||
if (channel == 1) {
|
||||
intent.putExtra("hdr", hdr);
|
||||
}
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 665 B |
Before Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 6.9 KiB |
Before Width: | Height: | Size: 1.0 KiB |
@ -1,5 +0,0 @@
|
||||
<vector android:height="48dp" android:tint="#0000FF"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z"/>
|
||||
</vector>
|
Before Width: | Height: | Size: 3.3 KiB |
@ -1,6 +0,0 @@
|
||||
<vector android:height="24dp" android:tint="#0000FF"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M12,12m-3.2,0a3.2,3.2 0,1 1,6.4 0a3.2,3.2 0,1 1,-6.4 0"/>
|
||||
<path android:fillColor="@android:color/white" android:pathData="M9,2L7.17,4L4,4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2h-3.17L15,2L9,2zM12,17c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5z"/>
|
||||
</vector>
|
Before Width: | Height: | Size: 196 B |
@ -1,60 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Copyright 2015 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:ignore="MissingDefaultResource">
|
||||
|
||||
<com.xypower.mppreview.AutoFitTextureView
|
||||
android:id="@+id/texture"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/picture"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:scaleType="fitXY"
|
||||
android:alpha="0.5"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/backMain"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:srcCompat="@drawable/ic_take_photo"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/backMain"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:scaleType="fitXY"
|
||||
android:alpha="0.5"
|
||||
app:layout_constraintStart_toEndOf="@id/picture"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:srcCompat="@drawable/ic_back"
|
||||
/>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Copyright 2015 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#000"
|
||||
tools:context="com.xypower.mppreview.CameraActivity" />
|
@ -1,59 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".MainActivity">
|
||||
|
||||
<Button
|
||||
android:id="@+id/channel1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="通道1"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/channel2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="通道2"
|
||||
app:layout_constraintStart_toEndOf="@+id/channel1"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/channel3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="通道3"
|
||||
app:layout_constraintStart_toEndOf="@+id/channel2"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:text="HDR"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/channel1" />
|
||||
|
||||
<Switch
|
||||
android:id="@+id/hdr"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toEndOf="@id/textView"
|
||||
app:layout_constraintTop_toTopOf="@id/textView"
|
||||
app:layout_constraintBottom_toBottomOf="@id/textView" />
|
||||
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -1,24 +0,0 @@
|
||||
<!--
|
||||
Copyright 2013 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
|
||||
<!-- Semantic definitions -->
|
||||
|
||||
<dimen name="horizontal_page_margin">@dimen/margin_huge</dimen>
|
||||
<dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
|
||||
|
||||
</resources>
|
@ -1,25 +0,0 @@
|
||||
<!--
|
||||
Copyright 2013 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
|
||||
<style name="Widget.SampleMessage">
|
||||
<item name="android:textAppearance">?android:textAppearanceLarge</item>
|
||||
<item name="android:lineSpacingMultiplier">1.2</item>
|
||||
<item name="android:shadowDy">-6.5</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
@ -1,22 +0,0 @@
|
||||
<!--
|
||||
Copyright 2013 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
|
||||
<!-- Activity themes -->
|
||||
<style name="Theme.Base" parent="android:Theme.Holo.Light" />
|
||||
|
||||
</resources>
|
@ -1,21 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright 2013 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
|
||||
|
||||
</resources>
|
@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright 2013 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
|
||||
<!-- Activity themes -->
|
||||
<style name="Theme.Base" parent="android:Theme.Material.Light">
|
||||
</style>
|
||||
|
||||
</resources>
|
@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright 2013 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<string name="app_name">微拍预览</string>
|
||||
<string name="intro_message">微拍预览
|
||||
</string>
|
||||
</resources>
|
@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Copyright 2015 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<resources>
|
||||
<string name="picture">拍照</string>
|
||||
<string name="description_info">Info</string>
|
||||
<string name="request_permission">This app needs camera permission.</string>
|
||||
</resources>
|
@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Copyright 2015 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<resources>
|
||||
<style name="MaterialTheme" parent="android:Theme.Material.Light.NoActionBar.Fullscreen" />
|
||||
</resources>
|
@ -1,32 +0,0 @@
|
||||
<!--
|
||||
Copyright 2013 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
|
||||
<!-- Define standard dimensions to comply with Holo-style grids and rhythm. -->
|
||||
|
||||
<dimen name="margin_tiny">4dp</dimen>
|
||||
<dimen name="margin_small">8dp</dimen>
|
||||
<dimen name="margin_medium">16dp</dimen>
|
||||
<dimen name="margin_large">32dp</dimen>
|
||||
<dimen name="margin_huge">64dp</dimen>
|
||||
|
||||
<!-- Semantic definitions -->
|
||||
|
||||
<dimen name="horizontal_page_margin">@dimen/margin_medium</dimen>
|
||||
<dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
|
||||
|
||||
</resources>
|
@ -1,42 +0,0 @@
|
||||
<!--
|
||||
Copyright 2013 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
|
||||
<!-- Activity themes -->
|
||||
|
||||
<style name="Theme.Base" parent="android:Theme.Light" />
|
||||
|
||||
<style name="Theme.Sample" parent="Theme.Base" />
|
||||
|
||||
<style name="AppTheme" parent="Theme.Sample" />
|
||||
<!-- Widget styling -->
|
||||
|
||||
<style name="Widget" />
|
||||
|
||||
<style name="Widget.SampleMessage">
|
||||
<item name="android:textAppearance">?android:textAppearanceMedium</item>
|
||||
<item name="android:lineSpacingMultiplier">1.1</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.SampleMessageTile">
|
||||
<item name="android:background">@drawable/tile</item>
|
||||
<item name="android:shadowColor">#7F000000</item>
|
||||
<item name="android:shadowDy">-3.5</item>
|
||||
<item name="android:shadowRadius">2</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
@ -1,40 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2013 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<!-- package name must be unique so suffix with "tests" so package loader doesn't ignore us -->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.xypower.mppreview.tests"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
|
||||
<!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
|
||||
|
||||
<!-- We add an application tag here just so that we can indicate that
|
||||
this package needs to link against the android.test library,
|
||||
which is needed when building test cases. -->
|
||||
<application>
|
||||
<uses-library android:name="android.test.runner" />
|
||||
</application>
|
||||
|
||||
<!--
|
||||
Specifies the instrumentation test runner used to run the tests.
|
||||
-->
|
||||
<instrumentation
|
||||
android:name="android.test.InstrumentationTestRunner"
|
||||
android:targetPackage="com.xypower.mppreview"
|
||||
android:label="Tests for com.xypower.mppreview" />
|
||||
|
||||
</manifest>
|
@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.xypower.mppreview.tests;
|
||||
|
||||
import com.xypower.mppreview.*;
|
||||
|
||||
import android.test.ActivityInstrumentationTestCase2;
|
||||
|
||||
/**
|
||||
* Tests for Camera2Raw sample.
|
||||
*/
|
||||
public class SampleTests extends ActivityInstrumentationTestCase2<CameraActivity> {
|
||||
|
||||
private CameraActivity mTestActivity;
|
||||
|
||||
public SampleTests() {
|
||||
super(CameraActivity.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
// Starts the activity under test using the default Intent with:
|
||||
// action = {@link Intent#ACTION_MAIN}
|
||||
// flags = {@link Intent#FLAG_ACTIVITY_NEW_TASK}
|
||||
// All other fields are null or empty.
|
||||
mTestActivity = getActivity();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if the test fixture has been set up correctly.
|
||||
*/
|
||||
public void testPreconditions() {
|
||||
//Try to add a message to add context to your assertions. These messages will be shown if
|
||||
//a tests fails and make it easy to understand why a test failed
|
||||
assertNotNull("mTestActivity is null", mTestActivity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add more tests below.
|
||||
*/
|
||||
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
# How to become a contributor and submit your own code
|
||||
|
||||
## Contributor License Agreements
|
||||
|
||||
We'd love to accept your sample apps and patches! Before we can take them, we
|
||||
have to jump a couple of legal hurdles.
|
||||
|
||||
Please fill out either the individual or corporate Contributor License Agreement (CLA).
|
||||
|
||||
* If you are an individual writing original source code and you're sure you
|
||||
own the intellectual property, then you'll need to sign an [individual CLA]
|
||||
(https://developers.google.com/open-source/cla/individual).
|
||||
* If you work for a company that wants to allow you to contribute your work,
|
||||
then you'll need to sign a [corporate CLA]
|
||||
(https://developers.google.com/open-source/cla/corporate).
|
||||
|
||||
Follow either of the two links above to access the appropriate CLA and
|
||||
instructions for how to sign and return it. Once we receive it, we'll be able to
|
||||
accept your pull requests.
|
||||
|
||||
## Contributing A Patch
|
||||
|
||||
1. Submit an issue describing your proposed change to the repo in question.
|
||||
1. The repo owner will respond to your issue promptly.
|
||||
1. If your proposed change is accepted, and you haven't already done so, sign a
|
||||
Contributor License Agreement (see details above).
|
||||
1. Fork the desired repo, develop and test your code changes.
|
||||
1. Ensure that your code adheres to the existing style in the sample to which
|
||||
you are contributing. Refer to the
|
||||
[Android Code Style Guide]
|
||||
(https://source.android.com/source/code-style.html) for the
|
||||
recommended coding standards for this organization.
|
||||
1. Ensure that your code has an appropriate set of unit tests which all pass.
|
||||
1. Submit a pull request.
|
||||
|
@ -1,35 +0,0 @@
|
||||
# How to become a contributor and submit your own code
|
||||
|
||||
## Contributor License Agreements
|
||||
|
||||
We'd love to accept your sample apps and patches! Before we can take them, we
|
||||
have to jump a couple of legal hurdles.
|
||||
|
||||
Please fill out either the individual or corporate Contributor License Agreement (CLA).
|
||||
|
||||
* If you are an individual writing original source code and you're sure you
|
||||
own the intellectual property, then you'll need to sign an [individual CLA]
|
||||
(https://cla.developers.google.com).
|
||||
* If you work for a company that wants to allow you to contribute your work,
|
||||
then you'll need to sign a [corporate CLA]
|
||||
(https://cla.developers.google.com).
|
||||
|
||||
Follow either of the two links above to access the appropriate CLA and
|
||||
instructions for how to sign and return it. Once we receive it, we'll be able to
|
||||
accept your pull requests.
|
||||
|
||||
## Contributing A Patch
|
||||
|
||||
1. Submit an issue describing your proposed change to the repo in question.
|
||||
1. The repo owner will respond to your issue promptly.
|
||||
1. If your proposed change is accepted, and you haven't already done so, sign a
|
||||
Contributor License Agreement (see details above).
|
||||
1. Fork the desired repo, develop and test your code changes.
|
||||
1. Ensure that your code adheres to the existing style in the sample to which
|
||||
you are contributing. Refer to the
|
||||
[Android Code Style Guide]
|
||||
(https://source.android.com/source/code-style.html) for the
|
||||
recommended coding standards for this organization.
|
||||
1. Ensure that your code has an appropriate set of unit tests which all pass.
|
||||
1. Submit a pull request.
|
||||
|
@ -1,203 +0,0 @@
|
||||
Apache License
|
||||
--------------
|
||||
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright {yyyy} {name of copyright owner}
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
@ -0,0 +1 @@
|
||||
/build
|
@ -0,0 +1,87 @@
|
||||
plugins {
|
||||
id 'com.android.application'
|
||||
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdk 33
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.xypower.mppreview"
|
||||
minSdk 28
|
||||
targetSdk 30
|
||||
versionCode 3
|
||||
versionName "1.2"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
// cppFlags '-std=c++17 -frtti -fexceptions -Wno-error=format-security'
|
||||
cppFlags '-std=c++17 -fexceptions -Wno-error=format-security -fopenmp '
|
||||
// cppFlags '-std=c++17 -Wno-error=format-security'
|
||||
// arguments "-DANDROID_STL=c++_shared"
|
||||
// arguments "-DNCNN_DISABLE_EXCEPTION=OFF", "-DOpenCV_DIR=" + opencvsdk + "/sdk/native/jni", "-DNCNN_ROOT=" + ncnnroot
|
||||
arguments "-DOpenCV_DIR=" + opencvsdk + "/sdk/native/jni"
|
||||
abiFilters 'arm64-v8a'
|
||||
// setAbiFilters(['arm64-v8a'])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
debug {
|
||||
jniDebuggable true
|
||||
}
|
||||
}
|
||||
|
||||
// sourceSets {
|
||||
// main{
|
||||
// jniLibs.srcDirs=['src/main/jniLibs']
|
||||
// }
|
||||
// }
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
path file('src/main/cpp/CMakeLists.txt')
|
||||
version '3.22.1'
|
||||
}
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
viewBinding true
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'androidx.appcompat:appcompat:1.3.0'
|
||||
implementation 'com.google.android.material:material:1.4.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||
|
||||
//CameraX
|
||||
// implementation "androidx.camera:camera-core:1.4.1"
|
||||
// implementation "androidx.camera:camera-camera2:1.4.1"
|
||||
// implementation "androidx.camera:camera-view:1.4.1"
|
||||
// implementation "androidx.camera:camera-lifecycle:1.4.1"
|
||||
// implementation "androidx.camera:camera-video:1.4.1"
|
||||
|
||||
// CameraX core library using camera2 implementation
|
||||
implementation "androidx.camera:camera-camera2:1.1.0"
|
||||
// CameraX Lifecycle Library
|
||||
implementation "androidx.camera:camera-lifecycle:1.1.0"
|
||||
// CameraX View class
|
||||
implementation "androidx.camera:camera-view:1.1.0"
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
@ -0,0 +1,26 @@
|
||||
package com.xypower.mppreview;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
assertEquals("com.xypower.camera2raw", appContext.getPackageName());
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.xypower.mppreview">
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<!-- A camera with RAW capability is required to use this application -->
|
||||
<uses-feature android:name="android.hardware.camera" />
|
||||
<uses-feature android:name="android.hardware.camera.raw" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
android:fullBackupContent="@xml/backup_rules"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.MpPreview"
|
||||
android:requestLegacyExternalStorage="true"
|
||||
tools:targetApi="30">
|
||||
<activity
|
||||
android:name=".ui.CameraChannelActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".ui.CameraActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="com.stg.rouge.activity.fileprovider"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true"
|
||||
tools:replace="android:authorities">
|
||||
<meta-data
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/file_paths_public"
|
||||
tools:replace="android:resource" />
|
||||
</provider>
|
||||
</application>
|
||||
|
||||
</manifest>
|
@ -0,0 +1,105 @@
|
||||
# For more information about using CMake with Android Studio, read the
|
||||
# documentation: https://d.android.com/studio/projects/add-native-code.html
|
||||
|
||||
# Sets the minimum version of CMake required to build the native library.
|
||||
|
||||
cmake_minimum_required(VERSION 3.22.1)
|
||||
|
||||
# enable_language(ASM)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp -static-openmp -ffunction-sections -fdata-sections -Wformat-security ")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}")
|
||||
# SET_TARGET_PROPERTIES(microphoto PROPERTIES LINK_FLAGS "-Wl,-s,--gc-sections")
|
||||
|
||||
IF (CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||
ADD_DEFINITIONS(-D_DEBUG)
|
||||
ELSE()
|
||||
ADD_DEFINITIONS(-DNDEBUG)
|
||||
ENDIF()
|
||||
|
||||
project("mppreview")
|
||||
|
||||
include_directories(D:/Workspace/deps/hdrplus_libs/${ANDROID_ABI}/include)
|
||||
link_directories(D:/Workspace/deps/hdrplus_libs/${ANDROID_ABI}/lib)
|
||||
|
||||
find_package(OpenCV REQUIRED core imgproc highgui photo)
|
||||
# find_package(OpenCV REQUIRED core imgproc)
|
||||
if(OpenCV_FOUND)
|
||||
include_directories(${OpenCV_INCLUDE_DIRS})
|
||||
message(WARNING "OpenCV library status:")
|
||||
message(WARNING " version: ${OpenCV_VERSION}")
|
||||
message(WARNING " libraries: ${OpenCV_LIBS}")
|
||||
message(WARNING " include path: ${OpenCV_INCLUDE_DIRS}")
|
||||
else(OpenCV_FOUND)
|
||||
message(FATAL_ERROR "OpenCV library not found")
|
||||
endif(OpenCV_FOUND)
|
||||
|
||||
# libzip
|
||||
# set(libzip_DIR ${LIBZIP_ROOT}/${ANDROID_ABI}/lib/cmake/libzip)
|
||||
# find_package(libzip REQUIRED)
|
||||
|
||||
# ncnn
|
||||
# set(ncnn_DIR ${NCNN_ROOT}/${ANDROID_ABI}/lib/cmake/ncnn)
|
||||
# find_package(ncnn REQUIRED)
|
||||
|
||||
# OpenMP
|
||||
find_package(OpenMP REQUIRED)
|
||||
|
||||
add_library( # Sets the name of the library.
|
||||
mppreview
|
||||
|
||||
# Sets the library as a shared library.
|
||||
SHARED
|
||||
|
||||
# Provides a relative path to your source file(s).
|
||||
MpPreview.cpp
|
||||
HdrImpl.cpp
|
||||
|
||||
)
|
||||
|
||||
# Searches for a specified prebuilt library and stores the path as a
|
||||
# variable. Because CMake includes system libraries in the search path by
|
||||
# default, you only need to specify the name of the public NDK library
|
||||
# you want to add. CMake verifies that the library exists before
|
||||
# completing its build.
|
||||
|
||||
find_library( # Sets the name of the path variable.
|
||||
log-lib
|
||||
|
||||
# Specifies the name of the NDK library that
|
||||
# you want CMake to locate.
|
||||
log)
|
||||
|
||||
# Specifies libraries CMake should link to your target library. You
|
||||
# can link multiple libraries, such as libraries you define in this
|
||||
# build script, prebuilt third-party libraries, or system libraries.
|
||||
|
||||
target_link_libraries( # Specifies the target library.
|
||||
${PROJECT_NAME}
|
||||
PUBLIC -fopenmp -static-openmp
|
||||
|
||||
# Links the target library to the log library
|
||||
# included in the NDK.
|
||||
${log-lib}
|
||||
|
||||
android mediandk z jnigraphics
|
||||
|
||||
#ncnn
|
||||
|
||||
raw raw_r
|
||||
${OpenCV_LIBS}
|
||||
|
||||
)
|
||||
|
||||
add_executable( libhdr.so
|
||||
hdr.cpp
|
||||
HdrImpl.cpp)
|
||||
target_link_libraries( libhdr.so PUBLIC -fopenmp -static-openmp
|
||||
android z
|
||||
-fopenmp -static-openmp
|
||||
${OpenCV_LIBS}
|
||||
raw raw_r
|
||||
)
|
||||
# set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS_RELEASE "-strip-all")
|
@ -0,0 +1,67 @@
|
||||
#include <jni.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <omp.h>
|
||||
|
||||
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include <opencv2/core.hpp>
|
||||
#include <opencv2/imgproc.hpp>
|
||||
|
||||
#include "hdr.h"
|
||||
|
||||
|
||||
bool makeHdr(std::vector<float>& times, std::vector<cv::Mat>& images, cv::Mat& rgb)
|
||||
{
|
||||
// Align input images
|
||||
// cout << "Aligning images ... " << endl;
|
||||
cv::Ptr<cv::AlignMTB> alignMTB = cv::createAlignMTB();
|
||||
#if 0
|
||||
alignMTB->process(images, images);
|
||||
#endif
|
||||
|
||||
// Obtain Camera Response Function (CRF)
|
||||
// ALOGI("Calculating Camera Response Function (CRF) ... ");
|
||||
cv::Mat responseDebevec;
|
||||
cv::Ptr<cv::CalibrateDebevec> calibrateDebevec = cv::createCalibrateDebevec();
|
||||
calibrateDebevec->process(images, responseDebevec, times);
|
||||
|
||||
// Merge images into an HDR linear image
|
||||
// ALOGI("Merging images into one HDR image ... ");
|
||||
cv::Mat hdrDebevec;
|
||||
cv::Ptr<cv::MergeDebevec> mergeDebevec = cv::createMergeDebevec();
|
||||
mergeDebevec->process(images, hdrDebevec, times, responseDebevec);
|
||||
// Save HDR image.
|
||||
// imwrite((OUTPUT_DIR "hdrDebevec.hdr"), hdrDebevec);
|
||||
// cout << "saved hdrDebevec.hdr " << endl;
|
||||
|
||||
{
|
||||
std::vector<cv::Mat> empty;
|
||||
empty.swap(images);
|
||||
}
|
||||
|
||||
// Tonemap using Reinhard's method to obtain 24-bit color image
|
||||
// ALOGI("Tonemaping using Reinhard's method ... ");
|
||||
cv::Mat ldrReinhard;
|
||||
cv::Ptr<cv::TonemapReinhard> tonemapReinhard = cv::createTonemapReinhard(1.5, 0, 0, 0);
|
||||
tonemapReinhard->process(hdrDebevec, ldrReinhard);
|
||||
hdrDebevec.release();
|
||||
|
||||
int type = ldrReinhard.type();
|
||||
ldrReinhard = ldrReinhard * 255;
|
||||
|
||||
ldrReinhard.convertTo(rgb, CV_8U);
|
||||
ldrReinhard.release();
|
||||
|
||||
mergeDebevec.release();
|
||||
responseDebevec.release();
|
||||
alignMTB.release();
|
||||
tonemapReinhard.release();
|
||||
calibrateDebevec.release();
|
||||
mergeDebevec.release();
|
||||
return true;
|
||||
}
|
@ -0,0 +1,500 @@
|
||||
#include <jni.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
// #include "ncnn/yolov5ncnn.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <omp.h>
|
||||
|
||||
#include <android/imagedecoder.h>
|
||||
#include <android/log.h>
|
||||
#include <media/NdkImage.h>
|
||||
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include <opencv2/core.hpp>
|
||||
#include <opencv2/imgproc.hpp>
|
||||
|
||||
#include "hdr.h"
|
||||
|
||||
namespace cv2
|
||||
{
|
||||
using namespace cv;
|
||||
|
||||
Mat linearResponseNew(int channels)
|
||||
{
|
||||
Mat response = Mat(LDR_SIZE, 1, CV_MAKETYPE(CV_32F, channels));
|
||||
for(int i = 0; i < LDR_SIZE; i++) {
|
||||
response.at<Vec3f>(i) = Vec3f::all(static_cast<float>(i));
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
Mat triangleWeightsNew()
|
||||
{
|
||||
// hat function
|
||||
Mat w(LDR_SIZE, 1, CV_32F);
|
||||
int half = LDR_SIZE / 2;
|
||||
for(int i = 0; i < LDR_SIZE; i++) {
|
||||
w.at<float>(i) = i < half ? i + 1.0f : LDR_SIZE - i;
|
||||
}
|
||||
return w;
|
||||
}
|
||||
|
||||
class CV_EXPORTS_W MergeExposuresNew
|
||||
{
|
||||
public:
|
||||
virtual ~MergeExposuresNew() {}
|
||||
/** @brief Merges images.
|
||||
|
||||
@param src vector of input images
|
||||
@param dst result image
|
||||
@param times vector of exposure time values for each image
|
||||
@param response 256x1 matrix with inverse camera response function for each pixel value, it should
|
||||
have the same number of channels as images.
|
||||
*/
|
||||
CV_WRAP virtual void process(InputArrayOfArrays src, OutputArray dst,
|
||||
InputArray times, InputArray response) = 0;
|
||||
};
|
||||
|
||||
class CV_EXPORTS_W MergeDebevecNew : public MergeExposuresNew
|
||||
{
|
||||
public:
|
||||
CV_WRAP virtual void process(InputArrayOfArrays src, OutputArray dst,
|
||||
InputArray times, InputArray response) CV_OVERRIDE = 0;
|
||||
CV_WRAP virtual void process(InputArrayOfArrays src, OutputArray dst, InputArray times) = 0;
|
||||
};
|
||||
|
||||
|
||||
class MergeDebevecImplNew CV_FINAL : public MergeDebevecNew
|
||||
{
|
||||
public:
|
||||
MergeDebevecImplNew() :
|
||||
name("MergeDebevecNew"),
|
||||
weights(triangleWeightsNew())
|
||||
{
|
||||
}
|
||||
|
||||
void process(InputArrayOfArrays src, OutputArray dst, InputArray _times, InputArray input_response) CV_OVERRIDE
|
||||
{
|
||||
// CV_INSTRUMENT_REGION();
|
||||
|
||||
ALOGD("HDR Merge 1");
|
||||
std::vector<Mat> images;
|
||||
src.getMatVector(images);
|
||||
Mat times = _times.getMat();
|
||||
|
||||
#if 0
|
||||
CV_Assert(images.size() == times.total());
|
||||
checkImageDimensions(images);
|
||||
CV_Assert(images[0].depth() == CV_8U);
|
||||
#endif
|
||||
|
||||
int channels = images[0].channels();
|
||||
Size size = images[0].size();
|
||||
int CV_32FCC = CV_MAKETYPE(CV_32F, channels);
|
||||
|
||||
ALOGD("HDR Merge 2");
|
||||
|
||||
dst.create(images[0].size(), CV_32FCC);
|
||||
Mat result = dst.getMat();
|
||||
|
||||
Mat response = input_response.getMat();
|
||||
|
||||
if(response.empty()) {
|
||||
response = linearResponseNew(channels);
|
||||
response.at<Vec3f>(0) = response.at<Vec3f>(1);
|
||||
}
|
||||
|
||||
ALOGD("HDR Merge 3");
|
||||
|
||||
Mat log_response;
|
||||
log(response, log_response);
|
||||
CV_Assert(log_response.rows == LDR_SIZE && log_response.cols == 1 &&
|
||||
log_response.channels() == channels);
|
||||
|
||||
Mat exp_values(times.clone());
|
||||
log(exp_values, exp_values);
|
||||
|
||||
ALOGD("HDR Merge 4");
|
||||
result = Mat::zeros(size, CV_32FCC);
|
||||
std::vector<Mat> result_split;
|
||||
split(result, result_split);
|
||||
Mat weight_sum = Mat::zeros(size, CV_32F);
|
||||
|
||||
ALOGD("HDR Merge 5");
|
||||
|
||||
for(size_t i = 0; i < images.size(); i++) {
|
||||
std::vector<Mat> splitted;
|
||||
split(images[i], splitted);
|
||||
|
||||
ALOGD("HDR Merge 5 - 1");
|
||||
Mat w = Mat::zeros(size, CV_32F);
|
||||
for(int c = 0; c < channels; c++) {
|
||||
LUT(splitted[c], weights, splitted[c]);
|
||||
w += splitted[c];
|
||||
}
|
||||
w /= channels;
|
||||
|
||||
ALOGD("HDR Merge 5 - 2");
|
||||
Mat response_img;
|
||||
LUT(images[i], log_response, response_img);
|
||||
split(response_img, splitted);
|
||||
|
||||
// #pragma omp parallel for num_threads(channels)
|
||||
for(int c = 0; c < channels; c++) {
|
||||
//这里崩溃
|
||||
result_split[c] += w.mul(splitted[c] - exp_values.at<float>((int)i));
|
||||
}
|
||||
weight_sum += w;
|
||||
ALOGD("HDR Merge 5 - 3");
|
||||
}
|
||||
|
||||
ALOGD("HDR Merge 6");
|
||||
weight_sum = 1.0f / weight_sum;
|
||||
for(int c = 0; c < channels; c++) {
|
||||
result_split[c] = result_split[c].mul(weight_sum);
|
||||
}
|
||||
ALOGD("HDR Merge 7");
|
||||
merge(result_split, result);
|
||||
exp(result, result);
|
||||
|
||||
ALOGD("HDR Merge 8");
|
||||
}
|
||||
|
||||
void process(InputArrayOfArrays src, OutputArray dst, InputArray times) CV_OVERRIDE
|
||||
{
|
||||
// CV_INSTRUMENT_REGION();
|
||||
|
||||
process(src, dst, times, Mat());
|
||||
}
|
||||
|
||||
protected:
|
||||
String name;
|
||||
Mat weights;
|
||||
};
|
||||
|
||||
Ptr<MergeDebevecNew> createMergeDebevecNew()
|
||||
{
|
||||
return makePtr<MergeDebevecImplNew>();
|
||||
}
|
||||
|
||||
|
||||
class CV_EXPORTS_W TonemapReinhardNew
|
||||
{
|
||||
public:
|
||||
CV_WRAP virtual void process(InputArray src, OutputArray dst) = 0;
|
||||
|
||||
virtual ~TonemapReinhardNew() {}
|
||||
|
||||
CV_WRAP virtual float getGamma() const = 0;
|
||||
CV_WRAP virtual void setGamma(float gamma) = 0;
|
||||
|
||||
CV_WRAP virtual float getIntensity() const = 0;
|
||||
CV_WRAP virtual void setIntensity(float intensity) = 0;
|
||||
|
||||
CV_WRAP virtual float getLightAdaptation() const = 0;
|
||||
CV_WRAP virtual void setLightAdaptation(float light_adapt) = 0;
|
||||
|
||||
CV_WRAP virtual float getColorAdaptation() const = 0;
|
||||
CV_WRAP virtual void setColorAdaptation(float color_adapt) = 0;
|
||||
};
|
||||
|
||||
inline void log_(const Mat& src, Mat& dst)
|
||||
{
|
||||
max(src, Scalar::all(1e-4), dst);
|
||||
log(dst, dst);
|
||||
}
|
||||
|
||||
class TonemapReinhardImpl CV_FINAL : public TonemapReinhardNew
|
||||
{
|
||||
public:
|
||||
TonemapReinhardImpl(float _gamma, float _intensity, float _light_adapt, float _color_adapt) :
|
||||
name("TonemapReinhardNew"),
|
||||
gamma(_gamma),
|
||||
intensity(_intensity),
|
||||
light_adapt(_light_adapt),
|
||||
color_adapt(_color_adapt)
|
||||
{
|
||||
}
|
||||
|
||||
void process(InputArray _src, OutputArray _dst) CV_OVERRIDE
|
||||
{
|
||||
ALOGD("HDR 1 ");
|
||||
|
||||
Mat src = _src.getMat();
|
||||
CV_Assert(!src.empty());
|
||||
_dst.create(src.size(), CV_32FC3);
|
||||
Mat img = _dst.getMat();
|
||||
Ptr<Tonemap> linear = createTonemap(1.0f);
|
||||
linear->process(src, img);
|
||||
|
||||
ALOGD("HDR 2 ");
|
||||
|
||||
Mat gray_img;
|
||||
cvtColor(img, gray_img, COLOR_RGB2GRAY);
|
||||
Mat log_img;
|
||||
log_(gray_img, log_img);
|
||||
|
||||
float log_mean = static_cast<float>(sum(log_img)[0] / log_img.total());
|
||||
double log_min, log_max;
|
||||
minMaxLoc(log_img, &log_min, &log_max);
|
||||
log_img.release();
|
||||
|
||||
ALOGD("HDR 3 ");
|
||||
|
||||
double key = static_cast<float>((log_max - log_mean) / (log_max - log_min));
|
||||
float map_key = 0.3f + 0.7f * pow(static_cast<float>(key), 1.4f);
|
||||
intensity = exp(-intensity);
|
||||
Scalar chan_mean = mean(img);
|
||||
float gray_mean = static_cast<float>(mean(gray_img)[0]);
|
||||
|
||||
std::vector<Mat> channels(3);
|
||||
split(img, channels);
|
||||
|
||||
ALOGD("HDR 4 ");
|
||||
|
||||
#pragma omp parallel for num_threads(3)
|
||||
for (int i = 0; i < 3; i++) {
|
||||
float global = color_adapt * static_cast<float>(chan_mean[i]) + (1.0f - color_adapt) * gray_mean;
|
||||
Mat adapt = color_adapt * channels[i] + (1.0f - color_adapt) * gray_img;
|
||||
adapt = light_adapt * adapt + (1.0f - light_adapt) * global;
|
||||
pow(intensity * adapt, map_key, adapt);
|
||||
//这里崩溃
|
||||
channels[i] = channels[i].mul(1.0f/(adapt + channels[i]));
|
||||
}
|
||||
gray_img.release();
|
||||
merge(channels, img);
|
||||
|
||||
ALOGD("HDR 5 ");
|
||||
linear->setGamma(gamma);
|
||||
linear->process(img, img);
|
||||
|
||||
ALOGD("HDR 6 ");
|
||||
}
|
||||
|
||||
float getGamma() const CV_OVERRIDE { return gamma; }
|
||||
void setGamma(float val) CV_OVERRIDE { gamma = val; }
|
||||
|
||||
float getIntensity() const CV_OVERRIDE { return intensity; }
|
||||
void setIntensity(float val) CV_OVERRIDE { intensity = val; }
|
||||
|
||||
float getLightAdaptation() const CV_OVERRIDE { return light_adapt; }
|
||||
void setLightAdaptation(float val) CV_OVERRIDE { light_adapt = val; }
|
||||
|
||||
float getColorAdaptation() const CV_OVERRIDE { return color_adapt; }
|
||||
void setColorAdaptation(float val) CV_OVERRIDE { color_adapt = val; }
|
||||
|
||||
void write(FileStorage& fs) const
|
||||
{
|
||||
#if 0
|
||||
writeFormat(fs);
|
||||
fs << "name" << name
|
||||
<< "gamma" << gamma
|
||||
<< "intensity" << intensity
|
||||
<< "light_adapt" << light_adapt
|
||||
<< "color_adapt" << color_adapt;
|
||||
#endif
|
||||
}
|
||||
|
||||
void read(const FileNode& fn)
|
||||
{
|
||||
#if 0
|
||||
FileNode n = fn["name"];
|
||||
CV_Assert(n.isString() && String(n) == name);
|
||||
gamma = fn["gamma"];
|
||||
intensity = fn["intensity"];
|
||||
light_adapt = fn["light_adapt"];
|
||||
color_adapt = fn["color_adapt"];
|
||||
#endif
|
||||
}
|
||||
|
||||
protected:
|
||||
String name;
|
||||
float gamma, intensity, light_adapt, color_adapt;
|
||||
};
|
||||
|
||||
Ptr<TonemapReinhardNew> createTonemapReinhardNew(float gamma, float contrast, float sigma_color, float sigma_space)
|
||||
{
|
||||
return makePtr<TonemapReinhardImpl>(gamma, contrast, sigma_color, sigma_space);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
bool AndroidBitmap_CompressWriteFile(void *userContext, const void *data, size_t size)
|
||||
{
|
||||
int file = (int)((size_t)userContext);
|
||||
int bytesWritten = write(file, data, size);
|
||||
return bytesWritten == size;
|
||||
}
|
||||
|
||||
bool AndroidBitmap_CompressWriteBuffer(void *userContext, const void *data, size_t size)
|
||||
{
|
||||
std::vector<uint8_t>* buffer = (std::vector<uint8_t>*)userContext;
|
||||
// int bytesWritten = write(file, data, size);
|
||||
const uint8_t* pBytes = (const uint8_t*)data;
|
||||
buffer->insert(buffer->cend(), pBytes, pBytes + size);
|
||||
return true;
|
||||
}
|
||||
|
||||
inline std::string jstring2string(JNIEnv *env, jstring jStr)
|
||||
{
|
||||
if (!jStr)
|
||||
return "";
|
||||
const jclass stringClass = env->GetObjectClass(jStr);
|
||||
const jmethodID getBytes = env->GetMethodID(stringClass, "getBytes", "(Ljava/lang/String;)[B");
|
||||
const jbyteArray stringJbytes = (jbyteArray) env->CallObjectMethod(jStr, getBytes, env->NewStringUTF("UTF-8"));
|
||||
size_t length = (size_t) env->GetArrayLength(stringJbytes);
|
||||
jbyte* pBytes = env->GetByteArrayElements(stringJbytes, NULL);
|
||||
std::string ret = std::string((char *)pBytes, length);
|
||||
env->ReleaseByteArrayElements(stringJbytes, pBytes, JNI_ABORT);
|
||||
env->DeleteLocalRef(stringJbytes);
|
||||
env->DeleteLocalRef(stringClass);
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool makeHdr(std::vector<float>& times, std::vector<std::string>& paths, cv::Mat& rgb)
|
||||
{
|
||||
// Read images and exposure times
|
||||
std::vector<cv::Mat> images;
|
||||
images.resize(paths.size());
|
||||
|
||||
#pragma omp parallel for
|
||||
for (int idx = 0; idx < paths.size(); idx++)
|
||||
{
|
||||
images[idx] = cv::imread(paths[idx].c_str());
|
||||
}
|
||||
// Align input images
|
||||
// cout << "Aligning images ... " << endl;
|
||||
cv::Ptr<cv::AlignMTB> alignMTB = cv::createAlignMTB();
|
||||
#if 0
|
||||
alignMTB->process(images, images);
|
||||
#endif
|
||||
|
||||
// Obtain Camera Response Function (CRF)
|
||||
// cout << "Calculating Camera Response Function (CRF) ... " << endl;
|
||||
cv::Mat responseDebevec;
|
||||
cv::Ptr<cv::CalibrateDebevec> calibrateDebevec = cv::createCalibrateDebevec();
|
||||
calibrateDebevec->process(images, responseDebevec, times);
|
||||
|
||||
// Merge images into an HDR linear image
|
||||
// cout << "Merging images into one HDR image ... ";
|
||||
cv::Mat hdrDebevec;
|
||||
cv::Ptr<cv::MergeDebevec> mergeDebevec = cv::createMergeDebevec();
|
||||
mergeDebevec->process(images, hdrDebevec, times, responseDebevec);
|
||||
// Save HDR image.
|
||||
// imwrite((OUTPUT_DIR "hdrDebevec.hdr"), hdrDebevec);
|
||||
// cout << "saved hdrDebevec.hdr " << endl;
|
||||
|
||||
{
|
||||
std::vector<cv::Mat> empty;
|
||||
empty.swap(images);
|
||||
}
|
||||
|
||||
// Tonemap using Reinhard's method to obtain 24-bit color image
|
||||
// cout << "Tonemaping using Reinhard's method ... ";
|
||||
cv::Mat ldrReinhard;
|
||||
cv::Ptr<cv::TonemapReinhard> tonemapReinhard = cv::createTonemapReinhard(1.5, 0, 0, 0);
|
||||
tonemapReinhard->process(hdrDebevec, ldrReinhard);
|
||||
hdrDebevec.release();
|
||||
|
||||
int type = ldrReinhard.type();
|
||||
ldrReinhard = ldrReinhard * 255;
|
||||
|
||||
ldrReinhard.convertTo(rgb, CV_8U);
|
||||
ldrReinhard.release();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
extern "C"
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_com_xypower_mppreview_Camera2RawFragment_makeHdr3(JNIEnv *env, jclass clazz,
|
||||
jlong exposureTime1, jobject img1, jint length1,
|
||||
jlong exposureTime2, jobject img2, jint length2,
|
||||
jstring outputPath) {
|
||||
|
||||
ALOGI("Start HDR3");
|
||||
|
||||
std::vector<cv::Mat> images;
|
||||
images.resize(2);
|
||||
|
||||
std::vector<jobject> bitmaps;
|
||||
bitmaps.push_back(img1);
|
||||
bitmaps.push_back(img2);
|
||||
|
||||
ALOGI("Start Decode");
|
||||
// omp_set_num_threads(2);
|
||||
// #pragma omp parallel for num_threads(2)
|
||||
for (int idx = 0; idx < 2; idx++)
|
||||
{
|
||||
AndroidBitmapInfo bmpInfo = { 0 };
|
||||
int result = AndroidBitmap_getInfo(env, bitmaps[idx], &bmpInfo);
|
||||
|
||||
if ((ANDROID_BITMAP_FLAGS_IS_HARDWARE & bmpInfo.flags) == ANDROID_BITMAP_FLAGS_IS_HARDWARE)
|
||||
{
|
||||
AHardwareBuffer* hardwareBuffer = NULL;
|
||||
result = AndroidBitmap_getHardwareBuffer(env, bitmaps[idx], &hardwareBuffer);
|
||||
|
||||
void* outVirtualAddress = NULL;
|
||||
int32_t fence = -1;
|
||||
result = AHardwareBuffer_lock(hardwareBuffer, AHARDWAREBUFFER_USAGE_CPU_READ_RARELY, fence, NULL, &outVirtualAddress);
|
||||
cv::Mat tmp(bmpInfo.height, bmpInfo.width, CV_8UC4, outVirtualAddress);
|
||||
tmp.copyTo(images[idx]);
|
||||
AHardwareBuffer_unlock(hardwareBuffer, &fence);
|
||||
AHardwareBuffer_release(hardwareBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
void* outAddress = NULL;
|
||||
result = AndroidBitmap_lockPixels(env, bitmaps[idx], &outAddress);
|
||||
cv::Mat tmp(bmpInfo.height, bmpInfo.width, CV_8UC4, outAddress);
|
||||
tmp.copyTo(images[idx]);
|
||||
AndroidBitmap_unlockPixels(env, bitmaps[idx]);
|
||||
tmp.release();
|
||||
}
|
||||
|
||||
//convert RGB to BGR
|
||||
cv::cvtColor(images[idx], images[idx], cv::COLOR_RGB2BGR);
|
||||
}
|
||||
bitmaps.clear();
|
||||
env->DeleteLocalRef(img1);
|
||||
env->DeleteLocalRef(img2);
|
||||
ALOGI("End Decode");
|
||||
cv::Mat rgb;
|
||||
|
||||
std::vector<float> times;
|
||||
times.push_back((double)(exposureTime1) / 1000000000.0);
|
||||
times.push_back((double)(exposureTime2) / 1000000000.0);
|
||||
|
||||
ALOGI("Start MakeHDR3");
|
||||
makeHdr(times, images, rgb);
|
||||
ALOGI("End MakeHDR3");
|
||||
|
||||
std::string fileName = jstring2string(env, outputPath);
|
||||
std::vector<int> params;
|
||||
params.push_back(cv::IMWRITE_JPEG_QUALITY);
|
||||
params.push_back(100);
|
||||
if (cv::imwrite(fileName.c_str(), rgb, params))
|
||||
{
|
||||
rgb.release();
|
||||
// images[0].release();
|
||||
// images[1].release();
|
||||
// images.clear();
|
||||
|
||||
ALOGI("End HDR3");
|
||||
return JNI_TRUE;
|
||||
}
|
||||
|
||||
// env->DeleteGlobalRef(img1);
|
||||
// env->DeleteGlobalRef(img2);
|
||||
|
||||
return JNI_FALSE;
|
||||
}
|
||||
extern "C"
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_com_xypower_mppreview_Camera2RawFragment_decodeDng(JNIEnv *env, jclass clazz,
|
||||
jobject byte_buffer, jstring output_path) {
|
||||
// TODO: implement decodeDng()
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
#include <jni.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <omp.h>
|
||||
|
||||
#include <android/imagedecoder.h>
|
||||
#include <android/log.h>
|
||||
#include <media/NdkImage.h>
|
||||
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include <opencv2/core.hpp>
|
||||
#include <opencv2/imgproc.hpp>
|
||||
|
||||
#include "hdr.h"
|
||||
|
||||
|
||||
int main( int argc, char** argv )
|
||||
{
|
||||
if (argc != 7)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
std::string outputPath = argv[1];
|
||||
std::string tmpFilePath = argv[2];
|
||||
|
||||
std::vector<float> times;
|
||||
times.push_back((double)(atoi(argv[3])) / 1000000000.0);
|
||||
times.push_back((double)(atoi(argv[5])) / 1000000000.0);
|
||||
|
||||
std::vector<std::string> paths;
|
||||
paths.push_back(std::string(argv[4]));
|
||||
paths.push_back(std::string(argv[6]));
|
||||
|
||||
std::vector<cv::Mat> images;
|
||||
images.resize(2);
|
||||
|
||||
printf("Start Decode");
|
||||
|
||||
#pragma omp parallel for num_threads(2)
|
||||
for (int idx = 0; idx < 2; idx++)
|
||||
{
|
||||
images[idx] = cv::imread(paths[idx].c_str());
|
||||
}
|
||||
|
||||
printf("End Decode");
|
||||
|
||||
cv::Mat rgb;
|
||||
|
||||
printf("Start MakeHDR3");
|
||||
makeHdr(times, images, rgb);
|
||||
printf("End MakeHDR3");
|
||||
|
||||
std::vector<int> params;
|
||||
params.push_back(cv::IMWRITE_JPEG_QUALITY);
|
||||
params.push_back(100);
|
||||
if (cv::imwrite(outputPath.c_str(), rgb, params))
|
||||
{
|
||||
printf("End HDR3");
|
||||
return JNI_TRUE;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
#include <jni.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <omp.h>
|
||||
|
||||
#include <android/imagedecoder.h>
|
||||
#include <android/log.h>
|
||||
#include <media/NdkImage.h>
|
||||
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include <opencv2/core.hpp>
|
||||
#include <opencv2/imgproc.hpp>
|
||||
|
||||
#define HDR_TAG "HDR"
|
||||
#define ALOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, HDR_TAG,__VA_ARGS__)
|
||||
#define ALOGI(...) __android_log_print(ANDROID_LOG_INFO, HDR_TAG,__VA_ARGS__)
|
||||
#define ALOGD(...) __android_log_print(ANDROID_LOG_DEBUG, HDR_TAG, __VA_ARGS__)
|
||||
#define ALOGW(...) __android_log_print(ANDROID_LOG_WARN, HDR_TAG, __VA_ARGS__)
|
||||
#define ALOGE(...) __android_log_print(ANDROID_LOG_ERROR, HDR_TAG,__VA_ARGS__)
|
||||
|
||||
bool makeHdr(std::vector<float>& times, std::vector<cv::Mat>& images, cv::Mat& rgb);
|
@ -0,0 +1,30 @@
|
||||
package com.xypower.mppreview;
|
||||
|
||||
import android.os.AsyncTask;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class AsyncTaskWithCustomThreadPool extends AsyncTask<Void, Void, Void> {
|
||||
|
||||
private static final int CORE_POOL_SIZE = 2; // 自定义线程数
|
||||
private static final int MAXIMUM_POOL_SIZE = 2; // 自定义线程数
|
||||
private static final int KEEP_ALIVE = 3; // 自定义线程存活时间
|
||||
|
||||
public static final Executor THREAD_POOL_EXECUTOR
|
||||
= new ThreadPoolExecutor(CORE_POOL_SIZE, MAXIMUM_POOL_SIZE, KEEP_ALIVE,
|
||||
TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
// 你的后台操作
|
||||
return null;
|
||||
}
|
||||
|
||||
public void executeTask() {
|
||||
executeOnExecutor(THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
}
|
@ -0,0 +1,133 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.xypower.mppreview;
|
||||
|
||||
import java.io.OutputStream;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
/**
|
||||
* A ByteBuffer-backed OutputStream that expands the internal ByteBuffer as required. Given this, the caller should
|
||||
* always access the underlying ByteBuffer via the {@link #buffer()} method until all writes are completed.
|
||||
*
|
||||
* This class is typically used for 2 purposes:
|
||||
*
|
||||
* 1. Write to a ByteBuffer when there is a chance that we may need to expand it in order to fit all the desired data
|
||||
* 2. Write to a ByteBuffer via methods that expect an OutputStream interface
|
||||
*
|
||||
* Hard to track bugs can happen when this class is used for the second reason and unexpected buffer expansion happens.
|
||||
* So, it's best to assume that buffer expansion can always happen. An improvement would be to create a separate class
|
||||
* that throws an error if buffer expansion is required to avoid the issue altogether.
|
||||
*/
|
||||
public class ByteBufferOutputStream extends OutputStream {
|
||||
|
||||
private static final float REALLOCATION_FACTOR = 1.1f;
|
||||
|
||||
private final int initialCapacity;
|
||||
private final int initialPosition;
|
||||
private ByteBuffer buffer;
|
||||
|
||||
/**
|
||||
* Creates an instance of this class that will write to the received `buffer` up to its `limit`. If necessary to
|
||||
* satisfy `write` or `position` calls, larger buffers will be allocated so the {@link #buffer()} method may return
|
||||
* a different buffer than the received `buffer` parameter.
|
||||
*
|
||||
* Prefer one of the constructors that allocate the internal buffer for clearer semantics.
|
||||
*/
|
||||
public ByteBufferOutputStream(ByteBuffer buffer) {
|
||||
this.buffer = buffer;
|
||||
this.initialPosition = buffer.position();
|
||||
this.initialCapacity = buffer.capacity();
|
||||
}
|
||||
|
||||
public ByteBufferOutputStream(int initialCapacity) {
|
||||
this(initialCapacity, false);
|
||||
}
|
||||
|
||||
public ByteBufferOutputStream(int initialCapacity, boolean directBuffer) {
|
||||
this(directBuffer ? ByteBuffer.allocateDirect(initialCapacity) : ByteBuffer.allocate(initialCapacity));
|
||||
}
|
||||
|
||||
public void write(int b) {
|
||||
ensureRemaining(1);
|
||||
buffer.put((byte) b);
|
||||
}
|
||||
|
||||
public void write(byte[] bytes, int off, int len) {
|
||||
ensureRemaining(len);
|
||||
buffer.put(bytes, off, len);
|
||||
}
|
||||
|
||||
public void write(ByteBuffer sourceBuffer) {
|
||||
ensureRemaining(sourceBuffer.remaining());
|
||||
buffer.put(sourceBuffer);
|
||||
}
|
||||
|
||||
public ByteBuffer buffer() {
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public int position() {
|
||||
return buffer.position();
|
||||
}
|
||||
|
||||
public int remaining() {
|
||||
return buffer.remaining();
|
||||
}
|
||||
|
||||
public int limit() {
|
||||
return buffer.limit();
|
||||
}
|
||||
|
||||
public void position(int position) {
|
||||
ensureRemaining(position - buffer.position());
|
||||
buffer.position(position);
|
||||
}
|
||||
|
||||
/**
|
||||
* The capacity of the first internal ByteBuffer used by this class. This is useful in cases where a pooled
|
||||
* ByteBuffer was passed via the constructor and it needs to be returned to the pool.
|
||||
*/
|
||||
public int initialCapacity() {
|
||||
return initialCapacity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure there is enough space to write some number of bytes, expanding the underlying buffer if necessary.
|
||||
* This can be used to avoid incremental expansions through calls to {@link #write(int)} when you know how
|
||||
* many total bytes are needed.
|
||||
*
|
||||
* @param remainingBytesRequired The number of bytes required
|
||||
*/
|
||||
public void ensureRemaining(int remainingBytesRequired) {
|
||||
if (remainingBytesRequired > buffer.remaining())
|
||||
expandBuffer(remainingBytesRequired);
|
||||
}
|
||||
|
||||
private void expandBuffer(int remainingRequired) {
|
||||
int expandSize = Math.max((int) (buffer.limit() * REALLOCATION_FACTOR), buffer.position() + remainingRequired);
|
||||
ByteBuffer temp = ByteBuffer.allocate(expandSize);
|
||||
int limit = limit();
|
||||
buffer.flip();
|
||||
temp.put(buffer);
|
||||
buffer.limit(limit);
|
||||
// reset the old buffer's position so that the partial data in the new buffer cannot be mistakenly consumed
|
||||
// we should ideally only do this for the original buffer, but the additional complexity doesn't seem worth it
|
||||
buffer.position(initialPosition);
|
||||
buffer = temp;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package com.xypower.mppreview;
|
||||
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.hardware.camera2.CameraCharacteristics;
|
||||
|
||||
public class CoordinateTransformer {
|
||||
private final Matrix mPreviewToCameraTransform;
|
||||
private RectF mDriverRectF;
|
||||
|
||||
/**
|
||||
* Convert rectangles to / from camera coordinate and preview coordinate space.
|
||||
* @param chr camera characteristics
|
||||
* @param previewRect the preview rectangle size and position.
|
||||
*/
|
||||
public CoordinateTransformer(CameraCharacteristics chr, RectF previewRect) {
|
||||
if (!hasNonZeroArea(previewRect)) {
|
||||
throw new IllegalArgumentException("previewRect");
|
||||
}
|
||||
Rect rect = chr.get(CameraCharacteristics.SENSOR_INFO_ACTIVE_ARRAY_SIZE);
|
||||
Integer sensorOrientation = chr.get(CameraCharacteristics.SENSOR_ORIENTATION);
|
||||
int rotation = sensorOrientation == null ? 90 : sensorOrientation;
|
||||
mDriverRectF = new RectF(rect);
|
||||
Integer face = chr.get(CameraCharacteristics.LENS_FACING);
|
||||
boolean mirrorX = face != null && face == CameraCharacteristics.LENS_FACING_FRONT;
|
||||
mPreviewToCameraTransform = previewToCameraTransform(mirrorX, rotation, previewRect);
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform a rectangle in preview view space into a new rectangle in
|
||||
* camera view space.
|
||||
* @param source the rectangle in preview view space
|
||||
* @return the rectangle in camera view space.
|
||||
*/
|
||||
public RectF toCameraSpace(RectF source) {
|
||||
RectF result = new RectF();
|
||||
mPreviewToCameraTransform.mapRect(result, source);
|
||||
return result;
|
||||
}
|
||||
|
||||
private Matrix previewToCameraTransform(boolean mirrorX, int sensorOrientation,
|
||||
RectF previewRect) {
|
||||
Matrix transform = new Matrix();
|
||||
// Need mirror for front camera.
|
||||
transform.setScale(mirrorX ? -1 : 1, 1);
|
||||
// Because preview orientation is different form sensor orientation,
|
||||
// rotate to same orientation, Counterclockwise.
|
||||
transform.postRotate(-sensorOrientation);
|
||||
// Map rotated matrix to preview rect
|
||||
transform.mapRect(previewRect);
|
||||
// Map preview coordinates to driver coordinates
|
||||
Matrix fill = new Matrix();
|
||||
fill.setRectToRect(previewRect, mDriverRectF, Matrix.ScaleToFit.FILL);
|
||||
// Concat the previous transform on top of the fill behavior.
|
||||
transform.setConcat(fill, transform);
|
||||
// finally get transform matrix
|
||||
return transform;
|
||||
}
|
||||
|
||||
private boolean hasNonZeroArea(RectF rect) {
|
||||
return rect.width() != 0 && rect.height() != 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,243 @@
|
||||
package com.xypower.mppreview;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.ImageDecoder;
|
||||
import android.graphics.ImageFormat;
|
||||
import android.hardware.camera2.CameraCharacteristics;
|
||||
import android.hardware.camera2.CaptureResult;
|
||||
import android.hardware.camera2.DngCreator;
|
||||
import android.media.Image;
|
||||
import android.media.ImageReader;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.xypower.mppreview.bean.PngPhotoBean;
|
||||
import com.xypower.mppreview.interfaces.CompleteCallback;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ImageSaver implements Runnable {
|
||||
|
||||
private final static String TAG = "HDR";
|
||||
private final Image mImage;
|
||||
private final File mFile;
|
||||
private final CaptureResult mCaptureResult;
|
||||
private final CameraCharacteristics mCharacteristics;
|
||||
private CompleteCallback mCallback;
|
||||
private final ImagePair mImagePair;
|
||||
|
||||
private final Camera2RawFragment.RefCountedAutoCloseable<ImageReader> mReader;
|
||||
|
||||
public static class ImageInfo {
|
||||
public long exposureTime;
|
||||
public int length;
|
||||
public Bitmap bitmap;
|
||||
|
||||
ImageInfo(Bitmap bmp, int length, long exp) {
|
||||
this.exposureTime = exp;
|
||||
this.length = length;
|
||||
bitmap = bmp;
|
||||
}
|
||||
}
|
||||
|
||||
public static class ImagePair {
|
||||
public List<ImageInfo> mImages;
|
||||
public int mExpectedCount;
|
||||
public Runnable mRunnable;
|
||||
|
||||
public ImagePair(int expectedCount) {
|
||||
mImages = new ArrayList<>();
|
||||
mExpectedCount = expectedCount;
|
||||
mRunnable = null;
|
||||
}
|
||||
|
||||
public void setRunnable(Runnable runnable) {
|
||||
mRunnable = runnable;
|
||||
}
|
||||
|
||||
public void addImage(Bitmap bitmap, int length, long exp) {
|
||||
boolean isFull = false;
|
||||
ImageInfo imageInfo = new ImageInfo(bitmap, length, exp);
|
||||
synchronized (mImages) {
|
||||
mImages.add(imageInfo);
|
||||
isFull = (mImages.size() == mExpectedCount);
|
||||
}
|
||||
|
||||
if (mRunnable != null && isFull) {
|
||||
mRunnable.run();
|
||||
}
|
||||
}
|
||||
|
||||
public List<ImageInfo> getImages() {
|
||||
return mImages;
|
||||
}
|
||||
}
|
||||
|
||||
public static abstract class ImagePairRunnable implements Runnable {
|
||||
|
||||
protected ImagePair mImagePair;
|
||||
|
||||
public ImagePairRunnable(ImagePair imagePair) {
|
||||
mImagePair = imagePair;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private ArrayList<PngPhotoBean> mlist = new ArrayList<>();//用来存储已拍照的照片名称
|
||||
|
||||
public ImageSaver(Image image, File file, CaptureResult result, CameraCharacteristics characteristics,
|
||||
Camera2RawFragment.RefCountedAutoCloseable<ImageReader> reader, ArrayList<PngPhotoBean> list,
|
||||
CompleteCallback callback, ImagePair imagePair) {
|
||||
mImage = image;
|
||||
mFile = file;
|
||||
mCaptureResult = result;
|
||||
mCharacteristics = characteristics;
|
||||
mReader = reader;
|
||||
mlist = list;
|
||||
mCallback = callback;
|
||||
mImagePair = imagePair;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
boolean success = false;
|
||||
int format = mImage.getFormat();
|
||||
switch (format) {
|
||||
case ImageFormat.JPEG: {
|
||||
ByteBuffer buffer = mImage.getPlanes()[0].getBuffer();
|
||||
byte[] bytes = new byte[buffer.remaining()];
|
||||
buffer.get(bytes);
|
||||
FileOutputStream output = null;
|
||||
try {
|
||||
output = new FileOutputStream(mFile);
|
||||
output.write(bytes);
|
||||
success = true;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
mImage.close();
|
||||
closeOutput(output);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ImageFormat.RAW_SENSOR: {
|
||||
DngCreator dngCreator = new DngCreator(mCharacteristics, mCaptureResult);
|
||||
|
||||
if (mImagePair != null) {
|
||||
ByteBuffer byteBuffer = null;
|
||||
ByteBufferOutputStream baos = null;
|
||||
|
||||
Long t = mCaptureResult.get(CaptureResult.SENSOR_EXPOSURE_TIME);
|
||||
|
||||
try {
|
||||
byteBuffer = ByteBuffer.allocateDirect(mImage.getWidth() * mImage.getHeight() * 2 + 81768);
|
||||
baos = new ByteBufferOutputStream(byteBuffer);
|
||||
Log.d(TAG, "Before Saving DNG Exp=" + t.toString());
|
||||
dngCreator.writeImage(baos, mImage);
|
||||
byteBuffer.limit(byteBuffer.position());
|
||||
byteBuffer.flip();
|
||||
Log.d(TAG, "After Saving DNG Exp=" + t.toString() + " size=" + byteBuffer.limit());
|
||||
ImageDecoder.OnHeaderDecodedListener listener = new ImageDecoder.OnHeaderDecodedListener() {
|
||||
@Override
|
||||
public void onHeaderDecoded(@NonNull ImageDecoder decoder, @NonNull ImageDecoder.ImageInfo info, @NonNull ImageDecoder.Source source) {
|
||||
// decoder.setAllocator(ImageDecoder.ALLOCATOR_SOFTWARE);
|
||||
decoder.setAllocator(ImageDecoder.ALLOCATOR_HARDWARE);
|
||||
// decoder.setTargetSize(4702, 3520);
|
||||
}
|
||||
};
|
||||
|
||||
Log.i(TAG, "Start Hardware Decoding Exp=" + t.toString() + " TID=" + Thread.currentThread().getId());
|
||||
ImageDecoder imageDecoder = null;
|
||||
Bitmap bmp = null;
|
||||
// ImageDecoder.Source source = ImageDecoder.createSource(mFile);
|
||||
ImageDecoder.Source source = ImageDecoder.createSource(byteBuffer);
|
||||
|
||||
|
||||
try {
|
||||
bmp = ImageDecoder.decodeBitmap(source, listener);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
Log.i(TAG, "End Hardware Decoding Exp=" + t.toString());
|
||||
|
||||
|
||||
byteBuffer.clear();
|
||||
byteBuffer = null;
|
||||
mImagePair.addImage(bmp, 0, t.longValue());
|
||||
// bmp.recycle();
|
||||
// bmp = null;
|
||||
success = true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
dngCreator.close();
|
||||
mImage.close();
|
||||
closeOutput(baos);
|
||||
}
|
||||
} else {
|
||||
FileOutputStream output = null;
|
||||
try {
|
||||
output = new FileOutputStream(mFile);
|
||||
dngCreator.writeImage(output, mImage);
|
||||
success = true;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
mImage.close();
|
||||
dngCreator.close();
|
||||
closeOutput(output);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
mReader.close();
|
||||
|
||||
}
|
||||
|
||||
private static void closeOutput(OutputStream outputStream) {
|
||||
if (null != outputStream) {
|
||||
try {
|
||||
outputStream.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// private static void clear() {
|
||||
// if (null != outputStream) {
|
||||
// try {
|
||||
// outputStream.close();
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// private void saveJpeg(Image image,String name) {
|
||||
// Image.Plane[] planes = image.getPlanes();
|
||||
// ByteBuffer buffer = planes[0].getBuffer();
|
||||
// int pixelStride = planes[0].getPixelStride();
|
||||
// int rowStride = planes[0].getRowStride();
|
||||
// int rowPadding = rowStride - pixelStride * mWidth;
|
||||
//
|
||||
// Bitmap bitmap = Bitmap.createBitmap(mWidth + rowPadding / pixelStride, mHeight, Bitmap.Config.ARGB_8888);
|
||||
// bitmap.copyPixelsFromBuffer(buffer);
|
||||
// //bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fos);
|
||||
// ImageSaveUtil.saveBitmap2file(bitmap,getApplicationContext(),name);
|
||||
//
|
||||
// }
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
package com.xypower.mppreview;
|
||||
|
||||
import android.content.Context;
|
||||
import android.hardware.camera2.CameraCharacteristics;
|
||||
import android.hardware.camera2.CaptureResult;
|
||||
import android.media.Image;
|
||||
import android.media.ImageReader;
|
||||
|
||||
import com.xypower.mppreview.bean.PngPhotoBean;
|
||||
import com.xypower.mppreview.interfaces.CompleteCallback;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ImageSaverBuilder {
|
||||
public Image mImage;
|
||||
public File mFile;
|
||||
public CaptureResult mCaptureResult;
|
||||
public CameraCharacteristics mCharacteristics;
|
||||
public Context mContext;
|
||||
public Camera2RawFragment.RefCountedAutoCloseable<ImageReader> mReader;
|
||||
public ImageSaver.ImagePair mImagePair;
|
||||
|
||||
private ArrayList<PngPhotoBean> mlist;
|
||||
private CompleteCallback mCallback;
|
||||
|
||||
/**
|
||||
* Construct a new ImageSaverBuilder using the given {@link Context}.
|
||||
*
|
||||
* @param context a {@link Context} to for accessing the
|
||||
* {@link android.provider.MediaStore}.
|
||||
*/
|
||||
public ImageSaverBuilder(final Context context) {
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
public synchronized ImageSaverBuilder setRefCountedReader(Camera2RawFragment.RefCountedAutoCloseable<ImageReader> reader) {
|
||||
if (reader == null) throw new NullPointerException();
|
||||
|
||||
mReader = reader;
|
||||
return this;
|
||||
}
|
||||
|
||||
public synchronized ImageSaverBuilder setImage(final Image image) {
|
||||
if (image == null) throw new NullPointerException();
|
||||
mImage = image;
|
||||
return this;
|
||||
}
|
||||
|
||||
public synchronized ImageSaverBuilder setImagePair(final ImageSaver.ImagePair imagePair) {
|
||||
if (imagePair == null) throw new NullPointerException();
|
||||
mImagePair = imagePair;
|
||||
return this;
|
||||
}
|
||||
|
||||
public synchronized ImageSaverBuilder setFile(final File file) {
|
||||
if (file == null) throw new NullPointerException();
|
||||
mFile = file;
|
||||
return this;
|
||||
}
|
||||
|
||||
public synchronized ImageSaverBuilder setResult(final CaptureResult result) {
|
||||
if (result == null) throw new NullPointerException();
|
||||
mCaptureResult = result;
|
||||
return this;
|
||||
}
|
||||
|
||||
public synchronized ImageSaverBuilder setList(ArrayList<PngPhotoBean> list) {
|
||||
if (list == null) throw new NullPointerException();
|
||||
mlist = list;
|
||||
return this;
|
||||
}
|
||||
|
||||
public synchronized ImageSaverBuilder setCharacteristics(final CameraCharacteristics characteristics) {
|
||||
if (characteristics == null) throw new NullPointerException();
|
||||
mCharacteristics = characteristics;
|
||||
return this;
|
||||
}
|
||||
|
||||
public synchronized ImageSaverBuilder setCallback(CompleteCallback callback) {
|
||||
mCallback = callback;
|
||||
return this;
|
||||
}
|
||||
public synchronized ImageSaver buildIfComplete() {
|
||||
if (!isComplete()) {
|
||||
return null;
|
||||
}
|
||||
return new ImageSaver(mImage, mFile, mCaptureResult, mCharacteristics, mReader, mlist,mCallback, mImagePair);
|
||||
}
|
||||
|
||||
public synchronized String getSaveLocation() {
|
||||
return (mFile == null) ? "Unknown" : mFile.toString();
|
||||
}
|
||||
|
||||
private boolean isComplete() {
|
||||
return mImage != null && mFile != null && mCaptureResult != null && mCharacteristics != null;
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.xypower.mppreview;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.camera.core.ImageAnalysis;
|
||||
import androidx.camera.core.ImageProxy;
|
||||
|
||||
import com.xypower.mppreview.bean.Contants;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class MyAnalyzer implements ImageAnalysis.Analyzer{
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
@Override
|
||||
public void analyze(@NonNull ImageProxy image) {
|
||||
Log.d(Contants.TAG, "Image's stamp is " + Objects.requireNonNull(image.getImage()).getTimestamp());
|
||||
image.close();
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package com.xypower.mppreview.adapter;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.xypower.mppreview.R;
|
||||
import com.xypower.mppreview.interfaces.OnItemClickListener;
|
||||
|
||||
public class ItemAdapter extends RecyclerView.Adapter<ItemAdapter.MyViewHolder> {
|
||||
private Integer count;
|
||||
public OnItemClickListener listener;
|
||||
|
||||
public class MyViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
|
||||
private final TextView title;
|
||||
private OnItemClickListener listeners;
|
||||
public MyViewHolder(View view, OnItemClickListener listener) {
|
||||
super(view);
|
||||
this.listeners = listener;
|
||||
title = view.findViewById(R.id.channel);
|
||||
title.setOnClickListener(this);
|
||||
}
|
||||
|
||||
public TextView getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (listeners != null) {
|
||||
listeners.onItemClick(v, getAdapterPosition());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ItemAdapter(Integer itemcount) {
|
||||
this.count = itemcount;
|
||||
}
|
||||
|
||||
|
||||
public void setOnClickListener(OnItemClickListener listener) {
|
||||
this.listener = listener;
|
||||
|
||||
}
|
||||
@NonNull
|
||||
@Override
|
||||
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_view, parent, false);
|
||||
return new MyViewHolder(view,listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull MyViewHolder holder, @SuppressLint("RecyclerView") int position) {
|
||||
// Integer item = itemList.get(position);
|
||||
holder.getTitle().setText("通道"+(position+1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return count;
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package com.xypower.mppreview.bean;
|
||||
|
||||
public class Contants {
|
||||
public static final String TAG = "MpPriview";
|
||||
public static final String HDRNUM = "hdrnum";
|
||||
public static final String CAMERAID = "CAMERAID";
|
||||
public static final String FILENAME_FORMAT = "yyyy-MM-dd-HH-mm-ss-SSS";
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.xypower.mppreview.bean;
|
||||
|
||||
public class PngPhotoBean {
|
||||
|
||||
private long etime;
|
||||
private String path;
|
||||
|
||||
public long getEtime() {
|
||||
return etime;
|
||||
}
|
||||
|
||||
public void setEtime(long etime) {
|
||||
this.etime = etime;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
package com.xypower.mppreview.interfaces;
|
||||
|
||||
public interface CompleteCallback {
|
||||
void onResult();
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package com.xypower.mppreview.interfaces;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
public interface OnItemClickListener {
|
||||
void onItemClick(View v, int position);
|
||||
}
|
||||
|
@ -0,0 +1,49 @@
|
||||
package com.xypower.mppreview.ui;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.xypower.mppreview.Camera2RawFragment;
|
||||
import com.xypower.mppreview.R;
|
||||
import com.xypower.mppreview.bean.Contants;
|
||||
|
||||
public class CameraActivity extends AppCompatActivity {
|
||||
|
||||
private final static String TAG = "HDR";
|
||||
public int intExtra;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
setContentView(R.layout.activity_camera);
|
||||
Intent intent = getIntent();
|
||||
intExtra = intent.getIntExtra(Contants.HDRNUM, 0);
|
||||
if (null == savedInstanceState) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putInt(Contants.HDRNUM,intExtra);
|
||||
getSupportFragmentManager().beginTransaction().setReorderingAllowed(true).replace(R.id.container, Camera2RawFragment.class, bundle).commit();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTrimMemory(int level) {
|
||||
Log.w(TAG, "Event onTrimMemory level=" + level);
|
||||
try {
|
||||
System.gc();
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLowMemory() {
|
||||
Log.w(TAG, "Event onLowMemory");
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.xypower.mppreview.utils;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.camera.core.CameraInfo;
|
||||
import androidx.camera.lifecycle.ProcessCameraProvider;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
public class CameraUtils {
|
||||
public static int getNumberOfCameras(Context context) {
|
||||
List<CameraInfo> availableCameraInfos;
|
||||
ListenableFuture<ProcessCameraProvider> instance = ProcessCameraProvider.getInstance(context);
|
||||
try {
|
||||
ProcessCameraProvider processCameraProvider = instance.get();
|
||||
availableCameraInfos = processCameraProvider.getAvailableCameraInfos();
|
||||
} catch (ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return availableCameraInfos.size();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package com.xypower.mppreview.utils;
|
||||
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
public class HdrUtil {
|
||||
|
||||
public static String generateTimestamp() {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmmss_SSS", Locale.US);
|
||||
return sdf.format(new Date());
|
||||
}
|
||||
|
||||
// public static void createHDR(Mat[] images, float[] exposureTimes, Mat hdrImage,String filepath) {
|
||||
// Mat[] images32f = new Mat[images.length];
|
||||
// for (int i = 0; i < images.length; i++) {
|
||||
// images32f[i] = new Mat();
|
||||
// images[i].convertTo(images32f[i], CvType.CV_32F);
|
||||
// }
|
||||
//
|
||||
// Mat response = new Mat();
|
||||
// Mat times = new Mat(exposureTimes.length, 1, CvType.CV_32F);
|
||||
// for (int i = 0; i < exposureTimes.length; i++) {
|
||||
// times.put(i, 0, exposureTimes[i]);
|
||||
// }
|
||||
//
|
||||
// // Calibrate the camera response
|
||||
// CalibrateDebevec calibrate = createCalibrateDebevec();
|
||||
// calibrate.process(Arrays.asList(images32f), response, times);
|
||||
//
|
||||
// // Merge the images into an HDR image
|
||||
// MergeDebevec merge = createMergeDebevec();
|
||||
// merge.process(Arrays.asList(images32f), hdrImage, times, response);
|
||||
// saveHDRImage(hdrImage,filepath);
|
||||
// }
|
||||
//
|
||||
// public static void saveHDRImage(Mat hdrImage, String filePath) {
|
||||
// Imgcodecs.imwrite(filePath, hdrImage);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package com.xypower.mppreview.widget;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
|
||||
public class ErrorDialog extends DialogFragment {
|
||||
|
||||
private String mErrorMessage;
|
||||
|
||||
public ErrorDialog() {
|
||||
mErrorMessage = "Unknown error occurred!";
|
||||
}
|
||||
|
||||
// Build a dialog with a custom message (Fragments require default constructor).
|
||||
public static ErrorDialog buildErrorDialog(String errorMessage) {
|
||||
ErrorDialog dialog = new ErrorDialog();
|
||||
dialog.mErrorMessage = errorMessage;
|
||||
return dialog;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
final Activity activity = getActivity();
|
||||
return new AlertDialog.Builder(activity).setMessage(mErrorMessage).setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
activity.finish();
|
||||
}
|
||||
}).create();
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package com.xypower.mppreview.widget;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.xypower.mppreview.R;
|
||||
|
||||
public class PermissionConfirmationDialog extends DialogFragment {
|
||||
|
||||
public static PermissionConfirmationDialog newInstance() {
|
||||
return new PermissionConfirmationDialog();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
final Fragment parent = getParentFragment();
|
||||
return new AlertDialog.Builder(getActivity()).setMessage(R.string.request_permission).setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
}
|
||||
}).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
getActivity().finish();
|
||||
}
|
||||
}).create();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="85.84757"
|
||||
android:endY="92.4963"
|
||||
android:startX="42.9492"
|
||||
android:startY="49.59793"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||
android:strokeWidth="1"
|
||||
android:strokeColor="#00000000" />
|
||||
</vector>
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path
|
||||
android:fillColor="#3DDC84"
|
||||
android:pathData="M0,0h108v108h-108z" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M9,0L9,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,0L19,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,0L29,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,0L39,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,0L49,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,0L59,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,0L69,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,0L79,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M89,0L89,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M99,0L99,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,9L108,9"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,19L108,19"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,29L108,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,39L108,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,49L108,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,59L108,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,69L108,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,79L108,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,89L108,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,99L108,99"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,29L89,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,39L89,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,49L89,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,59L89,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,69L89,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,79L89,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,19L29,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,19L39,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,19L49,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,19L59,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,19L69,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,19L79,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
</vector>
|
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
<solid android:color="@color/shutter_icon"/>
|
||||
<stroke
|
||||
android:width="5dp"
|
||||
android:color="#FFFFFF"
|
||||
/>
|
||||
</shape>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
<solid android:color="@color/shutter_icon_pressed"/>
|
||||
</shape>
|
Before Width: | Height: | Size: 196 B After Width: | Height: | Size: 196 B |
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:keepScreenOn="true"
|
||||
tools:context=".ui.CameraActivity">
|
||||
|
||||
<!-- res/layout/example_activity.xml -->
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:keepScreenOn="true"
|
||||
tools:context=".ui.CameraChannelActivity">
|
||||
|
||||
<androidx.camera.view.PreviewView
|
||||
android:id="@+id/viewFinder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<!-- <Button-->
|
||||
<!-- android:id="@+id/image_capture_button"-->
|
||||
<!-- android:layout_width="110dp"-->
|
||||
<!-- android:layout_height="110dp"-->
|
||||
<!-- android:layout_marginEnd="50dp"-->
|
||||
<!-- android:layout_marginBottom="50dp"-->
|
||||
<!-- android:elevation="2dp"-->
|
||||
<!-- android:text="拍照"-->
|
||||
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||
<!-- app:layout_constraintEnd_toStartOf="@id/vertical_centerline"-->
|
||||
<!-- app:layout_constraintLeft_toLeftOf="parent" />-->
|
||||
<Button
|
||||
android:id="@+id/image_capture_button"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginBottom="40dp"
|
||||
android:background="@mipmap/takepic"
|
||||
android:shadowColor="@null"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/vertical_centerline"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent=".50" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -0,0 +1,109 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingLeft="15dp"
|
||||
android:paddingTop="20dp"
|
||||
android:paddingRight="15dp"
|
||||
android:keepScreenOn="true"
|
||||
tools:context=".MainActivity">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/hdrhint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="曝光补偿:"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spinner"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:entries="@array/size"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/hdrhint"
|
||||
app:layout_constraintLeft_toRightOf="@+id/hdrhint"
|
||||
app:layout_constraintTop_toTopOf="@+id/hdrhint" />
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/hdrtakepic"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="HDR拍照"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/hdrhint" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/systakepic"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="拍照"
|
||||
app:layout_constraintLeft_toRightOf="@id/hdrtakepic"
|
||||
app:layout_constraintTop_toTopOf="@+id/hdrtakepic" />
|
||||
|
||||
<!-- <Button-->
|
||||
<!-- android:id="@+id/channel1"-->
|
||||
<!-- android:layout_width="100dp"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:text="通道一"-->
|
||||
<!-- app:layout_constraintLeft_toLeftOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@+id/hdrtakepic" />-->
|
||||
|
||||
<!-- <Button-->
|
||||
<!-- android:id="@+id/channel2"-->
|
||||
<!-- android:layout_width="100dp"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginLeft="15dp"-->
|
||||
<!-- android:text="通道二"-->
|
||||
<!-- app:layout_constraintLeft_toRightOf="@+id/channel1"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="@+id/channel1" />-->
|
||||
|
||||
<!-- <Button-->
|
||||
<!-- android:id="@+id/channel3"-->
|
||||
<!-- android:layout_width="100dp"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginLeft="15dp"-->
|
||||
<!-- android:text="通道三"-->
|
||||
<!-- app:layout_constraintLeft_toRightOf="@+id/channel2"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="@+id/channel1" />-->
|
||||
|
||||
<!-- <Button-->
|
||||
<!-- android:id="@+id/channel4"-->
|
||||
<!-- android:layout_width="100dp"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:text="通道四"-->
|
||||
<!-- app:layout_constraintLeft_toLeftOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@+id/channel1" />-->
|
||||
|
||||
<!-- <Button-->
|
||||
<!-- android:id="@+id/channel5"-->
|
||||
<!-- android:layout_width="100dp"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginLeft="15dp"-->
|
||||
<!-- android:text="通道五"-->
|
||||
<!-- app:layout_constraintLeft_toRightOf="@+id/channel4"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="@+id/channel4" />-->
|
||||
|
||||
<!-- <Button-->
|
||||
<!-- android:id="@+id/channel6"-->
|
||||
<!-- android:layout_width="100dp"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginLeft="15dp"-->
|
||||
<!-- android:text="通道六"-->
|
||||
<!-- app:layout_constraintLeft_toRightOf="@+id/channel5"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="@+id/channel4" />-->
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
app:layout_constraintTop_toBottomOf="@id/systakepic"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"/>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".Camera2RawFragment">
|
||||
|
||||
<com.xypower.mppreview.AutoFitTextureView
|
||||
android:id="@+id/texture"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/takepic"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginBottom="40dp"
|
||||
android:background="@mipmap/takepic"
|
||||
android:shadowColor="@null"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:visibility="invisible"
|
||||
android:id="@+id/rorpic"
|
||||
android:src="@mipmap/ror"
|
||||
app:layout_constraintTop_toTopOf="@+id/takepic"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/takepic"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/takepic"
|
||||
app:layout_constraintRight_toRightOf="@+id/takepic"
|
||||
android:layout_width="45dp"
|
||||
android:layout_height="45dp">
|
||||
|
||||
</ImageView>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
<Button
|
||||
android:id="@+id/channel"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="wrap_content"
|
||||
tools:ignore="MissingConstraints" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context="com.xypower.mpmaster.MainActivity">
|
||||
|
||||
<item
|
||||
android:id="@+id/action_picture"
|
||||
android:orderInCategory="100"
|
||||
android:title="Capture"
|
||||
app:showAsAction="always" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_focus"
|
||||
android:orderInCategory="100"
|
||||
android:title="Focus"
|
||||
app:showAsAction="always" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_comp0"
|
||||
android:orderInCategory="100"
|
||||
android:title="Reset"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_comp1"
|
||||
android:orderInCategory="100"
|
||||
android:title="X1"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_comp2"
|
||||
android:orderInCategory="100"
|
||||
android:title="X2"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_comp3"
|
||||
android:orderInCategory="100"
|
||||
android:title="X3"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_comp4"
|
||||
android:orderInCategory="100"
|
||||
android:title="X4"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_comp_1"
|
||||
android:orderInCategory="100"
|
||||
android:title="-X1"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_comp_2"
|
||||
android:orderInCategory="100"
|
||||
android:title="-X2"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_comp_3"
|
||||
android:orderInCategory="100"
|
||||
android:title="-X3"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_comp_4"
|
||||
android:orderInCategory="100"
|
||||
android:title="-X4"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_info"
|
||||
android:orderInCategory="100"
|
||||
android:title="Info"
|
||||
app:showAsAction="never" />
|
||||
|
||||
|
||||
</menu>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 982 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 7.6 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 5.8 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 7.6 KiB |
@ -0,0 +1,18 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.MpPreview" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">@color/purple_200</item>
|
||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||
<item name="colorOnPrimary">@color/black</item>
|
||||
<!-- Secondary brand color. -->
|
||||
<item name="colorSecondary">@color/teal_200</item>
|
||||
<item name="colorSecondaryVariant">@color/teal_200</item>
|
||||
<item name="colorOnSecondary">@color/black</item>
|
||||
<!-- Status bar color. -->
|
||||
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
</style>
|
||||
</resources>
|