Closed rvanderwerf closed 9 years ago
Well, that looks weird. We need to check this moment. Thanks.
Ok @rvanderwerf , this is what i see from generated bytecode:
public class StartPresentationActivity extends Activity implements GroovyObject
{
private static /* synthetic */ ClassInfo $staticClassInfo;
private transient /* synthetic */ MetaClass metaClass;
private TextView myTextView;
public StartPresentationActivity() {
this.metaClass = this.$getStaticMetaClass();
}
protected /* synthetic */ MetaClass $getStaticMetaClass() {
if (this.getClass() != StartPresentationActivity.class) {
return ScriptBytecodeAdapter.initMetaClass(this);
}
ClassInfo $staticClassInfo;
if (($staticClassInfo = StartPresentationActivity.$staticClassInfo) == null) {
$staticClassInfo = (StartPresentationActivity.$staticClassInfo = ClassInfo.getClassInfo(this.getClass()));
}
return $staticClassInfo.getMetaClass();
}
public TextView getMyTextView() {
return this.myTextView;
}
public void injectViews(final Object val) {
int n;
if (DefaultGroovyMethods.getMetaClass((Object)this.getClass().getClass().getSuperclass()).pickMethod("injectViews", new Class[] { Object.class }) != null) {
n = 1;
}
else {
n = 0;
}
if (n != 0) {
ScriptBytecodeAdapter.invokeMethodOnSuperN(Activity.class, this, "injectViews", new Object[] { ScriptBytecodeAdapter.createPojoWrapper(val, Object.class) });
}
this.myTextView = (TextView)ScriptBytecodeAdapter.castToType(Finder.findView(val, "text"), TextView.class);
}
protected void onCreate(final Bundle bundle) {
super.onCreate(bundle);
this.setContentView(R$layout.activity_presentation);
SwissKnife.inject((Object)this);
this.myTextView.setText((CharSequence)"eyN XHAsda");
}
public void setMyTextView(final TextView myTextView) {
this.myTextView = myTextView;
}
}
I think everything looks fine here, can you try the default findViewById method, because in this Activity it gives me null object also. I think it is something maybe wear related because of two views? One for square wear devices and one for circle one? I am not sure I have enough android wear experience to resolve this right now. @Arasthel please help here.
I think this was related to #38. @rvanderwerf, can you confirm if this is working?
I think we can close it
I see your wear sample doesn't actually use any SwissKnife. Well I gave it a try on the wear sample, but it doesn't seem inject the view?
Here is my gist..https://gist.github.com/rvanderwerf/9d4853fcbbb0990cefcf I just add the inject method which runs, but afterwards the textview isn't injected and is null?
Or maybe I am doing something wrong?
I have a working groovy app on wear, and when I try this my views aren't injected either.. but calling the SwissKnife.inject this causes the whole app to crash, even if I don't any sort of transformation. I can open a seperate one for that.