add project adins

This commit is contained in:
Alfrid Sanjaya Leo Putra 2024-07-25 14:44:22 +07:00
commit f8f85d679d
5299 changed files with 625430 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 707 B

View file

@ -0,0 +1,56 @@
/*
* Copyright (C) 2015 Paul Burke
*
* 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 com.adins.mss.base.todolist.form.helper;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.ItemTouchHelper;
/**
* Interface to listen for a move or dismissal event from a {@link ItemTouchHelper.Callback}.
*
* @author Paul Burke (ipaulpro)
*/
public interface ItemTouchHelperAdapter {
/**
* Called when an item has been dragged far enough to trigger a move. This is called every time
* an item is shifted, and <strong>not</strong> at the end of a "drop" event.<br/>
* <br/>
* Implementations should call {@link RecyclerView.Adapter#notifyItemMoved(int, int)} after
* adjusting the underlying data to reflect this move.
*
* @param fromPosition The start position of the moved item.
* @param toPosition Then resolved position of the moved item.
* @return True if the item was moved to the new adapter position.
* @see RecyclerView#getAdapterPositionFor(RecyclerView.ViewHolder)
* @see RecyclerView.ViewHolder#getAdapterPosition()
*/
boolean onItemMove(int fromPosition, int toPosition);
/**
* Called when an item has been dismissed by a swipe.<br/>
* <br/>
* Implementations should call {@link RecyclerView.Adapter#notifyItemRemoved(int)} after
* adjusting the underlying data to reflect this removal.
*
* @param position The position of the item dismissed.
* @see RecyclerView#getAdapterPositionFor(RecyclerView.ViewHolder)
* @see RecyclerView.ViewHolder#getAdapterPosition()
*/
void onItemDismiss(int position);
}

View file

@ -0,0 +1,23 @@
package com.adins.mss.foundation.questiongenerator;
import android.app.TimePickerDialog;
import android.widget.TimePicker;
import com.adins.mss.foundation.formatter.Tool;
public class TimeInputListener {
private TimePickerDialog.OnTimeSetListener mTimeSetListener = new TimePickerDialog.OnTimeSetListener() {
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
String hour = Tool.appendZeroForDateTime(hourOfDay, false);
String min = Tool.appendZeroForDateTime(minute, false);
DynamicQuestion.setTxtInFocusText(hour + ":" + min);
}
};
public TimeInputListener() {
}
public TimePickerDialog.OnTimeSetListener getmTimeSetListener() {
return mTimeSetListener;
}
}

View file

@ -0,0 +1,102 @@
package com.adins.mss.foundation.http.net;
import android.content.Context;
import com.squareup.okhttp.Call;
import com.squareup.okhttp.Callback;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;
import java.io.IOException;
import java.net.URL;
import java.util.concurrent.TimeUnit;
/**
* Handle http client request.
*/
public class HttpClient {
protected final OkHttpClient client;
protected final Context context;
/**
* Initialize a new instance of HTTP client.
*
* @param context Context for the client.
*/
public HttpClient(Context context) {
this.context = context;
client = new OkHttpClient();
}
public HttpClient() {
this.context = null;
client = new OkHttpClient();
}
public void setConnectionTimeout(long timeout) {
this.client.setConnectTimeout(timeout, TimeUnit.MILLISECONDS);
this.client.setReadTimeout(timeout, TimeUnit.MILLISECONDS);
this.client.setWriteTimeout(timeout, TimeUnit.MILLISECONDS);
}
/**
* Build a request object, that can be later executed by the client.
*
* @param url The target url to request.
* @return A request builder.
*/
public Request.Builder request(String url) {
return new Request.Builder().url(url);
}
/**
* Build a request object, that can be later executed by the client.
*
* @param url The target url to request.
* @return A request builder.
*/
public Request.Builder request(URL url) {
return request(url.toString());
}
/**
* Prepare a request, this method allows you to get the invoker to invoke the request manually.
*
* @param request The request to execute.
* @return A request invoker.
*/
public Call prepare(Request request) {
return client.newCall(request);
}
/**
* Execute a request, you won't have control over the invoker using this method.
* Note that this method runs on current thread, to run the request execution asynchronously,
* use enqueue.
*
* @param request The request to execute.
* @return A response.
* @throws java.io.IOException
*/
public Response execute(Request request) throws IOException {
return client.newCall(request).execute();
}
/**
* Enqueue a request execution, this will invoke the request later if the resource for
* invoking the request is available. Though the invoker is automatically invoked, this method
* returns a request invoker so you can deal with the invoker later.
*
* @param request The request to execute.
* @param callback Callback when the request completed (failed, or succeeded)
* @return A request invoker.
* @throws java.io.IOException
*/
public Call enqueue(Request request, Callback callback) throws IOException {
Call call = client.newCall(request);
call.enqueue(callback);
return call;
}
}

