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,17 @@
|
|||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/text1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceListItemSmall"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:textColor="#000"
|
||||
android:fontFamily="sans-serif-light"
|
||||
android:background="@drawable/activated_background_indicator"
|
||||
android:minHeight="42dp"/>
|
||||
</RelativeLayout>
|
|
@ -0,0 +1,8 @@
|
|||
package com.adins.mss.base.timeline;
|
||||
|
||||
public class Constants {
|
||||
public static int flag_edit = 0;
|
||||
public static boolean inAbsent = false;
|
||||
public static boolean inSearchMode = false;
|
||||
public static String KEY_TIMELINE = "KEY_TIMELINE";
|
||||
}
|
|
@ -0,0 +1,300 @@
|
|||
/*
|
||||
* 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;
|
||||
|
||||
import android.content.res.Configuration;
|
||||
|
||||
import org.acra.annotation.ReportsCrashes;
|
||||
|
||||
/**
|
||||
* Specifies all the different fields available in a crash report.
|
||||
*
|
||||
* @author Normal
|
||||
*/
|
||||
public enum ReportField {
|
||||
/**
|
||||
* Report Identifier
|
||||
*/
|
||||
REPORT_ID,
|
||||
/**
|
||||
* Application version code. This is the incremental integer version code
|
||||
* used to differentiate versions on the android market.
|
||||
*
|
||||
* @see android.content.pm.PackageInfo#versionCode
|
||||
*/
|
||||
APP_VERSION_CODE,
|
||||
/**
|
||||
* Application version name.
|
||||
*
|
||||
* @see android.content.pm.PackageInfo#versionName
|
||||
*/
|
||||
APP_VERSION_NAME,
|
||||
/**
|
||||
* Application package name.
|
||||
*
|
||||
* @see android.content.Context#getPackageName()
|
||||
*/
|
||||
PACKAGE_NAME,
|
||||
/**
|
||||
* Base path of the application's private file folder.
|
||||
*
|
||||
* @see android.content.Context#getFilesDir()
|
||||
*/
|
||||
FILE_PATH,
|
||||
/**
|
||||
* Device model name.
|
||||
*
|
||||
* @see android.os.Build#MODEL
|
||||
*/
|
||||
PHONE_MODEL,
|
||||
/**
|
||||
* Device android version name.
|
||||
*
|
||||
* @see android.os.Build.VERSION#RELEASE
|
||||
*/
|
||||
ANDROID_VERSION,
|
||||
/**
|
||||
* Android Build details.
|
||||
*
|
||||
* @see android.os.Build
|
||||
*/
|
||||
BUILD {
|
||||
@Override
|
||||
public boolean containsKeyValuePairs() {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Device brand (manufacturer or carrier).
|
||||
*
|
||||
* @see android.os.Build#BRAND
|
||||
*/
|
||||
BRAND,
|
||||
/**
|
||||
* Device overall product code.
|
||||
*
|
||||
* @see android.os.Build#PRODUCT
|
||||
*/
|
||||
PRODUCT,
|
||||
/**
|
||||
* Estimation of the total device memory size based on filesystem stats.
|
||||
*/
|
||||
TOTAL_MEM_SIZE,
|
||||
/**
|
||||
* Estimation of the available device memory size based on filesystem stats.
|
||||
*/
|
||||
AVAILABLE_MEM_SIZE,
|
||||
/**
|
||||
* Contains key = value pairs defined by the application developer during
|
||||
* the application build.
|
||||
*/
|
||||
BUILD_CONFIG {
|
||||
@Override
|
||||
public boolean containsKeyValuePairs() {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Contains key = value pairs defined by the application developer during
|
||||
* the application execution.
|
||||
*/
|
||||
CUSTOM_DATA {
|
||||
@Override
|
||||
public boolean containsKeyValuePairs() {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* The Holy Stack Trace.
|
||||
*/
|
||||
STACK_TRACE,
|
||||
/**
|
||||
* A hash of the stack trace, taking only method names into account.<br>
|
||||
* Line numbers are stripped out before computing the hash. This can help you
|
||||
* uniquely identify stack traces.
|
||||
*/
|
||||
STACK_TRACE_HASH,
|
||||
/**
|
||||
* {@link Configuration} fields state on the application start.
|
||||
*
|
||||
* @see Configuration
|
||||
*/
|
||||
INITIAL_CONFIGURATION {
|
||||
@Override
|
||||
public boolean containsKeyValuePairs() {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* {@link Configuration} fields state on the application crash.
|
||||
*
|
||||
* @see Configuration
|
||||
*/
|
||||
CRASH_CONFIGURATION {
|
||||
@Override
|
||||
public boolean containsKeyValuePairs() {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Device display specifications.
|
||||
*
|
||||
* @see android.view.WindowManager#getDefaultDisplay()
|
||||
*/
|
||||
DISPLAY {
|
||||
@Override
|
||||
public boolean containsKeyValuePairs() {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Comment added by the user in the CrashReportDialog displayed in
|
||||
* {@link ReportingInteractionMode#NOTIFICATION} mode.
|
||||
*/
|
||||
USER_COMMENT,
|
||||
/**
|
||||
* User date on application start.
|
||||
*/
|
||||
USER_APP_START_DATE,
|
||||
/**
|
||||
* User date immediately after the crash occurred.
|
||||
*/
|
||||
USER_CRASH_DATE,
|
||||
/**
|
||||
* Memory state details for the application process.
|
||||
*/
|
||||
DUMPSYS_MEMINFO,
|
||||
/**
|
||||
* Content of the android.os.DropBoxManager (introduced in API level 8).
|
||||
* Requires READ_LOGS permission.
|
||||
*/
|
||||
DROPBOX,
|
||||
/**
|
||||
* Logcat default extract. Requires READ_LOGS permission.
|
||||
*/
|
||||
LOGCAT,
|
||||
/**
|
||||
* Logcat eventslog extract. Requires READ_LOGS permission.
|
||||
*/
|
||||
EVENTSLOG,
|
||||
/**
|
||||
* Logcat radio extract. Requires READ_LOGS permission.
|
||||
*/
|
||||
RADIOLOG,
|
||||
/**
|
||||
* True if the report has been explicitly sent silently by the developer.
|
||||
*/
|
||||
IS_SILENT,
|
||||
/**
|
||||
* Device unique ID (IMEI). Requires READ_PHONE_STATE permission.
|
||||
*/
|
||||
DEVICE_ID,
|
||||
/**
|
||||
* Installation unique ID. This identifier allow you to track a specific
|
||||
* user application installation without using any personal data.
|
||||
*/
|
||||
INSTALLATION_ID,
|
||||
/**
|
||||
* User email address. Can be provided by the user in the
|
||||
* {@link ACRA#PREF_USER_EMAIL_ADDRESS} SharedPreference.
|
||||
*/
|
||||
USER_EMAIL,
|
||||
/**
|
||||
* Features declared as available on this device by the system.
|
||||
*/
|
||||
DEVICE_FEATURES {
|
||||
@Override
|
||||
public boolean containsKeyValuePairs() {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* External storage state and standard directories.
|
||||
*/
|
||||
ENVIRONMENT {
|
||||
@Override
|
||||
public boolean containsKeyValuePairs() {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* System settings.
|
||||
*/
|
||||
SETTINGS_SYSTEM {
|
||||
@Override
|
||||
public boolean containsKeyValuePairs() {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Secure settings (applications can't modify them).
|
||||
*/
|
||||
SETTINGS_SECURE {
|
||||
@Override
|
||||
public boolean containsKeyValuePairs() {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Global settings, introduced in Android 4.2 (API level 17) to centralize settings for multiple users.
|
||||
*/
|
||||
SETTINGS_GLOBAL {
|
||||
@Override
|
||||
public boolean containsKeyValuePairs() {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* SharedPreferences contents
|
||||
*/
|
||||
SHARED_PREFERENCES {
|
||||
@Override
|
||||
public boolean containsKeyValuePairs() {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Content of your own application log file. To be configured with
|
||||
* {@link ReportsCrashes#applicationLogFile()} to define the path/name of
|
||||
* the log file and {@link ReportsCrashes#applicationLogFileLines()} to set
|
||||
* the number of lines you want to be retrieved.
|
||||
*/
|
||||
APPLICATION_LOG,
|
||||
/**
|
||||
* Since Android API Level 16 (Android 4.1 - Jelly Beans), retrieve the list
|
||||
* of supported Media codecs and their capabilities (color format, profile
|
||||
* and level).
|
||||
*/
|
||||
MEDIA_CODEC_LIST,
|
||||
/**
|
||||
* Retrieves details of the failing thread (id, name, group name).
|
||||
*/
|
||||
THREAD_DETAILS,
|
||||
/**
|
||||
* Retrieves the user IP address(es).
|
||||
*/
|
||||
USER_IP;
|
||||
|
||||
/**
|
||||
* Whether this field is a collection of key/value pairs.
|
||||
*
|
||||
* @return true if the field contains a string with a key/value pair on each
|
||||
* line, key and value separated by an equal sugn
|
||||
*/
|
||||
public boolean containsKeyValuePairs() {
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/timelineLine" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:top="1dp">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/fontColorWhite" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
|
@ -0,0 +1,45 @@
|
|||
package com.adins.mss.svy;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.adins.mss.base.SynchronizeActivity;
|
||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
import com.google.firebase.perf.FirebasePerformance;
|
||||
import com.google.firebase.perf.metrics.Trace;
|
||||
|
||||
public class MSSynchronizeActivity extends SynchronizeActivity{
|
||||
|
||||
private Trace synchronizeSvyTrace;
|
||||
private FirebaseAnalytics screenName;
|
||||
|
||||
@Override
|
||||
protected Intent getIntentMainMenu() {
|
||||
// TODO Auto-generated method stub
|
||||
return new Intent(this,NewMSMainActivity.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
// TODO Auto-generated method stub
|
||||
screenName = FirebaseAnalytics.getInstance(this);
|
||||
synchronizeSvyTrace = FirebasePerformance.getInstance().newTrace(getString(R.string.synchronize_trace_survey));
|
||||
activity = this;
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
//Set Firebase screen name
|
||||
screenName.setCurrentScreen(this,getString(com.adins.mss.base.R.string.screen_name_svy_synchronize),null);
|
||||
synchronizeSvyTrace.start();
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
synchronizeSvyTrace.stop();
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
package com.adins.mss.foundation.oauth2;
|
||||
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
public class Token {
|
||||
|
||||
@SerializedName("expires_in")
|
||||
private final Long expires_in;
|
||||
@SerializedName("expires_at")
|
||||
private final Long expires_at;
|
||||
@SerializedName("token_type")
|
||||
private final String token_type;
|
||||
@SerializedName("refresh_token")
|
||||
private final String refresh_token;
|
||||
@SerializedName("access_token")
|
||||
private final String access_token;
|
||||
|
||||
|
||||
public Token(Long expiresIn, String tokenType, String refreshToken, String accessToken) {
|
||||
this.expires_in = expiresIn;
|
||||
this.token_type = tokenType;
|
||||
this.refresh_token = refreshToken;
|
||||
this.access_token = accessToken;
|
||||
this.expires_at = (expiresIn * 1000) + System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public Token(Long expiresIn, String tokenType, String refreshToken, String accessToken, Long expiresAt) {
|
||||
this.expires_in = expiresIn;
|
||||
this.token_type = tokenType;
|
||||
this.refresh_token = refreshToken;
|
||||
this.access_token = accessToken;
|
||||
this.expires_at = expiresAt;
|
||||
}
|
||||
|
||||
public Long getExpiresIn() {
|
||||
return expires_in;
|
||||
}
|
||||
|
||||
public Long getExpiresAt() {
|
||||
return expires_at;
|
||||
}
|
||||
|
||||
public String getTokenType() {
|
||||
return token_type;
|
||||
}
|
||||
|
||||
|
||||
public String getRefreshToken() {
|
||||
return refresh_token;
|
||||
}
|
||||
|
||||
|
||||
public String getAccessToken() {
|
||||
return access_token;
|
||||
}
|
||||
|
||||
public boolean isExpired() {
|
||||
return (System.currentTimeMillis() >= this.getExpiresAt()) ? true : false;
|
||||
}
|
||||
|
||||
public String getResource(OAuth2Client client, Token token, String path) {
|
||||
if (GlobalData.getSharedGlobalData().isSecureConnection()) {
|
||||
return OAuthUtils.getProtectedResourceHttps(client, token, path);
|
||||
} else {
|
||||
return OAuthUtils.getProtectedResourceHttp(client, token, path);
|
||||
}
|
||||
}
|
||||
|
||||
public Token refresh(Activity activity, OAuth2Client client) {
|
||||
OAuth2Config oauthConfig = new OAuth2Config.OAuth2ConfigBuilder(client.getUsername(), client.getPassword(), client.getClientId(), client.getClientSecret(), client.getSite())
|
||||
.grantType("refresh_token").build();
|
||||
WeakReference activityReference = new WeakReference(activity);
|
||||
if (GlobalData.getSharedGlobalData().isSecureConnection()) {
|
||||
return OAuthUtils.refreshAccessTokenHttps(activityReference,this, oauthConfig);
|
||||
} else {
|
||||
return OAuthUtils.refreshAccessTokenHttp(activityReference, this, oauthConfig);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,351 @@
|
|||
package com.adins.mss.svy.reassignment;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.ActionBar;
|
||||
import android.app.DatePickerDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemSelectedListener;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.CalendarView;
|
||||
import android.widget.DatePicker;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.adins.mss.base.crashlytics.FireCrash;
|
||||
import com.adins.mss.base.util.Utility;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.foundation.formatter.Formatter;
|
||||
import com.adins.mss.foundation.formatter.Tool;
|
||||
import com.adins.mss.svy.R;
|
||||
import com.adins.mss.svy.tool.Constants;
|
||||
|
||||
import org.acra.ACRA;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
public class CheckOrderActivity extends Fragment implements OnClickListener, OnItemSelectedListener {
|
||||
|
||||
|
||||
protected static EditText txtStartDate;
|
||||
protected static EditText txtEndDate;
|
||||
protected EditText txtNomorOrder;
|
||||
protected Spinner spinnerSearch;
|
||||
protected View view;
|
||||
private String[] isiSearchBy;
|
||||
private Button btnSearch;
|
||||
private ImageView btnStartDate;
|
||||
private ImageView btnEndDate;
|
||||
private LinearLayout byDateLayout;
|
||||
private LinearLayout byNomorLayout;
|
||||
static CalendarView.OnDateChangeListener onDateChangeListener;
|
||||
|
||||
@Override
|
||||
public void onAttach(Context activity) {
|
||||
super.onAttach(activity);
|
||||
ACRA.getErrorReporter().putCustomData("LAST_CLASS_ACCESSED", getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
Utility.freeMemory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
view = inflater.inflate(R.layout.new_fragment_check_survey_reassign, container, false);
|
||||
//onDateChangeListener = this;
|
||||
txtStartDate = (EditText)view.findViewById(R.id.txtStartDate);
|
||||
txtEndDate = (EditText)view.findViewById(R.id.txtEndDate);
|
||||
// txtNomorOrder = (EditText)view.findViewById(R.id.txtNomorOrder);
|
||||
btnSearch = (Button)view.findViewById(R.id.btnSearchOrder);
|
||||
btnStartDate =(ImageView)view.findViewById(R.id.btnStartDate);
|
||||
btnEndDate=(ImageView)view.findViewById(R.id.btnEndDate);
|
||||
// spinnerSearch=(Spinner)view.findViewById(R.id.cbSearchBy);
|
||||
byDateLayout=(LinearLayout) view.findViewById(R.id.byDate);
|
||||
// byNomorLayout=(LinearLayout) view.findViewById(R.id.byNoOrder);
|
||||
|
||||
btnStartDate.setOnClickListener(this);
|
||||
btnEndDate.setOnClickListener(this);
|
||||
btnSearch.setOnClickListener(this);
|
||||
|
||||
// isiSearchBy = this.getResources().getStringArray(R.array.cbOrderReassign);
|
||||
// if(isiSearchBy.length>1){
|
||||
// ArrayAdapter<CharSequence> adapter=ArrayAdapter.createFromResource(
|
||||
// getActivity(), R.array.cbOrderReassign,
|
||||
// R.layout.spinner_style);
|
||||
//
|
||||
// spinnerSearch.setAdapter(adapter);
|
||||
// spinnerSearch.setOnItemSelectedListener(this);
|
||||
// }else{
|
||||
// view.findViewById(R.id.btnRefresh).setVisibility(View.GONE);
|
||||
// spinnerSearch.setVisibility(View.GONE);
|
||||
// }
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
Global.haveLogin = 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume(){
|
||||
super.onResume();
|
||||
// getActivity().getActionBar().removeAllTabs();
|
||||
// getActivity().getActionBar().setTitle(getString(R.string.title_mn_checkorder));
|
||||
// getActivity().getActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
|
||||
}
|
||||
|
||||
protected Intent getNextActivityIntent(){
|
||||
// return new Intent(getActivity().getApplicationContext(), ResultActivity.class);
|
||||
return new Intent(getActivity().getApplicationContext(), ResultOrderActivity.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
int id = v.getId();
|
||||
if(id==R.id.btnStartDate){
|
||||
DialogFragment datePicker = new DatePickerDialogCustom();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(Constants.KEY_DATE, Constants.KEY_START_DATE);
|
||||
bundle.putInt(Constants.KEY_START_DATE, Constants.START_DATE_DIALOG_ID);
|
||||
datePicker.setArguments(bundle);
|
||||
|
||||
datePicker.show(getFragmentManager(), Constants.KEY_START_DATE);
|
||||
|
||||
}
|
||||
if(id==R.id.btnEndDate){
|
||||
DialogFragment datePicker = new DatePickerDialogCustom();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(Constants.KEY_DATE, Constants.KEY_END_DATE);
|
||||
bundle.putInt(Constants.KEY_END_DATE, Constants.END_DATE_DIALOG_ID);
|
||||
datePicker.setArguments(bundle);
|
||||
|
||||
datePicker.show(getFragmentManager(), Constants.KEY_END_DATE);
|
||||
|
||||
}
|
||||
if(id==R.id.btnSearchOrder){
|
||||
// String starDate=txtStartDate.getText().toString();
|
||||
// String endDate=txtEndDate.getText().toString();
|
||||
// String noOrder=txtNomorOrder.getText().toString();
|
||||
//
|
||||
// if((starDate.length()>0&&endDate.length()>0)||noOrder.length()>0){
|
||||
// Intent nextActivity = getNextActivityIntent();
|
||||
//
|
||||
// nextActivity.putExtra("startDate", txtStartDate.getText().toString());
|
||||
// nextActivity.putExtra("endDate", txtEndDate.getText().toString());
|
||||
// nextActivity.putExtra("nomorOrder", txtNomorOrder.getText().toString());
|
||||
//
|
||||
// startActivity(nextActivity);
|
||||
// }else{
|
||||
// Toast.makeText(getActivity(), "input required !",
|
||||
// Toast.LENGTH_LONG).show();
|
||||
// }
|
||||
StringBuffer errorMessage = new StringBuffer();
|
||||
// if (spinnerSearch.getSelectedItemPosition()==0) {
|
||||
if (txtStartDate.getText().toString().length()==0){
|
||||
errorMessage.append(getString(R.string.start_date_required));
|
||||
}
|
||||
if (txtEndDate.getText().toString().length() == 0) {
|
||||
errorMessage.append(getString(R.string.end_date_required));
|
||||
}
|
||||
try {
|
||||
SimpleDateFormat f = new SimpleDateFormat(Global.DATE_STR_FORMAT);
|
||||
Date sDate,eDate;
|
||||
long sLong = 0;
|
||||
long eLong=0;
|
||||
try {
|
||||
sDate = f.parse(txtStartDate.getText().toString());
|
||||
eDate = f.parse(txtEndDate.getText().toString());
|
||||
Calendar sCalendar = Calendar.getInstance();
|
||||
sCalendar.setTimeInMillis(sDate.getTime());
|
||||
Calendar eCalendar = Calendar.getInstance();
|
||||
eCalendar.setTimeInMillis(eDate.getTime());
|
||||
eCalendar.set(eCalendar.HOUR_OF_DAY, 23);
|
||||
eCalendar.set(eCalendar.MINUTE, 59);
|
||||
eCalendar.set(eCalendar.SECOND, 59);
|
||||
sLong = sCalendar.getTimeInMillis();
|
||||
eLong = eCalendar.getTimeInMillis();
|
||||
} catch (ParseException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
long milisecond=eLong-sLong;
|
||||
if(milisecond>604799000){
|
||||
errorMessage.append(getString(R.string.data_range_not_allowed));
|
||||
} else if (milisecond < 0) {
|
||||
errorMessage.append(getString(R.string.input_not_valid));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
// TODO: handle exception
|
||||
}
|
||||
// } else {
|
||||
// if(txtNomorOrder.getText().toString().length()==0){
|
||||
// errorMessage.append(getString(R.string.nomor_order_rewuired));
|
||||
// }
|
||||
// }
|
||||
if(errorMessage != null && errorMessage.length( )> 0){
|
||||
Toast.makeText(getActivity(), errorMessage, Toast.LENGTH_SHORT).show();
|
||||
}else{
|
||||
Intent nextActivity = getNextActivityIntent();
|
||||
|
||||
nextActivity.putExtra("startDate", txtStartDate.getText().toString());
|
||||
nextActivity.putExtra("endDate", txtEndDate.getText().toString());
|
||||
// nextActivity.putExtra("nomorOrder", txtNomorOrder.getText().toString());
|
||||
|
||||
startActivity(nextActivity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View v, int position,
|
||||
long id) {
|
||||
long itemSearchBy = spinnerSearch.getItemIdAtPosition(position);
|
||||
if (itemSearchBy == 1){
|
||||
byDateLayout.setVisibility(View.GONE);
|
||||
byNomorLayout.setVisibility(View.VISIBLE);
|
||||
txtStartDate.setText("");
|
||||
txtEndDate.setText("");
|
||||
}
|
||||
else if (itemSearchBy == 0){
|
||||
byDateLayout.setVisibility(View.VISIBLE);
|
||||
byNomorLayout.setVisibility(View.GONE);
|
||||
txtNomorOrder.setText("");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> arg0) {
|
||||
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public void onStartDateSetListener(String startDate) {
|
||||
txtStartDate.setText(startDate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEndDateSetListener(String endDate) {
|
||||
txtEndDate.setText(endDate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSelectedDayChange(CalendarView view, int year, int month, int dayOfMonth) {
|
||||
|
||||
}*/
|
||||
|
||||
@SuppressLint("ValidFragment")
|
||||
public static class DatePickerDialogCustom extends DialogFragment{
|
||||
|
||||
int id;
|
||||
String startDate ="";
|
||||
String endDate ="";
|
||||
private DatePickerDialog.OnDateSetListener mStartDateSetListener =
|
||||
new DatePickerDialog.OnDateSetListener() {
|
||||
|
||||
@Override
|
||||
public void onDateSet(DatePicker view, int year, int monthOfYear,
|
||||
int dayOfMonth) {
|
||||
String month = Tool.appendZeroForDateTime(monthOfYear, true);
|
||||
startDate = dayOfMonth + "/" + month + "/" + year;
|
||||
//onDateChangeListener.onStartDateSetListener(startDate);
|
||||
txtStartDate.setText(startDate);
|
||||
}
|
||||
};
|
||||
private DatePickerDialog.OnDateSetListener mEndDateSetListener =
|
||||
new DatePickerDialog.OnDateSetListener() {
|
||||
|
||||
@Override
|
||||
public void onDateSet(DatePicker view, int year, int monthOfYear,
|
||||
int dayOfMonth) {
|
||||
String month = Tool.appendZeroForDateTime(monthOfYear, true);
|
||||
endDate = dayOfMonth + "/" + month + "/" + year;
|
||||
//onDateChangeListener.onEndDateSetListener(endDate);
|
||||
txtEndDate.setText(endDate);
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
String key = getArguments().getString(Constants.KEY_DATE);
|
||||
int id=0;
|
||||
if(key.equals(Constants.KEY_START_DATE))
|
||||
id = getArguments().getInt(Constants.KEY_START_DATE);
|
||||
else if(key.equals(Constants.KEY_END_DATE))
|
||||
id = getArguments().getInt(Constants.KEY_END_DATE);
|
||||
|
||||
return DatePickerDialog(id);
|
||||
}
|
||||
|
||||
public Dialog DatePickerDialog(int id){
|
||||
Date sysdate =new Date(System.currentTimeMillis());
|
||||
DatePickerDialog datePicker = null;
|
||||
String sdt = Formatter.formatDate(sysdate, "dd/MM/yyyy");
|
||||
String[] temp1 = sdt.split("/");
|
||||
final int DayOfMonth = Integer.parseInt(temp1[0]);
|
||||
final int Month = Integer.parseInt((temp1[1])) - 1;
|
||||
final int Year = Integer.parseInt(temp1[2]);
|
||||
if (id==Constants.START_DATE_DIALOG_ID) {
|
||||
datePicker = new DatePickerDialog(getActivity(), mStartDateSetListener, Year, Month, DayOfMonth)
|
||||
{
|
||||
@Override
|
||||
public void onDateChanged(DatePicker view, int year, int monthOfYear, int dayOfMonth)
|
||||
{
|
||||
if (year > Year)
|
||||
view.updateDate(Year, Month, DayOfMonth);
|
||||
if (monthOfYear > Month && year == Year)
|
||||
view.updateDate(Year, Month, DayOfMonth);
|
||||
if (dayOfMonth > DayOfMonth && year == Year && monthOfYear == Month)
|
||||
view.updateDate(Year, Month, DayOfMonth);
|
||||
}
|
||||
};
|
||||
}
|
||||
else if (id==Constants.END_DATE_DIALOG_ID) {
|
||||
|
||||
datePicker = new DatePickerDialog(getActivity(), mEndDateSetListener, Year, Month, DayOfMonth)
|
||||
{
|
||||
@Override
|
||||
public void onDateChanged(DatePicker view, int year, int monthOfYear, int dayOfMonth)
|
||||
{
|
||||
|
||||
if (year > Year)
|
||||
view.updateDate(Year, Month, DayOfMonth);
|
||||
if (monthOfYear > Month && year == Year)
|
||||
view.updateDate(Year, Month, DayOfMonth);
|
||||
if (dayOfMonth > DayOfMonth && year == Year && monthOfYear == Month)
|
||||
view.updateDate(Year, Month, DayOfMonth);
|
||||
}
|
||||
};
|
||||
}
|
||||
return datePicker;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:orientation="vertical"
|
||||
android:visibility="visible" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/lblServerLinkId" >
|
||||
</TextView>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/txtServerLink"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/lblServerLinkId"
|
||||
android:text="" >
|
||||
</EditText>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="0.36"
|
||||
android:gravity="bottom" >
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnSaveLink"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/btnSaveLink" >
|
||||
</Button>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,46 @@
|
|||
package com.adins.mss.svy.reassignment;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.adins.mss.constant.Global;
|
||||
|
||||
import org.acra.ACRA;
|
||||
|
||||
public class OrderReassignmentActivity extends CheckOrderActivity{
|
||||
private int taskType;
|
||||
private Bundle mArguments;
|
||||
@Override
|
||||
public void onAttach(Context activity) {
|
||||
super.onAttach(activity);
|
||||
setHasOptionsMenu(false);
|
||||
ACRA.getErrorReporter().putCustomData("LAST_CLASS_ACCESSED", getClass().getSimpleName());
|
||||
mArguments = getArguments();
|
||||
taskType = mArguments.getInt(Global.BUND_KEY_TASK_TYPE, 0);
|
||||
}
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Intent getNextActivityIntent() {
|
||||
// TODO Auto-generated method stub
|
||||
super.getNextActivityIntent();
|
||||
Intent fragment = new Intent(getActivity(), OrderReassignmentResult.class);
|
||||
Bundle args = new Bundle();
|
||||
args.putString("startDate", txtStartDate.getText().toString());
|
||||
args.putString("endDate", txtEndDate.getText().toString());
|
||||
args.putString("nomorOrder", txtNomorOrder.getText().toString());
|
||||
args.putString("status", "1");
|
||||
fragment.putExtras(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* 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.sender;
|
||||
|
||||
/**
|
||||
* This exception is thrown when an error ocurred while sending crash data in a
|
||||
* {@link ReportSender} implementation.
|
||||
*
|
||||
* @author Kevin Gaudin
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class ReportSenderException extends Exception {
|
||||
|
||||
/**
|
||||
* Creates a new {@link ReportSenderException} instance. You can provide a
|
||||
* detailed message to explain what went wrong.
|
||||
*
|
||||
* @param detailMessage A message to explain the cause of this exception.
|
||||
* @param throwable An optional throwable which caused this Exception.
|
||||
*/
|
||||
public ReportSenderException(String detailMessage, Throwable throwable) {
|
||||
super(detailMessage, throwable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@link ReportSenderException} instance. You can provide a
|
||||
* detailed message to explain what went wrong.
|
||||
*
|
||||
* @param detailMessage A message to explain the cause of this exception.
|
||||
**/
|
||||
public ReportSenderException(String detailMessage) {
|
||||
super(detailMessage);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,122 @@
|
|||
package com.adins.mss.foundation.db.dataaccess;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.adins.mss.dao.DaoSession;
|
||||
import com.adins.mss.dao.ReceiptHistory;
|
||||
import com.adins.mss.dao.ReceiptHistoryDao;
|
||||
import com.adins.mss.foundation.db.DaoOpenHelper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import de.greenrobot.dao.query.QueryBuilder;
|
||||
|
||||
public class ReceiptHistoryDataAccess {
|
||||
|
||||
/**
|
||||
* use to generate dao session that you can access modelDao
|
||||
*
|
||||
* @param context --> context from activity
|
||||
* @return
|
||||
*/
|
||||
protected static DaoSession getDaoSession(Context context) {
|
||||
return DaoOpenHelper.getDaoSession(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* get receiptHistory dao and you can access the DB
|
||||
*
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
protected static ReceiptHistoryDao getReceiptHistoryDao(Context context) {
|
||||
return getDaoSession(context).getReceiptHistoryDao();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear session, close db and set daoOpenHelper to null
|
||||
*/
|
||||
public static void closeAll() {
|
||||
DaoOpenHelper.closeAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* add collectionActivity as entity
|
||||
*
|
||||
* @param context
|
||||
* @param ReceiptHistory
|
||||
*/
|
||||
public static void add(Context context, ReceiptHistory ReceiptHistory) {
|
||||
getReceiptHistoryDao(context).insertInTx(ReceiptHistory);
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* add collectionActivity as list entity
|
||||
*
|
||||
* @param context
|
||||
* @param receiptHistoryList
|
||||
*/
|
||||
public static void add(Context context, List<ReceiptHistory> receiptHistoryList) {
|
||||
getReceiptHistoryDao(context).insertInTx(receiptHistoryList);
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* delete all content in table.
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
public static void clean(Context context) {
|
||||
getReceiptHistoryDao(context).deleteAll();
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* @param receiptHistory
|
||||
*/
|
||||
public static void delete(Context context, ReceiptHistory receiptHistory) {
|
||||
getReceiptHistoryDao(context).delete(receiptHistory);
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
public static void delete(Context context, String uuidTaskH) {
|
||||
QueryBuilder<ReceiptHistory> qb = getReceiptHistoryDao(context).queryBuilder();
|
||||
qb.where(ReceiptHistoryDao.Properties.Uuid_task_h.eq(uuidTaskH));
|
||||
qb.build();
|
||||
if (qb.list().size() > 0) {
|
||||
getReceiptHistoryDao(context).deleteInTx(qb.list());
|
||||
}
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* @param receiptHistory
|
||||
*/
|
||||
public static void update(Context context, ReceiptHistory receiptHistory) {
|
||||
getReceiptHistoryDao(context).update(receiptHistory);
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
public static void addOrReplace(Context context, ReceiptHistory receiptHistory) {
|
||||
getReceiptHistoryDao(context).insertOrReplaceInTx(receiptHistory);
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
public static void addOrReplace(Context context, List<ReceiptHistory> receiptHistories) {
|
||||
getReceiptHistoryDao(context).insertOrReplaceInTx(receiptHistories);
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
public static List<ReceiptHistory> getAllByTask(Context context, String uuidTaskH) {
|
||||
QueryBuilder<ReceiptHistory> qb = getReceiptHistoryDao(context).queryBuilder();
|
||||
qb.where(ReceiptHistoryDao.Properties.Uuid_task_h.eq(uuidTaskH));
|
||||
qb.build();
|
||||
if (!qb.list().isEmpty())
|
||||
return qb.list();
|
||||
else return null;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue