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
Binary file not shown.
After Width: | Height: | Size: 6.9 KiB |
|
@ -0,0 +1,53 @@
|
|||
package com.adins.mss.foundation.operators;
|
||||
|
||||
import androidx.annotation.Keep;
|
||||
|
||||
import com.gadberry.utility.expression.Argument;
|
||||
import com.gadberry.utility.expression.Expression;
|
||||
import com.gadberry.utility.expression.Function;
|
||||
import com.gadberry.utility.expression.InvalidArgumentsException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by gigin.ginanjar on 14/09/2016.
|
||||
*/
|
||||
public class IfElseFunction extends Function {
|
||||
|
||||
@Keep
|
||||
public IfElseFunction(Expression expression) {
|
||||
super(expression);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void checkArgs(List<Argument> args) throws InvalidArgumentsException {
|
||||
if (args.size() < 3) {
|
||||
throw new InvalidArgumentsException(
|
||||
"IfElseOperator requires a minimum of three arguments."
|
||||
);
|
||||
}
|
||||
for (Argument arg : args) {
|
||||
if (arg.isNull()) {
|
||||
throw new InvalidArgumentsException(
|
||||
"IfElseOperator cannot accept null arguments. At least one argument provided was null.");
|
||||
}
|
||||
if (!arg.isBoolean()) {
|
||||
throw new InvalidArgumentsException(
|
||||
"IfElseOperator only accepts boolean. Wrong type of arguments provided. Arg: "
|
||||
+ arg.toString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Argument resolve() {
|
||||
Argument condArgument = new Argument(getArgument(0).toBoolean(), getResolver());
|
||||
boolean condition = condArgument.toBoolean();
|
||||
if (condition) {
|
||||
return new Argument(getArgument(1).toBoolean(), getResolver());
|
||||
} else {
|
||||
return new Argument(getArgument(2).toBoolean(), getResolver());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
package com.adins.mss.base.loyalti;
|
||||
|
||||
public interface BasePresenter {
|
||||
void init();
|
||||
}
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
package com.adins.mss.foundation.camerainapp.helper;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
/**
|
||||
* Layout that adjusts to maintain a specific aspect ratio.
|
||||
*/
|
||||
public class AspectFrameLayout extends FrameLayout {
|
||||
private double mTargetAspect = -1.0; // initially use default window size
|
||||
|
||||
public AspectFrameLayout(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public AspectFrameLayout(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the desired aspect ratio. The value is <code>width / height</code>.
|
||||
*/
|
||||
public void setAspectRatio(double aspectRatio) {
|
||||
if (aspectRatio < 0) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
Logger.d(this, "Setting aspect ratio to " + aspectRatio + " (was " + mTargetAspect + ")");
|
||||
if (mTargetAspect != aspectRatio) {
|
||||
mTargetAspect = aspectRatio;
|
||||
requestLayout();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
Logger.d(this, "onMeasure target=" + mTargetAspect +
|
||||
" width=[" + MeasureSpec.toString(widthMeasureSpec) +
|
||||
"] height=[" + View.MeasureSpec.toString(heightMeasureSpec) + "]");
|
||||
|
||||
// Target aspect ratio will be < 0 if it hasn't been set yet. In that case,
|
||||
// we just use whatever we've been handed.
|
||||
if (mTargetAspect > 0) {
|
||||
int initialWidth = MeasureSpec.getSize(widthMeasureSpec);
|
||||
int initialHeight = MeasureSpec.getSize(heightMeasureSpec);
|
||||
|
||||
// factor the padding out
|
||||
int horizPadding = getPaddingLeft() + getPaddingRight();
|
||||
int vertPadding = getPaddingTop() + getPaddingBottom();
|
||||
initialWidth -= horizPadding;
|
||||
initialHeight -= vertPadding;
|
||||
|
||||
double viewAspectRatio = (double) initialWidth / initialHeight;
|
||||
double aspectDiff = mTargetAspect / viewAspectRatio - 1;
|
||||
|
||||
if (Math.abs(aspectDiff) < 0.01) {
|
||||
// We're very close already. We don't want to risk switching from e.g. non-scaled
|
||||
// 1280x720 to scaled 1280x719 because of some floating-point round-off error,
|
||||
// so if we're really close just leave it alone.
|
||||
Logger.d(this, "aspect ratio is good (target=" + mTargetAspect +
|
||||
", view=" + initialWidth + "x" + initialHeight + ")");
|
||||
} else {
|
||||
if (aspectDiff > 0) {
|
||||
// limited by narrow width; restrict height
|
||||
initialHeight = (int) (initialWidth / mTargetAspect);
|
||||
} else {
|
||||
// limited by short height; restrict width
|
||||
initialWidth = (int) (initialHeight * mTargetAspect);
|
||||
}
|
||||
Logger.d(this, "new size=" + initialWidth + "x" + initialHeight + " + padding " +
|
||||
horizPadding + "x" + vertPadding);
|
||||
initialWidth += horizPadding;
|
||||
initialHeight += vertPadding;
|
||||
widthMeasureSpec = MeasureSpec.makeMeasureSpec(initialWidth, MeasureSpec.EXACTLY);
|
||||
heightMeasureSpec = MeasureSpec.makeMeasureSpec(initialHeight, MeasureSpec.EXACTLY);
|
||||
}
|
||||
}
|
||||
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,131 @@
|
|||
package com.adins.mss.coll.fragments;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.annotation.Keep;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ListView;
|
||||
|
||||
import com.adins.mss.coll.R;
|
||||
import com.adins.mss.coll.adapters.ClosingTaskAdapter;
|
||||
import com.adins.mss.coll.interfaces.ClosingTaskImpl;
|
||||
import com.adins.mss.coll.interfaces.ClosingTaskInterface;
|
||||
import com.adins.mss.coll.networks.ClosingTaskListener;
|
||||
import com.androidquery.AQuery;
|
||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
|
||||
/**
|
||||
* Created by angga.permadi on 6/6/2016.
|
||||
*/
|
||||
public class ClosingTaskFragment extends Fragment implements ClosingTaskListener {
|
||||
public static final String CLOSING_TASK_LIST = "closing_task_list";
|
||||
|
||||
private AQuery query;
|
||||
private ClosingTaskInterface iClosingTask;
|
||||
private FirebaseAnalytics screenName;
|
||||
//private ClosingTaskAdapter adapter;
|
||||
|
||||
public static ClosingTaskFragment newInstance() {
|
||||
return new ClosingTaskFragment();
|
||||
}
|
||||
|
||||
public static ClosingTaskFragment newInstance(Bundle args) {
|
||||
ClosingTaskFragment myFragment = new ClosingTaskFragment();
|
||||
myFragment.setArguments(args);
|
||||
return myFragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
screenName = FirebaseAnalytics.getInstance(getActivity());
|
||||
iClosingTask = new ClosingTaskImpl(getActivity(), this);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_closing_task, container, false);
|
||||
query = new AQuery(getActivity(), view);
|
||||
getActivity().setTitle(R.string.title_mn_closing_task);
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
ListView listView = (ListView) query.id(R.id.listClosingTask).getView();
|
||||
listView.setAdapter(ClosingTaskAdapter.getInstance());
|
||||
updateCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
//Set Firebase screen name
|
||||
screenName.setCurrentScreen(getActivity(), getString(R.string.screen_name_closing_task), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
query = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClosingTaskSuccess() {
|
||||
ClosingTaskAdapter.getInstance().clear();
|
||||
ClosingTaskAdapter.getInstance().notifyDataSetChanged();
|
||||
updateCount();
|
||||
}
|
||||
|
||||
private void updateCount() {
|
||||
query.id(R.id.btnClosingTask).clicked(this, "closingTask").text(
|
||||
getString(R.string.title_mn_closing_task) + " (" +
|
||||
ClosingTaskAdapter.getInstance().getCount() + ")");
|
||||
}
|
||||
|
||||
@Keep // subcribe
|
||||
public void closingTask() {
|
||||
iClosingTask.closingTask();
|
||||
// if (GlobalData.getSharedGlobalData().getUser() != null) {
|
||||
// String uuidUser = GlobalData.getSharedGlobalData().getUser().getUuid_user();
|
||||
//
|
||||
// boolean isDraft = TaskHDataAccess.getAllTaskByStatus(getActivity(), uuidUser, TaskHDataAccess.STATUS_SEND_SAVEDRAFT).size() != 0;
|
||||
// boolean isRvPending = TaskHDataAccess.getOneTaskByStatusRV(getActivity(), uuidUser, TaskHDataAccess.STATUS_RV_PENDING) != null;
|
||||
// boolean isPending = TaskHDataAccess.getAllTaskByStatus(getActivity(), uuidUser, TaskHDataAccess.STATUS_SEND_PENDING).size() != 0;
|
||||
//
|
||||
// if (Global.isUploading || isDraft || isRvPending || isPending) {
|
||||
// final NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(getActivity());
|
||||
// dialogBuilder.withTitle(getString(R.string.title_mn_closing_task))
|
||||
// .withMessage(getString(R.string.msg_still_uploading_closing_task))
|
||||
// .withButton1Text(getString(R.string.btnCancel))
|
||||
// .setButton1Click(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View arg0) {
|
||||
// dialogBuilder.dismiss();
|
||||
// }
|
||||
// })
|
||||
// .isCancelable(false)
|
||||
// .isCancelableOnTouchOutside(true)
|
||||
// .show();
|
||||
// } else {
|
||||
// ClosingTaskRequest request = new ClosingTaskRequest();
|
||||
// request.setFlag(ClosingTaskRequest.CLOSING_TASK);
|
||||
//
|
||||
// ClosingTaskSender<ClosingTaskResponse> sender = new ClosingTaskSender<>(
|
||||
// getActivity(), request, ClosingTaskResponse.class);
|
||||
// sender.setListener(this);
|
||||
// sender.execute();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/newTaskLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/bg_grayscale">
|
||||
|
||||
<View
|
||||
android:id="@+id/actionbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:background="@drawable/actionbar_background" />
|
||||
|
||||
<uk.co.senab.actionbarpulltorefresh.library.PullToRefreshLayout
|
||||
android:id="@+id/ptr_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@+id/actionbar"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp" >
|
||||
|
||||
<ListView
|
||||
android:id="@android:id/list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="5dp"
|
||||
android:divider="@android:color/transparent"
|
||||
android:dividerHeight="5dp"
|
||||
android:footerDividersEnabled="true"
|
||||
android:headerDividersEnabled="true" >
|
||||
</ListView>
|
||||
|
||||
</uk.co.senab.actionbarpulltorefresh.library.PullToRefreshLayout>
|
||||
|
||||
</RelativeLayout>
|
|
@ -0,0 +1,14 @@
|
|||
*.iml
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea/workspace.xml
|
||||
/.idea/libraries
|
||||
.DS_Store
|
||||
/build
|
||||
/captures
|
||||
for-testing-only/build/
|
||||
google-play-services/build/
|
||||
mssbase/build/
|
||||
msscoll/build/
|
||||
mssodr/build/
|
||||
msssvy/build/
|
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
* This source is part of the
|
||||
* _____ ___ ____
|
||||
* __ / / _ \/ _ | / __/___ _______ _
|
||||
* / // / , _/ __ |/ _/_/ _ \/ __/ _ `/
|
||||
* \___/_/|_/_/ |_/_/ (_)___/_/ \_, /
|
||||
* /___/
|
||||
* repository.
|
||||
*
|
||||
* Copyright (C) 2013 Benoit 'BoD' Lubek (BoD@JRAF.org)
|
||||
*
|
||||
* 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.jraf.android.util.activitylifecyclecallbackscompat;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.app.Application;
|
||||
import android.app.Application.ActivityLifecycleCallbacks;
|
||||
import android.os.Build;
|
||||
|
||||
/**
|
||||
* Helper for accessing {@link Application#registerActivityLifecycleCallbacks(ActivityLifecycleCallbacks)} and
|
||||
* {@link Application#unregisterActivityLifecycleCallbacks(ActivityLifecycleCallbacks)} introduced in API level 14 in a
|
||||
* backwards compatible fashion.<br>
|
||||
* When running on API level 14 or above, the framework's implementations of these methods will be used.
|
||||
*/
|
||||
public class ApplicationHelper {
|
||||
public static final boolean PRE_ICS = Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH;
|
||||
|
||||
/*
|
||||
* Register.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Registers a callback to be called following the life cycle of the application's {@link Activity activities}.
|
||||
*
|
||||
* @param application The application with which to register the callback.
|
||||
* @param callback The callback to register.
|
||||
*/
|
||||
public static void registerActivityLifecycleCallbacks(Application application, ActivityLifecycleCallbacksCompat callback) {
|
||||
if (PRE_ICS) {
|
||||
preIcsRegisterActivityLifecycleCallbacks(callback);
|
||||
} else {
|
||||
postIcsRegisterActivityLifecycleCallbacks(application, callback);
|
||||
}
|
||||
}
|
||||
|
||||
private static void preIcsRegisterActivityLifecycleCallbacks(ActivityLifecycleCallbacksCompat callback) {
|
||||
MainLifecycleDispatcher.get().registerActivityLifecycleCallbacks(callback);
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
|
||||
private static void postIcsRegisterActivityLifecycleCallbacks(Application application, ActivityLifecycleCallbacksCompat callback) {
|
||||
application.registerActivityLifecycleCallbacks(new ActivityLifecycleCallbacksWrapper(callback));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Unregister.
|
||||
*/
|
||||
|
||||
private static void preIcsUnregisterActivityLifecycleCallbacks(ActivityLifecycleCallbacksCompat callback) {
|
||||
MainLifecycleDispatcher.get().unregisterActivityLifecycleCallbacks(callback);
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
|
||||
private static void postIcsUnregisterActivityLifecycleCallbacks(Application application, ActivityLifecycleCallbacksCompat callback) {
|
||||
application.unregisterActivityLifecycleCallbacks(new ActivityLifecycleCallbacksWrapper(callback));
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters a previously registered callback.
|
||||
*
|
||||
* @param application The application with which to unregister the callback.
|
||||
* @param callback The callback to unregister.
|
||||
*/
|
||||
public void unregisterActivityLifecycleCallbacks(Application application, ActivityLifecycleCallbacksCompat callback) {
|
||||
if (PRE_ICS) {
|
||||
preIcsUnregisterActivityLifecycleCallbacks(callback);
|
||||
} else {
|
||||
postIcsUnregisterActivityLifecycleCallbacks(application, callback);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue