version:1.2

fix:
update:更新app name,增加快捷控制
This commit is contained in:
2022-10-25 09:34:58 +08:00
parent 15e9854c48
commit 652135f45c
27 changed files with 1258 additions and 123 deletions

View File

@@ -0,0 +1,483 @@
package com.uiuios.aios.activity;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.hardware.camera2.CameraAccessException;
import android.hardware.camera2.CameraCharacteristics;
import android.hardware.camera2.CameraManager;
import android.media.AudioManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.provider.Settings;
import android.util.Log;
import android.view.View;
import android.widget.SeekBar;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.baidu.location.BDAbstractLocationListener;
import com.baidu.location.BDLocation;
import com.baidu.location.LocationClient;
import com.uiuios.aios.R;
import com.uiuios.aios.manager.AmapManager;
import com.uiuios.aios.utils.BrightnessUtils;
import java.util.Arrays;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
public class ControlActivity extends AppCompatActivity {
private static final String TAG = ControlActivity.class.getSimpleName();
@BindView(R.id.tv_wifi)
TextView tv_wifi;
@BindView(R.id.tv_wifi_ssid)
TextView tv_wifi_ssid;
@BindView(R.id.tv_bt)
TextView tv_bt;
@BindView(R.id.tv_bt_ssid)
TextView tv_bt_ssid;
@BindView(R.id.tv_font_size)
TextView tv_font_size;
@BindView(R.id.seekBar)
SeekBar seekBar;
@BindView(R.id.seekbar_brightness)
SeekBar seekbar_brightness;
@BindView(R.id.seekbar_sound)
SeekBar seekbar_sound;
@BindView(R.id.tv_sound)
TextView tv_sound;
@BindView(R.id.tv_battery)
TextView tv_battery;
@BindView(R.id.tv_electricity)
TextView tv_electricity;
@BindView(R.id.tv_flashlight)
TextView tv_flashlight;
@BindView(R.id.tv_flashlight_switch)
TextView tv_flashlight_switch;
@BindView(R.id.tv_brightness)
TextView tv_brightness;
@BindView(R.id.tv_location)
TextView tv_location;
@BindView(R.id.cl_wifi)
ConstraintLayout cl_wifi;
@BindView(R.id.cl_bt)
ConstraintLayout cl_bt;
@BindView(R.id.cl_battery)
ConstraintLayout cl_battery;
@BindView(R.id.cl_flashlight)
ConstraintLayout cl_flashlight;
private ContentResolver crv;
private static final String ACTION_FLASHLIGHT_CHANGED =
"com.android.settings.flashlight.action.FLASHLIGHT_CHANGED";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_control);
ButterKnife.bind(this);
crv = getContentResolver();
initView();
}
private void initView() {
getWifi();
registerReceivers();
getBluetooth();
registerBluetoothReceiver();
getFlashlight();
getFontSize();
getLocation();
getBrightness();
getSound();
}
private void getWifi() {
cl_wifi.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(android.provider.Settings.ACTION_WIFI_SETTINGS));
}
});
if (isWifiEnabled()) {
tv_wifi_ssid.setText(getSSID());
cl_wifi.setBackground(getDrawable(R.drawable.control_background_item));
} else {
tv_wifi_ssid.setText("未连接");
cl_wifi.setBackground(getDrawable(R.drawable.control_background_item_dis));
}
}
public boolean isWifiEnabled() {
WifiManager wifiMgr = (WifiManager) getSystemService(Context.WIFI_SERVICE);
if (wifiMgr.getWifiState() == WifiManager.WIFI_STATE_ENABLED) {
ConnectivityManager connManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo wifiInfo = connManager
.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
return wifiInfo.isConnected();
} else {
return false;
}
}
private WifiReceiver mWifiReceiver;
private void registerReceivers() {
registerWiFiReceiver();
}
private void registerWiFiReceiver() {
if (mWifiReceiver == null) {
mWifiReceiver = new WifiReceiver();
}
IntentFilter filter = new IntentFilter();
filter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION);
filter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION);
filter.addAction(WifiManager.RSSI_CHANGED_ACTION);
filter.addAction(WifiManager.NETWORK_IDS_CHANGED_ACTION);
filter.addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION);
filter.addAction(WifiManager.CONFIGURED_NETWORKS_CHANGED_ACTION);
filter.addAction(WifiManager.LINK_CONFIGURATION_CHANGED_ACTION);
filter.addAction(WifiManager.SUPPLICANT_STATE_CHANGED_ACTION);
filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
registerReceiver(mWifiReceiver, filter);
}
public class WifiReceiver extends BroadcastReceiver {
private static final String TAG = "wifiReceiver";
@Override
public void onReceive(Context context, Intent intent) {
switch (intent.getAction()) {
case WifiManager.RSSI_CHANGED_ACTION:
Log.e(TAG, "wifi信号强度变化");
break;
//wifi连接上与否
case WifiManager.NETWORK_STATE_CHANGED_ACTION:
NetworkInfo info = intent.getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO);
if (info.getState().equals(NetworkInfo.State.DISCONNECTED)) {
Log.e(TAG, "wifi断开");
tv_wifi_ssid.setText("未连接");
cl_wifi.setBackground(getDrawable(R.drawable.control_background_item_dis));
} else if (info.getState().equals(NetworkInfo.State.CONNECTED)) {
WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
WifiInfo wifiInfo = wifiManager.getConnectionInfo();
//获取当前wifi名称
String newSSID = wifiInfo.getSSID();
tv_wifi_ssid.setText(newSSID);
cl_wifi.setBackground(getDrawable(R.drawable.control_background_item));
}
break;
//wifi打开与否
case WifiManager.WIFI_STATE_CHANGED_ACTION:
int wifistate = intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE, WifiManager.WIFI_STATE_DISABLED);
if (wifistate == WifiManager.WIFI_STATE_DISABLED) {
Log.e(TAG, "系统关闭wifi");
tv_wifi_ssid.setText("");
cl_wifi.setBackground(getDrawable(R.drawable.control_background_item_dis));
} else if (wifistate == WifiManager.WIFI_STATE_ENABLED) {
Log.e(TAG, "系统开启wifi");
}
break;
default:
}
}
}
/**
* 获取当前连接WIFI的SSID
*/
public String getSSID() {
WifiManager wm = (WifiManager) getSystemService(WIFI_SERVICE);
if (wm != null) {
WifiInfo winfo = wm.getConnectionInfo();
if (winfo != null) {
String s = winfo.getSSID();
if (s.length() > 2 && s.charAt(0) == '"' && s.charAt(s.length() - 1) == '"') {
return s.substring(1, s.length() - 1);
}
}
}
return "";
}
private void getBluetooth() {
cl_bt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(Settings.ACTION_BLUETOOTH_SETTINGS));
}
});
}
private BluetoothMonitorReceiver bleListenerReceiver;
private void registerBluetoothReceiver() {
bleListenerReceiver = new BluetoothMonitorReceiver();
IntentFilter intentFilter = new IntentFilter();
// 监视蓝牙关闭和打开的状态
intentFilter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
// 监视蓝牙设备与APP连接的状态
intentFilter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED);
intentFilter.addAction(BluetoothDevice.ACTION_ACL_CONNECTED);
// 注册广播
registerReceiver(this.bleListenerReceiver, intentFilter);
}
public class BluetoothMonitorReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (action != null) {
switch (action) {
case BluetoothAdapter.ACTION_STATE_CHANGED:
int blueState = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, 0);
switch (blueState) {
case BluetoothAdapter.STATE_TURNING_ON:
tv_bt_ssid.setText("蓝牙正在打开");
cl_bt.setBackground(getDrawable(R.drawable.control_background_item));
break;
case BluetoothAdapter.STATE_ON:
tv_bt_ssid.setText("蓝牙已经打开");
cl_bt.setBackground(getDrawable(R.drawable.control_background_item));
break;
case BluetoothAdapter.STATE_TURNING_OFF:
tv_bt_ssid.setText("蓝牙正在关闭");
cl_bt.setBackground(getDrawable(R.drawable.control_background_item));
break;
case BluetoothAdapter.STATE_OFF:
tv_bt_ssid.setText("");
cl_bt.setBackground(getDrawable(R.drawable.control_background_item_dis));
break;
default:
}
break;
case BluetoothDevice.ACTION_ACL_CONNECTED:
tv_bt_ssid.setText("蓝牙设备已连接");
cl_bt.setBackground(getDrawable(R.drawable.control_background_item));
break;
case BluetoothDevice.ACTION_ACL_DISCONNECTED:
tv_bt_ssid.setText("蓝牙设备已断开");
cl_bt.setBackground(getDrawable(R.drawable.control_background_item_dis));
break;
default:
}
}
}
}
private void getFlashlight() {
if (isFlashlightEnabled()) {
tv_flashlight_switch.setText("");
} else {
tv_flashlight_switch.setText("");
}
cl_flashlight.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (isFlashlightEnabled()) {
Settings.Secure.putInt(crv, Settings.Secure.FLASHLIGHT_ENABLED, 0);
sendBroadcast(new Intent(ACTION_FLASHLIGHT_CHANGED));
tv_flashlight_switch.setText("");
} else {
Settings.Secure.putInt(crv, Settings.Secure.FLASHLIGHT_ENABLED, 1);
sendBroadcast(new Intent(ACTION_FLASHLIGHT_CHANGED));
tv_flashlight_switch.setText("");
}
}
});
}
private boolean isFlashlightAvailable() {
int defaultAvailability = 0;
try {
// check if there is a flash unit
if (getCameraId(this) != null) {
defaultAvailability = 1;
}
} catch (CameraAccessException e) {
Log.e(TAG, "Error getting camera id.", e);
}
return Settings.Secure.getInt(crv, Settings.Secure.FLASHLIGHT_AVAILABLE, defaultAvailability) == 1;
}
private static String getCameraId(Context context) throws CameraAccessException {
final CameraManager cameraManager = context.getSystemService(CameraManager.class);
final String[] ids = cameraManager.getCameraIdList();
for (String id : ids) {
CameraCharacteristics c = cameraManager.getCameraCharacteristics(id);
Boolean flashAvailable = c.get(CameraCharacteristics.FLASH_INFO_AVAILABLE);
Integer lensFacing = c.get(CameraCharacteristics.LENS_FACING);
if (flashAvailable != null && flashAvailable
&& lensFacing != null && lensFacing == CameraCharacteristics.LENS_FACING_BACK) {
return id;
}
}
return null;
}
private boolean isFlashlightEnabled() {
return Settings.Secure.getInt(crv, Settings.Secure.FLASHLIGHT_ENABLED, 0) == 1;
}
private void getFontSize() {
float fontScale = Settings.System.getFloat(crv, Settings.System.FONT_SCALE, 0.0f);
Log.e(TAG, "getHardware: fontScale = " + fontScale);
List<String> mEntries = Arrays.asList(getResources().getStringArray(R.array.entries_font_size));
List<String> strEntryValues = Arrays.asList(getResources().getStringArray(R.array.entryvalues_font_size));
String font_size;
int index = strEntryValues.indexOf(String.valueOf(fontScale));
if (index == -1) {
font_size = "默认";
} else {
font_size = mEntries.get(index);
}
tv_font_size.setText(font_size);
seekBar.setProgress(index);
seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
Settings.System.putFloat(crv, Settings.System.FONT_SCALE, Float.parseFloat(strEntryValues.get(i)));
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
}
private void getLocation() {
BDLocation bdLocation = AmapManager.getInstance().getNowMapLocation();
if (bdLocation != null) {
if (bdLocation.getLocType() == BDLocation.TypeGpsLocation // GPS定位结果
|| bdLocation.getLocType() == BDLocation.TypeNetWorkLocation // 网络定位结果
|| bdLocation.getLocType() == BDLocation.TypeOffLineLocation) {// 离线定位结果
tv_location.setText(bdLocation.getAddrStr());
} else {
tv_location.setText("未知");
}
} else {
tv_location.setText("定位失败");
}
LocationClient locationClient = AmapManager.getInstance().getLocationClient();
locationClient.stop();
locationClient.start();
locationClient.registerLocationListener(new BDAbstractLocationListener() {
@Override
public void onReceiveLocation(BDLocation bdLocation) {
switch (bdLocation.getLocType()) {
case BDLocation.TypeGpsLocation:// GPS定位结果
case BDLocation.TypeNetWorkLocation:// 网络定位结果
case BDLocation.TypeOffLineLocation:// 离线定位结果
tv_location.setText(bdLocation.getAddrStr());
break;
default:
tv_location.setText("定位失败");
break;
}
}
});
}
private void getBrightness() {
seekbar_brightness.setMin(1);
seekbar_brightness.setMax(255);
//亮度
int brightness = Settings.System.getInt(crv, Settings.System.SCREEN_BRIGHTNESS, 1);
seekbar_brightness.setProgress(brightness);
Log.e(TAG, "getHardware: brightness = " + brightness);
int gamma = BrightnessUtils.convertLinearToGamma(brightness, 1, 255);
Log.e(TAG, "getHardware: gamma = " + gamma);
long percentage = Math.round((((double) gamma / 65535) * 100f));
tv_brightness.setText(percentage + "%");
Log.e(TAG, "getHardware: percentage = " + percentage);
seekbar_brightness.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
Settings.System.putInt(crv, Settings.System.SCREEN_BRIGHTNESS, i);
int gamma = BrightnessUtils.convertLinearToGamma(i, 1, 255);
long percentage = Math.round((((double) gamma / 65535) * 100f));
tv_brightness.setText(percentage + "%");
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
}
private AudioManager mAudioManager;
private void getSound() {
mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
//最大音量
int maxVolume = mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
seekbar_sound.setMax(maxVolume);
Log.e(TAG, "getHardware: maxVolume = " + maxVolume);
//音量
int streamVolume = mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
seekbar_sound.setProgress(streamVolume);
Log.e(TAG, "getHardware: streamVolume = " + streamVolume);
int currentVolume = (int) (((double) streamVolume / (double) maxVolume) * 100f);
Log.e(TAG, "getHardware: currentVolume = " + currentVolume);
tv_sound.setText(currentVolume + "%");
seekbar_sound.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
int volume = (int) (((double) i / (double) maxVolume) * 100f);
tv_sound.setText(volume + "%");
mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, i, 0);
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
}
@Override
protected void onDestroy() {
super.onDestroy();
if (mWifiReceiver != null) unregisterReceiver(mWifiReceiver);
}
}

