mirror of
https://github.com/freeedcom/ai-codereviewer.git
synced 2025-07-01 05:14:17 +00:00
add project adins
This commit is contained in:
parent
ad06ac5505
commit
f8f85d679d
5299 changed files with 625430 additions and 0 deletions
|
@ -0,0 +1,347 @@
|
|||
package com.adins.mss.dao;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import android.database.Cursor;
|
||||
|
||||
import de.greenrobot.dao.AbstractDao;
|
||||
import de.greenrobot.dao.Property;
|
||||
import de.greenrobot.dao.internal.SqlUtils;
|
||||
import de.greenrobot.dao.internal.DaoConfig;
|
||||
import de.greenrobot.dao.database.Database;
|
||||
import de.greenrobot.dao.database.DatabaseStatement;
|
||||
import de.greenrobot.dao.query.Query;
|
||||
import de.greenrobot.dao.query.QueryBuilder;
|
||||
|
||||
import com.adins.mss.dao.DepositReportH;
|
||||
|
||||
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
|
||||
/**
|
||||
* DAO for table "TR_DEPOSITREPORT_H".
|
||||
*/
|
||||
public class DepositReportHDao extends AbstractDao<DepositReportH, String> {
|
||||
|
||||
public static final String TABLENAME = "TR_DEPOSITREPORT_H";
|
||||
|
||||
/**
|
||||
* Properties of entity DepositReportH.<br/>
|
||||
* Can be used for QueryBuilder and for referencing column names.
|
||||
*/
|
||||
public static class Properties {
|
||||
public final static Property Uuid_deposit_report_h = new Property(0, String.class, "uuid_deposit_report_h", true, "UUID_DEPOSIT_REPORT_H");
|
||||
public final static Property Last_update = new Property(1, java.util.Date.class, "last_update", false, "LAST_UPDATE");
|
||||
public final static Property Batch_id = new Property(2, String.class, "batch_id", false, "BATCH_ID");
|
||||
public final static Property Bank_account = new Property(3, String.class, "bank_account", false, "BANK_ACCOUNT");
|
||||
public final static Property Bank_name = new Property(4, String.class, "bank_name", false, "BANK_NAME");
|
||||
public final static Property Cashier_name = new Property(5, String.class, "cashier_name", false, "CASHIER_NAME");
|
||||
public final static Property Transfered_date = new Property(6, java.util.Date.class, "transfered_date", false, "TRANSFERED_DATE");
|
||||
public final static Property Usr_crt = new Property(7, String.class, "usr_crt", false, "USR_CRT");
|
||||
public final static Property Dtm_crt = new Property(8, java.util.Date.class, "dtm_crt", false, "DTM_CRT");
|
||||
public final static Property Image = new Property(9, byte[].class, "image", false, "IMAGE");
|
||||
public final static Property Uuid_user = new Property(10, String.class, "uuid_user", false, "UUID_USER");
|
||||
public final static Property Flag = new Property(11, String.class, "flag", false, "FLAG");
|
||||
public final static Property Branch_payment = new Property(12, String.class, "branch_payment", false, "BRANCH_PAYMENT");
|
||||
public final static Property Code_channel = new Property(13, String.class, "code_channel", false, "CODE_CHANNEL");
|
||||
public final static Property No_transaction = new Property(14, String.class, "no_transaction", false, "NO_TRANSACTION");
|
||||
};
|
||||
|
||||
private DaoSession daoSession;
|
||||
|
||||
private Query<DepositReportH> user_DepositReportHListQuery;
|
||||
|
||||
public DepositReportHDao(DaoConfig config) {
|
||||
super(config);
|
||||
}
|
||||
|
||||
public DepositReportHDao(DaoConfig config, DaoSession daoSession) {
|
||||
super(config, daoSession);
|
||||
this.daoSession = daoSession;
|
||||
}
|
||||
|
||||
/** Creates the underlying database table. */
|
||||
public static void createTable(Database db, boolean ifNotExists) {
|
||||
String constraint = ifNotExists? "IF NOT EXISTS ": "";
|
||||
db.execSQL("CREATE TABLE " + constraint + "\"TR_DEPOSITREPORT_H\" (" + //
|
||||
"\"UUID_DEPOSIT_REPORT_H\" TEXT PRIMARY KEY NOT NULL ," + // 0: uuid_deposit_report_h
|
||||
"\"LAST_UPDATE\" INTEGER," + // 1: last_update
|
||||
"\"BATCH_ID\" TEXT," + // 2: batch_id
|
||||
"\"BANK_ACCOUNT\" TEXT," + // 3: bank_account
|
||||
"\"BANK_NAME\" TEXT," + // 4: bank_name
|
||||
"\"CASHIER_NAME\" TEXT," + // 5: cashier_name
|
||||
"\"TRANSFERED_DATE\" INTEGER," + // 6: transfered_date
|
||||
"\"USR_CRT\" TEXT," + // 7: usr_crt
|
||||
"\"DTM_CRT\" INTEGER," + // 8: dtm_crt
|
||||
"\"IMAGE\" BLOB," + // 9: image
|
||||
"\"UUID_USER\" TEXT," + // 10: uuid_user
|
||||
"\"FLAG\" TEXT," + // 11: flag
|
||||
"\"BRANCH_PAYMENT\" TEXT," + // 12: branch_payment
|
||||
"\"CODE_CHANNEL\" TEXT," + // 13: code_channel
|
||||
"\"NO_TRANSACTION\" TEXT);"); // 14: no_transaction
|
||||
}
|
||||
|
||||
/** Drops the underlying database table. */
|
||||
public static void dropTable(Database db, boolean ifExists) {
|
||||
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TR_DEPOSITREPORT_H\"";
|
||||
db.execSQL(sql);
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
@Override
|
||||
protected void bindValues(DatabaseStatement stmt, DepositReportH entity) {
|
||||
stmt.clearBindings();
|
||||
stmt.bindString(1, entity.getUuid_deposit_report_h());
|
||||
|
||||
java.util.Date last_update = entity.getLast_update();
|
||||
if (last_update != null) {
|
||||
stmt.bindLong(2, last_update.getTime());
|
||||
}
|
||||
|
||||
String batch_id = entity.getBatch_id();
|
||||
if (batch_id != null) {
|
||||
stmt.bindString(3, batch_id);
|
||||
}
|
||||
|
||||
String bank_account = entity.getBank_account();
|
||||
if (bank_account != null) {
|
||||
stmt.bindString(4, bank_account);
|
||||
}
|
||||
|
||||
String bank_name = entity.getBank_name();
|
||||
if (bank_name != null) {
|
||||
stmt.bindString(5, bank_name);
|
||||
}
|
||||
|
||||
String cashier_name = entity.getCashier_name();
|
||||
if (cashier_name != null) {
|
||||
stmt.bindString(6, cashier_name);
|
||||
}
|
||||
|
||||
java.util.Date transfered_date = entity.getTransfered_date();
|
||||
if (transfered_date != null) {
|
||||
stmt.bindLong(7, transfered_date.getTime());
|
||||
}
|
||||
|
||||
String usr_crt = entity.getUsr_crt();
|
||||
if (usr_crt != null) {
|
||||
stmt.bindString(8, usr_crt);
|
||||
}
|
||||
|
||||
java.util.Date dtm_crt = entity.getDtm_crt();
|
||||
if (dtm_crt != null) {
|
||||
stmt.bindLong(9, dtm_crt.getTime());
|
||||
}
|
||||
|
||||
byte[] image = entity.getImage();
|
||||
if (image != null) {
|
||||
stmt.bindBlob(10, image);
|
||||
}
|
||||
|
||||
String uuid_user = entity.getUuid_user();
|
||||
if (uuid_user != null) {
|
||||
stmt.bindString(11, uuid_user);
|
||||
}
|
||||
|
||||
String flag = entity.getFlag();
|
||||
if (flag != null) {
|
||||
stmt.bindString(12, flag);
|
||||
}
|
||||
|
||||
String branch_payment = entity.getBranch_payment();
|
||||
if (branch_payment != null) {
|
||||
stmt.bindString(13, branch_payment);
|
||||
}
|
||||
|
||||
String code_channel = entity.getCode_channel();
|
||||
if (code_channel != null) {
|
||||
stmt.bindString(14, code_channel);
|
||||
}
|
||||
|
||||
String no_transaction = entity.getNo_transaction();
|
||||
if (no_transaction != null) {
|
||||
stmt.bindString(15, no_transaction);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void attachEntity(DepositReportH entity) {
|
||||
super.attachEntity(entity);
|
||||
entity.__setDaoSession(daoSession);
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
@Override
|
||||
public String readKey(Cursor cursor, int offset) {
|
||||
return cursor.getString(offset + 0);
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
@Override
|
||||
public DepositReportH readEntity(Cursor cursor, int offset) {
|
||||
DepositReportH entity = new DepositReportH( //
|
||||
cursor.getString(offset + 0), // uuid_deposit_report_h
|
||||
cursor.isNull(offset + 1) ? null : new java.util.Date(cursor.getLong(offset + 1)), // last_update
|
||||
cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // batch_id
|
||||
cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // bank_account
|
||||
cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // bank_name
|
||||
cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cashier_name
|
||||
cursor.isNull(offset + 6) ? null : new java.util.Date(cursor.getLong(offset + 6)), // transfered_date
|
||||
cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // usr_crt
|
||||
cursor.isNull(offset + 8) ? null : new java.util.Date(cursor.getLong(offset + 8)), // dtm_crt
|
||||
cursor.isNull(offset + 9) ? null : cursor.getBlob(offset + 9), // image
|
||||
cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // uuid_user
|
||||
cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // flag
|
||||
cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // branch_payment
|
||||
cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // code_channel
|
||||
cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14) // no_transaction
|
||||
);
|
||||
return entity;
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
@Override
|
||||
public void readEntity(Cursor cursor, DepositReportH entity, int offset) {
|
||||
entity.setUuid_deposit_report_h(cursor.getString(offset + 0));
|
||||
entity.setLast_update(cursor.isNull(offset + 1) ? null : new java.util.Date(cursor.getLong(offset + 1)));
|
||||
entity.setBatch_id(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
|
||||
entity.setBank_account(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
|
||||
entity.setBank_name(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
|
||||
entity.setCashier_name(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
|
||||
entity.setTransfered_date(cursor.isNull(offset + 6) ? null : new java.util.Date(cursor.getLong(offset + 6)));
|
||||
entity.setUsr_crt(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
|
||||
entity.setDtm_crt(cursor.isNull(offset + 8) ? null : new java.util.Date(cursor.getLong(offset + 8)));
|
||||
entity.setImage(cursor.isNull(offset + 9) ? null : cursor.getBlob(offset + 9));
|
||||
entity.setUuid_user(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10));
|
||||
entity.setFlag(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11));
|
||||
entity.setBranch_payment(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12));
|
||||
entity.setCode_channel(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13));
|
||||
entity.setNo_transaction(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14));
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
@Override
|
||||
protected String updateKeyAfterInsert(DepositReportH entity, long rowId) {
|
||||
return entity.getUuid_deposit_report_h();
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
@Override
|
||||
public String getKey(DepositReportH entity) {
|
||||
if(entity != null) {
|
||||
return entity.getUuid_deposit_report_h();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
@Override
|
||||
protected boolean isEntityUpdateable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Internal query to resolve the "depositReportHList" to-many relationship of User. */
|
||||
public List<DepositReportH> _queryUser_DepositReportHList(String uuid_user) {
|
||||
synchronized (this) {
|
||||
if (user_DepositReportHListQuery == null) {
|
||||
QueryBuilder<DepositReportH> queryBuilder = queryBuilder();
|
||||
queryBuilder.where(Properties.Uuid_user.eq(null));
|
||||
user_DepositReportHListQuery = queryBuilder.build();
|
||||
}
|
||||
}
|
||||
Query<DepositReportH> query = user_DepositReportHListQuery.forCurrentThread();
|
||||
query.setParameter(0, uuid_user);
|
||||
return query.list();
|
||||
}
|
||||
|
||||
private String selectDeep;
|
||||
|
||||
protected String getSelectDeep() {
|
||||
if (selectDeep == null) {
|
||||
StringBuilder builder = new StringBuilder("SELECT ");
|
||||
SqlUtils.appendColumns(builder, "T", getAllColumns());
|
||||
builder.append(',');
|
||||
SqlUtils.appendColumns(builder, "T0", daoSession.getUserDao().getAllColumns());
|
||||
builder.append(" FROM TR_DEPOSITREPORT_H T");
|
||||
builder.append(" LEFT JOIN MS_USER T0 ON T.\"UUID_USER\"=T0.\"UUID_USER\"");
|
||||
builder.append(' ');
|
||||
selectDeep = builder.toString();
|
||||
}
|
||||
return selectDeep;
|
||||
}
|
||||
|
||||
protected DepositReportH loadCurrentDeep(Cursor cursor, boolean lock) {
|
||||
DepositReportH entity = loadCurrent(cursor, 0, lock);
|
||||
int offset = getAllColumns().length;
|
||||
|
||||
User user = loadCurrentOther(daoSession.getUserDao(), cursor, offset);
|
||||
entity.setUser(user);
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
public DepositReportH loadDeep(Long key) {
|
||||
assertSinglePk();
|
||||
if (key == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
StringBuilder builder = new StringBuilder(getSelectDeep());
|
||||
builder.append("WHERE ");
|
||||
SqlUtils.appendColumnsEqValue(builder, "T", getPkColumns());
|
||||
String sql = builder.toString();
|
||||
|
||||
String[] keyArray = new String[] { key.toString() };
|
||||
Cursor cursor = db.rawQuery(sql, keyArray);
|
||||
|
||||
try {
|
||||
boolean available = cursor.moveToFirst();
|
||||
if (!available) {
|
||||
return null;
|
||||
} else if (!cursor.isLast()) {
|
||||
throw new IllegalStateException("Expected unique result, but count was " + cursor.getCount());
|
||||
}
|
||||
return loadCurrentDeep(cursor, true);
|
||||
} finally {
|
||||
cursor.close();
|
||||
}
|
||||
}
|
||||
|
||||
/** Reads all available rows from the given cursor and returns a list of new ImageTO objects. */
|
||||
public List<DepositReportH> loadAllDeepFromCursor(Cursor cursor) {
|
||||
int count = cursor.getCount();
|
||||
List<DepositReportH> list = new ArrayList<DepositReportH>(count);
|
||||
|
||||
if (cursor.moveToFirst()) {
|
||||
if (identityScope != null) {
|
||||
identityScope.lock();
|
||||
identityScope.reserveRoom(count);
|
||||
}
|
||||
try {
|
||||
do {
|
||||
list.add(loadCurrentDeep(cursor, false));
|
||||
} while (cursor.moveToNext());
|
||||
} finally {
|
||||
if (identityScope != null) {
|
||||
identityScope.unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
protected List<DepositReportH> loadDeepAllAndCloseCursor(Cursor cursor) {
|
||||
try {
|
||||
return loadAllDeepFromCursor(cursor);
|
||||
} finally {
|
||||
cursor.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** A raw-style query where you can pass any WHERE clause and arguments. */
|
||||
public List<DepositReportH> queryDeep(String where, String... selectionArg) {
|
||||
Cursor cursor = db.rawQuery(getSelectDeep() + where, selectionArg);
|
||||
return loadDeepAllAndCloseCursor(cursor);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape>
|
||||
<solid android:color="#ffffff" />
|
||||
<stroke
|
||||
android:width="2dp"
|
||||
android:color="@color/tv_normal" />
|
||||
<corners android:radius="0dp" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:top="2dp">
|
||||
<shape>
|
||||
<solid android:color="@android:color/transparent" />
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="@color/tv_normal" />
|
||||
<corners android:radius="0dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
|
@ -0,0 +1,135 @@
|
|||
package com.adins.mss.base.timeline.comment.activity;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.Bundle;
|
||||
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.base.timeline.Constants;
|
||||
import com.adins.mss.base.timeline.TimelineManager;
|
||||
import com.adins.mss.base.timeline.comment.CommentArrayAdapter;
|
||||
import com.adins.mss.base.timeline.comment.CommentManager;
|
||||
import com.adins.mss.base.util.LocaleHelper;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.dao.Comment;
|
||||
import com.adins.mss.dao.Timeline;
|
||||
import com.adins.mss.foundation.formatter.Formatter;
|
||||
import com.adins.mss.foundation.formatter.Tool;
|
||||
import com.androidquery.AQuery;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class CommentActivity extends Activity {
|
||||
private String key_timeline;
|
||||
private List<Comment> comments;
|
||||
private Timeline content_timeline;
|
||||
private CommentArrayAdapter adapter;
|
||||
private AQuery query;
|
||||
private CommentManager manager;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.comment_layout);
|
||||
Intent intent = getIntent();
|
||||
Bundle extra = intent.getExtras();
|
||||
key_timeline = extra.getString(Constants.KEY_TIMELINE);
|
||||
|
||||
manager = new CommentManager(this);
|
||||
comments = manager.getAllComment(key_timeline);
|
||||
try {
|
||||
if (comments.isEmpty())
|
||||
comments = null;
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
}
|
||||
adapter = new CommentArrayAdapter(this, comments);
|
||||
|
||||
query = new AQuery(this);
|
||||
|
||||
String uuidUser = "";
|
||||
try {
|
||||
uuidUser = GlobalData.getSharedGlobalData().getUser().getUuid_user();
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
uuidUser = "user01";
|
||||
}
|
||||
|
||||
content_timeline = TimelineManager.getTimeline(this, uuidUser, key_timeline);
|
||||
Date dtm_crt = content_timeline.getDtm_crt();
|
||||
String str_dtm_crt = Formatter.formatDate(dtm_crt, Global.DATE_TIMESEC_TIMELINE_FORMAT);
|
||||
byte[] byte_image = content_timeline.getByte_image();
|
||||
Bitmap bm = null;
|
||||
if (byte_image != null) {
|
||||
try {
|
||||
bm = BitmapFactory.decodeByteArray(byte_image, 0, byte_image.length);
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
}
|
||||
|
||||
if (bm == null) {
|
||||
BitmapFactory.Options options = new BitmapFactory.Options();
|
||||
options.inJustDecodeBounds = true;
|
||||
BitmapFactory.decodeByteArray(byte_image, 0, byte_image.length, options);
|
||||
|
||||
// Calculate inSampleSize
|
||||
options.inSampleSize = 64;
|
||||
// Decode bitmap with inSampleSize set
|
||||
options.inJustDecodeBounds = false;
|
||||
bm = BitmapFactory.decodeByteArray(byte_image, 0, byte_image.length, options);
|
||||
}
|
||||
query.id(R.id.timelineImageC).image(bm);
|
||||
} else {
|
||||
query.id(R.id.timelineImageC).visibility(View.GONE);
|
||||
}
|
||||
query.id(R.id.txtTitleC).text(content_timeline.getTimelineType().getTimeline_type());
|
||||
query.id(R.id.txtDescC).text(content_timeline.getDescription());
|
||||
query.id(R.id.txtTimeC).text(str_dtm_crt);
|
||||
query.id(R.id.commentList).adapter(adapter).setSelection(adapter.getCount() - 1);
|
||||
query.id(R.id.btnSendComment).clicked(this, "sendComment");
|
||||
if (comments != null)
|
||||
query.id(R.id.jmlComments).text(adapter.getCount() + " Comments");
|
||||
else
|
||||
query.id(R.id.jmlComments).text(adapter.getCount() - 1 + " Comments");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void attachBaseContext(Context newBase) {
|
||||
Context context = newBase;
|
||||
Locale locale;
|
||||
try{
|
||||
locale = new Locale(GlobalData.getSharedGlobalData().getLocale());
|
||||
context = LocaleHelper.wrap(newBase, locale);
|
||||
} catch (Exception e) {
|
||||
locale = new Locale(LocaleHelper.ENGLSIH);
|
||||
context = LocaleHelper.wrap(newBase, locale);
|
||||
} finally {
|
||||
super.attachBaseContext(context);
|
||||
}
|
||||
}
|
||||
|
||||
public void sendComment(View view) {
|
||||
String comment_desc = query.id(R.id.editComment).getText().toString();
|
||||
if (comment_desc.equals("")) {
|
||||
Toast.makeText(getApplicationContext(), getString(R.string.comment_cannot_be_empty),
|
||||
Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
query.id(R.id.editComment).text("");
|
||||
manager.insertComment(comment_desc, Tool.getUUID(), "Gigin", "Gigin", "Gigin", key_timeline);
|
||||
comments = manager.getAllComment(key_timeline);
|
||||
adapter = new CommentArrayAdapter(this, comments);
|
||||
query.id(R.id.commentList).adapter(adapter).setSelection(adapter.getCount() - 1);
|
||||
query.id(R.id.jmlComments).text(adapter.getCount() + " Comments");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,176 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/bg_grayscale"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatSpinner
|
||||
android:id="@+id/priorityViewByForm"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:background="@drawable/dropdown_background"
|
||||
android:padding="5dp"
|
||||
android:spinnerMode="dropdown" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_expand_by_form"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/priorityViewByForm"
|
||||
android:layout_alignEnd="@+id/priorityViewByForm"
|
||||
android:layout_alignBottom="@+id/priorityViewByForm"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:tint="@color/colorMC"
|
||||
app:srcCompat="@drawable/ic_expand" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatSpinner
|
||||
android:id="@+id/priorityViewByUser"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:background="@drawable/dropdown_background"
|
||||
android:padding="5dp"
|
||||
android:spinnerMode="dropdown" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_expand_by_user"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/priorityViewByUser"
|
||||
android:layout_alignEnd="@+id/priorityViewByUser"
|
||||
android:layout_alignBottom="@+id/priorityViewByUser"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:tint="@color/colorMC"
|
||||
app:srcCompat="@drawable/ic_expand" />
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatSpinner
|
||||
android:id="@+id/priorityViewByBatch"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:background="@drawable/dropdown_background"
|
||||
android:padding="5dp"
|
||||
android:spinnerMode="dropdown" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/priorityViewByBatch"
|
||||
android:layout_alignEnd="@+id/priorityViewByBatch"
|
||||
android:layout_alignBottom="@+id/priorityViewByBatch"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:tint="@color/colorMC"
|
||||
app:srcCompat="@drawable/ic_expand" />
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/label_info_batch"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="@android:color/black"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:padding="4dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/formBatch"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/label_info_form" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/divider_colon" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/formBatchValue"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="right" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:padding="4dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dateBatch"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/label_info_submitdate" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/divider_colon" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dateBatchValue"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:gravity="right" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/label_recapitulation"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="@android:color/black"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ListView
|
||||
android:id="@+id/recapitulationList"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/transferButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/button_background"
|
||||
android:enabled="true"
|
||||
android:text="@string/btnTransfer"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/fontColorWhite" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright 2010 Emmanuel Astier & Kevin Gaudin
|
||||
*
|
||||
* 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 org.acra;
|
||||
|
||||
/**
|
||||
* A simple Exception used when required configuration items are missing.
|
||||
*
|
||||
* @author Kevin Gaudin
|
||||
*/
|
||||
public class ACRAConfigurationException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = -7355339673505996110L;
|
||||
|
||||
public ACRAConfigurationException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:background="@drawable/spinner_background">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtNoOrder"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="?android:attr/listPreferredItemHeightSmall"
|
||||
android:text="@string/dummy_number"
|
||||
android:paddingLeft="10dp"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
<TextView
|
||||
android:id="@+id/txtDivider"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="?android:attr/listPreferredItemHeightSmall"
|
||||
android:text="@string/divider_dash"
|
||||
android:paddingLeft="10dp"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
<TextView
|
||||
android:id="@+id/txtCustomerName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="?android:attr/listPreferredItemHeightSmall"
|
||||
android:text="@string/dummy_customer_name"
|
||||
android:paddingLeft="10dp"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
</LinearLayout>
|
|
@ -0,0 +1,9 @@
|
|||
package com.adins.mss.coll.networks.responses;
|
||||
|
||||
import com.adins.mss.foundation.http.MssResponseType;
|
||||
|
||||
/**
|
||||
* Created by angga.permadi on 3/3/2016.
|
||||
*/
|
||||
public class ClosingTaskResponse extends MssResponseType {
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
~ Copyright 2014 Alex Curran
|
||||
~
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/parent_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/spinner_background" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtTaskTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imageLayout"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="?android:attr/listPreferredItemHeightSmall"
|
||||
android:text="Title"
|
||||
android:paddingLeft="10dp"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/imageLayout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignBottom="@+id/txtTaskTitle"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:gravity="center_vertical|center_horizontal"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageInListTask"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:src="@drawable/ic_schema" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
|
@ -0,0 +1,685 @@
|
|||
package com.services;
|
||||
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import androidx.core.app.NotificationCompat;
|
||||
import android.text.format.DateFormat;
|
||||
import android.util.Log;
|
||||
|
||||
import com.adins.mss.base.AppContext;
|
||||
import com.adins.mss.base.Backup;
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.NewMainActivity;
|
||||
import com.adins.mss.base.R;
|
||||
import com.adins.mss.base.authentication.Authentication;
|
||||
import com.adins.mss.base.commons.CommonImpl;
|
||||
import com.adins.mss.base.crashlytics.FireCrash;
|
||||
import com.adins.mss.base.dynamicform.JsonRequestTaskD;
|
||||
import com.adins.mss.base.dynamicform.JsonResponseTaskD;
|
||||
import com.adins.mss.base.networkmonitor.NetworkMonitorDataUsage;
|
||||
import com.adins.mss.base.rv.SyncRVNumberTask;
|
||||
import com.adins.mss.base.scheme.SyncQuestionSetTask;
|
||||
import com.adins.mss.base.timeline.NewTimelineFragment;
|
||||
import com.adins.mss.base.timeline.TimelineManager;
|
||||
import com.adins.mss.base.todolist.ToDoList;
|
||||
import com.adins.mss.base.todolist.form.PriorityTabFragment;
|
||||
import com.adins.mss.base.todolist.form.TasklistInterface;
|
||||
import com.adins.mss.base.todolist.todayplanrepository.TodayPlanRepository;
|
||||
import com.adins.mss.base.util.GsonHelper;
|
||||
import com.adins.mss.base.util.Utility;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.dao.GeneralParameter;
|
||||
import com.adins.mss.dao.Scheme;
|
||||
import com.adins.mss.dao.TaskD;
|
||||
import com.adins.mss.dao.TaskH;
|
||||
import com.adins.mss.dao.TaskSummary;
|
||||
import com.adins.mss.dao.User;
|
||||
import com.adins.mss.foundation.camerainapp.helper.Logger;
|
||||
import com.adins.mss.foundation.db.dataaccess.GeneralParameterDataAccess;
|
||||
import com.adins.mss.foundation.db.dataaccess.SchemeDataAccess;
|
||||
import com.adins.mss.foundation.db.dataaccess.TaskDDataAccess;
|
||||
import com.adins.mss.foundation.db.dataaccess.TaskHDataAccess;
|
||||
import com.adins.mss.foundation.db.dataaccess.TaskSummaryDataAccess;
|
||||
import com.adins.mss.foundation.db.dataaccess.TimelineDataAccess;
|
||||
import com.adins.mss.foundation.db.dataaccess.TimelineTypeDataAccess;
|
||||
import com.adins.mss.foundation.dialog.DialogManager;
|
||||
import com.adins.mss.foundation.formatter.Tool;
|
||||
import com.adins.mss.foundation.http.HttpConnectionResult;
|
||||
import com.adins.mss.foundation.http.HttpCryptedConnection;
|
||||
import com.adins.mss.foundation.http.MssRequestType;
|
||||
import com.adins.mss.foundation.notification.Notification;
|
||||
import com.adins.mss.foundation.security.storepreferences.ObscuredSharedPreferences;
|
||||
import com.google.firebase.perf.FirebasePerformance;
|
||||
import com.google.firebase.perf.metrics.HttpMetric;
|
||||
import com.tracking.LocationTrackingService;
|
||||
|
||||
import org.acra.ACRA;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class NotificationThread extends Thread {
|
||||
private static String TAG = "NotificationThread";
|
||||
public static String TASKLIST_NOTIFICATION_KEY = "TASKLIST_NOTIFICATION_KEY";
|
||||
public static long lastAssigmentDate = 0;
|
||||
private static List<TaskH> taskHList = new ArrayList<>();
|
||||
public static int notifCount = 0;
|
||||
public String uuidUser;
|
||||
public boolean firstNotif = true;
|
||||
NetworkMonitorDataUsage monitorDU = new NetworkMonitorDataUsage();
|
||||
private Context context;
|
||||
private int interval; // in miliseconds
|
||||
private volatile boolean keepRunning = true;
|
||||
private volatile boolean isWait = false;
|
||||
private long dataUsage;
|
||||
private final Object threadMonitor;
|
||||
|
||||
public NotificationThread(Context context,Object threadMonitor) {
|
||||
this.threadMonitor = threadMonitor;
|
||||
this.context = context;
|
||||
interval = Global.MINUTE * 10;
|
||||
try {
|
||||
uuidUser = GlobalData.getSharedGlobalData().getUser()
|
||||
.getUuid_user();
|
||||
if (uuidUser != null) {
|
||||
if (GeneralParameterDataAccess.getOne(context, uuidUser, "PRM04_F5IN")
|
||||
.getGs_value() != null
|
||||
&& !GeneralParameterDataAccess
|
||||
.getOne(context, uuidUser, "PRM04_F5IN").getGs_value()
|
||||
.isEmpty()) {
|
||||
interval = Integer.parseInt(GeneralParameterDataAccess.getOne(
|
||||
context, uuidUser, "PRM04_F5IN").getGs_value()) * 1000;
|
||||
}
|
||||
} else {
|
||||
keepRunning = false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
e.printStackTrace();
|
||||
if (Global.user != null) {
|
||||
uuidUser = Global.user.getUuid_user();
|
||||
if (uuidUser != null) {
|
||||
if (GeneralParameterDataAccess.getOne(context, uuidUser, "PRM04_F5IN")
|
||||
.getGs_value() != null
|
||||
&& !GeneralParameterDataAccess
|
||||
.getOne(context, uuidUser, "PRM04_F5IN").getGs_value()
|
||||
.isEmpty()) {
|
||||
interval = Integer.parseInt(GeneralParameterDataAccess.getOne(
|
||||
context, uuidUser, "PRM04_F5IN").getGs_value()) * 1000;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
keepRunning = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static List<TaskH> getTaskHList() {
|
||||
return taskHList;
|
||||
}
|
||||
|
||||
public static int getNotificationIcon() {
|
||||
// boolean useWhiteIcon = (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP);
|
||||
// return useWhiteIcon ? R.drawable.icon_notif_new_white : R.drawable.icon_notif_new;
|
||||
return R.drawable.icon_notif_new;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
while (keepRunning) {
|
||||
try {
|
||||
synchronized (threadMonitor) {
|
||||
if (isWait) {
|
||||
threadMonitor.wait();
|
||||
}
|
||||
}
|
||||
try {
|
||||
uuidUser = GlobalData.getSharedGlobalData().getUser()
|
||||
.getUuid_user();
|
||||
if (uuidUser != null) {
|
||||
GeneralParameter gp = GeneralParameterDataAccess.getOne(context, uuidUser, Global.GS_INTERVAL_TASKREFRESH);
|
||||
if (gp != null && gp.getGs_value() != null
|
||||
&& !gp.getGs_value()
|
||||
.isEmpty()) {
|
||||
interval = Integer.parseInt(gp.getGs_value()) * Global.SECOND;
|
||||
if (Integer.parseInt(gp.getGs_value()) == 0) {
|
||||
keepRunning = false;
|
||||
}
|
||||
String application = GlobalData.getSharedGlobalData().getAuditData().getApplication();
|
||||
if (!Global.APPLICATION_ORDER.equals(application)) {
|
||||
checkFlagTracking();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (Tool.isInternetconnected(context)) {
|
||||
//Start Kelola Data Usage
|
||||
long save;
|
||||
dataUsage = monitorDU.getDataUsage(context);
|
||||
save = dataUsage - monitorDU.getDataLastDay(context);
|
||||
if (monitorDU.getDataLastDay(context) == 0) {//Data usage hari sebelumnya belum ada
|
||||
monitorDU.update(context, dataUsage);
|
||||
} else {
|
||||
if (save < 0) {
|
||||
save = 0;
|
||||
}
|
||||
monitorDU.update(context, save);
|
||||
}
|
||||
//End Kelola Data Usage
|
||||
|
||||
List<TaskH> taskHList = TaskHDataAccess.getAllWithAssignmentDate(context, GlobalData.getSharedGlobalData().getUser().getUuid_user());
|
||||
if (taskHList == null)
|
||||
taskHList = new ArrayList<>();
|
||||
for (TaskH taskH : taskHList) {
|
||||
long taskAssignmentDate = taskH.getAssignment_date().getTime();
|
||||
if (taskAssignmentDate >= lastAssigmentDate) {
|
||||
lastAssigmentDate = taskH.getAssignment_date().getTime();
|
||||
}
|
||||
}
|
||||
String application = GlobalData.getSharedGlobalData().getAuditData().getApplication();
|
||||
List<String> listUuidTaskH = null;
|
||||
/*if (Global.APPLICATION_COLLECTION.equalsIgnoreCase(application)) {
|
||||
try {
|
||||
SyncRVNumberTask.syncRvNumberInBackground(context);
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
}
|
||||
}*/
|
||||
notifCount = 0;
|
||||
taskHList.clear();
|
||||
taskHList.addAll(getServerNewTask());
|
||||
|
||||
|
||||
//generate plan task if needed
|
||||
if(Global.PLAN_TASK_ENABLED){
|
||||
TodayPlanRepository todayPlanRepository = GlobalData.getSharedGlobalData().getTodayPlanRepo();
|
||||
todayPlanRepository.generatePlansFromTaskList(taskHList);
|
||||
}
|
||||
|
||||
if (!Global.APPLICATION_ORDER.equalsIgnoreCase(application) && taskHList != null) {
|
||||
listUuidTaskH = new ArrayList<>();
|
||||
notifCount = taskHList.size();
|
||||
// save to local
|
||||
if (!taskHList.isEmpty()) {
|
||||
for (TaskH taskH : taskHList) {
|
||||
taskH.setUser(GlobalData.getSharedGlobalData()
|
||||
.getUser());
|
||||
taskH.setUuid_user(GlobalData
|
||||
.getSharedGlobalData().getUser()
|
||||
.getUuid_user());
|
||||
taskH.setIs_verification(Global.TRUE_STRING);
|
||||
listUuidTaskH.add(taskH.getUuid_task_h());
|
||||
String uuid_timelineType = TimelineTypeDataAccess
|
||||
.getTimelineTypebyType(context,
|
||||
Global.TIMELINE_TYPE_TASK)
|
||||
.getUuid_timeline_type();
|
||||
boolean wasInTimeline = TimelineDataAccess
|
||||
.getOneTimelineByTaskH(context,
|
||||
GlobalData
|
||||
.getSharedGlobalData()
|
||||
.getUser()
|
||||
.getUuid_user(),
|
||||
taskH.getUuid_task_h(),
|
||||
uuid_timelineType) != null;
|
||||
|
||||
String uuid_scheme = taskH.getUuid_scheme();
|
||||
Scheme scheme = SchemeDataAccess.getOne(
|
||||
context, uuid_scheme);
|
||||
if (scheme != null) {
|
||||
taskH.setScheme(scheme);
|
||||
TaskH h = TaskHDataAccess.getOneTaskHeader(
|
||||
context, taskH.getTask_id());
|
||||
if (h != null && h.getStatus() != null) {
|
||||
if (!ToDoList.isOldTask(h)) {
|
||||
taskH.setStatus(TaskHDataAccess.STATUS_SEND_INIT);
|
||||
TaskHDataAccess.addOrReplace(
|
||||
context, taskH);
|
||||
if (!wasInTimeline) {
|
||||
TimelineManager.insertTimeline(
|
||||
context, taskH);
|
||||
}
|
||||
} else if (ToDoList.isOldTask(h) && h.getUuid_user() != null &&
|
||||
!h.getUuid_user().equals(GlobalData.getSharedGlobalData().getUser().getUuid_user())) {
|
||||
taskH.setStatus(TaskHDataAccess.STATUS_SEND_INIT);
|
||||
TaskHDataAccess.addOrReplace(context, taskH);
|
||||
if (!wasInTimeline) {
|
||||
TimelineManager.insertTimeline(
|
||||
context, taskH);
|
||||
}
|
||||
} else {
|
||||
notifCount--;
|
||||
}
|
||||
} else {
|
||||
GlobalData.setNewTaskAvailable(true);
|
||||
taskH.setStatus(TaskHDataAccess.STATUS_SEND_INIT);
|
||||
TaskHDataAccess.addOrReplace(context, taskH);
|
||||
if (!wasInTimeline) {
|
||||
TimelineManager.insertTimeline(
|
||||
context, taskH);
|
||||
}
|
||||
}
|
||||
|
||||
// 2017/10/02 | olivia : simpan task ke table TaskSummary
|
||||
if (Global.APPLICATION_COLLECTION.equalsIgnoreCase(application)) {
|
||||
TaskSummary taskSummary = TaskSummaryDataAccess.getOne(context, taskH.getUuid_task_h(), uuidUser);
|
||||
String uuidTaskSum = Tool.getUUID();
|
||||
Date dtm_crt = Tool.getSystemDateTime();
|
||||
if (taskSummary != null) {
|
||||
if (!CommonImpl.dateIsToday(taskSummary.getDtm_crt())) {
|
||||
taskSummary.setDtm_crt(dtm_crt);
|
||||
TaskSummaryDataAccess.addOrReplace(context, taskSummary);
|
||||
}
|
||||
} else {
|
||||
TaskSummary tempSummary = new TaskSummary(uuidTaskSum, taskH.getUuid_task_h(), uuidUser, null, dtm_crt);
|
||||
TaskSummaryDataAccess.add(context, tempSummary);
|
||||
}
|
||||
}
|
||||
|
||||
Handler handler = new Handler(Looper.getMainLooper());
|
||||
handler.post(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
NewMainActivity.setCounter();
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
TaskH task = TaskHDataAccess.getOneHeader(context, taskH.getUuid_task_h());
|
||||
if ("New".equalsIgnoreCase(task.getStatus())) {
|
||||
JsonRequestTaskD request = new JsonRequestTaskD();
|
||||
request.setAudit(GlobalData.getSharedGlobalData().getAuditData());
|
||||
request.setuuid_task_h(taskH.getUuid_task_h());
|
||||
|
||||
String json = GsonHelper.toJson(request);
|
||||
String url = GlobalData.getSharedGlobalData().getURL_GET_VERIFICATION();
|
||||
boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
|
||||
boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
|
||||
HttpCryptedConnection httpConn = new HttpCryptedConnection(context, encrypt, decrypt);
|
||||
HttpConnectionResult serverResult = null;
|
||||
|
||||
//Firebase Performance Trace HTTP Request
|
||||
HttpMetric networkMetric =
|
||||
FirebasePerformance.getInstance().newHttpMetric(url, FirebasePerformance.HttpMethod.POST);
|
||||
Utility.metricStart(networkMetric, json);
|
||||
|
||||
try {
|
||||
serverResult = httpConn.requestToServer(url, json, Global.DEFAULTCONNECTIONTIMEOUT);
|
||||
Utility.metricStop(networkMetric, serverResult);
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (serverResult.isOK()) {
|
||||
try {
|
||||
String result = serverResult.getResult();
|
||||
|
||||
JsonResponseTaskD response = GsonHelper.fromJson(result, JsonResponseTaskD.class);
|
||||
if (response.getStatus().getCode() == 0) {
|
||||
List<TaskD> taskDs = response.getListTask();
|
||||
|
||||
if (!taskDs.isEmpty()) {
|
||||
|
||||
TaskH h2 = TaskHDataAccess.getOneTaskHeader(
|
||||
context, taskH.getTask_id());
|
||||
if (h2 != null && h2.getStatus() != null) {
|
||||
if (!ToDoList.isOldTask(h2)) {
|
||||
taskH.setScheme(scheme);
|
||||
taskH.setStatus(TaskHDataAccess.STATUS_SEND_DOWNLOAD);
|
||||
TaskHDataAccess.addOrReplace(context, taskH);
|
||||
for (TaskD taskD : taskDs) {
|
||||
taskD.setTaskH(taskH);
|
||||
}
|
||||
if (taskDs != null && !taskDs.isEmpty())
|
||||
TaskDDataAccess.addOrReplace(context, taskDs);
|
||||
}
|
||||
} else {
|
||||
taskH.setScheme(scheme);
|
||||
taskH.setStatus(TaskHDataAccess.STATUS_SEND_DOWNLOAD);
|
||||
TaskHDataAccess.addOrReplace(context, taskH);
|
||||
for (TaskD taskD : taskDs) {
|
||||
taskD.setTaskH(taskH);
|
||||
}
|
||||
if (taskDs != null && !taskDs.isEmpty())
|
||||
TaskDDataAccess.addOrReplace(context, taskDs);
|
||||
}
|
||||
} else {
|
||||
TaskH h2 = TaskHDataAccess.getOneTaskHeader(
|
||||
context, taskH.getTask_id());
|
||||
if (h2 != null && h2.getStatus() != null) {
|
||||
if (!ToDoList.isOldTask(h2)) {
|
||||
taskH.setScheme(scheme);
|
||||
taskH.setStatus(TaskHDataAccess.STATUS_SEND_DOWNLOAD);
|
||||
TaskHDataAccess.addOrReplace(context, taskH);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (Global.IS_DEV)
|
||||
Log.i(TAG,result);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
notifCount--;
|
||||
}
|
||||
}
|
||||
showNotif();
|
||||
}
|
||||
}
|
||||
SyncQuestionSetTask.syncQuestionSetInBackground(context);
|
||||
List<TaskH> taskHs = TaskHDataAccess.getAllTaskByStatus(context, GlobalData.getSharedGlobalData().getUser().getUuid_user(), TaskHDataAccess.STATUS_SEND_DOWNLOAD);
|
||||
taskHs.addAll(TaskHDataAccess.getAllTaskByStatus(context, GlobalData.getSharedGlobalData().getUser().getUuid_user(), TaskHDataAccess.STATUS_SEND_SAVEDRAFT));
|
||||
|
||||
List<TaskH> needRemoveFromBackup = new ArrayList<>();
|
||||
if (listUuidTaskH != null) {
|
||||
for (TaskH h : taskHs) {
|
||||
String uuid_task_h = h.getUuid_task_h();
|
||||
boolean isSame = false;
|
||||
for (String uuid_from_server : listUuidTaskH) {
|
||||
if (uuid_task_h.equals(uuid_from_server)) {
|
||||
isSame = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isSame) {
|
||||
// 2017/10/02 | olivia : task yang delete/close dianggap fail
|
||||
if (Global.APPLICATION_COLLECTION.equalsIgnoreCase(application)) {
|
||||
TaskSummary taskSummary = TaskSummaryDataAccess.getOne(context, h.getUuid_task_h(), uuidUser);
|
||||
if (taskSummary != null) {
|
||||
taskSummary.setTask_status(TaskSummaryDataAccess.STATUS_FAIL);
|
||||
TaskSummaryDataAccess.addOrReplace(context, taskSummary);
|
||||
}
|
||||
}
|
||||
TaskHDataAccess.deleteWithRelation(context, h);
|
||||
if(h.getStatus().equals(TaskHDataAccess.STATUS_SEND_SAVEDRAFT)){
|
||||
needRemoveFromBackup.add(h);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Backup backup = new Backup(context);
|
||||
backup.removeTask(needRemoveFromBackup);
|
||||
|
||||
if (PriorityTabFragment.mHandler != null) {
|
||||
PriorityTabFragment.mHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// Update your UI
|
||||
try {
|
||||
PriorityTabFragment.getListTaskH().clear();
|
||||
PriorityTabFragment.getHandler().sendEmptyMessage(0);
|
||||
PriorityTabFragment.viewAdapter.notifyDataSetChanged();
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (interval == 0) {
|
||||
keepRunning = false;
|
||||
}
|
||||
|
||||
final Handler handler = new Handler(Looper.getMainLooper());
|
||||
handler.post(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
NewMainActivity.setCounter();
|
||||
if (NewTimelineFragment.getTimelineHandler() != null)
|
||||
NewTimelineFragment.getTimelineHandler().sendEmptyMessage(0);
|
||||
if (PriorityTabFragment.getHandler() != null)
|
||||
PriorityTabFragment.getHandler().sendEmptyMessage(0);
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
ACRA.getErrorReporter().putCustomData("ErrorMainMenuActivity", e.getMessage());
|
||||
ACRA.getErrorReporter().putCustomData("ErrorMainMenuActivity", DateFormat.format("yyyy.MM.dd G \'at\' HH:mm:ss z", Calendar.getInstance().getTime()).toString());
|
||||
ACRA.getErrorReporter().handleSilentException(new Exception("Exception saat set Drawer Counter"));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
Thread.sleep(interval);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
try {
|
||||
Thread.sleep(interval);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void requestWait() {
|
||||
isWait = true;
|
||||
}
|
||||
|
||||
public synchronized void stopWaiting() {
|
||||
isWait = false;
|
||||
synchronized (threadMonitor) {
|
||||
threadMonitor.notifyAll();
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void requestStop() {
|
||||
Notification.getSharedNotification().clearNotifAll(context);
|
||||
keepRunning = false;
|
||||
}
|
||||
|
||||
private List<TaskH> getServerNewTask() {
|
||||
JsonResponseRetrieveTaskList jrsrtl = new JsonResponseRetrieveTaskList();
|
||||
MssRequestType mrt = new MssRequestType();
|
||||
mrt.setAudit(GlobalData.getSharedGlobalData().getAuditData());
|
||||
|
||||
String json = GsonHelper.toJson(mrt);
|
||||
|
||||
boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
|
||||
boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
|
||||
HttpCryptedConnection httpConn = new HttpCryptedConnection(context, encrypt, decrypt);
|
||||
HttpConnectionResult serverResult = null;
|
||||
String url = GlobalData.getSharedGlobalData().getURL_GET_TASKLIST();
|
||||
|
||||
//Firebase Performance Trace HTTP Request
|
||||
HttpMetric networkMetric =
|
||||
FirebasePerformance.getInstance().newHttpMetric(url, FirebasePerformance.HttpMethod.POST);
|
||||
Utility.metricStart(networkMetric, json);
|
||||
|
||||
try {
|
||||
serverResult = httpConn
|
||||
.requestToServer(url, json, Global.DEFAULTCONNECTIONTIMEOUT);
|
||||
Utility.metricStop(networkMetric, serverResult);
|
||||
} catch (Exception ex) {
|
||||
FireCrash.log(ex);
|
||||
}
|
||||
if (serverResult != null && serverResult.isOK()) {
|
||||
String sentStatus = serverResult.getResult();
|
||||
Logger.d(NotificationThread.class.getSimpleName(), "Here is response Tasklist from notif : " + sentStatus);
|
||||
jrsrtl = GsonHelper.fromJson(sentStatus, JsonResponseRetrieveTaskList.class);
|
||||
|
||||
if (jrsrtl.getStatus().getCode() == Global.STATUS_CODE_APPL_CLEANSING) {
|
||||
NewMainActivity.Force_Uninstall = true;
|
||||
ObscuredSharedPreferences.Editor editor = ObscuredSharedPreferences.getPrefs(context, Authentication.LOGIN_PREFERENCES, Context.MODE_PRIVATE).edit();
|
||||
editor.putString(Authentication.LOGIN_PREFERENCES_APPLICATION_CLEANSING, "uninstall");
|
||||
editor.apply();
|
||||
//bong 10 apr 15 - Gigin minta untuk uninstall aplikasi jika user tidak aktif
|
||||
DialogManager.uninstallAPK(context);
|
||||
} else {
|
||||
NewMainActivity.Force_Uninstall = false;
|
||||
//delete preferences uninstall ketika user active dan sebelumnya inactive
|
||||
ObscuredSharedPreferences prefs = ObscuredSharedPreferences.getPrefs(context,
|
||||
Authentication.LOGIN_PREFERENCES, Context.MODE_PRIVATE);
|
||||
String restoredText = prefs.getString(Authentication.LOGIN_PREFERENCES_APPLICATION_CLEANSING, null);
|
||||
if (restoredText != null && restoredText.equalsIgnoreCase("uninstall")) {
|
||||
ObscuredSharedPreferences.Editor editor = prefs.edit();
|
||||
try {
|
||||
editor.remove(Authentication.LOGIN_PREFERENCES_APPLICATION_CLEANSING);
|
||||
editor.apply();
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// new task must be saved to database
|
||||
if (jrsrtl.getListTaskList() != null){
|
||||
return jrsrtl.getListTaskList();
|
||||
}
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
public void showNotif() {
|
||||
if (notifCount > 0) {
|
||||
String notifTitle = context.getString(R.string.outstanding_task);
|
||||
String message = context.getString(R.string.notification, notifCount);
|
||||
|
||||
/* Start Prepare Pending Intent */
|
||||
Intent intent = new Intent(context, AppContext.getInstance().getHomeClass());
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
intent.setAction(TASKLIST_NOTIFICATION_KEY);
|
||||
|
||||
PendingIntent pendingIntent = PendingIntent
|
||||
.getActivity(context, 0, intent, PendingIntent.FLAG_ONE_SHOT);
|
||||
/* End Prepare Pending Intent */
|
||||
|
||||
Notification.getSharedNotification().setDefaultIcon(
|
||||
R.drawable.icon_notif_new);
|
||||
|
||||
//Nendi: 2019.06.20 | Update to support Android >= 8.0
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(context, context.getString(R.string.channel_new_task));
|
||||
builder.setSmallIcon(getNotificationIcon());
|
||||
builder.setContentTitle(notifTitle).setNumber(notifCount);
|
||||
builder.setContentText(message).setNumber(notifCount);
|
||||
builder.setPriority(NORM_PRIORITY);
|
||||
NotificationCompat.BigTextStyle inboxStyle =
|
||||
new NotificationCompat.BigTextStyle();
|
||||
// Sets a title for the Inbox in expanded layout
|
||||
inboxStyle.setBigContentTitle(notifTitle);
|
||||
inboxStyle.bigText(message);
|
||||
inboxStyle.setSummaryText(context.getString(R.string.click_to_open_tasklist));
|
||||
|
||||
|
||||
builder.setDefaults(android.app.Notification.DEFAULT_ALL);
|
||||
builder.setStyle(inboxStyle);
|
||||
builder.setAutoCancel(true);
|
||||
builder.setVisibility(NotificationCompat.VISIBILITY_PUBLIC);
|
||||
builder.setContentIntent(pendingIntent);
|
||||
|
||||
firstNotif = false;
|
||||
NotificationManager mNotificationManager =
|
||||
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
mNotificationManager.notify(2019, builder.build());
|
||||
}
|
||||
}
|
||||
|
||||
public void checkFlagTracking() {
|
||||
try {
|
||||
User user = GlobalData.getSharedGlobalData().getUser();
|
||||
if (null != user && null != user.getIs_tracking() && user.getIs_tracking().equals("1")) {
|
||||
String trackingDays;
|
||||
List trackingDaysList;
|
||||
int thisDayInt = Calendar.getInstance().get(Calendar.DAY_OF_WEEK);
|
||||
String thisDay;
|
||||
thisDayInt -= 1;
|
||||
|
||||
thisDay = String.valueOf(thisDayInt);
|
||||
|
||||
trackingDays = user.getTracking_days();
|
||||
if (null != trackingDays && !"".equalsIgnoreCase(trackingDays)) {
|
||||
trackingDaysList = Arrays.asList(trackingDays.split(";"));
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
String hourFromWebStart = user.getStart_time();
|
||||
Calendar calStart = Calendar.getInstance();
|
||||
if (null != hourFromWebStart && !"".equalsIgnoreCase(hourFromWebStart)) {
|
||||
String hourSplitStart[] = hourFromWebStart.split(":");
|
||||
int hourStart = Integer.parseInt(hourSplitStart[0]);
|
||||
int minuteStart = Integer.parseInt(hourSplitStart[1]);
|
||||
|
||||
calStart.set(Calendar.HOUR_OF_DAY, hourStart);
|
||||
calStart.set(Calendar.MINUTE, minuteStart);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
String hourFromWeb = user.getEnd_time();
|
||||
Calendar cal = Calendar.getInstance();
|
||||
if (null != hourFromWeb && !"".equalsIgnoreCase(hourFromWeb)) {
|
||||
String hourSplit[] = hourFromWeb.split(":");
|
||||
int hour = Integer.parseInt(hourSplit[0]);
|
||||
int minute = Integer.parseInt(hourSplit[1]);
|
||||
|
||||
cal.set(Calendar.HOUR_OF_DAY, hour);
|
||||
cal.set(Calendar.MINUTE, minute);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
if (trackingDaysList.contains(thisDay)) {
|
||||
if (Calendar.getInstance().after(calStart) && Calendar.getInstance().before(cal)) {
|
||||
|
||||
} else {
|
||||
if (!LocationTrackingService.isKeepRunning() && LocationTrackingService.isKeepRunningBefore()) {
|
||||
long dataUsageThis = monitorDU.getDataThisDay(context);
|
||||
long dataUsageLastDay = monitorDU.getDataLastDay(context);
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
|
||||
String eightDigit1 = String.valueOf(calendar.getTimeInMillis()).substring(0, 8);
|
||||
String eightDigit2 = String.valueOf(monitorDU.getLastDate(context)).substring(0, 8);
|
||||
Logger.d("NotificationThread", "" + calendar.getTimeInMillis() + " , " + eightDigit1);
|
||||
Logger.d("NotificationThread", "" + monitorDU.getLastDate(context) + " , " + eightDigit2);
|
||||
if (!eightDigit1.equalsIgnoreCase(eightDigit2)) {
|
||||
monitorDU.setDataLastDay(context, dataUsageLastDay + dataUsageThis);
|
||||
monitorDU.resetDataThisDay(context);
|
||||
monitorDU.setDateLastDay(context);
|
||||
LocationTrackingService.setKeepRunningBefore(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
ACRA.getErrorReporter().putCustomData("NotificationThread", e.getMessage());
|
||||
ACRA.getErrorReporter().putCustomData("NotificationThread", DateFormat.format("yyyy.MM.dd G \'at\' HH:mm:ss z", Calendar.getInstance().getTime()).toString());
|
||||
ACRA.getErrorReporter().handleSilentException(new Exception("Exception saat checkFlagTacking"));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue