适配调整

main
Matthew 8 months ago
parent be15a2030a
commit d0ac749705

@ -3,10 +3,11 @@ buildscript {
repositories {
jcenter()
google()
mavenCentral()
}
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 {
jcenter()
google()
mavenCentral()
}
dependencies {
compile "com.android.support:support-v4:27.0.2"
compile "com.android.support:support-v13:27.0.2"
compile "com.android.support:cardview-v7:27.0.2"
compile "com.android.support:appcompat-v7:27.0.2"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:2.0.4'
}
// 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
android {
compileSdkVersion 27
buildToolsVersion "27.0.2"
compileSdk 33
defaultConfig {
minSdkVersion 21
@ -43,8 +41,8 @@ android {
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
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.Message;
import android.os.SystemClock;
import android.support.v13.app.FragmentCompat;
import android.support.v4.app.ActivityCompat;
import android.text.TextUtils;
import android.util.Log;
import android.util.Size;
import android.util.SparseIntArray;
@ -119,7 +119,7 @@ import java.util.concurrent.atomic.AtomicInteger;
* </ul>
*/
public class Camera2RawFragment extends Fragment
implements View.OnClickListener, FragmentCompat.OnRequestPermissionsResultCallback {
implements View.OnClickListener {
/**
* Conversion from screen rotation to JPEG orientation.
@ -609,7 +609,7 @@ public class Camera2RawFragment extends Fragment
@Override
public void onViewCreated(final View view, Bundle savedInstanceState) {
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);
// 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() {
if (shouldShowRationale()) {
PermissionConfirmationDialog.newInstance().show(getChildFragmentManager(), "dialog");
// PermissionConfirmationDialog.newInstance().show(getChildFragmentManager(), "dialog");
} 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() {
for (String permission : CAMERA_PERMISSIONS) {
if (FragmentCompat.shouldShowRequestPermissionRationale(this, permission)) {
return true;
}
// if (FragmentCompat.shouldShowRequestPermissionRationale(this, permission)) {
// return true;
// }
}
return false;
}
@ -1829,8 +1829,8 @@ public class Camera2RawFragment extends Fragment
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
FragmentCompat.requestPermissions(parent, CAMERA_PERMISSIONS,
REQUEST_CAMERA_PERMISSIONS);
// FragmentCompat.requestPermissions(parent, CAMERA_PERMISSIONS,
// REQUEST_CAMERA_PERMISSIONS);
}
})
.setNegativeButton(android.R.string.cancel,

@ -43,17 +43,6 @@
android:layout_gravity="center"
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>
</RelativeLayout>

@ -29,7 +29,7 @@
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_below="@id/texture"
android:background="#4285f4">
<Button
@ -39,16 +39,6 @@
android:layout_gravity="center"
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>
</RelativeLayout>

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

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

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