View File

@@ -47,6 +47,7 @@ import com.qweather.sdk.view.QWeather;
import com.tencent.mmkv.MMKV;
import com.uiuios.aios.BuildConfig;
import com.uiuios.aios.R;
import com.uiuios.aios.activity.ControlActivity;
import com.uiuios.aios.activity.EmergencyActivity;
import com.uiuios.aios.activity.alarm.AlarmClockActivity;
import com.uiuios.aios.activity.code.HealthCodeActivity;
@@ -113,9 +114,10 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
ConstraintLayout cl_ai;
@BindView(R.id.cl_appstore)
ConstraintLayout cl_appstore;
// @BindView(R.id.cl_exit)
// @BindView(R.id.cl_exit)
// ConstraintLayout cl_exit;
@BindView(R.id.cl_control)
ConstraintLayout cl_control;
// @BindView(R.id.cl_battery)
// ConstraintLayout cl_battery;
@@ -464,6 +466,13 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
// showPassword();
// }
// });
cl_control.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(mContext, ControlActivity.class));
}
});
refreshMemory();
}

View File

@@ -74,8 +74,13 @@ public class AmapManager {
String aMapLocationjson = mMMKV.decodeString(AMAPLOCATION_JSON_KEY, "");
Type type = new TypeToken<BDLocation>() {
}.getType();
BDLocation bdLocation = new Gson().fromJson(aMapLocationjson, type);
return bdLocation;
try {
BDLocation bdLocation = new Gson().fromJson(aMapLocationjson, type);
return bdLocation;
} catch (Exception e) {
Log.e(TAG, "getNowMapLocation: " + e.getMessage());
return null;
}
}
return this.mLocation;
}
@@ -123,7 +128,7 @@ public class AmapManager {
* 定位结果回调重写onReceiveLocation方法可以直接拷贝如下代码到自己工程中修改
*
*/
private BDAbstractLocationListener mListener = new BDAbstractLocationListener() {
private BDAbstractLocationListener mListener = new BDAbstractLocationListener() {
/**
* 定位请求回调函数

View File

@@ -0,0 +1,142 @@
/*
* Copyright (C) 2018 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.uiuios.aios.utils;
import android.util.MathUtils;
public class BrightnessUtils {
public static final int GAMMA_SPACE_MIN = 0;
public static final int GAMMA_SPACE_MAX = 65535;
// Hybrid Log Gamma constant values
private static final float R = 0.5f;
private static final float A = 0.17883277f;
private static final float B = 0.28466892f;
private static final float C = 0.55991073f;
/**
* A function for converting from the gamma space that the slider works in to the
* linear space that the setting works in.
* <p>
* The gamma space effectively provides us a way to make linear changes to the slider that
* result in linear changes in perception. If we made changes to the slider in the linear space
* then we'd see an approximately logarithmic change in perception (c.f. Fechner's Law).
* <p>
* Internally, this implements the Hybrid Log Gamma electro-optical transfer function, which is
* a slight improvement to the typical gamma transfer function for displays whose max
* brightness exceeds the 120 nit reference point, but doesn't set a specific reference
* brightness like the PQ function does.
* <p>
* Note that this transfer function is only valid if the display's backlight value is a linear
* control. If it's calibrated to be something non-linear, then a different transfer function
* should be used.
*
* @param val The slider value.
* @param min The minimum acceptable value for the setting.
* @param max The maximum acceptable value for the setting.
* @return The corresponding setting value.
*/
public static final int convertGammaToLinear(int val, int min, int max) {
final float normalizedVal = MathUtils.norm(GAMMA_SPACE_MIN, GAMMA_SPACE_MAX, val);
final float ret;
if (normalizedVal <= R) {
ret = MathUtils.sq(normalizedVal / R);
} else {
ret = MathUtils.exp((normalizedVal - C) / A) + B;
}
// HLG is normalized to the range [0, 12], so we need to re-normalize to the range [0, 1]
// in order to derive the correct setting value.
return Math.round(MathUtils.lerp(min, max, ret / 12));
}
/**
* Version of {@link #convertGammaToLinear} that takes and returns float values.
* TODO(flc): refactor Android Auto to use float version
*
* @param val The slider value.
* @param min The minimum acceptable value for the setting.
* @param max The maximum acceptable value for the setting.
* @return The corresponding setting value.
*/
public static final float convertGammaToLinearFloat(int val, float min, float max) {
final float normalizedVal = MathUtils.norm(GAMMA_SPACE_MIN, GAMMA_SPACE_MAX, val);
final float ret;
if (normalizedVal <= R) {
ret = MathUtils.sq(normalizedVal / R);
} else {
ret = MathUtils.exp((normalizedVal - C) / A) + B;
}
// HLG is normalized to the range [0, 12], ensure that value is within that range,
// it shouldn't be out of bounds.
final float normalizedRet = MathUtils.constrain(ret, 0, 12);
// Re-normalize to the range [0, 1]
// in order to derive the correct setting value.
return MathUtils.lerp(min, max, normalizedRet / 12);
}
/**
* A function for converting from the linear space that the setting works in to the
* gamma space that the slider works in.
* <p>
* The gamma space effectively provides us a way to make linear changes to the slider that
* result in linear changes in perception. If we made changes to the slider in the linear space
* then we'd see an approximately logarithmic change in perception (c.f. Fechner's Law).
* <p>
* Internally, this implements the Hybrid Log Gamma opto-electronic transfer function, which is
* a slight improvement to the typical gamma transfer function for displays whose max
* brightness exceeds the 120 nit reference point, but doesn't set a specific reference
* brightness like the PQ function does.
* <p>
* Note that this transfer function is only valid if the display's backlight value is a linear
* control. If it's calibrated to be something non-linear, then a different transfer function
* should be used.
*
* @param val The brightness setting value.
* @param min The minimum acceptable value for the setting.
* @param max The maximum acceptable value for the setting.
* @return The corresponding slider value
*/
public static final int convertLinearToGamma(int val, int min, int max) {
return convertLinearToGammaFloat((float) val, (float) min, (float) max);
}
/**
* Version of {@link #convertLinearToGamma} that takes float values.
* TODO: brightnessfloat merge with above method(?)
*
* @param val The brightness setting value.
* @param min The minimum acceptable value for the setting.
* @param max The maximum acceptable value for the setting.
* @return The corresponding slider value
*/
public static final int convertLinearToGammaFloat(float val, float min, float max) {
// For some reason, HLG normalizes to the range [0, 12] rather than [0, 1]
final float normalizedVal = MathUtils.norm(min, max, val) * 12;
final float ret;
if (normalizedVal <= 1f) {
ret = MathUtils.sqrt(normalizedVal) * R;
} else {
ret = A * MathUtils.log(normalizedVal - B) + C;
}
return Math.round(MathUtils.lerp(GAMMA_SPACE_MIN, GAMMA_SPACE_MAX, ret));
}
}