Skip to content
Open
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
8 changes: 5 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ android {
}
defaultConfig {
applicationId = "org.openimis.imispolicies"
minSdkVersion = 21
targetSdkVersion = 33
minSdkVersion 21
targetSdkVersion 33
versionCode = gitVersionCode
versionName = gitVersionName
testInstrumentationRunner = 'androidx.test.runner.AndroidJUnitRunner'
Expand Down Expand Up @@ -247,7 +247,7 @@ dependencies {
implementation 'com.embarkmobile:zxing-android-minimal:1.2.1@aar'
implementation 'androidx.annotation:annotation:1.7.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.10.0'
implementation 'com.google.android.material:material:1.13.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
//noinspection GradleDependency
implementation 'com.squareup.picasso:picasso:2.8'
Expand All @@ -256,6 +256,8 @@ dependencies {
implementation 'androidx.recyclerview:recyclerview:1.3.2'
implementation 'org.apache.commons:commons-lang3:3.12.0'
implementation 'cz.msebera.android:httpclient:4.5.8'
implementation 'androidx.activity:activity:1.8.0'
implementation "androidx.viewpager2:viewpager2:1.0.0"
implementation 'androidx.test:core:1.7.0'

androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
Expand Down
14 changes: 7 additions & 7 deletions app/src/localeBepha/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,10 @@
<string name="Version">Version</string>
<string name="Name">Name</string>
<string name="ReleaseDate">Release Date</string>
<string name="TotalFamily">Total Households</string>
<string name="TotalInsuree">Total Adherents</string>
<string name="TotalPolicy">Total Policies</string>
<string name="TotalPremium">Total Contributions</string>
<string name="TotalFamily">Total Households:</string>
<string name="TotalInsuree">Total Adherents:</string>
<string name="TotalPolicy">Total Policies:</string>
<string name="TotalPremium">Total Contributions:</string>
<string name="UploadEnrollment">Upload Enrolments</string>
<string name="EnrollmentXML">Create Enrolments XML</string>
<string name="UploadRenewals">Upload Renewals</string>
Expand Down Expand Up @@ -259,9 +259,9 @@
<string name="Search">Search </string>
<string name="ModifyFamily">Modify household</string>
<string name="DownloadFamily">Downloading household</string>
<string name="TotalFamilyOnline">Edited Households </string>
<string name="TotalInsureeOnline">Edited Adherents</string>
<string name="TotalPolicyOnline">Edited Policies</string>
<string name="TotalFamilyOnline">Edited Households: </string>
<string name="TotalInsureeOnline">Edited Adherents:</string>
<string name="TotalPolicyOnline">Edited Policies:</string>
<string name="TotalPremiumOnline">Edited Contributions</string>
<string name="InsuranceNumberNotFound">Adherent number not found</string>
<string name="InsuranceNumberRequired">Adherent number required</string>
Expand Down
8 changes: 6 additions & 2 deletions app/src/localeMv/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
<string name="SelectMonth">Sél. Mois</string>
<string name="EnrolmentDate">Date d\'adhésion</string>
<string name="Product">Paquet de bénéfice</string>
<string name="EffectiveDate">Date d\'entrée en vigueur</string>
<string name="EffectiveDate">Date d\'entrée en vigueur:</string>
<string name="StartDate">Date de début</string>
<string name="ExpireDate">Date d\'expiration</string>
<string name="Officer">Agent</string>
Expand Down Expand Up @@ -120,7 +120,7 @@
<string name="Suspended">Suspendu</string>
<string name="ReceiptNotUnique">Le numéro de reçu doit être unique.</string>
<string name="PleaseDeletePremium">Le contrat a une contribution. Veuillez d\'abord supprimer les contributions</string>
<string name="PolicyDeleted">Contrat avec succès</string>
<string name="PolicyDeleted">Contrat supprimé avec succès</string>
<string name="PremiumDeleted">Contribution supprimée avec succès</string>
<string name="InsureeDeleted">Assuré supprimé avec succès</string>
<string name="IsHeadDelete">Vous ne pouvez pas supprimer le chef de famille.</string>
Expand Down Expand Up @@ -482,5 +482,9 @@
<string name="pay_type_cash">Cash</string>
<string name="pay_type_mobile_phone">Téléphone portable</string>
<string name="pay_type_bank_transfer">Virement banquaire</string>
<string name="tapToUpload">Cliquez pour changer la photo</string>
<string name="SelectBirthDate">Choisir votre date de naissance</string>
<string name="DeleteInsuree">Êtes-vous sûre de vouloir supprimer cet assuré ?</string>
<string name="DeletePolicy">Êtes-vous sûre de vouloir supprimer cette police ?</string>
<string name="Close">Fermer</string>
</resources>
2 changes: 2 additions & 0 deletions app/src/localeMv/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -477,5 +477,7 @@
<string name="CurrentResourceLanguage">Current resource language: %1$s</string>
<string name="SystemLanguageNotSupported">Current system language is not supported. The app will use the default language.</string>
<string name="SupportedLanguages">Supported languages:\n%1$s</string>
<string name="DeleteInsuree">Are you sure you want to delete this insuree?</string>
<string name="DeletePolicy">Are you sure you want to delete this policy?</string>
<string name="Close">Close</string>
</resources>
47 changes: 37 additions & 10 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

<!-- These statements prevent these permissions to be included in merged manifest -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <!-- These statements prevent these permissions to be included in merged manifest -->
<uses-permission
android:name="android.permission.READ_CALL_LOG"
tools:node="remove" />
Expand All @@ -28,7 +26,8 @@
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
tools:node="remove" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
<uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE"
tools:node="remove" />

<uses-feature
Expand All @@ -49,6 +48,34 @@
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning"
tools:replace="android:icon,android:label">
<activity
android:name=".SearchActivity"
android:exported="false" />
<activity
android:name=".AboutActivity"
android:exported="false" />
<activity
android:name=".SyncActivity"
android:exported="false" />
<activity
android:name=".LoginActivity"
android:exported="false" />
<activity
android:name=".PolicyActivity"
android:exported="false" />
<activity
android:name=".FamilyInsurees"
android:exported="false" />
<activity
android:name=".InsureeActivity"
android:exported="false" />
<activity
android:name=".FamilyActivity"
android:exported="false" />
<activity
android:name=".Enrolment"
android:exported="false" />

<service
android:name=".ControlNumberService"
android:exported="false" />
Expand All @@ -63,7 +90,9 @@
android:resource="@xml/paths" />
</provider>

<meta-data android:name="io.sentry.dsn" android:value="@string/sentry_dsn" />
<meta-data
android:name="io.sentry.dsn"
android:value="@string/sentry_dsn" />

<activity
android:name=".MainActivity"
Expand All @@ -73,6 +102,7 @@
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Expand Down Expand Up @@ -134,9 +164,7 @@
<activity android:name=".CheckCommission" />
<activity android:name=".SearchNotEnrolledPolicies" />
<activity android:name=".NotEnrolledPoliciesOverview" />
<activity android:name=".BulkControlNumbersActivity" />

<!-- Override missing configuration for library -->
<activity android:name=".BulkControlNumbersActivity" /> <!-- Override missing configuration for library -->
<activity
android:name="com.google.zxing.client.android.CaptureActivity"
android:exported="false"
Expand All @@ -152,7 +180,6 @@
android:exported="false"
tools:node="merge"
tools:overrideLibrary="com.google.zxing.client" />

</application>

</manifest>
</manifest>
41 changes: 41 additions & 0 deletions app/src/main/java/org/openimis/imispolicies/AboutActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package org.openimis.imispolicies;

import android.os.Bundle;
import android.view.MenuItem;
import android.widget.TextView;

import androidx.activity.EdgeToEdge;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

public class AboutActivity extends AppCompatActivity {

TextView appVersion, releaseDate;
ClientAndroidInterface ca;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about);
setTitle(R.string.About);
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
ca = new ClientAndroidInterface(this);
appVersion = findViewById(R.id.VersionValue);
releaseDate = findViewById(R.id.ReleaseDateValue);
appVersion.setText(ca.getVersion());
releaseDate.setText(getResources().getString(R.string.ReleaseDateValue));
}

@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if (item.getItemId() == android.R.id.home) {
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -680,17 +680,12 @@ public String getHF(int DistrictId, String HFLevel) {
protected HashMap<String, String> jsonToTable(String jsonString) {
HashMap<String, String> data = new HashMap<>();
try {
JSONArray array = new JSONArray(jsonString);
for (int i = 0; i < array.length(); i++) {
JSONObject object = array.getJSONObject(i);
String ControlName = object.getString("id");
String ControlValue;
if (!"null".equals(object.getString("value"))) {
ControlValue = object.getString("value");
} else {
ControlValue = null;
}
data.put(ControlName, ControlValue);
JSONObject object = new JSONObject(jsonString);
Iterator<String> keys = object.keys();
while (keys.hasNext()) {
String key = keys.next();
String value = object.getString(key);
data.put(key, value);
}
} catch (JSONException e) {
e.printStackTrace();
Expand Down Expand Up @@ -941,6 +936,7 @@ public int SaveInsuree(String InsureeData, int FamilyId, int isHead, int ExceedT

String PhotoPath = data.get("hfImagePath");
String newPhotoPath = data.get("hfNewPhotoPath");
Log.d("new photopath", newPhotoPath);

if (!"".equals(newPhotoPath)) {
PhotoPath = copyImageFromGalleryToApplication(newPhotoPath, data.get("txtInsuranceNumber"));
Expand Down Expand Up @@ -1078,7 +1074,7 @@ protected String copyImageFromGalleryToApplication(String selectedPath, String I
FileOutputStream outputStream = new FileOutputStream(outputFile);
Target imageTarget = new OutputStreamImageTarget(outputStream, global.getIntKey("image_jpeg_quality", 40), deleteOldFiles);
try {
activity.runOnUiThread(() -> picassoInstance.load(selectedPath)
activity.runOnUiThread(() -> picassoInstance.load(tempPhotoUri)
.resize(global.getIntKey("image_width_limit", 400),
global.getIntKey("image_height_limit", 400))
.centerInside()
Expand Down Expand Up @@ -1347,6 +1343,10 @@ else if (dateWithGracePeriod4 != null && (dEnrollDate.compareTo(dateWithGracePer
return period.toString();
}

public void setTempPhotoUri(Uri uri){
tempPhotoUri = uri;
}

@JavascriptInterface
@SuppressWarnings("unused")
public void selectPicture() {
Expand Down Expand Up @@ -1693,6 +1693,7 @@ public int SavePolicy(String PolicyData, int FamilyId, int PolicyId) throws Exce
if (IsBulkCNUsed()) {
sqlHandler.assignCnToPolicy(rtPolicyId, controlNumber);
}
Log.e("familyId", String.valueOf(FamilyId));
InsertRecordedPolicies("new", String.valueOf(FamilyId), data.get("ddlProduct"), data.get("hfPolicyValue"), MaxPolicyId);
} else {
int Online = 2;
Expand Down Expand Up @@ -4981,7 +4982,7 @@ public int getCountPremiums(String id) {
return TotalPremiums;
}

@RequiresApi(api = Build.VERSION_CODES.N)
//@RequiresApi(api = Build.VERSION_CODES.N)
@JavascriptInterface
@SuppressWarnings("unused")
public String getSumPremium() {
Expand Down
75 changes: 75 additions & 0 deletions app/src/main/java/org/openimis/imispolicies/Enrolment.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package org.openimis.imispolicies;

import android.content.Intent;
import android.os.Bundle;
import android.view.MenuItem;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.google.android.material.floatingactionbutton.FloatingActionButton;

import org.json.JSONArray;
import org.json.JSONException;

public class Enrolment extends AppCompatActivity {

RecyclerView recyclerView;
FloatingActionButton btnAdd;
ClientAndroidInterface ca;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_enrolment);
setTitle(getApplicationContext().getString(R.string.Families));
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
}
ca = new ClientAndroidInterface(this);

recyclerView = findViewById(R.id.recyclerFamilies);
btnAdd = findViewById(R.id.btnAddNew);
recyclerView.setLayoutManager(new LinearLayoutManager(this));

loadFamilies();
btnAdd.setOnClickListener(v -> {

Intent intent = new Intent(this, FamilyActivity.class);
intent.putExtra("familyId",0);
startActivity(intent);
});
}

@Override
protected void onResume() {
super.onResume();
loadFamilies();
}

private void loadFamilies() {
String families = ca.getAllFamilies();
try {
JSONArray familyArray = new JSONArray(families);
FamilyAdapter adapter = new FamilyAdapter(this,familyArray);
recyclerView.setAdapter(adapter);
} catch (JSONException e) {
throw new RuntimeException(e);
}
}

@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if (item.getItemId() == android.R.id.home) {
// Option 2: Fermer l'activité directement
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
}
Loading
Loading