The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

t/android: Run spotlessApply to format Java and Kotlin code

Signed-off-by: utzcoz <utzcoz@outlook.com>

authored by

utzcoz and committed by
Ryan Pavlik
b5b0c309 8e93bbde

+161 -158
+16 -15
src/xrt/targets/android_common/src/main/java/org/freedesktop/monado/android_common/AboutActivity.java
··· 19 19 import androidx.fragment.app.Fragment; 20 20 import androidx.fragment.app.FragmentTransaction; 21 21 22 + import dagger.hilt.android.AndroidEntryPoint; 23 + 22 24 import org.freedesktop.monado.auxiliary.NameAndLogoProvider; 23 25 import org.freedesktop.monado.auxiliary.UiProvider; 24 26 25 27 import javax.inject.Inject; 26 - 27 - import dagger.hilt.android.AndroidEntryPoint; 28 28 29 29 @AndroidEntryPoint 30 30 public class AboutActivity extends AppCompatActivity { 31 31 32 - @Inject 33 - NoticeFragmentProvider noticeFragmentProvider; 32 + @Inject NoticeFragmentProvider noticeFragmentProvider; 34 33 35 - @Inject 36 - UiProvider uiProvider; 34 + @Inject UiProvider uiProvider; 37 35 38 - @Inject 39 - NameAndLogoProvider nameAndLogoProvider; 36 + @Inject NameAndLogoProvider nameAndLogoProvider; 40 37 41 38 private boolean isInProcessBuild() { 42 39 try { ··· 57 54 AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); 58 55 59 56 // Make our Monado link clickable 60 - ((TextView) findViewById(R.id.textPowered)).setMovementMethod(LinkMovementMethod.getInstance()); 57 + ((TextView) findViewById(R.id.textPowered)) 58 + .setMovementMethod(LinkMovementMethod.getInstance()); 61 59 62 60 // Branding from the branding provider 63 - ((TextView) findViewById(R.id.textName)).setText(nameAndLogoProvider.getLocalizedRuntimeName()); 64 - ((ImageView) findViewById(R.id.imageView)).setImageDrawable(nameAndLogoProvider.getLogoDrawable()); 61 + ((TextView) findViewById(R.id.textName)) 62 + .setText(nameAndLogoProvider.getLocalizedRuntimeName()); 63 + ((ImageView) findViewById(R.id.imageView)) 64 + .setImageDrawable(nameAndLogoProvider.getLogoDrawable()); 65 65 66 66 boolean isInProcess = isInProcessBuild(); 67 67 if (!isInProcess) { ··· 72 72 FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); 73 73 74 74 @VrModeStatus.Status 75 - int status = VrModeStatus.detectStatus(this, 76 - getApplicationContext().getApplicationInfo().packageName); 77 - 75 + int status = 76 + VrModeStatus.detectStatus( 77 + this, getApplicationContext().getApplicationInfo().packageName); 78 78 79 79 VrModeStatus statusFrag = VrModeStatus.newInstance(status); 80 80 fragmentTransaction.add(R.id.statusFrame, statusFrag, null); 81 81 82 82 if (!isInProcess) { 83 83 findViewById(R.id.drawOverOtherAppsFrame).setVisibility(View.VISIBLE); 84 - DisplayOverOtherAppsStatusFragment drawOverFragment = new DisplayOverOtherAppsStatusFragment(); 84 + DisplayOverOtherAppsStatusFragment drawOverFragment = 85 + new DisplayOverOtherAppsStatusFragment(); 85 86 fragmentTransaction.replace(R.id.drawOverOtherAppsFrame, drawOverFragment, null); 86 87 } 87 88
+23 -16
src/xrt/targets/android_common/src/main/java/org/freedesktop/monado/android_common/DisplayOverOtherAppsStatusFragment.kt
··· 28 28 private var displayOverOtherAppsEnabled = false 29 29 30 30 override fun onCreateView( 31 - inflater: LayoutInflater, container: ViewGroup?, 31 + inflater: LayoutInflater, 32 + container: ViewGroup?, 32 33 savedInstanceState: Bundle? 33 34 ): View? { 34 35 val view = 35 36 inflater.inflate(R.layout.fragment_display_over_other_app_status, container, false) 36 37 updateStatus(view) 37 - view.findViewById<View>(R.id.btnLaunchDisplayOverOtherAppsSettings) 38 - .setOnClickListener { launchDisplayOverOtherAppsSettings() } 38 + view.findViewById<View>(R.id.btnLaunchDisplayOverOtherAppsSettings).setOnClickListener { 39 + launchDisplayOverOtherAppsSettings() 40 + } 39 41 return view 40 42 } 41 43 ··· 44 46 val tv = view!!.findViewById<TextView>(R.id.textDisplayOverOtherAppsStatus) 45 47 // Combining format with html style tag might have problem. See 46 48 // https://developer.android.com/guide/topics/resources/string-resource.html#StylingWithHTML 47 - val msg = getString( 48 - R.string.msg_display_over_other_apps, 49 - if (displayOverOtherAppsEnabled) getString(R.string.enabled) else getString(R.string.disabled) 50 - ) 49 + val msg = 50 + getString( 51 + R.string.msg_display_over_other_apps, 52 + if (displayOverOtherAppsEnabled) getString(R.string.enabled) 53 + else getString(R.string.disabled) 54 + ) 51 55 tv.text = Html.fromHtml(msg, Html.FROM_HTML_MODE_LEGACY) 52 56 } 53 57 ··· 55 59 // Since Android 11, framework ignores the uri and takes user to the top-level settings. 56 60 // See https://developer.android.com/about/versions/11/privacy/permissions#system-alert 57 61 // for detail. 58 - val intent = Intent( 59 - Settings.ACTION_MANAGE_OVERLAY_PERMISSION, 60 - Uri.parse("package:" + context!!.packageName) 61 - ) 62 + val intent = 63 + Intent( 64 + Settings.ACTION_MANAGE_OVERLAY_PERMISSION, 65 + Uri.parse("package:" + context!!.packageName) 66 + ) 62 67 startActivityForResult(intent, REQUEST_CODE_DISPLAY_OVER_OTHER_APPS) 63 68 } 64 69 ··· 68 73 return 69 74 } 70 75 71 - if (isRuntimeServiceRunning && 72 - displayOverOtherAppsEnabled != Settings.canDrawOverlays(requireContext()) 76 + if ( 77 + isRuntimeServiceRunning && 78 + displayOverOtherAppsEnabled != Settings.canDrawOverlays(requireContext()) 73 79 ) { 74 80 showRestartDialog() 75 81 } else { ··· 92 98 } 93 99 94 100 private fun showRestartDialog() { 95 - val dialog: DialogFragment = RestartRuntimeDialogFragment.newInstance( 96 - getString(R.string.msg_display_over_other_apps_changed) 97 - ) 101 + val dialog: DialogFragment = 102 + RestartRuntimeDialogFragment.newInstance( 103 + getString(R.string.msg_display_over_other_apps_changed) 104 + ) 98 105 dialog.show(parentFragmentManager, null) 99 106 } 100 107
-2
src/xrt/targets/android_common/src/main/java/org/freedesktop/monado/android_common/MonadoVrListener.kt
··· 25 25 if (component == null) { 26 26 Toast.makeText(this, "Now in VR for 2D", Toast.LENGTH_SHORT).show() 27 27 Log.i("OpenXRListener", "Got VR mode for 2D") 28 - 29 28 } else { 30 29 Toast.makeText(this, "Now in VR for $component", Toast.LENGTH_SHORT).show() 31 30 Log.i("OpenXRListener", "Got VR mode for component: $component") 32 31 } 33 - 34 32 } 35 33 }
+15 -12
src/xrt/targets/android_common/src/main/java/org/freedesktop/monado/android_common/RestartRuntimeDialogFragment.kt
··· 23 23 override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { 24 24 val message = arguments!!.getString(ARGS_KEY_MESSAGE) 25 25 val builder = AlertDialog.Builder(requireActivity()) 26 - builder.setMessage(message) 27 - .setCancelable(false) 28 - .setPositiveButton(R.string.restart) { _: DialogInterface?, _: Int -> 29 - delayRestart(DELAY_RESTART_DURATION) 30 - //! @todo elegant way to stop service? A bounded service might be restarted by 31 - // framework automatically. 32 - Process.killProcess(Process.myPid()) 33 - } 26 + builder.setMessage(message).setCancelable(false).setPositiveButton(R.string.restart) { 27 + _: DialogInterface?, 28 + _: Int -> 29 + delayRestart(DELAY_RESTART_DURATION) 30 + // ! @todo elegant way to stop service? A bounded service might be restarted by 31 + // framework automatically. 32 + Process.killProcess(Process.myPid()) 33 + } 34 34 return builder.create() 35 35 } 36 36 37 37 private fun delayRestart(delayMillis: Long) { 38 38 val intent = Intent(requireContext(), AboutActivity::class.java) 39 - val pendingIntent = PendingIntent.getActivity( 40 - requireContext(), REQUEST_CODE, 41 - intent, PendingIntent.FLAG_CANCEL_CURRENT 42 - ) 39 + val pendingIntent = 40 + PendingIntent.getActivity( 41 + requireContext(), 42 + REQUEST_CODE, 43 + intent, 44 + PendingIntent.FLAG_CANCEL_CURRENT 45 + ) 43 46 val am = requireContext().getSystemService(Context.ALARM_SERVICE) as AlarmManager 44 47 am.setExact(AlarmManager.RTC, System.currentTimeMillis() + delayMillis, pendingIntent) 45 48 }
+42 -36
src/xrt/targets/android_common/src/main/java/org/freedesktop/monado/android_common/ServiceNotificationImpl.kt
··· 15 15 import android.graphics.drawable.Icon 16 16 import android.os.Build 17 17 import androidx.core.app.NotificationManagerCompat 18 + import javax.inject.Inject 18 19 import org.freedesktop.monado.auxiliary.IServiceNotification 19 20 import org.freedesktop.monado.auxiliary.NameAndLogoProvider 20 21 import org.freedesktop.monado.auxiliary.UiProvider 21 - import javax.inject.Inject 22 22 23 23 class ServiceNotificationImpl @Inject constructor() : IServiceNotification { 24 24 companion object { ··· 28 28 private const val NOTIFICATION_ID = 8562 29 29 } 30 30 31 - @Inject 32 - lateinit var uiProvider: UiProvider 31 + @Inject lateinit var uiProvider: UiProvider 33 32 34 - @Inject 35 - lateinit var nameAndLogoProvider: NameAndLogoProvider 33 + @Inject lateinit var nameAndLogoProvider: NameAndLogoProvider 36 34 37 35 /** 38 - * Start creating a Notification.Builder in a version-compatible way, including our 39 - * notification channel if applicable. 36 + * Start creating a Notification.Builder in a version-compatible way, including our notification 37 + * channel if applicable. 40 38 */ 41 39 private fun makeNotificationBuilder(context: Context): Notification.Builder { 42 40 return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { 43 41 Notification.Builder(context, CHANNEL_ID) 44 42 } else { 45 - @Suppress("DEPRECATION") 46 - Notification.Builder(context) 43 + @Suppress("DEPRECATION") Notification.Builder(context) 47 44 } 48 45 } 49 46 50 47 private fun createChannel(context: Context) { 51 48 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { 52 49 53 - val notificationChannel = NotificationChannel(CHANNEL_ID, 50 + val notificationChannel = 51 + NotificationChannel( 52 + CHANNEL_ID, 54 53 nameAndLogoProvider.getLocalizedRuntimeName(), 55 - NotificationManager.IMPORTANCE_LOW) 56 - notificationChannel.description = context.getString( 54 + NotificationManager.IMPORTANCE_LOW 55 + ) 56 + notificationChannel.description = 57 + context.getString( 57 58 R.string.channel_desc, 58 - nameAndLogoProvider.getLocalizedRuntimeName()) 59 + nameAndLogoProvider.getLocalizedRuntimeName() 60 + ) 59 61 notificationChannel.setShowBadge(false) 60 62 notificationChannel.enableLights(false) 61 63 notificationChannel.enableVibration(false) 62 64 63 - NotificationManagerCompat.from(context) 64 - .createNotificationChannel(notificationChannel) 65 + NotificationManagerCompat.from(context).createNotificationChannel(notificationChannel) 65 66 } 66 - 67 67 } 68 68 69 69 /** 70 70 * Create and return a notification (creating the channel if applicable) that can be used in 71 71 * {@code Service#startForeground()} 72 72 */ 73 - override fun buildNotification(context: Context, pendingShutdownIntent: PendingIntent): Notification { 73 + override fun buildNotification( 74 + context: Context, 75 + pendingShutdownIntent: PendingIntent 76 + ): Notification { 74 77 createChannel(context) 75 78 76 - val action = Notification.Action.Builder( 77 - Icon.createWithResource(context, R.drawable.ic_feathericons_x), 78 - context.getString(R.string.notifExitRuntime), 79 - pendingShutdownIntent) 80 - .build() 79 + val action = 80 + Notification.Action.Builder( 81 + Icon.createWithResource(context, R.drawable.ic_feathericons_x), 82 + context.getString(R.string.notifExitRuntime), 83 + pendingShutdownIntent 84 + ) 85 + .build() 81 86 // Make a notification for our foreground service 82 87 // When selected it will open the "About" activity 83 - val builder = makeNotificationBuilder(context) 88 + val builder = 89 + makeNotificationBuilder(context) 84 90 .setOngoing(true) 85 91 .setContentTitle(nameAndLogoProvider.getLocalizedRuntimeName()) 86 - .setContentText(context.getString( 92 + .setContentText( 93 + context.getString( 87 94 R.string.notif_text, 88 - nameAndLogoProvider.getLocalizedRuntimeName())) 95 + nameAndLogoProvider.getLocalizedRuntimeName() 96 + ) 97 + ) 89 98 .setShowWhen(false) 90 99 .setActions(action) 91 100 .setContentIntent(uiProvider.makeAboutActivityPendingIntent()) 92 101 93 102 // Notification icon is optional 94 - uiProvider.getNotificationIcon()?.let { icon: Icon -> 95 - builder.setSmallIcon(icon) 96 - } 103 + uiProvider.getNotificationIcon()?.let { icon: Icon -> builder.setSmallIcon(icon) } 97 104 98 105 // Configure intent is optional 99 106 uiProvider.makeConfigureActivityPendingIntent()?.let { pendingIntent: PendingIntent -> 100 - 101 - val configureAction = Notification.Action.Builder( 102 - Icon.createWithResource(context, R.drawable.ic_feathericons_settings), 103 - context.getString(R.string.notifConfigure), 104 - pendingIntent) 107 + val configureAction = 108 + Notification.Action.Builder( 109 + Icon.createWithResource(context, R.drawable.ic_feathericons_settings), 110 + context.getString(R.string.notifConfigure), 111 + pendingIntent 112 + ) 105 113 .build() 106 114 builder.addAction(configureAction) 107 115 } 108 116 return builder.build() 109 117 } 110 118 111 - /** 112 - * Return the notification ID to use 113 - */ 119 + /** Return the notification ID to use */ 114 120 override fun getNotificationId(): Int = NOTIFICATION_ID 115 121 }
+3 -8
src/xrt/targets/android_common/src/main/java/org/freedesktop/monado/android_common/ShutdownProcess.kt
··· 14 14 15 15 class ShutdownProcess { 16 16 companion object { 17 - /** 18 - * Show and handle the shutdown runtime button. 19 - */ 17 + /** Show and handle the shutdown runtime button. */ 20 18 fun setupRuntimeShutdownButton(activity: AboutActivity) { 21 - val button = 22 - activity.findViewById<Button>(R.id.shutdown) 19 + val button = activity.findViewById<Button>(R.id.shutdown) 23 20 button.visibility = View.VISIBLE 24 - button.setOnClickListener { 25 - Process.killProcess(Process.myPid()) 26 - } 21 + button.setOnClickListener { Process.killProcess(Process.myPid()) } 27 22 } 28 23 } 29 24 }
+26 -31
src/xrt/targets/android_common/src/main/java/org/freedesktop/monado/android_common/VrModeStatus.java
··· 32 32 import androidx.annotation.Nullable; 33 33 import androidx.fragment.app.Fragment; 34 34 35 + import dagger.hilt.android.AndroidEntryPoint; 36 + 35 37 import org.freedesktop.monado.auxiliary.NameAndLogoProvider; 36 38 import org.freedesktop.monado.auxiliary.UiProvider; 37 39 ··· 41 43 42 44 import javax.inject.Inject; 43 45 44 - import dagger.hilt.android.AndroidEntryPoint; 45 - 46 - 47 - /** 48 - * A Fragment for displaying/affecting VR Listener status. 49 - */ 46 + /** A Fragment for displaying/affecting VR Listener status. */ 50 47 @AndroidEntryPoint 51 48 public class VrModeStatus extends Fragment { 52 49 public static final int STATUS_UNKNOWN = -2; ··· 56 53 private static final String TAG = "MonadoVrModeStatus"; 57 54 private static final String ARG_STATUS = "status"; 58 55 59 - @Inject 60 - UiProvider uiProvider; 56 + @Inject UiProvider uiProvider; 61 57 62 - @Inject 63 - NameAndLogoProvider nameAndLogoProvider; 58 + @Inject NameAndLogoProvider nameAndLogoProvider; 64 59 65 - private @Status 66 - int status_ = STATUS_UNKNOWN; 60 + private @Status int status_ = STATUS_UNKNOWN; 67 61 68 62 public VrModeStatus() { 69 63 // Required empty public constructor ··· 73 67 * Get the ComponentName for a VrListenerService 74 68 * 75 69 * @param resolveInfo a ResolveInfo from PackageManager.queryIntentServices() with an 76 - * android.service.vr.VrListenerService Intent and 77 - * PackageManager.GET_META_DATA 70 + * android.service.vr.VrListenerService Intent and PackageManager.GET_META_DATA 78 71 * @return the ComponentName, or null if resolveInfo.serviceInfo is null 79 72 */ 80 73 private static ComponentName getVrListener(@NonNull ResolveInfo resolveInfo) { ··· 85 78 return new ComponentName(serviceInfo.packageName, serviceInfo.name); 86 79 } 87 80 88 - private static @Nullable 89 - ComponentName findOurselves(@NonNull List<ResolveInfo> resolutions, @NonNull String packageName) { 81 + private static @Nullable ComponentName findOurselves( 82 + @NonNull List<ResolveInfo> resolutions, @NonNull String packageName) { 90 83 for (ResolveInfo resolveInfo : resolutions) { 91 84 ComponentName componentName = getVrListener(resolveInfo); 92 85 if (componentName == null) continue; ··· 102 95 /** 103 96 * Determine the VR mode status of this package. 104 97 * 105 - * @param context A context to look up package manager info about this package. 98 + * @param context A context to look up package manager info about this package. 106 99 * @param packageName The current package name (usually BuildConfig.APPLICATION_ID) 107 100 * @return the VR mode status 108 101 */ 109 - public static @Status 110 - int detectStatus(@NonNull Context context, @NonNull String packageName) { 102 + public static @Status int detectStatus(@NonNull Context context, @NonNull String packageName) { 111 103 Intent intent = new Intent(VrListenerService.SERVICE_INTERFACE); 112 104 PackageManager packageManager = context.getPackageManager(); 113 105 // Suppression because we only care about finding out about our own package. 114 106 @SuppressLint("QueryPermissionsNeeded") 115 - List<ResolveInfo> resolutions = packageManager.queryIntentServices(intent, 116 - PackageManager.GET_META_DATA); 107 + List<ResolveInfo> resolutions = 108 + packageManager.queryIntentServices(intent, PackageManager.GET_META_DATA); 117 109 if (resolutions == null || resolutions.isEmpty()) { 118 110 return STATUS_NOT_AVAIL; 119 111 } 120 112 ComponentName us = findOurselves(resolutions, packageName); 121 113 if (us == null) { 122 - Log.w(TAG, "Could not find ourselves in the list of VrListenerService implementations! " + packageName); 114 + Log.w( 115 + TAG, 116 + "Could not find ourselves in the list of VrListenerService implementations! " 117 + + packageName); 123 118 return STATUS_NOT_AVAIL; 124 119 } 125 120 ··· 132 127 } 133 128 134 129 /** 135 - * Use this factory method to create a new instance of 136 - * this fragment using the provided parameters. 130 + * Use this factory method to create a new instance of this fragment using the provided 131 + * parameters. 137 132 * 138 133 * @param status The VR Mode status. See detectStatus() 139 134 * @return A new instance of fragment VrModeStatus. ··· 180 175 break; 181 176 case STATUS_NOT_AVAIL: 182 177 textEnabledDisabled.setText( 183 - res.getString(R.string.vr_mode_not_avail, 178 + res.getString( 179 + R.string.vr_mode_not_avail, 184 180 nameAndLogoProvider.getLocalizedRuntimeName())); 185 181 textEnabledDisabled.setVisibility(View.VISIBLE); 186 182 button.setVisibility(View.GONE); ··· 196 192 } 197 193 198 194 @Override 199 - public View onCreateView(LayoutInflater inflater, ViewGroup container, 200 - Bundle savedInstanceState) { 195 + public View onCreateView( 196 + LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 201 197 // Inflate the layout for this fragment 202 198 View view = inflater.inflate(R.layout.fragment_vr_mode_status, container, false); 203 199 updateState(view); 204 - view.findViewById(R.id.btnLaunchVrSettings).setOnClickListener(v -> launchVrSettings(v.getContext())); 200 + view.findViewById(R.id.btnLaunchVrSettings) 201 + .setOnClickListener(v -> launchVrSettings(v.getContext())); 205 202 return view; 206 203 } 207 204 208 205 @IntDef(value = {STATUS_UNKNOWN, STATUS_DISABLED, STATUS_ENABLED, STATUS_NOT_AVAIL}) 209 206 @Retention(RetentionPolicy.SOURCE) 210 - public @interface Status { 211 - } 212 - 207 + public @interface Status {} 213 208 }
+8 -8
src/xrt/targets/openxr_android/src/main/java/org/freedesktop/monado/openxr_runtime/AboutLibrariesNoticeFragmentProvider.kt
··· 10 10 11 11 import androidx.fragment.app.Fragment 12 12 import com.mikepenz.aboutlibraries.LibsBuilder 13 - import org.freedesktop.monado.android_common.NoticeFragmentProvider 14 13 import javax.inject.Inject 14 + import org.freedesktop.monado.android_common.NoticeFragmentProvider 15 15 16 16 class AboutLibrariesNoticeFragmentProvider @Inject constructor() : NoticeFragmentProvider { 17 - override fun makeNoticeFragment(): Fragment = LibsBuilder() 18 - .withFields(R.string::class.java.fields) 19 - .withAboutIconShown(false) // We do this ourselves bigger 20 - .withAboutVersionShown(true) // Let the fragment show our version 21 - .withLicenseShown(true) // Not sure why you'd do this without license info 22 - .supportFragment() 23 - 17 + override fun makeNoticeFragment(): Fragment = 18 + LibsBuilder() 19 + .withFields(R.string::class.java.fields) 20 + .withAboutIconShown(false) // We do this ourselves bigger 21 + .withAboutVersionShown(true) // Let the fragment show our version 22 + .withLicenseShown(true) // Not sure why you'd do this without license info 23 + .supportFragment() 24 24 }
+10 -5
src/xrt/targets/openxr_android/src/main/java/org/freedesktop/monado/openxr_runtime/MonadoOpenXrAndroidModule.kt
··· 27 27 @Module 28 28 @InstallIn(SingletonComponent::class) 29 29 abstract class MonadoOpenXrAndroidModule { 30 - @Binds 31 - abstract fun bindUiProvider(uiProvider: MonadoOpenXrUiProvider): UiProvider 30 + @Binds abstract fun bindUiProvider(uiProvider: MonadoOpenXrUiProvider): UiProvider 32 31 33 32 @Binds 34 - abstract fun bindNameAndLogo(monadoOpenXrBrandingUiProvider: MonadoOpenXrBrandingUiProvider): NameAndLogoProvider 33 + abstract fun bindNameAndLogo( 34 + monadoOpenXrBrandingUiProvider: MonadoOpenXrBrandingUiProvider 35 + ): NameAndLogoProvider 35 36 36 37 @Binds 37 - abstract fun bindNoticeFragment(noticeFragmentProvider: AboutLibrariesNoticeFragmentProvider): NoticeFragmentProvider 38 + abstract fun bindNoticeFragment( 39 + noticeFragmentProvider: AboutLibrariesNoticeFragmentProvider 40 + ): NoticeFragmentProvider 38 41 39 42 @Binds 40 - abstract fun bindServiceNotification(serviceNotificationImpl: ServiceNotificationImpl): IServiceNotification 43 + abstract fun bindServiceNotification( 44 + serviceNotificationImpl: ServiceNotificationImpl 45 + ): IServiceNotification 41 46 }
+1 -3
src/xrt/targets/openxr_android/src/main/java/org/freedesktop/monado/openxr_runtime/MonadoOpenXrApplication.java
··· 14 14 15 15 import dagger.hilt.android.HiltAndroidApp; 16 16 17 - /** 18 - * Subclass required for Hilt usage. 19 - */ 17 + /** Subclass required for Hilt usage. */ 20 18 @HiltAndroidApp 21 19 public class MonadoOpenXrApplication extends Application { 22 20
+10 -8
src/xrt/targets/openxr_android/src/main/java/org/freedesktop/monado/openxr_runtime/MonadoOpenXrBrandingUiProvider.kt
··· 12 12 import android.graphics.drawable.Drawable 13 13 import androidx.core.content.ContextCompat 14 14 import dagger.hilt.android.qualifiers.ApplicationContext 15 - import org.freedesktop.monado.auxiliary.NameAndLogoProvider 16 15 import javax.inject.Inject 16 + import org.freedesktop.monado.auxiliary.NameAndLogoProvider 17 17 18 - class MonadoOpenXrBrandingUiProvider @Inject constructor(@ApplicationContext val context: Context) : NameAndLogoProvider { 19 - /** 20 - * Gets a localized runtime name string for the runtime/Monado-incorporating target. 21 - */ 22 - override fun getLocalizedRuntimeName(): CharSequence = context.packageManager.getApplicationLabel(context.applicationInfo) 18 + class MonadoOpenXrBrandingUiProvider @Inject constructor(@ApplicationContext val context: Context) : 19 + NameAndLogoProvider { 20 + /** Gets a localized runtime name string for the runtime/Monado-incorporating target. */ 21 + override fun getLocalizedRuntimeName(): CharSequence = 22 + context.packageManager.getApplicationLabel(context.applicationInfo) 23 23 24 24 /** 25 - * Gets a drawable for use in the about activity and elsewhere, for the runtime/Monado-incorporating target. 25 + * Gets a drawable for use in the about activity and elsewhere, for the 26 + * runtime/Monado-incorporating target. 26 27 */ 27 - override fun getLogoDrawable(): Drawable? = ContextCompat.getDrawable(context, R.drawable.ic_monado_logo) 28 + override fun getLogoDrawable(): Drawable? = 29 + ContextCompat.getDrawable(context, R.drawable.ic_monado_logo) 28 30 }
+7 -14
src/xrt/targets/openxr_android/src/main/java/org/freedesktop/monado/openxr_runtime/MonadoOpenXrUiProvider.kt
··· 15 15 import android.graphics.drawable.Icon 16 16 import android.os.Build 17 17 import dagger.hilt.android.qualifiers.ApplicationContext 18 + import javax.inject.Inject 18 19 import org.freedesktop.monado.android_common.AboutActivity 19 20 import org.freedesktop.monado.auxiliary.UiProvider 20 - import javax.inject.Inject 21 21 22 - class MonadoOpenXrUiProvider @Inject constructor(@ApplicationContext val context: Context) : UiProvider { 22 + class MonadoOpenXrUiProvider @Inject constructor(@ApplicationContext val context: Context) : 23 + UiProvider { 23 24 24 - /** 25 - * Gets a drawable for use in a notification, for the runtime/Monado-incorporating target. 26 - */ 25 + /** Gets a drawable for use in a notification, for the runtime/Monado-incorporating target. */ 27 26 override fun getNotificationIcon(): Icon? = 28 - Icon.createWithResource(context, R.drawable.ic_notif_xr_letters_custom) 27 + Icon.createWithResource(context, R.drawable.ic_notif_xr_letters_custom) 29 28 30 - /** 31 - * Make a {@code PendingIntent} to launch an "About" activity for the runtime/target. 32 - */ 29 + /** Make a {@code PendingIntent} to launch an "About" activity for the runtime/target. */ 33 30 override fun makeAboutActivityPendingIntent(): PendingIntent { 34 31 var flags = 0 35 32 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { ··· 39 36 context, 40 37 0, 41 38 Intent.makeMainActivity( 42 - ComponentName.createRelative( 43 - context, 44 - AboutActivity::class.qualifiedName!! 45 - ) 39 + ComponentName.createRelative(context, AboutActivity::class.qualifiedName!!) 46 40 ), 47 41 flags 48 42 ) 49 43 } 50 - 51 44 }