View file

@ -0,0 +1,63 @@
package com.adins.mss.foundation.camerainapp;
import android.view.MotionEvent;
import android.view.SurfaceHolder;
import com.adins.mss.foundation.camerainapp.helper.BasePresenterInterface;
import com.adins.mss.foundation.camerainapp.helper.BaseViewInterface;
import java.util.List;
/**
* Created by angga.permadi on 7/26/2016.
*/
public interface CameraContract {
interface View extends BaseViewInterface<Presenter> {
void initializeViews();
void cameraHasOpened();
void cameraMode(int cameraMode, String flashMode);
void onCameraPreview(int width, int height);
void reviewMode(byte[] data);
void setSupportCameraParams(boolean isSupportFrontCamera, List<String> flashMode);
void onAutoFocus(AutoFocusItem.FocusMode mode, MotionEvent event);
void onOrientationChanged(int rotation);
void onTakePicture(boolean safeTakePicture);
}
interface Presenter extends BasePresenterInterface {
void openCamera();
void openCamera(int mode);
void startPreview(SurfaceHolder holder, int width, int height, int quality);
void resumePreview();
void pausePreview();
void stopCamera();
void takePicture();
void autoFocus(MotionEvent event, CameraSurfaceView view);
void savePicture(byte[] data);
void onCameraModeChange(int mode);
void onFlashModeChange(String flashMode);
void onOrientationChanged(int arg0);
boolean onBackPressed();
}
}

View file

