Эх сурвалжийг харах

Convert to kt

Signed-off-by: alperozturk <alper_ozturk@proton.me>
alperozturk 1 жил өмнө
parent
commit
e03da3b9bc

+ 15 - 19
app/src/main/java/com/nextcloud/client/di/FragmentInjector.kt

@@ -17,30 +17,26 @@
  * You should have received a copy of the GNU Affero General Public License
  * You should have received a copy of the GNU Affero General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
  */
+package com.nextcloud.client.di
 
 
-package com.nextcloud.client.di;
+import android.content.Context
+import androidx.fragment.app.Fragment
+import androidx.fragment.app.FragmentManager
+import dagger.android.support.AndroidSupportInjection
 
 
-import android.content.Context;
-
-import androidx.annotation.NonNull;
-import androidx.fragment.app.Fragment;
-import androidx.fragment.app.FragmentManager;
-import dagger.android.support.AndroidSupportInjection;
-
-class FragmentInjector extends FragmentManager.FragmentLifecycleCallbacks {
-    @Override
-    public void onFragmentPreAttached(
-        @NonNull FragmentManager fragmentManager,
-        @NonNull Fragment fragment,
-        @NonNull Context context
+internal class FragmentInjector : FragmentManager.FragmentLifecycleCallbacks() {
+    override fun onFragmentPreAttached(
+        fragmentManager: FragmentManager,
+        fragment: Fragment,
+        context: Context
     ) {
     ) {
-        super.onFragmentPreAttached(fragmentManager, fragment, context);
-        if (fragment instanceof Injectable) {
+        super.onFragmentPreAttached(fragmentManager, fragment, context)
+        if (fragment is Injectable) {
             try {
             try {
-                AndroidSupportInjection.inject(fragment);
-            } catch (IllegalArgumentException directCause) {
+                AndroidSupportInjection.inject(fragment)
+            } catch (directCause: IllegalArgumentException) {
                 // this provides a cause description that is a bit more friendly for developers
                 // this provides a cause description that is a bit more friendly for developers
-                throw new InjectorNotFoundException(fragment, directCause);
+                throw InjectorNotFoundException(fragment, directCause)
             }
             }
         }
         }
     }
     }