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,38 @@
package com.adins.mss.base.receipt;
import android.graphics.Canvas;
/**
* Created by Loise on 12/04/2018.
*/
/**
* Mengenerate gambar bitmap kosong
*/
public class DrawBlankSpace implements IDrawItem {
private int blankSpace;
/**
* Konstruktor
* @param blankSpace tinggi bitmap kosong dalam pixel
*/
public DrawBlankSpace(int blankSpace) {
this.blankSpace = blankSpace;
}
/**
* Menggambar pada canvas
* @param canvas Objek Canvas
* @param x titik awal pada sumbu x
* @param y titik awal pada sumbu y
*/
@Override
public void drawOnCanvas(Canvas canvas, float x, float y) {
}
@Override
public int getHeight() {
return blankSpace;
}
}

View file

@ -0,0 +1,69 @@
package com.adins.mss.odr.catalogue;
import androidx.fragment.app.FragmentActivity;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.adins.mss.dao.Catalogue;
import com.adins.mss.odr.R;
import com.adins.mss.odr.catalogue.api.LoadPdf;
import java.util.List;
/**
* Created by olivia.dg on 11/28/2017.
*/
public class CatalogueListAdapter extends RecyclerView.Adapter<CatalogueListAdapter.CatalogueViewHolder>{
private FragmentActivity activity;
private List<Catalogue> objects;
public CatalogueListAdapter(FragmentActivity activity, List<Catalogue> objects) {
this.activity = activity;
this.objects = objects;
}
public class CatalogueViewHolder extends RecyclerView.ViewHolder {
public final View mView;
private TextView txtName;
private TextView txtDesc;
public CatalogueViewHolder(View itemView) {
super(itemView);
mView = itemView;
txtName = (TextView) itemView.findViewById(R.id.txtName);
txtDesc = (TextView) itemView.findViewById(R.id.txtDesc);
}
}
@Override
public CatalogueViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.catalogue_list_item, parent, false);
CatalogueViewHolder viewHolder = new CatalogueViewHolder(v);
return viewHolder;
}
@Override
public void onBindViewHolder(CatalogueViewHolder holder, final int position) {
holder.txtName.setText(objects.get(position).getCatalogue_name());
holder.txtDesc.setText(objects.get(position).getCatalogue_desc());
holder.mView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
LoadPdf task = new LoadPdf(activity, objects.get(position).getUuid_mkt_catalogue());
task.execute();
}
});
}
@Override
public int getItemCount() {
if (objects == null || objects.size() == 0)
return 0;
else
return objects.size();
}
}

View file

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<resources translatable="false">
<string name="define_license_bsd_3"></string>
<string name="license_bsd_3_licenseName">BSD 3-Clause License</string>
<string name="license_bsd_3_licenseWebsite">http://opensource.org/licenses/BSD-3-Clause</string>
<string name="license_bsd_3_licenseShortDescription">
<![CDATA[
Copyright &#169; <<<YEAR>>>, <<<OWNER>>>
<br />
All rights reserved.
<br /><br />
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
<br /><br />
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
<br /><br />
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
<br /><br />
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software
without specific prior written permission.
]]>
</string>
<string name="license_bsd_3_licenseDescription">
<![CDATA[
Copyright &#169; <<<YEAR>>>, <<<OWNER>>>
<br />
All rights reserved.
<br /><br />
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
<br /><br />
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
<br /><br />
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
<br /><br />
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software
without specific prior written permission.
<br /><br />
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
]]>
</string>
</resources>

View file

@ -0,0 +1,20 @@
package com.adins.mss.coll.fragments;
import com.adins.mss.dao.Kompetisi;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class BeanResps {
@SerializedName("beanResp")
private List<Kompetisi> beanResp;
public List<Kompetisi> getBeanResp() {
return beanResp;
}
public void setBeanResp(List<Kompetisi> beanResp) {
this.beanResp = beanResp;
}
}

View file

@ -0,0 +1,24 @@
package com.adins.mss.foundation.UserHelp.Bean.Dummy;
import java.util.List;
public class UserHelpGuideDummy {
private String activity;
private List<UserHelpViewDummy> view;
public String getActivity() {
return activity;
}
public void setActivity(String activity) {
this.activity = activity;
}
public List<UserHelpViewDummy> getView() {
return view;
}
public void setView(List<UserHelpViewDummy> view) {
this.view = view;
}
}

