Skip to content

Commit 4b5898f

Browse files
committed
More work on the subscriptions
1 parent ae7f9e7 commit 4b5898f

30 files changed

+362
-383
lines changed

app/build.gradle

+8-8
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ android {
111111
resValue "string", "analiticsapikey", "$System.env.GOOGLE_ANALITICS_ID"
112112
resValue "string", "google_maps_key", "$System.env.GOOGLEAPIKEY"
113113
resValue "string", "revenuecat_apikey", "$System.env.REVENUECATKEY"
114-
resValue "string", "app_name_domoticz", 'Domoticz Lite'
115-
buildConfigField "boolean", "LITE_VERSION", "true"
114+
resValue "string", "app_name_domoticz", 'Domoticz'
115+
buildConfigField "boolean", "NEW_VERSION", "true"
116116
buildConfigField "boolean", "PAID_OOTT", "false"
117117
dimension "tier"
118118
}
@@ -130,8 +130,8 @@ android {
130130

131131
resValue "string", "analiticsapikey", "$System.env.GOOGLE_ANALITICS_ID"
132132
resValue "string", "google_maps_key", "$System.env.GOOGLEAPIKEY"
133-
resValue "string", "app_name_domoticz", 'Domoticz'
134-
buildConfigField "boolean", "LITE_VERSION", "false"
133+
resValue "string", "app_name_domoticz", 'Domoticz Premium'
134+
buildConfigField "boolean", "NEW_VERSION", "false"
135135
buildConfigField "boolean", "PAID_OOTT", "false"
136136
dimension "tier"
137137
}
@@ -151,7 +151,7 @@ android {
151151
resValue "string", "google_maps_key", "$System.env.GOOGLEAPIKEY"
152152

153153
resValue "string", "app_name_domoticz", 'OOTT'
154-
buildConfigField "boolean", "LITE_VERSION", "false"
154+
buildConfigField "boolean", "NEW_VERSION", "false"
155155
buildConfigField "boolean", "PAID_OOTT", "true"
156156
dimension "tier"
157157
}
@@ -187,12 +187,12 @@ dependencies {
187187
implementation "androidx.work:work-runtime:2.8.0-alpha02"
188188
implementation 'androidx.preference:preference:1.2.0'
189189
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
190-
implementation 'androidx.appcompat:appcompat:1.4.1'
190+
implementation 'androidx.appcompat:appcompat:1.4.2'
191191
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
192192
implementation 'androidx.recyclerview:recyclerview:1.2.1'
193193
implementation 'androidx.cardview:cardview:1.0.0'
194194
implementation 'androidx.biometric:biometric:1.1.0'
195-
implementation 'com.google.android.material:material:1.6.0'
195+
implementation 'com.google.android.material:material:1.6.1'
196196
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
197197
implementation 'androidx.annotation:annotation:1.3.0'
198198
implementation 'org.reactivestreams:reactive-streams:1.0.3'
@@ -209,7 +209,7 @@ dependencies {
209209
implementation 'com.google.android.ads.consent:consent-library:1.0.8'
210210
implementation "com.google.android.gms:play-services-analytics:17.0.1"
211211
implementation "com.google.android.gms:play-services-wearable:17.1.0"
212-
implementation "com.google.android.gms:play-services-maps:17.0.1"
212+
implementation "com.google.android.gms:play-services-maps:18.0.2"
213213
implementation "com.google.android.gms:play-services-gcm:17.0.0"
214214
implementation "com.google.android.gms:play-services-location:18.0.0"
215215
implementation "com.google.android.gms:play-services-places:17.0.0"

app/src/main/java/nl/hnogames/domoticz/MainActivity.java

+8-7
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
import android.view.View;
3737
import android.view.WindowManager;
3838
import android.widget.FrameLayout;
39-
import android.widget.TextView;
4039
import android.widget.Toast;
4140

4241
import com.afollestad.materialdialogs.MaterialDialog;
@@ -108,7 +107,6 @@
108107
import nl.hnogames.domoticz.utils.SharedPrefUtil;
109108
import nl.hnogames.domoticz.utils.TalkBackUtil;
110109
import nl.hnogames.domoticz.utils.UsefulBits;
111-
import nl.hnogames.domoticz.utils.ViewUtils;
112110
import nl.hnogames.domoticz.utils.WidgetUtils;
113111
import nl.hnogames.domoticz.welcome.WelcomeViewActivity;
114112
import nl.hnogames.domoticzapi.Containers.ConfigInfo;
@@ -180,9 +178,7 @@ protected void onCreate(Bundle savedInstanceState) {
180178
mSharedPrefs = new SharedPrefUtil(this);
181179
permissionHelper = PermissionHelper.getInstance(this);
182180

183-
UsefulBits.checkAPK(this, mSharedPrefs);
184-
185-
if (Build.VERSION.SDK_INT < 21 && (BuildConfig.LITE_VERSION || !mSharedPrefs.isAPKValidated())) {
181+
if (Build.VERSION.SDK_INT < 21 && (!AppController.IsPremiumEnabled || !mSharedPrefs.isAPKValidated())) {
186182
setContentView(R.layout.activity_newmain_free);
187183
MobileAds.initialize(this, this.getString(R.string.ADMOB_APP_KEY));
188184
AdRequest adRequest = new AdRequest.Builder()
@@ -236,6 +232,11 @@ protected void onCreate(Bundle savedInstanceState) {
236232
new GeoUtils(this, this).AddGeofences();
237233
resetWorkerThreads();
238234
initScreen();
235+
236+
if(mSharedPrefs.showOldVersionDialog()) {
237+
UsefulBits.ShowOldVersionDialog(this);
238+
mSharedPrefs.OldVersionDialogShown();
239+
}
239240
}
240241
}
241242

@@ -840,7 +841,7 @@ public void drawNavigationMenu(final ConfigInfo mConfig) {
840841
.withOnlyMainProfileImageVisible(true)
841842
.withOnAccountHeaderListener((view, profile, current) -> {
842843
if (!current) {
843-
if (BuildConfig.LITE_VERSION || !mSharedPrefs.isAPKValidated()) {
844+
if (!AppController.IsPremiumEnabled || !mSharedPrefs.isAPKValidated()) {
844845
if (frameLayout != null) {
845846
Snackbar.make(frameLayout, getString(R.string.category_account) + " " + getString(R.string.premium_feature), Snackbar.LENGTH_LONG)
846847
.setAction(R.string.upgrade, view1 -> UsefulBits.openPremiumAppStore(MainActivity.this))
@@ -891,7 +892,7 @@ public void onCancel() {
891892
for (UserInfo user : config.getUsers()) {
892893
if (!allUsers.contains(user.getUsername())) {
893894
ProfileDrawerItem profile = new ProfileDrawerItem().withName(user.getRightsValue(this)
894-
).withEmail(user.getUsername())
895+
).withEmail(user.getUsername())
895896
.withIcon(R.drawable.users)
896897
.withEnabled(user.isEnabled());
897898
allUsers.add(user.getUsername());

app/src/main/java/nl/hnogames/domoticz/adapters/DashboardAdapter.java

+14-14
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,11 @@ public DataObjectHolder onCreateViewHolder(ViewGroup parent, int viewType) {
215215

216216
// Check if we're running on Android 5.0 or higher
217217
if (Build.VERSION.SDK_INT >= 21) {
218-
row = LayoutInflater.from(parent.getContext())
219-
.inflate(R.layout.dashboard_row, parent, false);
218+
row = LayoutInflater.from(parent.getContext())
219+
.inflate(R.layout.dashboard_row, parent, false);
220220
} else {
221-
row = LayoutInflater.from(parent.getContext())
222-
.inflate(R.layout.dashboard_row_noads, parent, false);
221+
row = LayoutInflater.from(parent.getContext())
222+
.inflate(R.layout.dashboard_row_noads, parent, false);
223223
}
224224
return new DataObjectHolder(row);
225225
}
@@ -319,8 +319,8 @@ private void setSwitchRowData(DevicesInfo mDeviceInfo,
319319
}
320320
break;
321321
default:
322-
setButtons(holder, Buttons.SWITCH);
323-
setOnOffSwitchRowData(mDeviceInfo, holder);
322+
setButtons(holder, Buttons.SWITCH);
323+
setOnOffSwitchRowData(mDeviceInfo, holder);
324324
break;
325325
}
326326
break;
@@ -352,11 +352,11 @@ private void setSwitchRowData(DevicesInfo mDeviceInfo,
352352
case DomoticzValues.Device.Type.Value.DIMMER:
353353
if (mDeviceInfo.getSubType().startsWith(DomoticzValues.Device.SubType.Name.RGB) ||
354354
mDeviceInfo.getSubType().startsWith(DomoticzValues.Device.SubType.Name.WW)) {
355-
setButtons(holder, Buttons.DIMMER_RGB);
356-
setDimmerRowData(mDeviceInfo, holder, true);
355+
setButtons(holder, Buttons.DIMMER_RGB);
356+
setDimmerRowData(mDeviceInfo, holder, true);
357357
} else {
358-
setButtons(holder, Buttons.DIMMER);
359-
setDimmerRowData(mDeviceInfo, holder, false);
358+
setButtons(holder, Buttons.DIMMER);
359+
setDimmerRowData(mDeviceInfo, holder, false);
360360
}
361361
break;
362362

@@ -375,8 +375,8 @@ private void setSwitchRowData(DevicesInfo mDeviceInfo,
375375
break;
376376

377377
case DomoticzValues.Device.Type.Value.SELECTOR:
378-
setButtons(holder, Buttons.SELECTOR);
379-
setSelectorRowData(mDeviceInfo, holder);
378+
setButtons(holder, Buttons.SELECTOR);
379+
setSelectorRowData(mDeviceInfo, holder);
380380
break;
381381

382382
case DomoticzValues.Device.Type.Value.BLINDS:
@@ -1835,8 +1835,8 @@ public void setButtons(DataObjectHolder holder, int button) {
18351835
holder.switch_name.setVisibility(View.VISIBLE);
18361836

18371837
holder.infoIcon.setVisibility(View.GONE);
1838-
ViewGroup.MarginLayoutParams p = (ViewGroup.MarginLayoutParams) holder.iconRow.getLayoutParams();
1839-
p.topMargin = 20;
1838+
ViewGroup.MarginLayoutParams p = (ViewGroup.MarginLayoutParams) holder.iconRow.getLayoutParams();
1839+
p.topMargin = 20;
18401840

18411841
holder.switch_battery_level.setVisibility(View.VISIBLE);
18421842
switch (button) {

app/src/main/java/nl/hnogames/domoticz/adapters/SmallPlansAdapter.java

+9-18
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,7 @@
2626
import android.view.LayoutInflater;
2727
import android.view.View;
2828
import android.view.ViewGroup;
29-
import android.widget.ImageView;
30-
import android.widget.RelativeLayout;
31-
import android.widget.TextView;
32-
33-
import com.google.android.gms.ads.AdListener;
34-
import com.google.android.gms.ads.AdLoader;
35-
import com.google.android.gms.ads.AdRequest;
36-
import com.google.android.gms.ads.MobileAds;
37-
import com.google.android.gms.ads.formats.NativeAdOptions;
29+
3830
import com.google.android.material.chip.Chip;
3931

4032
import java.util.ArrayList;
@@ -46,8 +38,6 @@
4638
import github.nisrulz.recyclerviewhelper.RVHViewHolder;
4739
import nl.hnogames.domoticz.MainActivity;
4840
import nl.hnogames.domoticz.R;
49-
import nl.hnogames.domoticz.ads.NativeTemplateStyle;
50-
import nl.hnogames.domoticz.ads.TemplateView;
5141
import nl.hnogames.domoticz.utils.SharedPrefUtil;
5242
import nl.hnogames.domoticzapi.Containers.PlanInfo;
5343

@@ -84,7 +74,8 @@ public PlanInfo getData(int counter) {
8474
try {
8575
if (this.mDataset != null)
8676
return this.mDataset.get(counter);
87-
}catch (Exception ex){}
77+
} catch (Exception ex) {
78+
}
8879
return null;
8980
}
9081

@@ -131,8 +122,8 @@ public void onDestroy() {
131122
@Override
132123
public DataObjectHolder onCreateViewHolder(ViewGroup parent, int viewType) {
133124
View view;
134-
view = LayoutInflater.from(parent.getContext())
135-
.inflate(R.layout.small_plan_row, parent, false);
125+
view = LayoutInflater.from(parent.getContext())
126+
.inflate(R.layout.small_plan_row, parent, false);
136127
return new DataObjectHolder(view);
137128
}
138129

@@ -141,11 +132,11 @@ public void onBindViewHolder(DataObjectHolder holder, int position) {
141132
try {
142133
if (mDataset != null && mDataset.size() > 0) {
143134
PlanInfo plan = mDataset.get(position);
144-
holder.itemView.setVisibility(View.VISIBLE);
145-
holder.plan.setVisibility(View.VISIBLE);
146-
String name = plan.getName();
135+
holder.itemView.setVisibility(View.VISIBLE);
136+
holder.plan.setVisibility(View.VISIBLE);
137+
String name = plan.getName();
147138
int numberOfDevices = plan.getDevices();
148-
holder.plan.setText(name+" ("+numberOfDevices+")");
139+
holder.plan.setText(name + " (" + numberOfDevices + ")");
149140
}
150141
} catch (Exception ex) {
151142
}

app/src/main/java/nl/hnogames/domoticz/adapters/SwitchesAdapter.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,8 @@ private void setSwitchRowData(DevicesInfo mDeviceInfo,
325325
}
326326
break;
327327
default:
328-
setButtons(holder, Buttons.SWITCH);
329-
setOnOffSwitchRowData(mDeviceInfo, holder);
328+
setButtons(holder, Buttons.SWITCH);
329+
setOnOffSwitchRowData(mDeviceInfo, holder);
330330
break;
331331
}
332332
break;
@@ -358,11 +358,11 @@ private void setSwitchRowData(DevicesInfo mDeviceInfo,
358358
case DomoticzValues.Device.Type.Value.DIMMER:
359359
if (mDeviceInfo.getSubType().startsWith(DomoticzValues.Device.SubType.Name.RGB) ||
360360
mDeviceInfo.getSubType().startsWith(DomoticzValues.Device.SubType.Name.WW)) {
361-
setButtons(holder, Buttons.DIMMER_RGB);
362-
setDimmerRowData(mDeviceInfo, holder, true);
361+
setButtons(holder, Buttons.DIMMER_RGB);
362+
setDimmerRowData(mDeviceInfo, holder, true);
363363
} else {
364-
setButtons(holder, Buttons.DIMMER);
365-
setDimmerRowData(mDeviceInfo, holder, false);
364+
setButtons(holder, Buttons.DIMMER);
365+
setDimmerRowData(mDeviceInfo, holder, false);
366366
}
367367
break;
368368

@@ -381,8 +381,8 @@ private void setSwitchRowData(DevicesInfo mDeviceInfo,
381381
break;
382382

383383
case DomoticzValues.Device.Type.Value.SELECTOR:
384-
setButtons(holder, Buttons.SELECTOR);
385-
setSelectorRowData(mDeviceInfo, holder);
384+
setButtons(holder, Buttons.SELECTOR);
385+
setSelectorRowData(mDeviceInfo, holder);
386386
break;
387387

388388
case DomoticzValues.Device.Type.Value.BLINDS:

0 commit comments

Comments
 (0)