Improve liquid glass defaults and restore Firebase
This commit is contained in:
@@ -27,6 +27,7 @@ dependencies {
|
||||
compileOnly 'org.checkerframework:checker-qual:2.5.2'
|
||||
compileOnly 'org.checkerframework:checker-compat-qual:2.5.5'
|
||||
|
||||
// Firebase
|
||||
implementation platform('com.google.firebase:firebase-bom:32.1.0')
|
||||
implementation 'com.google.firebase:firebase-crashlytics'
|
||||
implementation 'com.google.firebase:firebase-analytics'
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"project_info": {
|
||||
"project_number": "000000000000",
|
||||
"project_id": "overgram-placeholder",
|
||||
"storage_bucket": "overgram-placeholder.appspot.com"
|
||||
"project_number": "593914352814",
|
||||
"project_id": "overgram-5e84a",
|
||||
"storage_bucket": "overgram-5e84a.firebasestorage.app"
|
||||
},
|
||||
"client": [
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:000000000000:android:placeholder",
|
||||
"mobilesdk_app_id": "1:593914352814:android:a15b5adcbfe8a5115e493f",
|
||||
"android_client_info": {
|
||||
"package_name": "com.overspend1.overgram"
|
||||
}
|
||||
@@ -15,7 +15,7 @@
|
||||
"oauth_client": [],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyPlaceholder"
|
||||
"current_key": "AIzaSyCjCOoI0cmlEm19CR2Yl0bvyN9G1wh9bs4"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
|
||||
@@ -154,12 +154,13 @@ public class OverConfig {
|
||||
WALMode = preferences.getBoolean("walMode", true);
|
||||
|
||||
// ~ Liquid Glass
|
||||
liquidGlassEnabled = preferences.getBoolean("liquidGlassEnabled", false);
|
||||
// Liquid glass defaults: on, moderate blur, applied broadly
|
||||
liquidGlassEnabled = preferences.getBoolean("liquidGlassEnabled", true);
|
||||
liquidGlassApplyToChatBubbles = preferences.getBoolean("liquidGlassApplyToChatBubbles", true);
|
||||
liquidGlassApplyToDialogs = preferences.getBoolean("liquidGlassApplyToDialogs", false);
|
||||
liquidGlassApplyToDialogs = preferences.getBoolean("liquidGlassApplyToDialogs", true);
|
||||
liquidGlassPreset = preferences.getInt("liquidGlassPreset", 1); // Default: STANDARD
|
||||
liquidGlassBlurRadius = preferences.getFloat("liquidGlassBlurRadius", 15f);
|
||||
liquidGlassOpacity = preferences.getFloat("liquidGlassOpacity", 0.75f);
|
||||
liquidGlassBlurRadius = preferences.getFloat("liquidGlassBlurRadius", 10f);
|
||||
liquidGlassOpacity = preferences.getFloat("liquidGlassOpacity", 0.78f);
|
||||
|
||||
// AI
|
||||
geminiEnabled = preferences.getBoolean("geminiEnabled", false);
|
||||
|
||||
@@ -137,8 +137,34 @@ public class LiquidGlassEffect {
|
||||
|
||||
Bitmap region = Bitmap.createBitmap(source, left, top, width, height);
|
||||
|
||||
// Apply blur
|
||||
Bitmap blurred = applyBlur(region, parameters.blurRadius);
|
||||
// Downscale before blurring for smoother, faster blur; scale based on radius
|
||||
float scale = 1.0f;
|
||||
if (parameters.blurRadius >= 18f) {
|
||||
scale = 0.35f;
|
||||
} else if (parameters.blurRadius >= 12f) {
|
||||
scale = 0.5f;
|
||||
} else if (parameters.blurRadius >= 8f) {
|
||||
scale = 0.7f;
|
||||
}
|
||||
|
||||
Bitmap working = region;
|
||||
if (scale < 1f) {
|
||||
int scaledW = Math.max(1, Math.round(region.getWidth() * scale));
|
||||
int scaledH = Math.max(1, Math.round(region.getHeight() * scale));
|
||||
working = Bitmap.createScaledBitmap(region, scaledW, scaledH, true);
|
||||
}
|
||||
|
||||
// Apply blur on scaled bitmap
|
||||
Bitmap blurred = applyBlur(working, parameters.blurRadius * scale);
|
||||
|
||||
// If we downscaled, upscale back to original region size for drawing
|
||||
if (blurred != null && scale < 1f) {
|
||||
Bitmap scaledUp = Bitmap.createScaledBitmap(blurred, region.getWidth(), region.getHeight(), true);
|
||||
if (blurred != working && blurred != region) {
|
||||
blurred.recycle();
|
||||
}
|
||||
blurred = scaledUp;
|
||||
}
|
||||
|
||||
// Cache result
|
||||
if (cachedBlurredBitmap != null && !cachedBlurredBitmap.isRecycled()) {
|
||||
@@ -151,6 +177,9 @@ public class LiquidGlassEffect {
|
||||
if (region != blurred) {
|
||||
region.recycle();
|
||||
}
|
||||
if (working != region && working != blurred) {
|
||||
working.recycle();
|
||||
}
|
||||
|
||||
return blurred;
|
||||
} catch (Exception e) {
|
||||
@@ -166,12 +195,12 @@ public class LiquidGlassEffect {
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
int blurRadius = (int) Math.min(25, radius);
|
||||
try {
|
||||
// Use Telegram's optimized blur implementation
|
||||
int blurRadius = (int) Math.min(25, radius);
|
||||
Utilities.blurBitmap(bitmap, blurRadius, 1, bitmap.getWidth(), bitmap.getHeight(), bitmap.getRowBytes());
|
||||
return bitmap;
|
||||
} catch (Exception e) {
|
||||
// Use Telegram's stack blur which returns the source bitmap
|
||||
return Utilities.stackBlurBitmap(bitmap, blurRadius, false);
|
||||
} catch (Throwable ignore) {
|
||||
// Fallback to original bitmap on failure
|
||||
return bitmap;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,12 +13,12 @@ package com.overspend1.overgram.ui.liquidglass;
|
||||
* Predefined liquid glass presets
|
||||
*/
|
||||
public enum LiquidGlassPreset {
|
||||
SUBTLE(0, "Subtle", 8f, 0.90f),
|
||||
STANDARD(1, "Standard", 15f, 0.75f),
|
||||
HEAVY(2, "Heavy", 20f, 0.60f),
|
||||
FROSTED(3, "Frosted", 25f, 0.55f),
|
||||
CRYSTAL(4, "Crystal", 12f, 0.80f),
|
||||
MIDNIGHT(5, "Midnight", 18f, 0.65f);
|
||||
SUBTLE(0, "Subtle", 6f, 0.92f),
|
||||
STANDARD(1, "Standard", 10f, 0.80f),
|
||||
HEAVY(2, "Heavy", 16f, 0.65f),
|
||||
FROSTED(3, "Frosted", 20f, 0.60f),
|
||||
CRYSTAL(4, "Crystal", 12f, 0.85f),
|
||||
MIDNIGHT(5, "Midnight", 16f, 0.70f);
|
||||
|
||||
public final int id;
|
||||
public final String name;
|
||||
|
||||
@@ -106,7 +106,7 @@ public class AiPreferencesActivity extends BasePreferencesActivity {
|
||||
textCell.setTextAndValue(LocaleController.getString(R.string.OvergramGeminiModelTitle), OverConfig.geminiModel, true);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
TextCheckCell checkCell = (TextCheckCell) holder.itemView;
|
||||
if (position == enableGeminiRow) {
|
||||
checkCell.setTextAndCheck(LocaleController.getString(R.string.OvergramGeminiEnable), OverConfig.geminiEnabled, true);
|
||||
@@ -126,7 +126,7 @@ public class AiPreferencesActivity extends BasePreferencesActivity {
|
||||
} else if (position == apiKeyRow || position == modelRow) {
|
||||
return 3;
|
||||
}
|
||||
return 4;
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -382,17 +382,14 @@ public class ApplicationLoader extends Application {
|
||||
}
|
||||
}
|
||||
|
||||
// Firebase disabled (no init to avoid crashes when API keys are absent)
|
||||
private static FirebaseAnalytics firebaseAnalytics;
|
||||
private static FirebaseCrashlytics firebaseCrashlytics;
|
||||
|
||||
private void initFirebase() {
|
||||
AndroidUtilities.runOnUIThread(() -> {
|
||||
firebaseAnalytics = FirebaseAnalytics.getInstance(this);
|
||||
firebaseCrashlytics = FirebaseCrashlytics.getInstance();
|
||||
firebaseAnalytics.setAnalyticsCollectionEnabled(ExteraConfig.useGoogleAnalytics);
|
||||
firebaseCrashlytics.setCrashlyticsCollectionEnabled(ExteraConfig.useGoogleCrashlytics);
|
||||
CrashlyticsUtils.logEvents(applicationContext);
|
||||
});
|
||||
// no-op
|
||||
firebaseAnalytics = null;
|
||||
firebaseCrashlytics = null;
|
||||
}
|
||||
|
||||
public static FirebaseAnalytics getFirebaseAnalytics() {
|
||||
|
||||
@@ -670,9 +670,9 @@ public class LaunchActivity extends BasePermissionsActivity implements INavigati
|
||||
|
||||
// Make positive button red to emphasize danger
|
||||
dialog.setOnShowListener(dialogInterface -> {
|
||||
android.widget.Button positiveButton = dialog.getButton(AlertDialog.BUTTON_POSITIVE);
|
||||
if (positiveButton != null) {
|
||||
positiveButton.setTextColor(Theme.getColor(Theme.key_text_RedBold));
|
||||
android.view.View btn = dialog.getButton(AlertDialog.BUTTON_POSITIVE);
|
||||
if (btn instanceof android.widget.Button) {
|
||||
((android.widget.Button) btn).setTextColor(Theme.getColor(Theme.key_text_RedBold));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user