Skip to content

Instantly share code, notes, and snippets.

View m-asadullah's full-sized avatar
🚩
Focusing

M. AsadUllah m-asadullah

🚩
Focusing
View GitHub Profile
public class CustomSearchViewActivity extends AppCompatActivity {
LinearLayout linearLayoutSearch;
EditText editTextSearch;
ImageButton imageButtonClearSearch;
ImageButton imageButtonVoiceSearch;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@m-asadullah
m-asadullah / CardViewClickable.xml
Created March 27, 2021 08:50
Clickable CardView or Ripple Effect
android:foreground="?android:attr/selectableItemBackground"
android:clickable="true"
or
android:foreground="?attr/selectableItemBackgroundBorderless"
String dstPath = Environment.getExternalStorageDirectory() + File.separator + "myApp" + File.separator;
File dst = new File(dstPath);
exportFile(pictureFile, dst);
}
private File exportFile(File src, File dst) throws IOException {
//if folder does not exist
if (!dst.exists()) {
@m-asadullah
m-asadullah / gist:96e4fff4e0c1c95d4af3f9eb3e920f1c
Created March 27, 2021 07:59
hideFABonScrollRecyclerView
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
if (dy > 0 || dy < 0 && fab.isShown())
fab.hide();
}
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
/**
* Get the total disk space available on this Android Device
*
* @return total size (in bytes) that is the total disk space available on the device.
*/
public static long getTotalDiskSpace() {
StatFs statFs = new StatFs(Environment.getRootDirectory().getAbsolutePath());
return statFs.getBlockCountLong() * statFs.getBlockSizeLong();
}