···3232import androidx.annotation.Nullable;
3333import androidx.fragment.app.Fragment;
34343535+import dagger.hilt.android.AndroidEntryPoint;
3636+3537import org.freedesktop.monado.auxiliary.NameAndLogoProvider;
3638import org.freedesktop.monado.auxiliary.UiProvider;
3739···41434244import javax.inject.Inject;
43454444-import dagger.hilt.android.AndroidEntryPoint;
4545-4646-4747-/**
4848- * A Fragment for displaying/affecting VR Listener status.
4949- */
4646+/** A Fragment for displaying/affecting VR Listener status. */
5047@AndroidEntryPoint
5148public class VrModeStatus extends Fragment {
5249 public static final int STATUS_UNKNOWN = -2;
···5653 private static final String TAG = "MonadoVrModeStatus";
5754 private static final String ARG_STATUS = "status";
58555959- @Inject
6060- UiProvider uiProvider;
5656+ @Inject UiProvider uiProvider;
61576262- @Inject
6363- NameAndLogoProvider nameAndLogoProvider;
5858+ @Inject NameAndLogoProvider nameAndLogoProvider;
64596565- private @Status
6666- int status_ = STATUS_UNKNOWN;
6060+ private @Status int status_ = STATUS_UNKNOWN;
67616862 public VrModeStatus() {
6963 // Required empty public constructor
···7367 * Get the ComponentName for a VrListenerService
7468 *
7569 * @param resolveInfo a ResolveInfo from PackageManager.queryIntentServices() with an
7676- * android.service.vr.VrListenerService Intent and
7777- * PackageManager.GET_META_DATA
7070+ * android.service.vr.VrListenerService Intent and PackageManager.GET_META_DATA
7871 * @return the ComponentName, or null if resolveInfo.serviceInfo is null
7972 */
8073 private static ComponentName getVrListener(@NonNull ResolveInfo resolveInfo) {
···8578 return new ComponentName(serviceInfo.packageName, serviceInfo.name);
8679 }
87808888- private static @Nullable
8989- ComponentName findOurselves(@NonNull List<ResolveInfo> resolutions, @NonNull String packageName) {
8181+ private static @Nullable ComponentName findOurselves(
8282+ @NonNull List<ResolveInfo> resolutions, @NonNull String packageName) {
9083 for (ResolveInfo resolveInfo : resolutions) {
9184 ComponentName componentName = getVrListener(resolveInfo);
9285 if (componentName == null) continue;
···10295 /**
10396 * Determine the VR mode status of this package.
10497 *
105105- * @param context A context to look up package manager info about this package.
9898+ * @param context A context to look up package manager info about this package.
10699 * @param packageName The current package name (usually BuildConfig.APPLICATION_ID)
107100 * @return the VR mode status
108101 */
109109- public static @Status
110110- int detectStatus(@NonNull Context context, @NonNull String packageName) {
102102+ public static @Status int detectStatus(@NonNull Context context, @NonNull String packageName) {
111103 Intent intent = new Intent(VrListenerService.SERVICE_INTERFACE);
112104 PackageManager packageManager = context.getPackageManager();
113105 // Suppression because we only care about finding out about our own package.
114106 @SuppressLint("QueryPermissionsNeeded")
115115- List<ResolveInfo> resolutions = packageManager.queryIntentServices(intent,
116116- PackageManager.GET_META_DATA);
107107+ List<ResolveInfo> resolutions =
108108+ packageManager.queryIntentServices(intent, PackageManager.GET_META_DATA);
117109 if (resolutions == null || resolutions.isEmpty()) {
118110 return STATUS_NOT_AVAIL;
119111 }
120112 ComponentName us = findOurselves(resolutions, packageName);
121113 if (us == null) {
122122- Log.w(TAG, "Could not find ourselves in the list of VrListenerService implementations! " + packageName);
114114+ Log.w(
115115+ TAG,
116116+ "Could not find ourselves in the list of VrListenerService implementations! "
117117+ + packageName);
123118 return STATUS_NOT_AVAIL;
124119 }
125120···132127 }
133128134129 /**
135135- * Use this factory method to create a new instance of
136136- * this fragment using the provided parameters.
130130+ * Use this factory method to create a new instance of this fragment using the provided
131131+ * parameters.
137132 *
138133 * @param status The VR Mode status. See detectStatus()
139134 * @return A new instance of fragment VrModeStatus.
···180175 break;
181176 case STATUS_NOT_AVAIL:
182177 textEnabledDisabled.setText(
183183- res.getString(R.string.vr_mode_not_avail,
178178+ res.getString(
179179+ R.string.vr_mode_not_avail,
184180 nameAndLogoProvider.getLocalizedRuntimeName()));
185181 textEnabledDisabled.setVisibility(View.VISIBLE);
186182 button.setVisibility(View.GONE);
···196192 }
197193198194 @Override
199199- public View onCreateView(LayoutInflater inflater, ViewGroup container,
200200- Bundle savedInstanceState) {
195195+ public View onCreateView(
196196+ LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
201197 // Inflate the layout for this fragment
202198 View view = inflater.inflate(R.layout.fragment_vr_mode_status, container, false);
203199 updateState(view);
204204- view.findViewById(R.id.btnLaunchVrSettings).setOnClickListener(v -> launchVrSettings(v.getContext()));
200200+ view.findViewById(R.id.btnLaunchVrSettings)
201201+ .setOnClickListener(v -> launchVrSettings(v.getContext()));
205202 return view;
206203 }
207204208205 @IntDef(value = {STATUS_UNKNOWN, STATUS_DISABLED, STATUS_ENABLED, STATUS_NOT_AVAIL})
209206 @Retention(RetentionPolicy.SOURCE)
210210- public @interface Status {
211211- }
212212-207207+ public @interface Status {}
213208}
···10101111import androidx.fragment.app.Fragment
1212import com.mikepenz.aboutlibraries.LibsBuilder
1313-import org.freedesktop.monado.android_common.NoticeFragmentProvider
1413import javax.inject.Inject
1414+import org.freedesktop.monado.android_common.NoticeFragmentProvider
15151616class AboutLibrariesNoticeFragmentProvider @Inject constructor() : NoticeFragmentProvider {
1717- override fun makeNoticeFragment(): Fragment = LibsBuilder()
1818- .withFields(R.string::class.java.fields)
1919- .withAboutIconShown(false) // We do this ourselves bigger
2020- .withAboutVersionShown(true) // Let the fragment show our version
2121- .withLicenseShown(true) // Not sure why you'd do this without license info
2222- .supportFragment()
2323-1717+ override fun makeNoticeFragment(): Fragment =
1818+ LibsBuilder()
1919+ .withFields(R.string::class.java.fields)
2020+ .withAboutIconShown(false) // We do this ourselves bigger
2121+ .withAboutVersionShown(true) // Let the fragment show our version
2222+ .withLicenseShown(true) // Not sure why you'd do this without license info
2323+ .supportFragment()
2424}
···1212import android.graphics.drawable.Drawable
1313import androidx.core.content.ContextCompat
1414import dagger.hilt.android.qualifiers.ApplicationContext
1515-import org.freedesktop.monado.auxiliary.NameAndLogoProvider
1615import javax.inject.Inject
1616+import org.freedesktop.monado.auxiliary.NameAndLogoProvider
17171818-class MonadoOpenXrBrandingUiProvider @Inject constructor(@ApplicationContext val context: Context) : NameAndLogoProvider {
1919- /**
2020- * Gets a localized runtime name string for the runtime/Monado-incorporating target.
2121- */
2222- override fun getLocalizedRuntimeName(): CharSequence = context.packageManager.getApplicationLabel(context.applicationInfo)
1818+class MonadoOpenXrBrandingUiProvider @Inject constructor(@ApplicationContext val context: Context) :
1919+ NameAndLogoProvider {
2020+ /** Gets a localized runtime name string for the runtime/Monado-incorporating target. */
2121+ override fun getLocalizedRuntimeName(): CharSequence =
2222+ context.packageManager.getApplicationLabel(context.applicationInfo)
23232424 /**
2525- * Gets a drawable for use in the about activity and elsewhere, for the runtime/Monado-incorporating target.
2525+ * Gets a drawable for use in the about activity and elsewhere, for the
2626+ * runtime/Monado-incorporating target.
2627 */
2727- override fun getLogoDrawable(): Drawable? = ContextCompat.getDrawable(context, R.drawable.ic_monado_logo)
2828+ override fun getLogoDrawable(): Drawable? =
2929+ ContextCompat.getDrawable(context, R.drawable.ic_monado_logo)
2830}
···1515import android.graphics.drawable.Icon
1616import android.os.Build
1717import dagger.hilt.android.qualifiers.ApplicationContext
1818+import javax.inject.Inject
1819import org.freedesktop.monado.android_common.AboutActivity
1920import org.freedesktop.monado.auxiliary.UiProvider
2020-import javax.inject.Inject
21212222-class MonadoOpenXrUiProvider @Inject constructor(@ApplicationContext val context: Context) : UiProvider {
2222+class MonadoOpenXrUiProvider @Inject constructor(@ApplicationContext val context: Context) :
2323+ UiProvider {
23242424- /**
2525- * Gets a drawable for use in a notification, for the runtime/Monado-incorporating target.
2626- */
2525+ /** Gets a drawable for use in a notification, for the runtime/Monado-incorporating target. */
2726 override fun getNotificationIcon(): Icon? =
2828- Icon.createWithResource(context, R.drawable.ic_notif_xr_letters_custom)
2727+ Icon.createWithResource(context, R.drawable.ic_notif_xr_letters_custom)
29283030- /**
3131- * Make a {@code PendingIntent} to launch an "About" activity for the runtime/target.
3232- */
2929+ /** Make a {@code PendingIntent} to launch an "About" activity for the runtime/target. */
3330 override fun makeAboutActivityPendingIntent(): PendingIntent {
3431 var flags = 0
3532 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
···3936 context,
4037 0,
4138 Intent.makeMainActivity(
4242- ComponentName.createRelative(
4343- context,
4444- AboutActivity::class.qualifiedName!!
4545- )
3939+ ComponentName.createRelative(context, AboutActivity::class.qualifiedName!!)
4640 ),
4741 flags
4842 )
4943 }
5050-5144}