add project adins

This commit is contained in:
Alfrid Sanjaya Leo Putra 2024-07-25 14:44:22 +07:00
commit f8f85d679d
5299 changed files with 625430 additions and 0 deletions

View file

@ -0,0 +1,477 @@
/*
* Copyright 2012 Kevin Gaudin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.acra.collector;
import android.Manifest;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.os.Environment;
import org.acra.ACRA;
import org.acra.ReportField;
import org.acra.util.Installation;
import org.acra.util.PackageManagerWrapper;
import org.acra.util.ReportUtils;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.io.Writer;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import static org.acra.ACRA.LOG_TAG;
import static org.acra.ReportField.ANDROID_VERSION;
import static org.acra.ReportField.APPLICATION_LOG;
import static org.acra.ReportField.APP_VERSION_CODE;
import static org.acra.ReportField.APP_VERSION_NAME;
import static org.acra.ReportField.AVAILABLE_MEM_SIZE;
import static org.acra.ReportField.BRAND;
import static org.acra.ReportField.BUILD;
import static org.acra.ReportField.BUILD_CONFIG;
import static org.acra.ReportField.CRASH_CONFIGURATION;
import static org.acra.ReportField.CUSTOM_DATA;
import static org.acra.ReportField.DEVICE_FEATURES;
import static org.acra.ReportField.DEVICE_ID;
import static org.acra.ReportField.DISPLAY;
import static org.acra.ReportField.DROPBOX;
import static org.acra.ReportField.DUMPSYS_MEMINFO;
import static org.acra.ReportField.ENVIRONMENT;
import static org.acra.ReportField.EVENTSLOG;
import static org.acra.ReportField.FILE_PATH;
import static org.acra.ReportField.INITIAL_CONFIGURATION;
import static org.acra.ReportField.INSTALLATION_ID;
import static org.acra.ReportField.IS_SILENT;
import static org.acra.ReportField.LOGCAT;
import static org.acra.ReportField.MEDIA_CODEC_LIST;
import static org.acra.ReportField.PACKAGE_NAME;
import static org.acra.ReportField.PHONE_MODEL;
import static org.acra.ReportField.PRODUCT;
import static org.acra.ReportField.RADIOLOG;
import static org.acra.ReportField.REPORT_ID;
import static org.acra.ReportField.SETTINGS_GLOBAL;
import static org.acra.ReportField.SETTINGS_SECURE;
import static org.acra.ReportField.SETTINGS_SYSTEM;
import static org.acra.ReportField.SHARED_PREFERENCES;
import static org.acra.ReportField.STACK_TRACE;
import static org.acra.ReportField.STACK_TRACE_HASH;
import static org.acra.ReportField.THREAD_DETAILS;
import static org.acra.ReportField.TOTAL_MEM_SIZE;
import static org.acra.ReportField.USER_CRASH_DATE;
import static org.acra.ReportField.USER_EMAIL;
import static org.acra.ReportField.USER_IP;
/**
* Responsible for creating the CrashReportData for an Exception.
* <p>
* Also responsible for holding the custom data to send with each report.
* </p>
*
* @author William Ferguson
* @since 4.3.0
*/
public final class CrashReportDataFactory {
private final Context context;
private final SharedPreferences prefs;
private final Map<String, String> customParameters = new LinkedHashMap<String, String>();
private final GregorianCalendar appStartDate;
private final String initialConfiguration;
public CrashReportDataFactory(Context context, SharedPreferences prefs, GregorianCalendar appStartDate,
String initialConfiguration) {
this.context = context;
this.prefs = prefs;
this.appStartDate = appStartDate;
this.initialConfiguration = initialConfiguration;
}
/**
* <p>
* Adds a custom key and value to be reported with the generated
* CashReportData.
* </p>
* <p>
* The key/value pairs will be stored in the "custom" column, as a text
* containing one 'key = value' pair on each line.
* </p>
*
* @param key A key for your custom data.
* @param value The value associated to your key.
* @return The previous value for this key if there was one, or null.
*/
public String putCustomData(String key, String value) {
return customParameters.put(key, value);
}
/**
* Removes a key/value pair from the custom data field.
*
* @param key The key of the data to be removed.
* @return The value for this key before removal.
*/
public String removeCustomData(String key) {
return customParameters.remove(key);
}
/**
* Removes all key/value pairs from the custom data field.
*/
public void clearCustomData() {
customParameters.clear();
}
/**
* Gets the current value for a key in the custom data field.
*
* @param key The key of the data to be retrieved.
* @return The value for this key.
*/
public String getCustomData(String key) {
return customParameters.get(key);
}
/**
* Collects crash data.
*
* @param msg A message to be associated with the crash report.
* @param th Throwable that caused the crash.
* @param customData Custom key/value pairs to be associated with the crash report.
* @param isSilentReport Whether to report this report as being sent silently.
* @param brokenThread Thread on which the error occurred.
* @return CrashReportData representing the current state of the application
* at the instant of the Exception.
*/
public CrashReportData createCrashData(String msg, Throwable th, Map<String, String> customData, boolean isSilentReport, Thread brokenThread) {
final CrashReportData crashReportData = new CrashReportData();
try {
final List<ReportField> crashReportFields = ACRA.getConfig().getReportFields();
// Make every entry here bullet proof and move any slightly dodgy
// ones to the end.
// This ensures that we collect as much info as possible before
// something crashes the collection process.
crashReportData.put(STACK_TRACE, getStackTrace(msg, th));
crashReportData.put(ReportField.USER_APP_START_DATE, ReportUtils.getTimeString(appStartDate));
if (isSilentReport) {
crashReportData.put(IS_SILENT, "true");
}
// StackTrace hash
if (crashReportFields.contains(STACK_TRACE_HASH)) {
crashReportData.put(ReportField.STACK_TRACE_HASH, getStackTraceHash(th));
}
// Generate report uuid
if (crashReportFields.contains(REPORT_ID)) {
crashReportData.put(ReportField.REPORT_ID, UUID.randomUUID().toString());
}
// Installation unique ID
if (crashReportFields.contains(INSTALLATION_ID)) {
crashReportData.put(INSTALLATION_ID, Installation.id(context));
}
// Device Configuration when crashing
if (crashReportFields.contains(INITIAL_CONFIGURATION)) {
crashReportData.put(INITIAL_CONFIGURATION, initialConfiguration);
}
if (crashReportFields.contains(CRASH_CONFIGURATION)) {
crashReportData.put(CRASH_CONFIGURATION, ConfigurationCollector.collectConfiguration(context));
}
// Collect meminfo
if (!(th instanceof OutOfMemoryError) && crashReportFields.contains(DUMPSYS_MEMINFO)) {
crashReportData.put(DUMPSYS_MEMINFO, DumpSysCollector.collectMemInfo());
}
// Application Package name
if (crashReportFields.contains(PACKAGE_NAME)) {
crashReportData.put(PACKAGE_NAME, context.getPackageName());
}
// Android OS Build details
if (crashReportFields.contains(BUILD)) {
crashReportData.put(BUILD, ReflectionCollector.collectConstants(android.os.Build.class) + ReflectionCollector.collectConstants(android.os.Build.VERSION.class, "VERSION"));
}
// Device model
if (crashReportFields.contains(PHONE_MODEL)) {
crashReportData.put(PHONE_MODEL, android.os.Build.MODEL);
}
// Android version
if (crashReportFields.contains(ANDROID_VERSION)) {
crashReportData.put(ANDROID_VERSION, android.os.Build.VERSION.RELEASE);
}
// Device Brand (manufacturer)
if (crashReportFields.contains(BRAND)) {
crashReportData.put(BRAND, android.os.Build.BRAND);
}
if (crashReportFields.contains(PRODUCT)) {
crashReportData.put(PRODUCT, android.os.Build.PRODUCT);
}
// Device Memory
if (crashReportFields.contains(TOTAL_MEM_SIZE)) {
crashReportData.put(TOTAL_MEM_SIZE, Long.toString(ReportUtils.getTotalInternalMemorySize()));
}
if (crashReportFields.contains(AVAILABLE_MEM_SIZE)) {
crashReportData.put(AVAILABLE_MEM_SIZE, Long.toString(ReportUtils.getAvailableInternalMemorySize()));
}
// Application file path
if (crashReportFields.contains(FILE_PATH)) {
crashReportData.put(FILE_PATH, ReportUtils.getApplicationFilePath(context));
}
// Main display details
if (crashReportFields.contains(DISPLAY)) {
crashReportData.put(DISPLAY, DisplayManagerCollector.collectDisplays(context));
}
// User crash date with local timezone
if (crashReportFields.contains(USER_CRASH_DATE)) {
final GregorianCalendar curDate = new GregorianCalendar();
curDate.setTimeInMillis(Calendar.getInstance().getTimeInMillis());
crashReportData.put(USER_CRASH_DATE, ReportUtils.getTimeString(curDate));
}
// Add custom info, they are all stored in a single field
if (crashReportFields.contains(CUSTOM_DATA)) {
crashReportData.put(CUSTOM_DATA, createCustomInfoString(customData));
}
if (crashReportFields.contains(BUILD_CONFIG)) {
try {
final Class buildConfigClass = getBuildConfigClass();
crashReportData.put(BUILD_CONFIG, ReflectionCollector.collectConstants(buildConfigClass));
} catch (ClassNotFoundException e) {
// We have already logged this when we had the name of the class that wasn't found.
}
}
// Add user email address, if set in the app's preferences
if (crashReportFields.contains(USER_EMAIL)) {
crashReportData.put(USER_EMAIL, prefs.getString(ACRA.PREF_USER_EMAIL_ADDRESS, "N/A"));
}
// Device features
if (crashReportFields.contains(DEVICE_FEATURES)) {
crashReportData.put(DEVICE_FEATURES, DeviceFeaturesCollector.getFeatures(context));
}
// Environment (External storage state)
if (crashReportFields.contains(ENVIRONMENT)) {
crashReportData.put(ENVIRONMENT, ReflectionCollector.collectStaticGettersResults(Environment.class));
}
// System settings
if (crashReportFields.contains(SETTINGS_SYSTEM)) {
crashReportData.put(SETTINGS_SYSTEM, SettingsCollector.collectSystemSettings(context));
}
// Secure settings
if (crashReportFields.contains(SETTINGS_SECURE)) {
crashReportData.put(SETTINGS_SECURE, SettingsCollector.collectSecureSettings(context));
}
// Global settings
if (crashReportFields.contains(SETTINGS_GLOBAL)) {
crashReportData.put(SETTINGS_GLOBAL, SettingsCollector.collectGlobalSettings(context));
}
// SharedPreferences
if (crashReportFields.contains(SHARED_PREFERENCES)) {
crashReportData.put(SHARED_PREFERENCES, SharedPreferencesCollector.collect(context));
}
// Now get all the crash data that relies on the PackageManager
// (which may or may not be here).
final PackageManagerWrapper pm = new PackageManagerWrapper(context);
final PackageInfo pi = pm.getPackageInfo();
if (pi != null) {
// Application Version
if (crashReportFields.contains(APP_VERSION_CODE)) {
crashReportData.put(APP_VERSION_CODE, Integer.toString(pi.versionCode));
}
if (crashReportFields.contains(APP_VERSION_NAME)) {
crashReportData.put(APP_VERSION_NAME, pi.versionName != null ? pi.versionName : "not set");
}
} else {
// Could not retrieve package info...
crashReportData.put(APP_VERSION_NAME, "Package info unavailable");
}
// Retrieve UDID(IMEI) if permission is available
if (crashReportFields.contains(DEVICE_ID) && prefs.getBoolean(ACRA.PREF_ENABLE_DEVICE_ID, true)
&& pm.hasPermission(Manifest.permission.READ_PHONE_STATE)) {
final String deviceId = ReportUtils.getDeviceId(context);
if (deviceId != null) {
crashReportData.put(DEVICE_ID, deviceId);
}
}
// Collect DropBox and logcat
// Before JellyBean, this required the READ_LOGS permission
// Since JellyBean, READ_LOGS is not granted to third-party apps anymore for security reasons.
// Though, we can call logcat without any permission and still get traces related to our app.
final boolean hasReadLogsPermission = pm.hasPermission(Manifest.permission.READ_LOGS) || (Compatibility.getAPILevel() >= 16);
if (prefs.getBoolean(ACRA.PREF_ENABLE_SYSTEM_LOGS, true) && hasReadLogsPermission) {
ACRA.log.i(LOG_TAG, "READ_LOGS granted! ACRA can include LogCat and DropBox data.");
if (crashReportFields.contains(LOGCAT)) {
crashReportData.put(LOGCAT, LogCatCollector.collectLogCat(null));
}
if (crashReportFields.contains(EVENTSLOG)) {
crashReportData.put(EVENTSLOG, LogCatCollector.collectLogCat("events"));
}
if (crashReportFields.contains(RADIOLOG)) {
crashReportData.put(RADIOLOG, LogCatCollector.collectLogCat("radio"));
}
if (crashReportFields.contains(DROPBOX)) {
crashReportData.put(DROPBOX,
DropBoxCollector.read(context, ACRA.getConfig().additionalDropBoxTags()));
}
} else {
ACRA.log.i(LOG_TAG, "READ_LOGS not allowed. ACRA will not include LogCat and DropBox data.");
}
// Application specific log file
if (crashReportFields.contains(APPLICATION_LOG)) {
try {
final String logFile = LogFileCollector.collectLogFile(context,
ACRA.getConfig().applicationLogFile(),
ACRA.getConfig().applicationLogFileLines());
crashReportData.put(APPLICATION_LOG, logFile);
} catch (IOException e) {
ACRA.log.e(LOG_TAG, "Error while reading application log file " + ACRA.getConfig().applicationLogFile(), e);
}
}
// Media Codecs list
if (crashReportFields.contains(MEDIA_CODEC_LIST)) {
crashReportData.put(MEDIA_CODEC_LIST, MediaCodecListCollector.collecMediaCodecList());
}
// Failing thread details
if (crashReportFields.contains(THREAD_DETAILS)) {
crashReportData.put(THREAD_DETAILS, ThreadCollector.collect(brokenThread));
}
// IP addresses
if (crashReportFields.contains(USER_IP)) {
crashReportData.put(USER_IP, ReportUtils.getLocalIpAddress());
}
} catch (RuntimeException e) {
ACRA.log.e(LOG_TAG, "Error while retrieving crash data", e);
}
return crashReportData;
}
/**
* Generates the string which is posted in the single custom data field in
* the GoogleDocs Form.
*
* @return A string with a 'key = value' pair on each line.
*/
private String createCustomInfoString(Map<String, String> reportCustomData) {
Map<String, String> params = customParameters;
if (reportCustomData != null) {
params = new HashMap<String, String>(params);
params.putAll(reportCustomData);
}
final StringBuilder customInfo = new StringBuilder();
for (final String currentKey : params.keySet()) {
String currentVal = params.get(currentKey);
customInfo.append(currentKey);
customInfo.append(" = ");
// We need to escape new lines in values or they are transformed into new
// custom fields. => let's replace all '\n' with "\\n"
if (currentVal != null) {
currentVal = currentVal.replaceAll("\n", "\\\\n");
}
customInfo.append(currentVal);
customInfo.append("\n");
}
return customInfo.toString();
}
private String getStackTrace(String msg, Throwable th) {
final Writer result = new StringWriter();
final PrintWriter printWriter = new PrintWriter(result);
if (msg != null && !msg.isEmpty())
printWriter.println(msg);
// If the exception was thrown in a background thread inside
// AsyncTask, then the actual exception can be found with getCause
Throwable cause = th;
while (cause != null) {
cause.printStackTrace(printWriter);
cause = cause.getCause();
}
final String stacktraceAsString = result.toString();
printWriter.close();
return stacktraceAsString;
}
private String getStackTraceHash(Throwable th) {
final StringBuilder res = new StringBuilder();
Throwable cause = th;
while (cause != null) {
final StackTraceElement[] stackTraceElements = cause.getStackTrace();
for (final StackTraceElement e : stackTraceElements) {
res.append(e.getClassName());
res.append(e.getMethodName());
}
cause = cause.getCause();
}
return Integer.toHexString(res.toString().hashCode());
}
private Class<?> getBuildConfigClass() throws ClassNotFoundException {
final Class configuredBuildConfig = ACRA.getConfig().buildConfigClass();
if ((configuredBuildConfig != null) && !configuredBuildConfig.equals(Object.class)) {
// If set via annotations or programatically then it will have a real value,
// otherwise it will be Object.class (annotation default) or null (explicit programmatic).
return configuredBuildConfig;
}
final String className = context.getClass().getPackage().getName() + ".BuildConfig";
try {
return Class.forName(className);
} catch (ClassNotFoundException e) {
ACRA.log.e(LOG_TAG, "Not adding buildConfig to log. Class Not found : " + className + ". Please configure 'buildConfigClass' in your ACRA config");
throw e;
}
}
}