@ -0,0 +1,75 @@
package com.adins.mss.dao;
import com.adins.mss.base.util.ExcludeFromGson;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. Enable "keep" sections if you want to edit.
/**
* Entity mapped to table "TR_BROADCAST".
*/
public class Broadcast {
/** Not-null value. */
private String uuid_broadcast;
private String title;
private String message;
private Boolean is_shown;
private java.util.Date dtm_crt;
public Broadcast() {
}
public Broadcast(String uuid_broadcast) {
this.uuid_broadcast = uuid_broadcast;
}
public Broadcast(String uuid_broadcast, String title, String message, Boolean is_shown, java.util.Date dtm_crt) {
this.uuid_broadcast = uuid_broadcast;
this.title = title;
this.message = message;
this.is_shown = is_shown;
this.dtm_crt = dtm_crt;
}
/** Not-null value. */
public String getUuid_broadcast() {
return uuid_broadcast;
}
/** Not-null value; ensure this value is available before it is saved to the database. */
public void setUuid_broadcast(String uuid_broadcast) {
this.uuid_broadcast = uuid_broadcast;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public Boolean getIs_shown() {
return is_shown;
}
public void setIs_shown(Boolean is_shown) {
this.is_shown = is_shown;
}
public java.util.Date getDtm_crt() {
return dtm_crt;
}
public void setDtm_crt(java.util.Date dtm_crt) {
this.dtm_crt = dtm_crt;
}
}

View file

@ -0,0 +1,226 @@
package com.adins.mss.base.rv;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.os.AsyncTask;
import android.view.View;
import android.widget.Toast;
import com.adins.mss.base.GlobalData;
import com.adins.mss.base.R;
import com.adins.mss.base.crashlytics.FireCrash;
import com.adins.mss.constant.Global;
import com.adins.mss.dao.Lookup;
import com.adins.mss.dao.ReceiptVoucher;
import com.adins.mss.foundation.db.dataaccess.GeneralParameterDataAccess;
import com.adins.mss.foundation.db.dataaccess.LookupDataAccess;
import com.adins.mss.foundation.db.dataaccess.ReceiptVoucherDataAccess;
import com.adins.mss.foundation.dialog.NiftyDialogBuilder;
import com.adins.mss.foundation.print.rv.syncs.SyncRVRequest;
import com.adins.mss.foundation.print.rv.syncs.SyncRVResponse;
import com.adins.mss.foundation.print.rv.syncs.SyncRVTask;
import com.adins.mss.foundation.print.rv.syncs.SyncRvListener;
import org.acra.ACRA;
import java.util.ArrayList;
import java.util.List;
/**
* Created by gigin.ginanjar on 28/12/2016.
*/
public class SyncRVNumberTask {
public static void syncRvNumber(final Activity activity) {
final String uuidUser = GlobalData.getSharedGlobalData().getUser().getUuid_user();
SyncRVRequest request = new SyncRVRequest();
request.setLastDtmCrt(ReceiptVoucherDataAccess.getLastDate(activity, uuidUser));
SyncRVTask task = new SyncRVTask(activity, request, new SyncRvListener() {
ProgressDialog dialog;
@Override
public void onProgress() {
dialog = ProgressDialog.show(activity, "Sync RV Number", activity.getString(R.string.please_wait), true, false);
}
@Override
public void onError(SyncRVResponse response) {
if (dialog != null && dialog.isShowing()) {
dialog.dismiss();
}
if (response.getErrorMessage() != null) {
showErrorDialog();
}
}
@Override
public void onSuccess(SyncRVResponse response) {
if (dialog != null && dialog.isShowing()) {
dialog.dismiss();
}
List<ReceiptVoucher> rvNumbers = response.getListReceiptVoucher();
if (rvNumbers != null && rvNumbers.size() > 0) {
try {
ReceiptVoucherDataAccess.addNewReceiptVoucher(activity,
GlobalData.getSharedGlobalData().getUser().getUuid_user(),
rvNumbers);
} catch (Exception e) {
FireCrash.log(e);
e.printStackTrace();
ACRA.getErrorReporter().putCustomData("errorRV", e.getMessage());
ACRA.getErrorReporter().handleSilentException(new Exception("Error: Insert RV Error. " + e.getMessage()));
Toast.makeText(activity, e.getMessage(), Toast.LENGTH_SHORT).show();
}
try {
boolean isRVinFront = GeneralParameterDataAccess.isRvInFrontEnable(activity, uuidUser);
if (isRVinFront) {
List<Lookup> lookupRVList = new ArrayList<>();
for (int i = 0; i < rvNumbers.size(); i++) {
ReceiptVoucher rv = rvNumbers.get(i);
Lookup lookup = new Lookup();
lookup.setUuid_lookup(rv.getUuid_receipt_voucher());
lookup.setCode(rv.getUuid_receipt_voucher());
lookup.setValue(rv.getRv_number());
lookup.setSequence(i);
lookup.setDtm_upd(rv.getDtm_crt());
lookup.setLov_group(Global.TAG_RV_NUMBER);
lookup.setIs_active(Global.TRUE_STRING);
lookup.setIs_deleted(Global.FALSE_STRING);
lookupRVList.add(lookup);
}
LookupDataAccess.addOrUpdateAll(activity, lookupRVList);
}
} catch (Exception e) {
FireCrash.log(e);
e.printStackTrace();
}
}
openInputRVActivity();
}
private void openInputRVActivity() {
}
private void showErrorDialog() {
final NiftyDialogBuilder dialog = NiftyDialogBuilder.getInstance(activity)
.isCancelable(true)
.isCancelableOnTouchOutside(false);
boolean isRvNumberEmpty = ReceiptVoucherDataAccess.getByStatus(activity,
GlobalData.getSharedGlobalData().getUser().getUuid_user(),
ReceiptVoucherDataAccess.STATUS_NEW).size() == 0;
dialog.withTitle(activity.getString(R.string.error_capital))
.withMessage(R.string.sync_rv_failed)
.withButton1Text(activity.getString(R.string.try_again))
.setButton1Click(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
syncRvNumber(activity);
}
});
if (!isRvNumberEmpty) {
dialog.withButton2Text(activity.getString(R.string.btnNext))
.setButton2Click(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
openInputRVActivity();
}
});
} else {
dialog.withButton2Text(activity.getString(R.string.btnClose))
.setButton2Click(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
}
});
}
}
});
task.execute();
}
public static void syncRvNumber(Activity activity, SyncRvListener listener) {
final String uuidUser = GlobalData.getSharedGlobalData().getUser().getUuid_user();
SyncRVRequest request = new SyncRVRequest();
request.setLastDtmCrt(ReceiptVoucherDataAccess.getLastDate(activity, uuidUser));
new SyncRVTask(activity, request, listener).execute();
}
public static void syncRvNumberInBackground(final Context activity) {
final String uuidUser = GlobalData.getSharedGlobalData().getUser().getUuid_user();
SyncRVRequest request = new SyncRVRequest();
request.setLastDtmCrt(ReceiptVoucherDataAccess.getLastDate(activity, uuidUser));
SyncRVTask task = new SyncRVTask(activity, request, new SyncRvListener() {
@Override
public void onProgress() {
}
@Override
public void onError(SyncRVResponse response) {
}
@Override
public void onSuccess(SyncRVResponse response) {
List<ReceiptVoucher> rvNumbers = response.getListReceiptVoucher();
if (rvNumbers != null && rvNumbers.size() > 0) {
try {
ReceiptVoucherDataAccess.addNewReceiptVoucher(activity,
GlobalData.getSharedGlobalData().getUser().getUuid_user(),
rvNumbers);
System.out.println();
} catch (Exception e) {
FireCrash.log(e);
e.printStackTrace();
ACRA.getErrorReporter().putCustomData("errorRV", e.getMessage());
ACRA.getErrorReporter().handleSilentException(new Exception("Error: Insert RV Error. " + e.getMessage()));
}
/*try {
boolean isRVinFront = GeneralParameterDataAccess.isRvInFrontEnable(activity, uuidUser);
if (isRVinFront) {
LookupDataAccess.deleteByLovGroup(activity, Global.TAG_RV_NUMBER);
List<Lookup> lookupRVList = new ArrayList<>();
for (int i = 0; i < rvNumbers.size(); i++) {
ReceiptVoucher rv = rvNumbers.get(i);
Lookup lookup = new Lookup();
lookup.setUuid_lookup(rv.getUuid_receipt_voucher());
lookup.setCode(rv.getUuid_receipt_voucher());
lookup.setValue(rv.getRv_number());
lookup.setSequence(i);
lookup.setDtm_upd(rv.getDtm_crt());
lookup.setLov_group(Global.TAG_RV_NUMBER);
lookup.setIs_active(Global.TRUE_STRING);
lookup.setIs_deleted(Global.FALSE_STRING);
lookupRVList.add(lookup);
}
LookupDataAccess.addOrUpdateAll(activity, lookupRVList);
}
} catch (Exception e) {
FireCrash.log(e);
e.printStackTrace();
}*/
}
}
});
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}

