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,179 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context="com.adins.mss.base.DeveloperOptionActivity">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/scrollView"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_above="@+id/btnSave"
|
||||
android:layout_alignParentTop="true">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="Encrypt and decrypt options:"
|
||||
android:id="@+id/textView14"
|
||||
android:layout_marginBottom="8dp" />
|
||||
|
||||
<Switch
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Encrypt Connection"
|
||||
android:id="@+id/switchEncrypt"
|
||||
android:checked="false"
|
||||
android:layout_margin="4dp" />
|
||||
<Switch
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Decrypt Connection"
|
||||
android:id="@+id/switchDecrypt"
|
||||
android:checked="false"
|
||||
android:layout_margin="4dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:text="Encrypt Option :"
|
||||
android:visibility="gone"
|
||||
android:id="@+id/textView" />
|
||||
|
||||
<RadioGroup
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<RadioButton
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Yes"
|
||||
android:id="@+id/rdEncryptYes"
|
||||
android:checked="false" />
|
||||
|
||||
<RadioButton
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="No"
|
||||
android:id="@+id/rdEncryptNo"
|
||||
android:checked="true" />
|
||||
|
||||
</RadioGroup>
|
||||
|
||||
<TextView
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:text="Decrypt Option :"
|
||||
android:id="@+id/textView12" />
|
||||
|
||||
<RadioGroup
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<RadioButton
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Yes"
|
||||
android:id="@+id/rdDecryptYes"
|
||||
android:checked="false" />
|
||||
|
||||
<RadioButton
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="No"
|
||||
android:id="@+id/rdDecryptNo"
|
||||
android:checked="true" />
|
||||
</RadioGroup>
|
||||
<View
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="3dp"
|
||||
android:background="@color/tv_normal"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="Access Token Options:"
|
||||
android:id="@+id/textView11"
|
||||
android:layout_marginBottom="8dp" />
|
||||
|
||||
<Switch
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Using Access Token"
|
||||
android:id="@+id/switchAccessToken"
|
||||
android:checked="false"
|
||||
android:layout_margin="4dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layoutClientId"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:weightSum="1"
|
||||
android:layout_margin="4dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:text="Client ID : "
|
||||
android:id="@+id/txtClientId" />
|
||||
|
||||
<EditText
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/edtClientId"
|
||||
android:layout_gravity=""/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
<View
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="3dp"
|
||||
android:background="@color/tv_normal"/>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
<Button
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Save"
|
||||
android:id="@+id/btnSave"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true" />
|
||||
|
||||
</RelativeLayout>
|
|
@ -0,0 +1,626 @@
|
|||
package com.adins.mss.base.timeline;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.R;
|
||||
import com.adins.mss.base.R.anim;
|
||||
import com.adins.mss.base.crashlytics.FireCrash;
|
||||
import com.adins.mss.base.dynamicform.CustomerFragment;
|
||||
import com.adins.mss.base.dynamicform.SurveyHeaderBean;
|
||||
import com.adins.mss.base.mainmenu.MainMenuActivity;
|
||||
import com.adins.mss.base.tasklog.LogResultActivity;
|
||||
import com.adins.mss.base.tasklog.TaskLogListTask;
|
||||
import com.adins.mss.base.timeline.activity.Timeline_Activity;
|
||||
import com.adins.mss.base.timeline.comment.activity.CommentActivity;
|
||||
import com.adins.mss.base.todolist.form.StatusSectionFragment;
|
||||
import com.adins.mss.base.todolist.form.TaskListFragment_new;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.dao.TaskH;
|
||||
import com.adins.mss.dao.Timeline;
|
||||
import com.adins.mss.foundation.db.dataaccess.GeneralParameterDataAccess;
|
||||
import com.adins.mss.foundation.db.dataaccess.TaskHDataAccess;
|
||||
import com.adins.mss.foundation.dialog.DialogManager;
|
||||
import com.adins.mss.foundation.dialog.NiftyDialogBuilder;
|
||||
import com.adins.mss.foundation.formatter.Formatter;
|
||||
import com.adins.mss.foundation.formatter.Tool;
|
||||
import com.adins.mss.foundation.image.Utils;
|
||||
import com.androidquery.AQuery;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class TimelineArrayAdapter extends ArrayAdapter<Timeline> {
|
||||
|
||||
protected AQuery query;
|
||||
FragmentActivity mainActivity;
|
||||
Fragment endFragment;
|
||||
Fragment taskListFragment;
|
||||
Fragment logFragment;
|
||||
Fragment customerFragment;
|
||||
int content_frame;
|
||||
private Context mContext;
|
||||
private List<Timeline> objects = null;
|
||||
private int color = Color.BLACK;
|
||||
private ArrayList<Timeline> objectSort = new ArrayList<>();
|
||||
|
||||
public TimelineArrayAdapter(Context context,
|
||||
List<Timeline> objects) {
|
||||
super(context, R.layout.timeline_item_layout, objects);
|
||||
this.mContext = context;
|
||||
this.objects = objects;
|
||||
for (int i = objects.size() - 1; i >= 0; i--) {
|
||||
Timeline object = objects.get(i);
|
||||
objectSort.add(object);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public TimelineArrayAdapter(FragmentActivity mainActivity, Fragment endFragment, int contentFrame,
|
||||
List<Timeline> objects, int color) {
|
||||
super(mainActivity, R.layout.timeline_item_layout, objects);
|
||||
this.objects = objects;
|
||||
this.color = color;
|
||||
this.mContext = mainActivity;
|
||||
this.mainActivity = mainActivity;
|
||||
this.endFragment = endFragment;
|
||||
this.content_frame = contentFrame;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
int count = 0;
|
||||
if (objects.isEmpty())
|
||||
count = 1;
|
||||
else
|
||||
count = objects.size();
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||
|
||||
if (null == convertView) {
|
||||
convertView = LayoutInflater.from(getContext()).inflate(R.layout.timeline_item_layout, parent, false);
|
||||
}
|
||||
query = new AQuery(convertView);
|
||||
|
||||
if (objects.isEmpty()) {
|
||||
getLayoutIfDataNotFound();
|
||||
} else {
|
||||
final String timeline_type;
|
||||
final String description;
|
||||
String str_dtm_crt = "";
|
||||
|
||||
final Timeline timeline = objectSort.get(position);
|
||||
final String uuid_timeline = timeline.getUuid_timeline();
|
||||
description = timeline.getDescription();
|
||||
final String latitude = timeline.getLatitude();
|
||||
final String longitude = timeline.getLongitude();
|
||||
Date dtm_crt = timeline.getDtm_crt();
|
||||
Date today = Tool.getSystemDate();
|
||||
Date now = new Date();
|
||||
try {
|
||||
if (dtm_crt.before(today)) {
|
||||
str_dtm_crt = Formatter.formatDate(dtm_crt, Global.DATE_TIMESEC_TIMELINE_FORMAT_OLD);
|
||||
} else {
|
||||
long times = now.getTime() - dtm_crt.getTime();
|
||||
if (times < 60000) {
|
||||
str_dtm_crt = mContext.getString(R.string.moment_ago);
|
||||
} else if (times < 3600000) {
|
||||
times = times / 60000;
|
||||
str_dtm_crt = times + " " + mContext.getString(R.string.minute_ago);
|
||||
} else {
|
||||
times = times / 3600000;
|
||||
str_dtm_crt = times + " " + mContext.getString(R.string.hour_ago);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
}
|
||||
final String uuid_task_h = timeline.getUuid_task_h();
|
||||
timeline_type = timeline.getTimelineType().getTimeline_type();
|
||||
byte[] byte_bitmap = timeline.getByte_image();
|
||||
Bitmap bm = null;
|
||||
if (byte_bitmap != null) {
|
||||
try {
|
||||
bm = Utils.byteToBitmap(byte_bitmap);
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
String timeline_type_txt = "";
|
||||
if (timeline_type.equals(Global.TIMELINE_TYPE_APPROVAL)) {
|
||||
timeline_type_txt = mContext.getString(R.string.timeline_type_approval);
|
||||
} else if (timeline_type.equals(Global.TIMELINE_TYPE_APPROVED)) {
|
||||
timeline_type_txt = mContext.getString(R.string.timeline_type_approved);
|
||||
} else if (timeline_type.equals(Global.TIMELINE_TYPE_CHECKIN)) {
|
||||
timeline_type_txt = mContext.getString(R.string.timeline_type_checkin);
|
||||
} else if (timeline_type.equals(Global.TIMELINE_TYPE_MESSAGE)) {
|
||||
timeline_type_txt = mContext.getString(R.string.timeline_type_message);
|
||||
} else if (timeline_type.equals(Global.TIMELINE_TYPE_TASK)) {
|
||||
timeline_type_txt = mContext.getString(R.string.timeline_type_task);
|
||||
} else if (timeline_type.equals(Global.TIMELINE_TYPE_REJECTED)) {
|
||||
timeline_type_txt = mContext.getString(R.string.timeline_type_rejected);
|
||||
} else if (timeline_type.equals(Global.TIMELINE_TYPE_SUBMITTED)) {
|
||||
timeline_type_txt = mContext.getString(R.string.timeline_type_submitted);
|
||||
} else if (timeline_type.equals(Global.TIMELINE_TYPE_VERIFICATION)) {
|
||||
timeline_type_txt = mContext.getString(R.string.timeline_type_verification);
|
||||
} else if (timeline_type.equals(Global.TIMELINE_TYPE_VERIFIED)) {
|
||||
timeline_type_txt = mContext.getString(R.string.timeline_type_verified);
|
||||
} else if (timeline_type.equals(Global.TIMELINE_TYPE_UPLOADING)) {
|
||||
timeline_type_txt = mContext.getString(R.string.timeline_type_uploading);
|
||||
} else if (timeline_type.equals(Global.TIMELINE_TYPE_PENDING)) {
|
||||
timeline_type_txt = mContext.getString(R.string.timeline_type_pending);
|
||||
}
|
||||
query.id(R.id.txtTitle).text(timeline_type_txt).visibility(View.VISIBLE);
|
||||
query.id(R.id.txtDesc).text(description).visibility(View.VISIBLE);
|
||||
query.id(R.id.txtTime).text(str_dtm_crt).visibility(View.VISIBLE);
|
||||
query.id(R.id.buttonLayout).visibility(View.GONE);
|
||||
query.id(R.id.txtComment).visibility(View.VISIBLE);
|
||||
|
||||
try {
|
||||
if (Global.TIMELINE_TYPE_CHECKIN.equals(timeline_type) || Global.TIMELINE_TYPE_CHECKOUT.equals(timeline_type)) {
|
||||
try {
|
||||
if (bm != null)
|
||||
query.id(R.id.timelineImage).visibility(View.VISIBLE).image(bm);
|
||||
else
|
||||
query.id(R.id.timelineImage).visibility(View.VISIBLE).image(R.drawable.img_notavailable);
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
|
||||
}
|
||||
} else {
|
||||
query.id(R.id.timelineImage).visibility(View.GONE);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
}
|
||||
|
||||
|
||||
setTitleClick(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (MainMenuActivity.Force_Uninstall) {
|
||||
DialogManager.UninstallerHandler(mainActivity);
|
||||
} else {
|
||||
if (Global.TIMELINE_TYPE_MESSAGE.equals(timeline_type)) {
|
||||
NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(mContext);
|
||||
dialogBuilder.withTitle(timeline_type)
|
||||
.withMessage(description)
|
||||
.show();
|
||||
} else if (isLog(timeline_type)) {
|
||||
try {
|
||||
TaskH taskH = timeline.getTaskH();
|
||||
String taskId = taskH.getTask_id();
|
||||
taskH = TaskHDataAccess.getOneTaskHeader(mContext, taskId);
|
||||
String status = taskH.getStatus();
|
||||
if (Global.TIMELINE_TYPE_PENDING.equals(timeline_type) || Global.TIMELINE_TYPE_UPLOADING.equals(timeline_type) && status.equals(TaskHDataAccess.STATUS_SEND_UPLOADING)) {
|
||||
String application = GlobalData.getSharedGlobalData().getAuditData().getApplication();
|
||||
Fragment fragment = new Fragment();
|
||||
Bundle argument = new Bundle();
|
||||
if (Global.APPLICATION_ORDER.equalsIgnoreCase(application)) {
|
||||
fragment = new StatusSectionFragment();
|
||||
} else if (Global.APPLICATION_COLLECTION.equalsIgnoreCase(application) || Global.APPLICATION_SURVEY.equalsIgnoreCase(application)) {
|
||||
fragment = new TaskListFragment_new();
|
||||
argument.putString("status", "failed");
|
||||
}
|
||||
try {
|
||||
fragment.setArguments(argument);
|
||||
FragmentTransaction transaction = MainMenuActivity.fragmentManager.beginTransaction();
|
||||
transaction.setCustomAnimations(R.anim.activity_open_translate, R.anim.activity_close_scale, R.anim.activity_open_scale, R.anim.activity_close_translate);
|
||||
transaction.replace(R.id.content_frame, fragment);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
}
|
||||
} else {
|
||||
TaskLogListTask task = new TaskLogListTask(mainActivity, getContext().getString(R.string.progressWait),
|
||||
getContext().getString(R.string.msgNoSent), content_frame, new LogResultActivity());
|
||||
task.execute();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(mContext);
|
||||
dialogBuilder.withTitle(mContext.getString(R.string.info_capital))
|
||||
.withIcon(android.R.drawable.ic_dialog_info)
|
||||
.withMessage(mContext.getString(R.string.task_not_available))
|
||||
.show();
|
||||
}
|
||||
} else if (Global.TIMELINE_TYPE_TASK.equals(timeline_type)) {
|
||||
try {
|
||||
Fragment fragment = new TaskListFragment_new();
|
||||
Bundle argument = new Bundle();
|
||||
argument.putBoolean(Global.BUND_KEY_ISERROR, false);
|
||||
argument.putString(Global.BUND_KEY_MESSAGE, "");
|
||||
fragment.setArguments(argument);
|
||||
FragmentTransaction transaction = MainMenuActivity.fragmentManager.beginTransaction();
|
||||
transaction.setCustomAnimations(R.anim.activity_open_translate, R.anim.activity_close_scale, R.anim.activity_open_scale, R.anim.activity_close_translate);
|
||||
transaction.replace(R.id.content_frame, fragment);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
}
|
||||
} else if (Global.TIMELINE_TYPE_APPROVAL.equals(timeline_type)) {
|
||||
try {
|
||||
if (Timeline_Activity.haveDoubleMenuApproval) {
|
||||
Fragment fragment1 = MainMenuActivity.getApprovalFragment();
|
||||
FragmentTransaction transaction = MainMenuActivity.fragmentManager.beginTransaction();
|
||||
transaction.setCustomAnimations(anim.activity_open_translate, anim.activity_close_scale);
|
||||
transaction.replace(R.id.content_frame, fragment1);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
} else {
|
||||
Fragment fragment1 = MainMenuActivity.getApprovalFragmentByBranch();
|
||||
FragmentTransaction transaction = MainMenuActivity.fragmentManager.beginTransaction();
|
||||
transaction.setCustomAnimations(anim.activity_open_translate, anim.activity_close_scale);
|
||||
transaction.replace(R.id.content_frame, fragment1);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
Fragment fragment1 = MainMenuActivity.getApprovalFragment();
|
||||
FragmentTransaction transaction = MainMenuActivity.fragmentManager.beginTransaction();
|
||||
transaction.setCustomAnimations(anim.activity_open_translate, anim.activity_close_scale);
|
||||
transaction.replace(R.id.content_frame, fragment1);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
}
|
||||
|
||||
} else if (Global.TIMELINE_TYPE_VERIFICATION.equals(timeline_type)) {
|
||||
try {
|
||||
if (Timeline_Activity.haveDoubleMenuVerify) {
|
||||
Fragment fragment1 = MainMenuActivity.getVerificationFragment();
|
||||
FragmentTransaction transaction = MainMenuActivity.fragmentManager.beginTransaction();
|
||||
transaction.setCustomAnimations(anim.activity_open_translate, anim.activity_close_scale);
|
||||
transaction.replace(R.id.content_frame, fragment1);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
} else {
|
||||
Fragment fragment1 = MainMenuActivity.getVerificationFragmentByBranch();
|
||||
FragmentTransaction transaction = MainMenuActivity.fragmentManager.beginTransaction();
|
||||
transaction.setCustomAnimations(anim.activity_open_translate, anim.activity_close_scale);
|
||||
transaction.replace(R.id.content_frame, fragment1);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
Fragment fragment1 = MainMenuActivity.getVerificationFragment();
|
||||
FragmentTransaction transaction = MainMenuActivity.fragmentManager.beginTransaction();
|
||||
transaction.setCustomAnimations(anim.activity_open_translate, anim.activity_close_scale);
|
||||
transaction.replace(R.id.content_frame, fragment1);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
setDescriptionClick(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
if (MainMenuActivity.Force_Uninstall) {
|
||||
DialogManager.UninstallerHandler(mainActivity);
|
||||
} else {
|
||||
if (Global.TIMELINE_TYPE_MESSAGE.equals(timeline_type)) {
|
||||
NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(mContext);
|
||||
dialogBuilder.withTitle(timeline_type)
|
||||
.withMessage(description)
|
||||
.show();
|
||||
} else if (isLog(timeline_type)) {
|
||||
TaskH taskH = timeline.getTaskH();
|
||||
if (taskH != null) {
|
||||
try {
|
||||
String taskId = taskH.getTask_id();
|
||||
taskH = TaskHDataAccess.getOneTaskHeader(mContext, taskId);
|
||||
if (taskH.getScheme() != null) {
|
||||
SurveyHeaderBean header = new SurveyHeaderBean(taskH);
|
||||
Fragment fragment = CustomerFragment.create(header);
|
||||
FragmentTransaction transaction = MainMenuActivity.fragmentManager.beginTransaction();
|
||||
transaction.setCustomAnimations(R.anim.activity_open_translate, R.anim.activity_close_scale, R.anim.activity_open_scale, R.anim.activity_close_translate);
|
||||
transaction.replace(R.id.content_frame, fragment);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
MainMenuActivity.tempPosition = 0;
|
||||
} else {
|
||||
NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(mContext);
|
||||
dialogBuilder.withTitle(mContext.getString(R.string.info_capital))
|
||||
.withIcon(android.R.drawable.ic_dialog_info)
|
||||
.withMessage(mContext.getString(R.string.task_cant_seen))
|
||||
.show();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(mContext);
|
||||
dialogBuilder.withTitle(mContext.getString(R.string.info_capital))
|
||||
.withIcon(android.R.drawable.ic_dialog_info)
|
||||
.withMessage(mContext.getString(R.string.task_not_available))
|
||||
.show();
|
||||
}
|
||||
} else {
|
||||
NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(mContext);
|
||||
dialogBuilder.withTitle(mContext.getString(R.string.info_capital))
|
||||
.withIcon(android.R.drawable.ic_dialog_info)
|
||||
.withMessage(mContext.getString(R.string.task_not_available))
|
||||
.show();
|
||||
}
|
||||
} else if (Global.TIMELINE_TYPE_TASK.equals(timeline_type) ||
|
||||
Global.TIMELINE_TYPE_VERIFICATION.equals(timeline_type) ||
|
||||
Global.TIMELINE_TYPE_APPROVAL.equals(timeline_type)) {
|
||||
TaskH taskH = timeline.getTaskH();
|
||||
try {
|
||||
|
||||
String taskId = taskH.getTask_id();
|
||||
|
||||
TaskH nTaskH = TaskHDataAccess.getOneTaskHeader(mContext, taskId);
|
||||
if (Global.TIMELINE_TYPE_APPROVAL.equals(timeline_type))
|
||||
nTaskH = TaskHDataAccess.getOneHeader(mContext, uuid_task_h);
|
||||
|
||||
String appl = GlobalData.getSharedGlobalData().getAuditData().getApplication();
|
||||
if (Global.TIMELINE_TYPE_TASK.equals(timeline_type) && Global.APPLICATION_COLLECTION.equalsIgnoreCase(appl)) {
|
||||
String cashLimit = GlobalData.getSharedGlobalData().getUser().getCash_limit();
|
||||
double limit = cashLimit != null ? Double.parseDouble(cashLimit) : 0.0;
|
||||
String coh = GlobalData.getSharedGlobalData().getUser().getCash_on_hand();
|
||||
double cashOnHand = coh != null ? Double.parseDouble(coh) : 0.0;
|
||||
if (isCOHAktif() && limit > 0 && cashOnHand > limit) {
|
||||
DialogManager.showAlertNotif(mContext, mContext.getString(R.string.limit_coh), "Cash On Hand");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (nTaskH != null) {
|
||||
if (nTaskH.getScheme() != null) {
|
||||
SurveyHeaderBean header = new SurveyHeaderBean(nTaskH);
|
||||
Fragment fragment = CustomerFragment.create(header);
|
||||
FragmentTransaction transaction = MainMenuActivity.fragmentManager.beginTransaction();
|
||||
transaction.setCustomAnimations(R.anim.activity_open_translate, R.anim.activity_close_scale, R.anim.activity_open_scale, R.anim.activity_close_translate);
|
||||
transaction.replace(R.id.content_frame, fragment);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
MainMenuActivity.tempPosition = 0;
|
||||
} else {
|
||||
NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(mContext);
|
||||
dialogBuilder.withTitle(mContext.getString(R.string.info_capital))
|
||||
.withIcon(android.R.drawable.ic_dialog_info)
|
||||
.withMessage(mContext.getString(R.string.task_cant_seen))
|
||||
.show();
|
||||
}
|
||||
} else {
|
||||
String application = GlobalData.getSharedGlobalData().getAuditData().getApplication();
|
||||
if (Global.APPLICATION_SURVEY.equalsIgnoreCase(application)) {
|
||||
NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(mContext);
|
||||
dialogBuilder.withTitle(mContext.getString(R.string.warning_capital))
|
||||
.withIcon(android.R.drawable.ic_dialog_alert)
|
||||
.withMessage(mContext.getString(R.string.task_reassign_svy))
|
||||
.show();
|
||||
} else if (Global.APPLICATION_COLLECTION.equalsIgnoreCase(application)) {
|
||||
NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(mContext);
|
||||
dialogBuilder.withTitle(mContext.getString(R.string.warning_capital))
|
||||
.withIcon(android.R.drawable.ic_dialog_alert)
|
||||
.withMessage(mContext.getString(R.string.task_reassign_col))
|
||||
.show();
|
||||
} else {
|
||||
NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(mContext);
|
||||
dialogBuilder.withTitle(mContext.getString(R.string.warning_capital))
|
||||
.withIcon(android.R.drawable.ic_dialog_alert)
|
||||
.withMessage(mContext.getString(R.string.task_not_available2))
|
||||
.show();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
if (MainMenuActivity.mnSVYApproval != null) {
|
||||
if (Global.TIMELINE_TYPE_VERIFICATION.equals(timeline_type)) {
|
||||
NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(mContext);
|
||||
dialogBuilder.withTitle(mContext.getString(R.string.info_capital))
|
||||
.withIcon(android.R.drawable.ic_dialog_info)
|
||||
.withMessage(mContext.getString(R.string.task_verified))
|
||||
.show();
|
||||
}
|
||||
} else {
|
||||
String application = GlobalData.getSharedGlobalData().getAuditData().getApplication();
|
||||
if (Global.APPLICATION_SURVEY.equalsIgnoreCase(application)) {
|
||||
NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(mContext);
|
||||
dialogBuilder.withTitle(mContext.getString(R.string.warning_capital))
|
||||
.withIcon(android.R.drawable.ic_dialog_alert)
|
||||
.withMessage(mContext.getString(R.string.task_reassign_svy))
|
||||
.show();
|
||||
} else if (Global.APPLICATION_COLLECTION.equalsIgnoreCase(application)) {
|
||||
NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(mContext);
|
||||
dialogBuilder.withTitle(mContext.getString(R.string.warning_capital))
|
||||
.withIcon(android.R.drawable.ic_dialog_alert)
|
||||
.withMessage(mContext.getString(R.string.task_reassign_col))
|
||||
.show();
|
||||
} else {
|
||||
NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(mContext);
|
||||
dialogBuilder.withTitle(mContext.getString(R.string.warning_capital))
|
||||
.withIcon(android.R.drawable.ic_dialog_alert)
|
||||
.withMessage(mContext.getString(R.string.task_not_available2))
|
||||
.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (Global.TIMELINE_TYPE_APPROVED.equals(timeline_type)) {
|
||||
NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(mContext);
|
||||
dialogBuilder.withTitle(mContext.getString(R.string.info_capital))
|
||||
.withIcon(android.R.drawable.ic_dialog_info)
|
||||
.withMessage(mContext.getString(R.string.task_approved_view))
|
||||
.show();
|
||||
} else if (Global.TIMELINE_TYPE_REJECTED.equals(timeline_type)) {
|
||||
NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(mContext);
|
||||
dialogBuilder.withTitle(mContext.getString(R.string.info_capital))
|
||||
.withIcon(android.R.drawable.ic_dialog_info)
|
||||
.withMessage(mContext.getString(R.string.task_rejected_view))
|
||||
.show();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
setImageClick(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
if (MainMenuActivity.Force_Uninstall) {
|
||||
DialogManager.UninstallerHandler(mainActivity);
|
||||
} else {
|
||||
if (Global.TIMELINE_TYPE_CHECKIN.equals(timeline_type) || Global.TIMELINE_TYPE_CHECKOUT.equals(timeline_type)) {
|
||||
Intent intent = new Intent(mContext, MapsViewer.class);
|
||||
intent.putExtra("latitude", latitude);
|
||||
intent.putExtra("longitude", longitude);
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
setCommentClick(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
if (MainMenuActivity.Force_Uninstall) {
|
||||
DialogManager.UninstallerHandler(mainActivity);
|
||||
} else {
|
||||
Intent mIntent = new Intent(mainActivity, CommentActivity.class);
|
||||
Bundle mBundle = new Bundle();
|
||||
mBundle.putString(Constants.KEY_TIMELINE, uuid_timeline);
|
||||
mIntent.putExtras(mBundle);
|
||||
mainActivity.startActivity(mIntent);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return convertView;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method for set OnclickListener in Title of Timeline
|
||||
*
|
||||
* @param click - View OnclickListener
|
||||
* @return
|
||||
*/
|
||||
public TimelineArrayAdapter setTitleClick(View.OnClickListener click) {
|
||||
query.id(R.id.txtTitle).clicked(click);
|
||||
return this;
|
||||
}
|
||||
|
||||
private boolean isCOHAktif() {
|
||||
String parameter = GeneralParameterDataAccess.getOne(mContext, GlobalData.getSharedGlobalData().getUser().getUuid_user(),
|
||||
Global.GS_CASHONHAND).getGs_value();
|
||||
return parameter != null && parameter.equals(Global.TRUE_STRING);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method for set OnclickListener in Image of Timeline
|
||||
*
|
||||
* @param click - View OnclickListener
|
||||
* @return
|
||||
*/
|
||||
public TimelineArrayAdapter setImageClick(View.OnClickListener click) {
|
||||
query.id(R.id.timelineImage).clicked(click);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method for set OnclickListener in Description of Timeline
|
||||
*
|
||||
* @param click - View OnclickListener
|
||||
* @param click
|
||||
* @return
|
||||
*/
|
||||
public TimelineArrayAdapter setDescriptionClick(View.OnClickListener click) {
|
||||
query.id(R.id.txtDesc).clicked(click);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method for set OnclickListener in Button Comment of Timeline
|
||||
*
|
||||
* @param click - View OnclickListener
|
||||
* @return
|
||||
*/
|
||||
public TimelineArrayAdapter setCommentClick(View.OnClickListener click) {
|
||||
query.id(R.id.txtComment).clicked(click);
|
||||
return this;
|
||||
}
|
||||
|
||||
public TimelineArrayAdapter setTaskListFragment(Fragment taskListFragment) {
|
||||
this.taskListFragment = taskListFragment;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TimelineArrayAdapter setLogFragment(Fragment logFragment) {
|
||||
this.logFragment = logFragment;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TimelineArrayAdapter setCustomerFragment(Fragment customerFragment) {
|
||||
this.customerFragment = customerFragment;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TimelineArrayAdapter withColor(int color) {
|
||||
this.color = color;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TimelineArrayAdapter setContentFrame(int contentFrame) {
|
||||
this.content_frame = contentFrame;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TimelineArrayAdapter setMainFragment(FragmentActivity mainActivity) {
|
||||
this.mainActivity = mainActivity;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void getLayoutIfDataNotFound() {
|
||||
query.id(R.id.txtTitle).visibility(View.GONE);
|
||||
query.id(R.id.txtDesc).text(R.string.data_not_found).visibility(View.VISIBLE);
|
||||
query.id(R.id.txtTime).visibility(View.GONE);
|
||||
query.id(R.id.buttonLayout).visibility(View.GONE);
|
||||
query.id(R.id.txtComment).visibility(View.GONE);
|
||||
query.id(R.id.timelineImage).visibility(View.GONE);
|
||||
}
|
||||
|
||||
public void setData(List<Timeline> data) {
|
||||
clear();
|
||||
if (data != null) {
|
||||
objects = data;
|
||||
for (int i = objects.size() - 1; i >= 0; i--) {
|
||||
Timeline object = objects.get(i);
|
||||
objectSort.add(object);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isLog(String timeline_type) {
|
||||
return Global.TIMELINE_TYPE_SUBMITTED.equals(timeline_type)
|
||||
|| Global.TIMELINE_TYPE_VERIFIED.equals(timeline_type)
|
||||
|| Global.TIMELINE_TYPE_APPROVED.equals(timeline_type)
|
||||
|| Global.TIMELINE_TYPE_REJECTED.equals(timeline_type)
|
||||
|| Global.TIMELINE_TYPE_PENDING.equals(timeline_type)
|
||||
|| Global.TIMELINE_TYPE_UPLOADING.equals(timeline_type);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package com.services;
|
||||
|
||||
|
||||
import android.app.Service;
|
||||
import android.content.Intent;
|
||||
import android.os.IBinder;
|
||||
|
||||
public class AutoSendTaskService extends Service {
|
||||
private AutoSendTaskThread auto;
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
stopAutoSendThread();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
//TODO: auto = MainMenuActivity.autoSendTask;
|
||||
startAutoSendThread();
|
||||
}
|
||||
|
||||
public synchronized void startAutoSendThread() {
|
||||
if (auto == null) {
|
||||
auto = new AutoSendTaskThread(getApplicationContext(),this);
|
||||
auto.start();
|
||||
} else {
|
||||
auto.start();
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void stopAutoSendThread() {
|
||||
if (auto != null) {
|
||||
auto.requestStop();
|
||||
auto = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent arg0) {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,122 @@
|
|||
package com.adins.mss.odr.assignment;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.R;
|
||||
import com.adins.mss.base.mainmenu.MainMenuActivity;
|
||||
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.User;
|
||||
import com.adins.mss.foundation.dialog.NiftyDialogBuilder;
|
||||
import com.adins.mss.foundation.http.HttpConnectionResult;
|
||||
import com.adins.mss.foundation.http.HttpCryptedConnection;
|
||||
import com.adins.mss.odr.model.JsonRequestCheckOrder;
|
||||
import com.adins.mss.odr.model.JsonResponseServer;
|
||||
import com.google.firebase.perf.FirebasePerformance;
|
||||
import com.google.firebase.perf.metrics.HttpMetric;
|
||||
|
||||
public class OrderAssignmentTask extends AsyncTask<Void, Void, JsonResponseServer> {
|
||||
private ProgressDialog progressDialog;
|
||||
private Context context;
|
||||
private String messageWait;
|
||||
private String messageEmpty;
|
||||
private String errMessage = null;
|
||||
private FragmentActivity fragmentActivity;
|
||||
private int contentFrame;
|
||||
private User user = GlobalData.getSharedGlobalData().getUser();
|
||||
public OrderAssignmentTask(FragmentActivity fragmentActivity, String messageWait, String messageEmpty,int contentFrame){
|
||||
this.context=fragmentActivity;
|
||||
this.fragmentActivity = fragmentActivity;
|
||||
this.messageWait = messageWait;
|
||||
this.messageEmpty = messageEmpty;
|
||||
this.contentFrame = contentFrame;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
progressDialog = ProgressDialog.show(context, "", messageWait, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JsonResponseServer doInBackground(Void... params) {
|
||||
String resp = null;
|
||||
|
||||
JsonRequestCheckOrder requestCheckOrder = new JsonRequestCheckOrder();
|
||||
requestCheckOrder.setAudit(GlobalData.getSharedGlobalData().getAuditData());
|
||||
requestCheckOrder.setFlag(Global.FLAG_FOR_ORDERASSIGNMENT);
|
||||
String json = GsonHelper.toJson(requestCheckOrder);
|
||||
String url = GlobalData.getSharedGlobalData().getURL_GET_LIST_ASSIGNMENT();
|
||||
boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
|
||||
boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
|
||||
HttpCryptedConnection httpConn = new HttpCryptedConnection(fragmentActivity, 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);
|
||||
Utility.metricStop(networkMetric, serverResult);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
errMessage=e.getMessage();
|
||||
}
|
||||
|
||||
resp = serverResult.getResult();
|
||||
// resp = "{\"listResponseServer\":[{\"key\":\"123456789\",\"value\":\"Gigin\",\"flag\":\"7134135-1498451-18392\"},{\"key\":\"123456456\",\"value\":\"Bangkit\",\"flag\":\"\"},{\"key\":\"123454321\",\"value\":\"Ichsan\",\"flag\":\"\"}],\"status\":{\"code\":0}}";
|
||||
JsonResponseServer result = null;
|
||||
try {
|
||||
result = GsonHelper.fromJson(resp, JsonResponseServer.class);
|
||||
if(result.getStatus().getCode()!=0){
|
||||
errMessage=result.getStatus().getMessage();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
errMessage=e.getMessage();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(JsonResponseServer result) {
|
||||
if (progressDialog.isShowing()){
|
||||
try {
|
||||
progressDialog.dismiss();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
if (errMessage != null) {
|
||||
NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(fragmentActivity);
|
||||
dialogBuilder.withTitle("ERROR")
|
||||
.withMessage(errMessage)
|
||||
.show();
|
||||
}
|
||||
else if (result == null){
|
||||
NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(fragmentActivity);
|
||||
dialogBuilder.withTitle("INFO")
|
||||
.withMessage(messageEmpty)
|
||||
.show();
|
||||
}
|
||||
else{
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("resultJson",result);
|
||||
Fragment fragment = new OrderAssignmentActivity();
|
||||
fragment.setArguments(bundle);
|
||||
|
||||
FragmentTransaction transaction = MainMenuActivity.fragmentManager.beginTransaction();
|
||||
transaction.setCustomAnimations(R.anim.activity_open_translate,R.anim.activity_close_scale,R.anim.activity_open_scale,R.anim.activity_close_translate);
|
||||
transaction.replace(contentFrame, fragment);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.adins.mss.svy.models;
|
||||
|
||||
/**
|
||||
* Created by Aditya Purwa on 2/26/2015.
|
||||
*/
|
||||
public class AuditRequest {
|
||||
private String callerId;
|
||||
|
||||
public String getCallerId() {
|
||||
return callerId;
|
||||
}
|
||||
|
||||
public void setCallerId(String callerId) {
|
||||
this.callerId = callerId;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package com.adins.mss.base.todo.form;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
|
||||
import com.adins.mss.base.R;
|
||||
import com.adins.mss.dao.Scheme;
|
||||
import com.androidquery.AQuery;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class NewTaskAdapter extends ArrayAdapter<Scheme> {
|
||||
AQuery query;
|
||||
private List<Scheme> objects;
|
||||
private Context context;
|
||||
|
||||
public NewTaskAdapter(Context context,
|
||||
List<Scheme> objects) {
|
||||
super(context, R.layout.new_newtask_item, objects);
|
||||
this.context = context;
|
||||
this.objects = objects;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return objects.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||
if (convertView == null) {
|
||||
convertView = LayoutInflater.from(getContext()).inflate(R.layout.new_newtask_item, parent, false);
|
||||
}
|
||||
query = new AQuery(convertView);
|
||||
Scheme scheme = objects.get(position);
|
||||
|
||||
query.id(R.id.txtTaskTitle).text(scheme.getScheme_description());
|
||||
return convertView;
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 4.8 KiB |
|
@ -0,0 +1,34 @@
|
|||
<?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="wrap_content"
|
||||
android:layout_marginTop="@dimen/exr_margin"
|
||||
android:background="@color/tv_dark"
|
||||
android:clickable="true"
|
||||
android:orientation="horizontal"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtQuestionGroup"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="@dimen/exr_listItemHeight"
|
||||
android:layout_marginLeft="@dimen/exr_margin"
|
||||
android:layout_marginStart="@dimen/exr_margin"
|
||||
android:layout_weight="1"
|
||||
android:textColor="@color/tv_white"
|
||||
android:gravity="center" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/questionGroupExpandedIndicator"
|
||||
android:layout_width="@dimen/exr_iconSize"
|
||||
android:layout_height="@dimen/exr_iconSize"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/exr_margin"
|
||||
android:layout_marginRight="@dimen/exr_margin"
|
||||
android:tint="@color/tv_white"
|
||||
android:src="@drawable/ic_expand_more_24dp" />
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,57 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.adins.mss.foundation.questiongenerator.form.QuestionView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/questionLookupDukcapilLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/tv_white">
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/tv_white">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:layout_height="match_parent">
|
||||
<TextView
|
||||
android:id="@+id/questionLookupDukcapilLabel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="0. label" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnValidasiDukcapil"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="0.5"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/button_background"
|
||||
android:textColor="@color/fontColorWhite"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="@string/btnValidation"
|
||||
android:editable="false"/>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5pt"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:id="@+id/txtResult"
|
||||
android:hint="@string/pressButtonValidation"
|
||||
android:layout_span="2"/>
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_below="@+id/txtResult"
|
||||
android:background="@color/timelineLine"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_marginBottom="5dp"/>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
|
||||
</com.adins.mss.foundation.questiongenerator.form.QuestionView>
|
|
@ -0,0 +1,104 @@
|
|||
/*
|
||||
* 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 java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Tools to retrieve key/value pairs from static fields and getters of any
|
||||
* class. Reflection API usage allows to retrieve data without having to
|
||||
* implement a class for each android version of each interesting class.
|
||||
* It can also help find hidden properties.
|
||||
*
|
||||
* @author Kevin Gaudin
|
||||
*/
|
||||
final class ReflectionCollector {
|
||||
|
||||
/**
|
||||
* Retrieves key/value pairs from static fields of a class.
|
||||
*
|
||||
* @param someClass the class to be inspected.
|
||||
* @return A human readable string with a key=value pair on each line.
|
||||
*/
|
||||
public static String collectConstants(Class<?> someClass, String prefix) {
|
||||
|
||||
final StringBuilder result = new StringBuilder();
|
||||
|
||||
final Field[] fields = someClass.getFields();
|
||||
for (final Field field : fields) {
|
||||
if (prefix != null && prefix.length() > 0) {
|
||||
result.append(prefix).append('.');
|
||||
}
|
||||
result.append(field.getName()).append("=");
|
||||
try {
|
||||
final Object value = field.get(null);
|
||||
if (value != null) {
|
||||
if (field.getType().isArray()) {
|
||||
result.append(Arrays.toString((Object[]) value));
|
||||
} else {
|
||||
result.append(value.toString());
|
||||
}
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
result.append("N/A");
|
||||
} catch (IllegalAccessException e) {
|
||||
result.append("N/A");
|
||||
}
|
||||
result.append("\n");
|
||||
}
|
||||
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves key/value pairs from static getters of a class (get*() or is*()).
|
||||
*
|
||||
* @param someClass the class to be inspected.
|
||||
* @return A human readable string with a key=value pair on each line.
|
||||
*/
|
||||
public static String collectStaticGettersResults(Class<?> someClass) {
|
||||
final StringBuilder result = new StringBuilder();
|
||||
final Method[] methods = someClass.getMethods();
|
||||
for (final Method method : methods) {
|
||||
if (method.getParameterTypes().length == 0
|
||||
&& (method.getName().startsWith("get") || method.getName().startsWith("is"))
|
||||
&& !method.getName().equals("getClass")) {
|
||||
try {
|
||||
result.append(method.getName());
|
||||
result.append('=');
|
||||
result.append(method.invoke(null, (Object[]) null));
|
||||
result.append("\n");
|
||||
} catch (IllegalArgumentException e) {
|
||||
// NOOP
|
||||
} catch (IllegalAccessException e) {
|
||||
// NOOP
|
||||
} catch (InvocationTargetException e) {
|
||||
// NOOP
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
public static String collectConstants(Class<?> someClass) {
|
||||
return collectConstants(someClass, "");
|
||||
}
|
||||
}
|
|
@ -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,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13.41,18.09L13.41,20h-2.67v-1.93c-1.71,-0.36 -3.16,-1.46 -3.27,-3.4h1.96c0.1,1.05 0.82,1.87 2.65,1.87 1.96,0 2.4,-0.98 2.4,-1.59 0,-0.83 -0.44,-1.61 -2.67,-2.14 -2.48,-0.6 -4.18,-1.62 -4.18,-3.67 0,-1.72 1.39,-2.84 3.11,-3.21L10.74,4h2.67v1.95c1.86,0.45 2.79,1.86 2.85,3.39L14.3,9.34c-0.05,-1.11 -0.64,-1.87 -2.22,-1.87 -1.5,0 -2.4,0.68 -2.4,1.64 0,0.84 0.65,1.39 2.67,1.91s4.18,1.39 4.18,3.91c-0.01,1.83 -1.38,2.83 -3.12,3.16z"/>
|
||||
</vector>
|
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
|
@ -0,0 +1,35 @@
|
|||
package com.github.jjobes.slidedatetimepicker;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>This listener class informs the client when the user sets
|
||||
* a date and time by pressing "OK", or cancels the dialog.</p>
|
||||
* <p>
|
||||
* <p>Overriding {@code onDateTimeCancel()} is optional. The client
|
||||
* can override this to listen for when the user cancels the dialog.
|
||||
* This is called when the user presses the dialog's Cancel button,
|
||||
* touches outside the dialog or presses the device's Back button.</p>
|
||||
*
|
||||
* @author jjobes
|
||||
*/
|
||||
public abstract class SlideDateTimeListener {
|
||||
/**
|
||||
* Informs the client when the user presses "OK"
|
||||
* and selects a date and time.
|
||||
*
|
||||
* @param date The {@code Date} object that contains the date
|
||||
* and time that the user has selected.
|
||||
*/
|
||||
public abstract void onDateTimeSet(Date date);
|
||||
|
||||
/**
|
||||
* Informs the client when the user cancels the
|
||||
* dialog by pressing Cancel, touching outside
|
||||
* the dialog or pressing the Back button.
|
||||
* This override is optional.
|
||||
*/
|
||||
public void onDateTimeCancel() {
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue