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.
|
@ -0,0 +1,29 @@
|
|||
package com.adins.mss.base.commons;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
/**
|
||||
* Created by Aditya Purwa on 1/6/2015.
|
||||
* Used to create a context based model.
|
||||
*/
|
||||
public abstract class ContextModel {
|
||||
protected final Context context;
|
||||
|
||||
/**
|
||||
* Initialize a new instance of context model.
|
||||
*
|
||||
* @param context The context for the model.
|
||||
*/
|
||||
public ContextModel(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the model context.
|
||||
*
|
||||
* @return Model context.
|
||||
*/
|
||||
public Context getContext() {
|
||||
return context;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,83 @@
|
|||
package com.adins.mss.odr;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import com.adins.mss.foundation.http.HttpConnectionResult;
|
||||
import com.adins.mss.foundation.sync.DefaultSynchronizeScheme;
|
||||
import com.adins.mss.foundation.sync.Synchronize;
|
||||
import com.adins.mss.foundation.sync.Synchronize.SynchronizeListener;
|
||||
import com.adins.mss.foundation.sync.SynchronizeItem;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnClickListener;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class SynchronizeActivity extends Activity implements SynchronizeListener, Runnable, OnClickListener{
|
||||
|
||||
ProgressBar progressBar;
|
||||
TextView progressLabel;
|
||||
|
||||
File file = this.getDatabasePath("msm").getParentFile();
|
||||
String DB_PATH = file +"/";
|
||||
|
||||
Synchronize synchronize;
|
||||
public SynchronizeActivity(){
|
||||
|
||||
}
|
||||
|
||||
public void startSync(){
|
||||
synchronize = new Synchronize();
|
||||
synchronize.setSynchronizeScheme(new DefaultSynchronizeScheme());
|
||||
synchronize.setListener(this);
|
||||
|
||||
//TODO Bikin Task Buat Gabungin ke UI
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.synchronize_layout);
|
||||
|
||||
progressBar = (ProgressBar)findViewById(R.id.progressBar1);
|
||||
progressLabel = (TextView) findViewById(R.id.progressLabel);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
// TODO Auto-generated method stub
|
||||
synchronize.startSynchronize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void progressUpdated(float values) {
|
||||
// TODO Auto-generated method stub
|
||||
float progress = values;
|
||||
int progressInt = (int) progress;
|
||||
updateProgressBar(progressInt);
|
||||
}
|
||||
|
||||
protected void updateProgressBar(int progress){
|
||||
progressBar.setProgress(progress);
|
||||
progressLabel.setText("Progress : " + progress + "%");
|
||||
}
|
||||
@Override
|
||||
public void synchronizeFailed(SynchronizeItem arg0,
|
||||
HttpConnectionResult arg1, int arg2) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_enabled="false" android:color="@color/disabledFontColor" />
|
||||
<item android:state_enabled="true" android:color="@color/fontColor" />
|
||||
</selector>
|
|
@ -0,0 +1,157 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/scrollView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#f2f1ed"
|
||||
android:clipToPadding="false"
|
||||
tools:context=".loyalti.monthlypointacquisition.MonthlyPointsChartView">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/chartHeader"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="10dp"
|
||||
android:visibility="invisible"
|
||||
app:layout_constraintLeft_toRightOf="@id/guideline1"
|
||||
app:layout_constraintRight_toLeftOf="@id/guideline2"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/cardTotalCoin"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="110dp"
|
||||
android:layout_marginTop="20dp"
|
||||
app:cardCornerRadius="10dp"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="10dp"
|
||||
android:paddingEnd="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/currentMonthPointText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:text="@string/current_month_point"
|
||||
android:textSize="15sp" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@android:color/darker_gray" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/currentMonthPoint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="3000"
|
||||
android:textSize="25sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.05"/>
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.95"/>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginBottom="@dimen/activity_vertical_margin"
|
||||
app:cardCornerRadius="10dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@id/guideline1"
|
||||
app:layout_constraintRight_toLeftOf="@id/guideline2"
|
||||
app:layout_constraintTop_toBottomOf="@+id/chartHeader">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/chartContent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/yAxisTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/daily_points"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.github.mikephil.charting.charts.BarChart
|
||||
android:id="@+id/monthlyChart"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="500dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/yAxisTitle"
|
||||
tools:layout_editor_absoluteX="0dp" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/legendsContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/monthlyChart">
|
||||
|
||||
<com.adins.mss.base.loyalti.barchart.NonScrollListView
|
||||
android:id="@+id/legendPoints"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:divider="@null"
|
||||
android:dividerHeight="0dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintWidth_percent="0.65" />
|
||||
|
||||
<com.adins.mss.base.loyalti.barchart.NonScrollListView
|
||||
android:id="@+id/legendRanks"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:divider="@null"
|
||||
android:dividerHeight="0dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintWidth_percent="0.35" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
|
@ -0,0 +1,63 @@
|
|||
package com.adins.mss.odr.news;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
import androidx.viewpager.widget.PagerAdapter;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.adins.mss.dao.MobileContentD;
|
||||
import com.adins.mss.foundation.image.Utils;
|
||||
import com.adins.mss.odr.R;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class NewsContentAdapter extends PagerAdapter {
|
||||
public List<MobileContentD> objects;
|
||||
Activity activity;
|
||||
public NewsContentAdapter(Activity activity, List<MobileContentD> objects){
|
||||
this.activity=activity;
|
||||
this.objects=objects;
|
||||
}
|
||||
@Override
|
||||
public int getCount() {
|
||||
int count = 1;
|
||||
if(0!=objects.size())
|
||||
count=objects.size();
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isViewFromObject(View view, Object object) {
|
||||
((ImageView) object).setBackgroundColor(Color.WHITE);
|
||||
return view == object;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object instantiateItem(ViewGroup container, int position) {
|
||||
ImageView imageView = new ImageView(activity);
|
||||
try {
|
||||
MobileContentD contentD = objects.get(position);
|
||||
final byte[] imagebyte = contentD.getContent();
|
||||
final Bitmap image = Utils.byteToBitmap(imagebyte);
|
||||
|
||||
int padding = activity.getResources().getDimensionPixelSize(R.dimen.padding_medium);
|
||||
imageView.setPadding(padding, padding, padding, padding);
|
||||
imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
|
||||
|
||||
imageView.setImageBitmap(image);
|
||||
} catch (Exception e) {
|
||||
imageView.setImageResource(R.drawable.img_notavailable);
|
||||
}
|
||||
|
||||
container.addView(imageView, 0);
|
||||
return imageView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroyItem(ViewGroup container, int position, Object object) {
|
||||
container.removeView((ImageView) object);
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 6.5 KiB |
Loading…
Add table
Add a link
Reference in a new issue