View file

@ -0,0 +1,17 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="Divider">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">2dp</item>
<item name="android:background">@color/black</item>
</style>
</resources>

View file

@ -0,0 +1,39 @@
package org.acra.log;
/**
* Responsible for providing ACRA classes with a platform neutral way of logging.
* <p>
* One reason for using this mechanism is to allow ACRA classes to use a logging system,
* but be able to execute in a test environment outside of an Android JVM.
* </p>
*
* @author William Ferguson
* @since 4.3.0
*/
public interface ACRALog {
public int v(java.lang.String tag, java.lang.String msg);
public int v(java.lang.String tag, java.lang.String msg, java.lang.Throwable tr);
public int d(java.lang.String tag, java.lang.String msg);
public int d(java.lang.String tag, java.lang.String msg, java.lang.Throwable tr);
public int i(java.lang.String tag, java.lang.String msg);
public int i(java.lang.String tag, java.lang.String msg, java.lang.Throwable tr);
public int w(java.lang.String tag, java.lang.String msg);
public int w(java.lang.String tag, java.lang.String msg, java.lang.Throwable tr);
//public native boolean isLoggable(java.lang.String tag, int level);
public int w(java.lang.String tag, java.lang.Throwable tr);
public int e(java.lang.String tag, java.lang.String msg);
public int e(java.lang.String tag, java.lang.String msg, java.lang.Throwable tr);
public java.lang.String getStackTraceString(java.lang.Throwable tr);
//public native int println(int priority, java.lang.String tag, java.lang.String msg);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 795 B