SlideShare a Scribd company logo
1 of 17
Download to read offline
Developing Better
Debug Components
Mercari, Inc.
Tomoaki Imai
07/30/2015 @shibuya.apk
Hi I’m Tomo
Android Developer
Joined Mercari, Inc. Mar,2014
Focusing on US app development
twitter: @tomoaki_imai
github: tomoima525
How debugging goes
at Mercari
Debug View
Configure settings that affect
the whole app
• Api domain configuration
• Debug logout
• Open specific dialogs &
screens directly
Debug Menu
Debugging functions that you
want to use at each screens
Things you don’t always need
to see at Debug View
Debug Menu Functions
• Auto Inputs
• Device Info
• Activity Info
• Heap size
• Screen dpi
• GCM ID
• Refresh master data etc.
2 tips for debug functions
• Get the debug-related source code out of
the production
• Control a visibility of the debug menu
2 tips for debug functions
• Get the debug-related source code out of
the production
• Control a visibility of the debug menu
Modularize debug functions
public class DebugView {
public static void init(Context context, LinearLayout layout){
// Do nothing
}
}
Modularize debug functions
public class DebugView {
public static void init(Context context, LinearLayout layout) {
new DebugView(context, layout);
}
private DebugView(Context context, LinearLayout layout) {
LayoutInflater layoutInflater =
(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View debugView = layoutInflater.inflate(R.layout.layout_debug, null);
// Set debug views ...
layout.addView(debugView);
}
}
/src/release/…/DebugView.java
/src/debug/…/DebugView.java
// Any Activity or Fragment where you want to set DebugView.
// ex) SettingFragment.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_setting,
container, false);
// …
LinearLayout layout = (LinearLayout)
view.findViewById(R.id.debug_view);
DebugView.init(getBaseActivity(),layout);
return view;
}
Modularize debug functions
2 tips for debug functions
• Get the debug-related source code out of
the production
• Control a visibility of the debug menu
Control visibility of debug menu
Control visibility of debug menu
public class MenuModule {
private final static int GROUP_ID = Integer.MAX_VALUE;
public void onCreateOptionsMenu(Menu menu){
if(!LocalStorageUtil.getBoolean(S.is_debug_menu_visible)) return;
// Set group id so that we can control visibility!
menu.add(GROUP_ID, 100, 0, "Input");
//... Add menus
}
public void setVisibility(Menu menu, boolean isVisible){
for(int i = 0, length = menu.size(); i < length; i++ ){
MenuItem menuItem = menu.getItem(i);
if(menuItem.getGroupId() == GROUP_ID){
menuItem.setVisible(isVisible); //Set visibility
}
}
}
}
public class BaseActivity {
mMenuModule = new MenuModule(this);
// Called only once
@Override
public boolean onCreateOptionsMenu(Menu menu) {
mMenuModule.onCreateOptionsMenu(menu);
return super.onCreateOptionsMenu(menu);
}
// Called every time menu is shown
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
mMenuModule.setVisibility(menu,
LocalStorageUtil.getBoolean(S.is_debug_menu_visible, false));
return super.onPrepareOptionsMenu(menu);
}
}
Control visibility of debug menu
public class DebugView {
private void changeDebugMenu(boolean isDebugMenuVisible){
// Save the state in Shared preference
LocalStorageUtil.putBoolean(S.is_debug_menu_visible,
isDebugMenuVisible);
debugMenuButton
.setText(isDebugMenuVisible ? R.string.on : R.string.off);
debugMenuButton
.setBackgroundResource(isDebugMenuVisible ?
R.drawable.indicator_on :R.drawable.indicator_off);
// Update menu
MyApplication
.getContext().getCurrentActivity().invalidateOptionsMenu();
}
}
Control visibility of debug menu
Wrap up
• Modularise debug components and get rid
of them out from production
• Control the visibility of debug menu to avoid
effects on usability

More Related Content

What's hot

Exploring Android Studio
Exploring Android StudioExploring Android Studio
Exploring Android StudioAkshay Chordiya
 
Getting started with appium
Getting started with appiumGetting started with appium
Getting started with appiumPratik Patel
 
Comparison between Eclipse and Android Studio for Android Development
Comparison between Eclipse and Android Studio for Android DevelopmentComparison between Eclipse and Android Studio for Android Development
Comparison between Eclipse and Android Studio for Android DevelopmentWillow Cheng
 
Android Studio vs Eclipse: What are the main differences?
Android Studio vs Eclipse: What are the main differences?Android Studio vs Eclipse: What are the main differences?
Android Studio vs Eclipse: What are the main differences?avocarrot
 
Android Automation Testing with Selendroid
Android Automation Testing with SelendroidAndroid Automation Testing with Selendroid
Android Automation Testing with SelendroidVikas Thange
 
Mobile Automation with Appium
Mobile Automation with AppiumMobile Automation with Appium
Mobile Automation with AppiumManoj Kumar Kumar
 
Mobile Day - Intel XDK & Testing
Mobile Day - Intel XDK & TestingMobile Day - Intel XDK & Testing
Mobile Day - Intel XDK & TestingSoftware Guru
 
Introduction to android studio 2.0 and data binding library
Introduction to android studio 2.0 and data binding libraryIntroduction to android studio 2.0 and data binding library
Introduction to android studio 2.0 and data binding libraryKaushal Dhruw
 
Android – As a tool of innovation
Android – As a tool of innovation Android – As a tool of innovation
Android – As a tool of innovation Pallab Sarkar
 
Head first android apps dev tools
Head first android apps dev toolsHead first android apps dev tools
Head first android apps dev toolsShaka Huang
 
Getting Started with XCTest and XCUITest for iOS App Testing
Getting Started with XCTest and XCUITest for iOS App TestingGetting Started with XCTest and XCUITest for iOS App Testing
Getting Started with XCTest and XCUITest for iOS App TestingBitbar
 
Automation testing on ios platform using appium
Automation testing on ios platform using appiumAutomation testing on ios platform using appium
Automation testing on ios platform using appiumAmbreen Khan
 
ATAGTR2017 Upgrading a mobile tester's weapons with advanced debugging
ATAGTR2017 Upgrading a mobile tester's weapons with advanced debuggingATAGTR2017 Upgrading a mobile tester's weapons with advanced debugging
ATAGTR2017 Upgrading a mobile tester's weapons with advanced debuggingAgile Testing Alliance
 
Appium Meetup #2 - Mobile Web Automation Introduction
Appium Meetup #2 - Mobile Web Automation IntroductionAppium Meetup #2 - Mobile Web Automation Introduction
Appium Meetup #2 - Mobile Web Automation Introductionsnevesbarros
 
Best Strategy for Developing App Architecture and High Quality App
Best Strategy for Developing App Architecture and High Quality AppBest Strategy for Developing App Architecture and High Quality App
Best Strategy for Developing App Architecture and High Quality AppFlurry, Inc.
 

What's hot (20)

Exploring Android Studio
Exploring Android StudioExploring Android Studio
Exploring Android Studio
 
Getting started with appium
Getting started with appiumGetting started with appium
Getting started with appium
 
Comparison between Eclipse and Android Studio for Android Development
Comparison between Eclipse and Android Studio for Android DevelopmentComparison between Eclipse and Android Studio for Android Development
Comparison between Eclipse and Android Studio for Android Development
 
Android Studio vs. ADT
Android Studio vs. ADTAndroid Studio vs. ADT
Android Studio vs. ADT
 
Android Studio vs Eclipse: What are the main differences?
Android Studio vs Eclipse: What are the main differences?Android Studio vs Eclipse: What are the main differences?
Android Studio vs Eclipse: What are the main differences?
 
Flutter Intro
Flutter IntroFlutter Intro
Flutter Intro
 
Android Automation Testing with Selendroid
Android Automation Testing with SelendroidAndroid Automation Testing with Selendroid
Android Automation Testing with Selendroid
 
Mobile Automation with Appium
Mobile Automation with AppiumMobile Automation with Appium
Mobile Automation with Appium
 
Mobile Day - Intel XDK & Testing
Mobile Day - Intel XDK & TestingMobile Day - Intel XDK & Testing
Mobile Day - Intel XDK & Testing
 
Introduction to android studio 2.0 and data binding library
Introduction to android studio 2.0 and data binding libraryIntroduction to android studio 2.0 and data binding library
Introduction to android studio 2.0 and data binding library
 
Android – As a tool of innovation
Android – As a tool of innovation Android – As a tool of innovation
Android – As a tool of innovation
 
Head first android apps dev tools
Head first android apps dev toolsHead first android apps dev tools
Head first android apps dev tools
 
Android Test Automation Workshop
Android Test Automation WorkshopAndroid Test Automation Workshop
Android Test Automation Workshop
 
Getting Started with XCTest and XCUITest for iOS App Testing
Getting Started with XCTest and XCUITest for iOS App TestingGetting Started with XCTest and XCUITest for iOS App Testing
Getting Started with XCTest and XCUITest for iOS App Testing
 
Automation testing on ios platform using appium
Automation testing on ios platform using appiumAutomation testing on ios platform using appium
Automation testing on ios platform using appium
 
Appium & Jenkins
Appium & JenkinsAppium & Jenkins
Appium & Jenkins
 
ATAGTR2017 Upgrading a mobile tester's weapons with advanced debugging
ATAGTR2017 Upgrading a mobile tester's weapons with advanced debuggingATAGTR2017 Upgrading a mobile tester's weapons with advanced debugging
ATAGTR2017 Upgrading a mobile tester's weapons with advanced debugging
 
Appium Meetup #2 - Mobile Web Automation Introduction
Appium Meetup #2 - Mobile Web Automation IntroductionAppium Meetup #2 - Mobile Web Automation Introduction
Appium Meetup #2 - Mobile Web Automation Introduction
 
Best Strategy for Developing App Architecture and High Quality App
Best Strategy for Developing App Architecture and High Quality AppBest Strategy for Developing App Architecture and High Quality App
Best Strategy for Developing App Architecture and High Quality App
 
Appium overview
Appium overviewAppium overview
Appium overview
 

Viewers also liked

AWS Step FunctionとLambdaでディープラーニングの訓練を全自動化する
AWS Step FunctionとLambdaでディープラーニングの訓練を全自動化するAWS Step FunctionとLambdaでディープラーニングの訓練を全自動化する
AWS Step FunctionとLambdaでディープラーニングの訓練を全自動化するmizugokoro
 
20170210 jawsug横浜(AWSタグ)
20170210 jawsug横浜(AWSタグ)20170210 jawsug横浜(AWSタグ)
20170210 jawsug横浜(AWSタグ)Toshihiro Setojima
 
サーバーレスのアーキテクチャパターンとそれぞれの実装・テストの勘所
サーバーレスのアーキテクチャパターンとそれぞれの実装・テストの勘所サーバーレスのアーキテクチャパターンとそれぞれの実装・テストの勘所
サーバーレスのアーキテクチャパターンとそれぞれの実装・テストの勘所真吾 吉田
 
Redisの特徴と活用方法について
Redisの特徴と活用方法についてRedisの特徴と活用方法について
Redisの特徴と活用方法についてYuji Otani
 
サーバーレスの今とこれから
サーバーレスの今とこれからサーバーレスの今とこれから
サーバーレスの今とこれから真吾 吉田
 
AWS SAMで始めるサーバーレスアプリケーション開発
AWS SAMで始めるサーバーレスアプリケーション開発AWS SAMで始めるサーバーレスアプリケーション開発
AWS SAMで始めるサーバーレスアプリケーション開発真吾 吉田
 

Viewers also liked (6)

AWS Step FunctionとLambdaでディープラーニングの訓練を全自動化する
AWS Step FunctionとLambdaでディープラーニングの訓練を全自動化するAWS Step FunctionとLambdaでディープラーニングの訓練を全自動化する
AWS Step FunctionとLambdaでディープラーニングの訓練を全自動化する
 
20170210 jawsug横浜(AWSタグ)
20170210 jawsug横浜(AWSタグ)20170210 jawsug横浜(AWSタグ)
20170210 jawsug横浜(AWSタグ)
 
サーバーレスのアーキテクチャパターンとそれぞれの実装・テストの勘所
サーバーレスのアーキテクチャパターンとそれぞれの実装・テストの勘所サーバーレスのアーキテクチャパターンとそれぞれの実装・テストの勘所
サーバーレスのアーキテクチャパターンとそれぞれの実装・テストの勘所
 
Redisの特徴と活用方法について
Redisの特徴と活用方法についてRedisの特徴と活用方法について
Redisの特徴と活用方法について
 
サーバーレスの今とこれから
サーバーレスの今とこれからサーバーレスの今とこれから
サーバーレスの今とこれから
 
AWS SAMで始めるサーバーレスアプリケーション開発
AWS SAMで始めるサーバーレスアプリケーション開発AWS SAMで始めるサーバーレスアプリケーション開発
AWS SAMで始めるサーバーレスアプリケーション開発
 

