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
| import android.content.Context | |
| import android.graphics.Canvas | |
| import android.util.AttributeSet | |
| import android.view.MotionEvent | |
| import android.view.ScaleGestureDetector | |
| import android.view.ScaleGestureDetector.SimpleOnScaleGestureListener | |
| import androidx.recyclerview.widget.RecyclerView | |
| /** | |
| * Created by Rajat on 11,July,2020 |
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
| List<HttpMessageConverter<?>> messageConverters = new ArrayList<HttpMessageConverter<?>>(); | |
| //Add the Jackson Message converter | |
| MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); | |
| // Note: here we are making this converter to process any kind of response, | |
| // not only application/*json, which is the default behaviour | |
| converter.setSupportedMediaTypes(Collections.singletonList(MediaType.ALL)); | |
| messageConverters.add(converter); | |
| RestTemplate restTemplate = new RestTemplate(); |
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 boolean isOnline() { | |
| ConnectivityManager cm = | |
| (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); | |
| NetworkInfo netInfo = cm.getActiveNetworkInfo(); | |
| if (netInfo != null && netInfo.isConnectedOrConnecting()) { | |
| return true; | |
| } | |
| return false; | |
| } |
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 val requiredPermissionList = arrayOf( | |
| //list of permissions | |
| Manifest.permission.WRITE_EXTERNAL_STORAGE, | |
| Manifest.permission.READ_EXTERNAL_STORAGE | |
| ) | |
| private fun checkAndRequestPermission(): Boolean { | |
| val permissionsNeeded = ArrayList<String>() | |
| for (permission in requiredPermissionList) { |
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
| nestedscrollview.fullScroll(View.FOCUS_UP) |
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
| setSupportActionBar(toolbar) | |
| supportActionBar?.setDisplayHomeAsUpEnabled(true) | |
| supportActionBar?.setDisplayShowHomeEnabled(true) | |
| supportActionBar?.setDisplayShowTitleEnabled(false) | |
| //To change the color | |
| <style name="MyToolbarStyle"> | |
| <item name="android:minHeight">?actionBarSize</item> | |
| <item name="popupTheme">@style/ThemeOverlay.AppCompat.Light</item> |
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
| import android.Manifest | |
| import android.os.Bundle | |
| import android.support.v4.app.Fragment | |
| import android.view.LayoutInflater | |
| import android.view.View | |
| import android.view.ViewGroup | |
| import kotlinx.android.synthetic.main.addcare_addphoto_fragment.* | |
| import android.content.Intent | |
| import android.content.pm.PackageManager |
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 (!recyclerView.canScrollVertically(-1)) { | |
| Log.d("status", "Top reached") | |
| } |