Skip to content

Commit 840fd10

Browse files
author
Prasanna Anbazhagan
committed
Merge remote-tracking branch 'origin/master'
# Conflicts: # droidwizardlib/src/main/java/com/prasilabs/droidwizardlib/core/views/CoreFragmentView.java
2 parents b4e9623 + 7b8fc82 commit 840fd10

File tree

8 files changed

+36
-42
lines changed

8 files changed

+36
-42
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Step 1. Add the JitPack repository to your build file Build.gradle (app)
4343
Step 2. Add the dependency
4444
```
4545
dependencies {
46-
compile 'com.github.praslnx8:DroidWizard:1.1'
46+
compile 'com.github.praslnx8:DroidWizard:1.3'
4747
}
4848
```
4949
Check us at [![Medium]](https://medium.com/@praslnx8/droidwizard-framework-for-android-45cabd1d7d5c)

droidwizardlib/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
apply plugin: 'com.android.library'
22

33
android {
4-
compileSdkVersion 25
4+
compileSdkVersion 26
55
buildToolsVersion "25.0.3"
66

77
defaultConfig {
88
minSdkVersion 21
9-
targetSdkVersion 25
9+
targetSdkVersion 26
1010
versionCode 1
1111
versionName "1.0"
1212

@@ -26,7 +26,7 @@ dependencies {
2626
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
2727
exclude group: 'com.android.support', module: 'support-annotations'
2828
})
29-
compile 'com.android.support:appcompat-v7:25.3.1'
29+
compile 'com.android.support:appcompat-v7:26+'
3030
compile 'com.google.code.gson:gson:2.7'
3131

3232
testCompile 'junit:junit:4.12'

droidwizardlib/src/main/java/com/prasilabs/droidwizardlib/core/viewModels/CoreViewModel.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
public abstract class CoreViewModel<T extends CoreCallBack> implements Observer
3131
{
3232
private Context context;
33-
private T coreCallBack;
33+
private T vmCallBAck;
3434

3535
/**
3636
* Public default constructor
@@ -73,7 +73,7 @@ public void onCreate(Context context)
7373
*/
7474
public void onDestroy()
7575
{
76-
coreCallBack = null;
76+
vmCallBAck = null;
7777
}
7878

7979
/**
@@ -88,16 +88,16 @@ public Context getContext() {
8888
* Method for getting the view model callback to communicate back to view
8989
* @return return {@link CoreCallBack}
9090
*/
91-
public T getCoreCallBack() {
92-
return coreCallBack;
91+
public T getVMCallBack() {
92+
return vmCallBAck;
9393
}
9494

9595
/**
9696
* for registering the view model callback interface
9797
* @param t callback interface
9898
*/
99-
public void setCoreCallBack(T t) {
100-
this.coreCallBack = t;
99+
public void setVMCallBack(T t) {
100+
this.vmCallBAck = t;
101101
}
102102

103103
@Override

droidwizardlib/src/main/java/com/prasilabs/droidwizardlib/core/views/CoreActivityView.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState)
3939
if(coreViewModel != null)
4040
{
4141
coreViewModel.onCreate(this);
42-
coreViewModel.setCoreCallBack(getCoreCallBack());
42+
coreViewModel.setVMCallBack(getCoreCallBack());
4343
}
4444
}
4545

droidwizardlib/src/main/java/com/prasilabs/droidwizardlib/core/views/CoreFragmentView.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public abstract class CoreFragmentView<T extends CoreViewModel> extends Fragment
2323
private CoreActivityView coreActivityView;
2424
private T coreViewModel;
2525
private boolean isViewCreatedFresh;
26+
private boolean isViewDestroyed;
2627

2728

2829
public View getFragmentView()
@@ -59,7 +60,7 @@ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
5960

6061
if (coreViewModel != null) {
6162
coreViewModel.onCreate(context);
62-
coreViewModel.setCoreCallBack(getCoreCallBack());
63+
coreViewModel.setVMCallBack(getCoreCallBack());
6364
}
6465

6566

@@ -70,6 +71,7 @@ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
7071
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
7172
super.onViewCreated(view, savedInstanceState);
7273

74+
isViewDestroyed = false;
7375
initializeView(savedInstanceState, isViewCreatedFresh);
7476
}
7577

@@ -86,6 +88,8 @@ public void onDestroyView() {
8688
if (coreViewModel != null) {
8789
coreViewModel.onDestroy();
8890
}
91+
92+
isViewDestroyed = true;
8993
}
9094

9195
@Override
@@ -115,12 +119,6 @@ public void onResume() {
115119

116120
}
117121

118-
@Override
119-
public void onStop() {
120-
super.onStop();
121-
122-
}
123-
124122
@Override
125123
public void onAttach(Context context) {
126124
super.onAttach(context);
@@ -144,10 +142,12 @@ protected T getViewModel()
144142
return coreViewModel;
145143
}
146144

147-
148-
149145
public boolean onBackPressed()
150146
{
151147
return true;
152148
}
149+
150+
public boolean isViewDestroyed() {
151+
return isViewDestroyed;
152+
}
153153
}

exampleApp/build.gradle

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
apply plugin: 'com.android.application'
22

33
android {
4-
compileSdkVersion 25
5-
buildToolsVersion "25.0.2"
4+
compileSdkVersion 26
5+
buildToolsVersion "25.0.3"
66
defaultConfig {
77
applicationId "com.prasilabs.droidwizard"
88
minSdkVersion 21
9-
targetSdkVersion 25
9+
targetSdkVersion 26
1010
versionCode 1
1111
versionName "1.0"
1212
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
@@ -24,10 +24,9 @@ dependencies {
2424
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
2525
exclude group: 'com.android.support', module: 'support-annotations'
2626
})
27-
compile 'com.android.support:appcompat-v7:25.3.1'
28-
compile 'com.android.support:recyclerview-v7:25.3.1'
27+
compile 'com.android.support:recyclerview-v7:26+'
2928
compile 'com.squareup.picasso:picasso:2.5.2'
30-
compile 'com.android.support:cardview-v7:25.3.1'
29+
compile 'com.android.support:cardview-v7:26+'
3130

3231
testCompile 'junit:junit:4.12'
3332
compile project(path: ':droidwizardlib')

exampleApp/src/main/java/com/prasilabs/droidwizard/modules/simpleActivity/viewModels/SimpleActivityViewModel.java

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
package com.prasilabs.droidwizard.modules.simpleActivity.viewModels;
22

3-
import android.content.Context;
4-
import android.content.Intent;
5-
import android.content.IntentFilter;
6-
73
import com.prasilabs.droidwizard.modelEngines.QuestionsModelEngine;
84
import com.prasilabs.droidwizard.pojos.QuestionsPojo;
9-
import com.prasilabs.droidwizard.utils.KeyConstants;
105
import com.prasilabs.droidwizard.utils.NetworkManager;
116
import com.prasilabs.droidwizardlib.core.modelEngines.CoreModelEngine;
127
import com.prasilabs.droidwizardlib.core.viewModels.CoreViewModel;
@@ -21,9 +16,9 @@ public class SimpleActivityViewModel extends CoreViewModel<SimpleActivityCallBac
2116
{
2217
public void getQuestions()
2318
{
24-
if(getCoreCallBack() != null)
19+
if(getVMCallBack() != null)
2520
{
26-
getCoreCallBack().showProgress();
21+
getVMCallBack().showProgress();
2722
}
2823
if(NetworkManager.isConnected(getContext()))
2924
{
@@ -33,26 +28,26 @@ public void getQuestions(List<QuestionsPojo> questions)
3328
{
3429
if(questions != null && !questions.isEmpty())
3530
{
36-
if(getCoreCallBack() != null)
31+
if(getVMCallBack() != null)
3732
{
38-
getCoreCallBack().showQuestions(questions);
33+
getVMCallBack().showQuestions(questions);
3934
}
4035
}
4136
else
4237
{
43-
if(getCoreCallBack() != null)
38+
if(getVMCallBack() != null)
4439
{
45-
getCoreCallBack().showEmpty();
40+
getVMCallBack().showEmpty();
4641
}
4742
}
4843
}
4944
});
5045
}
5146
else
5247
{
53-
if(getCoreCallBack() != null)
48+
if(getVMCallBack() != null)
5449
{
55-
getCoreCallBack().showNoInternet();
50+
getVMCallBack().showNoInternet();
5651
}
5752
}
5853

exampleApp/src/main/java/com/prasilabs/droidwizard/modules/simpleFragment/viewModels/SimpleFragmentViewModel.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ public void getQuestions(List<QuestionsPojo> questions)
3636
{
3737
if(questions != null && !questions.isEmpty())
3838
{
39-
if(getCoreCallBack() != null)
39+
if(getVMCallBack() != null)
4040
{
41-
getCoreCallBack().showQuestions(questions);
41+
getVMCallBack().showQuestions(questions);
4242
}
4343
else
4444
{
45-
getCoreCallBack().showEmpty();
45+
getVMCallBack().showEmpty();
4646
}
4747
}
4848
}

0 commit comments

Comments
 (0)