-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from virresh/temp_merges
Temp merges
- Loading branch information
Showing
65 changed files
with
1,487 additions
and
803 deletions.
There are no files selected for viewing
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
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
94 changes: 94 additions & 0 deletions
94
app/src/main/java/com/mobilecomputing/sahayak/Activities/EditProposalActivity.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
package com.mobilecomputing.sahayak.Activities; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.appcompat.app.AppCompatActivity; | ||
import androidx.recyclerview.widget.ItemTouchHelper; | ||
import androidx.recyclerview.widget.LinearLayoutManager; | ||
import androidx.recyclerview.widget.RecyclerView; | ||
|
||
import android.content.Intent; | ||
import android.graphics.Color; | ||
import android.os.Bundle; | ||
import android.util.Log; | ||
import android.view.View; | ||
import android.widget.SearchView; | ||
|
||
import com.google.android.material.snackbar.Snackbar; | ||
import com.google.firebase.database.DatabaseReference; | ||
import com.google.firebase.database.FirebaseDatabase; | ||
import com.mobilecomputing.sahayak.Adapters.EditProposalAdapter; | ||
import com.mobilecomputing.sahayak.JavaClasses.Proposal; | ||
import com.mobilecomputing.sahayak.JavaClasses.EditProposalLab; | ||
import com.mobilecomputing.sahayak.JavaClasses.SwipeToDelete; | ||
import com.mobilecomputing.sahayak.R; | ||
|
||
import java.util.List; | ||
|
||
import static com.mobilecomputing.sahayak.Fragments.proposalShowFragment.TAG; | ||
|
||
public class EditProposalActivity extends AppCompatActivity { | ||
public static List<Proposal> proposals; | ||
EditProposalAdapter mAdapter; | ||
SearchView searchView; | ||
RecyclerView mentorProposalView; | ||
EditProposalLab proposalLab; | ||
View view; | ||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_edit_proposal); | ||
view = findViewById(R.id.edit_proposal); | ||
LinearLayoutManager linearLayoutManager; | ||
|
||
mentorProposalView = (RecyclerView) findViewById(R.id.edit_proposal); | ||
mentorProposalView.setLayoutManager(new LinearLayoutManager(this)); | ||
linearLayoutManager = new LinearLayoutManager(this); | ||
proposalLab = EditProposalLab.get(getApplicationContext()); | ||
proposals = proposalLab.getProposals(); | ||
|
||
mAdapter = new EditProposalAdapter(this, proposals,proposalLab); | ||
mAdapter.setClickListener(new EditProposalAdapter.ItemClickListener() { | ||
@Override | ||
public void onItemClick(View view, int position) { | ||
Proposal p = mAdapter.getItem(position); | ||
// Intent intent = new Intent(EditProposalActivity.this, IndividualProposalActivity.class); | ||
// startActivity(intent); | ||
} | ||
}); | ||
mentorProposalView.setAdapter(mAdapter); | ||
enableSwipeToDeleteAndUndo(); | ||
} | ||
public void enableSwipeToDeleteAndUndo(){ | ||
SwipeToDelete swipeToDeleteCallback = new SwipeToDelete(this) { | ||
@Override | ||
public void onSwiped(@NonNull RecyclerView.ViewHolder viewHolder, int i) { | ||
|
||
|
||
int position = viewHolder.getAdapterPosition(); | ||
Proposal item = mAdapter.getItem(position); | ||
Log.d(TAG,"Delete Position" + Integer.toString(position)); | ||
mAdapter.removeProposal(item,position); | ||
|
||
|
||
Snackbar snackbar = Snackbar | ||
.make(view, "Item was removed from the list.", Snackbar.LENGTH_LONG); | ||
snackbar.setAction("UNDO", new View.OnClickListener() { | ||
@Override | ||
public void onClick(View view) { | ||
|
||
mAdapter.restoreItem(item, position); | ||
} | ||
}); | ||
|
||
snackbar.setActionTextColor(Color.YELLOW); | ||
snackbar.show(); | ||
|
||
} | ||
}; | ||
|
||
ItemTouchHelper itemTouchhelper = new ItemTouchHelper(swipeToDeleteCallback); | ||
itemTouchhelper.attachToRecyclerView(mentorProposalView); | ||
} | ||
|
||
|
||
} |
16 changes: 16 additions & 0 deletions
16
app/src/main/java/com/mobilecomputing/sahayak/Activities/IndividualProposalActivity.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.mobilecomputing.sahayak.Activities; | ||
|
||
import androidx.appcompat.app.AppCompatActivity; | ||
|
||
import android.os.Bundle; | ||
|
||
import com.mobilecomputing.sahayak.R; | ||
|
||
public class IndividualProposalActivity extends AppCompatActivity { | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_individual_proposal); | ||
} | ||
} |
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
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
Oops, something went wrong.