View file

@ -0,0 +1,126 @@
/*
* Copyright 2013, Edmodo, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License.
* You may obtain a copy of the License in the LICENSE file, or 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 com.edmodo.cropper.util;
import android.content.Context;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.TypedValue;
/**
* Utility class for handling all of the Paint used to draw the CropOverlayView.
*/
public class PaintUtil {
// Private Constants ///////////////////////////////////////////////////////
private static final int DEFAULT_CORNER_COLOR = Color.WHITE;
private static final String SEMI_TRANSPARENT = "#AAFFFFFF";
private static final String DEFAULT_BACKGROUND_COLOR_ID = "#B0000000";
private static final float DEFAULT_LINE_THICKNESS_DP = 3;
private static final float DEFAULT_CORNER_THICKNESS_DP = 5;
private static final float DEFAULT_GUIDELINE_THICKNESS_PX = 1;
// Public Methods //////////////////////////////////////////////////////////
/**
* Creates the Paint object for drawing the crop window border.
*
* @param context the Context
* @return new Paint object
*/
public static Paint newBorderPaint(Context context) {
// Set the line thickness for the crop window border.
final float lineThicknessPx = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
DEFAULT_LINE_THICKNESS_DP,
context.getResources().getDisplayMetrics());
final Paint borderPaint = new Paint();
borderPaint.setColor(Color.parseColor(SEMI_TRANSPARENT));
borderPaint.setStrokeWidth(lineThicknessPx);
borderPaint.setStyle(Paint.Style.STROKE);
return borderPaint;
}
/**
* Creates the Paint object for drawing the crop window guidelines.
*
* @return the new Paint object
*/
public static Paint newGuidelinePaint() {
final Paint paint = new Paint();
paint.setColor(Color.parseColor(SEMI_TRANSPARENT));
paint.setStrokeWidth(DEFAULT_GUIDELINE_THICKNESS_PX);
return paint;
}
/**
* Creates the Paint object for drawing the translucent overlay outside the
* crop window.
*
* @param context the Context
* @return the new Paint object
*/
public static Paint newBackgroundPaint(Context context) {
final Paint paint = new Paint();
paint.setColor(Color.parseColor(DEFAULT_BACKGROUND_COLOR_ID));
return paint;
}
/**
* Creates the Paint object for drawing the corners of the border
*
* @param context the Context
* @return the new Paint object
*/
public static Paint newCornerPaint(Context context) {
// Set the line thickness for the crop window border.
final float lineThicknessPx = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
DEFAULT_CORNER_THICKNESS_DP,
context.getResources().getDisplayMetrics());
final Paint cornerPaint = new Paint();
cornerPaint.setColor(DEFAULT_CORNER_COLOR);
cornerPaint.setStrokeWidth(lineThicknessPx);
cornerPaint.setStyle(Paint.Style.STROKE);
return cornerPaint;
}
/**
* Returns the value of the corner thickness
*
* @return Float equivalent to the corner thickness
*/
public static float getCornerThickness() {
return DEFAULT_CORNER_THICKNESS_DP;
}
/**
* Returns the value of the line thickness of the border
*
* @return Float equivalent to the line thickness
*/
public static float getLineThickness() {
return DEFAULT_LINE_THICKNESS_DP;
}
}

