Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ public void validate(Element element, ElementValidation valid) {
@Override
protected final void assignListeners(EComponentWithViewSupportHolder holder, List<JFieldRef> idsRefs, JDefinedClass listenerAnonymousClass) {
for (JFieldRef idRef : idsRefs) {
FoundViewHolder foundViewHolder = holder.getFoundViewHolder(idRef, getListenerTargetClass(holder));
foundViewHolder.getIfNotNullBlock().invoke(foundViewHolder.getRef(), getSetterName()).arg(_new(listenerAnonymousClass));
AbstractJClass listenerTargetClass = getListenerTargetClass(holder);
FoundViewHolder foundViewHolder = holder.getFoundViewHolder(idRef, listenerTargetClass);
foundViewHolder.getIfNotNullBlock().invoke(foundViewHolder.getOrCastRef(listenerTargetClass), getSetterName()).arg(_new(listenerAnonymousClass));
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* Copyright (C) 2010-2016 eBusiness Information, Excilys Group
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed To in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package org.androidannotations.viewlistener;

import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.FocusChange;
import org.androidannotations.annotations.LongClick;
import org.androidannotations.annotations.Touch;
import org.androidannotations.viewbyid.R;

import android.app.Activity;

@EActivity
public abstract class AbstractViewListenerActivity extends Activity {

@FocusChange(R.id.view)
protected void onFocusChange() {
}

@Click(R.id.view)
protected void onClick() {
}

@LongClick(R.id.view)
protected void onLongClick() {
}

@Touch(R.id.view)
protected void onTouch() {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**
* Copyright (C) 2010-2016 eBusiness Information, Excilys Group
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed To in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package org.androidannotations.viewlistener;

import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.ItemClick;
import org.androidannotations.annotations.ItemLongClick;
import org.androidannotations.annotations.ItemSelect;
import org.androidannotations.viewbyid.R;

@EActivity
public class AdapterViewListenerActivity extends AbstractViewListenerActivity {

@ItemClick(R.id.view)
protected void onItemClick() {
}

@ItemLongClick(R.id.view)
protected void onItemLongClick() {
}

@ItemSelect(R.id.view)
protected void onItemSelect(boolean selected) {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* Copyright (C) 2010-2016 eBusiness Information, Excilys Group
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed To in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package org.androidannotations.viewlistener;

import org.androidannotations.annotations.CheckedChange;
import org.androidannotations.annotations.EActivity;
import org.androidannotations.viewbyid.R;

@EActivity
public class CompoundButtonListenerActivity extends AbstractViewListenerActivity {

@CheckedChange(R.id.view)
protected void onCheckedChange() {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* Copyright (C) 2010-2016 eBusiness Information, Excilys Group
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed To in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package org.androidannotations.viewlistener;

import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.EditorAction;
import org.androidannotations.viewbyid.R;

@EActivity
public class TextViewListenerActivity extends AbstractViewListenerActivity {

@EditorAction(R.id.view)
protected void onEditorAction() {
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* Copyright (C) 2010-2016 eBusiness Information, Excilys Group
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed To in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package org.androidannotations.viewlistener;

import java.io.IOException;

import org.androidannotations.internal.AndroidAnnotationProcessor;
import org.androidannotations.testutils.AAProcessorTestHelper;
import org.junit.Before;
import org.junit.Test;

public class ViewListenerCompilationTest extends AAProcessorTestHelper {

@Before
public void setUp() {
addManifestProcessorParameter(AbstractViewListenerActivity.class);
addProcessor(AndroidAnnotationProcessor.class);
ensureOutputDirectoryIsEmpty();
}

@Test
public void ensureAdapterViewListenerCompilationSuccessful() throws IOException {
assertCompilationSuccessful(compileFiles(AdapterViewListenerActivity.class));
}

@Test
public void ensureTextViewListenerCompilationSuccessful() throws IOException {
assertCompilationSuccessful(compileFiles(TextViewListenerActivity.class));
}

@Test
public void ensureCompundButtonListenerCompilationSuccessful() throws IOException {
assertCompilationSuccessful(compileFiles(CompoundButtonListenerActivity.class));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<!--

Copyright (C) 2010-2016 eBusiness Information, Excilys Group

Licensed under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy of
the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed To in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations under
the License.

-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.androidannotations.viewbyid"
android:versionCode="1"
android:versionName="1.0" >

<application>
<activity android:name="org.androidannotations.viewlistener.CompoundButtonListenerActivity_" />
<activity android:name="org.androidannotations.viewlistener.AdapterViewListenerActivity_" />
<activity android:name="org.androidannotations.viewlistener.TextViewListenerActivity_" />
</application>

</manifest>
Morty Proxy This is a proxified and sanitized view of the page, visit original site.