mirror of
https://github.com/amnezia-vpn/amneziawg-android.git
synced 2026-07-03 14:05:13 +02:00
c3e63df7b5
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
28 lines
856 B
Java
28 lines
856 B
Java
/*
|
|
* Copyright © 2017-2019 WireGuard LLC. All Rights Reserved.
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
package com.wireguard.android.util;
|
|
|
|
import android.content.Context;
|
|
import androidx.preference.Preference;
|
|
import android.view.ContextThemeWrapper;
|
|
|
|
import com.wireguard.android.activity.SettingsActivity;
|
|
|
|
public final class FragmentUtils {
|
|
private FragmentUtils() {
|
|
// Prevent instantiation
|
|
}
|
|
|
|
public static SettingsActivity getPrefActivity(final Preference preference) {
|
|
final Context context = preference.getContext();
|
|
if (context instanceof ContextThemeWrapper) {
|
|
if (((ContextThemeWrapper) context).getBaseContext() instanceof SettingsActivity) {
|
|
return ((SettingsActivity) ((ContextThemeWrapper) context).getBaseContext());
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
}
|