View file

@ -0,0 +1,33 @@
package com.adins.mss.odr;
import android.content.Context;
import com.adins.mss.base.dialogfragments.NewTaskDialog;
import com.adins.mss.base.todo.form.NewTaskAdapter;
import com.adins.mss.base.todolist.DoList;
import com.adins.mss.constant.Global;
import com.adins.mss.dao.Scheme;
import java.util.List;
public class MONewTaskActivity extends NewTaskDialog {
private DoList list;
private List<Scheme> objects;
@Override
public void onAttach(Context context) {
super.onAttach(context);
}
@Override
protected NewTaskAdapter getNewTaskAdapter() {
list = new DoList(getActivity());
if (Global.isNewlead) {
objects = list.getMarketingListScheme();
} else {
objects = list.getOrderListScheme();
}
return new NewTaskAdapter(getActivity(), objects);
}
}

View file

@ -0,0 +1,290 @@
package com.adins.mss.base.checkout;
import android.Manifest;
import android.content.Context;
import android.content.pm.PackageManager;
import android.location.Address;
import android.location.Geocoder;
import android.os.AsyncTask;
import android.os.Bundle;
import androidx.core.app.ActivityCompat;
import com.adins.mss.base.R;
import com.adins.mss.base.checkout.activity.CheckOutActivity;
import com.adins.mss.base.crashlytics.FireCrash;
import com.adins.mss.constant.Global;
import com.adins.mss.dao.LocationInfo;
import com.adins.mss.foundation.camerainapp.helper.Logger;
import com.adins.mss.foundation.db.dataaccess.LocationInfoDataAccess;
import com.adins.mss.foundation.location.LocationTrackingManager;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.maps.model.LatLng;
import java.io.IOException;
import java.util.List;
import java.util.Locale;
public class CheckOutManager implements
GoogleApiClient.ConnectionCallbacks,
GoogleApiClient.OnConnectionFailedListener {
static LocationTrackingManager ltm = Global.LTM;
static LocationInfo infoCheckOut;
private static GoogleApiClient mGoogleApiClient;
private static CheckOutLocationListener listener = new CheckOutLocationListener();
List<LocationInfo> LocationInfoCheckOut;
boolean updateLocation = true;
private Context context;
private LocationRequest mLocationRequest;
public CheckOutManager(Context context) {
this.context = context;
}
/**
* Gets List of Locations info CheckOut from Database
*
* @param context
* @param Uuid_user
* @return all Location info in type of Check In
*/
public static List<LocationInfo> getAllLocationInfoCheckOutFromDB(Context context, String Uuid_user) {
return LocationInfoDataAccess.getAllbyType(context, Uuid_user, Global.LOCATION_TYPE_CHECKOUT);
}
/**
* Insert a LocationInfo CheckOut to Data Base
*
* @param LocationInfo
*/
public static void insertLocationCheckOutToDB(Context context, LocationInfo LocationInfo) {
LocationInfoDataAccess.add(context, LocationInfo);
}
/**
* In response to a request to stop updates, send a request to
* Location Services
*/
public static void stopPeriodicUpdates() {
try {
LocationServices.FusedLocationApi.removeLocationUpdates(mGoogleApiClient, listener);
} catch (Exception e) {
FireCrash.log(e);
e.printStackTrace();
}
}
/**
* Method for get Current Location info Of Check In
*
* @return Location Info
*/
public static LocationInfo getCurrentCheckOut() {
return infoCheckOut;
}
public static String toLocationCheckOutString(LocationInfo locationInfo) {
StringBuilder sb = new StringBuilder();
sb.append(locationInfo.getLatitude()).append(",")
.append(locationInfo.getLongitude()).append(",")
.append(locationInfo.getCid()).append(",")
.append(locationInfo.getMcc()).append(",")
.append(locationInfo.getMnc()).append(",")
.append(locationInfo.getLac());
return sb.toString();
}
/**
* Creating google api client object
*/
protected synchronized void buildGoogleApiClient() {
mGoogleApiClient = new GoogleApiClient.Builder(context)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(LocationServices.API)
.build();
}
/**
* Method to Update Location
*/
public void updateLocationCheckOut() {
mLocationRequest = LocationRequest.create();
mLocationRequest.setInterval(5000);
mLocationRequest.setFastestInterval(5000);
mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
buildGoogleApiClient();
updateLocation = true;
updateLocation = false;
mGoogleApiClient.connect();
}
/**
* Method to get new LocationInfo. Use in Button Refresh or etc.
*
* @return Location Info
*/
public LocationInfo getNewLocation() {
infoCheckOut = listener.getNewLocationInfo();
return infoCheckOut;
}
/**
* Method for Get Location Info Of CheckOut
*
* @return
*/
public LocationInfo getLocationInfoCheckOut() {
Global.FLAG_LOCATION_TYPE = 2; //CheckOut
infoCheckOut = ltm.getCurrentLocation(Global.FLAG_LOCATION_CHECKOUT);
return infoCheckOut;
}
/**
* Method for Get Latitude and longitude from LocationInfo
*
* @param LocationInfo
* @return LatLng
*/
public LatLng getLatLng(LocationInfo LocationInfo) {
double mLatitude = Double.parseDouble(LocationInfo.getLatitude());
double mLongitude = Double.parseDouble(LocationInfo.getLongitude());
LatLng latLng = new LatLng(mLatitude, mLongitude);
return latLng;
}
/**
* Method For Get Address Location from Geocoder
*
* @param context - context of activity
* @param LocationInfo - location info
* @return String[] - length = 2
* <br/>String[0] is Local of Location, ex: Kebon Jeruk
* <br/>String[1] is Address Line of Location, ex: Jalan Kebon Jeruk Raya No. 80
*/
public void getAddressLocation(Context context, LocationInfo LocationInfo) {
new GetAddressTask().execute();
}
@Override
public void onConnectionFailed(ConnectionResult arg0) {
//EMPTY
}
@Override
public void onConnected(Bundle arg0) {
startPeriodicUpdates();
}
@Override
public void onConnectionSuspended(int i) {
//EMPTY
}
/**
* In response to a request to start updates, send a request
* to Location Services
*/
private void startPeriodicUpdates() {
try {
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED
&& ActivityCompat.checkSelfPermission(context, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
return;
}
LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, listener);
} catch (Exception e) {
FireCrash.log(e);
}
}
public class GetAddressTask extends AsyncTask<Void, Void, String[]> {
public GetAddressTask() {
//EMPTY
}
/**
* Get a Geocoder instance, get the latitude and longitude
* look up the address, and return it
*
* @return A string containing the address of the current
* location, or an empty string if no address can be found,
* or an error message
* @params params One or more Location objects
*/
@Override
protected String[] doInBackground(Void... params) {
Geocoder geocoder =
new Geocoder(context, Locale.getDefault());
// Get the current location from the input parameter list
LocationInfo loc = infoCheckOut;
double mLatitude = 0;
double mLongitude = 0;
try {
mLatitude = Double.parseDouble(loc.getLatitude());
mLongitude = Double.parseDouble(loc.getLongitude());
} catch (Exception e) {
FireCrash.log(e);
}
String[] addressString = new String[2];
// Create a list to contain the result address
List<Address> addresses = null;
try {
/*
* Return 1 address.
*/
addresses = geocoder.getFromLocation(mLatitude, mLongitude, 1);
} catch (IOException e1) {
if (Global.IS_DEV) {
Logger.e("LocationSampleActivity",
"IO Exception in getFromLocation()");
e1.printStackTrace();
}
addressString[0] = "No address found";
addressString[1] = "IO Exception trying to get address";
return addressString;
} catch (IllegalArgumentException e2) {
// Error message to post in the log
addressString[0] = "No address found";
addressString[1] = "Illegal arguments " +
Double.toString(mLatitude) +
" , " +
Double.toString(mLongitude) +
" passed to address service";
if (Global.IS_DEV) {
Logger.e("CheckOut Manager :", addressString[1]);
e2.printStackTrace();
}
return addressString;
}
// If the reverse geocode returned an address
if (addresses != null && !addresses.isEmpty()) {
// Get the first address
Address address = addresses.get(0);
addressString[0] = address.getLocality();
addressString[1] = address.getAddressLine(0);
// Return the text
return addressString;
} else {
addressString[0] = context.getString(R.string.address_not_found);
addressString[1] = context.getString(R.string.lblCoord) + " " + mLatitude + ", " + mLongitude;
return addressString;
}
}
@Override
protected void onPostExecute(String[] addressResult) {
// Set activity indicator visibility to "gone"
// Display the results of the lookup.
CheckOutActivity.setLocation(addressResult);
}
}
}

View file

@ -0,0 +1,135 @@
package com.adins.mss.base.syncfile;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.security.GeneralSecurityException;
import java.security.InvalidKeyException;
import java.security.KeyFactory;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
import javax.crypto.Cipher;
import javax.crypto.CipherInputStream;
import javax.crypto.CipherOutputStream;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
/**
* Utility class for encrypting/decrypting files.
*/
public class FileEncryption {
public static final int AES_Key_Size = 128;
/**
* Path to public key file
*/
public String publicKey;
/**
* Path to private key file
*/
public String privateKey;
private Cipher pkCipher, aesCipher;
private byte[] aesKey;
private SecretKeySpec aeskeySpec;
private String iv = "FA4AD06616A0F2BB2F94A71F4FAC9469";
/**
* Constructor: creates ciphers
*/
public FileEncryption() throws GeneralSecurityException {
// create RSA public key cipher
pkCipher = Cipher.getInstance("RSA");
// create AES shared key cipher
aesCipher = Cipher.getInstance("AES");
// generate key
// makeKey();
}
public static byte[] hexStringToByteArray(String s) {
int len = s.length();
byte[] data = new byte[len / 2];
for (int i = 0; i < len; i += 2) {
data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4)
+ Character.digit(s.charAt(i + 1), 16));
}
return data;
}
/**
* Creates a new AES key
* Generate random AES Key
*/
private void makeKey() throws NoSuchAlgorithmException {
KeyGenerator kgen = KeyGenerator.getInstance("AES");
kgen.init(AES_Key_Size);
SecretKey key = kgen.generateKey();
aesKey = key.getEncoded();
aeskeySpec = new SecretKeySpec(hexStringToByteArray(iv), "AES");
}
/**
* Encrypts and then copies the contents of a given file.
*
* @param in Input file to encrypt (source file to encrypt)
* @param out Out encrypted file (target file encrypted)
*/
public void encrypt(File in, File out) throws IOException, InvalidKeyException {
try {
makeKey();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
aesCipher.init(Cipher.ENCRYPT_MODE, aeskeySpec);
FileInputStream is = new FileInputStream(in);
CipherOutputStream os = new CipherOutputStream(new FileOutputStream(out), aesCipher);
copy(is, os);
os.close();
}
/**
* Decrypts and then copies the contents of a given file.
*
* @param in Input encrypted file (source existing encrypted file)
* @param out Output unencrypted file (target file unencrypted)
*/
public void decrypt(File in, File out) throws IOException, InvalidKeyException {
try {
makeKey();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
aesCipher.init(Cipher.DECRYPT_MODE, aeskeySpec);
CipherInputStream is = new CipherInputStream(new FileInputStream(in), aesCipher);
FileOutputStream os = new FileOutputStream(out);
copy(is, os);
is.close();
os.close();
}
/**
* Copies a stream.
*/
private void copy(InputStream is, OutputStream os) throws IOException {
int i;
byte[] b = new byte[1024];
while ((i = is.read(b)) != -1) {
os.write(b, 0, i);
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -0,0 +1,128 @@
package com.adins.mss.coll.adapters;
/**
* Created by winy.firdasari on 04/02/2015.
*/
import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.CheckedTextView;
import android.widget.TextView;
import android.widget.Toast;
import com.adins.mss.coll.R;
import java.util.ArrayList;
public class ExpandableAdapter extends BaseExpandableListAdapter {
private Activity activity;
private ArrayList<Object> childtems;
private LayoutInflater inflater;
private ArrayList<String> parentItems, child;
public ExpandableAdapter(ArrayList<String> parents, ArrayList<Object> childern) {
this.parentItems = parents;
this.childtems = childern;
}
public void setInflater(LayoutInflater inflater, Activity activity) {
this.inflater = inflater;
this.activity = activity;
}
@Override
public View getChildView(int groupPosition, final int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
child = (ArrayList<String>) childtems.get(groupPosition);
TextView textView = null;
if (convertView == null) {
convertView = inflater.inflate(R.layout.child_view, null);
}
textView = (TextView) convertView.findViewById(R.id.textView1);
textView.setText(child.get(childPosition));
convertView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(activity, child.get(childPosition),
Toast.LENGTH_SHORT).show();
}
});
return convertView;
}
@Override
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = inflater.inflate(R.layout.parent_view, null);
}
((CheckedTextView) convertView).setText(parentItems.get(groupPosition));
((CheckedTextView) convertView).setChecked(isExpanded);
return convertView;
}
@Override
public Object getChild(int groupPosition, int childPosition) {
return null;
}
@Override
public long getChildId(int groupPosition, int childPosition) {
return 0;
}
@Override
public int getChildrenCount(int groupPosition) {
return ((ArrayList<String>) childtems.get(groupPosition)).size();
}
@Override
public Object getGroup(int groupPosition) {
return null;
}
@Override
public int getGroupCount() {
return parentItems.size();
}
@Override
public void onGroupCollapsed(int groupPosition) {
super.onGroupCollapsed(groupPosition);
}
@Override
public void onGroupExpanded(int groupPosition) {
super.onGroupExpanded(groupPosition);
}
@Override
public long getGroupId(int groupPosition) {
return 0;
}
@Override
public boolean hasStableIds() {
return false;
}
@Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
return false;
}
}

View file

@ -0,0 +1,109 @@
package com.adins.mss.odr.accounts.adapter;
import androidx.fragment.app.FragmentActivity;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AlphaAnimation;
import com.adins.mss.base.dynamicform.form.ScrollingLinearLayoutManager;
import com.adins.mss.base.dynamicform.form.questions.OnQuestionClickListener;
import com.adins.mss.base.dynamicform.form.questions.viewholder.ExpandableRecyclerView;
import com.adins.mss.odr.R;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
/**
* Created by muhammad.aap on 11/30/2018.
*/
public class AccountButtonAdapter extends ExpandableRecyclerView.Adapter<RecyclerView.ViewHolder, ButtonOpportunityViewHolder, LeadHistory, String> {
private static final int FADE_DURATION = 300; // in milliseconds
private final LinkedHashMap<String, List<LeadHistory>> mValues;
private final List<String> mGroups;
private final FragmentActivity mActivity;
private final int VIEW_TYPE_LOADING = 999;
public ScrollingLinearLayoutManager linearLayoutManager;
public ExpandableRecyclerView mRecyclerView;
private OnQuestionClickListener mListener;
public AccountButtonAdapter(FragmentActivity activity, ExpandableRecyclerView recyclerView, LinkedHashMap<String, List<LeadHistory>> items, OnQuestionClickListener listener){
mActivity=activity;
mValues=items;
mListener=listener;
mGroups=new ArrayList<>();
mGroups.add("Opportunities");
mRecyclerView=recyclerView;
}
@Override
public int getGroupItemCount() {
return mGroups.size()-1;
}
@Override
public int getChildItemCount(int group) {
return mValues.get(mGroups.get(group)).size();
}
@Override
public String getGroupItem(int position) {
return mGroups.get(position);
}
@Override
public LeadHistory getChildItem(int group, int position) {
return mValues.get(getGroupItem(group)).get(position);
}
@Override
protected ButtonOpportunityViewHolder onCreateGroupViewHolder(ViewGroup parent) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_groupbutton, parent, false);
return new ButtonOpportunityViewHolder(view);
}
@Override
public void onBindGroupViewHolder(ButtonOpportunityViewHolder holder, int group) {
super.onBindGroupViewHolder(holder, group);
String qGroup = "";
try {
qGroup = getGroupItem(group);
}catch (Exception e){}
holder.bind(qGroup);
setFadeAnimation(holder.itemView);
}
@Override
protected LeadHistoryHolder onCreateChildViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_lead, parent, false);
return new LeadHistoryHolder(view);
}
@Override
public int getChildItemViewType(int group, int position) {
int viewType=1;
return getChildItem(group, position) == null ? VIEW_TYPE_LOADING : viewType;
}
public void onBindChildViewHolder(RecyclerView.ViewHolder mHolder, int group, int position) {
super.onBindChildViewHolder(mHolder, group, position);
final LeadHistoryHolder holder = (LeadHistoryHolder) mHolder;
holder.bind(getChildItem(group, position));
setFadeAnimation(mHolder.itemView);
}
@Override
public void onViewDetachedFromWindow(RecyclerView.ViewHolder holder) {
super.onViewDetachedFromWindow(holder);
holder.itemView.clearAnimation();
}
private void setFadeAnimation(View view) {
AlphaAnimation anim = new AlphaAnimation(0.0f, 1.0f);
anim.setDuration(FADE_DURATION);
view.startAnimation(anim);
}
}