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
StorageReference fileRef = mStorageRef.child(System.currentTimeMillis() + "." + "jpg"); | |
fileRef.putFile(mImageUri) | |
.addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() { | |
@Override | |
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) { | |
//upload success in firebase storage | |
Toast.makeText(MainActivity.this, "Upload success", Toast.LENGTH_SHORT).show(); | |
//setup to get download url | |
Task<Uri> downloadUri = taskSnapshot.getMetadata().getReference().getDownloadUrl(); |
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 void deleteCurrentTodoItem(final int position) { | |
mRealm.executeTransaction(new Realm.Transaction() { | |
@Override | |
public void execute(Realm realm) { | |
//needed appropriate action for db manipulation | |
//I've used realmDb so, use next line if your using realmDb | |
//and need to deleteItem from db | |
//otherwise write your code to implement required functionality | |
mRealmTodoList.deleteFromRealm(position); | |
notifyDataSetChanged(); |
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 void deleteTodoItem() { | |
//Swipe to delete currentTodo Item | |
new ItemTouchHelper(new ItemTouchHelper.SimpleCallback(0, | |
ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT) { | |
//private Drawable icon = ContextCompat.getDrawable(getApplicationContext(),R.drawable.icon_delete); | |
private ColorDrawable background = new ColorDrawable(Color.RED); | |
@Override |
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
package com.theappnerds.shubham.myshimmer; | |
import android.os.Bundle; | |
import android.support.v7.app.AppCompatActivity; | |
import android.support.v7.widget.DividerItemDecoration; | |
import android.support.v7.widget.LinearLayoutManager; | |
import android.support.v7.widget.RecyclerView; | |
import android.view.View; | |
import android.widget.Toast; |
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
package com.theappnerds.shubham.myshimmer; | |
import android.content.Context; | |
import android.support.annotation.NonNull; | |
import android.support.v7.widget.RecyclerView; | |
import android.view.LayoutInflater; | |
import android.view.View; | |
import android.view.ViewGroup; | |
import android.widget.ImageView; | |
import android.widget.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
package com.theappnerds.shubham.myshimmer; | |
public class BookItem { | |
int id; | |
String name; | |
String description; | |
double price; | |
String thumbnail; | |
String author; |
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" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:padding="@dimen/activity_padding"> | |
<!-- placeholder layout --> | |
<View | |
android:id="@+id/thumbnail" | |
android:layout_width="@dimen/placeholder_image" |
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" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:background="@android:color/white" | |
android:clickable="true" | |
android:focusable="true" | |
android:foreground="?attr/selectableItemBackground" | |
android:padding="@dimen/activity_padding_horizontal"> |
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"?> | |
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:shimmer="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:background="@android:color/white" | |
tools:context=".MainActivity"> |
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
intentSMS.setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View v) { | |
Intent intent = new Intent(Intent.ACTION_SENDTO); | |
String phoneNumber = "1234567890"; | |
String message = "hey there..."; | |
intent.setData(Uri.parse("smsto:" + phoneNumber)); | |
intent.putExtra("sms_body", message); | |
if (intent.resolveActivity(getPackageManager()) != null) { |