Skip to content
This repository has been archived by the owner on Feb 11, 2025. It is now read-only.

Commit

Permalink
v1.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
s1204IT committed Jan 25, 2025
1 parent 8f11906 commit f291165
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ android {
minSdk = 28
targetSdk = 22
versionCode = 15
versionName = "1.4.3"
versionName = "1.5.0"
multiDexEnabled = false
proguardFiles += 'proguard-rules.pro'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import android.provider.Settings;

public class BootCompletedReceiver extends BroadcastReceiver {
public void onReceive(Context c, Intent i) {
if (Settings.System.canWrite(c)) {
Settings.System.putInt(c.getContentResolver(), CameraActivity.camera_forced_shuttersound_key, 0);
public void onReceive(Context context, Intent intent) {
if (Settings.System.canWrite(context)) {
Settings.System.putInt(context.getContentResolver(), CameraActivity.camera_forced_shuttersound_key, 0);
}
}
}
39 changes: 39 additions & 0 deletions app/src/main/java/me/s1204/galaxycamsnd/DeviceAdminReceiver.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,43 @@
package me.s1204.galaxycamsnd;

import android.content.Context;
import android.content.Intent;
import android.provider.Settings;
import android.widget.Toast;

public class DeviceAdminReceiver extends android.app.admin.DeviceAdminReceiver {

void doDisable(Context context) {
if (Settings.System.canWrite(context)) {
Settings.System.putInt(context.getContentResolver(), CameraActivity.camera_forced_shuttersound_key, 0);
}
}

void showToast(Context context, String msg) {
Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
}

@Override
public void onReceive(Context context, Intent intent) {
doDisable(context);
}

@Override
public void onEnabled(Context context, Intent intent) {
doDisable(context);
showToast(context, context.getString(R.string.admin_receiver_status_enabled));
}

@Override
public CharSequence onDisableRequested(Context context, Intent intent) {
context.startActivity(new Intent(context, DisableActivity.class).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
return context.getString(R.string.admin_receiver_status_disable_warning);
}

@Override
public void onDisabled(Context context, Intent intent) {
context.startActivity(new Intent(context, DisableActivity.class).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
showToast(context, context.getString(R.string.admin_receiver_status_disabled));
}

}
3 changes: 3 additions & 0 deletions app/src/main/res/values-ja/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@
<string name="dialog">この機能を実行すると、シャッター音が再強制化されます。\nただし、再度無効化する場合は、アプリをインストールし直す必要があります。\n\n続行しますか?</string>
<string name="yes">はい</string>
<string name="no">いいえ</string>
<string name="admin_receiver_status_enabled">端末管理者が有効になりました</string>
<string name="admin_receiver_status_disabled">端末管理者が無効になりました。</string>
<string name="admin_receiver_status_disable_warning">端末管理者を無効にしますか?</string>
</resources>
3 changes: 3 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@
<string name="dialog">When you perform this feature, the shutter sound will be re-forced.\nHowever, if you want to disable it again, you will need to reinstall this app.\n\nDo you want to continue?</string>
<string name="yes">Yes</string>
<string name="no">No</string>
<string name="admin_receiver_status_enabled">Device admin was enabled.</string>
<string name="admin_receiver_status_disabled">Device admin was disabled.</string>
<string name="admin_receiver_status_disable_warning">Do you want to disable device admin?</string>
</resources>
6 changes: 5 additions & 1 deletion app/src/main/res/xml/device_admin.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<device-admin />
<device-admin xmlns:android="http://schemas.android.com/apk/res/android">
<uses-policies>
<disable-camera />
</uses-policies>
</device-admin>

0 comments on commit f291165

Please # to comment.