Compare commits
No commits in common. 'main' and 'mtkhdr' 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,66 @@
|
|||||||
|
plugins {
|
||||||
|
id 'com.android.application'
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdk 33
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
applicationId "com.xypower.mppreview"
|
||||||
|
minSdk 30
|
||||||
|
targetSdk 30
|
||||||
|
versionCode 1
|
||||||
|
versionName "1.0"
|
||||||
|
|
||||||
|
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'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
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'
|
||||||
|
}
|
@ -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,51 @@
|
|||||||
|
<?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.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=".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,91 @@
|
|||||||
|
# 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")
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
${OpenCV_LIBS}
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
# set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS_RELEASE "-strip-all")
|
@ -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,34 @@
|
|||||||
|
package com.xypower.mppreview;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.view.WindowInsets;
|
||||||
|
import android.view.WindowInsetsController;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
|
||||||
|
import com.xypower.mppreview.bean.Contants;
|
||||||
|
|
||||||
|
public class CameraActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
package com.xypower.mppreview;
|
||||||
|
|
||||||
|
public interface CompleteCallback {
|
||||||
|
void onResult();
|
||||||
|
}
|
@ -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,16 @@
|
|||||||
|
package com.xypower.mppreview;
|
||||||
|
|
||||||
|
import static java.lang.System.loadLibrary;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,247 @@
|
|||||||
|
package com.xypower.mppreview;
|
||||||
|
|
||||||
|
import static com.xypower.mppreview.Camera2RawFragment.makeHdr;
|
||||||
|
import static com.xypower.mppreview.HdrUtil.generateTimestamp;
|
||||||
|
|
||||||
|
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.CaptureRequest;
|
||||||
|
import android.hardware.camera2.CaptureResult;
|
||||||
|
import android.hardware.camera2.DngCreator;
|
||||||
|
import android.media.Image;
|
||||||
|
import android.media.ImageReader;
|
||||||
|
import android.os.Environment;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.xypower.mppreview.bean.Contants;
|
||||||
|
import com.xypower.mppreview.bean.PngPhotoBean;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
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 Context mContext;
|
||||||
|
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 {
|
||||||
|
private List<ImageInfo> mImages;
|
||||||
|
private int mExpectedCount;
|
||||||
|
private 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, Context context,
|
||||||
|
Camera2RawFragment.RefCountedAutoCloseable<ImageReader> reader, ArrayList<PngPhotoBean> list,
|
||||||
|
CompleteCallback callback, ImagePair imagePair) {
|
||||||
|
mImage = image;
|
||||||
|
mFile = file;
|
||||||
|
mCaptureResult = result;
|
||||||
|
mCharacteristics = characteristics;
|
||||||
|
mContext = context;
|
||||||
|
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");
|
||||||
|
dngCreator.writeImage(baos, mImage);
|
||||||
|
byteBuffer.limit(byteBuffer.position());
|
||||||
|
byteBuffer.flip();
|
||||||
|
Log.d(TAG, "After Saving DNG pos=" + byteBuffer.position());
|
||||||
|
|
||||||
|
/*
|
||||||
|
FileOutputStream output = null;
|
||||||
|
try {
|
||||||
|
output = new FileOutputStream(mFile);
|
||||||
|
dngCreator.writeImage(output, mImage);
|
||||||
|
success = true;
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
mImage.close();
|
||||||
|
closeOutput(output);
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
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_HARDWARE);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Log.i("HDR", "Start Hardware Decode");
|
||||||
|
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("HDR", "End Hardware Decode");
|
||||||
|
|
||||||
|
byteBuffer = null;
|
||||||
|
mImagePair.addImage(bmp, 0, t.longValue());
|
||||||
|
success = true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
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();
|
||||||
|
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 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 java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
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, mContext, 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,152 @@
|
|||||||
|
package com.xypower.mppreview;
|
||||||
|
|
||||||
|
import static java.lang.System.loadLibrary;
|
||||||
|
|
||||||
|
import androidx.activity.result.ActivityResult;
|
||||||
|
import androidx.activity.result.ActivityResultCallback;
|
||||||
|
import androidx.activity.result.ActivityResultLauncher;
|
||||||
|
import androidx.activity.result.contract.ActivityResultContracts;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.core.app.ActivityCompat;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.text.Editable;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.Spinner;
|
||||||
|
|
||||||
|
import com.xypower.mppreview.bean.Contants;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
public class MainActivity extends AppCompatActivity implements View.OnClickListener, AdapterView.OnItemSelectedListener {
|
||||||
|
|
||||||
|
static {
|
||||||
|
loadLibrary("mppreview");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int MY_PERMISSIONS_REQUEST_FOREGROUND_SERVICE = 100;
|
||||||
|
|
||||||
|
public static int ExposureComp = 0;
|
||||||
|
private Button systakepic;
|
||||||
|
private Button hdrtakepic;
|
||||||
|
private ActivityResultLauncher<Intent> photoResultLauncher;
|
||||||
|
private int picsize = 0;
|
||||||
|
|
||||||
|
|
||||||
|
protected native void test();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_main);
|
||||||
|
initView();
|
||||||
|
initActivityResult();
|
||||||
|
|
||||||
|
|
||||||
|
String[] accessPermissions = new String[]{Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.FOREGROUND_SERVICE, Manifest.permission.READ_PHONE_STATE,
|
||||||
|
/*Manifest.permission.PACKAGE_USAGE_STATS,*/
|
||||||
|
/*Manifest.permission.SET_TIME,*/};
|
||||||
|
boolean needRequire = false;
|
||||||
|
for (String access : accessPermissions) {
|
||||||
|
int curPermission = ActivityCompat.checkSelfPermission(MainActivity.this, access);
|
||||||
|
if (curPermission != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
needRequire = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (needRequire) {
|
||||||
|
ActivityCompat.requestPermissions(MainActivity.this, accessPermissions, MY_PERMISSIONS_REQUEST_FOREGROUND_SERVICE);
|
||||||
|
// return;
|
||||||
|
}
|
||||||
|
|
||||||
|
File file = this.getFilesDir();
|
||||||
|
|
||||||
|
String path = "/sdcard/com.xypower.mppreview/";
|
||||||
|
file = new File(path);
|
||||||
|
if (!file.exists()) {
|
||||||
|
file.mkdirs();
|
||||||
|
}
|
||||||
|
|
||||||
|
new Thread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
test();
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initView() {
|
||||||
|
hdrtakepic = findViewById(R.id.hdrtakepic);
|
||||||
|
systakepic = findViewById(R.id.systakepic);
|
||||||
|
Spinner spinner = findViewById(R.id.spinner);
|
||||||
|
hdrtakepic.setOnClickListener(this);
|
||||||
|
systakepic.setOnClickListener(this);
|
||||||
|
spinner.setOnItemSelectedListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initActivityResult() {
|
||||||
|
photoResultLauncher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback<ActivityResult>() {
|
||||||
|
@Override
|
||||||
|
public void onActivityResult(ActivityResult result) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
// if (OpenCVLoader.initDebug()) {
|
||||||
|
// Log.d("dfsdfd", "成功");
|
||||||
|
// } else {
|
||||||
|
// Log.d("dfsdfd", "失败");
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
private void restartFragment() {
|
||||||
|
getSupportFragmentManager().beginTransaction().replace(R.id.container, Camera2RawFragment.newInstance()).commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void doFocus() {
|
||||||
|
Camera2RawFragment fragment = (Camera2RawFragment) getSupportFragmentManager().findFragmentById(R.id.container);
|
||||||
|
fragment.doFocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void takePicture() {
|
||||||
|
Camera2RawFragment fragment = (Camera2RawFragment) getSupportFragmentManager().findFragmentById(R.id.container);
|
||||||
|
fragment.takePicture();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
int id = view.getId();
|
||||||
|
switch (id) {
|
||||||
|
case R.id.hdrtakepic:
|
||||||
|
Intent intent = new Intent(this, CameraActivity.class);
|
||||||
|
intent.putExtra(Contants.HDRNUM, picsize);
|
||||||
|
startActivity(intent);
|
||||||
|
break;
|
||||||
|
case R.id.systakepic:
|
||||||
|
PhotoUtil.openCamera(this, photoResultLauncher);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||||
|
picsize = position;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNothingSelected(AdapterView<?> parent) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
package com.xypower.mppreview.bean;
|
||||||
|
|
||||||
|
public class Contants {
|
||||||
|
public static final String HDRNUM = "hdrnum";
|
||||||
|
}
|
@ -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,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>
|
Before Width: | Height: | Size: 196 B After Width: | Height: | Size: 196 B |
@ -0,0 +1,16 @@
|
|||||||
|
<?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=".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,49 @@
|
|||||||
|
<?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"
|
||||||
|
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="wrap_content"
|
||||||
|
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="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="15dp"
|
||||||
|
android:text="拍照"
|
||||||
|
app:layout_constraintLeft_toRightOf="@id/hdrtakepic"
|
||||||
|
app:layout_constraintTop_toTopOf="@+id/hdrtakepic" />
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -0,0 +1,26 @@
|
|||||||
|
<?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="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="40dp"
|
||||||
|
android:background="@mipmap/takepic"
|
||||||
|
android:shadowColor="@null"
|
||||||
|
android:text="拍照"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toRightOf="parent" />
|
||||||
|
|
||||||
|
</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: 10 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>
|
@ -0,0 +1,27 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string-array name="size">
|
||||||
|
<item>默认</item>
|
||||||
|
<item>X1</item>
|
||||||
|
<item>X2</item>
|
||||||
|
<item>X3</item>
|
||||||
|
<item>X4</item>
|
||||||
|
<item>X5</item>
|
||||||
|
<item>X6</item>
|
||||||
|
<item>X7</item>
|
||||||
|
<item>X8</item>
|
||||||
|
<item>X9</item>
|
||||||
|
<item>X10</item>
|
||||||
|
<item>X11</item>
|
||||||
|
<item>X12</item>
|
||||||
|
<item>X13</item>
|
||||||
|
<item>X14</item>
|
||||||
|
<item>X15</item>
|
||||||
|
<item>X16</item>
|
||||||
|
<item>X17</item>
|
||||||
|
<item>X18</item>
|
||||||
|
<item>X19</item>
|
||||||
|
<item>X20</item>
|
||||||
|
<item>X0</item>
|
||||||
|
</string-array>
|
||||||
|
</resources>
|
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<color name="purple_200">#FFBB86FC</color>
|
||||||
|
<color name="purple_500">#FF6200EE</color>
|
||||||
|
<color name="purple_700">#FF3700B3</color>
|
||||||
|
<color name="teal_200">#FF03DAC5</color>
|
||||||
|
<color name="teal_700">#FF018786</color>
|
||||||
|
<color name="black">#FF000000</color>
|
||||||
|
<color name="white">#FFFFFFFF</color>
|
||||||
|
</resources>
|
@ -0,0 +1,18 @@
|
|||||||
|
<resources>
|
||||||
|
<string name="app_name">微拍预览</string>
|
||||||
|
<!-- TODO: Remove or change this placeholder text -->
|
||||||
|
<string name="hello_blank_fragment">Hello blank fragment</string>
|
||||||
|
<string name="picture">Picture</string>
|
||||||
|
<string name="description_info">Info</string>
|
||||||
|
<string name="request_permission">This app needs camera permission.</string>
|
||||||
|
<string name="intro_message">
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
|
||||||
|
This sample demonstrates how to use the Camera2 API to capture RAW
|
||||||
|
camera buffers and save them as DNG files.
|
||||||
|
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</string>
|
||||||
|
</resources>
|
@ -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_500</item>
|
||||||
|
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||||
|
<item name="colorOnPrimary">@color/white</item>
|
||||||
|
<!-- Secondary brand color. -->
|
||||||
|
<item name="colorSecondary">@color/teal_200</item>
|
||||||
|
<item name="colorSecondaryVariant">@color/teal_700</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>
|
@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
|
Sample backup rules file; uncomment and customize as necessary.
|
||||||
|
See https://developer.android.com/guide/topics/data/autobackup
|
||||||
|
for details.
|
||||||
|
Note: This file is ignored for devices older that API 31
|
||||||
|
See https://developer.android.com/about/versions/12/backup-restore
|
||||||
|
-->
|
||||||
|
<full-backup-content>
|
||||||
|
<!--
|
||||||
|
<include domain="sharedpref" path="."/>
|
||||||
|
<exclude domain="sharedpref" path="device.xml"/>
|
||||||
|
-->
|
||||||
|
</full-backup-content>
|
@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
|
Sample data extraction rules file; uncomment and customize as necessary.
|
||||||
|
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
|
||||||
|
for details.
|
||||||
|
-->
|
||||||
|
<data-extraction-rules>
|
||||||
|
<cloud-backup>
|
||||||
|
<!-- TODO: Use <include> and <exclude> to control what is backed up.
|
||||||
|
<include .../>
|
||||||
|
<exclude .../>
|
||||||
|
-->
|
||||||
|
</cloud-backup>
|
||||||
|
<!--
|
||||||
|
<device-transfer>
|
||||||
|
<include .../>
|
||||||
|
<exclude .../>
|
||||||
|
</device-transfer>
|
||||||
|
-->
|
||||||
|
</data-extraction-rules>
|
@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<paths xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<external-path name="external_files" path="." />
|
||||||
|
|
||||||
|
</paths>
|
@ -0,0 +1,17 @@
|
|||||||
|
package com.xypower.mppreview;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Example local unit test, which will execute on the development machine (host).
|
||||||
|
*
|
||||||
|
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||||
|
*/
|
||||||
|
public class ExampleUnitTest {
|
||||||
|
@Test
|
||||||
|
public void addition_isCorrect() {
|
||||||
|
assertEquals(4, 2 + 2);
|
||||||
|
}
|
||||||
|
}
|
@ -1,10 +1,21 @@
|
|||||||
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
buildscript {
|
||||||
|
ext.kotlin_version = "1.6.0" // 使用适合你项目的Kotlin版本
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
|
// 其他依赖...
|
||||||
|
}
|
||||||
|
}
|
||||||
|
plugins {
|
||||||
|
id 'com.android.application' version '7.2.2' apply false
|
||||||
|
id 'com.android.library' version '7.2.2' apply false
|
||||||
|
id 'org.jetbrains.kotlin.android' version '1.6.0' apply false
|
||||||
|
}
|
||||||
|
|
||||||
|
task clean(type: Delete) {
|
||||||
|
delete rootProject.buildDir
|
||||||
|
}
|
@ -1,2 +1,23 @@
|
|||||||
android.enableJetifier=true
|
# Project-wide Gradle settings.
|
||||||
android.useAndroidX=true
|
# IDE (e.g. Android Studio) users:
|
||||||
|
# Gradle settings configured through the IDE *will override*
|
||||||
|
# any settings specified in this file.
|
||||||
|
# For more details on how to configure your build environment visit
|
||||||
|
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||||
|
# Specifies the JVM arguments used for the daemon process.
|
||||||
|
# The setting is particularly useful for tweaking memory settings.
|
||||||
|
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
||||||
|
# When configured, Gradle will run in incubating parallel mode.
|
||||||
|
# This option should only be used with decoupled projects. More details, visit
|
||||||
|
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||||
|
# org.gradle.parallel=true
|
||||||
|
# AndroidX package structure to make it clearer which packages are bundled with the
|
||||||
|
# Android operating system, and which are packaged with your app"s APK
|
||||||
|
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||||
|
android.useAndroidX=true
|
||||||
|
# Enables namespacing of each library's R class so that its R class includes only the
|
||||||
|
# resources declared in the library itself and none from the library's dependencies,
|
||||||
|
# thereby reducing the size of the R class for that library
|
||||||
|
android.nonTransitiveRClass=true
|
||||||
|
|
||||||
|
opencvsdk=D:/Workspace/deps/opencv-mobile-4.10.0-android
|
@ -1,6 +1,6 @@
|
|||||||
#Wed Apr 10 15:27:10 PDT 2013
|
#Mon May 22 15:39:17 CST 2023
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
|
||||||
distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-7.5-bin.zip
|
distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-7.5-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
distributionPath=wrapper/dists
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
# GOOGLE SAMPLE PACKAGING DATA
|
|
||||||
#
|
|
||||||
# This file is used by Google as part of our samples packaging process.
|
|
||||||
# End users may safely ignore this file. It has no relevance to other systems.
|
|
||||||
---
|
|
||||||
|
|
||||||
status: PUBLISHED
|
|
||||||
technologies: [Android]
|
|
||||||
categories: [Media]
|
|
||||||
languages: [Java]
|
|
||||||
solutions: [Mobile]
|
|
||||||
github: googlesamples/android-Camera2Raw
|
|
||||||
level: BEGINNER
|
|
||||||
icon: Camera2RawSample/src/main/res/drawable-xxhdpi/ic_launcher.png
|
|
||||||
license: apache2
|
|