mirror of
https://github.com/freeedcom/ai-codereviewer.git
synced 2025-07-01 05:14:17 +00:00
add project adins
This commit is contained in:
parent
ad06ac5505
commit
f8f85d679d
5299 changed files with 625430 additions and 0 deletions
|
@ -0,0 +1,42 @@
|
|||
<?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:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:clickable="true">
|
||||
<RelativeLayout
|
||||
android:id="@+id/questionGroupContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<View
|
||||
android:id="@+id/lineView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/timelineLine"/>
|
||||
<TextView
|
||||
android:id="@+id/txtQuestionGroup"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/lineView"
|
||||
android:text="QUESTION GROUP"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:textStyle="bold"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:layout_margin="10dp" />
|
||||
<ImageView
|
||||
android:id="@+id/questionGroupExpandedIndicator"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="10dp"
|
||||
android:src="@drawable/ic_arrow_drop_down" />
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_below="@+id/txtQuestionGroup"
|
||||
android:background="@color/timelineLine"/>
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
|
@ -0,0 +1,18 @@
|
|||
package com.services;
|
||||
|
||||
import com.adins.mss.foundation.http.MssResponseType;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class JsonResponseRefreshTask extends MssResponseType {
|
||||
@SerializedName("newTask")
|
||||
private int newTask;
|
||||
|
||||
public int getNewTask() {
|
||||
return newTask;
|
||||
}
|
||||
|
||||
public void setNewTask(int newTask) {
|
||||
this.newTask = newTask;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,564 @@
|
|||
/*
|
||||
* Copyright 2010 Emmanuel Astier & Kevin Gaudin
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.acra.annotation;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
import org.acra.ACRA;
|
||||
import org.acra.ACRAConstants;
|
||||
import org.acra.BaseCrashReportDialog;
|
||||
import org.acra.CrashReportDialog;
|
||||
import org.acra.ReportField;
|
||||
import org.acra.ReportingInteractionMode;
|
||||
import org.acra.sender.HttpSender.Method;
|
||||
import org.acra.sender.HttpSender.Type;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Inherited;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Provide configuration elements to the
|
||||
* {@link ACRA#init(android.app.Application)} method. The only mandatory
|
||||
* configuration item is the {@link #formUri()} parameter which is the Uri
|
||||
* to the server that will receive your reports.
|
||||
*
|
||||
* @author Kevin Gaudin
|
||||
*/
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.TYPE)
|
||||
@Inherited
|
||||
public @interface ReportsCrashes {
|
||||
|
||||
/**
|
||||
* The Uri of your own server-side script that will receive reports. This is
|
||||
* to use if you don't want to send reports to Google Docs but to your own,
|
||||
* self-hosted script.
|
||||
*
|
||||
* @return URI of a custom server to which to post reports.
|
||||
*/
|
||||
String formUri() default ACRAConstants.DEFAULT_STRING_VALUE;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* The interaction mode you want to implement. Default is
|
||||
* {@link ReportingInteractionMode#SILENT} which does not require any
|
||||
* resources configuration.
|
||||
* </p>
|
||||
* <p>
|
||||
* Other modes have resources requirements:
|
||||
* </p>
|
||||
* <ul>
|
||||
* <li>{@link ReportingInteractionMode#TOAST} requires
|
||||
* {@link #resToastText()} to be provided to define the text that you want
|
||||
* to be displayed to the user when a report is being sent.</li>
|
||||
* <li>{@link ReportingInteractionMode#NOTIFICATION} requires
|
||||
* {@link #resNotifTickerText()}, {@link #resNotifTitle()},
|
||||
* {@link #resNotifText()}, {@link #resDialogText()}.</li>
|
||||
* <li>{@link ReportingInteractionMode#DIALOG} requires
|
||||
* {@link #resDialogText()}.</li>
|
||||
* </ul>
|
||||
* <p>
|
||||
* Default is {@link ReportingInteractionMode#SILENT}
|
||||
* </p>
|
||||
*
|
||||
* @return the interaction mode that you want ACRA to implement.
|
||||
*/
|
||||
ReportingInteractionMode mode() default ReportingInteractionMode.SILENT;
|
||||
|
||||
/**
|
||||
* @return Resource id for the label of positive button in the crash dialog.
|
||||
* If not provided, defaults to 'OK'.
|
||||
*/
|
||||
int resDialogPositiveButtonText() default ACRAConstants.DEFAULT_DIALOG_POSITIVE_BUTTON_TEXT;
|
||||
|
||||
/**
|
||||
* @return Resource id for the label of negative button in the crash dialog.
|
||||
* If not provided, defaults to 'cancel'.
|
||||
*/
|
||||
int resDialogNegativeButtonText() default ACRAConstants.DEFAULT_DIALOG_NEGATIVE_BUTTON_TEXT;
|
||||
|
||||
/**
|
||||
* @return Resource id for the user comment input label in the crash dialog.
|
||||
* If not provided, disables the input field.
|
||||
*/
|
||||
int resDialogCommentPrompt() default ACRAConstants.DEFAULT_RES_VALUE;
|
||||
|
||||
/**
|
||||
* @return Resource id for the user email address input label in the crash
|
||||
* dialog. If not provided, disables the input field.
|
||||
*/
|
||||
int resDialogEmailPrompt() default ACRAConstants.DEFAULT_RES_VALUE;
|
||||
|
||||
/**
|
||||
* @return Resource id for the icon in the crash dialog. Default value is
|
||||
* the system alert icon.
|
||||
*/
|
||||
int resDialogIcon() default ACRAConstants.DEFAULT_DIALOG_ICON;
|
||||
|
||||
/**
|
||||
* @return Resource id for the Toast text triggered when the user accepts to
|
||||
* send a report in the crash dialog.
|
||||
*/
|
||||
int resDialogOkToast() default ACRAConstants.DEFAULT_RES_VALUE;
|
||||
|
||||
/**
|
||||
* @return Resource id for the text in the crash dialog.
|
||||
*/
|
||||
int resDialogText() default ACRAConstants.DEFAULT_RES_VALUE;
|
||||
|
||||
/**
|
||||
* @return Resource id for the title in the crash dialog.
|
||||
*/
|
||||
int resDialogTitle() default ACRAConstants.DEFAULT_RES_VALUE;
|
||||
|
||||
/**
|
||||
* @return Resource id for the icon in the status bar notification. Default
|
||||
* is the system error notification icon.
|
||||
*/
|
||||
int resNotifIcon() default ACRAConstants.DEFAULT_NOTIFICATION_ICON;
|
||||
|
||||
/**
|
||||
* @return Resource id for the text in the status bar notification.
|
||||
*/
|
||||
int resNotifText() default ACRAConstants.DEFAULT_RES_VALUE;
|
||||
|
||||
/**
|
||||
* @return Resource id for the ticker text in the status bar notification.
|
||||
*/
|
||||
int resNotifTickerText() default ACRAConstants.DEFAULT_RES_VALUE;
|
||||
|
||||
/**
|
||||
* @return Resource id for the title in the status bar notification.
|
||||
*/
|
||||
int resNotifTitle() default ACRAConstants.DEFAULT_RES_VALUE;
|
||||
|
||||
/**
|
||||
* Resource id for the Toast text triggered when the application crashes if
|
||||
* the {@link ReportingInteractionMode#TOAST} mode is used. Can also be used
|
||||
* in {@link ReportingInteractionMode#NOTIFICATION} and
|
||||
* {@link ReportingInteractionMode#DIALOG} modes to display a Toast message
|
||||
* while the report is being created, before the dialog/notification
|
||||
* appears. This allows the user to know what is happening just before the
|
||||
* application is terminated.
|
||||
*
|
||||
* @return Resource id for the Toast text triggered when the application
|
||||
* crashes.
|
||||
*/
|
||||
int resToastText() default ACRAConstants.DEFAULT_RES_VALUE;
|
||||
|
||||
/**
|
||||
* @return Name of the SharedPreferences that will host ACRA settings you
|
||||
* can make accessible to your users through a preferences screen:
|
||||
* <ul>
|
||||
* <li>
|
||||
* {@link ACRA#PREF_DISABLE_ACRA} or {@link ACRA#PREF_ENABLE_ACRA}</li>
|
||||
* <li>
|
||||
* {@link ACRA#PREF_ALWAYS_ACCEPT}</li>
|
||||
* <li>
|
||||
* {@link ACRA#PREF_ENABLE_DEVICE_ID}</li>
|
||||
* <li>
|
||||
* {@link ACRA#PREF_ENABLE_SYSTEM_LOGS}</li>
|
||||
* </ul>
|
||||
* preference. Default is to use the application default
|
||||
* SharedPreferences, as retrieved with
|
||||
* {@link PreferenceManager#getDefaultSharedPreferences(Context)}.
|
||||
*/
|
||||
String sharedPreferencesName() default ACRAConstants.DEFAULT_STRING_VALUE;
|
||||
|
||||
/**
|
||||
* If using a custom {@link ReportsCrashes#sharedPreferencesName()}, pass
|
||||
* here the mode that you need for the SharedPreference file creation:
|
||||
* {@link Context#MODE_PRIVATE}, {@link Context#MODE_WORLD_READABLE} or
|
||||
* {@link Context#MODE_WORLD_WRITEABLE}. Default is
|
||||
* {@link Context#MODE_PRIVATE}.
|
||||
*
|
||||
* @return Mode to use with the SharedPreference creation.
|
||||
* @see Context#getSharedPreferences(String, int)
|
||||
*/
|
||||
int sharedPreferencesMode() default ACRAConstants.DEFAULT_SHARED_PREFERENCES_MODE;
|
||||
|
||||
/**
|
||||
* If enabled, DropBox events collection will include system tags:
|
||||
* <ul>
|
||||
* <li>system_app_anr</li>
|
||||
* <li>system_app_wtf</li>
|
||||
* <li>system_app_crash</li>
|
||||
* <li>system_server_anr</li>
|
||||
* <li>system_server_wtf</li>
|
||||
* <li>system_server_crash</li>
|
||||
* <li>BATTERY_DISCHARGE_INFO</li>
|
||||
* <li>SYSTEM_RECOVERY_LOG</li>
|
||||
* <li>SYSTEM_BOOT</li>
|
||||
* <li>SYSTEM_LAST_KMSG</li>
|
||||
* <li>APANIC_CONSOLE</li>
|
||||
* <li>APANIC_THREADS</li>
|
||||
* <li>SYSTEM_RESTART</li>
|
||||
* <li>SYSTEM_TOMBSTONE</li>
|
||||
* <li>data_app_strictmode</li>
|
||||
* </ul>
|
||||
*
|
||||
* @return True if system tags are to be included as part of DropBox events.
|
||||
*/
|
||||
boolean includeDropBoxSystemTags() default ACRAConstants.DEFAULT_INCLUDE_DROPBOX_SYSTEM_TAGS;
|
||||
|
||||
/**
|
||||
* @return Array of tags that you want to be fetched when collecting DropBox
|
||||
* entries.
|
||||
*/
|
||||
String[] additionalDropBoxTags() default {};
|
||||
|
||||
/**
|
||||
* @return Number of minutes to look back when collecting events from
|
||||
* DropBoxManager.
|
||||
*/
|
||||
int dropboxCollectionMinutes() default ACRAConstants.DEFAULT_DROPBOX_COLLECTION_MINUTES;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Arguments to be passed to the logcat command line. Default is { "-t",
|
||||
* "100", "-v", "time" } for:
|
||||
* </p>
|
||||
* <p>
|
||||
* <pre>
|
||||
* logcat -t 100 -v time
|
||||
* </pre>
|
||||
* <p>
|
||||
* <p>
|
||||
* Do not include -b arguments for buffer selection, include
|
||||
* {@link ReportField#EVENTSLOG} and {@link ReportField#RADIOLOG} in
|
||||
* {@link ReportsCrashes#customReportContent()} to activate alternative
|
||||
* logcat buffers reporting. They will use the same other arguments as those
|
||||
* provided here.
|
||||
* </p>
|
||||
* <p>
|
||||
* <p>
|
||||
* See <a href=
|
||||
* "http://developer.android.com/intl/fr/guide/developing/tools/adb.html#logcatoptions"
|
||||
* >Listing of logcat Command Options</a>.
|
||||
* </p>
|
||||
*
|
||||
* @return Array of arguments to supply if retrieving the log as part of the
|
||||
* report.
|
||||
*/
|
||||
String[] logcatArguments() default {"-t", "" + ACRAConstants.DEFAULT_LOGCAT_LINES, "-v", "time"};
|
||||
|
||||
/**
|
||||
* When using the {@link #formUri()} parameter to send reports to a custom
|
||||
* server-side script, you can set here and in
|
||||
* {@link #formUriBasicAuthPassword()} the credentials for a BASIC HTTP
|
||||
* authentication.
|
||||
*
|
||||
* @return Login to use when posting reports to a custom server.
|
||||
*/
|
||||
String formUriBasicAuthLogin() default ACRAConstants.NULL_VALUE;
|
||||
|
||||
/**
|
||||
* When using the {@link #formUri()} parameter to send reports to a custom
|
||||
* server-side script, you can set here and in
|
||||
* {@link #formUriBasicAuthLogin()} the credentials for a BASIC HTTP
|
||||
* authentication.
|
||||
*
|
||||
* @return Password to use when posting reports to a custom server.
|
||||
*/
|
||||
String formUriBasicAuthPassword() default ACRAConstants.NULL_VALUE;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Redefines the list of {@link ReportField}s collected and sent in your
|
||||
* reports. If you modify this list, you have to create a new Google Drive
|
||||
* Spreadsheet & Form which will be based on these fields as column headers.
|
||||
* </p>
|
||||
* <p>
|
||||
* The fields order is significant. You can also use this property to modify
|
||||
* fields order in your reports.
|
||||
* </p>
|
||||
* <p>
|
||||
* The default list is the following, except if you send reports by mail
|
||||
* using {@link #mailTo()}.
|
||||
* </p>
|
||||
* <ul>
|
||||
* <li>
|
||||
* {@link ReportField#REPORT_ID}</li>
|
||||
* <li>
|
||||
* {@link ReportField#APP_VERSION_CODE}</li>
|
||||
* <li>
|
||||
* {@link ReportField#APP_VERSION_NAME}</li>
|
||||
* <li>
|
||||
* {@link ReportField#PACKAGE_NAME}</li>
|
||||
* <li>
|
||||
* {@link ReportField#FILE_PATH}</li>
|
||||
* <li>
|
||||
* {@link ReportField#PHONE_MODEL}</li>
|
||||
* <li>
|
||||
* {@link ReportField#BRAND}</li>
|
||||
* <li>
|
||||
* {@link ReportField#PRODUCT}</li>
|
||||
* <li>
|
||||
* {@link ReportField#ANDROID_VERSION}</li>
|
||||
* <li>
|
||||
* {@link ReportField#BUILD}</li>
|
||||
* <li>
|
||||
* {@link ReportField#TOTAL_MEM_SIZE}</li>
|
||||
* <li>
|
||||
* {@link ReportField#AVAILABLE_MEM_SIZE}</li>
|
||||
* <li>
|
||||
* {@link ReportField#CUSTOM_DATA}</li>
|
||||
* <li>
|
||||
* {@link ReportField#IS_SILENT}</li>
|
||||
* <li>
|
||||
* {@link ReportField#STACK_TRACE}</li>
|
||||
* <li>
|
||||
* {@link ReportField#INITIAL_CONFIGURATION}</li>
|
||||
* <li>
|
||||
* {@link ReportField#CRASH_CONFIGURATION}</li>
|
||||
* <li>
|
||||
* {@link ReportField#DISPLAY}</li>
|
||||
* <li>
|
||||
* {@link ReportField#USER_COMMENT}</li>
|
||||
* <li>
|
||||
* {@link ReportField#USER_EMAIL}</li>
|
||||
* <li>
|
||||
* {@link ReportField#USER_APP_START_DATE}</li>
|
||||
* <li>
|
||||
* {@link ReportField#USER_CRASH_DATE}</li>
|
||||
* <li>
|
||||
* {@link ReportField#DUMPSYS_MEMINFO}</li>
|
||||
* <li>
|
||||
* {@link ReportField#LOGCAT}</li>
|
||||
* <li>
|
||||
* {@link ReportField#INSTALLATION_ID}</li>
|
||||
* <li>
|
||||
* {@link ReportField#DEVICE_FEATURES}</li>
|
||||
* <li>
|
||||
* {@link ReportField#ENVIRONMENT}</li>
|
||||
* <li>
|
||||
* {@link ReportField#SHARED_PREFERENCES}</li>
|
||||
* <li>
|
||||
* {@link ReportField#SETTINGS_SYSTEM}</li>
|
||||
* <li>
|
||||
* {@link ReportField#SETTINGS_SECURE}</li>
|
||||
* <li>
|
||||
* {@link ReportField#SETTINGS_GLOBAL}</li>
|
||||
* </ul>
|
||||
*
|
||||
* @return ReportField Array listing the fields to be included in the
|
||||
* report.
|
||||
*/
|
||||
ReportField[] customReportContent() default {};
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Add your crash reports mailbox here if you want to send reports via
|
||||
* email. This allows to get rid of the INTERNET permission. Reports content
|
||||
* can be customized with {@link #customReportContent()} . Default fields
|
||||
* are:
|
||||
* </p>
|
||||
* <ul>
|
||||
* <li>
|
||||
* {@link ReportField#USER_COMMENT}</li>
|
||||
* <li>
|
||||
* {@link ReportField#ANDROID_VERSION}</li>
|
||||
* <li>
|
||||
* {@link ReportField#APP_VERSION_NAME}</li>
|
||||
* <li>
|
||||
* {@link ReportField#BRAND}</li>
|
||||
* <li>
|
||||
* {@link ReportField#PHONE_MODEL}</li>
|
||||
* <li>
|
||||
* {@link ReportField#CUSTOM_DATA}</li>
|
||||
* <li>
|
||||
* {@link ReportField#STACK_TRACE}</li>
|
||||
* </ul>
|
||||
*
|
||||
* @return email address to which to send reports.
|
||||
*/
|
||||
String mailTo() default ACRAConstants.DEFAULT_STRING_VALUE;
|
||||
|
||||
/**
|
||||
* Controls whether unapproved reports are deleted on application start or
|
||||
* not. Default is true. This is a change from versions of ACRA before 3.2
|
||||
* as in {@link ReportingInteractionMode#NOTIFICATION} mode reports were
|
||||
* previously kept until the user explicitly opens the Notification dialog
|
||||
* AND choose to send or discard the report. Until then, on application
|
||||
* restart, ACRA was issuing a new crash notification for previous reports
|
||||
* pending for approval. This could be misunderstood by the user with a new
|
||||
* crash, resulting in bad appreciation of the application.
|
||||
*
|
||||
* @return true if ACRA should delete unapproved reports on application
|
||||
* start.
|
||||
*/
|
||||
boolean deleteUnapprovedReportsOnApplicationStart() default ACRAConstants.DEFAULT_DELETE_UNAPPROVED_REPORTS_ON_APPLICATION_START;
|
||||
|
||||
/**
|
||||
* This property can be used to determine whether old (out of date) reports
|
||||
* should be sent or not. By default they are discarded.
|
||||
*
|
||||
* @return true if ACRA should delete any unsent reports on startup if the
|
||||
* application has been updated since the last time the application
|
||||
* was started.
|
||||
*/
|
||||
boolean deleteOldUnsentReportsOnApplicationStart() default ACRAConstants.DEFAULT_DELETE_OLD_UNSENT_REPORTS_ON_APPLICATION_START;
|
||||
|
||||
/**
|
||||
* @return Value in milliseconds for timeout attempting to connect to a
|
||||
* network (default 3000ms).
|
||||
*/
|
||||
int connectionTimeout() default ACRAConstants.DEFAULT_CONNECTION_TIMEOUT;
|
||||
|
||||
/**
|
||||
* If the request is retried due to timeout, the socketTimeout will double
|
||||
* before retrying the request.
|
||||
*
|
||||
* @return Value in milliseconds for timeout receiving a response to a
|
||||
* network request (default 5000ms).
|
||||
* @see #maxNumberOfRequestRetries()
|
||||
*/
|
||||
int socketTimeout() default ACRAConstants.DEFAULT_SOCKET_TIMEOUT;
|
||||
|
||||
/**
|
||||
* @return Maximum number of times a network request will be retried when
|
||||
* receiving the response times out (default 3).
|
||||
* @see #socketTimeout()
|
||||
*/
|
||||
int maxNumberOfRequestRetries() default ACRAConstants.DEFAULT_MAX_NUMBER_OF_REQUEST_RETRIES;
|
||||
|
||||
/**
|
||||
* In {@link ReportingInteractionMode#TOAST} mode, set this to true if you
|
||||
* prefer displaying the native Force Close dialog after the Toast.
|
||||
*
|
||||
* @return true if the Force Close dialog has to be displayed.
|
||||
*/
|
||||
boolean forceCloseDialogAfterToast() default ACRAConstants.DEFAULT_FORCE_CLOSE_DIALOG_AFTER_TOAST;
|
||||
|
||||
/**
|
||||
* Add here your {@link SharedPreferences} identifier Strings if you use
|
||||
* others than your application's default. They will be added to the
|
||||
* {@link ReportField#SHARED_PREFERENCES} field.
|
||||
*
|
||||
* @return String Array containing the names of the additional preferences.
|
||||
*/
|
||||
String[] additionalSharedPreferences() default {};
|
||||
|
||||
/**
|
||||
* Set this to true if you want to include only logcat lines related to your
|
||||
* Application process.
|
||||
*
|
||||
* @return true if you want to filter logcat with your process id.
|
||||
*/
|
||||
boolean logcatFilterByPid() default ACRAConstants.DEFAULT_LOGCAT_FILTER_BY_PID;
|
||||
|
||||
/**
|
||||
* Set this to false if you want to disable sending reports in development
|
||||
* mode. Only signed application packages will send reports. Default value
|
||||
* is true.
|
||||
*
|
||||
* @return false if reports should not be sent.
|
||||
*/
|
||||
boolean sendReportsInDevMode() default ACRAConstants.DEFAULT_SEND_REPORTS_IN_DEV_MODE;
|
||||
|
||||
/**
|
||||
* Set this to false if you want to disable sending reports at the time the
|
||||
* exception is caught. In this case, reports will not be sent until the
|
||||
* application is restarted.
|
||||
*
|
||||
* @return false if reports should not be sent.
|
||||
*/
|
||||
boolean sendReportsAtShutdown() default ACRAConstants.DEFAULT_SEND_REPORTS_AT_SHUTDOWN;
|
||||
|
||||
/**
|
||||
* Provide here regex patterns to be evaluated on each SharedPreference key
|
||||
* to exclude KV pairs from the collected SharedPreferences. This allows you
|
||||
* to exclude sensitive user data like passwords to be collected.
|
||||
*
|
||||
* @return an array of regex patterns, every matching key is not collected.
|
||||
*/
|
||||
String[] excludeMatchingSharedPreferencesKeys() default {};
|
||||
|
||||
/**
|
||||
* Provide here regex patterns to be evaluated on each Settings.System,
|
||||
* Settings.Secure and Settings.Global key to exclude KV pairs from the
|
||||
* collected SharedPreferences. This allows you to exclude sensitive data to
|
||||
* be collected.
|
||||
*
|
||||
* @return an array of regex patterns, every matching key is not collected.
|
||||
*/
|
||||
String[] excludeMatchingSettingsKeys() default {};
|
||||
|
||||
/**
|
||||
* The default value will be a BuildConfig class residing in the same package as the Application class.
|
||||
*
|
||||
* @return BuildConfig class from which to read any BuildConfig attributes.
|
||||
*/
|
||||
Class buildConfigClass() default Object.class;
|
||||
|
||||
/**
|
||||
* To use in combination with {@link ReportField#APPLICATION_LOG} to set the
|
||||
* path/name of your application log file. If the string does not contain
|
||||
* any path separator, the file is assumed as being in
|
||||
* {@link Context#getFilesDir()}.
|
||||
*
|
||||
* @return a String containing the path/name of your application log file.
|
||||
* If the string does not containt any path separator, the file is
|
||||
* assumed as being in {@link Context#getFilesDir()}.
|
||||
*/
|
||||
String applicationLogFile() default ACRAConstants.DEFAULT_APPLICATION_LOGFILE;
|
||||
|
||||
/**
|
||||
* To use in combination with {@link ReportField#APPLICATION_LOG} to set the
|
||||
* number of latest lines of your application log file to be collected.
|
||||
* Default value is 100.
|
||||
*
|
||||
* @return number of lines to collect.
|
||||
*/
|
||||
int applicationLogFileLines() default ACRAConstants.DEFAULT_APPLICATION_LOGFILE_LINES;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Set this to true if you need to post reports to your own server using an
|
||||
* SSL connection with a self-signed certificate.
|
||||
* </p>
|
||||
*
|
||||
* @return True if SSL certificates validation has to be ignored when
|
||||
* posting reports.
|
||||
*/
|
||||
boolean disableSSLCertValidation() default ACRAConstants.DEFAULT_DISABLE_SSL_CERT_VALIDATION;
|
||||
|
||||
String httpsSocketFactoryFactoryClass() default ACRAConstants.DEFAULT_HTTP_SOCKET_FACTORY_FACTORY_CLASS;
|
||||
|
||||
/**
|
||||
* @return Class for the CrashReportDialog used when sending intent.
|
||||
* If not provided, defaults to CrashReportDialog.class
|
||||
*/
|
||||
Class<? extends BaseCrashReportDialog> reportDialogClass() default CrashReportDialog.class;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* The {@link Method} to be used when posting with {@link #formUri()}.
|
||||
* </p>
|
||||
*
|
||||
* @return HTTP method used when posting reports.
|
||||
*/
|
||||
Method httpMethod() default Method.POST;
|
||||
|
||||
Type reportType() default Type.FORM;
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 3.3 KiB |
|
@ -0,0 +1,387 @@
|
|||
package com.adins.mss.svy.fragments;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.text.format.DateFormat;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
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.CustomerFragment;
|
||||
import com.adins.mss.base.dynamicform.SurveyHeaderBean;
|
||||
import com.adins.mss.base.tasklog.SurveyTaskAdapter;
|
||||
import com.adins.mss.base.todolist.form.OnTaskListClickListener;
|
||||
import com.adins.mss.base.todolist.form.TasklistListener;
|
||||
import com.adins.mss.base.util.Utility;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.dao.TaskH;
|
||||
import com.adins.mss.dummy.userhelp_dummy.Adapter.NewTaskLogDummyAdapter;
|
||||
import com.adins.mss.foundation.db.dataaccess.TaskHDataAccess;
|
||||
import com.adins.mss.foundation.dialog.NiftyDialogBuilder;
|
||||
import com.adins.mss.svy.R;
|
||||
import com.adins.mss.svy.UserHelpSVYDummy;
|
||||
import com.adins.mss.svy.tool.Constants;
|
||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
|
||||
import org.acra.ACRA;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
public class SurveyApprovalFragment extends Fragment implements OnTaskListClickListener, TasklistListener {
|
||||
public static TaskH selectedApproval;
|
||||
private static Menu mainMenu;
|
||||
private List<TaskH> objects;
|
||||
private SurveyTaskAdapter adapter;
|
||||
// private GridView gridView;
|
||||
private RecyclerView recyclerView;
|
||||
private Context context;
|
||||
private SwipeRefreshLayout mSwipeRefreshLayout;
|
||||
private String errMessage = null;
|
||||
private SurveyActivityInterface iSurveyActivity;
|
||||
private LinearLayoutManager layoutManager;
|
||||
private boolean showDummy = true;
|
||||
|
||||
private FirebaseAnalytics screenName;
|
||||
@Override
|
||||
public void onAttach(Context activity) {
|
||||
super.onAttach(activity);
|
||||
this.context = activity;
|
||||
iSurveyActivity = new SurveyActivityImpl(activity);
|
||||
setHasOptionsMenu(true);
|
||||
try {
|
||||
objects = Constants.listOfApprovalTask;
|
||||
if (objects == null || objects.size() == 0) {
|
||||
objects = TaskHDataAccess.getAllApprovalForUser(getActivity(), GlobalData.getSharedGlobalData().getUser().getUuid_user());
|
||||
Constants.listOfApprovalTask = objects;
|
||||
}
|
||||
try {
|
||||
// MSMainMenuActivity.mnSVYApproval.setCounter(String.valueOf(Constants.getCounterApprovalTask(getActivity())));
|
||||
// if(MainMenuActivity.menuAdapter!=null)
|
||||
// MainMenuActivity.menuAdapter.notifyDataSetChanged();
|
||||
// MainMenuActivity.setDrawerCounter();
|
||||
NewMainActivity.setCounter();
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
ACRA.getErrorReporter().putCustomData("ErrorMainMenuActivity", e.getMessage());
|
||||
ACRA.getErrorReporter().putCustomData("ErrorMainMenuActivity", DateFormat.format("yyyy.MM.dd G \'at\' HH:mm:ss z", Calendar.getInstance().getTime()).toString());
|
||||
ACRA.getErrorReporter().handleSilentException(new Exception("Exception saat set Drawer Counter"));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
// TODO: handle exception
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
Utility.freeMemory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
screenName = FirebaseAnalytics.getInstance(getActivity());
|
||||
View view = inflater.inflate(R.layout.new_fragment_survey_verification, container, false);
|
||||
this.mSwipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.swipeRefreshLayout);
|
||||
this.mSwipeRefreshLayout.setColorSchemeColors(getResources().getColor(com.adins.mss.base.R.color.tv_light),
|
||||
getResources().getColor(com.adins.mss.base.R.color.tv_normal),
|
||||
getResources().getColor(com.adins.mss.base.R.color.tv_dark),
|
||||
getResources().getColor(com.adins.mss.base.R.color.tv_darker));
|
||||
this.mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||
public void onRefresh() {
|
||||
SurveyApprovalFragment.this.initiateRefresh();
|
||||
}
|
||||
});
|
||||
// getActivity().getActionBar().setTitle(getString(com.adins.mss.svy.R.string.title_mn_surveyapproval));
|
||||
|
||||
// olivia : set toolbar
|
||||
getActivity().findViewById(com.adins.mss.base.R.id.search).setVisibility(View.GONE);
|
||||
getActivity().findViewById(com.adins.mss.base.R.id.spinner).setVisibility(View.GONE);
|
||||
getActivity().setTitle(getString(com.adins.mss.base.R.string.title_mn_surveyapproval));
|
||||
|
||||
recyclerView = (RecyclerView) view.findViewById(R.id.list);
|
||||
layoutManager = new LinearLayoutManager(getContext());
|
||||
recyclerView.setLayoutManager(layoutManager);
|
||||
recyclerView.setHasFixedSize(true);
|
||||
recyclerView.getRecycledViewPool().setMaxRecycledViews(1, 500);
|
||||
// initiateRefresh();
|
||||
adapter = new SurveyTaskAdapter(getActivity(), objects, SurveyApprovalFragment.this);
|
||||
recyclerView.setAdapter(adapter);
|
||||
if(Global.ENABLE_USER_HELP &&
|
||||
showDummy &&
|
||||
Global.userHelpDummyGuide.get(SurveyApprovalFragment.this.getClass().getSimpleName()) != null &&
|
||||
Global.userHelpDummyGuide.get(SurveyApprovalFragment.this.getClass().getSimpleName()).size()>0) {
|
||||
NewTaskLogDummyAdapter dummyAdapter = new NewTaskLogDummyAdapter();
|
||||
recyclerView.setAdapter(dummyAdapter);
|
||||
UserHelpSVYDummy userHelpSVYDummy = new UserHelpSVYDummy();
|
||||
userHelpSVYDummy.showDummyVerif(SurveyApprovalFragment.this.getActivity(),SurveyApprovalFragment.this.getClass().getSimpleName(), recyclerView,adapter);
|
||||
showDummy = false;
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if(item.getItemId() == R.id.mnGuide){
|
||||
if(!Global.BACKPRESS_RESTRICTION) {
|
||||
if(!Global.BACKPRESS_RESTRICTION) {
|
||||
NewTaskLogDummyAdapter dummyAdapter = new NewTaskLogDummyAdapter();
|
||||
recyclerView.setAdapter(dummyAdapter);
|
||||
UserHelpSVYDummy userHelpSVYDummy = new UserHelpSVYDummy();
|
||||
userHelpSVYDummy.showDummyVerif(SurveyApprovalFragment.this.getActivity(), SurveyApprovalFragment.this.getClass().getSimpleName(), recyclerView, adapter);
|
||||
showDummy = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
private void initiateRefresh() {
|
||||
// RefreshBackgroundTask task = new RefreshBackgroundTask();
|
||||
// task.execute();
|
||||
iSurveyActivity.getBackgroundTask(SurveyApprovalFragment.this, false, false);
|
||||
}
|
||||
|
||||
private void onRefreshComplete(List<TaskH> result) {
|
||||
this.mSwipeRefreshLayout.setRefreshing(false);
|
||||
NiftyDialogBuilder fragment;
|
||||
objects = result;
|
||||
|
||||
try {
|
||||
// MSMainMenuActivity.mnSVYApproval.setCounter(String.valueOf(Constants.getCounterApprovalTask(getActivity())));
|
||||
// if(MainMenuActivity.menuAdapter!=null)
|
||||
// MainMenuActivity.menuAdapter.notifyDataSetChanged();
|
||||
// MainMenuActivity.setDrawerCounter();
|
||||
NewMainActivity.setCounter();
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
ACRA.getErrorReporter().putCustomData("ErrorMainMenuActivity", e.getMessage());
|
||||
ACRA.getErrorReporter().putCustomData("ErrorMainMenuActivity", DateFormat.format("yyyy.MM.dd G \'at\' HH:mm:ss z", Calendar.getInstance().getTime()).toString());
|
||||
ACRA.getErrorReporter().handleSilentException(new Exception("Exception saat set Drawer Counter"));
|
||||
}
|
||||
|
||||
// if (this.errMessage != null) {
|
||||
// fragment = NiftyDialogBuilder.getInstance(this.context);
|
||||
// fragment.withTitle(context.getString(com.adins.mss.base.R.string.error_capital)).withMessage(this.errMessage).show();
|
||||
// } else
|
||||
if (result != null && result.size() != 0) {
|
||||
try {
|
||||
if(objects==null || objects.size()==0){
|
||||
Constants.listOfApprovalTask = objects;
|
||||
adapter = new SurveyTaskAdapter(getActivity(), objects, SurveyApprovalFragment.this);
|
||||
recyclerView.setAdapter(adapter);
|
||||
// MSMainMenuActivity.mnSVYApproval.setCounter(String.valueOf(Constants.getCounterApprovalTask(getActivity())));
|
||||
// MSMainMenuActivity.menuAdapter.notifyDataSetChanged();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
e.getMessage();
|
||||
}
|
||||
}
|
||||
// else {
|
||||
// Constants.listOfApprovalTask = objects;
|
||||
// adapter = new TaskLogArrayAdapter(getActivity(), objects, false);
|
||||
// listView.setAdapter(adapter);
|
||||
// //MainMenuActivity.mnSVYApproval.setCounter(String.valueOf(Constants.getCounterApprovalTask(context)));
|
||||
// fragment = NiftyDialogBuilder.getInstance(this.context);
|
||||
// fragment.withTitle(context.getString(com.adins.mss.base.R.string.info_capital)).withMessage(getString(com.adins.mss.base.R.string.msgNoApproval)).show();
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
adapter = null;
|
||||
Constants.listOfApprovalTask = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
// getActivity().getActionBar().removeAllTabs();
|
||||
// getActivity().getActionBar().setTitle(getString(com.adins.mss.svy.R.string.title_mn_surveyapproval));
|
||||
// getActivity().getActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
|
||||
//Set Firebase screen name
|
||||
screenName.setCurrentScreen(getActivity(), getString(R.string.screen_name_survey_approval), null);
|
||||
|
||||
// olivia : set toolbar
|
||||
getActivity().findViewById(com.adins.mss.base.R.id.search).setVisibility(View.GONE);
|
||||
getActivity().findViewById(com.adins.mss.base.R.id.spinner).setVisibility(View.GONE);
|
||||
getActivity().setTitle(getString(com.adins.mss.base.R.string.title_mn_surveyapproval));
|
||||
|
||||
try {
|
||||
// MSMainMenuActivity.mnSVYApproval.setCounter(String.valueOf(Constants.getCounterApprovalTask(getActivity())));
|
||||
// if(MainMenuActivity.menuAdapter!=null)
|
||||
// MainMenuActivity.menuAdapter.notifyDataSetChanged();
|
||||
// MainMenuActivity.setDrawerCounter();
|
||||
NewMainActivity.setCounter();
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
ACRA.getErrorReporter().putCustomData("ErrorMainMenuActivity", e.getMessage());
|
||||
ACRA.getErrorReporter().putCustomData("ErrorMainMenuActivity", DateFormat.format("yyyy.MM.dd G \'at\' HH:mm:ss z", Calendar.getInstance().getTime()).toString());
|
||||
ACRA.getErrorReporter().handleSilentException(new Exception("Exception saat set Drawer Counter"));
|
||||
}
|
||||
|
||||
// if(objects!=null && objects.size()>0){
|
||||
objects = TaskHDataAccess.getAllApprovalForUser(getActivity(), GlobalData.getSharedGlobalData().getUser().getUuid_user());
|
||||
Constants.listOfApprovalTask = objects;
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClickListener(TaskH item, int position) {
|
||||
selectedApproval = item;
|
||||
SurveyHeaderBean header = new SurveyHeaderBean(selectedApproval);
|
||||
// TODO Action Lempar ke Customer ACtivity
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable(CustomerFragment.SURVEY_HEADER, header);
|
||||
bundle.putInt(CustomerFragment.SURVEY_MODE, Global.MODE_VIEW_SENT_SURVEY);
|
||||
Fragment fragment = com.adins.mss.base.dynamicform.CustomerFragment.create(header);
|
||||
|
||||
FragmentTransaction transaction = NewMainActivity.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();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemLongClickListener(TaskH item, int position) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefreshBackgroundCancelled(boolean value) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefreshBackgroundComplete(List<TaskH> result) {
|
||||
onRefreshComplete(result);
|
||||
}
|
||||
|
||||
|
||||
// @SuppressLint({"NewApi"})
|
||||
// private class RefreshBackgroundTask extends AsyncTask<Void, Void, List<TaskH>> {
|
||||
// static final int TASK_DURATION = 2000;
|
||||
//
|
||||
// private RefreshBackgroundTask() {
|
||||
// }
|
||||
//
|
||||
// protected List<TaskH> doInBackground(Void... params) {
|
||||
// List<TaskH> result = null;
|
||||
// User user = GlobalData.getSharedGlobalData().getUser();
|
||||
//
|
||||
// if (Tool.isInternetconnected(context)) {
|
||||
// MssRequestType requestType = new MssRequestType();
|
||||
// requestType.setAudit(GlobalData.getSharedGlobalData().getAuditData());
|
||||
// requestType.addImeiAndroidIdToUnstructured();
|
||||
//
|
||||
// String json = GsonHelper.toJson(requestType);
|
||||
// String url = GlobalData.getSharedGlobalData().getURL_GET_LIST_APPROVAL();
|
||||
// boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
|
||||
// boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
|
||||
// HttpCryptedConnection httpConn = new HttpCryptedConnection(getActivity(), encrypt, decrypt);
|
||||
// HttpConnectionResult serverResult = null;
|
||||
// try {
|
||||
// result = TaskHDataAccess.getAllApprovalForUser(context, GlobalData.getSharedGlobalData().getUser().getUuid_user());
|
||||
// if (result != null && result.size() > 0)
|
||||
// serverResult = httpConn.requestToServer(url, json, Global.SORTCONNECTIONTIMEOUT);
|
||||
// else
|
||||
// serverResult = httpConn.requestToServer(url, json, Global.DEFAULTCONNECTIONTIMEOUT);
|
||||
// } catch (Exception e) { FireCrash.log(e);
|
||||
// e.printStackTrace();
|
||||
// errMessage = e.getMessage();
|
||||
// }
|
||||
//
|
||||
// String stringResult = serverResult.getResult();
|
||||
//
|
||||
// try {
|
||||
// JsonResponseTaskList taskList = GsonHelper.fromJson(stringResult, JsonResponseTaskList.class);
|
||||
// if (taskList.getStatus().getCode() == 0) {
|
||||
// List<TaskH> listTaskH = taskList.getListTaskList();
|
||||
// if (listTaskH != null && listTaskH.size() > 0) {
|
||||
// String uuid_timelineType = TimelineTypeDataAccess.getTimelineTypebyType(getActivity(), Global.TIMELINE_TYPE_APPROVAL).getUuid_timeline_type();
|
||||
// for (TaskH taskHLocal : result) {
|
||||
// boolean wasDeleted = true;
|
||||
// for (TaskH taskH : listTaskH) {
|
||||
// if (taskH.getUuid_task_h().equals(taskHLocal.getUuid_task_h()))
|
||||
// wasDeleted = false;
|
||||
// }
|
||||
// if (wasDeleted) {
|
||||
// TaskHDataAccess.delete(getActivity(), taskHLocal);
|
||||
// /*Timeline timeline = TimelineDataAccess.getOneTimelineByTaskH(getActivity(), user.getUuid_user(), taskHLocal.getUuid_task_h(), uuid_timelineType);
|
||||
// if(timeline != null)
|
||||
// TimelineDataAccess.delete(getActivity(), timeline);*/
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// for (TaskH taskH : listTaskH) {
|
||||
// taskH.setUser(user);
|
||||
// taskH.setIs_verification(Global.TRUE_STRING);
|
||||
//
|
||||
// String uuid_scheme = taskH.getUuid_scheme();
|
||||
// Scheme scheme = SchemeDataAccess.getOne(getActivity(), uuid_scheme);
|
||||
// if (scheme != null) {
|
||||
// taskH.setScheme(scheme);
|
||||
//
|
||||
// TaskH h = TaskHDataAccess.getOneHeader(getActivity(), taskH.getUuid_task_h());
|
||||
// boolean wasInTimeline = TimelineDataAccess.getOneTimelineByTaskH(getActivity(), user.getUuid_user(), taskH.getUuid_task_h(), uuid_timelineType) != null;
|
||||
// if (h != null && h.getStatus() != null) {
|
||||
// if (!ToDoList.isOldTask(h)) {
|
||||
// TaskHDataAccess.addOrReplace(getActivity(), taskH);
|
||||
// if (!wasInTimeline)
|
||||
// TimelineManager.insertTimeline(getActivity(), taskH);
|
||||
// }
|
||||
// } else {
|
||||
// TaskHDataAccess.addOrReplace(getActivity(), taskH);
|
||||
// if (!wasInTimeline)
|
||||
// TimelineManager.insertTimeline(getActivity(), taskH);
|
||||
// }
|
||||
// } else {
|
||||
// errMessage = context.getString(com.adins.mss.base.R.string.scheme_not_found);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// errMessage = stringResult;
|
||||
// }
|
||||
// } catch (Exception e) { FireCrash.log(e);
|
||||
// errMessage = e.getMessage();
|
||||
// }
|
||||
// }
|
||||
// try {
|
||||
//// if (context != null) {
|
||||
//// result = TaskHDataAccess.getAllApprovalForUser(context, GlobalData.getSharedGlobalData().getUser().getUuid_user());
|
||||
//// } else if (getActivity() != null) {
|
||||
//// result = TaskHDataAccess.getAllApprovalForUser(context, GlobalData.getSharedGlobalData().getUser().getUuid_user());
|
||||
//// } else {
|
||||
//// result = TaskHDataAccess.getAllApprovalForUser(context, GlobalData.getSharedGlobalData().getUser().getUuid_user());
|
||||
//// }
|
||||
// } catch (Exception var6) {
|
||||
// var6.printStackTrace();
|
||||
// errMessage = var6.getMessage();
|
||||
// }
|
||||
//
|
||||
// return result;
|
||||
// }
|
||||
//
|
||||
// protected void onPostExecute(List<TaskH> result) {
|
||||
// super.onPostExecute(result);
|
||||
// SurveyApprovalFragment.this.onRefreshComplete(result);
|
||||
// }
|
||||
// }
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package com.adins.mss.foundation.UserHelp.Bean;
|
||||
|
||||
public class UserHelpProperties {
|
||||
private String text;
|
||||
private int sequence;
|
||||
private boolean square;
|
||||
private boolean recycled;
|
||||
private int viewHolderPos;
|
||||
|
||||
public UserHelpProperties(){ }
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public boolean isSquare() {
|
||||
return square;
|
||||
}
|
||||
|
||||
public void setSquare(boolean square) {
|
||||
this.square = square;
|
||||
}
|
||||
|
||||
public int getSequence() {
|
||||
return sequence;
|
||||
}
|
||||
|
||||
public void setSequence(int sequence) {
|
||||
this.sequence = sequence;
|
||||
}
|
||||
|
||||
public boolean isRecycled() {
|
||||
return recycled;
|
||||
}
|
||||
|
||||
public void setRecycled(boolean recycled) {
|
||||
this.recycled = recycled;
|
||||
}
|
||||
|
||||
public int getViewHolderPos() {
|
||||
return viewHolderPos;
|
||||
}
|
||||
|
||||
public void setViewHolderPos(int viewHolderPos) {
|
||||
this.viewHolderPos = viewHolderPos;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,163 @@
|
|||
package com.adins.mss.base.loyalti.mypointdashboard;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.GridView;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.cardview.widget.CardView;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.adins.mss.base.R;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.foundation.formatter.Tool;
|
||||
|
||||
import com.adins.mss.base.loyalti.mypointdashboard.DashboardMyPoint.OnListFragmentInteractionListener;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
|
||||
public class DashboardMyPointItemRecyclerViewAdapter extends RecyclerView.Adapter<DashboardMyPointItemRecyclerViewAdapter.ViewHolder> {
|
||||
|
||||
private final OnListFragmentInteractionListener mListener;
|
||||
private final Context mContext;
|
||||
DetailKompetisiResponse dataDetailKompetisi;
|
||||
|
||||
|
||||
public DashboardMyPointItemRecyclerViewAdapter(OnListFragmentInteractionListener listener, Context context) {
|
||||
mListener = listener;
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
public void setDataDetailKompetisi(DetailKompetisiResponse dataDetailKompetisi) {
|
||||
this.dataDetailKompetisi = dataDetailKompetisi;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.fragment_my_point, parent, false);
|
||||
return new ViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(final ViewHolder holder, final int position) {
|
||||
holder.mItem = dataDetailKompetisi;
|
||||
|
||||
Date mydate = new Date(System.currentTimeMillis() - (1000 * 60 * 60 * 24));
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat(Global.DATE_STR_FORMAT3);
|
||||
String yestr = dateFormat.format(mydate);
|
||||
|
||||
holder.labelPointSaya.setText(mContext.getString(R.string.my_rank, yestr));
|
||||
|
||||
DateFormat inputFormatter1 = new SimpleDateFormat(Global.DATE_STR_FORMAT1);
|
||||
Date datetanggal1 = null;
|
||||
try {
|
||||
datetanggal1 = inputFormatter1.parse(dataDetailKompetisi.getResultList().get(position).getMEMBERSHIP_PROGRAM_START_DATE());
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
DateFormat outputFormatter2 = new SimpleDateFormat(Global.DATE_STR_FORMAT3);
|
||||
String outputtanggal1 = outputFormatter2.format(datetanggal1); //
|
||||
Date datetanggal2 = null;
|
||||
try {
|
||||
datetanggal2 = inputFormatter1.parse(dataDetailKompetisi.getResultList().get(position).getMEMBERSHIP_PROGRAM_EXPIRED_DATE());
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
String outputtanggal2 = outputFormatter2.format(datetanggal2); //
|
||||
|
||||
holder.startDate.setText(outputtanggal1 + " - " + outputtanggal2);
|
||||
holder.competitionName.setText(dataDetailKompetisi.getResultList().get(position).getMEMBERSHIP_PROGRAM_NAME());
|
||||
|
||||
final double d = Double.parseDouble(dataDetailKompetisi.getResultList().get(position).getTEAM_MEMBER().get(0).getPOINT_PERIOD());
|
||||
String pointPeriod = Tool.formatToCurrency(d);
|
||||
holder.poinPeriod.setText(pointPeriod);
|
||||
|
||||
if (dataDetailKompetisi.getResultList().get(position).getTEAM_MEMBER().get(0).getPOINT_PERIOD().length() > 4) {
|
||||
holder.poinPeriod.setTextSize(12);
|
||||
} else {
|
||||
holder.poinPeriod.setTextSize(15);
|
||||
}
|
||||
|
||||
GetLogoKompetisi getLogoKompetisi = new GetLogoKompetisi(mContext, dataDetailKompetisi.getResultList().get(position).getMEMBERSHIP_PROGRAM_CODE(), holder.logoKompetisi);
|
||||
getLogoKompetisi.execute();
|
||||
|
||||
ArrayList<TeamMember.DataGroupRank> dataGroupRank = dataDetailKompetisi.getResultList().get(position).getTEAM_MEMBER().get(0).getDATA_GROUP_RANK();
|
||||
|
||||
holder.myPointLayout.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (null != mListener) {
|
||||
// Notify the active callbacks interface (the activity, if the
|
||||
// fragment is attached to one) that an item has been selected.
|
||||
if (d == 0) {
|
||||
Toast.makeText(mContext, mContext.getString(R.string.points_detail_not_found), Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("MembershipProgramCode", dataDetailKompetisi.getResultList().get(position).getMEMBERSHIP_PROGRAM_CODE());
|
||||
bundle.putString("MembershipProgramName", dataDetailKompetisi.getResultList().get(position).getMEMBERSHIP_PROGRAM_NAME());
|
||||
bundle.putString("ProgramStartDate", dataDetailKompetisi.getResultList().get(position).getMEMBERSHIP_PROGRAM_START_DATE());
|
||||
bundle.putString("CurrentMonthPoint", dataDetailKompetisi.getResultList().get(position).getTEAM_MEMBER().get(0).getPOINT_MONTH());
|
||||
bundle.putString("PreMonthPoint", dataDetailKompetisi.getResultList().get(position).getTEAM_MEMBER().get(0).getPOINT_MONTH_BEFORE());
|
||||
bundle.putString("GracePointNow", dataDetailKompetisi.getResultList().get(position).getTEAM_MEMBER().get(0).getPOINT_PERIOD());
|
||||
bundle.putString("GracePointBefore", dataDetailKompetisi.getResultList().get(position).getTEAM_MEMBER().get(0).getPOINT_PERIOD_BEFORE());
|
||||
mListener.onListFragmentInteraction(bundle);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
GridDashBoardAdapter adapter = new GridDashBoardAdapter(mContext, dataGroupRank);
|
||||
holder.gridView.setAdapter(adapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return dataDetailKompetisi.getResultList().size();
|
||||
}
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder {
|
||||
public final View mView;
|
||||
public final TextView competitionName;
|
||||
public final TextView poinPeriod;
|
||||
public final TextView startDate;
|
||||
public final TextView labelPointSaya;
|
||||
public final GridView gridView;
|
||||
public final ImageView logoKompetisi;
|
||||
public final CardView cardView;
|
||||
public DetailKompetisiResponse mItem;
|
||||
public LinearLayout myPointLayout;
|
||||
|
||||
public ViewHolder(View view) {
|
||||
super(view);
|
||||
mView = view;
|
||||
myPointLayout = view.findViewById(R.id.my_point_layout);
|
||||
cardView = view.findViewById(R.id.card_view);
|
||||
competitionName = view.findViewById(R.id.namaKompetisi);
|
||||
poinPeriod = view.findViewById(R.id.poinPeriod);
|
||||
labelPointSaya = view.findViewById(R.id.labelRank);
|
||||
|
||||
startDate = view.findViewById(R.id.dateEvent);
|
||||
gridView = view.findViewById(R.id.gridview);
|
||||
logoKompetisi = view.findViewById(R.id.logoKompetisi);
|
||||
|
||||
//marquee purpose, since name limit is 200 character
|
||||
competitionName.setSelected(true);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 157 KiB |
|
@ -0,0 +1,139 @@
|
|||
package com.adins.mss.foundation.db.dataaccess;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.adins.mss.dao.Comment;
|
||||
import com.adins.mss.dao.CommentDao;
|
||||
import com.adins.mss.dao.DaoSession;
|
||||
import com.adins.mss.foundation.db.DaoOpenHelper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import de.greenrobot.dao.query.QueryBuilder;
|
||||
|
||||
public class CommentDataAccess {
|
||||
|
||||
// private static DaoOpenHelper daoOpenHelper;
|
||||
|
||||
/**
|
||||
* use to generate dao session that you can access modelDao
|
||||
*
|
||||
* @param context --> context from activity
|
||||
* @return
|
||||
*/
|
||||
protected static DaoSession getDaoSession(Context context) {
|
||||
// if(daoOpenHelper==null){
|
||||
//// if(daoOpenHelper.getDaoSession()==null)
|
||||
// daoOpenHelper = new DaoOpenHelper(context);
|
||||
// }
|
||||
// DaoSession daoSeesion = daoOpenHelper.getDaoSession();
|
||||
// return daoSeesion;
|
||||
return DaoOpenHelper.getDaoSession(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* get comment dao and you can access the DB
|
||||
*
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
protected static CommentDao getCommentDao(Context context) {
|
||||
return getDaoSession(context).getCommentDao();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear session, close db and set daoOpenHelper to null
|
||||
*/
|
||||
public static void closeAll() {
|
||||
DaoOpenHelper.closeAll();
|
||||
// if(daoOpenHelper!=null){
|
||||
// daoOpenHelper.closeAll();
|
||||
// daoOpenHelper = null;
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* add comment as entity
|
||||
*
|
||||
* @param context
|
||||
* @param comment
|
||||
*/
|
||||
public static void add(Context context, Comment comment) {
|
||||
getCommentDao(context).insert(comment);
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* add comment as list entity
|
||||
*
|
||||
* @param context
|
||||
* @param commentList
|
||||
*/
|
||||
public static void add(Context context, List<Comment> commentList) {
|
||||
getCommentDao(context).insertInTx(commentList);
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* delete all content in table.
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
public static void clean(Context context) {
|
||||
getCommentDao(context).deleteAll();
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* @param comment
|
||||
*/
|
||||
public static void delete(Context context, Comment comment) {
|
||||
getCommentDao(context).delete(comment);
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* delete all record by keyTimeline
|
||||
*
|
||||
* @param context
|
||||
* @param keyTimeline
|
||||
*/
|
||||
public static void delete(Context context, String keyTimeline) {
|
||||
QueryBuilder<Comment> qb = getCommentDao(context).queryBuilder();
|
||||
qb.where(CommentDao.Properties.Uuid_timeline.eq(keyTimeline));
|
||||
qb.build();
|
||||
getCommentDao(context).deleteInTx(qb.list());
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* @param comment
|
||||
*/
|
||||
public static void update(Context context, Comment comment) {
|
||||
getCommentDao(context).update(comment);
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* select * from table where uuid_timeline = param
|
||||
*
|
||||
* @param context
|
||||
* @param keyTimeline
|
||||
* @return
|
||||
*/
|
||||
public static List<Comment> getAll(Context context, String keyTimeline) {
|
||||
QueryBuilder<Comment> qb = getCommentDao(context).queryBuilder();
|
||||
qb.where(CommentDao.Properties.Uuid_timeline.eq(keyTimeline));
|
||||
qb.build();
|
||||
return qb.list();
|
||||
}
|
||||
|
||||
/**
|
||||
* select comment per
|
||||
*
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
}
|
Binary file not shown.
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true" >
|
||||
<shape>
|
||||
<solid
|
||||
android:color="#4d4d4d" />
|
||||
<!-- <padding -->
|
||||
<!-- android:left="20dp" -->
|
||||
<!-- android:top="20dp" -->
|
||||
<!-- android:right="20dp" -->
|
||||
<!-- android:bottom="20dp" /> -->
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape>
|
||||
<gradient
|
||||
android:startColor="@color/gradient_start"
|
||||
android:endColor="@color/gradient_end"
|
||||
android:angle="270"
|
||||
/>
|
||||
<!-- <padding -->
|
||||
<!-- android:left="20dp" -->
|
||||
<!-- android:top="20dp" -->
|
||||
<!-- android:right="20dp" -->
|
||||
<!-- android:bottom="20dp" /> -->
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
Loading…
Add table
Add a link
Reference in a new issue