Similar to Developing better debug_components

Guice tutorial
Guice tutorialGuice tutorial
Guice tutorialAnh Quân
 
Testing android apps with espresso
Testing android apps with espressoTesting android apps with espresso
Testing android apps with espressoÉdipo Souza
 
Skinning Android for Embedded Applications
Skinning Android for Embedded ApplicationsSkinning Android for Embedded Applications
Skinning Android for Embedded ApplicationsVIA Embedded
 
0106 debugging
0106 debugging0106 debugging
0106 debuggingvkyecc1
 
Advanced Dagger talk from 360andev
Advanced Dagger talk from 360andevAdvanced Dagger talk from 360andev
Advanced Dagger talk from 360andevMike Nakhimovich
 
Handling action bar in Android
Handling action bar in AndroidHandling action bar in Android
Handling action bar in Androidindiangarg
 
Leaving Interface Builder Behind
Leaving Interface Builder BehindLeaving Interface Builder Behind
Leaving Interface Builder BehindJohn Wilker
 
Menu bars and menus
Menu bars and menusMenu bars and menus
Menu bars and menusmyrajendra
 
Android Workshop 2013
Android Workshop 2013Android Workshop 2013
Android Workshop 2013Junda Ong
 
Diving into VS 2015 Day5
Diving into VS 2015 Day5Diving into VS 2015 Day5
Diving into VS 2015 Day5Akhil Mittal
 
Advanced Coded UI Testing
Advanced Coded UI TestingAdvanced Coded UI Testing
Advanced Coded UI TestingShai Raiten
 
Debugging programs with Keil uVision
Debugging programs with Keil uVisionDebugging programs with Keil uVision
Debugging programs with Keil uVisionSaravananVijayakumar4
 
MOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app developmentMOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app developmentanistar sung
 
MobileConf 2015: Desmistificando o Phonegap (Cordova)
MobileConf 2015: Desmistificando o Phonegap (Cordova)MobileConf 2015: Desmistificando o Phonegap (Cordova)
MobileConf 2015: Desmistificando o Phonegap (Cordova)Loiane Groner
 
Desmistificando o Phonegap (Cordova)
Desmistificando o Phonegap (Cordova)Desmistificando o Phonegap (Cordova)
Desmistificando o Phonegap (Cordova)Loiane Groner
 

Similar to Developing better debug_components (20)

Google GIN
Google GINGoogle GIN
Google GIN
 
Guice tutorial
Guice tutorialGuice tutorial
Guice tutorial
 
Testing android apps with espresso
Testing android apps with espressoTesting android apps with espresso
Testing android apps with espresso
 
Skinning Android for Embedded Applications
Skinning Android for Embedded ApplicationsSkinning Android for Embedded Applications
Skinning Android for Embedded Applications
 
0106 debugging
0106 debugging0106 debugging
0106 debugging
 
Android App development III
Android App development IIIAndroid App development III
Android App development III
 
Advanced Dagger talk from 360andev
Advanced Dagger talk from 360andevAdvanced Dagger talk from 360andev
Advanced Dagger talk from 360andev
 
Handling action bar in Android
Handling action bar in AndroidHandling action bar in Android
Handling action bar in Android
 
Leaving Interface Builder Behind
Leaving Interface Builder BehindLeaving Interface Builder Behind
Leaving Interface Builder Behind
 
Menu bars and menus
Menu bars and menusMenu bars and menus
Menu bars and menus
 
Android Workshop 2013
Android Workshop 2013Android Workshop 2013
Android Workshop 2013
 
Android action bar and notifications-chapter16
Android action bar and notifications-chapter16Android action bar and notifications-chapter16
Android action bar and notifications-chapter16
 
Lightning Talk - Xamarin
Lightning Talk - Xamarin Lightning Talk - Xamarin
Lightning Talk - Xamarin
 
Diving into VS 2015 Day5
Diving into VS 2015 Day5Diving into VS 2015 Day5
Diving into VS 2015 Day5
 
Advanced Coded UI Testing
Advanced Coded UI TestingAdvanced Coded UI Testing
Advanced Coded UI Testing
 
Debugging programs with Keil uVision
Debugging programs with Keil uVisionDebugging programs with Keil uVision
Debugging programs with Keil uVision
 
MOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app developmentMOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app development
 
