dng自动转png
parent
c7c564ddec
commit
92ec7a8535
@ -0,0 +1,17 @@
|
||||
package com.xypower.mppreview;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
public class CameraActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_camera);
|
||||
if (null == savedInstanceState) {
|
||||
getSupportFragmentManager().beginTransaction().setReorderingAllowed(true).replace(R.id.container, Camera2RawFragment.class, null).commit();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package com.xypower.mppreview;
|
||||
|
||||
import static java.lang.System.loadLibrary;
|
||||
|
||||
public class HdrUtil {
|
||||
|
||||
|
||||
}
|
@ -1,113 +1,104 @@
|
||||
package com.xypower.mppreview;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
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 android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
||||
//import org.opencv.android.OpenCVLoader;
|
||||
import android.text.Editable;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
|
||||
|
||||
public static int ExposureComp = 0;
|
||||
private EditText hdrnum;
|
||||
private Button systakepic;
|
||||
private Button hdrtakepic;
|
||||
private ActivityResultLauncher<Intent> photoResultLauncher;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
// if (OpenCVLoader.initDebug()) {
|
||||
// Log.d("dfsdfd", "成功");
|
||||
// } else {
|
||||
// Log.d("dfsdfd", "失败");
|
||||
// }
|
||||
|
||||
initView();
|
||||
initActivityResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
getMenuInflater().inflate(R.menu.menu_main, menu);
|
||||
return true;
|
||||
private void initView() {
|
||||
hdrtakepic = findViewById(R.id.hdrtakepic);
|
||||
systakepic = findViewById(R.id.systakepic);
|
||||
hdrnum = findViewById(R.id.hdr_num);
|
||||
|
||||
hdrtakepic.setOnClickListener(this);
|
||||
systakepic.setOnClickListener(this);
|
||||
}
|
||||
|
||||
private void initActivityResult() {
|
||||
photoResultLauncher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback<ActivityResult>() {
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
int id = item.getItemId();
|
||||
int comp = -1000;
|
||||
switch (id) {
|
||||
case R.id.action_picture:
|
||||
takePicture();
|
||||
break;
|
||||
case R.id.action_focus:
|
||||
doFocus();
|
||||
break;
|
||||
case R.id.action_comp0:
|
||||
comp = 0;
|
||||
break;
|
||||
case R.id.action_comp1:
|
||||
comp = 1;
|
||||
break;
|
||||
case R.id.action_comp2:
|
||||
comp = 2;
|
||||
break;
|
||||
case R.id.action_comp3:
|
||||
comp = 3;
|
||||
break;
|
||||
case R.id.action_comp4:
|
||||
comp = 4;
|
||||
break;
|
||||
case R.id.action_comp_1:
|
||||
comp = -1;
|
||||
break;
|
||||
case R.id.action_comp_2:
|
||||
comp = -2;
|
||||
break;
|
||||
case R.id.action_comp_3:
|
||||
comp = -3;
|
||||
break;
|
||||
case R.id.action_comp_4:
|
||||
comp = -4;
|
||||
break;
|
||||
case R.id.action_info:
|
||||
new AlertDialog.Builder(this)
|
||||
.setMessage(R.string.intro_message)
|
||||
.setPositiveButton(android.R.string.ok, null)
|
||||
.show();
|
||||
public void onActivityResult(ActivityResult result) {
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (comp> -1000) {
|
||||
ExposureComp = comp;
|
||||
restartFragment();
|
||||
});
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
@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();
|
||||
getSupportFragmentManager().beginTransaction().replace(R.id.container, Camera2RawFragment.newInstance()).commit();
|
||||
}
|
||||
|
||||
private void doFocus() {
|
||||
Camera2RawFragment fragment = (Camera2RawFragment)getSupportFragmentManager().findFragmentById(R.id.container);
|
||||
Camera2RawFragment fragment = (Camera2RawFragment) getSupportFragmentManager().findFragmentById(R.id.container);
|
||||
fragment.doFocus();
|
||||
}
|
||||
|
||||
private void takePicture() {
|
||||
Camera2RawFragment fragment = (Camera2RawFragment)getSupportFragmentManager().findFragmentById(R.id.container);
|
||||
Camera2RawFragment fragment = (Camera2RawFragment) getSupportFragmentManager().findFragmentById(R.id.container);
|
||||
fragment.isHandTakePic = false;
|
||||
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);
|
||||
Editable text = hdrnum.getText();
|
||||
String s = text.toString();
|
||||
if (s != null && !s.equals("")) {
|
||||
double v = Double.parseDouble(s);
|
||||
intent.putExtra("hdrnum", v);
|
||||
}
|
||||
startActivity(intent);
|
||||
break;
|
||||
case R.id.systakepic:
|
||||
PhotoUtil.openCamera(this, photoResultLauncher);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.xypower.mppreview;
|
||||
|
||||
public class PngPhotoBean {
|
||||
|
||||
public long etime;
|
||||
public String path;
|
||||
|
||||
|
||||
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -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,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>
|
Loading…
Reference in New Issue