mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-09 07:16:04 -04:00
Merge pull request #1992 from akkywadhwa/jni-mod-kotlin
Fixed #1991 Convert JNIModule to Kotlin
This commit is contained in:
commit
0f17813039
@ -15,36 +15,25 @@
|
|||||||
* 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 org.kiwix.kiwixmobile.core.di.modules;
|
package org.kiwix.kiwixmobile.core.di.modules
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context
|
||||||
import androidx.annotation.NonNull;
|
import dagger.Module
|
||||||
import androidx.annotation.Nullable;
|
import dagger.Provides
|
||||||
import dagger.Module;
|
import org.kiwix.kiwixlib.JNIKiwix
|
||||||
import dagger.Provides;
|
import org.kiwix.kiwixlib.JNIKiwixSearcher
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton
|
||||||
import org.kiwix.kiwixlib.JNIKiwix;
|
|
||||||
import org.kiwix.kiwixlib.JNIKiwixSearcher;
|
|
||||||
|
|
||||||
/**
|
@Module
|
||||||
* Created by mhutti1 on 14/04/17.
|
class JNIModule {
|
||||||
*/
|
@Provides @Singleton
|
||||||
|
fun providesJNIKiwix(context: Context): JNIKiwix = JNIKiwix(context)
|
||||||
|
|
||||||
@Module public class JNIModule {
|
@Provides @Singleton fun providesJNIKiwixSearcher(): JNIKiwixSearcher? {
|
||||||
@Provides
|
return try {
|
||||||
@Singleton
|
JNIKiwixSearcher()
|
||||||
public JNIKiwix providesJNIKiwix(@NonNull Context context) {
|
} catch (ignore: UnsatisfiedLinkError) {
|
||||||
return new JNIKiwix(context);
|
null
|
||||||
}
|
|
||||||
|
|
||||||
@Provides
|
|
||||||
@Singleton
|
|
||||||
@Nullable
|
|
||||||
public JNIKiwixSearcher providesJNIKiwixSearcher() {
|
|
||||||
try {
|
|
||||||
return new JNIKiwixSearcher();
|
|
||||||
} catch (UnsatisfiedLinkError ignore) {
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user