View file

@ -0,0 +1,182 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/loginLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/bg_grayscale"
android:orientation="vertical"
android:visibility="visible" >
<include
android:id="@+id/include1"
layout="@layout/footer" />
<!-- <CheckBox -->
<!-- android:id="@+id/cbShowPassword" -->
<!-- android:layout_width="wrap_content" -->
<!-- android:layout_height="wrap_content" -->
<!-- android:layout_below="@+id/relativeLayout2" -->
<!-- android:text="Show Password" -->
<!-- android:textAppearance="?android:attr/textAppearanceSmall" -->
<!-- android:textColor="@color/tv_darker" -->
<!-- android:visibility="visible" /> -->
<!-- <Button -->
<!-- android:id="@+id/btnLogin" -->
<!-- android:layout_width="fill_parent" -->
<!-- android:layout_height="wrap_content" -->
<!-- android:layout_below="@+id/cbShowPassword" -->
<!-- android:layout_centerHorizontal="true" -->
<!-- android:layout_weight="1" -->
<!-- android:background="@drawable/button_background" -->
<!-- android:text="@string/btnLogin" -->
<!-- android:textColor="#ffffff" /> -->
<CheckBox
android:id="@+id/cbShowPassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/relativeLayout2"
android:text="@string/lblShowPassword"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/tv_darker"
android:visibility="visible" />
<RelativeLayout
android:id="@+id/relativeLayout2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/include1"
android:layout_below="@+id/profilePicture" >
<RelativeLayout
android:id="@+id/relativeLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginTop="20dp" >
<TextView
android:id="@+id/textView2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/txtUserId"
android:layout_below="@+id/txtUserId"
android:layout_marginTop="7dp"
android:gravity="center_horizontal"
android:text="@string/lblLoginPassword"
android:textColor="#000000"
android:visibility="gone" />
<TextView
android:id="@+id/textView3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/txtPassword"
android:layout_alignParentTop="true"
android:layout_marginBottom="7dp"
android:gravity="center_horizontal"
android:text="@string/login_desc"
android:textColor="#001135" />
<TextView
android:id="@+id/contentComment"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/txtPassword"
android:layout_alignParentTop="true"
android:gravity="center_horizontal"
android:text="@string/lblLoginId"
android:textColor="#000000"
android:visibility="gone" />
<EditText
android:id="@+id/txtPassword"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/textView2"
android:layout_marginTop="7dp"
android:drawableLeft="@drawable/ms_lock_icon_black"
android:ems="10"
android:hint="@string/lblLoginPassword"
android:inputType="textPassword"
android:textColor="@color/tv_darker"
android:textColorHint="@color/tv_darker" />
<EditText
android:id="@+id/txtUserId"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/txtPassword"
android:layout_below="@+id/textView3"
android:drawableLeft="@drawable/ms_user_icon_black"
android:ems="10"
android:hint="@string/lblLoginId"
android:singleLine="true"
android:textColor="@color/tv_darker"
android:textColorHint="@color/tv_darker" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_alignParentLeft="true"
android:layout_below="@+id/txtUserId"
android:background="@color/tv_normal"
android:orientation="vertical"
android:visibility="gone" >
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/include1"
android:layout_alignParentRight="true"
android:weightSum="1"
android:layout_marginTop="15dp"
android:layout_below="@+id/cbShowPassword" >
<Button
android:id="@+id/btnLogin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="@string/btnLogin"
android:textColor="#ffffff"
android:visibility="visible" />
<Button
android:id="@+id/btnExit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:background="@drawable/button_background"
android:text="@string/btnExit"
android:textColor="#ffffff"
android:visibility="visible" />
</LinearLayout>
<CheckBox
android:id="@+id/cbRememberMe2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="@+id/include1"
android:layout_below="@+id/relativeLayout2"
android:text="@string/lblRememberMe"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/tv_darker"
android:visibility="visible" />
<ImageView
android:id="@+id/profilePicture"
android:layout_width="fill_parent"
android:layout_height="200dp"
android:layout_alignParentTop="true"
android:scaleType="centerCrop"
android:src="@drawable/dummy" />
</RelativeLayout>

