SlideShare ist ein Scribd-Unternehmen logo
1 von 13
Downloaden Sie, um offline zu lesen
イカしたライブラリを作った
話
横幕圭真(@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日木曜日

Weitere ähnliche Inhalte

Mehr von 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
 
自己組織化
自己組織化自己組織化
自己組織化
 

Kürzlich hochgeladen

Kürzlich hochgeladen (12)

NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
 
Utilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native IntegrationsUtilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native Integrations
 
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
 
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
 
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
 
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
 
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
 
新人研修 後半 2024/04/26の勉強会で発表されたものです。
新人研修 後半        2024/04/26の勉強会で発表されたものです。新人研修 後半        2024/04/26の勉強会で発表されたものです。
新人研修 後半 2024/04/26の勉強会で発表されたものです。
 
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
LoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイスLoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイス
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
 
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアルLoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
 
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
 
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
 

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