适配调整

main
Matthew 8 months ago
parent be15a2030a
commit d0ac749705

@ -3,10 +3,11 @@ buildscript {
repositories { repositories {
jcenter() jcenter()
google() google()
mavenCentral()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.0.1' classpath 'com.android.tools.build:gradle:7.2.1'
} }
} }
@ -15,13 +16,12 @@ apply plugin: 'com.android.application'
repositories { repositories {
jcenter() jcenter()
google() google()
mavenCentral()
} }
dependencies { dependencies {
compile "com.android.support:support-v4:27.0.2" implementation 'com.android.support:appcompat-v7:28.0.0'
compile "com.android.support:support-v13:27.0.2" implementation 'com.android.support.constraint:constraint-layout:2.0.4'
compile "com.android.support:cardview-v7:27.0.2"
compile "com.android.support:appcompat-v7:27.0.2"
} }
// The sample build uses multiple directories to // The sample build uses multiple directories to
@ -33,9 +33,7 @@ List<String> dirs = [
'template'] // boilerplate code that is generated by the sample template process 'template'] // boilerplate code that is generated by the sample template process
android { android {
compileSdkVersion 27 compileSdk 33
buildToolsVersion "27.0.2"
defaultConfig { defaultConfig {
minSdkVersion 21 minSdkVersion 21
@ -43,8 +41,8 @@ android {
} }
compileOptions { compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7 sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_8
} }
sourceSets { sourceSets {
@ -59,4 +57,6 @@ android {
} }
ndkVersion '26.1.10909125'
} }

@ -55,8 +55,8 @@ import android.os.HandlerThread;
import android.os.Looper; import android.os.Looper;
import android.os.Message; import android.os.Message;
import android.os.SystemClock; import android.os.SystemClock;
import android.support.v13.app.FragmentCompat;
import android.support.v4.app.ActivityCompat; import android.support.v4.app.ActivityCompat;
import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.util.Size; import android.util.Size;
import android.util.SparseIntArray; import android.util.SparseIntArray;
@ -119,7 +119,7 @@ import java.util.concurrent.atomic.AtomicInteger;
* </ul> * </ul>
*/ */
public class Camera2RawFragment extends Fragment public class Camera2RawFragment extends Fragment
implements View.OnClickListener, FragmentCompat.OnRequestPermissionsResultCallback { implements View.OnClickListener {
/** /**
* Conversion from screen rotation to JPEG orientation. * Conversion from screen rotation to JPEG orientation.
@ -609,7 +609,7 @@ public class Camera2RawFragment extends Fragment
@Override @Override
public void onViewCreated(final View view, Bundle savedInstanceState) { public void onViewCreated(final View view, Bundle savedInstanceState) {
view.findViewById(R.id.picture).setOnClickListener(this); view.findViewById(R.id.picture).setOnClickListener(this);
view.findViewById(R.id.info).setOnClickListener(this); // view.findViewById(R.id.info).setOnClickListener(this);
mTextureView = (AutoFitTextureView) view.findViewById(R.id.texture); mTextureView = (AutoFitTextureView) view.findViewById(R.id.texture);
// Setup a new OrientationEventListener. This is used to handle rotation events like a // Setup a new OrientationEventListener. This is used to handle rotation events like a
@ -804,9 +804,9 @@ public class Camera2RawFragment extends Fragment
*/ */
private void requestCameraPermissions() { private void requestCameraPermissions() {
if (shouldShowRationale()) { if (shouldShowRationale()) {
PermissionConfirmationDialog.newInstance().show(getChildFragmentManager(), "dialog"); // PermissionConfirmationDialog.newInstance().show(getChildFragmentManager(), "dialog");
} else { } else {
FragmentCompat.requestPermissions(this, CAMERA_PERMISSIONS, REQUEST_CAMERA_PERMISSIONS); // FragmentCompat.requestPermissions(this, CAMERA_PERMISSIONS, REQUEST_CAMERA_PERMISSIONS);
} }
} }
@ -832,9 +832,9 @@ public class Camera2RawFragment extends Fragment
*/ */
private boolean shouldShowRationale() { private boolean shouldShowRationale() {
for (String permission : CAMERA_PERMISSIONS) { for (String permission : CAMERA_PERMISSIONS) {
if (FragmentCompat.shouldShowRequestPermissionRationale(this, permission)) { // if (FragmentCompat.shouldShowRequestPermissionRationale(this, permission)) {
return true; // return true;
} // }
} }
return false; return false;
} }
@ -1829,8 +1829,8 @@ public class Camera2RawFragment extends Fragment
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
FragmentCompat.requestPermissions(parent, CAMERA_PERMISSIONS, // FragmentCompat.requestPermissions(parent, CAMERA_PERMISSIONS,
REQUEST_CAMERA_PERMISSIONS); // REQUEST_CAMERA_PERMISSIONS);
} }
}) })
.setNegativeButton(android.R.string.cancel, .setNegativeButton(android.R.string.cancel,

@ -43,17 +43,6 @@
android:layout_gravity="center" android:layout_gravity="center"
android:text="@string/picture" /> android:text="@string/picture" />
<ImageButton
android:id="@+id/info"
style="@android:style/Widget.Material.Light.Button.Borderless"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
android:contentDescription="@string/description_info"
android:padding="20dp"
android:src="@drawable/ic_action_info" />
</FrameLayout> </FrameLayout>
</RelativeLayout> </RelativeLayout>

@ -29,7 +29,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:layout_below="@id/texture"
android:background="#4285f4"> android:background="#4285f4">
<Button <Button
@ -39,16 +39,6 @@
android:layout_gravity="center" android:layout_gravity="center"
android:text="@string/picture" /> android:text="@string/picture" />
<ImageButton
android:id="@+id/info"
android:contentDescription="@string/description_info"
style="@android:style/Widget.Material.Light.Button.Borderless"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end"
android:padding="20dp"
android:src="@drawable/ic_action_info" />
</FrameLayout> </FrameLayout>
</RelativeLayout> </RelativeLayout>

@ -16,15 +16,7 @@
--> -->
<resources> <resources>
<string name="app_name">Camera2Raw</string> <string name="app_name">微拍预览</string>
<string name="intro_message"> <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> </string>
</resources> </resources>

@ -14,7 +14,7 @@
limitations under the License. limitations under the License.
--> -->
<resources> <resources>
<string name="picture">Picture</string> <string name="picture">拍照</string>
<string name="description_info">Info</string> <string name="description_info">Info</string>
<string name="request_permission">This app needs camera permission.</string> <string name="request_permission">This app needs camera permission.</string>
</resources> </resources>

@ -1,6 +1,6 @@
#Wed Apr 10 15:27:10 PDT 2013 #Wed Apr 10 15:27:10 PDT 2013
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-7.5-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
Loading…
Cancel
Save