View file

@ -0,0 +1,35 @@
package com.adins.mss.base.dynamicform.form.questions;
import com.adins.mss.foundation.questiongenerator.QuestionBean;
import java.util.List;
/**
* Created by kusnendi.muhamad on 07/08/2017.
*/
public interface QuestionsValidatorInterface {
public boolean validateAllMandatory(List<QuestionBean> listQuestion, boolean displayMessage);
public boolean validateCurrentPage(boolean isCekValidate, boolean isSave);
public List<String> validateGeneratedQuestionView(QuestionBean bean);
public List<String> validateLookupQuestion(QuestionBean bean);
public List<String> validateDrawingQuestion(QuestionBean bean);
public List<String> validateImageQuestion(QuestionBean bean);
public List<String> validateMultipleQuestion(QuestionBean bean);
public List<String> validateTextQuestion(QuestionBean bean);
public List<String> validateTextWithSuggestionQuestion(QuestionBean bean);
public List<String> validateLocationQuestion(QuestionBean bean);
public List<String> validateDateTimeQuestion(QuestionBean bean);
public boolean validateByScript(String answer, String answerType, String script);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

View file

@ -0,0 +1,227 @@
/*
* Copyright (C) 2010 The Android Open Source Project
*
* 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 com.adins.libs.nineoldandroids.animation;
import android.view.animation.Interpolator;
import com.adins.libs.nineoldandroids.animation.Keyframe.FloatKeyframe;
import com.adins.libs.nineoldandroids.animation.Keyframe.IntKeyframe;
import com.adins.libs.nineoldandroids.animation.Keyframe.ObjectKeyframe;
import java.util.ArrayList;
import java.util.Arrays;
/**
* This class holds a collection of Keyframe objects and is called by ValueAnimator to calculate
* values between those keyframes for a given animation. The class internal to the animation
* package because it is an implementation detail of how Keyframes are stored and used.
*/
class KeyframeSet {
int mNumKeyframes;
Keyframe mFirstKeyframe;
Keyframe mLastKeyframe;
/*Time*/ Interpolator mInterpolator; // only used in the 2-keyframe case
ArrayList<Keyframe> mKeyframes; // only used when there are not 2 keyframes
TypeEvaluator mEvaluator;
public KeyframeSet(Keyframe... keyframes) {
mNumKeyframes = keyframes.length;
mKeyframes = new ArrayList<Keyframe>();
mKeyframes.addAll(Arrays.asList(keyframes));
mFirstKeyframe = mKeyframes.get(0);
mLastKeyframe = mKeyframes.get(mNumKeyframes - 1);
mInterpolator = mLastKeyframe.getInterpolator();
}
public static KeyframeSet ofInt(int... values) {
int numKeyframes = values.length;
IntKeyframe keyframes[] = new IntKeyframe[Math.max(numKeyframes, 2)];
if (numKeyframes == 1) {
keyframes[0] = (IntKeyframe) Keyframe.ofInt(0f);
keyframes[1] = (IntKeyframe) Keyframe.ofInt(1f, values[0]);
} else {
keyframes[0] = (IntKeyframe) Keyframe.ofInt(0f, values[0]);
for (int i = 1; i < numKeyframes; ++i) {
keyframes[i] = (IntKeyframe) Keyframe.ofInt((float) i / (numKeyframes - 1), values[i]);
}
}
return new IntKeyframeSet(keyframes);
}
public static KeyframeSet ofFloat(float... values) {
int numKeyframes = values.length;
FloatKeyframe keyframes[] = new FloatKeyframe[Math.max(numKeyframes, 2)];
if (numKeyframes == 1) {
keyframes[0] = (FloatKeyframe) Keyframe.ofFloat(0f);
keyframes[1] = (FloatKeyframe) Keyframe.ofFloat(1f, values[0]);
} else {
keyframes[0] = (FloatKeyframe) Keyframe.ofFloat(0f, values[0]);
for (int i = 1; i < numKeyframes; ++i) {
keyframes[i] = (FloatKeyframe) Keyframe.ofFloat((float) i / (numKeyframes - 1), values[i]);
}
}
return new FloatKeyframeSet(keyframes);
}
public static KeyframeSet ofKeyframe(Keyframe... keyframes) {
// if all keyframes of same primitive type, create the appropriate KeyframeSet
int numKeyframes = keyframes.length;
boolean hasFloat = false;
boolean hasInt = false;
boolean hasOther = false;
for (int i = 0; i < numKeyframes; ++i) {
if (keyframes[i] instanceof FloatKeyframe) {
hasFloat = true;
} else if (keyframes[i] instanceof IntKeyframe) {
hasInt = true;
} else {
hasOther = true;
}
}
if (hasFloat && !hasInt && !hasOther) {
FloatKeyframe floatKeyframes[] = new FloatKeyframe[numKeyframes];
for (int i = 0; i < numKeyframes; ++i) {
floatKeyframes[i] = (FloatKeyframe) keyframes[i];
}
return new FloatKeyframeSet(floatKeyframes);
} else if (hasInt && !hasFloat && !hasOther) {
IntKeyframe intKeyframes[] = new IntKeyframe[numKeyframes];
for (int i = 0; i < numKeyframes; ++i) {
intKeyframes[i] = (IntKeyframe) keyframes[i];
}
return new IntKeyframeSet(intKeyframes);
} else {
return new KeyframeSet(keyframes);
}
}
public static KeyframeSet ofObject(Object... values) {
int numKeyframes = values.length;
ObjectKeyframe keyframes[] = new ObjectKeyframe[Math.max(numKeyframes, 2)];
if (numKeyframes == 1) {
keyframes[0] = (ObjectKeyframe) Keyframe.ofObject(0f);
keyframes[1] = (ObjectKeyframe) Keyframe.ofObject(1f, values[0]);
} else {
keyframes[0] = (ObjectKeyframe) Keyframe.ofObject(0f, values[0]);
for (int i = 1; i < numKeyframes; ++i) {
keyframes[i] = (ObjectKeyframe) Keyframe.ofObject((float) i / (numKeyframes - 1), values[i]);
}
}
return new KeyframeSet(keyframes);
}
/**
* Sets the TypeEvaluator to be used when calculating animated values. This object
* is required only for KeyframeSets that are not either IntKeyframeSet or FloatKeyframeSet,
* both of which assume their own evaluator to speed up calculations with those primitive
* types.
*
* @param evaluator The TypeEvaluator to be used to calculate animated values.
*/
public void setEvaluator(TypeEvaluator evaluator) {
mEvaluator = evaluator;
}
@Override
public KeyframeSet clone() {
ArrayList<Keyframe> keyframes = mKeyframes;
int numKeyframes = mKeyframes.size();
Keyframe[] newKeyframes = new Keyframe[numKeyframes];
for (int i = 0; i < numKeyframes; ++i) {
newKeyframes[i] = keyframes.get(i).clone();
}
KeyframeSet newSet = new KeyframeSet(newKeyframes);
return newSet;
}
/**
* Gets the animated value, given the elapsed fraction of the animation (interpolated by the
* animation's interpolator) and the evaluator used to calculate in-between values. This
* function maps the input fraction to the appropriate keyframe interval and a fraction
* between them and returns the interpolated value. Note that the input fraction may fall
* outside the [0-1] bounds, if the animation's interpolator made that happen (e.g., a
* spring interpolation that might send the fraction past 1.0). We handle this situation by
* just using the two keyframes at the appropriate end when the value is outside those bounds.
*
* @param fraction The elapsed fraction of the animation
* @return The animated value.
*/
public Object getValue(float fraction) {
// Special-case optimization for the common case of only two keyframes
if (mNumKeyframes == 2) {
if (mInterpolator != null) {
fraction = mInterpolator.getInterpolation(fraction);
}
return mEvaluator.evaluate(fraction, mFirstKeyframe.getValue(),
mLastKeyframe.getValue());
}
if (fraction <= 0f) {
final Keyframe nextKeyframe = mKeyframes.get(1);
final /*Time*/ Interpolator interpolator = nextKeyframe.getInterpolator();
if (interpolator != null) {
fraction = interpolator.getInterpolation(fraction);
}
final float prevFraction = mFirstKeyframe.getFraction();
float intervalFraction = (fraction - prevFraction) /
(nextKeyframe.getFraction() - prevFraction);
return mEvaluator.evaluate(intervalFraction, mFirstKeyframe.getValue(),
nextKeyframe.getValue());
} else if (fraction >= 1f) {
final Keyframe prevKeyframe = mKeyframes.get(mNumKeyframes - 2);
final /*Time*/ Interpolator interpolator = mLastKeyframe.getInterpolator();
if (interpolator != null) {
fraction = interpolator.getInterpolation(fraction);
}
final float prevFraction = prevKeyframe.getFraction();
float intervalFraction = (fraction - prevFraction) /
(mLastKeyframe.getFraction() - prevFraction);
return mEvaluator.evaluate(intervalFraction, prevKeyframe.getValue(),
mLastKeyframe.getValue());
}
Keyframe prevKeyframe = mFirstKeyframe;
for (int i = 1; i < mNumKeyframes; ++i) {
Keyframe nextKeyframe = mKeyframes.get(i);
if (fraction < nextKeyframe.getFraction()) {
final /*Time*/ Interpolator interpolator = nextKeyframe.getInterpolator();
if (interpolator != null) {
fraction = interpolator.getInterpolation(fraction);
}
final float prevFraction = prevKeyframe.getFraction();
float intervalFraction = (fraction - prevFraction) /
(nextKeyframe.getFraction() - prevFraction);
return mEvaluator.evaluate(intervalFraction, prevKeyframe.getValue(),
nextKeyframe.getValue());
}
prevKeyframe = nextKeyframe;
}
// shouldn't reach here
return mLastKeyframe.getValue();
}
@Override
public String toString() {
String returnVal = " ";
for (int i = 0; i < mNumKeyframes; ++i) {
returnVal += mKeyframes.get(i).getValue() + " ";
}
return returnVal;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 875 B

View file

@ -0,0 +1,205 @@
<?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="match_parent"
android:background="@color/bgColor" >
<androidx.cardview.widget.CardView
android:id="@+id/depositSummaryContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
app:cardCornerRadius="10dp"
app:contentPadding="7dp"
app:cardElevation="@dimen/card_shadow"
android:layout_margin="@dimen/card_margin"
app:cardBackgroundColor="@color/fontColorWhite">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/summary_deposit_report"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textStyle="bold"
android:textColor="@color/gradient_end"
android:paddingBottom="10dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/lblTotalTask"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.6"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:text="@string/label_total_task"
android:textAppearance="?android:attr/textAppearanceSmall"/>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:background="@color/timelineLine" />
<TextView
android:id="@+id/totalTaskValue"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center|end"
android:layout_weight="0.5"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:text="0 Task(s)"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textAlignment="textEnd" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/lblTotalVisit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.6"
android:paddingBottom="5dp"
android:text="@string/label_total_visit"
android:textAppearance="?android:attr/textAppearanceSmall"/>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:background="@color/timelineLine" />
<TextView
android:id="@+id/visitValue"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center|end"
android:layout_weight="0.5"
android:paddingBottom="5dp"
android:text="@string/label_visit"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textAlignment="textEnd" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/lblTotalPaid"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.6"
android:paddingBottom="5dp"
android:text="@string/label_total_paid"
android:textAppearance="?android:attr/textAppearanceSmall"/>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:background="@color/timelineLine" />
<TextView
android:id="@+id/paidValue"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center|end"
android:layout_weight="0.5"
android:paddingBottom="5dp"
android:text="@string/label_paid"
android:textColor="#7B3"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textAlignment="textEnd" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/lblTotalFail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.6"
android:paddingBottom="5dp"
android:text="@string/label_total_fail"
android:textAppearance="?android:attr/textAppearanceSmall"/>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:background="@color/timelineLine" />
<TextView
android:id="@+id/failValue"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center|end"
android:layout_weight="0.5"
android:paddingBottom="5dp"
android:text="@string/label_fail"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textAlignment="textEnd"
android:textColor="#E11" />
</LinearLayout>
<TextView
android:id="@+id/lblDetail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="@string/label_detail"
android:textStyle="bold"
android:textAppearance="?android:attr/textAppearanceSmall"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/totalLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/lblTotal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.6"
android:paddingTop="10dp"
android:text="@string/total"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textStyle="bold"/>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:background="@color/timelineLine" />
<TextView
android:id="@+id/total"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:layout_gravity="center|end"
android:paddingTop="10dp"
android:paddingBottom="5dp"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textStyle="bold"
android:textAlignment="textEnd" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@+id/totalLayout"
android:layout_centerHorizontal="true"
android:background="@color/timelineLine"/>
</RelativeLayout>
<ListView
android:id="@+id/summaryDetail"
android:layout_width="match_parent"
android:layout_height="match_parent">
</ListView>
</LinearLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6 KiB

View file

@ -0,0 +1,122 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/bgGridPriority"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/grid_background" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" >
<ImageView
android:id="@+id/ImgSLE"
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:src="@drawable/light_red" />
<TextView
android:id="@+id/txtslatime"
android:layout_marginLeft="3dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/ImgSLE"
android:text="00:00"
android:textColor="@color/tv_white"
android:textSize="10dp" />
<ImageView
android:id="@+id/imgStsPriority"
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:src="@drawable/light_red" />
<ImageView
android:id="@+id/imgPriority"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/ImgSLE"
android:src="@drawable/icon_not_priority"
android:layout_centerHorizontal="true" />
<TextView
android:id="@+id/txtPriority"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:gravity="center_horizontal"
android:layout_below="@+id/imgPriority"
android:text="@string/dummy_priority"
android:textColor="@color/tv_white"
android:textSize="10dp" />
</RelativeLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical" >
<TextView
android:id="@+id/txtTaskID"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="@string/dummy_task_id"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/tv_white"
android:textSize="10dp" />
<TextView
android:id="@+id/txtName"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:text="@string/dummy_header_name_2"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/tv_white" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:orientation="horizontal"
android:gravity="center_horizontal" >
<TextView
android:id="@+id/txtStatusTask"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/dummy_status_task"
android:visibility="gone"
android:textColor="@color/tv_white"
android:textSize="10dp" />
<TextView
android:id="@+id/txtScheme"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:gravity="center_horizontal"
android:minLines="2"
android:textColor="@color/tv_white"
android:text="@string/dummy_scheme_name"
android:textSize="10dp" />
</LinearLayout>
</LinearLayout>

View file

@ -0,0 +1,72 @@
package com.adins.mss.foundation.print.rv;
import android.content.Context;
import android.os.AsyncTask;
import com.adins.mss.base.GlobalData;
import com.adins.mss.base.R;
import com.adins.mss.base.crashlytics.FireCrash;
import com.adins.mss.base.util.GsonHelper;
import com.adins.mss.base.util.Utility;
import com.adins.mss.constant.Global;
import com.adins.mss.foundation.formatter.Tool;
import com.adins.mss.foundation.http.HttpConnectionResult;
import com.adins.mss.foundation.http.HttpCryptedConnection;
import com.adins.mss.foundation.http.MssRequestType;
import com.google.firebase.perf.FirebasePerformance;
import com.google.firebase.perf.metrics.HttpMetric;
import java.lang.ref.WeakReference;
/**
* Created by angga.permadi on 3/3/2016.
*/
public abstract class DataTask<Params, Progress, Result> extends AsyncTask<Params, Progress, Result> {
protected String errorMessage;
protected WeakReference<Context> context;
private MssRequestType entity;
public DataTask(Context context, MssRequestType entity) {
this.context = new WeakReference<Context>(context);
this.entity = entity;
}
@SafeVarargs
@Override
protected final Result doInBackground(Params... params) {
entity.setAudit(GlobalData.getSharedGlobalData().getAuditData());
HttpCryptedConnection httpConn = new HttpCryptedConnection(context.get(),
GlobalData.getSharedGlobalData().isEncrypt(), GlobalData.getSharedGlobalData().isDecrypt());
HttpConnectionResult serverResult = null;
String json = GsonHelper.toJson(entity);
HttpMetric networkMetric =
FirebasePerformance.getInstance().newHttpMetric(getUrl(), FirebasePerformance.HttpMethod.POST);
Utility.metricStart(networkMetric, json);
if (Tool.isInternetconnected(context.get())) {
try {
serverResult = httpConn.requestToServer(getUrl(), json, Global.DEFAULTCONNECTIONTIMEOUT);
Utility.metricStop(networkMetric, serverResult);
} catch (Exception e) {
FireCrash.log(e);
e.printStackTrace();
errorMessage = context.get().getString(R.string.failed_send_data);
return onBackgroundResult(null);
}
} else {
errorMessage = context.get().getString(R.string.no_internet_connection);
}
return onBackgroundResult(serverResult);
}
protected void onDestroy() {
}
protected abstract Result onBackgroundResult(HttpConnectionResult serverResult);
protected abstract String getUrl();
}

View file

@ -0,0 +1,59 @@
<?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="match_parent"
android:background="@color/bgColor" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.cardview.widget.CardView
android:id="@+id/recapitulationListContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
app:cardCornerRadius="10dp"
app:contentPadding="7dp"
app:cardElevation="@dimen/card_shadow"
android:layout_marginTop="@dimen/card_margin"
android:layout_marginLeft="@dimen/card_margin"
android:layout_marginRight="@dimen/card_margin"
android:layout_marginBottom="60dp"
app:cardBackgroundColor="@color/fontColorWhite">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/label_recapitulation_list"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textStyle="bold"
android:textColor="@color/colorMC"
android:paddingBottom="10dp"/>
<ListView
android:id="@+id/listRecapitulation"
android:layout_width="match_parent"
android:layout_height="match_parent">
</ListView>
</LinearLayout>
</androidx.cardview.widget.CardView>
<Button
android:id="@+id/btnRecapitulate"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:layout_margin="5dp"
android:background="@drawable/button_background"
android:text="@string/label_recapitulate"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/fontColorWhite" />
</RelativeLayout>
</LinearLayout>

View file

@ -0,0 +1,81 @@
package com.adins.mss.odr.accounts;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.adins.mss.dao.Account;
import com.adins.mss.dao.Product;
import com.adins.mss.foundation.db.dataaccess.ProductDataAccess;
import com.adins.mss.odr.R;
import com.adins.mss.odr.accounts.adapter.ContactListAdapter;
import java.util.ArrayList;
import java.util.List;
/**
* Created by olivia.dg on 11/17/2017.
*/
public class ContactTabFragment extends Fragment {
private FragmentActivity activity;
private Account account;
private RecyclerView list;
private RecyclerView.LayoutManager layoutManager;
public ContactListAdapter adapter;
private String uuidAccount;
private List<Product> listProduct = new ArrayList<>();
private ArrayList<String> uuidProducts = new ArrayList<>();
public ContactTabFragment(FragmentActivity activity, Account account, ArrayList<String> products) {
this.activity = activity;
this.account = account;
this.uuidProducts = products;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.account_contact_tab, container, false);
list = (RecyclerView) view.findViewById(R.id.list);
layoutManager = new LinearLayoutManager(activity);
list.setLayoutManager(layoutManager);
setHasOptionsMenu(true);
// listContact = ContactDataAccess.getAllByAccount(activity, account.getUuid_account());
if (uuidProducts != null) {
for (String uuid : uuidProducts) {
Product product = ProductDataAccess.getOne(getActivity(), uuid);
listProduct.add(product);
}
}
adapter = new ContactListAdapter(getActivity(), account, listProduct);
list.setAdapter(adapter);
return view;
}
@Override
public void onCreate( Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public void onResume() {
super.onResume();
getActivity().setTitle(getString(R.string.title_mn_account));
adapter = new ContactListAdapter(activity, account, listProduct);
list.setAdapter(adapter);
adapter.notifyDataSetChanged();
}
}