MobileConf 2015: Desmistificando o Phonegap (Cordova)
MobileConf 2015: Desmistificando o Phonegap (Cordova)MobileConf 2015: Desmistificando o Phonegap (Cordova)
MobileConf 2015: Desmistificando o Phonegap (Cordova)
 
Deep Inside Android Hacks
Deep Inside Android HacksDeep Inside Android Hacks
Deep Inside Android Hacks
 
Desmistificando o Phonegap (Cordova)
Desmistificando o Phonegap (Cordova)Desmistificando o Phonegap (Cordova)
Desmistificando o Phonegap (Cordova)
 

More from Tomoaki Imai

Android development at mercari 2015
Android development at mercari 2015Android development at mercari 2015
Android development at mercari 2015Tomoaki Imai
 
Tips for better CI on Android
Tips for better CI on AndroidTips for better CI on Android
Tips for better CI on AndroidTomoaki Imai
 
What I learned about communication in Sanfrancisco
What I learned about communication in SanfranciscoWhat I learned about communication in Sanfrancisco
What I learned about communication in SanfranciscoTomoaki Imai
 
Android cleanarchitecture
Android cleanarchitectureAndroid cleanarchitecture
Android cleanarchitectureTomoaki Imai
 
Development at Mercari
Development at MercariDevelopment at Mercari
Development at MercariTomoaki Imai
 
ユーザーを待たせないためにできること
ユーザーを待たせないためにできることユーザーを待たせないためにできること
ユーザーを待たせないためにできることTomoaki Imai
 
US進出でのAndroid開発inメルカリ Mercari US App Development
US進出でのAndroid開発inメルカリ Mercari US App Development US進出でのAndroid開発inメルカリ Mercari US App Development
US進出でのAndroid開発inメルカリ Mercari US App Development Tomoaki Imai
 
ログ管理でウキウキAndroid Life (Log Management in Android)
ログ管理でウキウキAndroid Life (Log Management in Android)ログ管理でウキウキAndroid Life (Log Management in Android)
ログ管理でウキウキAndroid Life (Log Management in Android)Tomoaki Imai
 

More from Tomoaki Imai (8)

Android development at mercari 2015
Android development at mercari 2015Android development at mercari 2015
Android development at mercari 2015
 
Tips for better CI on Android
Tips for better CI on AndroidTips for better CI on Android
Tips for better CI on Android
 
What I learned about communication in Sanfrancisco
What I learned about communication in SanfranciscoWhat I learned about communication in Sanfrancisco
What I learned about communication in Sanfrancisco
 
Android cleanarchitecture
Android cleanarchitectureAndroid cleanarchitecture
Android cleanarchitecture
 
Development at Mercari
Development at MercariDevelopment at Mercari
Development at Mercari
 
ユーザーを待たせないためにできること
ユーザーを待たせないためにできることユーザーを待たせないためにできること
ユーザーを待たせないためにできること
 
US進出でのAndroid開発inメルカリ Mercari US App Development
US進出でのAndroid開発inメルカリ Mercari US App Development US進出でのAndroid開発inメルカリ Mercari US App Development
US進出でのAndroid開発inメルカリ Mercari US App Development
 
ログ管理でウキウキAndroid Life (Log Management in Android)
ログ管理でウキウキAndroid Life (Log Management in Android)ログ管理でウキウキAndroid Life (Log Management in Android)
ログ管理でウキウキAndroid Life (Log Management in Android)
 

Recently uploaded

lifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptxlifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptxsomshekarkn64
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEroselinkalist12
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfAsst.prof M.Gokilavani
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfROCENODodongVILLACER
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
Transport layer issues and challenges - Guide
Transport layer issues and challenges - GuideTransport layer issues and challenges - Guide
Transport layer issues and challenges - GuideGOPINATHS437943
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catcherssdickerson1
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionMebane Rash
 
Piping Basic stress analysis by engineering
Piping Basic stress analysis by engineeringPiping Basic stress analysis by engineering
Piping Basic stress analysis by engineeringJuanCarlosMorales19600
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
Earthing details of Electrical Substation
Earthing details of Electrical SubstationEarthing details of Electrical Substation
Earthing details of Electrical Substationstephanwindworld
 
computer application and construction management
computer application and construction managementcomputer application and construction management
computer application and construction managementMariconPadriquez1
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)dollysharma2066
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...Chandu841456
 

Recently uploaded (20)

lifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptxlifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptx
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
 
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdf
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
Transport layer issues and challenges - Guide
Transport layer issues and challenges - GuideTransport layer issues and challenges - Guide
Transport layer issues and challenges - Guide
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of Action
 
Piping Basic stress analysis by engineering
Piping Basic stress analysis by engineeringPiping Basic stress analysis by engineering
Piping Basic stress analysis by engineering
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
Earthing details of Electrical Substation
Earthing details of Electrical SubstationEarthing details of Electrical Substation
Earthing details of Electrical Substation
 
computer application and construction management
computer application and construction managementcomputer application and construction management
computer application and construction management
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 

Developing better debug_components

  • 1. Developing Better Debug Components Mercari, Inc. Tomoaki Imai 07/30/2015 @shibuya.apk
  • 2. Hi I’m Tomo Android Developer Joined Mercari, Inc. Mar,2014 Focusing on US app development twitter: @tomoaki_imai github: tomoima525
  • 4. Debug View Configure settings that affect the whole app • Api domain configuration • Debug logout • Open specific dialogs & screens directly
  • 5. Debug Menu Debugging functions that you want to use at each screens Things you don’t always need to see at Debug View
  • 6. Debug Menu Functions • Auto Inputs • Device Info • Activity Info • Heap size • Screen dpi • GCM ID • Refresh master data etc.
  • 7. 2 tips for debug functions • Get the debug-related source code out of the production • Control a visibility of the debug menu
  • 8. 2 tips for debug functions • Get the debug-related source code out of the production • Control a visibility of the debug menu
  • 10. public class DebugView { public static void init(Context context, LinearLayout layout){ // Do nothing } } Modularize debug functions public class DebugView { public static void init(Context context, LinearLayout layout) { new DebugView(context, layout); } private DebugView(Context context, LinearLayout layout) { LayoutInflater layoutInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View debugView = layoutInflater.inflate(R.layout.layout_debug, null); // Set debug views ... layout.addView(debugView); } } /src/release/…/DebugView.java /src/debug/…/DebugView.java
  • 11. // Any Activity or Fragment where you want to set DebugView. // ex) SettingFragment.java @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_setting, container, false); // … LinearLayout layout = (LinearLayout) view.findViewById(R.id.debug_view); DebugView.init(getBaseActivity(),layout); return view; } Modularize debug functions
  • 12. 2 tips for debug functions • Get the debug-related source code out of the production • Control a visibility of the debug menu
  • 13. Control visibility of debug menu
  • 14. Control visibility of debug menu public class MenuModule { private final static int GROUP_ID = Integer.MAX_VALUE; public void onCreateOptionsMenu(Menu menu){ if(!LocalStorageUtil.getBoolean(S.is_debug_menu_visible)) return; // Set group id so that we can control visibility! menu.add(GROUP_ID, 100, 0, "Input"); //... Add menus } public void setVisibility(Menu menu, boolean isVisible){ for(int i = 0, length = menu.size(); i < length; i++ ){ MenuItem menuItem = menu.getItem(i); if(menuItem.getGroupId() == GROUP_ID){ menuItem.setVisible(isVisible); //Set visibility } } } }
  • 15. public class BaseActivity { mMenuModule = new MenuModule(this); // Called only once @Override public boolean onCreateOptionsMenu(Menu menu) { mMenuModule.onCreateOptionsMenu(menu); return super.onCreateOptionsMenu(menu); } // Called every time menu is shown @Override public boolean onPrepareOptionsMenu(Menu menu) { mMenuModule.setVisibility(menu, LocalStorageUtil.getBoolean(S.is_debug_menu_visible, false)); return super.onPrepareOptionsMenu(menu); } } Control visibility of debug menu
  • 16. public class DebugView { private void changeDebugMenu(boolean isDebugMenuVisible){ // Save the state in Shared preference LocalStorageUtil.putBoolean(S.is_debug_menu_visible, isDebugMenuVisible); debugMenuButton .setText(isDebugMenuVisible ? R.string.on : R.string.off); debugMenuButton .setBackgroundResource(isDebugMenuVisible ? R.drawable.indicator_on :R.drawable.indicator_off); // Update menu MyApplication .getContext().getCurrentActivity().invalidateOptionsMenu(); } } Control visibility of debug menu
  • 17. Wrap up • Modularise debug components and get rid of them out from production • Control the visibility of debug menu to avoid effects on usability