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,177 @@
package com.adins.mss.foundation.image;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import com.adins.mss.base.GlobalData;
import com.adins.mss.base.R;
import com.adins.mss.base.dynamicform.DynamicFormActivity;
import com.adins.mss.base.util.LocaleHelper;
import com.adins.mss.base.util.Utility;
import com.adins.mss.constant.Global;
import com.adins.mss.foundation.formatter.Formatter;
import com.adins.mss.foundation.formatter.Tool;
import com.adins.mss.foundation.questiongenerator.QuestionBean;
import java.io.ByteArrayOutputStream;
import java.lang.ref.WeakReference;
import java.util.Locale;
public class ViewImageActivity extends Activity {
// We can be in one of these 3 states
static final int NONE = 0;
// These matrices will be used to move and zoom image
Matrix matrix = new Matrix();
//data gambar
byte[] img;
ImageView view;
Bitmap temp_bmp;
private int jpegQuality = 70;
@Override
protected void onDestroy() {
super.onDestroy();
if (temp_bmp != null) {
temp_bmp.recycle();
temp_bmp = null;
}
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (temp_bmp != null) temp_bmp.recycle();
setContentView(R.layout.view_image_layout);
view = (ImageView) findViewById(R.id.image_view);
Bundle extras = getIntent().getExtras();
Button save = (Button) findViewById(R.id.Save);
Button rotate = (Button) findViewById(R.id.Rotate);
if (Global.getSharedGlobal().getIsViewer()) {
save.setVisibility(View.GONE);
rotate.setVisibility(View.GONE);
} else {
save.setVisibility(View.VISIBLE);
rotate.setVisibility(View.VISIBLE);
}
img = extras.getByteArray(Global.BUND_KEY_IMAGE_BYTE);
new BitmapWorkerTask(view, false, false).execute(img);
view.setOnTouchListener(new ImageViewer());
matrix.setTranslate(1f, 1f);
view.setImageMatrix(matrix);
}
@Override
protected void attachBaseContext(Context newBase) {
Context context = newBase;
Locale locale;
try{
locale = new Locale(GlobalData.getSharedGlobalData().getLocale());
context = LocaleHelper.wrap(newBase, locale);
} catch (Exception e) {
locale = new Locale(LocaleHelper.ENGLSIH);
context = LocaleHelper.wrap(newBase, locale);
} finally {
super.attachBaseContext(context);
}
}
public void rotateImage(View v) {
new BitmapWorkerTask(view, true, false).execute();
}
public void saveImage(View v) {
new BitmapWorkerTask(DynamicFormActivity.getThumbInFocus(), false, true).execute();
}
class BitmapWorkerTask extends AsyncTask<byte[], Void, Bitmap> {
private final WeakReference<ImageView> imageViewReference;
QuestionBean bean;
private byte[] data;
private boolean isRotate;
private boolean isSave;
private ProgressDialog progressDialog;
public BitmapWorkerTask(ImageView imageView, boolean isRotate, boolean isSave) {
// Use a WeakReference to ensure the ImageView can be garbage collected
imageViewReference = new WeakReference<>(imageView);
this.isRotate = isRotate;
this.isSave = isSave;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
progressDialog = ProgressDialog.show(ViewImageActivity.this, "", ViewImageActivity.this.getString(R.string.processing_image), true);
}
// Decode image in background.
@Override
protected Bitmap doInBackground(byte[]... params) {
Utility.freeMemory();
Bitmap bm = null;
if (isRotate) {
bm = ImageManipulation.rotateImage(temp_bmp, 90);
temp_bmp = bm;
} else if (isSave) {
bean = DynamicFormActivity.getQuestionInFocus();
ByteArrayOutputStream stream = new ByteArrayOutputStream();
temp_bmp.compress(Bitmap.CompressFormat.JPEG, jpegQuality, stream);
DynamicFormActivity.saveImage(stream.toByteArray());
int[] res = Tool.getThumbnailResolution(temp_bmp.getWidth(), temp_bmp.getHeight());
bm = Bitmap.createScaledBitmap(temp_bmp, res[0], res[1], true);
} else {
data = params[0];
bm = BitmapFactory.decodeByteArray(data, 0, data.length);
temp_bmp = bm;
}
return bm;
}
// Once complete, see if ImageView is still around and set bitmap.
@Override
protected void onPostExecute(Bitmap bitmap) {
if (progressDialog != null && progressDialog.isShowing()) {
progressDialog.dismiss();
}
if (imageViewReference != null && bitmap != null) {
final ImageView imageView = imageViewReference.get();
if (imageView != null) {
imageView.setImageBitmap(bitmap);
}
if (isSave) {
String indicatorGPS = "";
boolean isGeoTagged = Global.AT_IMAGE_W_LOCATION.equals(bean.getAnswer_type());
boolean isGeoTaggedGPSOnly = Global.AT_IMAGE_W_GPS_ONLY.equals(bean.getAnswer_type());
long size = bean.getImgAnswer().length;
String formattedSize = Formatter.formatByteSize(size);
if (isGeoTagged || isGeoTaggedGPSOnly) {
indicatorGPS = bean.getAnswer();
if (!"".equals(bean.getAnswer()) || bean.getAnswer() != null)
DynamicFormActivity.setTxtDetailInFocus(temp_bmp.getWidth() + " x " + temp_bmp.getHeight() + ". Size " + formattedSize + "\n" + indicatorGPS);
else
DynamicFormActivity.setTxtDetailInFocus(temp_bmp.getWidth() + " x " + temp_bmp.getHeight() + ". Size " + formattedSize);
} else {
DynamicFormActivity.setTxtDetailInFocus(temp_bmp.getWidth() + " x " + temp_bmp.getHeight() + ". Size " + formattedSize);
}
finish();
}
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

View file

@ -0,0 +1,30 @@
package com.adins.mss.svy.models;
import com.adins.mss.foundation.http.KeyValue;
import com.adins.mss.foundation.http.MssResponseType;
import com.google.gson.annotations.SerializedName;
/**
* Created by Aditya Purwa on 1/28/2015.
*/
public class SurveyorSearchResponse extends MssResponseType{
@SerializedName("listKeyValue")
private KeyValue[] listKeyValue;
// private Status status;
public KeyValue[] getListKeyValue() {
return listKeyValue;
}
public void setListKeyValue(KeyValue[] listKeyValue) {
this.listKeyValue = listKeyValue;
}
// public Status getStatus() {
// return this.status;
// }
//
// public void setStatus(Status status) {
// this.status = status;
// }
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View file

@ -0,0 +1,66 @@
package com.adins.mss.base.loyalti.model;
import com.adins.mss.foundation.http.MssResponseType;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class GroupPointData extends MssResponseType {
@SerializedName("GROUP_POINT")
public String groupPoint;
@SerializedName("RANK")
public List<RankDetail> rankDetails;
@SerializedName("POINT_DETAIL")
public List<PointDetail> pointDetails;
private transient String[] groupPointValue;
private transient boolean isMonth;
private transient boolean isDay;
public GroupPointData() { }
public GroupPointData(String groupPoint, List<RankDetail> rankDetails, List<PointDetail> pointDetails) {
this.groupPoint = groupPoint;
this.rankDetails = rankDetails;
this.pointDetails = pointDetails;
groupPointValue = groupPoint.trim().split("-");
}
public String[] getGroupPointValue() {
if(groupPoint == null || groupPoint.equals("")){
return null;
}
if(groupPointValue == null || groupPointValue.length == 0)
groupPointValue = groupPoint.trim().split("-");
return groupPointValue;
}
public boolean isMonth() {
if(groupPointValue == null || groupPointValue.length == 0)
getGroupPointValue();
if(groupPointValue.length == 2){
isMonth = true;
isDay = false;
}
return isMonth;
}
public boolean isDay() {
if(groupPointValue == null || groupPointValue.length == 0)
getGroupPointValue();
if(groupPointValue.length == 3){
isDay = true;
isMonth = false;
}
return isDay;
}
}

View file

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- STATES WHEN BUTTON IS NOT PRESSED -->
<!-- Non focused states -->
<item android:state_focused="false" android:state_selected="false"
android:state_pressed="false"
android:drawable="@drawable/actionbar_background" />
<item android:state_focused="false" android:state_selected="true"
android:state_pressed="false"
android:drawable="@drawable/spinner_background" />
<!-- Focused states (such as when focused with a d-pad or mouse hover) -->
<item android:state_focused="true" android:state_selected="false"
android:state_pressed="false"
android:drawable="@drawable/actionbar_background" />
<item android:state_focused="true" android:state_selected="true"
android:state_pressed="false"
android:drawable="@drawable/spinner_background" />
<!-- STATES WHEN BUTTON IS PRESSED -->
<!-- Non focused states -->
<item android:state_focused="false" android:state_selected="false"
android:state_pressed="true"
android:drawable="@drawable/actionbar_background" />
<item android:state_focused="false" android:state_selected="true"
android:state_pressed="true"
android:drawable="@drawable/spinner_background" />
<!-- Focused states (such as when focused with a d-pad or mouse hover) -->
<item android:state_focused="true" android:state_selected="false"
android:state_pressed="true"
android:drawable="@drawable/actionbar_background" />
<item android:state_focused="true" android:state_selected="true"
android:state_pressed="true"
android:drawable="@drawable/spinner_background" />
</selector>

View file

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/tv_white">
<ScrollView android:layout_width="match_parent" android:layout_height="fill_parent">
<LinearLayout android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="0dp"
android:padding="8dp">
<TextView android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/collection_activity_detail"
android:textStyle="bold"
android:textSize="24sp"
android:layout_marginBottom="8dp"/>
<HorizontalScrollView
android:id="@+id/horizontalScrollView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:fillViewport="true">
<TableLayout android:layout_width="match_parent"
android:layout_height="fill_parent"
android:stretchColumns="2"
android:id="@+id/tableCollectionDetail">
<TableRow android:layout_width="match_parent" android:layout_height="wrap_content"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:background="@drawable/spinner_background">
<TextView android:text="@string/label_no"
android:textSize="12sp"
android:paddingRight="6dp"
android:paddingLeft="6dp"
android:gravity="center"
android:textColor="@color/tv_white"
android:textStyle="bold"/>
<TextView android:text="@string/label_field"
android:minWidth="120dp"
android:textSize="12sp"
android:paddingLeft="6dp"
android:paddingRight="6dp"
android:textColor="@color/tv_white"
android:textStyle="bold"/>
<TextView android:text="@string/label_value"
android:textSize="12sp"
android:paddingLeft="6dp"
android:paddingRight="6dp"
android:textColor="@color/tv_white"
android:textStyle="bold"/>
</TableRow>
</TableLayout>
</HorizontalScrollView>
</LinearLayout>
</ScrollView>
</LinearLayout>

View file

@ -0,0 +1,21 @@
<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="@color/bgColor">
<uk.co.senab.actionbarpulltorefresh.library.PullToRefreshLayout
android:id="@+id/ptr_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="5dp">
</ListView>
</uk.co.senab.actionbarpulltorefresh.library.PullToRefreshLayout>
</RelativeLayout>

View file

@ -0,0 +1,6 @@
package com.adins.mss.constant;
public class GlobalString {
}