mirror of
https://github.com/freeedcom/ai-codereviewer.git
synced 2025-06-30 21:04:16 +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,36 @@
|
|||
package com.adins.mss.coll.login;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.adins.mss.base.about.activity.AboutActivity;
|
||||
import com.adins.mss.base.login.DefaultLoginModel;
|
||||
import com.adins.mss.coll.ChangeLog;
|
||||
import com.adins.mss.coll.MCSynchronizeActivity;
|
||||
import com.adins.mss.constant.Global;
|
||||
|
||||
|
||||
public class MCDefaultLoginModel extends DefaultLoginModel{
|
||||
|
||||
public MCDefaultLoginModel(Context context) {
|
||||
super(context);
|
||||
// TODO Auto-generated constructor stub
|
||||
|
||||
//bong 29 apr 15 - set Global intent to go to synhronize after force change password
|
||||
Global.syncIntent = new Intent(getContext(), MCSynchronizeActivity.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getBuildNumber() {
|
||||
int c = Global.BUILD_VERSION;//ChangeLog.getChangeLog().get(0).getBuildVersion();
|
||||
AboutActivity.setChangeLog(ChangeLog.getChangeLog(getContext()), 0);
|
||||
return c;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Intent getIntentSynchronize() {
|
||||
// TODO Auto-generated method stub
|
||||
return new Intent(getContext(), MCSynchronizeActivity.class);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,173 @@
|
|||
package com.adins.mss.dao;
|
||||
|
||||
import android.database.Cursor;
|
||||
|
||||
import de.greenrobot.dao.AbstractDao;
|
||||
import de.greenrobot.dao.Property;
|
||||
import de.greenrobot.dao.internal.DaoConfig;
|
||||
import de.greenrobot.dao.database.Database;
|
||||
import de.greenrobot.dao.database.DatabaseStatement;
|
||||
|
||||
import com.adins.mss.dao.Account;
|
||||
|
||||
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
|
||||
/**
|
||||
* DAO for table "MS_ACCOUNT".
|
||||
*/
|
||||
public class AccountDao extends AbstractDao<Account, String> {
|
||||
|
||||
public static final String TABLENAME = "MS_ACCOUNT";
|
||||
|
||||
/**
|
||||
* Properties of entity Account.<br/>
|
||||
* Can be used for QueryBuilder and for referencing column names.
|
||||
*/
|
||||
public static class Properties {
|
||||
public final static Property Uuid_account = new Property(0, String.class, "uuid_account", true, "UUID_ACCOUNT");
|
||||
public final static Property Account_name = new Property(1, String.class, "account_name", false, "ACCOUNT_NAME");
|
||||
public final static Property Account_address = new Property(2, String.class, "account_address", false, "ACCOUNT_ADDRESS");
|
||||
public final static Property Account_phone_1 = new Property(3, String.class, "account_phone_1", false, "ACCOUNT_PHONE_1");
|
||||
public final static Property Account_phone_2 = new Property(4, String.class, "account_phone_2", false, "ACCOUNT_PHONE_2");
|
||||
public final static Property Account_latitude = new Property(5, String.class, "account_latitude", false, "ACCOUNT_LATITUDE");
|
||||
public final static Property Account_longitude = new Property(6, String.class, "account_longitude", false, "ACCOUNT_LONGITUDE");
|
||||
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 AccountDao(DaoConfig config) {
|
||||
super(config);
|
||||
}
|
||||
|
||||
public AccountDao(DaoConfig config, DaoSession daoSession) {
|
||||
super(config, 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 + "\"MS_ACCOUNT\" (" + //
|
||||
"\"UUID_ACCOUNT\" TEXT PRIMARY KEY NOT NULL ," + // 0: uuid_account
|
||||
"\"ACCOUNT_NAME\" TEXT," + // 1: account_name
|
||||
"\"ACCOUNT_ADDRESS\" TEXT," + // 2: account_address
|
||||
"\"ACCOUNT_PHONE_1\" TEXT," + // 3: account_phone_1
|
||||
"\"ACCOUNT_PHONE_2\" TEXT," + // 4: account_phone_2
|
||||
"\"ACCOUNT_LATITUDE\" TEXT," + // 5: account_latitude
|
||||
"\"ACCOUNT_LONGITUDE\" TEXT," + // 6: account_longitude
|
||||
"\"USR_CRT\" TEXT," + // 7: usr_crt
|
||||
"\"DTM_CRT\" INTEGER);"); // 8: dtm_crt
|
||||
}
|
||||
|
||||
/** Drops the underlying database table. */
|
||||
public static void dropTable(Database db, boolean ifExists) {
|
||||
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"MS_ACCOUNT\"";
|
||||
db.execSQL(sql);
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
@Override
|
||||
protected void bindValues(DatabaseStatement stmt, Account entity) {
|
||||
stmt.clearBindings();
|
||||
stmt.bindString(1, entity.getUuid_account());
|
||||
|
||||
String account_name = entity.getAccount_name();
|
||||
if (account_name != null) {
|
||||
stmt.bindString(2, account_name);
|
||||
}
|
||||
|
||||
String account_address = entity.getAccount_address();
|
||||
if (account_address != null) {
|
||||
stmt.bindString(3, account_address);
|
||||
}
|
||||
|
||||
String account_phone_1 = entity.getAccount_phone_1();
|
||||
if (account_phone_1 != null) {
|
||||
stmt.bindString(4, account_phone_1);
|
||||
}
|
||||
|
||||
String account_phone_2 = entity.getAccount_phone_2();
|
||||
if (account_phone_2 != null) {
|
||||
stmt.bindString(5, account_phone_2);
|
||||
}
|
||||
|
||||
String account_latitude = entity.getAccount_latitude();
|
||||
if (account_latitude != null) {
|
||||
stmt.bindString(6, account_latitude);
|
||||
}
|
||||
|
||||
String account_longitude = entity.getAccount_longitude();
|
||||
if (account_longitude != null) {
|
||||
stmt.bindString(7, account_longitude);
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
@Override
|
||||
public String readKey(Cursor cursor, int offset) {
|
||||
return cursor.getString(offset + 0);
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
@Override
|
||||
public Account readEntity(Cursor cursor, int offset) {
|
||||
Account entity = new Account( //
|
||||
cursor.getString(offset + 0), // uuid_account
|
||||
cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // account_name
|
||||
cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // account_address
|
||||
cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // account_phone_1
|
||||
cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // account_phone_2
|
||||
cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // account_latitude
|
||||
cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // account_longitude
|
||||
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
|
||||
);
|
||||
return entity;
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
@Override
|
||||
public void readEntity(Cursor cursor, Account entity, int offset) {
|
||||
entity.setUuid_account(cursor.getString(offset + 0));
|
||||
entity.setAccount_name(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
|
||||
entity.setAccount_address(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
|
||||
entity.setAccount_phone_1(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
|
||||
entity.setAccount_phone_2(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
|
||||
entity.setAccount_latitude(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
|
||||
entity.setAccount_longitude(cursor.isNull(offset + 6) ? null : cursor.getString(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)));
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
@Override
|
||||
protected String updateKeyAfterInsert(Account entity, long rowId) {
|
||||
return entity.getUuid_account();
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
@Override
|
||||
public String getKey(Account entity) {
|
||||
if(entity != null) {
|
||||
return entity.getUuid_account();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
@Override
|
||||
protected boolean isEntityUpdateable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
<?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"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/bgColor"
|
||||
android:orientation="vertical">
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/appVersionContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardCornerRadius="10dp"
|
||||
app:contentPadding="15dp"
|
||||
app:cardElevation="@dimen/card_shadow"
|
||||
android:layout_margin="@dimen/card_margin"
|
||||
app:cardBackgroundColor="@color/fontColorWhite">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:id="@+id/lblApp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_name_order"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/gradient_end"
|
||||
android:paddingBottom="10dp"/>
|
||||
<TextView
|
||||
android:id="@+id/appDesc"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="10dp"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:text="@string/app_desc_order"/>
|
||||
<Button
|
||||
android:id="@+id/btnCheckUpdate"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="15dp"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:text="@string/checkUpdate"
|
||||
android:textColor="@color/fontColorWhite"
|
||||
android:background="@drawable/button_background"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="15dp" />
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/appLogContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardCornerRadius="10dp"
|
||||
app:contentPadding="5dp"
|
||||
app:cardElevation="@dimen/card_shadow"
|
||||
android:layout_margin="@dimen/card_margin"
|
||||
app:cardBackgroundColor="@color/fontColorWhite">
|
||||
<ListView
|
||||
android:id="@android:id/list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="28dp"
|
||||
android:height="30dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="@color/fontColor"
|
||||
android:pathData="M2.01,21L23,12 2.01,3 2,10l15,2 -15,2z"/>
|
||||
</vector>
|
|
@ -0,0 +1,226 @@
|
|||
package com.adins.mss.dao;
|
||||
|
||||
import com.adins.mss.dao.DaoSession;
|
||||
import de.greenrobot.dao.DaoException;
|
||||
|
||||
import com.adins.mss.base.util.ExcludeFromGson;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. Enable "keep" sections if you want to edit.
|
||||
/**
|
||||
* Entity mapped to table "TR_IMAGERESULT".
|
||||
*/
|
||||
public class ImageResult {
|
||||
|
||||
/** Not-null value. */
|
||||
@SerializedName("uuid_image_result")
|
||||
private String uuid_image_result;
|
||||
@SerializedName("question_id")
|
||||
private String question_id;
|
||||
@SerializedName("submit_duration")
|
||||
private String submit_duration;
|
||||
@SerializedName("submit_size")
|
||||
private String submit_size;
|
||||
@SerializedName("total_image")
|
||||
private Integer total_image;
|
||||
@SerializedName("count_image")
|
||||
private Integer count_image;
|
||||
@SerializedName("submit_date")
|
||||
private java.util.Date submit_date;
|
||||
@SerializedName("submit_result")
|
||||
private String submit_result;
|
||||
@SerializedName("question_group_id")
|
||||
private String question_group_id;
|
||||
@SerializedName("usr_crt")
|
||||
private String usr_crt;
|
||||
@SerializedName("dtm_crt")
|
||||
private java.util.Date dtm_crt;
|
||||
@SerializedName("uuid_task_h")
|
||||
private String uuid_task_h;
|
||||
|
||||
/** Used to resolve relations */
|
||||
private transient DaoSession daoSession;
|
||||
|
||||
/** Used for active entity operations. */
|
||||
private transient ImageResultDao myDao;
|
||||
|
||||
private TaskH taskH;
|
||||
private String taskH__resolvedKey;
|
||||
|
||||
|
||||
public ImageResult() {
|
||||
}
|
||||
|
||||
public ImageResult(String uuid_image_result) {
|
||||
this.uuid_image_result = uuid_image_result;
|
||||
}
|
||||
|
||||
public ImageResult(String uuid_image_result, String question_id, String submit_duration, String submit_size, Integer total_image, Integer count_image, java.util.Date submit_date, String submit_result, String question_group_id, String usr_crt, java.util.Date dtm_crt, String uuid_task_h) {
|
||||
this.uuid_image_result = uuid_image_result;
|
||||
this.question_id = question_id;
|
||||
this.submit_duration = submit_duration;
|
||||
this.submit_size = submit_size;
|
||||
this.total_image = total_image;
|
||||
this.count_image = count_image;
|
||||
this.submit_date = submit_date;
|
||||
this.submit_result = submit_result;
|
||||
this.question_group_id = question_group_id;
|
||||
this.usr_crt = usr_crt;
|
||||
this.dtm_crt = dtm_crt;
|
||||
this.uuid_task_h = uuid_task_h;
|
||||
}
|
||||
|
||||
/** called by internal mechanisms, do not call yourself. */
|
||||
public void __setDaoSession(DaoSession daoSession) {
|
||||
this.daoSession = daoSession;
|
||||
myDao = daoSession != null ? daoSession.getImageResultDao() : null;
|
||||
}
|
||||
|
||||
/** Not-null value. */
|
||||
public String getUuid_image_result() {
|
||||
return uuid_image_result;
|
||||
}
|
||||
|
||||
/** Not-null value; ensure this value is available before it is saved to the database. */
|
||||
public void setUuid_image_result(String uuid_image_result) {
|
||||
this.uuid_image_result = uuid_image_result;
|
||||
}
|
||||
|
||||
public String getQuestion_id() {
|
||||
return question_id;
|
||||
}
|
||||
|
||||
public void setQuestion_id(String question_id) {
|
||||
this.question_id = question_id;
|
||||
}
|
||||
|
||||
public String getSubmit_duration() {
|
||||
return submit_duration;
|
||||
}
|
||||
|
||||
public void setSubmit_duration(String submit_duration) {
|
||||
this.submit_duration = submit_duration;
|
||||
}
|
||||
|
||||
public String getSubmit_size() {
|
||||
return submit_size;
|
||||
}
|
||||
|
||||
public void setSubmit_size(String submit_size) {
|
||||
this.submit_size = submit_size;
|
||||
}
|
||||
|
||||
public Integer getTotal_image() {
|
||||
return total_image;
|
||||
}
|
||||
|
||||
public void setTotal_image(Integer total_image) {
|
||||
this.total_image = total_image;
|
||||
}
|
||||
|
||||
public Integer getCount_image() {
|
||||
return count_image;
|
||||
}
|
||||
|
||||
public void setCount_image(Integer count_image) {
|
||||
this.count_image = count_image;
|
||||
}
|
||||
|
||||
public java.util.Date getSubmit_date() {
|
||||
return submit_date;
|
||||
}
|
||||
|
||||
public void setSubmit_date(java.util.Date submit_date) {
|
||||
this.submit_date = submit_date;
|
||||
}
|
||||
|
||||
public String getSubmit_result() {
|
||||
return submit_result;
|
||||
}
|
||||
|
||||
public void setSubmit_result(String submit_result) {
|
||||
this.submit_result = submit_result;
|
||||
}
|
||||
|
||||
public String getQuestion_group_id() {
|
||||
return question_group_id;
|
||||
}
|
||||
|
||||
public void setQuestion_group_id(String question_group_id) {
|
||||
this.question_group_id = question_group_id;
|
||||
}
|
||||
|
||||
public String getUsr_crt() {
|
||||
return usr_crt;
|
||||
}
|
||||
|
||||
public void setUsr_crt(String usr_crt) {
|
||||
this.usr_crt = usr_crt;
|
||||
}
|
||||
|
||||
public java.util.Date getDtm_crt() {
|
||||
return dtm_crt;
|
||||
}
|
||||
|
||||
public void setDtm_crt(java.util.Date dtm_crt) {
|
||||
this.dtm_crt = dtm_crt;
|
||||
}
|
||||
|
||||
public String getUuid_task_h() {
|
||||
return uuid_task_h;
|
||||
}
|
||||
|
||||
public void setUuid_task_h(String uuid_task_h) {
|
||||
this.uuid_task_h = uuid_task_h;
|
||||
}
|
||||
|
||||
/** To-one relationship, resolved on first access. */
|
||||
public TaskH getTaskH() {
|
||||
String __key = this.uuid_task_h;
|
||||
if (taskH__resolvedKey == null || taskH__resolvedKey != __key) {
|
||||
if (daoSession == null) {
|
||||
throw new DaoException("Entity is detached from DAO context");
|
||||
}
|
||||
TaskHDao targetDao = daoSession.getTaskHDao();
|
||||
TaskH taskHNew = targetDao.load(__key);
|
||||
synchronized (this) {
|
||||
taskH = taskHNew;
|
||||
taskH__resolvedKey = __key;
|
||||
}
|
||||
}
|
||||
return taskH;
|
||||
}
|
||||
|
||||
public void setTaskH(TaskH taskH) {
|
||||
synchronized (this) {
|
||||
this.taskH = taskH;
|
||||
uuid_task_h = taskH == null ? null : taskH.getUuid_task_h();
|
||||
taskH__resolvedKey = uuid_task_h;
|
||||
}
|
||||
}
|
||||
|
||||
/** Convenient call for {@link AbstractDao#delete(Object)}. Entity must attached to an entity context. */
|
||||
public void delete() {
|
||||
if (myDao == null) {
|
||||
throw new DaoException("Entity is detached from DAO context");
|
||||
}
|
||||
myDao.delete(this);
|
||||
}
|
||||
|
||||
/** Convenient call for {@link AbstractDao#update(Object)}. Entity must attached to an entity context. */
|
||||
public void update() {
|
||||
if (myDao == null) {
|
||||
throw new DaoException("Entity is detached from DAO context");
|
||||
}
|
||||
myDao.update(this);
|
||||
}
|
||||
|
||||
/** Convenient call for {@link AbstractDao#refresh(Object)}. Entity must attached to an entity context. */
|
||||
public void refresh() {
|
||||
if (myDao == null) {
|
||||
throw new DaoException("Entity is detached from DAO context");
|
||||
}
|
||||
myDao.refresh(this);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,123 @@
|
|||
package com.adins.mss.coll.fragments;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.TableLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.util.LocaleHelper;
|
||||
import com.adins.mss.coll.R;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.dao.CollectionActivity;
|
||||
import com.adins.mss.foundation.formatter.Formatter;
|
||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
|
||||
import org.acra.ACRA;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Created by dian.ina on 08/05/2015.
|
||||
*/
|
||||
public class CollectionActivityDetailFragment extends AppCompatActivity {
|
||||
public static final String COLLECTION_ACTIVITY_DETAIL = "CollectionActivityDetailFragment.COLLECTION_ACTIVITY_DETAIL";
|
||||
private FirebaseAnalytics screenName;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.new_fragment_collection_activity_detail);
|
||||
ACRA.getErrorReporter().putCustomData("LAST_CLASS_ACCESSED", getClass().getSimpleName());
|
||||
CollectionActivity item = CollectionActivityFragment.itemCollectionActivity;
|
||||
|
||||
Toolbar toolbar = (Toolbar) findViewById(com.adins.mss.base.R.id.toolbar);
|
||||
toolbar.setTitle(getString(R.string.title_mn_collectionactivitydet));
|
||||
toolbar.setTitleTextColor(getResources().getColor(com.adins.mss.base.R.color.fontColorWhite));
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
TableLayout table = (TableLayout) findViewById(R.id.tableCollectionDetail);
|
||||
screenName = FirebaseAnalytics.getInstance(this);
|
||||
|
||||
int index = 1;
|
||||
Class<CollectionActivity> type = CollectionActivity.class;
|
||||
|
||||
for (Method method : type.getMethods()) {
|
||||
if (!method.getName().startsWith("get") || method.getName().equals("getClass")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
View row = LayoutInflater.from(this).inflate(R.layout.view_no_label_value, table, false);
|
||||
TextView no = (TextView) row.findViewById(R.id.no);
|
||||
TextView label = (TextView) row.findViewById(R.id.fieldName);
|
||||
TextView value = (TextView) row.findViewById(R.id.fieldValue);
|
||||
|
||||
String labelField =method.getName().replaceFirst("get", "");
|
||||
|
||||
if(labelField.equalsIgnoreCase("Dtm_crt")||
|
||||
labelField.equalsIgnoreCase("Usr_crt")||
|
||||
labelField.equalsIgnoreCase("Usr_upd")||
|
||||
labelField.equalsIgnoreCase("dtm_upd")||
|
||||
labelField.equalsIgnoreCase("uuid_collection_activity")||
|
||||
labelField.equalsIgnoreCase("Uuid_task_h") ||
|
||||
labelField.equalsIgnoreCase("agreement_no") ||
|
||||
labelField.equalsIgnoreCase("branch_code")){
|
||||
|
||||
}else{
|
||||
no.setText(String.valueOf(index++));
|
||||
label.setText(labelField.replace("_", " "));
|
||||
try {
|
||||
String stringValue = "";
|
||||
Object itemValue = null;
|
||||
try {
|
||||
itemValue = method.invoke(item);
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (itemValue == null) {
|
||||
stringValue = "-";
|
||||
} else if (method.getReturnType() == Date.class) {
|
||||
stringValue = Formatter.formatDate((Date)itemValue, Global.DATE_STR_FORMAT);
|
||||
} else {
|
||||
stringValue = String.valueOf(itemValue);
|
||||
}
|
||||
|
||||
value.setText(stringValue);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
table.addView(row);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
//Set Firebase screen name
|
||||
screenName.setCurrentScreen(this, getString(R.string.screen_name_collection_detail_act), null);
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package com.adins.mss.odr.catalogue.imageslider;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/28/2017.
|
||||
*/
|
||||
|
||||
public class SliderPagerAdapter extends FragmentStatePagerAdapter {
|
||||
private static final String TAG = "SliderPagerAdapter";
|
||||
|
||||
List<Fragment> mFrags = new ArrayList<>();
|
||||
|
||||
public SliderPagerAdapter(FragmentManager fm, List<Fragment> frags) {
|
||||
super(fm);
|
||||
mFrags = frags;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
int index = position % mFrags.size();
|
||||
return FragmentSlider.newInstance(mFrags.get(index).getArguments().getByteArray("params"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroyItem(ViewGroup container, int position, Object object) {
|
||||
super.destroyItem(container, position, object);
|
||||
mFrags.remove(object);
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 6.2 KiB |
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="14dp"
|
||||
android:height="14dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="@color/fontColorWhite"
|
||||
android:pathData="M12,12c2.21,0 4,-1.79 4,-4s-1.79,-4 -4,-4 -4,1.79 -4,4 1.79,4 4,4zM12,14c-2.67,0 -8,1.34 -8,4v2h16v-2c0,-2.66 -5.33,-4 -8,-4z"/>
|
||||
</vector>
|
|
@ -0,0 +1,42 @@
|
|||
package com.adins.mss.base.dynamicform;
|
||||
|
||||
import com.adins.mss.foundation.questiongenerator.QuestionBean;
|
||||
|
||||
/**
|
||||
* Created by gigin.ginanjar on 18/07/2016.
|
||||
*/
|
||||
public class QuestionGroup {
|
||||
private String question_group_id;
|
||||
private String question_group_name;
|
||||
private Integer question_group_order;
|
||||
|
||||
public QuestionGroup(QuestionBean bean) {
|
||||
this.question_group_id = bean.getQuestion_group_id();
|
||||
this.question_group_name = bean.getQuestion_group_name();
|
||||
this.question_group_order = bean.getQuestion_group_order();
|
||||
}
|
||||
|
||||
public String getQuestion_group_id() {
|
||||
return question_group_id;
|
||||
}
|
||||
|
||||
public void setQuestion_group_id(String question_group_id) {
|
||||
this.question_group_id = question_group_id;
|
||||
}
|
||||
|
||||
public String getQuestion_group_name() {
|
||||
return question_group_name;
|
||||
}
|
||||
|
||||
public void setQuestion_group_name(String question_group_name) {
|
||||
this.question_group_name = question_group_name;
|
||||
}
|
||||
|
||||
public Integer getQuestion_group_order() {
|
||||
return question_group_order;
|
||||
}
|
||||
|
||||
public void setQuestion_group_order(Integer question_group_order) {
|
||||
this.question_group_order = question_group_order;
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 7.1 KiB |
|
@ -0,0 +1,322 @@
|
|||
package com.services;
|
||||
|
||||
import android.app.IntentService;
|
||||
import android.app.Service;
|
||||
import android.content.Intent;
|
||||
import android.os.IBinder;
|
||||
import androidx.annotation.Keep;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.NewMainActivity;
|
||||
import com.adins.mss.base.crashlytics.FireCrash;
|
||||
import com.adins.mss.base.dynamicform.TaskManager;
|
||||
import com.adins.mss.base.mainmenu.MainMenuActivity;
|
||||
import com.adins.mss.base.util.EventBusHelper;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.dao.PrintDate;
|
||||
import com.adins.mss.dao.TaskH;
|
||||
import com.adins.mss.foundation.db.dataaccess.GeneralParameterDataAccess;
|
||||
import com.adins.mss.foundation.db.dataaccess.PrintDateDataAccess;
|
||||
import com.adins.mss.foundation.db.dataaccess.TaskHDataAccess;
|
||||
import com.adins.mss.foundation.http.ForceLogoutResponse;
|
||||
import com.adins.mss.foundation.print.rv.ApiCodes;
|
||||
import com.adins.mss.foundation.print.rv.RVNumberResponse;
|
||||
import com.adins.mss.logger.Logger;
|
||||
|
||||
|
||||
/**
|
||||
* An {@link IntentService} subclass for handling asynchronous task requests in
|
||||
* a service on a separate handler thread.
|
||||
* <p/>
|
||||
* TODO: Customize class - update intent actions and extra parameters.
|
||||
*/
|
||||
public class MainServices extends Service {
|
||||
public static final String ACTION_GET_NOTIFICATION_THREAD = "ACTION_GET_NOTIFICATION_THREAD";
|
||||
// TODO: Rename actions, choose action names that describe tasks that this
|
||||
// IntentService can perform, e.g. ACTION_FETCH_NEW_ITEMS
|
||||
private static final String ACTION_TASKLIST = "com.services.action.TaskList";
|
||||
private static final String ACTION_AUTO_SEND_TASK = "com.services.action.AutoSendTask";
|
||||
private static final String ACTION_AUTO_SEND_IMAGE = "com.services.action.AutoSendImage";
|
||||
// TODO: Rename parameters
|
||||
private static final String EXTRA_PARAM1 = "com.services.extra.PARAM1";
|
||||
private static final String EXTRA_PARAM2 = "com.services.extra.PARAM2";
|
||||
|
||||
public static NotificationThread taskListThread;
|
||||
public static AutoSendTaskThread autoSendTaskThread;
|
||||
public static AutoSendImageThread autoSendImageThread;
|
||||
public static AutoSendRVNumberThread autoSendRVNumberThread;
|
||||
public static SurveyAssignmentThread assignmentThread;
|
||||
public static PrintSubmitThread printSubmitThread;
|
||||
public static Class mainClass;
|
||||
|
||||
public MainServices() {
|
||||
}
|
||||
|
||||
public static void stopAllThread() {
|
||||
stopTaskListThread();
|
||||
stopAutoSendTaskThread();
|
||||
stopAutoSendImageThread();
|
||||
stopAssignmentThread();
|
||||
stopPrintSubmitThread();
|
||||
stopSendRVNumberThread();
|
||||
}
|
||||
|
||||
private static synchronized void stopTaskListThread() {
|
||||
if (taskListThread != null) {
|
||||
taskListThread.requestStop();
|
||||
taskListThread = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static synchronized void stopAutoSendTaskThread() {
|
||||
if (autoSendTaskThread != null) {
|
||||
autoSendTaskThread.requestStop();
|
||||
autoSendTaskThread = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static synchronized void stopAutoSendImageThread() {
|
||||
if (autoSendImageThread != null) {
|
||||
autoSendImageThread.requestStop();
|
||||
autoSendImageThread = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static synchronized void stopAssignmentThread() {
|
||||
if (assignmentThread != null) {
|
||||
assignmentThread.requestStop();
|
||||
assignmentThread.interrupt();
|
||||
}
|
||||
|
||||
assignmentThread = null;
|
||||
}
|
||||
|
||||
public static synchronized void stopSendRVNumberThread() {
|
||||
if (autoSendRVNumberThread != null) {
|
||||
autoSendRVNumberThread.interrupt();
|
||||
}
|
||||
|
||||
autoSendRVNumberThread = null;
|
||||
}
|
||||
|
||||
public static synchronized void stopPrintSubmitThread() {
|
||||
if (printSubmitThread != null) {
|
||||
printSubmitThread.requestStop();
|
||||
printSubmitThread.interrupt();
|
||||
printSubmitThread = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
EventBusHelper.registerEventBus(this);
|
||||
GlobalData.getSharedGlobalData();
|
||||
if (GlobalData.getSharedGlobalData().getUser() == null) {
|
||||
NewMainActivity.InitializeGlobalDataIfError(getApplicationContext());
|
||||
}
|
||||
try {
|
||||
handleActionTaskList();
|
||||
if (!GeneralParameterDataAccess.getOne(getApplicationContext(), GlobalData.getSharedGlobalData().getUser().getUuid_user(), "PRM03_ASIN").getGs_value().equals("0")) {
|
||||
handleActionAutoSendTask();
|
||||
if (TaskManager.isPartial(getApplicationContext()) == true) {
|
||||
handleActionAutoSendImage();
|
||||
}
|
||||
startAssignmentThread();
|
||||
startPrintSubmitThread();
|
||||
boolean isRVinFront = GeneralParameterDataAccess.isRvInFrontEnable(getApplicationContext(), GlobalData.getSharedGlobalData().getUser().getUuid_user());
|
||||
if (isRVinFront && Global.APPLICATION_COLLECTION.equalsIgnoreCase(GlobalData.getSharedGlobalData().getApplication())) {
|
||||
startSendRVNumberThread();
|
||||
}
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle action TaskList in the provided background thread with the provided
|
||||
* parameters.
|
||||
*/
|
||||
private void handleActionTaskList() {
|
||||
// TODO: Handle action TaskList
|
||||
startTaskListThread();
|
||||
// throw new UnsupportedOperationException("Not yet implemented");
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle action AutoSendTask in the provided background thread with the provided
|
||||
* parameters.
|
||||
*/
|
||||
private void handleActionAutoSendTask() {
|
||||
// TODO: Handle action AutoSendTask
|
||||
startAutoSendTaskThread();
|
||||
// throw new UnsupportedOperationException("Not yet implemented");
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle action AutoSendTask in the provided background thread with the provided
|
||||
* parameters.
|
||||
*/
|
||||
private void handleActionAutoSendImage() {
|
||||
// TODO: Handle action AutoSendTask
|
||||
startAutoSendImageThread();
|
||||
// throw new UnsupportedOperationException("Not yet implemented");
|
||||
}
|
||||
|
||||
@Keep // subcribe
|
||||
public void onEvent(@NonNull MainServiceEvent event) {
|
||||
Logger.d(this, "onEvent : " + event.getClass().getSimpleName() + " : " + event.toString());
|
||||
|
||||
switch (event.getmState()) {
|
||||
case TASK_DATA_ACCESS_STOP_WAIT:
|
||||
if (taskListThread != null) taskListThread.stopWaiting();
|
||||
if (autoSendTaskThread != null) autoSendTaskThread.stopWaiting();
|
||||
if (autoSendImageThread != null) autoSendImageThread.stopWaiting();
|
||||
break;
|
||||
case TASK_DATA_ACCESS_WAIT:
|
||||
if (taskListThread != null) taskListThread.requestWait();
|
||||
if (autoSendTaskThread != null) autoSendTaskThread.requestWait();
|
||||
if (autoSendImageThread != null) autoSendImageThread.requestWait();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Keep // subcribe
|
||||
public void onEvent(PrintDate task) {
|
||||
Logger.d(this, "onEvent: " + task);
|
||||
|
||||
startPrintSubmitThread();
|
||||
}
|
||||
|
||||
@Keep // subcribe
|
||||
public void onEvent(RVNumberResponse response) {
|
||||
Logger.d(this, "onEvent : " + response.toString());
|
||||
|
||||
if (response.getReqCode() == ApiCodes.RV_NUMBER_AUTO_SEND) {
|
||||
boolean isRVinFront = GeneralParameterDataAccess.isRvInFrontEnable(getApplicationContext(), GlobalData.getSharedGlobalData().getUser().getUuid_user());
|
||||
if (isRVinFront)
|
||||
startSendRVNumberThread();
|
||||
}
|
||||
}
|
||||
|
||||
@Keep // subcribe
|
||||
public void onEvent(ForceLogoutResponse response) {
|
||||
stopAllThread();
|
||||
stopSelf();
|
||||
}
|
||||
|
||||
@Keep
|
||||
public void onEvent(String action) {
|
||||
if (action.equals(ACTION_GET_NOTIFICATION_THREAD)) {
|
||||
startTaskListThread();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
EventBusHelper.unregisterEventBus(this);
|
||||
stopAllThread();
|
||||
}
|
||||
|
||||
public void stopMainServices() {
|
||||
stopSelf();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
return null;
|
||||
}
|
||||
|
||||
private synchronized void startTaskListThread() {
|
||||
if (taskListThread == null) {
|
||||
taskListThread = new NotificationThread(getApplicationContext(),this);
|
||||
taskListThread.start();
|
||||
} else {
|
||||
if (!taskListThread.isAlive()) {
|
||||
taskListThread.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized void startAutoSendTaskThread() {
|
||||
if (autoSendTaskThread == null) {
|
||||
autoSendTaskThread = new AutoSendTaskThread(getApplicationContext(),this);
|
||||
autoSendTaskThread.start();
|
||||
} else {
|
||||
if (!autoSendTaskThread.isAlive())
|
||||
autoSendTaskThread.start();
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized void startAutoSendImageThread() {
|
||||
if (autoSendImageThread == null) {
|
||||
autoSendImageThread = new AutoSendImageThread(getApplicationContext(),this);
|
||||
autoSendImageThread.start();
|
||||
} else {
|
||||
if (!autoSendImageThread.isAlive())
|
||||
autoSendImageThread.start();
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void startAssignmentThread() {
|
||||
if (GlobalData.getSharedGlobalData() != null && GlobalData.getSharedGlobalData().getApplication() != null &&
|
||||
GlobalData.getSharedGlobalData().getApplication().equals(Global.APPLICATION_SURVEY)) {
|
||||
if (NewMainActivity.mnSurveyAssign != null) {
|
||||
if (assignmentThread == null) {
|
||||
assignmentThread = new SurveyAssignmentThread(getApplicationContext());
|
||||
assignmentThread.start();
|
||||
}
|
||||
|
||||
if (!assignmentThread.isAlive()) {
|
||||
assignmentThread.start();
|
||||
Logger.d(this, "start assignmentThread");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void startSendRVNumberThread() {
|
||||
if (GlobalData.getSharedGlobalData() != null && GlobalData.getSharedGlobalData().getApplication() != null &&
|
||||
GlobalData.getSharedGlobalData().getApplication().equals(Global.APPLICATION_COLLECTION)) {
|
||||
String uuidUser = GlobalData.getSharedGlobalData().getUser()
|
||||
.getUuid_user();
|
||||
TaskH taskH = TaskHDataAccess.getOneTaskByStatusRV(getApplicationContext(),
|
||||
uuidUser, TaskHDataAccess.STATUS_RV_PENDING);
|
||||
if (taskH != null) {
|
||||
if (autoSendRVNumberThread == null) {
|
||||
autoSendRVNumberThread = new AutoSendRVNumberThread(getApplicationContext());
|
||||
autoSendRVNumberThread.start();
|
||||
} else {
|
||||
try {
|
||||
if (!autoSendRVNumberThread.isAlive()) {
|
||||
autoSendRVNumberThread.start();
|
||||
Logger.d(this, "start autoSendRVNumberThread");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
Logger.printStackTrace(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void startPrintSubmitThread() {
|
||||
if (GlobalData.getSharedGlobalData() != null && GlobalData.getSharedGlobalData().getApplication() != null &&
|
||||
GlobalData.getSharedGlobalData().getApplication().equals("MC")) {
|
||||
stopPrintSubmitThread();
|
||||
if (PrintDateDataAccess.getAll(getApplicationContext()) != null) {
|
||||
printSubmitThread = new PrintSubmitThread(getApplicationContext());
|
||||
printSubmitThread.start();
|
||||
Logger.d(this, "start printSubmitThread");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/login_color" />
|
||||
|
||||
<stroke
|
||||
android:width="2dp"
|
||||
android:color="@android:color/transparent" />
|
||||
<padding
|
||||
android:bottom="1dp"
|
||||
android:left="1dp"
|
||||
android:right="1dp"
|
||||
android:top="1dp" />
|
||||
|
||||
<corners
|
||||
android:bottomLeftRadius="40dp"
|
||||
android:bottomRightRadius="40dp"
|
||||
android:topLeftRadius="40dp"
|
||||
android:topRightRadius="40dp" />
|
||||
</shape>
|
|
@ -0,0 +1,133 @@
|
|||
/*
|
||||
* Copyright 2010 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.collector;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.format.Time;
|
||||
|
||||
import org.acra.ACRA;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static org.acra.ACRA.LOG_TAG;
|
||||
|
||||
/**
|
||||
* Collects data from the DropBoxManager introduced with Android API Level 8. A
|
||||
* set of DropBox tags have been identified in the Android source code. , we
|
||||
* collect data associated to these tags with hope that some of them could help
|
||||
* debugging applications. Application specific tags can be provided by the app
|
||||
* dev to track his own usage of the DropBoxManager.
|
||||
*
|
||||
* @author Kevin Gaudin
|
||||
*/
|
||||
final class DropBoxCollector {
|
||||
|
||||
private static final String[] SYSTEM_TAGS = {"system_app_anr", "system_app_wtf", "system_app_crash",
|
||||
"system_server_anr", "system_server_wtf", "system_server_crash", "BATTERY_DISCHARGE_INFO",
|
||||
"SYSTEM_RECOVERY_LOG", "SYSTEM_BOOT", "SYSTEM_LAST_KMSG", "APANIC_CONSOLE", "APANIC_THREADS",
|
||||
"SYSTEM_RESTART", "SYSTEM_TOMBSTONE", "data_app_strictmode"};
|
||||
|
||||
private static final String NO_RESULT = "N/A";
|
||||
|
||||
/**
|
||||
* Read latest messages contained in the DropBox for system related tags and
|
||||
* optional developer-set tags.
|
||||
*
|
||||
* @param context The application context.
|
||||
* @param additionalTags An array of tags provided by the application developer.
|
||||
* @return A readable formatted String listing messages retrieved.
|
||||
*/
|
||||
public static String read(Context context, String[] additionalTags) {
|
||||
try {
|
||||
// Use reflection API to allow compilation with API Level 5.
|
||||
final String serviceName = Compatibility.getDropBoxServiceName();
|
||||
if (serviceName == null) {
|
||||
return NO_RESULT;
|
||||
}
|
||||
|
||||
final Object dropbox = context.getSystemService(serviceName);
|
||||
final Method getNextEntry = dropbox.getClass().getMethod("getNextEntry", String.class, long.class);
|
||||
if (getNextEntry == null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
final Time timer = new Time();
|
||||
timer.setToNow();
|
||||
timer.second -= ACRA.getConfig().dropboxCollectionMinutes();
|
||||
timer.normalize(false);
|
||||
final long time = timer.toMillis(false);
|
||||
|
||||
final List<String> tags = new ArrayList<String>();
|
||||
if (ACRA.getConfig().includeDropBoxSystemTags()) {
|
||||
tags.addAll(Arrays.asList(SYSTEM_TAGS));
|
||||
}
|
||||
if (additionalTags != null && additionalTags.length > 0) {
|
||||
tags.addAll(Arrays.asList(additionalTags));
|
||||
}
|
||||
|
||||
if (tags.isEmpty()) {
|
||||
return "No tag configured for collection.";
|
||||
}
|
||||
|
||||
final StringBuilder dropboxContent = new StringBuilder();
|
||||
for (String tag : tags) {
|
||||
dropboxContent.append("Tag: ").append(tag).append('\n');
|
||||
Object entry = getNextEntry.invoke(dropbox, tag, time);
|
||||
if (entry == null) {
|
||||
dropboxContent.append("Nothing.").append('\n');
|
||||
continue;
|
||||
}
|
||||
|
||||
final Method getText = entry.getClass().getMethod("getText", int.class);
|
||||
final Method getTimeMillis = entry.getClass().getMethod("getTimeMillis", (Class[]) null);
|
||||
final Method close = entry.getClass().getMethod("close", (Class[]) null);
|
||||
while (entry != null) {
|
||||
final long msec = (Long) getTimeMillis.invoke(entry, (Object[]) null);
|
||||
timer.set(msec);
|
||||
dropboxContent.append("@").append(timer.format2445()).append('\n');
|
||||
final String text = (String) getText.invoke(entry, 500);
|
||||
if (text != null) {
|
||||
dropboxContent.append("Text: ").append(text).append('\n');
|
||||
} else {
|
||||
dropboxContent.append("Not Text!").append('\n');
|
||||
}
|
||||
close.invoke(entry, (Object[]) null);
|
||||
entry = getNextEntry.invoke(dropbox, tag, msec);
|
||||
}
|
||||
}
|
||||
return dropboxContent.toString();
|
||||
|
||||
} catch (SecurityException e) {
|
||||
ACRA.log.i(LOG_TAG, "DropBoxManager not available.");
|
||||
} catch (NoSuchMethodException e) {
|
||||
ACRA.log.i(LOG_TAG, "DropBoxManager not available.");
|
||||
} catch (IllegalArgumentException e) {
|
||||
ACRA.log.i(LOG_TAG, "DropBoxManager not available.");
|
||||
} catch (IllegalAccessException e) {
|
||||
ACRA.log.i(LOG_TAG, "DropBoxManager not available.");
|
||||
} catch (InvocationTargetException e) {
|
||||
ACRA.log.i(LOG_TAG, "DropBoxManager not available.");
|
||||
} catch (NoSuchFieldException e) {
|
||||
ACRA.log.i(LOG_TAG, "DropBoxManager not available.");
|
||||
}
|
||||
|
||||
return NO_RESULT;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="14dp"
|
||||
android:height="14dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="@color/gradient_end"
|
||||
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM6.5,9L10,5.5 13.5,9L11,9v4L9,13L9,9L6.5,9zM17.5,15L14,18.5 10.5,15L13,15v-4h2v4h2.5z"/>
|
||||
</vector>
|
Loading…
Add table
Add a link
Reference in a new issue