This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void loadWebPage(final String pageUrl) { | |
webView.getSettings().setJavaScriptEnabled(true); | |
webView.setWebChromeClient(new WebChromeClient()); | |
webView.setWebViewClient(new WebViewClient() { | |
@Override | |
public void onPageFinished(final WebView view, final String url) { | |
injectJS(view); | |
} | |
}); | |
webView.loadUrl(pageUrl); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"swagger": "2.0", | |
"info": { | |
"version": "1.0.0", | |
"title": "Zumba's API", | |
"description": "Documentation about Zumba's API.", | |
"contact": { | |
"name": "Zumba Engineering Team", | |
"email": "engineering@zumba.com", | |
"url": "https://tech.zumba.com" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public void onCreate() { | |
applicationComponent = initializeAppComponent(); | |
applicationComponent.inject(this); | |
} | |
protected AppComponent initializeAppComponent() { | |
return DaggerAppComponent.builder() | |
.applicationModule(new ApplicationModule(this)) | |
.build(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TestsApp extends App { | |
@Override | |
protected AppComponent initializeAppComponent() { | |
return DaggerAppComponent.builder() | |
.applicationModule(new MockApplicationModule(this)) | |
.databaseModule(new DatabaseModule()) | |
.networkModule(new MockNetworkModule()) | |
.picassoModule(new PicassoModule()) | |
.androidModule(new AndroidModule()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MockTestRunner extends AndroidJUnitRunner{ | |
@Override | |
public void onCreate(Bundle arguments) { | |
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().permitAll().build()); | |
super.onCreate(arguments); | |
} | |
@Override | |
public Application newApplication(ClassLoader cl, String className, Context context) | |
throws InstantiationException, IllegalAccessException, ClassNotFoundException { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
android { | |
... | |
defaultConfig { | |
... | |
testInstrumentationRunner ".MockTestRunner" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FragmentToolbar(@IdRes val resId: Int, | |
@StringRes val title: Int, | |
@MenuRes val menuId: Int, | |
val menuItems: MutableList<Int>, | |
val menuClicks: MutableList<MenuItem.OnMenuItemClickListener?>) { | |
companion object { | |
@JvmField val NO_TOOLBAR = -1 | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ToolbarManager constructor( | |
private var builder: FragmentToolbar, | |
private var container: View) { | |
fun prepareToolbar() { | |
if (builder.resId != FragmentToolbar.NO_TOOLBAR) { | |
val fragmentToolbar = container.findViewById(builder.resId) as Toolbar | |
if (builder.title != -1) { | |
fragmentToolbar.setTitle(builder.title) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class BaseFragment : Fragment() { | |
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | |
super.onViewCreated(view, savedInstanceState) | |
ToolbarManager(builder(), view).prepareToolbar() | |
} | |
protected abstract fun builder(): FragmentToolbar | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected FragmentToolbar builder() { | |
return new FragmentToolbar.Builder() | |
.withId(R.id.toolbar) | |
.withTitle(R.string.toolbar_title) | |
.onHomePressedDefaultAction() | |
.build(); | |
} |
OlderNewer