Skip to content

Commit ee9e1a8

Browse files
committed
Add HasLifecycleMethods interface
Remove redundant method declarations in HasReceiverRegistration class.
1 parent 1d0f891 commit ee9e1a8

3 files changed

Lines changed: 37 additions & 17 deletions

File tree

‎AndroidAnnotations/androidannotations/src/main/java/org/androidannotations/helper/OrmLiteHelper.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@
1717

1818
import static com.sun.codemodel.JExpr._null;
1919

20-
import org.androidannotations.holder.HasReceiverRegistration;
20+
import org.androidannotations.holder.HasLifecycleMethods;
2121
import org.androidannotations.process.ProcessHolder;
2222

2323
import com.sun.codemodel.JBlock;
2424
import com.sun.codemodel.JFieldVar;
2525

2626
public class OrmLiteHelper {
2727

28-
public static void injectReleaseInDestroy(JFieldVar databaseHelperRef, HasReceiverRegistration receiverHolder, ProcessHolder.Classes classes) {
29-
JBlock destroyBody = receiverHolder.getOnDestroyBeforeSuperBlock();
28+
public static void injectReleaseInDestroy(JFieldVar databaseHelperRef, HasLifecycleMethods holder, ProcessHolder.Classes classes) {
29+
JBlock destroyBody = holder.getOnDestroyBeforeSuperBlock();
3030

3131
destroyBody.staticInvoke(classes.OPEN_HELPER_MANAGER, "releaseHelper");
3232
destroyBody.assign(databaseHelperRef, _null());
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* Copyright (C) 2010-2014 eBusiness Information, Excilys Group
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
* use this file except in compliance with the License. You may obtain a copy of
6+
* the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed To in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations under
14+
* the License.
15+
*/
16+
package org.androidannotations.holder;
17+
18+
import com.sun.codemodel.JBlock;
19+
20+
public interface HasLifecycleMethods extends GeneratedClassHolder {
21+
22+
JBlock getOnCreateAfterSuperBlock();
23+
JBlock getOnDestroyBeforeSuperBlock();
24+
25+
JBlock getOnStartAfterSuperBlock();
26+
JBlock getOnStopBeforeSuperBlock();
27+
28+
JBlock getOnResumeAfterSuperBlock();
29+
JBlock getOnPauseBeforeSuperBlock();
30+
31+
JBlock getOnAttachAfterSuperBlock();
32+
JBlock getOnDetachBeforeSuperBlock();
33+
}

‎AndroidAnnotations/androidannotations/src/main/java/org/androidannotations/holder/HasReceiverRegistration.java‎

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,12 @@
1515
*/
1616
package org.androidannotations.holder;
1717

18-
import com.sun.codemodel.JBlock;
1918
import com.sun.codemodel.JExpression;
2019
import com.sun.codemodel.JFieldVar;
2120

22-
public interface HasReceiverRegistration extends GeneratedClassHolder {
21+
public interface HasReceiverRegistration extends HasLifecycleMethods {
2322

2423
JExpression getContextRef();
2524

2625
JFieldVar getIntentFilterField(String[] actions, String[] dataSchemas);
27-
28-
JBlock getOnCreateAfterSuperBlock();
29-
JBlock getOnDestroyBeforeSuperBlock();
30-
31-
JBlock getOnStartAfterSuperBlock();
32-
JBlock getOnStopBeforeSuperBlock();
33-
34-
JBlock getOnResumeAfterSuperBlock();
35-
JBlock getOnPauseBeforeSuperBlock();
36-
37-
JBlock getOnAttachAfterSuperBlock();
38-
JBlock getOnDetachBeforeSuperBlock();
3926
}

0 commit comments

Comments
 (0)