This file contains 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 boolean isLoading = false; | |
private boolean isEndOfList = false; | |
private String currentPage = "1"; | |
. | |
. | |
. | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
. |
This file contains 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
/* configure Search */ | |
private void configureSearch() { | |
// add text change listener for searchView | |
searchView.addTextChangedListener(searchTextWatcher); | |
// set search Suggestion Adapter | |
searchSuggestionAdapter = new ArrayAdapter<>(this, android.R.layout.simple_dropdown_item_1line); | |
searchView.setAdapter(searchSuggestionAdapter); | |
searchView.setThreshold(2); |
This file contains 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 ResponseWrapper<T> { | |
@NonNull | |
private Status status; | |
@Nullable | |
private T data; | |
@Nullable | |
private Integer errorCode; |
This file contains 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 CustomeRecyclerViewAdapter extends RecyclerView.Adapter<CustomeRecyclerViewAdapter.CustomViewHolder> { | |
private Context mContext; | |
private List<T> dataList = new ArrayList<>(); | |
private OnItemClickedListener onItemClickedListener; | |
// for load more | |
private final int VIEW_TYPE_ITEM = 0; | |
private final int VIEW_TYPE_LOADING = 1; | |
private OnLoadMoreListener onLoadMoreListener; |
This file contains 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 BaseAdapter<T>(private val itemClickListener: OnItemClickListener<T>) : | |
RecyclerView.Adapter<BaseAdapter<T>.MyViewHolder>() { | |
interface OnItemClickListener<T> { | |
fun onItemClick(item: T) | |
} | |
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolder { | |
val binding = DataBindingUtil.inflate<ViewDataBinding>( | |
LayoutInflater.from(parent.context), |
This file contains 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
open class BaseActivity : AppCompatActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
val configuration: Configuration = resources.configuration | |
configuration.setLayoutDirection(Locale("fa")) | |
resources.updateConfiguration(configuration, resources.displayMetrics) | |
} | |
} |
This file contains 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
<application | |
... | |
android:theme="@style/AppTheme"> | |
<activity | |
android:name=".ui.main.MainActivity" | |
android:label="@string/app_name" /> | |
<activity | |
android:name=".ui.main.SplashScreenActivity" | |
android:configChanges="orientation|keyboardHidden|screenSize" | |
android:theme="@style/FullscreenTheme"> |
This file contains 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"?> | |
<shape xmlns:android="http://schemas.android.com/apk/res/android" | |
android:shape="oval"> | |
<solid android:color="@color/numbersCircleBG" /> | |
<size | |
android:width="120dp" | |
android:height="120dp" /> | |
</shape> |
This file contains 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
fun convertImageToBase64(imageFile: File): String { | |
return ByteArrayOutputStream().use { outputStream -> | |
Base64OutputStream(outputStream, Base64.DEFAULT).use { base64FilterStream -> | |
imageFile.inputStream().use { inputStream -> | |
inputStream.copyTo(base64FilterStream) | |
} | |
} | |
return@use outputStream.toString() | |
} | |
} |
OlderNewer