mirror of
https://github.com/freeedcom/ai-codereviewer.git
synced 2025-06-30 21:04:16 +00:00
add project adins
This commit is contained in:
parent
ad06ac5505
commit
f8f85d679d
5299 changed files with 625430 additions and 0 deletions
|
@ -0,0 +1,58 @@
|
|||
package com.adins.mss.foundation.db.dataaccess;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.adins.mss.dao.DaoSession;
|
||||
import com.adins.mss.dao.ErrorLog;
|
||||
import com.adins.mss.dao.ErrorLogDao;
|
||||
import com.adins.mss.foundation.db.DaoOpenHelper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import de.greenrobot.dao.query.QueryBuilder;
|
||||
|
||||
/**
|
||||
* Created by ACER 471 on 3/27/2017.
|
||||
*/
|
||||
|
||||
public class ErrorLogDataAccess {
|
||||
protected static DaoSession getDaoSession(Context context) {
|
||||
return DaoOpenHelper.getDaoSession(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* get Training dao and you can access the DB
|
||||
*
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
protected static ErrorLogDao getErrorLogDao(Context context) {
|
||||
return getDaoSession(context).getErrorLogDao();
|
||||
}
|
||||
|
||||
public static List<ErrorLog> getAllErrorLog(Context context) {
|
||||
QueryBuilder<ErrorLog> qb = getErrorLogDao(context).queryBuilder();
|
||||
qb.orderAsc(ErrorLogDao.Properties.Dtm_activity);
|
||||
qb.build();
|
||||
return qb.list();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear session, close db and set daoOpenHelper to null
|
||||
*/
|
||||
public static void closeAll() {
|
||||
DaoOpenHelper.closeAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* add training as entity
|
||||
*
|
||||
* @param context
|
||||
* @param errorLog
|
||||
* @return
|
||||
*/
|
||||
public static void addOrReplace(Context context, ErrorLog errorLog) {
|
||||
getErrorLogDao(context).insertOrReplaceInTx(errorLog);
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,134 @@
|
|||
package com.adins.mss.base.todolist.form;
|
||||
|
||||
import android.app.ActionBar;
|
||||
import android.os.Bundle;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.ItemTouchHelper;
|
||||
import android.text.format.DateFormat;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.adins.mss.base.R;
|
||||
import com.adins.mss.base.crashlytics.FireCrash;
|
||||
import com.adins.mss.base.mainmenu.MainMenuActivity;
|
||||
import com.adins.mss.base.todolist.ToDoList;
|
||||
import com.adins.mss.base.todolist.form.helper.OnStartDragListener;
|
||||
import com.adins.mss.base.todolist.form.helper.SimpleItemTouchHelperCallback;
|
||||
import com.adins.mss.dao.TaskH;
|
||||
import com.adins.mss.dao.TaskHSequence;
|
||||
import com.adins.mss.foundation.db.dataaccess.TaskHSequenceDataAccess;
|
||||
|
||||
import org.acra.ACRA;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by ACER 471 on 3/22/2017.
|
||||
*/
|
||||
|
||||
public class SurveyPlanFragment extends Fragment implements OnStartDragListener {
|
||||
|
||||
public static final String REQ_PRIORITY_LIST = "REQ_PRIORITY_LIST";
|
||||
public static final String REQ_LOG_LIST = "REQ_LOG_LIST";
|
||||
public static final String REQ_STATUS_LIST = "REQ_STATUS_LIST";
|
||||
public static final String BUND_KEY_REQ = "BUND_KEY_REQ";
|
||||
|
||||
RecyclerView recyclerView;
|
||||
private SurveyListAdapter adapter;
|
||||
private ItemTouchHelper mItemTouchHelper;
|
||||
private List<TaskH> listTaskH;
|
||||
private LinearLayout layoutView;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.survey_plan_layout, container, false);
|
||||
recyclerView = (RecyclerView) view.findViewById(R.id.recyclerList);
|
||||
Button btnSavePlan = (Button) view.findViewById(R.id.btnSavePlan);
|
||||
|
||||
btnSavePlan.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
TaskHSequenceDataAccess.clean(getActivity());
|
||||
TaskHSequenceDataAccess.insertAllNewTaskHSeq(getActivity(), adapter.getListTaskH());
|
||||
Toast.makeText(getActivity(), "Plan sudah di simpan", Toast.LENGTH_SHORT).show();
|
||||
FragmentTransaction transaction = MainMenuActivity.fragmentManager.beginTransaction();
|
||||
transaction.setCustomAnimations(R.anim.activity_open_translate, R.anim.activity_close_scale, R.anim.activity_open_scale, R.anim.activity_close_translate);
|
||||
getFragmentManager().popBackStack();
|
||||
}
|
||||
});
|
||||
return view;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
loadListView();
|
||||
|
||||
adapter = new SurveyListAdapter(getActivity(), this, listTaskH);
|
||||
|
||||
recyclerView.setHasFixedSize(true);
|
||||
recyclerView.setAdapter(adapter);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||
|
||||
layoutView = (LinearLayout) view.findViewById(R.id.layoutView);
|
||||
|
||||
ItemTouchHelper.Callback callback = new SimpleItemTouchHelperCallback(adapter);
|
||||
mItemTouchHelper = new ItemTouchHelper(callback);
|
||||
mItemTouchHelper.attachToRecyclerView(recyclerView);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void loadListView() {
|
||||
listTaskH = null;
|
||||
try {
|
||||
listTaskH = ToDoList.getListTaskInPriority(getActivity(), 0, null);
|
||||
List<TaskHSequence> taskHSequences = TaskHSequenceDataAccess.getAllOrderAsc(getContext());
|
||||
List<TaskH> taskHList = new ArrayList<>();
|
||||
if (taskHSequences.isEmpty()) {
|
||||
TaskHSequenceDataAccess.insertAllNewTaskHSeq(getContext(), listTaskH);
|
||||
taskHSequences = TaskHSequenceDataAccess.getAllOrderAsc(getContext());
|
||||
|
||||
}
|
||||
for (int i = 0; i < taskHSequences.size(); i++) {
|
||||
taskHList.add(taskHSequences.get(i).getTaskH());
|
||||
}
|
||||
listTaskH = taskHList;
|
||||
if ( listTaskH.isEmpty()) {
|
||||
layoutView.setBackgroundResource(R.drawable.bg_notfound);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
ACRA.getErrorReporter().putCustomData("errorLoadListView", e.getMessage());
|
||||
ACRA.getErrorReporter().putCustomData("errorLoadListView", DateFormat.format("yyyy.MM.dd G \'at\' HH:mm:ss z", Calendar.getInstance().getTime()).toString());
|
||||
ACRA.getErrorReporter().handleSilentException(new Exception("Exception saat check TaskH"));
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartDrag(RecyclerView.ViewHolder viewHolder) {
|
||||
mItemTouchHelper.startDrag(viewHolder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
getActivity().getActionBar().removeAllTabs();
|
||||
getActivity().getActionBar().setTitle(getString(R.string.title_mn_tasklist));
|
||||
getActivity().getActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package com.adins.mss.coll.loyalti;
|
||||
|
||||
public interface BasePresenter {
|
||||
void init();
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package com.manuelpeinado.fadingactionbar.view;
|
||||
|
||||
public interface OnScrollChangedCallback {
|
||||
void onScroll(int l, int t);
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
package com.services.models;
|
||||
|
||||
import com.adins.mss.foundation.http.MssRequestType;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class JsonRequestLastSync extends MssRequestType {
|
||||
@SerializedName("uuid_user")
|
||||
private String uuid_user;
|
||||
@SerializedName("dtm_req")
|
||||
private String dtm_req;
|
||||
@SerializedName("data")
|
||||
private String data;
|
||||
@SerializedName("listOfLOV")
|
||||
private List listOfLOV;
|
||||
@SerializedName("is_send")
|
||||
private int is_send;
|
||||
@SerializedName("flag")
|
||||
private String flag;
|
||||
|
||||
public List getListOfLOV() {
|
||||
return listOfLOV;
|
||||
}
|
||||
|
||||
public void setListOfLOV(List listOfLOV) {
|
||||
this.listOfLOV = listOfLOV;
|
||||
}
|
||||
|
||||
public String getUuid_user() {
|
||||
return uuid_user;
|
||||
}
|
||||
|
||||
public void setUuid_user(String uuid_user) {
|
||||
this.uuid_user = uuid_user;
|
||||
}
|
||||
|
||||
public String getDtm_req() {
|
||||
return dtm_req;
|
||||
}
|
||||
|
||||
public void setDtm_req(String dtm_req) {
|
||||
this.dtm_req = dtm_req;
|
||||
}
|
||||
|
||||
public String getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(String data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public int getIs_send() {
|
||||
return is_send;
|
||||
}
|
||||
|
||||
public void setIs_send(int is_send) {
|
||||
this.is_send = is_send;
|
||||
}
|
||||
|
||||
public String getFlag() {
|
||||
return flag;
|
||||
}
|
||||
|
||||
public void setFlag(String flag) {
|
||||
this.flag = flag;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources translatable="false">
|
||||
|
||||
<string name="define_license_mit"></string>
|
||||
<string name="license_mit_licenseName">MIT License</string>
|
||||
<string name="license_mit_licenseWebsite">http://opensource.org/licenses/MIT</string>
|
||||
<string name="license_mit_licenseShortDescription">
|
||||
<![CDATA[
|
||||
Copyright © <<<YEAR>>>, <<<OWNER>>>
|
||||
<br />
|
||||
All rights reserved.
|
||||
<br /><br />
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
<br /><br />
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
]]>
|
||||
</string>
|
||||
<string name="license_mit_licenseDescription">
|
||||
<![CDATA[
|
||||
The MIT License (MIT)
|
||||
<br /><br />
|
||||
Copyright © <<<YEAR>>>, <<<OWNER>>>
|
||||
<br />
|
||||
All rights reserved.
|
||||
<br /><br />
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
<br /><br />
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
<br /><br />
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
]]>
|
||||
</string>
|
||||
|
||||
</resources>
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* This evaluator can be used to perform type interpolation between <code>float</code> values.
|
||||
*/
|
||||
public class FloatEvaluator implements TypeEvaluator<Number> {
|
||||
|
||||
/**
|
||||
* This function returns the result of linearly interpolating the start and end values, with
|
||||
* <code>fraction</code> representing the proportion between the start and end values. The
|
||||
* calculation is a simple parametric calculation: <code>result = x0 + t * (v1 - v0)</code>,
|
||||
* where <code>x0</code> is <code>startValue</code>, <code>x1</code> is <code>endValue</code>,
|
||||
* and <code>t</code> is <code>fraction</code>.
|
||||
*
|
||||
* @param fraction The fraction from the starting to the ending values
|
||||
* @param startValue The start value; should be of type <code>float</code> or
|
||||
* <code>Float</code>
|
||||
* @param endValue The end value; should be of type <code>float</code> or <code>Float</code>
|
||||
* @return A linear interpolation between the start and end values, given the
|
||||
* <code>fraction</code> parameter.
|
||||
*/
|
||||
public Float evaluate(float fraction, Number startValue, Number endValue) {
|
||||
float startFloat = startValue.floatValue();
|
||||
return startFloat + fraction * (endValue.floatValue() - startFloat);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.adins.mss.odr.accounts.api;
|
||||
|
||||
import com.adins.mss.dao.GroupTask;
|
||||
import com.adins.mss.foundation.http.MssResponseType;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/17/2017.
|
||||
*/
|
||||
|
||||
public class LoadOpportunityResponse extends MssResponseType {
|
||||
@SerializedName("listOppor")
|
||||
private List<GroupTask> listOppor;
|
||||
|
||||
public List<GroupTask> getListOppor() {
|
||||
return listOppor;
|
||||
}
|
||||
|
||||
public void setListOppor(List<GroupTask> listOppor) {
|
||||
this.listOppor = listOppor;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package com.adins.mss.base.dynamicform;
|
||||
|
||||
import com.adins.mss.foundation.http.MssRequestType;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* Created by noerhayati.dm on 8/2/2018.
|
||||
*/
|
||||
|
||||
public class JsonRequestValidationQuestion extends MssRequestType {
|
||||
|
||||
@SerializedName("taskId")
|
||||
private String taskId;
|
||||
@SerializedName("phoneNumber")
|
||||
private String phoneNumber;
|
||||
|
||||
public String getTaskId() {
|
||||
return taskId;
|
||||
}
|
||||
|
||||
public void setTaskId(String taskId) {
|
||||
this.taskId = taskId;
|
||||
}
|
||||
|
||||
public String getPhoneNumber() {
|
||||
return phoneNumber;
|
||||
}
|
||||
|
||||
public void setPhoneNumber(String phoneNumber) {
|
||||
this.phoneNumber = phoneNumber;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package org.acra.collector;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
|
||||
public final class CollectorUtil {
|
||||
|
||||
/**
|
||||
* Closes a Reader.
|
||||
*
|
||||
* @param reader Reader to close. If reader is null then method just returns.
|
||||
*/
|
||||
public static void safeClose(Reader reader) {
|
||||
if (reader == null) return;
|
||||
|
||||
try {
|
||||
reader.close();
|
||||
} catch (IOException e) {
|
||||
// We made out best effort to release this resource. Nothing more we can do.
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
package com.adins.mss.foundation.camera2;
|
||||
|
||||
/**
|
||||
* Created by ahmadkamilalmasyhur on 25/01/2018.
|
||||
*/
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.TextureView;
|
||||
|
||||
/**
|
||||
* A {@link TextureView} that can be adjusted to a specified aspect ratio.
|
||||
*/
|
||||
public class AutoFitTextureView extends TextureView {
|
||||
|
||||
private int mRatioWidth = 0;
|
||||
private int mRatioHeight = 0;
|
||||
|
||||
public AutoFitTextureView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public AutoFitTextureView(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public AutoFitTextureView(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the aspect ratio for this view. The size of the view will be measured based on the ratio
|
||||
* calculated from the parameters. Note that the actual sizes of parameters don't matter, that
|
||||
* is, calling setAspectRatio(2, 3) and setAspectRatio(4, 6) make the same result.
|
||||
*
|
||||
* @param width Relative horizontal size
|
||||
* @param height Relative vertical size
|
||||
*/
|
||||
public void setAspectRatio(int width, int height) {
|
||||
if (width < 0 || height < 0) {
|
||||
throw new IllegalArgumentException("Size cannot be negative.");
|
||||
}
|
||||
mRatioWidth = width;
|
||||
mRatioHeight = height;
|
||||
requestLayout();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
int width = MeasureSpec.getSize(widthMeasureSpec);
|
||||
int height = MeasureSpec.getSize(heightMeasureSpec);
|
||||
if (0 == mRatioWidth || 0 == mRatioHeight) {
|
||||
setMeasuredDimension(width, height);
|
||||
} else {
|
||||
if (width < height * mRatioWidth / mRatioHeight) {
|
||||
setMeasuredDimension(width, width * mRatioHeight / mRatioWidth);
|
||||
} else {
|
||||
setMeasuredDimension(height * mRatioWidth / mRatioHeight, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.adins.mss.coll.models;
|
||||
|
||||
import com.adins.mss.dao.PaymentHistoryD;
|
||||
import com.adins.mss.foundation.http.MssResponseType;
|
||||
|
||||
/**
|
||||
* Created by adityapurwa on 20/03/15.
|
||||
*/
|
||||
public class PaymentHistoryResponseDetail extends PaymentHistoryD {
|
||||
public PaymentHistoryResponseDetail(PaymentHistoryD detail){
|
||||
setDtm_crt(detail.getDtm_crt());
|
||||
setDtm_upd(detail.getDtm_upd());
|
||||
setOs_amount_od(detail.getOs_amount_od());
|
||||
setPayment_allocation_name(detail.getPayment_allocation_name());
|
||||
setReceive_amount(detail.getReceive_amount());
|
||||
setUsr_crt(detail.getUsr_crt());
|
||||
setUsr_upd(detail.getUsr_upd());
|
||||
setUuid_task_h(detail.getUuid_task_h());
|
||||
setUuid_payment_history_d(detail.getUuid_payment_history_d());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/lookupDukcapilReviewLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/padding_medium"
|
||||
android:background="@color/tv_white">
|
||||
<TextView
|
||||
android:id="@+id/questionDukcapilNoLabel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="0. "
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||
<TextView
|
||||
android:id="@+id/questionDukcapilTextLabel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Label"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:layout_toRightOf="@+id/questionDukcapilNoLabel"/>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/answerLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_below="@+id/questionDukcapilTextLabel"
|
||||
android:layout_toEndOf="@+id/questionDukcapilNoLabel"
|
||||
android:layout_toRightOf="@+id/questionDukcapilNoLabel"
|
||||
|
||||
android:paddingTop="5dp"
|
||||
android:paddingBottom="5dp">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:id="@+id/questionDukcapilTextAnswer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Answer"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_below="@+id/answerLayout"
|
||||
android:background="@color/timelineLine"
|
||||
android:layout_marginBottom="5dp"/>
|
||||
</RelativeLayout>
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,56 @@
|
|||
package com.adins.mss.coll.commons;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.adins.mss.base.crashlytics.FireCrash;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
/**
|
||||
* Created by Aditya Purwa on 3/5/2015.
|
||||
*/
|
||||
public class PersistentCounter {
|
||||
public static int getAndIncrement(Context context, String name) {
|
||||
File dir = context.getDir("persistentcounter", Context.MODE_PRIVATE);
|
||||
File file = new File(dir, name);
|
||||
|
||||
int base = 0;
|
||||
if (file.exists()) {
|
||||
try( BufferedReader reader = new BufferedReader(new FileReader(file))) {
|
||||
String line = reader.readLine();
|
||||
base = Integer.parseInt(line);
|
||||
} catch (Exception ex) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
try (BufferedWriter writer = new BufferedWriter(new FileWriter(file))){
|
||||
|
||||
writer.write(String.valueOf(base + 1));
|
||||
writer.flush();
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return base;
|
||||
}
|
||||
|
||||
public static int get(Context context, String name) {
|
||||
File dir = context.getDir("persistentcounter", Context.MODE_PRIVATE);
|
||||
File file = new File(dir, name);
|
||||
|
||||
int base = 0;
|
||||
if (file.exists()) {
|
||||
|
||||
try(BufferedReader reader = new BufferedReader(new FileReader(file))){
|
||||
String line = reader.readLine();
|
||||
base = Integer.parseInt(line);
|
||||
} catch (Exception ex) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return base;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,176 @@
|
|||
package com.adins.mss.foundation.db.dataaccess;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.dao.DaoSession;
|
||||
import com.adins.mss.dao.PaymentChannel;
|
||||
import com.adins.mss.dao.PaymentChannelDao;
|
||||
import com.adins.mss.foundation.db.DaoOpenHelper;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import de.greenrobot.dao.query.QueryBuilder;
|
||||
|
||||
public class PaymentChannelDataAccess {
|
||||
|
||||
// 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 lookupDao dao and you can access the DB
|
||||
*
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
protected static PaymentChannelDao getPaymentChannelDao(Context context){
|
||||
return getDaoSession(context).getPaymentChannelDao();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear session, close db and set daoOpenHelper to null
|
||||
*
|
||||
*/
|
||||
public static void closeAll(){
|
||||
/*if(daoOpenHelper!=null){
|
||||
daoOpenHelper.closeAll();
|
||||
daoOpenHelper = null;
|
||||
}*/
|
||||
DaoOpenHelper.closeAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* add lookup as entity
|
||||
*
|
||||
* @param context
|
||||
* @param paymentChannel
|
||||
*
|
||||
*
|
||||
*/
|
||||
public static void add(Context context, PaymentChannel paymentChannel){
|
||||
getPaymentChannelDao(context).insertInTx(paymentChannel);
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* add lookup as list entity
|
||||
*
|
||||
* @param context
|
||||
* @param paymentChannelList
|
||||
*/
|
||||
public static void add(Context context, List<PaymentChannel> paymentChannelList){
|
||||
getPaymentChannelDao(context).insertInTx(paymentChannelList);
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* delete all content in table.
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
public static void clean(Context context){
|
||||
getPaymentChannelDao(context).deleteAll();
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param paymentChannel
|
||||
* @param context
|
||||
*/
|
||||
public static void delete(Context context, PaymentChannel paymentChannel){
|
||||
getPaymentChannelDao(context).delete(paymentChannel);
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* delete all record by keyQuestionSet
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
public static void delete(Context context, String codeChannel){
|
||||
QueryBuilder<PaymentChannel> qb = getPaymentChannelDao(context).queryBuilder();
|
||||
qb.where(PaymentChannelDao.Properties.Code.eq(codeChannel));
|
||||
qb.build();
|
||||
getPaymentChannelDao(context).deleteInTx(qb.list());
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param paymentChannel
|
||||
* @param context
|
||||
*/
|
||||
public static void update(Context context, PaymentChannel paymentChannel){
|
||||
getPaymentChannelDao(context).updateInTx(paymentChannel);
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
public static void addOrUpdate(final Context context, PaymentChannel paymentChannel){
|
||||
getPaymentChannelDao(context).insertOrReplaceInTx(paymentChannel);
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
public static Date getLastDateChannel(Context context) {
|
||||
QueryBuilder<PaymentChannel> qb = getPaymentChannelDao(context).queryBuilder();
|
||||
qb.orderDesc(PaymentChannelDao.Properties.Dtm_crt);
|
||||
qb.build();
|
||||
|
||||
if (qb.list() == null || qb.list().size() == 0) {
|
||||
return null;
|
||||
} else {
|
||||
return qb.list().get(0).getDtm_crt();
|
||||
}
|
||||
}
|
||||
|
||||
public static List<PaymentChannel> getReachedMaxLimit(Context context, Double reachedLimit) {
|
||||
QueryBuilder<PaymentChannel> qb = getPaymentChannelDao(context).queryBuilder();
|
||||
qb.where(PaymentChannelDao.Properties.Is_active.eq(Global.TRUE_STRING),
|
||||
PaymentChannelDao.Properties.Payment_limit.lt(reachedLimit),
|
||||
PaymentChannelDao.Properties.Payment_limit.notEq(reachedLimit));
|
||||
qb.build();
|
||||
return qb.list();
|
||||
}
|
||||
|
||||
public static List<PaymentChannel> getAllPaymentChannel(Context context , Double sumDeposit){
|
||||
QueryBuilder<PaymentChannel> qb = getPaymentChannelDao(context).queryBuilder();
|
||||
qb.where(PaymentChannelDao.Properties.Is_active.eq(Global.TRUE_STRING),
|
||||
qb.or(PaymentChannelDao.Properties.Payment_limit.gt(sumDeposit), PaymentChannelDao.Properties.Payment_limit.eq(sumDeposit)));
|
||||
qb.build();
|
||||
return qb.list();
|
||||
}
|
||||
|
||||
public static PaymentChannel getOnePaymentChannel(Context context , String codeChannel){
|
||||
QueryBuilder<PaymentChannel> qb = getPaymentChannelDao(context).queryBuilder();
|
||||
qb.where(PaymentChannelDao.Properties.Code.eq(codeChannel));
|
||||
qb.build();
|
||||
if (qb.list() == null || qb.list().size() == 0) {
|
||||
return null;
|
||||
} else {
|
||||
return qb.list().get(0);
|
||||
}
|
||||
}
|
||||
|
||||
public static List<PaymentChannel> getAllChannel(Context context){
|
||||
QueryBuilder<PaymentChannel> qb = getPaymentChannelDao(context).queryBuilder();
|
||||
qb.where(PaymentChannelDao.Properties.Is_active.eq(Global.TRUE_STRING));
|
||||
qb.build();
|
||||
return qb.list();
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue