This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| StatusResponse statusResponse = new StatusResponse(param1,param2,new StatusInterface(){ | |
| @Override | |
| public void returnResponse(int status){ | |
| switch(status){ | |
| case 1: //do your stuff | |
| break; | |
| case 2: //do your stuff | |
| break; | |
| default: | |
| break; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| View dialogView = getLayoutInflater().inflate(R.layout.custom_dialog, null); | |
| Dialog customDialog = new Dialog(this, R.style.CustomDialog); | |
| customDialog.setContentView(dialogView); | |
| customDialog.setCancelable(true); | |
| customDialog.getWindow().setLayout(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT); | |
| customDialog.show(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class TimeAgoUtils{ | |
| public static String getValue(String yourPostingTime){ | |
| SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", new Locale("id", "ID")); //set your locale | |
| Date postDate; | |
| Date currentDate; | |
| try { | |
| AppController.inputDate2.setTimeZone(TimeZone.getTimeZone("GMT+7")); //set your GMT server current time | |
| postDate = sdf1.parse(yourPostingTime); | |
| long postDateTime = postDate.getTime(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { | |
| @Override | |
| public void onScrollStateChanged(RecyclerView recyclerView, int newState) { | |
| if (newState == RecyclerView.SCROLL_STATE_IDLE) { | |
| LinearLayoutManager layout = (LinearLayoutManager) recyclerView.getLayoutManager(); | |
| int currentPosition = layout.findFirstVisibleItemPosition() - 1; | |
| try { | |
| Logger.d("currentPosition : " + currentPosition + "temp : " + previousPosition); | |
| if (responseItemList.get(currentPosition).getFile().get(0).getAttachment_type().toLowerCase() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="utf-8"?> | |
| <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| xmlns:tools="http://schemas.android.com/tools" | |
| android:id="@+id/layout_order_progress_status" | |
| android:layout_width="wrap_content" | |
| android:layout_height="fill_parent" | |
| android:layout_weight="1.0" | |
| tools:ignore="all"> | |
| <TextView |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public interface ClickListener { | |
| void onClick(View view, int position); | |
| void onLongClick(View view, int position); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private fun generateTextInputLayout(count: Int) { | |
| ll_root.removeAllViews() // remove prevous TextInputEditText on root layout | |
| for (item in 1..count) { | |
| //create textInputLayout | |
| val textInputLayout = TextInputLayout(this) | |
| ll_root.addView(textInputLayout) // add View TextInputLayout in LinearLayout | |
| //create textInputEditText | |
| val textInputEditText = TextInputEditText(this) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class CounterActivity extends AppCompatActivity { | |
| private int nilaiSkor = 0; | |
| private TextView tvCounter; | |
| @Override | |
| protected void onCreate(Bundle savedInstanceState) { | |
| super.onCreate(savedInstanceState); | |
| setContentView(R.layout.activity_counter); // layout counter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME}#end | |
| import android.support.v7.widget.RecyclerView | |
| import android.view.LayoutInflater | |
| import android.view.View | |
| import android.view.ViewGroup | |
| import java.util.* | |
| #parse("File Header.java") | |
| class ${NAME} (private val dataList:List<${Model_Class}>): RecyclerView.Adapter<${NAME}.${ViewHolder_Class}>() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| abstract class NetworkBoundResource<ResultType, RequestType> { | |
| private lateinit var result: Flowable<Resource<ResultType>> | |
| init { | |
| // Lazy disk observable. | |
| val diskObservable = Flowable.defer { | |
| loadFromDb() | |
| // Read from disk on Computation Scheduler | |
| .subscribeOn(Schedulers.computation()) |
OlderNewer