fix theme

This commit is contained in:
Alexey Kuznetsov 2024-03-26 12:16:51 +03:00
commit 4bbf6eff30
6 changed files with 47 additions and 37 deletions

View file

@ -23,15 +23,18 @@
android:requestLegacyExternalStorage="true"
android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="@style/Translucent">
<service android:name=".services.RecordingService" android:foregroundServiceType="mediaProjection" />
android:theme="@android:style/Theme.Translucent.NoTitleBar">
<service
android:name=".services.RecordingService"
android:foregroundServiceType="mediaProjection" />
<service android:name=".services.EncodingService" />
<service android:name=".services.ControlsService" />
<service
android:name=".services.TileService"
android:exported="true"
android:icon="@drawable/ic_mic_24dp"
android:label="@string/tile_start_recording"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE" android:exported="true">
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
<intent-filter>
<action android:name="android.service.quicksettings.action.QS_TILE" />
</intent-filter>
@ -39,14 +42,15 @@
<activity
android:name=".activities.SettingsActivity"
android:label="@string/app_name" />
android:label="@string/app_name"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<activity
android:name=".activities.MainActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:exported="true"
android:label="@string/app_name"
android:launchMode="singleInstance"
android:theme="@style/Translucent">
android:theme="@android:style/Theme.Translucent.NoTitleBar">
<meta-data
android:name="android.app.searchable"
android:resource="@xml/searchable" />
@ -62,7 +66,8 @@
android:configChanges="orientation|keyboardHidden|screenSize"
android:exported="true"
android:launchMode="singleInstance"
android:showOnLockScreen="true">
android:showOnLockScreen="true"
android:theme="@android:style/Theme.Translucent.NoTitleBar">
<intent-filter>
<action android:name="android.provider.MediaStore.RECORD_SOUND" />
<category android:name="android.intent.category.DEFAULT" />
@ -79,14 +84,18 @@
<action android:name="com.htc.intent.action.QUICKBOOT_POWERON" />
</intent-filter>
</receiver>
<receiver android:name=".services.OnUpgradeReceiver" android:exported="true">
<receiver
android:name=".services.OnUpgradeReceiver"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.PACKAGE_REPLACED" />
<data android:scheme="package" />
</intent-filter>
</receiver>
<receiver android:name=".services.OnExternalReceiver" android:exported="true">
<receiver
android:name=".services.OnExternalReceiver"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.EXTERNAL_APPLICATIONS_AVAILABLE" />
</intent-filter>

View file

@ -399,7 +399,7 @@ public class MainActivity extends AppCompatThemeActivity {
@Override
public int getAppTheme() {
return AudioApplication.getTheme(this, R.style.RecThemeLight_NoActionBar, R.style.RecThemeDark_NoActionBar);
return AudioApplication.getTheme(this, R.style.RecThemeLight_NoActionBar, R.style.RecThemeDark_NoActionBar, R.style.RecThemeDarkBlack_NoActionBar);
}
@Override

View file

@ -370,7 +370,7 @@ public class RecordingActivity extends AppCompatThemeActivity {
@Override
public int getAppTheme() {
return AudioApplication.getTheme(this, R.style.RecThemeLight, R.style.RecThemeDark);
return AudioApplication.getTheme(this, R.style.RecThemeLight, R.style.RecThemeDark, R.style.RecThemeDarkBlack);
}
@Override

View file

@ -60,7 +60,7 @@ public class SettingsActivity extends AppCompatSettingsThemeActivity implements
@Override
public int getAppTheme() {
return AudioApplication.getTheme(this, R.style.RecThemeLight, R.style.RecThemeDark);
return AudioApplication.getTheme(this, R.style.RecThemeLight, R.style.RecThemeDark, R.style.RecThemeDarkBlack);
}
@Override

View file

@ -1,6 +1,5 @@
package com.github.axet.audiorecorder.app;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.media.AudioFormat;
@ -18,20 +17,8 @@ import com.github.axet.audiolibrary.app.Sound;
import com.github.axet.audiolibrary.encoders.Encoder;
import com.github.axet.audiolibrary.encoders.OnFlyEncoding;
import com.github.axet.audiorecorder.BuildConfig;
import com.github.axet.audiorecorder.R;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
import org.json.JSONException;
import java.io.File;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ShortBuffer;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Locale;
import java.util.concurrent.atomic.AtomicBoolean;
public class RecordingStorage {
@ -78,7 +65,7 @@ public class RecordingStorage {
info = new RawSamples.Info(format, sampleRate, Sound.getChannels(context));
}
public void startRecording(int source) {
public void startRecording(final int source) {
final SharedPreferences shared = android.preference.PreferenceManager.getDefaultSharedPreferences(context);
sound.silent();
@ -240,17 +227,20 @@ public class RecordingStorage {
}
session += samples;
if (samplesTime - silence > 2 * sampleRate) { // 2 second of mic muted
if (!silenceDetected) {
silenceDetected = true;
Post(MUTED, null);
}
} else {
if (silenceDetected) {
silenceDetected = false;
Post(UNMUTED, null);
if (source != Sound.SOURCE_INTERNAL_AUDIO) {
if (samplesTime - silence > 2 * sampleRate) { // 2 second of mic muted
if (!silenceDetected) {
silenceDetected = true;
Post(MUTED, null);
}
} else {
if (silenceDetected) {
silenceDetected = false;
Post(UNMUTED, null);
}
}
}
diff = (now - start) * sampleRate / 1000; // number of samples we expect by this moment
if (diff - session > 2 * sampleRate) { // 2 second of silence / paused by os
Post(PAUSED, null);

View file

@ -6,20 +6,31 @@
<item name="cutColor">#b1b1b1</item>
</style>
<style name="RecThemeLight.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="RecThemeDark" parent="AppThemeDark">
<item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
<item name="recColor">#c6c6c6</item>
<item name="cutColor">#0e0e0e</item>
</style>
<style name="RecThemeLight.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="RecThemeDark.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="RecThemeDarkBlack" parent="AppThemeDarkBlack">
<item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
<item name="recColor">#c6c6c6</item>
<item name="cutColor">#0e0e0e</item>
</style>
<style name="RecThemeDarkBlack.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
</resources>