Last active
May 19, 2016 12:47
-
-
Save joannecheng/067eaede2673ab704c80 to your computer and use it in GitHub Desktop.
aaaagghhh
This file contains hidden or 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
java.lang.AssertionError: android.support.v7.app.ActionBar$DisplayOptions | |
at scala.tools.nsc.symtab.classfile.ClassfileParser$$anonfun$enterOwnInnerClasses$1.apply(ClassfileParser.scala:1120) | |
at scala.tools.nsc.symtab.classfile.ClassfileParser$$anonfun$enterOwnInnerClasses$1.apply(ClassfileParser.scala:1117) | |
at scala.collection.mutable.HashMap$$anon$2$$anonfun$foreach$3.apply(HashMap.scala:107) | |
at scala.collection.mutable.HashMap$$anon$2$$anonfun$foreach$3.apply(HashMap.scala:107) | |
at scala.collection.mutable.HashTable$class.foreachEntry(HashTable.scala:226) | |
at scala.collection.mutable.HashMap.foreachEntry(HashMap.scala:39) | |
at scala.collection.mutable.HashMap$$anon$2.foreach(HashMap.scala:107) | |
at scala.tools.nsc.symtab.classfile.ClassfileParser.enterOwnInnerClasses(ClassfileParser.scala:1117) | |
at scala.tools.nsc.symtab.classfile.ClassfileParser.parseClass(ClassfileParser.scala:536) | |
at scala.tools.nsc.symtab.classfile.ClassfileParser.parse(ClassfileParser.scala:88) | |
at scala.tools.nsc.symtab.SymbolLoaders$ClassfileLoader.doComplete(SymbolLoaders.scala:261) | |
at scala.tools.nsc.symtab.SymbolLoaders$SymbolLoader.complete(SymbolLoaders.scala:194) | |
at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1231) | |
at scala.tools.nsc.symtab.classfile.ClassfileParser$innerClasses$.scala$tools$nsc$symtab$classfile$ClassfileParser$innerClasses$$getMember$1(ClassfileParser.scala:1226) | |
at scala.tools.nsc.symtab.classfile.ClassfileParser$innerClasses$$anonfun$innerSymbol$1.apply(ClassfileParser.scala:1228) | |
at scala.tools.nsc.symtab.classfile.ClassfileParser$innerClasses$$anonfun$innerSymbol$1.apply(ClassfileParser.scala:1228) | |
at scala.reflect.internal.SymbolTable.atPhase(SymbolTable.scala:207) | |
at scala.reflect.internal.SymbolTable.beforePhase(SymbolTable.scala:215) | |
at scala.tools.nsc.symtab.classfile.ClassfileParser$innerClasses$.innerSymbol(ClassfileParser.scala:1228) | |
at scala.tools.nsc.symtab.classfile.ClassfileParser$innerClasses$.innerSymbol(ClassfileParser.scala:1213) | |
at scala.tools.nsc.symtab.classfile.ClassfileParser.classNameToSymbol(ClassfileParser.scala:482) | |
at scala.tools.nsc.symtab.classfile.ClassfileParser.sig2type$1(ClassfileParser.scala:751) | |
at scala.tools.nsc.symtab.classfile.ClassfileParser.sig2type$1(ClassfileParser.scala:781) | |
at scala.tools.nsc.symtab.classfile.ClassfileParser.scala$tools$nsc$symtab$classfile$ClassfileParser$$sigToType(ClassfileParser.scala:834) | |
at scala.tools.nsc.symtab.classfile.ClassfileParser$ConstantPool.getType(ClassfileParser.scala:329) | |
at scala.tools.nsc.symtab.classfile.ClassfileParser.parseMethod(ClassfileParser.scala:634) | |
at scala.tools.nsc.symtab.classfile.ClassfileParser.scala$tools$nsc$symtab$classfile$ClassfileParser$$queueLoad$1(ClassfileParser.scala:557) | |
at scala.tools.nsc.symtab.classfile.ClassfileParser$$anonfun$parseClass$1.apply$mcV$sp(ClassfileParser.scala:567) | |
at scala.tools.nsc.symtab.classfile.ClassfileParser.parseClass(ClassfileParser.scala:572) | |
at scala.tools.nsc.symtab.classfile.ClassfileParser.parse(ClassfileParser.scala:88) | |
at scala.tools.nsc.symtab.SymbolLoaders$ClassfileLoader.doComplete(SymbolLoaders.scala:261) | |
at scala.tools.nsc.symtab.SymbolLoaders$SymbolLoader.complete(SymbolLoaders.scala:194) | |
at scala.tools.nsc.symtab.SymbolLoaders$SymbolLoader.load(SymbolLoaders.scala:210) | |
at scala.tools.nsc.typechecker.Typers$Typer.isStale(Typers.scala:550) | |
at scala.tools.nsc.typechecker.Typers$Typer.reallyExists(Typers.scala:541) | |
at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedSelect$1(Typers.scala:4807) | |
at scala.tools.nsc.typechecker.Typers$Typer.typedSelectOrSuperCall$1(Typers.scala:4933) | |
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5563) | |
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5642) | |
at scala.tools.nsc.typechecker.Typers$Typer.typedType(Typers.scala:5769) | |
at scala.tools.nsc.typechecker.Typers$Typer.typedHigherKindedType(Typers.scala:5776) | |
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$113.apply(Typers.scala:5468) | |
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$113.apply(Typers.scala:5468) | |
at scala.reflect.internal.Types$class.map2Conserve(Types.scala:6400) | |
at scala.reflect.internal.SymbolTable.map2Conserve(SymbolTable.scala:13) | |
at scala.tools.nsc.typechecker.Typers$Typer.typedTypeApply$1(Typers.scala:5466) | |
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5572) | |
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5642) | |
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$93.apply(Typers.scala:4608) | |
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$93.apply(Typers.scala:4608) | |
at scala.tools.nsc.typechecker.Typers$Typer.silent(Typers.scala:727) | |
at scala.tools.nsc.typechecker.Typers$Typer.normalTypedApply$1(Typers.scala:4608) | |
at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1(Typers.scala:4659) | |
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5564) | |
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5642) | |
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5721) | |
at scala.tools.nsc.typechecker.Typers$Typer.computeType(Typers.scala:5808) | |
at scala.tools.nsc.typechecker.Namers$Namer.assignTypeToTree(Namers.scala:834) | |
at scala.tools.nsc.typechecker.Namers$Namer.valDefSig(Namers.scala:1315) | |
at scala.tools.nsc.typechecker.Namers$Namer.getSig$1(Namers.scala:1457) | |
at scala.tools.nsc.typechecker.Namers$Namer.typeSig(Namers.scala:1466) | |
at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$monoTypeCompleter$1$$anonfun$apply$1.apply$mcV$sp(Namers.scala:731) | |
at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$monoTypeCompleter$1$$anonfun$apply$1.apply(Namers.scala:730) | |
at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$monoTypeCompleter$1$$anonfun$apply$1.apply(Namers.scala:730) | |
at scala.tools.nsc.typechecker.Namers$Namer.scala$tools$nsc$typechecker$Namers$Namer$$logAndValidate(Namers.scala:1499) | |
at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$monoTypeCompleter$1.apply(Namers.scala:730) | |
at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$monoTypeCompleter$1.apply(Namers.scala:729) | |
at scala.tools.nsc.typechecker.Namers$$anon$1.completeImpl(Namers.scala:1614) | |
at scala.tools.nsc.typechecker.Namers$LockingTypeCompleter$class.complete(Namers.scala:1622) | |
at scala.tools.nsc.typechecker.Namers$$anon$1.complete(Namers.scala:1612) | |
at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1231) | |
at scala.reflect.internal.Symbols$Symbol.initialize(Symbols.scala:1374) | |
at scala.tools.nsc.typechecker.MethodSynthesis$MethodSynth$class.addDerivedTrees(MethodSynthesis.scala:225) | |
at scala.tools.nsc.typechecker.Namers$Namer.addDerivedTrees(Namers.scala:55) | |
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$32.apply(Typers.scala:1917) | |
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$32.apply(Typers.scala:1917) | |
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$rewrappingWrapperTrees$1.apply(Typers.scala:1856) | |
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$rewrappingWrapperTrees$1.apply(Typers.scala:1853) | |
at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:251) | |
at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:251) | |
at scala.collection.immutable.List.foreach(List.scala:318) | |
at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:251) | |
at scala.collection.AbstractTraversable.flatMap(Traversable.scala:105) | |
at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1917) | |
at scala.tools.nsc.typechecker.Typers$Typer.typedModuleDef(Typers.scala:1800) | |
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5584) | |
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5642) | |
at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedStat$1(Typers.scala:2928) | |
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$61.apply(Typers.scala:3032) | |
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$61.apply(Typers.scala:3032) | |
at scala.collection.immutable.List.loop$1(List.scala:170) | |
at scala.collection.immutable.List.mapConserve(List.scala:186) | |
at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:3032) | |
at scala.tools.nsc.typechecker.Typers$Typer.typedPackageDef$1(Typers.scala:5301) | |
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5587) | |
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5642) | |
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5704) | |
at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.apply(Analyzer.scala:99) | |
at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:464) | |
at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3$$anonfun$run$1.apply(Analyzer.scala:91) | |
at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3$$anonfun$run$1.apply(Analyzer.scala:91) | |
at scala.collection.Iterator$class.foreach(Iterator.scala:727) | |
at scala.collection.AbstractIterator.foreach(Iterator.scala:1157) | |
at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.run(Analyzer.scala:91) | |
at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1583) | |
at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1557) | |
at scala.tools.nsc.Global$Run.compileSources(Global.scala:1553) | |
at scala.tools.nsc.Global$Run.compile(Global.scala:1662) | |
at xsbt.CachedCompiler0.run(CompilerInterface.scala:123) | |
at xsbt.CachedCompiler0.run(CompilerInterface.scala:99) | |
at xsbt.CompilerInterface.run(CompilerInterface.scala:27) | |
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | |
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) | |
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) | |
at java.lang.reflect.Method.invoke(Method.java:606) | |
at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:102) | |
at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:48) | |
at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:41) | |
at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply$mcV$sp(AggressiveCompile.scala:99) | |
at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:99) | |
at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:99) | |
at sbt.compiler.AggressiveCompile.sbt$compiler$AggressiveCompile$$timed(AggressiveCompile.scala:166) | |
at sbt.compiler.AggressiveCompile$$anonfun$3.compileScala$1(AggressiveCompile.scala:98) | |
at sbt.compiler.AggressiveCompile$$anonfun$3.apply(AggressiveCompile.scala:143) | |
at sbt.compiler.AggressiveCompile$$anonfun$3.apply(AggressiveCompile.scala:87) | |
at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:39) | |
at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:37) | |
at sbt.inc.IncrementalCommon.cycle(Incremental.scala:99) | |
at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:38) | |
at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:37) | |
at sbt.inc.Incremental$.manageClassfiles(Incremental.scala:65) | |
at sbt.inc.Incremental$.compile(Incremental.scala:37) | |
at sbt.inc.IncrementalCompile$.apply(Compile.scala:27) | |
at sbt.compiler.AggressiveCompile.compile2(AggressiveCompile.scala:157) | |
at sbt.compiler.AggressiveCompile.compile1(AggressiveCompile.scala:71) | |
at sbt.compiler.AggressiveCompile.apply(AggressiveCompile.scala:46) | |
at sbt.Compiler$.apply(Compiler.scala:75) | |
at sbt.Compiler$.apply(Compiler.scala:66) | |
at sbt.Defaults$.sbt$Defaults$$compileTaskImpl(Defaults.scala:770) | |
at sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:762) | |
at sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:762) | |
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47) | |
at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:42) | |
at sbt.std.Transform$$anon$4.work(System.scala:64) | |
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237) | |
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237) | |
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18) | |
at sbt.Execute.work(Execute.scala:244) | |
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237) | |
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237) | |
at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160) | |
at sbt.CompletionService$$anon$2.call(CompletionService.scala:30) | |
at java.util.concurrent.FutureTask.run(FutureTask.java:262) | |
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) | |
at java.util.concurrent.FutureTask.run(FutureTask.java:262) | |
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) | |
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) | |
at java.lang.Thread.run(Thread.java:724) |
This file contains hidden or 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
package com.martialcodex | |
import scala.language.implicitConversions | |
import android.app.{Activity,Dialog} | |
import android.view.{View,ViewGroup,LayoutInflater} | |
case class TypedResource[A](id: Int) | |
case class TypedLayout[A](id: Int) | |
object TR { | |
val submit_area = TypedResource[android.widget.LinearLayout](R.id.submit_area) | |
val action_bar_subtitle = TypedResource[android.widget.TextView](R.id.action_bar_subtitle) | |
val search_plate = TypedResource[android.widget.LinearLayout](R.id.search_plate) | |
val action_bar_root = TypedResource[android.view.View](R.id.action_bar_root) | |
val default_activity_button = TypedResource[android.widget.FrameLayout](R.id.default_activity_button) | |
val search_voice_btn = TypedResource[android.widget.ImageView](R.id.search_voice_btn) | |
val search_bar = TypedResource[android.widget.LinearLayout](R.id.search_bar) | |
val radio = TypedResource[android.widget.RadioButton](R.id.radio) | |
val search_badge = TypedResource[android.widget.TextView](R.id.search_badge) | |
val image = TypedResource[android.widget.ImageView](R.id.image) | |
val up = TypedResource[android.widget.ImageView](R.id.up) | |
val list_item = TypedResource[android.widget.LinearLayout](R.id.list_item) | |
val expanded_menu = TypedResource[android.support.v7.internal.view.menu.ExpandedMenuView](R.id.expanded_menu) | |
val icon = TypedResource[android.widget.ImageView](R.id.icon) | |
val search_go_btn = TypedResource[android.widget.ImageView](R.id.search_go_btn) | |
val checkbox = TypedResource[android.widget.CheckBox](R.id.checkbox) | |
val search_mag_icon = TypedResource[android.widget.ImageView](R.id.search_mag_icon) | |
val action_context_bar = TypedResource[android.support.v7.internal.widget.ActionBarContextView](R.id.action_context_bar) | |
val activity_chooser_view_content = TypedResource[android.view.View](R.id.activity_chooser_view_content) | |
val search_button = TypedResource[android.widget.ImageView](R.id.search_button) | |
val expand_activities_button = TypedResource[android.widget.FrameLayout](R.id.expand_activities_button) | |
val action_bar_overlay_layout = TypedResource[android.support.v7.internal.widget.ActionBarOverlayLayout](R.id.action_bar_overlay_layout) | |
val search_close_btn = TypedResource[android.widget.ImageView](R.id.search_close_btn) | |
val action_bar = TypedResource[android.support.v7.internal.widget.ActionBarView](R.id.action_bar) | |
val action_bar_title = TypedResource[android.widget.TextView](R.id.action_bar_title) | |
val shortcut = TypedResource[android.widget.TextView](R.id.shortcut) | |
val action_bar_container = TypedResource[android.support.v7.internal.widget.ActionBarContainer](R.id.action_bar_container) | |
val system_names = TypedResource[android.view.View](R.id.system_names) | |
val top_action_bar = TypedResource[android.widget.LinearLayout](R.id.top_action_bar) | |
val action_mode_close_button = TypedResource[android.widget.LinearLayout](R.id.action_mode_close_button) | |
val title = TypedResource[android.widget.TextView](R.id.title) | |
val hello = TypedResource[android.widget.TextView](R.id.hello) | |
val split_action_bar = TypedResource[android.support.v7.internal.widget.ActionBarContainer](R.id.split_action_bar) | |
val edit_query = TypedResource[android.widget.ImageView](R.id.edit_query) | |
val search_edit_frame = TypedResource[android.widget.LinearLayout](R.id.search_edit_frame) | |
val system_name = TypedResource[android.view.View](R.id.system_name) | |
object layout { | |
val abc_action_bar_decor = TypedLayout[android.view.View](R.layout.abc_action_bar_decor) | |
val abc_action_menu_layout = TypedLayout[android.support.v7.internal.view.menu.ActionMenuView](R.layout.abc_action_menu_layout) | |
val abc_activity_chooser_view = TypedLayout[android.view.View](R.layout.abc_activity_chooser_view) | |
val abc_list_menu_item_layout = TypedLayout[android.support.v7.internal.view.menu.ListMenuItemView](R.layout.abc_list_menu_item_layout) | |
val systems = TypedLayout[android.widget.LinearLayout](R.layout.systems) | |
val abc_search_dropdown_item_icons_2line = TypedLayout[android.widget.RelativeLayout](R.layout.abc_search_dropdown_item_icons_2line) | |
val abc_expanded_menu_layout = TypedLayout[android.support.v7.internal.view.menu.ExpandedMenuView](R.layout.abc_expanded_menu_layout) | |
val abc_action_bar_decor_overlay = TypedLayout[android.support.v7.internal.widget.ActionBarOverlayLayout](R.layout.abc_action_bar_decor_overlay) | |
val main = TypedLayout[android.widget.LinearLayout](R.layout.main) | |
val abc_activity_chooser_view_list_item = TypedLayout[android.widget.LinearLayout](R.layout.abc_activity_chooser_view_list_item) | |
val abc_simple_decor = TypedLayout[android.view.View](R.layout.abc_simple_decor) | |
val abc_action_mode_close_item = TypedLayout[android.widget.LinearLayout](R.layout.abc_action_mode_close_item) | |
val abc_action_bar_title_item = TypedLayout[android.widget.LinearLayout](R.layout.abc_action_bar_title_item) | |
val abc_list_menu_item_icon = TypedLayout[android.widget.ImageView](R.layout.abc_list_menu_item_icon) | |
val abc_list_menu_item_checkbox = TypedLayout[android.widget.CheckBox](R.layout.abc_list_menu_item_checkbox) | |
val abc_action_menu_item_layout = TypedLayout[android.support.v7.internal.view.menu.ActionMenuItemView](R.layout.abc_action_menu_item_layout) | |
val abc_action_bar_tabbar = TypedLayout[android.support.v7.internal.widget.LinearLayoutICS](R.layout.abc_action_bar_tabbar) | |
val support_simple_spinner_dropdown_item = TypedLayout[android.widget.TextView](R.layout.support_simple_spinner_dropdown_item) | |
val abc_action_mode_bar = TypedLayout[android.support.v7.internal.widget.ActionBarContextView](R.layout.abc_action_mode_bar) | |
val abc_action_bar_view_list_nav_layout = TypedLayout[android.widget.LinearLayout](R.layout.abc_action_bar_view_list_nav_layout) | |
val abc_search_view = TypedLayout[android.widget.LinearLayout](R.layout.abc_search_view) | |
val abc_list_menu_item_radio = TypedLayout[android.widget.RadioButton](R.layout.abc_list_menu_item_radio) | |
val abc_popup_menu_item_layout = TypedLayout[android.support.v7.internal.view.menu.ListMenuItemView](R.layout.abc_popup_menu_item_layout) | |
} | |
} | |
trait TypedViewHolder { | |
def findViewById(id: Int): View | |
def findView[A](tr: TypedResource[A]): A = | |
findViewById(tr.id).asInstanceOf[A] | |
} | |
trait TypedView extends View with TypedViewHolder | |
trait TypedActivityHolder extends TypedViewHolder | |
trait TypedActivity extends Activity with TypedActivityHolder | |
trait TypedDialog extends Dialog with TypedViewHolder | |
class TypedLayoutInflater(l: LayoutInflater) { | |
def inflate[A](tl: TypedLayout[A], c: ViewGroup, b: Boolean) = | |
l.inflate(tl.id, c, b).asInstanceOf[A] | |
def inflate[A](tl: TypedLayout[A], c: ViewGroup) = | |
l.inflate(tl.id, c).asInstanceOf[A] | |
} | |
object TypedResource { | |
implicit def viewToTyped(v: View) = new TypedViewHolder { | |
def findViewById(id: Int) = v.findViewById(id) | |
} | |
implicit def activityToTyped(a: Activity) = new TypedViewHolder { | |
def findViewById(id: Int) = a.findViewById(id) | |
} | |
implicit def dialogToTyped(d: Dialog) = new TypedViewHolder { | |
def findViewById(id: Int) = d.findViewById(id) | |
} | |
implicit def layoutInflaterToTyped(l: LayoutInflater) = | |
new TypedLayoutInflater(l) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment