repo_name
stringlengths
7
104
file_path
stringlengths
13
198
context
stringlengths
67
7.15k
import_statement
stringlengths
16
4.43k
code
stringlengths
40
6.98k
prompt
stringlengths
227
8.27k
next_line
stringlengths
8
795
leelit/STUer-client
app/src/main/java/com/leelit/stuer/module_stu/StuFragment.java
// Path: app/src/main/java/com/leelit/stuer/base_adapters/BaseListAdapter.java // public abstract class BaseListAdapter<VH extends RecyclerView.ViewHolder> extends RecyclerView.Adapter<VH> { // protected OnItemClickListener mOnItemClickListener; // // public void setOnItemClickListener(OnItemClickListener onItemClickListener) { // mOnItemClickListener = onItemClickListener; // } // // public interface OnItemClickListener { // void onItemClick(View view, int position); // } // // public abstract void removeData(int position); // } // // Path: app/src/main/java/com/leelit/stuer/base_view/BaseListFragment.java // public abstract class BaseListFragment extends Fragment { // // protected RecyclerView mRecyclerView; // // protected SwipeRefreshLayout mSwipeRefreshLayout; // // protected BaseListAdapter mAdapter; // // protected abstract BaseListAdapter bindAdapter(); // // protected abstract void refreshTask(); // // protected abstract void onItemClickEvent(View view, int position); // // // @Nullable // @Override // public View onCreateView(final LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // View view = inflater.inflate(R.layout.fragment_base_list, container, false); // mSwipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.swipeRefreshLayout); // mRecyclerView = (RecyclerView) view.findViewById(R.id.recyclerView); // // // 默认布局 // mRecyclerView.setLayoutManager(new LinearLayoutManager(container.getContext())); // // mAdapter = bindAdapter(); // mRecyclerView.setAdapter(mAdapter); // // // 将adapter的click task转移到fragment中 // if (mAdapter != null) { // mAdapter.setOnItemClickListener(new BaseListAdapter.OnItemClickListener() { // @Override // public void onItemClick(View view, int position) { // onItemClickEvent(view, position); // } // }); // } // // mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { // @Override // public void onRefresh() { // refreshTask(); // } // }); // // taskAfterLoaded(); // 默认执行下拉操作 // // return view; // } // // protected void taskAfterLoaded() { // autoRefresh(); // } // // public void autoRefresh() { // mSwipeRefreshLayout.post(new Runnable() { // @Override // public void run() { // mSwipeRefreshLayout.setRefreshing(true); // refreshTask(); // } // }); // } // // // public void toast(String text) { // if (getActivity() != null) { // Toast.makeText(getActivity(), text, Toast.LENGTH_SHORT).show(); // } // } // // @Override // public void onDestroy() { // super.onDestroy(); // if (mSwipeRefreshLayout.isRefreshing()) { // mSwipeRefreshLayout.setRefreshing(false); // // 此处不设null,如果某个Fragment有数据时刷新,在数据还未加载完毕时切换到其他fragment,会产生Fragment重叠现象 // mRecyclerView.setAdapter(null); // } // } // // public void smoothToTop() { // mRecyclerView.smoothScrollToPosition(0); // } // }
import android.content.Intent; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.View; import com.leelit.stuer.base_adapters.BaseListAdapter; import com.leelit.stuer.base_view.BaseListFragment; import java.util.ArrayList; import java.util.Arrays; import java.util.List;
package com.leelit.stuer.module_stu; /** * Created by Leelit on 2016/3/3. */ public class StuFragment extends BaseListFragment { private List<String> mTitles; private List<String> mAddress; @Override
// Path: app/src/main/java/com/leelit/stuer/base_adapters/BaseListAdapter.java // public abstract class BaseListAdapter<VH extends RecyclerView.ViewHolder> extends RecyclerView.Adapter<VH> { // protected OnItemClickListener mOnItemClickListener; // // public void setOnItemClickListener(OnItemClickListener onItemClickListener) { // mOnItemClickListener = onItemClickListener; // } // // public interface OnItemClickListener { // void onItemClick(View view, int position); // } // // public abstract void removeData(int position); // } // // Path: app/src/main/java/com/leelit/stuer/base_view/BaseListFragment.java // public abstract class BaseListFragment extends Fragment { // // protected RecyclerView mRecyclerView; // // protected SwipeRefreshLayout mSwipeRefreshLayout; // // protected BaseListAdapter mAdapter; // // protected abstract BaseListAdapter bindAdapter(); // // protected abstract void refreshTask(); // // protected abstract void onItemClickEvent(View view, int position); // // // @Nullable // @Override // public View onCreateView(final LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // View view = inflater.inflate(R.layout.fragment_base_list, container, false); // mSwipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.swipeRefreshLayout); // mRecyclerView = (RecyclerView) view.findViewById(R.id.recyclerView); // // // 默认布局 // mRecyclerView.setLayoutManager(new LinearLayoutManager(container.getContext())); // // mAdapter = bindAdapter(); // mRecyclerView.setAdapter(mAdapter); // // // 将adapter的click task转移到fragment中 // if (mAdapter != null) { // mAdapter.setOnItemClickListener(new BaseListAdapter.OnItemClickListener() { // @Override // public void onItemClick(View view, int position) { // onItemClickEvent(view, position); // } // }); // } // // mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { // @Override // public void onRefresh() { // refreshTask(); // } // }); // // taskAfterLoaded(); // 默认执行下拉操作 // // return view; // } // // protected void taskAfterLoaded() { // autoRefresh(); // } // // public void autoRefresh() { // mSwipeRefreshLayout.post(new Runnable() { // @Override // public void run() { // mSwipeRefreshLayout.setRefreshing(true); // refreshTask(); // } // }); // } // // // public void toast(String text) { // if (getActivity() != null) { // Toast.makeText(getActivity(), text, Toast.LENGTH_SHORT).show(); // } // } // // @Override // public void onDestroy() { // super.onDestroy(); // if (mSwipeRefreshLayout.isRefreshing()) { // mSwipeRefreshLayout.setRefreshing(false); // // 此处不设null,如果某个Fragment有数据时刷新,在数据还未加载完毕时切换到其他fragment,会产生Fragment重叠现象 // mRecyclerView.setAdapter(null); // } // } // // public void smoothToTop() { // mRecyclerView.smoothScrollToPosition(0); // } // } // Path: app/src/main/java/com/leelit/stuer/module_stu/StuFragment.java import android.content.Intent; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.View; import com.leelit.stuer.base_adapters.BaseListAdapter; import com.leelit.stuer.base_view.BaseListFragment; import java.util.ArrayList; import java.util.Arrays; import java.util.List; package com.leelit.stuer.module_stu; /** * Created by Leelit on 2016/3/3. */ public class StuFragment extends BaseListFragment { private List<String> mTitles; private List<String> mAddress; @Override
protected BaseListAdapter bindAdapter() {
leelit/STUer-client
app/src/main/java/com/leelit/stuer/base_view/PhotoActivity.java
// Path: app/src/main/java/com/leelit/stuer/constant/NetConstant.java // public class NetConstant { // // public static final int NET_ERROR_RECORD_EXISTED = 601; // // // public static final String HOST = "http://192.168.191.1:8080/STUer/"; // public static final String HOST = "http://stuer.applinzi.com/"; // // public static final String IMAGE_HOST = "http://stuer-picture.stor.sinaapp.com/"; // // } // // Path: app/src/main/java/com/leelit/stuer/utils/ImageUtils.java // public class ImageUtils { // // // /** // * @param imageView // * @return byte[] // */ // public static byte[] image2byte(ImageView imageView) { // if (imageView == null) { // return null; // } // BitmapDrawable drawable = (BitmapDrawable) imageView.getDrawable(); // Bitmap bitmap = drawable.getBitmap(); // ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); // bitmap.compress(Bitmap.CompressFormat.JPEG, 100, outputStream); // return outputStream.toByteArray(); // } // }
import android.app.AlertDialog; import android.content.DialogInterface; import android.os.Bundle; import android.os.Environment; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.Toast; import com.leelit.stuer.R; import com.leelit.stuer.constant.NetConstant; import com.leelit.stuer.utils.ImageUtils; import com.squareup.picasso.Callback; import com.squareup.picasso.Picasso; import com.squareup.picasso.RequestCreator; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import butterknife.ButterKnife; import butterknife.InjectView; import uk.co.senab.photoview.PhotoViewAttacher;
package com.leelit.stuer.base_view; public class PhotoActivity extends AppCompatActivity { @InjectView(R.id.imageView) ImageView mImageView; PhotoViewAttacher mAttacher;
// Path: app/src/main/java/com/leelit/stuer/constant/NetConstant.java // public class NetConstant { // // public static final int NET_ERROR_RECORD_EXISTED = 601; // // // public static final String HOST = "http://192.168.191.1:8080/STUer/"; // public static final String HOST = "http://stuer.applinzi.com/"; // // public static final String IMAGE_HOST = "http://stuer-picture.stor.sinaapp.com/"; // // } // // Path: app/src/main/java/com/leelit/stuer/utils/ImageUtils.java // public class ImageUtils { // // // /** // * @param imageView // * @return byte[] // */ // public static byte[] image2byte(ImageView imageView) { // if (imageView == null) { // return null; // } // BitmapDrawable drawable = (BitmapDrawable) imageView.getDrawable(); // Bitmap bitmap = drawable.getBitmap(); // ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); // bitmap.compress(Bitmap.CompressFormat.JPEG, 100, outputStream); // return outputStream.toByteArray(); // } // } // Path: app/src/main/java/com/leelit/stuer/base_view/PhotoActivity.java import android.app.AlertDialog; import android.content.DialogInterface; import android.os.Bundle; import android.os.Environment; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.Toast; import com.leelit.stuer.R; import com.leelit.stuer.constant.NetConstant; import com.leelit.stuer.utils.ImageUtils; import com.squareup.picasso.Callback; import com.squareup.picasso.Picasso; import com.squareup.picasso.RequestCreator; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import butterknife.ButterKnife; import butterknife.InjectView; import uk.co.senab.photoview.PhotoViewAttacher; package com.leelit.stuer.base_view; public class PhotoActivity extends AppCompatActivity { @InjectView(R.id.imageView) ImageView mImageView; PhotoViewAttacher mAttacher;
public static final String IMAGE_HOST = NetConstant.IMAGE_HOST;
leelit/STUer-client
app/src/main/java/com/leelit/stuer/base_view/PhotoActivity.java
// Path: app/src/main/java/com/leelit/stuer/constant/NetConstant.java // public class NetConstant { // // public static final int NET_ERROR_RECORD_EXISTED = 601; // // // public static final String HOST = "http://192.168.191.1:8080/STUer/"; // public static final String HOST = "http://stuer.applinzi.com/"; // // public static final String IMAGE_HOST = "http://stuer-picture.stor.sinaapp.com/"; // // } // // Path: app/src/main/java/com/leelit/stuer/utils/ImageUtils.java // public class ImageUtils { // // // /** // * @param imageView // * @return byte[] // */ // public static byte[] image2byte(ImageView imageView) { // if (imageView == null) { // return null; // } // BitmapDrawable drawable = (BitmapDrawable) imageView.getDrawable(); // Bitmap bitmap = drawable.getBitmap(); // ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); // bitmap.compress(Bitmap.CompressFormat.JPEG, 100, outputStream); // return outputStream.toByteArray(); // } // }
import android.app.AlertDialog; import android.content.DialogInterface; import android.os.Bundle; import android.os.Environment; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.Toast; import com.leelit.stuer.R; import com.leelit.stuer.constant.NetConstant; import com.leelit.stuer.utils.ImageUtils; import com.squareup.picasso.Callback; import com.squareup.picasso.Picasso; import com.squareup.picasso.RequestCreator; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import butterknife.ButterKnife; import butterknife.InjectView; import uk.co.senab.photoview.PhotoViewAttacher;
} @Override public void onError() { Toast.makeText(PhotoActivity.this, "加载图片失败", Toast.LENGTH_SHORT).show(); } }); mAttacher = new PhotoViewAttacher(mImageView); mAttacher.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { AlertDialog.Builder builder = new AlertDialog.Builder(PhotoActivity.this); builder.setItems(new String[]{"保存"}, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { savePhoto(picName); } }); builder.create().show(); return false; } }); } private void savePhoto(String picName) { String dir = ""; try {
// Path: app/src/main/java/com/leelit/stuer/constant/NetConstant.java // public class NetConstant { // // public static final int NET_ERROR_RECORD_EXISTED = 601; // // // public static final String HOST = "http://192.168.191.1:8080/STUer/"; // public static final String HOST = "http://stuer.applinzi.com/"; // // public static final String IMAGE_HOST = "http://stuer-picture.stor.sinaapp.com/"; // // } // // Path: app/src/main/java/com/leelit/stuer/utils/ImageUtils.java // public class ImageUtils { // // // /** // * @param imageView // * @return byte[] // */ // public static byte[] image2byte(ImageView imageView) { // if (imageView == null) { // return null; // } // BitmapDrawable drawable = (BitmapDrawable) imageView.getDrawable(); // Bitmap bitmap = drawable.getBitmap(); // ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); // bitmap.compress(Bitmap.CompressFormat.JPEG, 100, outputStream); // return outputStream.toByteArray(); // } // } // Path: app/src/main/java/com/leelit/stuer/base_view/PhotoActivity.java import android.app.AlertDialog; import android.content.DialogInterface; import android.os.Bundle; import android.os.Environment; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.Toast; import com.leelit.stuer.R; import com.leelit.stuer.constant.NetConstant; import com.leelit.stuer.utils.ImageUtils; import com.squareup.picasso.Callback; import com.squareup.picasso.Picasso; import com.squareup.picasso.RequestCreator; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import butterknife.ButterKnife; import butterknife.InjectView; import uk.co.senab.photoview.PhotoViewAttacher; } @Override public void onError() { Toast.makeText(PhotoActivity.this, "加载图片失败", Toast.LENGTH_SHORT).show(); } }); mAttacher = new PhotoViewAttacher(mImageView); mAttacher.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { AlertDialog.Builder builder = new AlertDialog.Builder(PhotoActivity.this); builder.setItems(new String[]{"保存"}, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { savePhoto(picName); } }); builder.create().show(); return false; } }); } private void savePhoto(String picName) { String dir = ""; try {
byte[] buffer = ImageUtils.image2byte(mImageView);
leelit/STUer-client
app/src/main/java/com/leelit/stuer/receiver/MyXGResultReceiver.java
// Path: app/src/main/java/com/leelit/stuer/MyBusinessActivity.java // public class MyBusinessActivity extends AppCompatActivity { // // @InjectView(R.id.toolbar) // Toolbar mToolbar; // // private int mOrderActivityConstant; // private Fragment mFragment; // // public static boolean needPush = false; // public static String uniquecode = ""; // public static String type = ""; // // @Override // protected void onCreate(Bundle savedInstanceState) { // super.onCreate(savedInstanceState); // setContentView(R.layout.activity_mybusiness); // ButterKnife.inject(this); // UiUtils.setTranslucentStatusBar(this); // if (UiUtils.isNightMode(this)) { // return; // } // // needPush = getIntent().getBooleanExtra("need_push", false); // if (needPush) { // uniquecode = getIntent().getStringExtra("unique_code"); // type = getIntent().getStringExtra("type"); // } // mOrderActivityConstant = getIntent().getIntExtra(MyBusinessConstant.TAG, 1); // // if (mOrderActivityConstant == MyBusinessConstant.CARPOOL) { // mToolbar.setTitle(getString(R.string.mine_title_1)); // mFragment = new MyCarpoolFragment(); // } else if (mOrderActivityConstant == MyBusinessConstant.DATE) { // mToolbar.setTitle(getString(R.string.mine_title_2)); // mFragment = new MyDateFragment(); // } else if (mOrderActivityConstant == MyBusinessConstant.SELL) { // mToolbar.setTitle("我的转让"); // mFragment = new MySellFragment(); // } // // // setSupportActionBar(mToolbar); // mToolbar.setNavigationIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha); // mToolbar.setNavigationOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // finish(); // } // }); // // getSupportFragmentManager(). // beginTransaction(). // replace(R.id.content, mFragment). // commit(); // // } // // } // // Path: app/src/main/java/com/leelit/stuer/constant/MyBusinessConstant.java // public class MyBusinessConstant { // // public static final String TAG = "MyBusiness"; // // public static final int CARPOOL = 1; // public static final int DATE = 2; // public static final int SELL = 3; // } // // Path: app/src/main/java/com/leelit/stuer/utils/XingeUtils.java // public class XingeUtils { // // private static final long XINGE_ACCESS_ID = 2100195691; // private static final String XINGE_SECRET_KEY = "feb3e40e0d6f24af0a3564fe56ec3f58"; // // public static final String COMMON_Title = "STUer"; // public static final String CARPOOL_Message = "你有新的拼友"; // public static final String DATE_Message = "你有新的约友"; // // // public static void pushToAccount(String message, String account) { // pushToAccount(COMMON_Title, message, account, null); // } // // public static void pushToAccount(final String title, final String message, final String account, final String activity) { // // 必须在子线程完成 // Executors.newSingleThreadExecutor().execute(new Runnable() { // @Override // public void run() { // try { // Log.e("tag", XingeApp.pushAccountAndroid(XINGE_ACCESS_ID, XINGE_SECRET_KEY, title, message, account, activity).toString()); // } catch (JSONException e) { // // 不关心推送失败 // e.printStackTrace(); // } // } // }); // } // // }
import android.content.Context; import android.content.Intent; import com.leelit.stuer.MyBusinessActivity; import com.leelit.stuer.constant.MyBusinessConstant; import com.leelit.stuer.utils.XingeUtils; import com.tencent.android.tpush.XGPushBaseReceiver; import com.tencent.android.tpush.XGPushClickedResult; import com.tencent.android.tpush.XGPushRegisterResult; import com.tencent.android.tpush.XGPushShowedResult; import com.tencent.android.tpush.XGPushTextMessage;
package com.leelit.stuer.receiver; /** * Created by Leelit on 2016/4/23. */ public class MyXGResultReceiver extends XGPushBaseReceiver { @Override public void onRegisterResult(Context context, int i, XGPushRegisterResult xgPushRegisterResult) { } @Override public void onUnregisterResult(Context context, int i) { } @Override public void onSetTagResult(Context context, int i, String s) { } @Override public void onDeleteTagResult(Context context, int i, String s) { } @Override public void onTextMessage(Context context, XGPushTextMessage xgPushTextMessage) { } @Override public void onNotifactionClickedResult(Context context, XGPushClickedResult xgPushClickedResult) {
// Path: app/src/main/java/com/leelit/stuer/MyBusinessActivity.java // public class MyBusinessActivity extends AppCompatActivity { // // @InjectView(R.id.toolbar) // Toolbar mToolbar; // // private int mOrderActivityConstant; // private Fragment mFragment; // // public static boolean needPush = false; // public static String uniquecode = ""; // public static String type = ""; // // @Override // protected void onCreate(Bundle savedInstanceState) { // super.onCreate(savedInstanceState); // setContentView(R.layout.activity_mybusiness); // ButterKnife.inject(this); // UiUtils.setTranslucentStatusBar(this); // if (UiUtils.isNightMode(this)) { // return; // } // // needPush = getIntent().getBooleanExtra("need_push", false); // if (needPush) { // uniquecode = getIntent().getStringExtra("unique_code"); // type = getIntent().getStringExtra("type"); // } // mOrderActivityConstant = getIntent().getIntExtra(MyBusinessConstant.TAG, 1); // // if (mOrderActivityConstant == MyBusinessConstant.CARPOOL) { // mToolbar.setTitle(getString(R.string.mine_title_1)); // mFragment = new MyCarpoolFragment(); // } else if (mOrderActivityConstant == MyBusinessConstant.DATE) { // mToolbar.setTitle(getString(R.string.mine_title_2)); // mFragment = new MyDateFragment(); // } else if (mOrderActivityConstant == MyBusinessConstant.SELL) { // mToolbar.setTitle("我的转让"); // mFragment = new MySellFragment(); // } // // // setSupportActionBar(mToolbar); // mToolbar.setNavigationIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha); // mToolbar.setNavigationOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // finish(); // } // }); // // getSupportFragmentManager(). // beginTransaction(). // replace(R.id.content, mFragment). // commit(); // // } // // } // // Path: app/src/main/java/com/leelit/stuer/constant/MyBusinessConstant.java // public class MyBusinessConstant { // // public static final String TAG = "MyBusiness"; // // public static final int CARPOOL = 1; // public static final int DATE = 2; // public static final int SELL = 3; // } // // Path: app/src/main/java/com/leelit/stuer/utils/XingeUtils.java // public class XingeUtils { // // private static final long XINGE_ACCESS_ID = 2100195691; // private static final String XINGE_SECRET_KEY = "feb3e40e0d6f24af0a3564fe56ec3f58"; // // public static final String COMMON_Title = "STUer"; // public static final String CARPOOL_Message = "你有新的拼友"; // public static final String DATE_Message = "你有新的约友"; // // // public static void pushToAccount(String message, String account) { // pushToAccount(COMMON_Title, message, account, null); // } // // public static void pushToAccount(final String title, final String message, final String account, final String activity) { // // 必须在子线程完成 // Executors.newSingleThreadExecutor().execute(new Runnable() { // @Override // public void run() { // try { // Log.e("tag", XingeApp.pushAccountAndroid(XINGE_ACCESS_ID, XINGE_SECRET_KEY, title, message, account, activity).toString()); // } catch (JSONException e) { // // 不关心推送失败 // e.printStackTrace(); // } // } // }); // } // // } // Path: app/src/main/java/com/leelit/stuer/receiver/MyXGResultReceiver.java import android.content.Context; import android.content.Intent; import com.leelit.stuer.MyBusinessActivity; import com.leelit.stuer.constant.MyBusinessConstant; import com.leelit.stuer.utils.XingeUtils; import com.tencent.android.tpush.XGPushBaseReceiver; import com.tencent.android.tpush.XGPushClickedResult; import com.tencent.android.tpush.XGPushRegisterResult; import com.tencent.android.tpush.XGPushShowedResult; import com.tencent.android.tpush.XGPushTextMessage; package com.leelit.stuer.receiver; /** * Created by Leelit on 2016/4/23. */ public class MyXGResultReceiver extends XGPushBaseReceiver { @Override public void onRegisterResult(Context context, int i, XGPushRegisterResult xgPushRegisterResult) { } @Override public void onUnregisterResult(Context context, int i) { } @Override public void onSetTagResult(Context context, int i, String s) { } @Override public void onDeleteTagResult(Context context, int i, String s) { } @Override public void onTextMessage(Context context, XGPushTextMessage xgPushTextMessage) { } @Override public void onNotifactionClickedResult(Context context, XGPushClickedResult xgPushClickedResult) {
Intent intent = new Intent(context, MyBusinessActivity.class);
leelit/STUer-client
app/src/main/java/com/leelit/stuer/receiver/MyXGResultReceiver.java
// Path: app/src/main/java/com/leelit/stuer/MyBusinessActivity.java // public class MyBusinessActivity extends AppCompatActivity { // // @InjectView(R.id.toolbar) // Toolbar mToolbar; // // private int mOrderActivityConstant; // private Fragment mFragment; // // public static boolean needPush = false; // public static String uniquecode = ""; // public static String type = ""; // // @Override // protected void onCreate(Bundle savedInstanceState) { // super.onCreate(savedInstanceState); // setContentView(R.layout.activity_mybusiness); // ButterKnife.inject(this); // UiUtils.setTranslucentStatusBar(this); // if (UiUtils.isNightMode(this)) { // return; // } // // needPush = getIntent().getBooleanExtra("need_push", false); // if (needPush) { // uniquecode = getIntent().getStringExtra("unique_code"); // type = getIntent().getStringExtra("type"); // } // mOrderActivityConstant = getIntent().getIntExtra(MyBusinessConstant.TAG, 1); // // if (mOrderActivityConstant == MyBusinessConstant.CARPOOL) { // mToolbar.setTitle(getString(R.string.mine_title_1)); // mFragment = new MyCarpoolFragment(); // } else if (mOrderActivityConstant == MyBusinessConstant.DATE) { // mToolbar.setTitle(getString(R.string.mine_title_2)); // mFragment = new MyDateFragment(); // } else if (mOrderActivityConstant == MyBusinessConstant.SELL) { // mToolbar.setTitle("我的转让"); // mFragment = new MySellFragment(); // } // // // setSupportActionBar(mToolbar); // mToolbar.setNavigationIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha); // mToolbar.setNavigationOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // finish(); // } // }); // // getSupportFragmentManager(). // beginTransaction(). // replace(R.id.content, mFragment). // commit(); // // } // // } // // Path: app/src/main/java/com/leelit/stuer/constant/MyBusinessConstant.java // public class MyBusinessConstant { // // public static final String TAG = "MyBusiness"; // // public static final int CARPOOL = 1; // public static final int DATE = 2; // public static final int SELL = 3; // } // // Path: app/src/main/java/com/leelit/stuer/utils/XingeUtils.java // public class XingeUtils { // // private static final long XINGE_ACCESS_ID = 2100195691; // private static final String XINGE_SECRET_KEY = "feb3e40e0d6f24af0a3564fe56ec3f58"; // // public static final String COMMON_Title = "STUer"; // public static final String CARPOOL_Message = "你有新的拼友"; // public static final String DATE_Message = "你有新的约友"; // // // public static void pushToAccount(String message, String account) { // pushToAccount(COMMON_Title, message, account, null); // } // // public static void pushToAccount(final String title, final String message, final String account, final String activity) { // // 必须在子线程完成 // Executors.newSingleThreadExecutor().execute(new Runnable() { // @Override // public void run() { // try { // Log.e("tag", XingeApp.pushAccountAndroid(XINGE_ACCESS_ID, XINGE_SECRET_KEY, title, message, account, activity).toString()); // } catch (JSONException e) { // // 不关心推送失败 // e.printStackTrace(); // } // } // }); // } // // }
import android.content.Context; import android.content.Intent; import com.leelit.stuer.MyBusinessActivity; import com.leelit.stuer.constant.MyBusinessConstant; import com.leelit.stuer.utils.XingeUtils; import com.tencent.android.tpush.XGPushBaseReceiver; import com.tencent.android.tpush.XGPushClickedResult; import com.tencent.android.tpush.XGPushRegisterResult; import com.tencent.android.tpush.XGPushShowedResult; import com.tencent.android.tpush.XGPushTextMessage;
package com.leelit.stuer.receiver; /** * Created by Leelit on 2016/4/23. */ public class MyXGResultReceiver extends XGPushBaseReceiver { @Override public void onRegisterResult(Context context, int i, XGPushRegisterResult xgPushRegisterResult) { } @Override public void onUnregisterResult(Context context, int i) { } @Override public void onSetTagResult(Context context, int i, String s) { } @Override public void onDeleteTagResult(Context context, int i, String s) { } @Override public void onTextMessage(Context context, XGPushTextMessage xgPushTextMessage) { } @Override public void onNotifactionClickedResult(Context context, XGPushClickedResult xgPushClickedResult) { Intent intent = new Intent(context, MyBusinessActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// Path: app/src/main/java/com/leelit/stuer/MyBusinessActivity.java // public class MyBusinessActivity extends AppCompatActivity { // // @InjectView(R.id.toolbar) // Toolbar mToolbar; // // private int mOrderActivityConstant; // private Fragment mFragment; // // public static boolean needPush = false; // public static String uniquecode = ""; // public static String type = ""; // // @Override // protected void onCreate(Bundle savedInstanceState) { // super.onCreate(savedInstanceState); // setContentView(R.layout.activity_mybusiness); // ButterKnife.inject(this); // UiUtils.setTranslucentStatusBar(this); // if (UiUtils.isNightMode(this)) { // return; // } // // needPush = getIntent().getBooleanExtra("need_push", false); // if (needPush) { // uniquecode = getIntent().getStringExtra("unique_code"); // type = getIntent().getStringExtra("type"); // } // mOrderActivityConstant = getIntent().getIntExtra(MyBusinessConstant.TAG, 1); // // if (mOrderActivityConstant == MyBusinessConstant.CARPOOL) { // mToolbar.setTitle(getString(R.string.mine_title_1)); // mFragment = new MyCarpoolFragment(); // } else if (mOrderActivityConstant == MyBusinessConstant.DATE) { // mToolbar.setTitle(getString(R.string.mine_title_2)); // mFragment = new MyDateFragment(); // } else if (mOrderActivityConstant == MyBusinessConstant.SELL) { // mToolbar.setTitle("我的转让"); // mFragment = new MySellFragment(); // } // // // setSupportActionBar(mToolbar); // mToolbar.setNavigationIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha); // mToolbar.setNavigationOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // finish(); // } // }); // // getSupportFragmentManager(). // beginTransaction(). // replace(R.id.content, mFragment). // commit(); // // } // // } // // Path: app/src/main/java/com/leelit/stuer/constant/MyBusinessConstant.java // public class MyBusinessConstant { // // public static final String TAG = "MyBusiness"; // // public static final int CARPOOL = 1; // public static final int DATE = 2; // public static final int SELL = 3; // } // // Path: app/src/main/java/com/leelit/stuer/utils/XingeUtils.java // public class XingeUtils { // // private static final long XINGE_ACCESS_ID = 2100195691; // private static final String XINGE_SECRET_KEY = "feb3e40e0d6f24af0a3564fe56ec3f58"; // // public static final String COMMON_Title = "STUer"; // public static final String CARPOOL_Message = "你有新的拼友"; // public static final String DATE_Message = "你有新的约友"; // // // public static void pushToAccount(String message, String account) { // pushToAccount(COMMON_Title, message, account, null); // } // // public static void pushToAccount(final String title, final String message, final String account, final String activity) { // // 必须在子线程完成 // Executors.newSingleThreadExecutor().execute(new Runnable() { // @Override // public void run() { // try { // Log.e("tag", XingeApp.pushAccountAndroid(XINGE_ACCESS_ID, XINGE_SECRET_KEY, title, message, account, activity).toString()); // } catch (JSONException e) { // // 不关心推送失败 // e.printStackTrace(); // } // } // }); // } // // } // Path: app/src/main/java/com/leelit/stuer/receiver/MyXGResultReceiver.java import android.content.Context; import android.content.Intent; import com.leelit.stuer.MyBusinessActivity; import com.leelit.stuer.constant.MyBusinessConstant; import com.leelit.stuer.utils.XingeUtils; import com.tencent.android.tpush.XGPushBaseReceiver; import com.tencent.android.tpush.XGPushClickedResult; import com.tencent.android.tpush.XGPushRegisterResult; import com.tencent.android.tpush.XGPushShowedResult; import com.tencent.android.tpush.XGPushTextMessage; package com.leelit.stuer.receiver; /** * Created by Leelit on 2016/4/23. */ public class MyXGResultReceiver extends XGPushBaseReceiver { @Override public void onRegisterResult(Context context, int i, XGPushRegisterResult xgPushRegisterResult) { } @Override public void onUnregisterResult(Context context, int i) { } @Override public void onSetTagResult(Context context, int i, String s) { } @Override public void onDeleteTagResult(Context context, int i, String s) { } @Override public void onTextMessage(Context context, XGPushTextMessage xgPushTextMessage) { } @Override public void onNotifactionClickedResult(Context context, XGPushClickedResult xgPushClickedResult) { Intent intent = new Intent(context, MyBusinessActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
if (xgPushClickedResult.getContent().equals(XingeUtils.CARPOOL_Message)) {
leelit/STUer-client
app/src/main/java/com/leelit/stuer/receiver/MyXGResultReceiver.java
// Path: app/src/main/java/com/leelit/stuer/MyBusinessActivity.java // public class MyBusinessActivity extends AppCompatActivity { // // @InjectView(R.id.toolbar) // Toolbar mToolbar; // // private int mOrderActivityConstant; // private Fragment mFragment; // // public static boolean needPush = false; // public static String uniquecode = ""; // public static String type = ""; // // @Override // protected void onCreate(Bundle savedInstanceState) { // super.onCreate(savedInstanceState); // setContentView(R.layout.activity_mybusiness); // ButterKnife.inject(this); // UiUtils.setTranslucentStatusBar(this); // if (UiUtils.isNightMode(this)) { // return; // } // // needPush = getIntent().getBooleanExtra("need_push", false); // if (needPush) { // uniquecode = getIntent().getStringExtra("unique_code"); // type = getIntent().getStringExtra("type"); // } // mOrderActivityConstant = getIntent().getIntExtra(MyBusinessConstant.TAG, 1); // // if (mOrderActivityConstant == MyBusinessConstant.CARPOOL) { // mToolbar.setTitle(getString(R.string.mine_title_1)); // mFragment = new MyCarpoolFragment(); // } else if (mOrderActivityConstant == MyBusinessConstant.DATE) { // mToolbar.setTitle(getString(R.string.mine_title_2)); // mFragment = new MyDateFragment(); // } else if (mOrderActivityConstant == MyBusinessConstant.SELL) { // mToolbar.setTitle("我的转让"); // mFragment = new MySellFragment(); // } // // // setSupportActionBar(mToolbar); // mToolbar.setNavigationIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha); // mToolbar.setNavigationOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // finish(); // } // }); // // getSupportFragmentManager(). // beginTransaction(). // replace(R.id.content, mFragment). // commit(); // // } // // } // // Path: app/src/main/java/com/leelit/stuer/constant/MyBusinessConstant.java // public class MyBusinessConstant { // // public static final String TAG = "MyBusiness"; // // public static final int CARPOOL = 1; // public static final int DATE = 2; // public static final int SELL = 3; // } // // Path: app/src/main/java/com/leelit/stuer/utils/XingeUtils.java // public class XingeUtils { // // private static final long XINGE_ACCESS_ID = 2100195691; // private static final String XINGE_SECRET_KEY = "feb3e40e0d6f24af0a3564fe56ec3f58"; // // public static final String COMMON_Title = "STUer"; // public static final String CARPOOL_Message = "你有新的拼友"; // public static final String DATE_Message = "你有新的约友"; // // // public static void pushToAccount(String message, String account) { // pushToAccount(COMMON_Title, message, account, null); // } // // public static void pushToAccount(final String title, final String message, final String account, final String activity) { // // 必须在子线程完成 // Executors.newSingleThreadExecutor().execute(new Runnable() { // @Override // public void run() { // try { // Log.e("tag", XingeApp.pushAccountAndroid(XINGE_ACCESS_ID, XINGE_SECRET_KEY, title, message, account, activity).toString()); // } catch (JSONException e) { // // 不关心推送失败 // e.printStackTrace(); // } // } // }); // } // // }
import android.content.Context; import android.content.Intent; import com.leelit.stuer.MyBusinessActivity; import com.leelit.stuer.constant.MyBusinessConstant; import com.leelit.stuer.utils.XingeUtils; import com.tencent.android.tpush.XGPushBaseReceiver; import com.tencent.android.tpush.XGPushClickedResult; import com.tencent.android.tpush.XGPushRegisterResult; import com.tencent.android.tpush.XGPushShowedResult; import com.tencent.android.tpush.XGPushTextMessage;
package com.leelit.stuer.receiver; /** * Created by Leelit on 2016/4/23. */ public class MyXGResultReceiver extends XGPushBaseReceiver { @Override public void onRegisterResult(Context context, int i, XGPushRegisterResult xgPushRegisterResult) { } @Override public void onUnregisterResult(Context context, int i) { } @Override public void onSetTagResult(Context context, int i, String s) { } @Override public void onDeleteTagResult(Context context, int i, String s) { } @Override public void onTextMessage(Context context, XGPushTextMessage xgPushTextMessage) { } @Override public void onNotifactionClickedResult(Context context, XGPushClickedResult xgPushClickedResult) { Intent intent = new Intent(context, MyBusinessActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); if (xgPushClickedResult.getContent().equals(XingeUtils.CARPOOL_Message)) {
// Path: app/src/main/java/com/leelit/stuer/MyBusinessActivity.java // public class MyBusinessActivity extends AppCompatActivity { // // @InjectView(R.id.toolbar) // Toolbar mToolbar; // // private int mOrderActivityConstant; // private Fragment mFragment; // // public static boolean needPush = false; // public static String uniquecode = ""; // public static String type = ""; // // @Override // protected void onCreate(Bundle savedInstanceState) { // super.onCreate(savedInstanceState); // setContentView(R.layout.activity_mybusiness); // ButterKnife.inject(this); // UiUtils.setTranslucentStatusBar(this); // if (UiUtils.isNightMode(this)) { // return; // } // // needPush = getIntent().getBooleanExtra("need_push", false); // if (needPush) { // uniquecode = getIntent().getStringExtra("unique_code"); // type = getIntent().getStringExtra("type"); // } // mOrderActivityConstant = getIntent().getIntExtra(MyBusinessConstant.TAG, 1); // // if (mOrderActivityConstant == MyBusinessConstant.CARPOOL) { // mToolbar.setTitle(getString(R.string.mine_title_1)); // mFragment = new MyCarpoolFragment(); // } else if (mOrderActivityConstant == MyBusinessConstant.DATE) { // mToolbar.setTitle(getString(R.string.mine_title_2)); // mFragment = new MyDateFragment(); // } else if (mOrderActivityConstant == MyBusinessConstant.SELL) { // mToolbar.setTitle("我的转让"); // mFragment = new MySellFragment(); // } // // // setSupportActionBar(mToolbar); // mToolbar.setNavigationIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha); // mToolbar.setNavigationOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // finish(); // } // }); // // getSupportFragmentManager(). // beginTransaction(). // replace(R.id.content, mFragment). // commit(); // // } // // } // // Path: app/src/main/java/com/leelit/stuer/constant/MyBusinessConstant.java // public class MyBusinessConstant { // // public static final String TAG = "MyBusiness"; // // public static final int CARPOOL = 1; // public static final int DATE = 2; // public static final int SELL = 3; // } // // Path: app/src/main/java/com/leelit/stuer/utils/XingeUtils.java // public class XingeUtils { // // private static final long XINGE_ACCESS_ID = 2100195691; // private static final String XINGE_SECRET_KEY = "feb3e40e0d6f24af0a3564fe56ec3f58"; // // public static final String COMMON_Title = "STUer"; // public static final String CARPOOL_Message = "你有新的拼友"; // public static final String DATE_Message = "你有新的约友"; // // // public static void pushToAccount(String message, String account) { // pushToAccount(COMMON_Title, message, account, null); // } // // public static void pushToAccount(final String title, final String message, final String account, final String activity) { // // 必须在子线程完成 // Executors.newSingleThreadExecutor().execute(new Runnable() { // @Override // public void run() { // try { // Log.e("tag", XingeApp.pushAccountAndroid(XINGE_ACCESS_ID, XINGE_SECRET_KEY, title, message, account, activity).toString()); // } catch (JSONException e) { // // 不关心推送失败 // e.printStackTrace(); // } // } // }); // } // // } // Path: app/src/main/java/com/leelit/stuer/receiver/MyXGResultReceiver.java import android.content.Context; import android.content.Intent; import com.leelit.stuer.MyBusinessActivity; import com.leelit.stuer.constant.MyBusinessConstant; import com.leelit.stuer.utils.XingeUtils; import com.tencent.android.tpush.XGPushBaseReceiver; import com.tencent.android.tpush.XGPushClickedResult; import com.tencent.android.tpush.XGPushRegisterResult; import com.tencent.android.tpush.XGPushShowedResult; import com.tencent.android.tpush.XGPushTextMessage; package com.leelit.stuer.receiver; /** * Created by Leelit on 2016/4/23. */ public class MyXGResultReceiver extends XGPushBaseReceiver { @Override public void onRegisterResult(Context context, int i, XGPushRegisterResult xgPushRegisterResult) { } @Override public void onUnregisterResult(Context context, int i) { } @Override public void onSetTagResult(Context context, int i, String s) { } @Override public void onDeleteTagResult(Context context, int i, String s) { } @Override public void onTextMessage(Context context, XGPushTextMessage xgPushTextMessage) { } @Override public void onNotifactionClickedResult(Context context, XGPushClickedResult xgPushClickedResult) { Intent intent = new Intent(context, MyBusinessActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); if (xgPushClickedResult.getContent().equals(XingeUtils.CARPOOL_Message)) {
intent.putExtra(MyBusinessConstant.TAG, MyBusinessConstant.CARPOOL);
leelit/STUer-client
app/src/main/java/com/leelit/stuer/utils/SettingUtils.java
// Path: app/src/main/java/com/leelit/stuer/MyApplication.java // public class MyApplication extends Application { // // public static final String VERSION = "1.1.0"; // // public static Context context; // // @Override // public void onCreate() { // super.onCreate(); // context = getApplicationContext(); // } // }
import android.content.Context; import android.content.SharedPreferences; import com.leelit.stuer.MyApplication;
package com.leelit.stuer.utils; /** * Created by Leelit on 2016/3/20. */ public class SettingUtils { public static final String SETTING_SP_NAME = "setting";
// Path: app/src/main/java/com/leelit/stuer/MyApplication.java // public class MyApplication extends Application { // // public static final String VERSION = "1.1.0"; // // public static Context context; // // @Override // public void onCreate() { // super.onCreate(); // context = getApplicationContext(); // } // } // Path: app/src/main/java/com/leelit/stuer/utils/SettingUtils.java import android.content.Context; import android.content.SharedPreferences; import com.leelit.stuer.MyApplication; package com.leelit.stuer.utils; /** * Created by Leelit on 2016/3/20. */ public class SettingUtils { public static final String SETTING_SP_NAME = "setting";
private static SharedPreferences sharedPreferences = MyApplication.context.getSharedPreferences(SETTING_SP_NAME, Context.MODE_PRIVATE);
leelit/STUer-client
app/src/main/java/com/leelit/stuer/UpdatePresenter.java
// Path: app/src/main/java/com/leelit/stuer/base_presenter/IPresenter.java // public interface IPresenter { // void doClear(); // // } // // Path: app/src/main/java/com/leelit/stuer/constant/NetConstant.java // public class NetConstant { // // public static final int NET_ERROR_RECORD_EXISTED = 601; // // // public static final String HOST = "http://192.168.191.1:8080/STUer/"; // public static final String HOST = "http://stuer.applinzi.com/"; // // public static final String IMAGE_HOST = "http://stuer-picture.stor.sinaapp.com/"; // // } // // Path: app/src/main/java/com/leelit/stuer/utils/AppInfoUtils.java // public class AppInfoUtils { // public static String getAppName() { // return MyApplication.context.getString(R.string.app_name); // } // // public static String getImei() { // TelephonyManager tm = ((TelephonyManager) MyApplication.context.getSystemService(Activity.TELEPHONY_SERVICE)); // String imei = tm.getDeviceId(); // if (imei != null && !imei.isEmpty()) { // return imei; // } // return ""; // } // // /** // * 产生唯一订单号 // * @return // */ // public static String getUniqueCode() { // String imei = AppInfoUtils.getImei(); // Date date = new Date(); // String unique = imei + date.hashCode(); // return String.valueOf(unique.hashCode()); // } // }
import com.leelit.stuer.base_presenter.IPresenter; import com.leelit.stuer.constant.NetConstant; import com.leelit.stuer.utils.AppInfoUtils; import java.io.IOException; import okhttp3.ResponseBody; import rx.Subscriber;
mView.showCheckUpdateProgressDialog(); mSubscriber1 = new Subscriber<ResponseBody>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { mView.dismissCheckUpdateProgressDialog(); mView.netError(); } @Override public void onNext(ResponseBody responseBody) { mView.dismissCheckUpdateProgressDialog(); String latestVersionAndInfo = ""; String latestVersion = MyApplication.VERSION; String info = ""; try { latestVersionAndInfo = responseBody.string(); // 得到最新的版本 // ..-version-info latestVersion = latestVersionAndInfo.split("-")[1]; info = latestVersionAndInfo.split("-")[2]; } catch (IOException e) { e.printStackTrace(); } if (latestVersion.equals(MyApplication.VERSION)) { mView.noNewVersion(); } else {
// Path: app/src/main/java/com/leelit/stuer/base_presenter/IPresenter.java // public interface IPresenter { // void doClear(); // // } // // Path: app/src/main/java/com/leelit/stuer/constant/NetConstant.java // public class NetConstant { // // public static final int NET_ERROR_RECORD_EXISTED = 601; // // // public static final String HOST = "http://192.168.191.1:8080/STUer/"; // public static final String HOST = "http://stuer.applinzi.com/"; // // public static final String IMAGE_HOST = "http://stuer-picture.stor.sinaapp.com/"; // // } // // Path: app/src/main/java/com/leelit/stuer/utils/AppInfoUtils.java // public class AppInfoUtils { // public static String getAppName() { // return MyApplication.context.getString(R.string.app_name); // } // // public static String getImei() { // TelephonyManager tm = ((TelephonyManager) MyApplication.context.getSystemService(Activity.TELEPHONY_SERVICE)); // String imei = tm.getDeviceId(); // if (imei != null && !imei.isEmpty()) { // return imei; // } // return ""; // } // // /** // * 产生唯一订单号 // * @return // */ // public static String getUniqueCode() { // String imei = AppInfoUtils.getImei(); // Date date = new Date(); // String unique = imei + date.hashCode(); // return String.valueOf(unique.hashCode()); // } // } // Path: app/src/main/java/com/leelit/stuer/UpdatePresenter.java import com.leelit.stuer.base_presenter.IPresenter; import com.leelit.stuer.constant.NetConstant; import com.leelit.stuer.utils.AppInfoUtils; import java.io.IOException; import okhttp3.ResponseBody; import rx.Subscriber; mView.showCheckUpdateProgressDialog(); mSubscriber1 = new Subscriber<ResponseBody>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { mView.dismissCheckUpdateProgressDialog(); mView.netError(); } @Override public void onNext(ResponseBody responseBody) { mView.dismissCheckUpdateProgressDialog(); String latestVersionAndInfo = ""; String latestVersion = MyApplication.VERSION; String info = ""; try { latestVersionAndInfo = responseBody.string(); // 得到最新的版本 // ..-version-info latestVersion = latestVersionAndInfo.split("-")[1]; info = latestVersionAndInfo.split("-")[2]; } catch (IOException e) { e.printStackTrace(); } if (latestVersion.equals(MyApplication.VERSION)) { mView.noNewVersion(); } else {
String newVersionUrl = NetConstant.HOST + AppInfoUtils.getAppName() + "_" + latestVersion + ".apk";
leelit/STUer-client
app/src/main/java/com/leelit/stuer/UpdatePresenter.java
// Path: app/src/main/java/com/leelit/stuer/base_presenter/IPresenter.java // public interface IPresenter { // void doClear(); // // } // // Path: app/src/main/java/com/leelit/stuer/constant/NetConstant.java // public class NetConstant { // // public static final int NET_ERROR_RECORD_EXISTED = 601; // // // public static final String HOST = "http://192.168.191.1:8080/STUer/"; // public static final String HOST = "http://stuer.applinzi.com/"; // // public static final String IMAGE_HOST = "http://stuer-picture.stor.sinaapp.com/"; // // } // // Path: app/src/main/java/com/leelit/stuer/utils/AppInfoUtils.java // public class AppInfoUtils { // public static String getAppName() { // return MyApplication.context.getString(R.string.app_name); // } // // public static String getImei() { // TelephonyManager tm = ((TelephonyManager) MyApplication.context.getSystemService(Activity.TELEPHONY_SERVICE)); // String imei = tm.getDeviceId(); // if (imei != null && !imei.isEmpty()) { // return imei; // } // return ""; // } // // /** // * 产生唯一订单号 // * @return // */ // public static String getUniqueCode() { // String imei = AppInfoUtils.getImei(); // Date date = new Date(); // String unique = imei + date.hashCode(); // return String.valueOf(unique.hashCode()); // } // }
import com.leelit.stuer.base_presenter.IPresenter; import com.leelit.stuer.constant.NetConstant; import com.leelit.stuer.utils.AppInfoUtils; import java.io.IOException; import okhttp3.ResponseBody; import rx.Subscriber;
mView.showCheckUpdateProgressDialog(); mSubscriber1 = new Subscriber<ResponseBody>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { mView.dismissCheckUpdateProgressDialog(); mView.netError(); } @Override public void onNext(ResponseBody responseBody) { mView.dismissCheckUpdateProgressDialog(); String latestVersionAndInfo = ""; String latestVersion = MyApplication.VERSION; String info = ""; try { latestVersionAndInfo = responseBody.string(); // 得到最新的版本 // ..-version-info latestVersion = latestVersionAndInfo.split("-")[1]; info = latestVersionAndInfo.split("-")[2]; } catch (IOException e) { e.printStackTrace(); } if (latestVersion.equals(MyApplication.VERSION)) { mView.noNewVersion(); } else {
// Path: app/src/main/java/com/leelit/stuer/base_presenter/IPresenter.java // public interface IPresenter { // void doClear(); // // } // // Path: app/src/main/java/com/leelit/stuer/constant/NetConstant.java // public class NetConstant { // // public static final int NET_ERROR_RECORD_EXISTED = 601; // // // public static final String HOST = "http://192.168.191.1:8080/STUer/"; // public static final String HOST = "http://stuer.applinzi.com/"; // // public static final String IMAGE_HOST = "http://stuer-picture.stor.sinaapp.com/"; // // } // // Path: app/src/main/java/com/leelit/stuer/utils/AppInfoUtils.java // public class AppInfoUtils { // public static String getAppName() { // return MyApplication.context.getString(R.string.app_name); // } // // public static String getImei() { // TelephonyManager tm = ((TelephonyManager) MyApplication.context.getSystemService(Activity.TELEPHONY_SERVICE)); // String imei = tm.getDeviceId(); // if (imei != null && !imei.isEmpty()) { // return imei; // } // return ""; // } // // /** // * 产生唯一订单号 // * @return // */ // public static String getUniqueCode() { // String imei = AppInfoUtils.getImei(); // Date date = new Date(); // String unique = imei + date.hashCode(); // return String.valueOf(unique.hashCode()); // } // } // Path: app/src/main/java/com/leelit/stuer/UpdatePresenter.java import com.leelit.stuer.base_presenter.IPresenter; import com.leelit.stuer.constant.NetConstant; import com.leelit.stuer.utils.AppInfoUtils; import java.io.IOException; import okhttp3.ResponseBody; import rx.Subscriber; mView.showCheckUpdateProgressDialog(); mSubscriber1 = new Subscriber<ResponseBody>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { mView.dismissCheckUpdateProgressDialog(); mView.netError(); } @Override public void onNext(ResponseBody responseBody) { mView.dismissCheckUpdateProgressDialog(); String latestVersionAndInfo = ""; String latestVersion = MyApplication.VERSION; String info = ""; try { latestVersionAndInfo = responseBody.string(); // 得到最新的版本 // ..-version-info latestVersion = latestVersionAndInfo.split("-")[1]; info = latestVersionAndInfo.split("-")[2]; } catch (IOException e) { e.printStackTrace(); } if (latestVersion.equals(MyApplication.VERSION)) { mView.noNewVersion(); } else {
String newVersionUrl = NetConstant.HOST + AppInfoUtils.getAppName() + "_" + latestVersion + ".apk";
leelit/STUer-client
app/src/main/java/com/leelit/stuer/module_treehole/viewinterface/ITreeholeView.java
// Path: app/src/main/java/com/leelit/stuer/bean/TreeholeLocalInfo.java // public class TreeholeLocalInfo extends TreeholeInfo { // // boolean like; // // boolean unlike; // // public boolean isLike() { // return like; // } // // public void setLike(boolean like) { // this.like = like; // } // // public boolean isUnlike() { // return unlike; // } // // public void setUnlike(boolean unlike) { // this.unlike = unlike; // } // // @Override // public String toString() { // return "TreeholeLocalInfo{" + // "datetime='" + datetime + '\'' + // ", state='" + state + '\'' + // ", picAddress='" + picAddress + '\'' + // ", uniquecode='" + uniquecode + '\'' + // ", like=" + like + // ", unlike=" + unlike + // "} "; // } // } // // Path: app/src/main/java/com/leelit/stuer/bean/TreeholeInfo.java // public class TreeholeInfo { // String datetime; // // String state; // // String picAddress; // // String uniquecode; // // @Override // public String toString() { // return "TreeholeInfo{" + // "datetime='" + datetime + '\'' + // ", state='" + state + '\'' + // ", picAddress='" + picAddress + '\'' + // ", uniquecode='" + uniquecode + '\'' + // '}'; // } // // public String getDatetime() { // return datetime; // } // // public void setDatetime(String datetime) { // this.datetime = datetime; // } // // public String getState() { // return state; // } // // public void setState(String state) { // this.state = state; // } // // public String getPicAddress() { // return picAddress; // } // // public void setPicAddress(String picAddress) { // this.picAddress = picAddress; // } // // public String getUniquecode() { // return uniquecode; // } // // public void setUniquecode(String uniquecode) { // this.uniquecode = uniquecode; // } // }
import com.leelit.stuer.bean.TreeholeLocalInfo; import com.leelit.stuer.bean.TreeholeInfo; import java.util.List;
package com.leelit.stuer.module_treehole.viewinterface; /** * Created by Leelit on 2016/3/24. */ public interface ITreeholeView { void stopRefreshing(); void netError();
// Path: app/src/main/java/com/leelit/stuer/bean/TreeholeLocalInfo.java // public class TreeholeLocalInfo extends TreeholeInfo { // // boolean like; // // boolean unlike; // // public boolean isLike() { // return like; // } // // public void setLike(boolean like) { // this.like = like; // } // // public boolean isUnlike() { // return unlike; // } // // public void setUnlike(boolean unlike) { // this.unlike = unlike; // } // // @Override // public String toString() { // return "TreeholeLocalInfo{" + // "datetime='" + datetime + '\'' + // ", state='" + state + '\'' + // ", picAddress='" + picAddress + '\'' + // ", uniquecode='" + uniquecode + '\'' + // ", like=" + like + // ", unlike=" + unlike + // "} "; // } // } // // Path: app/src/main/java/com/leelit/stuer/bean/TreeholeInfo.java // public class TreeholeInfo { // String datetime; // // String state; // // String picAddress; // // String uniquecode; // // @Override // public String toString() { // return "TreeholeInfo{" + // "datetime='" + datetime + '\'' + // ", state='" + state + '\'' + // ", picAddress='" + picAddress + '\'' + // ", uniquecode='" + uniquecode + '\'' + // '}'; // } // // public String getDatetime() { // return datetime; // } // // public void setDatetime(String datetime) { // this.datetime = datetime; // } // // public String getState() { // return state; // } // // public void setState(String state) { // this.state = state; // } // // public String getPicAddress() { // return picAddress; // } // // public void setPicAddress(String picAddress) { // this.picAddress = picAddress; // } // // public String getUniquecode() { // return uniquecode; // } // // public void setUniquecode(String uniquecode) { // this.uniquecode = uniquecode; // } // } // Path: app/src/main/java/com/leelit/stuer/module_treehole/viewinterface/ITreeholeView.java import com.leelit.stuer.bean.TreeholeLocalInfo; import com.leelit.stuer.bean.TreeholeInfo; import java.util.List; package com.leelit.stuer.module_treehole.viewinterface; /** * Created by Leelit on 2016/3/24. */ public interface ITreeholeView { void stopRefreshing(); void netError();
void showDataFromDb(List<TreeholeLocalInfo> infos);
leelit/STUer-client
app/src/main/java/com/leelit/stuer/module_treehole/viewinterface/ITreeholeView.java
// Path: app/src/main/java/com/leelit/stuer/bean/TreeholeLocalInfo.java // public class TreeholeLocalInfo extends TreeholeInfo { // // boolean like; // // boolean unlike; // // public boolean isLike() { // return like; // } // // public void setLike(boolean like) { // this.like = like; // } // // public boolean isUnlike() { // return unlike; // } // // public void setUnlike(boolean unlike) { // this.unlike = unlike; // } // // @Override // public String toString() { // return "TreeholeLocalInfo{" + // "datetime='" + datetime + '\'' + // ", state='" + state + '\'' + // ", picAddress='" + picAddress + '\'' + // ", uniquecode='" + uniquecode + '\'' + // ", like=" + like + // ", unlike=" + unlike + // "} "; // } // } // // Path: app/src/main/java/com/leelit/stuer/bean/TreeholeInfo.java // public class TreeholeInfo { // String datetime; // // String state; // // String picAddress; // // String uniquecode; // // @Override // public String toString() { // return "TreeholeInfo{" + // "datetime='" + datetime + '\'' + // ", state='" + state + '\'' + // ", picAddress='" + picAddress + '\'' + // ", uniquecode='" + uniquecode + '\'' + // '}'; // } // // public String getDatetime() { // return datetime; // } // // public void setDatetime(String datetime) { // this.datetime = datetime; // } // // public String getState() { // return state; // } // // public void setState(String state) { // this.state = state; // } // // public String getPicAddress() { // return picAddress; // } // // public void setPicAddress(String picAddress) { // this.picAddress = picAddress; // } // // public String getUniquecode() { // return uniquecode; // } // // public void setUniquecode(String uniquecode) { // this.uniquecode = uniquecode; // } // }
import com.leelit.stuer.bean.TreeholeLocalInfo; import com.leelit.stuer.bean.TreeholeInfo; import java.util.List;
package com.leelit.stuer.module_treehole.viewinterface; /** * Created by Leelit on 2016/3/24. */ public interface ITreeholeView { void stopRefreshing(); void netError(); void showDataFromDb(List<TreeholeLocalInfo> infos); void showLoadingDbProgressDialog(); void dismissLoadingDbProgressDialog(); void showNoDataInDb();
// Path: app/src/main/java/com/leelit/stuer/bean/TreeholeLocalInfo.java // public class TreeholeLocalInfo extends TreeholeInfo { // // boolean like; // // boolean unlike; // // public boolean isLike() { // return like; // } // // public void setLike(boolean like) { // this.like = like; // } // // public boolean isUnlike() { // return unlike; // } // // public void setUnlike(boolean unlike) { // this.unlike = unlike; // } // // @Override // public String toString() { // return "TreeholeLocalInfo{" + // "datetime='" + datetime + '\'' + // ", state='" + state + '\'' + // ", picAddress='" + picAddress + '\'' + // ", uniquecode='" + uniquecode + '\'' + // ", like=" + like + // ", unlike=" + unlike + // "} "; // } // } // // Path: app/src/main/java/com/leelit/stuer/bean/TreeholeInfo.java // public class TreeholeInfo { // String datetime; // // String state; // // String picAddress; // // String uniquecode; // // @Override // public String toString() { // return "TreeholeInfo{" + // "datetime='" + datetime + '\'' + // ", state='" + state + '\'' + // ", picAddress='" + picAddress + '\'' + // ", uniquecode='" + uniquecode + '\'' + // '}'; // } // // public String getDatetime() { // return datetime; // } // // public void setDatetime(String datetime) { // this.datetime = datetime; // } // // public String getState() { // return state; // } // // public void setState(String state) { // this.state = state; // } // // public String getPicAddress() { // return picAddress; // } // // public void setPicAddress(String picAddress) { // this.picAddress = picAddress; // } // // public String getUniquecode() { // return uniquecode; // } // // public void setUniquecode(String uniquecode) { // this.uniquecode = uniquecode; // } // } // Path: app/src/main/java/com/leelit/stuer/module_treehole/viewinterface/ITreeholeView.java import com.leelit.stuer.bean.TreeholeLocalInfo; import com.leelit.stuer.bean.TreeholeInfo; import java.util.List; package com.leelit.stuer.module_treehole.viewinterface; /** * Created by Leelit on 2016/3/24. */ public interface ITreeholeView { void stopRefreshing(); void netError(); void showDataFromDb(List<TreeholeLocalInfo> infos); void showLoadingDbProgressDialog(); void dismissLoadingDbProgressDialog(); void showNoDataInDb();
void showDataFromNet(List<TreeholeInfo> infos);
leelit/STUer-client
app/src/main/java/com/leelit/stuer/dao/TreeholeDao.java
// Path: app/src/main/java/com/leelit/stuer/bean/TreeholeLocalInfo.java // public class TreeholeLocalInfo extends TreeholeInfo { // // boolean like; // // boolean unlike; // // public boolean isLike() { // return like; // } // // public void setLike(boolean like) { // this.like = like; // } // // public boolean isUnlike() { // return unlike; // } // // public void setUnlike(boolean unlike) { // this.unlike = unlike; // } // // @Override // public String toString() { // return "TreeholeLocalInfo{" + // "datetime='" + datetime + '\'' + // ", state='" + state + '\'' + // ", picAddress='" + picAddress + '\'' + // ", uniquecode='" + uniquecode + '\'' + // ", like=" + like + // ", unlike=" + unlike + // "} "; // } // } // // Path: app/src/main/java/com/leelit/stuer/bean/TreeholeInfo.java // public class TreeholeInfo { // String datetime; // // String state; // // String picAddress; // // String uniquecode; // // @Override // public String toString() { // return "TreeholeInfo{" + // "datetime='" + datetime + '\'' + // ", state='" + state + '\'' + // ", picAddress='" + picAddress + '\'' + // ", uniquecode='" + uniquecode + '\'' + // '}'; // } // // public String getDatetime() { // return datetime; // } // // public void setDatetime(String datetime) { // this.datetime = datetime; // } // // public String getState() { // return state; // } // // public void setState(String state) { // this.state = state; // } // // public String getPicAddress() { // return picAddress; // } // // public void setPicAddress(String picAddress) { // this.picAddress = picAddress; // } // // public String getUniquecode() { // return uniquecode; // } // // public void setUniquecode(String uniquecode) { // this.uniquecode = uniquecode; // } // }
import android.content.ContentValues; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import com.leelit.stuer.bean.TreeholeLocalInfo; import com.leelit.stuer.bean.TreeholeInfo; import java.util.ArrayList; import java.util.List;
package com.leelit.stuer.dao; /** * Created by Leelit on 2016/3/25. */ public class TreeholeDao { private static final String[] keys = {"dt", "state", "picaddress", "uniquecode", "like", "unlike"}; public static final int TRUE = 1; public static final int FALSE = 0;
// Path: app/src/main/java/com/leelit/stuer/bean/TreeholeLocalInfo.java // public class TreeholeLocalInfo extends TreeholeInfo { // // boolean like; // // boolean unlike; // // public boolean isLike() { // return like; // } // // public void setLike(boolean like) { // this.like = like; // } // // public boolean isUnlike() { // return unlike; // } // // public void setUnlike(boolean unlike) { // this.unlike = unlike; // } // // @Override // public String toString() { // return "TreeholeLocalInfo{" + // "datetime='" + datetime + '\'' + // ", state='" + state + '\'' + // ", picAddress='" + picAddress + '\'' + // ", uniquecode='" + uniquecode + '\'' + // ", like=" + like + // ", unlike=" + unlike + // "} "; // } // } // // Path: app/src/main/java/com/leelit/stuer/bean/TreeholeInfo.java // public class TreeholeInfo { // String datetime; // // String state; // // String picAddress; // // String uniquecode; // // @Override // public String toString() { // return "TreeholeInfo{" + // "datetime='" + datetime + '\'' + // ", state='" + state + '\'' + // ", picAddress='" + picAddress + '\'' + // ", uniquecode='" + uniquecode + '\'' + // '}'; // } // // public String getDatetime() { // return datetime; // } // // public void setDatetime(String datetime) { // this.datetime = datetime; // } // // public String getState() { // return state; // } // // public void setState(String state) { // this.state = state; // } // // public String getPicAddress() { // return picAddress; // } // // public void setPicAddress(String picAddress) { // this.picAddress = picAddress; // } // // public String getUniquecode() { // return uniquecode; // } // // public void setUniquecode(String uniquecode) { // this.uniquecode = uniquecode; // } // } // Path: app/src/main/java/com/leelit/stuer/dao/TreeholeDao.java import android.content.ContentValues; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import com.leelit.stuer.bean.TreeholeLocalInfo; import com.leelit.stuer.bean.TreeholeInfo; import java.util.ArrayList; import java.util.List; package com.leelit.stuer.dao; /** * Created by Leelit on 2016/3/25. */ public class TreeholeDao { private static final String[] keys = {"dt", "state", "picaddress", "uniquecode", "like", "unlike"}; public static final int TRUE = 1; public static final int FALSE = 0;
public static void save(List<TreeholeInfo> infos) {
leelit/STUer-client
app/src/main/java/com/leelit/stuer/dao/TreeholeDao.java
// Path: app/src/main/java/com/leelit/stuer/bean/TreeholeLocalInfo.java // public class TreeholeLocalInfo extends TreeholeInfo { // // boolean like; // // boolean unlike; // // public boolean isLike() { // return like; // } // // public void setLike(boolean like) { // this.like = like; // } // // public boolean isUnlike() { // return unlike; // } // // public void setUnlike(boolean unlike) { // this.unlike = unlike; // } // // @Override // public String toString() { // return "TreeholeLocalInfo{" + // "datetime='" + datetime + '\'' + // ", state='" + state + '\'' + // ", picAddress='" + picAddress + '\'' + // ", uniquecode='" + uniquecode + '\'' + // ", like=" + like + // ", unlike=" + unlike + // "} "; // } // } // // Path: app/src/main/java/com/leelit/stuer/bean/TreeholeInfo.java // public class TreeholeInfo { // String datetime; // // String state; // // String picAddress; // // String uniquecode; // // @Override // public String toString() { // return "TreeholeInfo{" + // "datetime='" + datetime + '\'' + // ", state='" + state + '\'' + // ", picAddress='" + picAddress + '\'' + // ", uniquecode='" + uniquecode + '\'' + // '}'; // } // // public String getDatetime() { // return datetime; // } // // public void setDatetime(String datetime) { // this.datetime = datetime; // } // // public String getState() { // return state; // } // // public void setState(String state) { // this.state = state; // } // // public String getPicAddress() { // return picAddress; // } // // public void setPicAddress(String picAddress) { // this.picAddress = picAddress; // } // // public String getUniquecode() { // return uniquecode; // } // // public void setUniquecode(String uniquecode) { // this.uniquecode = uniquecode; // } // }
import android.content.ContentValues; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import com.leelit.stuer.bean.TreeholeLocalInfo; import com.leelit.stuer.bean.TreeholeInfo; import java.util.ArrayList; import java.util.List;
public static final int FALSE = 0; public static void save(List<TreeholeInfo> infos) { SQLiteDatabase db = DatabaseHelper.getInstance().getWritableDatabase(); db.beginTransaction(); for (TreeholeInfo info : infos) { ContentValues values = new ContentValues(); values.put(keys[0], info.getDatetime()); values.put(keys[1], info.getState()); values.put(keys[2], info.getPicAddress()); values.put(keys[3], info.getUniquecode()); values.put(keys[4], FALSE); values.put(keys[5], FALSE); db.insert("treehole", null, values); } db.setTransactionSuccessful(); db.endTransaction(); } public static String getLatestDatetime() { String str = ""; SQLiteDatabase db = DatabaseHelper.getInstance().getReadableDatabase(); Cursor cursor = db.rawQuery("SELECT * FROM treehole ORDER BY id DESC LIMIT 1", null); if (cursor.moveToFirst()) { str = cursor.getString(cursor.getColumnIndex("dt")); } cursor.close(); return str; }
// Path: app/src/main/java/com/leelit/stuer/bean/TreeholeLocalInfo.java // public class TreeholeLocalInfo extends TreeholeInfo { // // boolean like; // // boolean unlike; // // public boolean isLike() { // return like; // } // // public void setLike(boolean like) { // this.like = like; // } // // public boolean isUnlike() { // return unlike; // } // // public void setUnlike(boolean unlike) { // this.unlike = unlike; // } // // @Override // public String toString() { // return "TreeholeLocalInfo{" + // "datetime='" + datetime + '\'' + // ", state='" + state + '\'' + // ", picAddress='" + picAddress + '\'' + // ", uniquecode='" + uniquecode + '\'' + // ", like=" + like + // ", unlike=" + unlike + // "} "; // } // } // // Path: app/src/main/java/com/leelit/stuer/bean/TreeholeInfo.java // public class TreeholeInfo { // String datetime; // // String state; // // String picAddress; // // String uniquecode; // // @Override // public String toString() { // return "TreeholeInfo{" + // "datetime='" + datetime + '\'' + // ", state='" + state + '\'' + // ", picAddress='" + picAddress + '\'' + // ", uniquecode='" + uniquecode + '\'' + // '}'; // } // // public String getDatetime() { // return datetime; // } // // public void setDatetime(String datetime) { // this.datetime = datetime; // } // // public String getState() { // return state; // } // // public void setState(String state) { // this.state = state; // } // // public String getPicAddress() { // return picAddress; // } // // public void setPicAddress(String picAddress) { // this.picAddress = picAddress; // } // // public String getUniquecode() { // return uniquecode; // } // // public void setUniquecode(String uniquecode) { // this.uniquecode = uniquecode; // } // } // Path: app/src/main/java/com/leelit/stuer/dao/TreeholeDao.java import android.content.ContentValues; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import com.leelit.stuer.bean.TreeholeLocalInfo; import com.leelit.stuer.bean.TreeholeInfo; import java.util.ArrayList; import java.util.List; public static final int FALSE = 0; public static void save(List<TreeholeInfo> infos) { SQLiteDatabase db = DatabaseHelper.getInstance().getWritableDatabase(); db.beginTransaction(); for (TreeholeInfo info : infos) { ContentValues values = new ContentValues(); values.put(keys[0], info.getDatetime()); values.put(keys[1], info.getState()); values.put(keys[2], info.getPicAddress()); values.put(keys[3], info.getUniquecode()); values.put(keys[4], FALSE); values.put(keys[5], FALSE); db.insert("treehole", null, values); } db.setTransactionSuccessful(); db.endTransaction(); } public static String getLatestDatetime() { String str = ""; SQLiteDatabase db = DatabaseHelper.getInstance().getReadableDatabase(); Cursor cursor = db.rawQuery("SELECT * FROM treehole ORDER BY id DESC LIMIT 1", null); if (cursor.moveToFirst()) { str = cursor.getString(cursor.getColumnIndex("dt")); } cursor.close(); return str; }
public static List<TreeholeLocalInfo> getAll() {
leelit/STUer-client
app/src/main/java/com/leelit/stuer/base_view/viewinterface/IMyBaseInfoView.java
// Path: app/src/main/java/com/leelit/stuer/bean/BaseInfo.java // public class BaseInfo { // // int id; // String name; // String tel; // String shortTel; // String wechat; // String date; // String time; // String temporaryCount; // String flag; // String imei; // String uniquecode; // // @Override // public String toString() { // return "CarpoolingInfo{" + // "id=" + id + // ", name='" + name + '\'' + // ", tel='" + tel + '\'' + // ", shortTel='" + shortTel + '\'' + // ", wechat='" + wechat + '\'' + // ", date='" + date + '\'' + // ", time='" + time + '\'' + // ", temporaryCount='" + temporaryCount + '\'' + // ", flag='" + flag + '\'' + // ", imei='" + imei + '\'' + // ", uniquecode='" + uniquecode + '\'' + // '}'; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getTel() { // return tel; // } // // public void setTel(String tel) { // this.tel = tel; // } // // public String getShortTel() { // return shortTel; // } // // public void setShortTel(String shortTel) { // this.shortTel = shortTel; // } // // public String getWechat() { // return wechat; // } // // public void setWechat(String wechat) { // this.wechat = wechat; // } // // public String getDate() { // return date; // } // // public void setDate(String date) { // this.date = date; // } // // public String getTime() { // return time; // } // // public void setTime(String time) { // this.time = time; // } // // public String getTemporaryCount() { // return temporaryCount; // } // // public void setTemporaryCount(String temporaryCount) { // this.temporaryCount = temporaryCount; // } // // public String getFlag() { // return flag; // } // // public void setFlag(String flag) { // this.flag = flag; // } // // public String getImei() { // return imei; // } // // public void setImei(String imei) { // this.imei = imei; // } // // // public String getUniquecode() { // return uniquecode; // } // // public void setUniquecode(String uniquecode) { // this.uniquecode = uniquecode; // } // // public boolean completedAllInfo() { // return (!TextUtils.isEmpty(name) && // !TextUtils.isEmpty(tel) && // !TextUtils.isEmpty(shortTel) && // !TextUtils.isEmpty(wechat) && // !TextUtils.isEmpty(temporaryCount) && // !TextUtils.isEmpty(date) && // !TextUtils.isEmpty(time) && // !TextUtils.isEmpty(flag)); // } // }
import com.leelit.stuer.bean.BaseInfo; import java.util.List;
package com.leelit.stuer.base_view.viewinterface; /** * Created by Leelit on 2016/3/9. */ public interface IMyBaseInfoView { void stopRefreshing(); void netError();
// Path: app/src/main/java/com/leelit/stuer/bean/BaseInfo.java // public class BaseInfo { // // int id; // String name; // String tel; // String shortTel; // String wechat; // String date; // String time; // String temporaryCount; // String flag; // String imei; // String uniquecode; // // @Override // public String toString() { // return "CarpoolingInfo{" + // "id=" + id + // ", name='" + name + '\'' + // ", tel='" + tel + '\'' + // ", shortTel='" + shortTel + '\'' + // ", wechat='" + wechat + '\'' + // ", date='" + date + '\'' + // ", time='" + time + '\'' + // ", temporaryCount='" + temporaryCount + '\'' + // ", flag='" + flag + '\'' + // ", imei='" + imei + '\'' + // ", uniquecode='" + uniquecode + '\'' + // '}'; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getTel() { // return tel; // } // // public void setTel(String tel) { // this.tel = tel; // } // // public String getShortTel() { // return shortTel; // } // // public void setShortTel(String shortTel) { // this.shortTel = shortTel; // } // // public String getWechat() { // return wechat; // } // // public void setWechat(String wechat) { // this.wechat = wechat; // } // // public String getDate() { // return date; // } // // public void setDate(String date) { // this.date = date; // } // // public String getTime() { // return time; // } // // public void setTime(String time) { // this.time = time; // } // // public String getTemporaryCount() { // return temporaryCount; // } // // public void setTemporaryCount(String temporaryCount) { // this.temporaryCount = temporaryCount; // } // // public String getFlag() { // return flag; // } // // public void setFlag(String flag) { // this.flag = flag; // } // // public String getImei() { // return imei; // } // // public void setImei(String imei) { // this.imei = imei; // } // // // public String getUniquecode() { // return uniquecode; // } // // public void setUniquecode(String uniquecode) { // this.uniquecode = uniquecode; // } // // public boolean completedAllInfo() { // return (!TextUtils.isEmpty(name) && // !TextUtils.isEmpty(tel) && // !TextUtils.isEmpty(shortTel) && // !TextUtils.isEmpty(wechat) && // !TextUtils.isEmpty(temporaryCount) && // !TextUtils.isEmpty(date) && // !TextUtils.isEmpty(time) && // !TextUtils.isEmpty(flag)); // } // } // Path: app/src/main/java/com/leelit/stuer/base_view/viewinterface/IMyBaseInfoView.java import com.leelit.stuer.bean.BaseInfo; import java.util.List; package com.leelit.stuer.base_view.viewinterface; /** * Created by Leelit on 2016/3/9. */ public interface IMyBaseInfoView { void stopRefreshing(); void netError();
void showData(List<List<? extends BaseInfo>> lists);
leelit/STUer-client
app/src/main/java/com/leelit/stuer/module_sell/viewinterface/ISellView.java
// Path: app/src/main/java/com/leelit/stuer/bean/SellInfo.java // public class SellInfo { // int id; // String name; // String tel; // String shortTel; // String wechat; // String datetime; // String imei; // String picAddress; // String state; // String uniquecode; // attention 这里的flag和carpool/date模块不同,唯一订单号,相当于前两个的uniquecode // String status; // on // off // // @Override // public String toString() { // return "SellInfo{" + // "id=" + id + // ", name='" + name + '\'' + // ", tel='" + tel + '\'' + // ", shortTel='" + shortTel + '\'' + // ", wechat='" + wechat + '\'' + // ", datetime='" + datetime + '\'' + // ", imei='" + imei + '\'' + // ", picAddress='" + picAddress + '\'' + // ", state='" + state + '\'' + // ", uniquecode='" + uniquecode + '\'' + // ", status='" + status + '\'' + // '}'; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getTel() { // return tel; // } // // public void setTel(String tel) { // this.tel = tel; // } // // public String getShortTel() { // return shortTel; // } // // public void setShortTel(String shortTel) { // this.shortTel = shortTel; // } // // public String getWechat() { // return wechat; // } // // public void setWechat(String wechat) { // this.wechat = wechat; // } // // public String getImei() { // return imei; // } // // public void setImei(String imei) { // this.imei = imei; // } // // public String getPicAddress() { // return picAddress; // } // // public void setPicAddress(String picAddress) { // this.picAddress = picAddress; // } // // public String getState() { // return state; // } // // public void setState(String state) { // this.state = state; // } // // public String getUniquecode() { // return uniquecode; // } // // public void setUniquecode(String uniquecode) { // this.uniquecode = uniquecode; // } // // public String getStatus() { // return status; // } // // public void setStatus(String status) { // this.status = status; // } // // public String getDatetime() { // return datetime; // } // // public void setDatetime(String datetime) { // this.datetime = datetime; // } // }
import com.leelit.stuer.bean.SellInfo; import java.util.List;
package com.leelit.stuer.module_sell.viewinterface; /** * Created by Leelit on 2016/3/16. */ public interface ISellView { void stopRefreshing(); void netError();
// Path: app/src/main/java/com/leelit/stuer/bean/SellInfo.java // public class SellInfo { // int id; // String name; // String tel; // String shortTel; // String wechat; // String datetime; // String imei; // String picAddress; // String state; // String uniquecode; // attention 这里的flag和carpool/date模块不同,唯一订单号,相当于前两个的uniquecode // String status; // on // off // // @Override // public String toString() { // return "SellInfo{" + // "id=" + id + // ", name='" + name + '\'' + // ", tel='" + tel + '\'' + // ", shortTel='" + shortTel + '\'' + // ", wechat='" + wechat + '\'' + // ", datetime='" + datetime + '\'' + // ", imei='" + imei + '\'' + // ", picAddress='" + picAddress + '\'' + // ", state='" + state + '\'' + // ", uniquecode='" + uniquecode + '\'' + // ", status='" + status + '\'' + // '}'; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getTel() { // return tel; // } // // public void setTel(String tel) { // this.tel = tel; // } // // public String getShortTel() { // return shortTel; // } // // public void setShortTel(String shortTel) { // this.shortTel = shortTel; // } // // public String getWechat() { // return wechat; // } // // public void setWechat(String wechat) { // this.wechat = wechat; // } // // public String getImei() { // return imei; // } // // public void setImei(String imei) { // this.imei = imei; // } // // public String getPicAddress() { // return picAddress; // } // // public void setPicAddress(String picAddress) { // this.picAddress = picAddress; // } // // public String getState() { // return state; // } // // public void setState(String state) { // this.state = state; // } // // public String getUniquecode() { // return uniquecode; // } // // public void setUniquecode(String uniquecode) { // this.uniquecode = uniquecode; // } // // public String getStatus() { // return status; // } // // public void setStatus(String status) { // this.status = status; // } // // public String getDatetime() { // return datetime; // } // // public void setDatetime(String datetime) { // this.datetime = datetime; // } // } // Path: app/src/main/java/com/leelit/stuer/module_sell/viewinterface/ISellView.java import com.leelit.stuer.bean.SellInfo; import java.util.List; package com.leelit.stuer.module_sell.viewinterface; /** * Created by Leelit on 2016/3/16. */ public interface ISellView { void stopRefreshing(); void netError();
void showDataFromDb(List<SellInfo> sellInfos);
leelit/STUer-client
app/src/main/java/com/leelit/stuer/module_sell/viewinterface/IMySellView.java
// Path: app/src/main/java/com/leelit/stuer/bean/SellInfo.java // public class SellInfo { // int id; // String name; // String tel; // String shortTel; // String wechat; // String datetime; // String imei; // String picAddress; // String state; // String uniquecode; // attention 这里的flag和carpool/date模块不同,唯一订单号,相当于前两个的uniquecode // String status; // on // off // // @Override // public String toString() { // return "SellInfo{" + // "id=" + id + // ", name='" + name + '\'' + // ", tel='" + tel + '\'' + // ", shortTel='" + shortTel + '\'' + // ", wechat='" + wechat + '\'' + // ", datetime='" + datetime + '\'' + // ", imei='" + imei + '\'' + // ", picAddress='" + picAddress + '\'' + // ", state='" + state + '\'' + // ", uniquecode='" + uniquecode + '\'' + // ", status='" + status + '\'' + // '}'; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getTel() { // return tel; // } // // public void setTel(String tel) { // this.tel = tel; // } // // public String getShortTel() { // return shortTel; // } // // public void setShortTel(String shortTel) { // this.shortTel = shortTel; // } // // public String getWechat() { // return wechat; // } // // public void setWechat(String wechat) { // this.wechat = wechat; // } // // public String getImei() { // return imei; // } // // public void setImei(String imei) { // this.imei = imei; // } // // public String getPicAddress() { // return picAddress; // } // // public void setPicAddress(String picAddress) { // this.picAddress = picAddress; // } // // public String getState() { // return state; // } // // public void setState(String state) { // this.state = state; // } // // public String getUniquecode() { // return uniquecode; // } // // public void setUniquecode(String uniquecode) { // this.uniquecode = uniquecode; // } // // public String getStatus() { // return status; // } // // public void setStatus(String status) { // this.status = status; // } // // public String getDatetime() { // return datetime; // } // // public void setDatetime(String datetime) { // this.datetime = datetime; // } // }
import com.leelit.stuer.bean.SellInfo; import java.util.List;
package com.leelit.stuer.module_sell.viewinterface; /** * Created by Leelit on 2016/3/18. */ public interface IMySellView { void stopRefreshing(); void netError();
// Path: app/src/main/java/com/leelit/stuer/bean/SellInfo.java // public class SellInfo { // int id; // String name; // String tel; // String shortTel; // String wechat; // String datetime; // String imei; // String picAddress; // String state; // String uniquecode; // attention 这里的flag和carpool/date模块不同,唯一订单号,相当于前两个的uniquecode // String status; // on // off // // @Override // public String toString() { // return "SellInfo{" + // "id=" + id + // ", name='" + name + '\'' + // ", tel='" + tel + '\'' + // ", shortTel='" + shortTel + '\'' + // ", wechat='" + wechat + '\'' + // ", datetime='" + datetime + '\'' + // ", imei='" + imei + '\'' + // ", picAddress='" + picAddress + '\'' + // ", state='" + state + '\'' + // ", uniquecode='" + uniquecode + '\'' + // ", status='" + status + '\'' + // '}'; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getTel() { // return tel; // } // // public void setTel(String tel) { // this.tel = tel; // } // // public String getShortTel() { // return shortTel; // } // // public void setShortTel(String shortTel) { // this.shortTel = shortTel; // } // // public String getWechat() { // return wechat; // } // // public void setWechat(String wechat) { // this.wechat = wechat; // } // // public String getImei() { // return imei; // } // // public void setImei(String imei) { // this.imei = imei; // } // // public String getPicAddress() { // return picAddress; // } // // public void setPicAddress(String picAddress) { // this.picAddress = picAddress; // } // // public String getState() { // return state; // } // // public void setState(String state) { // this.state = state; // } // // public String getUniquecode() { // return uniquecode; // } // // public void setUniquecode(String uniquecode) { // this.uniquecode = uniquecode; // } // // public String getStatus() { // return status; // } // // public void setStatus(String status) { // this.status = status; // } // // public String getDatetime() { // return datetime; // } // // public void setDatetime(String datetime) { // this.datetime = datetime; // } // } // Path: app/src/main/java/com/leelit/stuer/module_sell/viewinterface/IMySellView.java import com.leelit.stuer.bean.SellInfo; import java.util.List; package com.leelit.stuer.module_sell.viewinterface; /** * Created by Leelit on 2016/3/18. */ public interface IMySellView { void stopRefreshing(); void netError();
void showData(List<SellInfo> sellInfos);
leelit/STUer-client
app/src/main/java/com/leelit/stuer/base_view/viewinterface/IBaseInfoView.java
// Path: app/src/main/java/com/leelit/stuer/bean/BaseInfo.java // public class BaseInfo { // // int id; // String name; // String tel; // String shortTel; // String wechat; // String date; // String time; // String temporaryCount; // String flag; // String imei; // String uniquecode; // // @Override // public String toString() { // return "CarpoolingInfo{" + // "id=" + id + // ", name='" + name + '\'' + // ", tel='" + tel + '\'' + // ", shortTel='" + shortTel + '\'' + // ", wechat='" + wechat + '\'' + // ", date='" + date + '\'' + // ", time='" + time + '\'' + // ", temporaryCount='" + temporaryCount + '\'' + // ", flag='" + flag + '\'' + // ", imei='" + imei + '\'' + // ", uniquecode='" + uniquecode + '\'' + // '}'; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getTel() { // return tel; // } // // public void setTel(String tel) { // this.tel = tel; // } // // public String getShortTel() { // return shortTel; // } // // public void setShortTel(String shortTel) { // this.shortTel = shortTel; // } // // public String getWechat() { // return wechat; // } // // public void setWechat(String wechat) { // this.wechat = wechat; // } // // public String getDate() { // return date; // } // // public void setDate(String date) { // this.date = date; // } // // public String getTime() { // return time; // } // // public void setTime(String time) { // this.time = time; // } // // public String getTemporaryCount() { // return temporaryCount; // } // // public void setTemporaryCount(String temporaryCount) { // this.temporaryCount = temporaryCount; // } // // public String getFlag() { // return flag; // } // // public void setFlag(String flag) { // this.flag = flag; // } // // public String getImei() { // return imei; // } // // public void setImei(String imei) { // this.imei = imei; // } // // // public String getUniquecode() { // return uniquecode; // } // // public void setUniquecode(String uniquecode) { // this.uniquecode = uniquecode; // } // // public boolean completedAllInfo() { // return (!TextUtils.isEmpty(name) && // !TextUtils.isEmpty(tel) && // !TextUtils.isEmpty(shortTel) && // !TextUtils.isEmpty(wechat) && // !TextUtils.isEmpty(temporaryCount) && // !TextUtils.isEmpty(date) && // !TextUtils.isEmpty(time) && // !TextUtils.isEmpty(flag)); // } // }
import com.leelit.stuer.bean.BaseInfo; import java.util.List;
package com.leelit.stuer.base_view.viewinterface; /** * Created by Leelit on 2016/3/8. */ public interface IBaseInfoView { void stopRefreshing(); void netError();
// Path: app/src/main/java/com/leelit/stuer/bean/BaseInfo.java // public class BaseInfo { // // int id; // String name; // String tel; // String shortTel; // String wechat; // String date; // String time; // String temporaryCount; // String flag; // String imei; // String uniquecode; // // @Override // public String toString() { // return "CarpoolingInfo{" + // "id=" + id + // ", name='" + name + '\'' + // ", tel='" + tel + '\'' + // ", shortTel='" + shortTel + '\'' + // ", wechat='" + wechat + '\'' + // ", date='" + date + '\'' + // ", time='" + time + '\'' + // ", temporaryCount='" + temporaryCount + '\'' + // ", flag='" + flag + '\'' + // ", imei='" + imei + '\'' + // ", uniquecode='" + uniquecode + '\'' + // '}'; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getTel() { // return tel; // } // // public void setTel(String tel) { // this.tel = tel; // } // // public String getShortTel() { // return shortTel; // } // // public void setShortTel(String shortTel) { // this.shortTel = shortTel; // } // // public String getWechat() { // return wechat; // } // // public void setWechat(String wechat) { // this.wechat = wechat; // } // // public String getDate() { // return date; // } // // public void setDate(String date) { // this.date = date; // } // // public String getTime() { // return time; // } // // public void setTime(String time) { // this.time = time; // } // // public String getTemporaryCount() { // return temporaryCount; // } // // public void setTemporaryCount(String temporaryCount) { // this.temporaryCount = temporaryCount; // } // // public String getFlag() { // return flag; // } // // public void setFlag(String flag) { // this.flag = flag; // } // // public String getImei() { // return imei; // } // // public void setImei(String imei) { // this.imei = imei; // } // // // public String getUniquecode() { // return uniquecode; // } // // public void setUniquecode(String uniquecode) { // this.uniquecode = uniquecode; // } // // public boolean completedAllInfo() { // return (!TextUtils.isEmpty(name) && // !TextUtils.isEmpty(tel) && // !TextUtils.isEmpty(shortTel) && // !TextUtils.isEmpty(wechat) && // !TextUtils.isEmpty(temporaryCount) && // !TextUtils.isEmpty(date) && // !TextUtils.isEmpty(time) && // !TextUtils.isEmpty(flag)); // } // } // Path: app/src/main/java/com/leelit/stuer/base_view/viewinterface/IBaseInfoView.java import com.leelit.stuer.bean.BaseInfo; import java.util.List; package com.leelit.stuer.base_view.viewinterface; /** * Created by Leelit on 2016/3/8. */ public interface IBaseInfoView { void stopRefreshing(); void netError();
void showData(List<? extends BaseInfo> list);
leelit/STUer-client
app/src/main/java/com/leelit/stuer/dao/DatabaseHelper.java
// Path: app/src/main/java/com/leelit/stuer/MyApplication.java // public class MyApplication extends Application { // // public static final String VERSION = "1.1.0"; // // public static Context context; // // @Override // public void onCreate() { // super.onCreate(); // context = getApplicationContext(); // } // }
import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import com.leelit.stuer.MyApplication;
package com.leelit.stuer.dao; /** * Created by Leelit on 2016/3/16. */ public class DatabaseHelper extends SQLiteOpenHelper { private static final String DB_NAME = "stuer.db"; private static final int VERSION = 1;
// Path: app/src/main/java/com/leelit/stuer/MyApplication.java // public class MyApplication extends Application { // // public static final String VERSION = "1.1.0"; // // public static Context context; // // @Override // public void onCreate() { // super.onCreate(); // context = getApplicationContext(); // } // } // Path: app/src/main/java/com/leelit/stuer/dao/DatabaseHelper.java import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import com.leelit.stuer.MyApplication; package com.leelit.stuer.dao; /** * Created by Leelit on 2016/3/16. */ public class DatabaseHelper extends SQLiteOpenHelper { private static final String DB_NAME = "stuer.db"; private static final int VERSION = 1;
private static final DatabaseHelper mDatabaseHelper = new DatabaseHelper(MyApplication.context, DB_NAME, null, VERSION);
leelit/STUer-client
app/src/main/java/com/leelit/stuer/UpdateModel.java
// Path: app/src/main/java/com/leelit/stuer/constant/NetConstant.java // public class NetConstant { // // public static final int NET_ERROR_RECORD_EXISTED = 601; // // // public static final String HOST = "http://192.168.191.1:8080/STUer/"; // public static final String HOST = "http://stuer.applinzi.com/"; // // public static final String IMAGE_HOST = "http://stuer-picture.stor.sinaapp.com/"; // // } // // Path: app/src/main/java/com/leelit/stuer/utils/SupportModelUtils.java // public class SupportModelUtils { // // public static final String HOST = NetConstant.HOST; // // // /** // * 默认线程处理方式 // * // * @param observable // * @param subscriber // */ // public static void toSubscribe(Observable observable, Subscriber subscriber) { // observable.subscribeOn(Schedulers.io()) // .observeOn(AndroidSchedulers.mainThread()) // .subscribe(subscriber); // } // }
import com.leelit.stuer.constant.NetConstant; import com.leelit.stuer.utils.SupportModelUtils; import okhttp3.ResponseBody; import retrofit2.GsonConverterFactory; import retrofit2.Retrofit; import retrofit2.RxJavaCallAdapterFactory; import rx.Subscriber;
package com.leelit.stuer; /** * Created by Leelit on 2016/3/31. */ public class UpdateModel { public static final String BASE_URL = NetConstant.HOST; private UpdateService mService = new Retrofit.Builder() .baseUrl(BASE_URL) .addConverterFactory(GsonConverterFactory.create()) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) .build() .create(UpdateService.class); public void getNewVersion(Subscriber<ResponseBody> subscriber) {
// Path: app/src/main/java/com/leelit/stuer/constant/NetConstant.java // public class NetConstant { // // public static final int NET_ERROR_RECORD_EXISTED = 601; // // // public static final String HOST = "http://192.168.191.1:8080/STUer/"; // public static final String HOST = "http://stuer.applinzi.com/"; // // public static final String IMAGE_HOST = "http://stuer-picture.stor.sinaapp.com/"; // // } // // Path: app/src/main/java/com/leelit/stuer/utils/SupportModelUtils.java // public class SupportModelUtils { // // public static final String HOST = NetConstant.HOST; // // // /** // * 默认线程处理方式 // * // * @param observable // * @param subscriber // */ // public static void toSubscribe(Observable observable, Subscriber subscriber) { // observable.subscribeOn(Schedulers.io()) // .observeOn(AndroidSchedulers.mainThread()) // .subscribe(subscriber); // } // } // Path: app/src/main/java/com/leelit/stuer/UpdateModel.java import com.leelit.stuer.constant.NetConstant; import com.leelit.stuer.utils.SupportModelUtils; import okhttp3.ResponseBody; import retrofit2.GsonConverterFactory; import retrofit2.Retrofit; import retrofit2.RxJavaCallAdapterFactory; import rx.Subscriber; package com.leelit.stuer; /** * Created by Leelit on 2016/3/31. */ public class UpdateModel { public static final String BASE_URL = NetConstant.HOST; private UpdateService mService = new Retrofit.Builder() .baseUrl(BASE_URL) .addConverterFactory(GsonConverterFactory.create()) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) .build() .create(UpdateService.class); public void getNewVersion(Subscriber<ResponseBody> subscriber) {
SupportModelUtils.toSubscribe(mService.getNewVersion(),subscriber);
leelit/STUer-client
app/src/main/java/com/leelit/stuer/module_treehole/viewinterface/ICommentView.java
// Path: app/src/main/java/com/leelit/stuer/bean/TreeholeComment.java // public class TreeholeComment { // // int likeCount; // // int unlikeCount; // // List<Comment> comments; // // public int getLikeCount() { // return likeCount; // } // // public void setLikeCount(int likeCount) { // this.likeCount = likeCount; // } // // public int getUnlikeCount() { // return unlikeCount; // } // // public void setUnlikeCount(int unlikeCount) { // this.unlikeCount = unlikeCount; // } // // public List<Comment> getComments() { // return comments; // } // // public void setComments(List<Comment> comments) { // this.comments = comments; // } // // @Override // public String toString() { // return "TreeholeComment{" + // "likeCount=" + likeCount + // ", unlikeCount=" + unlikeCount + // ", comments=" + comments + // '}'; // } // // public static class Comment { // String uniquecode; // String name; // String dt; // String comment; // String imei; // // public String getUniquecode() { // return uniquecode; // } // // public void setUniquecode(String uniquecode) { // this.uniquecode = uniquecode; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getDt() { // return dt; // } // // public void setDt(String dt) { // this.dt = dt; // } // // public String getComment() { // return comment; // } // // public void setComment(String comment) { // this.comment = comment; // } // // public String getImei() { // return imei; // } // // public void setImei(String imei) { // this.imei = imei; // } // // @Override // public String toString() { // return "Comment{" + // "uniquecode='" + uniquecode + '\'' + // ", name='" + name + '\'' + // ", dt='" + dt + '\'' + // ", comment='" + comment + '\'' + // ", imei='" + imei + '\'' + // '}'; // } // } // }
import com.leelit.stuer.bean.TreeholeComment; import java.util.List;
package com.leelit.stuer.module_treehole.viewinterface; /** * Created by Leelit on 2016/3/27. */ public interface ICommentView { void sendingCommentProgressDialog(); void dismissProgressDialog(); void netError(); void loadingCommentProgressDialog();
// Path: app/src/main/java/com/leelit/stuer/bean/TreeholeComment.java // public class TreeholeComment { // // int likeCount; // // int unlikeCount; // // List<Comment> comments; // // public int getLikeCount() { // return likeCount; // } // // public void setLikeCount(int likeCount) { // this.likeCount = likeCount; // } // // public int getUnlikeCount() { // return unlikeCount; // } // // public void setUnlikeCount(int unlikeCount) { // this.unlikeCount = unlikeCount; // } // // public List<Comment> getComments() { // return comments; // } // // public void setComments(List<Comment> comments) { // this.comments = comments; // } // // @Override // public String toString() { // return "TreeholeComment{" + // "likeCount=" + likeCount + // ", unlikeCount=" + unlikeCount + // ", comments=" + comments + // '}'; // } // // public static class Comment { // String uniquecode; // String name; // String dt; // String comment; // String imei; // // public String getUniquecode() { // return uniquecode; // } // // public void setUniquecode(String uniquecode) { // this.uniquecode = uniquecode; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getDt() { // return dt; // } // // public void setDt(String dt) { // this.dt = dt; // } // // public String getComment() { // return comment; // } // // public void setComment(String comment) { // this.comment = comment; // } // // public String getImei() { // return imei; // } // // public void setImei(String imei) { // this.imei = imei; // } // // @Override // public String toString() { // return "Comment{" + // "uniquecode='" + uniquecode + '\'' + // ", name='" + name + '\'' + // ", dt='" + dt + '\'' + // ", comment='" + comment + '\'' + // ", imei='" + imei + '\'' + // '}'; // } // } // } // Path: app/src/main/java/com/leelit/stuer/module_treehole/viewinterface/ICommentView.java import com.leelit.stuer.bean.TreeholeComment; import java.util.List; package com.leelit.stuer.module_treehole.viewinterface; /** * Created by Leelit on 2016/3/27. */ public interface ICommentView { void sendingCommentProgressDialog(); void dismissProgressDialog(); void netError(); void loadingCommentProgressDialog();
void refreshLikeAndUnlike(TreeholeComment comment);
leelit/STUer-client
app/src/main/java/com/leelit/stuer/module_baseinfo/date/model/DateService.java
// Path: app/src/main/java/com/leelit/stuer/bean/DatingInfo.java // public class DatingInfo extends BaseInfo { // // String type; // String description = ""; // // public String getType() { // return type; // } // // public void setType(String type) { // this.type = type; // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // this.description = description; // } // // @Override // public String toString() { // return "DatingInfo{" + // "id=" + id + // ", name='" + name + '\'' + // ", tel='" + tel + '\'' + // ", shortTel='" + shortTel + '\'' + // ", wechat='" + wechat + '\'' + // ", date='" + date + '\'' + // ", time='" + time + '\'' + // ", temporaryCount='" + temporaryCount + '\'' + // ", flag='" + flag + '\'' + // ", imei='" + imei + '\'' + // ", uniquecode='" + uniquecode + '\'' + // ", type='" + type + '\'' + // ", description='" + description + '\'' + // '}'; // } // // @Override // public boolean completedAllInfo() { // return super.completedAllInfo() && // !TextUtils.isEmpty(type); // } // }
import com.leelit.stuer.bean.DatingInfo; import java.util.List; import java.util.Map; import okhttp3.ResponseBody; import retrofit2.http.Body; import retrofit2.http.GET; import retrofit2.http.POST; import retrofit2.http.Query; import retrofit2.http.QueryMap; import rx.Observable;
package com.leelit.stuer.module_baseinfo.date.model; /** * Created by Leelit on 2016/3/9. */ public interface DateService { @GET("query")
// Path: app/src/main/java/com/leelit/stuer/bean/DatingInfo.java // public class DatingInfo extends BaseInfo { // // String type; // String description = ""; // // public String getType() { // return type; // } // // public void setType(String type) { // this.type = type; // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // this.description = description; // } // // @Override // public String toString() { // return "DatingInfo{" + // "id=" + id + // ", name='" + name + '\'' + // ", tel='" + tel + '\'' + // ", shortTel='" + shortTel + '\'' + // ", wechat='" + wechat + '\'' + // ", date='" + date + '\'' + // ", time='" + time + '\'' + // ", temporaryCount='" + temporaryCount + '\'' + // ", flag='" + flag + '\'' + // ", imei='" + imei + '\'' + // ", uniquecode='" + uniquecode + '\'' + // ", type='" + type + '\'' + // ", description='" + description + '\'' + // '}'; // } // // @Override // public boolean completedAllInfo() { // return super.completedAllInfo() && // !TextUtils.isEmpty(type); // } // } // Path: app/src/main/java/com/leelit/stuer/module_baseinfo/date/model/DateService.java import com.leelit.stuer.bean.DatingInfo; import java.util.List; import java.util.Map; import okhttp3.ResponseBody; import retrofit2.http.Body; import retrofit2.http.GET; import retrofit2.http.POST; import retrofit2.http.Query; import retrofit2.http.QueryMap; import rx.Observable; package com.leelit.stuer.module_baseinfo.date.model; /** * Created by Leelit on 2016/3/9. */ public interface DateService { @GET("query")
Observable<List<DatingInfo>> getGroupRecords(@Query("type") String type);
leelit/STUer-client
app/src/main/java/com/leelit/stuer/module_treehole/model/TreeholeService.java
// Path: app/src/main/java/com/leelit/stuer/bean/TreeholeComment.java // public class TreeholeComment { // // int likeCount; // // int unlikeCount; // // List<Comment> comments; // // public int getLikeCount() { // return likeCount; // } // // public void setLikeCount(int likeCount) { // this.likeCount = likeCount; // } // // public int getUnlikeCount() { // return unlikeCount; // } // // public void setUnlikeCount(int unlikeCount) { // this.unlikeCount = unlikeCount; // } // // public List<Comment> getComments() { // return comments; // } // // public void setComments(List<Comment> comments) { // this.comments = comments; // } // // @Override // public String toString() { // return "TreeholeComment{" + // "likeCount=" + likeCount + // ", unlikeCount=" + unlikeCount + // ", comments=" + comments + // '}'; // } // // public static class Comment { // String uniquecode; // String name; // String dt; // String comment; // String imei; // // public String getUniquecode() { // return uniquecode; // } // // public void setUniquecode(String uniquecode) { // this.uniquecode = uniquecode; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getDt() { // return dt; // } // // public void setDt(String dt) { // this.dt = dt; // } // // public String getComment() { // return comment; // } // // public void setComment(String comment) { // this.comment = comment; // } // // public String getImei() { // return imei; // } // // public void setImei(String imei) { // this.imei = imei; // } // // @Override // public String toString() { // return "Comment{" + // "uniquecode='" + uniquecode + '\'' + // ", name='" + name + '\'' + // ", dt='" + dt + '\'' + // ", comment='" + comment + '\'' + // ", imei='" + imei + '\'' + // '}'; // } // } // } // // Path: app/src/main/java/com/leelit/stuer/bean/TreeholeInfo.java // public class TreeholeInfo { // String datetime; // // String state; // // String picAddress; // // String uniquecode; // // @Override // public String toString() { // return "TreeholeInfo{" + // "datetime='" + datetime + '\'' + // ", state='" + state + '\'' + // ", picAddress='" + picAddress + '\'' + // ", uniquecode='" + uniquecode + '\'' + // '}'; // } // // public String getDatetime() { // return datetime; // } // // public void setDatetime(String datetime) { // this.datetime = datetime; // } // // public String getState() { // return state; // } // // public void setState(String state) { // this.state = state; // } // // public String getPicAddress() { // return picAddress; // } // // public void setPicAddress(String picAddress) { // this.picAddress = picAddress; // } // // public String getUniquecode() { // return uniquecode; // } // // public void setUniquecode(String uniquecode) { // this.uniquecode = uniquecode; // } // }
import com.leelit.stuer.bean.TreeholeComment; import com.leelit.stuer.bean.TreeholeInfo; import java.util.List; import okhttp3.RequestBody; import okhttp3.ResponseBody; import retrofit2.http.Body; import retrofit2.http.GET; import retrofit2.http.Multipart; import retrofit2.http.POST; import retrofit2.http.Part; import retrofit2.http.Query; import rx.Observable;
package com.leelit.stuer.module_treehole.model; /** * Created by Leelit on 2016/3/24. */ public interface TreeholeService { @POST("create")
// Path: app/src/main/java/com/leelit/stuer/bean/TreeholeComment.java // public class TreeholeComment { // // int likeCount; // // int unlikeCount; // // List<Comment> comments; // // public int getLikeCount() { // return likeCount; // } // // public void setLikeCount(int likeCount) { // this.likeCount = likeCount; // } // // public int getUnlikeCount() { // return unlikeCount; // } // // public void setUnlikeCount(int unlikeCount) { // this.unlikeCount = unlikeCount; // } // // public List<Comment> getComments() { // return comments; // } // // public void setComments(List<Comment> comments) { // this.comments = comments; // } // // @Override // public String toString() { // return "TreeholeComment{" + // "likeCount=" + likeCount + // ", unlikeCount=" + unlikeCount + // ", comments=" + comments + // '}'; // } // // public static class Comment { // String uniquecode; // String name; // String dt; // String comment; // String imei; // // public String getUniquecode() { // return uniquecode; // } // // public void setUniquecode(String uniquecode) { // this.uniquecode = uniquecode; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getDt() { // return dt; // } // // public void setDt(String dt) { // this.dt = dt; // } // // public String getComment() { // return comment; // } // // public void setComment(String comment) { // this.comment = comment; // } // // public String getImei() { // return imei; // } // // public void setImei(String imei) { // this.imei = imei; // } // // @Override // public String toString() { // return "Comment{" + // "uniquecode='" + uniquecode + '\'' + // ", name='" + name + '\'' + // ", dt='" + dt + '\'' + // ", comment='" + comment + '\'' + // ", imei='" + imei + '\'' + // '}'; // } // } // } // // Path: app/src/main/java/com/leelit/stuer/bean/TreeholeInfo.java // public class TreeholeInfo { // String datetime; // // String state; // // String picAddress; // // String uniquecode; // // @Override // public String toString() { // return "TreeholeInfo{" + // "datetime='" + datetime + '\'' + // ", state='" + state + '\'' + // ", picAddress='" + picAddress + '\'' + // ", uniquecode='" + uniquecode + '\'' + // '}'; // } // // public String getDatetime() { // return datetime; // } // // public void setDatetime(String datetime) { // this.datetime = datetime; // } // // public String getState() { // return state; // } // // public void setState(String state) { // this.state = state; // } // // public String getPicAddress() { // return picAddress; // } // // public void setPicAddress(String picAddress) { // this.picAddress = picAddress; // } // // public String getUniquecode() { // return uniquecode; // } // // public void setUniquecode(String uniquecode) { // this.uniquecode = uniquecode; // } // } // Path: app/src/main/java/com/leelit/stuer/module_treehole/model/TreeholeService.java import com.leelit.stuer.bean.TreeholeComment; import com.leelit.stuer.bean.TreeholeInfo; import java.util.List; import okhttp3.RequestBody; import okhttp3.ResponseBody; import retrofit2.http.Body; import retrofit2.http.GET; import retrofit2.http.Multipart; import retrofit2.http.POST; import retrofit2.http.Part; import retrofit2.http.Query; import rx.Observable; package com.leelit.stuer.module_treehole.model; /** * Created by Leelit on 2016/3/24. */ public interface TreeholeService { @POST("create")
Observable<ResponseBody> addRecord(@Body TreeholeInfo info);
leelit/STUer-client
app/src/main/java/com/leelit/stuer/module_treehole/model/TreeholeService.java
// Path: app/src/main/java/com/leelit/stuer/bean/TreeholeComment.java // public class TreeholeComment { // // int likeCount; // // int unlikeCount; // // List<Comment> comments; // // public int getLikeCount() { // return likeCount; // } // // public void setLikeCount(int likeCount) { // this.likeCount = likeCount; // } // // public int getUnlikeCount() { // return unlikeCount; // } // // public void setUnlikeCount(int unlikeCount) { // this.unlikeCount = unlikeCount; // } // // public List<Comment> getComments() { // return comments; // } // // public void setComments(List<Comment> comments) { // this.comments = comments; // } // // @Override // public String toString() { // return "TreeholeComment{" + // "likeCount=" + likeCount + // ", unlikeCount=" + unlikeCount + // ", comments=" + comments + // '}'; // } // // public static class Comment { // String uniquecode; // String name; // String dt; // String comment; // String imei; // // public String getUniquecode() { // return uniquecode; // } // // public void setUniquecode(String uniquecode) { // this.uniquecode = uniquecode; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getDt() { // return dt; // } // // public void setDt(String dt) { // this.dt = dt; // } // // public String getComment() { // return comment; // } // // public void setComment(String comment) { // this.comment = comment; // } // // public String getImei() { // return imei; // } // // public void setImei(String imei) { // this.imei = imei; // } // // @Override // public String toString() { // return "Comment{" + // "uniquecode='" + uniquecode + '\'' + // ", name='" + name + '\'' + // ", dt='" + dt + '\'' + // ", comment='" + comment + '\'' + // ", imei='" + imei + '\'' + // '}'; // } // } // } // // Path: app/src/main/java/com/leelit/stuer/bean/TreeholeInfo.java // public class TreeholeInfo { // String datetime; // // String state; // // String picAddress; // // String uniquecode; // // @Override // public String toString() { // return "TreeholeInfo{" + // "datetime='" + datetime + '\'' + // ", state='" + state + '\'' + // ", picAddress='" + picAddress + '\'' + // ", uniquecode='" + uniquecode + '\'' + // '}'; // } // // public String getDatetime() { // return datetime; // } // // public void setDatetime(String datetime) { // this.datetime = datetime; // } // // public String getState() { // return state; // } // // public void setState(String state) { // this.state = state; // } // // public String getPicAddress() { // return picAddress; // } // // public void setPicAddress(String picAddress) { // this.picAddress = picAddress; // } // // public String getUniquecode() { // return uniquecode; // } // // public void setUniquecode(String uniquecode) { // this.uniquecode = uniquecode; // } // }
import com.leelit.stuer.bean.TreeholeComment; import com.leelit.stuer.bean.TreeholeInfo; import java.util.List; import okhttp3.RequestBody; import okhttp3.ResponseBody; import retrofit2.http.Body; import retrofit2.http.GET; import retrofit2.http.Multipart; import retrofit2.http.POST; import retrofit2.http.Part; import retrofit2.http.Query; import rx.Observable;
package com.leelit.stuer.module_treehole.model; /** * Created by Leelit on 2016/3/24. */ public interface TreeholeService { @POST("create") Observable<ResponseBody> addRecord(@Body TreeholeInfo info); @Multipart @POST("create/photo") Observable<ResponseBody> addRecordWithPhoto(@Part("photo") RequestBody photo, @Part("info") TreeholeInfo info); @GET("query") Observable<List<TreeholeInfo>> getNewerData(@Query("newer") String newer); @GET("like") Observable<ResponseBody> doLikeJob(@Query("uniquecode") String uniquecode, @Query("imei") String imei, @Query("islike") String isLike); @GET("unlike") Observable<ResponseBody> doUnlikeJob(@Query("uniquecode") String uniquecode, @Query("imei") String imei, @Query("isunlike") String isUnlike); @POST("comment")
// Path: app/src/main/java/com/leelit/stuer/bean/TreeholeComment.java // public class TreeholeComment { // // int likeCount; // // int unlikeCount; // // List<Comment> comments; // // public int getLikeCount() { // return likeCount; // } // // public void setLikeCount(int likeCount) { // this.likeCount = likeCount; // } // // public int getUnlikeCount() { // return unlikeCount; // } // // public void setUnlikeCount(int unlikeCount) { // this.unlikeCount = unlikeCount; // } // // public List<Comment> getComments() { // return comments; // } // // public void setComments(List<Comment> comments) { // this.comments = comments; // } // // @Override // public String toString() { // return "TreeholeComment{" + // "likeCount=" + likeCount + // ", unlikeCount=" + unlikeCount + // ", comments=" + comments + // '}'; // } // // public static class Comment { // String uniquecode; // String name; // String dt; // String comment; // String imei; // // public String getUniquecode() { // return uniquecode; // } // // public void setUniquecode(String uniquecode) { // this.uniquecode = uniquecode; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getDt() { // return dt; // } // // public void setDt(String dt) { // this.dt = dt; // } // // public String getComment() { // return comment; // } // // public void setComment(String comment) { // this.comment = comment; // } // // public String getImei() { // return imei; // } // // public void setImei(String imei) { // this.imei = imei; // } // // @Override // public String toString() { // return "Comment{" + // "uniquecode='" + uniquecode + '\'' + // ", name='" + name + '\'' + // ", dt='" + dt + '\'' + // ", comment='" + comment + '\'' + // ", imei='" + imei + '\'' + // '}'; // } // } // } // // Path: app/src/main/java/com/leelit/stuer/bean/TreeholeInfo.java // public class TreeholeInfo { // String datetime; // // String state; // // String picAddress; // // String uniquecode; // // @Override // public String toString() { // return "TreeholeInfo{" + // "datetime='" + datetime + '\'' + // ", state='" + state + '\'' + // ", picAddress='" + picAddress + '\'' + // ", uniquecode='" + uniquecode + '\'' + // '}'; // } // // public String getDatetime() { // return datetime; // } // // public void setDatetime(String datetime) { // this.datetime = datetime; // } // // public String getState() { // return state; // } // // public void setState(String state) { // this.state = state; // } // // public String getPicAddress() { // return picAddress; // } // // public void setPicAddress(String picAddress) { // this.picAddress = picAddress; // } // // public String getUniquecode() { // return uniquecode; // } // // public void setUniquecode(String uniquecode) { // this.uniquecode = uniquecode; // } // } // Path: app/src/main/java/com/leelit/stuer/module_treehole/model/TreeholeService.java import com.leelit.stuer.bean.TreeholeComment; import com.leelit.stuer.bean.TreeholeInfo; import java.util.List; import okhttp3.RequestBody; import okhttp3.ResponseBody; import retrofit2.http.Body; import retrofit2.http.GET; import retrofit2.http.Multipart; import retrofit2.http.POST; import retrofit2.http.Part; import retrofit2.http.Query; import rx.Observable; package com.leelit.stuer.module_treehole.model; /** * Created by Leelit on 2016/3/24. */ public interface TreeholeService { @POST("create") Observable<ResponseBody> addRecord(@Body TreeholeInfo info); @Multipart @POST("create/photo") Observable<ResponseBody> addRecordWithPhoto(@Part("photo") RequestBody photo, @Part("info") TreeholeInfo info); @GET("query") Observable<List<TreeholeInfo>> getNewerData(@Query("newer") String newer); @GET("like") Observable<ResponseBody> doLikeJob(@Query("uniquecode") String uniquecode, @Query("imei") String imei, @Query("islike") String isLike); @GET("unlike") Observable<ResponseBody> doUnlikeJob(@Query("uniquecode") String uniquecode, @Query("imei") String imei, @Query("isunlike") String isUnlike); @POST("comment")
Observable<ResponseBody> sendComment(@Body TreeholeComment.Comment comment);
leelit/STUer-client
app/src/main/java/com/leelit/stuer/utils/MyPushUtils.java
// Path: app/src/main/java/com/leelit/stuer/MyBusinessActivity.java // public class MyBusinessActivity extends AppCompatActivity { // // @InjectView(R.id.toolbar) // Toolbar mToolbar; // // private int mOrderActivityConstant; // private Fragment mFragment; // // public static boolean needPush = false; // public static String uniquecode = ""; // public static String type = ""; // // @Override // protected void onCreate(Bundle savedInstanceState) { // super.onCreate(savedInstanceState); // setContentView(R.layout.activity_mybusiness); // ButterKnife.inject(this); // UiUtils.setTranslucentStatusBar(this); // if (UiUtils.isNightMode(this)) { // return; // } // // needPush = getIntent().getBooleanExtra("need_push", false); // if (needPush) { // uniquecode = getIntent().getStringExtra("unique_code"); // type = getIntent().getStringExtra("type"); // } // mOrderActivityConstant = getIntent().getIntExtra(MyBusinessConstant.TAG, 1); // // if (mOrderActivityConstant == MyBusinessConstant.CARPOOL) { // mToolbar.setTitle(getString(R.string.mine_title_1)); // mFragment = new MyCarpoolFragment(); // } else if (mOrderActivityConstant == MyBusinessConstant.DATE) { // mToolbar.setTitle(getString(R.string.mine_title_2)); // mFragment = new MyDateFragment(); // } else if (mOrderActivityConstant == MyBusinessConstant.SELL) { // mToolbar.setTitle("我的转让"); // mFragment = new MySellFragment(); // } // // // setSupportActionBar(mToolbar); // mToolbar.setNavigationIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha); // mToolbar.setNavigationOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // finish(); // } // }); // // getSupportFragmentManager(). // beginTransaction(). // replace(R.id.content, mFragment). // commit(); // // } // // } // // Path: app/src/main/java/com/leelit/stuer/bean/BaseInfo.java // public class BaseInfo { // // int id; // String name; // String tel; // String shortTel; // String wechat; // String date; // String time; // String temporaryCount; // String flag; // String imei; // String uniquecode; // // @Override // public String toString() { // return "CarpoolingInfo{" + // "id=" + id + // ", name='" + name + '\'' + // ", tel='" + tel + '\'' + // ", shortTel='" + shortTel + '\'' + // ", wechat='" + wechat + '\'' + // ", date='" + date + '\'' + // ", time='" + time + '\'' + // ", temporaryCount='" + temporaryCount + '\'' + // ", flag='" + flag + '\'' + // ", imei='" + imei + '\'' + // ", uniquecode='" + uniquecode + '\'' + // '}'; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getTel() { // return tel; // } // // public void setTel(String tel) { // this.tel = tel; // } // // public String getShortTel() { // return shortTel; // } // // public void setShortTel(String shortTel) { // this.shortTel = shortTel; // } // // public String getWechat() { // return wechat; // } // // public void setWechat(String wechat) { // this.wechat = wechat; // } // // public String getDate() { // return date; // } // // public void setDate(String date) { // this.date = date; // } // // public String getTime() { // return time; // } // // public void setTime(String time) { // this.time = time; // } // // public String getTemporaryCount() { // return temporaryCount; // } // // public void setTemporaryCount(String temporaryCount) { // this.temporaryCount = temporaryCount; // } // // public String getFlag() { // return flag; // } // // public void setFlag(String flag) { // this.flag = flag; // } // // public String getImei() { // return imei; // } // // public void setImei(String imei) { // this.imei = imei; // } // // // public String getUniquecode() { // return uniquecode; // } // // public void setUniquecode(String uniquecode) { // this.uniquecode = uniquecode; // } // // public boolean completedAllInfo() { // return (!TextUtils.isEmpty(name) && // !TextUtils.isEmpty(tel) && // !TextUtils.isEmpty(shortTel) && // !TextUtils.isEmpty(wechat) && // !TextUtils.isEmpty(temporaryCount) && // !TextUtils.isEmpty(date) && // !TextUtils.isEmpty(time) && // !TextUtils.isEmpty(flag)); // } // }
import com.leelit.stuer.MyBusinessActivity; import com.leelit.stuer.bean.BaseInfo; import java.util.List; import java.util.concurrent.Executors;
package com.leelit.stuer.utils; /** * Created by Leelit on 2016/4/23. */ public class MyPushUtils { public static void doPush(List<List<? extends BaseInfo>> allList) {
// Path: app/src/main/java/com/leelit/stuer/MyBusinessActivity.java // public class MyBusinessActivity extends AppCompatActivity { // // @InjectView(R.id.toolbar) // Toolbar mToolbar; // // private int mOrderActivityConstant; // private Fragment mFragment; // // public static boolean needPush = false; // public static String uniquecode = ""; // public static String type = ""; // // @Override // protected void onCreate(Bundle savedInstanceState) { // super.onCreate(savedInstanceState); // setContentView(R.layout.activity_mybusiness); // ButterKnife.inject(this); // UiUtils.setTranslucentStatusBar(this); // if (UiUtils.isNightMode(this)) { // return; // } // // needPush = getIntent().getBooleanExtra("need_push", false); // if (needPush) { // uniquecode = getIntent().getStringExtra("unique_code"); // type = getIntent().getStringExtra("type"); // } // mOrderActivityConstant = getIntent().getIntExtra(MyBusinessConstant.TAG, 1); // // if (mOrderActivityConstant == MyBusinessConstant.CARPOOL) { // mToolbar.setTitle(getString(R.string.mine_title_1)); // mFragment = new MyCarpoolFragment(); // } else if (mOrderActivityConstant == MyBusinessConstant.DATE) { // mToolbar.setTitle(getString(R.string.mine_title_2)); // mFragment = new MyDateFragment(); // } else if (mOrderActivityConstant == MyBusinessConstant.SELL) { // mToolbar.setTitle("我的转让"); // mFragment = new MySellFragment(); // } // // // setSupportActionBar(mToolbar); // mToolbar.setNavigationIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha); // mToolbar.setNavigationOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // finish(); // } // }); // // getSupportFragmentManager(). // beginTransaction(). // replace(R.id.content, mFragment). // commit(); // // } // // } // // Path: app/src/main/java/com/leelit/stuer/bean/BaseInfo.java // public class BaseInfo { // // int id; // String name; // String tel; // String shortTel; // String wechat; // String date; // String time; // String temporaryCount; // String flag; // String imei; // String uniquecode; // // @Override // public String toString() { // return "CarpoolingInfo{" + // "id=" + id + // ", name='" + name + '\'' + // ", tel='" + tel + '\'' + // ", shortTel='" + shortTel + '\'' + // ", wechat='" + wechat + '\'' + // ", date='" + date + '\'' + // ", time='" + time + '\'' + // ", temporaryCount='" + temporaryCount + '\'' + // ", flag='" + flag + '\'' + // ", imei='" + imei + '\'' + // ", uniquecode='" + uniquecode + '\'' + // '}'; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getTel() { // return tel; // } // // public void setTel(String tel) { // this.tel = tel; // } // // public String getShortTel() { // return shortTel; // } // // public void setShortTel(String shortTel) { // this.shortTel = shortTel; // } // // public String getWechat() { // return wechat; // } // // public void setWechat(String wechat) { // this.wechat = wechat; // } // // public String getDate() { // return date; // } // // public void setDate(String date) { // this.date = date; // } // // public String getTime() { // return time; // } // // public void setTime(String time) { // this.time = time; // } // // public String getTemporaryCount() { // return temporaryCount; // } // // public void setTemporaryCount(String temporaryCount) { // this.temporaryCount = temporaryCount; // } // // public String getFlag() { // return flag; // } // // public void setFlag(String flag) { // this.flag = flag; // } // // public String getImei() { // return imei; // } // // public void setImei(String imei) { // this.imei = imei; // } // // // public String getUniquecode() { // return uniquecode; // } // // public void setUniquecode(String uniquecode) { // this.uniquecode = uniquecode; // } // // public boolean completedAllInfo() { // return (!TextUtils.isEmpty(name) && // !TextUtils.isEmpty(tel) && // !TextUtils.isEmpty(shortTel) && // !TextUtils.isEmpty(wechat) && // !TextUtils.isEmpty(temporaryCount) && // !TextUtils.isEmpty(date) && // !TextUtils.isEmpty(time) && // !TextUtils.isEmpty(flag)); // } // } // Path: app/src/main/java/com/leelit/stuer/utils/MyPushUtils.java import com.leelit.stuer.MyBusinessActivity; import com.leelit.stuer.bean.BaseInfo; import java.util.List; import java.util.concurrent.Executors; package com.leelit.stuer.utils; /** * Created by Leelit on 2016/4/23. */ public class MyPushUtils { public static void doPush(List<List<? extends BaseInfo>> allList) {
String uniquecode = MyBusinessActivity.uniquecode;
leelit/STUer-client
app/src/main/java/com/leelit/stuer/module_sell/model/SellService.java
// Path: app/src/main/java/com/leelit/stuer/bean/SellInfo.java // public class SellInfo { // int id; // String name; // String tel; // String shortTel; // String wechat; // String datetime; // String imei; // String picAddress; // String state; // String uniquecode; // attention 这里的flag和carpool/date模块不同,唯一订单号,相当于前两个的uniquecode // String status; // on // off // // @Override // public String toString() { // return "SellInfo{" + // "id=" + id + // ", name='" + name + '\'' + // ", tel='" + tel + '\'' + // ", shortTel='" + shortTel + '\'' + // ", wechat='" + wechat + '\'' + // ", datetime='" + datetime + '\'' + // ", imei='" + imei + '\'' + // ", picAddress='" + picAddress + '\'' + // ", state='" + state + '\'' + // ", uniquecode='" + uniquecode + '\'' + // ", status='" + status + '\'' + // '}'; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getTel() { // return tel; // } // // public void setTel(String tel) { // this.tel = tel; // } // // public String getShortTel() { // return shortTel; // } // // public void setShortTel(String shortTel) { // this.shortTel = shortTel; // } // // public String getWechat() { // return wechat; // } // // public void setWechat(String wechat) { // this.wechat = wechat; // } // // public String getImei() { // return imei; // } // // public void setImei(String imei) { // this.imei = imei; // } // // public String getPicAddress() { // return picAddress; // } // // public void setPicAddress(String picAddress) { // this.picAddress = picAddress; // } // // public String getState() { // return state; // } // // public void setState(String state) { // this.state = state; // } // // public String getUniquecode() { // return uniquecode; // } // // public void setUniquecode(String uniquecode) { // this.uniquecode = uniquecode; // } // // public String getStatus() { // return status; // } // // public void setStatus(String status) { // this.status = status; // } // // public String getDatetime() { // return datetime; // } // // public void setDatetime(String datetime) { // this.datetime = datetime; // } // }
import com.leelit.stuer.bean.SellInfo; import java.util.List; import okhttp3.RequestBody; import okhttp3.ResponseBody; import retrofit2.http.Body; import retrofit2.http.GET; import retrofit2.http.Multipart; import retrofit2.http.POST; import retrofit2.http.Part; import retrofit2.http.Query; import rx.Observable;
package com.leelit.stuer.module_sell.model; public interface SellService { @POST("create")
// Path: app/src/main/java/com/leelit/stuer/bean/SellInfo.java // public class SellInfo { // int id; // String name; // String tel; // String shortTel; // String wechat; // String datetime; // String imei; // String picAddress; // String state; // String uniquecode; // attention 这里的flag和carpool/date模块不同,唯一订单号,相当于前两个的uniquecode // String status; // on // off // // @Override // public String toString() { // return "SellInfo{" + // "id=" + id + // ", name='" + name + '\'' + // ", tel='" + tel + '\'' + // ", shortTel='" + shortTel + '\'' + // ", wechat='" + wechat + '\'' + // ", datetime='" + datetime + '\'' + // ", imei='" + imei + '\'' + // ", picAddress='" + picAddress + '\'' + // ", state='" + state + '\'' + // ", uniquecode='" + uniquecode + '\'' + // ", status='" + status + '\'' + // '}'; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getTel() { // return tel; // } // // public void setTel(String tel) { // this.tel = tel; // } // // public String getShortTel() { // return shortTel; // } // // public void setShortTel(String shortTel) { // this.shortTel = shortTel; // } // // public String getWechat() { // return wechat; // } // // public void setWechat(String wechat) { // this.wechat = wechat; // } // // public String getImei() { // return imei; // } // // public void setImei(String imei) { // this.imei = imei; // } // // public String getPicAddress() { // return picAddress; // } // // public void setPicAddress(String picAddress) { // this.picAddress = picAddress; // } // // public String getState() { // return state; // } // // public void setState(String state) { // this.state = state; // } // // public String getUniquecode() { // return uniquecode; // } // // public void setUniquecode(String uniquecode) { // this.uniquecode = uniquecode; // } // // public String getStatus() { // return status; // } // // public void setStatus(String status) { // this.status = status; // } // // public String getDatetime() { // return datetime; // } // // public void setDatetime(String datetime) { // this.datetime = datetime; // } // } // Path: app/src/main/java/com/leelit/stuer/module_sell/model/SellService.java import com.leelit.stuer.bean.SellInfo; import java.util.List; import okhttp3.RequestBody; import okhttp3.ResponseBody; import retrofit2.http.Body; import retrofit2.http.GET; import retrofit2.http.Multipart; import retrofit2.http.POST; import retrofit2.http.Part; import retrofit2.http.Query; import rx.Observable; package com.leelit.stuer.module_sell.model; public interface SellService { @POST("create")
Observable<ResponseBody> addRecord(@Body SellInfo baseInfo);
leelit/STUer-client
app/src/main/java/com/leelit/stuer/base_view/BaseListFragment.java
// Path: app/src/main/java/com/leelit/stuer/base_adapters/BaseListAdapter.java // public abstract class BaseListAdapter<VH extends RecyclerView.ViewHolder> extends RecyclerView.Adapter<VH> { // protected OnItemClickListener mOnItemClickListener; // // public void setOnItemClickListener(OnItemClickListener onItemClickListener) { // mOnItemClickListener = onItemClickListener; // } // // public interface OnItemClickListener { // void onItemClick(View view, int position); // } // // public abstract void removeData(int position); // }
import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Toast; import com.leelit.stuer.R; import com.leelit.stuer.base_adapters.BaseListAdapter;
package com.leelit.stuer.base_view; /** * Created by Leelit on 2015/12/6. * <p/> * only contains a SwipeRefreshLayout & RecyclerView */ public abstract class BaseListFragment extends Fragment { protected RecyclerView mRecyclerView; protected SwipeRefreshLayout mSwipeRefreshLayout;
// Path: app/src/main/java/com/leelit/stuer/base_adapters/BaseListAdapter.java // public abstract class BaseListAdapter<VH extends RecyclerView.ViewHolder> extends RecyclerView.Adapter<VH> { // protected OnItemClickListener mOnItemClickListener; // // public void setOnItemClickListener(OnItemClickListener onItemClickListener) { // mOnItemClickListener = onItemClickListener; // } // // public interface OnItemClickListener { // void onItemClick(View view, int position); // } // // public abstract void removeData(int position); // } // Path: app/src/main/java/com/leelit/stuer/base_view/BaseListFragment.java import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Toast; import com.leelit.stuer.R; import com.leelit.stuer.base_adapters.BaseListAdapter; package com.leelit.stuer.base_view; /** * Created by Leelit on 2015/12/6. * <p/> * only contains a SwipeRefreshLayout & RecyclerView */ public abstract class BaseListFragment extends Fragment { protected RecyclerView mRecyclerView; protected SwipeRefreshLayout mSwipeRefreshLayout;
protected BaseListAdapter mAdapter;
leelit/STUer-client
app/src/main/java/com/leelit/stuer/utils/ScreenUtils.java
// Path: app/src/main/java/com/leelit/stuer/MyApplication.java // public class MyApplication extends Application { // // public static final String VERSION = "1.1.0"; // // public static Context context; // // @Override // public void onCreate() { // super.onCreate(); // context = getApplicationContext(); // } // }
import com.leelit.stuer.MyApplication;
package com.leelit.stuer.utils; /** * Created by Leelit on 2016/3/17. */ public class ScreenUtils { public static int dp2px(float dp) {
// Path: app/src/main/java/com/leelit/stuer/MyApplication.java // public class MyApplication extends Application { // // public static final String VERSION = "1.1.0"; // // public static Context context; // // @Override // public void onCreate() { // super.onCreate(); // context = getApplicationContext(); // } // } // Path: app/src/main/java/com/leelit/stuer/utils/ScreenUtils.java import com.leelit.stuer.MyApplication; package com.leelit.stuer.utils; /** * Created by Leelit on 2016/3/17. */ public class ScreenUtils { public static int dp2px(float dp) {
float scale = MyApplication.context.getResources().getDisplayMetrics().density;
vogellacompany/eclipse4book
com.vogella.tasks.services/src/com/vogella/tasks/services/internal/JSONUtil.java
// Path: com.vogella.tasks.model/src/com/vogella/tasks/model/Task.java // public class Task { // // private transient PropertyChangeSupport changes = new PropertyChangeSupport(this); // // public static final String FIELD_ID = "id"; // public static final String FIELD_SUMMARY = "summary"; // public static final String FIELD_DESCRIPTION = "description"; // public static final String FIELD_DONE = "done"; // public static final String FIELD_DUEDATE = "dueDate"; // // private final long id; // private String summary = ""; // private String description = ""; // private boolean done = false; // private LocalDate dueDate = LocalDate.now(); // // public Task(long id, String summary, String description, boolean done, LocalDate dueDate) { // this.id = id; // this.summary = summary; // this.description = description; // this.done = done; // this.dueDate = dueDate; // } // // public Task(long id) { // this.id = id; // } // // public String getSummary() { // return summary; // } // // public void setSummary(String summary) { // changes.firePropertyChange(FIELD_SUMMARY, this.summary, this.summary = summary); // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // changes.firePropertyChange(FIELD_DESCRIPTION, this.description, this.description = description); // } // public boolean isDone() { // return done; // } // // public void setDone(boolean isDone) { // changes.firePropertyChange(FIELD_DONE, this.done, this.done = isDone); // } // // public LocalDate getDueDate() { // return dueDate; // } // // public void setDueDate(LocalDate dueDate) { // changes.firePropertyChange(FIELD_DUEDATE, this.dueDate, this.dueDate = dueDate); // } // // public long getId() { // return id; // } // // // @Override // public int hashCode() { // return Objects.hash(id); // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // Task other = (Task) obj; // return id == other.id; // } // // @Override // public String toString() { // return "Task [id=" + id + ", summary=" + summary + "]"; // } // // public Task copy() { // return new Task(this.id, this.summary, this.description, this.done, this.dueDate); // } // // public void addPropertyChangeListener(PropertyChangeListener l) { // changes.addPropertyChangeListener(l); // } // // public void removePropertyChangeListener(PropertyChangeListener l) { // changes.removePropertyChangeListener(l); // } // // /** // * Only need for JSON serialization and de-serialization // */ // public void restorePropertyChangeListener() { // if (Objects.isNull(changes)) { // changes = new PropertyChangeSupport(this); // } // } // }
import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; import java.nio.file.StandardOpenOption; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import com.vogella.tasks.model.Task;
package com.vogella.tasks.services.internal; public class JSONUtil { private JSONUtil() { // not to initialize } private static String fileName = "dataFile";
// Path: com.vogella.tasks.model/src/com/vogella/tasks/model/Task.java // public class Task { // // private transient PropertyChangeSupport changes = new PropertyChangeSupport(this); // // public static final String FIELD_ID = "id"; // public static final String FIELD_SUMMARY = "summary"; // public static final String FIELD_DESCRIPTION = "description"; // public static final String FIELD_DONE = "done"; // public static final String FIELD_DUEDATE = "dueDate"; // // private final long id; // private String summary = ""; // private String description = ""; // private boolean done = false; // private LocalDate dueDate = LocalDate.now(); // // public Task(long id, String summary, String description, boolean done, LocalDate dueDate) { // this.id = id; // this.summary = summary; // this.description = description; // this.done = done; // this.dueDate = dueDate; // } // // public Task(long id) { // this.id = id; // } // // public String getSummary() { // return summary; // } // // public void setSummary(String summary) { // changes.firePropertyChange(FIELD_SUMMARY, this.summary, this.summary = summary); // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // changes.firePropertyChange(FIELD_DESCRIPTION, this.description, this.description = description); // } // public boolean isDone() { // return done; // } // // public void setDone(boolean isDone) { // changes.firePropertyChange(FIELD_DONE, this.done, this.done = isDone); // } // // public LocalDate getDueDate() { // return dueDate; // } // // public void setDueDate(LocalDate dueDate) { // changes.firePropertyChange(FIELD_DUEDATE, this.dueDate, this.dueDate = dueDate); // } // // public long getId() { // return id; // } // // // @Override // public int hashCode() { // return Objects.hash(id); // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // Task other = (Task) obj; // return id == other.id; // } // // @Override // public String toString() { // return "Task [id=" + id + ", summary=" + summary + "]"; // } // // public Task copy() { // return new Task(this.id, this.summary, this.description, this.done, this.dueDate); // } // // public void addPropertyChangeListener(PropertyChangeListener l) { // changes.addPropertyChangeListener(l); // } // // public void removePropertyChangeListener(PropertyChangeListener l) { // changes.removePropertyChangeListener(l); // } // // /** // * Only need for JSON serialization and de-serialization // */ // public void restorePropertyChangeListener() { // if (Objects.isNull(changes)) { // changes = new PropertyChangeSupport(this); // } // } // } // Path: com.vogella.tasks.services/src/com/vogella/tasks/services/internal/JSONUtil.java import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; import java.nio.file.StandardOpenOption; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import com.vogella.tasks.model.Task; package com.vogella.tasks.services.internal; public class JSONUtil { private JSONUtil() { // not to initialize } private static String fileName = "dataFile";
public static void saveAsGson(List<Task> tasks) {
vogellacompany/eclipse4book
com.vogella.tasks.ui/src/com/vogella/tasks/ui/parts/TodoDetailsPart.java
// Path: com.vogella.tasks.model/src/com/vogella/tasks/model/Task.java // public class Task { // // private transient PropertyChangeSupport changes = new PropertyChangeSupport(this); // // public static final String FIELD_ID = "id"; // public static final String FIELD_SUMMARY = "summary"; // public static final String FIELD_DESCRIPTION = "description"; // public static final String FIELD_DONE = "done"; // public static final String FIELD_DUEDATE = "dueDate"; // // private final long id; // private String summary = ""; // private String description = ""; // private boolean done = false; // private LocalDate dueDate = LocalDate.now(); // // public Task(long id, String summary, String description, boolean done, LocalDate dueDate) { // this.id = id; // this.summary = summary; // this.description = description; // this.done = done; // this.dueDate = dueDate; // } // // public Task(long id) { // this.id = id; // } // // public String getSummary() { // return summary; // } // // public void setSummary(String summary) { // changes.firePropertyChange(FIELD_SUMMARY, this.summary, this.summary = summary); // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // changes.firePropertyChange(FIELD_DESCRIPTION, this.description, this.description = description); // } // public boolean isDone() { // return done; // } // // public void setDone(boolean isDone) { // changes.firePropertyChange(FIELD_DONE, this.done, this.done = isDone); // } // // public LocalDate getDueDate() { // return dueDate; // } // // public void setDueDate(LocalDate dueDate) { // changes.firePropertyChange(FIELD_DUEDATE, this.dueDate, this.dueDate = dueDate); // } // // public long getId() { // return id; // } // // // @Override // public int hashCode() { // return Objects.hash(id); // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // Task other = (Task) obj; // return id == other.id; // } // // @Override // public String toString() { // return "Task [id=" + id + ", summary=" + summary + "]"; // } // // public Task copy() { // return new Task(this.id, this.summary, this.description, this.done, this.dueDate); // } // // public void addPropertyChangeListener(PropertyChangeListener l) { // changes.addPropertyChangeListener(l); // } // // public void removePropertyChangeListener(PropertyChangeListener l) { // changes.removePropertyChangeListener(l); // } // // /** // * Only need for JSON serialization and de-serialization // */ // public void restorePropertyChangeListener() { // if (Objects.isNull(changes)) { // changes = new PropertyChangeSupport(this); // } // } // } // // Path: com.vogella.tasks.model/src/com/vogella/tasks/model/TaskService.java // public interface TaskService { // // /** // * Get all tasks // */ // List<Task> getAll(); // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // // // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // boolean update(Task task); // // /** // * Updates existing task or create new task // * // * @param task // * @return empty optional if not found, otherwise Optional holder the task // */ // // Optional<Task> get(long id); // // /** // * Deletes the task with the id // * @param id task id to delete // * @return true if task existed and was deleted, false otherwise // */ // boolean delete(long id); // // /** // * Allow to specify a consumer which retrieves all tasks // * // * @param tasksConsumer // */ // // void consume(Consumer<List<Task>> tasksConsumer); // // }
import java.util.HashMap; import java.util.List; import java.util.Map; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; import javax.inject.Inject; import javax.inject.Named; import org.eclipse.core.databinding.Binding; import org.eclipse.core.databinding.DataBindingContext; import org.eclipse.core.databinding.beans.typed.BeanProperties; import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.core.di.annotations.Optional; import org.eclipse.e4.ui.di.Focus; import org.eclipse.e4.ui.di.Persist; import org.eclipse.e4.ui.model.application.ui.basic.MPart; import org.eclipse.e4.ui.services.IServiceConstants; import org.eclipse.jface.databinding.swt.typed.WidgetProperties; import org.eclipse.jface.layout.GridDataFactory; import org.eclipse.jface.widgets.LabelFactory; import org.eclipse.jface.widgets.WidgetFactory; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.DateTime; import org.eclipse.swt.widgets.Text; import com.vogella.tasks.model.Task; import com.vogella.tasks.model.TaskService;
package com.vogella.tasks.ui.parts; public class TodoDetailsPart { private Text txtSummary; private Text txtDescription; private DateTime dateTime; private Button btnDone; // define a new field
// Path: com.vogella.tasks.model/src/com/vogella/tasks/model/Task.java // public class Task { // // private transient PropertyChangeSupport changes = new PropertyChangeSupport(this); // // public static final String FIELD_ID = "id"; // public static final String FIELD_SUMMARY = "summary"; // public static final String FIELD_DESCRIPTION = "description"; // public static final String FIELD_DONE = "done"; // public static final String FIELD_DUEDATE = "dueDate"; // // private final long id; // private String summary = ""; // private String description = ""; // private boolean done = false; // private LocalDate dueDate = LocalDate.now(); // // public Task(long id, String summary, String description, boolean done, LocalDate dueDate) { // this.id = id; // this.summary = summary; // this.description = description; // this.done = done; // this.dueDate = dueDate; // } // // public Task(long id) { // this.id = id; // } // // public String getSummary() { // return summary; // } // // public void setSummary(String summary) { // changes.firePropertyChange(FIELD_SUMMARY, this.summary, this.summary = summary); // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // changes.firePropertyChange(FIELD_DESCRIPTION, this.description, this.description = description); // } // public boolean isDone() { // return done; // } // // public void setDone(boolean isDone) { // changes.firePropertyChange(FIELD_DONE, this.done, this.done = isDone); // } // // public LocalDate getDueDate() { // return dueDate; // } // // public void setDueDate(LocalDate dueDate) { // changes.firePropertyChange(FIELD_DUEDATE, this.dueDate, this.dueDate = dueDate); // } // // public long getId() { // return id; // } // // // @Override // public int hashCode() { // return Objects.hash(id); // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // Task other = (Task) obj; // return id == other.id; // } // // @Override // public String toString() { // return "Task [id=" + id + ", summary=" + summary + "]"; // } // // public Task copy() { // return new Task(this.id, this.summary, this.description, this.done, this.dueDate); // } // // public void addPropertyChangeListener(PropertyChangeListener l) { // changes.addPropertyChangeListener(l); // } // // public void removePropertyChangeListener(PropertyChangeListener l) { // changes.removePropertyChangeListener(l); // } // // /** // * Only need for JSON serialization and de-serialization // */ // public void restorePropertyChangeListener() { // if (Objects.isNull(changes)) { // changes = new PropertyChangeSupport(this); // } // } // } // // Path: com.vogella.tasks.model/src/com/vogella/tasks/model/TaskService.java // public interface TaskService { // // /** // * Get all tasks // */ // List<Task> getAll(); // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // // // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // boolean update(Task task); // // /** // * Updates existing task or create new task // * // * @param task // * @return empty optional if not found, otherwise Optional holder the task // */ // // Optional<Task> get(long id); // // /** // * Deletes the task with the id // * @param id task id to delete // * @return true if task existed and was deleted, false otherwise // */ // boolean delete(long id); // // /** // * Allow to specify a consumer which retrieves all tasks // * // * @param tasksConsumer // */ // // void consume(Consumer<List<Task>> tasksConsumer); // // } // Path: com.vogella.tasks.ui/src/com/vogella/tasks/ui/parts/TodoDetailsPart.java import java.util.HashMap; import java.util.List; import java.util.Map; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; import javax.inject.Inject; import javax.inject.Named; import org.eclipse.core.databinding.Binding; import org.eclipse.core.databinding.DataBindingContext; import org.eclipse.core.databinding.beans.typed.BeanProperties; import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.core.di.annotations.Optional; import org.eclipse.e4.ui.di.Focus; import org.eclipse.e4.ui.di.Persist; import org.eclipse.e4.ui.model.application.ui.basic.MPart; import org.eclipse.e4.ui.services.IServiceConstants; import org.eclipse.jface.databinding.swt.typed.WidgetProperties; import org.eclipse.jface.layout.GridDataFactory; import org.eclipse.jface.widgets.LabelFactory; import org.eclipse.jface.widgets.WidgetFactory; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.DateTime; import org.eclipse.swt.widgets.Text; import com.vogella.tasks.model.Task; import com.vogella.tasks.model.TaskService; package com.vogella.tasks.ui.parts; public class TodoDetailsPart { private Text txtSummary; private Text txtDescription; private DateTime dateTime; private Button btnDone; // define a new field
private java.util.Optional<Task> task = java.util.Optional.ofNullable(null);
vogellacompany/eclipse4book
com.vogella.eclipse.css/src/com/vogella/eclipse/css/internal/CheckboxPropertyHandler.java
// Path: com.vogella.swt.widgets/src/com/vogella/swt/widgets/Checkbox.java // public class Checkbox extends Canvas { // // private List<SelectionListener> selectionListener = new ArrayList<>(); // // private boolean isSelected; // // private String text = ""; // // private Point textExtent; // // private Color checkColor; // // private Color centerColor; // // public Checkbox(Composite parent, int style) { // super(parent, style); // addListeners(); // } // // private void addListeners() { // addPaintListener(e -> { // GC gc = e.gc; // // gc.setAntialias(SWT.ON); // // gc.setBackground(getCenterColor() != null && !getCenterColor().isDisposed() ? getCenterColor() // : getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); // gc.setForeground(getForeground()); // gc.fillRoundRectangle(4, 4, 16, 16, 6, 6); // // gc.drawRoundRectangle(4, 4, 16, 16, 6, 6); // // if (getSelection()) { // gc.setLineWidth(4); // gc.setForeground(getCheckColor() != null && !getCheckColor().isDisposed() ? getCheckColor() // : getDisplay().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND)); // // gc.drawLine(6, 7, 13, 16); // // gc.drawLine(11, 16, 21, 0); // } // // textExtent = gc.textExtent(text); // // gc.setForeground(getForeground()); // gc.setBackground(getBackground()); // gc.drawText(text, 24, 4); // }); // // addListener(SWT.MouseDown, e -> { // setSelection(!getSelection()); // selectionListener.forEach(l -> l.widgetSelected(new SelectionEvent(e))); // redraw(); // }); // } // // @Override // public Point computeSize(int wHint, int hHint, boolean changed) { // checkWidget(); // int textWidth = textExtent != null ? textExtent.x : 0; // return super.computeSize(Math.max(26 + textWidth, wHint), Math.max(26, hHint), changed); // } // // public boolean getSelection() { // checkWidget(); // return isSelected; // } // // public void setSelection(boolean isSelected) { // checkWidget(); // this.isSelected = isSelected; // } // // public void setText(String string) { // checkWidget(); // if (string == null) { // SWT.error(SWT.ERROR_NULL_ARGUMENT); // } // text = string; // // redraw(); // } // // public String getText() { // checkWidget(); // return text; // } // // public void addSelectionListener(SelectionListener listener) { // checkWidget(); // if (null == listener) { // SWT.error(SWT.ERROR_NULL_ARGUMENT); // } // selectionListener.add(listener); // } // // public void removeSelectionListener(SelectionListener listener) { // checkWidget(); // if (null == listener) { // SWT.error(SWT.ERROR_NULL_ARGUMENT); // } // selectionListener.remove(listener); // } // // public Color getCheckColor() { // checkWidget(); // return checkColor; // } // // public void setCheckColor(Color checkColor) { // checkWidget(); // this.checkColor = checkColor; // } // // public Color getCenterColor() { // checkWidget(); // return centerColor; // } // // public void setCenterColor(Color centerColor) { // checkWidget(); // this.centerColor = centerColor; // } // }
import org.eclipse.e4.ui.css.core.dom.properties.ICSSPropertyHandler; import org.eclipse.e4.ui.css.core.dom.properties.converters.ICSSValueConverter; import org.eclipse.e4.ui.css.core.engine.CSSEngine; import org.eclipse.e4.ui.css.swt.properties.AbstractCSSPropertySWTHandler; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.widgets.Control; import org.w3c.dom.css.CSSValue; import com.vogella.swt.widgets.Checkbox;
package com.vogella.eclipse.css.internal; @SuppressWarnings("restriction") public class CheckboxPropertyHandler extends AbstractCSSPropertySWTHandler implements ICSSPropertyHandler { private static final String CHECK_COLOR = "check-color"; private static final String CENTER_COLOR = "center-color"; @Override protected void applyCSSProperty(Control control, String property, CSSValue value, String pseudo, CSSEngine engine) throws Exception {
// Path: com.vogella.swt.widgets/src/com/vogella/swt/widgets/Checkbox.java // public class Checkbox extends Canvas { // // private List<SelectionListener> selectionListener = new ArrayList<>(); // // private boolean isSelected; // // private String text = ""; // // private Point textExtent; // // private Color checkColor; // // private Color centerColor; // // public Checkbox(Composite parent, int style) { // super(parent, style); // addListeners(); // } // // private void addListeners() { // addPaintListener(e -> { // GC gc = e.gc; // // gc.setAntialias(SWT.ON); // // gc.setBackground(getCenterColor() != null && !getCenterColor().isDisposed() ? getCenterColor() // : getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); // gc.setForeground(getForeground()); // gc.fillRoundRectangle(4, 4, 16, 16, 6, 6); // // gc.drawRoundRectangle(4, 4, 16, 16, 6, 6); // // if (getSelection()) { // gc.setLineWidth(4); // gc.setForeground(getCheckColor() != null && !getCheckColor().isDisposed() ? getCheckColor() // : getDisplay().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND)); // // gc.drawLine(6, 7, 13, 16); // // gc.drawLine(11, 16, 21, 0); // } // // textExtent = gc.textExtent(text); // // gc.setForeground(getForeground()); // gc.setBackground(getBackground()); // gc.drawText(text, 24, 4); // }); // // addListener(SWT.MouseDown, e -> { // setSelection(!getSelection()); // selectionListener.forEach(l -> l.widgetSelected(new SelectionEvent(e))); // redraw(); // }); // } // // @Override // public Point computeSize(int wHint, int hHint, boolean changed) { // checkWidget(); // int textWidth = textExtent != null ? textExtent.x : 0; // return super.computeSize(Math.max(26 + textWidth, wHint), Math.max(26, hHint), changed); // } // // public boolean getSelection() { // checkWidget(); // return isSelected; // } // // public void setSelection(boolean isSelected) { // checkWidget(); // this.isSelected = isSelected; // } // // public void setText(String string) { // checkWidget(); // if (string == null) { // SWT.error(SWT.ERROR_NULL_ARGUMENT); // } // text = string; // // redraw(); // } // // public String getText() { // checkWidget(); // return text; // } // // public void addSelectionListener(SelectionListener listener) { // checkWidget(); // if (null == listener) { // SWT.error(SWT.ERROR_NULL_ARGUMENT); // } // selectionListener.add(listener); // } // // public void removeSelectionListener(SelectionListener listener) { // checkWidget(); // if (null == listener) { // SWT.error(SWT.ERROR_NULL_ARGUMENT); // } // selectionListener.remove(listener); // } // // public Color getCheckColor() { // checkWidget(); // return checkColor; // } // // public void setCheckColor(Color checkColor) { // checkWidget(); // this.checkColor = checkColor; // } // // public Color getCenterColor() { // checkWidget(); // return centerColor; // } // // public void setCenterColor(Color centerColor) { // checkWidget(); // this.centerColor = centerColor; // } // } // Path: com.vogella.eclipse.css/src/com/vogella/eclipse/css/internal/CheckboxPropertyHandler.java import org.eclipse.e4.ui.css.core.dom.properties.ICSSPropertyHandler; import org.eclipse.e4.ui.css.core.dom.properties.converters.ICSSValueConverter; import org.eclipse.e4.ui.css.core.engine.CSSEngine; import org.eclipse.e4.ui.css.swt.properties.AbstractCSSPropertySWTHandler; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.widgets.Control; import org.w3c.dom.css.CSSValue; import com.vogella.swt.widgets.Checkbox; package com.vogella.eclipse.css.internal; @SuppressWarnings("restriction") public class CheckboxPropertyHandler extends AbstractCSSPropertySWTHandler implements ICSSPropertyHandler { private static final String CHECK_COLOR = "check-color"; private static final String CENTER_COLOR = "center-color"; @Override protected void applyCSSProperty(Control control, String property, CSSValue value, String pseudo, CSSEngine engine) throws Exception {
if (control instanceof Checkbox) {
vogellacompany/eclipse4book
com.vogella.tasks.services/src/com/vogella/tasks/services/internal/TransientTaskServiceImpl.java
// Path: com.vogella.tasks.events/src/com/vogella/tasks/events/TaskEventConstants.java // public interface TaskEventConstants { // // // topic identifier for all topics // String TOPIC_TASKS = "TOPIC_TASKS"; // // // this key can only be used for event registration, you cannot // // send out generic events // String TOPIC_TASKS_ALLTOPICS = "TOPIC_TASKS/*"; // // String TOPIC_TASKS_CHANGED = "TOPIC_TASKS/CHANGED"; // // String TOPIC_TASKS_NEW = "TOPIC_TASKS/TASKS/NEW"; // // String TOPIC_TASKS_DELETE = "TOPIC_TASKS/TASKS/DELETED"; // // String TOPIC_TASKS_UPDATE = "TOPIC_TASKS/TASKS/UPDATED"; // } // // Path: com.vogella.tasks.model/src/com/vogella/tasks/model/Task.java // public class Task { // // private transient PropertyChangeSupport changes = new PropertyChangeSupport(this); // // public static final String FIELD_ID = "id"; // public static final String FIELD_SUMMARY = "summary"; // public static final String FIELD_DESCRIPTION = "description"; // public static final String FIELD_DONE = "done"; // public static final String FIELD_DUEDATE = "dueDate"; // // private final long id; // private String summary = ""; // private String description = ""; // private boolean done = false; // private LocalDate dueDate = LocalDate.now(); // // public Task(long id, String summary, String description, boolean done, LocalDate dueDate) { // this.id = id; // this.summary = summary; // this.description = description; // this.done = done; // this.dueDate = dueDate; // } // // public Task(long id) { // this.id = id; // } // // public String getSummary() { // return summary; // } // // public void setSummary(String summary) { // changes.firePropertyChange(FIELD_SUMMARY, this.summary, this.summary = summary); // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // changes.firePropertyChange(FIELD_DESCRIPTION, this.description, this.description = description); // } // public boolean isDone() { // return done; // } // // public void setDone(boolean isDone) { // changes.firePropertyChange(FIELD_DONE, this.done, this.done = isDone); // } // // public LocalDate getDueDate() { // return dueDate; // } // // public void setDueDate(LocalDate dueDate) { // changes.firePropertyChange(FIELD_DUEDATE, this.dueDate, this.dueDate = dueDate); // } // // public long getId() { // return id; // } // // // @Override // public int hashCode() { // return Objects.hash(id); // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // Task other = (Task) obj; // return id == other.id; // } // // @Override // public String toString() { // return "Task [id=" + id + ", summary=" + summary + "]"; // } // // public Task copy() { // return new Task(this.id, this.summary, this.description, this.done, this.dueDate); // } // // public void addPropertyChangeListener(PropertyChangeListener l) { // changes.addPropertyChangeListener(l); // } // // public void removePropertyChangeListener(PropertyChangeListener l) { // changes.removePropertyChangeListener(l); // } // // /** // * Only need for JSON serialization and de-serialization // */ // public void restorePropertyChangeListener() { // if (Objects.isNull(changes)) { // changes = new PropertyChangeSupport(this); // } // } // } // // Path: com.vogella.tasks.model/src/com/vogella/tasks/model/TaskService.java // public interface TaskService { // // /** // * Get all tasks // */ // List<Task> getAll(); // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // // // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // boolean update(Task task); // // /** // * Updates existing task or create new task // * // * @param task // * @return empty optional if not found, otherwise Optional holder the task // */ // // Optional<Task> get(long id); // // /** // * Deletes the task with the id // * @param id task id to delete // * @return true if task existed and was deleted, false otherwise // */ // boolean delete(long id); // // /** // * Allow to specify a consumer which retrieves all tasks // * // * @param tasksConsumer // */ // // void consume(Consumer<List<Task>> tasksConsumer); // // }
import java.time.LocalDate; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Consumer; import java.util.stream.Collectors; import javax.inject.Inject; import org.eclipse.e4.core.services.events.IEventBroker; import com.vogella.tasks.events.TaskEventConstants; import com.vogella.tasks.model.Task; import com.vogella.tasks.model.TaskService;
package com.vogella.tasks.services.internal; public class TransientTaskServiceImpl implements TaskService { @Inject private IEventBroker broker; private static AtomicInteger current = new AtomicInteger(1);
// Path: com.vogella.tasks.events/src/com/vogella/tasks/events/TaskEventConstants.java // public interface TaskEventConstants { // // // topic identifier for all topics // String TOPIC_TASKS = "TOPIC_TASKS"; // // // this key can only be used for event registration, you cannot // // send out generic events // String TOPIC_TASKS_ALLTOPICS = "TOPIC_TASKS/*"; // // String TOPIC_TASKS_CHANGED = "TOPIC_TASKS/CHANGED"; // // String TOPIC_TASKS_NEW = "TOPIC_TASKS/TASKS/NEW"; // // String TOPIC_TASKS_DELETE = "TOPIC_TASKS/TASKS/DELETED"; // // String TOPIC_TASKS_UPDATE = "TOPIC_TASKS/TASKS/UPDATED"; // } // // Path: com.vogella.tasks.model/src/com/vogella/tasks/model/Task.java // public class Task { // // private transient PropertyChangeSupport changes = new PropertyChangeSupport(this); // // public static final String FIELD_ID = "id"; // public static final String FIELD_SUMMARY = "summary"; // public static final String FIELD_DESCRIPTION = "description"; // public static final String FIELD_DONE = "done"; // public static final String FIELD_DUEDATE = "dueDate"; // // private final long id; // private String summary = ""; // private String description = ""; // private boolean done = false; // private LocalDate dueDate = LocalDate.now(); // // public Task(long id, String summary, String description, boolean done, LocalDate dueDate) { // this.id = id; // this.summary = summary; // this.description = description; // this.done = done; // this.dueDate = dueDate; // } // // public Task(long id) { // this.id = id; // } // // public String getSummary() { // return summary; // } // // public void setSummary(String summary) { // changes.firePropertyChange(FIELD_SUMMARY, this.summary, this.summary = summary); // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // changes.firePropertyChange(FIELD_DESCRIPTION, this.description, this.description = description); // } // public boolean isDone() { // return done; // } // // public void setDone(boolean isDone) { // changes.firePropertyChange(FIELD_DONE, this.done, this.done = isDone); // } // // public LocalDate getDueDate() { // return dueDate; // } // // public void setDueDate(LocalDate dueDate) { // changes.firePropertyChange(FIELD_DUEDATE, this.dueDate, this.dueDate = dueDate); // } // // public long getId() { // return id; // } // // // @Override // public int hashCode() { // return Objects.hash(id); // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // Task other = (Task) obj; // return id == other.id; // } // // @Override // public String toString() { // return "Task [id=" + id + ", summary=" + summary + "]"; // } // // public Task copy() { // return new Task(this.id, this.summary, this.description, this.done, this.dueDate); // } // // public void addPropertyChangeListener(PropertyChangeListener l) { // changes.addPropertyChangeListener(l); // } // // public void removePropertyChangeListener(PropertyChangeListener l) { // changes.removePropertyChangeListener(l); // } // // /** // * Only need for JSON serialization and de-serialization // */ // public void restorePropertyChangeListener() { // if (Objects.isNull(changes)) { // changes = new PropertyChangeSupport(this); // } // } // } // // Path: com.vogella.tasks.model/src/com/vogella/tasks/model/TaskService.java // public interface TaskService { // // /** // * Get all tasks // */ // List<Task> getAll(); // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // // // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // boolean update(Task task); // // /** // * Updates existing task or create new task // * // * @param task // * @return empty optional if not found, otherwise Optional holder the task // */ // // Optional<Task> get(long id); // // /** // * Deletes the task with the id // * @param id task id to delete // * @return true if task existed and was deleted, false otherwise // */ // boolean delete(long id); // // /** // * Allow to specify a consumer which retrieves all tasks // * // * @param tasksConsumer // */ // // void consume(Consumer<List<Task>> tasksConsumer); // // } // Path: com.vogella.tasks.services/src/com/vogella/tasks/services/internal/TransientTaskServiceImpl.java import java.time.LocalDate; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Consumer; import java.util.stream.Collectors; import javax.inject.Inject; import org.eclipse.e4.core.services.events.IEventBroker; import com.vogella.tasks.events.TaskEventConstants; import com.vogella.tasks.model.Task; import com.vogella.tasks.model.TaskService; package com.vogella.tasks.services.internal; public class TransientTaskServiceImpl implements TaskService { @Inject private IEventBroker broker; private static AtomicInteger current = new AtomicInteger(1);
private List<Task> tasks;
vogellacompany/eclipse4book
com.vogella.tasks.services/src/com/vogella/tasks/services/internal/TaskServiceContextFunction.java
// Path: com.vogella.tasks.model/src/com/vogella/tasks/model/TaskService.java // public interface TaskService { // // /** // * Get all tasks // */ // List<Task> getAll(); // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // // // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // boolean update(Task task); // // /** // * Updates existing task or create new task // * // * @param task // * @return empty optional if not found, otherwise Optional holder the task // */ // // Optional<Task> get(long id); // // /** // * Deletes the task with the id // * @param id task id to delete // * @return true if task existed and was deleted, false otherwise // */ // boolean delete(long id); // // /** // * Allow to specify a consumer which retrieves all tasks // * // * @param tasksConsumer // */ // // void consume(Consumer<List<Task>> tasksConsumer); // // }
import org.eclipse.e4.core.contexts.ContextFunction; import org.eclipse.e4.core.contexts.ContextInjectionFactory; import org.eclipse.e4.core.contexts.IContextFunction; import org.eclipse.e4.core.contexts.IEclipseContext; import org.eclipse.e4.ui.model.application.MApplication; import org.osgi.service.component.annotations.Component; import com.vogella.tasks.model.TaskService;
package com.vogella.tasks.services.internal; // TODO register this thing for the context key com.vogella.tasks.model.TaskService @Component(service = IContextFunction.class, property = "service.context.key=com.vogella.tasks.model.TaskService") public class TaskServiceContextFunction extends ContextFunction { @Override public Object compute(IEclipseContext context, String contextKey) { var make = ContextInjectionFactory.make(TransientTaskServiceImpl.class, context); MApplication mApplication = context.get(MApplication.class);
// Path: com.vogella.tasks.model/src/com/vogella/tasks/model/TaskService.java // public interface TaskService { // // /** // * Get all tasks // */ // List<Task> getAll(); // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // // // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // boolean update(Task task); // // /** // * Updates existing task or create new task // * // * @param task // * @return empty optional if not found, otherwise Optional holder the task // */ // // Optional<Task> get(long id); // // /** // * Deletes the task with the id // * @param id task id to delete // * @return true if task existed and was deleted, false otherwise // */ // boolean delete(long id); // // /** // * Allow to specify a consumer which retrieves all tasks // * // * @param tasksConsumer // */ // // void consume(Consumer<List<Task>> tasksConsumer); // // } // Path: com.vogella.tasks.services/src/com/vogella/tasks/services/internal/TaskServiceContextFunction.java import org.eclipse.e4.core.contexts.ContextFunction; import org.eclipse.e4.core.contexts.ContextInjectionFactory; import org.eclipse.e4.core.contexts.IContextFunction; import org.eclipse.e4.core.contexts.IEclipseContext; import org.eclipse.e4.ui.model.application.MApplication; import org.osgi.service.component.annotations.Component; import com.vogella.tasks.model.TaskService; package com.vogella.tasks.services.internal; // TODO register this thing for the context key com.vogella.tasks.model.TaskService @Component(service = IContextFunction.class, property = "service.context.key=com.vogella.tasks.model.TaskService") public class TaskServiceContextFunction extends ContextFunction { @Override public Object compute(IEclipseContext context, String contextKey) { var make = ContextInjectionFactory.make(TransientTaskServiceImpl.class, context); MApplication mApplication = context.get(MApplication.class);
mApplication.getContext().set(TaskService.class, make);
vogellacompany/eclipse4book
com.vogella.nattable/src/com/vogella/nattable/parts/NatTableEditorExample.java
// Path: com.vogella.tasks.model/src/com/vogella/tasks/model/Task.java // public class Task { // // private transient PropertyChangeSupport changes = new PropertyChangeSupport(this); // // public static final String FIELD_ID = "id"; // public static final String FIELD_SUMMARY = "summary"; // public static final String FIELD_DESCRIPTION = "description"; // public static final String FIELD_DONE = "done"; // public static final String FIELD_DUEDATE = "dueDate"; // // private final long id; // private String summary = ""; // private String description = ""; // private boolean done = false; // private LocalDate dueDate = LocalDate.now(); // // public Task(long id, String summary, String description, boolean done, LocalDate dueDate) { // this.id = id; // this.summary = summary; // this.description = description; // this.done = done; // this.dueDate = dueDate; // } // // public Task(long id) { // this.id = id; // } // // public String getSummary() { // return summary; // } // // public void setSummary(String summary) { // changes.firePropertyChange(FIELD_SUMMARY, this.summary, this.summary = summary); // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // changes.firePropertyChange(FIELD_DESCRIPTION, this.description, this.description = description); // } // public boolean isDone() { // return done; // } // // public void setDone(boolean isDone) { // changes.firePropertyChange(FIELD_DONE, this.done, this.done = isDone); // } // // public LocalDate getDueDate() { // return dueDate; // } // // public void setDueDate(LocalDate dueDate) { // changes.firePropertyChange(FIELD_DUEDATE, this.dueDate, this.dueDate = dueDate); // } // // public long getId() { // return id; // } // // // @Override // public int hashCode() { // return Objects.hash(id); // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // Task other = (Task) obj; // return id == other.id; // } // // @Override // public String toString() { // return "Task [id=" + id + ", summary=" + summary + "]"; // } // // public Task copy() { // return new Task(this.id, this.summary, this.description, this.done, this.dueDate); // } // // public void addPropertyChangeListener(PropertyChangeListener l) { // changes.addPropertyChangeListener(l); // } // // public void removePropertyChangeListener(PropertyChangeListener l) { // changes.removePropertyChangeListener(l); // } // // /** // * Only need for JSON serialization and de-serialization // */ // public void restorePropertyChangeListener() { // if (Objects.isNull(changes)) { // changes = new PropertyChangeSupport(this); // } // } // } // // Path: com.vogella.tasks.model/src/com/vogella/tasks/model/TaskService.java // public interface TaskService { // // /** // * Get all tasks // */ // List<Task> getAll(); // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // // // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // boolean update(Task task); // // /** // * Updates existing task or create new task // * // * @param task // * @return empty optional if not found, otherwise Optional holder the task // */ // // Optional<Task> get(long id); // // /** // * Deletes the task with the id // * @param id task id to delete // * @return true if task existed and was deleted, false otherwise // */ // boolean delete(long id); // // /** // * Allow to specify a consumer which retrieves all tasks // * // * @param tasksConsumer // */ // // void consume(Consumer<List<Task>> tasksConsumer); // // }
import java.util.List; import javax.annotation.PostConstruct; import org.eclipse.nebula.widgets.nattable.NatTable; import org.eclipse.nebula.widgets.nattable.config.AbstractRegistryConfiguration; import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration; import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry; import org.eclipse.nebula.widgets.nattable.config.IEditableRule; import org.eclipse.nebula.widgets.nattable.data.IColumnPropertyAccessor; import org.eclipse.nebula.widgets.nattable.data.ListDataProvider; import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes; import org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer; import org.eclipse.swt.widgets.Composite; import com.vogella.tasks.model.Task; import com.vogella.tasks.model.TaskService;
package com.vogella.nattable.parts; public class NatTableEditorExample { @PostConstruct
// Path: com.vogella.tasks.model/src/com/vogella/tasks/model/Task.java // public class Task { // // private transient PropertyChangeSupport changes = new PropertyChangeSupport(this); // // public static final String FIELD_ID = "id"; // public static final String FIELD_SUMMARY = "summary"; // public static final String FIELD_DESCRIPTION = "description"; // public static final String FIELD_DONE = "done"; // public static final String FIELD_DUEDATE = "dueDate"; // // private final long id; // private String summary = ""; // private String description = ""; // private boolean done = false; // private LocalDate dueDate = LocalDate.now(); // // public Task(long id, String summary, String description, boolean done, LocalDate dueDate) { // this.id = id; // this.summary = summary; // this.description = description; // this.done = done; // this.dueDate = dueDate; // } // // public Task(long id) { // this.id = id; // } // // public String getSummary() { // return summary; // } // // public void setSummary(String summary) { // changes.firePropertyChange(FIELD_SUMMARY, this.summary, this.summary = summary); // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // changes.firePropertyChange(FIELD_DESCRIPTION, this.description, this.description = description); // } // public boolean isDone() { // return done; // } // // public void setDone(boolean isDone) { // changes.firePropertyChange(FIELD_DONE, this.done, this.done = isDone); // } // // public LocalDate getDueDate() { // return dueDate; // } // // public void setDueDate(LocalDate dueDate) { // changes.firePropertyChange(FIELD_DUEDATE, this.dueDate, this.dueDate = dueDate); // } // // public long getId() { // return id; // } // // // @Override // public int hashCode() { // return Objects.hash(id); // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // Task other = (Task) obj; // return id == other.id; // } // // @Override // public String toString() { // return "Task [id=" + id + ", summary=" + summary + "]"; // } // // public Task copy() { // return new Task(this.id, this.summary, this.description, this.done, this.dueDate); // } // // public void addPropertyChangeListener(PropertyChangeListener l) { // changes.addPropertyChangeListener(l); // } // // public void removePropertyChangeListener(PropertyChangeListener l) { // changes.removePropertyChangeListener(l); // } // // /** // * Only need for JSON serialization and de-serialization // */ // public void restorePropertyChangeListener() { // if (Objects.isNull(changes)) { // changes = new PropertyChangeSupport(this); // } // } // } // // Path: com.vogella.tasks.model/src/com/vogella/tasks/model/TaskService.java // public interface TaskService { // // /** // * Get all tasks // */ // List<Task> getAll(); // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // // // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // boolean update(Task task); // // /** // * Updates existing task or create new task // * // * @param task // * @return empty optional if not found, otherwise Optional holder the task // */ // // Optional<Task> get(long id); // // /** // * Deletes the task with the id // * @param id task id to delete // * @return true if task existed and was deleted, false otherwise // */ // boolean delete(long id); // // /** // * Allow to specify a consumer which retrieves all tasks // * // * @param tasksConsumer // */ // // void consume(Consumer<List<Task>> tasksConsumer); // // } // Path: com.vogella.nattable/src/com/vogella/nattable/parts/NatTableEditorExample.java import java.util.List; import javax.annotation.PostConstruct; import org.eclipse.nebula.widgets.nattable.NatTable; import org.eclipse.nebula.widgets.nattable.config.AbstractRegistryConfiguration; import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration; import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry; import org.eclipse.nebula.widgets.nattable.config.IEditableRule; import org.eclipse.nebula.widgets.nattable.data.IColumnPropertyAccessor; import org.eclipse.nebula.widgets.nattable.data.ListDataProvider; import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes; import org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer; import org.eclipse.swt.widgets.Composite; import com.vogella.tasks.model.Task; import com.vogella.tasks.model.TaskService; package com.vogella.nattable.parts; public class NatTableEditorExample { @PostConstruct
public void postConstruct(Composite parent, TaskService taskService) {
vogellacompany/eclipse4book
com.vogella.nattable/src/com/vogella/nattable/parts/NatTableEditorExample.java
// Path: com.vogella.tasks.model/src/com/vogella/tasks/model/Task.java // public class Task { // // private transient PropertyChangeSupport changes = new PropertyChangeSupport(this); // // public static final String FIELD_ID = "id"; // public static final String FIELD_SUMMARY = "summary"; // public static final String FIELD_DESCRIPTION = "description"; // public static final String FIELD_DONE = "done"; // public static final String FIELD_DUEDATE = "dueDate"; // // private final long id; // private String summary = ""; // private String description = ""; // private boolean done = false; // private LocalDate dueDate = LocalDate.now(); // // public Task(long id, String summary, String description, boolean done, LocalDate dueDate) { // this.id = id; // this.summary = summary; // this.description = description; // this.done = done; // this.dueDate = dueDate; // } // // public Task(long id) { // this.id = id; // } // // public String getSummary() { // return summary; // } // // public void setSummary(String summary) { // changes.firePropertyChange(FIELD_SUMMARY, this.summary, this.summary = summary); // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // changes.firePropertyChange(FIELD_DESCRIPTION, this.description, this.description = description); // } // public boolean isDone() { // return done; // } // // public void setDone(boolean isDone) { // changes.firePropertyChange(FIELD_DONE, this.done, this.done = isDone); // } // // public LocalDate getDueDate() { // return dueDate; // } // // public void setDueDate(LocalDate dueDate) { // changes.firePropertyChange(FIELD_DUEDATE, this.dueDate, this.dueDate = dueDate); // } // // public long getId() { // return id; // } // // // @Override // public int hashCode() { // return Objects.hash(id); // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // Task other = (Task) obj; // return id == other.id; // } // // @Override // public String toString() { // return "Task [id=" + id + ", summary=" + summary + "]"; // } // // public Task copy() { // return new Task(this.id, this.summary, this.description, this.done, this.dueDate); // } // // public void addPropertyChangeListener(PropertyChangeListener l) { // changes.addPropertyChangeListener(l); // } // // public void removePropertyChangeListener(PropertyChangeListener l) { // changes.removePropertyChangeListener(l); // } // // /** // * Only need for JSON serialization and de-serialization // */ // public void restorePropertyChangeListener() { // if (Objects.isNull(changes)) { // changes = new PropertyChangeSupport(this); // } // } // } // // Path: com.vogella.tasks.model/src/com/vogella/tasks/model/TaskService.java // public interface TaskService { // // /** // * Get all tasks // */ // List<Task> getAll(); // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // // // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // boolean update(Task task); // // /** // * Updates existing task or create new task // * // * @param task // * @return empty optional if not found, otherwise Optional holder the task // */ // // Optional<Task> get(long id); // // /** // * Deletes the task with the id // * @param id task id to delete // * @return true if task existed and was deleted, false otherwise // */ // boolean delete(long id); // // /** // * Allow to specify a consumer which retrieves all tasks // * // * @param tasksConsumer // */ // // void consume(Consumer<List<Task>> tasksConsumer); // // }
import java.util.List; import javax.annotation.PostConstruct; import org.eclipse.nebula.widgets.nattable.NatTable; import org.eclipse.nebula.widgets.nattable.config.AbstractRegistryConfiguration; import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration; import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry; import org.eclipse.nebula.widgets.nattable.config.IEditableRule; import org.eclipse.nebula.widgets.nattable.data.IColumnPropertyAccessor; import org.eclipse.nebula.widgets.nattable.data.ListDataProvider; import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes; import org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer; import org.eclipse.swt.widgets.Composite; import com.vogella.tasks.model.Task; import com.vogella.tasks.model.TaskService;
package com.vogella.nattable.parts; public class NatTableEditorExample { @PostConstruct public void postConstruct(Composite parent, TaskService taskService) {
// Path: com.vogella.tasks.model/src/com/vogella/tasks/model/Task.java // public class Task { // // private transient PropertyChangeSupport changes = new PropertyChangeSupport(this); // // public static final String FIELD_ID = "id"; // public static final String FIELD_SUMMARY = "summary"; // public static final String FIELD_DESCRIPTION = "description"; // public static final String FIELD_DONE = "done"; // public static final String FIELD_DUEDATE = "dueDate"; // // private final long id; // private String summary = ""; // private String description = ""; // private boolean done = false; // private LocalDate dueDate = LocalDate.now(); // // public Task(long id, String summary, String description, boolean done, LocalDate dueDate) { // this.id = id; // this.summary = summary; // this.description = description; // this.done = done; // this.dueDate = dueDate; // } // // public Task(long id) { // this.id = id; // } // // public String getSummary() { // return summary; // } // // public void setSummary(String summary) { // changes.firePropertyChange(FIELD_SUMMARY, this.summary, this.summary = summary); // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // changes.firePropertyChange(FIELD_DESCRIPTION, this.description, this.description = description); // } // public boolean isDone() { // return done; // } // // public void setDone(boolean isDone) { // changes.firePropertyChange(FIELD_DONE, this.done, this.done = isDone); // } // // public LocalDate getDueDate() { // return dueDate; // } // // public void setDueDate(LocalDate dueDate) { // changes.firePropertyChange(FIELD_DUEDATE, this.dueDate, this.dueDate = dueDate); // } // // public long getId() { // return id; // } // // // @Override // public int hashCode() { // return Objects.hash(id); // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // Task other = (Task) obj; // return id == other.id; // } // // @Override // public String toString() { // return "Task [id=" + id + ", summary=" + summary + "]"; // } // // public Task copy() { // return new Task(this.id, this.summary, this.description, this.done, this.dueDate); // } // // public void addPropertyChangeListener(PropertyChangeListener l) { // changes.addPropertyChangeListener(l); // } // // public void removePropertyChangeListener(PropertyChangeListener l) { // changes.removePropertyChangeListener(l); // } // // /** // * Only need for JSON serialization and de-serialization // */ // public void restorePropertyChangeListener() { // if (Objects.isNull(changes)) { // changes = new PropertyChangeSupport(this); // } // } // } // // Path: com.vogella.tasks.model/src/com/vogella/tasks/model/TaskService.java // public interface TaskService { // // /** // * Get all tasks // */ // List<Task> getAll(); // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // // // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // boolean update(Task task); // // /** // * Updates existing task or create new task // * // * @param task // * @return empty optional if not found, otherwise Optional holder the task // */ // // Optional<Task> get(long id); // // /** // * Deletes the task with the id // * @param id task id to delete // * @return true if task existed and was deleted, false otherwise // */ // boolean delete(long id); // // /** // * Allow to specify a consumer which retrieves all tasks // * // * @param tasksConsumer // */ // // void consume(Consumer<List<Task>> tasksConsumer); // // } // Path: com.vogella.nattable/src/com/vogella/nattable/parts/NatTableEditorExample.java import java.util.List; import javax.annotation.PostConstruct; import org.eclipse.nebula.widgets.nattable.NatTable; import org.eclipse.nebula.widgets.nattable.config.AbstractRegistryConfiguration; import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration; import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry; import org.eclipse.nebula.widgets.nattable.config.IEditableRule; import org.eclipse.nebula.widgets.nattable.data.IColumnPropertyAccessor; import org.eclipse.nebula.widgets.nattable.data.ListDataProvider; import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes; import org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer; import org.eclipse.swt.widgets.Composite; import com.vogella.tasks.model.Task; import com.vogella.tasks.model.TaskService; package com.vogella.nattable.parts; public class NatTableEditorExample { @PostConstruct public void postConstruct(Composite parent, TaskService taskService) {
List<Task> tasks = taskService.getAll();
vogellacompany/eclipse4book
com.vogella.tasks.ui/src/com/vogella/tasks/ui/parts/TaskEditorPart.java
// Path: com.vogella.tasks.model/src/com/vogella/tasks/model/Task.java // public class Task { // // private transient PropertyChangeSupport changes = new PropertyChangeSupport(this); // // public static final String FIELD_ID = "id"; // public static final String FIELD_SUMMARY = "summary"; // public static final String FIELD_DESCRIPTION = "description"; // public static final String FIELD_DONE = "done"; // public static final String FIELD_DUEDATE = "dueDate"; // // private final long id; // private String summary = ""; // private String description = ""; // private boolean done = false; // private LocalDate dueDate = LocalDate.now(); // // public Task(long id, String summary, String description, boolean done, LocalDate dueDate) { // this.id = id; // this.summary = summary; // this.description = description; // this.done = done; // this.dueDate = dueDate; // } // // public Task(long id) { // this.id = id; // } // // public String getSummary() { // return summary; // } // // public void setSummary(String summary) { // changes.firePropertyChange(FIELD_SUMMARY, this.summary, this.summary = summary); // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // changes.firePropertyChange(FIELD_DESCRIPTION, this.description, this.description = description); // } // public boolean isDone() { // return done; // } // // public void setDone(boolean isDone) { // changes.firePropertyChange(FIELD_DONE, this.done, this.done = isDone); // } // // public LocalDate getDueDate() { // return dueDate; // } // // public void setDueDate(LocalDate dueDate) { // changes.firePropertyChange(FIELD_DUEDATE, this.dueDate, this.dueDate = dueDate); // } // // public long getId() { // return id; // } // // // @Override // public int hashCode() { // return Objects.hash(id); // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // Task other = (Task) obj; // return id == other.id; // } // // @Override // public String toString() { // return "Task [id=" + id + ", summary=" + summary + "]"; // } // // public Task copy() { // return new Task(this.id, this.summary, this.description, this.done, this.dueDate); // } // // public void addPropertyChangeListener(PropertyChangeListener l) { // changes.addPropertyChangeListener(l); // } // // public void removePropertyChangeListener(PropertyChangeListener l) { // changes.removePropertyChangeListener(l); // } // // /** // * Only need for JSON serialization and de-serialization // */ // public void restorePropertyChangeListener() { // if (Objects.isNull(changes)) { // changes = new PropertyChangeSupport(this); // } // } // } // // Path: com.vogella.tasks.model/src/com/vogella/tasks/model/TaskService.java // public interface TaskService { // // /** // * Get all tasks // */ // List<Task> getAll(); // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // // // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // boolean update(Task task); // // /** // * Updates existing task or create new task // * // * @param task // * @return empty optional if not found, otherwise Optional holder the task // */ // // Optional<Task> get(long id); // // /** // * Deletes the task with the id // * @param id task id to delete // * @return true if task existed and was deleted, false otherwise // */ // boolean delete(long id); // // /** // * Allow to specify a consumer which retrieves all tasks // * // * @param tasksConsumer // */ // // void consume(Consumer<List<Task>> tasksConsumer); // // }
import java.util.HashMap; import java.util.Map; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; import javax.inject.Inject; import org.eclipse.core.databinding.Binding; import org.eclipse.core.databinding.DataBindingContext; import org.eclipse.core.databinding.beans.typed.BeanProperties; import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.ui.di.Focus; import org.eclipse.e4.ui.di.Persist; import org.eclipse.e4.ui.model.application.ui.basic.MPart; import org.eclipse.jface.databinding.swt.typed.WidgetProperties; import org.eclipse.jface.layout.GridDataFactory; import org.eclipse.jface.widgets.LabelFactory; import org.eclipse.jface.widgets.WidgetFactory; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.DateTime; import org.eclipse.swt.widgets.Text; import com.vogella.tasks.model.Task; import com.vogella.tasks.model.TaskService;
package com.vogella.tasks.ui.parts; public class TaskEditorPart { private Text txtSummary; private Text txtDescription; private DateTime dateTime; private Button btnDone; // define a new field
// Path: com.vogella.tasks.model/src/com/vogella/tasks/model/Task.java // public class Task { // // private transient PropertyChangeSupport changes = new PropertyChangeSupport(this); // // public static final String FIELD_ID = "id"; // public static final String FIELD_SUMMARY = "summary"; // public static final String FIELD_DESCRIPTION = "description"; // public static final String FIELD_DONE = "done"; // public static final String FIELD_DUEDATE = "dueDate"; // // private final long id; // private String summary = ""; // private String description = ""; // private boolean done = false; // private LocalDate dueDate = LocalDate.now(); // // public Task(long id, String summary, String description, boolean done, LocalDate dueDate) { // this.id = id; // this.summary = summary; // this.description = description; // this.done = done; // this.dueDate = dueDate; // } // // public Task(long id) { // this.id = id; // } // // public String getSummary() { // return summary; // } // // public void setSummary(String summary) { // changes.firePropertyChange(FIELD_SUMMARY, this.summary, this.summary = summary); // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // changes.firePropertyChange(FIELD_DESCRIPTION, this.description, this.description = description); // } // public boolean isDone() { // return done; // } // // public void setDone(boolean isDone) { // changes.firePropertyChange(FIELD_DONE, this.done, this.done = isDone); // } // // public LocalDate getDueDate() { // return dueDate; // } // // public void setDueDate(LocalDate dueDate) { // changes.firePropertyChange(FIELD_DUEDATE, this.dueDate, this.dueDate = dueDate); // } // // public long getId() { // return id; // } // // // @Override // public int hashCode() { // return Objects.hash(id); // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // Task other = (Task) obj; // return id == other.id; // } // // @Override // public String toString() { // return "Task [id=" + id + ", summary=" + summary + "]"; // } // // public Task copy() { // return new Task(this.id, this.summary, this.description, this.done, this.dueDate); // } // // public void addPropertyChangeListener(PropertyChangeListener l) { // changes.addPropertyChangeListener(l); // } // // public void removePropertyChangeListener(PropertyChangeListener l) { // changes.removePropertyChangeListener(l); // } // // /** // * Only need for JSON serialization and de-serialization // */ // public void restorePropertyChangeListener() { // if (Objects.isNull(changes)) { // changes = new PropertyChangeSupport(this); // } // } // } // // Path: com.vogella.tasks.model/src/com/vogella/tasks/model/TaskService.java // public interface TaskService { // // /** // * Get all tasks // */ // List<Task> getAll(); // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // // // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // boolean update(Task task); // // /** // * Updates existing task or create new task // * // * @param task // * @return empty optional if not found, otherwise Optional holder the task // */ // // Optional<Task> get(long id); // // /** // * Deletes the task with the id // * @param id task id to delete // * @return true if task existed and was deleted, false otherwise // */ // boolean delete(long id); // // /** // * Allow to specify a consumer which retrieves all tasks // * // * @param tasksConsumer // */ // // void consume(Consumer<List<Task>> tasksConsumer); // // } // Path: com.vogella.tasks.ui/src/com/vogella/tasks/ui/parts/TaskEditorPart.java import java.util.HashMap; import java.util.Map; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; import javax.inject.Inject; import org.eclipse.core.databinding.Binding; import org.eclipse.core.databinding.DataBindingContext; import org.eclipse.core.databinding.beans.typed.BeanProperties; import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.core.databinding.observable.value.WritableValue; import org.eclipse.e4.ui.di.Focus; import org.eclipse.e4.ui.di.Persist; import org.eclipse.e4.ui.model.application.ui.basic.MPart; import org.eclipse.jface.databinding.swt.typed.WidgetProperties; import org.eclipse.jface.layout.GridDataFactory; import org.eclipse.jface.widgets.LabelFactory; import org.eclipse.jface.widgets.WidgetFactory; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.DateTime; import org.eclipse.swt.widgets.Text; import com.vogella.tasks.model.Task; import com.vogella.tasks.model.TaskService; package com.vogella.tasks.ui.parts; public class TaskEditorPart { private Text txtSummary; private Text txtDescription; private DateTime dateTime; private Button btnDone; // define a new field
private java.util.Optional<Task> task = java.util.Optional.ofNullable(null);
vogellacompany/eclipse4book
com.vogella.tasks.ui/src/com/vogella/tasks/ui/handlers/Testing.java
// Path: com.vogella.tasks.model/src/com/vogella/tasks/model/TaskService.java // public interface TaskService { // // /** // * Get all tasks // */ // List<Task> getAll(); // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // // // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // boolean update(Task task); // // /** // * Updates existing task or create new task // * // * @param task // * @return empty optional if not found, otherwise Optional holder the task // */ // // Optional<Task> get(long id); // // /** // * Deletes the task with the id // * @param id task id to delete // * @return true if task existed and was deleted, false otherwise // */ // boolean delete(long id); // // /** // * Allow to specify a consumer which retrieves all tasks // * // * @param tasksConsumer // */ // // void consume(Consumer<List<Task>> tasksConsumer); // // }
import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.util.concurrent.CompletableFuture; import org.eclipse.e4.core.di.annotations.Execute; import org.eclipse.e4.ui.di.UISynchronize; import org.eclipse.e4.ui.model.application.MApplication; import org.eclipse.e4.ui.workbench.modeling.EModelService; import com.vogella.tasks.model.TaskService;
package com.vogella.tasks.ui.handlers; public class Testing { static int i = 1; @Execute
// Path: com.vogella.tasks.model/src/com/vogella/tasks/model/TaskService.java // public interface TaskService { // // /** // * Get all tasks // */ // List<Task> getAll(); // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // // // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // boolean update(Task task); // // /** // * Updates existing task or create new task // * // * @param task // * @return empty optional if not found, otherwise Optional holder the task // */ // // Optional<Task> get(long id); // // /** // * Deletes the task with the id // * @param id task id to delete // * @return true if task existed and was deleted, false otherwise // */ // boolean delete(long id); // // /** // * Allow to specify a consumer which retrieves all tasks // * // * @param tasksConsumer // */ // // void consume(Consumer<List<Task>> tasksConsumer); // // } // Path: com.vogella.tasks.ui/src/com/vogella/tasks/ui/handlers/Testing.java import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.util.concurrent.CompletableFuture; import org.eclipse.e4.core.di.annotations.Execute; import org.eclipse.e4.ui.di.UISynchronize; import org.eclipse.e4.ui.model.application.MApplication; import org.eclipse.e4.ui.workbench.modeling.EModelService; import com.vogella.tasks.model.TaskService; package com.vogella.tasks.ui.handlers; public class Testing { static int i = 1; @Execute
public void execute(MApplication app, EModelService modelService, TaskService taskService, UISynchronize sync) {
vogellacompany/eclipse4book
com.vogella.nattable/src/com/vogella/nattable/parts/NatTableAdvancedExample.java
// Path: com.vogella.tasks.model/src/com/vogella/tasks/model/Task.java // public class Task { // // private transient PropertyChangeSupport changes = new PropertyChangeSupport(this); // // public static final String FIELD_ID = "id"; // public static final String FIELD_SUMMARY = "summary"; // public static final String FIELD_DESCRIPTION = "description"; // public static final String FIELD_DONE = "done"; // public static final String FIELD_DUEDATE = "dueDate"; // // private final long id; // private String summary = ""; // private String description = ""; // private boolean done = false; // private LocalDate dueDate = LocalDate.now(); // // public Task(long id, String summary, String description, boolean done, LocalDate dueDate) { // this.id = id; // this.summary = summary; // this.description = description; // this.done = done; // this.dueDate = dueDate; // } // // public Task(long id) { // this.id = id; // } // // public String getSummary() { // return summary; // } // // public void setSummary(String summary) { // changes.firePropertyChange(FIELD_SUMMARY, this.summary, this.summary = summary); // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // changes.firePropertyChange(FIELD_DESCRIPTION, this.description, this.description = description); // } // public boolean isDone() { // return done; // } // // public void setDone(boolean isDone) { // changes.firePropertyChange(FIELD_DONE, this.done, this.done = isDone); // } // // public LocalDate getDueDate() { // return dueDate; // } // // public void setDueDate(LocalDate dueDate) { // changes.firePropertyChange(FIELD_DUEDATE, this.dueDate, this.dueDate = dueDate); // } // // public long getId() { // return id; // } // // // @Override // public int hashCode() { // return Objects.hash(id); // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // Task other = (Task) obj; // return id == other.id; // } // // @Override // public String toString() { // return "Task [id=" + id + ", summary=" + summary + "]"; // } // // public Task copy() { // return new Task(this.id, this.summary, this.description, this.done, this.dueDate); // } // // public void addPropertyChangeListener(PropertyChangeListener l) { // changes.addPropertyChangeListener(l); // } // // public void removePropertyChangeListener(PropertyChangeListener l) { // changes.removePropertyChangeListener(l); // } // // /** // * Only need for JSON serialization and de-serialization // */ // public void restorePropertyChangeListener() { // if (Objects.isNull(changes)) { // changes = new PropertyChangeSupport(this); // } // } // } // // Path: com.vogella.tasks.model/src/com/vogella/tasks/model/TaskService.java // public interface TaskService { // // /** // * Get all tasks // */ // List<Task> getAll(); // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // // // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // boolean update(Task task); // // /** // * Updates existing task or create new task // * // * @param task // * @return empty optional if not found, otherwise Optional holder the task // */ // // Optional<Task> get(long id); // // /** // * Deletes the task with the id // * @param id task id to delete // * @return true if task existed and was deleted, false otherwise // */ // boolean delete(long id); // // /** // * Allow to specify a consumer which retrieves all tasks // * // * @param tasksConsumer // */ // // void consume(Consumer<List<Task>> tasksConsumer); // // }
import java.util.List; import javax.annotation.PostConstruct; import org.eclipse.nebula.widgets.nattable.NatTable; import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration; import org.eclipse.nebula.widgets.nattable.data.IColumnPropertyAccessor; import org.eclipse.nebula.widgets.nattable.data.ListDataProvider; import org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer; import org.eclipse.nebula.widgets.nattable.layer.DataLayer; import org.eclipse.nebula.widgets.nattable.layer.cell.ColumnLabelAccumulator; import org.eclipse.swt.widgets.Composite; import com.vogella.tasks.model.Task; import com.vogella.tasks.model.TaskService;
package com.vogella.nattable.parts; public class NatTableAdvancedExample { @PostConstruct
// Path: com.vogella.tasks.model/src/com/vogella/tasks/model/Task.java // public class Task { // // private transient PropertyChangeSupport changes = new PropertyChangeSupport(this); // // public static final String FIELD_ID = "id"; // public static final String FIELD_SUMMARY = "summary"; // public static final String FIELD_DESCRIPTION = "description"; // public static final String FIELD_DONE = "done"; // public static final String FIELD_DUEDATE = "dueDate"; // // private final long id; // private String summary = ""; // private String description = ""; // private boolean done = false; // private LocalDate dueDate = LocalDate.now(); // // public Task(long id, String summary, String description, boolean done, LocalDate dueDate) { // this.id = id; // this.summary = summary; // this.description = description; // this.done = done; // this.dueDate = dueDate; // } // // public Task(long id) { // this.id = id; // } // // public String getSummary() { // return summary; // } // // public void setSummary(String summary) { // changes.firePropertyChange(FIELD_SUMMARY, this.summary, this.summary = summary); // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // changes.firePropertyChange(FIELD_DESCRIPTION, this.description, this.description = description); // } // public boolean isDone() { // return done; // } // // public void setDone(boolean isDone) { // changes.firePropertyChange(FIELD_DONE, this.done, this.done = isDone); // } // // public LocalDate getDueDate() { // return dueDate; // } // // public void setDueDate(LocalDate dueDate) { // changes.firePropertyChange(FIELD_DUEDATE, this.dueDate, this.dueDate = dueDate); // } // // public long getId() { // return id; // } // // // @Override // public int hashCode() { // return Objects.hash(id); // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // Task other = (Task) obj; // return id == other.id; // } // // @Override // public String toString() { // return "Task [id=" + id + ", summary=" + summary + "]"; // } // // public Task copy() { // return new Task(this.id, this.summary, this.description, this.done, this.dueDate); // } // // public void addPropertyChangeListener(PropertyChangeListener l) { // changes.addPropertyChangeListener(l); // } // // public void removePropertyChangeListener(PropertyChangeListener l) { // changes.removePropertyChangeListener(l); // } // // /** // * Only need for JSON serialization and de-serialization // */ // public void restorePropertyChangeListener() { // if (Objects.isNull(changes)) { // changes = new PropertyChangeSupport(this); // } // } // } // // Path: com.vogella.tasks.model/src/com/vogella/tasks/model/TaskService.java // public interface TaskService { // // /** // * Get all tasks // */ // List<Task> getAll(); // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // // // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // boolean update(Task task); // // /** // * Updates existing task or create new task // * // * @param task // * @return empty optional if not found, otherwise Optional holder the task // */ // // Optional<Task> get(long id); // // /** // * Deletes the task with the id // * @param id task id to delete // * @return true if task existed and was deleted, false otherwise // */ // boolean delete(long id); // // /** // * Allow to specify a consumer which retrieves all tasks // * // * @param tasksConsumer // */ // // void consume(Consumer<List<Task>> tasksConsumer); // // } // Path: com.vogella.nattable/src/com/vogella/nattable/parts/NatTableAdvancedExample.java import java.util.List; import javax.annotation.PostConstruct; import org.eclipse.nebula.widgets.nattable.NatTable; import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration; import org.eclipse.nebula.widgets.nattable.data.IColumnPropertyAccessor; import org.eclipse.nebula.widgets.nattable.data.ListDataProvider; import org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer; import org.eclipse.nebula.widgets.nattable.layer.DataLayer; import org.eclipse.nebula.widgets.nattable.layer.cell.ColumnLabelAccumulator; import org.eclipse.swt.widgets.Composite; import com.vogella.tasks.model.Task; import com.vogella.tasks.model.TaskService; package com.vogella.nattable.parts; public class NatTableAdvancedExample { @PostConstruct
public void postConstruct(Composite parent, TaskService taskService) {
vogellacompany/eclipse4book
com.vogella.nattable/src/com/vogella/nattable/parts/NatTableAdvancedExample.java
// Path: com.vogella.tasks.model/src/com/vogella/tasks/model/Task.java // public class Task { // // private transient PropertyChangeSupport changes = new PropertyChangeSupport(this); // // public static final String FIELD_ID = "id"; // public static final String FIELD_SUMMARY = "summary"; // public static final String FIELD_DESCRIPTION = "description"; // public static final String FIELD_DONE = "done"; // public static final String FIELD_DUEDATE = "dueDate"; // // private final long id; // private String summary = ""; // private String description = ""; // private boolean done = false; // private LocalDate dueDate = LocalDate.now(); // // public Task(long id, String summary, String description, boolean done, LocalDate dueDate) { // this.id = id; // this.summary = summary; // this.description = description; // this.done = done; // this.dueDate = dueDate; // } // // public Task(long id) { // this.id = id; // } // // public String getSummary() { // return summary; // } // // public void setSummary(String summary) { // changes.firePropertyChange(FIELD_SUMMARY, this.summary, this.summary = summary); // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // changes.firePropertyChange(FIELD_DESCRIPTION, this.description, this.description = description); // } // public boolean isDone() { // return done; // } // // public void setDone(boolean isDone) { // changes.firePropertyChange(FIELD_DONE, this.done, this.done = isDone); // } // // public LocalDate getDueDate() { // return dueDate; // } // // public void setDueDate(LocalDate dueDate) { // changes.firePropertyChange(FIELD_DUEDATE, this.dueDate, this.dueDate = dueDate); // } // // public long getId() { // return id; // } // // // @Override // public int hashCode() { // return Objects.hash(id); // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // Task other = (Task) obj; // return id == other.id; // } // // @Override // public String toString() { // return "Task [id=" + id + ", summary=" + summary + "]"; // } // // public Task copy() { // return new Task(this.id, this.summary, this.description, this.done, this.dueDate); // } // // public void addPropertyChangeListener(PropertyChangeListener l) { // changes.addPropertyChangeListener(l); // } // // public void removePropertyChangeListener(PropertyChangeListener l) { // changes.removePropertyChangeListener(l); // } // // /** // * Only need for JSON serialization and de-serialization // */ // public void restorePropertyChangeListener() { // if (Objects.isNull(changes)) { // changes = new PropertyChangeSupport(this); // } // } // } // // Path: com.vogella.tasks.model/src/com/vogella/tasks/model/TaskService.java // public interface TaskService { // // /** // * Get all tasks // */ // List<Task> getAll(); // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // // // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // boolean update(Task task); // // /** // * Updates existing task or create new task // * // * @param task // * @return empty optional if not found, otherwise Optional holder the task // */ // // Optional<Task> get(long id); // // /** // * Deletes the task with the id // * @param id task id to delete // * @return true if task existed and was deleted, false otherwise // */ // boolean delete(long id); // // /** // * Allow to specify a consumer which retrieves all tasks // * // * @param tasksConsumer // */ // // void consume(Consumer<List<Task>> tasksConsumer); // // }
import java.util.List; import javax.annotation.PostConstruct; import org.eclipse.nebula.widgets.nattable.NatTable; import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration; import org.eclipse.nebula.widgets.nattable.data.IColumnPropertyAccessor; import org.eclipse.nebula.widgets.nattable.data.ListDataProvider; import org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer; import org.eclipse.nebula.widgets.nattable.layer.DataLayer; import org.eclipse.nebula.widgets.nattable.layer.cell.ColumnLabelAccumulator; import org.eclipse.swt.widgets.Composite; import com.vogella.tasks.model.Task; import com.vogella.tasks.model.TaskService;
package com.vogella.nattable.parts; public class NatTableAdvancedExample { @PostConstruct public void postConstruct(Composite parent, TaskService taskService) {
// Path: com.vogella.tasks.model/src/com/vogella/tasks/model/Task.java // public class Task { // // private transient PropertyChangeSupport changes = new PropertyChangeSupport(this); // // public static final String FIELD_ID = "id"; // public static final String FIELD_SUMMARY = "summary"; // public static final String FIELD_DESCRIPTION = "description"; // public static final String FIELD_DONE = "done"; // public static final String FIELD_DUEDATE = "dueDate"; // // private final long id; // private String summary = ""; // private String description = ""; // private boolean done = false; // private LocalDate dueDate = LocalDate.now(); // // public Task(long id, String summary, String description, boolean done, LocalDate dueDate) { // this.id = id; // this.summary = summary; // this.description = description; // this.done = done; // this.dueDate = dueDate; // } // // public Task(long id) { // this.id = id; // } // // public String getSummary() { // return summary; // } // // public void setSummary(String summary) { // changes.firePropertyChange(FIELD_SUMMARY, this.summary, this.summary = summary); // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // changes.firePropertyChange(FIELD_DESCRIPTION, this.description, this.description = description); // } // public boolean isDone() { // return done; // } // // public void setDone(boolean isDone) { // changes.firePropertyChange(FIELD_DONE, this.done, this.done = isDone); // } // // public LocalDate getDueDate() { // return dueDate; // } // // public void setDueDate(LocalDate dueDate) { // changes.firePropertyChange(FIELD_DUEDATE, this.dueDate, this.dueDate = dueDate); // } // // public long getId() { // return id; // } // // // @Override // public int hashCode() { // return Objects.hash(id); // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // Task other = (Task) obj; // return id == other.id; // } // // @Override // public String toString() { // return "Task [id=" + id + ", summary=" + summary + "]"; // } // // public Task copy() { // return new Task(this.id, this.summary, this.description, this.done, this.dueDate); // } // // public void addPropertyChangeListener(PropertyChangeListener l) { // changes.addPropertyChangeListener(l); // } // // public void removePropertyChangeListener(PropertyChangeListener l) { // changes.removePropertyChangeListener(l); // } // // /** // * Only need for JSON serialization and de-serialization // */ // public void restorePropertyChangeListener() { // if (Objects.isNull(changes)) { // changes = new PropertyChangeSupport(this); // } // } // } // // Path: com.vogella.tasks.model/src/com/vogella/tasks/model/TaskService.java // public interface TaskService { // // /** // * Get all tasks // */ // List<Task> getAll(); // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // // // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // boolean update(Task task); // // /** // * Updates existing task or create new task // * // * @param task // * @return empty optional if not found, otherwise Optional holder the task // */ // // Optional<Task> get(long id); // // /** // * Deletes the task with the id // * @param id task id to delete // * @return true if task existed and was deleted, false otherwise // */ // boolean delete(long id); // // /** // * Allow to specify a consumer which retrieves all tasks // * // * @param tasksConsumer // */ // // void consume(Consumer<List<Task>> tasksConsumer); // // } // Path: com.vogella.nattable/src/com/vogella/nattable/parts/NatTableAdvancedExample.java import java.util.List; import javax.annotation.PostConstruct; import org.eclipse.nebula.widgets.nattable.NatTable; import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration; import org.eclipse.nebula.widgets.nattable.data.IColumnPropertyAccessor; import org.eclipse.nebula.widgets.nattable.data.ListDataProvider; import org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer; import org.eclipse.nebula.widgets.nattable.layer.DataLayer; import org.eclipse.nebula.widgets.nattable.layer.cell.ColumnLabelAccumulator; import org.eclipse.swt.widgets.Composite; import com.vogella.tasks.model.Task; import com.vogella.tasks.model.TaskService; package com.vogella.nattable.parts; public class NatTableAdvancedExample { @PostConstruct public void postConstruct(Composite parent, TaskService taskService) {
List<Task> tasks = taskService.getAll();
vogellacompany/eclipse4book
com.vogella.tasks.ui/src/com/vogella/tasks/ui/parts/AutoCompleteFieldPart.java
// Path: com.vogella.tasks.model/src/com/vogella/tasks/model/TaskService.java // public interface TaskService { // // /** // * Get all tasks // */ // List<Task> getAll(); // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // // // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // boolean update(Task task); // // /** // * Updates existing task or create new task // * // * @param task // * @return empty optional if not found, otherwise Optional holder the task // */ // // Optional<Task> get(long id); // // /** // * Deletes the task with the id // * @param id task id to delete // * @return true if task existed and was deleted, false otherwise // */ // boolean delete(long id); // // /** // * Allow to specify a consumer which retrieves all tasks // * // * @param tasksConsumer // */ // // void consume(Consumer<List<Task>> tasksConsumer); // // } // // Path: com.vogella.tasks.ui/src/com/vogella/tasks/ui/parts/contentassists/TaskContentProposal.java // public class TaskContentProposal extends ContentProposal { // // private Task task; // // public TaskContentProposal(String content, Task task) { // super(content); // this.task = task; // } // // public Task getTask() { // return task; // } // // // } // // Path: com.vogella.tasks.ui/src/com/vogella/tasks/ui/parts/contentassists/TaskContentProposalProvider.java // public class TaskContentProposalProvider implements IContentProposalProvider { // // private List<Task> tasks; // public TaskContentProposalProvider(List<Task> tasks) { // this.tasks = tasks; // } // // @Override // public IContentProposal[] getProposals(String contents, int position) { // String substring = contents.substring(0, position); // Pattern pattern = Pattern.compile(substring, Pattern.LITERAL | Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE); // IContentProposal[] filteredProposals = tasks.stream() // .filter(task -> task.getSummary().length() >= substring.length() // && pattern.matcher(task.getSummary()).find()) // .map(task -> new TaskContentProposal(task.getSummary(), task)).toArray(TaskContentProposal[]::new); // return filteredProposals.length == 0 ? null : filteredProposals; // } // // // Simpler version of the above // // @Override // // public IContentProposal[] getProposals(String contents, int position) { // // // // for (Task task : tasks) { // // if (task.getSummary().toLowerCase().startsWith(contents.toLowerCase())) { // // proposals.add(new TaskContentProposal(task.getSummary(), task)); // // } // // } // // return proposals.toArray(new TaskContentProposal[0]); // // } // // public void setProposals(List<Task> tasks) { // this.tasks = tasks; // } // }
import static org.eclipse.jface.widgets.TextFactory.newText; import java.io.File; import java.nio.file.Files; import java.nio.file.InvalidPathException; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; import javax.annotation.PostConstruct; import org.eclipse.jface.bindings.keys.KeyStroke; import org.eclipse.jface.fieldassist.ContentProposalAdapter; import org.eclipse.jface.fieldassist.IContentProposal; import org.eclipse.jface.fieldassist.IContentProposalListener; import org.eclipse.jface.fieldassist.IContentProposalProvider; import org.eclipse.jface.fieldassist.IControlContentAdapter; import org.eclipse.jface.fieldassist.TextContentAdapter; import org.eclipse.jface.layout.GridDataFactory; import org.eclipse.jface.layout.GridLayoutFactory; import org.eclipse.jface.widgets.WidgetFactory; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Text; import com.vogella.tasks.model.TaskService; import com.vogella.tasks.ui.parts.contentassists.TaskContentProposal; import com.vogella.tasks.ui.parts.contentassists.TaskContentProposalProvider;
package com.vogella.tasks.ui.parts; public class AutoCompleteFieldPart { private final class ContentProposalAdapterExtension extends ContentProposalAdapter { private ContentProposalAdapterExtension(Control control, IControlContentAdapter controlContentAdapter, IContentProposalProvider proposalProvider, KeyStroke keyStroke, char[] autoActivationCharacters) { super(control, controlContentAdapter, proposalProvider, keyStroke, autoActivationCharacters); } @Override public void openProposalPopup() { super.openProposalPopup(); } } private Path lastDir; @PostConstruct
// Path: com.vogella.tasks.model/src/com/vogella/tasks/model/TaskService.java // public interface TaskService { // // /** // * Get all tasks // */ // List<Task> getAll(); // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // // // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // boolean update(Task task); // // /** // * Updates existing task or create new task // * // * @param task // * @return empty optional if not found, otherwise Optional holder the task // */ // // Optional<Task> get(long id); // // /** // * Deletes the task with the id // * @param id task id to delete // * @return true if task existed and was deleted, false otherwise // */ // boolean delete(long id); // // /** // * Allow to specify a consumer which retrieves all tasks // * // * @param tasksConsumer // */ // // void consume(Consumer<List<Task>> tasksConsumer); // // } // // Path: com.vogella.tasks.ui/src/com/vogella/tasks/ui/parts/contentassists/TaskContentProposal.java // public class TaskContentProposal extends ContentProposal { // // private Task task; // // public TaskContentProposal(String content, Task task) { // super(content); // this.task = task; // } // // public Task getTask() { // return task; // } // // // } // // Path: com.vogella.tasks.ui/src/com/vogella/tasks/ui/parts/contentassists/TaskContentProposalProvider.java // public class TaskContentProposalProvider implements IContentProposalProvider { // // private List<Task> tasks; // public TaskContentProposalProvider(List<Task> tasks) { // this.tasks = tasks; // } // // @Override // public IContentProposal[] getProposals(String contents, int position) { // String substring = contents.substring(0, position); // Pattern pattern = Pattern.compile(substring, Pattern.LITERAL | Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE); // IContentProposal[] filteredProposals = tasks.stream() // .filter(task -> task.getSummary().length() >= substring.length() // && pattern.matcher(task.getSummary()).find()) // .map(task -> new TaskContentProposal(task.getSummary(), task)).toArray(TaskContentProposal[]::new); // return filteredProposals.length == 0 ? null : filteredProposals; // } // // // Simpler version of the above // // @Override // // public IContentProposal[] getProposals(String contents, int position) { // // // // for (Task task : tasks) { // // if (task.getSummary().toLowerCase().startsWith(contents.toLowerCase())) { // // proposals.add(new TaskContentProposal(task.getSummary(), task)); // // } // // } // // return proposals.toArray(new TaskContentProposal[0]); // // } // // public void setProposals(List<Task> tasks) { // this.tasks = tasks; // } // } // Path: com.vogella.tasks.ui/src/com/vogella/tasks/ui/parts/AutoCompleteFieldPart.java import static org.eclipse.jface.widgets.TextFactory.newText; import java.io.File; import java.nio.file.Files; import java.nio.file.InvalidPathException; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; import javax.annotation.PostConstruct; import org.eclipse.jface.bindings.keys.KeyStroke; import org.eclipse.jface.fieldassist.ContentProposalAdapter; import org.eclipse.jface.fieldassist.IContentProposal; import org.eclipse.jface.fieldassist.IContentProposalListener; import org.eclipse.jface.fieldassist.IContentProposalProvider; import org.eclipse.jface.fieldassist.IControlContentAdapter; import org.eclipse.jface.fieldassist.TextContentAdapter; import org.eclipse.jface.layout.GridDataFactory; import org.eclipse.jface.layout.GridLayoutFactory; import org.eclipse.jface.widgets.WidgetFactory; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Text; import com.vogella.tasks.model.TaskService; import com.vogella.tasks.ui.parts.contentassists.TaskContentProposal; import com.vogella.tasks.ui.parts.contentassists.TaskContentProposalProvider; package com.vogella.tasks.ui.parts; public class AutoCompleteFieldPart { private final class ContentProposalAdapterExtension extends ContentProposalAdapter { private ContentProposalAdapterExtension(Control control, IControlContentAdapter controlContentAdapter, IContentProposalProvider proposalProvider, KeyStroke keyStroke, char[] autoActivationCharacters) { super(control, controlContentAdapter, proposalProvider, keyStroke, autoActivationCharacters); } @Override public void openProposalPopup() { super.openProposalPopup(); } } private Path lastDir; @PostConstruct
public void createControls(Composite parent, TaskService taskService) {
vogellacompany/eclipse4book
com.vogella.tasks.ui/src/com/vogella/tasks/ui/parts/AutoCompleteFieldPart.java
// Path: com.vogella.tasks.model/src/com/vogella/tasks/model/TaskService.java // public interface TaskService { // // /** // * Get all tasks // */ // List<Task> getAll(); // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // // // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // boolean update(Task task); // // /** // * Updates existing task or create new task // * // * @param task // * @return empty optional if not found, otherwise Optional holder the task // */ // // Optional<Task> get(long id); // // /** // * Deletes the task with the id // * @param id task id to delete // * @return true if task existed and was deleted, false otherwise // */ // boolean delete(long id); // // /** // * Allow to specify a consumer which retrieves all tasks // * // * @param tasksConsumer // */ // // void consume(Consumer<List<Task>> tasksConsumer); // // } // // Path: com.vogella.tasks.ui/src/com/vogella/tasks/ui/parts/contentassists/TaskContentProposal.java // public class TaskContentProposal extends ContentProposal { // // private Task task; // // public TaskContentProposal(String content, Task task) { // super(content); // this.task = task; // } // // public Task getTask() { // return task; // } // // // } // // Path: com.vogella.tasks.ui/src/com/vogella/tasks/ui/parts/contentassists/TaskContentProposalProvider.java // public class TaskContentProposalProvider implements IContentProposalProvider { // // private List<Task> tasks; // public TaskContentProposalProvider(List<Task> tasks) { // this.tasks = tasks; // } // // @Override // public IContentProposal[] getProposals(String contents, int position) { // String substring = contents.substring(0, position); // Pattern pattern = Pattern.compile(substring, Pattern.LITERAL | Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE); // IContentProposal[] filteredProposals = tasks.stream() // .filter(task -> task.getSummary().length() >= substring.length() // && pattern.matcher(task.getSummary()).find()) // .map(task -> new TaskContentProposal(task.getSummary(), task)).toArray(TaskContentProposal[]::new); // return filteredProposals.length == 0 ? null : filteredProposals; // } // // // Simpler version of the above // // @Override // // public IContentProposal[] getProposals(String contents, int position) { // // // // for (Task task : tasks) { // // if (task.getSummary().toLowerCase().startsWith(contents.toLowerCase())) { // // proposals.add(new TaskContentProposal(task.getSummary(), task)); // // } // // } // // return proposals.toArray(new TaskContentProposal[0]); // // } // // public void setProposals(List<Task> tasks) { // this.tasks = tasks; // } // }
import static org.eclipse.jface.widgets.TextFactory.newText; import java.io.File; import java.nio.file.Files; import java.nio.file.InvalidPathException; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; import javax.annotation.PostConstruct; import org.eclipse.jface.bindings.keys.KeyStroke; import org.eclipse.jface.fieldassist.ContentProposalAdapter; import org.eclipse.jface.fieldassist.IContentProposal; import org.eclipse.jface.fieldassist.IContentProposalListener; import org.eclipse.jface.fieldassist.IContentProposalProvider; import org.eclipse.jface.fieldassist.IControlContentAdapter; import org.eclipse.jface.fieldassist.TextContentAdapter; import org.eclipse.jface.layout.GridDataFactory; import org.eclipse.jface.layout.GridLayoutFactory; import org.eclipse.jface.widgets.WidgetFactory; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Text; import com.vogella.tasks.model.TaskService; import com.vogella.tasks.ui.parts.contentassists.TaskContentProposal; import com.vogella.tasks.ui.parts.contentassists.TaskContentProposalProvider;
package com.vogella.tasks.ui.parts; public class AutoCompleteFieldPart { private final class ContentProposalAdapterExtension extends ContentProposalAdapter { private ContentProposalAdapterExtension(Control control, IControlContentAdapter controlContentAdapter, IContentProposalProvider proposalProvider, KeyStroke keyStroke, char[] autoActivationCharacters) { super(control, controlContentAdapter, proposalProvider, keyStroke, autoActivationCharacters); } @Override public void openProposalPopup() { super.openProposalPopup(); } } private Path lastDir; @PostConstruct public void createControls(Composite parent, TaskService taskService) { GridLayoutFactory.fillDefaults().applyTo(parent); // Combo combo = new Combo(parent, SWT.NONE); // AutoCompleteField autoCompleteField = new AutoCompleteField(combo, new ComboContentAdapter()); // // combo.addModifyListener(e -> { // Path dir = getPathWithoutFileName(combo.getText()); // if (dir == null || dir.equals(lastDir) || !isDirectory(dir)) { // return; // } // lastDir = dir; // try (Stream<Path> paths = Files.list(dir)) { // List<String> directories = filterPaths(paths); // autoCompleteField.setProposals(directories.toArray(new String[directories.size()])); // } catch (IOException ex) { // // ignore // } // }); Text text = newText(SWT.BORDER) .layoutData(GridDataFactory.fillDefaults().grab(true, false).create()).create(parent);
// Path: com.vogella.tasks.model/src/com/vogella/tasks/model/TaskService.java // public interface TaskService { // // /** // * Get all tasks // */ // List<Task> getAll(); // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // // // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // boolean update(Task task); // // /** // * Updates existing task or create new task // * // * @param task // * @return empty optional if not found, otherwise Optional holder the task // */ // // Optional<Task> get(long id); // // /** // * Deletes the task with the id // * @param id task id to delete // * @return true if task existed and was deleted, false otherwise // */ // boolean delete(long id); // // /** // * Allow to specify a consumer which retrieves all tasks // * // * @param tasksConsumer // */ // // void consume(Consumer<List<Task>> tasksConsumer); // // } // // Path: com.vogella.tasks.ui/src/com/vogella/tasks/ui/parts/contentassists/TaskContentProposal.java // public class TaskContentProposal extends ContentProposal { // // private Task task; // // public TaskContentProposal(String content, Task task) { // super(content); // this.task = task; // } // // public Task getTask() { // return task; // } // // // } // // Path: com.vogella.tasks.ui/src/com/vogella/tasks/ui/parts/contentassists/TaskContentProposalProvider.java // public class TaskContentProposalProvider implements IContentProposalProvider { // // private List<Task> tasks; // public TaskContentProposalProvider(List<Task> tasks) { // this.tasks = tasks; // } // // @Override // public IContentProposal[] getProposals(String contents, int position) { // String substring = contents.substring(0, position); // Pattern pattern = Pattern.compile(substring, Pattern.LITERAL | Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE); // IContentProposal[] filteredProposals = tasks.stream() // .filter(task -> task.getSummary().length() >= substring.length() // && pattern.matcher(task.getSummary()).find()) // .map(task -> new TaskContentProposal(task.getSummary(), task)).toArray(TaskContentProposal[]::new); // return filteredProposals.length == 0 ? null : filteredProposals; // } // // // Simpler version of the above // // @Override // // public IContentProposal[] getProposals(String contents, int position) { // // // // for (Task task : tasks) { // // if (task.getSummary().toLowerCase().startsWith(contents.toLowerCase())) { // // proposals.add(new TaskContentProposal(task.getSummary(), task)); // // } // // } // // return proposals.toArray(new TaskContentProposal[0]); // // } // // public void setProposals(List<Task> tasks) { // this.tasks = tasks; // } // } // Path: com.vogella.tasks.ui/src/com/vogella/tasks/ui/parts/AutoCompleteFieldPart.java import static org.eclipse.jface.widgets.TextFactory.newText; import java.io.File; import java.nio.file.Files; import java.nio.file.InvalidPathException; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; import javax.annotation.PostConstruct; import org.eclipse.jface.bindings.keys.KeyStroke; import org.eclipse.jface.fieldassist.ContentProposalAdapter; import org.eclipse.jface.fieldassist.IContentProposal; import org.eclipse.jface.fieldassist.IContentProposalListener; import org.eclipse.jface.fieldassist.IContentProposalProvider; import org.eclipse.jface.fieldassist.IControlContentAdapter; import org.eclipse.jface.fieldassist.TextContentAdapter; import org.eclipse.jface.layout.GridDataFactory; import org.eclipse.jface.layout.GridLayoutFactory; import org.eclipse.jface.widgets.WidgetFactory; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Text; import com.vogella.tasks.model.TaskService; import com.vogella.tasks.ui.parts.contentassists.TaskContentProposal; import com.vogella.tasks.ui.parts.contentassists.TaskContentProposalProvider; package com.vogella.tasks.ui.parts; public class AutoCompleteFieldPart { private final class ContentProposalAdapterExtension extends ContentProposalAdapter { private ContentProposalAdapterExtension(Control control, IControlContentAdapter controlContentAdapter, IContentProposalProvider proposalProvider, KeyStroke keyStroke, char[] autoActivationCharacters) { super(control, controlContentAdapter, proposalProvider, keyStroke, autoActivationCharacters); } @Override public void openProposalPopup() { super.openProposalPopup(); } } private Path lastDir; @PostConstruct public void createControls(Composite parent, TaskService taskService) { GridLayoutFactory.fillDefaults().applyTo(parent); // Combo combo = new Combo(parent, SWT.NONE); // AutoCompleteField autoCompleteField = new AutoCompleteField(combo, new ComboContentAdapter()); // // combo.addModifyListener(e -> { // Path dir = getPathWithoutFileName(combo.getText()); // if (dir == null || dir.equals(lastDir) || !isDirectory(dir)) { // return; // } // lastDir = dir; // try (Stream<Path> paths = Files.list(dir)) { // List<String> directories = filterPaths(paths); // autoCompleteField.setProposals(directories.toArray(new String[directories.size()])); // } catch (IOException ex) { // // ignore // } // }); Text text = newText(SWT.BORDER) .layoutData(GridDataFactory.fillDefaults().grab(true, false).create()).create(parent);
TaskContentProposalProvider taskContentProposalProvider = new TaskContentProposalProvider(new ArrayList<>());
vogellacompany/eclipse4book
com.vogella.tasks.ui/src/com/vogella/tasks/ui/handlers/RemoveTaskHandler.java
// Path: com.vogella.tasks.model/src/com/vogella/tasks/model/Task.java // public class Task { // // private transient PropertyChangeSupport changes = new PropertyChangeSupport(this); // // public static final String FIELD_ID = "id"; // public static final String FIELD_SUMMARY = "summary"; // public static final String FIELD_DESCRIPTION = "description"; // public static final String FIELD_DONE = "done"; // public static final String FIELD_DUEDATE = "dueDate"; // // private final long id; // private String summary = ""; // private String description = ""; // private boolean done = false; // private LocalDate dueDate = LocalDate.now(); // // public Task(long id, String summary, String description, boolean done, LocalDate dueDate) { // this.id = id; // this.summary = summary; // this.description = description; // this.done = done; // this.dueDate = dueDate; // } // // public Task(long id) { // this.id = id; // } // // public String getSummary() { // return summary; // } // // public void setSummary(String summary) { // changes.firePropertyChange(FIELD_SUMMARY, this.summary, this.summary = summary); // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // changes.firePropertyChange(FIELD_DESCRIPTION, this.description, this.description = description); // } // public boolean isDone() { // return done; // } // // public void setDone(boolean isDone) { // changes.firePropertyChange(FIELD_DONE, this.done, this.done = isDone); // } // // public LocalDate getDueDate() { // return dueDate; // } // // public void setDueDate(LocalDate dueDate) { // changes.firePropertyChange(FIELD_DUEDATE, this.dueDate, this.dueDate = dueDate); // } // // public long getId() { // return id; // } // // // @Override // public int hashCode() { // return Objects.hash(id); // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // Task other = (Task) obj; // return id == other.id; // } // // @Override // public String toString() { // return "Task [id=" + id + ", summary=" + summary + "]"; // } // // public Task copy() { // return new Task(this.id, this.summary, this.description, this.done, this.dueDate); // } // // public void addPropertyChangeListener(PropertyChangeListener l) { // changes.addPropertyChangeListener(l); // } // // public void removePropertyChangeListener(PropertyChangeListener l) { // changes.removePropertyChangeListener(l); // } // // /** // * Only need for JSON serialization and de-serialization // */ // public void restorePropertyChangeListener() { // if (Objects.isNull(changes)) { // changes = new PropertyChangeSupport(this); // } // } // } // // Path: com.vogella.tasks.model/src/com/vogella/tasks/model/TaskService.java // public interface TaskService { // // /** // * Get all tasks // */ // List<Task> getAll(); // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // // // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // boolean update(Task task); // // /** // * Updates existing task or create new task // * // * @param task // * @return empty optional if not found, otherwise Optional holder the task // */ // // Optional<Task> get(long id); // // /** // * Deletes the task with the id // * @param id task id to delete // * @return true if task existed and was deleted, false otherwise // */ // boolean delete(long id); // // /** // * Allow to specify a consumer which retrieves all tasks // * // * @param tasksConsumer // */ // // void consume(Consumer<List<Task>> tasksConsumer); // // }
import java.util.List; import javax.inject.Named; import org.eclipse.e4.core.di.annotations.CanExecute; import org.eclipse.e4.core.di.annotations.Execute; import org.eclipse.e4.core.di.annotations.Optional; import org.eclipse.e4.ui.services.IServiceConstants; import com.vogella.tasks.model.Task; import com.vogella.tasks.model.TaskService;
package com.vogella.tasks.ui.handlers; public class RemoveTaskHandler { @Execute
// Path: com.vogella.tasks.model/src/com/vogella/tasks/model/Task.java // public class Task { // // private transient PropertyChangeSupport changes = new PropertyChangeSupport(this); // // public static final String FIELD_ID = "id"; // public static final String FIELD_SUMMARY = "summary"; // public static final String FIELD_DESCRIPTION = "description"; // public static final String FIELD_DONE = "done"; // public static final String FIELD_DUEDATE = "dueDate"; // // private final long id; // private String summary = ""; // private String description = ""; // private boolean done = false; // private LocalDate dueDate = LocalDate.now(); // // public Task(long id, String summary, String description, boolean done, LocalDate dueDate) { // this.id = id; // this.summary = summary; // this.description = description; // this.done = done; // this.dueDate = dueDate; // } // // public Task(long id) { // this.id = id; // } // // public String getSummary() { // return summary; // } // // public void setSummary(String summary) { // changes.firePropertyChange(FIELD_SUMMARY, this.summary, this.summary = summary); // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // changes.firePropertyChange(FIELD_DESCRIPTION, this.description, this.description = description); // } // public boolean isDone() { // return done; // } // // public void setDone(boolean isDone) { // changes.firePropertyChange(FIELD_DONE, this.done, this.done = isDone); // } // // public LocalDate getDueDate() { // return dueDate; // } // // public void setDueDate(LocalDate dueDate) { // changes.firePropertyChange(FIELD_DUEDATE, this.dueDate, this.dueDate = dueDate); // } // // public long getId() { // return id; // } // // // @Override // public int hashCode() { // return Objects.hash(id); // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // Task other = (Task) obj; // return id == other.id; // } // // @Override // public String toString() { // return "Task [id=" + id + ", summary=" + summary + "]"; // } // // public Task copy() { // return new Task(this.id, this.summary, this.description, this.done, this.dueDate); // } // // public void addPropertyChangeListener(PropertyChangeListener l) { // changes.addPropertyChangeListener(l); // } // // public void removePropertyChangeListener(PropertyChangeListener l) { // changes.removePropertyChangeListener(l); // } // // /** // * Only need for JSON serialization and de-serialization // */ // public void restorePropertyChangeListener() { // if (Objects.isNull(changes)) { // changes = new PropertyChangeSupport(this); // } // } // } // // Path: com.vogella.tasks.model/src/com/vogella/tasks/model/TaskService.java // public interface TaskService { // // /** // * Get all tasks // */ // List<Task> getAll(); // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // // // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // boolean update(Task task); // // /** // * Updates existing task or create new task // * // * @param task // * @return empty optional if not found, otherwise Optional holder the task // */ // // Optional<Task> get(long id); // // /** // * Deletes the task with the id // * @param id task id to delete // * @return true if task existed and was deleted, false otherwise // */ // boolean delete(long id); // // /** // * Allow to specify a consumer which retrieves all tasks // * // * @param tasksConsumer // */ // // void consume(Consumer<List<Task>> tasksConsumer); // // } // Path: com.vogella.tasks.ui/src/com/vogella/tasks/ui/handlers/RemoveTaskHandler.java import java.util.List; import javax.inject.Named; import org.eclipse.e4.core.di.annotations.CanExecute; import org.eclipse.e4.core.di.annotations.Execute; import org.eclipse.e4.core.di.annotations.Optional; import org.eclipse.e4.ui.services.IServiceConstants; import com.vogella.tasks.model.Task; import com.vogella.tasks.model.TaskService; package com.vogella.tasks.ui.handlers; public class RemoveTaskHandler { @Execute
public void execute(TaskService taskService, @Named(IServiceConstants.ACTIVE_SELECTION) List<Task> tasks) {
vogellacompany/eclipse4book
com.vogella.tasks.ui/src/com/vogella/tasks/ui/handlers/RemoveTaskHandler.java
// Path: com.vogella.tasks.model/src/com/vogella/tasks/model/Task.java // public class Task { // // private transient PropertyChangeSupport changes = new PropertyChangeSupport(this); // // public static final String FIELD_ID = "id"; // public static final String FIELD_SUMMARY = "summary"; // public static final String FIELD_DESCRIPTION = "description"; // public static final String FIELD_DONE = "done"; // public static final String FIELD_DUEDATE = "dueDate"; // // private final long id; // private String summary = ""; // private String description = ""; // private boolean done = false; // private LocalDate dueDate = LocalDate.now(); // // public Task(long id, String summary, String description, boolean done, LocalDate dueDate) { // this.id = id; // this.summary = summary; // this.description = description; // this.done = done; // this.dueDate = dueDate; // } // // public Task(long id) { // this.id = id; // } // // public String getSummary() { // return summary; // } // // public void setSummary(String summary) { // changes.firePropertyChange(FIELD_SUMMARY, this.summary, this.summary = summary); // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // changes.firePropertyChange(FIELD_DESCRIPTION, this.description, this.description = description); // } // public boolean isDone() { // return done; // } // // public void setDone(boolean isDone) { // changes.firePropertyChange(FIELD_DONE, this.done, this.done = isDone); // } // // public LocalDate getDueDate() { // return dueDate; // } // // public void setDueDate(LocalDate dueDate) { // changes.firePropertyChange(FIELD_DUEDATE, this.dueDate, this.dueDate = dueDate); // } // // public long getId() { // return id; // } // // // @Override // public int hashCode() { // return Objects.hash(id); // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // Task other = (Task) obj; // return id == other.id; // } // // @Override // public String toString() { // return "Task [id=" + id + ", summary=" + summary + "]"; // } // // public Task copy() { // return new Task(this.id, this.summary, this.description, this.done, this.dueDate); // } // // public void addPropertyChangeListener(PropertyChangeListener l) { // changes.addPropertyChangeListener(l); // } // // public void removePropertyChangeListener(PropertyChangeListener l) { // changes.removePropertyChangeListener(l); // } // // /** // * Only need for JSON serialization and de-serialization // */ // public void restorePropertyChangeListener() { // if (Objects.isNull(changes)) { // changes = new PropertyChangeSupport(this); // } // } // } // // Path: com.vogella.tasks.model/src/com/vogella/tasks/model/TaskService.java // public interface TaskService { // // /** // * Get all tasks // */ // List<Task> getAll(); // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // // // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // boolean update(Task task); // // /** // * Updates existing task or create new task // * // * @param task // * @return empty optional if not found, otherwise Optional holder the task // */ // // Optional<Task> get(long id); // // /** // * Deletes the task with the id // * @param id task id to delete // * @return true if task existed and was deleted, false otherwise // */ // boolean delete(long id); // // /** // * Allow to specify a consumer which retrieves all tasks // * // * @param tasksConsumer // */ // // void consume(Consumer<List<Task>> tasksConsumer); // // }
import java.util.List; import javax.inject.Named; import org.eclipse.e4.core.di.annotations.CanExecute; import org.eclipse.e4.core.di.annotations.Execute; import org.eclipse.e4.core.di.annotations.Optional; import org.eclipse.e4.ui.services.IServiceConstants; import com.vogella.tasks.model.Task; import com.vogella.tasks.model.TaskService;
package com.vogella.tasks.ui.handlers; public class RemoveTaskHandler { @Execute
// Path: com.vogella.tasks.model/src/com/vogella/tasks/model/Task.java // public class Task { // // private transient PropertyChangeSupport changes = new PropertyChangeSupport(this); // // public static final String FIELD_ID = "id"; // public static final String FIELD_SUMMARY = "summary"; // public static final String FIELD_DESCRIPTION = "description"; // public static final String FIELD_DONE = "done"; // public static final String FIELD_DUEDATE = "dueDate"; // // private final long id; // private String summary = ""; // private String description = ""; // private boolean done = false; // private LocalDate dueDate = LocalDate.now(); // // public Task(long id, String summary, String description, boolean done, LocalDate dueDate) { // this.id = id; // this.summary = summary; // this.description = description; // this.done = done; // this.dueDate = dueDate; // } // // public Task(long id) { // this.id = id; // } // // public String getSummary() { // return summary; // } // // public void setSummary(String summary) { // changes.firePropertyChange(FIELD_SUMMARY, this.summary, this.summary = summary); // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // changes.firePropertyChange(FIELD_DESCRIPTION, this.description, this.description = description); // } // public boolean isDone() { // return done; // } // // public void setDone(boolean isDone) { // changes.firePropertyChange(FIELD_DONE, this.done, this.done = isDone); // } // // public LocalDate getDueDate() { // return dueDate; // } // // public void setDueDate(LocalDate dueDate) { // changes.firePropertyChange(FIELD_DUEDATE, this.dueDate, this.dueDate = dueDate); // } // // public long getId() { // return id; // } // // // @Override // public int hashCode() { // return Objects.hash(id); // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // Task other = (Task) obj; // return id == other.id; // } // // @Override // public String toString() { // return "Task [id=" + id + ", summary=" + summary + "]"; // } // // public Task copy() { // return new Task(this.id, this.summary, this.description, this.done, this.dueDate); // } // // public void addPropertyChangeListener(PropertyChangeListener l) { // changes.addPropertyChangeListener(l); // } // // public void removePropertyChangeListener(PropertyChangeListener l) { // changes.removePropertyChangeListener(l); // } // // /** // * Only need for JSON serialization and de-serialization // */ // public void restorePropertyChangeListener() { // if (Objects.isNull(changes)) { // changes = new PropertyChangeSupport(this); // } // } // } // // Path: com.vogella.tasks.model/src/com/vogella/tasks/model/TaskService.java // public interface TaskService { // // /** // * Get all tasks // */ // List<Task> getAll(); // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // // // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // boolean update(Task task); // // /** // * Updates existing task or create new task // * // * @param task // * @return empty optional if not found, otherwise Optional holder the task // */ // // Optional<Task> get(long id); // // /** // * Deletes the task with the id // * @param id task id to delete // * @return true if task existed and was deleted, false otherwise // */ // boolean delete(long id); // // /** // * Allow to specify a consumer which retrieves all tasks // * // * @param tasksConsumer // */ // // void consume(Consumer<List<Task>> tasksConsumer); // // } // Path: com.vogella.tasks.ui/src/com/vogella/tasks/ui/handlers/RemoveTaskHandler.java import java.util.List; import javax.inject.Named; import org.eclipse.e4.core.di.annotations.CanExecute; import org.eclipse.e4.core.di.annotations.Execute; import org.eclipse.e4.core.di.annotations.Optional; import org.eclipse.e4.ui.services.IServiceConstants; import com.vogella.tasks.model.Task; import com.vogella.tasks.model.TaskService; package com.vogella.tasks.ui.handlers; public class RemoveTaskHandler { @Execute
public void execute(TaskService taskService, @Named(IServiceConstants.ACTIVE_SELECTION) List<Task> tasks) {
vogellacompany/eclipse4book
com.vogella.tasks.ui/src/com/vogella/tasks/ui/handlers/OpenEditorHandler.java
// Path: com.vogella.tasks.model/src/com/vogella/tasks/model/Task.java // public class Task { // // private transient PropertyChangeSupport changes = new PropertyChangeSupport(this); // // public static final String FIELD_ID = "id"; // public static final String FIELD_SUMMARY = "summary"; // public static final String FIELD_DESCRIPTION = "description"; // public static final String FIELD_DONE = "done"; // public static final String FIELD_DUEDATE = "dueDate"; // // private final long id; // private String summary = ""; // private String description = ""; // private boolean done = false; // private LocalDate dueDate = LocalDate.now(); // // public Task(long id, String summary, String description, boolean done, LocalDate dueDate) { // this.id = id; // this.summary = summary; // this.description = description; // this.done = done; // this.dueDate = dueDate; // } // // public Task(long id) { // this.id = id; // } // // public String getSummary() { // return summary; // } // // public void setSummary(String summary) { // changes.firePropertyChange(FIELD_SUMMARY, this.summary, this.summary = summary); // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // changes.firePropertyChange(FIELD_DESCRIPTION, this.description, this.description = description); // } // public boolean isDone() { // return done; // } // // public void setDone(boolean isDone) { // changes.firePropertyChange(FIELD_DONE, this.done, this.done = isDone); // } // // public LocalDate getDueDate() { // return dueDate; // } // // public void setDueDate(LocalDate dueDate) { // changes.firePropertyChange(FIELD_DUEDATE, this.dueDate, this.dueDate = dueDate); // } // // public long getId() { // return id; // } // // // @Override // public int hashCode() { // return Objects.hash(id); // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // Task other = (Task) obj; // return id == other.id; // } // // @Override // public String toString() { // return "Task [id=" + id + ", summary=" + summary + "]"; // } // // public Task copy() { // return new Task(this.id, this.summary, this.description, this.done, this.dueDate); // } // // public void addPropertyChangeListener(PropertyChangeListener l) { // changes.addPropertyChangeListener(l); // } // // public void removePropertyChangeListener(PropertyChangeListener l) { // changes.removePropertyChangeListener(l); // } // // /** // * Only need for JSON serialization and de-serialization // */ // public void restorePropertyChangeListener() { // if (Objects.isNull(changes)) { // changes = new PropertyChangeSupport(this); // } // } // }
import java.util.List; import javax.inject.Named; import org.eclipse.e4.core.di.annotations.CanExecute; import org.eclipse.e4.core.di.annotations.Execute; import org.eclipse.e4.core.di.annotations.Optional; import org.eclipse.e4.ui.model.application.MApplication; import org.eclipse.e4.ui.model.application.ui.basic.MPart; import org.eclipse.e4.ui.model.application.ui.basic.MPartStack; import org.eclipse.e4.ui.services.IServiceConstants; import org.eclipse.e4.ui.workbench.modeling.EModelService; import org.eclipse.e4.ui.workbench.modeling.EPartService; import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState; import com.vogella.tasks.model.Task;
package com.vogella.tasks.ui.handlers; public class OpenEditorHandler { private static final String EDITOR_ID = "com.vogella.tasks.ui.partdescriptor.editor"; @Execute
// Path: com.vogella.tasks.model/src/com/vogella/tasks/model/Task.java // public class Task { // // private transient PropertyChangeSupport changes = new PropertyChangeSupport(this); // // public static final String FIELD_ID = "id"; // public static final String FIELD_SUMMARY = "summary"; // public static final String FIELD_DESCRIPTION = "description"; // public static final String FIELD_DONE = "done"; // public static final String FIELD_DUEDATE = "dueDate"; // // private final long id; // private String summary = ""; // private String description = ""; // private boolean done = false; // private LocalDate dueDate = LocalDate.now(); // // public Task(long id, String summary, String description, boolean done, LocalDate dueDate) { // this.id = id; // this.summary = summary; // this.description = description; // this.done = done; // this.dueDate = dueDate; // } // // public Task(long id) { // this.id = id; // } // // public String getSummary() { // return summary; // } // // public void setSummary(String summary) { // changes.firePropertyChange(FIELD_SUMMARY, this.summary, this.summary = summary); // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // changes.firePropertyChange(FIELD_DESCRIPTION, this.description, this.description = description); // } // public boolean isDone() { // return done; // } // // public void setDone(boolean isDone) { // changes.firePropertyChange(FIELD_DONE, this.done, this.done = isDone); // } // // public LocalDate getDueDate() { // return dueDate; // } // // public void setDueDate(LocalDate dueDate) { // changes.firePropertyChange(FIELD_DUEDATE, this.dueDate, this.dueDate = dueDate); // } // // public long getId() { // return id; // } // // // @Override // public int hashCode() { // return Objects.hash(id); // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // Task other = (Task) obj; // return id == other.id; // } // // @Override // public String toString() { // return "Task [id=" + id + ", summary=" + summary + "]"; // } // // public Task copy() { // return new Task(this.id, this.summary, this.description, this.done, this.dueDate); // } // // public void addPropertyChangeListener(PropertyChangeListener l) { // changes.addPropertyChangeListener(l); // } // // public void removePropertyChangeListener(PropertyChangeListener l) { // changes.removePropertyChangeListener(l); // } // // /** // * Only need for JSON serialization and de-serialization // */ // public void restorePropertyChangeListener() { // if (Objects.isNull(changes)) { // changes = new PropertyChangeSupport(this); // } // } // } // Path: com.vogella.tasks.ui/src/com/vogella/tasks/ui/handlers/OpenEditorHandler.java import java.util.List; import javax.inject.Named; import org.eclipse.e4.core.di.annotations.CanExecute; import org.eclipse.e4.core.di.annotations.Execute; import org.eclipse.e4.core.di.annotations.Optional; import org.eclipse.e4.ui.model.application.MApplication; import org.eclipse.e4.ui.model.application.ui.basic.MPart; import org.eclipse.e4.ui.model.application.ui.basic.MPartStack; import org.eclipse.e4.ui.services.IServiceConstants; import org.eclipse.e4.ui.workbench.modeling.EModelService; import org.eclipse.e4.ui.workbench.modeling.EPartService; import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState; import com.vogella.tasks.model.Task; package com.vogella.tasks.ui.handlers; public class OpenEditorHandler { private static final String EDITOR_ID = "com.vogella.tasks.ui.partdescriptor.editor"; @Execute
public void execute(@Optional @Named(IServiceConstants.ACTIVE_SELECTION) List<Task> tasks, MApplication application,
vogellacompany/eclipse4book
com.vogella.tasks.ui/src/com/vogella/tasks/ui/handlers/NewTaskHandler.java
// Path: com.vogella.tasks.model/src/com/vogella/tasks/model/Task.java // public class Task { // // private transient PropertyChangeSupport changes = new PropertyChangeSupport(this); // // public static final String FIELD_ID = "id"; // public static final String FIELD_SUMMARY = "summary"; // public static final String FIELD_DESCRIPTION = "description"; // public static final String FIELD_DONE = "done"; // public static final String FIELD_DUEDATE = "dueDate"; // // private final long id; // private String summary = ""; // private String description = ""; // private boolean done = false; // private LocalDate dueDate = LocalDate.now(); // // public Task(long id, String summary, String description, boolean done, LocalDate dueDate) { // this.id = id; // this.summary = summary; // this.description = description; // this.done = done; // this.dueDate = dueDate; // } // // public Task(long id) { // this.id = id; // } // // public String getSummary() { // return summary; // } // // public void setSummary(String summary) { // changes.firePropertyChange(FIELD_SUMMARY, this.summary, this.summary = summary); // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // changes.firePropertyChange(FIELD_DESCRIPTION, this.description, this.description = description); // } // public boolean isDone() { // return done; // } // // public void setDone(boolean isDone) { // changes.firePropertyChange(FIELD_DONE, this.done, this.done = isDone); // } // // public LocalDate getDueDate() { // return dueDate; // } // // public void setDueDate(LocalDate dueDate) { // changes.firePropertyChange(FIELD_DUEDATE, this.dueDate, this.dueDate = dueDate); // } // // public long getId() { // return id; // } // // // @Override // public int hashCode() { // return Objects.hash(id); // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // Task other = (Task) obj; // return id == other.id; // } // // @Override // public String toString() { // return "Task [id=" + id + ", summary=" + summary + "]"; // } // // public Task copy() { // return new Task(this.id, this.summary, this.description, this.done, this.dueDate); // } // // public void addPropertyChangeListener(PropertyChangeListener l) { // changes.addPropertyChangeListener(l); // } // // public void removePropertyChangeListener(PropertyChangeListener l) { // changes.removePropertyChangeListener(l); // } // // /** // * Only need for JSON serialization and de-serialization // */ // public void restorePropertyChangeListener() { // if (Objects.isNull(changes)) { // changes = new PropertyChangeSupport(this); // } // } // } // // Path: com.vogella.tasks.model/src/com/vogella/tasks/model/TaskService.java // public interface TaskService { // // /** // * Get all tasks // */ // List<Task> getAll(); // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // // // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // boolean update(Task task); // // /** // * Updates existing task or create new task // * // * @param task // * @return empty optional if not found, otherwise Optional holder the task // */ // // Optional<Task> get(long id); // // /** // * Deletes the task with the id // * @param id task id to delete // * @return true if task existed and was deleted, false otherwise // */ // boolean delete(long id); // // /** // * Allow to specify a consumer which retrieves all tasks // * // * @param tasksConsumer // */ // // void consume(Consumer<List<Task>> tasksConsumer); // // } // // Path: com.vogella.tasks.ui/src/com/vogella/tasks/ui/wizards/TaskWizard.java // public class TaskWizard extends Wizard { // // private Task task; // // public TaskWizard(Task todo) { // this.task = todo; // setWindowTitle("New Wizard"); // } // // @Override // public void addPages() { // addPage(new CreateTaskPage1(task)); // addPage(new CreateTaskPage2()); // } // // @Override // public boolean performFinish() { // return true; // } // // }
import java.time.LocalDate; import org.eclipse.e4.core.di.annotations.Execute; import org.eclipse.e4.core.services.events.IEventBroker; import org.eclipse.jface.window.Window; import org.eclipse.jface.wizard.WizardDialog; import org.eclipse.swt.widgets.Shell; import com.vogella.tasks.model.Task; import com.vogella.tasks.model.TaskService; import com.vogella.tasks.ui.wizards.TaskWizard;
package com.vogella.tasks.ui.handlers; public class NewTaskHandler { @Execute
// Path: com.vogella.tasks.model/src/com/vogella/tasks/model/Task.java // public class Task { // // private transient PropertyChangeSupport changes = new PropertyChangeSupport(this); // // public static final String FIELD_ID = "id"; // public static final String FIELD_SUMMARY = "summary"; // public static final String FIELD_DESCRIPTION = "description"; // public static final String FIELD_DONE = "done"; // public static final String FIELD_DUEDATE = "dueDate"; // // private final long id; // private String summary = ""; // private String description = ""; // private boolean done = false; // private LocalDate dueDate = LocalDate.now(); // // public Task(long id, String summary, String description, boolean done, LocalDate dueDate) { // this.id = id; // this.summary = summary; // this.description = description; // this.done = done; // this.dueDate = dueDate; // } // // public Task(long id) { // this.id = id; // } // // public String getSummary() { // return summary; // } // // public void setSummary(String summary) { // changes.firePropertyChange(FIELD_SUMMARY, this.summary, this.summary = summary); // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // changes.firePropertyChange(FIELD_DESCRIPTION, this.description, this.description = description); // } // public boolean isDone() { // return done; // } // // public void setDone(boolean isDone) { // changes.firePropertyChange(FIELD_DONE, this.done, this.done = isDone); // } // // public LocalDate getDueDate() { // return dueDate; // } // // public void setDueDate(LocalDate dueDate) { // changes.firePropertyChange(FIELD_DUEDATE, this.dueDate, this.dueDate = dueDate); // } // // public long getId() { // return id; // } // // // @Override // public int hashCode() { // return Objects.hash(id); // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // Task other = (Task) obj; // return id == other.id; // } // // @Override // public String toString() { // return "Task [id=" + id + ", summary=" + summary + "]"; // } // // public Task copy() { // return new Task(this.id, this.summary, this.description, this.done, this.dueDate); // } // // public void addPropertyChangeListener(PropertyChangeListener l) { // changes.addPropertyChangeListener(l); // } // // public void removePropertyChangeListener(PropertyChangeListener l) { // changes.removePropertyChangeListener(l); // } // // /** // * Only need for JSON serialization and de-serialization // */ // public void restorePropertyChangeListener() { // if (Objects.isNull(changes)) { // changes = new PropertyChangeSupport(this); // } // } // } // // Path: com.vogella.tasks.model/src/com/vogella/tasks/model/TaskService.java // public interface TaskService { // // /** // * Get all tasks // */ // List<Task> getAll(); // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // // // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // boolean update(Task task); // // /** // * Updates existing task or create new task // * // * @param task // * @return empty optional if not found, otherwise Optional holder the task // */ // // Optional<Task> get(long id); // // /** // * Deletes the task with the id // * @param id task id to delete // * @return true if task existed and was deleted, false otherwise // */ // boolean delete(long id); // // /** // * Allow to specify a consumer which retrieves all tasks // * // * @param tasksConsumer // */ // // void consume(Consumer<List<Task>> tasksConsumer); // // } // // Path: com.vogella.tasks.ui/src/com/vogella/tasks/ui/wizards/TaskWizard.java // public class TaskWizard extends Wizard { // // private Task task; // // public TaskWizard(Task todo) { // this.task = todo; // setWindowTitle("New Wizard"); // } // // @Override // public void addPages() { // addPage(new CreateTaskPage1(task)); // addPage(new CreateTaskPage2()); // } // // @Override // public boolean performFinish() { // return true; // } // // } // Path: com.vogella.tasks.ui/src/com/vogella/tasks/ui/handlers/NewTaskHandler.java import java.time.LocalDate; import org.eclipse.e4.core.di.annotations.Execute; import org.eclipse.e4.core.services.events.IEventBroker; import org.eclipse.jface.window.Window; import org.eclipse.jface.wizard.WizardDialog; import org.eclipse.swt.widgets.Shell; import com.vogella.tasks.model.Task; import com.vogella.tasks.model.TaskService; import com.vogella.tasks.ui.wizards.TaskWizard; package com.vogella.tasks.ui.handlers; public class NewTaskHandler { @Execute
public void execute(Shell shell, TaskService taskService, IEventBroker broker) {
vogellacompany/eclipse4book
com.vogella.tasks.ui/src/com/vogella/tasks/ui/handlers/NewTaskHandler.java
// Path: com.vogella.tasks.model/src/com/vogella/tasks/model/Task.java // public class Task { // // private transient PropertyChangeSupport changes = new PropertyChangeSupport(this); // // public static final String FIELD_ID = "id"; // public static final String FIELD_SUMMARY = "summary"; // public static final String FIELD_DESCRIPTION = "description"; // public static final String FIELD_DONE = "done"; // public static final String FIELD_DUEDATE = "dueDate"; // // private final long id; // private String summary = ""; // private String description = ""; // private boolean done = false; // private LocalDate dueDate = LocalDate.now(); // // public Task(long id, String summary, String description, boolean done, LocalDate dueDate) { // this.id = id; // this.summary = summary; // this.description = description; // this.done = done; // this.dueDate = dueDate; // } // // public Task(long id) { // this.id = id; // } // // public String getSummary() { // return summary; // } // // public void setSummary(String summary) { // changes.firePropertyChange(FIELD_SUMMARY, this.summary, this.summary = summary); // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // changes.firePropertyChange(FIELD_DESCRIPTION, this.description, this.description = description); // } // public boolean isDone() { // return done; // } // // public void setDone(boolean isDone) { // changes.firePropertyChange(FIELD_DONE, this.done, this.done = isDone); // } // // public LocalDate getDueDate() { // return dueDate; // } // // public void setDueDate(LocalDate dueDate) { // changes.firePropertyChange(FIELD_DUEDATE, this.dueDate, this.dueDate = dueDate); // } // // public long getId() { // return id; // } // // // @Override // public int hashCode() { // return Objects.hash(id); // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // Task other = (Task) obj; // return id == other.id; // } // // @Override // public String toString() { // return "Task [id=" + id + ", summary=" + summary + "]"; // } // // public Task copy() { // return new Task(this.id, this.summary, this.description, this.done, this.dueDate); // } // // public void addPropertyChangeListener(PropertyChangeListener l) { // changes.addPropertyChangeListener(l); // } // // public void removePropertyChangeListener(PropertyChangeListener l) { // changes.removePropertyChangeListener(l); // } // // /** // * Only need for JSON serialization and de-serialization // */ // public void restorePropertyChangeListener() { // if (Objects.isNull(changes)) { // changes = new PropertyChangeSupport(this); // } // } // } // // Path: com.vogella.tasks.model/src/com/vogella/tasks/model/TaskService.java // public interface TaskService { // // /** // * Get all tasks // */ // List<Task> getAll(); // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // // // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // boolean update(Task task); // // /** // * Updates existing task or create new task // * // * @param task // * @return empty optional if not found, otherwise Optional holder the task // */ // // Optional<Task> get(long id); // // /** // * Deletes the task with the id // * @param id task id to delete // * @return true if task existed and was deleted, false otherwise // */ // boolean delete(long id); // // /** // * Allow to specify a consumer which retrieves all tasks // * // * @param tasksConsumer // */ // // void consume(Consumer<List<Task>> tasksConsumer); // // } // // Path: com.vogella.tasks.ui/src/com/vogella/tasks/ui/wizards/TaskWizard.java // public class TaskWizard extends Wizard { // // private Task task; // // public TaskWizard(Task todo) { // this.task = todo; // setWindowTitle("New Wizard"); // } // // @Override // public void addPages() { // addPage(new CreateTaskPage1(task)); // addPage(new CreateTaskPage2()); // } // // @Override // public boolean performFinish() { // return true; // } // // }
import java.time.LocalDate; import org.eclipse.e4.core.di.annotations.Execute; import org.eclipse.e4.core.services.events.IEventBroker; import org.eclipse.jface.window.Window; import org.eclipse.jface.wizard.WizardDialog; import org.eclipse.swt.widgets.Shell; import com.vogella.tasks.model.Task; import com.vogella.tasks.model.TaskService; import com.vogella.tasks.ui.wizards.TaskWizard;
package com.vogella.tasks.ui.handlers; public class NewTaskHandler { @Execute public void execute(Shell shell, TaskService taskService, IEventBroker broker) { // use -1 to indicate a not existing id
// Path: com.vogella.tasks.model/src/com/vogella/tasks/model/Task.java // public class Task { // // private transient PropertyChangeSupport changes = new PropertyChangeSupport(this); // // public static final String FIELD_ID = "id"; // public static final String FIELD_SUMMARY = "summary"; // public static final String FIELD_DESCRIPTION = "description"; // public static final String FIELD_DONE = "done"; // public static final String FIELD_DUEDATE = "dueDate"; // // private final long id; // private String summary = ""; // private String description = ""; // private boolean done = false; // private LocalDate dueDate = LocalDate.now(); // // public Task(long id, String summary, String description, boolean done, LocalDate dueDate) { // this.id = id; // this.summary = summary; // this.description = description; // this.done = done; // this.dueDate = dueDate; // } // // public Task(long id) { // this.id = id; // } // // public String getSummary() { // return summary; // } // // public void setSummary(String summary) { // changes.firePropertyChange(FIELD_SUMMARY, this.summary, this.summary = summary); // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // changes.firePropertyChange(FIELD_DESCRIPTION, this.description, this.description = description); // } // public boolean isDone() { // return done; // } // // public void setDone(boolean isDone) { // changes.firePropertyChange(FIELD_DONE, this.done, this.done = isDone); // } // // public LocalDate getDueDate() { // return dueDate; // } // // public void setDueDate(LocalDate dueDate) { // changes.firePropertyChange(FIELD_DUEDATE, this.dueDate, this.dueDate = dueDate); // } // // public long getId() { // return id; // } // // // @Override // public int hashCode() { // return Objects.hash(id); // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // Task other = (Task) obj; // return id == other.id; // } // // @Override // public String toString() { // return "Task [id=" + id + ", summary=" + summary + "]"; // } // // public Task copy() { // return new Task(this.id, this.summary, this.description, this.done, this.dueDate); // } // // public void addPropertyChangeListener(PropertyChangeListener l) { // changes.addPropertyChangeListener(l); // } // // public void removePropertyChangeListener(PropertyChangeListener l) { // changes.removePropertyChangeListener(l); // } // // /** // * Only need for JSON serialization and de-serialization // */ // public void restorePropertyChangeListener() { // if (Objects.isNull(changes)) { // changes = new PropertyChangeSupport(this); // } // } // } // // Path: com.vogella.tasks.model/src/com/vogella/tasks/model/TaskService.java // public interface TaskService { // // /** // * Get all tasks // */ // List<Task> getAll(); // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // // // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // boolean update(Task task); // // /** // * Updates existing task or create new task // * // * @param task // * @return empty optional if not found, otherwise Optional holder the task // */ // // Optional<Task> get(long id); // // /** // * Deletes the task with the id // * @param id task id to delete // * @return true if task existed and was deleted, false otherwise // */ // boolean delete(long id); // // /** // * Allow to specify a consumer which retrieves all tasks // * // * @param tasksConsumer // */ // // void consume(Consumer<List<Task>> tasksConsumer); // // } // // Path: com.vogella.tasks.ui/src/com/vogella/tasks/ui/wizards/TaskWizard.java // public class TaskWizard extends Wizard { // // private Task task; // // public TaskWizard(Task todo) { // this.task = todo; // setWindowTitle("New Wizard"); // } // // @Override // public void addPages() { // addPage(new CreateTaskPage1(task)); // addPage(new CreateTaskPage2()); // } // // @Override // public boolean performFinish() { // return true; // } // // } // Path: com.vogella.tasks.ui/src/com/vogella/tasks/ui/handlers/NewTaskHandler.java import java.time.LocalDate; import org.eclipse.e4.core.di.annotations.Execute; import org.eclipse.e4.core.services.events.IEventBroker; import org.eclipse.jface.window.Window; import org.eclipse.jface.wizard.WizardDialog; import org.eclipse.swt.widgets.Shell; import com.vogella.tasks.model.Task; import com.vogella.tasks.model.TaskService; import com.vogella.tasks.ui.wizards.TaskWizard; package com.vogella.tasks.ui.handlers; public class NewTaskHandler { @Execute public void execute(Shell shell, TaskService taskService, IEventBroker broker) { // use -1 to indicate a not existing id
Task task = new Task(-1);
vogellacompany/eclipse4book
com.vogella.tasks.ui/src/com/vogella/tasks/ui/handlers/NewTaskHandler.java
// Path: com.vogella.tasks.model/src/com/vogella/tasks/model/Task.java // public class Task { // // private transient PropertyChangeSupport changes = new PropertyChangeSupport(this); // // public static final String FIELD_ID = "id"; // public static final String FIELD_SUMMARY = "summary"; // public static final String FIELD_DESCRIPTION = "description"; // public static final String FIELD_DONE = "done"; // public static final String FIELD_DUEDATE = "dueDate"; // // private final long id; // private String summary = ""; // private String description = ""; // private boolean done = false; // private LocalDate dueDate = LocalDate.now(); // // public Task(long id, String summary, String description, boolean done, LocalDate dueDate) { // this.id = id; // this.summary = summary; // this.description = description; // this.done = done; // this.dueDate = dueDate; // } // // public Task(long id) { // this.id = id; // } // // public String getSummary() { // return summary; // } // // public void setSummary(String summary) { // changes.firePropertyChange(FIELD_SUMMARY, this.summary, this.summary = summary); // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // changes.firePropertyChange(FIELD_DESCRIPTION, this.description, this.description = description); // } // public boolean isDone() { // return done; // } // // public void setDone(boolean isDone) { // changes.firePropertyChange(FIELD_DONE, this.done, this.done = isDone); // } // // public LocalDate getDueDate() { // return dueDate; // } // // public void setDueDate(LocalDate dueDate) { // changes.firePropertyChange(FIELD_DUEDATE, this.dueDate, this.dueDate = dueDate); // } // // public long getId() { // return id; // } // // // @Override // public int hashCode() { // return Objects.hash(id); // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // Task other = (Task) obj; // return id == other.id; // } // // @Override // public String toString() { // return "Task [id=" + id + ", summary=" + summary + "]"; // } // // public Task copy() { // return new Task(this.id, this.summary, this.description, this.done, this.dueDate); // } // // public void addPropertyChangeListener(PropertyChangeListener l) { // changes.addPropertyChangeListener(l); // } // // public void removePropertyChangeListener(PropertyChangeListener l) { // changes.removePropertyChangeListener(l); // } // // /** // * Only need for JSON serialization and de-serialization // */ // public void restorePropertyChangeListener() { // if (Objects.isNull(changes)) { // changes = new PropertyChangeSupport(this); // } // } // } // // Path: com.vogella.tasks.model/src/com/vogella/tasks/model/TaskService.java // public interface TaskService { // // /** // * Get all tasks // */ // List<Task> getAll(); // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // // // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // boolean update(Task task); // // /** // * Updates existing task or create new task // * // * @param task // * @return empty optional if not found, otherwise Optional holder the task // */ // // Optional<Task> get(long id); // // /** // * Deletes the task with the id // * @param id task id to delete // * @return true if task existed and was deleted, false otherwise // */ // boolean delete(long id); // // /** // * Allow to specify a consumer which retrieves all tasks // * // * @param tasksConsumer // */ // // void consume(Consumer<List<Task>> tasksConsumer); // // } // // Path: com.vogella.tasks.ui/src/com/vogella/tasks/ui/wizards/TaskWizard.java // public class TaskWizard extends Wizard { // // private Task task; // // public TaskWizard(Task todo) { // this.task = todo; // setWindowTitle("New Wizard"); // } // // @Override // public void addPages() { // addPage(new CreateTaskPage1(task)); // addPage(new CreateTaskPage2()); // } // // @Override // public boolean performFinish() { // return true; // } // // }
import java.time.LocalDate; import org.eclipse.e4.core.di.annotations.Execute; import org.eclipse.e4.core.services.events.IEventBroker; import org.eclipse.jface.window.Window; import org.eclipse.jface.wizard.WizardDialog; import org.eclipse.swt.widgets.Shell; import com.vogella.tasks.model.Task; import com.vogella.tasks.model.TaskService; import com.vogella.tasks.ui.wizards.TaskWizard;
package com.vogella.tasks.ui.handlers; public class NewTaskHandler { @Execute public void execute(Shell shell, TaskService taskService, IEventBroker broker) { // use -1 to indicate a not existing id Task task = new Task(-1); task.setDueDate(LocalDate.now());
// Path: com.vogella.tasks.model/src/com/vogella/tasks/model/Task.java // public class Task { // // private transient PropertyChangeSupport changes = new PropertyChangeSupport(this); // // public static final String FIELD_ID = "id"; // public static final String FIELD_SUMMARY = "summary"; // public static final String FIELD_DESCRIPTION = "description"; // public static final String FIELD_DONE = "done"; // public static final String FIELD_DUEDATE = "dueDate"; // // private final long id; // private String summary = ""; // private String description = ""; // private boolean done = false; // private LocalDate dueDate = LocalDate.now(); // // public Task(long id, String summary, String description, boolean done, LocalDate dueDate) { // this.id = id; // this.summary = summary; // this.description = description; // this.done = done; // this.dueDate = dueDate; // } // // public Task(long id) { // this.id = id; // } // // public String getSummary() { // return summary; // } // // public void setSummary(String summary) { // changes.firePropertyChange(FIELD_SUMMARY, this.summary, this.summary = summary); // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // changes.firePropertyChange(FIELD_DESCRIPTION, this.description, this.description = description); // } // public boolean isDone() { // return done; // } // // public void setDone(boolean isDone) { // changes.firePropertyChange(FIELD_DONE, this.done, this.done = isDone); // } // // public LocalDate getDueDate() { // return dueDate; // } // // public void setDueDate(LocalDate dueDate) { // changes.firePropertyChange(FIELD_DUEDATE, this.dueDate, this.dueDate = dueDate); // } // // public long getId() { // return id; // } // // // @Override // public int hashCode() { // return Objects.hash(id); // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // Task other = (Task) obj; // return id == other.id; // } // // @Override // public String toString() { // return "Task [id=" + id + ", summary=" + summary + "]"; // } // // public Task copy() { // return new Task(this.id, this.summary, this.description, this.done, this.dueDate); // } // // public void addPropertyChangeListener(PropertyChangeListener l) { // changes.addPropertyChangeListener(l); // } // // public void removePropertyChangeListener(PropertyChangeListener l) { // changes.removePropertyChangeListener(l); // } // // /** // * Only need for JSON serialization and de-serialization // */ // public void restorePropertyChangeListener() { // if (Objects.isNull(changes)) { // changes = new PropertyChangeSupport(this); // } // } // } // // Path: com.vogella.tasks.model/src/com/vogella/tasks/model/TaskService.java // public interface TaskService { // // /** // * Get all tasks // */ // List<Task> getAll(); // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // // // /** // * Updates existing task or create new task // * // * @param task // * @return // */ // boolean update(Task task); // // /** // * Updates existing task or create new task // * // * @param task // * @return empty optional if not found, otherwise Optional holder the task // */ // // Optional<Task> get(long id); // // /** // * Deletes the task with the id // * @param id task id to delete // * @return true if task existed and was deleted, false otherwise // */ // boolean delete(long id); // // /** // * Allow to specify a consumer which retrieves all tasks // * // * @param tasksConsumer // */ // // void consume(Consumer<List<Task>> tasksConsumer); // // } // // Path: com.vogella.tasks.ui/src/com/vogella/tasks/ui/wizards/TaskWizard.java // public class TaskWizard extends Wizard { // // private Task task; // // public TaskWizard(Task todo) { // this.task = todo; // setWindowTitle("New Wizard"); // } // // @Override // public void addPages() { // addPage(new CreateTaskPage1(task)); // addPage(new CreateTaskPage2()); // } // // @Override // public boolean performFinish() { // return true; // } // // } // Path: com.vogella.tasks.ui/src/com/vogella/tasks/ui/handlers/NewTaskHandler.java import java.time.LocalDate; import org.eclipse.e4.core.di.annotations.Execute; import org.eclipse.e4.core.services.events.IEventBroker; import org.eclipse.jface.window.Window; import org.eclipse.jface.wizard.WizardDialog; import org.eclipse.swt.widgets.Shell; import com.vogella.tasks.model.Task; import com.vogella.tasks.model.TaskService; import com.vogella.tasks.ui.wizards.TaskWizard; package com.vogella.tasks.ui.handlers; public class NewTaskHandler { @Execute public void execute(Shell shell, TaskService taskService, IEventBroker broker) { // use -1 to indicate a not existing id Task task = new Task(-1); task.setDueDate(LocalDate.now());
var dialog = new WizardDialog(shell, new TaskWizard(task));
melloc/roguelike
engine/src/main/java/edu/brown/cs/roguelike/engine/entities/Weapon.java
// Path: engine/src/main/java/edu/brown/cs/roguelike/engine/entities/events/ChangeStats.java // public class ChangeStats extends Action { // // /** // * Generated // */ // private static final long serialVersionUID = 187342592937715063L; // // EntityManager manager = null; // // private Stats delta; // // public ChangeStats(Stats delta) { // super(0); // this.delta = delta; // } // // public void apply(EntityActionManager queue) { // queue.changeStats(delta); // }; // // /*** BEGIN Saveable ***/ // // private UUID id; // // /** initialize id **/ // { // this.id = UUID.randomUUID(); // } // // @Override // public int hashCode() { // final int prime = 31; // int result = 1; // result = prime * result + ((id == null) ? 0 : id.hashCode()); // return result; // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // ChangeStats other = (ChangeStats) obj; // if (id == null) { // if (other.id != null) // return false; // } else if (id.equals(other.id)) // // return true if ids are the same // return true; // return false; // } // // @Override // public UUID getId() { // return this.id; // } // // /*** END Saveable ***/ // // }
import com.googlecode.lanterna.terminal.Terminal.Color; import edu.brown.cs.roguelike.engine.entities.events.ChangeStats;
package edu.brown.cs.roguelike.engine.entities; public class Weapon extends Stackable{ /** * Generated */ private static final long serialVersionUID = -5817532170958350132L; protected Stats stats; private final Action wieldAction; private final Action unwieldAction; private String description; private DamageType damageType; public Weapon(Stats stats, String description, DamageType dt) { this.stats = stats;
// Path: engine/src/main/java/edu/brown/cs/roguelike/engine/entities/events/ChangeStats.java // public class ChangeStats extends Action { // // /** // * Generated // */ // private static final long serialVersionUID = 187342592937715063L; // // EntityManager manager = null; // // private Stats delta; // // public ChangeStats(Stats delta) { // super(0); // this.delta = delta; // } // // public void apply(EntityActionManager queue) { // queue.changeStats(delta); // }; // // /*** BEGIN Saveable ***/ // // private UUID id; // // /** initialize id **/ // { // this.id = UUID.randomUUID(); // } // // @Override // public int hashCode() { // final int prime = 31; // int result = 1; // result = prime * result + ((id == null) ? 0 : id.hashCode()); // return result; // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // ChangeStats other = (ChangeStats) obj; // if (id == null) { // if (other.id != null) // return false; // } else if (id.equals(other.id)) // // return true if ids are the same // return true; // return false; // } // // @Override // public UUID getId() { // return this.id; // } // // /*** END Saveable ***/ // // } // Path: engine/src/main/java/edu/brown/cs/roguelike/engine/entities/Weapon.java import com.googlecode.lanterna.terminal.Terminal.Color; import edu.brown.cs.roguelike.engine.entities.events.ChangeStats; package edu.brown.cs.roguelike.engine.entities; public class Weapon extends Stackable{ /** * Generated */ private static final long serialVersionUID = -5817532170958350132L; protected Stats stats; private final Action wieldAction; private final Action unwieldAction; private String description; private DamageType damageType; public Weapon(Stats stats, String description, DamageType dt) { this.stats = stats;
wieldAction = new ChangeStats(stats);
melloc/roguelike
game/src/test/java/edu/brown/cs/roguelike/level/test/PathFinderTest.java
// Path: game/src/main/java/edu/brown/cs/roguelike/game/DemoApplication.java // public class DemoApplication extends Application { // // public DemoApplication() { // super("demo"); // } // // @Override // protected boolean initialize(Vec2i screenSize) { // this.layers.push(new DemoLayer(this, screenSize)); // return true; // } // // @Override // public Vec2i getSize() { // return new Vec2i(80,30); // } // // @Override // public void deleteSaveFile() { // // TODO Auto-generated method stub // // } // }
import edu.brown.cs.roguelike.game.DemoApplication;
package edu.brown.cs.roguelike.level.test; public class PathFinderTest { public static void main(String[] args) {
// Path: game/src/main/java/edu/brown/cs/roguelike/game/DemoApplication.java // public class DemoApplication extends Application { // // public DemoApplication() { // super("demo"); // } // // @Override // protected boolean initialize(Vec2i screenSize) { // this.layers.push(new DemoLayer(this, screenSize)); // return true; // } // // @Override // public Vec2i getSize() { // return new Vec2i(80,30); // } // // @Override // public void deleteSaveFile() { // // TODO Auto-generated method stub // // } // } // Path: game/src/test/java/edu/brown/cs/roguelike/level/test/PathFinderTest.java import edu.brown.cs.roguelike.game.DemoApplication; package edu.brown.cs.roguelike.level.test; public class PathFinderTest { public static void main(String[] args) {
DemoApplication app = new DemoApplication();
melloc/roguelike
engine/src/main/java/edu/brown/cs/roguelike/engine/game/Announcer.java
// Path: engine/src/main/java/edu/brown/cs/roguelike/engine/graphics/Application.java // public abstract class Application extends LanternaFrontend { // // /** // * This stack contains all elements in the game that should be drawn. // * The element on top of the stack is considered the `active` element, // * and receives all key presses. // */ // protected Stack<Layer> layers = new Stack<Layer>(); // // public Stack<Layer> getLayers() {return layers;} // // public Application(String title) { // super(title); // } // // @Override // protected void onTick(long nanosSincePreviousTick) { // for (Layer layer : layers) // layer.tick(nanosSincePreviousTick); // } // // @Override // protected void onDraw(Section s) { // for (Layer layer : layers) // layer.doDraw(s); // } // // /** // * Takes care of any initialization that is necessary for the game. For // * example, any {@link Layer}'s that need to be added to the stack should // * be added here. Any other preparation that is necessary should also be // * done here. // * // * @param screenSize The initial size of the screen. This is provided in // * case there is a need to determine where things should initially be drawn // * until the next resize (which may never happen, so passing this in is // * sort of important). // * // * @return Boolean indicating whether initialization was sucessful. // */ // protected abstract boolean initialize(Vec2i screenSize); // // @Override // protected void onKeyPressed(Key k) { // if (!layers.isEmpty()) { // Layer active = layers.peek(); // active.propagateAction(active.getActionForKey(k)); // } // } // // public abstract void deleteSaveFile(); // // // private boolean initialized = false; // // @Override // protected void onResize(Vec2i newSize) { // if (!initialized) // initialized = initialize(newSize); // // for (Layer layer : layers) // layer.updateSize(newSize); // } // // }
import java.util.ArrayList; import edu.brown.cs.roguelike.engine.graphics.Application;
package edu.brown.cs.roguelike.engine.game; public class Announcer { private final static Announcer instance = new Announcer(); public static Announcer getAnnouncer() {return instance;} private ArrayList<String> announcements; private Announcer() { announcements = new ArrayList<String>(); } /**Adds the announcement to the announcement queue * * @param s - The announcement to add */ public static void announce(String s){ getAnnouncer().announcements.add(s); }
// Path: engine/src/main/java/edu/brown/cs/roguelike/engine/graphics/Application.java // public abstract class Application extends LanternaFrontend { // // /** // * This stack contains all elements in the game that should be drawn. // * The element on top of the stack is considered the `active` element, // * and receives all key presses. // */ // protected Stack<Layer> layers = new Stack<Layer>(); // // public Stack<Layer> getLayers() {return layers;} // // public Application(String title) { // super(title); // } // // @Override // protected void onTick(long nanosSincePreviousTick) { // for (Layer layer : layers) // layer.tick(nanosSincePreviousTick); // } // // @Override // protected void onDraw(Section s) { // for (Layer layer : layers) // layer.doDraw(s); // } // // /** // * Takes care of any initialization that is necessary for the game. For // * example, any {@link Layer}'s that need to be added to the stack should // * be added here. Any other preparation that is necessary should also be // * done here. // * // * @param screenSize The initial size of the screen. This is provided in // * case there is a need to determine where things should initially be drawn // * until the next resize (which may never happen, so passing this in is // * sort of important). // * // * @return Boolean indicating whether initialization was sucessful. // */ // protected abstract boolean initialize(Vec2i screenSize); // // @Override // protected void onKeyPressed(Key k) { // if (!layers.isEmpty()) { // Layer active = layers.peek(); // active.propagateAction(active.getActionForKey(k)); // } // } // // public abstract void deleteSaveFile(); // // // private boolean initialized = false; // // @Override // protected void onResize(Vec2i newSize) { // if (!initialized) // initialized = initialize(newSize); // // for (Layer layer : layers) // layer.updateSize(newSize); // } // // } // Path: engine/src/main/java/edu/brown/cs/roguelike/engine/game/Announcer.java import java.util.ArrayList; import edu.brown.cs.roguelike.engine.graphics.Application; package edu.brown.cs.roguelike.engine.game; public class Announcer { private final static Announcer instance = new Announcer(); public static Announcer getAnnouncer() {return instance;} private ArrayList<String> announcements; private Announcer() { announcements = new ArrayList<String>(); } /**Adds the announcement to the announcement queue * * @param s - The announcement to add */ public static void announce(String s){ getAnnouncer().announcements.add(s); }
public void display(Application app) {
melloc/roguelike
engine/src/main/java/edu/brown/cs/roguelike/engine/config/WeaponTemplate.java
// Path: engine/src/main/java/edu/brown/cs/roguelike/engine/entities/DamageType.java // public enum DamageType { // PIERCE, // SLASH, // BLUNT, // MAGIC, // FIRE, // COLD, // LIGHT, // DARK, // WIND, // EARTH // }
import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import edu.brown.cs.roguelike.engine.entities.DamageType;
package edu.brown.cs.roguelike.engine.config; /** * Intermediate Weapon Type Format * * * @author jte * */ public class WeaponTemplate { public final int tier; public final String name;
// Path: engine/src/main/java/edu/brown/cs/roguelike/engine/entities/DamageType.java // public enum DamageType { // PIERCE, // SLASH, // BLUNT, // MAGIC, // FIRE, // COLD, // LIGHT, // DARK, // WIND, // EARTH // } // Path: engine/src/main/java/edu/brown/cs/roguelike/engine/config/WeaponTemplate.java import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import edu.brown.cs.roguelike.engine.entities.DamageType; package edu.brown.cs.roguelike.engine.config; /** * Intermediate Weapon Type Format * * * @author jte * */ public class WeaponTemplate { public final int tier; public final String name;
public final DamageType damageType;
melloc/roguelike
engine/src/main/java/edu/brown/cs/roguelike/engine/entities/MainCharacter.java
// Path: engine/src/main/java/edu/brown/cs/roguelike/engine/game/Announcer.java // public class Announcer { // private final static Announcer instance = new Announcer(); // public static Announcer getAnnouncer() {return instance;} // // private ArrayList<String> announcements; // private Announcer() { // announcements = new ArrayList<String>(); // } // // /**Adds the announcement to the announcement queue // * // * @param s - The announcement to add // */ // public static void announce(String s){ // getAnnouncer().announcements.add(s); // } // // public void display(Application app) { // app.getLayers().push(new AnnounceLayer(app, announcements)); // } // // public static void displayAnnouncements(Application app) { // if(getAnnouncer().announcements.size() > 0) // getAnnouncer().display(app); // } // } // // Path: engine/src/main/java/edu/brown/cs/roguelike/engine/level/Direction.java // public enum Direction { // LEFT(-1, 0), RIGHT(1, 0), UP(0, -1), DOWN(0, 1); // // protected Vec2i delta = null; // // Direction(int x, int y) { // delta = new Vec2i(x, y); // } // // /** // * @return the delta on the map to get to our new tile. // */ // public Vec2i getDelta() { // return delta; // } // }
import java.util.ArrayList; import java.util.List; import com.googlecode.lanterna.terminal.Terminal.Color; import edu.brown.cs.roguelike.engine.game.Announcer; import edu.brown.cs.roguelike.engine.level.Direction;
return nextLevelXP; } public int getPlayerLevel() { return playerLevel; } public MainCharacter(String name) { this.name = name; this.color = Color.DEFAULT; this.character = '@'; this.HP = 100; this.startHP = this.HP; this.stats = new Stats(10,4); baseStats = stats; this.team = 1; this.XP = 0; nextLevelXP = 6; playerLevel = 1; } @Override protected void die() { this.location.setEntity(null); this.manager.call(Event.DEATH); } @Override protected void onKillEntity(Combatable combatable) {
// Path: engine/src/main/java/edu/brown/cs/roguelike/engine/game/Announcer.java // public class Announcer { // private final static Announcer instance = new Announcer(); // public static Announcer getAnnouncer() {return instance;} // // private ArrayList<String> announcements; // private Announcer() { // announcements = new ArrayList<String>(); // } // // /**Adds the announcement to the announcement queue // * // * @param s - The announcement to add // */ // public static void announce(String s){ // getAnnouncer().announcements.add(s); // } // // public void display(Application app) { // app.getLayers().push(new AnnounceLayer(app, announcements)); // } // // public static void displayAnnouncements(Application app) { // if(getAnnouncer().announcements.size() > 0) // getAnnouncer().display(app); // } // } // // Path: engine/src/main/java/edu/brown/cs/roguelike/engine/level/Direction.java // public enum Direction { // LEFT(-1, 0), RIGHT(1, 0), UP(0, -1), DOWN(0, 1); // // protected Vec2i delta = null; // // Direction(int x, int y) { // delta = new Vec2i(x, y); // } // // /** // * @return the delta on the map to get to our new tile. // */ // public Vec2i getDelta() { // return delta; // } // } // Path: engine/src/main/java/edu/brown/cs/roguelike/engine/entities/MainCharacter.java import java.util.ArrayList; import java.util.List; import com.googlecode.lanterna.terminal.Terminal.Color; import edu.brown.cs.roguelike.engine.game.Announcer; import edu.brown.cs.roguelike.engine.level.Direction; return nextLevelXP; } public int getPlayerLevel() { return playerLevel; } public MainCharacter(String name) { this.name = name; this.color = Color.DEFAULT; this.character = '@'; this.HP = 100; this.startHP = this.HP; this.stats = new Stats(10,4); baseStats = stats; this.team = 1; this.XP = 0; nextLevelXP = 6; playerLevel = 1; } @Override protected void die() { this.location.setEntity(null); this.manager.call(Event.DEATH); } @Override protected void onKillEntity(Combatable combatable) {
Announcer.announce("You defeated the " + combatable.getDescription());
melloc/roguelike
engine/src/main/java/edu/brown/cs/roguelike/engine/entities/MainCharacter.java
// Path: engine/src/main/java/edu/brown/cs/roguelike/engine/game/Announcer.java // public class Announcer { // private final static Announcer instance = new Announcer(); // public static Announcer getAnnouncer() {return instance;} // // private ArrayList<String> announcements; // private Announcer() { // announcements = new ArrayList<String>(); // } // // /**Adds the announcement to the announcement queue // * // * @param s - The announcement to add // */ // public static void announce(String s){ // getAnnouncer().announcements.add(s); // } // // public void display(Application app) { // app.getLayers().push(new AnnounceLayer(app, announcements)); // } // // public static void displayAnnouncements(Application app) { // if(getAnnouncer().announcements.size() > 0) // getAnnouncer().display(app); // } // } // // Path: engine/src/main/java/edu/brown/cs/roguelike/engine/level/Direction.java // public enum Direction { // LEFT(-1, 0), RIGHT(1, 0), UP(0, -1), DOWN(0, 1); // // protected Vec2i delta = null; // // Direction(int x, int y) { // delta = new Vec2i(x, y); // } // // /** // * @return the delta on the map to get to our new tile. // */ // public Vec2i getDelta() { // return delta; // } // }
import java.util.ArrayList; import java.util.List; import com.googlecode.lanterna.terminal.Terminal.Color; import edu.brown.cs.roguelike.engine.game.Announcer; import edu.brown.cs.roguelike.engine.level.Direction;
protected void onKillEntity(Combatable combatable) { Announcer.announce("You defeated the " + combatable.getDescription()); Monster m = (Monster) combatable; this.XP += m.tier; if(XP >= nextLevelXP) { XP -=nextLevelXP; levelUp(); Announcer.announce("Welcome to level " + playerLevel); } } private final int HP_GROWTH = 10; private final int ATTACK_GROWTH = 3; private final int DEFENSE_GROWTH = 1; private void levelUp() { playerLevel++; this.startHP += HP_GROWTH; this.HP = startHP; this.baseStats = new Stats(baseStats.attack+ATTACK_GROWTH, baseStats.defense+DEFENSE_GROWTH); this.stats = new Stats(stats.attack+ATTACK_GROWTH, stats.defense+DEFENSE_GROWTH); nextLevelXP = (int) Math.ceil(nextLevelXP*EXP_CURVE); } public List<String> getCategories() { return categories; } @Override
// Path: engine/src/main/java/edu/brown/cs/roguelike/engine/game/Announcer.java // public class Announcer { // private final static Announcer instance = new Announcer(); // public static Announcer getAnnouncer() {return instance;} // // private ArrayList<String> announcements; // private Announcer() { // announcements = new ArrayList<String>(); // } // // /**Adds the announcement to the announcement queue // * // * @param s - The announcement to add // */ // public static void announce(String s){ // getAnnouncer().announcements.add(s); // } // // public void display(Application app) { // app.getLayers().push(new AnnounceLayer(app, announcements)); // } // // public static void displayAnnouncements(Application app) { // if(getAnnouncer().announcements.size() > 0) // getAnnouncer().display(app); // } // } // // Path: engine/src/main/java/edu/brown/cs/roguelike/engine/level/Direction.java // public enum Direction { // LEFT(-1, 0), RIGHT(1, 0), UP(0, -1), DOWN(0, 1); // // protected Vec2i delta = null; // // Direction(int x, int y) { // delta = new Vec2i(x, y); // } // // /** // * @return the delta on the map to get to our new tile. // */ // public Vec2i getDelta() { // return delta; // } // } // Path: engine/src/main/java/edu/brown/cs/roguelike/engine/entities/MainCharacter.java import java.util.ArrayList; import java.util.List; import com.googlecode.lanterna.terminal.Terminal.Color; import edu.brown.cs.roguelike.engine.game.Announcer; import edu.brown.cs.roguelike.engine.level.Direction; protected void onKillEntity(Combatable combatable) { Announcer.announce("You defeated the " + combatable.getDescription()); Monster m = (Monster) combatable; this.XP += m.tier; if(XP >= nextLevelXP) { XP -=nextLevelXP; levelUp(); Announcer.announce("Welcome to level " + playerLevel); } } private final int HP_GROWTH = 10; private final int ATTACK_GROWTH = 3; private final int DEFENSE_GROWTH = 1; private void levelUp() { playerLevel++; this.startHP += HP_GROWTH; this.HP = startHP; this.baseStats = new Stats(baseStats.attack+ATTACK_GROWTH, baseStats.defense+DEFENSE_GROWTH); this.stats = new Stats(stats.attack+ATTACK_GROWTH, stats.defense+DEFENSE_GROWTH); nextLevelXP = (int) Math.ceil(nextLevelXP*EXP_CURVE); } public List<String> getCategories() { return categories; } @Override
public void move(Direction dir) {
melloc/roguelike
engine/src/main/java/edu/brown/cs/roguelike/engine/entities/EntityManager.java
// Path: engine/src/main/java/edu/brown/cs/roguelike/engine/entities/events/Remove.java // public class Remove extends Action { // // /** // * Generated // */ // private static final long serialVersionUID = 2164260182197546382L; // // Combatable entity = null; // EntityManager manager = null; // // public Remove(Combatable entity, EntityManager manager) { // super(0); // this.entity = entity; // this.manager = manager; // } // // public void apply(EntityActionManager queue) { // this.manager.unregister(this.entity); // } // // } // // Path: engine/src/main/java/edu/brown/cs/roguelike/engine/save/Saveable.java // public interface Saveable extends Serializable { // // /** // * @return globally unique UUID // */ // public UUID getId(); // // /** // * Hash based on this classes id // * // * @return int hash code // */ // public abstract int hashCode(); // // /** // * Overriding equals should use id to determine // * equality // * // * @param o // * @return boolean indicating object equality // */ // public abstract boolean equals(Object o); // }
import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.UUID; import edu.brown.cs.roguelike.engine.entities.events.Remove; import edu.brown.cs.roguelike.engine.save.Saveable;
package edu.brown.cs.roguelike.engine.entities; public class EntityManager implements Saveable { /** * Generated */ private static final long serialVersionUID = 6538908714623761737L; /** * Every EntityActionManager that truly exists. */ protected List<EntityActionManager> everything = new ArrayList<EntityActionManager>(); protected HashMap<String,List<EntityActionManager>> map = new HashMap<String,List<EntityActionManager>>(); public EntityManager() { } protected void addToCategory(String category, EntityActionManager manager) { List<EntityActionManager> managers = map.get(category); if (managers == null) { managers = new ArrayList<EntityActionManager>(); map.put(category, managers); } managers.add(manager); } /** * Convenience method that creates an EntityActionManager for entity * and adds it to map and everything * * @param entity the Combatable to be registered * @return the EntityActionManager created for entity and then added */ public EntityActionManager register(Combatable entity) { EntityActionManager manager = new LocalEntityActionManager(entity);
// Path: engine/src/main/java/edu/brown/cs/roguelike/engine/entities/events/Remove.java // public class Remove extends Action { // // /** // * Generated // */ // private static final long serialVersionUID = 2164260182197546382L; // // Combatable entity = null; // EntityManager manager = null; // // public Remove(Combatable entity, EntityManager manager) { // super(0); // this.entity = entity; // this.manager = manager; // } // // public void apply(EntityActionManager queue) { // this.manager.unregister(this.entity); // } // // } // // Path: engine/src/main/java/edu/brown/cs/roguelike/engine/save/Saveable.java // public interface Saveable extends Serializable { // // /** // * @return globally unique UUID // */ // public UUID getId(); // // /** // * Hash based on this classes id // * // * @return int hash code // */ // public abstract int hashCode(); // // /** // * Overriding equals should use id to determine // * equality // * // * @param o // * @return boolean indicating object equality // */ // public abstract boolean equals(Object o); // } // Path: engine/src/main/java/edu/brown/cs/roguelike/engine/entities/EntityManager.java import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.UUID; import edu.brown.cs.roguelike.engine.entities.events.Remove; import edu.brown.cs.roguelike.engine.save.Saveable; package edu.brown.cs.roguelike.engine.entities; public class EntityManager implements Saveable { /** * Generated */ private static final long serialVersionUID = 6538908714623761737L; /** * Every EntityActionManager that truly exists. */ protected List<EntityActionManager> everything = new ArrayList<EntityActionManager>(); protected HashMap<String,List<EntityActionManager>> map = new HashMap<String,List<EntityActionManager>>(); public EntityManager() { } protected void addToCategory(String category, EntityActionManager manager) { List<EntityActionManager> managers = map.get(category); if (managers == null) { managers = new ArrayList<EntityActionManager>(); map.put(category, managers); } managers.add(manager); } /** * Convenience method that creates an EntityActionManager for entity * and adds it to map and everything * * @param entity the Combatable to be registered * @return the EntityActionManager created for entity and then added */ public EntityActionManager register(Combatable entity) { EntityActionManager manager = new LocalEntityActionManager(entity);
manager.on(Event.DEATH, new Remove(entity, this));
melloc/roguelike
engine/src/main/java/edu/brown/cs/roguelike/engine/entities/events/Wait.java
// Path: engine/src/main/java/edu/brown/cs/roguelike/engine/entities/Action.java // public abstract class Action implements Saveable { // // /** // * Generated // */ // private static final long serialVersionUID = 786756738941365502L; // // /** // * The cost of taking this Action // */ // private int cost; // // public Action(int cost) { // this.cost = cost; // } // // public void setCost(int cost) { // this.cost = cost; // } // // public int getCost() { return this.cost; } // // public abstract void apply(EntityActionManager queue); // // /*** BEGIN Saveable ***/ // // private UUID id; // // /** initialize id **/ // { // this.id = UUID.randomUUID(); // } // // @Override // public int hashCode() { // final int prime = 31; // int result = 1; // result = prime * result + ((id == null) ? 0 : id.hashCode()); // return result; // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // Action other = (Action) obj; // if (id == null) { // if (other.id != null) // return false; // } else if (id.equals(other.id)) // // return true if ids are the same // return true; // return false; // } // // @Override // public UUID getId() { // return this.id; // } // // /*** END Saveable ***/ // } // // Path: engine/src/main/java/edu/brown/cs/roguelike/engine/entities/EntityActionManager.java // public interface EntityActionManager { // // public Combatable getEntity(); // // public Tile getLocation(); // public Stats getStats(); // // public int getActionPoints(); // public void useActionPoints(int ap); // public void addActionPoints(int ap); // // public void on(Event e, Action callback); // public void call(Event e); // // public Action getNextAction(); // public void takeNextAction(); // public void setNextAction(Action nextAction); // public boolean hasNextAction(); // // public void sendMove(Direction dir); // public void changeHP(int delta); // public void toggleVisibility(); // public void changeStats(Stats delta); // public void drop(Stackable s); // // public void modify(???); // // public void timed(???); // // }
import edu.brown.cs.roguelike.engine.entities.Action; import edu.brown.cs.roguelike.engine.entities.EntityActionManager;
package edu.brown.cs.roguelike.engine.entities.events; public class Wait extends Action { /** * Generated */ private static final long serialVersionUID = 4304058536153513684L; public Wait() { super(-1); // special case // TODO Auto-generated constructor stub } @Override
// Path: engine/src/main/java/edu/brown/cs/roguelike/engine/entities/Action.java // public abstract class Action implements Saveable { // // /** // * Generated // */ // private static final long serialVersionUID = 786756738941365502L; // // /** // * The cost of taking this Action // */ // private int cost; // // public Action(int cost) { // this.cost = cost; // } // // public void setCost(int cost) { // this.cost = cost; // } // // public int getCost() { return this.cost; } // // public abstract void apply(EntityActionManager queue); // // /*** BEGIN Saveable ***/ // // private UUID id; // // /** initialize id **/ // { // this.id = UUID.randomUUID(); // } // // @Override // public int hashCode() { // final int prime = 31; // int result = 1; // result = prime * result + ((id == null) ? 0 : id.hashCode()); // return result; // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // Action other = (Action) obj; // if (id == null) { // if (other.id != null) // return false; // } else if (id.equals(other.id)) // // return true if ids are the same // return true; // return false; // } // // @Override // public UUID getId() { // return this.id; // } // // /*** END Saveable ***/ // } // // Path: engine/src/main/java/edu/brown/cs/roguelike/engine/entities/EntityActionManager.java // public interface EntityActionManager { // // public Combatable getEntity(); // // public Tile getLocation(); // public Stats getStats(); // // public int getActionPoints(); // public void useActionPoints(int ap); // public void addActionPoints(int ap); // // public void on(Event e, Action callback); // public void call(Event e); // // public Action getNextAction(); // public void takeNextAction(); // public void setNextAction(Action nextAction); // public boolean hasNextAction(); // // public void sendMove(Direction dir); // public void changeHP(int delta); // public void toggleVisibility(); // public void changeStats(Stats delta); // public void drop(Stackable s); // // public void modify(???); // // public void timed(???); // // } // Path: engine/src/main/java/edu/brown/cs/roguelike/engine/entities/events/Wait.java import edu.brown.cs.roguelike.engine.entities.Action; import edu.brown.cs.roguelike.engine.entities.EntityActionManager; package edu.brown.cs.roguelike.engine.entities.events; public class Wait extends Action { /** * Generated */ private static final long serialVersionUID = 4304058536153513684L; public Wait() { super(-1); // special case // TODO Auto-generated constructor stub } @Override
public void apply(EntityActionManager queue) {
melloc/roguelike
engine/src/main/java/edu/brown/cs/roguelike/engine/fsm/monster/ActionState.java
// Path: engine/src/main/java/edu/brown/cs/roguelike/engine/entities/Action.java // public abstract class Action implements Saveable { // // /** // * Generated // */ // private static final long serialVersionUID = 786756738941365502L; // // /** // * The cost of taking this Action // */ // private int cost; // // public Action(int cost) { // this.cost = cost; // } // // public void setCost(int cost) { // this.cost = cost; // } // // public int getCost() { return this.cost; } // // public abstract void apply(EntityActionManager queue); // // /*** BEGIN Saveable ***/ // // private UUID id; // // /** initialize id **/ // { // this.id = UUID.randomUUID(); // } // // @Override // public int hashCode() { // final int prime = 31; // int result = 1; // result = prime * result + ((id == null) ? 0 : id.hashCode()); // return result; // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // Action other = (Action) obj; // if (id == null) { // if (other.id != null) // return false; // } else if (id.equals(other.id)) // // return true if ids are the same // return true; // return false; // } // // @Override // public UUID getId() { // return this.id; // } // // /*** END Saveable ***/ // } // // Path: engine/src/main/java/edu/brown/cs/roguelike/engine/fsm/Input.java // public interface Input { // } // // Path: engine/src/main/java/edu/brown/cs/roguelike/engine/fsm/State.java // public abstract class State<I extends Input> implements Saveable { // // /** // * Generated // */ // private static final long serialVersionUID = -2729803608828543111L; // // private ArrayList<Transition<I>> transitions; // // public State() { // this.transitions = new ArrayList<Transition<I>>(); // } // // /** // * Adds a transition to this State, and re-sorts the ArrayList // * so that higher-priority States come first // * // * @param t // */ // public void addTransition(Transition<I> t) { // transitions.add(t); // Collections.sort(transitions); // } // // public abstract void onActive(); // public abstract void onEnter(); // public abstract void onExit(); // // // /** // * Gets the next State, traversing the Transitions in // * order of highest to lowest priority. This order is guaranteed // * by addTransition. // * // * If transition, calls onExit on this and onEnter on next state. // * Otherwise returns this. // * // * @param i (Input) input condition used to determine the next State // * @return // */ // public State<I> nextState(I i) { // // for (Transition<I> t : transitions) { // // if (t.isReady(i)) { // State<I> next = t.getTargetState(); // this.onExit(); // next.onEnter(); // return next; // } // } // // // if no Transitions were succesful, just loop back to self // return this; // } // // /*** BEGIN Saveable ***/ // // private UUID id; // // /** initialize id **/ // { // this.id = UUID.randomUUID(); // } // // @Override // public int hashCode() { // final int prime = 31; // int result = 1; // result = prime * result + ((id == null) ? 0 : id.hashCode()); // return result; // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // // TODO: figure out how to safely handle this cast // State<I> other = (State<I>) obj; // if (id == null) { // if (other.id != null) // return false; // } else if (id.equals(other.id)) // // return true if ids are the same // return true; // return false; // } // // @Override // public UUID getId() { // return this.id; // } // // /*** END Saveable ***/ // // // }
import edu.brown.cs.roguelike.engine.entities.Action; import edu.brown.cs.roguelike.engine.fsm.Input; import edu.brown.cs.roguelike.engine.fsm.State;
package edu.brown.cs.roguelike.engine.fsm.monster; public abstract class ActionState<I extends Input> extends State<I> { /** * Generated */ private static final long serialVersionUID = 5601174407092298219L;
// Path: engine/src/main/java/edu/brown/cs/roguelike/engine/entities/Action.java // public abstract class Action implements Saveable { // // /** // * Generated // */ // private static final long serialVersionUID = 786756738941365502L; // // /** // * The cost of taking this Action // */ // private int cost; // // public Action(int cost) { // this.cost = cost; // } // // public void setCost(int cost) { // this.cost = cost; // } // // public int getCost() { return this.cost; } // // public abstract void apply(EntityActionManager queue); // // /*** BEGIN Saveable ***/ // // private UUID id; // // /** initialize id **/ // { // this.id = UUID.randomUUID(); // } // // @Override // public int hashCode() { // final int prime = 31; // int result = 1; // result = prime * result + ((id == null) ? 0 : id.hashCode()); // return result; // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // Action other = (Action) obj; // if (id == null) { // if (other.id != null) // return false; // } else if (id.equals(other.id)) // // return true if ids are the same // return true; // return false; // } // // @Override // public UUID getId() { // return this.id; // } // // /*** END Saveable ***/ // } // // Path: engine/src/main/java/edu/brown/cs/roguelike/engine/fsm/Input.java // public interface Input { // } // // Path: engine/src/main/java/edu/brown/cs/roguelike/engine/fsm/State.java // public abstract class State<I extends Input> implements Saveable { // // /** // * Generated // */ // private static final long serialVersionUID = -2729803608828543111L; // // private ArrayList<Transition<I>> transitions; // // public State() { // this.transitions = new ArrayList<Transition<I>>(); // } // // /** // * Adds a transition to this State, and re-sorts the ArrayList // * so that higher-priority States come first // * // * @param t // */ // public void addTransition(Transition<I> t) { // transitions.add(t); // Collections.sort(transitions); // } // // public abstract void onActive(); // public abstract void onEnter(); // public abstract void onExit(); // // // /** // * Gets the next State, traversing the Transitions in // * order of highest to lowest priority. This order is guaranteed // * by addTransition. // * // * If transition, calls onExit on this and onEnter on next state. // * Otherwise returns this. // * // * @param i (Input) input condition used to determine the next State // * @return // */ // public State<I> nextState(I i) { // // for (Transition<I> t : transitions) { // // if (t.isReady(i)) { // State<I> next = t.getTargetState(); // this.onExit(); // next.onEnter(); // return next; // } // } // // // if no Transitions were succesful, just loop back to self // return this; // } // // /*** BEGIN Saveable ***/ // // private UUID id; // // /** initialize id **/ // { // this.id = UUID.randomUUID(); // } // // @Override // public int hashCode() { // final int prime = 31; // int result = 1; // result = prime * result + ((id == null) ? 0 : id.hashCode()); // return result; // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // // TODO: figure out how to safely handle this cast // State<I> other = (State<I>) obj; // if (id == null) { // if (other.id != null) // return false; // } else if (id.equals(other.id)) // // return true if ids are the same // return true; // return false; // } // // @Override // public UUID getId() { // return this.id; // } // // /*** END Saveable ***/ // // // } // Path: engine/src/main/java/edu/brown/cs/roguelike/engine/fsm/monster/ActionState.java import edu.brown.cs.roguelike.engine.entities.Action; import edu.brown.cs.roguelike.engine.fsm.Input; import edu.brown.cs.roguelike.engine.fsm.State; package edu.brown.cs.roguelike.engine.fsm.monster; public abstract class ActionState<I extends Input> extends State<I> { /** * Generated */ private static final long serialVersionUID = 5601174407092298219L;
public abstract Action getAction();
melloc/roguelike
engine/src/main/java/edu/brown/cs/roguelike/engine/game/TurnManager.java
// Path: engine/src/main/java/edu/brown/cs/roguelike/engine/entities/Action.java // public abstract class Action implements Saveable { // // /** // * Generated // */ // private static final long serialVersionUID = 786756738941365502L; // // /** // * The cost of taking this Action // */ // private int cost; // // public Action(int cost) { // this.cost = cost; // } // // public void setCost(int cost) { // this.cost = cost; // } // // public int getCost() { return this.cost; } // // public abstract void apply(EntityActionManager queue); // // /*** BEGIN Saveable ***/ // // private UUID id; // // /** initialize id **/ // { // this.id = UUID.randomUUID(); // } // // @Override // public int hashCode() { // final int prime = 31; // int result = 1; // result = prime * result + ((id == null) ? 0 : id.hashCode()); // return result; // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // Action other = (Action) obj; // if (id == null) { // if (other.id != null) // return false; // } else if (id.equals(other.id)) // // return true if ids are the same // return true; // return false; // } // // @Override // public UUID getId() { // return this.id; // } // // /*** END Saveable ***/ // } // // Path: engine/src/main/java/edu/brown/cs/roguelike/engine/graphics/Application.java // public abstract class Application extends LanternaFrontend { // // /** // * This stack contains all elements in the game that should be drawn. // * The element on top of the stack is considered the `active` element, // * and receives all key presses. // */ // protected Stack<Layer> layers = new Stack<Layer>(); // // public Stack<Layer> getLayers() {return layers;} // // public Application(String title) { // super(title); // } // // @Override // protected void onTick(long nanosSincePreviousTick) { // for (Layer layer : layers) // layer.tick(nanosSincePreviousTick); // } // // @Override // protected void onDraw(Section s) { // for (Layer layer : layers) // layer.doDraw(s); // } // // /** // * Takes care of any initialization that is necessary for the game. For // * example, any {@link Layer}'s that need to be added to the stack should // * be added here. Any other preparation that is necessary should also be // * done here. // * // * @param screenSize The initial size of the screen. This is provided in // * case there is a need to determine where things should initially be drawn // * until the next resize (which may never happen, so passing this in is // * sort of important). // * // * @return Boolean indicating whether initialization was sucessful. // */ // protected abstract boolean initialize(Vec2i screenSize); // // @Override // protected void onKeyPressed(Key k) { // if (!layers.isEmpty()) { // Layer active = layers.peek(); // active.propagateAction(active.getActionForKey(k)); // } // } // // public abstract void deleteSaveFile(); // // // private boolean initialized = false; // // @Override // protected void onResize(Vec2i newSize) { // if (!initialized) // initialized = initialize(newSize); // // for (Layer layer : layers) // layer.updateSize(newSize); // } // // } // // Path: engine/src/main/java/edu/brown/cs/roguelike/engine/save/Saveable.java // public interface Saveable extends Serializable { // // /** // * @return globally unique UUID // */ // public UUID getId(); // // /** // * Hash based on this classes id // * // * @return int hash code // */ // public abstract int hashCode(); // // /** // * Overriding equals should use id to determine // * equality // * // * @param o // * @return boolean indicating object equality // */ // public abstract boolean equals(Object o); // }
import java.util.UUID; import edu.brown.cs.roguelike.engine.entities.Action; import edu.brown.cs.roguelike.engine.graphics.Application; import edu.brown.cs.roguelike.engine.save.Saveable;
package edu.brown.cs.roguelike.engine.game; /** * * Responsible for managing turns. * * * @author lelberty * */ public abstract class TurnManager implements Saveable { /** * Generated */ private static final long serialVersionUID = -8611255057971437450L; protected Game game; protected final int waitCost;
// Path: engine/src/main/java/edu/brown/cs/roguelike/engine/entities/Action.java // public abstract class Action implements Saveable { // // /** // * Generated // */ // private static final long serialVersionUID = 786756738941365502L; // // /** // * The cost of taking this Action // */ // private int cost; // // public Action(int cost) { // this.cost = cost; // } // // public void setCost(int cost) { // this.cost = cost; // } // // public int getCost() { return this.cost; } // // public abstract void apply(EntityActionManager queue); // // /*** BEGIN Saveable ***/ // // private UUID id; // // /** initialize id **/ // { // this.id = UUID.randomUUID(); // } // // @Override // public int hashCode() { // final int prime = 31; // int result = 1; // result = prime * result + ((id == null) ? 0 : id.hashCode()); // return result; // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // Action other = (Action) obj; // if (id == null) { // if (other.id != null) // return false; // } else if (id.equals(other.id)) // // return true if ids are the same // return true; // return false; // } // // @Override // public UUID getId() { // return this.id; // } // // /*** END Saveable ***/ // } // // Path: engine/src/main/java/edu/brown/cs/roguelike/engine/graphics/Application.java // public abstract class Application extends LanternaFrontend { // // /** // * This stack contains all elements in the game that should be drawn. // * The element on top of the stack is considered the `active` element, // * and receives all key presses. // */ // protected Stack<Layer> layers = new Stack<Layer>(); // // public Stack<Layer> getLayers() {return layers;} // // public Application(String title) { // super(title); // } // // @Override // protected void onTick(long nanosSincePreviousTick) { // for (Layer layer : layers) // layer.tick(nanosSincePreviousTick); // } // // @Override // protected void onDraw(Section s) { // for (Layer layer : layers) // layer.doDraw(s); // } // // /** // * Takes care of any initialization that is necessary for the game. For // * example, any {@link Layer}'s that need to be added to the stack should // * be added here. Any other preparation that is necessary should also be // * done here. // * // * @param screenSize The initial size of the screen. This is provided in // * case there is a need to determine where things should initially be drawn // * until the next resize (which may never happen, so passing this in is // * sort of important). // * // * @return Boolean indicating whether initialization was sucessful. // */ // protected abstract boolean initialize(Vec2i screenSize); // // @Override // protected void onKeyPressed(Key k) { // if (!layers.isEmpty()) { // Layer active = layers.peek(); // active.propagateAction(active.getActionForKey(k)); // } // } // // public abstract void deleteSaveFile(); // // // private boolean initialized = false; // // @Override // protected void onResize(Vec2i newSize) { // if (!initialized) // initialized = initialize(newSize); // // for (Layer layer : layers) // layer.updateSize(newSize); // } // // } // // Path: engine/src/main/java/edu/brown/cs/roguelike/engine/save/Saveable.java // public interface Saveable extends Serializable { // // /** // * @return globally unique UUID // */ // public UUID getId(); // // /** // * Hash based on this classes id // * // * @return int hash code // */ // public abstract int hashCode(); // // /** // * Overriding equals should use id to determine // * equality // * // * @param o // * @return boolean indicating object equality // */ // public abstract boolean equals(Object o); // } // Path: engine/src/main/java/edu/brown/cs/roguelike/engine/game/TurnManager.java import java.util.UUID; import edu.brown.cs.roguelike.engine.entities.Action; import edu.brown.cs.roguelike.engine.graphics.Application; import edu.brown.cs.roguelike.engine.save.Saveable; package edu.brown.cs.roguelike.engine.game; /** * * Responsible for managing turns. * * * @author lelberty * */ public abstract class TurnManager implements Saveable { /** * Generated */ private static final long serialVersionUID = -8611255057971437450L; protected Game game; protected final int waitCost;
protected Application app;
melloc/roguelike
engine/src/main/java/edu/brown/cs/roguelike/engine/game/TurnManager.java
// Path: engine/src/main/java/edu/brown/cs/roguelike/engine/entities/Action.java // public abstract class Action implements Saveable { // // /** // * Generated // */ // private static final long serialVersionUID = 786756738941365502L; // // /** // * The cost of taking this Action // */ // private int cost; // // public Action(int cost) { // this.cost = cost; // } // // public void setCost(int cost) { // this.cost = cost; // } // // public int getCost() { return this.cost; } // // public abstract void apply(EntityActionManager queue); // // /*** BEGIN Saveable ***/ // // private UUID id; // // /** initialize id **/ // { // this.id = UUID.randomUUID(); // } // // @Override // public int hashCode() { // final int prime = 31; // int result = 1; // result = prime * result + ((id == null) ? 0 : id.hashCode()); // return result; // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // Action other = (Action) obj; // if (id == null) { // if (other.id != null) // return false; // } else if (id.equals(other.id)) // // return true if ids are the same // return true; // return false; // } // // @Override // public UUID getId() { // return this.id; // } // // /*** END Saveable ***/ // } // // Path: engine/src/main/java/edu/brown/cs/roguelike/engine/graphics/Application.java // public abstract class Application extends LanternaFrontend { // // /** // * This stack contains all elements in the game that should be drawn. // * The element on top of the stack is considered the `active` element, // * and receives all key presses. // */ // protected Stack<Layer> layers = new Stack<Layer>(); // // public Stack<Layer> getLayers() {return layers;} // // public Application(String title) { // super(title); // } // // @Override // protected void onTick(long nanosSincePreviousTick) { // for (Layer layer : layers) // layer.tick(nanosSincePreviousTick); // } // // @Override // protected void onDraw(Section s) { // for (Layer layer : layers) // layer.doDraw(s); // } // // /** // * Takes care of any initialization that is necessary for the game. For // * example, any {@link Layer}'s that need to be added to the stack should // * be added here. Any other preparation that is necessary should also be // * done here. // * // * @param screenSize The initial size of the screen. This is provided in // * case there is a need to determine where things should initially be drawn // * until the next resize (which may never happen, so passing this in is // * sort of important). // * // * @return Boolean indicating whether initialization was sucessful. // */ // protected abstract boolean initialize(Vec2i screenSize); // // @Override // protected void onKeyPressed(Key k) { // if (!layers.isEmpty()) { // Layer active = layers.peek(); // active.propagateAction(active.getActionForKey(k)); // } // } // // public abstract void deleteSaveFile(); // // // private boolean initialized = false; // // @Override // protected void onResize(Vec2i newSize) { // if (!initialized) // initialized = initialize(newSize); // // for (Layer layer : layers) // layer.updateSize(newSize); // } // // } // // Path: engine/src/main/java/edu/brown/cs/roguelike/engine/save/Saveable.java // public interface Saveable extends Serializable { // // /** // * @return globally unique UUID // */ // public UUID getId(); // // /** // * Hash based on this classes id // * // * @return int hash code // */ // public abstract int hashCode(); // // /** // * Overriding equals should use id to determine // * equality // * // * @param o // * @return boolean indicating object equality // */ // public abstract boolean equals(Object o); // }
import java.util.UUID; import edu.brown.cs.roguelike.engine.entities.Action; import edu.brown.cs.roguelike.engine.graphics.Application; import edu.brown.cs.roguelike.engine.save.Saveable;
package edu.brown.cs.roguelike.engine.game; /** * * Responsible for managing turns. * * * @author lelberty * */ public abstract class TurnManager implements Saveable { /** * Generated */ private static final long serialVersionUID = -8611255057971437450L; protected Game game; protected final int waitCost; protected Application app; public TurnManager(Application app, Game game, int waitCost) { this.game = game; this.waitCost = waitCost; this.app = app; } public int getWaitCost() { return this.waitCost; } /** * Every turn starts with the player's Action * @param playerAction */
// Path: engine/src/main/java/edu/brown/cs/roguelike/engine/entities/Action.java // public abstract class Action implements Saveable { // // /** // * Generated // */ // private static final long serialVersionUID = 786756738941365502L; // // /** // * The cost of taking this Action // */ // private int cost; // // public Action(int cost) { // this.cost = cost; // } // // public void setCost(int cost) { // this.cost = cost; // } // // public int getCost() { return this.cost; } // // public abstract void apply(EntityActionManager queue); // // /*** BEGIN Saveable ***/ // // private UUID id; // // /** initialize id **/ // { // this.id = UUID.randomUUID(); // } // // @Override // public int hashCode() { // final int prime = 31; // int result = 1; // result = prime * result + ((id == null) ? 0 : id.hashCode()); // return result; // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // Action other = (Action) obj; // if (id == null) { // if (other.id != null) // return false; // } else if (id.equals(other.id)) // // return true if ids are the same // return true; // return false; // } // // @Override // public UUID getId() { // return this.id; // } // // /*** END Saveable ***/ // } // // Path: engine/src/main/java/edu/brown/cs/roguelike/engine/graphics/Application.java // public abstract class Application extends LanternaFrontend { // // /** // * This stack contains all elements in the game that should be drawn. // * The element on top of the stack is considered the `active` element, // * and receives all key presses. // */ // protected Stack<Layer> layers = new Stack<Layer>(); // // public Stack<Layer> getLayers() {return layers;} // // public Application(String title) { // super(title); // } // // @Override // protected void onTick(long nanosSincePreviousTick) { // for (Layer layer : layers) // layer.tick(nanosSincePreviousTick); // } // // @Override // protected void onDraw(Section s) { // for (Layer layer : layers) // layer.doDraw(s); // } // // /** // * Takes care of any initialization that is necessary for the game. For // * example, any {@link Layer}'s that need to be added to the stack should // * be added here. Any other preparation that is necessary should also be // * done here. // * // * @param screenSize The initial size of the screen. This is provided in // * case there is a need to determine where things should initially be drawn // * until the next resize (which may never happen, so passing this in is // * sort of important). // * // * @return Boolean indicating whether initialization was sucessful. // */ // protected abstract boolean initialize(Vec2i screenSize); // // @Override // protected void onKeyPressed(Key k) { // if (!layers.isEmpty()) { // Layer active = layers.peek(); // active.propagateAction(active.getActionForKey(k)); // } // } // // public abstract void deleteSaveFile(); // // // private boolean initialized = false; // // @Override // protected void onResize(Vec2i newSize) { // if (!initialized) // initialized = initialize(newSize); // // for (Layer layer : layers) // layer.updateSize(newSize); // } // // } // // Path: engine/src/main/java/edu/brown/cs/roguelike/engine/save/Saveable.java // public interface Saveable extends Serializable { // // /** // * @return globally unique UUID // */ // public UUID getId(); // // /** // * Hash based on this classes id // * // * @return int hash code // */ // public abstract int hashCode(); // // /** // * Overriding equals should use id to determine // * equality // * // * @param o // * @return boolean indicating object equality // */ // public abstract boolean equals(Object o); // } // Path: engine/src/main/java/edu/brown/cs/roguelike/engine/game/TurnManager.java import java.util.UUID; import edu.brown.cs.roguelike.engine.entities.Action; import edu.brown.cs.roguelike.engine.graphics.Application; import edu.brown.cs.roguelike.engine.save.Saveable; package edu.brown.cs.roguelike.engine.game; /** * * Responsible for managing turns. * * * @author lelberty * */ public abstract class TurnManager implements Saveable { /** * Generated */ private static final long serialVersionUID = -8611255057971437450L; protected Game game; protected final int waitCost; protected Application app; public TurnManager(Application app, Game game, int waitCost) { this.game = game; this.waitCost = waitCost; this.app = app; } public int getWaitCost() { return this.waitCost; } /** * Every turn starts with the player's Action * @param playerAction */
public abstract void takeTurnWithoutAnnounce(Action playerAction);
flipper83/protohipster
protohipster/src/main/java/com/flipper83/protohipster/feed/domain/module/DomainModule.java
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/mappers/HipsterMapper.java // public interface HipsterMapper { // public HipsterBoundary mapper(Hipster hipster); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/mappers/HipsterMapperManual.java // public class HipsterMapperManual implements HipsterMapper { // @Inject // public HipsterMapperManual() { // } // // @Override // public HipsterBoundary mapper(Hipster hipster) { // HipsterBoundary hipsterBoundary = new HipsterBoundary(); // hipsterBoundary.setAvatar(hipster.getAvatar()); // hipsterBoundary.setUserId(hipster.getUserId()); // hipsterBoundary.setName(hipster.getName() + " " + hipster.getSurname()); // // return hipsterBoundary; // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetFeed.java // public interface GetFeed { // Observable<FeedBoundary> getFeed(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetMyLikers.java // public interface GetMyLikers { // Observable<List<String>> getMyLikers(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/LikeHipster.java // public interface LikeHipster { // public Observable<String> like(String userId); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/rating/RatingCalculator.java // public interface RatingCalculator{ // int calculate(int totalLikers); // // int defaultValue(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/rating/RatingCalculatorFiveStars.java // public class RatingCalculatorFiveStars implements RatingCalculator { // // public final static int FIVE_STARTS_NUM_LIKES = 20; // public final static int NUM_STARS = 5; // private static final int DEFAULT_VALUE = 0; // // @Inject // public RatingCalculatorFiveStars(){ // // } // // @Override // public int calculate(int totalLikers) { // // float rating = (totalLikers * NUM_STARS) / FIVE_STARTS_NUM_LIKES; // // if (rating > NUM_STARS) { // rating = NUM_STARS; // } // // return Math.round(rating); // } // // @Override // public int defaultValue() { // return DEFAULT_VALUE; // } // }
import com.flipper83.protohipster.feed.domain.mappers.HipsterMapper; import com.flipper83.protohipster.feed.domain.mappers.HipsterMapperManual; import com.flipper83.protohipster.feed.domain.interactors.GetFeed; import com.flipper83.protohipster.feed.domain.interactors.GetMyLikers; import com.flipper83.protohipster.feed.domain.interactors.LikeHipster; import com.flipper83.protohipster.globalutils.rating.RatingCalculator; import com.flipper83.protohipster.globalutils.rating.RatingCalculatorFiveStars; import dagger.Module; import dagger.Provides;
package com.flipper83.protohipster.feed.domain.module; @Module(complete = false, library = true) public class DomainModule { @Provides
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/mappers/HipsterMapper.java // public interface HipsterMapper { // public HipsterBoundary mapper(Hipster hipster); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/mappers/HipsterMapperManual.java // public class HipsterMapperManual implements HipsterMapper { // @Inject // public HipsterMapperManual() { // } // // @Override // public HipsterBoundary mapper(Hipster hipster) { // HipsterBoundary hipsterBoundary = new HipsterBoundary(); // hipsterBoundary.setAvatar(hipster.getAvatar()); // hipsterBoundary.setUserId(hipster.getUserId()); // hipsterBoundary.setName(hipster.getName() + " " + hipster.getSurname()); // // return hipsterBoundary; // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetFeed.java // public interface GetFeed { // Observable<FeedBoundary> getFeed(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetMyLikers.java // public interface GetMyLikers { // Observable<List<String>> getMyLikers(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/LikeHipster.java // public interface LikeHipster { // public Observable<String> like(String userId); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/rating/RatingCalculator.java // public interface RatingCalculator{ // int calculate(int totalLikers); // // int defaultValue(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/rating/RatingCalculatorFiveStars.java // public class RatingCalculatorFiveStars implements RatingCalculator { // // public final static int FIVE_STARTS_NUM_LIKES = 20; // public final static int NUM_STARS = 5; // private static final int DEFAULT_VALUE = 0; // // @Inject // public RatingCalculatorFiveStars(){ // // } // // @Override // public int calculate(int totalLikers) { // // float rating = (totalLikers * NUM_STARS) / FIVE_STARTS_NUM_LIKES; // // if (rating > NUM_STARS) { // rating = NUM_STARS; // } // // return Math.round(rating); // } // // @Override // public int defaultValue() { // return DEFAULT_VALUE; // } // } // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/module/DomainModule.java import com.flipper83.protohipster.feed.domain.mappers.HipsterMapper; import com.flipper83.protohipster.feed.domain.mappers.HipsterMapperManual; import com.flipper83.protohipster.feed.domain.interactors.GetFeed; import com.flipper83.protohipster.feed.domain.interactors.GetMyLikers; import com.flipper83.protohipster.feed.domain.interactors.LikeHipster; import com.flipper83.protohipster.globalutils.rating.RatingCalculator; import com.flipper83.protohipster.globalutils.rating.RatingCalculatorFiveStars; import dagger.Module; import dagger.Provides; package com.flipper83.protohipster.feed.domain.module; @Module(complete = false, library = true) public class DomainModule { @Provides
GetFeed provideFeed(GetFeedImpl feedImp) {
flipper83/protohipster
protohipster/src/main/java/com/flipper83/protohipster/feed/domain/module/DomainModule.java
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/mappers/HipsterMapper.java // public interface HipsterMapper { // public HipsterBoundary mapper(Hipster hipster); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/mappers/HipsterMapperManual.java // public class HipsterMapperManual implements HipsterMapper { // @Inject // public HipsterMapperManual() { // } // // @Override // public HipsterBoundary mapper(Hipster hipster) { // HipsterBoundary hipsterBoundary = new HipsterBoundary(); // hipsterBoundary.setAvatar(hipster.getAvatar()); // hipsterBoundary.setUserId(hipster.getUserId()); // hipsterBoundary.setName(hipster.getName() + " " + hipster.getSurname()); // // return hipsterBoundary; // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetFeed.java // public interface GetFeed { // Observable<FeedBoundary> getFeed(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetMyLikers.java // public interface GetMyLikers { // Observable<List<String>> getMyLikers(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/LikeHipster.java // public interface LikeHipster { // public Observable<String> like(String userId); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/rating/RatingCalculator.java // public interface RatingCalculator{ // int calculate(int totalLikers); // // int defaultValue(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/rating/RatingCalculatorFiveStars.java // public class RatingCalculatorFiveStars implements RatingCalculator { // // public final static int FIVE_STARTS_NUM_LIKES = 20; // public final static int NUM_STARS = 5; // private static final int DEFAULT_VALUE = 0; // // @Inject // public RatingCalculatorFiveStars(){ // // } // // @Override // public int calculate(int totalLikers) { // // float rating = (totalLikers * NUM_STARS) / FIVE_STARTS_NUM_LIKES; // // if (rating > NUM_STARS) { // rating = NUM_STARS; // } // // return Math.round(rating); // } // // @Override // public int defaultValue() { // return DEFAULT_VALUE; // } // }
import com.flipper83.protohipster.feed.domain.mappers.HipsterMapper; import com.flipper83.protohipster.feed.domain.mappers.HipsterMapperManual; import com.flipper83.protohipster.feed.domain.interactors.GetFeed; import com.flipper83.protohipster.feed.domain.interactors.GetMyLikers; import com.flipper83.protohipster.feed.domain.interactors.LikeHipster; import com.flipper83.protohipster.globalutils.rating.RatingCalculator; import com.flipper83.protohipster.globalutils.rating.RatingCalculatorFiveStars; import dagger.Module; import dagger.Provides;
package com.flipper83.protohipster.feed.domain.module; @Module(complete = false, library = true) public class DomainModule { @Provides GetFeed provideFeed(GetFeedImpl feedImp) { return feedImp; } @Provides
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/mappers/HipsterMapper.java // public interface HipsterMapper { // public HipsterBoundary mapper(Hipster hipster); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/mappers/HipsterMapperManual.java // public class HipsterMapperManual implements HipsterMapper { // @Inject // public HipsterMapperManual() { // } // // @Override // public HipsterBoundary mapper(Hipster hipster) { // HipsterBoundary hipsterBoundary = new HipsterBoundary(); // hipsterBoundary.setAvatar(hipster.getAvatar()); // hipsterBoundary.setUserId(hipster.getUserId()); // hipsterBoundary.setName(hipster.getName() + " " + hipster.getSurname()); // // return hipsterBoundary; // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetFeed.java // public interface GetFeed { // Observable<FeedBoundary> getFeed(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetMyLikers.java // public interface GetMyLikers { // Observable<List<String>> getMyLikers(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/LikeHipster.java // public interface LikeHipster { // public Observable<String> like(String userId); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/rating/RatingCalculator.java // public interface RatingCalculator{ // int calculate(int totalLikers); // // int defaultValue(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/rating/RatingCalculatorFiveStars.java // public class RatingCalculatorFiveStars implements RatingCalculator { // // public final static int FIVE_STARTS_NUM_LIKES = 20; // public final static int NUM_STARS = 5; // private static final int DEFAULT_VALUE = 0; // // @Inject // public RatingCalculatorFiveStars(){ // // } // // @Override // public int calculate(int totalLikers) { // // float rating = (totalLikers * NUM_STARS) / FIVE_STARTS_NUM_LIKES; // // if (rating > NUM_STARS) { // rating = NUM_STARS; // } // // return Math.round(rating); // } // // @Override // public int defaultValue() { // return DEFAULT_VALUE; // } // } // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/module/DomainModule.java import com.flipper83.protohipster.feed.domain.mappers.HipsterMapper; import com.flipper83.protohipster.feed.domain.mappers.HipsterMapperManual; import com.flipper83.protohipster.feed.domain.interactors.GetFeed; import com.flipper83.protohipster.feed.domain.interactors.GetMyLikers; import com.flipper83.protohipster.feed.domain.interactors.LikeHipster; import com.flipper83.protohipster.globalutils.rating.RatingCalculator; import com.flipper83.protohipster.globalutils.rating.RatingCalculatorFiveStars; import dagger.Module; import dagger.Provides; package com.flipper83.protohipster.feed.domain.module; @Module(complete = false, library = true) public class DomainModule { @Provides GetFeed provideFeed(GetFeedImpl feedImp) { return feedImp; } @Provides
GetMyLikers provideGetMyLikers(GetMyLikersImpl getMyLikersImp){
flipper83/protohipster
protohipster/src/main/java/com/flipper83/protohipster/feed/domain/module/DomainModule.java
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/mappers/HipsterMapper.java // public interface HipsterMapper { // public HipsterBoundary mapper(Hipster hipster); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/mappers/HipsterMapperManual.java // public class HipsterMapperManual implements HipsterMapper { // @Inject // public HipsterMapperManual() { // } // // @Override // public HipsterBoundary mapper(Hipster hipster) { // HipsterBoundary hipsterBoundary = new HipsterBoundary(); // hipsterBoundary.setAvatar(hipster.getAvatar()); // hipsterBoundary.setUserId(hipster.getUserId()); // hipsterBoundary.setName(hipster.getName() + " " + hipster.getSurname()); // // return hipsterBoundary; // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetFeed.java // public interface GetFeed { // Observable<FeedBoundary> getFeed(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetMyLikers.java // public interface GetMyLikers { // Observable<List<String>> getMyLikers(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/LikeHipster.java // public interface LikeHipster { // public Observable<String> like(String userId); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/rating/RatingCalculator.java // public interface RatingCalculator{ // int calculate(int totalLikers); // // int defaultValue(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/rating/RatingCalculatorFiveStars.java // public class RatingCalculatorFiveStars implements RatingCalculator { // // public final static int FIVE_STARTS_NUM_LIKES = 20; // public final static int NUM_STARS = 5; // private static final int DEFAULT_VALUE = 0; // // @Inject // public RatingCalculatorFiveStars(){ // // } // // @Override // public int calculate(int totalLikers) { // // float rating = (totalLikers * NUM_STARS) / FIVE_STARTS_NUM_LIKES; // // if (rating > NUM_STARS) { // rating = NUM_STARS; // } // // return Math.round(rating); // } // // @Override // public int defaultValue() { // return DEFAULT_VALUE; // } // }
import com.flipper83.protohipster.feed.domain.mappers.HipsterMapper; import com.flipper83.protohipster.feed.domain.mappers.HipsterMapperManual; import com.flipper83.protohipster.feed.domain.interactors.GetFeed; import com.flipper83.protohipster.feed.domain.interactors.GetMyLikers; import com.flipper83.protohipster.feed.domain.interactors.LikeHipster; import com.flipper83.protohipster.globalutils.rating.RatingCalculator; import com.flipper83.protohipster.globalutils.rating.RatingCalculatorFiveStars; import dagger.Module; import dagger.Provides;
package com.flipper83.protohipster.feed.domain.module; @Module(complete = false, library = true) public class DomainModule { @Provides GetFeed provideFeed(GetFeedImpl feedImp) { return feedImp; } @Provides GetMyLikers provideGetMyLikers(GetMyLikersImpl getMyLikersImp){ return getMyLikersImp; } @Provides
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/mappers/HipsterMapper.java // public interface HipsterMapper { // public HipsterBoundary mapper(Hipster hipster); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/mappers/HipsterMapperManual.java // public class HipsterMapperManual implements HipsterMapper { // @Inject // public HipsterMapperManual() { // } // // @Override // public HipsterBoundary mapper(Hipster hipster) { // HipsterBoundary hipsterBoundary = new HipsterBoundary(); // hipsterBoundary.setAvatar(hipster.getAvatar()); // hipsterBoundary.setUserId(hipster.getUserId()); // hipsterBoundary.setName(hipster.getName() + " " + hipster.getSurname()); // // return hipsterBoundary; // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetFeed.java // public interface GetFeed { // Observable<FeedBoundary> getFeed(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetMyLikers.java // public interface GetMyLikers { // Observable<List<String>> getMyLikers(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/LikeHipster.java // public interface LikeHipster { // public Observable<String> like(String userId); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/rating/RatingCalculator.java // public interface RatingCalculator{ // int calculate(int totalLikers); // // int defaultValue(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/rating/RatingCalculatorFiveStars.java // public class RatingCalculatorFiveStars implements RatingCalculator { // // public final static int FIVE_STARTS_NUM_LIKES = 20; // public final static int NUM_STARS = 5; // private static final int DEFAULT_VALUE = 0; // // @Inject // public RatingCalculatorFiveStars(){ // // } // // @Override // public int calculate(int totalLikers) { // // float rating = (totalLikers * NUM_STARS) / FIVE_STARTS_NUM_LIKES; // // if (rating > NUM_STARS) { // rating = NUM_STARS; // } // // return Math.round(rating); // } // // @Override // public int defaultValue() { // return DEFAULT_VALUE; // } // } // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/module/DomainModule.java import com.flipper83.protohipster.feed.domain.mappers.HipsterMapper; import com.flipper83.protohipster.feed.domain.mappers.HipsterMapperManual; import com.flipper83.protohipster.feed.domain.interactors.GetFeed; import com.flipper83.protohipster.feed.domain.interactors.GetMyLikers; import com.flipper83.protohipster.feed.domain.interactors.LikeHipster; import com.flipper83.protohipster.globalutils.rating.RatingCalculator; import com.flipper83.protohipster.globalutils.rating.RatingCalculatorFiveStars; import dagger.Module; import dagger.Provides; package com.flipper83.protohipster.feed.domain.module; @Module(complete = false, library = true) public class DomainModule { @Provides GetFeed provideFeed(GetFeedImpl feedImp) { return feedImp; } @Provides GetMyLikers provideGetMyLikers(GetMyLikersImpl getMyLikersImp){ return getMyLikersImp; } @Provides
LikeHipster provideLikeHipster(LikeHipsterImp likeHipsterImp){
flipper83/protohipster
protohipster/src/main/java/com/flipper83/protohipster/feed/domain/module/DomainModule.java
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/mappers/HipsterMapper.java // public interface HipsterMapper { // public HipsterBoundary mapper(Hipster hipster); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/mappers/HipsterMapperManual.java // public class HipsterMapperManual implements HipsterMapper { // @Inject // public HipsterMapperManual() { // } // // @Override // public HipsterBoundary mapper(Hipster hipster) { // HipsterBoundary hipsterBoundary = new HipsterBoundary(); // hipsterBoundary.setAvatar(hipster.getAvatar()); // hipsterBoundary.setUserId(hipster.getUserId()); // hipsterBoundary.setName(hipster.getName() + " " + hipster.getSurname()); // // return hipsterBoundary; // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetFeed.java // public interface GetFeed { // Observable<FeedBoundary> getFeed(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetMyLikers.java // public interface GetMyLikers { // Observable<List<String>> getMyLikers(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/LikeHipster.java // public interface LikeHipster { // public Observable<String> like(String userId); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/rating/RatingCalculator.java // public interface RatingCalculator{ // int calculate(int totalLikers); // // int defaultValue(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/rating/RatingCalculatorFiveStars.java // public class RatingCalculatorFiveStars implements RatingCalculator { // // public final static int FIVE_STARTS_NUM_LIKES = 20; // public final static int NUM_STARS = 5; // private static final int DEFAULT_VALUE = 0; // // @Inject // public RatingCalculatorFiveStars(){ // // } // // @Override // public int calculate(int totalLikers) { // // float rating = (totalLikers * NUM_STARS) / FIVE_STARTS_NUM_LIKES; // // if (rating > NUM_STARS) { // rating = NUM_STARS; // } // // return Math.round(rating); // } // // @Override // public int defaultValue() { // return DEFAULT_VALUE; // } // }
import com.flipper83.protohipster.feed.domain.mappers.HipsterMapper; import com.flipper83.protohipster.feed.domain.mappers.HipsterMapperManual; import com.flipper83.protohipster.feed.domain.interactors.GetFeed; import com.flipper83.protohipster.feed.domain.interactors.GetMyLikers; import com.flipper83.protohipster.feed.domain.interactors.LikeHipster; import com.flipper83.protohipster.globalutils.rating.RatingCalculator; import com.flipper83.protohipster.globalutils.rating.RatingCalculatorFiveStars; import dagger.Module; import dagger.Provides;
package com.flipper83.protohipster.feed.domain.module; @Module(complete = false, library = true) public class DomainModule { @Provides GetFeed provideFeed(GetFeedImpl feedImp) { return feedImp; } @Provides GetMyLikers provideGetMyLikers(GetMyLikersImpl getMyLikersImp){ return getMyLikersImp; } @Provides LikeHipster provideLikeHipster(LikeHipsterImp likeHipsterImp){ return likeHipsterImp; } @Provides
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/mappers/HipsterMapper.java // public interface HipsterMapper { // public HipsterBoundary mapper(Hipster hipster); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/mappers/HipsterMapperManual.java // public class HipsterMapperManual implements HipsterMapper { // @Inject // public HipsterMapperManual() { // } // // @Override // public HipsterBoundary mapper(Hipster hipster) { // HipsterBoundary hipsterBoundary = new HipsterBoundary(); // hipsterBoundary.setAvatar(hipster.getAvatar()); // hipsterBoundary.setUserId(hipster.getUserId()); // hipsterBoundary.setName(hipster.getName() + " " + hipster.getSurname()); // // return hipsterBoundary; // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetFeed.java // public interface GetFeed { // Observable<FeedBoundary> getFeed(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetMyLikers.java // public interface GetMyLikers { // Observable<List<String>> getMyLikers(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/LikeHipster.java // public interface LikeHipster { // public Observable<String> like(String userId); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/rating/RatingCalculator.java // public interface RatingCalculator{ // int calculate(int totalLikers); // // int defaultValue(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/rating/RatingCalculatorFiveStars.java // public class RatingCalculatorFiveStars implements RatingCalculator { // // public final static int FIVE_STARTS_NUM_LIKES = 20; // public final static int NUM_STARS = 5; // private static final int DEFAULT_VALUE = 0; // // @Inject // public RatingCalculatorFiveStars(){ // // } // // @Override // public int calculate(int totalLikers) { // // float rating = (totalLikers * NUM_STARS) / FIVE_STARTS_NUM_LIKES; // // if (rating > NUM_STARS) { // rating = NUM_STARS; // } // // return Math.round(rating); // } // // @Override // public int defaultValue() { // return DEFAULT_VALUE; // } // } // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/module/DomainModule.java import com.flipper83.protohipster.feed.domain.mappers.HipsterMapper; import com.flipper83.protohipster.feed.domain.mappers.HipsterMapperManual; import com.flipper83.protohipster.feed.domain.interactors.GetFeed; import com.flipper83.protohipster.feed.domain.interactors.GetMyLikers; import com.flipper83.protohipster.feed.domain.interactors.LikeHipster; import com.flipper83.protohipster.globalutils.rating.RatingCalculator; import com.flipper83.protohipster.globalutils.rating.RatingCalculatorFiveStars; import dagger.Module; import dagger.Provides; package com.flipper83.protohipster.feed.domain.module; @Module(complete = false, library = true) public class DomainModule { @Provides GetFeed provideFeed(GetFeedImpl feedImp) { return feedImp; } @Provides GetMyLikers provideGetMyLikers(GetMyLikersImpl getMyLikersImp){ return getMyLikersImp; } @Provides LikeHipster provideLikeHipster(LikeHipsterImp likeHipsterImp){ return likeHipsterImp; } @Provides
RatingCalculator provideRatingFiveStars(RatingCalculatorFiveStars ratingCalculatorFiveStars) {
flipper83/protohipster
protohipster/src/main/java/com/flipper83/protohipster/feed/domain/module/DomainModule.java
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/mappers/HipsterMapper.java // public interface HipsterMapper { // public HipsterBoundary mapper(Hipster hipster); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/mappers/HipsterMapperManual.java // public class HipsterMapperManual implements HipsterMapper { // @Inject // public HipsterMapperManual() { // } // // @Override // public HipsterBoundary mapper(Hipster hipster) { // HipsterBoundary hipsterBoundary = new HipsterBoundary(); // hipsterBoundary.setAvatar(hipster.getAvatar()); // hipsterBoundary.setUserId(hipster.getUserId()); // hipsterBoundary.setName(hipster.getName() + " " + hipster.getSurname()); // // return hipsterBoundary; // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetFeed.java // public interface GetFeed { // Observable<FeedBoundary> getFeed(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetMyLikers.java // public interface GetMyLikers { // Observable<List<String>> getMyLikers(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/LikeHipster.java // public interface LikeHipster { // public Observable<String> like(String userId); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/rating/RatingCalculator.java // public interface RatingCalculator{ // int calculate(int totalLikers); // // int defaultValue(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/rating/RatingCalculatorFiveStars.java // public class RatingCalculatorFiveStars implements RatingCalculator { // // public final static int FIVE_STARTS_NUM_LIKES = 20; // public final static int NUM_STARS = 5; // private static final int DEFAULT_VALUE = 0; // // @Inject // public RatingCalculatorFiveStars(){ // // } // // @Override // public int calculate(int totalLikers) { // // float rating = (totalLikers * NUM_STARS) / FIVE_STARTS_NUM_LIKES; // // if (rating > NUM_STARS) { // rating = NUM_STARS; // } // // return Math.round(rating); // } // // @Override // public int defaultValue() { // return DEFAULT_VALUE; // } // }
import com.flipper83.protohipster.feed.domain.mappers.HipsterMapper; import com.flipper83.protohipster.feed.domain.mappers.HipsterMapperManual; import com.flipper83.protohipster.feed.domain.interactors.GetFeed; import com.flipper83.protohipster.feed.domain.interactors.GetMyLikers; import com.flipper83.protohipster.feed.domain.interactors.LikeHipster; import com.flipper83.protohipster.globalutils.rating.RatingCalculator; import com.flipper83.protohipster.globalutils.rating.RatingCalculatorFiveStars; import dagger.Module; import dagger.Provides;
package com.flipper83.protohipster.feed.domain.module; @Module(complete = false, library = true) public class DomainModule { @Provides GetFeed provideFeed(GetFeedImpl feedImp) { return feedImp; } @Provides GetMyLikers provideGetMyLikers(GetMyLikersImpl getMyLikersImp){ return getMyLikersImp; } @Provides LikeHipster provideLikeHipster(LikeHipsterImp likeHipsterImp){ return likeHipsterImp; } @Provides
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/mappers/HipsterMapper.java // public interface HipsterMapper { // public HipsterBoundary mapper(Hipster hipster); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/mappers/HipsterMapperManual.java // public class HipsterMapperManual implements HipsterMapper { // @Inject // public HipsterMapperManual() { // } // // @Override // public HipsterBoundary mapper(Hipster hipster) { // HipsterBoundary hipsterBoundary = new HipsterBoundary(); // hipsterBoundary.setAvatar(hipster.getAvatar()); // hipsterBoundary.setUserId(hipster.getUserId()); // hipsterBoundary.setName(hipster.getName() + " " + hipster.getSurname()); // // return hipsterBoundary; // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetFeed.java // public interface GetFeed { // Observable<FeedBoundary> getFeed(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetMyLikers.java // public interface GetMyLikers { // Observable<List<String>> getMyLikers(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/LikeHipster.java // public interface LikeHipster { // public Observable<String> like(String userId); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/rating/RatingCalculator.java // public interface RatingCalculator{ // int calculate(int totalLikers); // // int defaultValue(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/rating/RatingCalculatorFiveStars.java // public class RatingCalculatorFiveStars implements RatingCalculator { // // public final static int FIVE_STARTS_NUM_LIKES = 20; // public final static int NUM_STARS = 5; // private static final int DEFAULT_VALUE = 0; // // @Inject // public RatingCalculatorFiveStars(){ // // } // // @Override // public int calculate(int totalLikers) { // // float rating = (totalLikers * NUM_STARS) / FIVE_STARTS_NUM_LIKES; // // if (rating > NUM_STARS) { // rating = NUM_STARS; // } // // return Math.round(rating); // } // // @Override // public int defaultValue() { // return DEFAULT_VALUE; // } // } // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/module/DomainModule.java import com.flipper83.protohipster.feed.domain.mappers.HipsterMapper; import com.flipper83.protohipster.feed.domain.mappers.HipsterMapperManual; import com.flipper83.protohipster.feed.domain.interactors.GetFeed; import com.flipper83.protohipster.feed.domain.interactors.GetMyLikers; import com.flipper83.protohipster.feed.domain.interactors.LikeHipster; import com.flipper83.protohipster.globalutils.rating.RatingCalculator; import com.flipper83.protohipster.globalutils.rating.RatingCalculatorFiveStars; import dagger.Module; import dagger.Provides; package com.flipper83.protohipster.feed.domain.module; @Module(complete = false, library = true) public class DomainModule { @Provides GetFeed provideFeed(GetFeedImpl feedImp) { return feedImp; } @Provides GetMyLikers provideGetMyLikers(GetMyLikersImpl getMyLikersImp){ return getMyLikersImp; } @Provides LikeHipster provideLikeHipster(LikeHipsterImp likeHipsterImp){ return likeHipsterImp; } @Provides
RatingCalculator provideRatingFiveStars(RatingCalculatorFiveStars ratingCalculatorFiveStars) {
flipper83/protohipster
protohipster/src/main/java/com/flipper83/protohipster/feed/domain/module/DomainModule.java
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/mappers/HipsterMapper.java // public interface HipsterMapper { // public HipsterBoundary mapper(Hipster hipster); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/mappers/HipsterMapperManual.java // public class HipsterMapperManual implements HipsterMapper { // @Inject // public HipsterMapperManual() { // } // // @Override // public HipsterBoundary mapper(Hipster hipster) { // HipsterBoundary hipsterBoundary = new HipsterBoundary(); // hipsterBoundary.setAvatar(hipster.getAvatar()); // hipsterBoundary.setUserId(hipster.getUserId()); // hipsterBoundary.setName(hipster.getName() + " " + hipster.getSurname()); // // return hipsterBoundary; // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetFeed.java // public interface GetFeed { // Observable<FeedBoundary> getFeed(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetMyLikers.java // public interface GetMyLikers { // Observable<List<String>> getMyLikers(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/LikeHipster.java // public interface LikeHipster { // public Observable<String> like(String userId); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/rating/RatingCalculator.java // public interface RatingCalculator{ // int calculate(int totalLikers); // // int defaultValue(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/rating/RatingCalculatorFiveStars.java // public class RatingCalculatorFiveStars implements RatingCalculator { // // public final static int FIVE_STARTS_NUM_LIKES = 20; // public final static int NUM_STARS = 5; // private static final int DEFAULT_VALUE = 0; // // @Inject // public RatingCalculatorFiveStars(){ // // } // // @Override // public int calculate(int totalLikers) { // // float rating = (totalLikers * NUM_STARS) / FIVE_STARTS_NUM_LIKES; // // if (rating > NUM_STARS) { // rating = NUM_STARS; // } // // return Math.round(rating); // } // // @Override // public int defaultValue() { // return DEFAULT_VALUE; // } // }
import com.flipper83.protohipster.feed.domain.mappers.HipsterMapper; import com.flipper83.protohipster.feed.domain.mappers.HipsterMapperManual; import com.flipper83.protohipster.feed.domain.interactors.GetFeed; import com.flipper83.protohipster.feed.domain.interactors.GetMyLikers; import com.flipper83.protohipster.feed.domain.interactors.LikeHipster; import com.flipper83.protohipster.globalutils.rating.RatingCalculator; import com.flipper83.protohipster.globalutils.rating.RatingCalculatorFiveStars; import dagger.Module; import dagger.Provides;
package com.flipper83.protohipster.feed.domain.module; @Module(complete = false, library = true) public class DomainModule { @Provides GetFeed provideFeed(GetFeedImpl feedImp) { return feedImp; } @Provides GetMyLikers provideGetMyLikers(GetMyLikersImpl getMyLikersImp){ return getMyLikersImp; } @Provides LikeHipster provideLikeHipster(LikeHipsterImp likeHipsterImp){ return likeHipsterImp; } @Provides RatingCalculator provideRatingFiveStars(RatingCalculatorFiveStars ratingCalculatorFiveStars) { return ratingCalculatorFiveStars; } @Provides
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/mappers/HipsterMapper.java // public interface HipsterMapper { // public HipsterBoundary mapper(Hipster hipster); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/mappers/HipsterMapperManual.java // public class HipsterMapperManual implements HipsterMapper { // @Inject // public HipsterMapperManual() { // } // // @Override // public HipsterBoundary mapper(Hipster hipster) { // HipsterBoundary hipsterBoundary = new HipsterBoundary(); // hipsterBoundary.setAvatar(hipster.getAvatar()); // hipsterBoundary.setUserId(hipster.getUserId()); // hipsterBoundary.setName(hipster.getName() + " " + hipster.getSurname()); // // return hipsterBoundary; // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetFeed.java // public interface GetFeed { // Observable<FeedBoundary> getFeed(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetMyLikers.java // public interface GetMyLikers { // Observable<List<String>> getMyLikers(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/LikeHipster.java // public interface LikeHipster { // public Observable<String> like(String userId); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/rating/RatingCalculator.java // public interface RatingCalculator{ // int calculate(int totalLikers); // // int defaultValue(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/rating/RatingCalculatorFiveStars.java // public class RatingCalculatorFiveStars implements RatingCalculator { // // public final static int FIVE_STARTS_NUM_LIKES = 20; // public final static int NUM_STARS = 5; // private static final int DEFAULT_VALUE = 0; // // @Inject // public RatingCalculatorFiveStars(){ // // } // // @Override // public int calculate(int totalLikers) { // // float rating = (totalLikers * NUM_STARS) / FIVE_STARTS_NUM_LIKES; // // if (rating > NUM_STARS) { // rating = NUM_STARS; // } // // return Math.round(rating); // } // // @Override // public int defaultValue() { // return DEFAULT_VALUE; // } // } // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/module/DomainModule.java import com.flipper83.protohipster.feed.domain.mappers.HipsterMapper; import com.flipper83.protohipster.feed.domain.mappers.HipsterMapperManual; import com.flipper83.protohipster.feed.domain.interactors.GetFeed; import com.flipper83.protohipster.feed.domain.interactors.GetMyLikers; import com.flipper83.protohipster.feed.domain.interactors.LikeHipster; import com.flipper83.protohipster.globalutils.rating.RatingCalculator; import com.flipper83.protohipster.globalutils.rating.RatingCalculatorFiveStars; import dagger.Module; import dagger.Provides; package com.flipper83.protohipster.feed.domain.module; @Module(complete = false, library = true) public class DomainModule { @Provides GetFeed provideFeed(GetFeedImpl feedImp) { return feedImp; } @Provides GetMyLikers provideGetMyLikers(GetMyLikersImpl getMyLikersImp){ return getMyLikersImp; } @Provides LikeHipster provideLikeHipster(LikeHipsterImp likeHipsterImp){ return likeHipsterImp; } @Provides RatingCalculator provideRatingFiveStars(RatingCalculatorFiveStars ratingCalculatorFiveStars) { return ratingCalculatorFiveStars; } @Provides
HipsterMapper provideHipsterMapperManual(HipsterMapperManual hipsterMapperAuto) {
flipper83/protohipster
protohipster/src/main/java/com/flipper83/protohipster/feed/domain/module/DomainModule.java
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/mappers/HipsterMapper.java // public interface HipsterMapper { // public HipsterBoundary mapper(Hipster hipster); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/mappers/HipsterMapperManual.java // public class HipsterMapperManual implements HipsterMapper { // @Inject // public HipsterMapperManual() { // } // // @Override // public HipsterBoundary mapper(Hipster hipster) { // HipsterBoundary hipsterBoundary = new HipsterBoundary(); // hipsterBoundary.setAvatar(hipster.getAvatar()); // hipsterBoundary.setUserId(hipster.getUserId()); // hipsterBoundary.setName(hipster.getName() + " " + hipster.getSurname()); // // return hipsterBoundary; // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetFeed.java // public interface GetFeed { // Observable<FeedBoundary> getFeed(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetMyLikers.java // public interface GetMyLikers { // Observable<List<String>> getMyLikers(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/LikeHipster.java // public interface LikeHipster { // public Observable<String> like(String userId); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/rating/RatingCalculator.java // public interface RatingCalculator{ // int calculate(int totalLikers); // // int defaultValue(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/rating/RatingCalculatorFiveStars.java // public class RatingCalculatorFiveStars implements RatingCalculator { // // public final static int FIVE_STARTS_NUM_LIKES = 20; // public final static int NUM_STARS = 5; // private static final int DEFAULT_VALUE = 0; // // @Inject // public RatingCalculatorFiveStars(){ // // } // // @Override // public int calculate(int totalLikers) { // // float rating = (totalLikers * NUM_STARS) / FIVE_STARTS_NUM_LIKES; // // if (rating > NUM_STARS) { // rating = NUM_STARS; // } // // return Math.round(rating); // } // // @Override // public int defaultValue() { // return DEFAULT_VALUE; // } // }
import com.flipper83.protohipster.feed.domain.mappers.HipsterMapper; import com.flipper83.protohipster.feed.domain.mappers.HipsterMapperManual; import com.flipper83.protohipster.feed.domain.interactors.GetFeed; import com.flipper83.protohipster.feed.domain.interactors.GetMyLikers; import com.flipper83.protohipster.feed.domain.interactors.LikeHipster; import com.flipper83.protohipster.globalutils.rating.RatingCalculator; import com.flipper83.protohipster.globalutils.rating.RatingCalculatorFiveStars; import dagger.Module; import dagger.Provides;
package com.flipper83.protohipster.feed.domain.module; @Module(complete = false, library = true) public class DomainModule { @Provides GetFeed provideFeed(GetFeedImpl feedImp) { return feedImp; } @Provides GetMyLikers provideGetMyLikers(GetMyLikersImpl getMyLikersImp){ return getMyLikersImp; } @Provides LikeHipster provideLikeHipster(LikeHipsterImp likeHipsterImp){ return likeHipsterImp; } @Provides RatingCalculator provideRatingFiveStars(RatingCalculatorFiveStars ratingCalculatorFiveStars) { return ratingCalculatorFiveStars; } @Provides
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/mappers/HipsterMapper.java // public interface HipsterMapper { // public HipsterBoundary mapper(Hipster hipster); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/mappers/HipsterMapperManual.java // public class HipsterMapperManual implements HipsterMapper { // @Inject // public HipsterMapperManual() { // } // // @Override // public HipsterBoundary mapper(Hipster hipster) { // HipsterBoundary hipsterBoundary = new HipsterBoundary(); // hipsterBoundary.setAvatar(hipster.getAvatar()); // hipsterBoundary.setUserId(hipster.getUserId()); // hipsterBoundary.setName(hipster.getName() + " " + hipster.getSurname()); // // return hipsterBoundary; // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetFeed.java // public interface GetFeed { // Observable<FeedBoundary> getFeed(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetMyLikers.java // public interface GetMyLikers { // Observable<List<String>> getMyLikers(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/LikeHipster.java // public interface LikeHipster { // public Observable<String> like(String userId); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/rating/RatingCalculator.java // public interface RatingCalculator{ // int calculate(int totalLikers); // // int defaultValue(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/rating/RatingCalculatorFiveStars.java // public class RatingCalculatorFiveStars implements RatingCalculator { // // public final static int FIVE_STARTS_NUM_LIKES = 20; // public final static int NUM_STARS = 5; // private static final int DEFAULT_VALUE = 0; // // @Inject // public RatingCalculatorFiveStars(){ // // } // // @Override // public int calculate(int totalLikers) { // // float rating = (totalLikers * NUM_STARS) / FIVE_STARTS_NUM_LIKES; // // if (rating > NUM_STARS) { // rating = NUM_STARS; // } // // return Math.round(rating); // } // // @Override // public int defaultValue() { // return DEFAULT_VALUE; // } // } // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/module/DomainModule.java import com.flipper83.protohipster.feed.domain.mappers.HipsterMapper; import com.flipper83.protohipster.feed.domain.mappers.HipsterMapperManual; import com.flipper83.protohipster.feed.domain.interactors.GetFeed; import com.flipper83.protohipster.feed.domain.interactors.GetMyLikers; import com.flipper83.protohipster.feed.domain.interactors.LikeHipster; import com.flipper83.protohipster.globalutils.rating.RatingCalculator; import com.flipper83.protohipster.globalutils.rating.RatingCalculatorFiveStars; import dagger.Module; import dagger.Provides; package com.flipper83.protohipster.feed.domain.module; @Module(complete = false, library = true) public class DomainModule { @Provides GetFeed provideFeed(GetFeedImpl feedImp) { return feedImp; } @Provides GetMyLikers provideGetMyLikers(GetMyLikersImpl getMyLikersImp){ return getMyLikersImp; } @Provides LikeHipster provideLikeHipster(LikeHipsterImp likeHipsterImp){ return likeHipsterImp; } @Provides RatingCalculator provideRatingFiveStars(RatingCalculatorFiveStars ratingCalculatorFiveStars) { return ratingCalculatorFiveStars; } @Provides
HipsterMapper provideHipsterMapperManual(HipsterMapperManual hipsterMapperAuto) {
flipper83/protohipster
protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/call/rest/ApiRestCall.java
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/call/ApiCall.java // public abstract class ApiCall { // // protected ApiResponseCallback responseCallback; // // public ApiCall(ApiResponseCallback responseCallback) { // this.responseCallback = responseCallback; // } // // public abstract void call(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/callback/ApiResponseCallback.java // public interface ApiResponseCallback<T> { // void complete(T response); // }
import com.flipper83.protohipster.feed.datasource.api.call.ApiCall; import com.flipper83.protohipster.feed.datasource.api.callback.ApiResponseCallback; import retrofit.RestAdapter;
package com.flipper83.protohipster.feed.datasource.api.call.rest; /** * Basic Api call to the Api System. */ public abstract class ApiRestCall extends ApiCall { private RestAdapter restAdapter;
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/call/ApiCall.java // public abstract class ApiCall { // // protected ApiResponseCallback responseCallback; // // public ApiCall(ApiResponseCallback responseCallback) { // this.responseCallback = responseCallback; // } // // public abstract void call(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/callback/ApiResponseCallback.java // public interface ApiResponseCallback<T> { // void complete(T response); // } // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/call/rest/ApiRestCall.java import com.flipper83.protohipster.feed.datasource.api.call.ApiCall; import com.flipper83.protohipster.feed.datasource.api.callback.ApiResponseCallback; import retrofit.RestAdapter; package com.flipper83.protohipster.feed.datasource.api.call.rest; /** * Basic Api call to the Api System. */ public abstract class ApiRestCall extends ApiCall { private RestAdapter restAdapter;
public ApiRestCall(ApiResponseCallback responseCallback) {
flipper83/protohipster
protohipster/src/main/java/com/flipper83/protohipster/feed/domain/mappers/HipsterMapperManual.java
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/boundaries/HipsterBoundary.java // public class HipsterBoundary { // private String name; // private String avatar; // private int rating; // private String userId; // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getAvatar() { // return avatar; // } // // public void setAvatar(String avatar) { // this.avatar = avatar; // } // // public int getRating() { // return rating; // } // // public void setRating(int rating) { // this.rating = rating; // } // // public String getUserId() { // return userId; // } // // public void setUserId(String userId) { // this.userId = userId; // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/gateway/Hipster.java // public class Hipster { // // private String userId; // private String name; // private String surname; // private String avatar; // private long time; // private int numLikes; // // public Hipster(String userId) { // this.userId = userId; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getSurname() { // return surname; // } // // public void setSurname(String surname) { // this.surname = surname; // } // // public String getAvatar() { // return avatar; // } // // public void setAvatar(String avatar) { // this.avatar = avatar; // } // // public long getTime() { // return time; // } // // public void setTime(long time) { // this.time = time; // } // // public String getUserId() { // return userId; // } // // public int getNumLikes() { // return numLikes; // } // // public void setNumLikes(int numLikes) { // this.numLikes = numLikes; // } // }
import com.flipper83.protohipster.feed.domain.boundaries.HipsterBoundary; import com.flipper83.protohipster.feed.domain.gateway.Hipster; import javax.inject.Inject;
package com.flipper83.protohipster.feed.domain.mappers; /** * this class mapping models without */ public class HipsterMapperManual implements HipsterMapper { @Inject public HipsterMapperManual() { } @Override
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/boundaries/HipsterBoundary.java // public class HipsterBoundary { // private String name; // private String avatar; // private int rating; // private String userId; // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getAvatar() { // return avatar; // } // // public void setAvatar(String avatar) { // this.avatar = avatar; // } // // public int getRating() { // return rating; // } // // public void setRating(int rating) { // this.rating = rating; // } // // public String getUserId() { // return userId; // } // // public void setUserId(String userId) { // this.userId = userId; // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/gateway/Hipster.java // public class Hipster { // // private String userId; // private String name; // private String surname; // private String avatar; // private long time; // private int numLikes; // // public Hipster(String userId) { // this.userId = userId; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getSurname() { // return surname; // } // // public void setSurname(String surname) { // this.surname = surname; // } // // public String getAvatar() { // return avatar; // } // // public void setAvatar(String avatar) { // this.avatar = avatar; // } // // public long getTime() { // return time; // } // // public void setTime(long time) { // this.time = time; // } // // public String getUserId() { // return userId; // } // // public int getNumLikes() { // return numLikes; // } // // public void setNumLikes(int numLikes) { // this.numLikes = numLikes; // } // } // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/mappers/HipsterMapperManual.java import com.flipper83.protohipster.feed.domain.boundaries.HipsterBoundary; import com.flipper83.protohipster.feed.domain.gateway.Hipster; import javax.inject.Inject; package com.flipper83.protohipster.feed.domain.mappers; /** * this class mapping models without */ public class HipsterMapperManual implements HipsterMapper { @Inject public HipsterMapperManual() { } @Override
public HipsterBoundary mapper(Hipster hipster) {
flipper83/protohipster
protohipster/src/main/java/com/flipper83/protohipster/feed/domain/mappers/HipsterMapperManual.java
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/boundaries/HipsterBoundary.java // public class HipsterBoundary { // private String name; // private String avatar; // private int rating; // private String userId; // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getAvatar() { // return avatar; // } // // public void setAvatar(String avatar) { // this.avatar = avatar; // } // // public int getRating() { // return rating; // } // // public void setRating(int rating) { // this.rating = rating; // } // // public String getUserId() { // return userId; // } // // public void setUserId(String userId) { // this.userId = userId; // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/gateway/Hipster.java // public class Hipster { // // private String userId; // private String name; // private String surname; // private String avatar; // private long time; // private int numLikes; // // public Hipster(String userId) { // this.userId = userId; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getSurname() { // return surname; // } // // public void setSurname(String surname) { // this.surname = surname; // } // // public String getAvatar() { // return avatar; // } // // public void setAvatar(String avatar) { // this.avatar = avatar; // } // // public long getTime() { // return time; // } // // public void setTime(long time) { // this.time = time; // } // // public String getUserId() { // return userId; // } // // public int getNumLikes() { // return numLikes; // } // // public void setNumLikes(int numLikes) { // this.numLikes = numLikes; // } // }
import com.flipper83.protohipster.feed.domain.boundaries.HipsterBoundary; import com.flipper83.protohipster.feed.domain.gateway.Hipster; import javax.inject.Inject;
package com.flipper83.protohipster.feed.domain.mappers; /** * this class mapping models without */ public class HipsterMapperManual implements HipsterMapper { @Inject public HipsterMapperManual() { } @Override
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/boundaries/HipsterBoundary.java // public class HipsterBoundary { // private String name; // private String avatar; // private int rating; // private String userId; // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getAvatar() { // return avatar; // } // // public void setAvatar(String avatar) { // this.avatar = avatar; // } // // public int getRating() { // return rating; // } // // public void setRating(int rating) { // this.rating = rating; // } // // public String getUserId() { // return userId; // } // // public void setUserId(String userId) { // this.userId = userId; // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/gateway/Hipster.java // public class Hipster { // // private String userId; // private String name; // private String surname; // private String avatar; // private long time; // private int numLikes; // // public Hipster(String userId) { // this.userId = userId; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getSurname() { // return surname; // } // // public void setSurname(String surname) { // this.surname = surname; // } // // public String getAvatar() { // return avatar; // } // // public void setAvatar(String avatar) { // this.avatar = avatar; // } // // public long getTime() { // return time; // } // // public void setTime(long time) { // this.time = time; // } // // public String getUserId() { // return userId; // } // // public int getNumLikes() { // return numLikes; // } // // public void setNumLikes(int numLikes) { // this.numLikes = numLikes; // } // } // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/mappers/HipsterMapperManual.java import com.flipper83.protohipster.feed.domain.boundaries.HipsterBoundary; import com.flipper83.protohipster.feed.domain.gateway.Hipster; import javax.inject.Inject; package com.flipper83.protohipster.feed.domain.mappers; /** * this class mapping models without */ public class HipsterMapperManual implements HipsterMapper { @Inject public HipsterMapperManual() { } @Override
public HipsterBoundary mapper(Hipster hipster) {
flipper83/protohipster
protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/DataSourceModule.java
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/Api.java // public interface Api { // void call(ApiCall apiCall); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/LikeDataSource.java // public interface LikeDataSource { // void getCountLikesForUser(List<String> userIds, GetCountLikesCallback getCountLikesCallback); // void getMyLikers(GetMyLikersCallback getLikersForUserCallback); // void likeUser(String userId, LikeUserCallback likeUserCallback); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/UserDataSource.java // public interface UserDataSource { // void getUsers(GetUserCallback callback); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/api/ApiParse.java // public class ApiParse implements Api { // // // public ApiParse(Context context){ // Parse.initialize(context, "qFiaaQwGeJCdIpp3WUiBeuk0FXC4vRe0wGImASrB", "L8W1fORdrPiOGl63XzlxgUziX8q9f0ylV5tdV2Y1"); // } // // @Override // public void call(ApiCall apiCall) { // apiCall.call(); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/api/ApiRest.java // public class ApiRest implements Api { // // private final RestAdapter restAdapter; // // @Inject // public ApiRest(RestAdapter restAdapter) { // this.restAdapter = restAdapter; // } // // @Override // public void call(ApiCall apiCall) { // ApiRestCall restCall = (ApiRestCall) apiCall; // // restCall.setRestAdapter(restAdapter); // restCall.call(); // // // } // // public final static String DOMAIN = "http://api.randomuser.me"; // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/cache/Cache.java // public interface Cache<T> { // T get(String key); // void put(String key, T value); // List<T> getAllValues(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/cache/implementations/MapKeysCache.java // public class MapKeysCache implements Cache<String> { // // private Map<String,String> values = new HashMap<String, String>(); // // // @Override // public String get(String key) { // return values.get(key); // } // // @Override // public void put(String key, String value) { // values.put(key,value); // } // // @Override // public List<String> getAllValues() { // return new ArrayList<String>(values.values()); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/AndroidModule.java // @Module(library = true) // public class AndroidModule { // private final ProtoApplication application; // // public AndroidModule(ProtoApplication application) { // this.application = application; // } // // /** // * Allow the application context to be injected but require that it be annotated with // * {@link ForApplication @Annotation} to explicitly differentiate it from an activity context. // */ // @Provides // @Singleton // @ForApplication // Context provideApplicationContext() { // return application; // } // // @Provides // @Singleton // LocationManager provideLocationManager() { // return (LocationManager) application.getSystemService(LOCATION_SERVICE); // } // // }
import android.content.Context; import com.flipper83.protohipster.daggerUtils.ForApplication; import com.flipper83.protohipster.feed.datasource.api.Api; import com.flipper83.protohipster.feed.datasource.interfaces.LikeDataSource; import com.flipper83.protohipster.feed.datasource.interfaces.UserDataSource; import com.flipper83.protohipster.feed.datasource.module.api.ApiParse; import com.flipper83.protohipster.feed.datasource.module.api.ApiRest; import com.flipper83.protohipster.globalutils.cache.Cache; import com.flipper83.protohipster.globalutils.cache.implementations.MapKeysCache; import com.flipper83.protohipster.globalutils.module.AndroidModule; import javax.inject.Named; import javax.inject.Singleton; import dagger.Module; import dagger.Provides; import retrofit.RestAdapter;
package com.flipper83.protohipster.feed.datasource.module; @Module(library = true, includes = AndroidModule.class) public class DataSourceModule { public DataSourceModule() { } @Provides @Singleton
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/Api.java // public interface Api { // void call(ApiCall apiCall); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/LikeDataSource.java // public interface LikeDataSource { // void getCountLikesForUser(List<String> userIds, GetCountLikesCallback getCountLikesCallback); // void getMyLikers(GetMyLikersCallback getLikersForUserCallback); // void likeUser(String userId, LikeUserCallback likeUserCallback); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/UserDataSource.java // public interface UserDataSource { // void getUsers(GetUserCallback callback); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/api/ApiParse.java // public class ApiParse implements Api { // // // public ApiParse(Context context){ // Parse.initialize(context, "qFiaaQwGeJCdIpp3WUiBeuk0FXC4vRe0wGImASrB", "L8W1fORdrPiOGl63XzlxgUziX8q9f0ylV5tdV2Y1"); // } // // @Override // public void call(ApiCall apiCall) { // apiCall.call(); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/api/ApiRest.java // public class ApiRest implements Api { // // private final RestAdapter restAdapter; // // @Inject // public ApiRest(RestAdapter restAdapter) { // this.restAdapter = restAdapter; // } // // @Override // public void call(ApiCall apiCall) { // ApiRestCall restCall = (ApiRestCall) apiCall; // // restCall.setRestAdapter(restAdapter); // restCall.call(); // // // } // // public final static String DOMAIN = "http://api.randomuser.me"; // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/cache/Cache.java // public interface Cache<T> { // T get(String key); // void put(String key, T value); // List<T> getAllValues(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/cache/implementations/MapKeysCache.java // public class MapKeysCache implements Cache<String> { // // private Map<String,String> values = new HashMap<String, String>(); // // // @Override // public String get(String key) { // return values.get(key); // } // // @Override // public void put(String key, String value) { // values.put(key,value); // } // // @Override // public List<String> getAllValues() { // return new ArrayList<String>(values.values()); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/AndroidModule.java // @Module(library = true) // public class AndroidModule { // private final ProtoApplication application; // // public AndroidModule(ProtoApplication application) { // this.application = application; // } // // /** // * Allow the application context to be injected but require that it be annotated with // * {@link ForApplication @Annotation} to explicitly differentiate it from an activity context. // */ // @Provides // @Singleton // @ForApplication // Context provideApplicationContext() { // return application; // } // // @Provides // @Singleton // LocationManager provideLocationManager() { // return (LocationManager) application.getSystemService(LOCATION_SERVICE); // } // // } // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/DataSourceModule.java import android.content.Context; import com.flipper83.protohipster.daggerUtils.ForApplication; import com.flipper83.protohipster.feed.datasource.api.Api; import com.flipper83.protohipster.feed.datasource.interfaces.LikeDataSource; import com.flipper83.protohipster.feed.datasource.interfaces.UserDataSource; import com.flipper83.protohipster.feed.datasource.module.api.ApiParse; import com.flipper83.protohipster.feed.datasource.module.api.ApiRest; import com.flipper83.protohipster.globalutils.cache.Cache; import com.flipper83.protohipster.globalutils.cache.implementations.MapKeysCache; import com.flipper83.protohipster.globalutils.module.AndroidModule; import javax.inject.Named; import javax.inject.Singleton; import dagger.Module; import dagger.Provides; import retrofit.RestAdapter; package com.flipper83.protohipster.feed.datasource.module; @Module(library = true, includes = AndroidModule.class) public class DataSourceModule { public DataSourceModule() { } @Provides @Singleton
@Named("ApiRest")
flipper83/protohipster
protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/DataSourceModule.java
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/Api.java // public interface Api { // void call(ApiCall apiCall); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/LikeDataSource.java // public interface LikeDataSource { // void getCountLikesForUser(List<String> userIds, GetCountLikesCallback getCountLikesCallback); // void getMyLikers(GetMyLikersCallback getLikersForUserCallback); // void likeUser(String userId, LikeUserCallback likeUserCallback); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/UserDataSource.java // public interface UserDataSource { // void getUsers(GetUserCallback callback); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/api/ApiParse.java // public class ApiParse implements Api { // // // public ApiParse(Context context){ // Parse.initialize(context, "qFiaaQwGeJCdIpp3WUiBeuk0FXC4vRe0wGImASrB", "L8W1fORdrPiOGl63XzlxgUziX8q9f0ylV5tdV2Y1"); // } // // @Override // public void call(ApiCall apiCall) { // apiCall.call(); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/api/ApiRest.java // public class ApiRest implements Api { // // private final RestAdapter restAdapter; // // @Inject // public ApiRest(RestAdapter restAdapter) { // this.restAdapter = restAdapter; // } // // @Override // public void call(ApiCall apiCall) { // ApiRestCall restCall = (ApiRestCall) apiCall; // // restCall.setRestAdapter(restAdapter); // restCall.call(); // // // } // // public final static String DOMAIN = "http://api.randomuser.me"; // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/cache/Cache.java // public interface Cache<T> { // T get(String key); // void put(String key, T value); // List<T> getAllValues(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/cache/implementations/MapKeysCache.java // public class MapKeysCache implements Cache<String> { // // private Map<String,String> values = new HashMap<String, String>(); // // // @Override // public String get(String key) { // return values.get(key); // } // // @Override // public void put(String key, String value) { // values.put(key,value); // } // // @Override // public List<String> getAllValues() { // return new ArrayList<String>(values.values()); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/AndroidModule.java // @Module(library = true) // public class AndroidModule { // private final ProtoApplication application; // // public AndroidModule(ProtoApplication application) { // this.application = application; // } // // /** // * Allow the application context to be injected but require that it be annotated with // * {@link ForApplication @Annotation} to explicitly differentiate it from an activity context. // */ // @Provides // @Singleton // @ForApplication // Context provideApplicationContext() { // return application; // } // // @Provides // @Singleton // LocationManager provideLocationManager() { // return (LocationManager) application.getSystemService(LOCATION_SERVICE); // } // // }
import android.content.Context; import com.flipper83.protohipster.daggerUtils.ForApplication; import com.flipper83.protohipster.feed.datasource.api.Api; import com.flipper83.protohipster.feed.datasource.interfaces.LikeDataSource; import com.flipper83.protohipster.feed.datasource.interfaces.UserDataSource; import com.flipper83.protohipster.feed.datasource.module.api.ApiParse; import com.flipper83.protohipster.feed.datasource.module.api.ApiRest; import com.flipper83.protohipster.globalutils.cache.Cache; import com.flipper83.protohipster.globalutils.cache.implementations.MapKeysCache; import com.flipper83.protohipster.globalutils.module.AndroidModule; import javax.inject.Named; import javax.inject.Singleton; import dagger.Module; import dagger.Provides; import retrofit.RestAdapter;
package com.flipper83.protohipster.feed.datasource.module; @Module(library = true, includes = AndroidModule.class) public class DataSourceModule { public DataSourceModule() { } @Provides @Singleton @Named("ApiRest")
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/Api.java // public interface Api { // void call(ApiCall apiCall); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/LikeDataSource.java // public interface LikeDataSource { // void getCountLikesForUser(List<String> userIds, GetCountLikesCallback getCountLikesCallback); // void getMyLikers(GetMyLikersCallback getLikersForUserCallback); // void likeUser(String userId, LikeUserCallback likeUserCallback); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/UserDataSource.java // public interface UserDataSource { // void getUsers(GetUserCallback callback); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/api/ApiParse.java // public class ApiParse implements Api { // // // public ApiParse(Context context){ // Parse.initialize(context, "qFiaaQwGeJCdIpp3WUiBeuk0FXC4vRe0wGImASrB", "L8W1fORdrPiOGl63XzlxgUziX8q9f0ylV5tdV2Y1"); // } // // @Override // public void call(ApiCall apiCall) { // apiCall.call(); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/api/ApiRest.java // public class ApiRest implements Api { // // private final RestAdapter restAdapter; // // @Inject // public ApiRest(RestAdapter restAdapter) { // this.restAdapter = restAdapter; // } // // @Override // public void call(ApiCall apiCall) { // ApiRestCall restCall = (ApiRestCall) apiCall; // // restCall.setRestAdapter(restAdapter); // restCall.call(); // // // } // // public final static String DOMAIN = "http://api.randomuser.me"; // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/cache/Cache.java // public interface Cache<T> { // T get(String key); // void put(String key, T value); // List<T> getAllValues(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/cache/implementations/MapKeysCache.java // public class MapKeysCache implements Cache<String> { // // private Map<String,String> values = new HashMap<String, String>(); // // // @Override // public String get(String key) { // return values.get(key); // } // // @Override // public void put(String key, String value) { // values.put(key,value); // } // // @Override // public List<String> getAllValues() { // return new ArrayList<String>(values.values()); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/AndroidModule.java // @Module(library = true) // public class AndroidModule { // private final ProtoApplication application; // // public AndroidModule(ProtoApplication application) { // this.application = application; // } // // /** // * Allow the application context to be injected but require that it be annotated with // * {@link ForApplication @Annotation} to explicitly differentiate it from an activity context. // */ // @Provides // @Singleton // @ForApplication // Context provideApplicationContext() { // return application; // } // // @Provides // @Singleton // LocationManager provideLocationManager() { // return (LocationManager) application.getSystemService(LOCATION_SERVICE); // } // // } // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/DataSourceModule.java import android.content.Context; import com.flipper83.protohipster.daggerUtils.ForApplication; import com.flipper83.protohipster.feed.datasource.api.Api; import com.flipper83.protohipster.feed.datasource.interfaces.LikeDataSource; import com.flipper83.protohipster.feed.datasource.interfaces.UserDataSource; import com.flipper83.protohipster.feed.datasource.module.api.ApiParse; import com.flipper83.protohipster.feed.datasource.module.api.ApiRest; import com.flipper83.protohipster.globalutils.cache.Cache; import com.flipper83.protohipster.globalutils.cache.implementations.MapKeysCache; import com.flipper83.protohipster.globalutils.module.AndroidModule; import javax.inject.Named; import javax.inject.Singleton; import dagger.Module; import dagger.Provides; import retrofit.RestAdapter; package com.flipper83.protohipster.feed.datasource.module; @Module(library = true, includes = AndroidModule.class) public class DataSourceModule { public DataSourceModule() { } @Provides @Singleton @Named("ApiRest")
Api provideApiRest(ApiRest apiRest) {
flipper83/protohipster
protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/DataSourceModule.java
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/Api.java // public interface Api { // void call(ApiCall apiCall); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/LikeDataSource.java // public interface LikeDataSource { // void getCountLikesForUser(List<String> userIds, GetCountLikesCallback getCountLikesCallback); // void getMyLikers(GetMyLikersCallback getLikersForUserCallback); // void likeUser(String userId, LikeUserCallback likeUserCallback); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/UserDataSource.java // public interface UserDataSource { // void getUsers(GetUserCallback callback); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/api/ApiParse.java // public class ApiParse implements Api { // // // public ApiParse(Context context){ // Parse.initialize(context, "qFiaaQwGeJCdIpp3WUiBeuk0FXC4vRe0wGImASrB", "L8W1fORdrPiOGl63XzlxgUziX8q9f0ylV5tdV2Y1"); // } // // @Override // public void call(ApiCall apiCall) { // apiCall.call(); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/api/ApiRest.java // public class ApiRest implements Api { // // private final RestAdapter restAdapter; // // @Inject // public ApiRest(RestAdapter restAdapter) { // this.restAdapter = restAdapter; // } // // @Override // public void call(ApiCall apiCall) { // ApiRestCall restCall = (ApiRestCall) apiCall; // // restCall.setRestAdapter(restAdapter); // restCall.call(); // // // } // // public final static String DOMAIN = "http://api.randomuser.me"; // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/cache/Cache.java // public interface Cache<T> { // T get(String key); // void put(String key, T value); // List<T> getAllValues(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/cache/implementations/MapKeysCache.java // public class MapKeysCache implements Cache<String> { // // private Map<String,String> values = new HashMap<String, String>(); // // // @Override // public String get(String key) { // return values.get(key); // } // // @Override // public void put(String key, String value) { // values.put(key,value); // } // // @Override // public List<String> getAllValues() { // return new ArrayList<String>(values.values()); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/AndroidModule.java // @Module(library = true) // public class AndroidModule { // private final ProtoApplication application; // // public AndroidModule(ProtoApplication application) { // this.application = application; // } // // /** // * Allow the application context to be injected but require that it be annotated with // * {@link ForApplication @Annotation} to explicitly differentiate it from an activity context. // */ // @Provides // @Singleton // @ForApplication // Context provideApplicationContext() { // return application; // } // // @Provides // @Singleton // LocationManager provideLocationManager() { // return (LocationManager) application.getSystemService(LOCATION_SERVICE); // } // // }
import android.content.Context; import com.flipper83.protohipster.daggerUtils.ForApplication; import com.flipper83.protohipster.feed.datasource.api.Api; import com.flipper83.protohipster.feed.datasource.interfaces.LikeDataSource; import com.flipper83.protohipster.feed.datasource.interfaces.UserDataSource; import com.flipper83.protohipster.feed.datasource.module.api.ApiParse; import com.flipper83.protohipster.feed.datasource.module.api.ApiRest; import com.flipper83.protohipster.globalutils.cache.Cache; import com.flipper83.protohipster.globalutils.cache.implementations.MapKeysCache; import com.flipper83.protohipster.globalutils.module.AndroidModule; import javax.inject.Named; import javax.inject.Singleton; import dagger.Module; import dagger.Provides; import retrofit.RestAdapter;
package com.flipper83.protohipster.feed.datasource.module; @Module(library = true, includes = AndroidModule.class) public class DataSourceModule { public DataSourceModule() { } @Provides @Singleton @Named("ApiRest") Api provideApiRest(ApiRest apiRest) { return apiRest; } @Provides @Singleton
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/Api.java // public interface Api { // void call(ApiCall apiCall); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/LikeDataSource.java // public interface LikeDataSource { // void getCountLikesForUser(List<String> userIds, GetCountLikesCallback getCountLikesCallback); // void getMyLikers(GetMyLikersCallback getLikersForUserCallback); // void likeUser(String userId, LikeUserCallback likeUserCallback); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/UserDataSource.java // public interface UserDataSource { // void getUsers(GetUserCallback callback); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/api/ApiParse.java // public class ApiParse implements Api { // // // public ApiParse(Context context){ // Parse.initialize(context, "qFiaaQwGeJCdIpp3WUiBeuk0FXC4vRe0wGImASrB", "L8W1fORdrPiOGl63XzlxgUziX8q9f0ylV5tdV2Y1"); // } // // @Override // public void call(ApiCall apiCall) { // apiCall.call(); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/api/ApiRest.java // public class ApiRest implements Api { // // private final RestAdapter restAdapter; // // @Inject // public ApiRest(RestAdapter restAdapter) { // this.restAdapter = restAdapter; // } // // @Override // public void call(ApiCall apiCall) { // ApiRestCall restCall = (ApiRestCall) apiCall; // // restCall.setRestAdapter(restAdapter); // restCall.call(); // // // } // // public final static String DOMAIN = "http://api.randomuser.me"; // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/cache/Cache.java // public interface Cache<T> { // T get(String key); // void put(String key, T value); // List<T> getAllValues(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/cache/implementations/MapKeysCache.java // public class MapKeysCache implements Cache<String> { // // private Map<String,String> values = new HashMap<String, String>(); // // // @Override // public String get(String key) { // return values.get(key); // } // // @Override // public void put(String key, String value) { // values.put(key,value); // } // // @Override // public List<String> getAllValues() { // return new ArrayList<String>(values.values()); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/AndroidModule.java // @Module(library = true) // public class AndroidModule { // private final ProtoApplication application; // // public AndroidModule(ProtoApplication application) { // this.application = application; // } // // /** // * Allow the application context to be injected but require that it be annotated with // * {@link ForApplication @Annotation} to explicitly differentiate it from an activity context. // */ // @Provides // @Singleton // @ForApplication // Context provideApplicationContext() { // return application; // } // // @Provides // @Singleton // LocationManager provideLocationManager() { // return (LocationManager) application.getSystemService(LOCATION_SERVICE); // } // // } // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/DataSourceModule.java import android.content.Context; import com.flipper83.protohipster.daggerUtils.ForApplication; import com.flipper83.protohipster.feed.datasource.api.Api; import com.flipper83.protohipster.feed.datasource.interfaces.LikeDataSource; import com.flipper83.protohipster.feed.datasource.interfaces.UserDataSource; import com.flipper83.protohipster.feed.datasource.module.api.ApiParse; import com.flipper83.protohipster.feed.datasource.module.api.ApiRest; import com.flipper83.protohipster.globalutils.cache.Cache; import com.flipper83.protohipster.globalutils.cache.implementations.MapKeysCache; import com.flipper83.protohipster.globalutils.module.AndroidModule; import javax.inject.Named; import javax.inject.Singleton; import dagger.Module; import dagger.Provides; import retrofit.RestAdapter; package com.flipper83.protohipster.feed.datasource.module; @Module(library = true, includes = AndroidModule.class) public class DataSourceModule { public DataSourceModule() { } @Provides @Singleton @Named("ApiRest") Api provideApiRest(ApiRest apiRest) { return apiRest; } @Provides @Singleton
@Named("ApiParse")
flipper83/protohipster
protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/DataSourceModule.java
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/Api.java // public interface Api { // void call(ApiCall apiCall); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/LikeDataSource.java // public interface LikeDataSource { // void getCountLikesForUser(List<String> userIds, GetCountLikesCallback getCountLikesCallback); // void getMyLikers(GetMyLikersCallback getLikersForUserCallback); // void likeUser(String userId, LikeUserCallback likeUserCallback); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/UserDataSource.java // public interface UserDataSource { // void getUsers(GetUserCallback callback); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/api/ApiParse.java // public class ApiParse implements Api { // // // public ApiParse(Context context){ // Parse.initialize(context, "qFiaaQwGeJCdIpp3WUiBeuk0FXC4vRe0wGImASrB", "L8W1fORdrPiOGl63XzlxgUziX8q9f0ylV5tdV2Y1"); // } // // @Override // public void call(ApiCall apiCall) { // apiCall.call(); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/api/ApiRest.java // public class ApiRest implements Api { // // private final RestAdapter restAdapter; // // @Inject // public ApiRest(RestAdapter restAdapter) { // this.restAdapter = restAdapter; // } // // @Override // public void call(ApiCall apiCall) { // ApiRestCall restCall = (ApiRestCall) apiCall; // // restCall.setRestAdapter(restAdapter); // restCall.call(); // // // } // // public final static String DOMAIN = "http://api.randomuser.me"; // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/cache/Cache.java // public interface Cache<T> { // T get(String key); // void put(String key, T value); // List<T> getAllValues(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/cache/implementations/MapKeysCache.java // public class MapKeysCache implements Cache<String> { // // private Map<String,String> values = new HashMap<String, String>(); // // // @Override // public String get(String key) { // return values.get(key); // } // // @Override // public void put(String key, String value) { // values.put(key,value); // } // // @Override // public List<String> getAllValues() { // return new ArrayList<String>(values.values()); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/AndroidModule.java // @Module(library = true) // public class AndroidModule { // private final ProtoApplication application; // // public AndroidModule(ProtoApplication application) { // this.application = application; // } // // /** // * Allow the application context to be injected but require that it be annotated with // * {@link ForApplication @Annotation} to explicitly differentiate it from an activity context. // */ // @Provides // @Singleton // @ForApplication // Context provideApplicationContext() { // return application; // } // // @Provides // @Singleton // LocationManager provideLocationManager() { // return (LocationManager) application.getSystemService(LOCATION_SERVICE); // } // // }
import android.content.Context; import com.flipper83.protohipster.daggerUtils.ForApplication; import com.flipper83.protohipster.feed.datasource.api.Api; import com.flipper83.protohipster.feed.datasource.interfaces.LikeDataSource; import com.flipper83.protohipster.feed.datasource.interfaces.UserDataSource; import com.flipper83.protohipster.feed.datasource.module.api.ApiParse; import com.flipper83.protohipster.feed.datasource.module.api.ApiRest; import com.flipper83.protohipster.globalutils.cache.Cache; import com.flipper83.protohipster.globalutils.cache.implementations.MapKeysCache; import com.flipper83.protohipster.globalutils.module.AndroidModule; import javax.inject.Named; import javax.inject.Singleton; import dagger.Module; import dagger.Provides; import retrofit.RestAdapter;
package com.flipper83.protohipster.feed.datasource.module; @Module(library = true, includes = AndroidModule.class) public class DataSourceModule { public DataSourceModule() { } @Provides @Singleton @Named("ApiRest") Api provideApiRest(ApiRest apiRest) { return apiRest; } @Provides @Singleton @Named("ApiParse") Api provideApiParse(@ForApplication Context context) { return new ApiParse(context); } @Provides @Singleton
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/Api.java // public interface Api { // void call(ApiCall apiCall); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/LikeDataSource.java // public interface LikeDataSource { // void getCountLikesForUser(List<String> userIds, GetCountLikesCallback getCountLikesCallback); // void getMyLikers(GetMyLikersCallback getLikersForUserCallback); // void likeUser(String userId, LikeUserCallback likeUserCallback); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/UserDataSource.java // public interface UserDataSource { // void getUsers(GetUserCallback callback); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/api/ApiParse.java // public class ApiParse implements Api { // // // public ApiParse(Context context){ // Parse.initialize(context, "qFiaaQwGeJCdIpp3WUiBeuk0FXC4vRe0wGImASrB", "L8W1fORdrPiOGl63XzlxgUziX8q9f0ylV5tdV2Y1"); // } // // @Override // public void call(ApiCall apiCall) { // apiCall.call(); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/api/ApiRest.java // public class ApiRest implements Api { // // private final RestAdapter restAdapter; // // @Inject // public ApiRest(RestAdapter restAdapter) { // this.restAdapter = restAdapter; // } // // @Override // public void call(ApiCall apiCall) { // ApiRestCall restCall = (ApiRestCall) apiCall; // // restCall.setRestAdapter(restAdapter); // restCall.call(); // // // } // // public final static String DOMAIN = "http://api.randomuser.me"; // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/cache/Cache.java // public interface Cache<T> { // T get(String key); // void put(String key, T value); // List<T> getAllValues(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/cache/implementations/MapKeysCache.java // public class MapKeysCache implements Cache<String> { // // private Map<String,String> values = new HashMap<String, String>(); // // // @Override // public String get(String key) { // return values.get(key); // } // // @Override // public void put(String key, String value) { // values.put(key,value); // } // // @Override // public List<String> getAllValues() { // return new ArrayList<String>(values.values()); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/AndroidModule.java // @Module(library = true) // public class AndroidModule { // private final ProtoApplication application; // // public AndroidModule(ProtoApplication application) { // this.application = application; // } // // /** // * Allow the application context to be injected but require that it be annotated with // * {@link ForApplication @Annotation} to explicitly differentiate it from an activity context. // */ // @Provides // @Singleton // @ForApplication // Context provideApplicationContext() { // return application; // } // // @Provides // @Singleton // LocationManager provideLocationManager() { // return (LocationManager) application.getSystemService(LOCATION_SERVICE); // } // // } // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/DataSourceModule.java import android.content.Context; import com.flipper83.protohipster.daggerUtils.ForApplication; import com.flipper83.protohipster.feed.datasource.api.Api; import com.flipper83.protohipster.feed.datasource.interfaces.LikeDataSource; import com.flipper83.protohipster.feed.datasource.interfaces.UserDataSource; import com.flipper83.protohipster.feed.datasource.module.api.ApiParse; import com.flipper83.protohipster.feed.datasource.module.api.ApiRest; import com.flipper83.protohipster.globalutils.cache.Cache; import com.flipper83.protohipster.globalutils.cache.implementations.MapKeysCache; import com.flipper83.protohipster.globalutils.module.AndroidModule; import javax.inject.Named; import javax.inject.Singleton; import dagger.Module; import dagger.Provides; import retrofit.RestAdapter; package com.flipper83.protohipster.feed.datasource.module; @Module(library = true, includes = AndroidModule.class) public class DataSourceModule { public DataSourceModule() { } @Provides @Singleton @Named("ApiRest") Api provideApiRest(ApiRest apiRest) { return apiRest; } @Provides @Singleton @Named("ApiParse") Api provideApiParse(@ForApplication Context context) { return new ApiParse(context); } @Provides @Singleton
@Named("MapKeysCache")
flipper83/protohipster
protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/DataSourceModule.java
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/Api.java // public interface Api { // void call(ApiCall apiCall); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/LikeDataSource.java // public interface LikeDataSource { // void getCountLikesForUser(List<String> userIds, GetCountLikesCallback getCountLikesCallback); // void getMyLikers(GetMyLikersCallback getLikersForUserCallback); // void likeUser(String userId, LikeUserCallback likeUserCallback); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/UserDataSource.java // public interface UserDataSource { // void getUsers(GetUserCallback callback); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/api/ApiParse.java // public class ApiParse implements Api { // // // public ApiParse(Context context){ // Parse.initialize(context, "qFiaaQwGeJCdIpp3WUiBeuk0FXC4vRe0wGImASrB", "L8W1fORdrPiOGl63XzlxgUziX8q9f0ylV5tdV2Y1"); // } // // @Override // public void call(ApiCall apiCall) { // apiCall.call(); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/api/ApiRest.java // public class ApiRest implements Api { // // private final RestAdapter restAdapter; // // @Inject // public ApiRest(RestAdapter restAdapter) { // this.restAdapter = restAdapter; // } // // @Override // public void call(ApiCall apiCall) { // ApiRestCall restCall = (ApiRestCall) apiCall; // // restCall.setRestAdapter(restAdapter); // restCall.call(); // // // } // // public final static String DOMAIN = "http://api.randomuser.me"; // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/cache/Cache.java // public interface Cache<T> { // T get(String key); // void put(String key, T value); // List<T> getAllValues(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/cache/implementations/MapKeysCache.java // public class MapKeysCache implements Cache<String> { // // private Map<String,String> values = new HashMap<String, String>(); // // // @Override // public String get(String key) { // return values.get(key); // } // // @Override // public void put(String key, String value) { // values.put(key,value); // } // // @Override // public List<String> getAllValues() { // return new ArrayList<String>(values.values()); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/AndroidModule.java // @Module(library = true) // public class AndroidModule { // private final ProtoApplication application; // // public AndroidModule(ProtoApplication application) { // this.application = application; // } // // /** // * Allow the application context to be injected but require that it be annotated with // * {@link ForApplication @Annotation} to explicitly differentiate it from an activity context. // */ // @Provides // @Singleton // @ForApplication // Context provideApplicationContext() { // return application; // } // // @Provides // @Singleton // LocationManager provideLocationManager() { // return (LocationManager) application.getSystemService(LOCATION_SERVICE); // } // // }
import android.content.Context; import com.flipper83.protohipster.daggerUtils.ForApplication; import com.flipper83.protohipster.feed.datasource.api.Api; import com.flipper83.protohipster.feed.datasource.interfaces.LikeDataSource; import com.flipper83.protohipster.feed.datasource.interfaces.UserDataSource; import com.flipper83.protohipster.feed.datasource.module.api.ApiParse; import com.flipper83.protohipster.feed.datasource.module.api.ApiRest; import com.flipper83.protohipster.globalutils.cache.Cache; import com.flipper83.protohipster.globalutils.cache.implementations.MapKeysCache; import com.flipper83.protohipster.globalutils.module.AndroidModule; import javax.inject.Named; import javax.inject.Singleton; import dagger.Module; import dagger.Provides; import retrofit.RestAdapter;
package com.flipper83.protohipster.feed.datasource.module; @Module(library = true, includes = AndroidModule.class) public class DataSourceModule { public DataSourceModule() { } @Provides @Singleton @Named("ApiRest") Api provideApiRest(ApiRest apiRest) { return apiRest; } @Provides @Singleton @Named("ApiParse") Api provideApiParse(@ForApplication Context context) { return new ApiParse(context); } @Provides @Singleton @Named("MapKeysCache")
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/Api.java // public interface Api { // void call(ApiCall apiCall); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/LikeDataSource.java // public interface LikeDataSource { // void getCountLikesForUser(List<String> userIds, GetCountLikesCallback getCountLikesCallback); // void getMyLikers(GetMyLikersCallback getLikersForUserCallback); // void likeUser(String userId, LikeUserCallback likeUserCallback); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/UserDataSource.java // public interface UserDataSource { // void getUsers(GetUserCallback callback); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/api/ApiParse.java // public class ApiParse implements Api { // // // public ApiParse(Context context){ // Parse.initialize(context, "qFiaaQwGeJCdIpp3WUiBeuk0FXC4vRe0wGImASrB", "L8W1fORdrPiOGl63XzlxgUziX8q9f0ylV5tdV2Y1"); // } // // @Override // public void call(ApiCall apiCall) { // apiCall.call(); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/api/ApiRest.java // public class ApiRest implements Api { // // private final RestAdapter restAdapter; // // @Inject // public ApiRest(RestAdapter restAdapter) { // this.restAdapter = restAdapter; // } // // @Override // public void call(ApiCall apiCall) { // ApiRestCall restCall = (ApiRestCall) apiCall; // // restCall.setRestAdapter(restAdapter); // restCall.call(); // // // } // // public final static String DOMAIN = "http://api.randomuser.me"; // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/cache/Cache.java // public interface Cache<T> { // T get(String key); // void put(String key, T value); // List<T> getAllValues(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/cache/implementations/MapKeysCache.java // public class MapKeysCache implements Cache<String> { // // private Map<String,String> values = new HashMap<String, String>(); // // // @Override // public String get(String key) { // return values.get(key); // } // // @Override // public void put(String key, String value) { // values.put(key,value); // } // // @Override // public List<String> getAllValues() { // return new ArrayList<String>(values.values()); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/AndroidModule.java // @Module(library = true) // public class AndroidModule { // private final ProtoApplication application; // // public AndroidModule(ProtoApplication application) { // this.application = application; // } // // /** // * Allow the application context to be injected but require that it be annotated with // * {@link ForApplication @Annotation} to explicitly differentiate it from an activity context. // */ // @Provides // @Singleton // @ForApplication // Context provideApplicationContext() { // return application; // } // // @Provides // @Singleton // LocationManager provideLocationManager() { // return (LocationManager) application.getSystemService(LOCATION_SERVICE); // } // // } // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/DataSourceModule.java import android.content.Context; import com.flipper83.protohipster.daggerUtils.ForApplication; import com.flipper83.protohipster.feed.datasource.api.Api; import com.flipper83.protohipster.feed.datasource.interfaces.LikeDataSource; import com.flipper83.protohipster.feed.datasource.interfaces.UserDataSource; import com.flipper83.protohipster.feed.datasource.module.api.ApiParse; import com.flipper83.protohipster.feed.datasource.module.api.ApiRest; import com.flipper83.protohipster.globalutils.cache.Cache; import com.flipper83.protohipster.globalutils.cache.implementations.MapKeysCache; import com.flipper83.protohipster.globalutils.module.AndroidModule; import javax.inject.Named; import javax.inject.Singleton; import dagger.Module; import dagger.Provides; import retrofit.RestAdapter; package com.flipper83.protohipster.feed.datasource.module; @Module(library = true, includes = AndroidModule.class) public class DataSourceModule { public DataSourceModule() { } @Provides @Singleton @Named("ApiRest") Api provideApiRest(ApiRest apiRest) { return apiRest; } @Provides @Singleton @Named("ApiParse") Api provideApiParse(@ForApplication Context context) { return new ApiParse(context); } @Provides @Singleton @Named("MapKeysCache")
Cache provideApiParse() {
flipper83/protohipster
protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/DataSourceModule.java
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/Api.java // public interface Api { // void call(ApiCall apiCall); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/LikeDataSource.java // public interface LikeDataSource { // void getCountLikesForUser(List<String> userIds, GetCountLikesCallback getCountLikesCallback); // void getMyLikers(GetMyLikersCallback getLikersForUserCallback); // void likeUser(String userId, LikeUserCallback likeUserCallback); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/UserDataSource.java // public interface UserDataSource { // void getUsers(GetUserCallback callback); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/api/ApiParse.java // public class ApiParse implements Api { // // // public ApiParse(Context context){ // Parse.initialize(context, "qFiaaQwGeJCdIpp3WUiBeuk0FXC4vRe0wGImASrB", "L8W1fORdrPiOGl63XzlxgUziX8q9f0ylV5tdV2Y1"); // } // // @Override // public void call(ApiCall apiCall) { // apiCall.call(); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/api/ApiRest.java // public class ApiRest implements Api { // // private final RestAdapter restAdapter; // // @Inject // public ApiRest(RestAdapter restAdapter) { // this.restAdapter = restAdapter; // } // // @Override // public void call(ApiCall apiCall) { // ApiRestCall restCall = (ApiRestCall) apiCall; // // restCall.setRestAdapter(restAdapter); // restCall.call(); // // // } // // public final static String DOMAIN = "http://api.randomuser.me"; // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/cache/Cache.java // public interface Cache<T> { // T get(String key); // void put(String key, T value); // List<T> getAllValues(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/cache/implementations/MapKeysCache.java // public class MapKeysCache implements Cache<String> { // // private Map<String,String> values = new HashMap<String, String>(); // // // @Override // public String get(String key) { // return values.get(key); // } // // @Override // public void put(String key, String value) { // values.put(key,value); // } // // @Override // public List<String> getAllValues() { // return new ArrayList<String>(values.values()); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/AndroidModule.java // @Module(library = true) // public class AndroidModule { // private final ProtoApplication application; // // public AndroidModule(ProtoApplication application) { // this.application = application; // } // // /** // * Allow the application context to be injected but require that it be annotated with // * {@link ForApplication @Annotation} to explicitly differentiate it from an activity context. // */ // @Provides // @Singleton // @ForApplication // Context provideApplicationContext() { // return application; // } // // @Provides // @Singleton // LocationManager provideLocationManager() { // return (LocationManager) application.getSystemService(LOCATION_SERVICE); // } // // }
import android.content.Context; import com.flipper83.protohipster.daggerUtils.ForApplication; import com.flipper83.protohipster.feed.datasource.api.Api; import com.flipper83.protohipster.feed.datasource.interfaces.LikeDataSource; import com.flipper83.protohipster.feed.datasource.interfaces.UserDataSource; import com.flipper83.protohipster.feed.datasource.module.api.ApiParse; import com.flipper83.protohipster.feed.datasource.module.api.ApiRest; import com.flipper83.protohipster.globalutils.cache.Cache; import com.flipper83.protohipster.globalutils.cache.implementations.MapKeysCache; import com.flipper83.protohipster.globalutils.module.AndroidModule; import javax.inject.Named; import javax.inject.Singleton; import dagger.Module; import dagger.Provides; import retrofit.RestAdapter;
@Provides @Singleton @Named("ApiRest") Api provideApiRest(ApiRest apiRest) { return apiRest; } @Provides @Singleton @Named("ApiParse") Api provideApiParse(@ForApplication Context context) { return new ApiParse(context); } @Provides @Singleton @Named("MapKeysCache") Cache provideApiParse() { return new MapKeysCache(); } @Provides RestAdapter provideRestAdapter() { return new RestAdapter.Builder() .setServer(ApiRest.DOMAIN) .build(); } @Provides
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/Api.java // public interface Api { // void call(ApiCall apiCall); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/LikeDataSource.java // public interface LikeDataSource { // void getCountLikesForUser(List<String> userIds, GetCountLikesCallback getCountLikesCallback); // void getMyLikers(GetMyLikersCallback getLikersForUserCallback); // void likeUser(String userId, LikeUserCallback likeUserCallback); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/UserDataSource.java // public interface UserDataSource { // void getUsers(GetUserCallback callback); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/api/ApiParse.java // public class ApiParse implements Api { // // // public ApiParse(Context context){ // Parse.initialize(context, "qFiaaQwGeJCdIpp3WUiBeuk0FXC4vRe0wGImASrB", "L8W1fORdrPiOGl63XzlxgUziX8q9f0ylV5tdV2Y1"); // } // // @Override // public void call(ApiCall apiCall) { // apiCall.call(); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/api/ApiRest.java // public class ApiRest implements Api { // // private final RestAdapter restAdapter; // // @Inject // public ApiRest(RestAdapter restAdapter) { // this.restAdapter = restAdapter; // } // // @Override // public void call(ApiCall apiCall) { // ApiRestCall restCall = (ApiRestCall) apiCall; // // restCall.setRestAdapter(restAdapter); // restCall.call(); // // // } // // public final static String DOMAIN = "http://api.randomuser.me"; // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/cache/Cache.java // public interface Cache<T> { // T get(String key); // void put(String key, T value); // List<T> getAllValues(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/cache/implementations/MapKeysCache.java // public class MapKeysCache implements Cache<String> { // // private Map<String,String> values = new HashMap<String, String>(); // // // @Override // public String get(String key) { // return values.get(key); // } // // @Override // public void put(String key, String value) { // values.put(key,value); // } // // @Override // public List<String> getAllValues() { // return new ArrayList<String>(values.values()); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/AndroidModule.java // @Module(library = true) // public class AndroidModule { // private final ProtoApplication application; // // public AndroidModule(ProtoApplication application) { // this.application = application; // } // // /** // * Allow the application context to be injected but require that it be annotated with // * {@link ForApplication @Annotation} to explicitly differentiate it from an activity context. // */ // @Provides // @Singleton // @ForApplication // Context provideApplicationContext() { // return application; // } // // @Provides // @Singleton // LocationManager provideLocationManager() { // return (LocationManager) application.getSystemService(LOCATION_SERVICE); // } // // } // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/DataSourceModule.java import android.content.Context; import com.flipper83.protohipster.daggerUtils.ForApplication; import com.flipper83.protohipster.feed.datasource.api.Api; import com.flipper83.protohipster.feed.datasource.interfaces.LikeDataSource; import com.flipper83.protohipster.feed.datasource.interfaces.UserDataSource; import com.flipper83.protohipster.feed.datasource.module.api.ApiParse; import com.flipper83.protohipster.feed.datasource.module.api.ApiRest; import com.flipper83.protohipster.globalutils.cache.Cache; import com.flipper83.protohipster.globalutils.cache.implementations.MapKeysCache; import com.flipper83.protohipster.globalutils.module.AndroidModule; import javax.inject.Named; import javax.inject.Singleton; import dagger.Module; import dagger.Provides; import retrofit.RestAdapter; @Provides @Singleton @Named("ApiRest") Api provideApiRest(ApiRest apiRest) { return apiRest; } @Provides @Singleton @Named("ApiParse") Api provideApiParse(@ForApplication Context context) { return new ApiParse(context); } @Provides @Singleton @Named("MapKeysCache") Cache provideApiParse() { return new MapKeysCache(); } @Provides RestAdapter provideRestAdapter() { return new RestAdapter.Builder() .setServer(ApiRest.DOMAIN) .build(); } @Provides
UserDataSource provideUserDataSource(@Named("ApiRest") Api api) {
flipper83/protohipster
protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/DataSourceModule.java
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/Api.java // public interface Api { // void call(ApiCall apiCall); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/LikeDataSource.java // public interface LikeDataSource { // void getCountLikesForUser(List<String> userIds, GetCountLikesCallback getCountLikesCallback); // void getMyLikers(GetMyLikersCallback getLikersForUserCallback); // void likeUser(String userId, LikeUserCallback likeUserCallback); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/UserDataSource.java // public interface UserDataSource { // void getUsers(GetUserCallback callback); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/api/ApiParse.java // public class ApiParse implements Api { // // // public ApiParse(Context context){ // Parse.initialize(context, "qFiaaQwGeJCdIpp3WUiBeuk0FXC4vRe0wGImASrB", "L8W1fORdrPiOGl63XzlxgUziX8q9f0ylV5tdV2Y1"); // } // // @Override // public void call(ApiCall apiCall) { // apiCall.call(); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/api/ApiRest.java // public class ApiRest implements Api { // // private final RestAdapter restAdapter; // // @Inject // public ApiRest(RestAdapter restAdapter) { // this.restAdapter = restAdapter; // } // // @Override // public void call(ApiCall apiCall) { // ApiRestCall restCall = (ApiRestCall) apiCall; // // restCall.setRestAdapter(restAdapter); // restCall.call(); // // // } // // public final static String DOMAIN = "http://api.randomuser.me"; // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/cache/Cache.java // public interface Cache<T> { // T get(String key); // void put(String key, T value); // List<T> getAllValues(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/cache/implementations/MapKeysCache.java // public class MapKeysCache implements Cache<String> { // // private Map<String,String> values = new HashMap<String, String>(); // // // @Override // public String get(String key) { // return values.get(key); // } // // @Override // public void put(String key, String value) { // values.put(key,value); // } // // @Override // public List<String> getAllValues() { // return new ArrayList<String>(values.values()); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/AndroidModule.java // @Module(library = true) // public class AndroidModule { // private final ProtoApplication application; // // public AndroidModule(ProtoApplication application) { // this.application = application; // } // // /** // * Allow the application context to be injected but require that it be annotated with // * {@link ForApplication @Annotation} to explicitly differentiate it from an activity context. // */ // @Provides // @Singleton // @ForApplication // Context provideApplicationContext() { // return application; // } // // @Provides // @Singleton // LocationManager provideLocationManager() { // return (LocationManager) application.getSystemService(LOCATION_SERVICE); // } // // }
import android.content.Context; import com.flipper83.protohipster.daggerUtils.ForApplication; import com.flipper83.protohipster.feed.datasource.api.Api; import com.flipper83.protohipster.feed.datasource.interfaces.LikeDataSource; import com.flipper83.protohipster.feed.datasource.interfaces.UserDataSource; import com.flipper83.protohipster.feed.datasource.module.api.ApiParse; import com.flipper83.protohipster.feed.datasource.module.api.ApiRest; import com.flipper83.protohipster.globalutils.cache.Cache; import com.flipper83.protohipster.globalutils.cache.implementations.MapKeysCache; import com.flipper83.protohipster.globalutils.module.AndroidModule; import javax.inject.Named; import javax.inject.Singleton; import dagger.Module; import dagger.Provides; import retrofit.RestAdapter;
} @Provides @Singleton @Named("ApiParse") Api provideApiParse(@ForApplication Context context) { return new ApiParse(context); } @Provides @Singleton @Named("MapKeysCache") Cache provideApiParse() { return new MapKeysCache(); } @Provides RestAdapter provideRestAdapter() { return new RestAdapter.Builder() .setServer(ApiRest.DOMAIN) .build(); } @Provides UserDataSource provideUserDataSource(@Named("ApiRest") Api api) { return new UserDataSourceImp(api); } @Provides
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/Api.java // public interface Api { // void call(ApiCall apiCall); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/LikeDataSource.java // public interface LikeDataSource { // void getCountLikesForUser(List<String> userIds, GetCountLikesCallback getCountLikesCallback); // void getMyLikers(GetMyLikersCallback getLikersForUserCallback); // void likeUser(String userId, LikeUserCallback likeUserCallback); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/UserDataSource.java // public interface UserDataSource { // void getUsers(GetUserCallback callback); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/api/ApiParse.java // public class ApiParse implements Api { // // // public ApiParse(Context context){ // Parse.initialize(context, "qFiaaQwGeJCdIpp3WUiBeuk0FXC4vRe0wGImASrB", "L8W1fORdrPiOGl63XzlxgUziX8q9f0ylV5tdV2Y1"); // } // // @Override // public void call(ApiCall apiCall) { // apiCall.call(); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/api/ApiRest.java // public class ApiRest implements Api { // // private final RestAdapter restAdapter; // // @Inject // public ApiRest(RestAdapter restAdapter) { // this.restAdapter = restAdapter; // } // // @Override // public void call(ApiCall apiCall) { // ApiRestCall restCall = (ApiRestCall) apiCall; // // restCall.setRestAdapter(restAdapter); // restCall.call(); // // // } // // public final static String DOMAIN = "http://api.randomuser.me"; // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/cache/Cache.java // public interface Cache<T> { // T get(String key); // void put(String key, T value); // List<T> getAllValues(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/cache/implementations/MapKeysCache.java // public class MapKeysCache implements Cache<String> { // // private Map<String,String> values = new HashMap<String, String>(); // // // @Override // public String get(String key) { // return values.get(key); // } // // @Override // public void put(String key, String value) { // values.put(key,value); // } // // @Override // public List<String> getAllValues() { // return new ArrayList<String>(values.values()); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/AndroidModule.java // @Module(library = true) // public class AndroidModule { // private final ProtoApplication application; // // public AndroidModule(ProtoApplication application) { // this.application = application; // } // // /** // * Allow the application context to be injected but require that it be annotated with // * {@link ForApplication @Annotation} to explicitly differentiate it from an activity context. // */ // @Provides // @Singleton // @ForApplication // Context provideApplicationContext() { // return application; // } // // @Provides // @Singleton // LocationManager provideLocationManager() { // return (LocationManager) application.getSystemService(LOCATION_SERVICE); // } // // } // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/DataSourceModule.java import android.content.Context; import com.flipper83.protohipster.daggerUtils.ForApplication; import com.flipper83.protohipster.feed.datasource.api.Api; import com.flipper83.protohipster.feed.datasource.interfaces.LikeDataSource; import com.flipper83.protohipster.feed.datasource.interfaces.UserDataSource; import com.flipper83.protohipster.feed.datasource.module.api.ApiParse; import com.flipper83.protohipster.feed.datasource.module.api.ApiRest; import com.flipper83.protohipster.globalutils.cache.Cache; import com.flipper83.protohipster.globalutils.cache.implementations.MapKeysCache; import com.flipper83.protohipster.globalutils.module.AndroidModule; import javax.inject.Named; import javax.inject.Singleton; import dagger.Module; import dagger.Provides; import retrofit.RestAdapter; } @Provides @Singleton @Named("ApiParse") Api provideApiParse(@ForApplication Context context) { return new ApiParse(context); } @Provides @Singleton @Named("MapKeysCache") Cache provideApiParse() { return new MapKeysCache(); } @Provides RestAdapter provideRestAdapter() { return new RestAdapter.Builder() .setServer(ApiRest.DOMAIN) .build(); } @Provides UserDataSource provideUserDataSource(@Named("ApiRest") Api api) { return new UserDataSourceImp(api); } @Provides
LikeDataSource provideLikeDataSource(LikeDataSourceParse likeDataSource) {
flipper83/protohipster
protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/LoggerProvider.java
// Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/interfaces/Logger.java // public interface Logger { // // void v(String tag, String msg); // // void v(String tag, String msg, Throwable tr); // // void d(String tag, String msg); // // void d(String tag, String msg, boolean report); // // void d(String tag, String msg, Throwable tr); // // void d(String tag, String msg, Throwable tr, boolean report); // // void i(String tag, String msg); // // void i(String tag, String msg, boolean report); // // void i(String tag, String msg, Throwable tr); // // void i(String tag, String msg, Throwable tr, boolean report); // // void e(String tag, String msg); // // void e(String tag, String msg, boolean report); // // void e(String tag, String msg, Throwable tr); // // void e(String tag, String msg, Throwable tr, boolean report); // // void w(String tag, String msg); // // void w(String tag, String msg, boolean report); // // void r(String tag, String msg); // // void r(String tag, String msg, Throwable tr); // // // Performance recording // void p(String tag, long time); // // void p(String tag, String msg, long time); // // void pt(String tag, String msg, long time); // // void tr(String tag, String msg); // // String getCalledFrom(); // // boolean isDebugEnabled(); // // boolean isVerboseEnabled(); // // boolean isInfoEnabled(); // // boolean isErrorEnabled(); // // String getCallStack(); // }
import com.flipper83.protohipster.globalutils.interfaces.Logger; import javax.inject.Inject;
package com.flipper83.protohipster.globalutils.module; public class LoggerProvider { @Inject
// Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/interfaces/Logger.java // public interface Logger { // // void v(String tag, String msg); // // void v(String tag, String msg, Throwable tr); // // void d(String tag, String msg); // // void d(String tag, String msg, boolean report); // // void d(String tag, String msg, Throwable tr); // // void d(String tag, String msg, Throwable tr, boolean report); // // void i(String tag, String msg); // // void i(String tag, String msg, boolean report); // // void i(String tag, String msg, Throwable tr); // // void i(String tag, String msg, Throwable tr, boolean report); // // void e(String tag, String msg); // // void e(String tag, String msg, boolean report); // // void e(String tag, String msg, Throwable tr); // // void e(String tag, String msg, Throwable tr, boolean report); // // void w(String tag, String msg); // // void w(String tag, String msg, boolean report); // // void r(String tag, String msg); // // void r(String tag, String msg, Throwable tr); // // // Performance recording // void p(String tag, long time); // // void p(String tag, String msg, long time); // // void pt(String tag, String msg, long time); // // void tr(String tag, String msg); // // String getCalledFrom(); // // boolean isDebugEnabled(); // // boolean isVerboseEnabled(); // // boolean isInfoEnabled(); // // boolean isErrorEnabled(); // // String getCallStack(); // } // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/LoggerProvider.java import com.flipper83.protohipster.globalutils.interfaces.Logger; import javax.inject.Inject; package com.flipper83.protohipster.globalutils.module; public class LoggerProvider { @Inject
static Logger logger;
flipper83/protohipster
protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/call/parse/LikeUserCall.java
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/call/ApiCall.java // public abstract class ApiCall { // // protected ApiResponseCallback responseCallback; // // public ApiCall(ApiResponseCallback responseCallback) { // this.responseCallback = responseCallback; // } // // public abstract void call(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/callback/ApiResponseCallback.java // public interface ApiResponseCallback<T> { // void complete(T response); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/LoggerProvider.java // public class LoggerProvider { // // @Inject // static Logger logger; // // public LoggerProvider() { // // } // // public static Logger getLogger() { // return logger; // } // }
import com.flipper83.protohipster.feed.datasource.api.call.ApiCall; import com.flipper83.protohipster.feed.datasource.api.callback.ApiResponseCallback; import com.flipper83.protohipster.globalutils.module.LoggerProvider; import com.parse.FindCallback; import com.parse.ParseException; import com.parse.ParseObject; import com.parse.ParseQuery; import java.util.List;
package com.flipper83.protohipster.feed.datasource.api.call.parse; /** * Like a user api call */ public class LikeUserCall extends ApiCall { private static final String LOGTAG = "LikeUserCall"; private final String userId;
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/call/ApiCall.java // public abstract class ApiCall { // // protected ApiResponseCallback responseCallback; // // public ApiCall(ApiResponseCallback responseCallback) { // this.responseCallback = responseCallback; // } // // public abstract void call(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/callback/ApiResponseCallback.java // public interface ApiResponseCallback<T> { // void complete(T response); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/LoggerProvider.java // public class LoggerProvider { // // @Inject // static Logger logger; // // public LoggerProvider() { // // } // // public static Logger getLogger() { // return logger; // } // } // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/call/parse/LikeUserCall.java import com.flipper83.protohipster.feed.datasource.api.call.ApiCall; import com.flipper83.protohipster.feed.datasource.api.callback.ApiResponseCallback; import com.flipper83.protohipster.globalutils.module.LoggerProvider; import com.parse.FindCallback; import com.parse.ParseException; import com.parse.ParseObject; import com.parse.ParseQuery; import java.util.List; package com.flipper83.protohipster.feed.datasource.api.call.parse; /** * Like a user api call */ public class LikeUserCall extends ApiCall { private static final String LOGTAG = "LikeUserCall"; private final String userId;
public LikeUserCall(String userId, ApiResponseCallback<String> responseCallback) {
flipper83/protohipster
protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/call/parse/LikeUserCall.java
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/call/ApiCall.java // public abstract class ApiCall { // // protected ApiResponseCallback responseCallback; // // public ApiCall(ApiResponseCallback responseCallback) { // this.responseCallback = responseCallback; // } // // public abstract void call(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/callback/ApiResponseCallback.java // public interface ApiResponseCallback<T> { // void complete(T response); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/LoggerProvider.java // public class LoggerProvider { // // @Inject // static Logger logger; // // public LoggerProvider() { // // } // // public static Logger getLogger() { // return logger; // } // }
import com.flipper83.protohipster.feed.datasource.api.call.ApiCall; import com.flipper83.protohipster.feed.datasource.api.callback.ApiResponseCallback; import com.flipper83.protohipster.globalutils.module.LoggerProvider; import com.parse.FindCallback; import com.parse.ParseException; import com.parse.ParseObject; import com.parse.ParseQuery; import java.util.List;
package com.flipper83.protohipster.feed.datasource.api.call.parse; /** * Like a user api call */ public class LikeUserCall extends ApiCall { private static final String LOGTAG = "LikeUserCall"; private final String userId; public LikeUserCall(String userId, ApiResponseCallback<String> responseCallback) { super(responseCallback); this.userId = userId; } @Override public void call() { ParseQuery<ParseObject> query = ParseQuery.getQuery(ParseLikeTableDefinitions.PARSE_LIKE_TABLE); query.whereEqualTo(ParseLikeTableDefinitions.PARSE_LIKE_USER_ID, userId); query.findInBackground(new FindCallback<ParseObject>() { @Override public void done(List<ParseObject> parseLikes, ParseException e) { if (e == null) { if(parseLikes.size() > 0){ ParseObject likeObject = parseLikes.get(0); likeObject.increment(ParseLikeTableDefinitions.PARSE_LIKE_NUM_LIKES); likeObject.saveInBackground(); } responseCallback.complete(userId); } else {
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/call/ApiCall.java // public abstract class ApiCall { // // protected ApiResponseCallback responseCallback; // // public ApiCall(ApiResponseCallback responseCallback) { // this.responseCallback = responseCallback; // } // // public abstract void call(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/callback/ApiResponseCallback.java // public interface ApiResponseCallback<T> { // void complete(T response); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/LoggerProvider.java // public class LoggerProvider { // // @Inject // static Logger logger; // // public LoggerProvider() { // // } // // public static Logger getLogger() { // return logger; // } // } // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/call/parse/LikeUserCall.java import com.flipper83.protohipster.feed.datasource.api.call.ApiCall; import com.flipper83.protohipster.feed.datasource.api.callback.ApiResponseCallback; import com.flipper83.protohipster.globalutils.module.LoggerProvider; import com.parse.FindCallback; import com.parse.ParseException; import com.parse.ParseObject; import com.parse.ParseQuery; import java.util.List; package com.flipper83.protohipster.feed.datasource.api.call.parse; /** * Like a user api call */ public class LikeUserCall extends ApiCall { private static final String LOGTAG = "LikeUserCall"; private final String userId; public LikeUserCall(String userId, ApiResponseCallback<String> responseCallback) { super(responseCallback); this.userId = userId; } @Override public void call() { ParseQuery<ParseObject> query = ParseQuery.getQuery(ParseLikeTableDefinitions.PARSE_LIKE_TABLE); query.whereEqualTo(ParseLikeTableDefinitions.PARSE_LIKE_USER_ID, userId); query.findInBackground(new FindCallback<ParseObject>() { @Override public void done(List<ParseObject> parseLikes, ParseException e) { if (e == null) { if(parseLikes.size() > 0){ ParseObject likeObject = parseLikes.get(0); likeObject.increment(ParseLikeTableDefinitions.PARSE_LIKE_NUM_LIKES); likeObject.saveInBackground(); } responseCallback.complete(userId); } else {
LoggerProvider.getLogger().d(LOGTAG, "Error retrying info from parse");
flipper83/protohipster
protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/GlobalModule.java
// Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/interfaces/Logger.java // public interface Logger { // // void v(String tag, String msg); // // void v(String tag, String msg, Throwable tr); // // void d(String tag, String msg); // // void d(String tag, String msg, boolean report); // // void d(String tag, String msg, Throwable tr); // // void d(String tag, String msg, Throwable tr, boolean report); // // void i(String tag, String msg); // // void i(String tag, String msg, boolean report); // // void i(String tag, String msg, Throwable tr); // // void i(String tag, String msg, Throwable tr, boolean report); // // void e(String tag, String msg); // // void e(String tag, String msg, boolean report); // // void e(String tag, String msg, Throwable tr); // // void e(String tag, String msg, Throwable tr, boolean report); // // void w(String tag, String msg); // // void w(String tag, String msg, boolean report); // // void r(String tag, String msg); // // void r(String tag, String msg, Throwable tr); // // // Performance recording // void p(String tag, long time); // // void p(String tag, String msg, long time); // // void pt(String tag, String msg, long time); // // void tr(String tag, String msg); // // String getCalledFrom(); // // boolean isDebugEnabled(); // // boolean isVerboseEnabled(); // // boolean isInfoEnabled(); // // boolean isErrorEnabled(); // // String getCallStack(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/view/ui/ProtoActivity.java // public class ProtoActivity extends BaseActivity { // // @Override // protected void onCreate(Bundle savedInstanceState) { // super.onCreate(savedInstanceState); // setContentView(R.layout.screen_proto_list); // // if (savedInstanceState == null) { // getSupportFragmentManager().beginTransaction() // .add(android.R.id.content, new HipsterListFragment()) // .commit(); // } // } // // // @Override // public boolean onCreateOptionsMenu(Menu menu) { // // // Inflate the menu; this adds items to the action bar if it is present. // getMenuInflater().inflate(R.menu.proto, menu); // return true; // } // // @Override // public boolean onOptionsItemSelected(MenuItem item) { // // Handle action bar item clicks here. The action bar will // // automatically handle clicks on the Home/Up button, so long // // as you specify a parent activity in AndroidManifest.xml. // switch (item.getItemId()) { // case R.id.action_settings: // return true; // } // return super.onOptionsItemSelected(item); // } // // // }
import com.flipper83.protohipster.globalutils.interfaces.Logger; import com.flipper83.protohipster.feed.view.ui.ProtoActivity; import dagger.Module; import dagger.Provides;
package com.flipper83.protohipster.globalutils.module; @Module(injects = {ProtoActivity.class}, staticInjections = {LoggerProvider.class}, complete = false) public class GlobalModule { @Provides
// Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/interfaces/Logger.java // public interface Logger { // // void v(String tag, String msg); // // void v(String tag, String msg, Throwable tr); // // void d(String tag, String msg); // // void d(String tag, String msg, boolean report); // // void d(String tag, String msg, Throwable tr); // // void d(String tag, String msg, Throwable tr, boolean report); // // void i(String tag, String msg); // // void i(String tag, String msg, boolean report); // // void i(String tag, String msg, Throwable tr); // // void i(String tag, String msg, Throwable tr, boolean report); // // void e(String tag, String msg); // // void e(String tag, String msg, boolean report); // // void e(String tag, String msg, Throwable tr); // // void e(String tag, String msg, Throwable tr, boolean report); // // void w(String tag, String msg); // // void w(String tag, String msg, boolean report); // // void r(String tag, String msg); // // void r(String tag, String msg, Throwable tr); // // // Performance recording // void p(String tag, long time); // // void p(String tag, String msg, long time); // // void pt(String tag, String msg, long time); // // void tr(String tag, String msg); // // String getCalledFrom(); // // boolean isDebugEnabled(); // // boolean isVerboseEnabled(); // // boolean isInfoEnabled(); // // boolean isErrorEnabled(); // // String getCallStack(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/view/ui/ProtoActivity.java // public class ProtoActivity extends BaseActivity { // // @Override // protected void onCreate(Bundle savedInstanceState) { // super.onCreate(savedInstanceState); // setContentView(R.layout.screen_proto_list); // // if (savedInstanceState == null) { // getSupportFragmentManager().beginTransaction() // .add(android.R.id.content, new HipsterListFragment()) // .commit(); // } // } // // // @Override // public boolean onCreateOptionsMenu(Menu menu) { // // // Inflate the menu; this adds items to the action bar if it is present. // getMenuInflater().inflate(R.menu.proto, menu); // return true; // } // // @Override // public boolean onOptionsItemSelected(MenuItem item) { // // Handle action bar item clicks here. The action bar will // // automatically handle clicks on the Home/Up button, so long // // as you specify a parent activity in AndroidManifest.xml. // switch (item.getItemId()) { // case R.id.action_settings: // return true; // } // return super.onOptionsItemSelected(item); // } // // // } // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/GlobalModule.java import com.flipper83.protohipster.globalutils.interfaces.Logger; import com.flipper83.protohipster.feed.view.ui.ProtoActivity; import dagger.Module; import dagger.Provides; package com.flipper83.protohipster.globalutils.module; @Module(injects = {ProtoActivity.class}, staticInjections = {LoggerProvider.class}, complete = false) public class GlobalModule { @Provides
Logger provideLogger() {
flipper83/protohipster
protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/call/rest/request/GetFeedRequest.java
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/call/rest/GetFeedCall.java // public class GetFeedCall extends ApiRestCall implements Callback<GetFeedResponse> { // private static final int MAX_USERS = 5; // private static final String LOGTAG = "GetFeedCall"; // private List<UserApiEntry> responseBuffer = new ArrayList<UserApiEntry>(); // private GetFeedRequest request; // private int page; // // public GetFeedCall(ApiResponseCallback<List<UserApiEntry>> apiResponseCallback) { // super(apiResponseCallback); // } // // @Override // public void call(RestAdapter restAdapter) { // page = 0; // responseBuffer.clear(); // // request = restAdapter.create(GetFeedRequest.class); // request.getRandomUsers(MAX_USERS, page, this); // } // // @Override // public void success(GetFeedResponse apiUsers, Response response) { // responseBuffer.addAll(apiUsers.getResults()); // if (responseBuffer.size() >= MAX_USERS) { // super.responseCallback.complete(responseBuffer); // } else { // page++; // request.getRandomUsers(MAX_USERS, page, this); // } // } // // @Override // public void failure(RetrofitError retrofitError) { // //TODO notify api error. // LoggerProvider.getLogger().d(LOGTAG, "an error happens " + retrofitError.getBody()); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/call/rest/response/GetFeedResponse.java // public class GetFeedResponse { // private List<UserApiEntry> results; // // public List<UserApiEntry> getResults() { // return results; // } // }
import com.flipper83.protohipster.feed.datasource.api.call.rest.GetFeedCall; import com.flipper83.protohipster.feed.datasource.api.call.rest.response.GetFeedResponse; import retrofit.http.GET; import retrofit.http.Query; import retrofit.Callback;
package com.flipper83.protohipster.feed.datasource.api.call.rest.request; /** * The request for the feed */ public interface GetFeedRequest { public final static String SEED_HIPSTER = "hipster"; /** * randomUser.me don't have page suppont, and the limit in one all is 5 users. I'm going to * simulate the page system with the seed param. */ @GET("/") void getRandomUsers(@Query("results") int maxUsers,@Query("seed") int page,
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/call/rest/GetFeedCall.java // public class GetFeedCall extends ApiRestCall implements Callback<GetFeedResponse> { // private static final int MAX_USERS = 5; // private static final String LOGTAG = "GetFeedCall"; // private List<UserApiEntry> responseBuffer = new ArrayList<UserApiEntry>(); // private GetFeedRequest request; // private int page; // // public GetFeedCall(ApiResponseCallback<List<UserApiEntry>> apiResponseCallback) { // super(apiResponseCallback); // } // // @Override // public void call(RestAdapter restAdapter) { // page = 0; // responseBuffer.clear(); // // request = restAdapter.create(GetFeedRequest.class); // request.getRandomUsers(MAX_USERS, page, this); // } // // @Override // public void success(GetFeedResponse apiUsers, Response response) { // responseBuffer.addAll(apiUsers.getResults()); // if (responseBuffer.size() >= MAX_USERS) { // super.responseCallback.complete(responseBuffer); // } else { // page++; // request.getRandomUsers(MAX_USERS, page, this); // } // } // // @Override // public void failure(RetrofitError retrofitError) { // //TODO notify api error. // LoggerProvider.getLogger().d(LOGTAG, "an error happens " + retrofitError.getBody()); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/call/rest/response/GetFeedResponse.java // public class GetFeedResponse { // private List<UserApiEntry> results; // // public List<UserApiEntry> getResults() { // return results; // } // } // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/call/rest/request/GetFeedRequest.java import com.flipper83.protohipster.feed.datasource.api.call.rest.GetFeedCall; import com.flipper83.protohipster.feed.datasource.api.call.rest.response.GetFeedResponse; import retrofit.http.GET; import retrofit.http.Query; import retrofit.Callback; package com.flipper83.protohipster.feed.datasource.api.call.rest.request; /** * The request for the feed */ public interface GetFeedRequest { public final static String SEED_HIPSTER = "hipster"; /** * randomUser.me don't have page suppont, and the limit in one all is 5 users. I'm going to * simulate the page system with the seed param. */ @GET("/") void getRandomUsers(@Query("results") int maxUsers,@Query("seed") int page,
Callback<GetFeedResponse> callback);
flipper83/protohipster
protohipster/src/main/java/com/flipper83/protohipster/uibase/app/ProtoApplication.java
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/DataSourceModule.java // @Module(library = true, // includes = AndroidModule.class) // public class DataSourceModule { // // public DataSourceModule() { // // } // // @Provides // @Singleton // @Named("ApiRest") // Api provideApiRest(ApiRest apiRest) { // return apiRest; // } // // @Provides // @Singleton // @Named("ApiParse") // Api provideApiParse(@ForApplication Context context) { // return new ApiParse(context); // } // // // @Provides // @Singleton // @Named("MapKeysCache") // Cache provideApiParse() { // return new MapKeysCache(); // } // // @Provides // RestAdapter provideRestAdapter() { // return new RestAdapter.Builder() // .setServer(ApiRest.DOMAIN) // .build(); // } // // @Provides // UserDataSource provideUserDataSource(@Named("ApiRest") Api api) { // return new UserDataSourceImp(api); // } // // @Provides // LikeDataSource provideLikeDataSource(LikeDataSourceParse likeDataSource) { // return likeDataSource; // } // // // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/module/DomainModule.java // @Module(complete = false, // library = true) // public class DomainModule { // // @Provides // GetFeed provideFeed(GetFeedImpl feedImp) { // return feedImp; // } // // @Provides // GetMyLikers provideGetMyLikers(GetMyLikersImpl getMyLikersImp){ // return getMyLikersImp; // } // // @Provides // LikeHipster provideLikeHipster(LikeHipsterImp likeHipsterImp){ // return likeHipsterImp; // } // // @Provides // RatingCalculator provideRatingFiveStars(RatingCalculatorFiveStars ratingCalculatorFiveStars) { // return ratingCalculatorFiveStars; // } // // @Provides // HipsterMapper provideHipsterMapperManual(HipsterMapperManual hipsterMapperAuto) { // return hipsterMapperAuto; // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/GlobalModule.java // @Module(injects = {ProtoActivity.class}, staticInjections = {LoggerProvider.class}, complete = false) // public class GlobalModule { // // @Provides // Logger provideLogger() { // return TLog.getLogger(); // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/AndroidModule.java // @Module(library = true) // public class AndroidModule { // private final ProtoApplication application; // // public AndroidModule(ProtoApplication application) { // this.application = application; // } // // /** // * Allow the application context to be injected but require that it be annotated with // * {@link ForApplication @Annotation} to explicitly differentiate it from an activity context. // */ // @Provides // @Singleton // @ForApplication // Context provideApplicationContext() { // return application; // } // // @Provides // @Singleton // LocationManager provideLocationManager() { // return (LocationManager) application.getSystemService(LOCATION_SERVICE); // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/view/module/FeedViewModule.java // @Module(injects = {ProtoActivity.class, HipsterListFragment.class}, // complete = false, // library = true) // public class FeedViewModule { // // @Provides // FeedProvider provideFeedProvider(FeedViewModel viewModel) { // return new FeedProvider(viewModel); // } // // @Provides // FeedViewModel provideFeedViewModel(GetFeed getFeed,GetMyLikers getMyLikers, // LikeHipster likeHipster, HipsterViewMapper mapper) { // return new FeedViewModel(getFeed,getMyLikers,likeHipster,mapper); // } // // @Provides // @Singleton // Picasso providePicasso(@ForApplication Context context) { // return Picasso.with(context); // } // // @Provides // TransformationBuilder provideTransformationBuilder(TransformationBuilderPicasso // transformationBuilderPicasso) { // return transformationBuilderPicasso; // } // // @Provides // HipsterViewMapper provideHipsterViewMapperManual(HipsterViewMapperManual hipsterViewMapperManual) { // return hipsterViewMapperManual; // } // }
import android.app.Application; import com.flipper83.protohipster.feed.datasource.module.DataSourceModule; import com.flipper83.protohipster.feed.domain.module.DomainModule; import com.flipper83.protohipster.globalutils.module.GlobalModule; import com.flipper83.protohipster.globalutils.module.AndroidModule; import com.flipper83.protohipster.feed.view.module.FeedViewModule; import java.util.Arrays; import java.util.List; import dagger.ObjectGraph;
package com.flipper83.protohipster.uibase.app; /** * Application called on Android Manifest */ public class ProtoApplication extends Application{ private ObjectGraph graph; @Override public void onCreate() { super.onCreate(); graph = ObjectGraph.create(getModules().toArray()); graph.injectStatics(); } protected List<Object> getModules() {
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/DataSourceModule.java // @Module(library = true, // includes = AndroidModule.class) // public class DataSourceModule { // // public DataSourceModule() { // // } // // @Provides // @Singleton // @Named("ApiRest") // Api provideApiRest(ApiRest apiRest) { // return apiRest; // } // // @Provides // @Singleton // @Named("ApiParse") // Api provideApiParse(@ForApplication Context context) { // return new ApiParse(context); // } // // // @Provides // @Singleton // @Named("MapKeysCache") // Cache provideApiParse() { // return new MapKeysCache(); // } // // @Provides // RestAdapter provideRestAdapter() { // return new RestAdapter.Builder() // .setServer(ApiRest.DOMAIN) // .build(); // } // // @Provides // UserDataSource provideUserDataSource(@Named("ApiRest") Api api) { // return new UserDataSourceImp(api); // } // // @Provides // LikeDataSource provideLikeDataSource(LikeDataSourceParse likeDataSource) { // return likeDataSource; // } // // // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/module/DomainModule.java // @Module(complete = false, // library = true) // public class DomainModule { // // @Provides // GetFeed provideFeed(GetFeedImpl feedImp) { // return feedImp; // } // // @Provides // GetMyLikers provideGetMyLikers(GetMyLikersImpl getMyLikersImp){ // return getMyLikersImp; // } // // @Provides // LikeHipster provideLikeHipster(LikeHipsterImp likeHipsterImp){ // return likeHipsterImp; // } // // @Provides // RatingCalculator provideRatingFiveStars(RatingCalculatorFiveStars ratingCalculatorFiveStars) { // return ratingCalculatorFiveStars; // } // // @Provides // HipsterMapper provideHipsterMapperManual(HipsterMapperManual hipsterMapperAuto) { // return hipsterMapperAuto; // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/GlobalModule.java // @Module(injects = {ProtoActivity.class}, staticInjections = {LoggerProvider.class}, complete = false) // public class GlobalModule { // // @Provides // Logger provideLogger() { // return TLog.getLogger(); // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/AndroidModule.java // @Module(library = true) // public class AndroidModule { // private final ProtoApplication application; // // public AndroidModule(ProtoApplication application) { // this.application = application; // } // // /** // * Allow the application context to be injected but require that it be annotated with // * {@link ForApplication @Annotation} to explicitly differentiate it from an activity context. // */ // @Provides // @Singleton // @ForApplication // Context provideApplicationContext() { // return application; // } // // @Provides // @Singleton // LocationManager provideLocationManager() { // return (LocationManager) application.getSystemService(LOCATION_SERVICE); // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/view/module/FeedViewModule.java // @Module(injects = {ProtoActivity.class, HipsterListFragment.class}, // complete = false, // library = true) // public class FeedViewModule { // // @Provides // FeedProvider provideFeedProvider(FeedViewModel viewModel) { // return new FeedProvider(viewModel); // } // // @Provides // FeedViewModel provideFeedViewModel(GetFeed getFeed,GetMyLikers getMyLikers, // LikeHipster likeHipster, HipsterViewMapper mapper) { // return new FeedViewModel(getFeed,getMyLikers,likeHipster,mapper); // } // // @Provides // @Singleton // Picasso providePicasso(@ForApplication Context context) { // return Picasso.with(context); // } // // @Provides // TransformationBuilder provideTransformationBuilder(TransformationBuilderPicasso // transformationBuilderPicasso) { // return transformationBuilderPicasso; // } // // @Provides // HipsterViewMapper provideHipsterViewMapperManual(HipsterViewMapperManual hipsterViewMapperManual) { // return hipsterViewMapperManual; // } // } // Path: protohipster/src/main/java/com/flipper83/protohipster/uibase/app/ProtoApplication.java import android.app.Application; import com.flipper83.protohipster.feed.datasource.module.DataSourceModule; import com.flipper83.protohipster.feed.domain.module.DomainModule; import com.flipper83.protohipster.globalutils.module.GlobalModule; import com.flipper83.protohipster.globalutils.module.AndroidModule; import com.flipper83.protohipster.feed.view.module.FeedViewModule; import java.util.Arrays; import java.util.List; import dagger.ObjectGraph; package com.flipper83.protohipster.uibase.app; /** * Application called on Android Manifest */ public class ProtoApplication extends Application{ private ObjectGraph graph; @Override public void onCreate() { super.onCreate(); graph = ObjectGraph.create(getModules().toArray()); graph.injectStatics(); } protected List<Object> getModules() {
return Arrays.asList(new AndroidModule(this),new GlobalModule(), new DomainModule(),new FeedViewModule(),new DataSourceModule());
flipper83/protohipster
protohipster/src/main/java/com/flipper83/protohipster/uibase/app/ProtoApplication.java
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/DataSourceModule.java // @Module(library = true, // includes = AndroidModule.class) // public class DataSourceModule { // // public DataSourceModule() { // // } // // @Provides // @Singleton // @Named("ApiRest") // Api provideApiRest(ApiRest apiRest) { // return apiRest; // } // // @Provides // @Singleton // @Named("ApiParse") // Api provideApiParse(@ForApplication Context context) { // return new ApiParse(context); // } // // // @Provides // @Singleton // @Named("MapKeysCache") // Cache provideApiParse() { // return new MapKeysCache(); // } // // @Provides // RestAdapter provideRestAdapter() { // return new RestAdapter.Builder() // .setServer(ApiRest.DOMAIN) // .build(); // } // // @Provides // UserDataSource provideUserDataSource(@Named("ApiRest") Api api) { // return new UserDataSourceImp(api); // } // // @Provides // LikeDataSource provideLikeDataSource(LikeDataSourceParse likeDataSource) { // return likeDataSource; // } // // // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/module/DomainModule.java // @Module(complete = false, // library = true) // public class DomainModule { // // @Provides // GetFeed provideFeed(GetFeedImpl feedImp) { // return feedImp; // } // // @Provides // GetMyLikers provideGetMyLikers(GetMyLikersImpl getMyLikersImp){ // return getMyLikersImp; // } // // @Provides // LikeHipster provideLikeHipster(LikeHipsterImp likeHipsterImp){ // return likeHipsterImp; // } // // @Provides // RatingCalculator provideRatingFiveStars(RatingCalculatorFiveStars ratingCalculatorFiveStars) { // return ratingCalculatorFiveStars; // } // // @Provides // HipsterMapper provideHipsterMapperManual(HipsterMapperManual hipsterMapperAuto) { // return hipsterMapperAuto; // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/GlobalModule.java // @Module(injects = {ProtoActivity.class}, staticInjections = {LoggerProvider.class}, complete = false) // public class GlobalModule { // // @Provides // Logger provideLogger() { // return TLog.getLogger(); // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/AndroidModule.java // @Module(library = true) // public class AndroidModule { // private final ProtoApplication application; // // public AndroidModule(ProtoApplication application) { // this.application = application; // } // // /** // * Allow the application context to be injected but require that it be annotated with // * {@link ForApplication @Annotation} to explicitly differentiate it from an activity context. // */ // @Provides // @Singleton // @ForApplication // Context provideApplicationContext() { // return application; // } // // @Provides // @Singleton // LocationManager provideLocationManager() { // return (LocationManager) application.getSystemService(LOCATION_SERVICE); // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/view/module/FeedViewModule.java // @Module(injects = {ProtoActivity.class, HipsterListFragment.class}, // complete = false, // library = true) // public class FeedViewModule { // // @Provides // FeedProvider provideFeedProvider(FeedViewModel viewModel) { // return new FeedProvider(viewModel); // } // // @Provides // FeedViewModel provideFeedViewModel(GetFeed getFeed,GetMyLikers getMyLikers, // LikeHipster likeHipster, HipsterViewMapper mapper) { // return new FeedViewModel(getFeed,getMyLikers,likeHipster,mapper); // } // // @Provides // @Singleton // Picasso providePicasso(@ForApplication Context context) { // return Picasso.with(context); // } // // @Provides // TransformationBuilder provideTransformationBuilder(TransformationBuilderPicasso // transformationBuilderPicasso) { // return transformationBuilderPicasso; // } // // @Provides // HipsterViewMapper provideHipsterViewMapperManual(HipsterViewMapperManual hipsterViewMapperManual) { // return hipsterViewMapperManual; // } // }
import android.app.Application; import com.flipper83.protohipster.feed.datasource.module.DataSourceModule; import com.flipper83.protohipster.feed.domain.module.DomainModule; import com.flipper83.protohipster.globalutils.module.GlobalModule; import com.flipper83.protohipster.globalutils.module.AndroidModule; import com.flipper83.protohipster.feed.view.module.FeedViewModule; import java.util.Arrays; import java.util.List; import dagger.ObjectGraph;
package com.flipper83.protohipster.uibase.app; /** * Application called on Android Manifest */ public class ProtoApplication extends Application{ private ObjectGraph graph; @Override public void onCreate() { super.onCreate(); graph = ObjectGraph.create(getModules().toArray()); graph.injectStatics(); } protected List<Object> getModules() {
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/DataSourceModule.java // @Module(library = true, // includes = AndroidModule.class) // public class DataSourceModule { // // public DataSourceModule() { // // } // // @Provides // @Singleton // @Named("ApiRest") // Api provideApiRest(ApiRest apiRest) { // return apiRest; // } // // @Provides // @Singleton // @Named("ApiParse") // Api provideApiParse(@ForApplication Context context) { // return new ApiParse(context); // } // // // @Provides // @Singleton // @Named("MapKeysCache") // Cache provideApiParse() { // return new MapKeysCache(); // } // // @Provides // RestAdapter provideRestAdapter() { // return new RestAdapter.Builder() // .setServer(ApiRest.DOMAIN) // .build(); // } // // @Provides // UserDataSource provideUserDataSource(@Named("ApiRest") Api api) { // return new UserDataSourceImp(api); // } // // @Provides // LikeDataSource provideLikeDataSource(LikeDataSourceParse likeDataSource) { // return likeDataSource; // } // // // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/module/DomainModule.java // @Module(complete = false, // library = true) // public class DomainModule { // // @Provides // GetFeed provideFeed(GetFeedImpl feedImp) { // return feedImp; // } // // @Provides // GetMyLikers provideGetMyLikers(GetMyLikersImpl getMyLikersImp){ // return getMyLikersImp; // } // // @Provides // LikeHipster provideLikeHipster(LikeHipsterImp likeHipsterImp){ // return likeHipsterImp; // } // // @Provides // RatingCalculator provideRatingFiveStars(RatingCalculatorFiveStars ratingCalculatorFiveStars) { // return ratingCalculatorFiveStars; // } // // @Provides // HipsterMapper provideHipsterMapperManual(HipsterMapperManual hipsterMapperAuto) { // return hipsterMapperAuto; // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/GlobalModule.java // @Module(injects = {ProtoActivity.class}, staticInjections = {LoggerProvider.class}, complete = false) // public class GlobalModule { // // @Provides // Logger provideLogger() { // return TLog.getLogger(); // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/AndroidModule.java // @Module(library = true) // public class AndroidModule { // private final ProtoApplication application; // // public AndroidModule(ProtoApplication application) { // this.application = application; // } // // /** // * Allow the application context to be injected but require that it be annotated with // * {@link ForApplication @Annotation} to explicitly differentiate it from an activity context. // */ // @Provides // @Singleton // @ForApplication // Context provideApplicationContext() { // return application; // } // // @Provides // @Singleton // LocationManager provideLocationManager() { // return (LocationManager) application.getSystemService(LOCATION_SERVICE); // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/view/module/FeedViewModule.java // @Module(injects = {ProtoActivity.class, HipsterListFragment.class}, // complete = false, // library = true) // public class FeedViewModule { // // @Provides // FeedProvider provideFeedProvider(FeedViewModel viewModel) { // return new FeedProvider(viewModel); // } // // @Provides // FeedViewModel provideFeedViewModel(GetFeed getFeed,GetMyLikers getMyLikers, // LikeHipster likeHipster, HipsterViewMapper mapper) { // return new FeedViewModel(getFeed,getMyLikers,likeHipster,mapper); // } // // @Provides // @Singleton // Picasso providePicasso(@ForApplication Context context) { // return Picasso.with(context); // } // // @Provides // TransformationBuilder provideTransformationBuilder(TransformationBuilderPicasso // transformationBuilderPicasso) { // return transformationBuilderPicasso; // } // // @Provides // HipsterViewMapper provideHipsterViewMapperManual(HipsterViewMapperManual hipsterViewMapperManual) { // return hipsterViewMapperManual; // } // } // Path: protohipster/src/main/java/com/flipper83/protohipster/uibase/app/ProtoApplication.java import android.app.Application; import com.flipper83.protohipster.feed.datasource.module.DataSourceModule; import com.flipper83.protohipster.feed.domain.module.DomainModule; import com.flipper83.protohipster.globalutils.module.GlobalModule; import com.flipper83.protohipster.globalutils.module.AndroidModule; import com.flipper83.protohipster.feed.view.module.FeedViewModule; import java.util.Arrays; import java.util.List; import dagger.ObjectGraph; package com.flipper83.protohipster.uibase.app; /** * Application called on Android Manifest */ public class ProtoApplication extends Application{ private ObjectGraph graph; @Override public void onCreate() { super.onCreate(); graph = ObjectGraph.create(getModules().toArray()); graph.injectStatics(); } protected List<Object> getModules() {
return Arrays.asList(new AndroidModule(this),new GlobalModule(), new DomainModule(),new FeedViewModule(),new DataSourceModule());
flipper83/protohipster
protohipster/src/main/java/com/flipper83/protohipster/uibase/app/ProtoApplication.java
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/DataSourceModule.java // @Module(library = true, // includes = AndroidModule.class) // public class DataSourceModule { // // public DataSourceModule() { // // } // // @Provides // @Singleton // @Named("ApiRest") // Api provideApiRest(ApiRest apiRest) { // return apiRest; // } // // @Provides // @Singleton // @Named("ApiParse") // Api provideApiParse(@ForApplication Context context) { // return new ApiParse(context); // } // // // @Provides // @Singleton // @Named("MapKeysCache") // Cache provideApiParse() { // return new MapKeysCache(); // } // // @Provides // RestAdapter provideRestAdapter() { // return new RestAdapter.Builder() // .setServer(ApiRest.DOMAIN) // .build(); // } // // @Provides // UserDataSource provideUserDataSource(@Named("ApiRest") Api api) { // return new UserDataSourceImp(api); // } // // @Provides // LikeDataSource provideLikeDataSource(LikeDataSourceParse likeDataSource) { // return likeDataSource; // } // // // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/module/DomainModule.java // @Module(complete = false, // library = true) // public class DomainModule { // // @Provides // GetFeed provideFeed(GetFeedImpl feedImp) { // return feedImp; // } // // @Provides // GetMyLikers provideGetMyLikers(GetMyLikersImpl getMyLikersImp){ // return getMyLikersImp; // } // // @Provides // LikeHipster provideLikeHipster(LikeHipsterImp likeHipsterImp){ // return likeHipsterImp; // } // // @Provides // RatingCalculator provideRatingFiveStars(RatingCalculatorFiveStars ratingCalculatorFiveStars) { // return ratingCalculatorFiveStars; // } // // @Provides // HipsterMapper provideHipsterMapperManual(HipsterMapperManual hipsterMapperAuto) { // return hipsterMapperAuto; // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/GlobalModule.java // @Module(injects = {ProtoActivity.class}, staticInjections = {LoggerProvider.class}, complete = false) // public class GlobalModule { // // @Provides // Logger provideLogger() { // return TLog.getLogger(); // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/AndroidModule.java // @Module(library = true) // public class AndroidModule { // private final ProtoApplication application; // // public AndroidModule(ProtoApplication application) { // this.application = application; // } // // /** // * Allow the application context to be injected but require that it be annotated with // * {@link ForApplication @Annotation} to explicitly differentiate it from an activity context. // */ // @Provides // @Singleton // @ForApplication // Context provideApplicationContext() { // return application; // } // // @Provides // @Singleton // LocationManager provideLocationManager() { // return (LocationManager) application.getSystemService(LOCATION_SERVICE); // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/view/module/FeedViewModule.java // @Module(injects = {ProtoActivity.class, HipsterListFragment.class}, // complete = false, // library = true) // public class FeedViewModule { // // @Provides // FeedProvider provideFeedProvider(FeedViewModel viewModel) { // return new FeedProvider(viewModel); // } // // @Provides // FeedViewModel provideFeedViewModel(GetFeed getFeed,GetMyLikers getMyLikers, // LikeHipster likeHipster, HipsterViewMapper mapper) { // return new FeedViewModel(getFeed,getMyLikers,likeHipster,mapper); // } // // @Provides // @Singleton // Picasso providePicasso(@ForApplication Context context) { // return Picasso.with(context); // } // // @Provides // TransformationBuilder provideTransformationBuilder(TransformationBuilderPicasso // transformationBuilderPicasso) { // return transformationBuilderPicasso; // } // // @Provides // HipsterViewMapper provideHipsterViewMapperManual(HipsterViewMapperManual hipsterViewMapperManual) { // return hipsterViewMapperManual; // } // }
import android.app.Application; import com.flipper83.protohipster.feed.datasource.module.DataSourceModule; import com.flipper83.protohipster.feed.domain.module.DomainModule; import com.flipper83.protohipster.globalutils.module.GlobalModule; import com.flipper83.protohipster.globalutils.module.AndroidModule; import com.flipper83.protohipster.feed.view.module.FeedViewModule; import java.util.Arrays; import java.util.List; import dagger.ObjectGraph;
package com.flipper83.protohipster.uibase.app; /** * Application called on Android Manifest */ public class ProtoApplication extends Application{ private ObjectGraph graph; @Override public void onCreate() { super.onCreate(); graph = ObjectGraph.create(getModules().toArray()); graph.injectStatics(); } protected List<Object> getModules() {
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/DataSourceModule.java // @Module(library = true, // includes = AndroidModule.class) // public class DataSourceModule { // // public DataSourceModule() { // // } // // @Provides // @Singleton // @Named("ApiRest") // Api provideApiRest(ApiRest apiRest) { // return apiRest; // } // // @Provides // @Singleton // @Named("ApiParse") // Api provideApiParse(@ForApplication Context context) { // return new ApiParse(context); // } // // // @Provides // @Singleton // @Named("MapKeysCache") // Cache provideApiParse() { // return new MapKeysCache(); // } // // @Provides // RestAdapter provideRestAdapter() { // return new RestAdapter.Builder() // .setServer(ApiRest.DOMAIN) // .build(); // } // // @Provides // UserDataSource provideUserDataSource(@Named("ApiRest") Api api) { // return new UserDataSourceImp(api); // } // // @Provides // LikeDataSource provideLikeDataSource(LikeDataSourceParse likeDataSource) { // return likeDataSource; // } // // // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/module/DomainModule.java // @Module(complete = false, // library = true) // public class DomainModule { // // @Provides // GetFeed provideFeed(GetFeedImpl feedImp) { // return feedImp; // } // // @Provides // GetMyLikers provideGetMyLikers(GetMyLikersImpl getMyLikersImp){ // return getMyLikersImp; // } // // @Provides // LikeHipster provideLikeHipster(LikeHipsterImp likeHipsterImp){ // return likeHipsterImp; // } // // @Provides // RatingCalculator provideRatingFiveStars(RatingCalculatorFiveStars ratingCalculatorFiveStars) { // return ratingCalculatorFiveStars; // } // // @Provides // HipsterMapper provideHipsterMapperManual(HipsterMapperManual hipsterMapperAuto) { // return hipsterMapperAuto; // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/GlobalModule.java // @Module(injects = {ProtoActivity.class}, staticInjections = {LoggerProvider.class}, complete = false) // public class GlobalModule { // // @Provides // Logger provideLogger() { // return TLog.getLogger(); // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/AndroidModule.java // @Module(library = true) // public class AndroidModule { // private final ProtoApplication application; // // public AndroidModule(ProtoApplication application) { // this.application = application; // } // // /** // * Allow the application context to be injected but require that it be annotated with // * {@link ForApplication @Annotation} to explicitly differentiate it from an activity context. // */ // @Provides // @Singleton // @ForApplication // Context provideApplicationContext() { // return application; // } // // @Provides // @Singleton // LocationManager provideLocationManager() { // return (LocationManager) application.getSystemService(LOCATION_SERVICE); // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/view/module/FeedViewModule.java // @Module(injects = {ProtoActivity.class, HipsterListFragment.class}, // complete = false, // library = true) // public class FeedViewModule { // // @Provides // FeedProvider provideFeedProvider(FeedViewModel viewModel) { // return new FeedProvider(viewModel); // } // // @Provides // FeedViewModel provideFeedViewModel(GetFeed getFeed,GetMyLikers getMyLikers, // LikeHipster likeHipster, HipsterViewMapper mapper) { // return new FeedViewModel(getFeed,getMyLikers,likeHipster,mapper); // } // // @Provides // @Singleton // Picasso providePicasso(@ForApplication Context context) { // return Picasso.with(context); // } // // @Provides // TransformationBuilder provideTransformationBuilder(TransformationBuilderPicasso // transformationBuilderPicasso) { // return transformationBuilderPicasso; // } // // @Provides // HipsterViewMapper provideHipsterViewMapperManual(HipsterViewMapperManual hipsterViewMapperManual) { // return hipsterViewMapperManual; // } // } // Path: protohipster/src/main/java/com/flipper83/protohipster/uibase/app/ProtoApplication.java import android.app.Application; import com.flipper83.protohipster.feed.datasource.module.DataSourceModule; import com.flipper83.protohipster.feed.domain.module.DomainModule; import com.flipper83.protohipster.globalutils.module.GlobalModule; import com.flipper83.protohipster.globalutils.module.AndroidModule; import com.flipper83.protohipster.feed.view.module.FeedViewModule; import java.util.Arrays; import java.util.List; import dagger.ObjectGraph; package com.flipper83.protohipster.uibase.app; /** * Application called on Android Manifest */ public class ProtoApplication extends Application{ private ObjectGraph graph; @Override public void onCreate() { super.onCreate(); graph = ObjectGraph.create(getModules().toArray()); graph.injectStatics(); } protected List<Object> getModules() {
return Arrays.asList(new AndroidModule(this),new GlobalModule(), new DomainModule(),new FeedViewModule(),new DataSourceModule());
flipper83/protohipster
protohipster/src/main/java/com/flipper83/protohipster/uibase/app/ProtoApplication.java
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/DataSourceModule.java // @Module(library = true, // includes = AndroidModule.class) // public class DataSourceModule { // // public DataSourceModule() { // // } // // @Provides // @Singleton // @Named("ApiRest") // Api provideApiRest(ApiRest apiRest) { // return apiRest; // } // // @Provides // @Singleton // @Named("ApiParse") // Api provideApiParse(@ForApplication Context context) { // return new ApiParse(context); // } // // // @Provides // @Singleton // @Named("MapKeysCache") // Cache provideApiParse() { // return new MapKeysCache(); // } // // @Provides // RestAdapter provideRestAdapter() { // return new RestAdapter.Builder() // .setServer(ApiRest.DOMAIN) // .build(); // } // // @Provides // UserDataSource provideUserDataSource(@Named("ApiRest") Api api) { // return new UserDataSourceImp(api); // } // // @Provides // LikeDataSource provideLikeDataSource(LikeDataSourceParse likeDataSource) { // return likeDataSource; // } // // // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/module/DomainModule.java // @Module(complete = false, // library = true) // public class DomainModule { // // @Provides // GetFeed provideFeed(GetFeedImpl feedImp) { // return feedImp; // } // // @Provides // GetMyLikers provideGetMyLikers(GetMyLikersImpl getMyLikersImp){ // return getMyLikersImp; // } // // @Provides // LikeHipster provideLikeHipster(LikeHipsterImp likeHipsterImp){ // return likeHipsterImp; // } // // @Provides // RatingCalculator provideRatingFiveStars(RatingCalculatorFiveStars ratingCalculatorFiveStars) { // return ratingCalculatorFiveStars; // } // // @Provides // HipsterMapper provideHipsterMapperManual(HipsterMapperManual hipsterMapperAuto) { // return hipsterMapperAuto; // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/GlobalModule.java // @Module(injects = {ProtoActivity.class}, staticInjections = {LoggerProvider.class}, complete = false) // public class GlobalModule { // // @Provides // Logger provideLogger() { // return TLog.getLogger(); // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/AndroidModule.java // @Module(library = true) // public class AndroidModule { // private final ProtoApplication application; // // public AndroidModule(ProtoApplication application) { // this.application = application; // } // // /** // * Allow the application context to be injected but require that it be annotated with // * {@link ForApplication @Annotation} to explicitly differentiate it from an activity context. // */ // @Provides // @Singleton // @ForApplication // Context provideApplicationContext() { // return application; // } // // @Provides // @Singleton // LocationManager provideLocationManager() { // return (LocationManager) application.getSystemService(LOCATION_SERVICE); // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/view/module/FeedViewModule.java // @Module(injects = {ProtoActivity.class, HipsterListFragment.class}, // complete = false, // library = true) // public class FeedViewModule { // // @Provides // FeedProvider provideFeedProvider(FeedViewModel viewModel) { // return new FeedProvider(viewModel); // } // // @Provides // FeedViewModel provideFeedViewModel(GetFeed getFeed,GetMyLikers getMyLikers, // LikeHipster likeHipster, HipsterViewMapper mapper) { // return new FeedViewModel(getFeed,getMyLikers,likeHipster,mapper); // } // // @Provides // @Singleton // Picasso providePicasso(@ForApplication Context context) { // return Picasso.with(context); // } // // @Provides // TransformationBuilder provideTransformationBuilder(TransformationBuilderPicasso // transformationBuilderPicasso) { // return transformationBuilderPicasso; // } // // @Provides // HipsterViewMapper provideHipsterViewMapperManual(HipsterViewMapperManual hipsterViewMapperManual) { // return hipsterViewMapperManual; // } // }
import android.app.Application; import com.flipper83.protohipster.feed.datasource.module.DataSourceModule; import com.flipper83.protohipster.feed.domain.module.DomainModule; import com.flipper83.protohipster.globalutils.module.GlobalModule; import com.flipper83.protohipster.globalutils.module.AndroidModule; import com.flipper83.protohipster.feed.view.module.FeedViewModule; import java.util.Arrays; import java.util.List; import dagger.ObjectGraph;
package com.flipper83.protohipster.uibase.app; /** * Application called on Android Manifest */ public class ProtoApplication extends Application{ private ObjectGraph graph; @Override public void onCreate() { super.onCreate(); graph = ObjectGraph.create(getModules().toArray()); graph.injectStatics(); } protected List<Object> getModules() {
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/DataSourceModule.java // @Module(library = true, // includes = AndroidModule.class) // public class DataSourceModule { // // public DataSourceModule() { // // } // // @Provides // @Singleton // @Named("ApiRest") // Api provideApiRest(ApiRest apiRest) { // return apiRest; // } // // @Provides // @Singleton // @Named("ApiParse") // Api provideApiParse(@ForApplication Context context) { // return new ApiParse(context); // } // // // @Provides // @Singleton // @Named("MapKeysCache") // Cache provideApiParse() { // return new MapKeysCache(); // } // // @Provides // RestAdapter provideRestAdapter() { // return new RestAdapter.Builder() // .setServer(ApiRest.DOMAIN) // .build(); // } // // @Provides // UserDataSource provideUserDataSource(@Named("ApiRest") Api api) { // return new UserDataSourceImp(api); // } // // @Provides // LikeDataSource provideLikeDataSource(LikeDataSourceParse likeDataSource) { // return likeDataSource; // } // // // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/module/DomainModule.java // @Module(complete = false, // library = true) // public class DomainModule { // // @Provides // GetFeed provideFeed(GetFeedImpl feedImp) { // return feedImp; // } // // @Provides // GetMyLikers provideGetMyLikers(GetMyLikersImpl getMyLikersImp){ // return getMyLikersImp; // } // // @Provides // LikeHipster provideLikeHipster(LikeHipsterImp likeHipsterImp){ // return likeHipsterImp; // } // // @Provides // RatingCalculator provideRatingFiveStars(RatingCalculatorFiveStars ratingCalculatorFiveStars) { // return ratingCalculatorFiveStars; // } // // @Provides // HipsterMapper provideHipsterMapperManual(HipsterMapperManual hipsterMapperAuto) { // return hipsterMapperAuto; // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/GlobalModule.java // @Module(injects = {ProtoActivity.class}, staticInjections = {LoggerProvider.class}, complete = false) // public class GlobalModule { // // @Provides // Logger provideLogger() { // return TLog.getLogger(); // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/AndroidModule.java // @Module(library = true) // public class AndroidModule { // private final ProtoApplication application; // // public AndroidModule(ProtoApplication application) { // this.application = application; // } // // /** // * Allow the application context to be injected but require that it be annotated with // * {@link ForApplication @Annotation} to explicitly differentiate it from an activity context. // */ // @Provides // @Singleton // @ForApplication // Context provideApplicationContext() { // return application; // } // // @Provides // @Singleton // LocationManager provideLocationManager() { // return (LocationManager) application.getSystemService(LOCATION_SERVICE); // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/view/module/FeedViewModule.java // @Module(injects = {ProtoActivity.class, HipsterListFragment.class}, // complete = false, // library = true) // public class FeedViewModule { // // @Provides // FeedProvider provideFeedProvider(FeedViewModel viewModel) { // return new FeedProvider(viewModel); // } // // @Provides // FeedViewModel provideFeedViewModel(GetFeed getFeed,GetMyLikers getMyLikers, // LikeHipster likeHipster, HipsterViewMapper mapper) { // return new FeedViewModel(getFeed,getMyLikers,likeHipster,mapper); // } // // @Provides // @Singleton // Picasso providePicasso(@ForApplication Context context) { // return Picasso.with(context); // } // // @Provides // TransformationBuilder provideTransformationBuilder(TransformationBuilderPicasso // transformationBuilderPicasso) { // return transformationBuilderPicasso; // } // // @Provides // HipsterViewMapper provideHipsterViewMapperManual(HipsterViewMapperManual hipsterViewMapperManual) { // return hipsterViewMapperManual; // } // } // Path: protohipster/src/main/java/com/flipper83/protohipster/uibase/app/ProtoApplication.java import android.app.Application; import com.flipper83.protohipster.feed.datasource.module.DataSourceModule; import com.flipper83.protohipster.feed.domain.module.DomainModule; import com.flipper83.protohipster.globalutils.module.GlobalModule; import com.flipper83.protohipster.globalutils.module.AndroidModule; import com.flipper83.protohipster.feed.view.module.FeedViewModule; import java.util.Arrays; import java.util.List; import dagger.ObjectGraph; package com.flipper83.protohipster.uibase.app; /** * Application called on Android Manifest */ public class ProtoApplication extends Application{ private ObjectGraph graph; @Override public void onCreate() { super.onCreate(); graph = ObjectGraph.create(getModules().toArray()); graph.injectStatics(); } protected List<Object> getModules() {
return Arrays.asList(new AndroidModule(this),new GlobalModule(), new DomainModule(),new FeedViewModule(),new DataSourceModule());
flipper83/protohipster
protohipster/src/main/java/com/flipper83/protohipster/uibase/app/ProtoApplication.java
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/DataSourceModule.java // @Module(library = true, // includes = AndroidModule.class) // public class DataSourceModule { // // public DataSourceModule() { // // } // // @Provides // @Singleton // @Named("ApiRest") // Api provideApiRest(ApiRest apiRest) { // return apiRest; // } // // @Provides // @Singleton // @Named("ApiParse") // Api provideApiParse(@ForApplication Context context) { // return new ApiParse(context); // } // // // @Provides // @Singleton // @Named("MapKeysCache") // Cache provideApiParse() { // return new MapKeysCache(); // } // // @Provides // RestAdapter provideRestAdapter() { // return new RestAdapter.Builder() // .setServer(ApiRest.DOMAIN) // .build(); // } // // @Provides // UserDataSource provideUserDataSource(@Named("ApiRest") Api api) { // return new UserDataSourceImp(api); // } // // @Provides // LikeDataSource provideLikeDataSource(LikeDataSourceParse likeDataSource) { // return likeDataSource; // } // // // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/module/DomainModule.java // @Module(complete = false, // library = true) // public class DomainModule { // // @Provides // GetFeed provideFeed(GetFeedImpl feedImp) { // return feedImp; // } // // @Provides // GetMyLikers provideGetMyLikers(GetMyLikersImpl getMyLikersImp){ // return getMyLikersImp; // } // // @Provides // LikeHipster provideLikeHipster(LikeHipsterImp likeHipsterImp){ // return likeHipsterImp; // } // // @Provides // RatingCalculator provideRatingFiveStars(RatingCalculatorFiveStars ratingCalculatorFiveStars) { // return ratingCalculatorFiveStars; // } // // @Provides // HipsterMapper provideHipsterMapperManual(HipsterMapperManual hipsterMapperAuto) { // return hipsterMapperAuto; // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/GlobalModule.java // @Module(injects = {ProtoActivity.class}, staticInjections = {LoggerProvider.class}, complete = false) // public class GlobalModule { // // @Provides // Logger provideLogger() { // return TLog.getLogger(); // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/AndroidModule.java // @Module(library = true) // public class AndroidModule { // private final ProtoApplication application; // // public AndroidModule(ProtoApplication application) { // this.application = application; // } // // /** // * Allow the application context to be injected but require that it be annotated with // * {@link ForApplication @Annotation} to explicitly differentiate it from an activity context. // */ // @Provides // @Singleton // @ForApplication // Context provideApplicationContext() { // return application; // } // // @Provides // @Singleton // LocationManager provideLocationManager() { // return (LocationManager) application.getSystemService(LOCATION_SERVICE); // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/view/module/FeedViewModule.java // @Module(injects = {ProtoActivity.class, HipsterListFragment.class}, // complete = false, // library = true) // public class FeedViewModule { // // @Provides // FeedProvider provideFeedProvider(FeedViewModel viewModel) { // return new FeedProvider(viewModel); // } // // @Provides // FeedViewModel provideFeedViewModel(GetFeed getFeed,GetMyLikers getMyLikers, // LikeHipster likeHipster, HipsterViewMapper mapper) { // return new FeedViewModel(getFeed,getMyLikers,likeHipster,mapper); // } // // @Provides // @Singleton // Picasso providePicasso(@ForApplication Context context) { // return Picasso.with(context); // } // // @Provides // TransformationBuilder provideTransformationBuilder(TransformationBuilderPicasso // transformationBuilderPicasso) { // return transformationBuilderPicasso; // } // // @Provides // HipsterViewMapper provideHipsterViewMapperManual(HipsterViewMapperManual hipsterViewMapperManual) { // return hipsterViewMapperManual; // } // }
import android.app.Application; import com.flipper83.protohipster.feed.datasource.module.DataSourceModule; import com.flipper83.protohipster.feed.domain.module.DomainModule; import com.flipper83.protohipster.globalutils.module.GlobalModule; import com.flipper83.protohipster.globalutils.module.AndroidModule; import com.flipper83.protohipster.feed.view.module.FeedViewModule; import java.util.Arrays; import java.util.List; import dagger.ObjectGraph;
package com.flipper83.protohipster.uibase.app; /** * Application called on Android Manifest */ public class ProtoApplication extends Application{ private ObjectGraph graph; @Override public void onCreate() { super.onCreate(); graph = ObjectGraph.create(getModules().toArray()); graph.injectStatics(); } protected List<Object> getModules() {
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/DataSourceModule.java // @Module(library = true, // includes = AndroidModule.class) // public class DataSourceModule { // // public DataSourceModule() { // // } // // @Provides // @Singleton // @Named("ApiRest") // Api provideApiRest(ApiRest apiRest) { // return apiRest; // } // // @Provides // @Singleton // @Named("ApiParse") // Api provideApiParse(@ForApplication Context context) { // return new ApiParse(context); // } // // // @Provides // @Singleton // @Named("MapKeysCache") // Cache provideApiParse() { // return new MapKeysCache(); // } // // @Provides // RestAdapter provideRestAdapter() { // return new RestAdapter.Builder() // .setServer(ApiRest.DOMAIN) // .build(); // } // // @Provides // UserDataSource provideUserDataSource(@Named("ApiRest") Api api) { // return new UserDataSourceImp(api); // } // // @Provides // LikeDataSource provideLikeDataSource(LikeDataSourceParse likeDataSource) { // return likeDataSource; // } // // // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/module/DomainModule.java // @Module(complete = false, // library = true) // public class DomainModule { // // @Provides // GetFeed provideFeed(GetFeedImpl feedImp) { // return feedImp; // } // // @Provides // GetMyLikers provideGetMyLikers(GetMyLikersImpl getMyLikersImp){ // return getMyLikersImp; // } // // @Provides // LikeHipster provideLikeHipster(LikeHipsterImp likeHipsterImp){ // return likeHipsterImp; // } // // @Provides // RatingCalculator provideRatingFiveStars(RatingCalculatorFiveStars ratingCalculatorFiveStars) { // return ratingCalculatorFiveStars; // } // // @Provides // HipsterMapper provideHipsterMapperManual(HipsterMapperManual hipsterMapperAuto) { // return hipsterMapperAuto; // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/GlobalModule.java // @Module(injects = {ProtoActivity.class}, staticInjections = {LoggerProvider.class}, complete = false) // public class GlobalModule { // // @Provides // Logger provideLogger() { // return TLog.getLogger(); // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/AndroidModule.java // @Module(library = true) // public class AndroidModule { // private final ProtoApplication application; // // public AndroidModule(ProtoApplication application) { // this.application = application; // } // // /** // * Allow the application context to be injected but require that it be annotated with // * {@link ForApplication @Annotation} to explicitly differentiate it from an activity context. // */ // @Provides // @Singleton // @ForApplication // Context provideApplicationContext() { // return application; // } // // @Provides // @Singleton // LocationManager provideLocationManager() { // return (LocationManager) application.getSystemService(LOCATION_SERVICE); // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/view/module/FeedViewModule.java // @Module(injects = {ProtoActivity.class, HipsterListFragment.class}, // complete = false, // library = true) // public class FeedViewModule { // // @Provides // FeedProvider provideFeedProvider(FeedViewModel viewModel) { // return new FeedProvider(viewModel); // } // // @Provides // FeedViewModel provideFeedViewModel(GetFeed getFeed,GetMyLikers getMyLikers, // LikeHipster likeHipster, HipsterViewMapper mapper) { // return new FeedViewModel(getFeed,getMyLikers,likeHipster,mapper); // } // // @Provides // @Singleton // Picasso providePicasso(@ForApplication Context context) { // return Picasso.with(context); // } // // @Provides // TransformationBuilder provideTransformationBuilder(TransformationBuilderPicasso // transformationBuilderPicasso) { // return transformationBuilderPicasso; // } // // @Provides // HipsterViewMapper provideHipsterViewMapperManual(HipsterViewMapperManual hipsterViewMapperManual) { // return hipsterViewMapperManual; // } // } // Path: protohipster/src/main/java/com/flipper83/protohipster/uibase/app/ProtoApplication.java import android.app.Application; import com.flipper83.protohipster.feed.datasource.module.DataSourceModule; import com.flipper83.protohipster.feed.domain.module.DomainModule; import com.flipper83.protohipster.globalutils.module.GlobalModule; import com.flipper83.protohipster.globalutils.module.AndroidModule; import com.flipper83.protohipster.feed.view.module.FeedViewModule; import java.util.Arrays; import java.util.List; import dagger.ObjectGraph; package com.flipper83.protohipster.uibase.app; /** * Application called on Android Manifest */ public class ProtoApplication extends Application{ private ObjectGraph graph; @Override public void onCreate() { super.onCreate(); graph = ObjectGraph.create(getModules().toArray()); graph.injectStatics(); } protected List<Object> getModules() {
return Arrays.asList(new AndroidModule(this),new GlobalModule(), new DomainModule(),new FeedViewModule(),new DataSourceModule());
flipper83/protohipster
protohipster/src/main/java/com/flipper83/protohipster/feed/view/ui/HipsterListFragment.java
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/view/provider/FeedProvider.java // public class FeedProvider { // // FeedViewModel viewModel; // // public FeedProvider(FeedViewModel viewModel) { // this.viewModel = viewModel; // } // // public FeedViewModel getFeed() { // return viewModel; // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/view/viewmodel/FeedViewModel.java // public class FeedViewModel { // // HipsterViewMapper hipsterViewMapper; // GetFeed getFeed; // GetMyLikers getMyLikers; // LikeHipster likeUser; // // private List<HipsterViewModel> hipsters = new ArrayList<HipsterViewModel>(); // // public FeedViewModel(GetFeed getFeed,GetMyLikers getMyLikers,LikeHipster likeUser, HipsterViewMapper mapper) { // this.getFeed = getFeed; // this.getMyLikers = getMyLikers; // this.likeUser = likeUser; // this.hipsterViewMapper = mapper; // } // // public void addHipster(HipsterViewModel hipster) { // hipsters.add(hipster); // } // // public List<HipsterViewModel> getHipsters() { // return Collections.unmodifiableList(hipsters); // } // // public Observable<List<HipsterViewModel>> populateFeed() { // return Observable.zip(getFeed.getFeed(), getMyLikers.getMyLikers(), new Func2<FeedBoundary, List<String>, List<HipsterViewModel>>() { // @Override // public List<HipsterViewModel> call(FeedBoundary feedBoundary, List<String> myLikers) { // hipsters.clear(); // // for (HipsterBoundary hipsterBoundary : feedBoundary.getHipsters()) { // // HipsterViewModel hipsterViewModel = hipsterViewMapper.mapper(hipsterBoundary); // // boolean likedByMe = myLikers.contains(hipsterViewModel.getUserId()); // hipsterViewModel.setLikedByMe(likedByMe); // // hipsters.add(hipsterViewModel); // } // // return hipsters; // } // }); // } // // public Observable<HipsterViewModel> likeHipster(int position){ // HipsterViewModel hipster = hipsters.get(position); // hipster.setLikedByMe(true); // // return likeUser.like(hipster.getUserId()).map( new Func1<String, HipsterViewModel>() { // @Override // public HipsterViewModel call(String userId) { // for (HipsterViewModel hipsterViewModel : hipsters) { // if (hipsterViewModel.getUserId().equals(userId)){ // hipsterViewModel.setRating(hipsterViewModel.getRating() + 1); // hipsterViewModel.setLikedByMe(true); // return hipsterViewModel; // } // } // // return HipsterViewModel.EMPTY; // } // }); // // } // // // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/view/viewmodel/HipsterViewModel.java // public class HipsterViewModel { // public static final HipsterViewModel EMPTY = new HipsterViewModel(); // // private String userId = ""; // private String name = ""; // private String urlAvatar = ""; // private int rating; // private boolean likedByMe; // // public HipsterViewModel() { // // } // // public String getName() { // return name; // } // // public String getUrlAvatar() { // return urlAvatar; // } // // public int getRating() { // return rating; // } // // public void setName(String name) { // this.name = name; // } // // public void setUrlAvatar(String urlAvatar) { // this.urlAvatar = urlAvatar; // } // // public void setRating(int rating) { // this.rating = rating; // } // // public String getUserId() { // return userId; // } // // public void setUserId(String userId) { // this.userId = userId; // } // // public void setLikedByMe(boolean likedByMe) { // this.likedByMe = likedByMe; // } // // public boolean isLikedByMe() { // return likedByMe; // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/uibase/base/BaseFragment.java // public class BaseFragment extends Fragment { // @Override // public void onActivityCreated(Bundle savedInstanceState) { // super.onActivityCreated(savedInstanceState); // // ((BaseActivity) this.getActivity()).inject(this); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/uibase/transformation/TransformationBuilder.java // public interface TransformationBuilder { // Transformation createAvatarTransformation(); // }
import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ListView; import com.flipper83.protohipster.R; import com.flipper83.protohipster.feed.view.provider.FeedProvider; import com.flipper83.protohipster.feed.view.viewmodel.FeedViewModel; import com.flipper83.protohipster.feed.view.viewmodel.HipsterViewModel; import com.flipper83.protohipster.uibase.base.BaseFragment; import com.flipper83.protohipster.uibase.transformation.TransformationBuilder; import com.squareup.picasso.Picasso; import java.util.List; import javax.inject.Inject; import rx.Observer; import rx.Subscription; import rx.android.concurrency.AndroidSchedulers; import rx.schedulers.Schedulers;
package com.flipper83.protohipster.feed.view.ui; /** * A placeholder fragment containing a simple view. */ public class HipsterListFragment extends BaseFragment { @Inject
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/view/provider/FeedProvider.java // public class FeedProvider { // // FeedViewModel viewModel; // // public FeedProvider(FeedViewModel viewModel) { // this.viewModel = viewModel; // } // // public FeedViewModel getFeed() { // return viewModel; // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/view/viewmodel/FeedViewModel.java // public class FeedViewModel { // // HipsterViewMapper hipsterViewMapper; // GetFeed getFeed; // GetMyLikers getMyLikers; // LikeHipster likeUser; // // private List<HipsterViewModel> hipsters = new ArrayList<HipsterViewModel>(); // // public FeedViewModel(GetFeed getFeed,GetMyLikers getMyLikers,LikeHipster likeUser, HipsterViewMapper mapper) { // this.getFeed = getFeed; // this.getMyLikers = getMyLikers; // this.likeUser = likeUser; // this.hipsterViewMapper = mapper; // } // // public void addHipster(HipsterViewModel hipster) { // hipsters.add(hipster); // } // // public List<HipsterViewModel> getHipsters() { // return Collections.unmodifiableList(hipsters); // } // // public Observable<List<HipsterViewModel>> populateFeed() { // return Observable.zip(getFeed.getFeed(), getMyLikers.getMyLikers(), new Func2<FeedBoundary, List<String>, List<HipsterViewModel>>() { // @Override // public List<HipsterViewModel> call(FeedBoundary feedBoundary, List<String> myLikers) { // hipsters.clear(); // // for (HipsterBoundary hipsterBoundary : feedBoundary.getHipsters()) { // // HipsterViewModel hipsterViewModel = hipsterViewMapper.mapper(hipsterBoundary); // // boolean likedByMe = myLikers.contains(hipsterViewModel.getUserId()); // hipsterViewModel.setLikedByMe(likedByMe); // // hipsters.add(hipsterViewModel); // } // // return hipsters; // } // }); // } // // public Observable<HipsterViewModel> likeHipster(int position){ // HipsterViewModel hipster = hipsters.get(position); // hipster.setLikedByMe(true); // // return likeUser.like(hipster.getUserId()).map( new Func1<String, HipsterViewModel>() { // @Override // public HipsterViewModel call(String userId) { // for (HipsterViewModel hipsterViewModel : hipsters) { // if (hipsterViewModel.getUserId().equals(userId)){ // hipsterViewModel.setRating(hipsterViewModel.getRating() + 1); // hipsterViewModel.setLikedByMe(true); // return hipsterViewModel; // } // } // // return HipsterViewModel.EMPTY; // } // }); // // } // // // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/view/viewmodel/HipsterViewModel.java // public class HipsterViewModel { // public static final HipsterViewModel EMPTY = new HipsterViewModel(); // // private String userId = ""; // private String name = ""; // private String urlAvatar = ""; // private int rating; // private boolean likedByMe; // // public HipsterViewModel() { // // } // // public String getName() { // return name; // } // // public String getUrlAvatar() { // return urlAvatar; // } // // public int getRating() { // return rating; // } // // public void setName(String name) { // this.name = name; // } // // public void setUrlAvatar(String urlAvatar) { // this.urlAvatar = urlAvatar; // } // // public void setRating(int rating) { // this.rating = rating; // } // // public String getUserId() { // return userId; // } // // public void setUserId(String userId) { // this.userId = userId; // } // // public void setLikedByMe(boolean likedByMe) { // this.likedByMe = likedByMe; // } // // public boolean isLikedByMe() { // return likedByMe; // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/uibase/base/BaseFragment.java // public class BaseFragment extends Fragment { // @Override // public void onActivityCreated(Bundle savedInstanceState) { // super.onActivityCreated(savedInstanceState); // // ((BaseActivity) this.getActivity()).inject(this); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/uibase/transformation/TransformationBuilder.java // public interface TransformationBuilder { // Transformation createAvatarTransformation(); // } // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/view/ui/HipsterListFragment.java import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ListView; import com.flipper83.protohipster.R; import com.flipper83.protohipster.feed.view.provider.FeedProvider; import com.flipper83.protohipster.feed.view.viewmodel.FeedViewModel; import com.flipper83.protohipster.feed.view.viewmodel.HipsterViewModel; import com.flipper83.protohipster.uibase.base.BaseFragment; import com.flipper83.protohipster.uibase.transformation.TransformationBuilder; import com.squareup.picasso.Picasso; import java.util.List; import javax.inject.Inject; import rx.Observer; import rx.Subscription; import rx.android.concurrency.AndroidSchedulers; import rx.schedulers.Schedulers; package com.flipper83.protohipster.feed.view.ui; /** * A placeholder fragment containing a simple view. */ public class HipsterListFragment extends BaseFragment { @Inject
FeedProvider feedProvider;
flipper83/protohipster
protohipster/src/main/java/com/flipper83/protohipster/feed/view/ui/HipsterListFragment.java
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/view/provider/FeedProvider.java // public class FeedProvider { // // FeedViewModel viewModel; // // public FeedProvider(FeedViewModel viewModel) { // this.viewModel = viewModel; // } // // public FeedViewModel getFeed() { // return viewModel; // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/view/viewmodel/FeedViewModel.java // public class FeedViewModel { // // HipsterViewMapper hipsterViewMapper; // GetFeed getFeed; // GetMyLikers getMyLikers; // LikeHipster likeUser; // // private List<HipsterViewModel> hipsters = new ArrayList<HipsterViewModel>(); // // public FeedViewModel(GetFeed getFeed,GetMyLikers getMyLikers,LikeHipster likeUser, HipsterViewMapper mapper) { // this.getFeed = getFeed; // this.getMyLikers = getMyLikers; // this.likeUser = likeUser; // this.hipsterViewMapper = mapper; // } // // public void addHipster(HipsterViewModel hipster) { // hipsters.add(hipster); // } // // public List<HipsterViewModel> getHipsters() { // return Collections.unmodifiableList(hipsters); // } // // public Observable<List<HipsterViewModel>> populateFeed() { // return Observable.zip(getFeed.getFeed(), getMyLikers.getMyLikers(), new Func2<FeedBoundary, List<String>, List<HipsterViewModel>>() { // @Override // public List<HipsterViewModel> call(FeedBoundary feedBoundary, List<String> myLikers) { // hipsters.clear(); // // for (HipsterBoundary hipsterBoundary : feedBoundary.getHipsters()) { // // HipsterViewModel hipsterViewModel = hipsterViewMapper.mapper(hipsterBoundary); // // boolean likedByMe = myLikers.contains(hipsterViewModel.getUserId()); // hipsterViewModel.setLikedByMe(likedByMe); // // hipsters.add(hipsterViewModel); // } // // return hipsters; // } // }); // } // // public Observable<HipsterViewModel> likeHipster(int position){ // HipsterViewModel hipster = hipsters.get(position); // hipster.setLikedByMe(true); // // return likeUser.like(hipster.getUserId()).map( new Func1<String, HipsterViewModel>() { // @Override // public HipsterViewModel call(String userId) { // for (HipsterViewModel hipsterViewModel : hipsters) { // if (hipsterViewModel.getUserId().equals(userId)){ // hipsterViewModel.setRating(hipsterViewModel.getRating() + 1); // hipsterViewModel.setLikedByMe(true); // return hipsterViewModel; // } // } // // return HipsterViewModel.EMPTY; // } // }); // // } // // // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/view/viewmodel/HipsterViewModel.java // public class HipsterViewModel { // public static final HipsterViewModel EMPTY = new HipsterViewModel(); // // private String userId = ""; // private String name = ""; // private String urlAvatar = ""; // private int rating; // private boolean likedByMe; // // public HipsterViewModel() { // // } // // public String getName() { // return name; // } // // public String getUrlAvatar() { // return urlAvatar; // } // // public int getRating() { // return rating; // } // // public void setName(String name) { // this.name = name; // } // // public void setUrlAvatar(String urlAvatar) { // this.urlAvatar = urlAvatar; // } // // public void setRating(int rating) { // this.rating = rating; // } // // public String getUserId() { // return userId; // } // // public void setUserId(String userId) { // this.userId = userId; // } // // public void setLikedByMe(boolean likedByMe) { // this.likedByMe = likedByMe; // } // // public boolean isLikedByMe() { // return likedByMe; // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/uibase/base/BaseFragment.java // public class BaseFragment extends Fragment { // @Override // public void onActivityCreated(Bundle savedInstanceState) { // super.onActivityCreated(savedInstanceState); // // ((BaseActivity) this.getActivity()).inject(this); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/uibase/transformation/TransformationBuilder.java // public interface TransformationBuilder { // Transformation createAvatarTransformation(); // }
import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ListView; import com.flipper83.protohipster.R; import com.flipper83.protohipster.feed.view.provider.FeedProvider; import com.flipper83.protohipster.feed.view.viewmodel.FeedViewModel; import com.flipper83.protohipster.feed.view.viewmodel.HipsterViewModel; import com.flipper83.protohipster.uibase.base.BaseFragment; import com.flipper83.protohipster.uibase.transformation.TransformationBuilder; import com.squareup.picasso.Picasso; import java.util.List; import javax.inject.Inject; import rx.Observer; import rx.Subscription; import rx.android.concurrency.AndroidSchedulers; import rx.schedulers.Schedulers;
package com.flipper83.protohipster.feed.view.ui; /** * A placeholder fragment containing a simple view. */ public class HipsterListFragment extends BaseFragment { @Inject FeedProvider feedProvider; @Inject Picasso picasso; @Inject
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/view/provider/FeedProvider.java // public class FeedProvider { // // FeedViewModel viewModel; // // public FeedProvider(FeedViewModel viewModel) { // this.viewModel = viewModel; // } // // public FeedViewModel getFeed() { // return viewModel; // } // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/view/viewmodel/FeedViewModel.java // public class FeedViewModel { // // HipsterViewMapper hipsterViewMapper; // GetFeed getFeed; // GetMyLikers getMyLikers; // LikeHipster likeUser; // // private List<HipsterViewModel> hipsters = new ArrayList<HipsterViewModel>(); // // public FeedViewModel(GetFeed getFeed,GetMyLikers getMyLikers,LikeHipster likeUser, HipsterViewMapper mapper) { // this.getFeed = getFeed; // this.getMyLikers = getMyLikers; // this.likeUser = likeUser; // this.hipsterViewMapper = mapper; // } // // public void addHipster(HipsterViewModel hipster) { // hipsters.add(hipster); // } // // public List<HipsterViewModel> getHipsters() { // return Collections.unmodifiableList(hipsters); // } // // public Observable<List<HipsterViewModel>> populateFeed() { // return Observable.zip(getFeed.getFeed(), getMyLikers.getMyLikers(), new Func2<FeedBoundary, List<String>, List<HipsterViewModel>>() { // @Override // public List<HipsterViewModel> call(FeedBoundary feedBoundary, List<String> myLikers) { // hipsters.clear(); // // for (HipsterBoundary hipsterBoundary : feedBoundary.getHipsters()) { // // HipsterViewModel hipsterViewModel = hipsterViewMapper.mapper(hipsterBoundary); // // boolean likedByMe = myLikers.contains(hipsterViewModel.getUserId()); // hipsterViewModel.setLikedByMe(likedByMe); // // hipsters.add(hipsterViewModel); // } // // return hipsters; // } // }); // } // // public Observable<HipsterViewModel> likeHipster(int position){ // HipsterViewModel hipster = hipsters.get(position); // hipster.setLikedByMe(true); // // return likeUser.like(hipster.getUserId()).map( new Func1<String, HipsterViewModel>() { // @Override // public HipsterViewModel call(String userId) { // for (HipsterViewModel hipsterViewModel : hipsters) { // if (hipsterViewModel.getUserId().equals(userId)){ // hipsterViewModel.setRating(hipsterViewModel.getRating() + 1); // hipsterViewModel.setLikedByMe(true); // return hipsterViewModel; // } // } // // return HipsterViewModel.EMPTY; // } // }); // // } // // // // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/view/viewmodel/HipsterViewModel.java // public class HipsterViewModel { // public static final HipsterViewModel EMPTY = new HipsterViewModel(); // // private String userId = ""; // private String name = ""; // private String urlAvatar = ""; // private int rating; // private boolean likedByMe; // // public HipsterViewModel() { // // } // // public String getName() { // return name; // } // // public String getUrlAvatar() { // return urlAvatar; // } // // public int getRating() { // return rating; // } // // public void setName(String name) { // this.name = name; // } // // public void setUrlAvatar(String urlAvatar) { // this.urlAvatar = urlAvatar; // } // // public void setRating(int rating) { // this.rating = rating; // } // // public String getUserId() { // return userId; // } // // public void setUserId(String userId) { // this.userId = userId; // } // // public void setLikedByMe(boolean likedByMe) { // this.likedByMe = likedByMe; // } // // public boolean isLikedByMe() { // return likedByMe; // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/uibase/base/BaseFragment.java // public class BaseFragment extends Fragment { // @Override // public void onActivityCreated(Bundle savedInstanceState) { // super.onActivityCreated(savedInstanceState); // // ((BaseActivity) this.getActivity()).inject(this); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/uibase/transformation/TransformationBuilder.java // public interface TransformationBuilder { // Transformation createAvatarTransformation(); // } // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/view/ui/HipsterListFragment.java import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ListView; import com.flipper83.protohipster.R; import com.flipper83.protohipster.feed.view.provider.FeedProvider; import com.flipper83.protohipster.feed.view.viewmodel.FeedViewModel; import com.flipper83.protohipster.feed.view.viewmodel.HipsterViewModel; import com.flipper83.protohipster.uibase.base.BaseFragment; import com.flipper83.protohipster.uibase.transformation.TransformationBuilder; import com.squareup.picasso.Picasso; import java.util.List; import javax.inject.Inject; import rx.Observer; import rx.Subscription; import rx.android.concurrency.AndroidSchedulers; import rx.schedulers.Schedulers; package com.flipper83.protohipster.feed.view.ui; /** * A placeholder fragment containing a simple view. */ public class HipsterListFragment extends BaseFragment { @Inject FeedProvider feedProvider; @Inject Picasso picasso; @Inject
TransformationBuilder transformationBuilder;
flipper83/protohipster
protohipster/src/main/java/com/flipper83/protohipster/uibase/base/BaseActivity.java
// Path: protohipster/src/main/java/com/flipper83/protohipster/uibase/app/ProtoApplication.java // public class ProtoApplication extends Application{ // private ObjectGraph graph; // // @Override // public void onCreate() { // super.onCreate(); // // graph = ObjectGraph.create(getModules().toArray()); // graph.injectStatics(); // } // // protected List<Object> getModules() { // return Arrays.asList(new AndroidModule(this),new GlobalModule(), new DomainModule(),new FeedViewModule(),new DataSourceModule()); // } // // // // public void inject(Object object) { // graph.inject(object); // } // // }
import android.os.Bundle; import android.support.v4.app.FragmentActivity; import com.flipper83.protohipster.uibase.app.ProtoApplication;
package com.flipper83.protohipster.uibase.base; /** * This is base Activity, all activities must extends from this one. */ public class BaseActivity extends FragmentActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); inject(this); } public void inject(Object object) { // Perform injection so that when this call returns all dependencies will be available for use.
// Path: protohipster/src/main/java/com/flipper83/protohipster/uibase/app/ProtoApplication.java // public class ProtoApplication extends Application{ // private ObjectGraph graph; // // @Override // public void onCreate() { // super.onCreate(); // // graph = ObjectGraph.create(getModules().toArray()); // graph.injectStatics(); // } // // protected List<Object> getModules() { // return Arrays.asList(new AndroidModule(this),new GlobalModule(), new DomainModule(),new FeedViewModule(),new DataSourceModule()); // } // // // // public void inject(Object object) { // graph.inject(object); // } // // } // Path: protohipster/src/main/java/com/flipper83/protohipster/uibase/base/BaseActivity.java import android.os.Bundle; import android.support.v4.app.FragmentActivity; import com.flipper83.protohipster.uibase.app.ProtoApplication; package com.flipper83.protohipster.uibase.base; /** * This is base Activity, all activities must extends from this one. */ public class BaseActivity extends FragmentActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); inject(this); } public void inject(Object object) { // Perform injection so that when this call returns all dependencies will be available for use.
((ProtoApplication) getApplication()).inject(object);
flipper83/protohipster
protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/api/ApiParse.java
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/Api.java // public interface Api { // void call(ApiCall apiCall); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/call/ApiCall.java // public abstract class ApiCall { // // protected ApiResponseCallback responseCallback; // // public ApiCall(ApiResponseCallback responseCallback) { // this.responseCallback = responseCallback; // } // // public abstract void call(); // }
import android.content.Context; import com.flipper83.protohipster.feed.datasource.api.Api; import com.flipper83.protohipster.feed.datasource.api.call.ApiCall; import com.parse.Parse;
package com.flipper83.protohipster.feed.datasource.module.api; /** * */ public class ApiParse implements Api { public ApiParse(Context context){ Parse.initialize(context, "qFiaaQwGeJCdIpp3WUiBeuk0FXC4vRe0wGImASrB", "L8W1fORdrPiOGl63XzlxgUziX8q9f0ylV5tdV2Y1"); } @Override
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/Api.java // public interface Api { // void call(ApiCall apiCall); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/call/ApiCall.java // public abstract class ApiCall { // // protected ApiResponseCallback responseCallback; // // public ApiCall(ApiResponseCallback responseCallback) { // this.responseCallback = responseCallback; // } // // public abstract void call(); // } // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/api/ApiParse.java import android.content.Context; import com.flipper83.protohipster.feed.datasource.api.Api; import com.flipper83.protohipster.feed.datasource.api.call.ApiCall; import com.parse.Parse; package com.flipper83.protohipster.feed.datasource.module.api; /** * */ public class ApiParse implements Api { public ApiParse(Context context){ Parse.initialize(context, "qFiaaQwGeJCdIpp3WUiBeuk0FXC4vRe0wGImASrB", "L8W1fORdrPiOGl63XzlxgUziX8q9f0ylV5tdV2Y1"); } @Override
public void call(ApiCall apiCall) {
flipper83/protohipster
protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/LikeDataSource.java
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/callbacks/GetCountLikesCallback.java // public interface GetCountLikesCallback { // void countUsers(Map<String, Integer> countLikers); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/callbacks/GetMyLikersCallback.java // public interface GetMyLikersCallback { // void myLikers(List<String> userIds); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/callbacks/LikeUserCallback.java // public interface LikeUserCallback { // void liked(String userId); // }
import com.flipper83.protohipster.feed.datasource.interfaces.callbacks.GetCountLikesCallback; import com.flipper83.protohipster.feed.datasource.interfaces.callbacks.GetMyLikersCallback; import com.flipper83.protohipster.feed.datasource.interfaces.callbacks.LikeUserCallback; import java.util.List;
package com.flipper83.protohipster.feed.datasource.interfaces; /** * This is the data source that provides likes */ public interface LikeDataSource { void getCountLikesForUser(List<String> userIds, GetCountLikesCallback getCountLikesCallback);
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/callbacks/GetCountLikesCallback.java // public interface GetCountLikesCallback { // void countUsers(Map<String, Integer> countLikers); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/callbacks/GetMyLikersCallback.java // public interface GetMyLikersCallback { // void myLikers(List<String> userIds); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/callbacks/LikeUserCallback.java // public interface LikeUserCallback { // void liked(String userId); // } // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/LikeDataSource.java import com.flipper83.protohipster.feed.datasource.interfaces.callbacks.GetCountLikesCallback; import com.flipper83.protohipster.feed.datasource.interfaces.callbacks.GetMyLikersCallback; import com.flipper83.protohipster.feed.datasource.interfaces.callbacks.LikeUserCallback; import java.util.List; package com.flipper83.protohipster.feed.datasource.interfaces; /** * This is the data source that provides likes */ public interface LikeDataSource { void getCountLikesForUser(List<String> userIds, GetCountLikesCallback getCountLikesCallback);
void getMyLikers(GetMyLikersCallback getLikersForUserCallback);
flipper83/protohipster
protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/LikeDataSource.java
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/callbacks/GetCountLikesCallback.java // public interface GetCountLikesCallback { // void countUsers(Map<String, Integer> countLikers); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/callbacks/GetMyLikersCallback.java // public interface GetMyLikersCallback { // void myLikers(List<String> userIds); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/callbacks/LikeUserCallback.java // public interface LikeUserCallback { // void liked(String userId); // }
import com.flipper83.protohipster.feed.datasource.interfaces.callbacks.GetCountLikesCallback; import com.flipper83.protohipster.feed.datasource.interfaces.callbacks.GetMyLikersCallback; import com.flipper83.protohipster.feed.datasource.interfaces.callbacks.LikeUserCallback; import java.util.List;
package com.flipper83.protohipster.feed.datasource.interfaces; /** * This is the data source that provides likes */ public interface LikeDataSource { void getCountLikesForUser(List<String> userIds, GetCountLikesCallback getCountLikesCallback); void getMyLikers(GetMyLikersCallback getLikersForUserCallback);
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/callbacks/GetCountLikesCallback.java // public interface GetCountLikesCallback { // void countUsers(Map<String, Integer> countLikers); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/callbacks/GetMyLikersCallback.java // public interface GetMyLikersCallback { // void myLikers(List<String> userIds); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/callbacks/LikeUserCallback.java // public interface LikeUserCallback { // void liked(String userId); // } // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/LikeDataSource.java import com.flipper83.protohipster.feed.datasource.interfaces.callbacks.GetCountLikesCallback; import com.flipper83.protohipster.feed.datasource.interfaces.callbacks.GetMyLikersCallback; import com.flipper83.protohipster.feed.datasource.interfaces.callbacks.LikeUserCallback; import java.util.List; package com.flipper83.protohipster.feed.datasource.interfaces; /** * This is the data source that provides likes */ public interface LikeDataSource { void getCountLikesForUser(List<String> userIds, GetCountLikesCallback getCountLikesCallback); void getMyLikers(GetMyLikersCallback getLikersForUserCallback);
void likeUser(String userId, LikeUserCallback likeUserCallback);
flipper83/protohipster
protohipster/src/main/java/com/flipper83/protohipster/feed/domain/module/LikeHipsterImp.java
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/LikeDataSource.java // public interface LikeDataSource { // void getCountLikesForUser(List<String> userIds, GetCountLikesCallback getCountLikesCallback); // void getMyLikers(GetMyLikersCallback getLikersForUserCallback); // void likeUser(String userId, LikeUserCallback likeUserCallback); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/callbacks/LikeUserCallback.java // public interface LikeUserCallback { // void liked(String userId); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/LikeHipster.java // public interface LikeHipster { // public Observable<String> like(String userId); // }
import com.flipper83.protohipster.feed.datasource.interfaces.LikeDataSource; import com.flipper83.protohipster.feed.datasource.interfaces.callbacks.LikeUserCallback; import com.flipper83.protohipster.feed.domain.interactors.LikeHipster; import javax.inject.Inject; import rx.Observable; import rx.Observer; import rx.Subscription; import rx.subscriptions.Subscriptions;
package com.flipper83.protohipster.feed.domain.module; /** * Implementation for the interactor LikeHipster */ public class LikeHipsterImp implements LikeHipster{ LikeDataSource likeDataSource; @Inject public LikeHipsterImp(LikeDataSource likeDataSource){ this.likeDataSource = likeDataSource; } @Override public Observable<String> like(final String userId) { return Observable.create(new Observable.OnSubscribeFunc<String>() { @Override public Subscription onSubscribe(final Observer<? super String> observer) {
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/LikeDataSource.java // public interface LikeDataSource { // void getCountLikesForUser(List<String> userIds, GetCountLikesCallback getCountLikesCallback); // void getMyLikers(GetMyLikersCallback getLikersForUserCallback); // void likeUser(String userId, LikeUserCallback likeUserCallback); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/interfaces/callbacks/LikeUserCallback.java // public interface LikeUserCallback { // void liked(String userId); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/LikeHipster.java // public interface LikeHipster { // public Observable<String> like(String userId); // } // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/module/LikeHipsterImp.java import com.flipper83.protohipster.feed.datasource.interfaces.LikeDataSource; import com.flipper83.protohipster.feed.datasource.interfaces.callbacks.LikeUserCallback; import com.flipper83.protohipster.feed.domain.interactors.LikeHipster; import javax.inject.Inject; import rx.Observable; import rx.Observer; import rx.Subscription; import rx.subscriptions.Subscriptions; package com.flipper83.protohipster.feed.domain.module; /** * Implementation for the interactor LikeHipster */ public class LikeHipsterImp implements LikeHipster{ LikeDataSource likeDataSource; @Inject public LikeHipsterImp(LikeDataSource likeDataSource){ this.likeDataSource = likeDataSource; } @Override public Observable<String> like(final String userId) { return Observable.create(new Observable.OnSubscribeFunc<String>() { @Override public Subscription onSubscribe(final Observer<? super String> observer) {
likeDataSource.likeUser(userId,new LikeUserCallback() {
flipper83/protohipster
protohipster/src/main/java/com/flipper83/protohipster/feed/view/viewmodel/FeedViewModel.java
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/boundaries/FeedBoundary.java // public class FeedBoundary { // private boolean success = false; // List<HipsterBoundary> hipsters = new ArrayList<HipsterBoundary>(); // // public boolean isSuccess() { // return success; // } // // public void setSuccess(boolean success) { // this.success = success; // } // // public List<HipsterBoundary> getHipsters() { // return hipsters; // } // // // public void add(HipsterBoundary hipster) { // hipsters.add(hipster); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/boundaries/HipsterBoundary.java // public class HipsterBoundary { // private String name; // private String avatar; // private int rating; // private String userId; // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getAvatar() { // return avatar; // } // // public void setAvatar(String avatar) { // this.avatar = avatar; // } // // public int getRating() { // return rating; // } // // public void setRating(int rating) { // this.rating = rating; // } // // public String getUserId() { // return userId; // } // // public void setUserId(String userId) { // this.userId = userId; // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetFeed.java // public interface GetFeed { // Observable<FeedBoundary> getFeed(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetMyLikers.java // public interface GetMyLikers { // Observable<List<String>> getMyLikers(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/LikeHipster.java // public interface LikeHipster { // public Observable<String> like(String userId); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/view/viewmodel/mapper/HipsterViewMapper.java // public interface HipsterViewMapper { // public HipsterViewModel mapper(HipsterBoundary hipsterBoundary); // }
import com.flipper83.protohipster.feed.domain.boundaries.FeedBoundary; import com.flipper83.protohipster.feed.domain.boundaries.HipsterBoundary; import com.flipper83.protohipster.feed.domain.interactors.GetFeed; import com.flipper83.protohipster.feed.domain.interactors.GetMyLikers; import com.flipper83.protohipster.feed.domain.interactors.LikeHipster; import com.flipper83.protohipster.feed.view.viewmodel.mapper.HipsterViewMapper; import java.util.ArrayList; import java.util.Collections; import java.util.List; import rx.Observable; import rx.util.functions.Func1; import rx.util.functions.Func2;
package com.flipper83.protohipster.feed.view.viewmodel; /** * A list of view information Hipsters */ public class FeedViewModel { HipsterViewMapper hipsterViewMapper;
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/boundaries/FeedBoundary.java // public class FeedBoundary { // private boolean success = false; // List<HipsterBoundary> hipsters = new ArrayList<HipsterBoundary>(); // // public boolean isSuccess() { // return success; // } // // public void setSuccess(boolean success) { // this.success = success; // } // // public List<HipsterBoundary> getHipsters() { // return hipsters; // } // // // public void add(HipsterBoundary hipster) { // hipsters.add(hipster); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/boundaries/HipsterBoundary.java // public class HipsterBoundary { // private String name; // private String avatar; // private int rating; // private String userId; // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getAvatar() { // return avatar; // } // // public void setAvatar(String avatar) { // this.avatar = avatar; // } // // public int getRating() { // return rating; // } // // public void setRating(int rating) { // this.rating = rating; // } // // public String getUserId() { // return userId; // } // // public void setUserId(String userId) { // this.userId = userId; // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetFeed.java // public interface GetFeed { // Observable<FeedBoundary> getFeed(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetMyLikers.java // public interface GetMyLikers { // Observable<List<String>> getMyLikers(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/LikeHipster.java // public interface LikeHipster { // public Observable<String> like(String userId); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/view/viewmodel/mapper/HipsterViewMapper.java // public interface HipsterViewMapper { // public HipsterViewModel mapper(HipsterBoundary hipsterBoundary); // } // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/view/viewmodel/FeedViewModel.java import com.flipper83.protohipster.feed.domain.boundaries.FeedBoundary; import com.flipper83.protohipster.feed.domain.boundaries.HipsterBoundary; import com.flipper83.protohipster.feed.domain.interactors.GetFeed; import com.flipper83.protohipster.feed.domain.interactors.GetMyLikers; import com.flipper83.protohipster.feed.domain.interactors.LikeHipster; import com.flipper83.protohipster.feed.view.viewmodel.mapper.HipsterViewMapper; import java.util.ArrayList; import java.util.Collections; import java.util.List; import rx.Observable; import rx.util.functions.Func1; import rx.util.functions.Func2; package com.flipper83.protohipster.feed.view.viewmodel; /** * A list of view information Hipsters */ public class FeedViewModel { HipsterViewMapper hipsterViewMapper;
GetFeed getFeed;
flipper83/protohipster
protohipster/src/main/java/com/flipper83/protohipster/feed/view/viewmodel/FeedViewModel.java
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/boundaries/FeedBoundary.java // public class FeedBoundary { // private boolean success = false; // List<HipsterBoundary> hipsters = new ArrayList<HipsterBoundary>(); // // public boolean isSuccess() { // return success; // } // // public void setSuccess(boolean success) { // this.success = success; // } // // public List<HipsterBoundary> getHipsters() { // return hipsters; // } // // // public void add(HipsterBoundary hipster) { // hipsters.add(hipster); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/boundaries/HipsterBoundary.java // public class HipsterBoundary { // private String name; // private String avatar; // private int rating; // private String userId; // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getAvatar() { // return avatar; // } // // public void setAvatar(String avatar) { // this.avatar = avatar; // } // // public int getRating() { // return rating; // } // // public void setRating(int rating) { // this.rating = rating; // } // // public String getUserId() { // return userId; // } // // public void setUserId(String userId) { // this.userId = userId; // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetFeed.java // public interface GetFeed { // Observable<FeedBoundary> getFeed(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetMyLikers.java // public interface GetMyLikers { // Observable<List<String>> getMyLikers(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/LikeHipster.java // public interface LikeHipster { // public Observable<String> like(String userId); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/view/viewmodel/mapper/HipsterViewMapper.java // public interface HipsterViewMapper { // public HipsterViewModel mapper(HipsterBoundary hipsterBoundary); // }
import com.flipper83.protohipster.feed.domain.boundaries.FeedBoundary; import com.flipper83.protohipster.feed.domain.boundaries.HipsterBoundary; import com.flipper83.protohipster.feed.domain.interactors.GetFeed; import com.flipper83.protohipster.feed.domain.interactors.GetMyLikers; import com.flipper83.protohipster.feed.domain.interactors.LikeHipster; import com.flipper83.protohipster.feed.view.viewmodel.mapper.HipsterViewMapper; import java.util.ArrayList; import java.util.Collections; import java.util.List; import rx.Observable; import rx.util.functions.Func1; import rx.util.functions.Func2;
package com.flipper83.protohipster.feed.view.viewmodel; /** * A list of view information Hipsters */ public class FeedViewModel { HipsterViewMapper hipsterViewMapper; GetFeed getFeed;
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/boundaries/FeedBoundary.java // public class FeedBoundary { // private boolean success = false; // List<HipsterBoundary> hipsters = new ArrayList<HipsterBoundary>(); // // public boolean isSuccess() { // return success; // } // // public void setSuccess(boolean success) { // this.success = success; // } // // public List<HipsterBoundary> getHipsters() { // return hipsters; // } // // // public void add(HipsterBoundary hipster) { // hipsters.add(hipster); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/boundaries/HipsterBoundary.java // public class HipsterBoundary { // private String name; // private String avatar; // private int rating; // private String userId; // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getAvatar() { // return avatar; // } // // public void setAvatar(String avatar) { // this.avatar = avatar; // } // // public int getRating() { // return rating; // } // // public void setRating(int rating) { // this.rating = rating; // } // // public String getUserId() { // return userId; // } // // public void setUserId(String userId) { // this.userId = userId; // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetFeed.java // public interface GetFeed { // Observable<FeedBoundary> getFeed(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetMyLikers.java // public interface GetMyLikers { // Observable<List<String>> getMyLikers(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/LikeHipster.java // public interface LikeHipster { // public Observable<String> like(String userId); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/view/viewmodel/mapper/HipsterViewMapper.java // public interface HipsterViewMapper { // public HipsterViewModel mapper(HipsterBoundary hipsterBoundary); // } // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/view/viewmodel/FeedViewModel.java import com.flipper83.protohipster.feed.domain.boundaries.FeedBoundary; import com.flipper83.protohipster.feed.domain.boundaries.HipsterBoundary; import com.flipper83.protohipster.feed.domain.interactors.GetFeed; import com.flipper83.protohipster.feed.domain.interactors.GetMyLikers; import com.flipper83.protohipster.feed.domain.interactors.LikeHipster; import com.flipper83.protohipster.feed.view.viewmodel.mapper.HipsterViewMapper; import java.util.ArrayList; import java.util.Collections; import java.util.List; import rx.Observable; import rx.util.functions.Func1; import rx.util.functions.Func2; package com.flipper83.protohipster.feed.view.viewmodel; /** * A list of view information Hipsters */ public class FeedViewModel { HipsterViewMapper hipsterViewMapper; GetFeed getFeed;
GetMyLikers getMyLikers;
flipper83/protohipster
protohipster/src/main/java/com/flipper83/protohipster/feed/view/viewmodel/FeedViewModel.java
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/boundaries/FeedBoundary.java // public class FeedBoundary { // private boolean success = false; // List<HipsterBoundary> hipsters = new ArrayList<HipsterBoundary>(); // // public boolean isSuccess() { // return success; // } // // public void setSuccess(boolean success) { // this.success = success; // } // // public List<HipsterBoundary> getHipsters() { // return hipsters; // } // // // public void add(HipsterBoundary hipster) { // hipsters.add(hipster); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/boundaries/HipsterBoundary.java // public class HipsterBoundary { // private String name; // private String avatar; // private int rating; // private String userId; // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getAvatar() { // return avatar; // } // // public void setAvatar(String avatar) { // this.avatar = avatar; // } // // public int getRating() { // return rating; // } // // public void setRating(int rating) { // this.rating = rating; // } // // public String getUserId() { // return userId; // } // // public void setUserId(String userId) { // this.userId = userId; // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetFeed.java // public interface GetFeed { // Observable<FeedBoundary> getFeed(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetMyLikers.java // public interface GetMyLikers { // Observable<List<String>> getMyLikers(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/LikeHipster.java // public interface LikeHipster { // public Observable<String> like(String userId); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/view/viewmodel/mapper/HipsterViewMapper.java // public interface HipsterViewMapper { // public HipsterViewModel mapper(HipsterBoundary hipsterBoundary); // }
import com.flipper83.protohipster.feed.domain.boundaries.FeedBoundary; import com.flipper83.protohipster.feed.domain.boundaries.HipsterBoundary; import com.flipper83.protohipster.feed.domain.interactors.GetFeed; import com.flipper83.protohipster.feed.domain.interactors.GetMyLikers; import com.flipper83.protohipster.feed.domain.interactors.LikeHipster; import com.flipper83.protohipster.feed.view.viewmodel.mapper.HipsterViewMapper; import java.util.ArrayList; import java.util.Collections; import java.util.List; import rx.Observable; import rx.util.functions.Func1; import rx.util.functions.Func2;
package com.flipper83.protohipster.feed.view.viewmodel; /** * A list of view information Hipsters */ public class FeedViewModel { HipsterViewMapper hipsterViewMapper; GetFeed getFeed; GetMyLikers getMyLikers;
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/boundaries/FeedBoundary.java // public class FeedBoundary { // private boolean success = false; // List<HipsterBoundary> hipsters = new ArrayList<HipsterBoundary>(); // // public boolean isSuccess() { // return success; // } // // public void setSuccess(boolean success) { // this.success = success; // } // // public List<HipsterBoundary> getHipsters() { // return hipsters; // } // // // public void add(HipsterBoundary hipster) { // hipsters.add(hipster); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/boundaries/HipsterBoundary.java // public class HipsterBoundary { // private String name; // private String avatar; // private int rating; // private String userId; // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getAvatar() { // return avatar; // } // // public void setAvatar(String avatar) { // this.avatar = avatar; // } // // public int getRating() { // return rating; // } // // public void setRating(int rating) { // this.rating = rating; // } // // public String getUserId() { // return userId; // } // // public void setUserId(String userId) { // this.userId = userId; // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetFeed.java // public interface GetFeed { // Observable<FeedBoundary> getFeed(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetMyLikers.java // public interface GetMyLikers { // Observable<List<String>> getMyLikers(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/LikeHipster.java // public interface LikeHipster { // public Observable<String> like(String userId); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/view/viewmodel/mapper/HipsterViewMapper.java // public interface HipsterViewMapper { // public HipsterViewModel mapper(HipsterBoundary hipsterBoundary); // } // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/view/viewmodel/FeedViewModel.java import com.flipper83.protohipster.feed.domain.boundaries.FeedBoundary; import com.flipper83.protohipster.feed.domain.boundaries.HipsterBoundary; import com.flipper83.protohipster.feed.domain.interactors.GetFeed; import com.flipper83.protohipster.feed.domain.interactors.GetMyLikers; import com.flipper83.protohipster.feed.domain.interactors.LikeHipster; import com.flipper83.protohipster.feed.view.viewmodel.mapper.HipsterViewMapper; import java.util.ArrayList; import java.util.Collections; import java.util.List; import rx.Observable; import rx.util.functions.Func1; import rx.util.functions.Func2; package com.flipper83.protohipster.feed.view.viewmodel; /** * A list of view information Hipsters */ public class FeedViewModel { HipsterViewMapper hipsterViewMapper; GetFeed getFeed; GetMyLikers getMyLikers;
LikeHipster likeUser;
flipper83/protohipster
protohipster/src/main/java/com/flipper83/protohipster/feed/view/viewmodel/FeedViewModel.java
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/boundaries/FeedBoundary.java // public class FeedBoundary { // private boolean success = false; // List<HipsterBoundary> hipsters = new ArrayList<HipsterBoundary>(); // // public boolean isSuccess() { // return success; // } // // public void setSuccess(boolean success) { // this.success = success; // } // // public List<HipsterBoundary> getHipsters() { // return hipsters; // } // // // public void add(HipsterBoundary hipster) { // hipsters.add(hipster); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/boundaries/HipsterBoundary.java // public class HipsterBoundary { // private String name; // private String avatar; // private int rating; // private String userId; // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getAvatar() { // return avatar; // } // // public void setAvatar(String avatar) { // this.avatar = avatar; // } // // public int getRating() { // return rating; // } // // public void setRating(int rating) { // this.rating = rating; // } // // public String getUserId() { // return userId; // } // // public void setUserId(String userId) { // this.userId = userId; // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetFeed.java // public interface GetFeed { // Observable<FeedBoundary> getFeed(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetMyLikers.java // public interface GetMyLikers { // Observable<List<String>> getMyLikers(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/LikeHipster.java // public interface LikeHipster { // public Observable<String> like(String userId); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/view/viewmodel/mapper/HipsterViewMapper.java // public interface HipsterViewMapper { // public HipsterViewModel mapper(HipsterBoundary hipsterBoundary); // }
import com.flipper83.protohipster.feed.domain.boundaries.FeedBoundary; import com.flipper83.protohipster.feed.domain.boundaries.HipsterBoundary; import com.flipper83.protohipster.feed.domain.interactors.GetFeed; import com.flipper83.protohipster.feed.domain.interactors.GetMyLikers; import com.flipper83.protohipster.feed.domain.interactors.LikeHipster; import com.flipper83.protohipster.feed.view.viewmodel.mapper.HipsterViewMapper; import java.util.ArrayList; import java.util.Collections; import java.util.List; import rx.Observable; import rx.util.functions.Func1; import rx.util.functions.Func2;
package com.flipper83.protohipster.feed.view.viewmodel; /** * A list of view information Hipsters */ public class FeedViewModel { HipsterViewMapper hipsterViewMapper; GetFeed getFeed; GetMyLikers getMyLikers; LikeHipster likeUser; private List<HipsterViewModel> hipsters = new ArrayList<HipsterViewModel>(); public FeedViewModel(GetFeed getFeed,GetMyLikers getMyLikers,LikeHipster likeUser, HipsterViewMapper mapper) { this.getFeed = getFeed; this.getMyLikers = getMyLikers; this.likeUser = likeUser; this.hipsterViewMapper = mapper; } public void addHipster(HipsterViewModel hipster) { hipsters.add(hipster); } public List<HipsterViewModel> getHipsters() { return Collections.unmodifiableList(hipsters); } public Observable<List<HipsterViewModel>> populateFeed() {
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/boundaries/FeedBoundary.java // public class FeedBoundary { // private boolean success = false; // List<HipsterBoundary> hipsters = new ArrayList<HipsterBoundary>(); // // public boolean isSuccess() { // return success; // } // // public void setSuccess(boolean success) { // this.success = success; // } // // public List<HipsterBoundary> getHipsters() { // return hipsters; // } // // // public void add(HipsterBoundary hipster) { // hipsters.add(hipster); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/boundaries/HipsterBoundary.java // public class HipsterBoundary { // private String name; // private String avatar; // private int rating; // private String userId; // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getAvatar() { // return avatar; // } // // public void setAvatar(String avatar) { // this.avatar = avatar; // } // // public int getRating() { // return rating; // } // // public void setRating(int rating) { // this.rating = rating; // } // // public String getUserId() { // return userId; // } // // public void setUserId(String userId) { // this.userId = userId; // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetFeed.java // public interface GetFeed { // Observable<FeedBoundary> getFeed(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetMyLikers.java // public interface GetMyLikers { // Observable<List<String>> getMyLikers(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/LikeHipster.java // public interface LikeHipster { // public Observable<String> like(String userId); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/view/viewmodel/mapper/HipsterViewMapper.java // public interface HipsterViewMapper { // public HipsterViewModel mapper(HipsterBoundary hipsterBoundary); // } // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/view/viewmodel/FeedViewModel.java import com.flipper83.protohipster.feed.domain.boundaries.FeedBoundary; import com.flipper83.protohipster.feed.domain.boundaries.HipsterBoundary; import com.flipper83.protohipster.feed.domain.interactors.GetFeed; import com.flipper83.protohipster.feed.domain.interactors.GetMyLikers; import com.flipper83.protohipster.feed.domain.interactors.LikeHipster; import com.flipper83.protohipster.feed.view.viewmodel.mapper.HipsterViewMapper; import java.util.ArrayList; import java.util.Collections; import java.util.List; import rx.Observable; import rx.util.functions.Func1; import rx.util.functions.Func2; package com.flipper83.protohipster.feed.view.viewmodel; /** * A list of view information Hipsters */ public class FeedViewModel { HipsterViewMapper hipsterViewMapper; GetFeed getFeed; GetMyLikers getMyLikers; LikeHipster likeUser; private List<HipsterViewModel> hipsters = new ArrayList<HipsterViewModel>(); public FeedViewModel(GetFeed getFeed,GetMyLikers getMyLikers,LikeHipster likeUser, HipsterViewMapper mapper) { this.getFeed = getFeed; this.getMyLikers = getMyLikers; this.likeUser = likeUser; this.hipsterViewMapper = mapper; } public void addHipster(HipsterViewModel hipster) { hipsters.add(hipster); } public List<HipsterViewModel> getHipsters() { return Collections.unmodifiableList(hipsters); } public Observable<List<HipsterViewModel>> populateFeed() {
return Observable.zip(getFeed.getFeed(), getMyLikers.getMyLikers(), new Func2<FeedBoundary, List<String>, List<HipsterViewModel>>() {
flipper83/protohipster
protohipster/src/main/java/com/flipper83/protohipster/feed/view/viewmodel/FeedViewModel.java
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/boundaries/FeedBoundary.java // public class FeedBoundary { // private boolean success = false; // List<HipsterBoundary> hipsters = new ArrayList<HipsterBoundary>(); // // public boolean isSuccess() { // return success; // } // // public void setSuccess(boolean success) { // this.success = success; // } // // public List<HipsterBoundary> getHipsters() { // return hipsters; // } // // // public void add(HipsterBoundary hipster) { // hipsters.add(hipster); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/boundaries/HipsterBoundary.java // public class HipsterBoundary { // private String name; // private String avatar; // private int rating; // private String userId; // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getAvatar() { // return avatar; // } // // public void setAvatar(String avatar) { // this.avatar = avatar; // } // // public int getRating() { // return rating; // } // // public void setRating(int rating) { // this.rating = rating; // } // // public String getUserId() { // return userId; // } // // public void setUserId(String userId) { // this.userId = userId; // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetFeed.java // public interface GetFeed { // Observable<FeedBoundary> getFeed(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetMyLikers.java // public interface GetMyLikers { // Observable<List<String>> getMyLikers(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/LikeHipster.java // public interface LikeHipster { // public Observable<String> like(String userId); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/view/viewmodel/mapper/HipsterViewMapper.java // public interface HipsterViewMapper { // public HipsterViewModel mapper(HipsterBoundary hipsterBoundary); // }
import com.flipper83.protohipster.feed.domain.boundaries.FeedBoundary; import com.flipper83.protohipster.feed.domain.boundaries.HipsterBoundary; import com.flipper83.protohipster.feed.domain.interactors.GetFeed; import com.flipper83.protohipster.feed.domain.interactors.GetMyLikers; import com.flipper83.protohipster.feed.domain.interactors.LikeHipster; import com.flipper83.protohipster.feed.view.viewmodel.mapper.HipsterViewMapper; import java.util.ArrayList; import java.util.Collections; import java.util.List; import rx.Observable; import rx.util.functions.Func1; import rx.util.functions.Func2;
package com.flipper83.protohipster.feed.view.viewmodel; /** * A list of view information Hipsters */ public class FeedViewModel { HipsterViewMapper hipsterViewMapper; GetFeed getFeed; GetMyLikers getMyLikers; LikeHipster likeUser; private List<HipsterViewModel> hipsters = new ArrayList<HipsterViewModel>(); public FeedViewModel(GetFeed getFeed,GetMyLikers getMyLikers,LikeHipster likeUser, HipsterViewMapper mapper) { this.getFeed = getFeed; this.getMyLikers = getMyLikers; this.likeUser = likeUser; this.hipsterViewMapper = mapper; } public void addHipster(HipsterViewModel hipster) { hipsters.add(hipster); } public List<HipsterViewModel> getHipsters() { return Collections.unmodifiableList(hipsters); } public Observable<List<HipsterViewModel>> populateFeed() { return Observable.zip(getFeed.getFeed(), getMyLikers.getMyLikers(), new Func2<FeedBoundary, List<String>, List<HipsterViewModel>>() { @Override public List<HipsterViewModel> call(FeedBoundary feedBoundary, List<String> myLikers) { hipsters.clear();
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/boundaries/FeedBoundary.java // public class FeedBoundary { // private boolean success = false; // List<HipsterBoundary> hipsters = new ArrayList<HipsterBoundary>(); // // public boolean isSuccess() { // return success; // } // // public void setSuccess(boolean success) { // this.success = success; // } // // public List<HipsterBoundary> getHipsters() { // return hipsters; // } // // // public void add(HipsterBoundary hipster) { // hipsters.add(hipster); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/boundaries/HipsterBoundary.java // public class HipsterBoundary { // private String name; // private String avatar; // private int rating; // private String userId; // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getAvatar() { // return avatar; // } // // public void setAvatar(String avatar) { // this.avatar = avatar; // } // // public int getRating() { // return rating; // } // // public void setRating(int rating) { // this.rating = rating; // } // // public String getUserId() { // return userId; // } // // public void setUserId(String userId) { // this.userId = userId; // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetFeed.java // public interface GetFeed { // Observable<FeedBoundary> getFeed(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/GetMyLikers.java // public interface GetMyLikers { // Observable<List<String>> getMyLikers(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/domain/interactors/LikeHipster.java // public interface LikeHipster { // public Observable<String> like(String userId); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/view/viewmodel/mapper/HipsterViewMapper.java // public interface HipsterViewMapper { // public HipsterViewModel mapper(HipsterBoundary hipsterBoundary); // } // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/view/viewmodel/FeedViewModel.java import com.flipper83.protohipster.feed.domain.boundaries.FeedBoundary; import com.flipper83.protohipster.feed.domain.boundaries.HipsterBoundary; import com.flipper83.protohipster.feed.domain.interactors.GetFeed; import com.flipper83.protohipster.feed.domain.interactors.GetMyLikers; import com.flipper83.protohipster.feed.domain.interactors.LikeHipster; import com.flipper83.protohipster.feed.view.viewmodel.mapper.HipsterViewMapper; import java.util.ArrayList; import java.util.Collections; import java.util.List; import rx.Observable; import rx.util.functions.Func1; import rx.util.functions.Func2; package com.flipper83.protohipster.feed.view.viewmodel; /** * A list of view information Hipsters */ public class FeedViewModel { HipsterViewMapper hipsterViewMapper; GetFeed getFeed; GetMyLikers getMyLikers; LikeHipster likeUser; private List<HipsterViewModel> hipsters = new ArrayList<HipsterViewModel>(); public FeedViewModel(GetFeed getFeed,GetMyLikers getMyLikers,LikeHipster likeUser, HipsterViewMapper mapper) { this.getFeed = getFeed; this.getMyLikers = getMyLikers; this.likeUser = likeUser; this.hipsterViewMapper = mapper; } public void addHipster(HipsterViewModel hipster) { hipsters.add(hipster); } public List<HipsterViewModel> getHipsters() { return Collections.unmodifiableList(hipsters); } public Observable<List<HipsterViewModel>> populateFeed() { return Observable.zip(getFeed.getFeed(), getMyLikers.getMyLikers(), new Func2<FeedBoundary, List<String>, List<HipsterViewModel>>() { @Override public List<HipsterViewModel> call(FeedBoundary feedBoundary, List<String> myLikers) { hipsters.clear();
for (HipsterBoundary hipsterBoundary : feedBoundary.getHipsters()) {
flipper83/protohipster
protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/api/ApiRest.java
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/Api.java // public interface Api { // void call(ApiCall apiCall); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/call/ApiCall.java // public abstract class ApiCall { // // protected ApiResponseCallback responseCallback; // // public ApiCall(ApiResponseCallback responseCallback) { // this.responseCallback = responseCallback; // } // // public abstract void call(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/call/rest/ApiRestCall.java // public abstract class ApiRestCall extends ApiCall { // // private RestAdapter restAdapter; // // // public ApiRestCall(ApiResponseCallback responseCallback) { // super(responseCallback); // } // // @Override // public void call(){ // this.call(restAdapter); // } // // public abstract void call(RestAdapter restAdapter); // // // public void setRestAdapter(RestAdapter restAdapter) { // this.restAdapter = restAdapter; // } // }
import com.flipper83.protohipster.feed.datasource.api.Api; import com.flipper83.protohipster.feed.datasource.api.call.ApiCall; import com.flipper83.protohipster.feed.datasource.api.call.rest.ApiRestCall; import javax.inject.Inject; import retrofit.RestAdapter;
package com.flipper83.protohipster.feed.datasource.module.api; /** * */ public class ApiRest implements Api { private final RestAdapter restAdapter; @Inject public ApiRest(RestAdapter restAdapter) { this.restAdapter = restAdapter; } @Override
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/Api.java // public interface Api { // void call(ApiCall apiCall); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/call/ApiCall.java // public abstract class ApiCall { // // protected ApiResponseCallback responseCallback; // // public ApiCall(ApiResponseCallback responseCallback) { // this.responseCallback = responseCallback; // } // // public abstract void call(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/call/rest/ApiRestCall.java // public abstract class ApiRestCall extends ApiCall { // // private RestAdapter restAdapter; // // // public ApiRestCall(ApiResponseCallback responseCallback) { // super(responseCallback); // } // // @Override // public void call(){ // this.call(restAdapter); // } // // public abstract void call(RestAdapter restAdapter); // // // public void setRestAdapter(RestAdapter restAdapter) { // this.restAdapter = restAdapter; // } // } // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/api/ApiRest.java import com.flipper83.protohipster.feed.datasource.api.Api; import com.flipper83.protohipster.feed.datasource.api.call.ApiCall; import com.flipper83.protohipster.feed.datasource.api.call.rest.ApiRestCall; import javax.inject.Inject; import retrofit.RestAdapter; package com.flipper83.protohipster.feed.datasource.module.api; /** * */ public class ApiRest implements Api { private final RestAdapter restAdapter; @Inject public ApiRest(RestAdapter restAdapter) { this.restAdapter = restAdapter; } @Override
public void call(ApiCall apiCall) {
flipper83/protohipster
protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/api/ApiRest.java
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/Api.java // public interface Api { // void call(ApiCall apiCall); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/call/ApiCall.java // public abstract class ApiCall { // // protected ApiResponseCallback responseCallback; // // public ApiCall(ApiResponseCallback responseCallback) { // this.responseCallback = responseCallback; // } // // public abstract void call(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/call/rest/ApiRestCall.java // public abstract class ApiRestCall extends ApiCall { // // private RestAdapter restAdapter; // // // public ApiRestCall(ApiResponseCallback responseCallback) { // super(responseCallback); // } // // @Override // public void call(){ // this.call(restAdapter); // } // // public abstract void call(RestAdapter restAdapter); // // // public void setRestAdapter(RestAdapter restAdapter) { // this.restAdapter = restAdapter; // } // }
import com.flipper83.protohipster.feed.datasource.api.Api; import com.flipper83.protohipster.feed.datasource.api.call.ApiCall; import com.flipper83.protohipster.feed.datasource.api.call.rest.ApiRestCall; import javax.inject.Inject; import retrofit.RestAdapter;
package com.flipper83.protohipster.feed.datasource.module.api; /** * */ public class ApiRest implements Api { private final RestAdapter restAdapter; @Inject public ApiRest(RestAdapter restAdapter) { this.restAdapter = restAdapter; } @Override public void call(ApiCall apiCall) {
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/Api.java // public interface Api { // void call(ApiCall apiCall); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/call/ApiCall.java // public abstract class ApiCall { // // protected ApiResponseCallback responseCallback; // // public ApiCall(ApiResponseCallback responseCallback) { // this.responseCallback = responseCallback; // } // // public abstract void call(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/call/rest/ApiRestCall.java // public abstract class ApiRestCall extends ApiCall { // // private RestAdapter restAdapter; // // // public ApiRestCall(ApiResponseCallback responseCallback) { // super(responseCallback); // } // // @Override // public void call(){ // this.call(restAdapter); // } // // public abstract void call(RestAdapter restAdapter); // // // public void setRestAdapter(RestAdapter restAdapter) { // this.restAdapter = restAdapter; // } // } // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/module/api/ApiRest.java import com.flipper83.protohipster.feed.datasource.api.Api; import com.flipper83.protohipster.feed.datasource.api.call.ApiCall; import com.flipper83.protohipster.feed.datasource.api.call.rest.ApiRestCall; import javax.inject.Inject; import retrofit.RestAdapter; package com.flipper83.protohipster.feed.datasource.module.api; /** * */ public class ApiRest implements Api { private final RestAdapter restAdapter; @Inject public ApiRest(RestAdapter restAdapter) { this.restAdapter = restAdapter; } @Override public void call(ApiCall apiCall) {
ApiRestCall restCall = (ApiRestCall) apiCall;
flipper83/protohipster
protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/call/parse/GetLikesCall.java
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/call/ApiCall.java // public abstract class ApiCall { // // protected ApiResponseCallback responseCallback; // // public ApiCall(ApiResponseCallback responseCallback) { // this.responseCallback = responseCallback; // } // // public abstract void call(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/call/parse/response/GetLikesResponse.java // public class GetLikesResponse { // private static final int NO_EXIST = 0; // // Map<String, Integer> likes = new HashMap<String, Integer>(); // // public void add(String userId, int numLikes) { // likes.put(userId, numLikes); // } // // public int getNumLikes(String userId) { // if (likes.containsKey(userId)) { // return likes.get(userId); // } else { // return NO_EXIST; // } // } // // public Map<String, Integer> getAllLikers() { // return Collections.unmodifiableMap(likes); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/callback/ApiResponseCallback.java // public interface ApiResponseCallback<T> { // void complete(T response); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/LoggerProvider.java // public class LoggerProvider { // // @Inject // static Logger logger; // // public LoggerProvider() { // // } // // public static Logger getLogger() { // return logger; // } // }
import com.flipper83.protohipster.feed.datasource.api.call.ApiCall; import com.flipper83.protohipster.feed.datasource.api.call.parse.response.GetLikesResponse; import com.flipper83.protohipster.feed.datasource.api.callback.ApiResponseCallback; import com.flipper83.protohipster.globalutils.module.LoggerProvider; import com.parse.FindCallback; import com.parse.ParseException; import com.parse.ParseObject; import com.parse.ParseQuery; import java.util.List;
package com.flipper83.protohipster.feed.datasource.api.call.parse; /** * Obtain the number of likes for the users */ public class GetLikesCall extends ApiCall { private static final String LOGTAG = "GetLikesCall"; private final List<String> userIds;
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/call/ApiCall.java // public abstract class ApiCall { // // protected ApiResponseCallback responseCallback; // // public ApiCall(ApiResponseCallback responseCallback) { // this.responseCallback = responseCallback; // } // // public abstract void call(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/call/parse/response/GetLikesResponse.java // public class GetLikesResponse { // private static final int NO_EXIST = 0; // // Map<String, Integer> likes = new HashMap<String, Integer>(); // // public void add(String userId, int numLikes) { // likes.put(userId, numLikes); // } // // public int getNumLikes(String userId) { // if (likes.containsKey(userId)) { // return likes.get(userId); // } else { // return NO_EXIST; // } // } // // public Map<String, Integer> getAllLikers() { // return Collections.unmodifiableMap(likes); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/callback/ApiResponseCallback.java // public interface ApiResponseCallback<T> { // void complete(T response); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/LoggerProvider.java // public class LoggerProvider { // // @Inject // static Logger logger; // // public LoggerProvider() { // // } // // public static Logger getLogger() { // return logger; // } // } // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/call/parse/GetLikesCall.java import com.flipper83.protohipster.feed.datasource.api.call.ApiCall; import com.flipper83.protohipster.feed.datasource.api.call.parse.response.GetLikesResponse; import com.flipper83.protohipster.feed.datasource.api.callback.ApiResponseCallback; import com.flipper83.protohipster.globalutils.module.LoggerProvider; import com.parse.FindCallback; import com.parse.ParseException; import com.parse.ParseObject; import com.parse.ParseQuery; import java.util.List; package com.flipper83.protohipster.feed.datasource.api.call.parse; /** * Obtain the number of likes for the users */ public class GetLikesCall extends ApiCall { private static final String LOGTAG = "GetLikesCall"; private final List<String> userIds;
public GetLikesCall(List<String> userIds, ApiResponseCallback<GetLikesResponse> responseCallback) {
flipper83/protohipster
protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/call/parse/GetLikesCall.java
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/call/ApiCall.java // public abstract class ApiCall { // // protected ApiResponseCallback responseCallback; // // public ApiCall(ApiResponseCallback responseCallback) { // this.responseCallback = responseCallback; // } // // public abstract void call(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/call/parse/response/GetLikesResponse.java // public class GetLikesResponse { // private static final int NO_EXIST = 0; // // Map<String, Integer> likes = new HashMap<String, Integer>(); // // public void add(String userId, int numLikes) { // likes.put(userId, numLikes); // } // // public int getNumLikes(String userId) { // if (likes.containsKey(userId)) { // return likes.get(userId); // } else { // return NO_EXIST; // } // } // // public Map<String, Integer> getAllLikers() { // return Collections.unmodifiableMap(likes); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/callback/ApiResponseCallback.java // public interface ApiResponseCallback<T> { // void complete(T response); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/LoggerProvider.java // public class LoggerProvider { // // @Inject // static Logger logger; // // public LoggerProvider() { // // } // // public static Logger getLogger() { // return logger; // } // }
import com.flipper83.protohipster.feed.datasource.api.call.ApiCall; import com.flipper83.protohipster.feed.datasource.api.call.parse.response.GetLikesResponse; import com.flipper83.protohipster.feed.datasource.api.callback.ApiResponseCallback; import com.flipper83.protohipster.globalutils.module.LoggerProvider; import com.parse.FindCallback; import com.parse.ParseException; import com.parse.ParseObject; import com.parse.ParseQuery; import java.util.List;
package com.flipper83.protohipster.feed.datasource.api.call.parse; /** * Obtain the number of likes for the users */ public class GetLikesCall extends ApiCall { private static final String LOGTAG = "GetLikesCall"; private final List<String> userIds;
// Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/call/ApiCall.java // public abstract class ApiCall { // // protected ApiResponseCallback responseCallback; // // public ApiCall(ApiResponseCallback responseCallback) { // this.responseCallback = responseCallback; // } // // public abstract void call(); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/call/parse/response/GetLikesResponse.java // public class GetLikesResponse { // private static final int NO_EXIST = 0; // // Map<String, Integer> likes = new HashMap<String, Integer>(); // // public void add(String userId, int numLikes) { // likes.put(userId, numLikes); // } // // public int getNumLikes(String userId) { // if (likes.containsKey(userId)) { // return likes.get(userId); // } else { // return NO_EXIST; // } // } // // public Map<String, Integer> getAllLikers() { // return Collections.unmodifiableMap(likes); // } // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/callback/ApiResponseCallback.java // public interface ApiResponseCallback<T> { // void complete(T response); // } // // Path: protohipster/src/main/java/com/flipper83/protohipster/globalutils/module/LoggerProvider.java // public class LoggerProvider { // // @Inject // static Logger logger; // // public LoggerProvider() { // // } // // public static Logger getLogger() { // return logger; // } // } // Path: protohipster/src/main/java/com/flipper83/protohipster/feed/datasource/api/call/parse/GetLikesCall.java import com.flipper83.protohipster.feed.datasource.api.call.ApiCall; import com.flipper83.protohipster.feed.datasource.api.call.parse.response.GetLikesResponse; import com.flipper83.protohipster.feed.datasource.api.callback.ApiResponseCallback; import com.flipper83.protohipster.globalutils.module.LoggerProvider; import com.parse.FindCallback; import com.parse.ParseException; import com.parse.ParseObject; import com.parse.ParseQuery; import java.util.List; package com.flipper83.protohipster.feed.datasource.api.call.parse; /** * Obtain the number of likes for the users */ public class GetLikesCall extends ApiCall { private static final String LOGTAG = "GetLikesCall"; private final List<String> userIds;
public GetLikesCall(List<String> userIds, ApiResponseCallback<GetLikesResponse> responseCallback) {