mirror of
https://github.com/freeedcom/ai-codereviewer.git
synced 2025-07-01 05:14:17 +00:00
add project adins
This commit is contained in:
parent
ad06ac5505
commit
f8f85d679d
5299 changed files with 625430 additions and 0 deletions
|
@ -0,0 +1,129 @@
|
|||
package com.adins.mss.foundation.rvgenerator;
|
||||
|
||||
/**
|
||||
* Created by intishar.fa on 09/10/2018.
|
||||
*/
|
||||
import java.math.BigInteger;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
public class RvGenerator {
|
||||
private BigInteger taskIdInt,noKontrakId;
|
||||
|
||||
public RvGenerator(){
|
||||
|
||||
}
|
||||
|
||||
public String generateRVNum(String taskId, String noKontrak){
|
||||
|
||||
Date submitDate = Calendar.getInstance().getTime();
|
||||
//convert taskId to int
|
||||
taskId = convertCharToInt(taskId);
|
||||
taskIdInt = new BigInteger(taskId);//use it for multiply operation
|
||||
|
||||
//convert no kontrak to int
|
||||
String noKontrakConv = convertCharToInt(noKontrak);
|
||||
noKontrakId = new BigInteger(noKontrakConv);//use it for multiply operation
|
||||
//pad no kontrak to max 12 char if it's length smaller than 10
|
||||
if(noKontrakConv.length() < 10)
|
||||
noKontrakConv = paddingSequence(noKontrakConv,12);
|
||||
noKontrak = noKontrakConv;
|
||||
|
||||
//string builder for concat all fragment
|
||||
StringBuilder fullRvNum = new StringBuilder();
|
||||
|
||||
//fragment 1
|
||||
String headFragment = getFragment1(submitDate);
|
||||
fullRvNum.append(headFragment);
|
||||
System.out.println("head fragment: "+headFragment);
|
||||
|
||||
//fragment 2
|
||||
String midFragment = getFragment2(noKontrak);
|
||||
fullRvNum.append(midFragment);
|
||||
System.out.println("mid fragment: "+midFragment);
|
||||
|
||||
//fragment 3
|
||||
String tailFragment = getFragment3();
|
||||
fullRvNum.append(tailFragment);
|
||||
System.out.println("tail fragment: "+tailFragment);
|
||||
|
||||
System.out.println("Full RV Number: "+fullRvNum.toString());
|
||||
return fullRvNum.toString();
|
||||
}
|
||||
|
||||
private String formatDate(Date date,String format){
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat(format);
|
||||
return dateFormat.format(date);
|
||||
}
|
||||
|
||||
private String getFragment1(Date submitDate){
|
||||
return formatDate(submitDate,"yyyyMMdd");
|
||||
}
|
||||
|
||||
private String getFragment2(String noKontrak){
|
||||
StringBuilder sb = new StringBuilder();
|
||||
//no kontrak at 5-8th digit
|
||||
sb.append(noKontrak.substring(4,8));
|
||||
|
||||
//taskId * 7
|
||||
long multTaskId7 = taskIdInt.longValue() * 7;
|
||||
String multTaskId7padd = paddingSequence(String.valueOf(multTaskId7),7);
|
||||
sb.append(multTaskId7padd.substring(0,7));
|
||||
|
||||
//no kontrak at 9-10th digit
|
||||
sb.append(noKontrak.substring(8,10));
|
||||
|
||||
//no kontrak at 1-4th digit
|
||||
sb.append(noKontrak.substring(0,4));
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private String getFragment3(){
|
||||
BigInteger taskIdMultNoKontrak = taskIdInt.multiply(noKontrakId);
|
||||
|
||||
String taskIdMultNoKontrakStr = String.valueOf(taskIdMultNoKontrak);
|
||||
taskIdMultNoKontrakStr = paddingSequence(taskIdMultNoKontrakStr,7);
|
||||
int diff = taskIdMultNoKontrakStr.length() - 7;
|
||||
String result = null;
|
||||
if(diff == 0){
|
||||
result = taskIdMultNoKontrakStr;
|
||||
}
|
||||
else if(diff > 0){
|
||||
result = taskIdMultNoKontrakStr.substring(diff,taskIdMultNoKontrakStr.length());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private String convertCharToInt(String charseq){
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for(int i=0; i<charseq.length(); i++){
|
||||
byte asciiCode = (byte) charseq.charAt(i);
|
||||
if(asciiCode < 48 || asciiCode > 57){//test if this char is not number
|
||||
stringBuilder.append(String.valueOf(asciiCode));//append its ascii
|
||||
}
|
||||
else {//if number just append it
|
||||
stringBuilder.append(charseq.charAt(i));
|
||||
}
|
||||
}
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
|
||||
private String paddingSequence(String seq,int targetPaddingNum){
|
||||
int currentLength = seq.length();
|
||||
if(currentLength >= targetPaddingNum)
|
||||
return seq;
|
||||
else {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int diff = targetPaddingNum - currentLength;
|
||||
for(int i=0; i<diff; i++){
|
||||
sb.append('0');
|
||||
}
|
||||
sb.append(seq);
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,188 @@
|
|||
package com.adins.mss.coll.fragments.view;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.adins.mss.base.commons.ViewImpl;
|
||||
import com.adins.mss.base.crashlytics.FireCrash;
|
||||
import com.adins.mss.coll.R;
|
||||
import com.adins.mss.coll.commons.ViewManager;
|
||||
import com.adins.mss.coll.interfaces.callback.DepositReportCallback;
|
||||
import com.adins.mss.coll.interfaces.DepositReportImpl;
|
||||
import com.adins.mss.coll.interfaces.DepositReportInterface;
|
||||
import com.adins.mss.dao.DepositReportD;
|
||||
import com.adins.mss.dao.DepositReportH;
|
||||
import com.adins.mss.dao.TaskD;
|
||||
import com.adins.mss.foundation.formatter.Tool;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by kusnendi.muhamad on 28/07/2017.
|
||||
*/
|
||||
|
||||
public class DepositReportSummaryView extends ViewManager {
|
||||
public View view;
|
||||
private Activity activity;
|
||||
private ListView listOfBatch;
|
||||
private TextView totalTaskLabel;
|
||||
private TextView totalPaidLabel;
|
||||
private TextView totalVisitLabel;
|
||||
private TextView totalFailLabel;
|
||||
private TextView totalTaskValue;
|
||||
private TextView total;
|
||||
private DepositReportInterface DepositReport;
|
||||
private int sum = 0;
|
||||
private int totalSum = 0;
|
||||
|
||||
public DepositReportSummaryView(Activity activity) {
|
||||
super(activity);
|
||||
this.activity = activity;
|
||||
DepositReport = new DepositReportImpl(activity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void publish() {
|
||||
DepositReport.cleanDepositReportH();
|
||||
DepositReport.fillHeader(this);
|
||||
DepositReport.fillDetail(this);
|
||||
}
|
||||
|
||||
public View layoutInflater(LayoutInflater inflater, ViewGroup container) {
|
||||
view = inflater.inflate(R.layout.new_fragment_deposit_report_summary, container, false);
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
totalTaskLabel = (TextView) view.findViewById(R.id.totalTask);
|
||||
totalTaskValue = (TextView) view.findViewById(R.id.totalTaskValue);
|
||||
totalPaidLabel = (TextView) view.findViewById(R.id.paidValue);
|
||||
totalVisitLabel = (TextView) view.findViewById(R.id.visitValue);
|
||||
totalFailLabel = (TextView) view.findViewById(R.id.failValue);
|
||||
listOfBatch = (ListView) view.findViewById(R.id.summaryDetail);
|
||||
total = (TextView) view.findViewById(R.id.total);
|
||||
total.setText(Tool.separateThousand(String.valueOf(totalSum)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void OnFillHeader(int totalTask, int paidTask, int failTask, int visitTask) {
|
||||
this.totalTaskValue.setText(totalTask + " Tasks");
|
||||
totalPaidLabel.setText(paidTask + " Tasks");
|
||||
totalFailLabel.setText(failTask + " Tasks");
|
||||
totalVisitLabel.setText(visitTask + " Tasks");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void OnFillDetail(HashMap<DepositReportH, List<DepositReportD>> packedListOfBatch) {
|
||||
listOfBatch.setAdapter(new PackedBatchListAdapterNew(activity, packedListOfBatch));
|
||||
}
|
||||
|
||||
private void getTotal() {
|
||||
total.setText(Tool.separateThousand(String.valueOf(totalSum)));
|
||||
}
|
||||
|
||||
private class PackedBatchListAdapterNew extends BaseAdapter {
|
||||
private final HashMap<DepositReportH, List<DepositReportD>> packedBatches;
|
||||
private final List<DepositReportH> batchesHeaders;
|
||||
private final Context context;
|
||||
private int curr = 0;
|
||||
|
||||
public PackedBatchListAdapterNew(Context context, HashMap<DepositReportH, List<DepositReportD>> packedBatches) {
|
||||
this.context = context;
|
||||
this.packedBatches = packedBatches;
|
||||
this.batchesHeaders =
|
||||
Arrays.asList(packedBatches.keySet().toArray(new DepositReportH[packedBatches.keySet().size()]));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return packedBatches.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return packedBatches.get(batchesHeaders.get(position));
|
||||
}
|
||||
|
||||
public int getTaskCount(int position) {
|
||||
List<DepositReportD> tasks = (List<DepositReportD>) getItem(position);
|
||||
return tasks.size();
|
||||
}
|
||||
|
||||
public double getTaskSum(int position) {
|
||||
List<DepositReportD> tasks = (List<DepositReportD>) getItem(position);
|
||||
double sum = 0;
|
||||
for (DepositReportD task : tasks) {
|
||||
try {
|
||||
sum += Double.parseDouble(task.getDeposit_amt());
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
sum += 0;
|
||||
}
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
public DepositReportH getHeader(int position) {
|
||||
return batchesHeaders.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
if (convertView == null) {
|
||||
// if (position % 2 == 0) {
|
||||
// convertView = LayoutInflater.from(context).inflate(R.layout.item_summary_batch_colored, parent, false);
|
||||
// } else {
|
||||
convertView = LayoutInflater.from(context).inflate(R.layout.new_summary_detail_item, parent, false);
|
||||
// }
|
||||
}
|
||||
TextView label = (TextView) convertView.findViewById(R.id.itemLabel);
|
||||
TextView value = (TextView) convertView.findViewById(R.id.itemValue);
|
||||
|
||||
// if (position == getCount() - 1) {
|
||||
// label.setText("Total");
|
||||
// value.setText(Tool.separateThousand(String.valueOf(getSumAll())));
|
||||
// return convertView;
|
||||
// }
|
||||
|
||||
DepositReportH header = getHeader(position);
|
||||
int taskCount = getTaskCount(position);
|
||||
double taskSum = getTaskSum(position);
|
||||
|
||||
label.setText(header.getBatch_id());
|
||||
value.setText(taskCount + " Tasks, " + Tool.separateThousand(taskSum));
|
||||
|
||||
int pos = getCount();
|
||||
curr += 1;
|
||||
|
||||
if (curr == pos) {
|
||||
totalSum = getSumAll();
|
||||
getTotal();
|
||||
}
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
private int getSumAll() {
|
||||
for (int i = 0; i < getCount(); i++) {
|
||||
sum += getTaskSum(i);
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,315 @@
|
|||
package com.adins.mss.base.todolist.form;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import com.adins.mss.base.todolist.form.followup.FollowUpTabFragment;
|
||||
import com.google.android.material.tabs.TabItem;
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentPagerAdapter;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.adins.mss.base.R;
|
||||
import com.adins.mss.base.crashlytics.FireCrash;
|
||||
import com.adins.mss.base.todolist.form.helper.TaskFilterParam;
|
||||
import com.adins.mss.base.todolist.form.helper.TaskPlanFilterObservable;
|
||||
import com.adins.mss.base.todolist.form.todaysplan.TodayPlanFragment;
|
||||
import com.adins.mss.foundation.dialog.NiftyDialogBuilder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by kusnendi.muhamad on 27/07/2017.
|
||||
*/
|
||||
|
||||
public class TasklistView implements TaskListTabInteractor, TabLayout.BaseOnTabSelectedListener {
|
||||
public static boolean isMenuClicked = false;
|
||||
public Activity activity;
|
||||
View view;
|
||||
private Context mContext;
|
||||
private ViewPagerAdapter mViewPagerAdapter;
|
||||
public static ViewPager mViewPager;
|
||||
public static TabLayout mSlidingTabLayout;
|
||||
private TabItem dummyTaskListTab, dummyTodayPlanTab;
|
||||
private boolean isError = false;
|
||||
private int page;
|
||||
private String message;
|
||||
private String status = "";
|
||||
private Fragment fragment;
|
||||
private Fragment activeFragment;
|
||||
|
||||
public static String TASKLIST_TAB_PAGE_TAG = "Task List";
|
||||
public static String TODAYSPLAN_TAB_PAGE_TAG = "Today's Plan";
|
||||
public static String FOLLOWUP_TAB_PAGE_TAG = "Follow Up";
|
||||
|
||||
List<TabPage> managedTabs = new ArrayList<>();
|
||||
|
||||
public TasklistView() {
|
||||
}
|
||||
|
||||
public TasklistView(Context context) {
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
public TasklistView(Fragment fragment) {
|
||||
this.fragment = fragment;
|
||||
this.activity = fragment.getActivity();
|
||||
this.mContext = fragment.getContext();
|
||||
}
|
||||
|
||||
public View initialize(LayoutInflater inflater, ViewGroup container) {
|
||||
view = inflater.inflate(R.layout.tasklist_fragment_new, container, false);
|
||||
setupViews(view);
|
||||
initTabs();
|
||||
initViewPager();
|
||||
return view;
|
||||
}
|
||||
|
||||
public void initTabs() {
|
||||
// Set intial date on date tab
|
||||
updatePriorityTab();
|
||||
// Set initial time on time tab
|
||||
updateTodayPlanTab();
|
||||
updateFollowUpTab();
|
||||
mSlidingTabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
|
||||
mSlidingTabLayout.addOnTabSelectedListener(this);
|
||||
mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(mSlidingTabLayout));
|
||||
}
|
||||
|
||||
private void updateFollowUpTab() {
|
||||
TabLayout.Tab tasklistTab = mSlidingTabLayout.newTab();
|
||||
tasklistTab.setText("Follow Up");
|
||||
View view = createCustomTabView("Follow Up");
|
||||
tasklistTab.setCustomView(view);
|
||||
mSlidingTabLayout.addTab( tasklistTab, 2);
|
||||
}
|
||||
|
||||
private void updateTodayPlanTab() {
|
||||
TabLayout.Tab tasklistTab = mSlidingTabLayout.newTab();
|
||||
View view = createCustomTabView(mContext.getString(R.string.todays_plan_tab_page));
|
||||
tasklistTab.setCustomView(view);
|
||||
tasklistTab.setText(mContext.getString(R.string.todays_plan_tab_page));
|
||||
mSlidingTabLayout.addTab( tasklistTab, 1);
|
||||
}
|
||||
|
||||
private void updatePriorityTab() {
|
||||
TabLayout.Tab tasklistTab = mSlidingTabLayout.newTab();
|
||||
View view = createCustomTabView(mContext.getString(R.string.tasklist_tab_page));
|
||||
tasklistTab.setCustomView(view);
|
||||
tasklistTab.setText(mContext.getString(R.string.tasklist_tab_page));
|
||||
mSlidingTabLayout.addTab( tasklistTab, 0);
|
||||
}
|
||||
|
||||
public void initViewPager() {
|
||||
if(mViewPagerAdapter == null)
|
||||
mViewPagerAdapter = new ViewPagerAdapter(fragment.getChildFragmentManager());
|
||||
mViewPager.setAdapter(mViewPagerAdapter);
|
||||
|
||||
try {
|
||||
if (status.equals("failed")) {
|
||||
mViewPager.setCurrentItem(mViewPager.getCurrentItem() + 1, true);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
}
|
||||
|
||||
if (isError) {
|
||||
isError = false;
|
||||
NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(activity);
|
||||
|
||||
if (!dialogBuilder.isShowing()) {
|
||||
dialogBuilder.withTitle("WARNING").
|
||||
withIcon(android.R.drawable.ic_dialog_alert).
|
||||
withMessage(message).isCancelable(true).show();
|
||||
}
|
||||
}
|
||||
|
||||
if (page == 1) {
|
||||
mViewPager.setCurrentItem(1);
|
||||
}
|
||||
}
|
||||
|
||||
private View createCustomTabView(String title) {
|
||||
View view = LayoutInflater.from(mContext).inflate(R.layout.custom_tab_text_size, null);
|
||||
TextView textView = view.findViewById(R.id.custom_text);
|
||||
textView.setText(title);
|
||||
return view;
|
||||
}
|
||||
|
||||
public void setupViews(View v) {
|
||||
mViewPager = (ViewPager) v.findViewById(R.id.pager);
|
||||
mSlidingTabLayout = v.findViewById(R.id.slidingTabLayout);
|
||||
}
|
||||
|
||||
public boolean isError() {
|
||||
return isError;
|
||||
}
|
||||
|
||||
public void setError(boolean error) {
|
||||
isError = error;
|
||||
}
|
||||
|
||||
public int getPage() {
|
||||
return page;
|
||||
}
|
||||
|
||||
public void setPage(int page) {
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Fragment getFragment() {
|
||||
return fragment;
|
||||
}
|
||||
|
||||
public void setFragment(Fragment fragment) {
|
||||
this.fragment = fragment;
|
||||
}
|
||||
|
||||
public Fragment getActiveFragment() {
|
||||
return activeFragment;
|
||||
}
|
||||
|
||||
public void setActiveFragment(Fragment activeFragment) {
|
||||
this.activeFragment = activeFragment;
|
||||
}
|
||||
|
||||
public View getView() {
|
||||
return view;
|
||||
}
|
||||
|
||||
public void setView(View view) {
|
||||
this.view = view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void goToTab(int index) {
|
||||
mViewPager.setCurrentItem(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskPlanFilterObservable<TaskFilterParam> getFilterObservable() {
|
||||
PriorityTabFragment priorityTabFragment = (PriorityTabFragment) mViewPagerAdapter.managedFragment.get(TASKLIST_TAB_PAGE_TAG);
|
||||
return priorityTabFragment;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onTabSelected(TabLayout.Tab tab) {
|
||||
mViewPager.setCurrentItem(tab.getPosition());
|
||||
for(TabPage tabPage:managedTabs){
|
||||
String tabTag = tab.getText().toString();
|
||||
if(tabTag.equals(tabPage.getTabPageName())){
|
||||
tabPage.onEnterPage();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabUnselected(TabLayout.Tab tab) {
|
||||
for(TabPage tabPage:managedTabs){
|
||||
String tabTag = tab.getText().toString();
|
||||
if(tabTag.equals(tabPage.getTabPageName())){
|
||||
tabPage.onLeavePage();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabReselected(TabLayout.Tab tab) {
|
||||
|
||||
}
|
||||
|
||||
private class ViewPagerAdapter extends FragmentPagerAdapter {
|
||||
|
||||
public HashMap<String,Fragment> managedFragment = new HashMap<>();
|
||||
|
||||
public ViewPagerAdapter(FragmentManager fm) {
|
||||
super(fm);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
Fragment fragment = null;
|
||||
switch (position) {
|
||||
case 0:
|
||||
if(managedFragment.get(TASKLIST_TAB_PAGE_TAG) != null){
|
||||
fragment = managedFragment.get(TASKLIST_TAB_PAGE_TAG);
|
||||
}
|
||||
else {
|
||||
PriorityTabFragment taskfragment = new PriorityTabFragment();
|
||||
taskfragment.setTabInteractor(TasklistView.this);
|
||||
managedTabs.add(taskfragment);
|
||||
TodayPlanFragment todayPlanFragment = (TodayPlanFragment) managedFragment.get(TODAYSPLAN_TAB_PAGE_TAG);
|
||||
if(todayPlanFragment != null){
|
||||
taskfragment.setTodayPlanHandler(todayPlanFragment);
|
||||
}
|
||||
else {
|
||||
todayPlanFragment = new TodayPlanFragment();
|
||||
todayPlanFragment.setTabInteractor(TasklistView.this);
|
||||
managedFragment.put(TODAYSPLAN_TAB_PAGE_TAG,todayPlanFragment);
|
||||
taskfragment.setTodayPlanHandler(todayPlanFragment);
|
||||
managedTabs.add(todayPlanFragment);
|
||||
}
|
||||
fragment = taskfragment;
|
||||
managedFragment.put(TASKLIST_TAB_PAGE_TAG,fragment);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if(managedFragment.get(TODAYSPLAN_TAB_PAGE_TAG) != null){
|
||||
fragment = managedFragment.get(TODAYSPLAN_TAB_PAGE_TAG);
|
||||
}
|
||||
else {
|
||||
fragment = new TodayPlanFragment();
|
||||
((TodayPlanFragment) fragment).setTabInteractor(TasklistView.this);
|
||||
managedFragment.put(TODAYSPLAN_TAB_PAGE_TAG,fragment);
|
||||
managedTabs.add(((TodayPlanFragment) fragment));
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if(managedFragment.get(FOLLOWUP_TAB_PAGE_TAG) != null){
|
||||
fragment = managedFragment.get(FOLLOWUP_TAB_PAGE_TAG);
|
||||
}else {
|
||||
fragment = new FollowUpTabFragment();
|
||||
((FollowUpTabFragment) fragment).setTabInteractor(TasklistView.this);
|
||||
managedFragment.put(FOLLOWUP_TAB_PAGE_TAG, fragment);
|
||||
managedTabs.add((FollowUpTabFragment) fragment);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="14dp"
|
||||
android:height="14dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="@color/gradient_end"
|
||||
android:pathData="M3,5L1,5v16c0,1.1 0.9,2 2,2h16v-2L3,21L3,5zM21,1L7,1c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2L23,3c0,-1.1 -0.9,-2 -2,-2zM21,17L7,17L7,3h14v14zM17,13h-4v-2h2c1.1,0 2,-0.89 2,-2L17,7c0,-1.11 -0.9,-2 -2,-2h-4v2h4v2h-2c-1.1,0 -2,0.89 -2,2v4h6v-2z"/>
|
||||
</vector>
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle" >
|
||||
|
||||
<gradient
|
||||
android:angle="270"
|
||||
android:endColor="#0000"
|
||||
android:startColor="#7000" />
|
||||
|
||||
</shape>
|
|
@ -0,0 +1,27 @@
|
|||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/bgColor">
|
||||
<!--<View-->
|
||||
<!--android:id="@+id/actionbar"-->
|
||||
<!--android:layout_width="match_parent"-->
|
||||
<!--android:layout_height="48dp"-->
|
||||
<!--android:layout_alignParentTop="true"-->
|
||||
<!--android:background="@drawable/actionbar_background" />-->
|
||||
<com.github.jjobes.slidedatetimepicker.SlidingTabLayout
|
||||
android:id="@+id/slidingTabLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:background="@drawable/header"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:name="com.adins.mss.base.todolist.form.TaskListFragment_new"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:id="@+id/pager"
|
||||
tools:context="com.adins.mss.base.todolist.form.TaskListFragment_new">
|
||||
</androidx.viewpager.widget.ViewPager>
|
||||
</LinearLayout>
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="14dp"
|
||||
android:height="14dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="@color/gradient_end"
|
||||
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,17h-2v-6h2v6zM13,9h-2L11,7h2v2z"/>
|
||||
</vector>
|
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
* Utility class copied from http://transdroid.googlecode.com with the authorization from Eric Kok to redistribute it under Apache Software License.
|
||||
*/
|
||||
package org.acra.util;
|
||||
|
||||
import com.adins.mss.base.crashlytics.FireCrash;
|
||||
|
||||
import org.apache.http.conn.scheme.LayeredSocketFactory;
|
||||
import org.apache.http.conn.scheme.SocketFactory;
|
||||
import org.apache.http.params.HttpConnectionParams;
|
||||
import org.apache.http.params.HttpParams;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Socket;
|
||||
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.SSLSocket;
|
||||
import javax.net.ssl.TrustManager;
|
||||
|
||||
public class FakeSocketFactory implements SocketFactory, LayeredSocketFactory {
|
||||
|
||||
private SSLContext sslcontext = null;
|
||||
|
||||
private static SSLContext createEasySSLContext() throws IOException {
|
||||
try {
|
||||
final SSLContext context = SSLContext.getInstance("TLS");
|
||||
context.init(null, new TrustManager[]{new NaiveTrustManager()}, null);
|
||||
return context;
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
throw new IOException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private SSLContext getSSLContext() throws IOException {
|
||||
if (this.sslcontext == null) {
|
||||
this.sslcontext = createEasySSLContext();
|
||||
}
|
||||
return this.sslcontext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Socket connectSocket(Socket sock, String host, int port, InetAddress localAddress, int localPort, HttpParams params) throws IOException {
|
||||
final int connTimeout = HttpConnectionParams.getConnectionTimeout(params);
|
||||
final int soTimeout = HttpConnectionParams.getSoTimeout(params);
|
||||
|
||||
final InetSocketAddress remoteAddress = new InetSocketAddress(host, port);
|
||||
final SSLSocket sslsock = (SSLSocket) ((sock != null) ? sock : createSocket());
|
||||
|
||||
if ((localAddress != null) || (localPort > 0)) {
|
||||
// we need to bind explicitly
|
||||
if (localPort < 0) {
|
||||
localPort = 0; // indicates "any"
|
||||
}
|
||||
final InetSocketAddress isa = new InetSocketAddress(localAddress, localPort);
|
||||
sslsock.bind(isa);
|
||||
}
|
||||
|
||||
sslsock.connect(remoteAddress, connTimeout);
|
||||
sslsock.setSoTimeout(soTimeout);
|
||||
|
||||
return sslsock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Socket createSocket() throws IOException {
|
||||
return getSSLContext().getSocketFactory().createSocket();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSecure(Socket arg0) throws IllegalArgumentException {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Socket createSocket(Socket socket, String host, int port, boolean autoClose) throws IOException {
|
||||
return getSSLContext().getSocketFactory().createSocket(socket, host, port, autoClose);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,107 @@
|
|||
/*
|
||||
* Copyright 2010 Kevin Gaudin
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.acra.collector;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
import org.acra.ACRA;
|
||||
import org.acra.annotation.ReportsCrashes;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import static org.acra.ACRA.LOG_TAG;
|
||||
|
||||
/**
|
||||
* Collects the content (key/value pairs) of SharedPreferences, from the
|
||||
* application default preferences or any other preferences asked by the
|
||||
* application developer.
|
||||
*/
|
||||
final class SharedPreferencesCollector {
|
||||
|
||||
/**
|
||||
* Collects all key/value pairs in SharedPreferences and writes them in a
|
||||
* result String. The application default SharedPreferences are always
|
||||
* collected, and the developer can provide additional SharedPreferences
|
||||
* names in the {@link ReportsCrashes#additionalSharedPreferences()}
|
||||
* configuration item.
|
||||
*
|
||||
* @param context the application context.
|
||||
* @return A readable formatted String containing all key/value pairs.
|
||||
*/
|
||||
public static String collect(Context context) {
|
||||
final StringBuilder result = new StringBuilder();
|
||||
|
||||
// Include the default SharedPreferences
|
||||
final Map<String, SharedPreferences> sharedPrefs = new TreeMap<String, SharedPreferences>();
|
||||
sharedPrefs.put("default", PreferenceManager.getDefaultSharedPreferences(context));
|
||||
|
||||
// Add in any additional SharedPreferences
|
||||
final String[] sharedPrefIds = ACRA.getConfig().additionalSharedPreferences();
|
||||
if (sharedPrefIds != null) {
|
||||
for (final String sharedPrefId : sharedPrefIds) {
|
||||
sharedPrefs.put(sharedPrefId, context.getSharedPreferences(sharedPrefId, Context.MODE_PRIVATE));
|
||||
}
|
||||
}
|
||||
|
||||
// Iterate over all included preference files and add the preferences from each.
|
||||
for (Map.Entry<String, SharedPreferences> entry : sharedPrefs.entrySet()) {
|
||||
final String sharedPrefId = entry.getKey();
|
||||
final SharedPreferences prefs = entry.getValue();
|
||||
|
||||
final Map<String, ?> prefEntries = prefs.getAll();
|
||||
|
||||
// Show that we have no preferences saved for that preference file.
|
||||
if (prefEntries.isEmpty()) {
|
||||
result.append(sharedPrefId).append('=').append("empty\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
// Add all non-filtered preferences from that preference file.
|
||||
for (final String key : prefEntries.keySet()) {
|
||||
if (filteredKey(key)) {
|
||||
ACRA.log.d(LOG_TAG, "Filtered out sharedPreference=" + sharedPrefId + " key=" + key + " due to filtering rule");
|
||||
} else {
|
||||
final Object prefValue = prefEntries.get(key);
|
||||
result.append(sharedPrefId).append('.').append(key).append('=');
|
||||
result.append(prefValue == null ? "null" : prefValue.toString());
|
||||
result.append("\n");
|
||||
}
|
||||
}
|
||||
result.append('\n');
|
||||
}
|
||||
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the key matches one of the patterns provided by the developer
|
||||
* to exclude some preferences from reports.
|
||||
*
|
||||
* @param key the name of the preference to be checked
|
||||
* @return true if the key has to be excluded from reports.
|
||||
*/
|
||||
private static boolean filteredKey(String key) {
|
||||
for (String regex : ACRA.getConfig().excludeMatchingSharedPreferencesKeys()) {
|
||||
if (key.matches(regex)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package com.adins.mss.base.commons;
|
||||
|
||||
import com.adins.mss.base.NewMainActivity;
|
||||
import com.adins.mss.base.mainmenu.MainMenuActivity;
|
||||
|
||||
/**
|
||||
* Created by kusnendi.muhamad on 03/08/2017.
|
||||
*/
|
||||
|
||||
public interface AppInfo {
|
||||
public void checkAppVersion(NewMainActivity activity);
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
package com.adins.mss.foundation.print;
|
||||
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.dao.PrintResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public abstract class AbstractPrintManager_ {
|
||||
protected boolean connected = false;
|
||||
protected String valueSeparator = ":";
|
||||
protected char blank = ' ';
|
||||
protected int labelStart = 0;
|
||||
protected int separatorStart = 0;
|
||||
protected int valueStart = 0;
|
||||
protected List<PrintResult> list;
|
||||
|
||||
public AbstractPrintManager_(List<PrintResult> list) {
|
||||
if (list == null)
|
||||
throw new IllegalArgumentException("Print list can not be null!");
|
||||
|
||||
this.list = list;
|
||||
|
||||
int longestLabel = 1;
|
||||
for (PrintResult bean : list) {
|
||||
if (Global.PRINT_ANSWER.equals(bean.getPrint_type_id())) {
|
||||
String label = bean.getLabel();
|
||||
if (label != null) {
|
||||
int len = label.length();
|
||||
longestLabel = (len > longestLabel) ? len : longestLabel;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.separatorStart = longestLabel + 1;
|
||||
this.valueStart = longestLabel + 3;
|
||||
}
|
||||
|
||||
public void setValueSeparator(String valueSeparator) {
|
||||
this.valueSeparator = valueSeparator;
|
||||
}
|
||||
|
||||
public boolean isConnected() {
|
||||
return connected;
|
||||
}
|
||||
|
||||
public abstract boolean connect() throws Exception;
|
||||
|
||||
public abstract boolean disconnect() throws Exception;
|
||||
|
||||
public abstract boolean print() throws Exception;
|
||||
|
||||
public abstract boolean printSato() throws Exception;
|
||||
|
||||
public abstract boolean printZebra() throws Exception;
|
||||
//public abstract boolean printSato(byte[] file) throws Exception;
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue