SlideShare uma empresa Scribd logo
1 de 13
Baixar para ler offline
イカしたライブラリを作った
話
横幕圭真(@KeithYokoma)
114年3月27日木曜日
イカしたライブラリ
• Amalgam
• https://github.com/nohana/Amalgam
• 頻繁に使う手続きをまとめてユーティリティに
• ほぼ static なメソッドばかり
• Context を使ったものも安心設計
214年3月27日木曜日
イカしたライブラリ
• Laevatein
• https://github.com/nohana/Laevatein
• 写真セレクタ画面のセット
• 目指したのは、KitKat のファイルセレクタのもっ
とイイカンジのやつ
• 簡単な API でらくらく実装
314年3月27日木曜日
イカしたライブラリ
• Laevatein
• やるべきことは以下
public	
  static	
  final	
  int	
  REQUEST_CODE	
  =	
  1;
public	
  void	
  onButtonClick(View	
  view)	
  {
	
  	
  	
  	
  Laevatein.from(this)
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .choose(MimeType.allOf())
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .count(0,	
  10)
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .forResult(REQUEST_CODE);
}
private	
  List<Uri>	
  mSelected;
@Override
protected	
  void	
  onActivityResult(int	
  requestCode,	
  int	
  resultCode,	
  Intent	
  data)	
  {
	
  	
  	
  	
  super.onActivityResult(requestCode,	
  resultCode,	
  data);
	
  	
  	
  	
  if	
  (requestCode	
  ==	
  REQUEST_CODE	
  &&	
  resultCode	
  ==	
  Activity.RESULT_OK)	
  {
	
  	
  	
  	
  	
  	
  	
  	
  mSelected	
  =	
  Laevatein.obtainResult(data);
	
  	
  	
  	
  }
}
414年3月27日木曜日
イカしたライブラリ
514年3月27日木曜日
超カンタン!
✌(‘ω’✌ )三✌(‘ω’)✌三( ✌’ω’)✌
614年3月27日木曜日
イカしたライブラリ
• Laevatein
• オプションもいろいろ
• 画質にこだわる場合
• 選び直しをしたい場合
• セルのレイアウトを変えたい場合
Laevatein.from(this)
	
  	
  	
  	
  	
  	
  	
  	
  .choose(MimeType.allOf())
	
  	
  	
  	
  	
  	
  	
  	
  .quality(30000,	
  Integer.MAX_VALUE)
	
  	
  	
  	
  	
  	
  	
  	
  .forResult(REQUEST_CODE);
Laevatein.from(this)
	
  	
  	
  	
  	
  	
  	
  	
  .choose(MimeType.allOf())
	
  	
  	
  	
  	
  	
  	
  	
  .resume(mSelectedList)
	
  	
  	
  	
  	
  	
  	
  	
  .forResult(REQUEST_CODE);
Laevatein.from(this)
	
  	
  	
  	
  	
  	
  	
  	
  .choose(MimeType.allOf())
	
  	
  	
  	
  	
  	
  	
  	
  .bindEachImageWith(
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  R.layout.hoge,	
  R.id.image,	
  R.id.check)
	
  	
  	
  	
  	
  	
  	
  	
  .forResult(REQUEST_CODE);
714年3月27日木曜日
イカしたライブラリ
• Laevatein
• テーマはアプリが定義したものに
814年3月27日木曜日
超カンタン!
✌(‘ω’✌ )三✌(‘ω’)✌三( ✌’ω’)✌
914年3月27日木曜日
苦労話
• attr.xml の闇
• 他のライブラリと <attr>の名前がかぶった時
• aapt がうまく解決できなくなってコンパイルエラー
• iOS 的ネーミングで解決
1014年3月27日木曜日
苦労話
• リソース名の闇
• ライブラリと同じ名前のリソースを持つアプリ
• アプリ本体側のリソース名が優先される
• iOS 的ネーミングで解決
1114年3月27日木曜日
orz
1214年3月27日木曜日
今後
• もう少し機能を増やす
• KitKat のやつ呼び出すとか
• 写真をその場で撮って選択状態にするとか
1314年3月27日木曜日

Mais conteúdo relacionado

Mais de Keishin Yokomaku (10)

Deep Inside Android Hacks
Deep Inside Android HacksDeep Inside Android Hacks
Deep Inside Android Hacks
 
Make it compatible
Make it compatibleMake it compatible
Make it compatible
 
Signature
SignatureSignature
Signature
 
Android Media Hacks
Android Media HacksAndroid Media Hacks
Android Media Hacks
 
Null, the Abyss
Null, the AbyssNull, the Abyss
Null, the Abyss
 
?
??
?
 
Typeface
TypefaceTypeface
Typeface
 
Version Management
Version ManagementVersion Management
Version Management
 
Google I/O 2013 報告会 Android Studio と Gradle
Google I/O 2013 報告会 Android Studio と GradleGoogle I/O 2013 報告会 Android Studio と Gradle
Google I/O 2013 報告会 Android Studio と Gradle
 
自己組織化
自己組織化自己組織化
自己組織化
 

Último

【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)Hiroki Ichikura
 
論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNet論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNetToru Tamaki
 
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介Yuma Ohgami
 
論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A survey論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A surveyToru Tamaki
 
スマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムスマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムsugiuralab
 
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略Ryo Sasaki
 
SOPを理解する 2024/04/19 の勉強会で発表されたものです
SOPを理解する       2024/04/19 の勉強会で発表されたものですSOPを理解する       2024/04/19 の勉強会で発表されたものです
SOPを理解する 2024/04/19 の勉強会で発表されたものですiPride Co., Ltd.
 
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...Toru Tamaki
 
TSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdfTSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdftaisei2219
 

Último (9)

【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
 
論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNet論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNet
 
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
 
論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A survey論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A survey
 
スマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムスマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システム
 
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
 
SOPを理解する 2024/04/19 の勉強会で発表されたものです
SOPを理解する       2024/04/19 の勉強会で発表されたものですSOPを理解する       2024/04/19 の勉強会で発表されたものです
SOPを理解する 2024/04/19 の勉強会で発表されたものです
 
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
 
TSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdfTSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdf
 

イカしたライブラリを作った話