[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-7332":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":16,"stars30d":17,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":18,"rankGlobal":10,"rankLanguage":10,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":22,"hasPages":20,"topics":23,"createdAt":10,"pushedAt":10,"updatedAt":26,"readmeContent":27,"aiSummary":28,"trendingCount":16,"starSnapshotCount":16,"syncStatus":29,"lastSyncTime":30,"discoverSource":31},7332,"Fotoapparat","RedApparat\u002FFotoapparat","RedApparat","Making Camera for Android more friendly. 📸","",null,"Kotlin",3818,416,87,83,0,1,59.96,"Apache License 2.0",false,"master",true,[24,25],"android","camera","2026-06-12 04:00:33","# Fotoapparat\n\n![Build status](https:\u002F\u002Ftravis-ci.org\u002FRedApparat\u002FFotoapparat.svg?branch=master)\n\n![ ](sample\u002Fsrc\u002Fmain\u002Fres\u002Fmipmap-xxxhdpi\u002Fic_launcher.png)\n\nCamera API in Android is hard. Having 2 different API for new and old Camera does not make things any easier. But fret not, that is your lucky day! After several years of working with Camera, we came up with Fotoapparat.\n\nWhat it provides:\n\n- Camera API which does not allow you to shoot yourself in the foot.\n- Simple yet powerful parameters customization.\n- Standalone custom `CameraView` which can be integrated into any `Activity`.\n- Fixes and workarounds for device-specific problems.\n- Both Kotlin and Java friendly configurations.\n- Last, but not least, non 0% test coverage.\n\nTaking picture becomes as simple as:\n\n```kotlin\nval fotoapparat = Fotoapparat(\n    context = this,\n    view = cameraView\n)\n\nfotoapparat.start()\n\nfotoapparat\n    .takePicture()\n    .saveToFile(someFile)\n```\n\n## How it works\n\n### Step One\n\nAdd `CameraView` to your layout\n\n```xml\n\u003Cio.fotoapparat.view.CameraView\n    android:id=\"@+id\u002Fcamera_view\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\u002F>\n```\n\n### Step Two\n\nConfigure `Fotoapparat` instance.\n\n```kotlin\nFotoapparat(\n            context = this,\n            view = cameraView,                   \u002F\u002F view which will draw the camera preview\n            scaleType = ScaleType.CenterCrop,    \u002F\u002F (optional) we want the preview to fill the view\n            lensPosition = back(),               \u002F\u002F (optional) we want back camera\n            cameraConfiguration = configuration, \u002F\u002F (optional) define an advanced configuration\n            logger = loggers(                    \u002F\u002F (optional) we want to log camera events in 2 places at once\n                     logcat(),                   \u002F\u002F ... in logcat\n                     fileLogger(this)            \u002F\u002F ... and to file\n            ),\n            cameraErrorCallback = { error -> }   \u002F\u002F (optional) log fatal errors\n    )\n```\n\nCheck the [wiki for the `configuration` options e.g. change iso](https:\u002F\u002Fgithub.com\u002FFotoapparat\u002FFotoapparat\u002Fwiki\u002FConfiguration-Kotlin)\n\nAre you using Java only? See our [wiki for the java-friendly configuration](https:\u002F\u002Fgithub.com\u002FFotoapparat\u002FFotoapparat\u002Fwiki\u002FConfiguration-Java).\n\n### Step Three\n\nCall `start()` and `stop()`. No rocket science here.\n\n```kotlin\noverride fun onStart() {\n    super.onStart()\n    fotoapparat.start()\n}\n\noverride fun onStop() {\n    super.onStop()\n    fotoapparat.stop()\n}\n```\n\n### Take a picture\n\nFinally, we are ready to take a picture. You have various options.\n\n```kotlin\nval photoResult = fotoapparat.takePicture()\n\n\u002F\u002F Asynchronously saves photo to file\nphotoResult.saveToFile(someFile)\n\n\u002F\u002F Asynchronously converts photo to bitmap and returns the result on the main thread\nphotoResult\n    .toBitmap()\n    .whenAvailable { bitmapPhoto ->\n            val imageView = (ImageView) findViewById(R.id.result)\n\n            imageView.setImageBitmap(bitmapPhoto.bitmap)\n            imageView.setRotation(-bitmapPhoto.rotationDegrees)\n    }\n\n\u002F\u002F Of course, you can also get a photo in a blocking way. Do not do it on the main thread though.\nval result = photoResult.toBitmap().await()\n\n\u002F\u002F Convert asynchronous events to RxJava 1.x\u002F2.x types.\n\u002F\u002F See \u002Ffotoapparat-adapters\u002F module\nphotoResult\n        .toBitmap()\n        .toSingle()\n        .subscribe { bitmapPhoto ->\n\n        }\n```\n\n## Update parameters\n\nIt is also possible to update some parameters after `Fotoapparat` was already started.\n\n```kotlin\nfotoapparat.updateConfiguration(\n        UpdateConfiguration(\n                flashMode = if (isChecked) torch() else off()\n                \u002F\u002F ...\n                \u002F\u002F all the parameters available in CameraConfiguration\n        )\n)\n```\n\nOr alternatively, you may provide updates on an existing full configuration.\n\n```kotlin\nval configuration = CameraConfiguration(\n    \u002F\u002F A full configuration\n    \u002F\u002F ...\n)\n\nfotoapparat.updateConfiguration(\n    configuration.copy(\n            flashMode = if (isChecked) torch() else off()\n            \u002F\u002F all the parameters available in CameraConfiguration\n    )\n)\n```\n\n## Switch cameras\n\nIn order to switch between cameras, `Fotoapparat.switchTo()` can be used with the new desired `lensPosition` and its `cameraConfiguration`.\n\n```kotlin\nfotoapparat.switchTo(\n    lensPosition = front(),\n    cameraConfiguration = newConfigurationForFrontCamera\n)\n```\n\n## Set up\n\nAdd dependency to your `build.gradle`\n\n```groovy\nimplementation 'io.fotoapparat:fotoapparat:2.7.0'\n```\n\nCamera permission will be automatically added to your `AndroidManifest.xml`. Do not forget to request this permission on Marshmallow and higher.\n\n## Face detection\n\nOptionally, you can check out our other library which adds face detection capabilities - [FaceDetector](https:\u002F\u002Fgithub.com\u002FFotoapparat\u002FFaceDetector).\n\n## Credits\n\nWe want to say thanks to [Mark Murphy](https:\u002F\u002Fgithub.com\u002Fcommonsguy) for the awesome job he did with [CWAC-Camera](https:\u002F\u002Fgithub.com\u002Fcommonsguy\u002Fcwac-camera). We were using his library for a couple of years and now we feel that Fotoapparat is a next step in the right direction.\n\nWe also want to say many thanks to [Leander Lenzing](http:\u002F\u002Fleanderlenzing.com\u002F) for the amazing icon. Don't forget to follow his work in [dribbble](https:\u002F\u002Fdribbble.com\u002Fleanderlenzing).\n\n## License\n\n```\nCopyright 2017 Fotoapparat\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http:\u002F\u002Fwww.apache.org\u002Flicenses\u002FLICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","Fotoapparat 是一个旨在简化 Android 平台相机应用开发的库。它通过提供易于使用的 API 来封装复杂的原生 Camera API，支持 Kotlin 和 Java 语言编写的应用程序。核心功能包括自定义参数设置、独立的 `CameraView` 组件以及针对特定设备问题的修复和变通方案等。特别适合需要集成相机功能但又希望减少因直接操作底层 API 而可能引入错误的 Android 应用场景中使用。无论是快速拍摄照片还是更高级别的相机控制需求，如调整ISO值等，开发者都能找到简洁而强大的解决方案。",2,"2026-06-11 03:11:48","top_language"]