Skip to content

Commit

Permalink
Add Contact delete.
Browse files Browse the repository at this point in the history
  • Loading branch information
j4rvis committed Jun 8, 2017
1 parent 696270c commit 6eca51e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@
<orderEntry type="library" exported="" name="sqldroid-1.0.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="rules-0.5" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="uiautomator-v18-2.1.2" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="javax.annotation-api-1.2" level="project" />
<orderEntry type="library" exported="" name="lorem-2.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="javax.annotation-api-1.2" level="project" />
<orderEntry type="library" exported="" name="sqlite-jdbc-3.16.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="javax.inject-1" level="project" />
<orderEntry type="library" exported="" name="annotations-2.0.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="javax.inject-1" level="project" />
<orderEntry type="library" exported="" name="rxjava-1.1.0" level="project" />
<orderEntry type="library" exported="" name="android-activation-1.5.5" level="project" />
<orderEntry type="library" exported="" name="android-mail-1.5.5" level="project" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@

import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import net.sharksystem.api.models.Contact;
import net.sharksystem.sharknet.R;
import net.sharksystem.sharknet.RxSingleBaseActivity;

public class ContactDetailActivity extends RxSingleBaseActivity<Contact> {
public class ContactDetailActivity extends RxSingleBaseActivity<Contact> implements View.OnClickListener {

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand Down Expand Up @@ -44,6 +46,9 @@ protected void doOnUIThread(Contact contact) {
}
name.setText(contact.getName());
email.setText(contact.getEmail());

Button buttonDelete = (Button) findViewById(R.id.contact_delete);
buttonDelete.setOnClickListener(this);
}

@Override
Expand All @@ -62,4 +67,10 @@ public boolean onOptionsItemSelected(MenuItem item) {
return super.onOptionsItemSelected(item);
}
}

@Override
public void onClick(View v) {
mApi.removeContact(getSharkApp().getContact());
finish();
}
}

0 comments on commit 6eca51e

Please sign in to comment.