mirror of
https://github.com/amnezia-vpn/amneziawg-android.git
synced 2026-07-03 14:05:13 +02:00
99cf2152c4
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev> [Samuel: Changed static to non-static import] Signed-off-by: Samuel Holland <samuel@sholland.org>
26 lines
874 B
Java
26 lines
874 B
Java
/*
|
|
* Copyright © 2018 Harsh Shandilya <msfjarvis@gmail.com>
|
|
* Copyright © 2018 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
*/
|
|
package com.wireguard.android.util;
|
|
|
|
import android.content.Context;
|
|
import android.support.v7.preference.Preference;
|
|
import android.view.ContextThemeWrapper;
|
|
|
|
import com.wireguard.android.activity.SettingsActivity;
|
|
|
|
public class FragmentUtils {
|
|
|
|
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;
|
|
}
|
|
}
|